UNPKG

@sprig-technologies/sprig-bundled

Version:

npm package for the sprig web sdk with bundled dependencies

20 lines (19 loc) 290 kB
"use strict";var yd=Object.defineProperty;var wd=(e,t,r)=>t in e?yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ue=(e,t,r)=>wd(e,typeof t!="symbol"?t+"":t,r);var vd=Object.create,uo=Object.defineProperty,bd=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyNames,Id=Object.getPrototypeOf,Cd=Object.prototype.hasOwnProperty,mr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kd=mr((e,t)=>{var r;r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t.exports=r}),Ed=mr((e,t)=>{t.exports=function(n){if(!n)return!1;var s=r.call(n);return s==="[object Function]"||typeof n=="function"&&s!=="[object RegExp]"||typeof window<"u"&&(n===window.setTimeout||n===window.alert||n===window.confirm||n===window.prompt)};var r=Object.prototype.toString}),xd=mr((e,t)=>{var r=function(s){return s.replace(/^\s+|\s+$/g,"")},n=function(s){return Object.prototype.toString.call(s)==="[object Array]"};t.exports=function(s){if(!s)return{};for(var i={},a=r(s).split(` `),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:n(i[u])?i[u].push(d):i[u]=[i[u],d]}return i}}),Rd=mr((e,t)=>{t.exports=function(){for(var n={},s=0;s<arguments.length;s++){var i=arguments[s];for(var a in i)r.call(i,a)&&(n[a]=i[a])}return n};var r=Object.prototype.hasOwnProperty}),Ld=mr((e,t)=>{var r=kd(),n=Ed(),s=xd(),i=Rd();function a(c,u,d){var p=c;return n(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,O,S){u||(u=!0,c.callback(R,O,S))};function p(){var R=void 0;if(R=h.response?h.response:h.responseText||function(O){try{if(O.responseType==="document")return O.responseXML;var S=O.responseXML&&O.responseXML.documentElement.nodeName==="parsererror";if(O.responseType===""&&!S)return O.responseXML}catch{}return null}(h),A)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,k)}function y(){if(!m){var R;clearTimeout(g),R=c.useXDR&&h.status===void 0?200:h.status===1223?204:h.status;var O=k,S=null;return R!==0?(O={body:p(),statusCode:R,method:I,headers:{},url:v,rawRequest:h},h.getAllResponseHeaders&&(O.headers=s(h.getAllResponseHeaders()))):S=new Error("Internal XMLHttpRequest Error"),d(S,O,O.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,I=h.method=c.method||"GET",M=c.body||c.data,E=h.headers=c.headers||{},U=!!c.sync,A=!1,k={body:void 0,headers:{},statusCode:0,method:I,url:v,rawRequest:h};if("json"in c&&c.json!==!1&&(A=!0,E.accept||E.Accept||(E.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(E["content-type"]||E["Content-Type"]||(E["Content-Type"]="application/json"),M=JSON.stringify(c.json===!0?M:c.json))),h.onreadystatechange=function(){h.readyState===4&&setTimeout(y,0)},h.onload=y,h.onerror=f,h.onprogress=function(){},h.onabort=function(){m=!0},h.ontimeout=f,h.open(I,v,!U,c.username,c.password),U||(h.withCredentials=!!c.withCredentials),!U&&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 E)E.hasOwnProperty(C)&&h.setRequestHeader(C,E[C]);else if(c.headers&&!function(R){for(var O in R)if(R.hasOwnProperty(O))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(M||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(cl(t,r))}function cl(e,t){let r=0;return e.replace(/%[os]/gu,()=>ul(t[r++]))}function ul(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var Te=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,ct=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,` `);console.warn(this.message,...e,r)}catch{}}},Od=new ct("W01","Unable to initialize event under dispatching."),Ad=new ct("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Md=new ct("W03","Assigning any truthy value to 'returnValue' property has no effect."),Ud=new ct("W04","Unable to preventDefault on non-cancelable events."),Td=new ct("W05","Unable to preventDefault inside passive event listener invocation."),Dd=new ct("W06","An event listener wasn't added because it has been added already: %o, %o"),Xn=new ct("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),po=new ct("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),Xe=class{static get NONE(){return ho}static get CAPTURING_PHASE(){return mo}static get AT_TARGET(){return fo}static get BUBBLING_PHASE(){return go}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t??{};Cs.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 he(this).type}get target(){return he(this).target}get srcElement(){return he(this).target}get currentTarget(){return he(this).currentTarget}composedPath(){let e=he(this).currentTarget;return e?[e]:[]}get NONE(){return ho}get CAPTURING_PHASE(){return mo}get AT_TARGET(){return fo}get BUBBLING_PHASE(){return go}get eventPhase(){return he(this).dispatchFlag?2:0}stopPropagation(){he(this).stopPropagationFlag=!0}get cancelBubble(){return he(this).stopPropagationFlag}set cancelBubble(e){e?he(this).stopPropagationFlag=!0:Ad.warn()}stopImmediatePropagation(){let e=he(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return he(this).bubbles}get cancelable(){return he(this).cancelable}get returnValue(){return!he(this).canceledFlag}set returnValue(e){e?Md.warn():yo(he(this))}preventDefault(){yo(he(this))}get defaultPrevented(){return he(this).canceledFlag}get composed(){return he(this).composed}get isTrusted(){return!1}get timeStamp(){return he(this).timeStamp}initEvent(e,t=!1,r=!1){let n=he(this);n.dispatchFlag?Od.warn():Cs.set(this,{...n,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},ho=0,mo=1,fo=2,go=3,Cs=new WeakMap;function he(e,t="this"){let r=Cs.get(e);return Mi(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function yo(e){e.inPassiveListenerFlag?Td.warn():e.cancelable?e.canceledFlag=!0:Ud.warn()}Object.defineProperty(Xe,"NONE",{enumerable:!0}),Object.defineProperty(Xe,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(Xe,"AT_TARGET",{enumerable:!0}),Object.defineProperty(Xe,"BUBBLING_PHASE",{enumerable:!0});var Zn=Object.getOwnPropertyNames(Xe.prototype);for(let e=0;e<Zn.length;++e)Zn[e]!=="constructor"&&Object.defineProperty(Xe.prototype,Zn[e],{enumerable:!0});Te!==void 0&&Te.Event!==void 0&&Object.setPrototypeOf(Xe.prototype,Te.Event.prototype);var wt,wo={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(wo);for(let r=0;r<t.length;++r){let n=t[r],s=wo[n];Object.defineProperty(e,n,{get:()=>s,configurable:!0,enumerable:!0})}}var fn=class extends Xe{static wrap(e){return new(pl(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),dl.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let n=t[r];n in this||Object.defineProperty(this,n,hl(e,n))}}stopPropagation(){super.stopPropagation();let{original:e}=nt(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=nt(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=nt(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=nt(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=nt(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=nt(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},dl=new WeakMap;function nt(e){let t=dl.get(e);return Mi(t!=null,"'this' is expected an Event object, but got",e),t}var gn=new WeakMap;function pl(e){let t=Object.getPrototypeOf(e);if(t==null)return fn;let r=gn.get(t);return r==null&&(r=function(n,s){class i extends n{}let a=Object.keys(s);for(let o=0;o<a.length;++o)Object.defineProperty(i.prototype,a[o],hl(s,a[o]));return i}(pl(t),t),gn.set(t,r)),r}function hl(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let n=nt(this).original,s=n[t];return typeof s=="function"?s.bind(n):s},set(n){nt(this).original[t]=n},configurable:r.configurable,enumerable:r.enumerable}}function ml(e){return!(1&~e.flags)}function bo(e){return!(2&~e.flags)}function So(e){return!(4&~e.flags)}function Pd(e){return!(8&~e.flags)}function _d({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(n){(function(s){try{let i=s instanceof Error?s:new Error(ul(s));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{}})(n)}}function fl({listeners:e},t,r){for(let n=0;n<e.length;++n)if(e[n].callback===t&&ml(e[n])===r)return n;return-1}function Io(e,t,r){let n=fl(e,t,r);return n!==-1&&gl(e,n)}function gl(e,t,r=!1){let n=e.listeners[t];return function(s){s.flags|=8}(n),n.signal&&n.signal.removeEventListener("abort",n.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((s,i)=>i!==t),!1):(e.listeners.splice(t,1),!0)}gn.set(Object.prototype,fn),Te!==void 0&&Te.Event!==void 0&&gn.set(Te.Event.prototype,fn);var Tn=class{constructor(){wl.set(this,Object.create(null))}addEventListener(e,t,r){let n=Kn(this),{callback:s,capture:i,once:a,passive:o,signal:l,type:c}=function(p,f,y){var h;return Co(f),typeof y=="object"&&y!==null?{type:String(p),callback:f??void 0,capture:!!y.capture,passive:!!y.passive,once:!!y.once,signal:(h=y.signal)!==null&&h!==void 0?h:void 0}:{type:String(p),callback:f??void 0,capture:!!y,passive:!1,once:!1,signal:void 0}}(e,t,r);if(s==null||l!=null&&l.aborted)return;let u=function(p,f){var y;return(y=p[f])!==null&&y!==void 0?y:p[f]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}(n,c),d=fl(u,s,i);d===-1?function(p,f,y,h,C,m){let g;m&&(g=Io.bind(null,p,f,y),m.addEventListener("abort",g));let v=function(I,M,E,U,A,k){return{callback:I,flags:(M?1:0)|(E?2:0)|(U?4:0),signal:A,signalListener:k}}(f,y,h,C,m,g);p.cow?(p.cow=!1,p.listeners=[...p.listeners,v]):p.listeners.push(v)}(u,s,i,o,a,l):function(p,f,y,h){Dd.warn(ml(p)?"capture":"bubble",p.callback),bo(p)!==f&&Xn.warn("passive"),So(p)!==y&&Xn.warn("once"),p.signal!==h&&Xn.warn("signal")}(u.listeners[d],o,a,l)}removeEventListener(e,t,r){let n=Kn(this),{callback:s,capture:i,type:a}=function(l,c,u){return Co(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=n[a];s!=null&&o&&Io(o,s,i)}dispatchEvent(e){let t=Kn(this)[String(e.type)];if(t==null)return!0;let r=e instanceof Xe?e:fn.wrap(e),n=he(r,"event");if(n.dispatchFlag)throw s="This event has been in dispatching.",Te.DOMException?new Te.DOMException(s,"InvalidStateError"):(wt==null&&(wt=class yl extends Error{constructor(a){super(a),Error.captureStackTrace&&Error.captureStackTrace(this,yl)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(wt.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),vo(wt),vo(wt.prototype)),new wt(s));var s;if(n.dispatchFlag=!0,n.target=n.currentTarget=this,!n.stopPropagationFlag){let{cow:i,listeners:a}=t;t.cow=!0;for(let o=0;o<a.length;++o){let l=a[o];if(!Pd(l)&&(So(l)&&gl(t,o,!i)&&(o-=1),n.inPassiveListenerFlag=bo(l),_d(l,this,r),n.inPassiveListenerFlag=!1,n.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return n.target=null,n.currentTarget=null,n.stopImmediatePropagationFlag=!1,n.stopPropagationFlag=!1,n.dispatchFlag=!1,!n.canceledFlag}},wl=new WeakMap;function Kn(e,t="this"){let r=wl.get(e);return Mi(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function Co(e){if(typeof e!="function"&&(typeof e!="object"||e===null||typeof e.handleEvent!="function")){if(e==null||typeof e=="object")return void po.warn(e);throw new TypeError(cl(po.message,[e]))}}var Qn=Object.getOwnPropertyNames(Tn.prototype);for(let e=0;e<Qn.length;++e)Qn[e]!=="constructor"&&Object.defineProperty(Tn.prototype,Qn[e],{enumerable:!0});Te!==void 0&&Te.EventTarget!==void 0&&Object.setPrototypeOf(Tn.prototype,Te.EventTarget.prototype);var ko,Nd=((e,t,r)=>(r=e!=null?vd(Id(e)):{},((n,s,i,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of Sd(s))!Cd.call(n,o)&&o!==i&&uo(n,o,{get:()=>s[o],enumerable:!(a=bd(s,o))||a.enumerable});return n})(e&&e.__esModule?r:uo(r,"default",{value:e,enumerable:!0}),e)))(Ld()),Dn=512e3,Pn=256,ks=(e,{minChunkSize:t=Pn,maxChunkSize:r=Dn}={})=>e==null||typeof e=="number"&&e>=256&&e%256==0&&e>=t&&e<=r,Es=(e,{minChunkSize:t=Pn,maxChunkSize:r=Dn}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),Fd=class{constructor(e,t={}){var r,n,s;if(this.readableStream=e,!ks(t.defaultChunkSize,t))throw Es(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:30720,this.minChunkSize=(n=t.minChunkSize)!=null?n:Pn,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:Dn}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!ks(e,this))throw Es(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:n}=await t.read();if(r){if(e){let i=e;e=void 0,yield i}break}let s=n instanceof Uint8Array?new Blob([n],{type:"application/octet-stream"}):n;for(e=e?new Blob([e,s]):s;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()}}},Bd=[200,201,202,204,308],vl=[408,502,503,504],bl=(e,t)=>!!e&&Bd.includes(e.statusCode),zd=(e,t)=>t.attemptCount>=t.attempts||!(bl(e)||((r,{retryCodes:n=vl})=>!r||n.includes(r.statusCode))(e,t)),Sl=class{static createUpload(e){return new Sl(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||vl,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 Fd(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 Tn,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:Dn}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:Pn}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(!ks(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw Es(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=n=>{var s;let i=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/i,o=this.nextChunkRangeStart/this.file.size,l=n.loaded/((s=n.total)!=null?s:this.chunkByteSize)*a;this.dispatch("progress",Math.min(100*(o+l),100))}};return new Promise((r,n)=>{this.currentXhr=(0,Nd.default)({...e,beforeSend:t},(s,i)=>(this.currentXhr=void 0,s?n(s):r(i)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,n={...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:n,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 bl(t)?(async n=>{var s;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:n}),this.attemptCount=0,this.chunkCount=((s=this.chunkCount)!=null?s: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):zd(t,r)?(async n=>(this.dispatch("error",{message:`Server responded with ${n.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(n=>{setTimeout(async()=>{if(this._paused||this.offline)return this.pendingChunk=e,void n(!1);let s=await this.sendChunkWithRetries(e);n(s)},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}}},jd=Sl.createUpload,Wd=Object.defineProperty,x=(e,t,r)=>((n,s,i)=>s in n?Wd(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i)(e,typeof t!="symbol"?t+"":t,r),Vd=Object.defineProperty,Eo=(e,t,r)=>((n,s,i)=>s in n?Vd(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=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 xo={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ro={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Sr={};function Ui(e){if(Sr[e])return Sr[e];const t=globalThis[e],r=t.prototype,n=e in xo?xo[e]:void 0,s=!!(n&&n.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(s&&a)return Sr[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?Sr[e]=c:r}catch{return r}}const es={};function et(e,t,r){var n;const s=`${e}.${String(r)}`;if(es[s])return es[s].call(t);const i=Ui(e),a=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return a?(es[s]=a,a.call(t)):t[r]}const ts={};function Lo(e,t,r){const n=`${e}.${String(r)}`;if(ts[n])return ts[n].bind(t);const s=Ui(e)[r];return typeof s!="function"?t[r]:(ts[n]=s,s.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 Il(e){return e.nodeType===e.ELEMENT_NODE}function qt(e){const t=e&&"host"in e&&"mode"in e&&ge.host(e)||null;return!!(t&&"shadowRoot"in t&&ge.shadowRoot(t)===e)}function Xt(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Jr(e){try{const r=e.rules||e.cssRules;return r?((t=Array.from(r,s=>Cl(s,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 Cl(e,t){if(function(r){return"styleSheet"in r}(e)){let r;try{r=Jr(e.styleSheet)||function(n){const{cssText:s}=n;if(s.split('"').length<3)return s;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}(e)}catch{r=e.cssText}return e.styleSheet.href?yn(r,e.styleSheet.href):r}{let r=e.cssText;return function(n){return"selectorText"in n}(e)&&e.selectorText.includes(":")&&(r=function(n){const s=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(s,"$1\\$2")}(r)),t?yn(r,t):r}}class kl{constructor(){Eo(this,"idNodeMap",new Map),Eo(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(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){const n=this.getNode(t);if(n){const s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ti({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:i}){let a=s||"";const o=n&&ht(n);return(t[r.toLowerCase()]||o&&t[o])&&(a=i?i(a,e):"*".repeat(a.length)),a}function ht(e){return e.toLowerCase()}const Oo="__rrweb_original__";function Di(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ht(t):null}function Ao(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}const n=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(n==null?void 0:n[1])??null}const Hd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Gd=/^(?:[a-z+]+:)?\/\//i,$d=/^www\..*/i,Yd=/^(data:)([^,]*),(.*)/i;function yn(e,t){return(e||"").replace(Hd,(r,n,s,i,a,o)=>{const l=s||a||o,c=n||i||"";if(!l)return r;if(Gd.test(l)||$d.test(l))return`url(${c}${l}${c})`;if(Yd.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 Jd=1;const qd=new RegExp("[^a-z0-9-_:]");function El(){return Jd++}let vt,Mo;const Xd=/^[^ \t\n\r\u000c]+/,Zd=/^[, \t\n\r\u000c]+/,Uo=new WeakMap;function _t(e,t){return t&&t.trim()!==""?Pi(e,t):t}function Kd(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Pi(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 xl(e,t,r,n){return n&&(r==="src"||r==="href"&&(t!=="use"||n[0]!=="#")||r==="xlink:href"&&n[0]!=="#"?_t(e,n):r!=="background"||t!=="table"&&t!=="td"&&t!=="th"?r==="srcset"?function(s,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(Zd),!(a>=i.length);){let c=o(Xd);if(c.slice(-1)===",")c=_t(s,c.substring(0,c.length-1)),l.push(c);else{let u="";c=_t(s,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,n):r==="style"?yn(n,Pi(e)):t==="object"&&r==="data"?_t(e,n):n:_t(e,n))}function Rl(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function wn(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&wn(ge.parentNode(e),t,r);for(let n=e.classList.length;n--;){const s=e.classList[n];if(t.test(s))return!0}return!!r&&wn(ge.parentNode(e),t,r)}function Ll(e,t,r,n){let s;if(Il(e)){if(s=e,!ge.childNodes(s).length)return!1}else{if(ge.parentElement(e)===null)return!1;s=ge.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(wn(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function Qd(e,t){const{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:a,inlineStylesheet:o,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:y,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,n);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:I,blockSelector:M,inlineStylesheet:E,maskInputOptions:U={},maskInputFn:A,dataURLOptions:k={},inlineImages:R,recordCanvas:O,keepIframeSrcFn:S,newlyAddedElement:N=!1,rootId:D}=g,b=function(L,_,F){try{if(typeof _=="string"){if(L.classList.contains(_))return!0}else for(let J=L.classList.length;J--;){const pe=L.classList[J];if(_.test(pe))return!0}if(F)return L.matches(F)}catch{}return!1}(m,I,M),w=function(L){if(L instanceof HTMLFormElement)return"form";const _=ht(L.tagName);return qd.test(_)?"div":_}(m);let T={};const z=m.attributes.length;for(let L=0;L<z;L++){const _=m.attributes[L];Rl(w,_.name,_.value)||(T[_.name]=xl(v,w,ht(_.name),_.value))}if(w==="link"&&E){const L=Array.from(v.styleSheets).find(F=>F.href===m.href);let _=null;L&&(_=Jr(L)),_&&(delete T.rel,delete T.href,T._cssText=_)}if(w==="style"&&m.sheet&&!(m.innerText||ge.textContent(m)||"").trim().length){const L=Jr(m.sheet);L&&(T._cssText=L)}if(w==="input"||w==="textarea"||w==="select"){const L=m.value,_=m.checked;T.type!=="radio"&&T.type!=="checkbox"&&T.type!=="submit"&&T.type!=="button"&&L?T.value=Ti({element:m,type:Di(m),tagName:w,value:L,maskInputOptions:U,maskInputFn:A}):_&&(T.checked=_)}if(w==="option"&&(m.selected&&!U.select?T.selected=!0:delete T.selected),w==="dialog"&&m.open&&(T.rr_open_mode=m.matches("dialog:modal")?"modal":"non-modal"),w==="canvas"&&O){if(m.__context==="2d")(function(L){const _=L.getContext("2d");if(!_)return!0;for(let F=0;F<L.width;F+=50)for(let J=0;J<L.height;J+=50){const pe=_.getImageData,Le=Oo in pe?pe[Oo]:pe;if(new Uint32Array(Le.call(_,F,J,Math.min(50,L.width-F),Math.min(50,L.height-J)).data.buffer).some(ye=>ye!==0))return!1}return!0})(m)||(T.rr_dataURL=m.toDataURL(k.type,k.quality));else if(!("__context"in m)){const L=m.toDataURL(k.type,k.quality),_=v.createElement("canvas");_.width=m.width,_.height=m.height,L!==_.toDataURL(k.type,k.quality)&&(T.rr_dataURL=L)}}if(w==="img"&&R){vt||(vt=v.createElement("canvas"),Mo=vt.getContext("2d"));const L=m,_=L.currentSrc||L.getAttribute("src")||"<unknown-src>",F=L.crossOrigin,J=()=>{L.removeEventListener("load",J);try{vt.width=L.naturalWidth,vt.height=L.naturalHeight,Mo.drawImage(L,0,0),T.rr_dataURL=vt.toDataURL(k.type,k.quality)}catch(pe){if(L.crossOrigin!=="anonymous")return L.crossOrigin="anonymous",void(L.complete&&L.naturalWidth!==0?J():L.addEventListener("load",J));console.warn(`Cannot inline img src=${_}! Error: ${pe}`)}L.crossOrigin==="anonymous"&&(F?T.crossOrigin=F:L.removeAttribute("crossorigin"))};L.complete&&L.naturalWidth!==0?J():L.addEventListener("load",J)}if(w==="audio"||w==="video"){const L=T;L.rr_mediaState=m.paused?"paused":"played",L.rr_mediaCurrentTime=m.currentTime,L.rr_mediaPlaybackRate=m.playbackRate,L.rr_mediaMuted=m.muted,L.rr_mediaLoop=m.loop,L.rr_mediaVolume=m.volume}if(N||(m.scrollLeft&&(T.rr_scrollLeft=m.scrollLeft),m.scrollTop&&(T.rr_scrollTop=m.scrollTop)),b){const{width:L,height:_}=m.getBoundingClientRect();T={class:T.class,rr_width:`${L}px`,rr_height:`${_}px`}}w!=="iframe"||S(T.src)||(m.contentDocument||(T.rr_src=T.src),delete T.src);let W;try{customElements.get(w)&&(W=!0)}catch{}return{type:me.Element,tagName:w,attributes:T,childNodes:[],isSVG:Kd(m)||void 0,needBlock:b,rootId:D,isCustom:W}}(e,{doc:r,blockClass:s,blockSelector:i,inlineStylesheet:o,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:f,keepIframeSrcFn:y,newlyAddedElement:h,rootId:C});case e.TEXT_NODE:return function(m,g){var v;const{needsMask:I,maskTextFn:M,rootId:E}=g,U=ge.parentNode(m),A=U&&U.tagName;let k=ge.textContent(m);const R=A==="STYLE"||void 0,O=A==="SCRIPT"||void 0;if(R&&k){try{m.nextSibling||m.previousSibling||(v=U.sheet)!=null&&v.cssRules&&(k=Jr(U.sheet))}catch(S){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${S}`,m)}k=yn(k,Pi(g.doc))}return O&&(k="SCRIPT_PLACEHOLDER"),!R&&!O&&k&&I&&(k=M?M(k,ge.parentElement(m)):k.replace(/[\S]/g,"*")),{type:me.Text,textContent:k||"",isStyle:R,rootId:E}}(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 ee(e){return e==null?"":e.toLowerCase()}function kt(e,t){const{doc:r,mirror:n,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:o,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:y={},inlineImages:h=!1,recordCanvas:C=!1,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:M=5e3,keepIframeSrcFn:E=()=>!1,newlyAddedElement:U=!1}=t;let{needsMask:A}=t,{preserveWhiteSpace:k=!0}=t;A||(A=Ll(e,a,o,A===void 0));const R=Qd(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:A,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:y,inlineImages:h,recordCanvas:C,keepIframeSrcFn:E,newlyAddedElement:U});if(!R)return console.warn(e,"not serialized"),null;let O;O=n.hasNode(e)?n.getId(e):!function(b,w){return!!(w.comment&&b.type===me.Comment||b.type===me.Element&&(w.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")||w.headFavicon&&(b.tagName==="link"&&b.attributes.rel==="shortcut icon"||b.tagName==="meta"&&(ee(b.attributes.name).match(/^msapplication-tile(image|color)$/)||ee(b.attributes.name)==="application-name"||ee(b.attributes.rel)==="icon"||ee(b.attributes.rel)==="apple-touch-icon"||ee(b.attributes.rel)==="shortcut icon"))||b.tagName==="meta"&&(w.headMetaDescKeywords&&ee(b.attributes.name).match(/^description|keywords$/)||w.headMetaSocial&&(ee(b.attributes.property).match(/^(og|twitter|fb):/)||ee(b.attributes.name).match(/^(og|twitter):/)||ee(b.attributes.name)==="pinterest")||w.headMetaRobots&&(ee(b.attributes.name)==="robots"||ee(b.attributes.name)==="googlebot"||ee(b.attributes.name)==="bingbot")||w.headMetaHttpEquiv&&b.attributes["http-equiv"]!==void 0||w.headMetaAuthorship&&(ee(b.attributes.name)==="author"||ee(b.attributes.name)==="generator"||ee(b.attributes.name)==="framework"||ee(b.attributes.name)==="publisher"||ee(b.attributes.name)==="progid"||ee(b.attributes.property).match(/^article:/)||ee(b.attributes.property).match(/^product:/))||w.headMetaVerification&&(ee(b.attributes.name)==="google-site-verification"||ee(b.attributes.name)==="yandex-verification"||ee(b.attributes.name)==="csrf-token"||ee(b.attributes.name)==="p:domain_verify"||ee(b.attributes.name)==="verify-v1"||ee(b.attributes.name)==="verification"||ee(b.attributes.name)==="shopify-checkout-api-token"))))}(R,f)&&(k||R.type!==me.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?El():-2;const S=Object.assign(R,{id:O});if(n.add(e,S),O===-2)return null;m&&m(e);let N=!l;if(S.type===me.Element){N=N&&!S.needBlock,delete S.needBlock;const b=ge.shadowRoot(e);b&&Xt(b)&&(S.isShadowHost=!0)}if((S.type===me.Document||S.type===me.Element)&&N){f.headWhitespace&&S.type===me.Element&&S.tagName==="head"&&(k=!1);const b={doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:A,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:y,inlineImages:h,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:E};if(!(S.type===me.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0))for(const T of Array.from(ge.childNodes(e))){const z=kt(T,b);z&&S.childNodes.push(z)}let w=null;if(Il(e)&&(w=ge.shadowRoot(e)))for(const T of Array.from(ge.childNodes(w))){const z=kt(T,b);z&&(Xt(w)&&(z.isShadow=!0),S.childNodes.push(z))}}const D=ge.parentNode(e);return D&&qt(D)&&Xt(D)&&(S.isShadow=!0),S.type===me.Element&&S.tagName==="iframe"&&function(b,w,T){const z=b.contentWindow;if(!z)return;let W,L=!1;try{W=z.document.readyState}catch{return}if(W!=="complete"){const F=setTimeout(()=>{L||(w(),L=!0)},T);return void b.addEventListener("load",()=>{clearTimeout(F),L=!0,w()})}const _="about:blank";if(z.location.href!==_||b.src===_||b.src==="")return setTimeout(w,0),b.addEventListener("load",w);b.addEventListener("load",w)}(e,()=>{const b=e.contentDocument;if(b&&g){const w=kt(b,{doc:b,mirror:n,blockClass:s,blockSelector:i,needsMask:A,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:y,inlineImages:h,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:E});w&&g(e,w)}},v),S.type===me.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&Ao(S.attributes.href)==="css")&&function(b,w,T){let z,W=!1;try{z=b.sheet}catch{return}if(z)return;const L=setTimeout(()=>{W||(w(),W=!0)},T);b.addEventListener("load",()=>{clearTimeout(L),W=!0,w()})}(e,()=>{if(I){const b=kt(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,needsMask:A,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:y,inlineImages:h,recordCanvas:C,preserveWhiteSpace:k,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:M,keepIframeSrcFn:E});b&&I(e,b)}},M),S}function ep(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tp(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?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(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}var xs={exports:{}},ne=String,To=function(){return{isColorSupported:!1,reset:ne,bold:ne,dim:ne,italic:ne,underline:ne,inverse:ne,hidden:ne,strikethrough:ne,black:ne,red:ne,green:ne,yellow:ne,blue:ne,magenta:ne,cyan:ne,white:ne,gray:ne,bgBlack:ne,bgRed:ne,bgGreen:ne,bgYellow:ne,bgBlue:ne,bgMagenta:ne,bgCyan:ne,bgWhite:ne}};xs.exports=To(),xs.exports.createColors=To;var rp=xs.exports;const Pe=tp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let Do=rp,Po=Pe,Rs=class Ol extends Error{constructor(t,r,n,s,i,a){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),s&&(this.source=s),a&&(this.plugin=a),r!==void 0&&n!==void 0&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Ol)}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=Do.isColorSupported),Po&&t&&(r=Po(r));let n,s,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}=Do.createColors(!0);n=p=>c(d(p)),s=p=>u(p)}else n=s=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=s(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return n(">")+s(p)+c+` `+f+n("^")}return" "+s(p)+c}).join(` `)}toString(){let t=this.showSourceCode();return t&&(t=` `+t+` `),this.name+": "+this.message+t}};var _i=Rs;Rs.default=Rs;var nr={};nr.isClean=Symbol("isClean"),nr.my=Symbol("my");const _o={after:` `,beforeClose:` `,beforeComment:` `,beforeDecl:` `,beforeOpen:" ",beforeRule:` `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};let Ls=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(e.raws.afterName!==void 0?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let s=(e.raws.between||"")+(t?";":"");this.builder(r+n+s,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 n=e.parent,s=0;for(;n&&n.type!=="root";)s+=1,n=n.parent;if(r.includes(` `)){let i=this.raw(e,null,"indent");if(i.length)for(let a=0;a<s;a++)r+=i}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",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 n=0;n<e.nodes.length;n++){let s=e.nodes[n],i=this.raw(s,"before");i&&this.builder(i),this.stringify(s,t!==n||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"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],n!==void 0))return n;let s=e.parent;if(r==="before"&&(!s||s.type==="root"&&s.first===e||s&&s.type==="document"))return"";if(!s)return _o[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]?n=this[o](i,e):i.walk(l=>{if(n=l.raws[t],n!==void 0)return!1})}var a;return n===void 0&&(n=_o[r]),i.rawCache[r]=n,n}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(` `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(n=>{if(n.raws.before!==void 0)return r=n.raws.before,r.includes(` `)&&(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(n=>{if(n.raws.before!==void 0)return r=n.raws.before,r.includes(` `)&&(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(` `)&&(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 n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&r.raws.before!==void 0){let s=r.raws.before.split(` `);return t=s[s.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],n=e.raws[t];return n&&n.value===r?n.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 Al=Ls;Ls.default=Ls;let np=Al;function Os(e,t){new np(t).stringify(e)}var _n=Os;Os.default=Os;let{isClean:Ir,my:sp}=nr,ip=_i,op=Al,ap=_n;function As(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let s=e[n],i=typeof s;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=s:Array.isArray(s)?r[n]=s.map(a=>As(a,r)):(i==="object"&&s!==null&&(s=As(s)),r[n]=s)}return r}let Ms=class{constructor(e={}){this.raws={},this[Ir]=!1,this[sp]=!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=As(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:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new ip(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[Ir]){this[Ir]=!1;let e=this;for(;e=e.parent;)e[Ir]=!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 n=(t=this.toString()).indexOf(e.word);n!==-1&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,s=this.source.start.line;for(let i=0;i<e;i++)r[i]===` `?(n=1,s+=1):n+=1;return{column:n,line:s}}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 n=this.toString(),s=n.indexOf(e.word);s!==-1&&(t=this.positionInside(s,n),r=this.positionInside(s+e.word.length,n))}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 op().raw(this,e,t)}