import{n as e}from"./rolldown-runtime-BG2f4sTM.js";function t(){return typeof window<`u`}function n(){return!t()}var r=e((()=>{}));function i(){return window[s]}function a(e){s=e}function o(e){window[s]=e}var s,c=e((()=>{s=`analytics`})),l,u,d,f,p,m,h,g=e((()=>{c(),l=/(https:\/\/.*)\/analytics\.js\/v1\/(?:.*?)\/(?:platform|analytics.*)?/,u=function(){var e;return Array.prototype.slice.call(document.querySelectorAll(`script`)).forEach(function(t){var n=t.getAttribute(`src`)??``,r=l.exec(n);r&&r[1]&&(e=r[1])}),e},f=function(){return d??i()?._cdn},p=function(e){var t=i();t&&(t._cdn=e),d=e},m=function(){return f()||u()||`https://cdn.segment.com`},h=function(){return`${m()}/next-integrations`}}));function _(e){return Array.prototype.slice.call(window.document.querySelectorAll(`script`)).find(function(t){return t.src===e})}function v(e,t){var n=_(e);if(n!==void 0){var r=n?.getAttribute(`status`);if(r===`loaded`)return Promise.resolve(n);if(r===`loading`)return new Promise(function(e,t){n.addEventListener(`load`,function(){return e(n)}),n.addEventListener(`error`,function(e){return t(e)})})}return new Promise(function(n,r){var i,a=window.document.createElement(`script`);a.type=`text/javascript`,a.src=e,a.async=!0,a.setAttribute(`status`,`loading`);for(var o=0,s=Object.entries(t??{});o<s.length;o++){var c=s[o],l=c[0],u=c[1];a.setAttribute(l,u)}a.onload=function(){a.onerror=a.onload=null,a.setAttribute(`status`,`loaded`),n(a)},a.onerror=function(){a.onerror=a.onload=null,a.setAttribute(`status`,`error`),r(Error(`Failed to load ${e}`))};var d=window.document.querySelector(`script`);d?(i=d.parentElement)==null||i.insertBefore(a,d):window.document.head.appendChild(a)})}function y(e){var t=_(e);return t!==void 0&&t.remove(),Promise.resolve()}var b=e((()=>{}));export{h as a,i as c,a as d,r as f,m as i,c as l,n as m,v as n,g as o,t as p,y as r,p as s,b as t,o as u};
//# sourceMappingURL=load-script-Cltl04TI.js.map