iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: http://retty.me/_nuxt/XImg-BILABif1.js
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\/(?\d+)/.exec(t))==null?void 0:s.groups)==null?void 0:n.user_id;return i===void 0?t:w(i,e.values.width,e.values.height)}toEqual(t){return Object.keys({...this.destinationParts,...t.destinationParts}).every(e=>this.destinationParts[e]===t.destinationParts[e])&&this.filterArguments.toEqual(t.filterArguments)&&this.mode===t.mode}size(t,e=t){return new r(this.uri.toString(),{...this.options,width:t,height:e})}resized(t,e=t){const i=t&&e?{width:t,height:e}:{};return new r(this.uri.toString(),{...this.options,...i,mode:r.MODE.resize})}cropped(t,e=t){const i=t&&e?{width:t,height:e}:{};return new r(this.uri.toString(),{...this.options,...i,mode:r.MODE.crop})}da(t="s"){return new r(this.uri.toString(),{...this.options,da:t})}quality(t){return new r(this.uri.toString(),{...this.options,quality:t})}toString(){return r.build(this.mode,this.filterArguments,this.destinationParts)}valueOf(){return this.toString()}};a(r,"BASE_URI",new URL("https://ximg.retty.me/")),a(r,"MODE",{crop:"crop",resize:"resize"}),a(r,"DEFAULT_HOSTNAME","retty.me"),a(r,"XIMG_URL_REGEX",/^\/(crop|resize)((?:\/[^-/][^/]*)*)\/-\/(.+)$/),a(r,"REQUIRED_PARTS",["path","mode","width","height"]),a(r,"SOURCES",{"img.retty.me":"retty","retty.me":"retty_main","img.retty.news":"retty_news",$$external:"ext/"}),a(r,"FACEBOOK_GRAPH_DOMAIN","graph.facebook.com"),a(r,"USER_ICON_SERVICE_DOMAIN",new URL(U()).hostname),a(r,"CAN_NOT_HANDLE_HOSTNAMES",["platform-lookaside.fbsbx.com"]);let f=r;const R=o=>o%1===0,v=o=>Object.keys(f.MODE).includes(o),O=y.extend({props:{src:{type:String,required:!0},width:{type:Number,required:!0},height:{type:Number,required:!0},mode:{type:String,default:"crop",validator:v},da:{type:String,validator:o=>o==="s"||o==="l",default:"s"},quality:{type:Number,validator:R,default:80},loading:{type:String,default:"lazy"},alt:{type:String,default:void 0}},computed:{ximgSrc(){const o={mode:this.mode,quality:this.quality,da:this.da,width:this.width,height:this.height};return this.src&&new f(this.src,o).toString()}}});var N=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("img",{attrs:{loading:t.loading,alt:t.alt,src:t.ximgSrc}})},$=[],I=A(O,N,$,!1,null,null);const P=I.exports,T=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));export{P as X,f as a,T as b};