diff --git a/build/browser/index.js b/build/browser/index.js index c075209..ee50f52 100644 --- a/build/browser/index.js +++ b/build/browser/index.js @@ -1,2 +1,2 @@ -(()=>{var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};(()=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(){r=function(){return t};var e,t={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function p(e,t,n,r){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),s=new P(r||[]);return a(i,"_invoke",{value:L(e,n,s)}),i}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var f="suspendedStart",g="suspendedYield",m="executing",v="completed",y={};function b(){}function w(){}function k(){}var x={};d(x,c,(function(){return this}));var S=Object.getPrototypeOf,C=S&&S(S(_([])));C&&C!==o&&i.call(C,c)&&(x=C);var I=k.prototype=b.prototype=Object.create(x);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(o,a,s,c){var l=h(e[o],e,a);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==n(d)&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,s,c)}),(function(e){r("throw",e,s,c)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function L(t,n,r){var o=f;return function(i,a){if(o===m)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var c=O(s,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===f)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=m;var l=h(t,n,r);if("normal"===l.type){if(o=r.done?v:g,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=v,r.method="throw",r.arg=l.arg)}}}function O(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=h(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function _(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nqu});var c=function(e,t,n){var r,o,i,a,s,c,l;switch(e){case"meta":null===(r=n.onMeta)||void 0===r||r.call(n,t);break;case"token":null===(o=n.onToken)||void 0===o||o.call(n,t);break;case"tool_start":null===(i=n.onToolStart)||void 0===i||i.call(n,t);break;case"tool_end":null===(a=n.onToolEnd)||void 0===a||a.call(n,t);break;case"done":null===(s=n.onDone)||void 0===s||s.call(n,t);break;case"error":null===(c=n.onError)||void 0===c||c.call(n,t);break;case"handoff":null===(l=n.onHandoff)||void 0===l||l.call(n,t)}},l=function(){var e,t=(e=r().mark((function e(t,n){var i,a,s,l,u,d,p,h,f,g,m,v,y,b,w,k,x,S;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.body){e.next=3;break}return null===(i=n.onError)||void 0===i||i.call(n,{message:"No response body."}),e.abrupt("return");case 3:a=t.body.getReader(),s=new TextDecoder,l="",u="",d="",e.prev=8;case 9:return e.next=12,a.read();case 12:if(h=e.sent,f=h.done,g=h.value,!f){e.next=17;break}return e.abrupt("break",24);case 17:l+=s.decode(g,{stream:!0}),m=l.split("\n"),l=null!==(p=m.pop())&&void 0!==p?p:"",v=o(m);try{for(v.s();!(y=v.n()).done;)if(b=y.value,(w=b.replace(/\r$/,"")).startsWith("event: "))u=w.slice(7).trim();else if(w.startsWith("data: "))d+=(d?"\n":"")+w.slice(6);else if(""===w){if(u&&d)try{k=JSON.parse(d),c(u,k,n)}catch(r){}u="",d=""}}catch(C){v.e(C)}finally{v.f()}e.next=9;break;case 24:if(u&&d)try{x=JSON.parse(d),c(u,x,n)}catch(I){}e.next=30;break;case 27:e.prev=27,e.t0=e.catch(8),"AbortError"!==(null===e.t0||void 0===e.t0?void 0:e.t0.name)&&(null===(S=n.onError)||void 0===S||S.call(n,{message:"Stream interrupted."}));case 30:case"end":return e.stop()}}),e,null,[[8,27]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){a(i,r,o,s,c,"next",e)}function c(e){a(i,r,o,s,c,"throw",e)}s(void 0)}))});return function(e,n){return t.apply(this,arguments)}}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t=200&&i.status<300)try{r(i.responseText?JSON.parse(i.responseText):null)}catch(e){o({status:i.status,statusText:"JSON Parse Error",error:e})}else o({status:i.status,statusText:i.statusText,responseText:i.responseText})},i.onerror=function(){return o({status:0,statusText:"Network Error"})},i.send(n?JSON.stringify(n):null)}))}},{key:"streamAgent",value:(o=h().mark((function e(t,n,r,o){var i,a,s,c,u,d,p;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.executeInFlight.get(t)){e.next=2;break}return e.abrupt("return");case 2:if(this.executeInFlight.set(t,!0),i=this._getApiUrl()){e.next=8;break}return this.executeInFlight.delete(t),null===(a=r.onError)||void 0===a||a.call(r,{message:"Gleap API URL not configured."}),e.abrupt("return");case 8:return s="".concat(i,"/v3/shared/agents/").concat(t,"/stream"),c=g(g({},this._getHeaders()),{},{Accept:"text/event-stream"}),e.prev=10,e.next=13,fetch(s,{method:"POST",headers:c,body:JSON.stringify(n),signal:o});case 13:u=e.sent,e.next=23;break;case 16:if(e.prev=16,e.t0=e.catch(10),this.executeInFlight.delete(t),"AbortError"!==(null===e.t0||void 0===e.t0?void 0:e.t0.name)){e.next=21;break}return e.abrupt("return");case 21:return null===(d=r.onError)||void 0===d||d.call(r,{message:"Failed to connect to agent."}),e.abrupt("return");case 23:if(u.ok){e.next=27;break}return this.executeInFlight.delete(t),null===(p=r.onError)||void 0===p||p.call(r,{message:"Server error: ".concat(u.status)}),e.abrupt("return");case 27:return e.next=29,l(u,r);case 29:n.conversationId&&this._invalidateMessagesCache(n.conversationId),this.executeInFlight.delete(t);case 31:case"end":return e.stop()}}),e,this,[[10,16]])})),i=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){m(i,n,r,a,s,"next",e)}function s(e){m(i,n,r,a,s,"throw",e)}a(void 0)}))},function(e,t,n,r){return i.apply(this,arguments)})},{key:"executeAgent",value:function(e,t){var n=this;if(this.executeInFlight.get(e))return Promise.reject(new Error("Agent execution already in progress."));var r=this._getApiUrl();if(!r)return Promise.reject(new Error("AgentNetworkManager: Gleap API URL not configured."));this.executeInFlight.set(e,!0);var o="".concat(r,"/v3/shared/agents/").concat(e,"/execute");return this._makeRequest("POST",o,t).then((function(e){return t.conversationId&&n._invalidateMessagesCache(t.conversationId),null!=e&&e.conversationId&&n._invalidateMessagesCache(e.conversationId),e})).finally((function(){n.executeInFlight.delete(e)}))}},{key:"getConversationMessages",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if("kai"===e)return Promise.resolve({messages:[]});var i="".concat(t,":").concat(r,":").concat(o),a=this.messagesCache.get(i);if(a)return a.status===w?Promise.resolve(JSON.parse(JSON.stringify(a.data))):Promise.reject(a.error);if(this.messagesRequests.has(i))return this.messagesRequests.get(i).then((function(e){return JSON.parse(JSON.stringify(e))}));var s=this._getApiUrl();if(!s)return Promise.reject(new Error("AgentNetworkManager: Gleap API URL not configured."));var c="".concat(s,"/v3/shared/agents/").concat(e,"/conversations/").concat(t,"/messages?limit=").concat(r,"&skip=").concat(o),l=this._makeRequest("GET",c,null).then((function(e){return n.messagesCache.set(i,{status:w,data:e}),JSON.parse(JSON.stringify(e))})).catch((function(e){throw n.messagesCache.set(i,{status:k,error:e}),e})).finally((function(){n.messagesRequests.delete(i)}));return this.messagesRequests.set(i,l),l.then((function(e){return JSON.parse(JSON.stringify(e))}))}},{key:"getConversations",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if("kai"===e)return Promise.resolve({conversations:[]});var r=this._getApiUrl();return r?this._makeRequest("GET","".concat(r,"/v3/shared/agents/").concat(e,"/conversations?limit=").concat(t,"&skip=").concat(n),null):Promise.reject(new Error("AgentNetworkManager: Gleap API URL not configured."))}},{key:"_invalidateMessagesCache",value:function(e){var t,n=d(this.messagesCache.keys());try{for(n.s();!(t=n.n()).done;){var r=t.value;r.startsWith(e+":")&&this.messagesCache.delete(r)}}catch(s){n.e(s)}finally{n.f()}var o,i=d(this.messagesRequests.keys());try{for(i.s();!(o=i.n()).done;){var a=o.value;a.startsWith(e+":")&&this.messagesRequests.delete(a)}}catch(s){i.e(s)}finally{i.f()}}}],r=[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}],n&&v(t.prototype,n),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();y(x,"instance",null);const S=x;function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function I(e,t){for(var n=0;n=200&&i.status<300)try{var e=i.responseText?JSON.parse(i.responseText):null;r(e)}catch(t){o({status:i.status,statusText:"JSON Parse Error",responseText:i.responseText,error:t})}else o({status:i.status,statusText:i.statusText,responseText:i.responseText})},i.onerror=function(){o({status:0,statusText:"Network Error",responseText:null})},i.send(n?JSON.stringify(n):null)}))}},{key:"_createCacheKey",value:function(e,t){return t?"".concat(e,"::").concat(t):e}},{key:"validateChecklist",value:function(e,t){var n=this,r=this._createCacheKey(e,t),o=this.validationCache.get(r);if(o)return o.status===L?Promise.resolve(o.internalId):Promise.reject(o.error);if(this.validationRequests.has(r))return this.validationRequests.get(r);var i=this._getApiUrl();if(!i){var a=new Error("ChecklistNetworkManager: Gleap API URL not configured.");return this.validationCache.set(r,{status:O,error:a}),Promise.reject(a)}var s="".concat(i,"/outbound/checklists?").concat(this._getQueryParams()),c=this._makeRequest("POST",s,{outboundId:e,sharedKey:t}).then((function(e){if(e&&e.id)return n.validationCache.set(r,{status:L,internalId:e.id}),e.id;var t=new Error("Validation response missing checklist ID.");throw n.validationCache.set(r,{status:O,error:e||t}),t})).catch((function(e){throw n.validationCache.set(r,{status:O,error:e}),e})).finally((function(){n.validationRequests.delete(r)}));return this.validationRequests.set(r,c),c}},{key:"fetchChecklist",value:function(e){var t=this,n=this.fetchCache.get(e);if(n)return n.status===L?Promise.resolve(JSON.parse(JSON.stringify(n.data))):Promise.reject(n.error);if(this.fetchRequests.has(e))return this.fetchRequests.get(e).then((function(e){return JSON.parse(JSON.stringify(e))}));var r=this._getApiUrl();if(!r){var o=new Error("ChecklistNetworkManager: Gleap API URL not configured.");return this.fetchCache.set(e,{status:O,error:o}),Promise.reject(o)}var i="".concat(r,"/outbound/checklists/").concat(e,"?convertTipTap=true&").concat(this._getQueryParams()),a=this._makeRequest("GET",i,null).then((function(n){if(n)return t.fetchCache.set(e,{status:L,data:n}),JSON.parse(JSON.stringify(n));var r=new Error("Empty response received for checklist fetch.");throw t.fetchCache.set(e,{status:O,error:n||r}),r})).catch((function(n){throw t.fetchCache.set(e,{status:O,error:n}),n})).finally((function(){t.fetchRequests.delete(e)}));return this.fetchRequests.set(e,a),a.then((function(e){return JSON.parse(JSON.stringify(e))}))}}])&&I(t.prototype,n),r&&I(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();T(M,"instance",null);const A=M;function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function _(e,t){for(var n=0;n0&&!Si.getInstance().isOpened()?(t.classList.remove(n),t.innerText=e):t.classList.add(n)}}},{key:"refresh",value:function(){document.querySelector(".bb-feedback-button")?(this.updateFeedbackButtonText(),this.updateFeedbackButtonState()):(this.injectedFeedbackButton=!1,this.feedbackButton=null,this.buttonHidden=null,this.lastButtonIcon=null,this.injectFeedbackButton())}},{key:"updateFeedbackButtonText",value:function(){var t=Ln.getInstance().getFlowConfig();if(t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC||t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC_BOTTOM||t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC_LEFT){var n=document.querySelector(".bb-feedback-button-classic");n&&(n.innerText=t.widgetButtonText)}}},{key:"updateFeedbackButtonState",value:function(){if(Wt.getInstance().updateUIVisibility(),null!==this.feedbackButton){var t=Ln.getInstance().getFlowConfig(),n="";n=t.buttonLogo?''):H("button","#fff"),this.feedbackButton.className="bb-feedback-button gleap-font rr-block",this.feedbackButton.setAttribute("dir",Ou.getInstance().isRTLLayout?"rtl":"ltr"),t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC||t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC_BOTTOM||t.feedbackButtonPosition===e.FEEDBACK_BUTTON_CLASSIC_LEFT?(this.feedbackButton.classList.add("bb-feedback-button--classic-button-style"),this.feedbackButton.innerHTML='
').concat(t.widgetButtonText,"
")):n!==this.lastButtonIcon&&(this.feedbackButton.innerHTML='
'.concat(n).concat(H("arrowdown","#fff"),'
')),this.lastButtonIcon=n;var r=!1;null===e.getInstance().buttonHidden?t.feedbackButtonPosition===e.FEEDBACK_BUTTON_NONE&&(r=!0):e.getInstance().buttonHidden&&(r=!0),r&&this.feedbackButton.classList.add("bb-feedback-button--disabled"),t.feedbackButtonPosition===e.FEEDBACK_BUTTON_BOTTOM_LEFT&&this.feedbackButton.classList.add("bb-feedback-button--bottomleft"),Si.getInstance().isOpened()&&this.feedbackButton.classList.add("bb-feedback-button--open");var o=Si.getInstance().appMode;"survey"!==o&&"survey_full"!==o&&"survey_web"!==o||this.feedbackButton.classList.add("bb-feedback-button--survey"),!0!==t.hideForGuests||Qo.getInstance().isUser()||this.feedbackButton.classList.add("bb-feedback-button--hidden")}}}])&&_(t.prototype,n),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=160?"#000000":"#ffffff"},H=function(e,t){return"button"===e?'':"drag"===e?'\x3c!--!Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--\x3e':"unmute"===e?'':"mute"===e?'':"replay"===e?'\n \n ':"dismiss"===e?'':"blur"===e?'\n \n':"pen"===e?'\n \n \n \n \n \n \n \n \n \n \n \n \n':"rect"===e?'\n \n \n \n \n \n \n \n \n \n \n':"pointer"===e?'\n \n ':"clip"===e?'\n \n \n \n \n \n':"mic"===e?'\n \n \n \n \n ':"camera"===e?'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n':"recorderon"===e?'\n \n \n \n \n \n \n \n \n \n \n \n':"recorderoff"===e?'\n \n \n \n \n \n \n \n \n ':"arrowdown"===e?'\n \n '):"arrowleft"===e?'\n \n '):"close"===e?'\n \n '):"undo"===e?'\n \n \n \n \n \n \n \n \n \n ':"circle-dot"===e?''):"circle-question"===e?''):"circle-info"===e?''):"circle-exclamation"===e?''):"circle-up"===e?''):"circle-right"===e?''):""};function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(e,t){for(var n=0;n=a-i;++s)n[i]=t[s],Z(e,t,n,s+1,o,i+1,a);else e.push(n.slice(0,i).join(""))}function Q(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:["id","class","length"];return Q(e.attributes).reduce((function(e,n){return t.indexOf(n.nodeName)>-1||e.push("[".concat(n.nodeName,'="').concat(n.value,'"]')),e}),[])}(e,n)},Class:$,ID:Y};return t.reduce((function(t,n){return t[n]=r[n](e),t}),{})}function le(e,t){try{var n=e.parentNode.querySelectorAll(t);return 1===n.length&&n[0]===e}catch(r){return!1}}function ue(e,t){return t.find(le.bind(null,e))}function de(e,t,n){var r=function(e,t){for(var n=[],r=e.length,o=[],i=1;i<=t;++i)Z(n,e,o,0,r-1,0,i);return n}(t,3),o=ue(e,r);return Boolean(o)||Boolean(n)&&(o=ue(e,r=r.map((function(e){return n+e}))),Boolean(o))?o:null}function pe(e,t,n,r){var o,i=ce(e,t,n);r&&r instanceof RegExp&&(i.ID=r.test(i.ID)?null:i.ID,i.Class=i.Class.filter((function(e){return!r.test(e)})));var a,s=ae(t);try{for(s.s();!(a=s.n()).done;){var c=a.value,l=i.ID,u=i.Tag,d=i.Class,p=i.Attributes,h=i.NthChild;switch(c){case"ID":if(Boolean(l)&&le(e,l))return l;break;case"Tag":if(Boolean(u)&&le(e,u))return u;break;case"Class":if(Boolean(d)&&d.length&&(o=de(e,d,u)))return o;break;case"Attributes":if(Boolean(p)&&p.length&&(o=de(e,p,u)))return o;break;case"NthChild":if(Boolean(h))return h}}}catch(f){s.e(f)}finally{s.f()}return"*"}function he(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.selectorTypes,o=void 0===r?["ID","Class","Tag","NthChild"]:r,i=n.attributesToIgnore,a=void 0===i?["id","class","length"]:i,s=n.excludeRegex,c=void 0===s?null:s,l=[],u=function(e){for(var t=[],n=e;ne(n);)t.push(n),n=n.parentNode;return t}(e),d=ae(u);try{for(d.s();!(t=d.n()).done;){var p=pe(t.value,o,a,c);Boolean(p)&&l.push(p)}}catch(y){d.e(y)}finally{d.f()}for(var h=[],f=0,g=l;f ");if(ie(e,v))return v}return null}var fe=function(e){return'(?:[^"]*[^a-zA-Z0-9])?(?:'.concat(e.join("|"),")")},ge=new RegExp(['^(?:#|\\[id=")'.concat(fe(["v-\\d+",":r[0-9a-z]+:","(?:radix|headlessui|reach|floating-ui)-","mui-\\d+","(?:mat|cdk)-[a-z-]+-?\\d+","(?:downshift|react-select|tippy|uid|uuid)-\\d+","ember\\d+","BVID__\\d+","ext-gen\\d+","yui_\\d","[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"])),"^\\.".concat(fe(["css-[a-z0-9]*\\d[a-z0-9]*","sc-(?=[a-zA-Z0-9]*[A-Z])[a-zA-Z0-9]{5,}","jsx-\\d+"])),"^\\.[^.]*".concat("__(?=[A-Za-z0-9]{4,}$)(?=[A-Za-z0-9]*[0-9])(?=[A-Za-z0-9]*[A-Z])[A-Za-z0-9]+$")].join("|")),me=function(e,t){if(!e||"*"===e)return!1;try{var n=document.querySelectorAll(e);return 1===n.length&&n[0]===t}catch(r){return!1}},ve=/\d{2,}/,ye=function(e){return e.replace(/\d+/g,"#")},be=function(e){return e.match(/(?:^\d|:)/)?'[id="'.concat(e,'"]'):"#".concat(e)},we=["data-testid","data-test-id","data-test","data-cy","data-qa","name"],ke=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:he,n=t(e),r=[];try{var o=function(){for(var e={},t=document.querySelectorAll("[id]"),n=0;n1?t.concat(e[n]):t}),[])}(),i="function"==typeof e.getAttribute?e.getAttribute("id"):null;i&&o.indexOf(i)<0&&!ge.test(be(i))&&r.push(be(i)),r.push.apply(r,function(e){var t=(e.tagName||"").toLowerCase();return we.reduce((function(n,r){var o="function"==typeof e.getAttribute?e.getAttribute(r):null;if(!o||ge.test("#".concat(o)))return n;var i=o.replace(/["\\]/g,"\\$&");return n.concat(["".concat(t,"[").concat(r,'="').concat(i,'"]'),"[".concat(r,'="').concat(i,'"]')])}),[])}(e));var a=o.map((function(e){return be(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})),s=a.length?new RegExp("".concat(ge.source,"|^(?:").concat(a.join("|"),")$")):ge;r.push(t(e,{excludeRegex:s}))}catch(l){}for(var c=0;c0&&void 0!==arguments[0]&&arguments[0])||r(t.gleapCollapseUI,e)&&r(t.gleapFrameContainer,n))&&(t.gleapCollapseUI&&t.gleapCollapseUI.classList.toggle(e),t.gleapFrameContainer&&t.gleapFrameContainer.classList.toggle(n))})),_e(this,"injectCollapseUI",(function(){if(!t.injectedCollapseUI){t.injectedCollapseUI=!0;var e=document.createElement("div");e.className="gleap-admin-collapse-ui",e.innerHTML='
\n '.concat(H("arrowdown"),"\n
"),document.body.appendChild(e),t.gleapCollapseUI=e,e.addEventListener("click",(function(e){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t.toggleCollapseUI()}))}})),_e(this,"injectFrame",(function(){var e;if(!t.injectedFrame){t.injectedFrame=!0;var n=document.createElement("div");n.className="gleap-admin-frame-container",n.innerHTML=''),document.body.appendChild(n),t.gleapFrameContainer=n,t.gleapFrame=document.querySelector(".gleap-admin-frame")}}))}var t,n,r;return t=e,r=[{key:"getInstance",value:function(){return this.instance||(this.instance=new e),this.instance}}],(n=[{key:"logCurrentPage",value:function(){var e=window.location.href;e&&e!==this.lastUrl&&(this.lastUrl=e,this.sendMessageToTourBuilder({name:"page-changed",data:{page:e}}))}},{key:"startPageListener",value:function(){var e=this;setInterval((function(){e.logCurrentPage()}),1e3)}},{key:"initAdminHelper",value:function(){var e=this;this.initialized=!0,Va.getInstance().disable(),nn.getInstance().disable(),Yi.getInstance().disable(),Hu.close(),Hu.showFeedbackButton(!1),e.adminHelper=new Le;try{e.adminHelper.onElementPicked=function(t){e.toggleCollapseUI(!0),e.sendMessageToTourBuilder({name:"element-picked",data:{selector:t}})}}catch(t){console.log(t)}e.injectFrame(),e.injectCollapseUI(),e.setFrameHeight("loading")}},{key:"setFrameHeight",value:function(e){if(this.gleapFrameContainer){var t="";t="picker"===e||"navigate"===e?"65px":"editor"===e?"100vh":"0px",this.gleapFrameContainer.style.height=t}}},{key:"start",value:function(){var e=this;if("undefined"!=typeof window&&!window.gleapAdminDisabled){var t=this;window.addEventListener("message",(function(n){if("https://app.gleap.io"===n.origin)try{var r=JSON.parse(n.data);if("admin"===r.type&&("load"===r.name&&(t.configData=r.data,t.initAdminHelper()),"smartlink-search-result"===r.name&&e.sendMessageToTourBuilder({name:"smartlink-search-result",data:r.data}),"translate-complete"===r.name&&e.sendMessageToTourBuilder({name:"translate-complete",data:r.data})),"tourbuilder"===r.type){var o;if("loaddata"===r.name&&e.sendMessageToTourBuilder({name:"data",data:Ae(Ae({},t.configData),{},{currentPage:window.location.href})}),"highlight-element"===r.name&&(document.querySelectorAll(".gleap-admin-highlight").forEach((function(e){e.classList.remove("gleap-admin-highlight")})),null!=r&&null!==(o=r.data)&&void 0!==o&&o.selector)){var i,a=document.querySelector(null==r||null===(i=r.data)||void 0===i?void 0:i.selector);a&&a.classList.add("gleap-admin-highlight")}if("smartlink-search"===r.name&&e.sendMessage({name:"smartlink-search",data:r.data}),"product-tour-started"===r.name&&e.sendMessage({name:"product-tour-started",data:r.data}),"translate"===r.name&&e.sendMessage({name:"translate",data:r.data}),"save"===r.name&&e.sendMessage({name:"save",data:r.data}),"update-steps"===r.name&&e.sendMessage({name:"update-steps",data:r.data}),"click"===r.name)try{document.querySelector(r.data.selector).click()}catch(s){console.log(s)}"status-changed"===r.name&&(t.status=r.data,e.setFrameHeight(t.status),t.adminHelper.stopPicker(),"picker"===t.status&&t.adminHelper.startPicker())}}catch(c){}})),this.sendMessage({name:"init"}),this.startPageListener()}}},{key:"sendMessage",value:function(e){try{window&&window.opener&&window.opener.postMessage(JSON.stringify(Ae(Ae({},e),{},{type:"admin"})),"*")}catch(t){}}},{key:"sendMessageToTourBuilder",value:function(e){try{this.gleapFrame&&this.gleapFrame.contentWindow&&this.gleapFrame.contentWindow.postMessage(JSON.stringify(Ae(Ae({},e),{},{type:"tourbuilder"})),"*")}catch(t){}}}])&&Pe(t.prototype,n),r&&Pe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function je(e){return je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},je(e)}function De(){De=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),s=new M(r||[]);return o(a,"_invoke",{value:T(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",f="executing",g="completed",m={};function v(){}function y(){}function b(){}var w={};l(w,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(A([])));x&&x!==n&&r.call(x,a)&&(w=x);var S=b.prototype=v.prototype=Object.create(w);function C(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(o,i,a,s){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==je(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function T(t,n,r){var o=p;return function(i,a){if(o===f)throw new Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var c=E(s,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=f;var l=d(t,n,r);if("normal"===l.type){if(o=r.done?g:h,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=g,r.method="throw",r.arg=l.arg)}}}function E(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,E(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Be(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._agentId=t.agentId||"kai",this._context=t.context||null,this._onChange=t.onChange||null,this._onError=t.onError||null,this._onReplyReceived=t.onReplyReceived||null,this._onConversationCreated=t.onConversationCreated||null,this._onToken=t.onToken||null,this._messages=[],this._conversationId=t.conversationId||null,this._isExecuting=!1,this._error=null,this._destroyed=!1,this._abortController=null;try{this._networkManager=S.getInstance()}catch(n){this._networkManager=null}}var t,n,r,o,i;return t=e,n=[{key:"sendMessage",value:(o=De().mark((function e(t){var n,r,o,i,a,s,c,l=this;return De().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=(t||"").trim())&&!this._isExecuting&&!this._destroyed){e.next=3;break}return e.abrupt("return");case 3:return this._messages=[].concat(He(this._messages),[{id:"user-".concat(Date.now()),role:"user",content:n,createdAt:(new Date).toISOString()}]),r="stream-".concat(Date.now()),this._messages=[].concat(He(this._messages),[{id:r,role:"assistant",content:"",createdAt:(new Date).toISOString(),isStreaming:!0}]),this._isExecuting=!0,this._error=null,this._notify(),o="kai"===this._agentId,i=o?this._messages.filter((function(e){return!e.isStreaming&&e.content})).map((function(e){return{role:e.role,content:e.content}})):[{role:"user",content:n}],a={messages:i},this._conversationId&&(a.conversationId=this._conversationId),this._context&&(a.additionalContext=this._context),this._abortController=new AbortController,s=!this._conversationId,c=this._messages.length-1,e.next=19,this._networkManager.streamAgent(this._agentId,a,{onMeta:function(e){l._destroyed||(e.conversationId&&(l._conversationId=e.conversationId,l._networkManager._invalidateMessagesCache(e.conversationId),s&&l._onConversationCreated&&l._onConversationCreated(e.conversationId)),e.runId&&l._messages[c]&&(l._messages[c]=Be(Be({},l._messages[c]),{},{id:e.runId})))},onToken:function(e){if(!l._destroyed){var t=l._messages[c];t&&(t.content+=e.content||""),l._notify(),l._onToken&&l._onToken(e)}},onDone:function(e){if(!l._destroyed){var t=l._messages[c];t&&(t.isStreaming=!1,e.response&&!t.content&&(t.content=e.response)),l._isExecuting=!1,l._abortController=null,l._notify(),l._onReplyReceived&&l._onReplyReceived(e)}},onError:function(e){if(!l._destroyed){var t=l._messages[c];t&&!t.content?l._messages.splice(c,1):t&&(t.isStreaming=!1),l._isExecuting=!1,l._error=e,l._abortController=null,l._notify(),l._onError&&l._onError(e)}},onToolStart:function(){},onToolEnd:function(){}},this._abortController.signal);case 19:case"end":return e.stop()}}),e,this)})),i=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){ze(i,n,r,a,s,"next",e)}function s(e){ze(i,n,r,a,s,"throw",e)}a(void 0)}))},function(e){return i.apply(this,arguments)})},{key:"cancelStream",value:function(){this._abortController&&(this._abortController.abort(),this._abortController=null),this._messages=this._messages.map((function(e){return e.isStreaming?Be(Be({},e),{},{isStreaming:!1}):e})),this._messages=this._messages.filter((function(e){return e.content||"user"===e.role})),this._isExecuting=!1,this._notify()}},{key:"clearMessages",value:function(){this._messages=[],this._conversationId=null,this._isExecuting=!1,this._error=null,this.cancelStream(),S.getInstance().clearCache(),this._notify()}},{key:"setContext",value:function(e){this._context=e}},{key:"getState",value:function(){return{messages:this._messages,isExecuting:this._isExecuting,error:this._error,conversationId:this._conversationId}}},{key:"destroy",value:function(){this.cancelStream(),this._destroyed=!0,this._onChange=null,this._onError=null,this._onReplyReceived=null,this._onConversationCreated=null,this._onToken=null}},{key:"_notify",value:function(){this._onChange&&!this._destroyed&&this._onChange(this.getState())}}],n&&We(t.prototype,n),r&&We(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Ke=Ve;function Je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xe(e,t,n){return t=function(e){var t=function(e,t){if("object"!=Ye(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ye(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ye(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}var $e=function(e,t){if(e&&t){var n,r=function(){try{e.src=t}catch(n){}};try{if(!e.contentDocument)return r()}catch(i){return r()}try{var o=new URL(t);n=o.origin+"/"}catch(i){return r()}fetch(t,{mode:"cors",credentials:"omit"}).then((function(e){if(!e.ok)throw new Error("Bootstrap fetch failed: "+e.status);return e.text()})).then((function(o){var a=o.replace(/(\s(?:href|src)\s*=\s*["'])\/([^"'/][^"']*)/g,"$1"+n+"$2"),s="/";try{var c=new URL(t);s=c.pathname+c.search+c.hash}catch(i){}var l,u,d='';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing ';\n\n // Inject the route-setter script BEFORE the first existing