@sprig-technologies/sprig-bundled 2.46.1 → 2.48.0

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.
Files changed (35) hide show
  1. package/dist/conversational-styles-BO6t2-y4.js +4 -0
  2. package/dist/conversational-styles-CWaKMg_f.cjs +1 -0
  3. package/dist/conversational-ui-CoOUaxMV.js +1516 -0
  4. package/dist/conversational-ui-D4JFc07q.cjs +658 -0
  5. package/dist/conversational-v2-styles-BCsmmSE3.cjs +1 -0
  6. package/dist/conversational-v2-styles-BK9YvF7Q.js +4 -0
  7. package/dist/getAttributedUrl-Cy6ZmssZ.js +197 -0
  8. package/dist/getAttributedUrl-GFl2RKI_.cjs +12 -0
  9. package/dist/index-Cg785YpL.js +4 -0
  10. package/dist/index-DDZBH-vP.js +768 -0
  11. package/dist/index-DYrVxSAM.cjs +1 -0
  12. package/dist/index-D_IOfB4u.cjs +1 -0
  13. package/dist/index-Dm2nk1lh.js +4 -0
  14. package/dist/{index-D2UpkOdR.js → index-Q_m-uWR7.js} +993 -993
  15. package/dist/index-pfR5IQvc.cjs +66 -0
  16. package/dist/index-rJoqOgIc.cjs +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +43 -0
  19. package/dist/index.js +1 -1
  20. package/dist/view-bHnS65wz.js +1834 -0
  21. package/dist/view-umqtk1IA.cjs +1 -0
  22. package/package.json +1 -1
  23. package/dist/conversational-styles-B-bImmUK.js +0 -4
  24. package/dist/conversational-styles-vDq05r1U.cjs +0 -1
  25. package/dist/conversational-ui-BZDC1buu.js +0 -1511
  26. package/dist/conversational-ui-DqQZMJkq.cjs +0 -658
  27. package/dist/conversational-v2-styles-DeqT460S.js +0 -4
  28. package/dist/conversational-v2-styles-DkN3ff79.cjs +0 -1
  29. package/dist/getAttributedUrl-BuO50-dW.cjs +0 -12
  30. package/dist/getAttributedUrl-BvS4nPJR.js +0 -193
  31. package/dist/index-BCIAxJWJ.cjs +0 -66
  32. package/dist/index-DiPr4x-u.cjs +0 -1
  33. package/dist/index-fcbxeQg3.js +0 -734
  34. package/dist/view-5-qQQKtl.js +0 -1789
  35. package/dist/view-D8rc4Fhu.cjs +0 -1
@@ -0,0 +1,66 @@
1
+ "use strict";var Cd=Object.defineProperty;var kd=(e,t,r)=>t in e?Cd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ue=(e,t,r)=>kd(e,typeof t!="symbol"?t+"":t,r);var Ed=Object.create,po=Object.defineProperty,xd=Object.getOwnPropertyDescriptor,Td=Object.getOwnPropertyNames,Rd=Object.getPrototypeOf,Ld=Object.prototype.hasOwnProperty,gr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Od=gr((e,t)=>{var r;r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t.exports=r}),Ad=gr((e,t)=>{t.exports=function(s){if(!s)return!1;var n=r.call(s);return n==="[object Function]"||typeof s=="function"&&n!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)};var r=Object.prototype.toString}),Md=gr((e,t)=>{var r=function(n){return n.replace(/^\s+|\s+$/g,"")},s=function(n){return Object.prototype.toString.call(n)==="[object Array]"};t.exports=function(n){if(!n)return{};for(var i={},a=r(n).split(`
2
+ `),o=0;o<a.length;o++){var l=a[o],c=l.indexOf(":"),u=r(l.slice(0,c)).toLowerCase(),d=r(l.slice(c+1));i[u]===void 0?i[u]=d:s(i[u])?i[u].push(d):i[u]=[i[u],d]}return i}}),Ud=gr((e,t)=>{t.exports=function(){for(var s={},n=0;n<arguments.length;n++){var i=arguments[n];for(var a in i)r.call(i,a)&&(s[a]=i[a])}return s};var r=Object.prototype.hasOwnProperty}),Dd=gr((e,t)=>{var r=Od(),s=Ad(),n=Md(),i=Ud();function a(c,u,d){var p=c;return s(u)?(d=u,typeof c=="string"&&(p={uri:c})):p=i(u,{uri:c}),p.callback=d,p}function o(c,u,d){return l(u=a(c,u,d))}function l(c){if(c.callback===void 0)throw new Error("callback argument missing");var u=!1,d=function(R,L,I){u||(u=!0,c.callback(R,L,I))};function p(){var R=void 0;if(R=h.response?h.response:h.responseText||function(L){try{if(L.responseType==="document")return L.responseXML;var I=L.responseXML&&L.responseXML.documentElement.nodeName==="parsererror";if(L.responseType===""&&!I)return L.responseXML}catch{}return null}(h),U)try{R=JSON.parse(R)}catch{}return R}function f(R){return clearTimeout(g),R instanceof Error||(R=new Error(""+(R||"Unknown XMLHttpRequest Error"))),R.statusCode=0,d(R,E)}function w(){if(!m){var R;clearTimeout(g),R=c.useXDR&&h.status===void 0?200:h.status===1223?204:h.status;var L=E,I=null;return R!==0?(L={body:p(),statusCode:R,method:S,headers:{},url:v,rawRequest:h},h.getAllResponseHeaders&&(L.headers=n(h.getAllResponseHeaders()))):I=new Error("Internal XMLHttpRequest Error"),d(I,L,L.body)}}var h=c.xhr||null;h||(h=c.cors||c.useXDR?new o.XDomainRequest:new o.XMLHttpRequest);var C,m,g,v=h.url=c.uri||c.url,S=h.method=c.method||"GET",A=c.body||c.data,k=h.headers=c.headers||{},M=!!c.sync,U=!1,E={body:void 0,headers:{},statusCode:0,method:S,url:v,rawRequest:h};if("json"in c&&c.json!==!1&&(U=!0,k.accept||k.Accept||(k.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(k["content-type"]||k["Content-Type"]||(k["Content-Type"]="application/json"),A=JSON.stringify(c.json===!0?A:c.json))),h.onreadystatechange=function(){h.readyState===4&&setTimeout(w,0)},h.onload=w,h.onerror=f,h.onprogress=function(){},h.onabort=function(){m=!0},h.ontimeout=f,h.open(S,v,!M,c.username,c.password),M||(h.withCredentials=!!c.withCredentials),!M&&c.timeout>0&&(g=setTimeout(function(){if(!m){m=!0,h.abort("timeout");var R=new Error("XMLHttpRequest timeout");R.code="ETIMEDOUT",f(R)}},c.timeout)),h.setRequestHeader)for(C in k)k.hasOwnProperty(C)&&h.setRequestHeader(C,k[C]);else if(c.headers&&!function(R){for(var L in R)if(R.hasOwnProperty(L))return!1;return!0}(c.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in c&&(h.responseType=c.responseType),"beforeSend"in c&&typeof c.beforeSend=="function"&&c.beforeSend(h),h.send(A||null),h}t.exports=o,t.exports.default=o,o.XMLHttpRequest=r.XMLHttpRequest||function(){},o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:r.XDomainRequest,function(c,u){for(var d=0;d<c.length;d++)u(c[d])}(["get","put","post","patch","head","delete"],function(c){o[c==="delete"?"del":c]=function(u,d,p){return(d=a(u,d,p)).method=c.toUpperCase(),l(d)}})});function Mi(e,t,...r){if(!e)throw new TypeError(ml(t,r))}function ml(e,t){let r=0;return e.replace(/%[os]/gu,()=>fl(t[r++]))}function fl(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var Ue=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,ut=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{let r=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,`
3
+ `);console.warn(this.message,...e,r)}catch{}}},Pd=new ut("W01","Unable to initialize event under dispatching."),_d=new ut("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Nd=new ut("W03","Assigning any truthy value to 'returnValue' property has no effect."),Fd=new ut("W04","Unable to preventDefault on non-cancelable events."),Bd=new ut("W05","Unable to preventDefault inside passive event listener invocation."),zd=new ut("W06","An event listener wasn't added because it has been added already: %o, %o"),Xs=new ut("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),ho=new ut("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),qe=class{static get NONE(){return mo}static get CAPTURING_PHASE(){return fo}static get AT_TARGET(){return go}static get BUBBLING_PHASE(){return yo}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t??{};En.set(this,{type:String(e),bubbles:!!r.bubbles,cancelable:!!r.cancelable,composed:!!r.composed,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return pe(this).type}get target(){return pe(this).target}get srcElement(){return pe(this).target}get currentTarget(){return pe(this).currentTarget}composedPath(){let e=pe(this).currentTarget;return e?[e]:[]}get NONE(){return mo}get CAPTURING_PHASE(){return fo}get AT_TARGET(){return go}get BUBBLING_PHASE(){return yo}get eventPhase(){return pe(this).dispatchFlag?2:0}stopPropagation(){pe(this).stopPropagationFlag=!0}get cancelBubble(){return pe(this).stopPropagationFlag}set cancelBubble(e){e?pe(this).stopPropagationFlag=!0:_d.warn()}stopImmediatePropagation(){let e=pe(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return pe(this).bubbles}get cancelable(){return pe(this).cancelable}get returnValue(){return!pe(this).canceledFlag}set returnValue(e){e?Nd.warn():wo(pe(this))}preventDefault(){wo(pe(this))}get defaultPrevented(){return pe(this).canceledFlag}get composed(){return pe(this).composed}get isTrusted(){return!1}get timeStamp(){return pe(this).timeStamp}initEvent(e,t=!1,r=!1){let s=pe(this);s.dispatchFlag?Pd.warn():En.set(this,{...s,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},mo=0,fo=1,go=2,yo=3,En=new WeakMap;function pe(e,t="this"){let r=En.get(e);return Mi(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function wo(e){e.inPassiveListenerFlag?Bd.warn():e.cancelable?e.canceledFlag=!0:Fd.warn()}Object.defineProperty(qe,"NONE",{enumerable:!0}),Object.defineProperty(qe,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(qe,"AT_TARGET",{enumerable:!0}),Object.defineProperty(qe,"BUBBLING_PHASE",{enumerable:!0});var Zs=Object.getOwnPropertyNames(qe.prototype);for(let e=0;e<Zs.length;++e)Zs[e]!=="constructor"&&Object.defineProperty(qe.prototype,Zs[e],{enumerable:!0});Ue!==void 0&&Ue.Event!==void 0&&Object.setPrototypeOf(qe.prototype,Ue.Event.prototype);var St,bo={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function vo(e){let t=Object.keys(bo);for(let r=0;r<t.length;++r){let s=t[r],n=bo[s];Object.defineProperty(e,s,{get:()=>n,configurable:!0,enumerable:!0})}}var fs=class extends qe{static wrap(e){return new(yl(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),gl.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let s=t[r];s in this||Object.defineProperty(this,s,wl(e,s))}}stopPropagation(){super.stopPropagation();let{original:e}=st(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=st(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=st(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=st(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=st(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=st(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},gl=new WeakMap;function st(e){let t=gl.get(e);return Mi(t!=null,"'this' is expected an Event object, but got",e),t}var gs=new WeakMap;function yl(e){let t=Object.getPrototypeOf(e);if(t==null)return fs;let r=gs.get(t);return r==null&&(r=function(s,n){class i extends s{}let a=Object.keys(n);for(let o=0;o<a.length;++o)Object.defineProperty(i.prototype,a[o],wl(n,a[o]));return i}(yl(t),t),gs.set(t,r)),r}function wl(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let s=st(this).original,n=s[t];return typeof n=="function"?n.bind(s):n},set(s){st(this).original[t]=s},configurable:r.configurable,enumerable:r.enumerable}}function bl(e){return!(1&~e.flags)}function So(e){return!(2&~e.flags)}function Io(e){return!(4&~e.flags)}function jd(e){return!(8&~e.flags)}function Wd({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(s){(function(n){try{let i=n instanceof Error?n:new Error(fl(n));if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:i,message:i.message}));else if(typeof process<"u"&&typeof process.emit=="function")return void process.emit("uncaughtException",i);console.error(i)}catch{}})(s)}}function vl({listeners:e},t,r){for(let s=0;s<e.length;++s)if(e[s].callback===t&&bl(e[s])===r)return s;return-1}function Co(e,t,r){let s=vl(e,t,r);return s!==-1&&Sl(e,s)}function Sl(e,t,r=!1){let s=e.listeners[t];return function(n){n.flags|=8}(s),s.signal&&s.signal.removeEventListener("abort",s.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((n,i)=>i!==t),!1):(e.listeners.splice(t,1),!0)}gs.set(Object.prototype,fs),Ue!==void 0&&Ue.Event!==void 0&&gs.set(Ue.Event.prototype,fs);var Ds=class{constructor(){Cl.set(this,Object.create(null))}addEventListener(e,t,r){let s=Qs(this),{callback:n,capture:i,once:a,passive:o,signal:l,type:c}=function(p,f,w){var h;return ko(f),typeof w=="object"&&w!==null?{type:String(p),callback:f??void 0,capture:!!w.capture,passive:!!w.passive,once:!!w.once,signal:(h=w.signal)!==null&&h!==void 0?h:void 0}:{type:String(p),callback:f??void 0,capture:!!w,passive:!1,once:!1,signal:void 0}}(e,t,r);if(n==null||l!=null&&l.aborted)return;let u=function(p,f){var w;return(w=p[f])!==null&&w!==void 0?w:p[f]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}(s,c),d=vl(u,n,i);d===-1?function(p,f,w,h,C,m){let g;m&&(g=Co.bind(null,p,f,w),m.addEventListener("abort",g));let v=function(S,A,k,M,U,E){return{callback:S,flags:(A?1:0)|(k?2:0)|(M?4:0),signal:U,signalListener:E}}(f,w,h,C,m,g);p.cow?(p.cow=!1,p.listeners=[...p.listeners,v]):p.listeners.push(v)}(u,n,i,o,a,l):function(p,f,w,h){zd.warn(bl(p)?"capture":"bubble",p.callback),So(p)!==f&&Xs.warn("passive"),Io(p)!==w&&Xs.warn("once"),p.signal!==h&&Xs.warn("signal")}(u.listeners[d],o,a,l)}removeEventListener(e,t,r){let s=Qs(this),{callback:n,capture:i,type:a}=function(l,c,u){return ko(c),typeof u=="object"&&u!==null?{type:String(l),callback:c??void 0,capture:!!u.capture}:{type:String(l),callback:c??void 0,capture:!!u}}(e,t,r),o=s[a];n!=null&&o&&Co(o,n,i)}dispatchEvent(e){let t=Qs(this)[String(e.type)];if(t==null)return!0;let r=e instanceof qe?e:fs.wrap(e),s=pe(r,"event");if(s.dispatchFlag)throw n="This event has been in dispatching.",Ue.DOMException?new Ue.DOMException(n,"InvalidStateError"):(St==null&&(St=class Il extends Error{constructor(a){super(a),Error.captureStackTrace&&Error.captureStackTrace(this,Il)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(St.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),vo(St),vo(St.prototype)),new St(n));var n;if(s.dispatchFlag=!0,s.target=s.currentTarget=this,!s.stopPropagationFlag){let{cow:i,listeners:a}=t;t.cow=!0;for(let o=0;o<a.length;++o){let l=a[o];if(!jd(l)&&(Io(l)&&Sl(t,o,!i)&&(o-=1),s.inPassiveListenerFlag=So(l),Wd(l,this,r),s.inPassiveListenerFlag=!1,s.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return s.target=null,s.currentTarget=null,s.stopImmediatePropagationFlag=!1,s.stopPropagationFlag=!1,s.dispatchFlag=!1,!s.canceledFlag}},Cl=new WeakMap;function Qs(e,t="this"){let r=Cl.get(e);return Mi(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function ko(e){if(typeof e!="function"&&(typeof e!="object"||e===null||typeof e.handleEvent!="function")){if(e==null||typeof e=="object")return void ho.warn(e);throw new TypeError(ml(ho.message,[e]))}}var en=Object.getOwnPropertyNames(Ds.prototype);for(let e=0;e<en.length;++e)en[e]!=="constructor"&&Object.defineProperty(Ds.prototype,en[e],{enumerable:!0});Ue!==void 0&&Ue.EventTarget!==void 0&&Object.setPrototypeOf(Ds.prototype,Ue.EventTarget.prototype);var Eo,Vd=((e,t,r)=>(r=e!=null?Ed(Rd(e)):{},((s,n,i,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Td(n))!Ld.call(s,o)&&o!==i&&po(s,o,{get:()=>n[o],enumerable:!(a=xd(n,o))||a.enumerable});return s})(e&&e.__esModule?r:po(r,"default",{value:e,enumerable:!0}),e)))(Dd()),Ps=512e3,_s=256,xn=(e,{minChunkSize:t=_s,maxChunkSize:r=Ps}={})=>e==null||typeof e=="number"&&e>=256&&e%256==0&&e>=t&&e<=r,Tn=(e,{minChunkSize:t=_s,maxChunkSize:r=Ps}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),Hd=class{constructor(e,t={}){var r,s,n;if(this.readableStream=e,!xn(t.defaultChunkSize,t))throw Tn(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:30720,this.minChunkSize=(s=t.minChunkSize)!=null?s:_s,this.maxChunkSize=(n=t.maxChunkSize)!=null?n:Ps}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!xn(e,this))throw Tn(e,this);this._chunkSize=e}get chunkByteSize(){return 1024*this.chunkSize}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:r,value:s}=await t.read();if(r){if(e){let i=e;e=void 0,yield i}break}let n=s instanceof Uint8Array?new Blob([s],{type:"application/octet-stream"}):s;for(e=e?new Blob([e,n]):n;e;){if(e.size===this.chunkByteSize){let i=e;e=void 0,yield i;break}if(e.size<this.chunkByteSize)break;{let i=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield i}}}}finally{if(e){let r=e;e=void 0,yield r}return void t.releaseLock()}}},Gd=[200,201,202,204,308],kl=[408,502,503,504],El=(e,t)=>!!e&&Gd.includes(e.statusCode),$d=(e,t)=>t.attemptCount>=t.attempts||!(El(e)||((r,{retryCodes:s=kl})=>!r||s.includes(r.statusCode))(e,t)),xl=class{static createUpload(e){return new xl(e)}constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||kl,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=1024*(e.maxFileSize||0),this.chunkCount=0,this.attemptCount=0,this.offline=!1,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,this.chunkedStreamIterable=new Hd(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedStreamIterator=this.chunkedStreamIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.eventTarget=new Ds,this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window<"u"&&(window.addEventListener("online",()=>{!this.offline||(this.offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline=!0,this.dispatch("offline")}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.maxChunkSize)!=null?t:Ps}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:_s}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:30720}set chunkSize(e){this.chunkedStreamIterable.chunkSize=e}get chunkByteSize(){return this.chunkedStreamIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}dispatch(e,t){let r=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(r)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!xn(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw Tn(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!=0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!=0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=r=>{r.upload.onprogress=s=>{var n;let i=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/i,o=this.nextChunkRangeStart/this.file.size,l=s.loaded/((n=s.total)!=null?n:this.chunkByteSize)*a;this.dispatch("progress",Math.min(100*(o+l),100))}};return new Promise((r,s)=>{this.currentXhr=(0,Vd.default)({...e,beforeSend:t},(n,i)=>(this.currentXhr=void 0,n?s(n):r(i)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${r}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,t=await this.sendChunk(e)}catch{}let r={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts};return El(t)?(async s=>{var n;let i=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:i,response:s}),this.attemptCount=0,this.chunkCount=((n=this.chunkCount)!=null?n:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let a=this.chunkSize;i<10?a=Math.min(2*this.chunkSize,this.maxChunkSize):i>30&&(a=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=256*Math.ceil(a/256);let o=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+o)}return!0})(t):$d(t,r)?(async s=>(this.dispatch("error",{message:`Server responded with ${s.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount}),!1))(t):(async()=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount}),new Promise(s=>{setTimeout(async()=>{if(this._paused||this.offline)return this.pendingChunk=e,void s(!1);let n=await this.sendChunkWithRetries(e);s(n)},1e3*this.delayBeforeAttempt)})))()}async sendChunks(){if(this.pendingChunk&&!this._paused&&!this.offline){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedStreamIterator.next(),r=!e&&t;if(e&&(r=await this.sendChunkWithRetries(e)),this.success=!!t,this.success&&r&&this.dispatch("success"),!r)return}}},Yd=xl.createUpload,Jd=Object.defineProperty,x=(e,t,r)=>((s,n,i)=>n in s?Jd(s,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[n]=i)(e,typeof t!="symbol"?t+"":t,r),qd=Object.defineProperty,xo=(e,t,r)=>((s,n,i)=>n in s?qd(s,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[n]=i)(e,typeof t!="symbol"?t+"":t,r),me=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(me||{});const To={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ro={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ir={};function Ui(e){if(Ir[e])return Ir[e];const t=globalThis[e],r=t.prototype,s=e in To?To[e]:void 0,n=!!(s&&s.every(o=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,o))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Ro?Ro[e]:void 0,a=!!(i&&i.every(o=>{var l;return typeof r[o]=="function"&&((l=r[o])==null?void 0:l.toString().includes("[native code]"))}));if(n&&a)return Ir[e]=t.prototype,t.prototype;try{const o=document.createElement("iframe");document.body.appendChild(o);const l=o.contentWindow;if(!l)return t.prototype;const c=l[e].prototype;return document.body.removeChild(o),c?Ir[e]=c:r}catch{return r}}const tn={};function et(e,t,r){var s;const n=`${e}.${String(r)}`;if(tn[n])return tn[n].call(t);const i=Ui(e),a=(s=Object.getOwnPropertyDescriptor(i,r))==null?void 0:s.get;return a?(tn[n]=a,a.call(t)):t[r]}const rn={};function Lo(e,t,r){const s=`${e}.${String(r)}`;if(rn[s])return rn[s].bind(t);const n=Ui(e)[r];return typeof n!="function"?t[r]:(rn[s]=n,n.bind(t))}const ge={childNodes:function(e){return et("Node",e,"childNodes")},parentNode:function(e){return et("Node",e,"parentNode")},parentElement:function(e){return et("Node",e,"parentElement")},textContent:function(e){return et("Node",e,"textContent")},contains:function(e,t){return Lo("Node",e,"contains")(t)},getRootNode:function(e){return Lo("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?et("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?et("Element",e,"shadowRoot"):null},querySelector:function(e,t){return et("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return et("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Ui("MutationObserver").constructor}};function Tl(e){return e.nodeType===e.ELEMENT_NODE}function Xt(e){const t=e&&"host"in e&&"mode"in e&&ge.host(e)||null;return!!(t&&"shadowRoot"in t&&ge.shadowRoot(t)===e)}function Zt(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function qr(e){try{const r=e.rules||e.cssRules;return r?((t=Array.from(r,n=>Rl(n,e.href)).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t):null}catch{return null}var t}function Rl(e,t){if(function(r){return"styleSheet"in r}(e)){let r;try{r=qr(e.styleSheet)||function(s){const{cssText:n}=s;if(n.split('"').length<3)return n;const i=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?i.push("layer"):s.layerName&&i.push(`layer(${s.layerName})`),s.supportsText&&i.push(`supports(${s.supportsText})`),s.media.length&&i.push(s.media.mediaText),i.join(" ")+";"}(e)}catch{r=e.cssText}return e.styleSheet.href?ys(r,e.styleSheet.href):r}{let r=e.cssText;return function(s){return"selectorText"in s}(e)&&e.selectorText.includes(":")&&(r=function(s){const n=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(n,"$1\\$2")}(r)),t?ys(r,t):r}}class Ll{constructor(){xo(this,"idNodeMap",new Map),xo(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const s=r.id;this.idNodeMap.set(s,t),this.nodeMetaMap.set(t,r)}replace(t,r){const s=this.getNode(t);if(s){const n=this.nodeMetaMap.get(s);n&&this.nodeMetaMap.set(r,n)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Di({element:e,maskInputOptions:t,tagName:r,type:s,value:n,maskInputFn:i}){let a=n||"";const o=s&&ft(s);return(t[r.toLowerCase()]||o&&t[o])&&(a=i?i(a,e):"*".repeat(a.length)),a}function ft(e){return e.toLowerCase()}const Oo="__rrweb_original__";function Pi(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ft(t):null}function Ao(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}const s=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(s==null?void 0:s[1])??null}const Kd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Xd=/^(?:[a-z+]+:)?\/\//i,Zd=/^www\..*/i,Qd=/^(data:)([^,]*),(.*)/i;function ys(e,t){return(e||"").replace(Kd,(r,s,n,i,a,o)=>{const l=n||a||o,c=s||i||"";if(!l)return r;if(Xd.test(l)||Zd.test(l))return`url(${c}${l}${c})`;if(Qd.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${function(p){let f="";return f=p.indexOf("//")>-1?p.split("/").slice(0,3).join("/"):p.split("/")[0],f=f.split("?")[0],f}(t)+l}${c})`;const u=t.split("/"),d=l.split("/");u.pop();for(const p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}let ep=1;const tp=new RegExp("[^a-z0-9-_:]");function Ol(){return ep++}let It,Mo;const rp=/^[^ \t\n\r\u000c]+/,sp=/^[, \t\n\r\u000c]+/,Uo=new WeakMap;function Ft(e,t){return t&&t.trim()!==""?_i(e,t):t}function np(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function _i(e,t){let r=Uo.get(e);if(r||(r=e.createElement("a"),Uo.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Al(e,t,r,s){return s&&(r==="src"||r==="href"&&(t!=="use"||s[0]!=="#")||r==="xlink:href"&&s[0]!=="#"?Ft(e,s):r!=="background"||t!=="table"&&t!=="td"&&t!=="th"?r==="srcset"?function(n,i){if(i.trim()==="")return i;let a=0;function o(c){let u;const d=c.exec(i.substring(a));return d?(u=d[0],a+=u.length,u):""}const l=[];for(;o(sp),!(a>=i.length);){let c=o(rp);if(c.slice(-1)===",")c=Ft(n,c.substring(0,c.length-1)),l.push(c);else{let u="";c=Ft(n,c);let d=!1;for(;;){const p=i.charAt(a);if(p===""){l.push((c+u).trim());break}if(d)p===")"&&(d=!1);else{if(p===","){a+=1,l.push((c+u).trim());break}p==="("&&(d=!0)}u+=p,a+=1}}}return l.join(", ")}(e,s):r==="style"?ys(s,_i(e)):t==="object"&&r==="data"?Ft(e,s):s:Ft(e,s))}function Ml(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function ws(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&ws(ge.parentNode(e),t,r);for(let s=e.classList.length;s--;){const n=e.classList[s];if(t.test(n))return!0}return!!r&&ws(ge.parentNode(e),t,r)}function Ul(e,t,r,s){let n;if(Tl(e)){if(n=e,!ge.childNodes(n).length)return!1}else{if(ge.parentElement(e)===null)return!1;n=ge.parentElement(e)}try{if(typeof t=="string"){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ws(n,t,s))return!0;if(r){if(s){if(n.closest(r))return!0}else if(n.matches(r))return!0}}catch{}return!1}function ip(e,t){const{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:a,inlineStylesheet:o,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:w,newlyAddedElement:h=!1}=t,C=function(m,g){if(!g.hasNode(m))return;const v=g.getId(m);return v===1?void 0:v}(r,s);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:me.Document,childNodes:[],compatMode:e.compatMode}:{type:me.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:me.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return function(m,g){const{doc:v,blockClass:S,blockSelector:A,inlineStylesheet:k,maskInputOptions:M={},maskInputFn:U,dataURLOptions:E={},inlineImages:R,recordCanvas:L,keepIframeSrcFn:I,newlyAddedElement:F=!1,rootId:P}=g,b=function(T,D,ne){try{if(typeof D=="string"){if(T.classList.contains(D))return!0}else for(let K=T.classList.length;K--;){const he=T.classList[K];if(D.test(he))return!0}if(ne)return T.matches(ne)}catch{}return!1}(m,S,A),y=function(T){if(T instanceof HTMLFormElement)return"form";const D=ft(T.tagName);return tp.test(D)?"div":D}(m);let O={};const B=m.attributes.length;for(let T=0;T<B;T++){const D=m.attributes[T];Ml(y,D.name,D.value)||(O[D.name]=Al(v,y,ft(D.name),D.value))}if(y==="link"&&k){const T=Array.from(v.styleSheets).find(ne=>ne.href===m.href);let D=null;T&&(D=qr(T)),D&&(delete O.rel,delete O.href,O._cssText=D)}if(y==="style"&&m.sheet&&!(m.innerText||ge.textContent(m)||"").trim().length){const T=qr(m.sheet);T&&(O._cssText=T)}if(y==="input"||y==="textarea"||y==="select"){const T=m.value,D=m.checked;O.type!=="radio"&&O.type!=="checkbox"&&O.type!=="submit"&&O.type!=="button"&&T?O.value=Di({element:m,type:Pi(m),tagName:y,value:T,maskInputOptions:M,maskInputFn:U}):D&&(O.checked=D)}if(y==="option"&&(m.selected&&!M.select?O.selected=!0:delete O.selected),y==="dialog"&&m.open&&(O.rr_open_mode=m.matches("dialog:modal")?"modal":"non-modal"),y==="canvas"&&L){if(m.__context==="2d")(function(T){const D=T.getContext("2d");if(!D)return!0;for(let ne=0;ne<T.width;ne+=50)for(let K=0;K<T.height;K+=50){const he=D.getImageData,Le=Oo in he?he[Oo]:he;if(new Uint32Array(Le.call(D,ne,K,Math.min(50,T.width-ne),Math.min(50,T.height-K)).data.buffer).some(ye=>ye!==0))return!1}return!0})(m)||(O.rr_dataURL=m.toDataURL(E.type,E.quality));else if(!("__context"in m)){const T=m.toDataURL(E.type,E.quality),D=v.createElement("canvas");D.width=m.width,D.height=m.height,T!==D.toDataURL(E.type,E.quality)&&(O.rr_dataURL=T)}}if(y==="img"&&R){It||(It=v.createElement("canvas"),Mo=It.getContext("2d"));const T=m,D=T.currentSrc||T.getAttribute("src")||"<unknown-src>",ne=T.crossOrigin,K=()=>{T.removeEventListener("load",K);try{It.width=T.naturalWidth,It.height=T.naturalHeight,Mo.drawImage(T,0,0),O.rr_dataURL=It.toDataURL(E.type,E.quality)}catch(he){if(T.crossOrigin!=="anonymous")return T.crossOrigin="anonymous",void(T.complete&&T.naturalWidth!==0?K():T.addEventListener("load",K));console.warn(`Cannot inline img src=${D}! Error: ${he}`)}T.crossOrigin==="anonymous"&&(ne?O.crossOrigin=ne:T.removeAttribute("crossorigin"))};T.complete&&T.naturalWidth!==0?K():T.addEventListener("load",K)}if(y==="audio"||y==="video"){const T=O;T.rr_mediaState=m.paused?"paused":"played",T.rr_mediaCurrentTime=m.currentTime,T.rr_mediaPlaybackRate=m.playbackRate,T.rr_mediaMuted=m.muted,T.rr_mediaLoop=m.loop,T.rr_mediaVolume=m.volume}if(F||(m.scrollLeft&&(O.rr_scrollLeft=m.scrollLeft),m.scrollTop&&(O.rr_scrollTop=m.scrollTop)),b){const{width:T,height:D}=m.getBoundingClientRect();O={class:O.class,rr_width:`${T}px`,rr_height:`${D}px`}}y!=="iframe"||I(O.src)||(m.contentDocument||(O.rr_src=O.src),delete O.src);let W;try{customElements.get(y)&&(W=!0)}catch{}return{type:me.Element,tagName:y,attributes:O,childNodes:[],isSVG:np(m)||void 0,needBlock:b,rootId:P,isCustom:W}}(e,{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:f,keepIframeSrcFn:w,newlyAddedElement:h,rootId:C});case e.TEXT_NODE:return function(m,g){var v;const{needsMask:S,maskTextFn:A,rootId:k}=g,M=ge.parentNode(m),U=M&&M.tagName;let E=ge.textContent(m);const R=U==="STYLE"||void 0,L=U==="SCRIPT"||void 0;if(R&&E){try{m.nextSibling||m.previousSibling||(v=M.sheet)!=null&&v.cssRules&&(E=qr(M.sheet))}catch(I){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${I}`,m)}E=ys(E,_i(g.doc))}return L&&(E="SCRIPT_PLACEHOLDER"),!R&&!L&&E&&S&&(E=A?A(E,ge.parentElement(m)):E.replace(/[\S]/g,"*")),{type:me.Text,textContent:E||"",isStyle:R,rootId:k}}(e,{doc:r,needsMask:a,maskTextFn:c,rootId:C});case e.CDATA_SECTION_NODE:return{type:me.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:me.Comment,textContent:ge.textContent(e)||"",rootId:C};default:return!1}}function te(e){return e==null?"":e.toLowerCase()}function Tt(e,t){const{doc:r,mirror:s,blockClass:n,blockSelector:i,maskTextClass:a,maskTextSelector:o,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:w={},inlineImages:h=!1,recordCanvas:C=!1,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:M=!1}=t;let{needsMask:U}=t,{preserveWhiteSpace:E=!0}=t;U||(U=Ul(e,a,o,U===void 0));const R=ip(e,{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:U,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:w,inlineImages:h,recordCanvas:C,keepIframeSrcFn:k,newlyAddedElement:M});if(!R)return console.warn(e,"not serialized"),null;let L;L=s.hasNode(e)?s.getId(e):!function(b,y){return!!(y.comment&&b.type===me.Comment||b.type===me.Element&&(y.script&&(b.tagName==="script"||b.tagName==="link"&&(b.attributes.rel==="preload"||b.attributes.rel==="modulepreload")&&b.attributes.as==="script"||b.tagName==="link"&&b.attributes.rel==="prefetch"&&typeof b.attributes.href=="string"&&Ao(b.attributes.href)==="js")||y.headFavicon&&(b.tagName==="link"&&b.attributes.rel==="shortcut icon"||b.tagName==="meta"&&(te(b.attributes.name).match(/^msapplication-tile(image|color)$/)||te(b.attributes.name)==="application-name"||te(b.attributes.rel)==="icon"||te(b.attributes.rel)==="apple-touch-icon"||te(b.attributes.rel)==="shortcut icon"))||b.tagName==="meta"&&(y.headMetaDescKeywords&&te(b.attributes.name).match(/^description|keywords$/)||y.headMetaSocial&&(te(b.attributes.property).match(/^(og|twitter|fb):/)||te(b.attributes.name).match(/^(og|twitter):/)||te(b.attributes.name)==="pinterest")||y.headMetaRobots&&(te(b.attributes.name)==="robots"||te(b.attributes.name)==="googlebot"||te(b.attributes.name)==="bingbot")||y.headMetaHttpEquiv&&b.attributes["http-equiv"]!==void 0||y.headMetaAuthorship&&(te(b.attributes.name)==="author"||te(b.attributes.name)==="generator"||te(b.attributes.name)==="framework"||te(b.attributes.name)==="publisher"||te(b.attributes.name)==="progid"||te(b.attributes.property).match(/^article:/)||te(b.attributes.property).match(/^product:/))||y.headMetaVerification&&(te(b.attributes.name)==="google-site-verification"||te(b.attributes.name)==="yandex-verification"||te(b.attributes.name)==="csrf-token"||te(b.attributes.name)==="p:domain_verify"||te(b.attributes.name)==="verify-v1"||te(b.attributes.name)==="verification"||te(b.attributes.name)==="shopify-checkout-api-token"))))}(R,f)&&(E||R.type!==me.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?Ol():-2;const I=Object.assign(R,{id:L});if(s.add(e,I),L===-2)return null;m&&m(e);let F=!l;if(I.type===me.Element){F=F&&!I.needBlock,delete I.needBlock;const b=ge.shadowRoot(e);b&&Zt(b)&&(I.isShadowHost=!0)}if((I.type===me.Document||I.type===me.Element)&&F){f.headWhitespace&&I.type===me.Element&&I.tagName==="head"&&(E=!1);const b={doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:U,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:w,inlineImages:h,recordCanvas:C,preserveWhiteSpace:E,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:S,stylesheetLoadTimeout:A,keepIframeSrcFn:k};if(!(I.type===me.Element&&I.tagName==="textarea"&&I.attributes.value!==void 0))for(const O of Array.from(ge.childNodes(e))){const B=Tt(O,b);B&&I.childNodes.push(B)}let y=null;if(Tl(e)&&(y=ge.shadowRoot(e)))for(const O of Array.from(ge.childNodes(y))){const B=Tt(O,b);B&&(Zt(y)&&(B.isShadow=!0),I.childNodes.push(B))}}const P=ge.parentNode(e);return P&&Xt(P)&&Zt(P)&&(I.isShadow=!0),I.type===me.Element&&I.tagName==="iframe"&&function(b,y,O){const B=b.contentWindow;if(!B)return;let W,T=!1;try{W=B.document.readyState}catch{return}if(W!=="complete"){const ne=setTimeout(()=>{T||(y(),T=!0)},O);return void b.addEventListener("load",()=>{clearTimeout(ne),T=!0,y()})}const D="about:blank";if(B.location.href!==D||b.src===D||b.src==="")return setTimeout(y,0),b.addEventListener("load",y);b.addEventListener("load",y)}(e,()=>{const b=e.contentDocument;if(b&&g){const y=Tt(b,{doc:b,mirror:s,blockClass:n,blockSelector:i,needsMask:U,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:w,inlineImages:h,recordCanvas:C,preserveWhiteSpace:E,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:S,stylesheetLoadTimeout:A,keepIframeSrcFn:k});y&&g(e,y)}},v),I.type===me.Element&&I.tagName==="link"&&typeof I.attributes.rel=="string"&&(I.attributes.rel==="stylesheet"||I.attributes.rel==="preload"&&typeof I.attributes.href=="string"&&Ao(I.attributes.href)==="css")&&function(b,y,O){let B,W=!1;try{B=b.sheet}catch{return}if(B)return;const T=setTimeout(()=>{W||(y(),W=!0)},O);b.addEventListener("load",()=>{clearTimeout(T),W=!0,y()})}(e,()=>{if(S){const b=Tt(e,{doc:r,mirror:s,blockClass:n,blockSelector:i,needsMask:U,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:w,inlineImages:h,recordCanvas:C,preserveWhiteSpace:E,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:S,stylesheetLoadTimeout:A,keepIframeSrcFn:k});b&&S(e,b)}},A),I}function op(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ap(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}),r}var Rn={exports:{}},ie=String,Do=function(){return{isColorSupported:!1,reset:ie,bold:ie,dim:ie,italic:ie,underline:ie,inverse:ie,hidden:ie,strikethrough:ie,black:ie,red:ie,green:ie,yellow:ie,blue:ie,magenta:ie,cyan:ie,white:ie,gray:ie,bgBlack:ie,bgRed:ie,bgGreen:ie,bgYellow:ie,bgBlue:ie,bgMagenta:ie,bgCyan:ie,bgWhite:ie}};Rn.exports=Do(),Rn.exports.createColors=Do;var lp=Rn.exports;const Pe=ap(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let Po=lp,_o=Pe,Ln=class Dl extends Error{constructor(t,r,s,n,i,a){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),a&&(this.plugin=a),r!==void 0&&s!==void 0&&(typeof r=="number"?(this.line=r,this.column=s):(this.line=r.line,this.column=r.column,this.endLine=s.line,this.endColumn=s.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Dl)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",this.line!==void 0&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let r=this.source;t==null&&(t=Po.isColorSupported),_o&&t&&(r=_o(r));let s,n,i=r.split(/\r?\n/),a=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),l=String(o).length;if(t){let{bold:c,gray:u,red:d}=Po.createColors(!0);s=p=>c(d(p)),n=p=>u(p)}else s=n=c=>c;return i.slice(a,o).map((c,u)=>{let d=a+1+u,p=" "+(" "+d).slice(-l)+" | ";if(d===this.line){let f=n(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+n(p)+c+`
4
+ `+f+s("^")}return" "+n(p)+c}).join(`
5
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
6
+
7
+ `+t+`
8
+ `),this.name+": "+this.message+t}};var Ni=Ln;Ln.default=Ln;var ir={};ir.isClean=Symbol("isClean"),ir.my=Symbol("my");const No={after:`
9
+ `,beforeClose:`
10
+ `,beforeComment:`
11
+ `,beforeDecl:`
12
+ `,beforeOpen:" ",beforeRule:`
13
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let On=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,s=e.params?this.rawValue(e,"params"):"";if(e.raws.afterName!==void 0?r+=e.raws.afterName:s&&(r+=" "),e.nodes)this.block(e,r+s);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+s+n,e)}}beforeAfter(e,t){let r;r=e.type==="decl"?this.raw(e,null,"beforeDecl"):e.type==="comment"?this.raw(e,null,"beforeComment"):t==="before"?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let s=e.parent,n=0;for(;s&&s.type!=="root";)n+=1,s=s.parent;if(r.includes(`
14
+ `)){let i=this.raw(e,null,"indent");if(i.length)for(let a=0;a<n;a++)r+=i}return r}block(e,t){let r,s=this.raw(e,"between","beforeOpen");this.builder(t+s+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let s=0;s<e.nodes.length;s++){let n=e.nodes[s],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,t!==s||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),s=e.prop+r+this.rawValue(e,"value");e.important&&(s+=e.raws.important||" !important"),t&&(s+=";"),this.builder(s,e)}document(e){this.body(e)}raw(e,t,r){let s;if(r||(r=t),t&&(s=e.raws[t],s!==void 0))return s;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return No[r];let i=e.root();if(i.rawCache||(i.rawCache={}),i.rawCache[r]!==void 0)return i.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let o="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[o]?s=this[o](i,e):i.walk(l=>{if(s=l.raws[t],s!==void 0)return!1})}var a;return s===void 0&&(s=No[r]),i.rawCache[r]=s,s}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&r.raws.after!==void 0)return t=r.raws.after,t.includes(`
15
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(`
16
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(`
17
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,t!==void 0))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&r.raws.before!==void 0)return t=r.raws.before,t.includes(`
18
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(r.raws.between!==void 0)return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,t!==void 0))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let s=r.parent;if(s&&s!==e&&s.parent&&s.parent===e&&r.raws.before!==void 0){let n=r.raws.before.split(`
19
+ `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,t!==void 0))return!1}),t}rawValue(e,t){let r=e[t],s=e.raws[t];return s&&s.value===r?s.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var Pl=On;On.default=On;let cp=Pl;function An(e,t){new cp(t).stringify(e)}var Ns=An;An.default=An;let{isClean:Cr,my:up}=ir,dp=Ni,pp=Pl,hp=Ns;function Mn(e,t){let r=new e.constructor;for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s==="proxyCache")continue;let n=e[s],i=typeof n;s==="parent"&&i==="object"?t&&(r[s]=t):s==="source"?r[s]=n:Array.isArray(n)?r[s]=n.map(a=>Mn(a,r)):(i==="object"&&n!==null&&(n=Mn(n)),r[s]=n)}return r}let Un=class{constructor(e={}){this.raws={},this[Cr]=!1,this[up]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Mn(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:r.column,line:r.line},t)}return new dp(e)}getProxyProcessor(){return{get:(e,t)=>t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,t!=="prop"&&t!=="value"&&t!=="name"&&t!=="params"&&t!=="important"&&t!=="text"||e.markDirty()),!0)}}markDirty(){if(this[Cr]){this[Cr]=!1;let e=this;for(;e=e.parent;)e[Cr]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let s=(t=this.toString()).indexOf(e.word);s!==-1&&(r=this.positionInside(s,t))}return r}positionInside(e,t){let r=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let i=0;i<e;i++)r[i]===`
20
+ `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),r=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new pp().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let s of e)s===this?r=!0:r?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},s=t==null;t=t||new Map;let n=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let a=this[i];if(Array.isArray(a))r[i]=a.map(o=>typeof o=="object"&&o.toJSON?o.toJSON(null,t):o);else if(typeof a=="object"&&a.toJSON)r[i]=a.toJSON(null,t);else if(i==="source"){let o=t.get(a.input);o==null&&(o=n,t.set(a.input,n),n++),r[i]={end:a.end,inputId:o,start:a.start}}else r[i]=a}return s&&(r.inputs=[...t.keys()].map(i=>i.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=hp){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let s={node:this};for(let n in r)s[n]=r[n];return e.warn(t,s)}get proxyOf(){return this}};var Fs=Un;Un.default=Un;let mp=Fs,Dn=class extends mp{constructor(e){e&&e.value!==void 0&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var Bs=Dn;Dn.default=Dn;var fp={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:Fo,SourceMapGenerator:Bo}=Pe,{existsSync:gp,readFileSync:yp}=Pe,{dirname:sn,join:wp}=Pe,Pn=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,s=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=sn(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new Fo(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e=="object"&&(typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),s=e.indexOf("*/",r);r>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,s)))}loadFile(e){if(this.root=sn(e),gp(e))return this.mapFile=e,yp(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t!="function"){if(t instanceof Fo)return Bo.fromSourceMap(t).toString();if(t instanceof Bo)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let r=t(e);if(r){let s=this.loadFile(r);if(!s)throw new Error("Unable to load previous source map: "+r.toString());return s}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=wp(sn(e),r)),this.loadFile(r)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var _l=Pn;Pn.default=Pn;let{SourceMapConsumer:bp,SourceMapGenerator:vp}=Pe,{fileURLToPath:zo,pathToFileURL:kr}=Pe,{isAbsolute:_n,resolve:Nn}=Pe,{nanoid:Sp}=fp,nn=Pe,jo=Ni,Ip=_l,on=Symbol("fromOffsetCache"),Cp=!!(bp&&vp),Wo=!!(Nn&&_n),Kr=class{constructor(e,t={}){if(e==null||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Wo||/^\w+:\/\//.test(t.from)||_n(t.from)?this.file=t.from:this.file=Nn(t.from)),Wo&&Cp){let r=new Ip(this.css,t);if(r.text){this.map=r;let s=r.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+Sp(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,s={}){let n,i,a;if(t&&typeof t=="object"){let l=t,c=r;if(typeof l.offset=="number"){let u=this.fromOffset(l.offset);t=u.line,r=u.col}else t=l.line,r=l.column;if(typeof c.offset=="number"){let u=this.fromOffset(c.offset);i=u.line,a=u.col}else i=c.line,a=c.column}else if(!r){let l=this.fromOffset(t);t=l.line,r=l.col}let o=this.origin(t,r,i,a);return n=o?new jo(e,o.endLine===void 0?o.line:{column:o.column,line:o.line},o.endLine===void 0?o.column:{column:o.endColumn,line:o.endLine},o.source,o.file,s.plugin):new jo(e,i===void 0?t:{column:r,line:t},i===void 0?r:{column:a,line:i},this.css,this.file,s.plugin),n.input={column:r,endColumn:a,endLine:i,line:t,source:this.css},this.file&&(kr&&(n.input.url=kr(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[on])r=this[on];else{let n=this.css.split(`
21
+ `);r=new Array(n.length);let i=0;for(let a=0,o=n.length;a<o;a++)r[a]=i,i+=n[a].length+1;this[on]=r}t=r[r.length-1];let s=0;if(e>=t)s=r.length-1;else{let n,i=r.length-2;for(;s<i;)if(n=s+(i-s>>1),e<r[n])i=n-1;else{if(!(e>=r[n+1])){s=n;break}s=n+1}}return{col:e-r[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Nn(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,s){if(!this.map)return!1;let n,i,a=this.map.consumer(),o=a.originalPositionFor({column:t,line:e});if(!o.source)return!1;typeof r=="number"&&(n=a.originalPositionFor({column:s,line:r})),i=_n(o.source)?kr(o.source):new URL(o.source,this.map.consumer().sourceRoot||kr(this.map.mapFile));let l={column:o.column,endColumn:n&&n.column,endLine:n&&n.line,line:o.line,url:i.toString()};if(i.protocol==="file:"){if(!zo)throw new Error("file: protocol is not available in this PostCSS build");l.file=zo(i)}let c=a.sourceContentFor(o.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var zs=Kr;Kr.default=Kr,nn&&nn.registerInput&&nn.registerInput(Kr);let{SourceMapConsumer:Nl,SourceMapGenerator:Xr}=Pe,{dirname:Zr,relative:Fl,resolve:Bl,sep:zl}=Pe,{pathToFileURL:Vo}=Pe,kp=zs,Ep=!!(Nl&&Xr),xp=!!(Zr&&Bl&&Fl&&zl);var jl=class{constructor(e,t,r,s){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t=`
22
+ `;this.css.includes(`\r
23
+ `)&&(t=`\r
24
+ `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,r=this.toUrl(this.path(e.file)),s=e.root||Zr(e.file);this.mapOpts.sourcesContent===!1?(t=new Nl(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,r,this.toUrl(this.path(s)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),xp&&Ep&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Xr.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Xr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Xr({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,r=1,s=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(a,o,l)=>{if(this.css+=a,o&&l!=="end"&&(i.generated.line=r,i.generated.column=s-1,o.source&&o.source.start?(i.source=this.sourcePath(o),i.original.line=o.source.start.line,i.original.column=o.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=a.match(/\n/g),e?(r+=e.length,t=a.lastIndexOf(`
25
+ `),s=a.length-t):s+=a.length,o&&l!=="start"){let c=o.parent||{raws:{}};(o.type==="decl"||o.type==="atrule"&&!o.nodes)&&o===c.last&&!c.raws.semicolon||(o.source&&o.source.end?(i.source=this.sourcePath(o),i.original.line=o.source.end.line,i.original.column=o.source.end.column-1,i.generated.line=r,i.generated.column=s-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=r,i.generated.column=s-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(this.mapOpts.annotation!==void 0?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(e===void 0||e===!0)&&(!this.previous().length||this.previous().some(t=>t.inline))}isMap(){return this.opts.map!==void 0?!!this.opts.map:this.previous().length>0}isSourcesContent(){return this.mapOpts.sourcesContent!==void 0?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Zr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Zr(Bl(r,this.mapOpts.annotation)));let s=Fl(r,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new kp(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let s=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Vo){let r=Vo(e).toString();return this.memoizedFileURLs.set(e,r),r}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;zl==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let Tp=Fs,Fn=class extends Tp{constructor(e){super(e),this.type="comment"}};var js=Fn;Fn.default=Fn;let Wl,Fi,Bi,Vl,{isClean:Hl,my:Gl}=ir,$l=Bs,Yl=js,Rp=Fs;function Jl(e){return e.map(t=>(t.nodes&&(t.nodes=Jl(t.nodes)),delete t.source,t))}function ql(e){if(e[Hl]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ql(t)}let Ke=class Kl extends Rp{append(...t){for(let r of t){let s=this.normalize(r,this.last);for(let n of s)this.proxyOf.nodes.push(n)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r,s,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],s=t(this.proxyOf.nodes[r],r),s!==!1);)this.indexes[n]+=1;return delete this.indexes[n],s}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get:(t,r)=>r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...s)=>t[r](...s.map(n=>typeof n=="function"?(i,a)=>n(i.toProxy(),a):n)):r==="every"||r==="some"?s=>t[r]((n,...i)=>s(n.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(s=>s.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r],set:(t,r,s)=>(t[r]===s||(t[r]=s,r!=="name"&&r!=="params"&&r!=="selector"||t.markDirty()),!0)}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let s,n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n+1,0,a);for(let a in this.indexes)s=this.indexes[a],n<s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}insertBefore(t,r){let s,n=this.index(t),i=n===0&&"prepend",a=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let o of a)this.proxyOf.nodes.splice(n,0,o);for(let o in this.indexes)s=this.indexes[o],n<=s&&(this.indexes[o]=s+a.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Jl(Wl(t).nodes);else if(t===void 0)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let s of t)s.parent&&s.parent.removeChild(s,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let s of t)s.parent&&s.parent.removeChild(s,"ignore")}else if(t.type)t=[t];else if(t.prop){if(t.value===void 0)throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new $l(t)]}else if(t.selector)t=[new Fi(t)];else if(t.name)t=[new Bi(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Yl(t)]}return t.map(s=>(s[Gl]||Kl.rebuild(s),(s=s.proxyOf).parent&&s.parent.removeChild(s),s[Hl]&&ql(s),s.raws.before===void 0&&r&&r.raws.before!==void 0&&(s.raws.before=r.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...t){t=t.reverse();for(let r of t){let s=this.normalize(r,this.first,"prepend").reverse();for(let n of s)this.proxyOf.nodes.unshift(n);for(let n in this.indexes)this.indexes[n]=this.indexes[n]+s.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){let r;t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);for(let s in this.indexes)r=this.indexes[s],r>=t&&(this.indexes[s]=r-1);return this.markDirty(),this}replaceValues(t,r,s){return s||(s=r,r={}),this.walkDecls(n=>{r.props&&!r.props.includes(n.prop)||r.fast&&!n.value.includes(r.fast)||(n.value=n.value.replace(t,s))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,s)=>{let n;try{n=t(r,s)}catch(i){throw r.addToError(i)}return n!==!1&&r.walk&&(n=r.walk(t)),n})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="atrule"&&t.test(s.name))return r(s,n)}):this.walk((s,n)=>{if(s.type==="atrule"&&s.name===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="atrule")return r(s,n)}))}walkComments(t){return this.walk((r,s)=>{if(r.type==="comment")return t(r,s)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="decl"&&t.test(s.prop))return r(s,n)}):this.walk((s,n)=>{if(s.type==="decl"&&s.prop===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="decl")return r(s,n)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="rule"&&t.test(s.selector))return r(s,n)}):this.walk((s,n)=>{if(s.type==="rule"&&s.selector===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="rule")return r(s,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Ke.registerParse=e=>{Wl=e},Ke.registerRule=e=>{Fi=e},Ke.registerAtRule=e=>{Bi=e},Ke.registerRoot=e=>{Vl=e};var yt=Ke;Ke.default=Ke,Ke.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Bi.prototype):e.type==="rule"?Object.setPrototypeOf(e,Fi.prototype):e.type==="decl"?Object.setPrototypeOf(e,$l.prototype):e.type==="comment"?Object.setPrototypeOf(e,Yl.prototype):e.type==="root"&&Object.setPrototypeOf(e,Vl.prototype),e[Gl]=!0,e.nodes&&e.nodes.forEach(t=>{Ke.rebuild(t)})};let Xl,Zl,Lp=yt,or=class extends Lp{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Xl(new Zl,this,e).stringify()}};or.registerLazyResult=e=>{Xl=e},or.registerProcessor=e=>{Zl=e};var zi=or;or.default=or;let Bn=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Ql=Bn;Bn.default=Bn;let Op=Ql,zn=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Op(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var ji=zn;zn.default=zn;const an=39,Ho=34,Er=92,Go=47,xr=10,Bt=32,Tr=12,Rr=9,Lr=13,Ap=91,Mp=93,Up=40,Dp=41,Pp=123,_p=125,Np=59,Fp=42,Bp=58,zp=64,Or=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ar=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,jp=/.[\r\n"'(/\\]/,$o=/[\da-f]/i;let ec=yt,Qr=class extends ec{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Wi=Qr;Qr.default=Qr,ec.registerAtRule(Qr);let tc,rc,sc=yt,At=class extends sc{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let s=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new tc(new rc,this,e).stringify()}};At.registerLazyResult=e=>{tc=e},At.registerProcessor=e=>{rc=e};var yr=At;At.default=At,sc.registerRoot(At);let ar={comma:e=>ar.split(e,[","],!0),space:e=>ar.split(e,[" ",`
26
+ `," "]),split(e,t,r){let s=[],n="",i=!1,a=0,o=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:o?u===l&&(o=!1):u==='"'||u==="'"?(o=!0,l=u):u==="("?a+=1:u===")"?a>0&&(a-=1):a===0&&t.includes(u)&&(i=!0),i?(n!==""&&s.push(n.trim()),n="",i=!1):n+=u;return(r||n!=="")&&s.push(n.trim()),s}};var nc=ar;ar.default=ar;let ic=yt,Wp=nc,es=class extends ic{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Wp.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var Vi=es;es.default=es,ic.registerRule(es);let Vp=Bs,Hp=function(e,t={}){let r,s,n,i,a,o,l,c,u,d,p=e.css.valueOf(),f=t.ignoreErrors,w=p.length,h=0,C=[],m=[];function g(v){throw e.error("Unclosed "+v,h)}return{back:function(v){m.push(v)},endOfFile:function(){return m.length===0&&h>=w},nextToken:function(v){if(m.length)return m.pop();if(h>=w)return;let S=!!v&&v.ignoreUnclosed;switch(r=p.charCodeAt(h),r){case xr:case Bt:case Rr:case Lr:case Tr:s=h;do s+=1,r=p.charCodeAt(s);while(r===Bt||r===xr||r===Rr||r===Lr||r===Tr);d=["space",p.slice(h,s)],h=s-1;break;case Ap:case Mp:case Pp:case _p:case Bp:case Np:case Dp:{let A=String.fromCharCode(r);d=[A,A,h];break}case Up:if(c=C.length?C.pop()[1]:"",u=p.charCodeAt(h+1),c==="url"&&u!==an&&u!==Ho&&u!==Bt&&u!==xr&&u!==Rr&&u!==Tr&&u!==Lr){s=h;do{if(o=!1,s=p.indexOf(")",s+1),s===-1){if(f||S){s=h;break}g("bracket")}for(l=s;p.charCodeAt(l-1)===Er;)l-=1,o=!o}while(o);d=["brackets",p.slice(h,s+1),h,s],h=s}else s=p.indexOf(")",h+1),i=p.slice(h,s+1),s===-1||jp.test(i)?d=["(","(",h]:(d=["brackets",i,h,s],h=s);break;case an:case Ho:n=r===an?"'":'"',s=h;do{if(o=!1,s=p.indexOf(n,s+1),s===-1){if(f||S){s=h+1;break}g("string")}for(l=s;p.charCodeAt(l-1)===Er;)l-=1,o=!o}while(o);d=["string",p.slice(h,s+1),h,s],h=s;break;case zp:Or.lastIndex=h+1,Or.test(p),s=Or.lastIndex===0?p.length-1:Or.lastIndex-2,d=["at-word",p.slice(h,s+1),h,s],h=s;break;case Er:for(s=h,a=!0;p.charCodeAt(s+1)===Er;)s+=1,a=!a;if(r=p.charCodeAt(s+1),a&&r!==Go&&r!==Bt&&r!==xr&&r!==Rr&&r!==Lr&&r!==Tr&&(s+=1,$o.test(p.charAt(s)))){for(;$o.test(p.charAt(s+1));)s+=1;p.charCodeAt(s+1)===Bt&&(s+=1)}d=["word",p.slice(h,s+1),h,s],h=s;break;default:r===Go&&p.charCodeAt(h+1)===Fp?(s=p.indexOf("*/",h+2)+1,s===0&&(f||S?s=p.length:g("comment")),d=["comment",p.slice(h,s+1),h,s],h=s):(Ar.lastIndex=h+1,Ar.test(p),s=Ar.lastIndex===0?p.length-1:Ar.lastIndex-2,d=["word",p.slice(h,s+1),h,s],C.push(d),h=s)}return h++,d},position:function(){return h}}},Gp=js,$p=Wi,Yp=yr,Yo=Vi;const Jo={empty:!0,space:!0};var Jp=class{constructor(e){this.input=e,this.root=new Yp,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,s,n=new $p;n.name=e[1].slice(1),n.name===""&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!1,a=!1,o=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],t==="("||t==="["?l.push(t==="("?")":"]"):t==="{"&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),l.length===0){if(t===";"){n.source.end=this.getPosition(e[2]),n.source.end.offset++,this.semicolon=!0;break}if(t==="{"){a=!0;break}if(t==="}"){if(o.length>0){for(s=o.length-1,r=o[s];r&&r[0]==="space";)r=o[--s];r&&(n.source.end=this.getPosition(r[3]||r[2]),n.source.end.offset++)}this.end(e);break}o.push(e)}else o.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(o),o.length?(n.raws.afterName=this.spacesAndCommentsFromStart(o),this.raw(n,"params",o),i&&(e=o[o.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r,s=0;for(let n=t-1;n>=0&&(r=e[n],r[0]==="space"||(s+=1,s!==2));n--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(e){let t,r,s,n=0;for(let[i,a]of e.entries()){if(t=a,r=t[0],r==="("&&(n+=1),r===")"&&(n-=1),n===0&&r===":"){if(s){if(s[0]==="word"&&s[1]==="progid")continue;return i}this.doubleColon(t)}s=t}return!1}comment(e){let t=new Gp;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let s=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Hp(this.input)}decl(e,t){let r=new Vp;this.init(r,e[0][2]);let s,n=e[e.length-1];for(n[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(n[3]||n[2]||function(o){for(let l=o.length-1;l>=0;l--){let c=o[l],u=c[3]||c[2];if(u)return u}}(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let o=e[0][0];if(o===":"||o==="space"||o==="comment")break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(s=e.shift(),s[0]===":"){r.raws.between+=s[1];break}s[0]==="word"&&/\w/.test(s[1])&&this.unknownWord([s]),r.raws.between+=s[1]}r.prop[0]!=="_"&&r.prop[0]!=="*"||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i,a=[];for(;e.length&&(i=e[0][0],i==="space"||i==="comment");)a.push(e.shift());this.precheckMissedSemicolon(e);for(let o=e.length-1;o>=0;o--){if(s=e[o],s[1].toLowerCase()==="!important"){r.important=!0;let l=this.stringFrom(e,o);l=this.spacesFromEnd(e)+l,l!==" !important"&&(r.raws.important=l);break}if(s[1].toLowerCase()==="important"){let l=e.slice(0),c="";for(let u=o;u>0;u--){let d=l[u][0];if(c.trim().indexOf("!")===0&&d!=="space")break;c=l.pop()[1]+c}c.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=c,e=l)}if(s[0]!=="space"&&s[0]!=="comment")break}e.some(o=>o[0]!=="space"&&o[0]!=="comment")&&(r.raws.between+=a.map(o=>o[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Yo;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,s=!1,n=null,i=[],a=e[1].startsWith("--"),o=[],l=e;for(;l;){if(r=l[0],o.push(l),r==="("||r==="[")n||(n=l),i.push(r==="("?")":"]");else if(a&&s&&r==="{")n||(n=l),i.push("}");else if(i.length===0){if(r===";"){if(s)return void this.decl(o,a);break}if(r==="{")return void this.rule(o);if(r==="}"){this.tokenizer.back(o.pop()),t=!0;break}r===":"&&(s=!0)}else r===i[i.length-1]&&(i.pop(),i.length===0&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;o.length&&(l=o[o.length-1][0],l==="space"||l==="comment");)this.tokenizer.back(o.pop());this.decl(o,a)}else this.unknownWord(o)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,s){let n,i,a,o,l=r.length,c="",u=!0;for(let d=0;d<l;d+=1)n=r[d],i=n[0],i!=="space"||d!==l-1||s?i==="comment"?(o=r[d-1]?r[d-1][0]:"empty",a=r[d+1]?r[d+1][0]:"empty",Jo[o]||Jo[a]||c.slice(-1)===","?u=!1:c+=n[1]):c+=n[1]:u=!1;if(!u){let d=r.reduce((p,f)=>p+f[1],"");e.raws[t]={raw:d,value:c}}e[t]=c}rule(e){e.pop();let t=new Yo;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space"||t==="comment");)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],t==="space"||t==="comment");)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let s=t;s<e.length;s++)r+=e[s][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let qp=yt,Kp=Jp,Xp=zs;function ts(e,t){let r=new Xp(e,t),s=new Kp(r);try{s.parse()}catch(n){throw n}return s.root}var Hi=ts;ts.default=ts,qp.registerParse(ts);let{isClean:Ne,my:Zp}=ir,Qp=jl,eh=Ns,th=yt,rh=zi,qo=ji,sh=Hi,nh=yr;const ih={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},oh={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ah={Once:!0,postcssPlugin:!0,prepare:!0};function zt(e){return typeof e=="object"&&typeof e.then=="function"}function oc(e){let t=!1,r=ih[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function Ko(e){let t;return t=e.type==="document"?["Document",0,"DocumentExit"]:e.type==="root"?["Root",0,"RootExit"]:oc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function jn(e){return e[Ne]=!1,e.nodes&&e.nodes.forEach(t=>jn(t)),e}let Wn={},Rt=class ac{constructor(t,r,s){let n;if(this.stringified=!1,this.processed=!1,typeof r!="object"||r===null||r.type!=="root"&&r.type!=="document")if(r instanceof ac||r instanceof qo)n=jn(r.root),r.map&&(s.map===void 0&&(s.map={}),s.map.inline||(s.map.inline=!1),s.map.prev=r.map);else{let i=sh;s.syntax&&(i=s.syntax.parse),s.parser&&(i=s.parser),i.parse&&(i=i.parse);try{n=i(r,s)}catch(a){this.processed=!0,this.error=a}n&&!n[Zp]&&th.rebuild(n)}else n=jn(r);this.result=new qo(t,n,s),this.helpers={...Wn,postcss:Wn,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let s=this.result.lastPlugin;try{r&&r.addToError(t),this.error=t,t.name!=="CssSyntaxError"||t.plugin?s.postcssVersion:(t.plugin=s.postcssPlugin,t.setMessage())}catch(n){console&&console.error&&console.error(n)}return t}prepareVisitors(){this.listeners={};let t=(r,s,n)=>{this.listeners[s]||(this.listeners[s]=[]),this.listeners[s].push([r,n])};for(let r of this.plugins)if(typeof r=="object")for(let s in r){if(!oh[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ah[s])if(typeof r[s]=="object")for(let n in r[s])t(r,n==="*"?s:s+"-"+n.toLowerCase(),r[s][n]);else typeof r[s]=="function"&&t(r,s,r[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],s=this.runOnRoot(r);if(zt(s))try{await s}catch(n){throw this.handleError(n)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ne];){t[Ne]=!0;let r=[Ko(t)];for(;r.length>0;){let s=this.visitTick(r);if(zt(s))try{await s}catch(n){let i=r[r.length-1].node;throw this.handleError(n,i)}}}if(this.listeners.OnceExit)for(let[r,s]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let n=t.nodes.map(i=>s(i,this.helpers));await Promise.all(n)}else await s(t,this.helpers)}catch(n){throw this.handleError(n)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(s=>t.Once(s,this.helpers));return zt(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=eh;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let s=new Qp(r,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins)if(zt(this.runOnRoot(t)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ne];)t[Ne]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[s,n]of t){let i;this.result.lastPlugin=s;try{i=n(r,this.helpers)}catch(a){throw this.handleError(a,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(zt(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:s,visitors:n}=r;if(s.type!=="root"&&s.type!=="document"&&!s.parent)return void t.pop();if(n.length>0&&r.visitorIndex<n.length){let[a,o]=n[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===n.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=a;try{return o(s.toProxy(),this.helpers)}catch(l){throw this.handleError(l,s)}}if(r.iterator!==0){let a,o=r.iterator;for(;a=s.nodes[s.indexes[o]];)if(s.indexes[o]+=1,!a[Ne])return a[Ne]=!0,void t.push(Ko(a));r.iterator=0,delete s.indexes[o]}let i=r.events;for(;r.eventIndex<i.length;){let a=i[r.eventIndex];if(r.eventIndex+=1,a===0)return void(s.nodes&&s.nodes.length&&(s[Ne]=!0,r.iterator=s.getIterator()));if(this.listeners[a])return void(r.visitors=this.listeners[a])}t.pop()}walkSync(t){t[Ne]=!0;let r=oc(t);for(let s of r)if(s===0)t.nodes&&t.each(n=>{n[Ne]||this.walkSync(n)});else{let n=this.listeners[s];if(n&&this.visitSync(n,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Rt.registerPostcss=e=>{Wn=e};var lc=Rt;Rt.default=Rt,nh.registerLazyResult(Rt),rh.registerLazyResult(Rt);let lh=jl,ch=Ns,uh=Hi;const dh=ji;let Vn=class{constructor(e,t,r){let s;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let n=ch;this.result=new dh(this._processor,s,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let a=new lh(n,s,this._opts,t);if(a.isMap()){let[o,l]=a.generate();o&&(this.result.css=o),l&&(this.result.map=l)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=uh;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var ph=Vn;Vn.default=Vn;let hh=ph,mh=lc,fh=zi,gh=yr,Ht=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r!="object"||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new mh(this,e,t):new hh(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var yh=Ht;Ht.default=Ht,gh.registerProcessor(Ht),fh.registerProcessor(Ht);let wh=Bs,bh=_l,vh=js,Sh=Wi,Ih=zs,Ch=yr,kh=Vi;function lr(e,t){if(Array.isArray(e))return e.map(n=>lr(n));let{inputs:r,...s}=e;if(r){t=[];for(let n of r){let i={...n,__proto__:Ih.prototype};i.map&&(i.map={...i.map,__proto__:bh.prototype}),t.push(i)}}if(s.nodes&&(s.nodes=e.nodes.map(n=>lr(n,t))),s.source){let{inputId:n,...i}=s.source;s.source=i,n!=null&&(s.source.input=t[n])}if(s.type==="root")return new Ch(s);if(s.type==="decl")return new wh(s);if(s.type==="rule")return new kh(s);if(s.type==="comment")return new vh(s);if(s.type==="atrule")return new Sh(s);throw new Error("Unknown node type: "+e.type)}var Eh=lr;lr.default=lr;let xh=Ni,Xo=Bs,Th=lc,Rh=yt,Hn=yh,Lh=Ns,Oh=Eh,Zo=zi,Ah=Ql,Qo=js,ea=Wi,Mh=ji,Uh=zs,Dh=Hi,Ph=nc,ta=Vi,ra=yr,_h=Fs;function X(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Hn(e)}X.plugin=function(e,t){let r,s=!1;function n(...i){console&&console.warn&&!s&&(s=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
27
+ https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
28
+ https://www.w3ctech.com/topic/2226`));let a=t(...i);return a.postcssPlugin=e,a.postcssVersion=new Hn().version,a}return Object.defineProperty(n,"postcss",{get:()=>(r||(r=n()),r)}),n.process=function(i,a,o){return X([n(o)]).process(i,a)},n},X.stringify=Lh,X.parse=Dh,X.fromJSON=Oh,X.list=Ph,X.comment=e=>new Qo(e),X.atRule=e=>new ea(e),X.decl=e=>new Xo(e),X.rule=e=>new ta(e),X.root=e=>new ra(e),X.document=e=>new Zo(e),X.CssSyntaxError=xh,X.Declaration=Xo,X.Container=Rh,X.Processor=Hn,X.Document=Zo,X.Comment=Qo,X.Warning=Ah,X.AtRule=ea,X.Result=Mh,X.Input=Uh,X.Rule=ta,X.Root=ra,X.Node=_h,Th.registerPostcss(X);var Nh=X;X.default=X;const ae=op(Nh);ae.stringify,ae.fromJSON,ae.plugin,ae.parse,ae.list,ae.document,ae.comment,ae.atRule,ae.rule,ae.decl,ae.root,ae.CssSyntaxError,ae.Declaration,ae.Container,ae.Processor,ae.Document,ae.Comment,ae.Warning,ae.AtRule,ae.Result,ae.Input,ae.Rule,ae.Root,ae.Node;var Fh=Object.defineProperty,Re=(e,t,r)=>((s,n,i)=>n in s?Fh(s,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[n]=i)(e,typeof t!="symbol"?t+"":t,r);function Bh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function zh(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}),r}var Gn={exports:{}},oe=String,sa=function(){return{isColorSupported:!1,reset:oe,bold:oe,dim:oe,italic:oe,underline:oe,inverse:oe,hidden:oe,strikethrough:oe,black:oe,red:oe,green:oe,yellow:oe,blue:oe,magenta:oe,cyan:oe,white:oe,gray:oe,bgBlack:oe,bgRed:oe,bgGreen:oe,bgYellow:oe,bgBlue:oe,bgMagenta:oe,bgCyan:oe,bgWhite:oe}};Gn.exports=sa(),Gn.exports.createColors=sa;var jh=Gn.exports;const _e=zh(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let na=jh,ia=_e,$n=class cc extends Error{constructor(t,r,s,n,i,a){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),n&&(this.source=n),a&&(this.plugin=a),r!==void 0&&s!==void 0&&(typeof r=="number"?(this.line=r,this.column=s):(this.line=r.line,this.column=r.column,this.endLine=s.line,this.endColumn=s.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,cc)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",this.line!==void 0&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let r=this.source;t==null&&(t=na.isColorSupported),ia&&t&&(r=ia(r));let s,n,i=r.split(/\r?\n/),a=Math.max(this.line-3,0),o=Math.min(this.line+2,i.length),l=String(o).length;if(t){let{bold:c,gray:u,red:d}=na.createColors(!0);s=p=>c(d(p)),n=p=>u(p)}else s=n=c=>c;return i.slice(a,o).map((c,u)=>{let d=a+1+u,p=" "+(" "+d).slice(-l)+" | ";if(d===this.line){let f=n(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+n(p)+c+`
29
+ `+f+s("^")}return" "+n(p)+c}).join(`
30
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
31
+
32
+ `+t+`
33
+ `),this.name+": "+this.message+t}};var Gi=$n;$n.default=$n;var cr={};cr.isClean=Symbol("isClean"),cr.my=Symbol("my");const oa={after:`
34
+ `,beforeClose:`
35
+ `,beforeComment:`
36
+ `,beforeDecl:`
37
+ `,beforeOpen:" ",beforeRule:`
38
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let Yn=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,s=e.params?this.rawValue(e,"params"):"";if(e.raws.afterName!==void 0?r+=e.raws.afterName:s&&(r+=" "),e.nodes)this.block(e,r+s);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+s+n,e)}}beforeAfter(e,t){let r;r=e.type==="decl"?this.raw(e,null,"beforeDecl"):e.type==="comment"?this.raw(e,null,"beforeComment"):t==="before"?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let s=e.parent,n=0;for(;s&&s.type!=="root";)n+=1,s=s.parent;if(r.includes(`
39
+ `)){let i=this.raw(e,null,"indent");if(i.length)for(let a=0;a<n;a++)r+=i}return r}block(e,t){let r,s=this.raw(e,"between","beforeOpen");this.builder(t+s+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let s=0;s<e.nodes.length;s++){let n=e.nodes[s],i=this.raw(n,"before");i&&this.builder(i),this.stringify(n,t!==s||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),s=e.prop+r+this.rawValue(e,"value");e.important&&(s+=e.raws.important||" !important"),t&&(s+=";"),this.builder(s,e)}document(e){this.body(e)}raw(e,t,r){let s;if(r||(r=t),t&&(s=e.raws[t],s!==void 0))return s;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return oa[r];let i=e.root();if(i.rawCache||(i.rawCache={}),i.rawCache[r]!==void 0)return i.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let o="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[o]?s=this[o](i,e):i.walk(l=>{if(s=l.raws[t],s!==void 0)return!1})}var a;return s===void 0&&(s=oa[r]),i.rawCache[r]=s,s}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&r.raws.after!==void 0)return t=r.raws.after,t.includes(`
40
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(`
41
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(s=>{if(s.raws.before!==void 0)return r=s.raws.before,r.includes(`
42
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r===void 0?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,t!==void 0))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&r.raws.before!==void 0)return t=r.raws.before,t.includes(`
43
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(r.raws.between!==void 0)return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,t!==void 0))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let s=r.parent;if(s&&s!==e&&s.parent&&s.parent===e&&r.raws.before!==void 0){let n=r.raws.before.split(`
44
+ `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,t!==void 0))return!1}),t}rawValue(e,t){let r=e[t],s=e.raws[t];return s&&s.value===r?s.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var uc=Yn;Yn.default=Yn;let Wh=uc;function Jn(e,t){new Wh(t).stringify(e)}var Ws=Jn;Jn.default=Jn;let{isClean:Mr,my:Vh}=cr,Hh=Gi,Gh=uc,$h=Ws;function qn(e,t){let r=new e.constructor;for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s)||s==="proxyCache")continue;let n=e[s],i=typeof n;s==="parent"&&i==="object"?t&&(r[s]=t):s==="source"?r[s]=n:Array.isArray(n)?r[s]=n.map(a=>qn(a,r)):(i==="object"&&n!==null&&(n=qn(n)),r[s]=n)}return r}let Kn=class{constructor(e={}){this.raws={},this[Mr]=!1,this[Vh]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=qn(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:r.column,line:r.line},t)}return new Hh(e)}getProxyProcessor(){return{get:(e,t)=>t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,t!=="prop"&&t!=="value"&&t!=="name"&&t!=="params"&&t!=="important"&&t!=="text"||e.markDirty()),!0)}}markDirty(){if(this[Mr]){this[Mr]=!1;let e=this;for(;e=e.parent;)e[Mr]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let s=(t=this.toString()).indexOf(e.word);s!==-1&&(r=this.positionInside(s,t))}return r}positionInside(e,t){let r=t||this.toString(),s=this.source.start.column,n=this.source.start.line;for(let i=0;i<e;i++)r[i]===`
45
+ `?(s=1,n+=1):s+=1;return{column:s,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let s=this.toString(),n=s.indexOf(e.word);n!==-1&&(t=this.positionInside(n,s),r=this.positionInside(n+e.word.length,s))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new Gh().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let s of e)s===this?r=!0:r?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},s=t==null;t=t||new Map;let n=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let a=this[i];if(Array.isArray(a))r[i]=a.map(o=>typeof o=="object"&&o.toJSON?o.toJSON(null,t):o);else if(typeof a=="object"&&a.toJSON)r[i]=a.toJSON(null,t);else if(i==="source"){let o=t.get(a.input);o==null&&(o=n,t.set(a.input,n),n++),r[i]={end:a.end,inputId:o,start:a.start}}else r[i]=a}return s&&(r.inputs=[...t.keys()].map(i=>i.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=$h){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let s={node:this};for(let n in r)s[n]=r[n];return e.warn(t,s)}get proxyOf(){return this}};var Vs=Kn;Kn.default=Kn;let Yh=Vs,Xn=class extends Yh{constructor(e){e&&e.value!==void 0&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var Hs=Xn;Xn.default=Xn;var Jh={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t}};let{SourceMapConsumer:aa,SourceMapGenerator:la}=_e,{existsSync:qh,readFileSync:Kh}=_e,{dirname:ln,join:Xh}=_e,Zn=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,s=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=ln(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new aa(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e=="object"&&(typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),s=e.indexOf("*/",r);r>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,s)))}loadFile(e){if(this.root=ln(e),qh(e))return this.mapFile=e,Kh(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t!="function"){if(t instanceof aa)return la.fromSourceMap(t).toString();if(t instanceof la)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let r=t(e);if(r){let s=this.loadFile(r);if(!s)throw new Error("Unable to load previous source map: "+r.toString());return s}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Xh(ln(e),r)),this.loadFile(r)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var dc=Zn;Zn.default=Zn;let{SourceMapConsumer:Zh,SourceMapGenerator:Qh}=_e,{fileURLToPath:ca,pathToFileURL:Ur}=_e,{isAbsolute:Qn,resolve:ei}=_e,{nanoid:em}=Jh,cn=_e,ua=Gi,tm=dc,un=Symbol("fromOffsetCache"),rm=!!(Zh&&Qh),da=!!(ei&&Qn),rs=class{constructor(e,t={}){if(e==null||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!da||/^\w+:\/\//.test(t.from)||Qn(t.from)?this.file=t.from:this.file=ei(t.from)),da&&rm){let r=new tm(this.css,t);if(r.text){this.map=r;let s=r.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+em(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,s={}){let n,i,a;if(t&&typeof t=="object"){let l=t,c=r;if(typeof l.offset=="number"){let u=this.fromOffset(l.offset);t=u.line,r=u.col}else t=l.line,r=l.column;if(typeof c.offset=="number"){let u=this.fromOffset(c.offset);i=u.line,a=u.col}else i=c.line,a=c.column}else if(!r){let l=this.fromOffset(t);t=l.line,r=l.col}let o=this.origin(t,r,i,a);return n=o?new ua(e,o.endLine===void 0?o.line:{column:o.column,line:o.line},o.endLine===void 0?o.column:{column:o.endColumn,line:o.endLine},o.source,o.file,s.plugin):new ua(e,i===void 0?t:{column:r,line:t},i===void 0?r:{column:a,line:i},this.css,this.file,s.plugin),n.input={column:r,endColumn:a,endLine:i,line:t,source:this.css},this.file&&(Ur&&(n.input.url=Ur(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[un])r=this[un];else{let n=this.css.split(`
46
+ `);r=new Array(n.length);let i=0;for(let a=0,o=n.length;a<o;a++)r[a]=i,i+=n[a].length+1;this[un]=r}t=r[r.length-1];let s=0;if(e>=t)s=r.length-1;else{let n,i=r.length-2;for(;s<i;)if(n=s+(i-s>>1),e<r[n])i=n-1;else{if(!(e>=r[n+1])){s=n;break}s=n+1}}return{col:e-r[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:ei(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,s){if(!this.map)return!1;let n,i,a=this.map.consumer(),o=a.originalPositionFor({column:t,line:e});if(!o.source)return!1;typeof r=="number"&&(n=a.originalPositionFor({column:s,line:r})),i=Qn(o.source)?Ur(o.source):new URL(o.source,this.map.consumer().sourceRoot||Ur(this.map.mapFile));let l={column:o.column,endColumn:n&&n.column,endLine:n&&n.line,line:o.line,url:i.toString()};if(i.protocol==="file:"){if(!ca)throw new Error("file: protocol is not available in this PostCSS build");l.file=ca(i)}let c=a.sourceContentFor(o.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Gs=rs;rs.default=rs,cn&&cn.registerInput&&cn.registerInput(rs);let{SourceMapConsumer:pc,SourceMapGenerator:ss}=_e,{dirname:ns,relative:hc,resolve:mc,sep:fc}=_e,{pathToFileURL:pa}=_e,sm=Gs,nm=!!(pc&&ss),im=!!(ns&&mc&&hc&&fc);var gc=class{constructor(e,t,r,s){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t=`
47
+ `;this.css.includes(`\r
48
+ `)&&(t=`\r
49
+ `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,r=this.toUrl(this.path(e.file)),s=e.root||ns(e.file);this.mapOpts.sourcesContent===!1?(t=new pc(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,r,this.toUrl(this.path(s)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),im&&nm&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=ss.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new ss({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new ss({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,r=1,s=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(a,o,l)=>{if(this.css+=a,o&&l!=="end"&&(i.generated.line=r,i.generated.column=s-1,o.source&&o.source.start?(i.source=this.sourcePath(o),i.original.line=o.source.start.line,i.original.column=o.source.start.column-1,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=a.match(/\n/g),e?(r+=e.length,t=a.lastIndexOf(`
50
+ `),s=a.length-t):s+=a.length,o&&l!=="start"){let c=o.parent||{raws:{}};(o.type==="decl"||o.type==="atrule"&&!o.nodes)&&o===c.last&&!c.raws.semicolon||(o.source&&o.source.end?(i.source=this.sourcePath(o),i.original.line=o.source.end.line,i.original.column=o.source.end.column-1,i.generated.line=r,i.generated.column=s-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=r,i.generated.column=s-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(this.mapOpts.annotation!==void 0?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(e===void 0||e===!0)&&(!this.previous().length||this.previous().some(t=>t.inline))}isMap(){return this.opts.map!==void 0?!!this.opts.map:this.previous().length>0}isSourcesContent(){return this.mapOpts.sourcesContent!==void 0?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?ns(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=ns(mc(r,this.mapOpts.annotation)));let s=hc(r,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new sm(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let s=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(pa){let r=pa(e).toString();return this.memoizedFileURLs.set(e,r),r}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;fc==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let om=Vs,ti=class extends om{constructor(e){super(e),this.type="comment"}};var $s=ti;ti.default=ti;let yc,$i,Yi,wc,{isClean:bc,my:vc}=cr,Sc=Hs,Ic=$s,am=Vs;function Cc(e){return e.map(t=>(t.nodes&&(t.nodes=Cc(t.nodes)),delete t.source,t))}function kc(e){if(e[bc]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)kc(t)}let Xe=class Ec extends am{append(...t){for(let r of t){let s=this.normalize(r,this.last);for(let n of s)this.proxyOf.nodes.push(n)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r,s,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],s=t(this.proxyOf.nodes[r],r),s!==!1);)this.indexes[n]+=1;return delete this.indexes[n],s}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get:(t,r)=>r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...s)=>t[r](...s.map(n=>typeof n=="function"?(i,a)=>n(i.toProxy(),a):n)):r==="every"||r==="some"?s=>t[r]((n,...i)=>s(n.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(s=>s.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r],set:(t,r,s)=>(t[r]===s||(t[r]=s,r!=="name"&&r!=="params"&&r!=="selector"||t.markDirty()),!0)}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let s,n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n+1,0,a);for(let a in this.indexes)s=this.indexes[a],n<s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}insertBefore(t,r){let s,n=this.index(t),i=n===0&&"prepend",a=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let o of a)this.proxyOf.nodes.splice(n,0,o);for(let o in this.indexes)s=this.indexes[o],n<=s&&(this.indexes[o]=s+a.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Cc(yc(t).nodes);else if(t===void 0)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let s of t)s.parent&&s.parent.removeChild(s,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let s of t)s.parent&&s.parent.removeChild(s,"ignore")}else if(t.type)t=[t];else if(t.prop){if(t.value===void 0)throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Sc(t)]}else if(t.selector)t=[new $i(t)];else if(t.name)t=[new Yi(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Ic(t)]}return t.map(s=>(s[vc]||Ec.rebuild(s),(s=s.proxyOf).parent&&s.parent.removeChild(s),s[bc]&&kc(s),s.raws.before===void 0&&r&&r.raws.before!==void 0&&(s.raws.before=r.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...t){t=t.reverse();for(let r of t){let s=this.normalize(r,this.first,"prepend").reverse();for(let n of s)this.proxyOf.nodes.unshift(n);for(let n in this.indexes)this.indexes[n]=this.indexes[n]+s.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){let r;t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);for(let s in this.indexes)r=this.indexes[s],r>=t&&(this.indexes[s]=r-1);return this.markDirty(),this}replaceValues(t,r,s){return s||(s=r,r={}),this.walkDecls(n=>{r.props&&!r.props.includes(n.prop)||r.fast&&!n.value.includes(r.fast)||(n.value=n.value.replace(t,s))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,s)=>{let n;try{n=t(r,s)}catch(i){throw r.addToError(i)}return n!==!1&&r.walk&&(n=r.walk(t)),n})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="atrule"&&t.test(s.name))return r(s,n)}):this.walk((s,n)=>{if(s.type==="atrule"&&s.name===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="atrule")return r(s,n)}))}walkComments(t){return this.walk((r,s)=>{if(r.type==="comment")return t(r,s)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="decl"&&t.test(s.prop))return r(s,n)}):this.walk((s,n)=>{if(s.type==="decl"&&s.prop===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="decl")return r(s,n)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((s,n)=>{if(s.type==="rule"&&t.test(s.selector))return r(s,n)}):this.walk((s,n)=>{if(s.type==="rule"&&s.selector===t)return r(s,n)}):(r=t,this.walk((s,n)=>{if(s.type==="rule")return r(s,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Xe.registerParse=e=>{yc=e},Xe.registerRule=e=>{$i=e},Xe.registerAtRule=e=>{Yi=e},Xe.registerRoot=e=>{wc=e};var wt=Xe;Xe.default=Xe,Xe.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Yi.prototype):e.type==="rule"?Object.setPrototypeOf(e,$i.prototype):e.type==="decl"?Object.setPrototypeOf(e,Sc.prototype):e.type==="comment"?Object.setPrototypeOf(e,Ic.prototype):e.type==="root"&&Object.setPrototypeOf(e,wc.prototype),e[vc]=!0,e.nodes&&e.nodes.forEach(t=>{Xe.rebuild(t)})};let xc,Tc,lm=wt,ur=class extends lm{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new xc(new Tc,this,e).stringify()}};ur.registerLazyResult=e=>{xc=e},ur.registerProcessor=e=>{Tc=e};var Ji=ur;ur.default=ur;let ri=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Rc=ri;ri.default=ri;let cm=Rc,si=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new cm(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var qi=si;si.default=si;const dn=39,ha=34,Dr=92,ma=47,Pr=10,jt=32,_r=12,Nr=9,Fr=13,um=91,dm=93,pm=40,hm=41,mm=123,fm=125,gm=59,ym=42,wm=58,bm=64,Br=/[\t\n\f\r "#'()/;[\\\]{}]/g,zr=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,vm=/.[\r\n"'(/\\]/,fa=/[\da-f]/i;let Lc=wt,is=class extends Lc{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Ki=is;is.default=is,Lc.registerAtRule(is);let Oc,Ac,Mc=wt,Mt=class extends Mc{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let s=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Oc(new Ac,this,e).stringify()}};Mt.registerLazyResult=e=>{Oc=e},Mt.registerProcessor=e=>{Ac=e};var wr=Mt;Mt.default=Mt,Mc.registerRoot(Mt);let dr={comma:e=>dr.split(e,[","],!0),space:e=>dr.split(e,[" ",`
51
+ `," "]),split(e,t,r){let s=[],n="",i=!1,a=0,o=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:o?u===l&&(o=!1):u==='"'||u==="'"?(o=!0,l=u):u==="("?a+=1:u===")"?a>0&&(a-=1):a===0&&t.includes(u)&&(i=!0),i?(n!==""&&s.push(n.trim()),n="",i=!1):n+=u;return(r||n!=="")&&s.push(n.trim()),s}};var Uc=dr;dr.default=dr;let Dc=wt,Sm=Uc,os=class extends Dc{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Sm.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var Xi=os;os.default=os,Dc.registerRule(os);let Im=Hs,Cm=function(e,t={}){let r,s,n,i,a,o,l,c,u,d,p=e.css.valueOf(),f=t.ignoreErrors,w=p.length,h=0,C=[],m=[];function g(v){throw e.error("Unclosed "+v,h)}return{back:function(v){m.push(v)},endOfFile:function(){return m.length===0&&h>=w},nextToken:function(v){if(m.length)return m.pop();if(h>=w)return;let S=!!v&&v.ignoreUnclosed;switch(r=p.charCodeAt(h),r){case Pr:case jt:case Nr:case Fr:case _r:s=h;do s+=1,r=p.charCodeAt(s);while(r===jt||r===Pr||r===Nr||r===Fr||r===_r);d=["space",p.slice(h,s)],h=s-1;break;case um:case dm:case mm:case fm:case wm:case gm:case hm:{let A=String.fromCharCode(r);d=[A,A,h];break}case pm:if(c=C.length?C.pop()[1]:"",u=p.charCodeAt(h+1),c==="url"&&u!==dn&&u!==ha&&u!==jt&&u!==Pr&&u!==Nr&&u!==_r&&u!==Fr){s=h;do{if(o=!1,s=p.indexOf(")",s+1),s===-1){if(f||S){s=h;break}g("bracket")}for(l=s;p.charCodeAt(l-1)===Dr;)l-=1,o=!o}while(o);d=["brackets",p.slice(h,s+1),h,s],h=s}else s=p.indexOf(")",h+1),i=p.slice(h,s+1),s===-1||vm.test(i)?d=["(","(",h]:(d=["brackets",i,h,s],h=s);break;case dn:case ha:n=r===dn?"'":'"',s=h;do{if(o=!1,s=p.indexOf(n,s+1),s===-1){if(f||S){s=h+1;break}g("string")}for(l=s;p.charCodeAt(l-1)===Dr;)l-=1,o=!o}while(o);d=["string",p.slice(h,s+1),h,s],h=s;break;case bm:Br.lastIndex=h+1,Br.test(p),s=Br.lastIndex===0?p.length-1:Br.lastIndex-2,d=["at-word",p.slice(h,s+1),h,s],h=s;break;case Dr:for(s=h,a=!0;p.charCodeAt(s+1)===Dr;)s+=1,a=!a;if(r=p.charCodeAt(s+1),a&&r!==ma&&r!==jt&&r!==Pr&&r!==Nr&&r!==Fr&&r!==_r&&(s+=1,fa.test(p.charAt(s)))){for(;fa.test(p.charAt(s+1));)s+=1;p.charCodeAt(s+1)===jt&&(s+=1)}d=["word",p.slice(h,s+1),h,s],h=s;break;default:r===ma&&p.charCodeAt(h+1)===ym?(s=p.indexOf("*/",h+2)+1,s===0&&(f||S?s=p.length:g("comment")),d=["comment",p.slice(h,s+1),h,s],h=s):(zr.lastIndex=h+1,zr.test(p),s=zr.lastIndex===0?p.length-1:zr.lastIndex-2,d=["word",p.slice(h,s+1),h,s],C.push(d),h=s)}return h++,d},position:function(){return h}}},km=$s,Em=Ki,xm=wr,ga=Xi;const ya={empty:!0,space:!0};var Tm=class{constructor(e){this.input=e,this.root=new xm,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,s,n=new Em;n.name=e[1].slice(1),n.name===""&&this.unnamedAtrule(n,e),this.init(n,e[2]);let i=!1,a=!1,o=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],t==="("||t==="["?l.push(t==="("?")":"]"):t==="{"&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),l.length===0){if(t===";"){n.source.end=this.getPosition(e[2]),n.source.end.offset++,this.semicolon=!0;break}if(t==="{"){a=!0;break}if(t==="}"){if(o.length>0){for(s=o.length-1,r=o[s];r&&r[0]==="space";)r=o[--s];r&&(n.source.end=this.getPosition(r[3]||r[2]),n.source.end.offset++)}this.end(e);break}o.push(e)}else o.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(o),o.length?(n.raws.afterName=this.spacesAndCommentsFromStart(o),this.raw(n,"params",o),i&&(e=o[o.length-1],n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r,s=0;for(let n=t-1;n>=0&&(r=e[n],r[0]==="space"||(s+=1,s!==2));n--);throw this.input.error("Missed semicolon",r[0]==="word"?r[3]+1:r[2])}colon(e){let t,r,s,n=0;for(let[i,a]of e.entries()){if(t=a,r=t[0],r==="("&&(n+=1),r===")"&&(n-=1),n===0&&r===":"){if(s){if(s[0]==="word"&&s[1]==="progid")continue;return i}this.doubleColon(t)}s=t}return!1}comment(e){let t=new km;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let s=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=Cm(this.input)}decl(e,t){let r=new Im;this.init(r,e[0][2]);let s,n=e[e.length-1];for(n[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(n[3]||n[2]||function(o){for(let l=o.length-1;l>=0;l--){let c=o[l],u=c[3]||c[2];if(u)return u}}(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let o=e[0][0];if(o===":"||o==="space"||o==="comment")break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(s=e.shift(),s[0]===":"){r.raws.between+=s[1];break}s[0]==="word"&&/\w/.test(s[1])&&this.unknownWord([s]),r.raws.between+=s[1]}r.prop[0]!=="_"&&r.prop[0]!=="*"||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i,a=[];for(;e.length&&(i=e[0][0],i==="space"||i==="comment");)a.push(e.shift());this.precheckMissedSemicolon(e);for(let o=e.length-1;o>=0;o--){if(s=e[o],s[1].toLowerCase()==="!important"){r.important=!0;let l=this.stringFrom(e,o);l=this.spacesFromEnd(e)+l,l!==" !important"&&(r.raws.important=l);break}if(s[1].toLowerCase()==="important"){let l=e.slice(0),c="";for(let u=o;u>0;u--){let d=l[u][0];if(c.trim().indexOf("!")===0&&d!=="space")break;c=l.pop()[1]+c}c.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=c,e=l)}if(s[0]!=="space"&&s[0]!=="comment")break}e.some(o=>o[0]!=="space"&&o[0]!=="comment")&&(r.raws.between+=a.map(o=>o[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ga;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,s=!1,n=null,i=[],a=e[1].startsWith("--"),o=[],l=e;for(;l;){if(r=l[0],o.push(l),r==="("||r==="[")n||(n=l),i.push(r==="("?")":"]");else if(a&&s&&r==="{")n||(n=l),i.push("}");else if(i.length===0){if(r===";"){if(s)return void this.decl(o,a);break}if(r==="{")return void this.rule(o);if(r==="}"){this.tokenizer.back(o.pop()),t=!0;break}r===":"&&(s=!0)}else r===i[i.length-1]&&(i.pop(),i.length===0&&(n=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;o.length&&(l=o[o.length-1][0],l==="space"||l==="comment");)this.tokenizer.back(o.pop());this.decl(o,a)}else this.unknownWord(o)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,s){let n,i,a,o,l=r.length,c="",u=!0;for(let d=0;d<l;d+=1)n=r[d],i=n[0],i!=="space"||d!==l-1||s?i==="comment"?(o=r[d-1]?r[d-1][0]:"empty",a=r[d+1]?r[d+1][0]:"empty",ya[o]||ya[a]||c.slice(-1)===","?u=!1:c+=n[1]):c+=n[1]:u=!1;if(!u){let d=r.reduce((p,f)=>p+f[1],"");e.raws[t]={raw:d,value:c}}e[t]=c}rule(e){e.pop();let t=new ga;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space"||t==="comment");)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],t==="space"||t==="comment");)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let s=t;s<e.length;s++)r+=e[s][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let Rm=wt,Lm=Tm,Om=Gs;function as(e,t){let r=new Om(e,t),s=new Lm(r);try{s.parse()}catch(n){throw n}return s.root}var Zi=as;as.default=as,Rm.registerParse(as);let{isClean:Fe,my:Am}=cr,Mm=gc,Um=Ws,Dm=wt,Pm=Ji,wa=qi,_m=Zi,Nm=wr;const Fm={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Bm={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},zm={Once:!0,postcssPlugin:!0,prepare:!0};function Wt(e){return typeof e=="object"&&typeof e.then=="function"}function Pc(e){let t=!1,r=Fm[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function ba(e){let t;return t=e.type==="document"?["Document",0,"DocumentExit"]:e.type==="root"?["Root",0,"RootExit"]:Pc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ni(e){return e[Fe]=!1,e.nodes&&e.nodes.forEach(t=>ni(t)),e}let ii={},Lt=class _c{constructor(t,r,s){let n;if(this.stringified=!1,this.processed=!1,typeof r!="object"||r===null||r.type!=="root"&&r.type!=="document")if(r instanceof _c||r instanceof wa)n=ni(r.root),r.map&&(s.map===void 0&&(s.map={}),s.map.inline||(s.map.inline=!1),s.map.prev=r.map);else{let i=_m;s.syntax&&(i=s.syntax.parse),s.parser&&(i=s.parser),i.parse&&(i=i.parse);try{n=i(r,s)}catch(a){this.processed=!0,this.error=a}n&&!n[Am]&&Dm.rebuild(n)}else n=ni(r);this.result=new wa(t,n,s),this.helpers={...ii,postcss:ii,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let s=this.result.lastPlugin;try{r&&r.addToError(t),this.error=t,t.name!=="CssSyntaxError"||t.plugin?s.postcssVersion:(t.plugin=s.postcssPlugin,t.setMessage())}catch(n){console&&console.error&&console.error(n)}return t}prepareVisitors(){this.listeners={};let t=(r,s,n)=>{this.listeners[s]||(this.listeners[s]=[]),this.listeners[s].push([r,n])};for(let r of this.plugins)if(typeof r=="object")for(let s in r){if(!Bm[s]&&/^[A-Z]/.test(s))throw new Error(`Unknown event ${s} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!zm[s])if(typeof r[s]=="object")for(let n in r[s])t(r,n==="*"?s:s+"-"+n.toLowerCase(),r[s][n]);else typeof r[s]=="function"&&t(r,s,r[s])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],s=this.runOnRoot(r);if(Wt(s))try{await s}catch(n){throw this.handleError(n)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Fe];){t[Fe]=!0;let r=[ba(t)];for(;r.length>0;){let s=this.visitTick(r);if(Wt(s))try{await s}catch(n){let i=r[r.length-1].node;throw this.handleError(n,i)}}}if(this.listeners.OnceExit)for(let[r,s]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let n=t.nodes.map(i=>s(i,this.helpers));await Promise.all(n)}else await s(t,this.helpers)}catch(n){throw this.handleError(n)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(s=>t.Once(s,this.helpers));return Wt(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=Um;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let s=new Mm(r,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins)if(Wt(this.runOnRoot(t)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Fe];)t[Fe]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[s,n]of t){let i;this.result.lastPlugin=s;try{i=n(r,this.helpers)}catch(a){throw this.handleError(a,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Wt(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:s,visitors:n}=r;if(s.type!=="root"&&s.type!=="document"&&!s.parent)return void t.pop();if(n.length>0&&r.visitorIndex<n.length){let[a,o]=n[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===n.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=a;try{return o(s.toProxy(),this.helpers)}catch(l){throw this.handleError(l,s)}}if(r.iterator!==0){let a,o=r.iterator;for(;a=s.nodes[s.indexes[o]];)if(s.indexes[o]+=1,!a[Fe])return a[Fe]=!0,void t.push(ba(a));r.iterator=0,delete s.indexes[o]}let i=r.events;for(;r.eventIndex<i.length;){let a=i[r.eventIndex];if(r.eventIndex+=1,a===0)return void(s.nodes&&s.nodes.length&&(s[Fe]=!0,r.iterator=s.getIterator()));if(this.listeners[a])return void(r.visitors=this.listeners[a])}t.pop()}walkSync(t){t[Fe]=!0;let r=Pc(t);for(let s of r)if(s===0)t.nodes&&t.each(n=>{n[Fe]||this.walkSync(n)});else{let n=this.listeners[s];if(n&&this.visitSync(n,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Lt.registerPostcss=e=>{ii=e};var Nc=Lt;Lt.default=Lt,Nm.registerLazyResult(Lt),Pm.registerLazyResult(Lt);let jm=gc,Wm=Ws,Vm=Zi;const Hm=qi;let oi=class{constructor(e,t,r){let s;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let n=Wm;this.result=new Hm(this._processor,s,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let a=new jm(n,s,this._opts,t);if(a.isMap()){let[o,l]=a.generate();o&&(this.result.css=o),l&&(this.result.map=l)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Vm;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var Gm=oi;oi.default=oi;let $m=Gm,Ym=Nc,Jm=Ji,qm=wr,Gt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r!="object"||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new Ym(this,e,t):new $m(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Km=Gt;Gt.default=Gt,qm.registerProcessor(Gt),Jm.registerProcessor(Gt);let Xm=Hs,Zm=dc,Qm=$s,ef=Ki,tf=Gs,rf=wr,sf=Xi;function pr(e,t){if(Array.isArray(e))return e.map(n=>pr(n));let{inputs:r,...s}=e;if(r){t=[];for(let n of r){let i={...n,__proto__:tf.prototype};i.map&&(i.map={...i.map,__proto__:Zm.prototype}),t.push(i)}}if(s.nodes&&(s.nodes=e.nodes.map(n=>pr(n,t))),s.source){let{inputId:n,...i}=s.source;s.source=i,n!=null&&(s.source.input=t[n])}if(s.type==="root")return new rf(s);if(s.type==="decl")return new Xm(s);if(s.type==="rule")return new sf(s);if(s.type==="comment")return new Qm(s);if(s.type==="atrule")return new ef(s);throw new Error("Unknown node type: "+e.type)}var nf=pr;pr.default=pr;let of=Gi,va=Hs,af=Nc,lf=wt,ai=Km,cf=Ws,uf=nf,Sa=Ji,df=Rc,Ia=$s,Ca=Ki,pf=qi,hf=Gs,mf=Zi,ff=Uc,ka=Xi,Ea=wr,gf=Vs;function Z(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new ai(e)}Z.plugin=function(e,t){let r,s=!1;function n(...i){console&&console.warn&&!s&&(s=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
52
+ https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
53
+ https://www.w3ctech.com/topic/2226`));let a=t(...i);return a.postcssPlugin=e,a.postcssVersion=new ai().version,a}return Object.defineProperty(n,"postcss",{get:()=>(r||(r=n()),r)}),n.process=function(i,a,o){return Z([n(o)]).process(i,a)},n},Z.stringify=cf,Z.parse=mf,Z.fromJSON=uf,Z.list=ff,Z.comment=e=>new Ia(e),Z.atRule=e=>new Ca(e),Z.decl=e=>new va(e),Z.rule=e=>new ka(e),Z.root=e=>new Ea(e),Z.document=e=>new Sa(e),Z.CssSyntaxError=of,Z.Declaration=va,Z.Container=lf,Z.Processor=ai,Z.Document=Sa,Z.Comment=Ia,Z.Warning=df,Z.AtRule=Ca,Z.Result=pf,Z.Input=hf,Z.Rule=ka,Z.Root=Ea,Z.Node=gf,af.registerPostcss(Z);var yf=Z;Z.default=Z;const le=Bh(yf);le.stringify,le.fromJSON,le.plugin,le.parse,le.list,le.document,le.comment,le.atRule,le.rule,le.decl,le.root,le.CssSyntaxError,le.Declaration,le.Container,le.Processor,le.Document,le.Comment,le.Warning,le.AtRule,le.Result,le.Input,le.Rule,le.Root,le.Node;class Qi{constructor(...t){Re(this,"parentElement",null),Re(this,"parentNode",null),Re(this,"ownerDocument"),Re(this,"firstChild",null),Re(this,"lastChild",null),Re(this,"previousSibling",null),Re(this,"nextSibling",null),Re(this,"ELEMENT_NODE",1),Re(this,"TEXT_NODE",3),Re(this,"nodeType"),Re(this,"nodeName"),Re(this,"RRNodeType")}get childNodes(){const t=[];let r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(!(t instanceof Qi)||t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const xa={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ta={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},jr={};function eo(e){if(jr[e])return jr[e];const t=globalThis[e],r=t.prototype,s=e in xa?xa[e]:void 0,n=!!(s&&s.every(o=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,o))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Ta?Ta[e]:void 0,a=!!(i&&i.every(o=>{var l;return typeof r[o]=="function"&&((l=r[o])==null?void 0:l.toString().includes("[native code]"))}));if(n&&a)return jr[e]=t.prototype,t.prototype;try{const o=document.createElement("iframe");document.body.appendChild(o);const l=o.contentWindow;if(!l)return t.prototype;const c=l[e].prototype;return document.body.removeChild(o),c?jr[e]=c:r}catch{return r}}const pn={};function tt(e,t,r){var s;const n=`${e}.${String(r)}`;if(pn[n])return pn[n].call(t);const i=eo(e),a=(s=Object.getOwnPropertyDescriptor(i,r))==null?void 0:s.get;return a?(pn[n]=a,a.call(t)):t[r]}const hn={};function Ra(e,t,r){const s=`${e}.${String(r)}`;if(hn[s])return hn[s].bind(t);const n=eo(e)[r];return typeof n!="function"?t[r]:(hn[s]=n,n.bind(t))}function Fc(){return eo("MutationObserver").constructor}const H={childNodes:function(e){return tt("Node",e,"childNodes")},parentNode:function(e){return tt("Node",e,"parentNode")},parentElement:function(e){return tt("Node",e,"parentElement")},textContent:function(e){return tt("Node",e,"textContent")},contains:function(e,t){return Ra("Node",e,"contains")(t)},getRootNode:function(e){return Ra("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?tt("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?tt("Element",e,"shadowRoot"):null},querySelector:function(e,t){return tt("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return tt("Element",e,"querySelectorAll")(t)},mutationObserver:Fc};function ve(e,t,r=document){const s={capture:!0,passive:!0};return r.addEventListener(e,t,s),()=>r.removeEventListener(e,t,s)}const kt=`Please stop import mirror directly. Instead of that,\r
54
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
55
+ or you can use record.mirror to access the mirror instance during recording.`;let La={map:{},getId:()=>(console.error(kt),-1),getNode:()=>(console.error(kt),null),removeNodeFromMap(){console.error(kt)},has:()=>(console.error(kt),!1),reset(){console.error(kt)}};function $t(e,t,r={}){let s=null,n=0;return function(...i){const a=Date.now();n||r.leading!==!1||(n=a);const o=t-(a-n),l=this;o<=0||o>t?(s&&(clearTimeout(s),s=null),n=a,e.apply(l,i)):s||r.trailing===!1||(s=setTimeout(()=>{n=r.leading===!1?0:Date.now(),s=null,e.apply(l,i)},o))}}function Ys(e,t,r,s,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,s?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>Ys(e,t,i||{},!0)}function Ut(e,t,r){try{if(!(t in e))return()=>{};const s=e[t],n=r(s);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:s}})),e[t]=n,()=>{e[t]=s}}catch{return()=>{}}}typeof window<"u"&&window.Proxy&&window.Reflect&&(La=new Proxy(La,{get:(e,t,r)=>(t==="map"&&console.error(kt),Reflect.get(e,t,r))}));let bs=Date.now;function Bc(e){var t,r,s,n;const i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||(i==null?void 0:i.body)&&((t=H.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i==null?void 0:i.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(i==null?void 0:i.documentElement.scrollTop)||(i==null?void 0:i.body)&&((s=H.parentElement(i.body))==null?void 0:s.scrollTop)||((n=i==null?void 0:i.body)==null?void 0:n.scrollTop)||0}}function zc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function jc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Wc(e){return e?e.nodeType===e.ELEMENT_NODE?e:H.parentElement(e):null}function Se(e,t,r,s){if(!e)return!1;const n=Wc(e);if(!n)return!1;try{if(typeof t=="string"){if(n.classList.contains(t)||s&&n.closest("."+t)!==null)return!0}else if(ws(n,t,s))return!0}catch{}return!!(r&&(n.matches(r)||s&&n.closest(r)!==null))}function mn(e,t,r){return!(e.tagName!=="TITLE"||!r.headTitleMutations)||t.getId(e)===-2}function Vc(e,t){if(Xt(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const s=H.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||Vc(s,t))}function li(e){return!!e.changedTouches}function Hc(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Gc(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function ci(e){return!!e&&(e instanceof Qi&&"shadowRoot"in e?!!e.shadowRoot:!!H.shadowRoot(e))}/[1-9][0-9]{12}/.test(Date.now().toString())||(bs=()=>new Date().getTime());class wf{constructor(){x(this,"id",1),x(this,"styleIDMap",new WeakMap),x(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let s;return s=r===void 0?this.id++:r,this.styleIDMap.set(t,s),this.idStyleMap.set(s,t),s}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function $c(e){var t;let r=null;return"getRootNode"in e&&((t=H.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&H.host(H.getRootNode(e))&&(r=H.host(H.getRootNode(e))),r}function bf(e){const t=e.ownerDocument;if(!t)return!1;const r=function(s){let n,i=s;for(;n=$c(i);)i=n;return i}(e);return H.contains(t,r)}function Yc(e){const t=e.ownerDocument;return!!t&&(H.contains(t,e)||bf(e))}var J=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(J||{}),G=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(G||{}),Ce=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Ce||{}),Ge=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ge||{}),Et=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Et||{}),xt=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(xt||{});function Oa(e){return"__ln"in e}class vf{constructor(){x(this,"length",0),x(this,"head",null),x(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let s=0;s<t;s++)r=(r==null?void 0:r.next)||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&Oa(t.previousSibling)){const s=t.previousSibling.__ln.next;r.next=s,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,s&&(s.previous=r)}else if(t.nextSibling&&Oa(t.nextSibling)&&t.nextSibling.__ln.previous){const s=t.nextSibling.__ln.previous;r.previous=s,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,s&&(s.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Aa=(e,t)=>`${e}@${t}`;class Sf{constructor(){x(this,"frozen",!1),x(this,"locked",!1),x(this,"texts",[]),x(this,"attributes",[]),x(this,"attributeMap",new WeakMap),x(this,"removes",[]),x(this,"mapRemoves",[]),x(this,"movedMap",{}),x(this,"addedSet",new Set),x(this,"movedSet",new Set),x(this,"droppedSet",new Set),x(this,"mutationCb"),x(this,"blockClass"),x(this,"blockSelector"),x(this,"maskTextClass"),x(this,"maskTextSelector"),x(this,"inlineStylesheet"),x(this,"maskInputOptions"),x(this,"maskTextFn"),x(this,"maskInputFn"),x(this,"keepIframeSrcFn"),x(this,"recordCanvas"),x(this,"inlineImages"),x(this,"slimDOMOptions"),x(this,"dataURLOptions"),x(this,"doc"),x(this,"mirror"),x(this,"iframeManager"),x(this,"stylesheetManager"),x(this,"shadowDomManager"),x(this,"canvasManager"),x(this,"processedNodeManager"),x(this,"unattachedDoc"),x(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),x(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,s=new vf,n=l=>{let c=l,u=-2;for(;u===-2;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{const c=H.parentNode(l);if(!c||!Yc(l)||c.tagName==="TEXTAREA")return;const u=Xt(c)?this.mirror.getId($c(l)):this.mirror.getId(c),d=n(l);if(u===-1||d===-1)return s.addNode(l);const p=Tt(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{Hc(f,this.mirror)&&this.iframeManager.addIframe(f),Gc(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),ci(l)&&this.shadowDomManager.addShadowRoot(H.shadowRoot(l),this.doc)},onIframeLoad:(f,w)=>{this.iframeManager.attachIframe(f,w),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,w)=>{this.stylesheetManager.attachLinkElement(f,w)}});p&&(t.push({parentId:u,nextId:d,node:p}),r.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)Ma(this.removes,l,this.mirror)&&!this.movedSet.has(H.parentNode(l))||i(l);for(const l of this.addedSet)Ua(this.droppedSet,l)||Ma(this.removes,l,this.mirror)?Ua(this.movedSet,l)?i(l):this.droppedSet.add(l):i(l);let a=null;for(;s.length;){let l=null;if(a){const c=this.mirror.getId(H.parentNode(a.value)),u=n(a.value);c!==-1&&u!==-1&&(l=a)}if(!l){let c=s.tail;for(;c;){const u=c;if(c=c.previous,u){const d=this.mirror.getId(H.parentNode(u.value));if(n(u.value)===-1)continue;if(d!==-1){l=u;break}{const p=u.value,f=H.parentNode(p);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=H.host(f);if(this.mirror.getId(w)!==-1){l=u;break}}}}}}if(!l){for(;s.head;)s.removeNode(s.head.value);break}a=l.previous,s.removeNode(l.value),i(l.value)}const o={texts:this.texts.map(l=>{const c=l.node,u=H.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:c}=l;if(typeof c.style=="string"){const u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};(o.texts.length||o.attributes.length||o.removes.length||o.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(o))}),x(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(H.childNodes(t),s=>H.textContent(s)||"").join("")}),x(this,"processMutation",t=>{if(!mn(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const r=H.textContent(t.target);Se(t.target,this.blockClass,this.blockSelector,!1)||r===t.oldValue||this.texts.push({value:Ul(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Wc(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let s=t.attributeName,n=t.target.getAttribute(s);if(s==="value"){const a=Pi(r);n=Di({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:n,maskInputFn:this.maskInputFn})}if(Se(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&s==="src"&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;s="rr_src"}if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),s==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Ml(r.tagName,s))if(i.attributes[s]=Al(this.doc,ft(r.tagName),ft(s),n),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");t.oldValue&&a.setAttribute("style",t.oldValue);for(const o of Array.from(r.style)){const l=r.style.getPropertyValue(o),c=r.style.getPropertyPriority(o);l!==a.style.getPropertyValue(o)||c!==a.style.getPropertyPriority(o)?i.styleDiff[o]=c===""?l:[l,c]:i._unchangedStyles[o]=[l,c]}for(const o of Array.from(a.style))r.style.getPropertyValue(o)===""&&(i.styleDiff[o]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(Se(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA")return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const s=this.mirror.getId(r),n=Xt(t.target)?this.mirror.getId(H.host(t.target)):this.mirror.getId(t.target);Se(t.target,this.blockClass,this.blockSelector,!1)||mn(r,this.mirror,this.slimDOMOptions)||!function(i,a){return a.getId(i)!==-1}(r,this.mirror)||(this.addedSet.has(r)?(ui(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&s===-1||Vc(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Aa(s,n)]?ui(this.movedSet,r):this.removes.push({parentId:n,id:s,isShadow:!(!Xt(t.target)||!Zt(t.target))||void 0})),this.mapRemoves.push(r))})}}),x(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!this.addedSet.has(t)&&!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(mn(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let s=null;r&&this.mirror.hasNode(r)&&(s=this.mirror.getId(r)),s&&s!==-1&&(this.movedMap[Aa(this.mirror.getId(t),s)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Se(t,this.blockClass,this.blockSelector,!1)||(H.childNodes(t).forEach(s=>this.genAdds(s)),ci(t)&&H.childNodes(H.shadowRoot(t)).forEach(s=>{this.processedNodeManager.add(s,this),this.genAdds(s,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ui(e,t){e.delete(t),H.childNodes(t).forEach(r=>ui(e,r))}function Ma(e,t,r){return e.length!==0&&function(s,n,i){let a=H.parentNode(n);for(;a;){const o=i.getId(a);if(s.some(l=>l.id===o))return!0;a=H.parentNode(a)}return!1}(e,t,r)}function Ua(e,t){return e.size!==0&&Jc(e,t)}function Jc(e,t){const r=H.parentNode(t);return!!r&&(!!e.has(r)||Jc(e,r))}let Qt;const $=e=>Qt?(...t)=>{try{return e(...t)}catch(r){if(Qt&&Qt(r)===!0)return;throw r}}:e,mt=[];function er(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function qc(e,t){const r=new Sf;mt.push(r),r.init(e);const s=new(Fc())($(r.processMutations.bind(r)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function If({mouseInteractionCb:e,doc:t,mirror:r,blockClass:s,blockSelector:n,sampling:i}){if(i.mouseInteraction===!1)return()=>{};const a=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,o=[];let l=null;return Object.keys(Ce).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&a[c]!==!1).forEach(c=>{let u=ft(c);const d=(p=>f=>{const w=er(f);if(Se(w,s,n,!0))return;let h=null,C=p;if("pointerType"in f){switch(f.pointerType){case"mouse":h=Ge.Mouse;break;case"touch":h=Ge.Touch;break;case"pen":h=Ge.Pen}h===Ge.Touch?Ce[p]===Ce.MouseDown?C="TouchStart":Ce[p]===Ce.MouseUp&&(C="TouchEnd"):Ge.Pen}else li(f)&&(h=Ge.Touch);h!==null?(l=h,(C.startsWith("Touch")&&h===Ge.Touch||C.startsWith("Mouse")&&h===Ge.Mouse)&&(h=null)):Ce[p]===Ce.Click&&(h=l,l=null);const m=li(f)?f.changedTouches[0]:f;if(!m)return;const g=r.getId(w),{clientX:v,clientY:S}=m;$(e)({type:Ce[C],id:g,x:v,y:S,...h!==null&&{pointerType:h}})})(c);if(window.PointerEvent)switch(Ce[c]){case Ce.MouseDown:case Ce.MouseUp:u=u.replace("mouse","pointer");break;case Ce.TouchStart:case Ce.TouchEnd:return}o.push(ve(u,d,t))}),$(()=>{o.forEach(c=>c())})}function Kc({scrollCb:e,doc:t,mirror:r,blockClass:s,blockSelector:n,sampling:i}){return ve("scroll",$($t($(a=>{const o=er(a);if(!o||Se(o,s,n,!0))return;const l=r.getId(o);if(o===t&&t.defaultView){const c=Bc(t.defaultView);e({id:l,x:c.left,y:c.top})}else e({id:l,x:o.scrollLeft,y:o.scrollTop})}),i.scroll||100)),t)}const Cf=["INPUT","TEXTAREA","SELECT"],Da=new WeakMap;function Wr(e){return function(t,r){if(Vr("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Vr("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Vr("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Vr("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const s=Array.from(t.parentRule.cssRules).indexOf(t);r.unshift(s)}else if(t.parentStyleSheet){const s=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(s)}return r}(e,[])}function rt(e,t,r){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:s}):{}}function Xc({mirror:e,stylesheetManager:t},r){var s,n,i;let a=null;a=r.nodeName==="#document"?e.getId(r):e.getId(H.host(r));const o=r.nodeName==="#document"?(s=r.defaultView)==null?void 0:s.Document:(i=(n=r.ownerDocument)==null?void 0:n.defaultView)==null?void 0:i.ShadowRoot,l=o!=null&&o.prototype?Object.getOwnPropertyDescriptor(o==null?void 0:o.prototype,"adoptedStyleSheets"):void 0;return a!==null&&a!==-1&&o&&l?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;const d=(u=l.set)==null?void 0:u.call(this,c);if(a!==null&&a!==-1)try{t.adoptStyleSheets(c,a)}catch{}return d}}),$(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function kf(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};let s;(function(m,g){const{mutationCb:v,mousemoveCb:S,mouseInteractionCb:A,scrollCb:k,viewportResizeCb:M,inputCb:U,mediaInteractionCb:E,styleSheetRuleCb:R,styleDeclarationCb:L,canvasMutationCb:I,fontCb:F,selectionCb:P,customElementCb:b}=m;m.mutationCb=(...y)=>{g.mutation&&g.mutation(...y),v(...y)},m.mousemoveCb=(...y)=>{g.mousemove&&g.mousemove(...y),S(...y)},m.mouseInteractionCb=(...y)=>{g.mouseInteraction&&g.mouseInteraction(...y),A(...y)},m.scrollCb=(...y)=>{g.scroll&&g.scroll(...y),k(...y)},m.viewportResizeCb=(...y)=>{g.viewportResize&&g.viewportResize(...y),M(...y)},m.inputCb=(...y)=>{g.input&&g.input(...y),U(...y)},m.mediaInteractionCb=(...y)=>{g.mediaInteaction&&g.mediaInteaction(...y),E(...y)},m.styleSheetRuleCb=(...y)=>{g.styleSheetRule&&g.styleSheetRule(...y),R(...y)},m.styleDeclarationCb=(...y)=>{g.styleDeclaration&&g.styleDeclaration(...y),L(...y)},m.canvasMutationCb=(...y)=>{g.canvasMutation&&g.canvasMutation(...y),I(...y)},m.fontCb=(...y)=>{g.font&&g.font(...y),F(...y)},m.selectionCb=(...y)=>{g.selection&&g.selection(...y),P(...y)},m.customElementCb=(...y)=>{g.customElement&&g.customElement(...y),b(...y)}})(e,t),e.recordDOM&&(s=qc(e,e.doc));const n=function({mousemoveCb:m,sampling:g,doc:v,mirror:S}){if(g.mousemove===!1)return()=>{};const A=typeof g.mousemove=="number"?g.mousemove:50,k=typeof g.mousemoveCallback=="number"?g.mousemoveCallback:500;let M,U=[];const E=$t($(I=>{const F=Date.now()-M;m(U.map(P=>(P.timeOffset-=F,P)),I),U=[],M=null}),k),R=$($t($(I=>{const F=er(I),{clientX:P,clientY:b}=li(I)?I.changedTouches[0]:I;M||(M=bs()),U.push({x:P,y:b,id:S.getId(F),timeOffset:bs()-M}),E(typeof DragEvent<"u"&&I instanceof DragEvent?G.Drag:I instanceof MouseEvent?G.MouseMove:G.TouchMove)}),A,{trailing:!1})),L=[ve("mousemove",R,v),ve("touchmove",R,v),ve("drag",R,v)];return $(()=>{L.forEach(I=>I())})}(e),i=If(e),a=Kc(e),o=function({viewportResizeCb:m},{win:g}){let v=-1,S=-1;return ve("resize",$($t($(()=>{const A=zc(),k=jc();v===A&&S===k||(m({width:Number(k),height:Number(A)}),v=A,S=k)}),200)),g)}(e,{win:r}),l=function({inputCb:m,doc:g,mirror:v,blockClass:S,blockSelector:A,ignoreClass:k,ignoreSelector:M,maskInputOptions:U,maskInputFn:E,sampling:R,userTriggeredOnInput:L}){function I(B){let W=er(B);const T=B.isTrusted,D=W&&W.tagName;if(W&&D==="OPTION"&&(W=H.parentElement(W)),!W||!D||Cf.indexOf(D)<0||Se(W,S,A,!0)||W.classList.contains(k)||M&&W.matches(M))return;let ne=W.value,K=!1;const he=Pi(W)||"";he==="radio"||he==="checkbox"?K=W.checked:(U[D.toLowerCase()]||U[he])&&(ne=Di({element:W,maskInputOptions:U,tagName:D,type:he,value:ne,maskInputFn:E})),F(W,L?{text:ne,isChecked:K,userTriggered:T}:{text:ne,isChecked:K});const Le=W.name;he==="radio"&&Le&&K&&g.querySelectorAll(`input[type="radio"][name="${Le}"]`).forEach(ye=>{if(ye!==W){const ke=ye.value;F(ye,L?{text:ke,isChecked:!K,userTriggered:!1}:{text:ke,isChecked:!K})}})}function F(B,W){const T=Da.get(B);if(!T||T.text!==W.text||T.isChecked!==W.isChecked){Da.set(B,W);const D=v.getId(B);$(m)({...W,id:D})}}const P=(R.input==="last"?["change"]:["input","change"]).map(B=>ve(B,$(I),g)),b=g.defaultView;if(!b)return()=>{P.forEach(B=>B())};const y=b.Object.getOwnPropertyDescriptor(b.HTMLInputElement.prototype,"value"),O=[[b.HTMLInputElement.prototype,"value"],[b.HTMLInputElement.prototype,"checked"],[b.HTMLSelectElement.prototype,"value"],[b.HTMLTextAreaElement.prototype,"value"],[b.HTMLSelectElement.prototype,"selectedIndex"],[b.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&P.push(...O.map(B=>Ys(B[0],B[1],{set(){$(I)({target:this,isTrusted:!1})}},!1,b))),$(()=>{P.forEach(B=>B())})}(e),c=function({mediaInteractionCb:m,blockClass:g,blockSelector:v,mirror:S,sampling:A,doc:k}){const M=$(E=>$t($(R=>{const L=er(R);if(!L||Se(L,g,v,!0))return;const{currentTime:I,volume:F,muted:P,playbackRate:b,loop:y}=L;m({type:E,id:S.getId(L),currentTime:I,volume:F,muted:P,playbackRate:b,loop:y})}),A.media||500)),U=[ve("play",M(xt.Play),k),ve("pause",M(xt.Pause),k),ve("seeked",M(xt.Seeked),k),ve("volumechange",M(xt.VolumeChange),k),ve("ratechange",M(xt.RateChange),k)];return $(()=>{U.forEach(E=>E())})}(e);let u=()=>{},d=()=>{},p=()=>{},f=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:m,mirror:g,stylesheetManager:v},{win:S}){if(!S.CSSStyleSheet||!S.CSSStyleSheet.prototype)return()=>{};const A=S.CSSStyleSheet.prototype.insertRule;S.CSSStyleSheet.prototype.insertRule=new Proxy(A,{apply:$((L,I,F)=>{const[P,b]=F,{id:y,styleId:O}=rt(I,g,v.styleMirror);return(y&&y!==-1||O&&O!==-1)&&m({id:y,styleId:O,adds:[{rule:P,index:b}]}),L.apply(I,F)})}),S.CSSStyleSheet.prototype.addRule=function(L,I,F=this.cssRules.length){const P=`${L} { ${I} }`;return S.CSSStyleSheet.prototype.insertRule.apply(this,[P,F])};const k=S.CSSStyleSheet.prototype.deleteRule;let M,U;S.CSSStyleSheet.prototype.deleteRule=new Proxy(k,{apply:$((L,I,F)=>{const[P]=F,{id:b,styleId:y}=rt(I,g,v.styleMirror);return(b&&b!==-1||y&&y!==-1)&&m({id:b,styleId:y,removes:[{index:P}]}),L.apply(I,F)})}),S.CSSStyleSheet.prototype.removeRule=function(L){return S.CSSStyleSheet.prototype.deleteRule.apply(this,[L])},S.CSSStyleSheet.prototype.replace&&(M=S.CSSStyleSheet.prototype.replace,S.CSSStyleSheet.prototype.replace=new Proxy(M,{apply:$((L,I,F)=>{const[P]=F,{id:b,styleId:y}=rt(I,g,v.styleMirror);return(b&&b!==-1||y&&y!==-1)&&m({id:b,styleId:y,replace:P}),L.apply(I,F)})})),S.CSSStyleSheet.prototype.replaceSync&&(U=S.CSSStyleSheet.prototype.replaceSync,S.CSSStyleSheet.prototype.replaceSync=new Proxy(U,{apply:$((L,I,F)=>{const[P]=F,{id:b,styleId:y}=rt(I,g,v.styleMirror);return(b&&b!==-1||y&&y!==-1)&&m({id:b,styleId:y,replaceSync:P}),L.apply(I,F)})}));const E={};Hr("CSSGroupingRule")?E.CSSGroupingRule=S.CSSGroupingRule:(Hr("CSSMediaRule")&&(E.CSSMediaRule=S.CSSMediaRule),Hr("CSSConditionRule")&&(E.CSSConditionRule=S.CSSConditionRule),Hr("CSSSupportsRule")&&(E.CSSSupportsRule=S.CSSSupportsRule));const R={};return Object.entries(E).forEach(([L,I])=>{R[L]={insertRule:I.prototype.insertRule,deleteRule:I.prototype.deleteRule},I.prototype.insertRule=new Proxy(R[L].insertRule,{apply:$((F,P,b)=>{const[y,O]=b,{id:B,styleId:W}=rt(P.parentStyleSheet,g,v.styleMirror);return(B&&B!==-1||W&&W!==-1)&&m({id:B,styleId:W,adds:[{rule:y,index:[...Wr(P),O||0]}]}),F.apply(P,b)})}),I.prototype.deleteRule=new Proxy(R[L].deleteRule,{apply:$((F,P,b)=>{const[y]=b,{id:O,styleId:B}=rt(P.parentStyleSheet,g,v.styleMirror);return(O&&O!==-1||B&&B!==-1)&&m({id:O,styleId:B,removes:[{index:[...Wr(P),y]}]}),F.apply(P,b)})})}),$(()=>{S.CSSStyleSheet.prototype.insertRule=A,S.CSSStyleSheet.prototype.deleteRule=k,M&&(S.CSSStyleSheet.prototype.replace=M),U&&(S.CSSStyleSheet.prototype.replaceSync=U),Object.entries(E).forEach(([L,I])=>{I.prototype.insertRule=R[L].insertRule,I.prototype.deleteRule=R[L].deleteRule})})}(e,{win:r}),d=Xc(e,e.doc),p=function({styleDeclarationCb:m,mirror:g,ignoreCSSAttributes:v,stylesheetManager:S},{win:A}){const k=A.CSSStyleDeclaration.prototype.setProperty;A.CSSStyleDeclaration.prototype.setProperty=new Proxy(k,{apply:$((U,E,R)=>{var L;const[I,F,P]=R;if(v.has(I))return k.apply(E,[I,F,P]);const{id:b,styleId:y}=rt((L=E.parentRule)==null?void 0:L.parentStyleSheet,g,S.styleMirror);return(b&&b!==-1||y&&y!==-1)&&m({id:b,styleId:y,set:{property:I,value:F,priority:P},index:Wr(E.parentRule)}),U.apply(E,R)})});const M=A.CSSStyleDeclaration.prototype.removeProperty;return A.CSSStyleDeclaration.prototype.removeProperty=new Proxy(M,{apply:$((U,E,R)=>{var L;const[I]=R;if(v.has(I))return M.apply(E,[I]);const{id:F,styleId:P}=rt((L=E.parentRule)==null?void 0:L.parentStyleSheet,g,S.styleMirror);return(F&&F!==-1||P&&P!==-1)&&m({id:F,styleId:P,remove:{property:I},index:Wr(E.parentRule)}),U.apply(E,R)})}),$(()=>{A.CSSStyleDeclaration.prototype.setProperty=k,A.CSSStyleDeclaration.prototype.removeProperty=M})}(e,{win:r}),e.collectFonts&&(f=function({fontCb:m,doc:g}){const v=g.defaultView;if(!v)return()=>{};const S=[],A=new WeakMap,k=v.FontFace;v.FontFace=function(U,E,R){const L=new k(U,E,R);return A.set(L,{family:U,buffer:typeof E!="string",descriptors:R,fontSource:typeof E=="string"?E:JSON.stringify(Array.from(new Uint8Array(E)))}),L};const M=Ut(g.fonts,"add",function(U){return function(E){return setTimeout($(()=>{const R=A.get(E);R&&(m(R),A.delete(E))}),0),U.apply(this,[E])}});return S.push(()=>{v.FontFace=k}),S.push(M),$(()=>{S.forEach(U=>U())})}(e)));const w=function(m){const{doc:g,mirror:v,blockClass:S,blockSelector:A,selectionCb:k}=m;let M=!0;const U=$(()=>{const E=g.getSelection();if(!E||M&&(E!=null&&E.isCollapsed))return;M=E.isCollapsed||!1;const R=[],L=E.rangeCount||0;for(let I=0;I<L;I++){const F=E.getRangeAt(I),{startContainer:P,startOffset:b,endContainer:y,endOffset:O}=F;Se(P,S,A,!0)||Se(y,S,A,!0)||R.push({start:v.getId(P),startOffset:b,end:v.getId(y),endOffset:O})}k({ranges:R})});return U(),ve("selectionchange",U)}(e),h=function({doc:m,customElementCb:g}){const v=m.defaultView;return v&&v.customElements?Ut(v.customElements,"define",function(S){return function(A,k,M){try{g({define:{name:A}})}catch{console.warn(`Custom element callback failed for ${A}`)}return S.apply(this,[A,k,M])}}):()=>{}}(e),C=[];for(const m of e.plugins)C.push(m.observer(m.callback,r,m.options));return $(()=>{mt.forEach(m=>m.reset()),s==null||s.disconnect(),n(),i(),a(),o(),l(),c(),u(),d(),p(),f(),w(),h(),C.forEach(m=>m())})}function Vr(e){return window[e]!==void 0}function Hr(e){return!!(window[e]!==void 0&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Pa{constructor(t){x(this,"iframeIdToRemoteIdMap",new WeakMap),x(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,s,n){const i=s||this.getIdToRemoteIdMap(t),a=n||this.getRemoteIdToIdMap(t);let o=i.get(r);return o||(o=this.generateIdFn(),i.set(r,o),a.set(o,r)),o}getIds(t,r){const s=this.getIdToRemoteIdMap(t),n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,s,n))}getRemoteId(t,r,s){const n=s||this.getRemoteIdToIdMap(t);return typeof r!="number"?r:n.get(r)||-1}getRemoteIds(t,r){const s=this.getRemoteIdToIdMap(t);return r.map(n=>this.getRemoteId(t,n,s))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Ef{constructor(t){x(this,"iframes",new WeakMap),x(this,"crossOriginIframeMap",new WeakMap),x(this,"crossOriginIframeMirror",new Pa(Ol)),x(this,"crossOriginIframeStyleMirror"),x(this,"crossOriginIframeRootIdMap",new WeakMap),x(this,"mirror"),x(this,"mutationCb"),x(this,"wrappedEmit"),x(this,"loadListener"),x(this,"stylesheetManager"),x(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pa(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var s,n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((s=t.contentWindow)==null||s.addEventListener("message",this.handleMessage.bind(this))),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const s=this.crossOriginIframeMap.get(t.source);if(!s)return;const n=this.transformCrossOriginEvent(s,r.data.event);n&&this.wrappedEmit(n,r.data.isCheckout)}transformCrossOriginEvent(t,r){var s;switch(r.type){case J.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const n=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(r.data.node,n),{timestamp:r.timestamp,type:J.IncrementalSnapshot,data:{source:G.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case J.Meta:case J.Load:case J.DomContentLoaded:return!1;case J.Plugin:return r;case J.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case J.IncrementalSnapshot:switch(r.data.source){case G.Mutation:return r.data.adds.forEach(n=>{this.replaceIds(n,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(n.node,i)}),r.data.removes.forEach(n=>{this.replaceIds(n,t,["parentId","id"])}),r.data.attributes.forEach(n=>{this.replaceIds(n,t,["id"])}),r.data.texts.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case G.Drag:case G.TouchMove:case G.MouseMove:return r.data.positions.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case G.ViewportResize:return!1;case G.MediaInteraction:case G.MouseInteraction:case G.Scroll:case G.CanvasMutation:case G.Input:return this.replaceIds(r.data,t,["id"]),r;case G.StyleSheetRule:case G.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case G.Font:return r;case G.Selection:return r.data.ranges.forEach(n=>{this.replaceIds(n,t,["start","end"])}),r;case G.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(s=r.data.styles)==null||s.forEach(n=>{this.replaceStyleIds(n,t,["styleId"])}),r}}return!1}replace(t,r,s,n){for(const i of n)(Array.isArray(r[i])||typeof r[i]=="number")&&(Array.isArray(r[i])?r[i]=t.getIds(s,r[i]):r[i]=t.getId(s,r[i]));return r}replaceIds(t,r,s){return this.replace(this.crossOriginIframeMirror,t,r,s)}replaceStyleIds(t,r,s){return this.replace(this.crossOriginIframeStyleMirror,t,r,s)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(s=>{this.replaceIdOnNode(s,r)})}patchRootIdOnNode(t,r){t.type===me.Document||t.rootId||(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(s=>{this.patchRootIdOnNode(s,r)})}}class xf{constructor(t){x(this,"shadowDoms",new WeakSet),x(this,"mutationCb"),x(this,"scrollCb"),x(this,"bypassOptions"),x(this,"mirror"),x(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Zt(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=qc({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Kc({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(H.host(t))),this.restoreHandlers.push(Xc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const s=this;this.restoreHandlers.push(Ut(t.prototype,"attachShadow",function(n){return function(i){const a=n.call(this,i),o=H.shadowRoot(this);return o&&Yc(this)&&s.addShadowRoot(o,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tf=typeof Uint8Array>"u"?[]:new Uint8Array(256),Gr=0;Gr<64;Gr++)Tf[Yt.charCodeAt(Gr)]=Gr;const _a=new Map,Zc=(e,t,r)=>{if(!e||!eu(e,t)&&typeof e!="object")return;const s=function(i,a){let o=_a.get(i);return o||(o=new Map,_a.set(i,o)),o.has(a)||o.set(a,[]),o.get(a)}(r,e.constructor.name);let n=s.indexOf(e);return n===-1&&(n=s.length,s.push(e)),n};function ls(e,t,r){if(e instanceof Array)return e.map(s=>ls(s,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:function(s){var n,i=new Uint8Array(s),a=i.length,o="";for(n=0;n<a;n+=3)o+=Yt[i[n]>>2],o+=Yt[(3&i[n])<<4|i[n+1]>>4],o+=Yt[(15&i[n+1])<<2|i[n+2]>>6],o+=Yt[63&i[n+2]];return a%3==2?o=o.substring(0,o.length-1)+"=":a%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ls(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const s=e.constructor.name,{src:n}=e;return{rr_type:s,src:n}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[ls(e.data,t,r),e.width,e.height]}:eu(e,t)||typeof e=="object"?{rr_type:e.constructor.name,index:Zc(e,t,r)}:e}const Qc=(e,t,r)=>e.map(s=>ls(s,t,r)),eu=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function Na(e,t,r,s){const n=[];try{const i=Ut(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(o,...l){if(!Se(this,t,r,!0)){const c=function(u){return u==="experimental-webgl"?"webgl":u}(o);if("__context"in this||(this.__context=c),s&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){const u=l[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[o,...l])}});n.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(i=>i())}}function Fa(e,t,r,s,n,i){const a=[],o=Object.getOwnPropertyNames(e);for(const l of o)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;const c=Ut(e,l,function(u){return function(...d){const p=u.apply(this,d);if(Zc(p,i,this),"tagName"in this.canvas&&!Se(this.canvas,s,n,!0)){const f=Qc(d,i,this),w={type:t,property:l,args:f};r(this.canvas,w)}return p}});a.push(c)}catch{const c=Ys(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});a.push(c)}return a}const tu="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Ba=typeof window<"u"&&window.Blob&&new Blob([(za=tu,Uint8Array.from(atob(za),e=>e.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});var za;function Rf(e){let t;try{if(t=Ba&&(window.URL||window.webkitURL).createObjectURL(Ba),!t)throw"";const r=new Worker(t,{name:e==null?void 0:e.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+tu,{name:e==null?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class Lf{constructor(t){x(this,"pendingCanvasMutations",new Map),x(this,"rafStamps",{latestId:0,invokeId:null}),x(this,"mirror"),x(this,"mutationCb"),x(this,"resetObservers"),x(this,"frozen",!1),x(this,"locked",!1),x(this,"processMutation",(l,c)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c)});const{sampling:r="all",win:s,blockClass:n,blockSelector:i,recordCanvas:a,dataURLOptions:o}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(s,n,i),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,s,n,i,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,s,n,i){const a=Na(r,s,n,!0),o=new Map,l=new Rf;l.onmessage=f=>{const{id:w}=f.data;if(o.set(w,!1),!("base64"in f.data))return;const{base64:h,type:C,width:m,height:g}=f.data;this.mutationCb({id:w,type:Et["2D"],commands:[{property:"clearRect",args:[0,0,m,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:h}],type:C}]},0,0]}]})};const c=1e3/t;let u,d=0;const p=f=>{d&&f-d<c||(d=f,(()=>{const w=[];return r.document.querySelectorAll("canvas").forEach(h=>{Se(h,s,n,!0)||w.push(h)}),w})().forEach(async w=>{var h;const C=this.mirror.getId(w);if(o.get(C)||w.width===0||w.height===0)return;if(o.set(C,!0),["webgl","webgl2"].includes(w.__context)){const g=w.getContext(w.__context);((h=g==null?void 0:g.getContextAttributes())==null?void 0:h.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}const m=await createImageBitmap(w);l.postMessage({id:C,bitmap:m,width:w.width,height:w.height,dataURLOptions:i.dataURLOptions},[m])})),u=requestAnimationFrame(p)};u=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(t,r,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Na(t,r,s,!1),i=function(o,l,c,u){const d=[],p=Object.getOwnPropertyNames(l.CanvasRenderingContext2D.prototype);for(const f of p)try{if(typeof l.CanvasRenderingContext2D.prototype[f]!="function")continue;const w=Ut(l.CanvasRenderingContext2D.prototype,f,function(h){return function(...C){return Se(this.canvas,c,u,!0)||setTimeout(()=>{const m=Qc(C,l,this);o(this.canvas,{type:Et["2D"],property:f,args:m})},0),h.apply(this,C)}});d.push(w)}catch{const w=Ys(l.CanvasRenderingContext2D.prototype,f,{set(h){o(this.canvas,{type:Et["2D"],property:f,args:[h],setter:!0})}});d.push(w)}return()=>{d.forEach(f=>f())}}(this.processMutation.bind(this),t,r,s),a=function(o,l,c,u){const d=[];return d.push(...Fa(l.WebGLRenderingContext.prototype,Et.WebGL,o,c,u,l)),l.WebGL2RenderingContext!==void 0&&d.push(...Fa(l.WebGL2RenderingContext.prototype,Et.WebGL2,o,c,u,l)),()=>{d.forEach(p=>p())}}(this.processMutation.bind(this),t,r,s);this.resetObservers=()=>{n(),i(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const s=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,s)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const s=this.pendingCanvasMutations.get(t);if(!s||r===-1)return;const n=s.map(a=>{const{type:o,...l}=a;return l}),{type:i}=s[0];this.mutationCb({id:r,type:i,commands:n}),this.pendingCanvasMutations.delete(t)}}class Of{constructor(t){x(this,"trackedLinkElements",new WeakSet),x(this,"mutationCb"),x(this,"adoptedStyleSheetCb"),x(this,"styleMirror",new wf),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const s={id:r,styleIds:[]},n=[];for(const i of t){let a;this.styleMirror.has(i)?a=this.styleMirror.getId(i):(a=this.styleMirror.add(i),n.push({styleId:a,rules:Array.from(i.rules||CSSRule,(o,l)=>({rule:Rl(o,i.href),index:l}))})),s.styleIds.push(a)}n.length>0&&(s.styles=n),this.adoptedStyleSheetCb(s)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Af{constructor(){x(this,"nodeMap",new WeakMap),x(this,"active",!1)}inOtherBuffer(t,r){const s=this.nodeMap.get(t);return s&&Array.from(s).some(n=>n!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}}let ce,cs,fn,vs=!1;try{if(Array.from([1],e=>2*e)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Eo=e.contentWindow)==null?void 0:Eo.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const Oe=new Ll;function Jt(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:s,blockClass:n="rr-block",blockSelector:i=null,ignoreClass:a="rr-ignore",ignoreSelector:o=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:w,maskTextFn:h,hooks:C,packFn:m,sampling:g={},dataURLOptions:v={},mousemoveWait:S,recordDOM:A=!0,recordCanvas:k=!1,recordCrossOriginIframes:M=!1,recordAfter:U=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:E=!1,collectFonts:R=!1,inlineImages:L=!1,plugins:I,keepIframeSrcFn:F=()=>!1,ignoreCSSAttributes:P=new Set([]),errorHandler:b}=e;Qt=b;const y=!M||window.parent===window;let O=!1;if(!y)try{window.parent.document&&(O=!1)}catch{O=!0}if(y&&!t)throw new Error("emit function is required");if(!y&&!O)return()=>{};S!==void 0&&g.mousemove===void 0&&(g.mousemove=S),Oe.reset();const B=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},W=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all",headTitleMutations:f==="all"}:f||{};let T;(function(V=window){"NodeList"in V&&!V.NodeList.prototype.forEach&&(V.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in V&&!V.DOMTokenList.prototype.forEach&&(V.DOMTokenList.prototype.forEach=Array.prototype.forEach)})();let D=0;const ne=V=>{for(const Ie of I||[])Ie.eventProcessor&&(V=Ie.eventProcessor(V));return m&&!O&&(V=m(V)),V};ce=(V,Ie)=>{var N;const q=V;if(q.timestamp=bs(),!((N=mt[0])!=null&&N.isFrozen())||q.type===J.FullSnapshot||q.type===J.IncrementalSnapshot&&q.data.source===G.Mutation||mt.forEach(we=>we.unfreeze()),y)t==null||t(ne(q),Ie);else if(O){const we={type:"rrweb",event:ne(q),origin:window.location.origin,isCheckout:Ie};window.parent.postMessage(we,"*")}if(q.type===J.FullSnapshot)T=q,D=0;else if(q.type===J.IncrementalSnapshot){if(q.data.source===G.Mutation&&q.data.isAttachIframe)return;D++;const we=s&&D>=s,Y=r&&q.timestamp-T.timestamp>r;(we||Y)&&cs(!0)}};const K=V=>{ce({type:J.IncrementalSnapshot,data:{source:G.Mutation,...V}})},he=V=>ce({type:J.IncrementalSnapshot,data:{source:G.Scroll,...V}}),Le=V=>ce({type:J.IncrementalSnapshot,data:{source:G.CanvasMutation,...V}}),ye=new Of({mutationCb:K,adoptedStyleSheetCb:V=>ce({type:J.IncrementalSnapshot,data:{source:G.AdoptedStyleSheet,...V}})}),ke=new Ef({mirror:Oe,mutationCb:K,stylesheetManager:ye,recordCrossOriginIframes:M,wrappedEmit:ce});for(const V of I||[])V.getMirror&&V.getMirror({nodeMirror:Oe,crossOriginIframeMirror:ke.crossOriginIframeMirror,crossOriginIframeStyleMirror:ke.crossOriginIframeStyleMirror});const vt=new Af;fn=new Lf({recordCanvas:k,mutationCb:Le,win:window,blockClass:n,blockSelector:i,mirror:Oe,sampling:g.canvas,dataURLOptions:v});const dt=new xf({mutationCb:K,scrollCb:he,bypassOptions:{blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:B,dataURLOptions:v,maskTextFn:h,maskInputFn:w,recordCanvas:k,inlineImages:L,sampling:g,slimDOMOptions:W,iframeManager:ke,stylesheetManager:ye,canvasManager:fn,keepIframeSrcFn:F,processedNodeManager:vt},mirror:Oe});cs=(V=!1)=>{if(!A)return;ce({type:J.Meta,data:{href:window.location.href,width:jc(),height:zc()}},V),ye.reset(),dt.init(),mt.forEach(N=>N.lock());const Ie=function(N,q){const{mirror:we=new Ll,blockClass:Y="rr-block",blockSelector:Qe=null,maskTextClass:ld="rr-mask",maskTextSelector:cd=null,inlineStylesheet:ud=!0,inlineImages:dd=!1,recordCanvas:pd=!1,maskAllInputs:Ks=!1,maskTextFn:hd,maskInputFn:md,slimDOM:Nt=!1,dataURLOptions:fd,preserveWhiteSpace:gd,onSerialize:yd,onIframeLoad:wd,iframeLoadTimeout:bd,onStylesheetLoad:vd,stylesheetLoadTimeout:Sd,keepIframeSrcFn:Id=()=>!1}=q||{};return Tt(N,{doc:N,mirror:we,blockClass:Y,blockSelector:Qe,maskTextClass:ld,maskTextSelector:cd,skipChild:!1,inlineStylesheet:ud,maskInputOptions:Ks===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:Ks===!1?{password:!0}:Ks,maskTextFn:hd,maskInputFn:md,slimDOMOptions:Nt===!0||Nt==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:Nt==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:Nt===!1?{}:Nt,dataURLOptions:fd,inlineImages:dd,recordCanvas:pd,preserveWhiteSpace:gd,onSerialize:yd,onIframeLoad:wd,iframeLoadTimeout:bd,onStylesheetLoad:vd,stylesheetLoadTimeout:Sd,keepIframeSrcFn:Id,newlyAddedElement:!1})}(document,{mirror:Oe,blockClass:n,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:B,maskTextFn:h,maskInputFn:w,slimDOM:W,dataURLOptions:v,recordCanvas:k,inlineImages:L,onSerialize:N=>{Hc(N,Oe)&&ke.addIframe(N),Gc(N,Oe)&&ye.trackLinkElement(N),ci(N)&&dt.addShadowRoot(H.shadowRoot(N),document)},onIframeLoad:(N,q)=>{ke.attachIframe(N,q),dt.observeAttachShadow(N)},onStylesheetLoad:(N,q)=>{ye.attachLinkElement(N,q)},keepIframeSrcFn:F});if(!Ie)return console.warn("Failed to snapshot the document");ce({type:J.FullSnapshot,data:{node:Ie,initialOffset:Bc(window)}},V),mt.forEach(N=>N.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))};try{const V=[],Ie=q=>{var we;return $(kf)({mutationCb:K,mousemoveCb:(Y,Qe)=>ce({type:J.IncrementalSnapshot,data:{source:Qe,positions:Y}}),mouseInteractionCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.MouseInteraction,...Y}}),scrollCb:he,viewportResizeCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.ViewportResize,...Y}}),inputCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.Input,...Y}}),mediaInteractionCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.MediaInteraction,...Y}}),styleSheetRuleCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.StyleSheetRule,...Y}}),styleDeclarationCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.StyleDeclaration,...Y}}),canvasMutationCb:Le,fontCb:Y=>ce({type:J.IncrementalSnapshot,data:{source:G.Font,...Y}}),selectionCb:Y=>{ce({type:J.IncrementalSnapshot,data:{source:G.Selection,...Y}})},customElementCb:Y=>{ce({type:J.IncrementalSnapshot,data:{source:G.CustomElement,...Y}})},blockClass:n,ignoreClass:a,ignoreSelector:o,maskTextClass:l,maskTextSelector:c,maskInputOptions:B,inlineStylesheet:u,sampling:g,recordDOM:A,recordCanvas:k,inlineImages:L,userTriggeredOnInput:E,collectFonts:R,doc:q,maskInputFn:w,maskTextFn:h,keepIframeSrcFn:F,blockSelector:i,slimDOMOptions:W,dataURLOptions:v,mirror:Oe,iframeManager:ke,stylesheetManager:ye,shadowDomManager:dt,processedNodeManager:vt,canvasManager:fn,ignoreCSSAttributes:P,plugins:((we=I==null?void 0:I.filter(Y=>Y.observer))==null?void 0:we.map(Y=>({observer:Y.observer,options:Y.options,callback:Qe=>ce({type:J.Plugin,data:{plugin:Y.name,payload:Qe}})})))||[]},C)};ke.addLoadListener(q=>{try{V.push(Ie(q.contentDocument))}catch(we){console.warn(we)}});const N=()=>{cs(),V.push(Ie(document)),vs=!0};return document.readyState==="interactive"||document.readyState==="complete"?N():(V.push(ve("DOMContentLoaded",()=>{ce({type:J.DomContentLoaded,data:{}}),U==="DOMContentLoaded"&&N()})),V.push(ve("load",()=>{ce({type:J.Load,data:{}}),U==="load"&&N()},window))),()=>{V.forEach(q=>q()),vt.destroy(),vs=!1,Qt=void 0}}catch(V){console.warn(V)}}var ja,Ct;Jt.addCustomEvent=(e,t)=>{if(!vs)throw new Error("please add custom event after start recording");ce({type:J.Custom,data:{tag:e,payload:t}})},Jt.freezePage=()=>{mt.forEach(e=>e.freeze())},Jt.takeFullSnapshot=e=>{if(!vs)throw new Error("please take full snapshot after start recording");cs(e)},Jt.mirror=Oe,(Ct=ja||(ja={}))[Ct.NotStarted=0]="NotStarted",Ct[Ct.Running=1]="Running",Ct[Ct.Stopped=2]="Stopped";var Ae=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.FeedbackClosed="feedback.closed",e.PageChange="page.change",e.API="api",e.Override="override",e))(Ae||{}),z=(e=>(e.ReplayCapture="replay.capture",e.ReplayPaused="replay.paused",e.ReplayResumed="replay.resumed",e.FeedbackButtonLoaded="feedback.button.loaded",e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyCloseRequested="survey.closeRequested",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(z||{});const hr={FEEDBACK_BUTTON_LOADED:"feedback.button.loaded",SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_WIDTH:"survey.width",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};let $r;const Mf=new Uint8Array(16);function Uf(){if(!$r&&($r=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $r(Mf)}const fe=[];for(let e=0;e<256;++e)fe.push((e+256).toString(16).slice(1));const Wa={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function bt(e,t,r){if(Wa.randomUUID&&!e)return Wa.randomUUID();const s=(e=e||{}).random||(e.rng||Uf)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(n,i=0){return fe[n[i+0]]+fe[n[i+1]]+fe[n[i+2]]+fe[n[i+3]]+"-"+fe[n[i+4]]+fe[n[i+5]]+"-"+fe[n[i+6]]+fe[n[i+7]]+"-"+fe[n[i+8]]+fe[n[i+9]]+"-"+fe[n[i+10]]+fe[n[i+11]]+fe[n[i+12]]+fe[n[i+13]]+fe[n[i+14]]+fe[n[i+15]]}(s)}const _=new class{constructor(){ue(this,"breadcrumbs",[])}getTimeStamp(){return new Date().toISOString()}addBreadcrumb(e){this.breadcrumbs.push(e),this.breadcrumbs.length>300&&this.breadcrumbs.shift()}debug(e,t="debug"){this.addBreadcrumb({category:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"debug"})}error(e,t={}){this.addBreadcrumb({category:"error",data:t,level:"error",message:e,timestamp:this.getTimeStamp(),type:"error"})}http(e,t){this.addBreadcrumb({category:"xhr",data:t,message:e,timestamp:this.getTimeStamp(),type:"http"})}info(e,t={}){this.addBreadcrumb({category:"info",data:t,level:"info",message:e,timestamp:this.getTimeStamp(),type:"info"})}navigation(e,t){this.addBreadcrumb({category:"navigation",data:t,message:e,timestamp:this.getTimeStamp(),type:"navigation"})}},Va=()=>{try{return window.parent.Intercom}catch{return null}},Ha=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const e=Va();e&&(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},enable:()=>{const e=Va();e&&(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class ru{static disable(){Ha.forEach(t=>t.disable())}static enable(){Ha.forEach(t=>t.enable())}}var Df=class extends Error{constructor(e,t,r){super(`Possible EventEmitter memory leak detected. ${r} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=r,this.name="MaxListenersExceededWarning"}},su=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=su.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,r){this.emit(e,t,r)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const r=e.indexOf(t);return r>-1&&e.splice(r,1),[]}_wrapOnceListener(e,t){const r=(...s)=>(this.removeListener(e,r),t.apply(this,s));return Object.defineProperty(r,"name",{value:t.name}),r}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const r=this._getListeners(e);return r.forEach(s=>{s.apply(this,t)}),r.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const r=this._getListeners(e).concat(t);if(this.events.set(e,r),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const s=new Df(this,e,this.listenerCount(e));console.warn(s)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const r=this._getListeners(e);if(r.length>0){const s=[t].concat(r);this.events.set(e,s)}else this.events.set(e,r.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const r=this._getListeners(e);return r.length>0&&(this._removeListener(r,t),this.events.set(e,r),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},nu=su;nu.defaultMaxListeners=10;const j=new nu,Ss=async e=>{await new Promise(t=>{setTimeout(t,e)})},to=({"userleap-platform":e})=>{var t;return((t=window.UserLeap)==null?void 0:t.forceDirectEmbed)||e!=="web"};class iu{constructor(t){ue(this,"storage");ue(this,"tempStorage",{});ue(this,"isStorageAvailable");try{this.storage=window[t];const r="__storage_test__";this.storage.setItem(r,r),this.storage.removeItem(r),this.isStorageAvailable=!0}catch{this.isStorageAvailable=!1}}setItem(t,r){this.isStorageAvailable&&this.storage?this.storage.setItem(t,r):this.tempStorage[t]=r}setItemObject(t,r){try{this.setItem(t,JSON.stringify(r))}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to save to local storage",s))}}getItem(t){return this.isStorageAvailable&&this.storage?this.storage.getItem(t):this.tempStorage[t]}getItemObject(t){const r=this.getItem(t);if(r)try{return JSON.parse(r)}catch(s){s instanceof Error&&(s.stack=t+": "+r,window.UserLeap.reportError("Failed to parse local storage",s))}return{}}removeItem(t){this.isStorageAvailable&&this.storage?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable&&this.storage?this.storage.clear():this.tempStorage={}}}const ee=new iu("sessionStorage"),ct=new iu("localStorage");class Pf{constructor(t){ue(this,"payload");ue(this,"promise");ue(this,"reject",()=>{});ue(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((r,s)=>{this.reject=s,this.resolve=r})}resolveRequest(t){this.resolve(t)}}const re={replay:null},_f=()=>{const e=[];return re.replay&&e.push("replay"),e.join(",")},Nf=10;let ou=!1,au="",Yr=!1,lu=!1,us=[];const Ff=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?"web-gtm":e._segment?"web-segment":"web-snippet",Ga=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(lu=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`))},di=(e="")=>{ou=!0,au=e};function De(e={}){const t={"Content-Type":"application/json","userleap-platform":"web","x-ul-sdk-version":"2.48.0","x-ul-installation-method":Ff(e),"sprig-modules":_f(),"x-ul-package-version":"2.48.0"};if(e.envId&&(t["x-ul-environment-id"]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t["x-ul-user-id"]=e.userId),e.visitorId&&(t["x-ul-visitor-id"]=e.visitorId),e.partnerAnonymousId&&(t["x-ul-anonymous-id"]=e.partnerAnonymousId),e.mobileHeadersJSON){const r=JSON.parse(e.mobileHeadersJSON);Object.assign(t,r)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t["x-ul-preview-mode"]="1"),t}const $a=async({shouldDropOnRateLimit:e,...t})=>{if(e)return{status:429};{const r=new Pf(t);return us.push(r),r.promise}},Ve=async(e,t)=>{const{retries:r=0,shouldDropOnRateLimit:s=!1,shouldRetryRequest:n=!1,...i}=t,a={url:e,options:i,retries:r,shouldDropOnRateLimit:s};if(Yr&&!n)return $a(a);const o={ok:!1,reportError:!1};if(ou)return console.info(`UserLeap - ${au}`),o;try{const l=await fetch(e,i);if(l.status===429){if(!Yr&&!s||n){Yr=!0;const c=l.headers.has("ratelimit-reset")?Number(l.headers.get("ratelimit-reset")):Nf;return await Ss(1e3*c),Ve(e,{...i,shouldDropOnRateLimit:s,shouldRetryRequest:!0})}return $a(a)}if(Yr=!1,us.length&&(us.map(c=>{const u=c.payload;Ve(u.url,{...u.options,retries:u.retries,shouldDropOnRateLimit:u.shouldDropOnRateLimit}).then(d=>{c.resolveRequest(d)})}),us=[]),l.ok){if(l.status===249)return di(),o;const c=await l.text();try{return c&&c!=="OK"&&(l.json=JSON.parse(c)),l}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${c}`)}}}return l}catch(l){const c=r+1;return c>5||lu?{ok:!1,reportError:!1,error:l}:(await Ss(1e3*Math.pow(2,r)),Ve(e,{...i,retries:c}))}},Ya="ul-view-sdk-script",Bf=new Set(["ios","android"]),nt="visitors",it="environments";async function Be(e,t){var i,a,o;const{shouldDropOnRateLimit:r,...s}=t;s.headers=Object.assign(De(window.UserLeap),s.headers);const n=await Ve(e,{...s,shouldDropOnRateLimit:r});if(n.ok){const l=(i=n.headers)==null?void 0:i.get("Authorization"),c=l?l.split(" "):void 0,u=c&&c.length===2?c[1]:void 0,d=(a=n.headers)==null?void 0:a.get("x-ul-visitor-id");if(window.UserLeap.userId&&d===window.UserLeap.visitorId){const p=ct.getItemObject("sprig.anon.env.vid.map");p&&p[window.UserLeap.envId]===d&&(delete p[window.UserLeap.envId],ct.setItemObject("sprig.anon.env.vid.map",p))}u&&d&&(d!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(Ee("token",u),Ee("vid",d),j.emit(z.VisitorIDUpdated,{visitorId:d}),window.UserLeap.token=u,window.UserLeap.visitorId=d)}return(o=n.json)!=null&&o.logMessage&&console.warn(`[Sprig] ${n.json.logMessage}`),n}function Ee(e,t){const r=ct.getItemObject("userleap.ids");let s=r[window.UserLeap.envId];s?s[e]=t:s={[e]:t},r[window.UserLeap.envId]=s,ct.setItemObject("userleap.ids",r)}function ro(){return window.previewMode?"0":window.UserLeap.visitorId??""}function Me(e,t,r){const s=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(n=>{s.push(n),n===it?s.push(window.UserLeap.envId):n===nt&&s.push(ro())}),r&&s.push(r),s.join("/")}const tr=async(e,t,r)=>{var vt,dt,V,Ie;const{context:s,delay:n,avatars:i,experimentFlags:a,forceBrandedLogo:o,endCard:l,isFeedback:c=!1,heatmap:u,locale:d,layout:p,previewMode:f,productConfig:w,quotaMessages:h,providerPersona:C,quotas:m,questions:g,responseGroupUid:v,surveyId:S,uuid:A,vid:k,sessionReplay:M,showProviderPersona:U,useBranding:E,studyType:R,surveyVisitorAttributes:L}=e,I=De(window.UserLeap),F=mr(I),P=Js(I);if(M)if(F)j.emit(z.ReplayCapture,{responseGroupUid:v,hasQuestions:!!(g!=null&&g.length),surveyId:S,uploadId:M.uploadId,replayType:M.replayDurationType??"before",seconds:M.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:bt(),mediaType:"screen",questionId:1,responseGroupUid:v,surveyId:S,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!re.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};re.replay.scheduleOrCaptureReplay({responseGroupId:v,surveyId:S,visitorId:k,replayParams:M,completeUploadHeaders:I,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:g.length===0})}if(u){if(!re.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:N,replayParams:q,responseGroupUid:we,surveyId:Y}=u;await re.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:r}),re.replay.tryReplayAction(()=>{var Qe;return(Qe=re.replay)==null?void 0:Qe.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:I,eventId:N,isHeatmap:!0,replayParams:q,responseGroupId:we,surveyId:Y,triggerTimestamp:Date.now(),visitorId:k})},"Error in scheduling/capturing replay")}if(k==null||!(g!=null&&g.length))return _.info("CannotDisplaySurvey",{vid:k}),{success:!1,message:"[Sprig] no survey found",surveyState:window.UserLeap.container?"previous survey ready":"no survey"};if(zf(g))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:"no survey"};if(window.UserLeap.container){_.info("AlreadyDisplayingSurvey");const N="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(N),{success:!1,message:N,surveyState:"previous survey ready"}}if(k!==window.UserLeap.visitorId&&A!==window.UserLeap.visitorId&&!window.previewMode){const N="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(N)),{success:!1,message:N,surveyState:"no survey"}}_.info("ShowingSurvey",{surveyId:S}),(vt=re.replay)==null||vt.RecordSurveyShown({id:S,userAgent:window.navigator.userAgent}),ru.disable(),j.emit(z.SurveyWillPresent,{name:z.SurveyWillPresent,"survey.id":S,layout:p});let b,y,O,B,W=document.createElement("div");const T=N=>{const{"view.version":q}=N;q!==I["x-ul-sdk-version"]&&uu(),j.removeListener("verify.view.version",T)};j.on("verify.view.version",T),window.UserLeap.useMobileStyling=P,to(I)?(b="ul-direct-embeded-frame",y=document.head,O=window,B=!1,(()=>{const N=De(window.UserLeap),q=mr(N),we=window.UserLeap.forceDirectEmbed,Y=N["userleap-platform"]==="web";return q||we&&Y})()&&(cu(S,c),W.id=b,window.UserLeap.container.appendChild(W),du(),j.emit(z.SurveyLifeCycle,{state:"presented"}),j.emit(z.SurveyPresented,{name:z.SurveyPresented,"survey.id":S}))):{frameId:b,contentWinDocHead:y,contentWindow:O,hasOverlay:B,iframe:W}=Vf({productConfig:w,useMobileStyling:P,surveyId:S,isFeedback:c,enableCspTrustedTypes:(dt=window.UserLeap._config)==null?void 0:dt.enableCspTrustedTypes}),window.UserLeap.frameId=b;const D={apiURL:window.UserLeap._API_URL,avatars:i,cards:g,configureExitOnOverlayClick:N=>{j.once(z.CloseSurveyOnOverlayClick,N)},context:s,endCard:l,envId:window.UserLeap.envId,eventEmitFn:j.emit.bind(j),experimentFlags:a,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:o,frame:W,headers:I,layout:p,locale:d,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:ee.getItem("sprig.previewKey"),previewMode:f||!!window.previewMode,productConfig:{framePosition:w==null?void 0:w.framePosition,desktopDisplay:w==null?void 0:w.desktopDisplay,placement:w==null?void 0:w.placement},quotaMessages:h,providerPersona:C,quotas:m,responseGroupUid:v,showProviderPersona:U,useBranding:E??!0,startingQuestionIdx:(V=window.UserLeap.config)==null?void 0:V.startingQuestionIdx,studyType:R,styleNonce:window.UserLeap.styleNonce,surveyId:S,tabTitle:document.title,trackPageViewUrl:t,ulEvents:hr,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:P,userId:A,viewDocument:O==null?void 0:O.document,viewWindow:O,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},surveyVisitorAttributes:L||{},...window.UserLeap._config};(Ie=window.UserLeap._config)!=null&&Ie.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const ne=(c?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??w.customStyles;D.customStyles=ne,O&&(O.__cfg=D);const K=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:D.path,he=document.getElementById(Ya);he&&he.remove();const Le=function(){const N=document.createElement("script");return window.UserLeap.isMobileSDK||N.setAttribute("type","module"),window.UserLeap.nonce&&N.setAttribute("nonce",window.UserLeap.nonce),N.id=Ya,N}(),ye=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(D.installationMethod==="web-npm"||D.installationMethod==="web-npm-bundled"){const{default:N}=await Promise.resolve().then(()=>require("./view-umqtk1IA.cjs")).then(q=>q.view);N.configure(D),B&&window.UserLeap.container&&ye()}else K&&(Le.src=`${K}${window.UserLeap.isMobileSDK?"":`?t=${Date.now()}`}`,B&&Le.addEventListener("load",()=>{window.UserLeap.container&&ye()}),O==null||O.addEventListener("error",N=>{N.target instanceof HTMLScriptElement&&N.target.src===K&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));y==null||y.appendChild(Le);const ke={success:!0,surveyState:"ready",surveyId:S,responseGroupUid:v};return window.UserLeap.isMobileSDK&&n&&(ke.delay=n),ke};function Js(e){var r;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=((r=window.UserLeap.windowDimensions)==null?void 0:r.width)??document.body.clientWidth;return mr(e)||t>10&&t<500}function mr(e){return Bf.has(e["userleap-platform"])}const zf=e=>e.some(t=>t.type==="videovoice"),Ja=new WeakMap,jf=(e,t)=>{try{return(s=>{var a,o;const n=Ja.get(s);if(n)return n;if(!((a=s.trustedTypes)!=null&&a.createPolicy))throw new Error("Trusted types not supported");const i=(o=s.trustedTypes)==null?void 0:o.createPolicy("sprig-sdk",{createHTML:l=>l,createScript:l=>l,createScriptURL:l=>l});return Ja.set(s,i),i})(t).createHTML(e)}catch(r){return console.warn("Could not create TrustedHTML object",r),e}},qs=(e,t,r=window)=>{var s;return t&&((s=r.trustedTypes)!=null&&s.createPolicy)?jf(e,r):e},so="ul-frame";globalThis.UserLeap&&globalThis.Sprig&&(globalThis.Sprig._gtm?globalThis.Sprig=globalThis.UserLeap:globalThis.UserLeap=globalThis.Sprig),globalThis.UserLeap||(globalThis.UserLeap=globalThis.Sprig),globalThis.Sprig||(globalThis.Sprig=globalThis.UserLeap);const gn="0px",cu=(e,t,r)=>{globalThis.UserLeap.container=document.createElement("div"),globalThis.UserLeap.container.className="ul-container"+(t?" ul-container-feedback":""),e&&(globalThis.UserLeap.container.dataset.studyId=e.toString());const s=fu();r&&s&&!globalThis.UserLeap.useMobileStyling?s.appendChild(globalThis.UserLeap.container):document.body.appendChild(globalThis.UserLeap.container)},uu=(e,t)=>{var s;Gf();const r=globalThis.UserLeap.container;if(r)try{(s=r.parentNode)==null||s.removeChild(r),globalThis.UserLeap.container=null,Ee("trackStartUrl",null),j.emit(z.SurveyLifeCycle,{state:"dismissed"}),j.emit(z.SurveyClosed,{name:z.SurveyClosed,initiator:e,"survey.id":parseInt(r.dataset.studyId),...t&&{studyType:t}})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+r),n instanceof Error&&globalThis.UserLeap.reportError("dismissActiveSurvey",n)}},du=()=>{j.once(z.SurveyWillClose,({initiator:e,studyType:t})=>{j.removeAllListeners(z.CloseSurveyOnOverlayClick),uu(e,t)})},Wf=(e,t,r,s)=>{var u,d;const n={position:"fixed",bottom:"0px",right:gn,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},i=Object.assign({},t,globalThis.UserLeap),{desktopDisplay:a}=t||{},o=a==="center-modal";let l;o&&(i.framePosition="center");let c=!1;if(r)(u=globalThis.UserLeap.windowDimensions)!=null&&u.width?n.width=`${globalThis.UserLeap.windowDimensions.width}px`:n.width="100%",(d=globalThis.UserLeap.windowDimensions)!=null&&d.height?n.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px":globalThis.UserLeap.maxHeight?n.maxHeight=globalThis.UserLeap.maxHeight:n.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(i.overlayStyleMobile)&&(c=!0);else{n.width="360px",n.maxHeight=globalThis.UserLeap.maxHeight||"66vh";const p=()=>{c=!0,l={margin:"auto",position:"static"}};if(s)o?p():l={position:"relative",height:"300px"};else switch(i.framePosition){case"bottomLeft":l={left:gn};break;case"topLeft":l={left:gn,top:0};break;case"topRight":l={top:0};break;case"center":p()}}return c&&((p,f)=>{const w={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},h=f?p.overlayStyleMobile:p.overlayStyle;w["background-color"]=h==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",f||(w.margin="auto"),globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,w)})(i,r),Object.assign(e.style,n,l),c},Vf=({productConfig:e,useMobileStyling:t,surveyId:r,isFeedback:s,enableCspTrustedTypes:n})=>{var f,w;const i=so,a=s&&e.desktopDisplay==="slider";cu(r,s,a),Hf();const o=document.createElement("iframe");o.id=i,o.setAttribute("title","Sprig User Feedback Dialog");const l=Wf(o,e,t,s);du();let c=!1;o.setHeight=h=>{parseInt(o.style.height)==h&&c||(c=!0,o.style.height=`${h}px`,j.emit(z.SurveyHeight,{name:z.SurveyHeight,contentFrameHeight:h,"survey.id":r}))};let u=!1;o.setWidth=h=>{parseInt(o.style.width)==h&&u||(u=!0,o.style.width=`${h}px`,j.emit(z.SurveyWidth,{name:z.SurveyWidth,contentFrameWidth:h,"survey.id":r}))},(f=globalThis.UserLeap.container)==null||f.appendChild(o),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&globalThis.UserLeap.container&&(globalThis.UserLeap.container.onclick=()=>{j.emit(z.CloseSurveyOnOverlayClick)}),j.emit(z.SurveyLifeCycle,{state:"presented"}),j.emit(z.SurveyPresented,{name:z.SurveyPresented,"survey.id":r});const d=(w=o.contentWindow)==null?void 0:w.document;if(d&&(d.open("text/html","replace"),d.write(qs("<!doctype html><head></head><body></body></html>",n,o.contentWindow)),d.close(),!t)){const h=d.body;h.style.display="flex",h.style.alignItems="center"}const p=d==null?void 0:d.head;return{frameId:i,contentWinDocHead:p,contentWindow:o.contentWindow,hasOverlay:l,iframe:o}},pu={[z.SurveyFadingOut]:()=>{globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},Hf=()=>{Object.entries(pu).forEach(([e,t])=>{j.on(e,t)})},Gf=()=>{Object.entries(pu).forEach(([e,t])=>{j.off(e,t)})},qa=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function no(e,t){const{matchType:r,pattern:s}=e,n=r?qa[r]:qa.legacy;let i=!1;try{i=n(s,t)}catch(a){const o=`[Sprig] (ERR-445) Failed to check url match with pattern ${s}`;a instanceof Error&&(console.warn(o,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(o,a))}return i}const hu=e=>{const{pageUrlEvents:t}=window.UserLeap._config,r=t==null?void 0:t.find(s=>s.id===e);return!!r&&no(r,window.location.href)},Ye=e=>!!e&&e.nodeType===Node.ELEMENT_NODE,Ka=e=>e instanceof HTMLElement||e instanceof SVGElement,fr=({document:e,elementId:t,styleString:r,nonce:s})=>{const n=e.getElementById(t);if(n)return void(n.textContent=r);const i=e.createElement("style");s&&(i.nonce=s),i.textContent=r,i.id=t,e.head.appendChild(i)},Xa=(e,t)=>{const r=t.querySelector(e);if(!Ye(r))return 0;const s=getComputedStyle(r);return parseFloat(s.paddingLeft)+parseFloat(s.paddingRight)+(parseFloat(s.marginLeft)+parseFloat(s.marginRight))+(parseFloat(s.borderLeftWidth)+parseFloat(s.borderRightWidth))},mu=(e,t,r)=>{const s=e.querySelector(".ul-card__container"),n=e.querySelector(".ul-app");let i=600,a=360;if(Ye(s)&&Ye(n)){const o=s.querySelector(".ul-card--matrix_grid"),l=!o&&t&&r;try{l&&(n.style.width="360px"),i=s.scrollHeight,i+=(d=>{const p=d.querySelector(".sprig-question-body"),f=d.querySelector(".ul-card"),w=d.querySelector(".ul-card-main-content"),h=d.querySelector(".ul-footer"),C=d.querySelector(".sprig-container");let m=0;return Ye(f)&&(m+=f.scrollHeight-f.clientHeight),Ye(w)&&(m+=w.scrollHeight-w.clientHeight),Ye(p)&&(m+=p.scrollHeight-p.clientHeight),Ye(h)&&Ye(C)&&C.clientHeight===0&&(m+=h.clientHeight),m})(e);const c=getComputedStyle(s),u=parseFloat(c.marginTop)+parseFloat(c.marginBottom);i+=u+(parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)),o&&(a=o.scrollWidth,a+=Xa(".ul-card__container",e),a+=Xa(".sprig-question-body",e))}finally{l&&n.style.removeProperty("width")}}return[i+2,a]},fu=()=>Q,Ot=()=>document.getElementById("sprig-feedback-container"),pi=()=>document.getElementById("sprig-feedback-loading-animation"),gu=()=>!!document.getElementById(so);let Za=!1,Q=null,ze=null,io=!1,rr=null,pt=null;const $f=["bottom-left","bottom-right","center-left","center-right"],Is=()=>{var t;const e=window.UserLeap.container;return((t=e==null?void 0:e.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},yu=()=>document.getElementById("sprig-feedback-error-container"),wu=()=>{if(!Q)return 0;const e=Q==null?void 0:Q.clientWidth,t=window.getComputedStyle(Q);return e+parseInt(t.borderRightWidth||"0")+parseInt(t.borderLeftWidth||"0")},Cs=e=>{const t=Ot();t&&(pt!=null&&pt.endsWith("right")?t.style.right=`${e}px`:pt!=null&&pt.endsWith("left")&&(t.style.left=`${e}px`))},yn=()=>{if(Q&&(Is()||yu())){j.off(z.SurveyAppeared,qt),hi();const e=wu();return Cs(-e),!0}return!1},qt=()=>{if(!Q||!ze)return;const e=pi();e&&e.remove(),Q.style.height="auto",Q.style.width="auto",ze.disabled=!1,io=!1},hi=()=>{if(Q&&!pi()){const e=(()=>{var r;if(pi())return;const t=document.createElement("div");return t.className="ul-loading-spinner-container",t.id="sprig-feedback-loading-animation",t.role="progressbar",t.setAttribute("aria-live","polite"),t.setAttribute("aria-busy","true"),t.setAttribute("aria-label","Processing..."),t.innerHTML=qs(`
56
+ <div class="ul-loading-spinner">
57
+ <div class="first"></div>
58
+ <div class="second"></div>
59
+ <div class="third"></div>
60
+ <div class="fourth"></div>
61
+ </div>
62
+ `,(r=window.UserLeap._config)==null?void 0:r.enableCspTrustedTypes),t})();e&&(Q.style.height="300px",Q.style.width="360px",Q.appendChild(e))}},Qa=()=>{Q&&ze&&(Cs(0),ze.disabled=!0,io=!0)},bu=async(e,t,r)=>{const{buttonTheme:s,customStyles:n,eventId:i,placement:a,desktopDisplay:o,feedbackLabel:l,surveyUuid:c,surveyId:u}=e;window.UserLeap.feedbackCustomStyles=void 0;let d=Ot();if(d){if(!t&&i===rr)return;d.remove(),j.off(hr.SURVEY_FADING_OUT,yn)}rr=i,fr({document,elementId:"sprig-feedback-style",styleString:'.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}',nonce:window.UserLeap.styleNonce}),fr({document,elementId:"ul-custom-style",styleString:n??"",nonce:window.UserLeap.styleNonce}),Za=o==="center-modal",pt=a;const[p,f]=a.split("-");(m=>{if(Ot()||!$f.includes(m))return;const[g,v]=m.split("-"),S=document.createElement("div");S.id="sprig-feedback-container",S.classList.add(`sprig-feedback-container-${v}`,`sprig-feedback-container-${g}`),document.body.appendChild(S)})(a),d=Ot(),ze=document.createElement("button");const w=document.createElement("div");w.className="sprig-feedback-button-label",w.innerText=l,ze.appendChild(w),ze.id="sprig-feedback-button",ze.classList.add(`sprig-feedback-button-${f}`,`sprig-feedback-button-${p}`,`sprig-feedback-button-${s}`,"fade-in-transition"),j.on(hr.SURVEY_FADING_OUT,yn),ze.addEventListener("click",async()=>{const m=document.getElementById("sprig-feedback-error-container");if(gu()||yu()){if(yn()){j.emit(z.SurveyCloseRequested,{name:z.SurveyCloseRequested,initiator:Ae.FeedbackClosed,studyType:"feedbackButton","survey.id":u}),j.emit(z.SurveyWillClose,{name:z.SurveyWillClose,initiator:Ae.FeedbackClosed,studyType:"feedbackButton","survey.id":u});const v=Ot();m&&v&&(v.remove(),rr=null,Q=null)}return}if(Js(De(window.UserLeap))||io||Qa(),t)return Q&&Q.classList.add("sprig-feedback-loading-container-previews"),await tr(t),void qt();const g=await(async v=>{const S=await Be(Me("1",[nt],"startFeedbackStudy"),{body:JSON.stringify({surveyUuid:v}),method:"POST"});return S.ok?S.json:null})(c);if(g)j.once(z.SurveyAppeared,qt),tr({...g,studyType:"feedbackButton"},r);else if(Q){const v=Yf();Q.appendChild(v),qt(),Q.style.height="300px",Q.style.width="360px"}}),d==null||d.appendChild(ze),j.emit(z.FeedbackButtonLoaded,{name:z.FeedbackButtonLoaded,"survey.id":u});const{useMobileStyling:h,_config:{border:C}}=window.UserLeap;if(Za||h)Cs(0);else{const m=document.createElement("div");m.id="sprig-feedback-loading-container",m.className=`sprig-feedback-loading-container sprig-feedback-loading-container-${f}`,m.style.setProperty("--feedback-border",C),Q=m,hi(),d==null||d.appendChild(m);const g=wu();Cs(-g)}window.UserLeap._config.isOnQuestionsTab&&t&&!Is()&&Q&&(Qa(),hi(),Q&&Q.classList.add("sprig-feedback-loading-container-previews"),tr(t),qt())},Yf=()=>{var r;const e=document.createElement("div");e.id="sprig-feedback-error-container",e.innerHTML=qs(`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
63
+ <circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
64
+ <path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
65
+ <circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
66
+ </svg>`,(r=window.UserLeap._config)==null?void 0:r.enableCspTrustedTypes);const t=document.createElement("h3");return t.className="sprig-feedback-error-text",t.innerText="There was an error while loading the survey",e.appendChild(t),e},mi=new class{constructor(){ue(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(e){try{return!(!e||typeof e!="object"||Array.isArray(e))&&(Object.keys(this._ldData).forEach(t=>{delete this._ldData[t]}),Object.keys(e).forEach(t=>this._ldData[`!launch_darkly_${t}`]=(e[t]??0)+1),!0)}catch(t){return t instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",t),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(mi);const ds=new class{constructor(){ue(this,"_optimizelyData",{})}setOptimizelyExperiment(e,t=!0){if(!e||typeof e!="object")return!1;const{experiments:r}=e;try{return t&&Object.keys(this._optimizelyData).map(s=>{delete this._optimizelyData[s]}),r&&r.map(s=>{const{id:n,variation:i}=s,a=this.transformExperimentId(n);i&&typeof i=="string"&&(this._optimizelyData[a]=i)}),!0}catch(s){return s instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",s),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(e){return this._optimizelyData[this.transformExperimentId(e)]}transformExperimentId(e){return"!optimizely_experiments_"+e}getAndSetWebOptimizelyExperiments(){var e;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const t=(e=window.optimizely.get("state"))==null?void 0:e.getExperimentStates({isActive:!0});if(t){const r=Object.keys(t).map(s=>{var n,i;return(n=t[s].variation)!=null&&n.name?{id:s,variation:(i=t[s].variation)==null?void 0:i.name}:{id:s,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(t){return t instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",t),!1}}};Object.freeze(ds);class Jf{constructor(t,r){ue(this,"paused");ue(this,"queue");ue(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(r)}flush(t){const r=t.length;if(r)for(let s=0;s<r;s++)this.push(t[s])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const r=Array.prototype.slice.call(t,1),s=t[0],n=this.ul[s];n instanceof Function?n.apply(this.ul,r):s&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",s)}}perform(t){if(this.paused){let r=()=>{};const s=new Promise(function(n){r=function(){n(t())}});return this.queue.push(r),s}return t()}empty(){this.queue.length=0}}let vu=!0,fi=!1;const qf=["sdk_event_queue_latency_seconds","sdk_replay_add_event_batch_seconds","sdk_replay_cleanup_seconds","sdk_replay_compression_seconds","sdk_replay_get_events_between_seconds","sdk_replay_snapshot_seconds","sdk_mutations_nodes_added","sdk_mutations_nodes_removed","sdk_mutations_attributes_changed","sdk_mutations_character_data","sdk_dom_nodes_count","sdk_page_html_characters"];let gi,Kt={};class Kf{constructor(t){ue(this,"_values",[]);ue(this,"_isWebMetric");this.name=t,this._isWebMetric=qf.includes(this.name)}report(t){if(vu&&this._values.push({time:Date.now(),value:t}),fi||!this._isWebMetric)return;const r=this.findExceededThreshold(t);r&&gi&&gi(t,r)}collect(){const t=this._values;return this._values=[],t}findExceededThreshold(t){const r=Kt[this.name];if(r)return r.find(s=>this.valueExceedsThreshold(t,s))}valueExceedsThreshold(t,r){return r.type==="max"?t>r.value:r.type==="min"&&t<r.value}}const br={},We=e=>{const t=new Kf(e);return br[e]=t,t},Su=(e,t)=>{let r=br[e];return r||(r=We(e)),r.report(t)},Xf=({reportingIntervalSeconds:e,postMetrics:t})=>{e?setInterval(()=>{(async r=>{const s=Object.values(br).map(n=>({name:n.name,values:n.collect()}));if(s.some(n=>n.values.length))try{await r(JSON.stringify(s))}catch(n){n instanceof Error&&_.error("MetricsErr",{error:{message:n.message,name:n.name}})}})(t)},1e3*e):vu=!1};let Iu,Cu;const yi=e=>{let t=0,r=e.firstElementChild;for(;r;)t+=yi(r),r.shadowRoot&&(t+=yi(r.shadowRoot)),r=r.nextElementSibling,t++;return t},el=()=>{Iu.report(yi(document.body)),Cu.report(document.documentElement.innerHTML.toString().length)},wi=(e,t)=>{const r=performance.now();document.hidden?setTimeout(()=>wi(e,t),e):setTimeout(()=>{const s=performance.now()-r;t.report(s/1e3),setTimeout(()=>wi(e,t),e)},0)};let ks,Es,xs,Ts,tl,ht={};const Jr=(e,t=1)=>{const{name:r}=e;ht[r]=(ht[r]||0)+t},ku=e=>{let t=1;return e.childNodes.forEach(r=>{t+=ku(r)}),t},rl=e=>{let t=0;return e.forEach(r=>{t+=ku(r)}),t},Zf=e=>{switch(e.type){case"childList":return Jr(ks,rl(e.addedNodes)),void Jr(Es,rl(e.removedNodes));case"attributes":return void Jr(xs);case"characterData":return void Jr(Ts)}},Qf=e=>e.forEach(Zf),eg=()=>{ks.report(ht[ks.name]||0),Es.report(ht[Es.name]||0),xs.report(ht[xs.name]||0),Ts.report(ht[Ts.name]||0),ht={}},tg=(e=1e3)=>{ks=We("sdk_mutations_nodes_added"),Es=We("sdk_mutations_nodes_removed"),xs=We("sdk_mutations_attributes_changed"),Ts=We("sdk_mutations_character_data"),tl=new MutationObserver(Qf),tl.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(eg,e)},rg=({isWeb:e,reportingIntervalSeconds:t,thresholds:r,postMetrics:s})=>{((n,i)=>{Kt={},fi=!1,n==null||n.forEach(a=>{var o;a.metric in Kt||(Kt[a.metric]=[]),(o=Kt[a.metric])==null||o.push(a)}),gi=i})(r,(n,i)=>{var a,o;if((a=re.replay)!=null&&a.isReplayRecording()){const l=`Value: ${n} on ${i.metric} violated threshold of ${i.type} ${i.value}`;(o=re.replay)==null||o.disableRecording("Threshold violated",new Error(l),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:i.metric,type:i.type,value:i.value},{metricName:i.metric}),fi=!0}}),Xf({reportingIntervalSeconds:t,postMetrics:s}),e&&(((n=1e3)=>{const i=We("sdk_event_queue_latency_seconds");wi(n,i)})(),((n=1e4)=>{Iu=We("sdk_dom_nodes_count"),Cu=We("sdk_page_html_characters"),el(),setInterval(el,n)})(),tg())},sg="test",ng=["popState","pushState","replaceState"];let oo,sr;const Rs={},Vt="!email",Eu="pageUrl";var dl;let wn=((dl=globalThis.location)==null?void 0:dl.href)||"";function nr(e){var o,l;const{pageUrlEvents:t,interactiveEvents:r,dismissOnPageChange:s,platform:n}=globalThis.UserLeap._config;if(n&&n!=="web")return;wn!==globalThis.location.href&&_.navigation("LocationChange",{from:wn,to:globalThis.location.href}),wn=globalThis.location.href;const i=Ru().trackStartUrl,a=i?String(i):null;t&&Ou(globalThis.location.href),r&&(Tu(),ig()),fu()&&(()=>{if(Is())return;const c=Ot();c&&(hu(rr)||(c.remove(),rr=null,Q=null))})(),ee.getItem("sprig.isCapturingHeatmap")&&((l=(o=re.replay)==null?void 0:o.checkPendingHeatmapsUrl())==null||l.then(c=>{var u;c&&((u=re.replay)==null||u.uploadReadyPendingCaptures(!0))})),!Is()&&s&&a&&a!==globalThis.location.href&&e&&ng.includes(e.type)&&globalThis.UserLeap("dismissActiveSurvey",Ae.PageChange)}const xu={capture:!0},ig=()=>{const e=globalThis.UserLeap._config.interactiveEvents.filter(r=>no(r,globalThis.location.href)).map(r=>{const{name:s,properties:n}=r,{selector:i,innerText:a}=n;return i?o=>{if(Ka(o.target))try{o.target.closest(i)&&globalThis.UserLeap("track",s)}catch{}return!1}:o=>(Ka(o.target)&&o.target.innerText===a&&globalThis.UserLeap("track",s),!1)}),t=r=>e.forEach(s=>s(r));globalThis.UserLeap._config.interactiveEventsHandler=t,globalThis.addEventListener("click",t,xu)},Tu=()=>{globalThis.UserLeap._config.interactiveEventsHandler&&globalThis.removeEventListener("click",globalThis.UserLeap._config.interactiveEventsHandler,xu),delete globalThis.UserLeap._config.interactiveEventsHandler};function Ru(){const e=ct.getItemObject("userleap.ids");return(e==null?void 0:e[globalThis.UserLeap.envId])||{}}function Lu(){if(globalThis.previewMode)return;const e=ct.getItemObject("sprig.anon.env.vid.map")||{},t=e[globalThis.UserLeap.envId];globalThis.UserLeap.visitorId=t||bt(),_.info("NewVid",{vid:globalThis.UserLeap.visitorId}),Ee("vid",globalThis.UserLeap.visitorId),t||(e[globalThis.UserLeap.envId]=globalThis.UserLeap.visitorId,ct.setItemObject("sprig.anon.env.vid.map",e)),j.emit(z.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId})}function Ou(e,t,r,s){var n,i;try{if(e.endsWith("mock_snippet.html"))return;_.info("PageView",{url:e});const a=(n=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:n.getAttribute("content");(i=re.replay)==null||i.RecordPageView({...a&&{description:a},url:e,referrer:document.referrer,pageTitle:document.title});const o=globalThis.UserLeap._config.pageUrlEvents;let l=!1;if(o&&o.length)for(let u=0;u<o.length&&(l=no(o[u],e),!l);u++);if(!l)return;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const c={url:e};s&&(c.trackPageView=!0),globalThis.UserLeap._queue.push(["track",Eu,t,c,r])}catch(a){a instanceof Error&&(a.stack=e,globalThis.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-428) Failed to track page view",a)}}function og(){var t;const e=((t=globalThis.Backbone)==null?void 0:t.history)||globalThis.history;"pushState"in e&&(e.pushState=(r=>function(...s){const n=r.apply(this,s),i=new Event("pushState");return globalThis.dispatchEvent(i),nr(i),n})(e.pushState)),"replaceState"in e&&(e.replaceState=(r=>function(...s){const n=r.apply(this,s),i=new Event("replaceState");return globalThis.dispatchEvent(i),nr(i),n})(e.replaceState)),["hashchange","popstate"].forEach(r=>globalThis.addEventListener(r,nr,!0))}async function bn(e,t){const r=ro();e&&!t&&(globalThis.UserLeap._config.mode=sg);const s=Js(De(globalThis.UserLeap)),n=await Be(function(i){const a=new URL(Me("1",[it],"questions"));return Object.entries(i||{}).forEach(([o,l])=>{l&&a.searchParams.append(o,String(l))}),a.toString()}({desktopDisplay:globalThis.UserLeap._config.desktopDisplay,isMobile:s,previewLanguage:globalThis.UserLeap._config.previewLanguage,surveyid:e==null?void 0:e.surveyId,surveytemplateid:e==null?void 0:e.surveyTemplateId,vid:r}),{shouldDropOnRateLimit:!0});if(!n.ok)return n.reportError&&n.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",n.error),globalThis.UserLeap.reportError("getQuestions",n.error)),{success:!1,surveyState:"no survey"};if(n.json.delay&&await Ss(n.json.delay),!n.json.isFeedback)return tr(n.json,sr,oo);{const{feedbackLabel:i,productConfig:a,surveyUuid:o,feedbackCustomStyles:l}=n.json,{buttonTheme:c,placement:u,desktopDisplay:d}=a;bu({customStyles:l,buttonTheme:c,desktopDisplay:d,eventId:0,feedbackLabel:i,placement:u,surveyUuid:o,surveyId:e==null?void 0:e.surveyId},n.json)}}function ag(e){if(!e)return;globalThis.UserLeap._config=e,e.mute&&globalThis.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:r,dismissOnPageChange:s}=e;t&&function(n){let i=n.length;for(;i;){const a=Math.floor(Math.random()*i);i-=1;const o=n[i];n[i]=n[a],n[a]=o}}(t),(t||r||s)&&(og(),nr())}const lg=function(e){if(!globalThis.UserLeap)return;const t=async(n={})=>{var m,g,v,S,A;const{userId:i,anonymousId:a,metadata:o={},properties:l,showSurveyCallback:c}=n;let{eventName:u}=n;if(globalThis.UserLeap.debugMode&&u!==Eu&&console.info("[DEBUG] Sprig track",n),e.mode==="test")return;const d=ee.getItem("sprig.previewKey")??void 0;if(e.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!i){const k="[Sprig] - Skipping tracking without userId";return console.warn(k),{success:!1,message:k,surveyState:"no survey"}}if(!u||u.trim().length===0){u=u?String(u):"";const k="[Sprig] - Invalid event name "+u;return console.warn(k),{success:!1,message:k,surveyState:"no survey"}}const p=sr??globalThis.location.href;o.url||(o.url=p),Ee("trackStartUrl",p),(g=(m=globalThis.UserLeap)==null?void 0:m._config)!=null&&g.optimizelyEnabled&&(mr(De(globalThis.UserLeap))||ds.getAndSetWebOptimizelyExperiments(),o.optimizelyExperiments=Object.assign({},ds.getAllOptimizelyExperiments())),(S=(v=globalThis.UserLeap)==null?void 0:v._config)!=null&&S.launchDarklyEnabled&&(o.launchDarklyFlags=mi.getAllLaunchDarklyVariations()),i&&(globalThis.UserLeap.userId=i),a&&(globalThis.UserLeap.partnerAnonymousId=a),l&&(o.eventProperties=l),(A=re.replay)==null||A.RecordEvent({name:u,url:o.url}),_.info("TrackEvent",{eventName:u});const f=globalThis.UserLeap.delayingSurvey||gu()?await Be(Me("1",[nt],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:o}],previewKey:d}),method:"POST",shouldDropOnRateLimit:!0}):await Be(Me("1",[nt],"events"),{body:JSON.stringify({event:u,metadata:o,previewKey:d}),method:"POST",shouldDropOnRateLimit:!0});if(!f.ok){const k="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(k,f.error),f.error&&globalThis.UserLeap.reportError("track",f.error)),{success:!1,message:k,error:f.error,surveyState:"no survey"}}i&&Ee("uid",i),a&&Ee("aid",a);const w=f.json;w.invalidPreviewKey&&ee.removeItem("sprig.previewKey");const h=o.trackPageView?o.url:void 0;return w!=null&&w.feedbackButton&&bu(w.feedbackButton,void 0,h),await async function(k,M){var E,R;let U=!0;return!(M&&((E=k==null?void 0:k.json)!=null&&E.surveyId)&&(globalThis.UserLeap.delayingSurvey=!0,U=await M(k.json.surveyId),globalThis.UserLeap.delayingSurvey=!1,!U))&&((R=k==null?void 0:k.json)!=null&&R.delay&&!globalThis.UserLeap.isMobileSDK&&(globalThis.UserLeap.delayingSurvey=!0,await Ss(k.json.delay),globalThis.UserLeap.delayingSurvey=!1),U)}(f,c)?function(k){if(!globalThis.UserLeap._config.dismissOnPageChange)return!0;const M=new URL(k),U=new URL(sr??globalThis.location.href);return M.hostname===U.hostname&&M.pathname===U.pathname}(p)?tr(w,h,oo):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},r=(n,i)=>{var o;const a=(o=n==null?void 0:n.querySelector(`[id="${so}"]`))==null?void 0:o.contentDocument;a&&fr({document:a,elementId:"ul-custom-style",styleString:i})},s={displaySurvey:async n=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),globalThis.UserLeap("dismissActiveSurvey",Ae.Override),bn({surveyId:n},!0)),_previewSurvey(n){globalThis.UserLeap("dismissActiveSurvey",Ae.Override),bn({surveyTemplateId:n},!1)},_reviewSurvey(n){globalThis.UserLeap("dismissActiveSurvey",Ae.Override),bn({surveyId:n},!1)},previewSurvey(n){s._previewSurvey(n)},reviewSurvey(n){s._reviewSurvey(n)},mute(){globalThis.UserLeap._queue.pause()},unmute(){globalThis.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(n=Ae.API){globalThis.UserLeap.container&&(n===Ae.Closed&&globalThis.Sprig.trackHistory&&globalThis.Sprig.trackHistory({event:"closed"}),j.emit(z.SurveyCloseRequested,{name:z.SurveyCloseRequested,initiator:n,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}),j.emit(z.SurveyWillClose,{name:z.SurveyWillClose,initiator:n,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},async setAttribute(n,i){if(!n||!i&&i!==0&&i!==!1){const a="[Sprig] - Disregarding empty attribute / value provided";return console.warn(a),{success:!1,message:a}}return this.setAttributes({[n]:i})},async setAttributes(n){if(n==null||Object.keys(n).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:n})},async identifyAndSetAttributes(n){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",n),e.mode==="test")return;if(n===null||typeof n!="object"||!(n.userId||n.anonymousId||n.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:a,attributes:o}=n;if(e.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(o){o.email&&!o[Vt]&&(o[Vt]=o.email,delete o.email);const u=Object.keys(o);for(const d of u)o[d]===Rs[d]&&delete o[d]}if(!(o&&Object.keys(o).length!==0||i&&globalThis.UserLeap.userId!==i||a&&globalThis.UserLeap.partnerAnonymousId!==a))return{success:!0};const l={};let c;return i&&(l.userId=globalThis.UserLeap.userId=i),a&&(l.partnerAnonymousId=globalThis.UserLeap.partnerAnonymousId=a),o&&Object.keys(o).length>0?(c=await Be(Me("1",[it,nt],"attributes"),{body:JSON.stringify(o),method:"PUT"}),c.ok?Object.assign(Rs,o):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&globalThis.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await Be(Me("1",[it,nt]),{body:JSON.stringify(l),method:"PUT"}),o&&o[Vt]&&(globalThis.UserLeap.email=o[Vt]),c.ok&&(i&&Ee("uid",i),a&&Ee("aid",a)),{success:!!c.ok}},async removeAttributes(n){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",n),e.mode==="test")return;if(n==null||n.length===0){const a="[Sprig] - Disregarding empty attributes provided";return console.warn(a),{success:!1,message:a}}if(e.requireUserIdForTracking&&!globalThis.UserLeap.userId){const a="[Sprig] - Skipping tracking without userId";return console.warn(a),{success:!1,message:a}}const i=await Be(Me("1",[it,nt],"attributes"),{body:JSON.stringify({delete:n}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&globalThis.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(n){j.on(z.SurveyLifeCycle,n)},async removeSurveyListener(n){j.removeListener(z.SurveyLifeCycle,n)},async addListener(n,i){j.on(n,i)},async removeListener(n,i){j.removeListener(n,i)},async removeAllListeners(){j.removeAllListeners()},setPreviewKey(n){n&&typeof n=="string"&&ee.isStorageAvailable&&n&&ee.setItem("sprig.previewKey",n)},async setUserId(n){var o;if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",n),n==null){const l=`[Sprig] - Invalid userId ${n}`;return console.warn(l),{success:!1,message:l}}if(e.mode==="test"||n===globalThis.UserLeap.userId)return;globalThis.UserLeap.userId=n;const i=globalThis.UserLeap.visitorId,a=await Be(Me("1",[it,nt]),{body:JSON.stringify({userId:n}),method:"PUT"});a.ok?(i!==globalThis.UserLeap.visitorId&&((o=re.replay)==null||o.clearUserReplayData()),Ee("uid",n)):a.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",a.error),a.error&&globalThis.UserLeap.reportError("setUserId",a.error))},async setPartnerAnonymousId(n){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",n),n==null){const i=`[Sprig] - Invalid partnerAnonymousId ${n}`;return console.warn(i),{success:!1,message:i}}return globalThis.UserLeap.partnerAnonymousId=n,Ee("aid",n),{success:!0}},track:async(n,i,a={},o=void 0)=>t({eventName:n,properties:i,metadata:a,showSurveyCallback:o}),identifyAndTrack:async n=>await t(n),trackPageView(n,i=void 0,a=void 0,o=!0){sr=n,Ou(n,i,a,o)},applyFeedbackStyles({button:n="",view:i=""}){globalThis.UserLeap.feedbackCustomStyles=i,document.getElementById("sprig-feedback-style")&&fr({document,elementId:"ul-custom-style",styleString:n,nonce:globalThis.UserLeap.styleNonce}),r(document.querySelector(".ul-container-feedback"),i)},applyStyles(n){globalThis.UserLeap.customStyles=n,r(globalThis.UserLeap.container,n)},setWindowDimensions(n,i){var p,f;const a=typeof n=="string"?parseInt(n,10):n,o=typeof i=="string"?parseInt(i,10):i;isNaN(a)||isNaN(o)||(globalThis.UserLeap.windowDimensions={width:a,height:o});const l=De(globalThis.UserLeap),c=Js(l),u=l["userleap-platform"]==="web";if(!globalThis.UserLeap.frameId)return;const d=document.getElementById(globalThis.UserLeap.frameId);d&&(globalThis.UserLeap.useMobileStyling&&((p=globalThis.UserLeap.windowDimensions)!=null&&p.width&&(d.style.width=`${globalThis.UserLeap.windowDimensions.width}px`),(f=globalThis.UserLeap.windowDimensions)!=null&&f.height&&(d.style.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px"),d.contentDocument&&(d.style.height=String(mu(d.contentDocument,u&&!c,to(l))[0])+"px")),j.emit(z.SurveyDimensions,{name:z.SurveyDimensions,contentFrameWidth:d.clientWidth,contentFrameHeight:d.clientHeight,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},logoutUser(){var n;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),_.info("LogOut",{vid:globalThis.UserLeap.visitorId,userId:globalThis.UserLeap.userId}),globalThis.UserLeap.visitorId=null,globalThis.UserLeap.userId=null,globalThis.UserLeap.partnerAnonymousId=null,globalThis.UserLeap.token=null,globalThis.UserLeap.email=null,ct.removeItem("userleap.ids"),globalThis.UserLeap._queue.isPaused()&&globalThis.UserLeap._queue.empty(),Lu(),(n=re.replay)==null||n.clearUserReplayData(),globalThis.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(n=>globalThis.removeEventListener(n,nr,!0)),globalThis.UserLeap._config.interactiveEvents&&Tu(),globalThis.UserLeap("dismissActiveSurvey",Ae.API),delete globalThis.UserLeap,delete globalThis.Sprig,delete globalThis._Sprig},integrateOptimizely(n,i=!0){var a,o;if((o=(a=globalThis.UserLeap)==null?void 0:a._config)!=null&&o.optimizelyEnabled)try{const l=typeof n=="string"?JSON.parse(n):n;ds.setOptimizelyExperiment(l,i)}catch(l){console.warn("[Sprig] Error with integrating Optimizely data"),l instanceof Error&&globalThis.UserLeap.reportError("integrateOptimizely",l)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(n){var i,a;if(!((a=(i=globalThis.UserLeap)==null?void 0:i._config)!=null&&a.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");n.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:o,variation:l})=>{const c={experiments:[{id:o.id,variation:l.key}]};globalThis.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(n){var i,a;(a=(i=globalThis.UserLeap)==null?void 0:i._config)!=null&&a.launchDarklyEnabled?mi.setLDFlagsVariations(n):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(n,i)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),s.setAttribute(n,i)),setEmail:async n=>s.setAttribute(Vt,n),setVisitorEmail:async n=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),s.setEmail(n)),_generateVideoUploadUrl:async n=>async function(i){var o;if(!i)return;const a=`${globalThis.UserLeap._API_URL}/2/environments/integrations/upload`;try{const l=await fetch(a,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(l.ok){const c=await l.json();return(o=c==null?void 0:c.upload)==null?void 0:o.url}return null}catch(l){console.warn("[Sprig] Error with generating video upload url"),l instanceof Error&&globalThis.UserLeap.reportError("generateVideoUploadUrl",l)}}(n),_reportMetric(n,i){Su(n,i)},_completeSessionReplay:async({surveyId:n,responseGroupUuid:i,eventDigest:a})=>{var o;return re.replay?(o=re.replay)==null?void 0:o._completeSessionReplay({surveyId:n,responseGroupUuid:i,eventDigest:a,headers:De(globalThis.UserLeap)}):(globalThis.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var n,i,a,o;(i=(n=re.replay)==null?void 0:n.isReplayPaused)!=null&&i.call(n)||((o=(a=re.replay)==null?void 0:a.recordReplayPaused)==null||o.call(a))},resumeReplayRecording(){var n,i,a,o,l,c;(i=(n=re.replay)==null?void 0:n.isReplayPaused)!=null&&i.call(n)&&((o=(a=re.replay)==null?void 0:a.recordReplayResumed)==null||o.call(a),(c=(l=re.replay)==null?void 0:l.recordFullSnapshot)==null||c.call(l))}};Object.assign(globalThis.UserLeap,s)};async function cg(e,t,r={},s={}){var u;const n=(u=globalThis.__cfg)==null?void 0:u.mode,i=ro(),a=globalThis.UserLeap.envId,o=globalThis.document.documentElement,l={mode:n,screenWidth:globalThis.screen.width,screenHeight:globalThis.screen.height,clientWidth:o.clientWidth,clientHeight:o.clientHeight,location:sr??globalThis.location.href,language:globalThis.navigator.language,...r},c={action:e,breadcrumbs:_.breadcrumbs,err:{message:`${t==null?void 0:t.name} - ${t==null?void 0:t.message}`,stack:t==null?void 0:t.stack},meta:l,vid:i,envId:a,...s};(await Be(Me("1",null,"errors"),{method:"POST",headers:{"x-ul-error":globalThis.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function ug(e={}){var s;(s=globalThis.SprigLoggerCallback)==null||s.call(globalThis,"Initializing Sprig");const t=new URLSearchParams(globalThis.location.search).get("sprigPreviewKey")??"";async function r(){var d,p,f,w,h;if(globalThis.UserLeap.loaded)return;if((d=globalThis.SprigLoggerCallback)==null||d.call(globalThis,"Loading Sprig"),globalThis.UserLeap.reportError=cg,globalThis.UserLeap.loaded=!0,globalThis.UserLeap._config=Object.assign({},e,globalThis.UserLeap.config),globalThis.UserLeap.delayingSurvey=!1,globalThis.UserLeap._config&&typeof globalThis.UserLeap._config=="object")for(const C in globalThis.UserLeap._config)globalThis.UserLeap[C]=globalThis.UserLeap._config[C];if(globalThis.Sprig.outstandingTransactionLimit!==void 0&&(e.outstandingTransactionLimit=globalThis.Sprig.outstandingTransactionLimit),!globalThis.UserLeap.envId){if(!globalThis.UserLeap.appId)throw new Error("Missing Environment id");globalThis.UserLeap.envId=globalThis.UserLeap.appId}globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const n=Ru(),i=globalThis.UserLeap.sampleRate;let a=n.sampled;if(i){if(a===null&&(a=Math.random()<i,Ee("sampled",a)),!a)return}else a!==null&&Ee("sampled",null);globalThis.UserLeap._API_URL||(globalThis.UserLeap._API_URL="https://api.sprig.com");const o=[...globalThis.UserLeap._queue];globalThis.UserLeap._queue=new Jf(globalThis.UserLeap,[]),globalThis.UserLeap._queue.pause();for(let C=0;C<o.length;C++)globalThis.UserLeap._queue.push(o[C]);const l=n.token;l?(globalThis.UserLeap.token=l,globalThis.UserLeap.visitorId=n.vid??null,globalThis.UserLeap.userId=n.uid??null,globalThis.UserLeap.partnerAnonymousId=n.aid??null):Lu();const c=mr(De(globalThis.UserLeap));(p=globalThis.SprigLoggerCallback)==null||p.call(globalThis,"Sprig fetching config");const u=await async function(C){var S,A;const m=De(globalThis.UserLeap);document.addEventListener("securitypolicyviolation",Ga);const g=await Ve(Me("1",[it],"config"),{headers:m});if(document.removeEventListener("securitypolicyviolation",Ga),!g.ok)return(S=globalThis.SprigLoggerCallback)==null||S.call(globalThis,"Sprig config fetch failed"),g.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",g.error),g.error&&globalThis.UserLeap.reportError("applyRemoteConfig",g.error)),di("Disabled: failed to fetch configuration"),C;const v=g.json;return v!=null&&v.disabled?((A=globalThis.SprigLoggerCallback)==null||A.call(globalThis,"Sprig config fetch disabled"),di(`Disabled: ${v.disabled}`),{disabled:v.disabled}):Object.assign({},v,C)}(e);if((f=globalThis.SprigLoggerCallback)==null||f.call(globalThis,"Sprig fetched config"),rg({isWeb:!c,reportingIntervalSeconds:u.metricsReportingEnabled||u.mobileMetricsReportingEnabled?u.metricsReportingIntervalSeconds:0,thresholds:u.metricThresholds,postMetrics:async C=>{var m;await Be(Me("1",[it],"metrics"),{body:C,method:"POST",headers:{"x-ul-replay-enabled":`${!!((m=re.replay)!=null&&m.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const C=u.alwaysOnReplay?{userAgent:globalThis.navigator.userAgent,surveyId:u.alwaysOnReplay.surveyId,responseGroupUuid:u.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.48.0",maxDurationSeconds:u.alwaysOnReplay.maxDurationSeconds}:void 0;await((w=re.replay)==null?void 0:w.initializeReplay({maxReplayDurationSeconds:u.maxReplayDurationSeconds,maxInflightRequests:globalThis.UserLeap.maxInflightReplayRequests??2,replaySettings:u.replaySettings,apiUrl:globalThis.UserLeap._API_URL,alwaysOnConfig:C})),oo=u.replaySettings}lg(u),await ag(u),globalThis.UserLeap._queue.unpause(),(h=globalThis.SprigLoggerCallback)==null||h.call(globalThis,"SdkReady"),j.emit(z.SDKReady,{mobileMetricsReportingEnabled:!!u.mobileMetricsReportingEnabled,metricsReportingInterval:u.metricsReportingIntervalSeconds||0,metricsThresholds:u.metricThresholds||[],maxMobileReplayDurationSeconds:u.maxMobileReplayDurationSeconds,mobileReplaySettings:u.mobileReplaySettings}),j.emit(z.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId}),j.on(z.VisitorIDUpdated,()=>{for(const C in Rs)delete Rs[C]})}globalThis.UserLeap.UPDATES=hr,globalThis.UserLeap("setPreviewKey",t),document.readyState==="complete"?r():globalThis.attachEvent?globalThis.attachEvent("onload",r):globalThis.addEventListener("load",()=>{r()},!1)}class Ls{constructor(){ue(this,"UPDATES",hr)}displaySurvey(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"displaySurvey",t)}mute(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"mute")}unmute(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"unmute")}dismissActiveSurvey(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"dismissActiveSurvey")}setAttribute(t,r){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setAttribute",t,r)}setAttributes(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"setAttributes",t)}identifyAndSetAttributes(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"identifyAndSetAttributes",t)}removeAttributes(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"removeAttributes",t)}addListener(t,r){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"addListener",t,r)}removeListener(t,r){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"removeListener",t,r)}removeAllListeners(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"removeAllListeners")}setEmail(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"setAttribute","!email",t)}setUserId(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"setUserId",t)}setPartnerAnonymousId(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"setPartnerAnonymousId",t)}track(t,r={},s={}){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"track",t,r,s)}identifyAndTrack(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"identifyAndTrack",t)}trackPageView(t,r,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"trackPageView",t,r,s)}applyStyles(t){var r;(r=globalThis.Sprig)==null||r.call(globalThis,"applyStyles",t)}setWindowDimensions(t,r){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setWindowDimensions",t,r)}logoutUser(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"logoutUser")}teardown(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"teardown")}pauseReplayRecording(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"pauseReplayRecording")}resumeReplayRecording(){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"resumeReplayRecording")}}const dg={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId??""),e.installationMethod="web-npm-bundled",globalThis.Sprig)return globalThis.Sprig;globalThis.Sprig=function(){var r;(r=globalThis.Sprig)==null||r._queue.push(arguments)},Object.getOwnPropertyNames(Ls.prototype).map(r=>{r!=="constructor"&&(globalThis.Sprig[r]=Ls.prototype[r])});const t=globalThis.Sprig;return t.appId=e.envId,t._queue=[],globalThis.UserLeap=t,ug(e),globalThis.Sprig}},pg=new Ls;var ot=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(ot||{}),$e=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))($e||{});const bi=(e,t)=>t.some(r=>e instanceof r);let sl,nl;const vi=new WeakMap,vn=new WeakMap,Os=new WeakMap;let Si={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return vi.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return at(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&(t==="done"||t==="store")||t in e};function Au(e){Si=e(Si)}function hg(e){return(nl||(nl=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ii(this),t),at(this.request)}:function(...t){return at(e.apply(Ii(this),t))}}function mg(e){return typeof e=="function"?hg(e):(e instanceof IDBTransaction&&function(t){if(vi.has(t))return;const r=new Promise((s,n)=>{const i=()=>{n(t.error||new DOMException("AbortError","AbortError"))};t.oncomplete=()=>{s()},t.onerror=i,t.onabort=i});vi.set(t,r)}(e),bi(e,sl||(sl=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,Si):e)}function at(e){if(e instanceof IDBRequest)return function(r){const s=new Promise((n,i)=>{r.onsuccess=()=>{n(at(r.result))},r.onerror=()=>{i(r.error)}});return Os.set(s,r),s}(e);if(vn.has(e))return vn.get(e);const t=mg(e);return t!==e&&(vn.set(e,t),Os.set(t,e)),t}const Ii=e=>Os.get(e);function Ci(e,{blocked:t}={}){const r=indexedDB.deleteDatabase(e);return t&&(r.onblocked=s=>t(s.oldVersion,s)),at(r).then(()=>{})}const fg=["get","getKey","getAll","getAllKeys","count"],gg=["put","add","delete","clear"],Sn=new Map;function il(e,t){if(!(e instanceof IDBDatabase)||t in e||typeof t!="string")return;if(Sn.get(t))return Sn.get(t);const r=t.replace(/FromIndex$/,""),s=t!==r,n=gg.includes(r);if(!(r in(s?IDBIndex:IDBObjectStore).prototype)||!n&&!fg.includes(r))return;const i=async function(a,...o){const l=this.transaction(a,n?"readwrite":"readonly");let c=l.store;return s&&(c=c.index(o.shift())),(await Promise.all([c[r](...o),n&&l.done]))[0]};return Sn.set(t,i),i}Au(e=>({...e,get:(t,r,s)=>il(t,r)||e.get(t,r,s),has:(t,r)=>!!il(t,r)||e.has(t,r)}));const yg=["continue","continuePrimaryKey","advance"],ol={},ki=new WeakMap,Mu=new WeakMap,wg={get(e,t){if(!yg.includes(t))return e[t];let r=ol[t];return r||(r=ol[t]=function(...s){ki.set(this,Mu.get(this)[t](...s))}),r}};async function*bg(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,wg);for(Mu.set(r,t),Os.set(r,Ii(t));t;)yield r,t=await(ki.get(r)||t.continue()),ki.delete(r)}function al(e,t){return t===Symbol.asyncIterator&&bi(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&bi(e,[IDBIndex,IDBObjectStore])}Au(e=>({...e,get:(t,r,s)=>al(t,r)?bg:e.get(t,r,s),has:(t,r)=>al(t,r)||e.has(t,r)}));const vg="sprigReplayIframeLoaded",Sg="sprigReplayIframeSettings",Ig="sprigReplayIframeTakeFullSnapshot",Cg="sprigReplayTeardown",ao=[],Uu=new class{constructor(e){ue(this,"awaitingResolvers",[]);ue(this,"activeCount",0);this.capacity=e}async acquire(){if(!(this.activeCount<this.capacity))return new Promise(e=>{this.awaitingResolvers.push(e)});this.activeCount++}release(){const e=this.awaitingResolvers.shift();e&&this.activeCount<=this.capacity?e():this.activeCount--}async execute(e){try{return await this.acquire(),await e()}finally{this.release()}}setLimit(e){this.capacity=e}}(2),Du=async({apiUrl:e,surveyId:t,uploadId:r,etags:s,headers:n,responseGroupUuid:i,replayDuration:a,eventDigest:o},l=!1)=>{var u;if(!l&&!r&&!s)return void _.error("UploadErr",{isMobile:l,uploadId:r,etags:s});_.info("MarkUploadComplete",{surveyId:t});const c=await Ve(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:s,uploadId:r,responseGroupUuid:i,surveyId:t,replayDuration:a,eventDigest:o,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:n,shouldRetryRequest:!0});return _.info("MarkUploadDone",{surveyId:t}),c},kg=e=>{if(e instanceof Attr)return null;let t=1;for(let r=e.previousSibling;r;r=r.previousSibling)r.nodeName===e.nodeName&&++t;return t},Pu=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let r=e;r&&!(r instanceof Document)&&r!==null;r=r instanceof Attr?r.ownerElement:r.parentElement){const s=t[t.length]={name:void 0,position:null};switch(r.nodeType){case Node.TEXT_NODE:s.name="text()";break;case Node.ATTRIBUTE_NODE:s.name="@"+r.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:s.name="processing-instruction()";break;case Node.COMMENT_NODE:s.name="comment()";break;case Node.ELEMENT_NODE:s.name=r.nodeName}s.position=kg(r)}return"/"+t.reverse().map(r=>r.position!==null?`/${r.name}[${r.position}]`:`/${r.name}`).join("")},lo=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),_u=(e,t)=>{let r;return s=>{clearTimeout(r),r=window.setTimeout(()=>e(s),t)}},je={capture:!0,passive:!0},Eg=["a","button","input","option","li","link"],xg=["Escape","Enter","Backspace","F5","Tab"];let As=!1,Te=null,ps=null;const ll=e=>{var r;if(((r=e.tagName)==null?void 0:r.toLowerCase())==="html")return{element:"html"};const t={};return t.element=(s=>{if(!s.tagName)return"No tagName";const n=s.getAttribute("type");return n?`${n} ${s.tagName.toLowerCase()}`:s.tagName.toLowerCase()})(e),t},Tg=e=>{var s;if(!e)return{};const t={...ll(e)},r=e.parentElement;if(r&&Eg.includes((s=r.tagName)==null?void 0:s.toLowerCase())){const n=ll(r);Object.assign(t,n)}return t},Nu=(e,t)=>{var n,i;let r=t.target;var s;t.target===((n=window.document)==null?void 0:n.body)&&window.Sprig.pointerDownTarget&&(r=window.Sprig.pointerDownTarget),s={x:t.x,y:t.y,type:e,elementAttributes:Tg(r),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...r instanceof HTMLElement||r instanceof SVGElement||r instanceof MathMLElement?{rect:r==null?void 0:r.getBoundingClientRect(),xPath:Pu(r)}:{}},(i=s==null?void 0:s.elementAttributes)!=null&&i.text&&(s.elementAttributes.text=lo(s.elementAttributes.text)),Te==null||Te("Sprig_Click",s)},Fu=e=>{var t;xg.includes(e.key)&&(t={key:e.key},Te==null||Te("Sprig_Keystroke",t))},Rg=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&(e={url:window.location.href,currentPageTitle:document.title},Te==null||Te("Sprig_Refresh",e))},Lg=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&((e={curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title}).currentPageTitle&&(e.currentPageTitle=lo(e.currentPageTitle)),Te==null||Te("Sprig_BackForward",e))},Bu=_u(e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),ps==null||ps({xPath:Pu(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},750),zu=(cl="left_click",e=>Nu(cl,e));var cl;const ju=e=>{e.button===2&&Nu("right_click",e)},Wu=e=>{window.Sprig&&(window.Sprig.pointerDownTarget=e.target)},de={isRecording:!1,scrollEventUuids:{},stopRecording:()=>{}},Vu=()=>globalThis.indexedDB&&globalThis.IDBKeyRange&&globalThis.CompressionStream,be=(()=>{const e=ee.getItem("sprig.sessionId");if(e)return _.info("SessionIDFound",{savedSessionId:e}),ee.removeItem("sprig.sessionId"),e;const t=bt();return _.info("GeneratedSessionID",{uuid:t}),t})(),Ei=()=>{ee.setItem("sprig.disableReplayRecording","disabled")},He=()=>!!ee.getItem("sprig.disableReplayRecording"),Ms=()=>!!ee.getItem("sprig.isReplayPaused");var pl;(pl=globalThis.addEventListener)==null||pl.call(globalThis,"beforeunload",()=>{_.info("BeforeUnload",{sessionId:be}),ee.setItem("sprig.sessionId",be)});const Je=(e,t)=>{var r,s;if(!He()&&de.isRecording&&!Ms())try{(s=(r=globalThis.rrwebRecord)==null?void 0:r.addCustomEvent)==null||s.call(r,e,t)}catch(n){vr("Error recording custom event",n)}},Og=async e=>{const{x:t,xPath:r,y:s}=e,n=de.scrollEventUuids[r];if(n)return xe(async()=>{var o,l,c,u;const i=await se.openDB(),a=await i.get("events",n);if(a!=null&&a.event){const d=JSON.parse(a.event),p=t>((l=(o=d.data)==null?void 0:o.payload)==null?void 0:l.x),f=s>((u=(c=d.data)==null?void 0:c.payload)==null?void 0:u.y);if(!p&&!f)return null;p&&(d.data.payload.x=t),f&&(d.data.payload.y=s),d.data.payload.elementAttributes=e.elementAttributes,a.event=JSON.stringify(d),await i.put("events",a)}else Je("Sprig_Scroll",e)},"Error updating scroll event");Je("Sprig_Scroll",e)},Hu=()=>{de.stopRecording&&(de.stopRecording(),de.stopRecording=void 0),de.isRecording=!1,["cleanupInterval","inactivityInterval","pendingCheckInterval"].forEach(e=>{de[e]&&(clearInterval(de[e]),de[e]=void 0)}),As&&(window.removeEventListener("click",zu,je),window.removeEventListener("pointerdown",Wu,je),window.removeEventListener("mousedown",ju,je),window.removeEventListener("keydown",Fu,je),window.removeEventListener("scroll",Bu,je),As=!1),ao.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:Cg},{targetOrigin:e.origin})})},Ag=["did not allow mutations","called in an invalid security context"],Mg=(e,t,{reportError:r=!0,extraInfo:s={}})=>{if(!He()&&t instanceof Error){if(Ei(),t.name==="VersionError")return _.error("VersionErr",{message:e}),void se.deleteDB();(n=>{if(!n)return!0;for(const i of Ag)if(n.toLowerCase().includes(i))return!1;return!0})(t==null?void 0:t.message)&&(r&&globalThis.UserLeap.reportError(e,t,s),se.clearAll())}},vr=(e,t,{reportError:r}={reportError:!0})=>{Hu(),_.error("ReplayErr",{code:t.code,name:t.name}),Mg(e,t,{reportError:r})},xe=async(e,t)=>{try{return await e()}catch(r){vr(t,r)}},xi=()=>{de.isRecording&&(xe(()=>{var e,t;return(t=(e=globalThis.rrwebRecord)==null?void 0:e.takeFullSnapshot)==null?void 0:t.call(e,!0)},"Error recording full snapshot"),ao.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:Ig},{targetOrigin:e.origin})}))};let In=0;(async()=>Vu()&&Promise.allSettled([Ci("replayStorage"),Ci("sprig.replay")]))();const se=new class{constructor(){ue(this,"wrapTransactionWithCounter",e=>{var s,n;const t=(n=(s=window.Sprig)==null?void 0:s._config)==null?void 0:n.outstandingTransactionLimit,r=t===void 0?100:t;if(r&&In>r){const i="Too many outstanding transactions";vr(i,new Error(i),{reportError:!1})}In++,e.done.finally(()=>{In--})});ue(this,"getTransaction",async e=>{const t=(await this.openDB()).transaction(e,"readwrite");return this.wrapTransactionWithCounter(t),t})}openDB(){return function(e,t,{blocked:r,upgrade:s,blocking:n,terminated:i}={}){const a=indexedDB.open(e,t),o=at(a);return s&&(a.onupgradeneeded=l=>{s(at(a.result),l.oldVersion,l.newVersion,at(a.transaction),l)}),r&&(a.onblocked=l=>r(l.oldVersion,l.newVersion,l)),o.then(l=>{i&&(l.onclose=()=>i()),n&&(l.onversionchange=c=>n(c.oldVersion,c.newVersion,c))}).catch(()=>{}),o}("sprigReplay",1,{upgrade:(e,t,r)=>{if(r===0&&ee.setItem("sprig.pendingCount","0"),!e.objectStoreNames.contains("events")){const s=e.createObjectStore("events",{keyPath:"uuid"});s.createIndex("sessionId","sessionId"),s.createIndex("timestamp","timestamp"),s.createIndex("[sessionId+timestamp]",["sessionId","timestamp"])}if(!e.objectStoreNames.contains("chunkUploads")){const s=e.createObjectStore("chunkUploads",{keyPath:"uuid"});s.createIndex("sessionId","sessionId"),s.createIndex("timestamp","timestamp"),s.createIndex("[sessionId+status]",["sessionId","status"]),s.createIndex("[uploadId+status]",["uploadId","status"]),s.createIndex("[sessionId+status+uploadId]",["sessionId","status","uploadId"])}if(!e.objectStoreNames.contains("pendingCaptures")){const s=e.createObjectStore("pendingCaptures",{keyPath:"uuid"});s.createIndex("sessionId","sessionId"),s.createIndex("timestamp","timestamp"),s.createIndex("[sessionId+targetTimestamp]",["sessionId","targetTimestamp"])}}})}async deleteDB(){try{await Ci("sprigReplay")}catch{}}async bulkAdd(e,t){const r=await this.getTransaction(e);return Promise.all([...t.map(s=>r.store.add(s)),r.done])}async clearAll(){const e=(await this.openDB()).transaction(["events","chunkUploads","pendingCaptures"],"readwrite");return this.wrapTransactionWithCounter(e),Promise.all([e.objectStore("events").clear(),e.objectStore("chunkUploads").clear(),e.objectStore("pendingCaptures").clear()])}async deleteBySessionId(e,t){const r=IDBKeyRange.only(t),s=await this.getTransaction(e),n=s.store.index("sessionId");for await(const i of n.iterate(r))await i.delete();await s.done}async updatePartial(e,t,r){const s=await this.getTransaction(e),n=await s.store.get(t);n&&await s.store.put({...n,...r}),await s.done}async deleteRowsBefore(e,t,r=()=>!0){const s=IDBKeyRange.upperBound(t,!0),n=await this.getTransaction(e),i=n.store.index("timestamp");for await(const a of i.iterate(s))r(a.value)&&await a.delete();await n.done}async getEventsBetween(e,t=Date.now()){if(e>=t)return Promise.resolve([]);const r=IDBKeyRange.bound([be,e],[be,t],!1,!0);return(await this.openDB()).getAllFromIndex("events","[sessionId+timestamp]",r)}async updateEventsExpiredAt(e,t,r=30){const s=new Date,n=s.setMinutes(s.getMinutes()+(r??30)),i=await this.getTransaction("events"),a=i.store.index("[sessionId+timestamp]"),o=IDBKeyRange.bound([be,e],[be,t],!1,!0);for await(const l of a.iterate(o))await l.update({...l.value,expiredAt:n});await i.done}async deleteChunkUploads(e,t){const r=IDBKeyRange.only([t,e]),s=await this.getTransaction("chunkUploads");let i=await s.store.index("[uploadId+status]").openCursor(r);for(;i;)i.delete(),i=await i.continue();await s.done}async getChunkUploadsByStatus({sessionId:e,status:t,uploadId:r}){const s=(await this.openDB()).transaction("chunkUploads","readonly");this.wrapTransactionWithCounter(s);const n=r?s.store.index("[uploadId+status]"):s.store.index("[sessionId+status]"),i=r?IDBKeyRange.only([r,t]):IDBKeyRange.only([e,t]);return n.getAll(i)}async getPendingCaptures(e={}){return(await(await this.openDB()).getAllFromIndex("pendingCaptures","sessionId",be)).filter(r=>!e.beforePresent||r.targetTimestamp<Date.now()).filter(r=>!e.isBeforeType||r.captureParams.replayParams.replayDurationType==="before").filter(r=>!e.isHeatmap||(r.captureParams.isHeatmap??!1))}async tryAddPendingCaptureForSurvey(e){const{surveyId:t,record:r}=e,s=(await this.openDB()).transaction("pendingCaptures","readwrite");this.wrapTransactionWithCounter(s);const n=s.store.index("sessionId"),i=await n.getAll(be),a=!!r.captureParams.isHeatmap;return i.some(o=>o.captureParams.surveyId===t&&!!o.captureParams.isHeatmap===a)?(await s.done,{added:!1}):(await s.store.add(r),await s.done,{added:!0})}async markPendingCaptureToCanUpload(e){const t=await this.getTransaction("pendingCaptures"),r=t.store.index("sessionId");for await(const s of r.iterate(be)){const n=s.value;n.captureParams.responseGroupId===e&&await s.update({...n,canUpload:!0})}await t.done}async markPendingHeatmapsReady(e){if(parseInt(ee.getItem("sprig.pendingCount")??"0")===0)return null;const t=Date.now(),r=await this.getTransaction("pendingCaptures"),s=r.store.index("sessionId");for await(const n of s.iterate(be)){const i=n.value;!i.captureParams.isHeatmap||e&&!e.includes(i.uuid)||await n.update({...i,targetTimestamp:t,captureParams:{...i.captureParams,triggerTimestamp:t,replayParams:{...i.captureParams.replayParams,replayDurationSeconds:Math.floor((t-i.timestamp)/1e3)}}})}await r.done}},Ze=[];let Sr,Gu,gt=[],Pt=!1,Dt=0,hs=!1,$u=!1;const co=[];let Us,Yu,ms,Ju,Cn=!1;const _t=()=>hs&&!Pt&&Date.now()<=Us,Ug=({apiUrl:e,config:t,triggerSnapshot:r,forceInit:s=!1})=>{hs&&!s||(ee.isStorageAvailable?(gt=[],co.splice(0),Ze.splice(0),Dt=0,ms=r,Gu=e,Sr={responseGroupUuid:t.responseGroupUuid,surveyId:t.surveyId,userAgent:t.userAgent,sdkVersion:t.sdkVersion},Yu=t.maxDurationSeconds,Ng(),hs||(Ju=globalThis.setInterval(_g,500)),hs=!0):Pt=!0)},Dg=[$e.Drag,$e.Input,$e.MediaInteraction,$e.MouseInteraction,$e.MouseMove,$e.Scroll,$e.Selection,$e.TouchMove],Pg=e=>e.type===ot.Custom||e.type===ot.IncrementalSnapshot&&Dg.includes(e.data.source),uo=e=>e.some(Pg),_g=async()=>{if(!_t())return void globalThis.clearInterval(Ju);if(qu(),!uo(Ze))return;const e=Ze[0].timestamp;Date.now()-e>35e3&&(ms==null||ms())},qu=async()=>{if(gt.length||Cn)return;Cn=!0;const e=await Bg();if(!e)return void(Pt=!0);co.splice(0,e.length).forEach(t=>t(e.shift())),e.forEach(t=>gt.push(t)),Cn=!1},Ng=()=>{const e=ee.getItem("sprig.alwayson.info");if(e){_.info("Read stored session state",e);const t=JSON.parse(e);Pt=t.disabled,Sr=t.metadata,gt=t.uploadUrls,Dt=t.currentIndex,Us=t.expirationTimestamp,t.pendingEventTimestamp&&(_.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`),Fg(t.pendingEventTimestamp))}else Us=1e3*Yu+Date.now()},Fg=async e=>{const t=Date.now(),r=(await se.getEventsBetween(e,t)).map(n=>JSON.parse(n.event));if(!uo(r))return;Qu(r);const s=await Zu();s&&await Xu(s,r)},Ku=async(e,t)=>{try{const r=await e();if(!r.ok)throw new Error(`Error ${t}`);return r}catch{Pt=!0}},Xu=async(e,t)=>{if(!_t()||!e)return;const r=await(async s=>{const n=new TextEncoder,i=new CompressionStream("gzip"),a=i.writable.getWriter(),o=n.encode(JSON.stringify(s));return a.write(o),a.close(),new Uint8Array(await new Response(i.readable).arrayBuffer())})(t);_.info("Uploading always-on events with presigned url"),await Ku(()=>Ve(e,{body:r,method:"PUT"}),"uploading always-on with presigned url")},Bg=async()=>{if(!_t())return;const{surveyId:e,responseGroupUuid:t}=Sr,r={responseGroupUuid:t,surveyId:e,index:Dt+1};_.info("Fetching always-on upload urls",r);const s=await Ku(()=>Ve(`${Gu}/sdk/1/replayUrls`,{method:"POST",body:JSON.stringify(r),headers:De(globalThis.UserLeap)}),"fetching always-on signed urls");if(!s)return;const n=s.json.signedUrls;return _.info("Fetched more always-on upload urls",{body:r,urls:n}),n},Zu=async()=>{if(gt.length)return gt.shift();const e=new Promise(t=>{co.push(t)});return qu(),e},Qu=e=>{var n,i,a;const t=e.length?e[e.length-1].timestamp:Date.now(),r=Dt,s=((i=(n=globalThis.UserLeap)==null?void 0:n.config)==null?void 0:i.customMetadata)??((a=globalThis.__cfg)==null?void 0:a.customMetadata);Dt++,e.push({timestamp:t,type:ot.Custom,data:{tag:"Sprig_Meta",payload:{...Sr,index:r,visitorId:globalThis.UserLeap.visitorId??"",timestamp:t,customMetadata:s}}})},zg=(e,t)=>{_t()&&!$u&&(e||Ze.length)&&(e&&Ze.length&&(async()=>{const r=Ze.splice(0);if(!uo(r))return;_.info("Capturing always-on event array to upload"),Qu(r);const s=await Zu();s&&await Xu(s,r)})(),Ze.push(t))};var hl;(hl=globalThis.addEventListener)==null||hl.call(globalThis,"beforeunload",async()=>{$u=!0,_t()&&(_.info("Always On handle page unload"),(()=>{let e;Ze.length&&(e=Ze[0].timestamp);const t={disabled:Pt,metadata:Sr,uploadUrls:gt,currentIndex:Dt,pendingEventTimestamp:e,expirationTimestamp:Us};_.info("Storing session state on unload",t),ee.setItem("sprig.alwayson.info",JSON.stringify(t))})())});const ed=async(e,t)=>{const r=performance.now();let s;try{s=await e()}finally{const n=performance.now()-r;let i=br[t];i||(i=We(t)),i.report(n/1e3)}return s},td=(e,t)=>{const r=performance.now();try{e()}finally{const s=performance.now()-r;let n=br[t];n||(n=We(t)),n.report(s/1e3)}};let rd=5e3,Ti=6e4,Ri=0,lt,Li=!1,Oi=[];const jg=e=>{var t,r,s,n;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const i=(n=(s=(r=JSON.parse(e.event))==null?void 0:r.data)==null?void 0:s.payload)==null?void 0:n.xPath;if(!i)return;de.scrollEventUuids[i]=e.uuid}Oi.push(e),Li||Wg()},Wg=()=>{Li=!0,setTimeout(async()=>{if(He()||Ms())return;const e=Oi;Oi=[],Li=!1,td(async()=>{await(async t=>{const r=t.map(s=>({...s,sessionId:s.sessionId??be}));if(r.length!==0)return xe(()=>se.bulkAdd("events",r),"Error storing replay events")})(e)},"sdk_replay_add_event_batch_seconds")},500)},Vg=(e,t,r)=>{de.cleanupInterval=window.setInterval(()=>{const s=Date.now();ed(()=>xe(async()=>{He()||await Promise.all([se.deleteRowsBefore("events",s-1e3*e,n=>n.expiredAt===void 0||n.expiredAt<s-1e3*e),se.deleteRowsBefore("chunkUploads",s-1e3*t),se.deleteRowsBefore("pendingCaptures",s-1e3*r,n=>!n.canUpload)])},"Error deleting table rows"),"sdk_replay_cleanup_seconds"),_.debug("CleanupComplete")},3e4)},Hg=()=>{de.pendingCheckInterval=window.setInterval(async()=>{xe(async()=>{await Ai()},"Error initiating pending captures")},5e3)};let kn=!1;const Ai=async(e=!1)=>{if(!kn)try{kn=!0;const t=parseInt(lt??"0");if(t===0)return;const r=await se.getPendingCaptures({beforePresent:!0,isBeforeType:e}),s=await se.openDB();await Promise.all(r.map(async n=>(await s.delete("pendingCaptures",n.uuid),id(n.captureParams,n.canUpload)))),lt=(t-r.length).toString(),ee.setItem("sprig.pendingCount",lt)}finally{kn=!1}},Gg=async(e,t,r,s,n)=>{const i=Math.min(e+n,r),a=await ed(()=>se.getEventsBetween(e,i),"sdk_replay_get_events_between_seconds");if(!(a!=null&&a.length))return _.debug("NoEventsFound"),{validStartFound:s,events:[]};if(!s){_.debug("ValidStartSearch");let o=-1;return a==null||a.forEach((l,c)=>{if(!l.isValidStart)return;const u=l.timestamp<=t;(o<0||u)&&(o=c)}),o<0?(_.debug("ValidStartNotFound"),{validStartFound:s,events:[]}):{validStartFound:!0,events:a==null?void 0:a.slice(o)}}return{validStartFound:s,events:a}},sd=e=>Promise.all(e.map(async t=>{const r=await(async s=>Uu.execute(async()=>{var a;_.info("UploadChunkStart",{chunkIndex:s.chunkIndex,surveyId:s.surveyId});const n=await Ve(s.uploadUrl,{body:s.data,method:"PUT"});_.http("UploadChunkEnd",{url:s.uploadUrl,method:"PUT",status_code:n.status,reason:n.statusText??"OK",chunkIndex:s.chunkIndex,surveyId:s.surveyId});const i=(a=n.headers)==null?void 0:a.get("ETag");if(!i)throw new Error(`Upload response did not include etag for upload ${s.uploadId}, part ${s.chunkIndex}`);return i}))(t);return await se.updatePartial("chunkUploads",t.uuid,{data:null,etag:r,status:"UploadComplete"}),t.uploadId})),nd=async e=>{const t=await se.getChunkUploadsByStatus({status:"UploadComplete",uploadId:e});if(!(t!=null&&t.length))return void _.info("NoChunksForUpload",{uploadId:e});const r=t.reduce((i,a)=>(i.find(o=>o.chunkIndex===a.chunkIndex)||i.push(a),i),[]);r.sort((i,a)=>i.chunkIndex-a.chunkIndex);const s=r.map(i=>({ETag:i.etag,PartNumber:i.chunkIndex})).filter(i=>i.ETag!==null),n=r[0];await Du({apiUrl:n.apiUrl,surveyId:n.surveyId,uploadId:e,responseGroupUuid:n.responseGroupId,etags:s,headers:n.completeUploadHeaders,replayDuration:n.replayDuration}),await se.deleteChunkUploads("UploadComplete",e)},$g=()=>{xe(async()=>{const e=await se.getChunkUploadsByStatus({sessionId:be,status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await sd(e);t!=null&&t.length&&await Promise.all(t.map(r=>{if(r)return nd(r)}))},"Error uploading unfinished chunks")},Yg=async(e,t)=>{const r=t??Date.now();return(async(s,n)=>{const i=new TextEncoder;let a=null;const o=new CompressionStream("gzip"),l=o.writable.getWriter();let c=!1,u=!1,[d,p]=[0,0],f=[];for(let h=s-35e3;h<n;h+=Ti){if({validStartFound:u,events:f}=await Gg(h,s,n,u,Ti),!(f!=null&&f.length)){_.debug("NoEventsFound");continue}d===0&&(d=f[0].timestamp),p=f[f.length-1].timestamp;const C=f.map(v=>v.event);C.push(`{"timestamp":${n}}`);const m=`${c?",":"["}${C}`,g=i.encode(m);td(()=>{l.write(g)},"sdk_replay_compression_seconds"),c=!0}if(p-d<rd)return _.debug("ReplayTooShort"),null;const w=i.encode("]");return l.write(w),l.close(),a=new Uint8Array(await new Response(o.readable).arrayBuffer()),a})(r-e,r)},ul=async e=>{const{surveyId:t,responseGroupId:r,visitorId:s,apiUrl:n,completeUploadHeaders:i,replayParams:a,triggerTimestamp:o}=e,l=await Yg(1e3*a.replayDurationSeconds,o);if(!(l!=null&&l.length))return void _.info("FileDataEmpty",{surveyId:t});const c=((d,p,f)=>{const w=d.length,h=1024*p*1024,C=Math.ceil(w/f),m=Math.max(h,C),g=[];let v=0;for(;v<w;)g.push(d.slice(v,v+m)),v+=m;return g})(l,a.minimumChunkSizeMb,a.signedUrls.length),u=await Promise.all(c.map(async(d,p)=>{const f=bt(),w={apiUrl:n,chunkIndex:p+1,completeUploadHeaders:i,etag:null,responseGroupId:r,status:"ReadyForUpload",surveyId:t,timestamp:o,totalChunks:c.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[p].url,uuid:f,visitorId:s};return await(await se.openDB()).add("chunkUploads",{...w,sessionId:w.sessionId??be}),w}));await(async(d,p)=>{await sd(p),await Promise.all(d.map(f=>nd(f)))})([a.uploadId],u)},id=async(e,t)=>{if(He())return _.debug("ReplayDisabled-ScheduleOrCapture");const{isHeatmap:r,isStandalone:s,replayParams:n,triggerTimestamp:i,responseGroupId:a}=e,o=async()=>{setTimeout(()=>j.removeListener(z.QuestionAnswered,o),0),xe(async()=>{n.replayDurationType==="before"?await ul(e):await se.markPendingCaptureToCanUpload(a)},"Error in schedule/capture callback")};xe(async()=>{if(n.replayDurationType==="after"||n.replayDurationType==="beforeAndAfter")return!s&&!r&&j.on(z.QuestionAnswered,o),void await ad(e);if(s||r||t)await ul(e),r&&Jg();else{const l=35+n.replayDurationSeconds,c=i-1e3*l,u=i;await se.updateEventsExpiredAt(c,u,n.expirationTimeLimitMinutes),j.on(z.QuestionAnswered,o)}},"Error in scheduling/capturing replay")},Jg=async()=>{parseInt(lt??"0")||ee.removeItem("sprig.isCapturingHeatmap"),ee.getItem("sprig.teardownAfterCapture")&&(Hu(),od(),ee.removeItem("sprig.teardownAfterCapture"))},od=async()=>He()?_.debug("ReplayDisabled-ClearData"):Promise.all([se.deleteBySessionId("events",be),se.deleteBySessionId("pendingCaptures",be)]).catch(e=>{vr("Error clearing user replay data",e)}),ad=async e=>{if(He())return;const{isHeatmap:t,surveyId:r}=e,s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const n=e.triggerTimestamp+1e3*e.replayParams.replayDurationSeconds;s.triggerTimestamp=n;const i={canUpload:!1,captureParams:s,sessionId:be,targetTimestamp:n,timestamp:Date.now(),uuid:bt()},{added:a}=await se.tryAddPendingCaptureForSurvey({surveyId:r,record:i});a?(lt=(parseInt(lt??"0")+1).toString(),ee.setItem("sprig.pendingCount",lt),t&&(xi(),ee.setItem("sprig.isCapturingHeatmap","true"),Ri=Date.now(),de.inactivityInterval||(de.inactivityInterval=window.setInterval(()=>{var o;o=Ri,Date.now()-o>=3e4&&xe(()=>se.markPendingHeatmapsReady(),"Error in heatmap inactivity")},1e3)))):_.info("PendingCaptureExists",{surveyId:r})},qg=Object.freeze(Object.defineProperty({__proto__:null,RecordEvent:e=>{Je("Sprig_TrackEvent",e)},RecordPageView:e=>{e.description&&(e.description=lo(e.description)),Je("Sprig_PageView",e)},RecordSurveyShown:e=>{Je("Sprig_ShowSurvey",e)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:t,eventDigest:r,headers:s})=>{if(!e||!t)return!1;const n=globalThis.UserLeap._API_URL,i=await Du({surveyId:e,responseGroupUuid:t,eventDigest:r,apiUrl:n,headers:s},!0);return!(i!=null&&i.error)},checkPendingHeatmapsUrl:()=>He()?_.debug("ReplayDisabled-PendingHeatmaps"):xe(async()=>{const e=(await se.getPendingCaptures({isHeatmap:!0})).map(t=>({eventId:t.captureParams.eventId,uuid:t.uuid})).filter(({eventId:t})=>!hu(t)).map(({uuid:t})=>t);return _.info("PendingHeatmapsToComplete",{count:e.length}),e.length&&(await se.markPendingHeatmapsReady(e),_.info("MarkedPendingHeatmapsReady")),e.length},"Error marking pending heatmaps ready"),clearUserReplayData:od,disableRecording:vr,initializeReplay:async({maxReplayDurationSeconds:e,maxInflightRequests:t=2,replaySettings:r,teardownAfter:s=!1,apiUrl:n,alwaysOnConfig:i})=>{if(i&&Ug({apiUrl:n,config:i,triggerSnapshot:()=>{xi()}}),lt=ee.getItem("sprig.pendingCount"),de.isRecording)return;if(s&&ee.setItem("sprig.teardownAfterCapture","true"),He())return _.debug("ReplayDisabled");if(await(async()=>{var l;if(!Vu())return!0;if((l=globalThis.navigator.storage)!=null&&l.estimate)try{const{quota:c=0,usage:u=0}=await globalThis.navigator.storage.estimate(),d=(c-u)/1024**3;return _.info("Storage",{availableGb:d}),d<.5}catch{return!0}return!1})())return _.debug("IDBNotSupported"),Ei();try{const l=await se.openDB();_.info("DBVersion",{version:l.version})}catch(l){return _.error("ReplayOpenErr",{name:l.name}),l.name==="VersionError"&&se.deleteDB(),Ei()}xe(async()=>{await Ai(!0)},"Error uploading ready pending captures");const a=_t()?30:0,o=Math.max(e??0,a);if(!o)return _.debug("MissingDuration");_.debug("ReplayInit"),await xe(async()=>{var l;r!=null&&r.minDuration&&(rd=r.minDuration),r!=null&&r.batchDuration&&(Ti=r.batchDuration),l=t,Uu.setLimit(l),$g(),Vg(o+35,1800,o+35),Hg();const c=window.UserLeap.replayLibraryURL??"https://cdn.sprig.com/dependencies/record.min.js",u=window.rrwebRecord;if(!u)return _.error("RecordScriptFailed");let d=!0,p=0;const f={checkoutEveryNms:3e4,sampling:{input:"last",scroll:250,media:800},...r,mutationQueueEnabled:r==null?void 0:r.enableMutationQueue};var w,h;de.stopRecording=u({emit:(C,m)=>{if(C.type===ot.Custom&&(Ri=Date.now()),He()||Ms())return;if(m&&C.type===ot.Meta)p=performance.now();else if(m&&p&&C.type===ot.FullSnapshot){const v=performance.now()-p;Su("sdk_replay_snapshot_seconds",v/1e3)}const g=d||!!m&&C.type===ot.Meta;d=!1,zg(g,C),jg({uuid:bt(),event:JSON.stringify(C),isValidStart:g,timestamp:Date.now()})},...f}),de.isRecording=!!de.stopRecording,de.isRecording&&(((C,m)=>{window.addEventListener("message",g=>{var v;g.data.type===vg&&(ao.push({source:g.source,origin:g.origin}),(v=g.source)==null||v.postMessage({type:Sg,settings:C,replayLibraryUrl:m},{targetOrigin:g.origin}))})})(f,c),j.on("survey.complete",C=>{var m;m={id:C,userAgent:window.navigator.userAgent},Je("Sprig_SubmitSurvey",m)}),w=Je,h=Og,As||(Te=w,ps=h,window.addEventListener("click",zu,je),window.addEventListener("pointerdown",Wu,je),window.addEventListener("mousedown",ju,je),window.addEventListener("keydown",Fu,je),window.addEventListener("scroll",Bu,je),As=!0,Rg(),Lg()))},"Error initializing replay")},isReplayPaused:Ms,isReplayRecording:()=>de.isRecording,recordFullSnapshot:xi,recordReplayPaused:()=>{Je("Sprig_ReplayPaused",{timestamp:Date.now()}),ee.setItem("sprig.isReplayPaused","true")},recordReplayResumed:()=>{ee.removeItem("sprig.isReplayPaused"),Je("Sprig_ReplayResumed",{timestamp:Date.now()})},scheduleCapture:ad,scheduleOrCaptureReplay:id,tryReplayAction:xe,uploadReadyPendingCaptures:Ai},Symbol.toStringTag,{value:"Module"}));(e=>{re.replay=e})(qg),window.UpChunk={createUpload:Yd},window.rrwebRecord=Jt,exports.APP_ID="ul-app",exports.ConflictingWidgets=ru,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.DismissReason=Ae,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#d66464",exports.Sprig=pg,exports.SprigAPI=Ls,exports.SprigEvent=z,exports.breadcrumbsLogger=_,exports.calculateFrameDimensions=mu,exports.debounce=_u,exports.eventEmitter=j,exports.getHtml=qs,exports.groupCards=(e,t)=>{const r=[e[t]],s=e[t].groupId;return s?e.slice(t).reduce((n,i)=>(i.groupId===s&&n.push(i),n),[]):r},exports.isHTMLElement=Ye,exports.isLongFormSurvey=e=>e==="longFormSurvey",exports.resetScrollPosition=e=>{const t=e.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=fr,exports.shouldDirectEmbed=to,exports.sprig=dg,exports.sprigFetch=Ve,exports.v4=bt;