import{p as Et,g as pn,a as Kt,b as fn,o as dn}from"./index-CYtgifWR.chunk.mjs";import{i as Jt,g as gn}from"./NcNoteCard-CwNXZ4vV-dRcgmGN6.chunk.mjs";import{b as mn}from"./index-DxwFe63_.chunk.mjs";import{g as yt}from"./vue.runtime.esm-fahCO3eG.chunk.mjs";function it(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ge(e,t,n){vn(e,t),t.set(e,n)}function vn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function W(e,t){var n=Me(e,t,"get");return yn(e,n)}function yn(e,t){return t.get?t.get.call(e):t.value}function me(e,t,n){var r=Me(e,t,"set");return wn(e,r,n),n}function Me(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function wn(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}var bn=typeof Symbol<"u"?Symbol.toStringTag:"@@toStringTag",q=new WeakMap,ht=new WeakMap;class It{constructor(t){var{executor:n=()=>{},internals:r=Qt(),promise:s=new Promise((i,c)=>n(i,c,u=>{r.onCancelList.push(u)}))}=t;ge(this,q,{writable:!0,value:void 0}),ge(this,ht,{writable:!0,value:void 0}),it(this,bn,"CancelablePromise"),this.cancel=this.cancel.bind(this),me(this,q,r),me(this,ht,s||new Promise((i,c)=>n(i,c,u=>{r.onCancelList.push(u)})))}then(t,n){return Nt(W(this,ht).then(wt(t,W(this,q)),wt(n,W(this,q))),W(this,q))}catch(t){return Nt(W(this,ht).catch(wt(t,W(this,q))),W(this,q))}finally(t,n){return n&&W(this,q).onCancelList.push(t),Nt(W(this,ht).finally(wt(()=>{if(t)return n&&(W(this,q).onCancelList=W(this,q).onCancelList.filter(r=>r!==t)),t()},W(this,q))),W(this,q))}cancel(){W(this,q).isCanceled=!0;var t=W(this,q).onCancelList;W(this,q).onCancelList=[];for(var n of t)if(typeof n=="function")try{n()}catch(r){console.error(r)}}isCanceled(){return W(this,q).isCanceled===!0}}class nt extends It{constructor(t){super({executor:t})}}it(nt,"all",function(e){return bt(e,Promise.all(e))}),it(nt,"allSettled",function(e){return bt(e,Promise.allSettled(e))}),it(nt,"any",function(e){return bt(e,Promise.any(e))}),it(nt,"race",function(e){return bt(e,Promise.race(e))}),it(nt,"resolve",function(e){return ve(Promise.resolve(e))}),it(nt,"reject",function(e){return ve(Promise.reject(e))}),it(nt,"isCancelable",Zt);function ve(e){return Nt(e,Qt())}function Zt(e){return e instanceof nt||e instanceof It}function wt(e,t){if(e)return n=>{if(!t.isCanceled){var r=e(n);return Zt(r)&&t.onCancelList.push(r.cancel),r}return n}}function Nt(e,t){return new It({internals:t,promise:e})}function bt(e,t){var n=Qt();return n.onCancelList.push(()=>{for(var r of e)Zt(r)&&r.cancel()}),new It({internals:n,promise:t})}function Qt(){return{isCanceled:!1,onCancelList:[]}}var Lt={},xn={2:e=>{function t(s,i,c){s instanceof RegExp&&(s=n(s,c)),i instanceof RegExp&&(i=n(i,c));var u=r(s,i,c);return u&&{start:u[0],end:u[1],pre:c.slice(0,u[0]),body:c.slice(u[0]+s.length,u[1]),post:c.slice(u[1]+i.length)}}function n(s,i){var c=i.match(s);return c?c[0]:null}function r(s,i,c){var u,g,l,o,h,a=c.indexOf(s),d=c.indexOf(i,a+1),f=a;if(a>=0&&d>0){for(u=[],l=c.length;f>=0&&!h;)f==a?(u.push(f),a=c.indexOf(s,f+1)):u.length==1?h=[u.pop(),d]:((g=u.pop())=0?a:d;u.length&&(h=[l,o])}return h}e.exports=t,t.range=r},101:function(e,t,n){var r;e=n.nmd(e),(function(s){var i=(e&&e.exports,typeof yt=="object"&&yt);i.global!==i&&i.window;var c=function(h){this.message=h};(c.prototype=new Error).name="InvalidCharacterError";var u=function(h){throw new c(h)},g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=/[\t\n\f\r ]/g,o={encode:function(h){h=String(h),/[^\0-\xFF]/.test(h)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var a,d,f,m,v=h.length%3,A="",p=-1,y=h.length-v;++p>18&63)+g.charAt(m>>12&63)+g.charAt(m>>6&63)+g.charAt(63&m);return v==2?(a=h.charCodeAt(p)<<8,d=h.charCodeAt(++p),A+=g.charAt((m=a+d)>>10)+g.charAt(m>>4&63)+g.charAt(m<<2&63)+"="):v==1&&(m=h.charCodeAt(p),A+=g.charAt(m>>2)+g.charAt(m<<4&63)+"=="),A},decode:function(h){var a=(h=String(h).replace(l,"")).length;a%4==0&&(a=(h=h.replace(/==?$/,"")).length),(a%4==1||/[^+a-zA-Z0-9/]/.test(h))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var d,f,m=0,v="",A=-1;++A>(-2*m&6)));return v},version:"1.0.0"};(r=function(){return o}.call(t,n,t,e))===void 0||(e.exports=r)})()},172:(e,t)=>{t.d=function(n){if(!n)return 0;for(var r=(n=n.toString()).length,s=n.length;s--;){var i=n.charCodeAt(s);56320<=i&&i<=57343&&s--,127{var t={utf8:{stringToBytes:function(n){return t.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(t.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var r=[],s=0;s{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(r,s){return r<>>32-s},rotr:function(r,s){return r<<32-s|r>>>s},endian:function(r){if(r.constructor==Number)return 16711935&n.rotl(r,8)|4278255360&n.rotl(r,24);for(var s=0;s0;r--)s.push(Math.floor(256*Math.random()));return s},bytesToWords:function(r){for(var s=[],i=0,c=0;i>>5]|=r[i]<<24-c%32;return s},wordsToBytes:function(r){for(var s=[],i=0;i<32*r.length;i+=8)s.push(r[i>>>5]>>>24-i%32&255);return s},bytesToHex:function(r){for(var s=[],i=0;i>>4).toString(16)),s.push((15&r[i]).toString(16));return s.join("")},hexToBytes:function(r){for(var s=[],i=0;i>>6*(3-u)&63)):s.push("=");return s.join("")},base64ToBytes:function(r){r=r.replace(/[^A-Z0-9+\/]/gi,"");for(var s=[],i=0,c=0;i>>6-2*c);return s}},e.exports=n},635:(e,t,n)=>{const r=n(31),s=n(338),i=n(221);e.exports={XMLParser:s,XMLValidator:r,XMLBuilder:i}},118:e=>{e.exports=function(t){return typeof t=="function"?t:Array.isArray(t)?n=>{for(const r of t)if(typeof r=="string"&&n===r||r instanceof RegExp&&r.test(n))return!0}:()=>!1}},705:(e,t)=>{const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r="["+n+"]["+n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",s=new RegExp("^"+r+"$");t.isExist=function(i){return i!==void 0},t.isEmptyObject=function(i){return Object.keys(i).length===0},t.merge=function(i,c,u){if(c){const g=Object.keys(c),l=g.length;for(let o=0;o{const r=n(705),s={allowBooleanAttributes:!1,unpairedTags:[]};function i(p){return p===" "||p===" "||p===` `||p==="\r"}function c(p,y){const x=y;for(;y5&&E==="xml")return f("InvalidXml","XML declaration allowed only at the start of the document.",v(p,y));if(p[y]=="?"&&p[y+1]==">"){y++;break}}return y}function u(p,y){if(p.length>y+5&&p[y+1]==="-"&&p[y+2]==="-"){for(y+=3;y"){y+=2;break}}else if(p.length>y+8&&p[y+1]==="D"&&p[y+2]==="O"&&p[y+3]==="C"&&p[y+4]==="T"&&p[y+5]==="Y"&&p[y+6]==="P"&&p[y+7]==="E"){let x=1;for(y+=8;y"&&(x--,x===0))break}else if(p.length>y+9&&p[y+1]==="["&&p[y+2]==="C"&&p[y+3]==="D"&&p[y+4]==="A"&&p[y+5]==="T"&&p[y+6]==="A"&&p[y+7]==="["){for(y+=8;y"){y+=2;break}}return y}t.validate=function(p,y){y=Object.assign({},s,y);const x=[];let E=!1,w=!1;p[0]==="\uFEFF"&&(p=p.substr(1));for(let b=0;b"&&p[b]!==" "&&p[b]!==" "&&p[b]!==` `&&p[b]!=="\r";b++)j+=p[b];if(j=j.trim(),j[j.length-1]==="/"&&(j=j.substring(0,j.length-1),b--),P=j,!r.isName(P)){let _;return _=j.trim().length===0?"Invalid space after '<'.":"Tag '"+j+"' is an invalid name.",f("InvalidTag",_,v(p,b))}const S=o(p,b);if(S===!1)return f("InvalidAttr","Attributes for '"+j+"' have open quote.",v(p,b));let N=S.value;if(b=S.index,N[N.length-1]==="/"){const _=b-N.length;N=N.substring(0,N.length-1);const C=a(N,y);if(C!==!0)return f(C.err.code,C.err.msg,v(p,_+C.err.line));E=!0}else if(T){if(!S.tagClosed)return f("InvalidTag","Closing tag '"+j+"' doesn't have proper closing.",v(p,b));if(N.trim().length>0)return f("InvalidTag","Closing tag '"+j+"' can't have attributes or invalid starting.",v(p,O));if(x.length===0)return f("InvalidTag","Closing tag '"+j+"' has not been opened.",v(p,O));{const _=x.pop();if(j!==_.tagName){let C=v(p,_.tagStartPos);return f("InvalidTag","Expected closing tag '"+_.tagName+"' (opened in line "+C.line+", col "+C.col+") instead of closing tag '"+j+"'.",v(p,O))}x.length==0&&(w=!0)}}else{const _=a(N,y);if(_!==!0)return f(_.err.code,_.err.msg,v(p,b-N.length+_.err.line));if(w===!0)return f("InvalidXml","Multiple possible root nodes found.",v(p,b));y.unpairedTags.indexOf(j)!==-1||x.push({tagName:j,tagStartPos:O}),E=!0}for(b++;b0)||f("InvalidXml","Invalid '"+JSON.stringify(x.map(b=>b.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):f("InvalidXml","Start tag expected.",1)};const g='"',l="'";function o(p,y){let x="",E="",w=!1;for(;y"&&E===""){w=!0;break}x+=p[y]}return E===""&&{value:x,index:y,tagClosed:w}}const h=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function a(p,y){const x=r.getAllMatches(p,h),E={};for(let w=0;w{const r=n(87),s=n(118),i={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(o,h){return h},attributeValueProcessor:function(o,h){return h},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function c(o){this.options=Object.assign({},i,o),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=s(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=l),this.processTextOrObjNode=u,this.options.format?(this.indentate=g,this.tagEndChar=`> `,this.newLine=` `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function u(o,h,a,d){const f=this.j2x(o,a+1,d.concat(h));return o[this.options.textNodeName]!==void 0&&Object.keys(o).length===1?this.buildTextValNode(o[this.options.textNodeName],h,f.attrStr,a):this.buildObjectNode(f.val,h,f.attrStr,a)}function g(o){return this.options.indentBy.repeat(o)}function l(o){return!(!o.startsWith(this.options.attributeNamePrefix)||o===this.options.textNodeName)&&o.substr(this.attrPrefixLen)}c.prototype.build=function(o){return this.options.preserveOrder?r(o,this.options):(Array.isArray(o)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(o={[this.options.arrayNodeName]:o}),this.j2x(o,0,[]).val)},c.prototype.j2x=function(o,h,a){let d="",f="";const m=a.join(".");for(let v in o)if(Object.prototype.hasOwnProperty.call(o,v))if(o[v]===void 0)this.isAttribute(v)&&(f+="");else if(o[v]===null)this.isAttribute(v)?f+="":v[0]==="?"?f+=this.indentate(h)+"<"+v+"?"+this.tagEndChar:f+=this.indentate(h)+"<"+v+"/"+this.tagEndChar;else if(o[v]instanceof Date)f+=this.buildTextValNode(o[v],v,"",h);else if(typeof o[v]!="object"){const A=this.isAttribute(v);if(A&&!this.ignoreAttributesFn(A,m))d+=this.buildAttrPairStr(A,""+o[v]);else if(!A)if(v===this.options.textNodeName){let p=this.options.tagValueProcessor(v,""+o[v]);f+=this.replaceEntitiesValue(p)}else f+=this.buildTextValNode(o[v],v,"",h)}else if(Array.isArray(o[v])){const A=o[v].length;let p="",y="";for(let x=0;x`+this.newLine:this.indentate(d)+"<"+h+a+m+this.tagEndChar+o+this.indentate(d)+f:this.indentate(d)+"<"+h+a+m+">"+o+f}},c.prototype.closeTag=function(o){let h="";return this.options.unpairedTags.indexOf(o)!==-1?this.options.suppressUnpairedNode||(h="/"):h=this.options.suppressEmptyNode?"/":`>`+this.newLine;if(this.options.commentPropName!==!1&&h===this.options.commentPropName)return this.indentate(d)+``+this.newLine;if(h[0]==="?")return this.indentate(d)+"<"+h+a+"?"+this.tagEndChar;{let f=this.options.tagValueProcessor(h,o);return f=this.replaceEntitiesValue(f),f===""?this.indentate(d)+"<"+h+a+this.closeTag(h)+this.tagEndChar:this.indentate(d)+"<"+h+a+">"+f+"0&&this.options.processEntities)for(let h=0;h{function t(c,u,g,l){let o="",h=!1;for(let a=0;a`,h=!1;continue}if(f===u.commentPropName){o+=l+``,h=!0;continue}if(f[0]==="?"){const y=r(d[":@"],u),x=f==="?xml"?"":l;let E=d[f][0][u.textNodeName];E=E.length!==0?" "+E:"",o+=x+`<${f}${E}${y}?>`,h=!0;continue}let v=l;v!==""&&(v+=u.indentBy);const A=l+`<${f}${r(d[":@"],u)}`,p=t(d[f],u,m,v);u.unpairedTags.indexOf(f)!==-1?u.suppressUnpairedNode?o+=A+">":o+=A+"/>":p&&p.length!==0||!u.suppressEmptyNode?p&&p.endsWith(">")?o+=A+`>${p}${l}`:(o+=A+">",p&&l!==""&&(p.includes("/>")||p.includes("`):o+=A+"/>",h=!0}return o}function n(c){const u=Object.keys(c);for(let g=0;g0&&u.processEntities)for(let g=0;g0&&(g=` `),t(c,u,"",g)}},193:(e,t,n)=>{const r=n(705);function s(h,a){let d="";for(;a"){if(v?h[a-1]==="-"&&h[a-2]==="-"&&(v=!1,f--):f--,f===0)break}else h[a]==="["?m=!0:A+=h[a];else{if(m&&c(h,a)){let p,y;a+=7,[p,y,a]=s(h,a+1),y.indexOf("&")===-1&&(d[o(p)]={regx:RegExp(`&${p};`,"g"),val:y})}else if(m&&u(h,a))a+=8;else if(m&&g(h,a))a+=8;else if(m&&l(h,a))a+=9;else{if(!i)throw new Error("Invalid DOCTYPE");v=!0}f++,A=""}if(f!==0)throw new Error("Unclosed DOCTYPE")}return{entities:d,i:a}}},63:(e,t)=>{const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(r,s){return s},attributeValueProcessor:function(r,s){return s},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(r,s,i){return r}};t.buildOptions=function(r){return Object.assign({},n,r)},t.defaultOptions=n},299:(e,t,n)=>{const r=n(705),s=n(365),i=n(193),c=n(494),u=n(118);function g(w){const P=Object.keys(w);for(let b=0;b0)){S||(w=this.replaceEntitiesValue(w));const N=this.options.tagValueProcessor(P,w,b,T,j);return N==null?w:typeof N!=typeof w||N!==w?N:this.options.trimValues||w.trim()===w?E(w,this.options.parseTagValue,this.options.numberParseOptions):w}}function o(w){if(this.options.removeNSPrefix){const P=w.split(":"),b=w.charAt(0)==="/"?"/":"";if(P[0]==="xmlns")return"";P.length===2&&(w=b+P[1])}return w}const h=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function a(w,P,b){if(this.options.ignoreAttributes!==!0&&typeof w=="string"){const O=r.getAllMatches(w,h),T=O.length,j={};for(let S=0;S",j,"Closing Tag is not closed.");let N=w.substring(j+2,S).trim();if(this.options.removeNSPrefix){const I=N.indexOf(":");I!==-1&&(N=N.substr(I+1))}this.options.transformTagName&&(N=this.options.transformTagName(N)),b&&(O=this.saveTextToParentTag(O,b,T));const _=T.substring(T.lastIndexOf(".")+1);if(N&&this.options.unpairedTags.indexOf(N)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let C=0;_&&this.options.unpairedTags.indexOf(_)!==-1?(C=T.lastIndexOf(".",T.lastIndexOf(".")-1),this.tagsNodeStack.pop()):C=T.lastIndexOf("."),T=T.substring(0,C),b=this.tagsNodeStack.pop(),O="",j=S}else if(w[j+1]==="?"){let S=y(w,j,!1,"?>");if(!S)throw new Error("Pi Tag is not closed.");if(O=this.saveTextToParentTag(O,b,T),!(this.options.ignoreDeclaration&&S.tagName==="?xml"||this.options.ignorePiTags)){const N=new s(S.tagName);N.add(this.options.textNodeName,""),S.tagName!==S.tagExp&&S.attrExpPresent&&(N[":@"]=this.buildAttributesMap(S.tagExp,T,S.tagName)),this.addChild(b,N,T)}j=S.closeIndex+1}else if(w.substr(j+1,3)==="!--"){const S=p(w,"-->",j+4,"Comment is not closed.");if(this.options.commentPropName){const N=w.substring(j+4,S-2);O=this.saveTextToParentTag(O,b,T),b.add(this.options.commentPropName,[{[this.options.textNodeName]:N}])}j=S}else if(w.substr(j+1,2)==="!D"){const S=i(w,j);this.docTypeEntities=S.entities,j=S.i}else if(w.substr(j+1,2)==="!["){const S=p(w,"]]>",j,"CDATA is not closed.")-2,N=w.substring(j+9,S);O=this.saveTextToParentTag(O,b,T);let _=this.parseTextData(N,b.tagname,T,!0,!1,!0,!0);_==null&&(_=""),this.options.cdataPropName?b.add(this.options.cdataPropName,[{[this.options.textNodeName]:N}]):b.add(this.options.textNodeName,_),j=S+2}else{let S=y(w,j,this.options.removeNSPrefix),N=S.tagName;const _=S.rawTagName;let C=S.tagExp,I=S.attrExpPresent,V=S.closeIndex;this.options.transformTagName&&(N=this.options.transformTagName(N)),b&&O&&b.tagname!=="!xml"&&(O=this.saveTextToParentTag(O,b,T,!1));const M=b;if(M&&this.options.unpairedTags.indexOf(M.tagname)!==-1&&(b=this.tagsNodeStack.pop(),T=T.substring(0,T.lastIndexOf("."))),N!==P.tagname&&(T+=T?"."+N:N),this.isItStopNode(this.options.stopNodes,T,N)){let L="";if(C.length>0&&C.lastIndexOf("/")===C.length-1)N[N.length-1]==="/"?(N=N.substr(0,N.length-1),T=T.substr(0,T.length-1),C=N):C=C.substr(0,C.length-1),j=S.closeIndex;else if(this.options.unpairedTags.indexOf(N)!==-1)j=S.closeIndex;else{const D=this.readStopNodeData(w,_,V+1);if(!D)throw new Error(`Unexpected end of ${_}`);j=D.i,L=D.tagContent}const J=new s(N);N!==C&&I&&(J[":@"]=this.buildAttributesMap(C,T,N)),L&&(L=this.parseTextData(L,N,T,!0,I,!0,!0)),T=T.substr(0,T.lastIndexOf(".")),J.add(this.options.textNodeName,L),this.addChild(b,J,T)}else{if(C.length>0&&C.lastIndexOf("/")===C.length-1){N[N.length-1]==="/"?(N=N.substr(0,N.length-1),T=T.substr(0,T.length-1),C=N):C=C.substr(0,C.length-1),this.options.transformTagName&&(N=this.options.transformTagName(N));const L=new s(N);N!==C&&I&&(L[":@"]=this.buildAttributesMap(C,T,N)),this.addChild(b,L,T),T=T.substr(0,T.lastIndexOf("."))}else{const L=new s(N);this.tagsNodeStack.push(b),N!==C&&I&&(L[":@"]=this.buildAttributesMap(C,T,N)),this.addChild(b,L,T),b=L}O="",j=V}}else O+=w[j];return P.child};function f(w,P,b){const O=this.options.updateTag(P.tagname,b,P[":@"]);O===!1||(typeof O=="string"&&(P.tagname=O),w.addChild(P))}const m=function(w){if(this.options.processEntities){for(let P in this.docTypeEntities){const b=this.docTypeEntities[P];w=w.replace(b.regx,b.val)}for(let P in this.lastEntities){const b=this.lastEntities[P];w=w.replace(b.regex,b.val)}if(this.options.htmlEntities)for(let P in this.htmlEntities){const b=this.htmlEntities[P];w=w.replace(b.regex,b.val)}w=w.replace(this.ampEntity.regex,this.ampEntity.val)}return w};function v(w,P,b,O){return w&&(O===void 0&&(O=Object.keys(P.child).length===0),(w=this.parseTextData(w,P.tagname,b,!1,!!P[":@"]&&Object.keys(P[":@"]).length!==0,O))!==void 0&&w!==""&&P.add(this.options.textNodeName,w),w=""),w}function A(w,P,b){const O="*."+b;for(const T in w){const j=w[T];if(O===j||P===j)return!0}return!1}function p(w,P,b,O){const T=w.indexOf(P,b);if(T===-1)throw new Error(O);return T+P.length-1}function y(w,P,b){const O=(function(I,V){let M,L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:">",J="";for(let D=V;D3&&arguments[3]!==void 0?arguments[3]:">");if(!O)return;let T=O.data;const j=O.index,S=T.search(/\s/);let N=T,_=!0;S!==-1&&(N=T.substring(0,S),T=T.substring(S+1).trimStart());const C=N;if(b){const I=N.indexOf(":");I!==-1&&(N=N.substr(I+1),_=N!==O.data.substr(I+1))}return{tagName:N,tagExp:T,closeIndex:j,attrExpPresent:_,rawTagName:C}}function x(w,P,b){const O=b;let T=1;for(;b",b,`${P} is not closed`);if(w.substring(b+2,j).trim()===P&&(T--,T===0))return{tagContent:w.substring(O,b),i:j};b=j}else if(w[b+1]==="?")b=p(w,"?>",b+1,"StopNode is not closed.");else if(w.substr(b+1,3)==="!--")b=p(w,"-->",b+3,"StopNode is not closed.");else if(w.substr(b+1,2)==="![")b=p(w,"]]>",b,"StopNode is not closed.")-2;else{const j=y(w,b,">");j&&((j&&j.tagName)===P&&j.tagExp[j.tagExp.length-1]!=="/"&&T++,b=j.closeIndex)}}function E(w,P,b){if(P&&typeof w=="string"){const O=w.trim();return O==="true"||O!=="false"&&c(w,b)}return r.isExist(w)?w:""}e.exports=class{constructor(w){this.options=w,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(P,b)=>String.fromCharCode(Number.parseInt(b,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(P,b)=>String.fromCharCode(Number.parseInt(b,16))}},this.addExternalEntities=g,this.parseXml=d,this.parseTextData=l,this.resolveNameSpace=o,this.buildAttributesMap=a,this.isItStopNode=A,this.replaceEntitiesValue=m,this.readStopNodeData=x,this.saveTextToParentTag=v,this.addChild=f,this.ignoreAttributesFn=u(this.options.ignoreAttributes)}}},338:(e,t,n)=>{const{buildOptions:r}=n(63),s=n(299),{prettify:i}=n(728),c=n(31);e.exports=class{constructor(u){this.externalEntities={},this.options=r(u)}parse(u,g){if(typeof u!="string"){if(!u.toString)throw new Error("XML data is accepted in String or Bytes[] form.");u=u.toString()}if(g){g===!0&&(g={});const h=c.validate(u,g);if(h!==!0)throw Error(`${h.err.msg}:${h.err.line}:${h.err.col}`)}const l=new s(this.options);l.addExternalEntities(this.externalEntities);const o=l.parseXml(u);return this.options.preserveOrder||o===void 0?o:i(o,this.options)}addEntity(u,g){if(g.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(u.indexOf("&")!==-1||u.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if(g==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[u]=g}}},728:(e,t)=>{function n(c,u,g){let l;const o={};for(let h=0;h0&&(o[u.textNodeName]=l):l!==void 0&&(o[u.textNodeName]=l),o}function r(c){const u=Object.keys(c);for(let g=0;g{e.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},135:e=>{function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}e.exports=function(n){return n!=null&&(t(n)||(function(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&t(r.slice(0,0))})(n)||!!n._isBuffer)}},542:(e,t,n)=>{(function(){var r=n(298),s=n(526).utf8,i=n(135),c=n(526).bin,u=function(g,l){g.constructor==String?g=l&&l.encoding==="binary"?c.stringToBytes(g):s.stringToBytes(g):i(g)?g=Array.prototype.slice.call(g,0):Array.isArray(g)||g.constructor===Uint8Array||(g=g.toString());for(var o=r.bytesToWords(g),h=8*g.length,a=1732584193,d=-271733879,f=-1732584194,m=271733878,v=0;v>>24)|4278255360&(o[v]<<24|o[v]>>>8);o[h>>>5]|=128<>>9<<4)]=h;var A=u._ff,p=u._gg,y=u._hh,x=u._ii;for(v=0;v>>0,d=d+w>>>0,f=f+P>>>0,m=m+b>>>0}return r.endian([a,d,f,m])};u._ff=function(g,l,o,h,a,d,f){var m=g+(l&o|~l&h)+(a>>>0)+f;return(m<>>32-d)+l},u._gg=function(g,l,o,h,a,d,f){var m=g+(l&h|o&~h)+(a>>>0)+f;return(m<>>32-d)+l},u._hh=function(g,l,o,h,a,d,f){var m=g+(l^o^h)+(a>>>0)+f;return(m<>>32-d)+l},u._ii=function(g,l,o,h,a,d,f){var m=g+(o^(l|~h))+(a>>>0)+f;return(m<>>32-d)+l},u._blocksize=16,u._digestsize=16,e.exports=function(g,l){if(g==null)throw new Error("Illegal argument "+g);var o=r.wordsToBytes(u(g,l));return l&&l.asBytes?o:l&&l.asString?c.bytesToString(o):r.bytesToHex(o)}})()},285:(e,t,n)=>{var r=n(2);e.exports=function(A){return A?(A.substr(0,2)==="{}"&&(A="\\{\\}"+A.substr(2)),v((function(p){return p.split("\\\\").join(s).split("\\{").join(i).split("\\}").join(c).split("\\,").join(u).split("\\.").join(g)})(A),!0).map(o)):[]};var s="\0SLASH"+Math.random()+"\0",i="\0OPEN"+Math.random()+"\0",c="\0CLOSE"+Math.random()+"\0",u="\0COMMA"+Math.random()+"\0",g="\0PERIOD"+Math.random()+"\0";function l(A){return parseInt(A,10)==A?parseInt(A,10):A.charCodeAt(0)}function o(A){return A.split(s).join("\\").split(i).join("{").split(c).join("}").split(u).join(",").split(g).join(".")}function h(A){if(!A)return[""];var p=[],y=r("{","}",A);if(!y)return A.split(",");var x=y.pre,E=y.body,w=y.post,P=x.split(",");P[P.length-1]+="{"+E+"}";var b=h(w);return w.length&&(P[P.length-1]+=b.shift(),P.push.apply(P,b)),p.push.apply(p,P),p}function a(A){return"{"+A+"}"}function d(A){return/^-?0\d/.test(A)}function f(A,p){return A<=p}function m(A,p){return A>=p}function v(A,p){var y=[],x=r("{","}",A);if(!x)return[A];var E=x.pre,w=x.post.length?v(x.post,!1):[""];if(/\$$/.test(x.pre))for(var P=0;P=0;if(!N&&!_)return x.post.match(/,.*\}/)?v(A=x.pre+"{"+x.body+c+x.post):[A];if(N)O=x.body.split(/\.\./);else if((O=h(x.body)).length===1&&(O=v(O[0],!1).map(a)).length===1)return w.map(function(hn){return x.pre+O[0]+hn});if(N){var C=l(O[0]),I=l(O[1]),V=Math.max(O[0].length,O[1].length),M=O.length==3?Math.abs(l(O[2])):1,L=f;I0){var de=new Array(fe+1).join("0");z=D<0?"-"+de+z.slice(1):de+z}}T.push(z)}}else{T=[];for(var at=0;at{function t(l){return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t(l)}function n(l){var o=typeof Map=="function"?new Map:void 0;return n=function(h){if(h===null||(a=h,Function.toString.call(a).indexOf("[native code]")===-1))return h;var a;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(h))return o.get(h);o.set(h,d)}function d(){return r(h,arguments,i(this).constructor)}return d.prototype=Object.create(h.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),s(d,h)},n(l)}function r(l,o,h){return r=(function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}})()?Reflect.construct:function(a,d,f){var m=[null];m.push.apply(m,d);var v=new(Function.bind.apply(a,m));return f&&s(v,f.prototype),v},r.apply(null,arguments)}function s(l,o){return s=Object.setPrototypeOf||function(h,a){return h.__proto__=a,h},s(l,o)}function i(l){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},i(l)}var c=(function(l){function o(h){var a;return(function(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")})(this,o),(a=(function(d,f){return!f||t(f)!=="object"&&typeof f!="function"?(function(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m})(d):f})(this,i(o).call(this,h))).name="ObjectPrototypeMutationError",a}return(function(h,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(a&&a.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),a&&s(h,a)})(o,l),o})(n(Error));function u(l,o){for(var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=o.split("."),d=a.length,f=function(A){var p=a[A];if(!l)return{v:void 0};if(p==="+"){if(Array.isArray(l))return{v:l.map(function(x,E){var w=a.slice(A+1);return w.length>0?u(x,w.join("."),h):h(l,E,a,A)})};var y=a.slice(0,A).join(".");throw new Error("Object at wildcard (".concat(y,") is not an array"))}l=h(l,p,a,A)},m=0;m2&&arguments[2]!==void 0?arguments[2]:{};if(t(l)!="object"||l===null||o===void 0)return!1;if(typeof o=="number")return o in l;try{var a=!1;return u(l,o,function(d,f,m,v){if(!g(m,v))return d&&d[f];a=h.own?d.hasOwnProperty(f):f in d}),a}catch{return!1}},hasOwn:function(l,o,h){return this.has(l,o,h||{own:!0})},isIn:function(l,o,h){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(t(l)!="object"||l===null||o===void 0)return!1;try{var d=!1,f=!1;return u(l,o,function(m,v,A,p){return d=d||m===h||!!m&&m[v]===h,f=g(A,p)&&t(m)==="object"&&v in m,m&&m[v]}),a.validPath?d&&f:d}catch{return!1}},ObjectPrototypeMutationError:c}},47:(e,t,n)=>{var r=n(410),s=function(l){return typeof l=="string"};function i(l,o){for(var h=[],a=0;a=-1&&!o;h--){var a=h>=0?arguments[h]:Et.cwd();if(!s(a))throw new TypeError("Arguments to path.resolve must be strings");a&&(l=a+"/"+l,o=a.charAt(0)==="/")}return(o?"/":"")+(l=i(l.split("/"),!o).join("/"))||"."},u.normalize=function(l){var o=u.isAbsolute(l),h=l.substr(-1)==="/";return(l=i(l.split("/"),!o).join("/"))||o||(l="."),l&&h&&(l+="/"),(o?"/":"")+l},u.isAbsolute=function(l){return l.charAt(0)==="/"},u.join=function(){for(var l="",o=0;o=0&&p[x]==="";x--);return y>x?[]:p.slice(y,x+1)}l=u.resolve(l).substr(1),o=u.resolve(o).substr(1);for(var a=h(l.split("/")),d=h(o.split("/")),f=Math.min(a.length,d.length),m=f,v=0;v{var n=Object.prototype.hasOwnProperty;function r(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function s(i){try{return encodeURIComponent(i)}catch{return null}}t.stringify=function(i,c){c=c||"";var u,g,l=[];for(g in typeof c!="string"&&(c="?"),i)if(n.call(i,g)){if((u=i[g])||u!=null&&!isNaN(u)||(u=""),g=s(g),u=s(u),g===null||u===null)continue;l.push(g+"="+u)}return l.length?c+l.join("&"):""},t.parse=function(i){for(var c,u=/([^=?#&]+)=?([^&]*)/g,g={};c=u.exec(i);){var l=r(c[1]),o=r(c[2]);l===null||o===null||l in g||(g[l]=o)}return g}},670:e=>{e.exports=function(t,n){if(n=n.split(":")[0],!(t=+t))return!1;switch(n){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}},494:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const r={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(s){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(i=Object.assign({},r,i),!s||typeof s!="string")return s;let c=s.trim();if(i.skipLike!==void 0&&i.skipLike.test(c))return s;if(i.hex&&t.test(c))return Number.parseInt(c,16);{const g=n.exec(c);if(g){const l=g[1],o=g[2];let h=((u=g[3])&&u.indexOf(".")!==-1&&((u=u.replace(/0+$/,""))==="."?u="0":u[0]==="."?u="0"+u:u[u.length-1]==="."&&(u=u.substr(0,u.length-1))),u);const a=g[4]||g[6];if(!i.leadingZeros&&o.length>0&&l&&c[2]!=="."||!i.leadingZeros&&o.length>0&&!l&&c[1]!==".")return s;{const d=Number(c),f=""+d;return f.search(/[eE]/)!==-1||a?i.eNotation?d:s:c.indexOf(".")!==-1?f==="0"&&h===""||f===h||l&&f==="-"+h?d:s:o?h===f||l+h===f?d:s:c===f||c===l+f?d:s}}return s}var u}},737:(e,t,n)=>{var r=n(670),s=n(647),i=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,c=/[\n\r\t]/g,u=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,g=/:\d+$/,l=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,o=/^[a-zA-Z]:/;function h(p){return(p||"").toString().replace(i,"")}var a=[["#","hash"],["?","query"],function(p,y){return m(y.protocol)?p.replace(/\\/g,"/"):p},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};function f(p){var y,x=(typeof window<"u"?window:typeof yt<"u"?yt:typeof self<"u"?self:{}).location||{},E={},w=typeof(p=p||x);if(p.protocol==="blob:")E=new A(unescape(p.pathname),{});else if(w==="string")for(y in E=new A(p,{}),d)delete E[y];else if(w==="object"){for(y in p)y in d||(E[y]=p[y]);E.slashes===void 0&&(E.slashes=u.test(p.href))}return E}function m(p){return p==="file:"||p==="ftp:"||p==="http:"||p==="https:"||p==="ws:"||p==="wss:"}function v(p,y){p=(p=h(p)).replace(c,""),y=y||{};var x,E=l.exec(p),w=E[1]?E[1].toLowerCase():"",P=!!E[2],b=!!E[3],O=0;return P?b?(x=E[2]+E[3]+E[4],O=E[2].length+E[3].length):(x=E[2]+E[4],O=E[2].length):b?(x=E[3]+E[4],O=E[3].length):x=E[4],w==="file:"?O>=2&&(x=x.slice(2)):m(w)?x=E[4]:w?P&&(x=x.slice(2)):O>=2&&m(y.protocol)&&(x=E[4]),{protocol:w,slashes:P||m(w),slashesCount:O,rest:x}}function A(p,y,x){if(p=(p=h(p)).replace(c,""),!(this instanceof A))return new A(p,y,x);var E,w,P,b,O,T,j=a.slice(),S=typeof y,N=this,_=0;for(S!=="object"&&S!=="string"&&(x=y,y=null),x&&typeof x!="function"&&(x=s.parse),E=!(w=v(p||"",y=f(y))).protocol&&!w.slashes,N.slashes=w.slashes||E&&y.slashes,N.protocol=w.protocol||y.protocol||"",p=w.rest,(w.protocol==="file:"&&(w.slashesCount!==2||o.test(p))||!w.slashes&&(w.protocol||w.slashesCount<2||!m(N.protocol)))&&(j[3]=[/(.*)/,"pathname"]);_{},388:()=>{},805:()=>{},345:()=>{},800:()=>{}},ye={};function $(e){var t=ye[e];if(t!==void 0)return t.exports;var n=ye[e]={id:e,loaded:!1,exports:{}};return xn[e].call(n.exports,n,n.exports,$),n.loaded=!0,n.exports}$.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return $.d(t,{a:t}),t},$.d=(e,t)=>{for(var n in t)$.o(t,n)&&!$.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},$.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var tt={};$.d(tt,{hT:()=>X,O4:()=>st,Kd:()=>Cn,YK:()=>_n,UU:()=>Dr,Gu:()=>Ve,ky:()=>Je,h4:()=>vt,ch:()=>Rt,hq:()=>ut,i5:()=>Ze});var An=$(737),En=$.n(An);function Dt(e){if(!qt(e))throw new Error("Parameter was not an error")}function qt(e){return!!e&&typeof e=="object"&&(t=e,Object.prototype.toString.call(t)==="[object Error]")||e instanceof Error;var t}class K extends Error{constructor(t,n){const r=[...arguments],{options:s,shortMessage:i}=(function(u){let g,l="";if(u.length===0)g={};else if(qt(u[0]))g={cause:u[0]},l=u.slice(1).join(" ")||"";else if(u[0]&&typeof u[0]=="object")g=Object.assign({},u[0]),l=u.slice(1).join(" ")||"";else{if(typeof u[0]!="string")throw new Error("Invalid arguments passed to Layerr");g={},l=l=u.join(" ")||""}return{options:g,shortMessage:l}})(r);let c=i;if(s.cause&&(c=`${c}: ${s.cause.message}`),super(c),this.message=c,s.name&&typeof s.name=="string"?this.name=s.name:this.name="Layerr",s.cause&&Object.defineProperty(this,"_cause",{value:s.cause}),Object.defineProperty(this,"_info",{value:{}}),s.info&&typeof s.info=="object"&&Object.assign(this._info,s.info),Error.captureStackTrace){const u=s.constructorOpt||this.constructor;Error.captureStackTrace(this,u)}}static cause(t){return Dt(t),t._cause&&qt(t._cause)?t._cause:null}static fullStack(t){Dt(t);const n=K.cause(t);return n?`${t.stack} caused by: ${K.fullStack(n)}`:t.stack??""}static info(t){Dt(t);const n={},r=K.cause(t);return r&&Object.assign(n,K.info(r)),t._info&&Object.assign(n,t._info),n}toString(){let t=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(t=`${t}: ${this.message}`),t}}var Nn=$(47),Ot=$.n(Nn);const we="__PATH_SEPARATOR_POSIX__",be="__PATH_SEPARATOR_WINDOWS__";function R(e){try{const t=e.replace(/\//g,we).replace(/\\\\/g,be);return encodeURIComponent(t).split(be).join("\\\\").split(we).join("/")}catch(t){throw new K(t,"Failed encoding path")}}function xe(e){return e.startsWith("/")?e:"/"+e}function mt(e){let t=e;return t[0]!=="/"&&(t="/"+t),/^.+\/$/.test(t)&&(t=t.substr(0,t.length-1)),t}function Pn(e){let t=new(En())(e).pathname;return t.length<=0&&(t="/"),mt(t)}function k(){for(var e=arguments.length,t=new Array(e),n=0;n1){var i=r.shift();r[0]=i+r[0]}r[0].match(/^file:\/\/\//)?r[0]=r[0].replace(/^([^/:]+):\/*/,"$1:///"):r[0]=r[0].replace(/^([^/:]+):\/*/,"$1://");for(var c=0;c0&&(u=u.replace(/^[\/]+/,"")),u=c0?"?":"")+l.join("&")})(typeof arguments[0]=="object"?arguments[0]:[].slice.call(arguments))})(t.reduce((r,s,i)=>((i===0||s!=="/"||s==="/"&&r[r.length-1]!=="/")&&r.push(s),r),[]))}var On=$(542),pt=$.n(On);const Tn="abcdef0123456789";function Ae(e,t){const n=e.url.replace("//",""),r=n.indexOf("/")==-1?"/":n.slice(n.indexOf("/")),s=e.method?e.method.toUpperCase():"GET",i=!!/(^|,)\s*auth\s*($|,)/.test(t.qop)&&"auth",c=`00000000${t.nc}`.slice(-8),u=(function(a,d,f,m,v,A,p){const y=p||pt()(`${d}:${f}:${m}`);return a&&a.toLowerCase()==="md5-sess"?pt()(`${y}:${v}:${A}`):y})(t.algorithm,t.username,t.realm,t.password,t.nonce,t.cnonce,t.ha1),g=pt()(`${s}:${r}`),l=i?pt()(`${u}:${t.nonce}:${c}:${t.cnonce}:${i}:${g}`):pt()(`${u}:${t.nonce}:${g}`),o={username:t.username,realm:t.realm,nonce:t.nonce,uri:r,qop:i,response:l,nc:c,cnonce:t.cnonce,algorithm:t.algorithm,opaque:t.opaque},h=[];for(const a in o)o[a]&&(a==="qop"||a==="nc"||a==="algorithm"?h.push(`${a}=${o[a]}`):h.push(`${a}="${o[a]}"`));return`Digest ${h.join(", ")}`}function Fe(e){return(e.headers&&e.headers.get("www-authenticate")||"").split(/\s/)[0].toLowerCase()==="digest"}var jn=$(101),Ue=$.n(jn);function Ee(e){return Ue().decode(e)}function Ne(e,t){var n;return`Basic ${n=`${e}:${t}`,Ue().encode(n)}`}const Tt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:typeof window<"u"?window:globalThis,Sn=Tt.fetch.bind(Tt),Cn=Tt.Request,_n=Tt.Response;let X=(function(e){return e.Auto="auto",e.Digest="digest",e.None="none",e.Password="password",e.Token="token",e})({}),st=(function(e){return e.DataTypeNoLength="data-type-no-length",e.InvalidAuthType="invalid-auth-type",e.InvalidOutputFormat="invalid-output-format",e.LinkUnsupportedAuthType="link-unsupported-auth",e.InvalidUpdateRange="invalid-update-range",e.NotSupported="not-supported",e})({});function Be(e,t,n,r,s){switch(e.authType){case X.Auto:t&&n&&(e.headers.Authorization=Ne(t,n));break;case X.Digest:e.digest=(function(c,u,g){return{username:c,password:u,ha1:g,nc:0,algorithm:"md5",hasDigestAuth:!1}})(t,n,s);break;case X.None:break;case X.Password:e.headers.Authorization=Ne(t,n);break;case X.Token:e.headers.Authorization=`${(i=r).token_type} ${i.access_token}`;break;default:throw new K({info:{code:st.InvalidAuthType}},`Invalid auth type: ${e.authType}`)}var i}$(345),$(800);const Pe="@@HOTPATCHER",$n=()=>{};function Mt(e){return{original:e,methods:[e],final:!1}}class In{constructor(){this._configuration={registry:{},getEmptyAction:"null"},this.__type__=Pe}get configuration(){return this._configuration}get getEmptyAction(){return this.configuration.getEmptyAction}set getEmptyAction(t){this.configuration.getEmptyAction=t}control(t){let n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!t||t.__type__!==Pe)throw new Error("Failed taking control of target HotPatcher instance: Invalid type or object");return Object.keys(t.configuration.registry).forEach(r=>{this.configuration.registry.hasOwnProperty(r)?n&&(this.configuration.registry[r]=Object.assign({},t.configuration.registry[r])):this.configuration.registry[r]=Object.assign({},t.configuration.registry[r])}),t._configuration=this.configuration,this}execute(t){const n=this.get(t)||$n;for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i0;)l=[s.shift().apply(o,l)];return l[0]}})(...n.methods)}isPatched(t){return!!this.configuration.registry[t]}patch(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{chain:s=!1}=r;if(this.configuration.registry[t]&&this.configuration.registry[t].final)throw new Error(`Failed patching '${t}': Method marked as being final`);if(typeof n!="function")throw new Error(`Failed patching '${t}': Provided method is not a function`);if(s)this.configuration.registry[t]?this.configuration.registry[t].methods.push(n):this.configuration.registry[t]=Mt(n);else if(this.isPatched(t)){const{original:i}=this.configuration.registry[t];this.configuration.registry[t]=Object.assign(Mt(n),{original:i})}else this.configuration.registry[t]=Mt(n);return this}patchInline(t,n){this.isPatched(t)||this.patch(t,n);for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i1?n-1:0),s=1;s{this.patch(t,i,{chain:!0})}),this}restore(t){if(!this.isPatched(t))throw new Error(`Failed restoring method: No method present for key: ${t}`);if(typeof this.configuration.registry[t].original!="function")throw new Error(`Failed restoring method: Original method not found or of invalid type for key: ${t}`);return this.configuration.registry[t].methods=[this.configuration.registry[t].original],this}setFinal(t){if(!this.configuration.registry.hasOwnProperty(t))throw new Error(`Failed marking '${t}' as final: No method found for key`);return this.configuration.registry[t].final=!0,this}}let Ft=null;function Ve(){return Ft||(Ft=new In),Ft}function jt(e){return(function(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let n=t;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n})(e)?Object.assign({},e):Object.setPrototypeOf(Object.assign({},e),Object.getPrototypeOf(e))}function Oe(){for(var e=arguments.length,t=new Array(e),n=0;n0;){const i=s.shift();r=r?ze(r,i):jt(i)}return r}function ze(e,t){const n=jt(e);return Object.keys(t).forEach(r=>{n.hasOwnProperty(r)?Array.isArray(t[r])?n[r]=Array.isArray(n[r])?[...n[r],...t[r]]:[...t[r]]:typeof t[r]=="object"&&t[r]?n[r]=typeof n[r]=="object"&&n[r]?ze(n[r],t[r]):jt(t[r]):n[r]=t[r]:n[r]=t[r]}),n}function Rn(e){const t={};for(const n of e.keys())t[n]=e.get(n);return t}function Gt(){for(var e=arguments.length,t=new Array(e),n=0;n(Object.keys(i).forEach(c=>{const u=c.toLowerCase();r.hasOwnProperty(u)?s[r[u]]=i[c]:(r[u]=c,s[c]=i[c])}),s),{})}$(805);const kn=typeof ArrayBuffer=="function",{toString:Ln}=Object.prototype;function We(e){return kn&&(e instanceof ArrayBuffer||Ln.call(e)==="[object ArrayBuffer]")}function qe(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function te(e){return function(){for(var t=[],n=0;nt.patchInline("fetch",Sn,n.url,(function(r){let s={};const i={method:r.method};if(r.headers&&(s=Gt(s,r.headers)),r.data!==void 0){const[c,u]=(function(g){if(typeof g=="string")return[g,{}];if(qe(g))return[g,{}];if(We(g))return[g,{}];if(g&&typeof g=="object")return[JSON.stringify(g),{"content-type":"application/json"}];throw new Error("Unable to convert request body: Unexpected body type: "+typeof g)})(r.data);i.body=c,s=Gt(s,u)}return r.signal&&(i.signal=r.signal),r.withCredentials&&(i.credentials="include"),i.headers=s,i})(n)),e)}var Mn=$(285);const Ct=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},Fn={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ft=e=>e.replace(/[[\]\\-]/g,"\\$&"),Te=e=>e.join(""),Un=(e,t)=>{const n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");const r=[],s=[];let i=n+1,c=!1,u=!1,g=!1,l=!1,o=n,h="";t:for(;ih?r.push(ft(h)+"-"+ft(m)):m===h&&r.push(ft(m)),h="",i++):e.startsWith("-]",i+1)?(r.push(ft(m+"-")),i+=2):e.startsWith("-",i+1)?(h=m,i+=2):(r.push(ft(m)),i++)}else g=!0,i++}else l=!0,i++}if(o1&&arguments[1]!==void 0?arguments[1]:{};return t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")},Bn=new Set(["!","?","+","*","@"]),je=e=>Bn.has(e),Ut="(?!\\.)",Vn=new Set(["[","."]),zn=new Set(["..","."]),Wn=new Set("().*{}+?[]^$\\!"),ee="[^/]",Se=ee+"*?",Ce=ee+"+?";class H{type;#n;#r;#o=!1;#t=[];#e;#i;#u;#a=!1;#s;#c;#h=!1;constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.type=t,t&&(this.#r=!0),this.#e=n,this.#n=this.#e?this.#e.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,t!=="!"||this.#n.#a||this.#u.push(this),this.#i=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(const t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#c=this.#t.map(t=>String(t)).join("")}#f(){if(this!==this.#n)throw new Error("should only call on root");if(this.#a)return this;let t;for(this.toString(),this.#a=!0;t=this.#u.pop();){if(t.type!=="!")continue;let n=t,r=n.#e;for(;r;){for(let s=n.#i+1;!r.type&&stypeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#a&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#n===this)return!0;if(!this.#e?.isStart())return!1;if(this.#i===0)return!0;const t=this.#e;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:{};const r=new H(null,void 0,n);return H.#l(t,r,0,n),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();const t=this.toString(),[n,r,s,i]=this.toRegExpSource();if(!(s||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return r;const c=(this.#s.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${n}$`,c),{_src:n,_glob:t})}get options(){return this.#s}toRegExpSource(t){const n=t??!!this.#s.dot;if(this.#n===this&&this.#f(),!this.type){const g=this.isStart()&&this.isEnd(),l=this.#t.map(a=>{const[d,f,m,v]=typeof a=="string"?H.#d(a,this.#r,g):a.toRegExpSource(t);return this.#r=this.#r||m,this.#o=this.#o||v,d}).join("");let o="";if(this.isStart()&&typeof this.#t[0]=="string"&&(this.#t.length!==1||!zn.has(this.#t[0]))){const a=Vn,d=n&&a.has(l.charAt(0))||l.startsWith("\\.")&&a.has(l.charAt(2))||l.startsWith("\\.\\.")&&a.has(l.charAt(4)),f=!n&&!t&&a.has(l.charAt(0));o=d?"(?!(?:^|/)\\.\\.?(?:$|/))":f?Ut:""}let h="";return this.isEnd()&&this.#n.#a&&this.#e?.type==="!"&&(h="(?:$|\\/)"),[o+l+h,dt(l),this.#r=!!this.#r,this.#o]}const r=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:";let i=this.#p(n);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){const g=this.toString();return this.#t=[g],this.type=null,this.#r=void 0,[g,dt(this.toString()),!1,!1]}let c=!r||t||n?"":this.#p(!0);c===i&&(c=""),c&&(i=`(?:${i})(?:${c})*?`);let u="";return u=this.type==="!"&&this.#h?(this.isStart()&&!n?Ut:"")+Ce:s+i+(this.type==="!"?"))"+(!this.isStart()||n||t?"":Ut)+Se+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&c?")":this.type==="*"&&c?")?":`)${this.type}`),[u,dt(i),this.#r=!!this.#r,this.#o]}#p(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");const[r,s,i,c]=n.toRegExpSource(t);return this.#o=this.#o||c,r}).filter(n=>!(this.isStart()&&this.isEnd()&&!n)).join("|")}static#d(t,n){let r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],s=!1,i="",c=!1;for(let u=0;u2&&arguments[2]!==void 0?arguments[2]:{};return Ct(t),!(!n.nocomment&&t.charAt(0)==="#")&&new _t(t,n).match(e)},qn=/^\*+([^+@!?\*\[\(]*)$/,Gn=e=>t=>!t.startsWith(".")&&t.endsWith(e),Hn=e=>t=>t.endsWith(e),Xn=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Yn=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Kn=/^\*+\.\*+$/,Jn=e=>!e.startsWith(".")&&e.includes("."),Zn=e=>e!=="."&&e!==".."&&e.includes("."),Qn=/^\.\*+$/,tr=e=>e!=="."&&e!==".."&&e.startsWith("."),er=/^\*+$/,nr=e=>e.length!==0&&!e.startsWith("."),rr=e=>e.length!==0&&e!=="."&&e!=="..",sr=/^\?+([^+@!?\*\[\(]*)?$/,or=e=>{let[t,n=""]=e;const r=He([t]);return n?(n=n.toLowerCase(),s=>r(s)&&s.toLowerCase().endsWith(n)):r},ir=e=>{let[t,n=""]=e;const r=Xe([t]);return n?(n=n.toLowerCase(),s=>r(s)&&s.toLowerCase().endsWith(n)):r},ar=e=>{let[t,n=""]=e;const r=Xe([t]);return n?s=>r(s)&&s.endsWith(n):r},ur=e=>{let[t,n=""]=e;const r=He([t]);return n?s=>r(s)&&s.endsWith(n):r},He=e=>{let[t]=e;const n=t.length;return r=>r.length===n&&!r.startsWith(".")},Xe=e=>{let[t]=e;const n=t.length;return r=>r.length===n&&r!=="."&&r!==".."},Ye=typeof Et=="object"&&Et?typeof Lt=="object"&&Lt&&Lt.__MINIMATCH_TESTING_PLATFORM__||Et.platform:"posix";G.sep=Ye==="win32"?"\\":"/";const Q=Symbol("globstar **");G.GLOBSTAR=Q,G.filter=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n=>G(n,e,t)};const Z=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.assign({},e,t)};G.defaults=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return G;const t=G;return Object.assign(function(n,r){return t(n,r,Z(e,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{}))},{Minimatch:class extends t.Minimatch{constructor(n){super(n,Z(e,arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}))}static defaults(n){return t.defaults(Z(e,n)).Minimatch}},AST:class extends t.AST{constructor(n,r){super(n,r,Z(e,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{}))}static fromGlob(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.AST.fromGlob(n,Z(e,r))}},unescape:function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.unescape(n,Z(e,r))},escape:function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.escape(n,Z(e,r))},filter:function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.filter(n,Z(e,r))},defaults:n=>t.defaults(Z(e,n)),makeRe:function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.makeRe(n,Z(e,r))},braceExpand:function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.braceExpand(n,Z(e,r))},match:function(n,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t.match(n,r,Z(e,s))},sep:t.sep,GLOBSTAR:Q})};const Ke=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ct(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Mn(e)};G.braceExpand=Ke,G.makeRe=function(e){return new _t(e,arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).makeRe()},G.match=function(e,t){const n=new _t(t,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{});return e=e.filter(r=>n.match(r)),n.options.nonull&&!e.length&&e.push(t),e};const _e=/[?*]|[+@!]\(.*?\)|\[|\]/;class _t{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ct(t),n=n||{},this.options=n,this.pattern=t,this.platform=n.platform||Ye,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const n of t)if(typeof n!="string")return!0;return!1}debug(){}make(){const t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#")return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=function(){return console.error(...arguments)}),this.debug(this.pattern,this.globSet);const r=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let s=this.globParts.map((i,c,u)=>{if(this.isWindows&&this.windowsNoMagicRoot){const g=!(i[0]!==""||i[1]!==""||i[2]!=="?"&&_e.test(i[2])||_e.test(i[3])),l=/^[a-z]:/i.test(i[0]);if(g)return[...i.slice(0,4),...i.slice(4).map(o=>this.parse(o))];if(l)return[i[0],...i.slice(1).map(o=>this.parse(o))]}return i.map(g=>this.parse(g))});if(this.debug(this.pattern,s),this.set=s.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=n>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let s=r;for(;n[s+1]==="**";)s++;s!==r&&n.splice(r,s-r)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((r,s)=>{const i=r[r.length-1];return s==="**"&&i==="**"?r:s===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(r.pop(),r):(r.push(s),r)},[])).length===0?[""]:n)}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let s=1;ss&&r.splice(s+1,c-s);let u=r[s+1];const g=r[s+2],l=r[s+3];if(u!==".."||!g||g==="."||g===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(s,1);const o=r.slice(0);o[s]="**",t.push(o),s--}if(!this.preserveMultipleSlashes){for(let c=1;cn.length)}partsMatch(t,n){let r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],s=0,i=0,c=[],u="";for(;s2&&arguments[2]!==void 0&&arguments[2];const s=this.options;if(this.isWindows){const m=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),v=!m&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),A=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=v?3:m?0:void 0,y=!A&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])?3:A?0:void 0;if(typeof p=="number"&&typeof y=="number"){const[x,E]=[t[p],n[y]];x.toLowerCase()===E.toLowerCase()&&(n[y]=x,y>p?n=n.slice(y):p>y&&(t=t.slice(p)))}}const{optimizationLevel:i=1}=this.options;i>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:n}),this.debug("matchOne",t.length,n.length);for(var c=0,u=0,g=t.length,l=n.length;c>> no match, partial?`,t,a,n,d),a!==g))}let m;if(typeof o=="string"?(m=h===o,this.debug("string match",o,h,m)):(m=o.test(h),this.debug("pattern match",o,h,m)),!m)return!1}if(c===g&&u===l)return!0;if(c===g)return r;if(u===l)return c===g-1&&t[c]==="";throw new Error("wtf?")}braceExpand(){return Ke(this.pattern,this.options)}parse(t){Ct(t);const n=this.options;if(t==="**")return Q;if(t==="")return"";let r,s=null;(r=t.match(er))?s=n.dot?rr:nr:(r=t.match(qn))?s=(n.nocase?n.dot?Yn:Xn:n.dot?Hn:Gn)(r[1]):(r=t.match(sr))?s=(n.nocase?n.dot?ir:or:n.dot?ar:ur)(r):(r=t.match(Kn))?s=n.dot?Zn:Jn:(r=t.match(Qn))&&(s=tr);const i=H.fromGlob(t,this.options).toMMPattern();return s&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:s}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const n=this.options,r=n.noglobstar?"[^/]*?":n.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(n.nocase?["i"]:[]);let i=t.map(g=>{const l=g.map(o=>{if(o instanceof RegExp)for(const h of o.flags.split(""))s.add(h);return typeof o=="string"?o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):o===Q?Q:o._src});return l.forEach((o,h)=>{const a=l[h+1],d=l[h-1];o===Q&&d!==Q&&(d===void 0?a!==void 0&&a!==Q?l[h+1]="(?:\\/|"+r+"\\/)?"+a:l[h]=r:a===void 0?l[h-1]=d+"(?:\\/|"+r+")?":a!==Q&&(l[h-1]=d+"(?:\\/|\\/"+r+"\\/)"+a,l[h+1]=Q))}),l.filter(o=>o!==Q).join("/")}).join("|");const[c,u]=t.length>1?["(?:",")"]:["",""];i="^"+c+i+u+"$",this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.partial;if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;const r=this.options;this.isWindows&&(t=t.split("\\").join("/"));const s=this.slashSplit(t);this.debug(this.pattern,"split",s);const i=this.set;this.debug(this.pattern,"set",i);let c=s[s.length-1];if(!c)for(let u=s.length-2;!c&&u>=0;u--)c=s[u];for(let u=0;u1&&arguments[1]!==void 0?arguments[1]:""}Invalid response: ${e.status} ${e.statusText}`);return t.status=e.status,t.response=e,t}function B(e,t){const{status:n}=t;if(n===401&&e.digest)return t;if(n>=400)throw ne(t);return t}function ut(e,t){return arguments.length>2&&arguments[2]!==void 0&&arguments[2]?{data:t,headers:e.headers?Rn(e.headers):{},status:e.status,statusText:e.statusText}:t}G.AST=H,G.Minimatch=_t,G.escape=function(e){let{windowsPathsNoEscape:t=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&")},G.unescape=dt;const cr=($e=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=U({url:k(e.remoteURL,R(t)),method:"COPY",headers:{Destination:k(e.remoteURL,R(n)),Overwrite:r.overwrite===!1?"F":"T",Depth:r.shallow?"0":"infinity"}},e,r);return c=function(u){B(e,u)},(i=F(s,e))&&i.then||(i=Promise.resolve(i)),c?i.then(c):i;var i,c},function(){for(var e=[],t=0;t2&&arguments[2]!==void 0?arguments[2]:ct.Original;const r=rt().get(e,t);return n==="array"&&Array.isArray(r)===!1?[r]:n==="object"&&Array.isArray(r)?r[0]:r}function vt(e){return new Promise(t=>{t((function(n){const{multistatus:r}=n;if(r==="")return{multistatus:{response:[]}};if(!r)throw new Error("Invalid response: No root multistatus found");const s={multistatus:Array.isArray(r)?r[0]:r};return rt().set(s,"multistatus.response",xt(s,"multistatus.response",ct.Array)),rt().set(s,"multistatus.response",rt().get(s,"multistatus.response").map(i=>(function(c){const u=Object.assign({},c);return u.status?rt().set(u,"status",xt(u,"status",ct.Object)):(rt().set(u,"propstat",xt(u,"propstat",ct.Object)),rt().set(u,"propstat.prop",xt(u,"propstat.prop",ct.Object))),u})(i))),s})(new re.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",textNodeName:"text",ignoreAttributes:!1,removeNSPrefix:!0,numberParseOptions:{hex:!0,leadingZeros:!1},attributeValueProcessor:(n,r,s)=>r==="true"||r==="false"?r==="true":r,tagValueProcessor(n,r,s){if(!s.endsWith("propstat.prop.displayname"))return r}}).parse(e)))})}function Rt(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2];const{getlastmodified:r=null,getcontentlength:s="0",resourcetype:i=null,getcontenttype:c=null,getetag:u=null}=e,g=i&&typeof i=="object"&&i.collection!==void 0?"directory":"file",l={filename:t,basename:Ot().basename(t),lastmod:r,size:parseInt(s,10),type:g,etag:typeof u=="string"?u.replace(/"/g,""):null};return g==="file"&&(l.mime=c&&typeof c=="string"?c.split(";")[0]:""),n&&(e.displayname!==void 0&&(e.displayname=String(e.displayname)),l.props=e),l}function Je(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=null;try{e.multistatus.response[0].propstat&&(r=e.multistatus.response[0])}catch{}if(!r)throw new Error("Failed getting item stat: bad response");const{propstat:{prop:s,status:i}}=r,[c,u,g]=i.split(" ",3),l=parseInt(u,10);if(l>=400){const o=new Error(`Invalid response: ${l} ${g}`);throw o.status=l,o}return Rt(s,mt(t),n)}function Ze(e){switch(String(e)){case"-3":return"unlimited";case"-2":case"-1":return"unknown";default:return parseInt(String(e),10)}}function Bt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const se=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const{details:r=!1}=n,s=U({url:k(e.remoteURL,R(t)),method:"PROPFIND",headers:{Accept:"text/plain,application/xml",Depth:"0"}},e,n);return Bt(F(s,e),function(i){return B(e,i),Bt(i.text(),function(c){return Bt(vt(c),function(u){const g=Je(u,t,r);return ut(i,g,r)})})})});function Qe(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const hr=tn(function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=(function(i){if(!i||i==="/")return[];let c=i;const u=[];do u.push(c),c=Ot().dirname(c);while(c&&c!=="/");return u})(mt(t));r.sort((i,c)=>i.length>c.length?1:c.length>i.length?-1:0);let s=!1;return(function(i,c,u){if(typeof i[Re]=="function"){let m=function(v){try{for(;!(g=h.next()).done;)if((v=c(g.value))&&v.then){if(!ke(v))return void v.then(m,o||(o=Y.bind(null,l=new lt,2)));v=v.v}l?Y(l,1,v):l=v}catch(A){Y(l||(l=new lt),2,A)}};var g,l,o,h=i[Re]();if(m(),h.return){var a=function(v){try{g.done||h.return()}catch{}return v};if(l&&l.then)return l.then(a,function(v){throw a(v)});a()}return l}if(!("length"in i))throw new TypeError("Object is not iterable");for(var d=[],f=0;f2&&arguments[2]!==void 0?arguments[2]:{};if(n.recursive===!0)return hr(e,t,n);const r=U({url:k(e.remoteURL,(s=R(t),s.endsWith("/")?s:s+"/")),method:"MKCOL"},e,n);var s;return Qe(F(r,e),function(i){B(e,i)})});var fr=$(388),Le=$.n(fr);const dr=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const r={};if(typeof n.range=="object"&&typeof n.range.start=="number"){let u=`bytes=${n.range.start}-`;typeof n.range.end=="number"&&(u=`${u}${n.range.end}`),r.Range=u}const s=U({url:k(e.remoteURL,R(t)),method:"GET",headers:r},e,n);return c=function(u){if(B(e,u),r.Range&&u.status!==206){const g=new Error(`Invalid response code for partial request: ${u.status}`);throw g.status=u.status,g}return n.callback&&setTimeout(()=>{n.callback(u)},0),u.body},(i=F(s,e))&&i.then||(i=Promise.resolve(i)),c?i.then(c):i;var i,c}),gr=()=>{},mr=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const r=U({url:k(e.remoteURL,R(t)),method:"DELETE"},e,n);return i=function(c){B(e,c)},(s=F(r,e))&&s.then||(s=Promise.resolve(s)),i?s.then(i):s;var s,i}),yr=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};return(function(r,s){try{var i=(c=se(e,t,n),u=function(){return!0},g?u?u(c):c:(c&&c.then||(c=Promise.resolve(c)),u?c.then(u):c))}catch(l){return s(l)}var c,u,g;return i&&i.then?i.then(void 0,s):i})(0,function(r){if(r.status===404)return!1;throw r})});function Vt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const wr=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const r=U({url:k(e.remoteURL,R(t),"/"),method:"PROPFIND",headers:{Accept:"text/plain,application/xml",Depth:n.deep?"infinity":"1"}},e,n);return Vt(F(r,e),function(s){return B(e,s),Vt(s.text(),function(i){if(!i)throw new Error("Failed parsing directory contents: Empty response");return Vt(vt(i),function(c){const u=xe(t);let g=(function(l,o,h){let a=arguments.length>3&&arguments[3]!==void 0&&arguments[3],d=arguments.length>4&&arguments[4]!==void 0&&arguments[4];const f=Ot().join(o,"/"),{multistatus:{response:m}}=l,v=m.map(A=>{const p=(function(x){try{return x.replace(/^https?:\/\/[^\/]+/,"")}catch(E){throw new K(E,"Failed normalising HREF")}})(A.href),{propstat:{prop:y}}=A;return Rt(y,f==="/"?decodeURIComponent(mt(p)):mt(Ot().relative(decodeURIComponent(f),decodeURIComponent(p))),a)});return d?v:v.filter(A=>A.basename&&(A.type==="file"||A.filename!==h.replace(/\/$/,"")))})(c,xe(e.remoteBasePath||e.remotePath),u,n.details,n.includeSelf);return n.glob&&(g=(function(l,o){return l.filter(h=>G(h.filename,o,{matchBase:!0}))})(g,n.glob)),ut(s,g,n.details)})})})});function oe(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const r=U({url:k(e.remoteURL,R(t)),method:"GET",headers:{Accept:"text/plain"},transformResponse:[Er]},e,n);return $t(F(r,e),function(s){return B(e,s),$t(s.text(),function(i){return ut(s,i,n.details)})})});function $t(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const xr=oe(function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=U({url:k(e.remoteURL,R(t)),method:"GET"},e,n);return $t(F(r,e),function(s){let i;return B(e,s),(function(c,u){var g=c();return g&&g.then?g.then(u):u()})(function(){return $t(s.arrayBuffer(),function(c){i=c})},function(){return ut(s,i,n.details)})})}),Ar=oe(function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{format:r="binary"}=n;if(r!=="binary"&&r!=="text")throw new K({info:{code:st.InvalidOutputFormat}},`Invalid output format: ${r}`);return r==="text"?br(e,t,n):xr(e,t,n)}),Er=e=>e;function Nr(e){return new re.XMLBuilder({attributeNamePrefix:"@_",format:!0,ignoreAttributes:!1,suppressEmptyNode:!0}).build(en({lockinfo:{"@_xmlns:d":"DAV:",lockscope:{exclusive:{}},locktype:{write:{}},owner:{href:e}}},"d"))}function en(e,t){const n={...e};for(const r in n)n.hasOwnProperty(r)&&(n[r]&&typeof n[r]=="object"&&r.indexOf(":")===-1?(n[`${t}:${r}`]=en(n[r],t),delete n[r]):/^@_/.test(r)===!1&&(n[`${t}:${r}`]=n[r],delete n[r]));return n}function Yt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function nn(e){return function(){for(var t=[],n=0;n3&&arguments[3]!==void 0?arguments[3]:{};const s=U({url:k(e.remoteURL,R(t)),method:"UNLOCK",headers:{"Lock-Token":n}},e,r);return Yt(F(s,e),function(i){if(B(e,i),i.status!==204&&i.status!==200)throw ne(i)})}),Or=nn(function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{refreshToken:r,timeout:s=Tr}=n,i={Accept:"text/plain,application/xml",Timeout:s};r&&(i.If=r);const c=U({url:k(e.remoteURL,R(t)),method:"LOCK",headers:i,data:Nr(e.contactHref)},e,n);return Yt(F(c,e),function(u){return B(e,u),Yt(u.text(),function(g){const l=(a=g,new re.XMLParser({removeNSPrefix:!0,parseAttributeValue:!0,parseTagValue:!0}).parse(a)),o=rt().get(l,"prop.lockdiscovery.activelock.locktoken.href"),h=rt().get(l,"prop.lockdiscovery.activelock.timeout");var a;if(!o)throw ne(u,"No lock token received: ");return{token:o,serverTimeout:h}})})}),Tr="Infinite, Second-4100000000";function zt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const jr=(function(e){return function(){for(var t=[],n=0;n1&&arguments[1]!==void 0?arguments[1]:{};const n=t.path||"/",r=U({url:k(e.remoteURL,n),method:"PROPFIND",headers:{Accept:"text/plain,application/xml",Depth:"0"}},e,t);return zt(F(r,e),function(s){return B(e,s),zt(s.text(),function(i){return zt(vt(i),function(c){const u=(function(g){try{const[l]=g.multistatus.response,{propstat:{prop:{"quota-used-bytes":o,"quota-available-bytes":h}}}=l;return o!==void 0&&h!==void 0?{used:parseInt(String(o),10),available:Ze(h)}:null}catch{}return null})(c);return ut(s,u,t.details)})})})});function Wt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const Sr=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const{details:r=!1}=n,s=U({url:k(e.remoteURL,R(t)),method:"SEARCH",headers:{Accept:"text/plain,application/xml","Content-Type":e.headers["Content-Type"]||"application/xml; charset=utf-8"}},e,n);return Wt(F(s,e),function(i){return B(e,i),Wt(i.text(),function(c){return Wt(vt(c),function(u){const g=(function(l,o,h){const a={truncated:!1,results:[]};return a.truncated=l.multistatus.response.some(d=>(d.status||d.propstat?.status).split(" ",3)?.[1]==="507"&&d.href.replace(/\/$/,"").endsWith(R(o).replace(/\/$/,""))),l.multistatus.response.forEach(d=>{if(d.propstat===void 0)return;const f=d.href.split("/").map(decodeURIComponent).join("/");a.results.push(Rt(d.propstat.prop,f,h))}),a})(u,t,r);return ut(i,g,r)})})})}),Cr=(function(e){return function(){for(var t=[],n=0;n3&&arguments[3]!==void 0?arguments[3]:{};const s=U({url:k(e.remoteURL,R(t)),method:"MOVE",headers:{Destination:k(e.remoteURL,R(n)),Overwrite:r.overwrite===!1?"F":"T"}},e,r);return c=function(u){B(e,u)},(i=F(s,e))&&i.then||(i=Promise.resolve(i)),c?i.then(c):i;var i,c});var _r=$(172);const $r=(function(e){return function(){for(var t=[],n=0;n3&&arguments[3]!==void 0?arguments[3]:{};const{contentLength:s=!0,overwrite:i=!0}=r,c={"Content-Type":"application/octet-stream"};s===!1||(c["Content-Length"]=typeof s=="number"?`${s}`:`${(function(o){if(We(o))return o.byteLength;if(qe(o))return o.length;if(typeof o=="string")return(0,_r.d)(o);throw new K({info:{code:st.DataTypeNoLength}},"Cannot calculate data length: Invalid type")})(n)}`),i||(c["If-None-Match"]="*");const u=U({url:k(e.remoteURL,R(t)),method:"PUT",headers:c,data:n},e,r);return l=function(o){try{B(e,o)}catch(h){const a=h;if(a.status!==412||i)throw a;return!1}return!0},(g=F(u,e))&&g.then||(g=Promise.resolve(g)),l?g.then(l):g;var g,l}),rn=(function(e){return function(){for(var t=[],n=0;n2&&arguments[2]!==void 0?arguments[2]:{};const r=U({url:k(e.remoteURL,R(t)),method:"OPTIONS"},e,n);return i=function(c){try{B(e,c)}catch(u){throw u}return{compliance:(c.headers.get("DAV")??"").split(",").map(u=>u.trim()),server:c.headers.get("Server")??""}},(s=F(r,e))&&s.then||(s=Promise.resolve(s)),i?s.then(i):s;var s,i});function gt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const Ir=ie(function(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(n>r||n<0)throw new K({info:{code:st.InvalidUpdateRange}},`Invalid update range ${n} for partial update`);const c={"Content-Type":"application/octet-stream","Content-Length":""+(r-n+1),"Content-Range":`bytes ${n}-${r}/*`},u=U({url:k(e.remoteURL,R(t)),method:"PUT",headers:c,data:s},e,i);return gt(F(u,e),function(g){B(e,g)})});function De(e,t){var n=e();return n&&n.then?n.then(t):t(n)}const Rr=ie(function(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(n>r||n<0)throw new K({info:{code:st.InvalidUpdateRange}},`Invalid update range ${n} for partial update`);const c={"Content-Type":"application/x-sabredav-partialupdate","Content-Length":""+(r-n+1),"X-Update-Range":`bytes=${n}-${r}`},u=U({url:k(e.remoteURL,R(t)),method:"PATCH",headers:c,data:s},e,i);return gt(F(u,e),function(g){B(e,g)})});function ie(e){return function(){for(var t=[],n=0;n5&&arguments[5]!==void 0?arguments[5]:{};return gt(rn(e,t,i),function(c){let u=!1;return De(function(){if(c.compliance.includes("sabredav-partialupdate"))return gt(Rr(e,t,n,r,s,i),function(g){return u=!0,g})},function(g){let l=!1;return u?g:De(function(){if(c.server.includes("Apache")&&c.compliance.includes(""))return gt(Ir(e,t,n,r,s,i),function(o){return l=!0,o})},function(o){if(l)return o;throw new K({info:{code:st.NotSupported}},"Not supported")})})})}),Lr="https://github.com/perry-mitchell/webdav-client/blob/master/LOCK_CONTACT.md";function Dr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{authType:n=null,remoteBasePath:r,contactHref:s=Lr,ha1:i,headers:c={},httpAgent:u,httpsAgent:g,password:l,token:o,username:h,withCredentials:a}=t;let d=n;d||(d=h||l?X.Password:X.None);const f={authType:d,remoteBasePath:r,contactHref:s,ha1:i,headers:Object.assign({},c),httpAgent:u,httpsAgent:g,password:l,remotePath:Pn(e),remoteURL:e,token:o,username:h,withCredentials:a};return Be(f,h,l,o,i),{copyFile:(m,v,A)=>cr(f,m,v,A),createDirectory:(m,v)=>Xt(f,m,v),createReadStream:(m,v)=>(function(A,p){let y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const x=new(Le()).PassThrough;return dr(A,p,y).then(E=>{E.pipe(x)}).catch(E=>{x.emit("error",E)}),x})(f,m,v),createWriteStream:(m,v,A)=>(function(p,y){let x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments.length>3&&arguments[3]!==void 0?arguments[3]:gr;const w=new(Le()).PassThrough,P={};x.overwrite===!1&&(P["If-None-Match"]="*");const b=U({url:k(p.remoteURL,R(y)),method:"PUT",headers:P,data:w,maxRedirects:0},p,x);return F(b,p).then(O=>B(p,O)).then(O=>{setTimeout(()=>{E(O)},0)}).catch(O=>{w.emit("error",O)}),w})(f,m,v,A),customRequest:(m,v)=>mr(f,m,v),deleteFile:(m,v)=>vr(f,m,v),exists:(m,v)=>yr(f,m,v),getDirectoryContents:(m,v)=>wr(f,m,v),getFileContents:(m,v)=>Ar(f,m,v),getFileDownloadLink:m=>(function(v,A){let p=k(v.remoteURL,R(A));const y=/^https:/i.test(p)?"https":"http";switch(v.authType){case X.None:break;case X.Password:{const x=Ee(v.headers.Authorization.replace(/^Basic /i,"").trim());p=p.replace(/^https?:\/\//,`${y}://${x}@`);break}default:throw new K({info:{code:st.LinkUnsupportedAuthType}},`Unsupported auth type for file link: ${v.authType}`)}return p})(f,m),getFileUploadLink:m=>(function(v,A){let p=`${k(v.remoteURL,R(A))}?Content-Type=application/octet-stream`;const y=/^https:/i.test(p)?"https":"http";switch(v.authType){case X.None:break;case X.Password:{const x=Ee(v.headers.Authorization.replace(/^Basic /i,"").trim());p=p.replace(/^https?:\/\//,`${y}://${x}@`);break}default:throw new K({info:{code:st.LinkUnsupportedAuthType}},`Unsupported auth type for file link: ${v.authType}`)}return p})(f,m),getHeaders:()=>Object.assign({},f.headers),getQuota:m=>jr(f,m),lock:(m,v)=>Or(f,m,v),moveFile:(m,v,A)=>Cr(f,m,v,A),putFileContents:(m,v,A)=>$r(f,m,v,A),partialUpdateFileContents:(m,v,A,p,y)=>kr(f,m,v,A,p,y),getDAVCompliance:m=>rn(f,m),search:(m,v)=>Sr(f,m,v),setHeaders:m=>{f.headers=Object.assign({},m)},stat:(m,v)=>se(f,m,v),unlock:(m,v,A)=>Pr(f,m,v,A)}}tt.hT,tt.O4,tt.Kd,tt.YK;var Mr=tt.UU,Fr=tt.Gu;tt.ky,tt.h4,tt.ch,tt.hq,tt.i5;function Ur(e){return e&&e.split("/").map(encodeURIComponent).join("/")}function sn(e,t){return e=e.replace(/\\/g,"/").replace(/\/+$/g,"").replace(/.*\//,""),e}function At(e){e=e.replaceAll(/\\/g,"/");const t=e.split("/");return t.length<=1?".":(t.pop(),t.length===1&&t[0]===""?"/":t.join("/"))}function Br(e){const t=sn(e),n=t.lastIndexOf(".");return n>0?t.substring(n):""}function Vr(...e){if(arguments.length<1)return"";const t=e.filter(g=>g.length>0);if(t.length<1)return"";const n=t[t.length-1],r=t[0].charAt(0)==="/",s=n.charAt(n.length-1)==="/",i=t.reduce((g,l)=>g.concat(l.split("/")),[]);let c=!r;const u=i.reduce((g,l)=>l===""?g:c?(c=!1,g+l):g+"/"+l,"");return s?u+"/":u}const Pt=pn().setApp("@f7cloud/files").detectUser().build();var ae=(e=>(e.Folder="folder",e.File="file",e))(ae||{}),et=(e=>(e[e.NONE=0]="NONE",e[e.CREATE=4]="CREATE",e[e.READ=1]="READ",e[e.UPDATE=2]="UPDATE",e[e.DELETE=8]="DELETE",e[e.SHARE=16]="SHARE",e[e.ALL=31]="ALL",e))(et||{});const on=function(e,t){return e.match(t)!==null},ot=(e,t)=>{if(e.id&&typeof e.id!="number")throw new Error("Invalid id type of value");if(!e.source)throw new Error("Missing mandatory source");try{new URL(e.source)}catch{throw new Error("Invalid source format, source must be a valid URL")}if(!e.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(e.displayname&&typeof e.displayname!="string")throw new Error("Invalid displayname type");if(e.mtime&&!(e.mtime instanceof Date))throw new Error("Invalid mtime type");if(e.crtime&&!(e.crtime instanceof Date))throw new Error("Invalid crtime type");if(!e.mime||typeof e.mime!="string"||!e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in e&&typeof e.size!="number"&&e.size!==void 0)throw new Error("Invalid size type");if("permissions"in e&&e.permissions!==void 0&&!(typeof e.permissions=="number"&&e.permissions>=et.NONE&&e.permissions<=et.ALL))throw new Error("Invalid permissions");if(e.owner&&e.owner!==null&&typeof e.owner!="string")throw new Error("Invalid owner type");if(e.attributes&&typeof e.attributes!="object")throw new Error("Invalid attributes type");if(e.root&&typeof e.root!="string")throw new Error("Invalid root type");if(e.root&&!e.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(e.root&&!e.source.includes(e.root))throw new Error("Root must be part of the source");if(e.root&&on(e.source,t)){const n=e.source.match(t)[0];if(!e.source.includes(Vr(n,e.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}if(e.status&&!Object.values(ue).includes(e.status))throw new Error("Status must be a valid NodeStatus")};var ue=(e=>(e.NEW="new",e.FAILED="failed",e.LOADING="loading",e.LOCKED="locked",e))(ue||{});class kt{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;readonlyAttributes=Object.entries(Object.getOwnPropertyDescriptors(kt.prototype)).filter(t=>typeof t[1].get=="function"&&t[0]!=="__proto__").map(t=>t[0]);handler={set:(t,n,r)=>this.readonlyAttributes.includes(n)?!1:Reflect.set(t,n,r),deleteProperty:(t,n)=>this.readonlyAttributes.includes(n)?!1:Reflect.deleteProperty(t,n),get:(t,n,r)=>this.readonlyAttributes.includes(n)?(Pt.warn(`Accessing "Node.attributes.${n}" is deprecated, access it directly on the Node instance.`),Reflect.get(this,n)):Reflect.get(t,n,r)};constructor(t,n){t.mime||(t.mime="application/octet-stream"),ot(t,n||this._knownDavService),this._data={displayname:t.attributes?.displayname,...t,attributes:{}},this._attributes=new Proxy(this._data.attributes,this.handler),this.update(t.attributes??{}),n&&(this._knownDavService=n)}get source(){return this._data.source.replace(/\/$/i,"")}get encodedSource(){const{origin:t}=new URL(this.source);return t+Ur(this.source.slice(t.length))}get basename(){return sn(this.source)}get displayname(){return this._data.displayname||this.basename}set displayname(t){ot({...this._data,displayname:t},this._knownDavService),this._data.displayname=t}get extension(){return Br(this.source)}get dirname(){if(this.root){let n=this.source;this.isDavResource&&(n=n.split(this._knownDavService).pop());const r=n.indexOf(this.root),s=this.root.replace(/\/$/,"");return At(n.slice(r+s.length)||"/")}const t=new URL(this.source);return At(t.pathname)}get mime(){return this._data.mime||"application/octet-stream"}set mime(t){t??="application/octet-stream",ot({...this._data,mime:t},this._knownDavService),this._data.mime=t}get mtime(){return this._data.mtime}set mtime(t){ot({...this._data,mtime:t},this._knownDavService),this._data.mtime=t}get crtime(){return this._data.crtime}get size(){return this._data.size}set size(t){ot({...this._data,size:t},this._knownDavService),this.updateMtime(),this._data.size=t}get attributes(){return this._attributes}get permissions(){return this.owner===null&&!this.isDavResource?et.READ:this._data.permissions!==void 0?this._data.permissions:et.NONE}set permissions(t){ot({...this._data,permissions:t},this._knownDavService),this.updateMtime(),this._data.permissions=t}get owner(){return this.isDavResource?this._data.owner:null}get isDavResource(){return on(this.source,this._knownDavService)}get isDavRessource(){return this.isDavResource}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavResource&&At(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){let t=this.source;this.isDavResource&&(t=t.split(this._knownDavService).pop());const n=t.indexOf(this.root),r=this.root.replace(/\/$/,"");return t.slice(n+r.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id}get status(){return this._data?.status}set status(t){ot({...this._data,status:t},this._knownDavService),this._data.status=t}get data(){return structuredClone(this._data)}move(t){ot({...this._data,source:t},this._knownDavService);const n=this.basename;this._data.source=t,this.displayname===n&&this.basename!==n&&(this.displayname=this.basename)}rename(t){if(t.includes("/"))throw new Error("Invalid basename");this.move(At(this.source)+"/"+t)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}update(t){for(const[n,r]of Object.entries(t))try{r===void 0?delete this.attributes[n]:this.attributes[n]=r}catch(s){if(s instanceof TypeError)continue;throw s}}}class ce extends kt{get type(){return ae.File}clone(){return new ce(this.data)}}class le extends kt{constructor(t){super({...t,mime:"httpd/unix-directory"})}get type(){return ae.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}clone(){return new le(this.data)}}const zr=function(e=""){let t=et.NONE;return e&&((e.includes("C")||e.includes("K"))&&(t|=et.CREATE),e.includes("G")&&(t|=et.READ),(e.includes("W")||e.includes("N")||e.includes("V"))&&(t|=et.UPDATE),e.includes("D")&&(t|=et.DELETE),e.includes("R")&&(t|=et.SHARE)),t},an=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:creationdate","d:displayname","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:size"],un={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},Zr=function(e,t={nc:"http://nextcloud.org/ns"}){typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...an],window._nc_dav_namespaces={...un});const n={...window._nc_dav_namespaces,...t};if(window._nc_dav_properties.find(s=>s===e))return Pt.warn(`${e} already registered`,{prop:e}),!1;if(e.startsWith("<")||e.split(":").length!==2)return Pt.error(`${e} is not valid. See example: 'oc:fileid'`,{prop:e}),!1;const r=e.split(":")[0];return n[r]?(window._nc_dav_properties.push(e),window._nc_dav_namespaces=n,!0):(Pt.error(`${e} namespace unknown`,{prop:e,namespaces:n}),!1)},he=function(){return typeof window._nc_dav_properties>"u"&&(window._nc_dav_properties=[...an]),window._nc_dav_properties.map(e=>`<${e} />`).join(" ")},pe=function(){return typeof window._nc_dav_namespaces>"u"&&(window._nc_dav_namespaces={...un}),Object.keys(window._nc_dav_namespaces).map(e=>`xmlns:${e}="${window._nc_dav_namespaces?.[e]}"`).join(" ")},Qr=function(){return` ${he()} `},Wr=function(){return` ${he()} 1 `},ts=function(e){return` ${he()} /files/${Kt()?.uid}/ infinity httpd/unix-directory 0 ${e} 100 0 `};function qr(){return Jt()?`/files/${gn()}`:`/files/${Kt()?.uid}`}const cn=qr();function Gr(){const e=mn("dav");return Jt()?e.replace("remote.php","public.php"):e}const ln=Gr(),es=function(e=ln,t={}){const n=Mr(e,{headers:t});function r(s){n.setHeaders({...t,"X-Requested-With":"XMLHttpRequest",requesttoken:s??""})}return dn(r),r(fn()),Fr().patch("fetch",(s,i)=>{const c=i.headers;return c?.method&&(i.method=c.method,delete c.method),fetch(s,i)}),n},ns=(e,t="/",n=cn)=>{const r=new AbortController;return new nt(async(s,i,c)=>{c(()=>r.abort());try{const u=(await e.getDirectoryContents(`${n}${t}`,{signal:r.signal,details:!0,data:Wr(),headers:{method:"REPORT"},includeSelf:!0})).data.filter(g=>g.filename!==t).map(g=>Hr(g,n));s(u)}catch(u){i(u)}})},Hr=function(e,t=cn,n=ln){let r=Kt()?.uid;if(Jt())r=r??"anonymous";else if(!r)throw new Error("No user id found");const s=e.props,i=zr(s?.permissions),c=String(s?.["owner-id"]||r),u=s.fileid||0,g=new Date(Date.parse(e.lastmod)),l=new Date(Date.parse(s.creationdate)),o={id:u,source:`${n}${e.filename}`,mtime:!isNaN(g.getTime())&&g.getTime()!==0?g:void 0,crtime:!isNaN(l.getTime())&&l.getTime()!==0?l:void 0,mime:e.mime||"application/octet-stream",displayname:s.displayname!==void 0?String(s.displayname):void 0,size:s?.size||Number.parseInt(s.getcontentlength||"0"),status:u<0?ue.FAILED:void 0,permissions:i,owner:c,root:t,attributes:{...e,...s,hasPreview:s?.["has-preview"]}};return delete o.attributes?.props,e.type==="file"?new ce(o):new le(o)};export{nt as C,ce as F,et as P,qr as a,ae as b,ns as c,cn as d,ts as e,Hr as f,es as g,Qr as h,Pt as l,Zr as r}; //# sourceMappingURL=dav-Rt1kTtvI-PDCKXEjH.chunk.mjs.map