var SourceEmbedsLoader=function(b){"use strict";var W=typeof document<"u"?document.currentScript:null;function Ht(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yt=typeof global=="object"&&global&&global.Object===Object&&global;const k=Yt;var qt=typeof self=="object"&&self&&self.Object===Object&&self,Xt=k||qt||Function("return this")();const w=Xt;var Vt=w.Symbol;const O=Vt;var tt=Object.prototype,Zt=tt.hasOwnProperty,Qt=tt.toString,$=O?O.toStringTag:void 0;function Wt(t){var e=Zt.call(t,$),r=t[$];try{t[$]=void 0;var n=!0}catch{}var o=Qt.call(t);return n&&(e?t[$]=r:delete t[$]),o}var kt=Object.prototype,te=kt.toString;function ee(t){return te.call(t)}var re="[object Null]",ne="[object Undefined]",et=O?O.toStringTag:void 0;function P(t){return t==null?t===void 0?ne:re:et&&et in Object(t)?Wt(t):ee(t)}function E(t){return t!=null&&typeof t=="object"}var oe="[object Symbol]";function z(t){return typeof t=="symbol"||E(t)&&P(t)==oe}function ie(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var ae=Array.isArray;const T=ae;var ce=1/0,rt=O?O.prototype:void 0,nt=rt?rt.toString:void 0;function ot(t){if(typeof t=="string")return t;if(T(t))return ie(t,ot)+"";if(z(t))return nt?nt.call(t):"";var e=t+"";return e=="0"&&1/t==-ce?"-0":e}function m(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function it(t){return t}var ue="[object AsyncFunction]",se="[object Function]",fe="[object GeneratorFunction]",le="[object Proxy]";function B(t){if(!m(t))return!1;var e=P(t);return e==se||e==fe||e==ue||e==le}var de=w["__core-js_shared__"];const K=de;var at=function(){var t=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function pe(t){return!!at&&at in t}var ge=Function.prototype,he=ge.toString;function be(t){if(t!=null){try{return he.call(t)}catch{}try{return t+""}catch{}}return""}var ye=/[\\^$.*+?()[\]{}|]/g,me=/^\[object .+?Constructor\]$/,_e=Function.prototype,ve=Object.prototype,Se=_e.toString,we=ve.hasOwnProperty,Oe=RegExp("^"+Se.call(we).replace(ye,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ee(t){if(!m(t)||pe(t))return!1;var e=B(t)?Oe:me;return e.test(be(t))}function Te(t,e){return t==null?void 0:t[e]}function G(t,e){var r=Te(t,e);return Ee(r)?r:void 0}var ct=Object.create,je=function(){function t(){}return function(e){if(!m(e))return{};if(ct)return ct(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const $e=je;function Pe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ae(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Ce=800,Ue=16,Ie=Date.now;function Le(t){var e=0,r=0;return function(){var n=Ie(),o=Ue-(n-r);if(r=n,o>0){if(++e>=Ce)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Fe(t){return function(){return t}}var Re=function(){try{var t=G(Object,"defineProperty");return t({},"",{}),t}catch{}}();const F=Re;var Ne=F?function(t,e){return F(t,"toString",{configurable:!0,enumerable:!1,value:Fe(e),writable:!0})}:it,Me=Le(Ne);const xe=Me;var De=9007199254740991,ze=/^(?:0|[1-9]\d*)$/;function J(t,e){var r=typeof t;return e=e??De,!!e&&(r=="number"||r!="symbol"&&ze.test(t))&&t>-1&&t%1==0&&t<e}function H(t,e,r){e=="__proto__"&&F?F(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function R(t,e){return t===e||t!==t&&e!==e}var Be=Object.prototype,Ke=Be.hasOwnProperty;function ut(t,e,r){var n=t[e];(!(Ke.call(t,e)&&R(n,r))||r===void 0&&!(e in t))&&H(t,e,r)}function Ge(t,e,r,n){var o=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var i=e[a],c=n?n(r[i],t[i],i,r,t):void 0;c===void 0&&(c=t[i]),o?H(r,i,c):ut(r,i,c)}return r}var st=Math.max;function Je(t,e,r){return e=st(e===void 0?t.length-1:e,0),function(){for(var n=arguments,o=-1,a=st(n.length-e,0),s=Array(a);++o<a;)s[o]=n[e+o];o=-1;for(var i=Array(e+1);++o<e;)i[o]=n[o];return i[e]=r(s),Pe(t,this,i)}}function He(t,e){return xe(Je(t,e,it),t+"")}var Ye=9007199254740991;function ft(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ye}function Y(t){return t!=null&&ft(t.length)&&!B(t)}function qe(t,e,r){if(!m(r))return!1;var n=typeof e;return(n=="number"?Y(r)&&J(e,r.length):n=="string"&&e in r)?R(r[e],t):!1}function Xe(t){return He(function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(o--,a):void 0,s&&qe(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++n<o;){var i=r[n];i&&t(e,i,n,a)}return e})}var Ve=Object.prototype;function lt(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ve;return t===r}function Ze(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Qe="[object Arguments]";function dt(t){return E(t)&&P(t)==Qe}var pt=Object.prototype,We=pt.hasOwnProperty,ke=pt.propertyIsEnumerable,tr=dt(function(){return arguments}())?dt:function(t){return E(t)&&We.call(t,"callee")&&!ke.call(t,"callee")};const q=tr;function er(){return!1}var gt=typeof b=="object"&&b&&!b.nodeType&&b,ht=gt&&typeof module=="object"&&module&&!module.nodeType&&module,rr=ht&&ht.exports===gt,bt=rr?w.Buffer:void 0,nr=bt?bt.isBuffer:void 0,or=nr||er;const yt=or;var ir="[object Arguments]",ar="[object Array]",cr="[object Boolean]",ur="[object Date]",sr="[object Error]",fr="[object Function]",lr="[object Map]",dr="[object Number]",pr="[object Object]",gr="[object RegExp]",hr="[object Set]",br="[object String]",yr="[object WeakMap]",mr="[object ArrayBuffer]",_r="[object DataView]",vr="[object Float32Array]",Sr="[object Float64Array]",wr="[object Int8Array]",Or="[object Int16Array]",Er="[object Int32Array]",Tr="[object Uint8Array]",jr="[object Uint8ClampedArray]",$r="[object Uint16Array]",Pr="[object Uint32Array]",p={};p[vr]=p[Sr]=p[wr]=p[Or]=p[Er]=p[Tr]=p[jr]=p[$r]=p[Pr]=!0,p[ir]=p[ar]=p[mr]=p[cr]=p[_r]=p[ur]=p[sr]=p[fr]=p[lr]=p[dr]=p[pr]=p[gr]=p[hr]=p[br]=p[yr]=!1;function Ar(t){return E(t)&&ft(t.length)&&!!p[P(t)]}function Cr(t){return function(e){return t(e)}}var mt=typeof b=="object"&&b&&!b.nodeType&&b,A=mt&&typeof module=="object"&&module&&!module.nodeType&&module,Ur=A&&A.exports===mt,X=Ur&&k.process,Ir=function(){try{var t=A&&A.require&&A.require("util").types;return t||X&&X.binding&&X.binding("util")}catch{}}();const _t=Ir;var vt=_t&&_t.isTypedArray,Lr=vt?Cr(vt):Ar;const St=Lr;var Fr=Object.prototype,Rr=Fr.hasOwnProperty;function Nr(t,e){var r=T(t),n=!r&&q(t),o=!r&&!n&&yt(t),a=!r&&!n&&!o&&St(t),s=r||n||o||a,i=s?Ze(t.length,String):[],c=i.length;for(var l in t)(e||Rr.call(t,l))&&!(s&&(l=="length"||o&&(l=="offset"||l=="parent")||a&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||J(l,c)))&&i.push(l);return i}function Mr(t,e){return function(r){return t(e(r))}}function xr(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Dr=Object.prototype,zr=Dr.hasOwnProperty;function Br(t){if(!m(t))return xr(t);var e=lt(t),r=[];for(var n in t)n=="constructor"&&(e||!zr.call(t,n))||r.push(n);return r}function wt(t){return Y(t)?Nr(t,!0):Br(t)}var Kr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gr=/^\w*$/;function Jr(t,e){if(T(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:Gr.test(t)||!Kr.test(t)||e!=null&&t in Object(e)}var Hr=G(Object,"create");const C=Hr;function Yr(){this.__data__=C?C(null):{},this.size=0}function qr(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Xr="__lodash_hash_undefined__",Vr=Object.prototype,Zr=Vr.hasOwnProperty;function Qr(t){var e=this.__data__;if(C){var r=e[t];return r===Xr?void 0:r}return Zr.call(e,t)?e[t]:void 0}var Wr=Object.prototype,kr=Wr.hasOwnProperty;function tn(t){var e=this.__data__;return C?e[t]!==void 0:kr.call(e,t)}var en="__lodash_hash_undefined__";function rn(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&e===void 0?en:e,this}function S(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}S.prototype.clear=Yr,S.prototype.delete=qr,S.prototype.get=Qr,S.prototype.has=tn,S.prototype.set=rn;function nn(){this.__data__=[],this.size=0}function N(t,e){for(var r=t.length;r--;)if(R(t[r][0],e))return r;return-1}var on=Array.prototype,an=on.splice;function cn(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():an.call(e,r,1),--this.size,!0}function un(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}function sn(t){return N(this.__data__,t)>-1}function fn(t,e){var r=this.__data__,n=N(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function _(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_.prototype.clear=nn,_.prototype.delete=cn,_.prototype.get=un,_.prototype.has=sn,_.prototype.set=fn;var ln=G(w,"Map");const Ot=ln;function dn(){this.size=0,this.__data__={hash:new S,map:new(Ot||_),string:new S}}function pn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function M(t,e){var r=t.__data__;return pn(e)?r[typeof e=="string"?"string":"hash"]:r.map}function gn(t){var e=M(this,t).delete(t);return this.size-=e?1:0,e}function hn(t){return M(this,t).get(t)}function bn(t){return M(this,t).has(t)}function yn(t,e){var r=M(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function v(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}v.prototype.clear=dn,v.prototype.delete=gn,v.prototype.get=hn,v.prototype.has=bn,v.prototype.set=yn;var mn="Expected a function";function V(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(mn);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=t.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(V.Cache||v),r}V.Cache=v;var _n=500;function vn(t){var e=V(t,function(n){return r.size===_n&&r.clear(),n}),r=e.cache;return e}var Sn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wn=/\\(\\)?/g,On=vn(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Sn,function(r,n,o,a){e.push(o?a.replace(wn,"$1"):n||r)}),e});const En=On;function Tn(t){return t==null?"":ot(t)}function jn(t,e){return T(t)?t:Jr(t,e)?[t]:En(Tn(t))}var $n=1/0;function Pn(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-$n?"-0":e}var An=Mr(Object.getPrototypeOf,Object);const Et=An;var Cn="[object Object]",Un=Function.prototype,In=Object.prototype,Tt=Un.toString,Ln=In.hasOwnProperty,Fn=Tt.call(Object);function Rn(t){if(!E(t)||P(t)!=Cn)return!1;var e=Et(t);if(e===null)return!0;var r=Ln.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Tt.call(r)==Fn}function Nn(){this.__data__=new _,this.size=0}function Mn(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function xn(t){return this.__data__.get(t)}function Dn(t){return this.__data__.has(t)}var zn=200;function Bn(t,e){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!Ot||n.length<zn-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new v(n)}return r.set(t,e),this.size=r.size,this}function j(t){var e=this.__data__=new _(t);this.size=e.size}j.prototype.clear=Nn,j.prototype.delete=Mn,j.prototype.get=xn,j.prototype.has=Dn,j.prototype.set=Bn;var jt=typeof b=="object"&&b&&!b.nodeType&&b,$t=jt&&typeof module=="object"&&module&&!module.nodeType&&module,Kn=$t&&$t.exports===jt,Pt=Kn?w.Buffer:void 0,At=Pt?Pt.allocUnsafe:void 0;function Gn(t,e){if(e)return t.slice();var r=t.length,n=At?At(r):new t.constructor(r);return t.copy(n),n}var Jn=w.Uint8Array;const Ct=Jn;function Hn(t){var e=new t.constructor(t.byteLength);return new Ct(e).set(new Ct(t)),e}function Yn(t,e){var r=e?Hn(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function qn(t){return typeof t.constructor=="function"&&!lt(t)?$e(Et(t)):{}}function Xn(t){return function(e,r,n){for(var o=-1,a=Object(e),s=n(e),i=s.length;i--;){var c=s[t?i:++o];if(r(a[c],c,a)===!1)break}return e}}var Vn=Xn();const Zn=Vn;function Z(t,e,r){(r!==void 0&&!R(t[e],r)||r===void 0&&!(e in t))&&H(t,e,r)}function Qn(t){return E(t)&&Y(t)}function Q(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function Wn(t){return Ge(t,wt(t))}function kn(t,e,r,n,o,a,s){var i=Q(t,r),c=Q(e,r),l=s.get(c);if(l){Z(t,r,l);return}var u=a?a(i,c,r+"",t,e,s):void 0,f=u===void 0;if(f){var d=T(c),g=!d&&yt(c),h=!d&&!g&&St(c);u=c,d||g||h?T(i)?u=i:Qn(i)?u=Ae(i):g?(f=!1,u=Gn(c,!0)):h?(f=!1,u=Yn(c,!0)):u=[]:Rn(c)||q(c)?(u=i,q(i)?u=Wn(i):(!m(i)||B(i))&&(u=qn(c))):f=!1}f&&(s.set(c,u),o(u,c,n,a,s),s.delete(c)),Z(t,r,u)}function Ut(t,e,r,n,o){t!==e&&Zn(e,function(a,s){if(o||(o=new j),m(a))kn(t,e,s,r,Ut,n,o);else{var i=n?n(Q(t,s),a,s+"",t,e,o):void 0;i===void 0&&(i=a),Z(t,s,i)}},wt)}var to=Xe(function(t,e,r){Ut(t,e,r)});const U=to;function eo(t,e,r,n){if(!m(t))return t;e=jn(e,t);for(var o=-1,a=e.length,s=a-1,i=t;i!=null&&++o<a;){var c=Pn(e[o]),l=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(o!=s){var u=i[c];l=n?n(u,c,i):void 0,l===void 0&&(l=m(u)?u:J(e[o+1])?[]:{})}ut(i,c,l),i=i[c]}return t}function It(t,e,r){return t==null?t:eo(t,e,r)}const x="[sd-embedder]",ro=console.debug.bind(window.console,x),no=console.warn.bind(window.console,x),oo=console.error.bind(window.console,x),io=console.error.bind(window.console,x),y={debug:ro,warn:no,error:oo,log:io,child(t){const e={};return Object.entries(this).forEach(([r,n])=>{typeof n=="function"&&(e[r]=n.bind(n,`[${t}]`))}),e}},Lt="StgbEE5LEe6j2Uu38haiJw",ao="^_sdembed_",co="1",uo="https://cdn.sourcesync.io/embed/",so="embed.min.js",fo="source-embeds-settings",Ft="prod",Rt={prod:{content:"https://content.sourcesync.io",experience:"https://experience.sourcesync.io",api:"https://api.sourcesync.io"},dev:{content:"https://content-dev.sourcesync.io",experience:"https://experience-dev.sourcesync.io",api:"https://api-dev.sourcesync.io"},stg:{content:"https://content-stg.sourcesync.io",experience:"https://experience-stg.sourcesync.io",api:"https://api-stg.sourcesync.io"}};function lo(t){return t==null?Ft:Rt[t]!=null?t:Ft}function po(t,e){const r=lo(e);return Rt[r][t]}async function Nt(t){y.debug("Fetching from service",t);const e=po(t.service,t.env),r=new URL(e);r.pathname=t.path;for(const[a,s]of Object.entries(t.query??{}))s!=null&&r.searchParams.append(a,s);const n=await fetch(r,t.requestInit);if(!n.ok){if(n.status===404)return;throw new Error(`Fetch from service failed: ${n.status} ${n.statusText}`)}return await n.json()}var go=I;I.flatten=I,I.unflatten=Dt;function Mt(t){return t&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xt(t){return t}function I(t,e){e=e||{};const r=e.delimiter||".",n=e.maxDepth,o=e.transformKey||xt,a={};function s(i,c,l){l=l||1,Object.keys(i).forEach(function(u){const f=i[u],d=e.safe&&Array.isArray(f),g=Object.prototype.toString.call(f),h=Mt(f),D=g==="[object Object]"||g==="[object Array]",L=c?c+r+o(u):o(u);if(!d&&!h&&D&&Object.keys(f).length&&(!e.maxDepth||l<n))return s(f,L,l+1);a[L]=f})}return s(t),a}function Dt(t,e){e=e||{};const r=e.delimiter||".",n=e.overwrite||!1,o=e.transformKey||xt,a={};if(Mt(t)||Object.prototype.toString.call(t)!=="[object Object]")return t;function i(u){const f=Number(u);return isNaN(f)||u.indexOf(".")!==-1||e.object?u:f}function c(u,f,d){return Object.keys(d).reduce(function(g,h){return g[u+r+h]=d[h],g},f)}function l(u){const f=Object.prototype.toString.call(u),d=f==="[object Array]",g=f==="[object Object]";if(u){if(d)return!u.length;if(g)return!Object.keys(u).length}else return!0}return t=Object.keys(t).reduce(function(u,f){const d=Object.prototype.toString.call(t[f]);return!(d==="[object Object]"||d==="[object Array]")||l(t[f])?(u[f]=t[f],u):c(f,u,I(t[f],e))},{}),Object.keys(t).forEach(function(u){const f=u.split(r).map(o);let d=i(f.shift()),g=i(f[0]),h=a;for(;g!==void 0;){if(d==="__proto__")return;const D=Object.prototype.toString.call(h[d]),L=D==="[object Object]"||D==="[object Array]";if(!n&&!L&&typeof h[d]<"u")return;(n&&!L||!n&&h[d]==null)&&(h[d]=typeof g=="number"&&!e.object?[]:{}),h=h[d],f.length>0&&(d=i(f.shift()),g=i(f[0]))}h[d]=Dt(t[u],e)}),a}const ho=Ht(go);async function bo(t){const{url:e="",globalName:r="",reuseGlobal:n=!1,resolveGlobal:o=!0,defer:a=!0,retryDelay:s=100,maxTries:i=10}=t;let c=i;const l=window;return n&&l[r]!=null?l[r]:await new Promise((u,f)=>{const d=document.createElement("script");d.defer=a,d.src=e,d.addEventListener("error",h=>{f(h.error)}),d.addEventListener("load",g),document.body.appendChild(d);function g(){if(o&&l[r]==null){if(c>0)return c-=1,setTimeout(g,s);f(new Error("loadScript: could not resolve globalName"));return}u(l[r])}})}function zt(t){return t==="true"?!0:t==="false"?!1:t}function yo(t){if(t!=null)return t instanceof RegExp?t:new RegExp(t)}function Bt(t,e,r){const n=new URL(t),o=n.searchParams,a={},s=yo(r);o.forEach((l,u)=>{const f=mo(u,s);f!=null&&It(a,f,zt(l))});const i=_o(n.pathname);return i!=null&&i.c&&It(a,"config",zt(i.c)),y.debug("Loaded settings from URL",a),e==null?a:U({},e,a)}function mo(t,e){return e==null?t:e.test(t)?t.replace(e,""):null}function _o(t){if(!t)return;const[e,r]=t.split("/").filter(Boolean);return{[e]:r}}function vo(t){const e=new URL(window.location.toString());if(!e.searchParams.has(Lt))return t;const r=e.searchParams.get(Lt)||null;return y.debug("Loading settings from page URL"),Bt(e,t,r??ao)}function So(){return wo()??Oo()??Eo()}function wo(){try{return W&&W.src||new URL("embed-loader.min.js",document.baseURI).href}catch{return}}function Oo(){if(document.currentScript!=null&&document.currentScript instanceof HTMLScriptElement)return document.currentScript.src}function Eo(){const t=window.document.getElementsByTagName("script");return t[t.length-1].src}function Kt(t){const e=So();return y.debug("Loading settings from script URL"),Bt(e,t)}function To(t){if(t.byJsonElement==null)return t;y.debug("Loading settings from JSON element: "+t.byJsonElement);const e=document.querySelector(t.byJsonElement);if(e==null)throw new Error("No script element found: "+t.byJsonElement);if((e==null?void 0:e.getAttribute("type"))!=="application/json")throw new Error('Invalid script element type. Must have `type="application/json"`: '+t.byJsonElement);if(e==null)throw new Error("No script element found: "+t.byJsonElement);const r=e.textContent;if(r==null)throw new Error("No JSON found in script element: "+t.byJsonElement);return U({},t,JSON.parse(r))}function jo(t){if(t.byLocalStorage==null||t.byLocalStorage===!1)return t;let e=fo;typeof t.byLocalStorage=="string"&&(e=t.byLocalStorage),y.debug("Loading settings from localStorage with key:",e);const r=window.localStorage.getItem(e);if(r==null)return t;const n=JSON.parse(r);return y.debug("Loaded settings from localStorage",n),U({},t,n)}async function $o(t){if((t==null?void 0:t.byDomain)===!1)return t;const r=new URL(window.location.toString()).hostname;y.debug("Loading settings from domain: ",r);const n=await Nt({service:"content",path:`/embed/by-domain/${r}`,env:t==null?void 0:t.env});return y.debug("Loaded settings from domain: ",n),U({},t,n)}async function Po(t){let e;const r=(t==null?void 0:t.configId)??(t==null?void 0:t.config);return r!=null&&(e=await Nt({service:"content",path:`/embed/by-id/${r}`,env:t==null?void 0:t.env}),y.debug("Loaded settings from config: ",e)),U({},t,e)}async function Ao(t){return t=Kt(t),t=await $o(t),t=await Po(t),t=To(t),t=vo(t),t=jo(t),t}async function Co(t){const e=Uo(t),r=t.globalName;return await bo({url:e.toString(),globalName:r,reuseGlobal:!0,resolveGlobal:!0})}function Uo(t){const{version:e=co,baseUrl:r=uo,file:n=so,settings:o}=t,a=new URL(`${r}${e}/${n}`);if(o==null)return a;const s=ho(o);return Object.entries(s).forEach(([i,c])=>{a.searchParams.set(i,c)}),a}const Io="1",Gt=y.child("loader");async function Jt(t={}){t=Kt(t),Gt.debug("loading settings");const e=await Ao(t);return e.global="SourceEmbedV"+(e.version??Io).replace(/\./gi,""),Gt.debug("using settings:",e),await Co({version:e.version,settings:e,globalName:e.global})}const Lo=Jt();return b.load=Jt,b.ready=Lo,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b}({});
//# sourceMappingURL=embed-loader.min.js.map
