var p=Object.defineProperty;var E=(o,t,e)=>t in o?p(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var a=(o,t,e)=>E(o,typeof t!="symbol"?t+"":t,e);import{a1 as U,a2 as w,V as y,n as A}from"./client-BmVmnFEC.js";const h=class h{get values(){return this.$values}set values(t){t&&Object.keys(t).length>0&&(this.$values=h.normalizeValues(t))}constructor(t){this.values=t}toEqual(t){return Object.keys({...this.values,...t.values}).every(e=>this.values[e]===t.values[e])}static normalizeValues(t){return!t||Object.keys(t).length===0?{}:typeof t=="string"?h.parse(t):h.filter({...t})}static filter(t){return Object.keys(t).reduce((e,i)=>t[i]&&(["width","height"].includes(i)||i in h.ARGUMENTS)?{...e,[i]:t[i]}:e,{})}parse(){return this.values}static parse(t){return Object.entries(h.ARGUMENTS).reduce((e,[i,{regex:s}])=>{const n=s.exec(t);if(i!=="size")return n===null?e:{...e,[i]:n[1]};if(n===null)throw new Error("size is required in ximg url");return{...e,width:n[1],height:n[2]}},{})}stringify(){return h.stringify(this.values)}static stringify(t={}){const e=Object.entries(h.ARGUMENTS).reduce((i,[s,{validator:n,stringify:u}])=>s==="size"?(n(t.width,t.height),[...i,u(t.width,t.height)]):s in t?(n(t[s]),[...i,u(t[s])]):i,[]);return e.length===0?"":["",...e].join("/")}merge(t){this.values={...this.values,...h.normalizeValues(t)}}valueOf(){return this.stringify()}toString(){return this.stringify()}};a(h,"ARGUMENTS",{size:{regex:/s(\d{1,4})x(\d{1,4})/,validator(...t){t.forEach(e=>{const i=typeof e=="number"?e:parseInt(e,10);if(!i||i<0||i>1e4)throw new Error(`filter arugment: size should be 0 > size > 10000, but given ${i}`)})},stringify(t,e){return`s${t}x${e}`}},quality:{regex:/q(100|[1-9]?[0-9])/,validator(t){const e=typeof t=="number"?t:parseInt(t,10);if(isNaN(e))throw new TypeError(`filter arugment: quality could not be parsed as Number, given ${t}`);if(e>100||e<0)throw new Error(`filter arugment: quality is out of range(0 >= q >= 100), but given ${t}`)},stringify(t){return`q${t}`}},da:{regex:/da(s|l)/,validator(t){if(t!=="s"&&t!=="l")throw new TypeError(`filter arugment: da should be "s" or "l", but given ${t}`)},stringify(t){return`da${t}`}}});let m=h;const r=class r{get url(){return this.toString()}set url(t){this.uri=new URL(t),this.setParametersFromUri()}get options(){return{mode:this.mode,...this.destinationParts,...this.filterArguments.parse()}}constructor(t,e={}){this.uri=new URL(t,`https://${r.DEFAULT_HOSTNAME}`),this.filterArguments=new m,this.destinationParts={},this.setParametersFromUri(),this.filterArguments.merge(e),this.mode=e.mode?r.MODE[e.mode]:this.mode,this.destinationParts.path=e.path||this.destinationParts.path,this.destinationParts.source=e.source||this.destinationParts.source}setParametersFromUri(){if(this.uri.hostname===r.BASE_URI.hostname){const{mode:i,path:s,source:n,filterArgumentsString:u}=r.parseXimgUrl(this.uri.pathname);this.destinationParts={path:s,source:n},this.mode=i,this.filterArguments.merge(u);return}const t=this.uri.hostname||r.DEFAULT_HOSTNAME,e=!(t in r.SOURCES);this.destinationParts={source:e?r.SOURCES.$$external:r.SOURCES[t],path:e?this.uri.href:this.uri.pathname}}static parseXimgUrl(t){const[,e,i,s]=r.XIMG_URL_REGEX.exec(t);return{filterArgumentsString:i,mode:e,path:s,source:""}}static build(t,e,i={}){const s={mode:t,...i,...e.parse()},n=r.REQUIRED_PARTS.reduce((c,l)=>l==="path"?s[l]&&s[l]!=="/"?c:[...c,l]:s[l]?c:[...c,l],[]);if(n.length>0)throw new Error(`${n.join(", ")} ${n.length>1?"are":"is"} required.`);const{source:u,path:d}=i,g=new URL(d,`https://${r.DEFAULT_HOSTNAME}`);if(g.hostname===r.FACEBOOK_GRAPH_DOMAIN)return r.rewriteFacebookGraphUrl(d,e);if(g.hostname===r.USER_ICON_SERVICE_DOMAIN)return r.rewriteUserIconServiceUrl(d,e);if(r.CAN_NOT_HANDLE_HOSTNAMES.includes(g.hostname))return d;const S=e.toString();return`${r.BASE_URI.toString()}${t}${S}/-/${u}${d}`}static rewriteFacebookGraphUrl(t,e){const i=new URL(t);return i.searchParams.set("width",e.values.width),i.searchParams.set("height",e.values.height),i.toString()}static rewriteUserIconServiceUrl(t,e){var s,n;const i=(n=(s=/id\/(?