@imgproxy/imgproxy-js-core
Version:
imgproxy-js-core package is designed to be used as part of framework-specific packages and plugins.
2 lines (1 loc) • 36.9 kB
JavaScript
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=t=>t===!0||t==="t"||t===1?"t":"f",_=t=>`${t}${t.includes(".")?"":" option"}`;function n(t,e,o){if(t===void 0)throw new Error(`${_(e)} is undefined${o?`. ${o}`:""}`)}function x(t,e,o,r){return`${_(t)} value can't be less${r?" or equal":""} than ${e}${o?`. ${o}`:""}`}function i(t,e,o){if(typeof t!="number")throw new Error(`${_(e)} is not a number${o!=null&&o.addInfo?`. ${o==null?void 0:o.addInfo}`:""}`);if(!(o!=null&&o.addParam))return;const r=o.addParam,s=o==null?void 0:o.addInfo;if(r.min!==void 0){if(r.minEqual&&t<=r.min)throw new Error(x(e,r.min,s,!0));if(t<r.min)throw new Error(x(e,r.min,s));if(r.max!==void 0&&t>r.max)throw new Error(`${_(e)} value can't be more than ${r.max}${s?`. ${s}`:""}`)}if(r.isInt&&!Number.isInteger(t))throw new Error(`${_(e)} is must be an integer`)}function d(t,e,o){const r=`Valid values are: ${Object.keys(t).join(", ")}`;if(!t[e])throw new Error(`${_(o)} is invalid. ${r}`)}function ve(t,e,o){if(!t.includes(e)){const r=`Valid values are: ${t.join(", ")}`;throw new Error(`${_(o)} is invalid. ${r}`)}}function b(t,e,o){if(typeof t!="string")throw new Error(`${_(e)} is not a string`);if(o){if(t.match(/[^0-9a-fA-F]/))throw new Error(`${_(e)} must be hexadecimal`);if(t.length!==3&&t.length!==6&&t.length!==8)throw new Error(`${_(e)} must be 3, 6 or 8 characters long (with alpha)`)}}function f(t,e){if(!Array.isArray(t))throw new Error(`${_(e)} is not an array`);if(t.length===0)throw new Error(`${_(e)} is empty`)}function p(t,e){if(typeof t!="boolean")throw new Error(`${_(e)} is not a boolean`)}const B=t=>t.adjust||t.a,je=t=>!!B(t),we=t=>{const e=B(t);n(e,"adjust"),e.brightness!==void 0&&i(e.brightness,"adjust.brightness",{addParam:{min:-255,max:255}});const o=e.brightness??"",r=e.contrast??"",s=e.saturation??"";return`a:${o}:${r}:${s}`},Se=Object.freeze(Object.defineProperty({__proto__:null,build:we,test:je},Symbol.toStringTag,{value:"Module"})),Pe={none:!0,size:!0,dssim:!0,ml:!0},q=t=>t.autoquality||t.aq,xe=t=>!!q(t),ze=t=>{const e=q(t);n(e,"autoquality");const{method:o,target:r,min_quality:s,max_quality:a,allowed_error:l}=e;if(o&&d(Pe,o,"autoquality.method"),r!==void 0&&i(r,"autoquality.target",{addParam:{min:0}}),s!==void 0&&i(s,"autoquality.min_quality",{addParam:{min:0,max:100}}),a!==void 0&&i(a,"autoquality.max_quality",{addParam:{min:0,max:100}}),l!==void 0){if(o!=="dssim"&&o!=="ml")throw new Error("autoquality.allowed_error is applicable only to dssim and ml methods");i(l,"autoquality.allowed_error",{addParam:{min:0,max:1}})}return`aq:${o??""}:${r??""}:${s??""}:${a??""}:${l??""}`.replace(/:+$/,"")},Te=Object.freeze(Object.defineProperty({__proto__:null,build:ze,test:xe},Symbol.toStringTag,{value:"Module"})),E=t=>{if("auto_rotate"in t)return t.auto_rotate;if("ar"in t)return t.ar},Me=t=>E(t)!==void 0,ke=t=>{const e=E(t);return n(e,"auto_rotate"),`ar:${c(e)}`},Be=Object.freeze(Object.defineProperty({__proto__:null,build:ke,test:Me},Symbol.toStringTag,{value:"Module"})),I=t=>t.background||t.bg,qe=t=>!!I(t),Ee=t=>{const e=I(t);if(n(e,"background"),typeof e=="number")throw new Error("background option is not a string or object");return typeof e=="string"?(b(e,"background",!0),`bg:${e}`):(n(e.r,"background.r"),n(e.g,"background.g"),n(e.b,"background.b"),i(e.r,"background.r"),i(e.g,"background.g"),i(e.b,"background.b"),`bg:${e.r}:${e.g}:${e.b}`)},Ie=Object.freeze(Object.defineProperty({__proto__:null,build:Ee,test:qe},Symbol.toStringTag,{value:"Module"})),A=t=>t.background_alpha??t.bga,Ae=t=>!!A(t),Fe=t=>{const e=A(t);return n(e,"background_alpha"),i(e,"background_alpha",{addParam:{min:0,max:1}}),`background_alpha:${e}`},Re=Object.freeze(Object.defineProperty({__proto__:null,build:Fe,test:Ae},Symbol.toStringTag,{value:"Module"})),F=t=>t.blur??t.bl,Ue=t=>!!F(t),Ve=t=>{const e=F(t);return n(e,"blur"),i(e,"blur",{addParam:{min:0}}),`bl:${e}`},Ne=Object.freeze(Object.defineProperty({__proto__:null,build:Ve,test:Ue},Symbol.toStringTag,{value:"Module"})),R=t=>t.blur_detections||t.bd,He=t=>!!R(t),Ce=t=>{const e=R(t);n(e,"blur_detections"),n(e.sigma,"blur_detections.sigma"),i(e.sigma,"blur_detections.sigma");const o=e.sigma,r=e.class_names?e.class_names.join(":"):"";return`bd:${o}:${r}`.replace(/:+$/,"")},De=Object.freeze(Object.defineProperty({__proto__:null,build:Ce,test:He},Symbol.toStringTag,{value:"Module"})),U=t=>t.brightness??t.br,Qe=t=>!!U(t),Xe=t=>{const e=U(t);return n(e,"brightness"),i(e,"brightness",{addParam:{min:-255,max:255}}),`br:${e}`},We=Object.freeze(Object.defineProperty({__proto__:null,build:Xe,test:Qe},Symbol.toStringTag,{value:"Module"})),V=t=>t.cachebuster||t.cb,Je=t=>!!V(t),Ye=t=>{const e=V(t);return n(e,"cachebuster"),b(e,"cachebuster"),`cb:${e}`},N=Object.freeze(Object.defineProperty({__proto__:null,build:Ye,test:Je},Symbol.toStringTag,{value:"Module"})),H=t=>t.colorize??t.col,Ge=t=>!!H(t),Ke=t=>{const e=H(t);n(e,"colorize");const{opacity:o,color:r,keepAlpha:s}=e;i(o,"colorize.opacity",{addParam:{min:0,max:1}});let a=`col:${o}`;return r&&(a+=`:${r}`),s!==void 0&&(r||(a+=":"),a+=`:${s?1:0}`),a},Le=Object.freeze(Object.defineProperty({__proto__:null,build:Ke,test:Ge},Symbol.toStringTag,{value:"Module"})),C=t=>t.contrast??t.co,Ze=t=>!!C(t),to=t=>{const e=C(t);return n(e,"contrast"),i(e,"contrast",{addParam:{min:0}}),`co:${e}`},eo=Object.freeze(Object.defineProperty({__proto__:null,build:to,test:Ze},Symbol.toStringTag,{value:"Module"})),D={no:!0,so:!0,ea:!0,we:!0,ce:!0,noea:!0,nowe:!0,soea:!0,sowe:!0},oo={...D,sm:!0,fp:!0,obj:!0,objw:!0},Q=t=>t.gravity||t.g,O=t=>!!Q(t),y=(t,e)=>`${e?"":"g:"}${t.replace(/:+$/,"")}`,h=(t,e={})=>{const{headless:o=!1}=e,r=Q(t);n(r,"gravity"),n(r.type,"gravity.type");const s=r.type;if(d(oo,s,"gravity.type"),(r.x_offset||r.y_offset)&&d(D,s,"gravity.type"),r.class_names&&s!=="obj")throw new Error("gravity.class_names can be used only with type obj");if(r.class_weights&&s!=="objw")throw new Error("gravity.class_weights can be used only with type objw");if((r.x||r.y)&&s!=="fp")throw new Error("gravity.x and gravity.y can be used only with type fp");if(s==="sm")return y(s,o);if(s==="fp"){const a=r;return n(a.x,"gravity.x"),n(a.y,"gravity.y"),i(a.x,"gravity.x",{addParam:{min:0,max:1}}),i(a.y,"gravity.y",{addParam:{min:0,max:1}}),y(`${s}:${a.x}:${a.y}`,o)}if(s==="obj"){const a=r;n(r.class_names,"gravity.class_names"),f(a.class_names,"gravity.class_names");const l=a.class_names;return y(`${s}:${l.join(":")}`,o)}if(s==="objw"){const a=r;n(a.class_weights,"gravity.class_weights"),f(a.class_weights,"gravity.class_weights");const l=a.class_weights.map(u=>{if(typeof u!="object"||!u.class||typeof u.weight!="number")throw new Error("Each item in gravity.class_weights must have 'class' and 'weight' properties");return`${u.class}:${u.weight}`});return y(`${s}:${l.join(":")}`,o)}else{const a=r,l=a.x_offset===void 0?"":a.x_offset,u=a.y_offset===void 0?"":a.y_offset;return y(`${a.type}:${l}:${u}`,o)}},ro=Object.freeze(Object.defineProperty({__proto__:null,build:h,test:O},Symbol.toStringTag,{value:"Module"})),X=t=>t.crop||t.c,no=t=>!!X(t),so=t=>{const e=X(t);n(e,"crop");const{width:o,height:r}=e;n(o,"crop.width"),n(r,"crop.height"),i(o,"crop.width",{addParam:{min:0}}),i(r,"crop.height",{addParam:{min:0}});const s=O(e)?h(e,{headless:!0}):"";return`c:${o}:${r}:${s}`.replace(/:+$/,"")},W=Object.freeze(Object.defineProperty({__proto__:null,build:so,test:no},Symbol.toStringTag,{value:"Module"})),J=t=>t.crop_aspect_ratio||t.crop_ar||t.car,io=t=>!!J(t),ao=t=>{const e=J(t);n(e,"crop_aspect_ratio");const{aspect_ratio:o,enlarge:r}=e;n(o,"crop_aspect_ratio.aspect_ratio"),i(o,"crop_aspect_ratio.aspect_ratio",{addParam:{min:0}});let s=`crop_ar:${o}`;return r!==void 0&&(s+=`:${c(r)}`),s},lo=Object.freeze(Object.defineProperty({__proto__:null,build:ao,test:io},Symbol.toStringTag,{value:"Module"})),Y=t=>{if("disable_animation"in t)return t.disable_animation;if("da"in t)return t.da},co=t=>Y(t)!==void 0,uo=t=>{const e=Y(t);return n(e,"disable_animation"),`da:${c(e)}`},_o=Object.freeze(Object.defineProperty({__proto__:null,build:uo,test:co},Symbol.toStringTag,{value:"Module"})),G=t=>t.duotone??t.dt,bo=t=>!!G(t),mo=t=>{const e=G(t);n(e,"duotone");const{intensity:o,color1:r="",color2:s=""}=e;return i(o,"duotone.intensity",{addParam:{min:0,max:1}}),s?`dt:${o}:${r}:${s}`:r?`dt:${o}:${r}`:`dt:${o}`},po=Object.freeze(Object.defineProperty({__proto__:null,build:mo,test:bo},Symbol.toStringTag,{value:"Module"})),K=t=>t.dpi,fo=t=>!!K(t),go=t=>{const e=K(t);return n(e,"dpi"),i(e,"dpi"),`dpi:${e}`},$o=Object.freeze(Object.defineProperty({__proto__:null,build:go,test:fo},Symbol.toStringTag,{value:"Module"})),L=t=>t.dpr,yo=t=>!!L(t),Oo=t=>{const e=L(t);return n(e,"dpr"),i(e,"dpr",{addParam:{min:0}}),`dpr:${e}`},ho=Object.freeze(Object.defineProperty({__proto__:null,build:Oo,test:yo},Symbol.toStringTag,{value:"Module"})),Z=t=>t.draw_detections||t.dd,vo=t=>!!Z(t),jo=t=>{const e=Z(t);n(e,"draw_detections"),n(e.draw,"draw_detections.draw");const o=c(e.draw),r=e.class_names?`:${e.class_names.join(":")}`:"";return`dd:${o}${r}`},wo=Object.freeze(Object.defineProperty({__proto__:null,build:jo,test:vo},Symbol.toStringTag,{value:"Module"})),tt=t=>{if("enforce_thumbnail"in t)return t.enforce_thumbnail;if("eth"in t)return t.eth},So=t=>tt(t)!==void 0,Po=t=>{const e=tt(t);return n(e,"enforce_thumbnail"),`eth:${c(e)}`},xo=Object.freeze(Object.defineProperty({__proto__:null,build:Po,test:So},Symbol.toStringTag,{value:"Module"})),et=t=>{if("enlarge"in t)return t.enlarge;if("el"in t)return t.el},zo=t=>et(t)!==void 0,To=t=>{const e=et(t);return n(e,"enlarge"),`el:${c(e)}`},Mo=Object.freeze(Object.defineProperty({__proto__:null,build:To,test:zo},Symbol.toStringTag,{value:"Module"})),ot=t=>t.expires||t.exp,ko=t=>!!ot(t),Bo=t=>{const e=ot(t);return n(e,"expires"),i(e,"expires"),`exp:${e}`},rt=Object.freeze(Object.defineProperty({__proto__:null,build:Bo,test:ko},Symbol.toStringTag,{value:"Module"})),nt=t=>t.extend||t.ex,w=t=>!!nt(t),qo=(t,e)=>`${e?"":"ex:"}${t.replace(/:+$/,"")}`,S=(t,e={})=>{const{headless:o=!1}=e,r=nt(t);n(r,"extend"),n(r.extend,"extend.extend");const s=O(r)?`:${h(r,{headless:!0})}`:"";return qo(`${c(r.extend)}${s}`,o)},Eo=Object.freeze(Object.defineProperty({__proto__:null,build:S,test:w},Symbol.toStringTag,{value:"Module"})),st=t=>t.extend_aspect_ratio||t.exar||t.extend_ar,Io=t=>!!st(t),Ao=t=>{const e=st(t);n(e,"extend_aspect_ratio"),n(e.extend,"extend_aspect_ratio.extend");const o=O(e)?`:${h(e,{headless:!0})}`:"";return`exar:${c(e.extend)}${o}`},Fo=Object.freeze(Object.defineProperty({__proto__:null,build:Ao,test:Io},Symbol.toStringTag,{value:"Module"})),it=t=>t.fallback_image_url||t.fiu,Ro=t=>!!it(t),Uo=t=>{const e=it(t);return n(e,"fallback_image_url"),b(e,"fallback_image_url"),`fiu:${e}`},Vo=Object.freeze(Object.defineProperty({__proto__:null,build:Uo,test:Ro},Symbol.toStringTag,{value:"Module"})),at=t=>t.filename||t.fn,No=t=>!!at(t),Ho=t=>{const e=at(t);n(e,"filename"),n(e.name,"filename.name"),b(e.name,"filename.name");const o=e.encoded===void 0?"":`:${c(e.encoded)}`;return`fn:${e.name}${o}`},Co=Object.freeze(Object.defineProperty({__proto__:null,build:Ho,test:No},Symbol.toStringTag,{value:"Module"})),Do={png:!0,jpg:!0,jxl:!0,webp:!0,avif:!0,gif:!0,ico:!0,svg:!0,bmp:!0,tiff:!0,mp4:!0,pdf:!0,best:!0},lt=t=>t.format||t.f||t.ext,Qo=t=>!!lt(t),Xo=t=>{const e=lt(t);return n(e,"format"),d(Do,e,"format"),`f:${e}`},Wo=Object.freeze(Object.defineProperty({__proto__:null,build:Xo,test:Qo},Symbol.toStringTag,{value:"Module"})),ct=t=>t.format_quality||t.fq,Jo=t=>!!ct(t),Yo=t=>{const e=ct(t);n(e,"format_quality"),f(e,"format_quality");const o=[];return e.forEach(r=>{o.push(`${r.format}:${r.quality}`)}),`fq:${o.join(":")}`},Go=Object.freeze(Object.defineProperty({__proto__:null,build:Yo,test:Jo},Symbol.toStringTag,{value:"Module"})),Ko={down:!0,up:!0,right:!0,left:!0},ut=t=>t.gradient||t.gr,Lo=t=>!!ut(t),Zo=t=>{const e=ut(t);n(e,"gradient");const{opacity:o,color:r,direction:s,start:a,stop:l}=e;return n(o,"gradient.opacity"),i(o,"gradient.opacity",{addParam:{min:0,max:1}}),r&&b(r,"gradient.color",!0),s&&(typeof s=="number"?i(s,"gradient.direction"):(b(s,"gradient.direction"),d(Ko,s,"gradient.direction"))),a&&i(a,"gradient.start",{addParam:{min:0,max:1}}),l&&i(l,"gradient.stop",{addParam:{min:0,max:1}}),`gr:${o}:${r||""}:${s||""}:${a||""}:${l||""}`.replace(/:+$/,"")},tr=Object.freeze(Object.defineProperty({__proto__:null,build:Zo,test:Lo},Symbol.toStringTag,{value:"Module"})),dt=t=>t.height??t.h,er=t=>!!dt(t),or=t=>{const e=dt(t);return n(e,"height"),i(e,"height",{addParam:{min:0}}),`h:${e}`},rr=Object.freeze(Object.defineProperty({__proto__:null,build:or,test:er},Symbol.toStringTag,{value:"Module"})),_t=t=>t.jpeg_options||t.jpgo,nr=t=>!!_t(t),sr=t=>{const e=_t(t);n(e,"jpeg_options");const{progressive:o,no_subsample:r,trellis_quant:s,overshoot_deringing:a,optimize_scans:l,quant_table:u}=e;if(o&&p(o,"jpeg_options.progressive"),r&&p(r,"jpeg_options.no_subsample"),s&&p(s,"jpeg_options.trellis_quant"),a&&p(a,"jpeg_options.overshoot_deringing"),l&&(p(l,"jpeg_options.optimize_scans"),o===!1))throw new Error("jpeg_options.progressive must be true if jpeg_options.optimize_scans is true");return u&&i(u,"jpeg_options.quant_table",{addParam:{min:0,max:8}}),`jpgo:${o===void 0?"":o}:${r===void 0?"":r}:${s===void 0?"":s}:${a===void 0?"":a}:${l===void 0?"":l}:${u===void 0?"":u}`.replace(/:+$/,"")},ir=Object.freeze(Object.defineProperty({__proto__:null,build:sr,test:nr},Symbol.toStringTag,{value:"Module"})),bt=t=>{if("keep_copyright"in t)return t.keep_copyright;if("kcr"in t)return t.kcr},ar=t=>bt(t)!==void 0,lr=t=>{const e=bt(t);return n(e,"keep_copyright"),`kcr:${c(e)}`},cr=Object.freeze(Object.defineProperty({__proto__:null,build:lr,test:ar},Symbol.toStringTag,{value:"Module"})),mt=t=>{if("max_animation_frames"in t)return t.max_animation_frames;if("maf"in t)return t.maf},ur=t=>mt(t)!==void 0,dr=t=>{const e=mt(t);return n(e,"max_animation_frames"),i(e,"max_animation_frames",{addParam:{min:0,minEqual:!0}}),`maf:${e}`},_r=Object.freeze(Object.defineProperty({__proto__:null,build:dr,test:ur},Symbol.toStringTag,{value:"Module"})),pt=t=>{if("max_animation_frame_resolution"in t)return t.max_animation_frame_resolution;if("mafr"in t)return t.mafr},br=t=>pt(t)!==void 0,mr=t=>{const e=pt(t);return n(e,"max_animation_frame_resolution"),i(e,"max_animation_frame_resolution",{addParam:{min:0}}),`mafr:${e}`},pr=Object.freeze(Object.defineProperty({__proto__:null,build:mr,test:br},Symbol.toStringTag,{value:"Module"})),ft=t=>t.max_bytes??t.mb,fr=t=>!!ft(t),gr=t=>{const e=ft(t);return n(e,"max_bytes"),i(e,"max_bytes",{addParam:{min:0}}),`mb:${e}`},$r=Object.freeze(Object.defineProperty({__proto__:null,build:gr,test:fr},Symbol.toStringTag,{value:"Module"})),gt=t=>t.max_result_dimension??t.mrd,yr=t=>gt(t)!==void 0,Or=t=>{const e=gt(t);return n(e,"max_result_dimension"),i(e,"max_result_dimension",{addParam:{min:0}}),`mrd:${e}`},hr=Object.freeze(Object.defineProperty({__proto__:null,build:Or,test:yr},Symbol.toStringTag,{value:"Module"})),$t=["no","so","ea","we","noea","nowe","soea","sowe","ce"],vr=t=>$t.includes(t.type),yt=t=>t.objects_position||t.obj_pos||t.op,jr=t=>!!yt(t),wr=t=>{const e=yt(t);n(e,"objects_position");const o=e.type;if(ve([...$t,"fp","prop"],o,"type"),vr(e)){e.xOffset!==void 0&&i(e.xOffset,"objects_position.xOffset"),e.yOffset!==void 0&&i(e.yOffset,"objects_position.yOffset");const r=e.xOffset??"",s=e.yOffset??"";return`op:${o}:${r}:${s}`}else if(e.type==="fp"){e.x!==void 0&&i(e.x,"objects_position.x",{addParam:{min:0,max:1}}),e.y!==void 0&&i(e.y,"objects_position.y",{addParam:{min:0,max:1}});const r=e.x??"",s=e.y??"";return`op:${o}:${r}:${s}`}else{if(o==="prop")return"op:prop";throw new Error(`Unknown object position type: ${o}`)}},Sr=Object.freeze(Object.defineProperty({__proto__:null,build:wr,test:jr},Symbol.toStringTag,{value:"Module"})),Ot=t=>{if("max_src_file_size"in t)return t.max_src_file_size;if("msfs"in t)return t.msfs},Pr=t=>Ot(t)!==void 0,xr=t=>{const e=Ot(t);return n(e,"max_src_file_size"),i(e,"max_src_file_size",{addParam:{min:0}}),`msfs:${e}`},ht=Object.freeze(Object.defineProperty({__proto__:null,build:xr,test:Pr},Symbol.toStringTag,{value:"Module"})),vt=t=>{if("max_src_resolution"in t)return t.max_src_resolution;if("msr"in t)return t.msr},zr=t=>vt(t)!==void 0,Tr=t=>{const e=vt(t);return n(e,"max_src_resolution"),i(e,"max_src_resolution",{addParam:{min:0,minEqual:!0}}),`msr:${e}`},jt=Object.freeze(Object.defineProperty({__proto__:null,build:Tr,test:zr},Symbol.toStringTag,{value:"Module"})),wt=t=>t.min_height??t.mh,Mr=t=>!!wt(t),kr=t=>{const e=wt(t);return n(e,"min_height"),i(e,"min_height",{addParam:{min:0}}),`mh:${e}`},Br=Object.freeze(Object.defineProperty({__proto__:null,build:kr,test:Mr},Symbol.toStringTag,{value:"Module"})),St=t=>t.min_width??t.mw,qr=t=>!!St(t),Er=t=>{const e=St(t);return n(e,"min_width"),i(e,"min_width",{addParam:{min:0}}),`mw:${e}`},Ir=Object.freeze(Object.defineProperty({__proto__:null,build:Er,test:qr},Symbol.toStringTag,{value:"Module"})),Pt=t=>t.monochrome??t.mc,Ar=t=>!!Pt(t),Fr=t=>{const e=Pt(t);n(e,"monochrome");const{intensity:o,color:r}=e;return i(o,"monochrome.intensity",{addParam:{min:0,max:1}}),r?`mc:${o}:${r}`:`mc:${o}`},Rr=Object.freeze(Object.defineProperty({__proto__:null,build:Fr,test:Ar},Symbol.toStringTag,{value:"Module"})),xt=t=>t.padding||t.pd,Ur=t=>!!xt(t),Vr=t=>{const e=xt(t);if(n(e,"padding"),typeof e=="string")throw new Error("padding option is not a number or object");if(typeof e=="number")return i(e,"padding",{addParam:{min:0}}),`pd:${e}`;e.top!==void 0&&i(e.top,"padding.top"),e.right!==void 0&&i(e.right,"padding.right"),e.bottom!==void 0&&i(e.bottom,"padding.bottom"),e.left!==void 0&&i(e.left,"padding.left");const o=e.top??"",r=e.right??"",s=e.bottom??"",a=e.left??"";return`pd:${o}:${r}:${s}:${a}`.replace(/:+$/,"")},Nr=Object.freeze(Object.defineProperty({__proto__:null,build:Vr,test:Ur},Symbol.toStringTag,{value:"Module"})),zt=t=>{if("page"in t)return t.page;if("pg"in t)return t.pg},Hr=t=>zt(t)!==void 0,Cr=t=>{const e=zt(t);return n(e,"page"),i(e,"page",{addParam:{min:0,isInt:!0}}),`pg:${e}`},Tt=Object.freeze(Object.defineProperty({__proto__:null,build:Cr,test:Hr},Symbol.toStringTag,{value:"Module"})),Mt=t=>{if("pages"in t)return t.pages;if("pgs"in t)return t.pgs},Dr=t=>Mt(t)!==void 0,Qr=t=>{const e=Mt(t);return n(e,"pages"),i(e,"pages",{addParam:{min:1,isInt:!0}}),`pgs:${e}`},Xr=Object.freeze(Object.defineProperty({__proto__:null,build:Qr,test:Dr},Symbol.toStringTag,{value:"Module"})),kt=t=>t.pixelate??t.pix,Wr=t=>!!kt(t),Jr=t=>{const e=kt(t);return n(e,"pixelate"),i(e,"pixelate",{addParam:{min:0}}),`pix:${e}`},Yr=Object.freeze(Object.defineProperty({__proto__:null,build:Jr,test:Wr},Symbol.toStringTag,{value:"Module"})),Bt=t=>t.png_options||t.pngo,Gr=t=>!!Bt(t),Kr=t=>{const e=Bt(t);n(e,"png_options");const{interlaced:o,quantize:r,quantization_colors:s}=e;return o&&p(o,"png_options.interlaced"),r&&p(r,"png_options.quantize"),s&&i(s,"png_options.quantization_colors",{addParam:{min:2,max:256}}),`pngo:${o===void 0?"":o}:${r===void 0?"":r}:${s||""}`.replace(/:+$/,"")},Lr=Object.freeze(Object.defineProperty({__proto__:null,build:Kr,test:Gr},Symbol.toStringTag,{value:"Module"})),qt=t=>t.preset||t.pr,Zr=t=>!!qt(t),tn=(t,e)=>{let o=qt(t);if(n(o,"preset"),f(o,"preset"),o.some(r=>typeof r!="string"))throw new Error("preset option should contain only strings");return e!=null&&e.onlyPresets||(o=["pr",...o]),`${o.join(":")}`},v=Object.freeze(Object.defineProperty({__proto__:null,build:tn,test:Zr},Symbol.toStringTag,{value:"Module"})),Et=t=>t.quality??t.q,en=t=>!!Et(t),on=t=>{const e=Et(t);return n(e,"quality"),i(e,"quality",{addParam:{min:0,max:100}}),`q:${e}`},rn=Object.freeze(Object.defineProperty({__proto__:null,build:on,test:en},Symbol.toStringTag,{value:"Module"})),It=t=>{if("raw"in t)return t.raw},nn=t=>It(t)!==void 0,sn=t=>{const e=It(t);return n(e,"raw"),`raw:${c(e)}`},an=Object.freeze(Object.defineProperty({__proto__:null,build:sn,test:nn},Symbol.toStringTag,{value:"Module"})),ln={fit:!0,fill:!0,auto:!0,"fill-down":!0,force:!0},At=t=>t.resize||t.rs,cn=t=>!!At(t),un=t=>{const e=At(t);n(e,"resize");const{resizing_type:o,width:r,height:s,enlarge:a}=e;o&&d(ln,o,"resize.resizing_type"),r&&i(r,"resize.width",{addParam:{min:0}}),s&&i(s,"resize.height",{addParam:{min:0}});const l=o||"",u=r||"",m=s||"",g=a===void 0?"":c(a),$=w(e)?S(e,{headless:!0}):"";return`rs:${l}:${u}:${m}:${g}:${$}`.replace(/:+$/,"")},dn=Object.freeze(Object.defineProperty({__proto__:null,build:un,test:cn},Symbol.toStringTag,{value:"Module"})),_n={nearest:!0,linear:!0,cubic:!0,lanczos2:!0,lanczos3:!0},Ft=t=>t.resizing_algorithm||t.ra,bn=t=>!!Ft(t),mn=t=>{const e=Ft(t);return n(e,"resizing_algorithm"),d(_n,e,"resizing_algorithm"),`ra:${e}`},pn=Object.freeze(Object.defineProperty({__proto__:null,build:mn,test:bn},Symbol.toStringTag,{value:"Module"})),fn={fit:!0,fill:!0,"fill-down":!0,force:!0,auto:!0},Rt=t=>t.resizing_type||t.rt,gn=t=>!!Rt(t),$n=t=>{const e=Rt(t);return n(e,"resizing_type"),d(fn,e,"resizing_type"),`rt:${e}`},yn=Object.freeze(Object.defineProperty({__proto__:null,build:$n,test:gn},Symbol.toStringTag,{value:"Module"})),Ut=t=>{if("return_attachment"in t)return t.return_attachment;if("att"in t)return t.att},On=t=>Ut(t)!==void 0,hn=t=>{const e=Ut(t);return n(e,"return_attachment"),`att:${c(e)}`},vn=Object.freeze(Object.defineProperty({__proto__:null,build:hn,test:On},Symbol.toStringTag,{value:"Module"})),z={0:!0,90:!0,180:!0,270:!0},Vt=t=>t.rotate??t.rot,jn=t=>!!Vt(t),wn=t=>{const e=Vt(t),o=`You can use values ${Object.keys(z).join(", ")}`;return n(e,"rotate"),i(e,"rotate",{addInfo:o}),d(z,e,"rotate"),`rot:${e}`},Sn=Object.freeze(Object.defineProperty({__proto__:null,build:wn,test:jn},Symbol.toStringTag,{value:"Module"})),Nt=t=>t.saturation??t.sa,Pn=t=>!!Nt(t),xn=t=>{const e=Nt(t);return n(e,"saturation"),i(e,"saturation",{addParam:{min:0}}),`sa:${e}`},zn=Object.freeze(Object.defineProperty({__proto__:null,build:xn,test:Pn},Symbol.toStringTag,{value:"Module"})),Ht=t=>t.sharpen??t.sh,Tn=t=>!!Ht(t),Mn=t=>{const e=Ht(t);return n(e,"sharpen"),i(e,"sharpen",{addParam:{min:0}}),`sh:${e}`},kn=Object.freeze(Object.defineProperty({__proto__:null,build:Mn,test:Tn},Symbol.toStringTag,{value:"Module"})),Ct=t=>t.size||t.s,Bn=t=>!!Ct(t),qn=t=>{const e=Ct(t);n(e,"size");const{width:o,height:r,enlarge:s}=e;o&&i(o,"size.width",{addParam:{min:0}}),r&&i(r,"size.height",{addParam:{min:0}});const a=o||"",l=r||"",u=s===void 0?"":c(s),m=w(e)?S(e,{headless:!0}):"";return`s:${a}:${l}:${u}:${m}`.replace(/:+$/,"")},En=Object.freeze(Object.defineProperty({__proto__:null,build:qn,test:Bn},Symbol.toStringTag,{value:"Module"})),T=["jpg","jxl","png","webp","avif","gif","ico","svg","heic","bmp","tiff","pdf","mp4"],Dt=t=>t.skip_processing||t.sp,In=t=>!!Dt(t),An=t=>{const e=Dt(t);if(n(e,"skip_processing"),f(e,"skip_processing"),e.some(o=>!T.includes(o))){const o=`Valid values are: ${T.join(",")}`;throw new Error(`skip_processing option contains unsupported extension. ${o}`)}return`sp:${e.join(":")}`},Fn=Object.freeze(Object.defineProperty({__proto__:null,build:An,test:In},Symbol.toStringTag,{value:"Module"})),Qt=t=>{if("strip_color_profile"in t)return t.strip_color_profile;if("scp"in t)return t.scp},Rn=t=>Qt(t)!==void 0,Un=t=>{const e=Qt(t);return n(e,"strip_color_profile"),`scp:${c(e)}`},Vn=Object.freeze(Object.defineProperty({__proto__:null,build:Un,test:Rn},Symbol.toStringTag,{value:"Module"})),Xt=t=>"strip_metadata"in t?t.strip_metadata:"sm"in t?t.sm:void 0,Nn=t=>Xt(t)!==void 0,Hn=t=>{const e=Xt(t);return n(e,"strip_metadata"),`sm:${c(e)}`},Cn=Object.freeze(Object.defineProperty({__proto__:null,build:Hn,test:Nn},Symbol.toStringTag,{value:"Module"})),Wt=t=>t.style||t.stl,Dn=t=>!!Wt(t),Qn=t=>{const e=Wt(t);return n(e,"style"),b(e,"style"),`stl:${e}`},Xn=Object.freeze(Object.defineProperty({__proto__:null,build:Qn,test:Dn},Symbol.toStringTag,{value:"Module"})),Jt=t=>t.trim||t.t,Wn=t=>!!Jt(t),Jn=t=>{const e=Jt(t);n(e,"trim");const{threshold:o,color:r,equal_hor:s,equal_ver:a}=e;n(o,"trim.threshold"),i(o,"trim.threshold"),r&&b(r,"trim.color",!0);const l=s===void 0?"":c(s),u=a===void 0?"":c(a);return`t:${o}:${r||""}:${l}:${u}`.replace(/:+$/,"")},Yn=Object.freeze(Object.defineProperty({__proto__:null,build:Jn,test:Wn},Symbol.toStringTag,{value:"Module"})),Gn={auto:!0,none:!0,always:!0},Yt=t=>t.unsharp_masking||t.ush,Kn=t=>!!Yt(t),Ln=t=>{const e=Yt(t);n(e,"unsharp_masking");const{mode:o,weight:r,divider:s}=e;return o&&d(Gn,o,"unsharp_masking.mode"),r!==void 0&&i(r,"unsharp_masking.weight",{addParam:{min:0,minEqual:!0}}),s!==void 0&&i(s,"unsharp_masking.divider",{addParam:{min:0,minEqual:!0}}),`ush:${o||""}:${r||""}:${s||""}`.replace(/:+$/,"")},Zn=Object.freeze(Object.defineProperty({__proto__:null,build:Ln,test:Kn},Symbol.toStringTag,{value:"Module"})),Gt=t=>{if("video_thumbnail_second"in t)return t.video_thumbnail_second;if("vts"in t)return t.vts},ts=t=>Gt(t)!==void 0,es=t=>{const e=Gt(t);return n(e,"video_thumbnail_second"),i(e,"video_thumbnail_second",{addParam:{min:1,isInt:!0}}),`vts:${e}`},Kt=Object.freeze(Object.defineProperty({__proto__:null,build:es,test:ts},Symbol.toStringTag,{value:"Module"}));function Lt(t){return t.video_thumbnail_animation||t.vta}function os(t){return!!Lt(t)}function rs(t){const e=Lt(t);n(e,"video_thumbnail_animation"),i(e.step,"video_thumbnail_animation.step"),i(e.delay,"video_thumbnail_animation.delay"),i(e.frames,"video_thumbnail_animation.frames"),e.frame_width!==void 0&&i(e.frame_width,"video_thumbnail_animation.frame_width"),e.frame_height!==void 0&&i(e.frame_height,"video_thumbnail_animation.frame_height");const o=[],r=e.extend_frame!==void 0?c(e.extend_frame):void 0,s=e.trim!==void 0?c(e.trim):void 0,a=e.fill!==void 0?c(e.fill):void 0;for(o.push(r,s,a),a==="t"&&o.push(e.focus_x,e.focus_y);o.length>0&&o[o.length-1]===void 0;)o.pop();const l=o.length>0?`:${o.join(":")}`:"";return`vta:${e.step}:${e.delay}:${e.frames}:${e.frame_width}:${e.frame_height}${l}`}const ns=Object.freeze(Object.defineProperty({__proto__:null,build:rs,test:os},Symbol.toStringTag,{value:"Module"}));function Zt(t){return t.video_thumbnail_tile||t.vtt}function ss(t){return!!Zt(t)}function is(t){const e=Zt(t);n(e,"video_thumbnail_tile"),i(e.step,"video_thumbnail_tile.step"),i(e.columns,"video_thumbnail_tile.columns"),i(e.rows,"video_thumbnail_tile.rows"),i(e.tile_width,"video_thumbnail_tile.tile_width"),i(e.tile_height,"video_thumbnail_tile.tile_height");const o=[],r=e.extend_tile!==void 0?c(e.extend_tile):void 0,s=e.trim!==void 0?c(e.trim):void 0,a=e.fill!==void 0?c(e.fill):void 0;for(o.push(r,s,a),a==="t"&&o.push(e.focus_x,e.focus_y);o.length>0&&o[o.length-1]===void 0;)o.pop();const l=o.length>0?`:${o.join(":")}`:"";return`vtt:${e.step}:${e.columns}:${e.rows}:${e.tile_width}:${e.tile_height}${l}`}const as=Object.freeze(Object.defineProperty({__proto__:null,build:is,test:ss},Symbol.toStringTag,{value:"Module"})),ls={ce:!0,no:!0,so:!0,ea:!0,we:!0,noea:!0,nowe:!0,soea:!0,sowe:!0,re:!0,ch:!0},te=t=>t.watermark||t.wm,cs=t=>!!te(t),us=t=>{const e=te(t);n(e,"watermark");const{opacity:o,position:r,x_offset:s,y_offset:a,scale:l}=e;return n(o,"watermark.opacity"),i(o,"watermark.opacity",{addParam:{min:0,max:1}}),r&&(b(r,"watermark.position"),d(ls,r,"watermark.position")),s&&i(s,"watermark.x_offset"),a&&i(a,"watermark.y_offset"),l&&i(l,"watermark.scale"),`wm:${o}:${r||""}:${s||""}:${a||""}:${l||""}`.replace(/:+$/,"")},ds=Object.freeze(Object.defineProperty({__proto__:null,build:us,test:cs},Symbol.toStringTag,{value:"Module"})),ee=t=>t.watermark_shadow??t.wmsh,_s=t=>!!ee(t),bs=t=>{const e=ee(t);return n(e,"watermark_shadow"),i(e,"watermark_shadow",{addParam:{min:0}}),`wmsh:${e}`},ms=Object.freeze(Object.defineProperty({__proto__:null,build:bs,test:_s},Symbol.toStringTag,{value:"Module"})),oe=t=>t.watermark_size||t.wms,ps=t=>!!oe(t),fs=t=>{const e=oe(t);n(e,"watermark_size");const{width:o,height:r}=e;return o&&i(o,"watermark_size.width",{addParam:{min:0}}),r&&i(r,"watermark_size.height",{addParam:{min:0}}),`wms:${o||""}:${r||""}`.replace(/:+$/,"")},gs=Object.freeze(Object.defineProperty({__proto__:null,build:fs,test:ps},Symbol.toStringTag,{value:"Module"})),re=t=>t.watermark_text||t.wmt,$s=t=>!!re(t),ys=t=>{const e=re(t);return n(e,"watermark_text"),b(e,"watermark_text"),`wmt:${e}`},Os=Object.freeze(Object.defineProperty({__proto__:null,build:ys,test:$s},Symbol.toStringTag,{value:"Module"})),ne=t=>t.watermark_url||t.wmu,hs=t=>!!ne(t),vs=t=>{const e=ne(t);return n(e,"watermark_url"),b(e,"watermark_url"),`wmu:${e}`},js=Object.freeze(Object.defineProperty({__proto__:null,build:vs,test:hs},Symbol.toStringTag,{value:"Module"})),ws={lossy:!0,near_lossless:!0,lossless:!0},Ss={default:!0,photo:!0,picture:!0,drawing:!0,icon:!0,text:!0},se=t=>t.webp_options||t.webpo,Ps=t=>!!se(t),xs=t=>{const e=se(t);let o,r,s;n(e,"webp_options"),typeof e=="string"?o=e:(o=e.compression,e.smart_subsample!==void 0&&(r=e.smart_subsample,p(r,"webp_options.smart_subsample")),e.preset!==void 0&&(s=e.preset,d(Ss,s,"webp_options.preset"))),d(ws,o,"webp_options");let a=`webpo:${o}`;return(r!==void 0||s!==void 0)&&(a+=`:${r!==void 0?r:""}`),s!==void 0&&(a+=`:${s}`),a},zs=Object.freeze(Object.defineProperty({__proto__:null,build:xs,test:Ps},Symbol.toStringTag,{value:"Module"})),ie=t=>t.width??t.w,Ts=t=>!!ie(t),Ms=t=>{const e=ie(t);return n(e,"width"),i(e,"width",{addParam:{min:0}}),`w:${e}`},ks=Object.freeze(Object.defineProperty({__proto__:null,build:Ms,test:Ts},Symbol.toStringTag,{value:"Module"})),j=(t,e)=>{n(t,e),i(t,e,{addParam:{min:0}})},ae=t=>t.zoom||t.z,Bs=t=>!!ae(t),qs=t=>{const e=ae(t);return n(e,"zoom"),typeof e=="string"&&i(e,"zoom"),typeof e=="number"?(j(e,"zoom"),`z:${e}`):(j(e.zoom_x,"zoom.zoom_x"),j(e.zoom_y,"zoom.zoom_y"),`z:${e.zoom_x}:${e.zoom_y}`)},Es=Object.freeze(Object.defineProperty({__proto__:null,build:qs,test:Bs},Symbol.toStringTag,{value:"Module"})),Is=t=>t.wild_options,As=t=>!!Is(t),Fs=t=>{const e=t.wild_options;if(n(e,"raw_options"),f(e,"raw_options"),!e.every(r=>Array.isArray(r)))throw new Error("raw_options is not an array of arrays");let o="";for(let r=0;r<e.length;r++){let s="";for(let a=0;a<e[r].length;a++)a>0&&(s+=":"),s+=e[r][a];r>0&&(o+="/"),o+=s}return o},le=Object.freeze(Object.defineProperty({__proto__:null,build:Fs,test:As},Symbol.toStringTag,{value:"Module"})),Rs=Object.freeze(Object.defineProperty({__proto__:null,adjust:Se,autoRotate:Be,autoquality:Te,background:Ie,backgroundAlpha:Re,blur:Ne,blurDetections:De,brightness:We,cacheBuster:N,colorize:Le,contrast:eo,crop:W,cropAspectRatio:lo,disableAnimation:_o,dpi:$o,dpr:ho,drawDetections:wo,duotone:po,enforceThumbnail:xo,enlarge:Mo,expires:rt,extend:Eo,extendAspectRatio:Fo,fallbackImageUrl:Vo,filename:Co,format:Wo,formatQuality:Go,gradient:tr,gravity:ro,height:rr,jpegOptions:ir,keepCopyright:cr,maxAnimationFrameResolution:pr,maxAnimationFrames:_r,maxBytes:$r,maxResultDimension:hr,maxSrcFileSize:ht,maxSrcResolution:jt,minHeight:Br,minWidth:Ir,monochrome:Rr,objectPosition:Sr,padding:Nr,page:Tt,pages:Xr,pixelate:Yr,pngOptions:Lr,preset:v,quality:rn,raw:an,resize:dn,resizingAlgorithm:pn,resizingType:yn,returnAttachment:vn,rotate:Sn,saturation:zn,sharpen:kn,size:En,skipProcessing:Fn,stripColorProfile:Vn,stripMetadata:Cn,style:Xn,trim:Yn,unsharpMasking:Zn,videoThumbnailAnimation:ns,videoThumbnailSecond:Kt,videoThumbnailTile:as,watermark:ds,watermarkShadow:ms,watermarkSize:gs,watermarkText:Os,watermarkUrl:js,webpOptions:zs,width:ks,wildOptions:le,zoom:Es},Symbol.toStringTag,{value:"Module"})),M={plain:!0,base64:!0,encrypted:!0},Us=Object.values(Rs),Vs=[v],Ns=(t,e,o)=>{n(t.value,"url.value","Must be a string"),n(t.type,"url.type",`Valid values are: ${Object.keys(M).join(", ")}`),d(M,t.type,"url.type");let r="";if(e){const a=o!=null&&o.onlyPresets?Vs:Us;for(const l of a)l.test(e)&&(r+="/",r+=l.build(e,o))}let s="";return t.type==="plain"?s=`/plain/${t.value}`:t.type==="base64"?s=`/${t.value}`:t.type==="encrypted"&&(s=`/enc/${t.value}`),`${r}${s}`},ce=t=>{if("average"in t)return t.average;if("avg"in t)return t.avg},Hs=t=>ce(t)!==void 0,Cs=t=>{const e=ce(t);n(e,"average"),n(e.average,"average.average");const o=e.ignore_transparent===void 0?"":`:${c(e.ignore_transparent)}`;return`avg:${c(e.average)}${o}`},Ds=Object.freeze(Object.defineProperty({__proto__:null,build:Cs,test:Hs},Symbol.toStringTag,{value:"Module"})),ue=t=>{if("blurhash"in t)return t.blurhash;if("bh"in t)return t.bh},Qs=t=>ue(t)!==void 0,Xs=t=>{const e=ue(t);n(e,"blurhash");const{x_components:o,y_components:r}=e;return n(o,"blurhash.x_components"),n(r,"blurhash.y_components"),i(o,"blurhash.x_components",{addParam:{min:0,max:9}}),i(r,"blurhash.y_components",{addParam:{min:0,max:9}}),`bh:${o}:${r}`},Ws=Object.freeze(Object.defineProperty({__proto__:null,build:Xs,test:Qs},Symbol.toStringTag,{value:"Module"})),de=t=>{if("calcHashsums"in t)return t.calcHashsums;if("chs"in t)return t.chs},Js=t=>de(t)!==void 0,Ys=t=>{const e=de(t);return n(e,"calcHashsums"),e.length?`chs:${e.join(":")}`:"chs:"},Gs=Object.freeze(Object.defineProperty({__proto__:null,build:Ys,test:Js},Symbol.toStringTag,{value:"Module"})),_e=t=>{if("detect_objects"in t)return t.detect_objects;if("do"in t)return t.do},Ks=t=>_e(t)!==void 0,Ls=t=>{const e=_e(t);return n(e,"detect_objects"),`do:${c(e)}`},Zs=Object.freeze(Object.defineProperty({__proto__:null,build:Ls,test:Ks},Symbol.toStringTag,{value:"Module"})),be=t=>{if("dimensions"in t)return t.dimensions;if("d"in t)return t.d},ti=t=>be(t)!==void 0,ei=t=>{const e=be(t);return n(e,"dimensions"),`d:${c(e)}`},oi=Object.freeze(Object.defineProperty({__proto__:null,build:ei,test:ti},Symbol.toStringTag,{value:"Module"})),me=t=>{if("dominant_colors"in t)return t.dominant_colors;if("dc"in t)return t.dc},ri=t=>me(t)!==void 0,ni=t=>{const e=me(t);n(e,"dominant_colors"),n(e.dominant_colors,"dominant_colors.dominant_colors");const o=e.build_missed===void 0?"":`:${c(e.build_missed)}`;return`dc:${c(e.dominant_colors)}${o}`},si=Object.freeze(Object.defineProperty({__proto__:null,build:ni,test:ri},Symbol.toStringTag,{value:"Module"})),pe=t=>{if("exif"in t)return t.exif},ii=t=>pe(t)!==void 0,ai=t=>{const e=pe(t);return n(e,"EXIF"),`exif:${c(e)}`},li=Object.freeze(Object.defineProperty({__proto__:null,build:ai,test:ii},Symbol.toStringTag,{value:"Module"})),fe=t=>{if("format"in t)return t.format;if("f"in t)return t.f},ci=t=>fe(t)!==void 0,ui=t=>{const e=fe(t);return n(e,"format"),`f:${c(e)}`},di=Object.freeze(Object.defineProperty({__proto__:null,build:ui,test:ci},Symbol.toStringTag,{value:"Module"})),ge=t=>{if("iptc"in t)return t.iptc},_i=t=>ge(t)!==void 0,bi=t=>{const e=ge(t);return n(e,"IPTC"),`iptc:${c(e)}`},mi=Object.freeze(Object.defineProperty({__proto__:null,build:bi,test:_i},Symbol.toStringTag,{value:"Module"})),$e=t=>{if("palette"in t)return t.palette;if("p"in t)return t.p},pi=t=>$e(t)!==void 0,fi=t=>{const e=$e(t);if(n(e,"palette"),i(e,"palette",{addParam:{min:0,max:256,isInt:!0}}),e===1)throw new Error("palette option is should be 0 or between 2 and 256");return`p:${e}`},gi=Object.freeze(Object.defineProperty({__proto__:null,build:fi,test:pi},Symbol.toStringTag,{value:"Module"})),ye=t=>{if("size"in t)return t.size;if("s"in t)return t.s},$i=t=>ye(t)!==void 0,yi=t=>{const e=ye(t);return n(e,"size"),`s:${c(e)}`},Oi=Object.freeze(Object.defineProperty({__proto__:null,build:yi,test:$i},Symbol.toStringTag,{value:"Module"})),Oe=t=>{if("video_meta"in t)return t.video_meta;if("vm"in t)return t.vm},hi=t=>Oe(t)!==void 0,vi=t=>{const e=Oe(t);return n(e,"video_meta"),`vm:${c(e)}`},ji=Object.freeze(Object.defineProperty({__proto__:null,build:vi,test:hi},Symbol.toStringTag,{value:"Module"})),he=t=>{if("xmp"in t)return t.xmp},wi=t=>he(t)!==void 0,Si=t=>{const e=he(t);return n(e,"XMP"),`xmp:${c(e)}`},Pi=Object.freeze(Object.defineProperty({__proto__:null,build:Si,test:wi},Symbol.toStringTag,{value:"Module"})),xi=Object.freeze(Object.defineProperty({__proto__:null,average:Ds,blurhash:Ws,cacheBuster:N,calcHashsums:Gs,crop:W,detectObjects:Zs,dimensions:oi,dominantColors:si,exif:li,expires:rt,format:di,iptc:mi,maxSrcFileSize:ht,maxSrcResolution:jt,page:Tt,palette:gi,preset:v,size:Oi,videoMeta:ji,videoThumbnailSecond:Kt,wildOptions:le,xmp:Pi},Symbol.toStringTag,{value:"Module"})),k={plain:!0,base64:!0,encrypted:!0},zi=Object.values(xi),Ti=[v],Mi=(t,e,o)=>{n(t.value,"url.value","Must be a string"),n(t.type,"url.type",`Valid values are: ${Object.keys(k).join(", ")}`),d(k,t.type,"url.type");let r="";if(e){const a=o!=null&&o.onlyPresets?Ti:zi;for(const l of a)l.test(e)&&(r+="/",r+=l.build(e,o))}let s="";return t.type==="plain"?s=`/plain/${t.value}`:t.type==="base64"?s=`/${t.value}`:t.type==="encrypted"&&(s=`/enc/${t.value}`),`${r}${s}`},ki="/info";exports.INFO_PREFIX=ki;exports.generateImageInfoUrl=Mi;exports.generateUrl=Ns;
;