@imgly/plugin-ai-sticker-generation-web 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/LICENSE.md +1 -0
- package/README.md +308 -0
- package/dist/constants.d.ts +1 -0
- package/dist/fal-ai/Recraft20b.constants.d.ts +30 -0
- package/dist/fal-ai/Recraft20b.d.ts +30 -0
- package/dist/fal-ai/createStickerProvider.d.ts +40 -0
- package/dist/fal-ai/index.d.ts +5 -0
- package/dist/fal-ai/index.mjs +169 -0
- package/dist/fal-ai/index.mjs.map +7 -0
- package/dist/fal-ai/utils.d.ts +8 -0
- package/dist/iconSprite.d.ts +3 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +117 -0
- package/dist/index.mjs.map +7 -0
- package/dist/plugin.d.ts +6 -0
- package/dist/types.d.ts +52 -0
- package/package.json +89 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var zn=Object.create;var xi=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var Bn=Object.getPrototypeOf,Rn=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var qn=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ln(t))!Rn.call(e,n)&&n!==i&&xi(e,n,{get:()=>t[n],enumerable:!(r=Fn(t,n))||r.enumerable});return e};var Ii=(e,t,i)=>(i=e!=null?zn(Bn(e)):{},qn(t||!e||!e.__esModule?xi(i,"default",{value:e,enumerable:!0}):i,e));var Ft=I($=>{"use strict";var nd=$&&$.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})};Object.defineProperty($,"__esModule",{value:!0});$.TARGET_URL_HEADER=void 0;$.withMiddleware=od;$.withProxy=ad;function od(...e){let t=i=>typeof i=="function";return i=>nd(this,void 0,void 0,function*(){let r=Object.assign({},i);for(let n of e.filter(t))r=yield n(r);return r})}$.TARGET_URL_HEADER="x-fal-target-url";function ad(e){let t=i=>Promise.resolve(i);return typeof window>"u"?t:i=>i.headers&&$.TARGET_URL_HEADER in i?t(i):Promise.resolve(Object.assign(Object.assign({},i),{url:e.targetUrl,headers:Object.assign(Object.assign({},i.headers||{}),{[$.TARGET_URL_HEADER]:i.url})}))}});var Q=I(O=>{"use strict";var yr=O&&O.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})};Object.defineProperty(O,"__esModule",{value:!0});O.ValidationError=O.ApiError=void 0;O.defaultResponseHandler=br;O.resultResponseHandler=ld;var sd="x-fal-request-id",he=class extends Error{constructor({message:t,status:i,body:r}){super(t),this.name="ApiError",this.status=i,this.body=r}};O.ApiError=he;var We=class extends he{constructor(t){super(t),this.name="ValidationError"}get fieldErrors(){return typeof this.body.detail=="string"?[{loc:["body"],msg:this.body.detail,type:"value_error"}]:this.body.detail||[]}getFieldErrors(t){return this.fieldErrors.filter(i=>i.loc[i.loc.length-1]===t)}};O.ValidationError=We;function br(e){return yr(this,void 0,void 0,function*(){var t;let{status:i,statusText:r}=e,n=(t=e.headers.get("Content-Type"))!==null&&t!==void 0?t:"";if(!e.ok){if(n.includes("application/json")){let o=yield e.json(),a=i===422?We:he;throw new a({message:o.message||r,status:i,body:o})}throw new he({message:`HTTP ${i}: ${r}`,status:i})}return n.includes("application/json")?e.json():n.includes("text/html")?e.text():n.includes("application/octet-stream")?e.arrayBuffer():e.text()})}function ld(e){return yr(this,void 0,void 0,function*(){return{data:yield br(e),requestId:e.headers.get(sd)||""}})}});var _r=I((Ih,cd)=>{cd.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.3.0",license:"MIT",repository:{type:"git",url:"https://github.com/fal-ai/fal-js.git",directory:"libs/client"},keywords:["fal","client","ai","ml","typescript"],exports:{".":"./src/index.js","./endpoints":"./src/types/endpoints.js"},typesVersions:{"*":{endpoints:["src/types/endpoints.d.ts"]}},main:"./src/index.js",types:"./src/index.d.ts",dependencies:{"@msgpack/msgpack":"^3.0.0-beta2","eventsource-parser":"^1.1.2",robot3:"^0.4.1"},engines:{node:">=18.0.0"},type:"commonjs"}});var Xe=I(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.isBrowser=ud;Ze.getUserAgent=dd;function ud(){return typeof window<"u"&&typeof window.document<"u"}var Qe=null;function dd(){if(Qe!==null)return Qe;let e=_r();return Qe=`${e.name}/${e.version}`,Qe}});var Je=I(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.credentialsFromEnv=void 0;B.resolveDefaultFetch=wr;B.createConfig=yd;B.getRestApiUrl=bd;var vr=Ft(),gd=Q(),pd=Xe();function wr(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function hd(){return typeof process<"u"&&process.env&&(typeof process.env.FAL_KEY<"u"||typeof process.env.FAL_KEY_ID<"u"&&typeof process.env.FAL_KEY_SECRET<"u")}var fd=()=>{if(hd())return typeof process.env.FAL_KEY<"u"?process.env.FAL_KEY:process.env.FAL_KEY_ID?`${process.env.FAL_KEY_ID}:${process.env.FAL_KEY_SECRET}`:void 0};B.credentialsFromEnv=fd;var md={credentials:B.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:e=>Promise.resolve(e),responseHandler:gd.defaultResponseHandler};function yd(e){var t;let i=Object.assign(Object.assign(Object.assign({},md),e),{fetch:(t=e.fetch)!==null&&t!==void 0?t:wr()});e.proxyUrl&&(i=Object.assign(Object.assign({},i),{requestMiddleware:(0,vr.withMiddleware)(i.requestMiddleware,(0,vr.withProxy)({targetUrl:e.proxyUrl}))}));let{credentials:r,suppressLocalCredentialsWarning:n}=i,o=typeof r=="function"?r():r;return(0,pd.isBrowser)()&&o&&!n&&console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases."),i}function bd(){return"https://rest.alpha.fal.ai"}});var Z=I(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.ensureEndpointIdFormat=xr;R.parseEndpointId=vd;R.isValidUrl=wd;R.throttle=xd;R.isReact=Id;R.isPlainObject=kd;function xr(e){if(e.split("/").length>1)return e;let[,i,r]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(e)||[];if(i&&r)return`${i}/${r}`;throw new Error(`Invalid app id: ${e}. Must be in the format <appOwner>/<appId>`)}var _d=["workflows","comfy"];function vd(e){let i=xr(e).split("/");return _d.includes(i[0])?{owner:i[1],alias:i[2],path:i.slice(3).join("/")||void 0,namespace:i[0]}:{owner:i[0],alias:i[1],path:i.slice(2).join("/")||void 0}}function wd(e){try{let{host:t}=new URL(e);return/(fal\.(ai|run))$/.test(t)}catch{return!1}}function xd(e,t,i=!1){let r,n;return(...o)=>{!n&&i?(e(...o),n=Date.now()):(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-n>=t&&(e(...o),n=Date.now())},t-(Date.now()-n)))}}var Lt;function Id(){if(Lt===void 0){let e=new Error().stack;Lt=!!e&&(e.includes("node_modules/react-dom/")||e.includes("node_modules/next/"))}return Lt}function kd(e){return!!e&&Object.getPrototypeOf(e)===Object.prototype}});var fe=I(q=>{"use strict";var Sd=q&&q.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})},Ed=q&&q.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};Object.defineProperty(q,"__esModule",{value:!0});q.dispatchRequest=Cd;q.buildUrl=Td;var Ir=Xe(),kr=Z(),Ad=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function Cd(e){return Sd(this,void 0,void 0,function*(){var t,i,r;let{targetUrl:n,input:o,config:a,options:s={}}=e,{credentials:c,requestMiddleware:d,responseHandler:l,fetch:u}=a,f=(0,Ir.isBrowser)()?{}:{"User-Agent":(0,Ir.getUserAgent)()},p=typeof c=="function"?c():c,{method:m,url:v,headers:w}=yield d({method:((i=(t=e.method)!==null&&t!==void 0?t:s.method)!==null&&i!==void 0?i:"post").toUpperCase(),url:n,headers:e.headers}),g=p?{Authorization:`Key ${p}`}:{},h=Object.assign(Object.assign(Object.assign(Object.assign({},g),{Accept:"application/json","Content-Type":"application/json"}),f),w??{}),{responseHandler:_}=s,b=Ed(s,["responseHandler"]),C=yield u(v,Object.assign(Object.assign(Object.assign(Object.assign({},b),{method:m,headers:Object.assign(Object.assign({},h),(r=b.headers)!==null&&r!==void 0?r:{})}),!Ad&&{mode:"cors"}),{signal:s.signal,body:m.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(_??l)(C)})}function Td(e,t={}){var i,r;let n=((i=t.method)!==null&&i!==void 0?i:"post").toLowerCase(),o=((r=t.path)!==null&&r!==void 0?r:"").replace(/^\//,"").replace(/\/{2,}/,"/"),a=t.input,s=Object.assign(Object.assign({},t.query||{}),n==="get"?a:{}),c=Object.keys(s).length>0?`?${new URLSearchParams(s).toString()}`:"";if((0,kr.isValidUrl)(e))return`${e.endsWith("/")?e:`${e}/`}${o}${c}`;let d=(0,kr.ensureEndpointIdFormat)(e);return`${`https://${t.subdomain?`${t.subdomain}.`:""}fal.run/${d}/${o}`.replace(/\/$/,"")}${c}`}});var Er=I(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});function Md(e){let t,i,r,n,o,a,s;return c(),{feed:d,reset:c};function c(){t=!0,i="",r=0,n=-1,o=void 0,a=void 0,s=""}function d(u){i=i?i+u:u,t&&jd(i)&&(i=i.slice(Sr.length)),t=!1;let f=i.length,p=0,m=!1;for(;p<f;){m&&(i[p]===`
|
|
2
|
+
`&&++p,m=!1);let v=-1,w=n,g;for(let h=r;v<0&&h<f;++h)g=i[h],g===":"&&w<0?w=h-p:g==="\r"?(m=!0,v=h-p):g===`
|
|
3
|
+
`&&(v=h-p);if(v<0){r=f-p,n=w;break}else r=0,n=-1;l(i,p,w,v),p+=v+1}p===f?i="":p>0&&(i=i.slice(p))}function l(u,f,p,m){if(m===0){s.length>0&&(e({type:"event",id:o,event:a||void 0,data:s.slice(0,-1)}),s="",o=void 0),a=void 0;return}let v=p<0,w=u.slice(f,f+(v?m:p)),g=0;v?g=m:u[f+p+1]===" "?g=p+2:g=p+1;let h=f+g,_=m-g,b=u.slice(h,h+_).toString();if(w==="data")s+=b?"".concat(b,`
|
|
4
|
+
`):`
|
|
5
|
+
`;else if(w==="event")a=b;else if(w==="id"&&!b.includes("\0"))o=b;else if(w==="retry"){let C=parseInt(b,10);Number.isNaN(C)||e({type:"reconnect-interval",value:C})}}}var Sr=[239,187,191];function jd(e){return Sr.every((t,i)=>e.charCodeAt(i)===t)}Bt.createParser=Md});var Rt=I(V=>{"use strict";var $d=V&&V.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})};Object.defineProperty(V,"__esModule",{value:!0});V.TOKEN_EXPIRATION_SECONDS=void 0;V.getTemporaryAuthToken=Ud;var Od=Je(),Pd=fe(),Dd=Z();V.TOKEN_EXPIRATION_SECONDS=120;function Ud(e,t){return $d(this,void 0,void 0,function*(){let i=(0,Dd.parseEndpointId)(e),r=yield(0,Pd.dispatchRequest)({method:"POST",targetUrl:`${(0,Od.getRestApiUrl)()}/tokens/`,config:t,input:{allowed_apps:[i.alias],token_expiration:V.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var Vt=I(j=>{"use strict";var je=j&&j.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})},$e=j&&j.__await||function(e){return this instanceof $e?(this.v=e,this):new $e(e)},Nd=j&&j.__asyncGenerator||function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(e,t||[]),n,o=[];return n={},s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(p){return function(m){return Promise.resolve(m).then(p,u)}}function s(p,m){r[p]&&(n[p]=function(v){return new Promise(function(w,g){o.push([p,v,w,g])>1||c(p,v)})},m&&(n[p]=m(n[p])))}function c(p,m){try{d(r[p](m))}catch(v){f(o[0][3],v)}}function d(p){p.value instanceof $e?Promise.resolve(p.value.v).then(l,u):f(o[0][2],p)}function l(p){c("next",p)}function u(p){c("throw",p)}function f(p,m){p(m),o.shift(),o.length&&c(o[0][0],o[0][1])}};Object.defineProperty(j,"__esModule",{value:!0});j.FalStream=void 0;j.createStreamingClient=Bd;var zd=Er(),Fd=Rt(),Ar=fe(),me=Q(),qt="text/event-stream",Ld=15*1e3,et=class{constructor(t,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this.abortController=new AbortController,this.start=()=>je(this,void 0,void 0,function*(){var o,a;let{endpointId:s,options:c}=this,{input:d,method:l="post",connectionMode:u="server"}=c;try{if(u==="client"){let f=yield(0,Fd.getTemporaryAuthToken)(s,this.config),{fetch:p}=this.config,m=new URL(this.url);m.searchParams.set("fal_jwt_token",f);let v=yield p(m.toString(),{method:l.toUpperCase(),headers:{accept:(o=c.accept)!==null&&o!==void 0?o:qt,"content-type":"application/json"},body:d&&l!=="get"?JSON.stringify(d):void 0,signal:this.abortController.signal});return yield this.handleResponse(v)}return yield(0,Ar.dispatchRequest)({method:l.toUpperCase(),targetUrl:this.url,input:d,config:this.config,options:{headers:{accept:(a=c.accept)!==null&&a!==void 0?a:qt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(f){this.handleError(f)}}),this.handleResponse=o=>je(this,void 0,void 0,function*(){var a,s;if(!o.ok){try{yield(0,me.defaultResponseHandler)(o)}catch(v){this.emit("error",v)}return}let c=o.body;if(!c){this.emit("error",new me.ApiError({message:"Response body is empty.",status:400,body:void 0}));return}if(!((a=o.headers.get("content-type"))!==null&&a!==void 0?a:"").startsWith(qt)){let v=c.getReader(),w=()=>{v.read().then(({done:g,value:h})=>{if(g){this.emit("done",this.currentData);return}this.currentData=h,this.emit("data",h),w()})};w();return}let l=new TextDecoder("utf-8"),u=o.body.getReader(),f=(0,zd.createParser)(v=>{if(v.type==="event"){let w=v.data;try{let g=JSON.parse(w);this.buffer.push(g),this.currentData=g,this.emit("data",g),this.emit("message",g)}catch(g){this.emit("error",g)}}}),p=(s=this.options.timeout)!==null&&s!==void 0?s:Ld,m=()=>je(this,void 0,void 0,function*(){let{value:v,done:w}=yield u.read();this.lastEventTimestamp=Date.now(),f.feed(l.decode(v)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new me.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408})),w?this.emit("done",this.currentData):m().catch(this.handleError)});m().catch(this.handleError)}),this.handleError=o=>{var a;if(o.name==="AbortError"||this.signal.aborted)return;let s=o instanceof me.ApiError?o:new me.ApiError({message:(a=o.message)!==null&&a!==void 0?a:"An unknown error occurred",status:500});this.emit("error",s)},this.on=(o,a)=>{var s;this.listeners.has(o)||this.listeners.set(o,[]),(s=this.listeners.get(o))===null||s===void 0||s.push(a)},this.emit=(o,a)=>{let s=this.listeners.get(o)||[];for(let c of s)c(a)},this.done=()=>je(this,void 0,void 0,function*(){return this.donePromise}),this.abort=o=>{this.streamClosed||this.abortController.abort(o)},this.endpointId=t,this.config=i,this.url=(n=r.url)!==null&&n!==void 0?n:(0,Ar.buildUrl)(t,{path:"/stream",query:r.queryParams}),this.options=r,this.donePromise=new Promise((o,a)=>{this.streamClosed&&a(new me.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0})),this.signal.addEventListener("abort",()=>{var s;o((s=this.currentData)!==null&&s!==void 0?s:{})}),this.on("done",s=>{this.streamClosed=!0,o(s)}),this.on("error",s=>{this.streamClosed=!0,a(s)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return Nd(this,arguments,function*(){let i=!0,r=()=>i=!1;for(this.on("error",r),this.on("done",r);i||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield $e(n)),yield $e(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}};j.FalStream=et;function Bd({config:e,storage:t}){return{stream(i,r){return je(this,void 0,void 0,function*(){let n=r.input?yield t.transformInput(r.input):void 0;return new et(i,e,Object.assign(Object.assign({},r),{input:n}))})}}}});var Tr=I(H=>{"use strict";var X=H&&H.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})},Rd=H&&H.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};Object.defineProperty(H,"__esModule",{value:!0});H.createQueueClient=void 0;var N=fe(),qd=Q(),Vd=Vt(),tt=Z(),Cr=500,Hd=({config:e,storage:t})=>{let i={submit(r,n){return X(this,void 0,void 0,function*(){let{webhookUrl:o,priority:a}=n,s=Rd(n,["webhookUrl","priority"]),c=n.input?yield t.transformInput(n.input):void 0;return(0,N.dispatchRequest)({method:n.method,targetUrl:(0,N.buildUrl)(r,Object.assign(Object.assign({},s),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:{"x-fal-queue-priority":a??"normal"},input:c,config:e,options:{signal:n.abortSignal}})})},status(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,abortSignal:c}){let d=(0,tt.parseEndpointId)(o),l=d.namespace?`${d.namespace}/`:"";return(0,N.dispatchRequest)({method:"get",targetUrl:(0,N.buildUrl)(`${l}${d.owner}/${d.alias}`,{subdomain:"queue",query:{logs:s?"1":"0"},path:`/requests/${a}/status`}),config:e,options:{signal:c}})})},streamStatus(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,connectionMode:c}){let d=(0,tt.parseEndpointId)(o),l=d.namespace?`${d.namespace}/`:"",u={logs:s?"1":"0"},f=(0,N.buildUrl)(`${l}${d.owner}/${d.alias}`,{subdomain:"queue",path:`/requests/${a}/status/stream`,query:u});return new Vd.FalStream(o,e,{url:f,method:"get",connectionMode:c,queryParams:u})})},subscribeToStatus(r,n){return X(this,void 0,void 0,function*(){let o=n.requestId,a=n.timeout,s,c=()=>{};if(n.mode==="streaming"){let d=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),l=[];a&&(s=setTimeout(()=>{throw d.abort(),i.cancel(r,{requestId:o}).catch(c),new Error(`Client timed out waiting for the request to complete after ${a}ms`)},a)),d.on("data",f=>{n.onQueueUpdate&&("logs"in f&&Array.isArray(f.logs)&&f.logs.length>0&&l.push(...f.logs),n.onQueueUpdate("logs"in f?Object.assign(Object.assign({},f),{logs:l}):f))});let u=yield d.done();return s&&clearTimeout(s),u}return new Promise((d,l)=>{var u;let f,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(u=n.pollInterval)!==null&&u!==void 0?u:Cr,m=()=>{s&&clearTimeout(s),f&&clearTimeout(f)};a&&(s=setTimeout(()=>{m(),i.cancel(r,{requestId:o}).catch(c),l(new Error(`Client timed out waiting for the request to complete after ${a}ms`))},a));let v=()=>X(this,void 0,void 0,function*(){var w;try{let g=yield i.status(r,{requestId:o,logs:(w=n.logs)!==null&&w!==void 0?w:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(g),g.status==="COMPLETED"){m(),d(g);return}f=setTimeout(v,p)}catch(g){m(),l(g)}});v().catch(l)})})},result(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let c=(0,tt.parseEndpointId)(o),d=c.namespace?`${c.namespace}/`:"";return(0,N.dispatchRequest)({method:"get",targetUrl:(0,N.buildUrl)(`${d}${c.owner}/${c.alias}`,{subdomain:"queue",path:`/requests/${a}`}),config:Object.assign(Object.assign({},e),{responseHandler:qd.resultResponseHandler}),options:{signal:s}})})},cancel(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let c=(0,tt.parseEndpointId)(o),d=c.namespace?`${c.namespace}/`:"";yield(0,N.dispatchRequest)({method:"put",targetUrl:(0,N.buildUrl)(`${d}${c.owner}/${c.alias}`,{subdomain:"queue",path:`/requests/${a}/cancel`}),config:e,options:{signal:s}})})}};return i};H.createQueueClient=Hd});var it=I(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.utf8Count=Gd;z.utf8EncodeJs=Mr;z.utf8EncodeTE=jr;z.utf8Encode=Wd;z.utf8DecodeJs=$r;z.utf8DecodeTD=Or;z.utf8Decode=Jd;function Gd(e){let t=e.length,i=0,r=0;for(;r<t;){let n=e.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))i+=2;else{if(n>=55296&&n<=56319&&r<t){let o=e.charCodeAt(r);(o&64512)===56320&&(++r,n=((n&1023)<<10)+(o&1023)+65536)}n&4294901760?i+=4:i+=3}else{i++;continue}}return i}function Mr(e,t,i){let r=e.length,n=i,o=0;for(;o<r;){let a=e.charCodeAt(o++);if(a&4294967168)if(!(a&4294965248))t[n++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<r){let s=e.charCodeAt(o);(s&64512)===56320&&(++o,a=((a&1023)<<10)+(s&1023)+65536)}a&4294901760?(t[n++]=a>>18&7|240,t[n++]=a>>12&63|128,t[n++]=a>>6&63|128):(t[n++]=a>>12&15|224,t[n++]=a>>6&63|128)}else{t[n++]=a;continue}t[n++]=a&63|128}}var Kd=new TextEncoder,Yd=50;function jr(e,t,i){Kd.encodeInto(e,t.subarray(i))}function Wd(e,t,i){e.length>Yd?jr(e,t,i):Mr(e,t,i)}var Qd=4096;function $r(e,t,i){let r=t,n=r+i,o=[],a="";for(;r<n;){let s=e[r++];if(!(s&128))o.push(s);else if((s&224)===192){let c=e[r++]&63;o.push((s&31)<<6|c)}else if((s&240)===224){let c=e[r++]&63,d=e[r++]&63;o.push((s&31)<<12|c<<6|d)}else if((s&248)===240){let c=e[r++]&63,d=e[r++]&63,l=e[r++]&63,u=(s&7)<<18|c<<12|d<<6|l;u>65535&&(u-=65536,o.push(u>>>10&1023|55296),u=56320|u&1023),o.push(u)}else o.push(s);o.length>=Qd&&(a+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(a+=String.fromCharCode(...o)),a}var Zd=new TextDecoder,Xd=200;function Or(e,t,i){let r=e.subarray(t,t+i);return Zd.decode(r)}function Jd(e,t,i){return i>Xd?Or(e,t,i):$r(e,t,i)}});var Gt=I(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.ExtData=void 0;var Ht=class{constructor(t,i){this.type=t,this.data=i}};rt.ExtData=Ht});var ot=I(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.DecodeError=void 0;var Kt=class e extends Error{constructor(t){super(t);let i=Object.create(e.prototype);Object.setPrototypeOf(this,i),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};nt.DecodeError=Kt});var at=I(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.UINT32_MAX=void 0;G.setUint64=eg;G.setInt64=tg;G.getInt64=ig;G.getUint64=rg;G.UINT32_MAX=4294967295;function eg(e,t,i){let r=i/4294967296,n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function tg(e,t,i){let r=Math.floor(i/4294967296),n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function ig(e,t){let i=e.getInt32(t),r=e.getUint32(t+4);return i*4294967296+r}function rg(e,t){let i=e.getUint32(t),r=e.getUint32(t+4);return i*4294967296+r}});var Yt=I(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.timestampExtension=T.EXT_TIMESTAMP=void 0;T.encodeTimeSpecToTimestamp=Dr;T.encodeDateToTimeSpec=Ur;T.encodeTimestampExtension=Nr;T.decodeTimestampToTimeSpec=zr;T.decodeTimestampExtension=Fr;var ng=ot(),Pr=at();T.EXT_TIMESTAMP=-1;var og=4294967296-1,ag=17179869184-1;function Dr({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=ag)if(t===0&&e<=og){let i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,e),i}else{let i=e/4294967296,r=e&4294967295,n=new Uint8Array(8),o=new DataView(n.buffer);return o.setUint32(0,t<<2|i&3),o.setUint32(4,r),n}else{let i=new Uint8Array(12),r=new DataView(i.buffer);return r.setUint32(0,t),(0,Pr.setInt64)(r,4,e),i}}function Ur(e){let t=e.getTime(),i=Math.floor(t/1e3),r=(t-i*1e3)*1e6,n=Math.floor(r/1e9);return{sec:i+n,nsec:r-n*1e9}}function Nr(e){if(e instanceof Date){let t=Ur(e);return Dr(t)}else return null}function zr(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let i=t.getUint32(0),r=t.getUint32(4),n=(i&3)*4294967296+r,o=i>>>2;return{sec:n,nsec:o}}case 12:{let i=(0,Pr.getInt64)(t,4),r=t.getUint32(0);return{sec:i,nsec:r}}default:throw new ng.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function Fr(e){let t=zr(e);return new Date(t.sec*1e3+t.nsec/1e6)}T.timestampExtension={type:T.EXT_TIMESTAMP,encode:Nr,decode:Fr}});var ct=I(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.ExtensionCodec=void 0;var st=Gt(),sg=Yt(),Oe=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(sg.timestampExtension)}register({type:t,encode:i,decode:r}){if(t>=0)this.encoders[t]=i,this.decoders[t]=r;else{let n=-1-t;this.builtInEncoders[n]=i,this.builtInDecoders[n]=r}}tryToEncode(t,i){for(let r=0;r<this.builtInEncoders.length;r++){let n=this.builtInEncoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=-1-r;return new st.ExtData(a,o)}}}for(let r=0;r<this.encoders.length;r++){let n=this.encoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=r;return new st.ExtData(a,o)}}}return t instanceof st.ExtData?t:null}decode(t,i,r){let n=i<0?this.builtInDecoders[-1-i]:this.decoders[i];return n?n(t,i,r):new st.ExtData(i,t)}};lt.ExtensionCodec=Oe;Oe.defaultCodec=new Oe});var Qt=I(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.ensureUint8Array=cg;function lg(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function cg(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):lg(e)?new Uint8Array(e):Uint8Array.from(e)}});var Xt=I(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.Encoder=P.DEFAULT_INITIAL_BUFFER_SIZE=P.DEFAULT_MAX_DEPTH=void 0;var Lr=it(),ug=ct(),Br=at(),dg=Qt();P.DEFAULT_MAX_DEPTH=100;P.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Zt=class e{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??ug.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??P.DEFAULT_MAX_DEPTH,this.initialBufferSize=t?.initialBufferSize??P.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,i){if(i>this.maxDepth)throw new Error(`Too deep objects in depth ${i}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,i)}ensureBufferSizeToWrite(t){let i=this.pos+t;this.view.byteLength<i&&this.resizeBuffer(i*2)}resizeBuffer(t){let i=new ArrayBuffer(t),r=new Uint8Array(i),n=new DataView(i);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){let r=(0,Lr.utf8Count)(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,Lr.utf8Encode)(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,i){let r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,i);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,i);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){let i=t.byteLength;if(i<256)this.writeU8(196),this.writeU8(i);else if(i<65536)this.writeU8(197),this.writeU16(i);else if(i<4294967296)this.writeU8(198),this.writeU32(i);else throw new Error(`Too large binary: ${i}`);let r=(0,dg.ensureUint8Array)(t);this.writeU8a(r)}encodeArray(t,i){let r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(let n of t)this.doEncode(n,i+1)}countWithoutUndefined(t,i){let r=0;for(let n of i)t[n]!==void 0&&r++;return r}encodeMap(t,i){let r=Object.keys(t);this.sortKeys&&r.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(let o of r){let a=t[o];this.ignoreUndefined&&a===void 0||(this.encodeString(o),this.doEncode(a,i+1))}}encodeExtension(t){if(typeof t.data=="function"){let r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}let i=t.data.length;if(i===1)this.writeU8(212);else if(i===2)this.writeU8(213);else if(i===4)this.writeU8(214);else if(i===8)this.writeU8(215);else if(i===16)this.writeU8(216);else if(i<256)this.writeU8(199),this.writeU8(i);else if(i<65536)this.writeU8(200),this.writeU16(i);else if(i<4294967296)this.writeU8(201),this.writeU32(i);else throw new Error(`Too large extension object: ${i}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){let i=t.length;this.ensureBufferSizeToWrite(i),this.bytes.set(t,this.pos),this.pos+=i}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),(0,Br.setUint64)(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),(0,Br.setInt64)(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}};P.Encoder=Zt});var Rr=I(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.encode=pg;var gg=Xt();function pg(e,t){return new gg.Encoder(t).encodeSharedRef(e)}});var qr=I(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.prettyByte=hg;function hg(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}});var Vr=I(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.CachedKeyDecoder=void 0;var fg=it(),mg=16,yg=16,ti=class{constructor(t=mg,i=yg){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=i,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,i,r){let n=this.caches[r-1];e:for(let o of n){let a=o.bytes;for(let s=0;s<r;s++)if(a[s]!==t[i+s])continue e;return o.str}return null}store(t,i){let r=this.caches[t.length-1],n={bytes:t,str:i};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,i,r){let n=this.find(t,i,r);if(n!=null)return this.hit++,n;this.miss++;let o=(0,fg.utf8DecodeJs)(t,i,r),a=Uint8Array.prototype.slice.call(t,i,i+r);return this.store(a,o),o}};ut.CachedKeyDecoder=ti});var gt=I(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.Decoder=void 0;var ii=qr(),bg=ct(),J=at(),_g=it(),Hr=Qt(),vg=Vr(),F=ot(),ri="array",De="map_key",Kr="map_value",wg=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new F.DecodeError("The type of key must be string or number but "+typeof e)},ni=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){let i=this.getUninitializedStateFromPool();i.type=ri,i.position=0,i.size=t,i.array=new Array(t)}pushMapState(t){let i=this.getUninitializedStateFromPool();i.type=De,i.readCount=0,i.size=t,i.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ri){let r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===De||t.type===Kr){let r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},Pe=-1,ai=new DataView(new ArrayBuffer(0)),xg=new Uint8Array(ai.buffer);try{ai.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var Gr=new RangeError("Insufficient data"),Ig=new vg.CachedKeyDecoder,oi=class e{constructor(t){this.totalPos=0,this.pos=0,this.view=ai,this.bytes=xg,this.headByte=Pe,this.stack=new ni,this.entered=!1,this.extensionCodec=t?.extensionCodec??bg.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??J.UINT32_MAX,this.maxBinLength=t?.maxBinLength??J.UINT32_MAX,this.maxArrayLength=t?.maxArrayLength??J.UINT32_MAX,this.maxMapLength=t?.maxMapLength??J.UINT32_MAX,this.maxExtLength=t?.maxExtLength??J.UINT32_MAX,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Ig,this.mapKeyConverter=t?.mapKeyConverter??wg}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Pe,this.stack.reset()}setBuffer(t){let i=(0,Hr.ensureUint8Array)(t);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===Pe&&!this.hasRemaining(1))this.setBuffer(t);else{let i=this.bytes.subarray(this.pos),r=(0,Hr.ensureUint8Array)(t),n=new Uint8Array(i.length+r.length);n.set(i),n.set(r,i.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){let{view:i,pos:r}=this;return new RangeError(`Extra ${i.byteLength-r} of ${i.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);let i=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return i}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let i=!1,r;for await(let s of t){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{r=this.doDecodeSync(),i=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}let{headByte:n,pos:o,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${(0,ii.prettyByte)(n)} at ${a} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,i){if(this.entered){yield*this.clone().decodeMultiAsync(t,i);return}try{this.entered=!0;let r=i,n=-1;for await(let o of t){if(i&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let t=this.readHeadByte(),i;if(t>=224)i=t-256;else if(t<192)if(t<128)i=t;else if(t<144){let n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t<160){let n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else{let n=t-160;i=this.decodeString(n,0)}else if(t===192)i=null;else if(t===194)i=!1;else if(t===195)i=!0;else if(t===202)i=this.readF32();else if(t===203)i=this.readF64();else if(t===204)i=this.readU8();else if(t===205)i=this.readU16();else if(t===206)i=this.readU32();else if(t===207)this.useBigInt64?i=this.readU64AsBigInt():i=this.readU64();else if(t===208)i=this.readI8();else if(t===209)i=this.readI16();else if(t===210)i=this.readI32();else if(t===211)this.useBigInt64?i=this.readI64AsBigInt():i=this.readI64();else if(t===217){let n=this.lookU8();i=this.decodeString(n,1)}else if(t===218){let n=this.lookU16();i=this.decodeString(n,2)}else if(t===219){let n=this.lookU32();i=this.decodeString(n,4)}else if(t===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===196){let n=this.lookU8();i=this.decodeBinary(n,1)}else if(t===197){let n=this.lookU16();i=this.decodeBinary(n,2)}else if(t===198){let n=this.lookU32();i=this.decodeBinary(n,4)}else if(t===212)i=this.decodeExtension(1,0);else if(t===213)i=this.decodeExtension(2,0);else if(t===214)i=this.decodeExtension(4,0);else if(t===215)i=this.decodeExtension(8,0);else if(t===216)i=this.decodeExtension(16,0);else if(t===199){let n=this.lookU8();i=this.decodeExtension(n,1)}else if(t===200){let n=this.lookU16();i=this.decodeExtension(n,2)}else if(t===201){let n=this.lookU32();i=this.decodeExtension(n,4)}else throw new F.DecodeError(`Unrecognized type byte: ${(0,ii.prettyByte)(t)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===ri)if(n.array[n.position]=i,n.position++,n.position===n.size)i=n.array,r.release(n);else continue e;else if(n.type===De){if(i==="__proto__")throw new F.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=Kr;continue e}else if(n.map[n.key]=i,n.readCount++,n.readCount===n.size)i=n.map,r.release(n);else{n.key=null,n.type=De;continue e}}return i}}readHeadByte(){return this.headByte===Pe&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Pe}readArraySize(){let t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new F.DecodeError(`Unrecognized array type byte: ${(0,ii.prettyByte)(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new F.DecodeError(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new F.DecodeError(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,i){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,i):this.decodeBinary(t,i)}decodeUtf8String(t,i){if(t>this.maxStrLength)throw new F.DecodeError(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+t)throw Gr;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?n=this.keyDecoder.decode(this.bytes,r,t):n=(0,_g.utf8Decode)(this.bytes,r,t),this.pos+=i+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===De:!1}decodeBinary(t,i){if(t>this.maxBinLength)throw new F.DecodeError(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+i))throw Gr;let r=this.pos+i,n=this.bytes.subarray(r,r+t);return this.pos+=i+t,n}decodeExtension(t,i){if(t>this.maxExtLength)throw new F.DecodeError(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+i),n=this.decodeBinary(t,i+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){let t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){let t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){let t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){let t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){let t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){let t=(0,J.getUint64)(this.view,this.pos);return this.pos+=8,t}readI64(){let t=(0,J.getInt64)(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){let t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){let t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){let t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){let t=this.view.getFloat64(this.pos);return this.pos+=8,t}};dt.Decoder=oi});var Wr=I(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.decode=kg;pt.decodeMulti=Sg;var Yr=gt();function kg(e,t){return new Yr.Decoder(t).decode(e)}function Sg(e,t){return new Yr.Decoder(t).decodeMulti(e)}});var Xr=I(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.isAsyncIterable=Qr;Ue.asyncIterableFromStream=Zr;Ue.ensureAsyncIterable=Eg;function Qr(e){return e[Symbol.asyncIterator]!=null}async function*Zr(e){let t=e.getReader();try{for(;;){let{done:i,value:r}=await t.read();if(i)return;yield r}}finally{t.releaseLock()}}function Eg(e){return Qr(e)?e:Zr(e)}});var Jr=I(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.decodeAsync=Ag;Ne.decodeArrayStream=Cg;Ne.decodeMultiStream=Tg;var si=gt(),li=Xr();async function Ag(e,t){let i=(0,li.ensureAsyncIterable)(e);return new si.Decoder(t).decodeAsync(i)}function Cg(e,t){let i=(0,li.ensureAsyncIterable)(e);return new si.Decoder(t).decodeArrayStream(i)}function Tg(e,t){let i=(0,li.ensureAsyncIterable)(e);return new si.Decoder(t).decodeStream(i)}});var tn=I(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.decodeTimestampExtension=x.encodeTimestampExtension=x.decodeTimestampToTimeSpec=x.encodeTimeSpecToTimestamp=x.encodeDateToTimeSpec=x.EXT_TIMESTAMP=x.ExtData=x.ExtensionCodec=x.Encoder=x.DecodeError=x.Decoder=x.decodeMultiStream=x.decodeArrayStream=x.decodeAsync=x.decodeMulti=x.decode=x.encode=void 0;var Mg=Rr();Object.defineProperty(x,"encode",{enumerable:!0,get:function(){return Mg.encode}});var en=Wr();Object.defineProperty(x,"decode",{enumerable:!0,get:function(){return en.decode}});Object.defineProperty(x,"decodeMulti",{enumerable:!0,get:function(){return en.decodeMulti}});var ci=Jr();Object.defineProperty(x,"decodeAsync",{enumerable:!0,get:function(){return ci.decodeAsync}});Object.defineProperty(x,"decodeArrayStream",{enumerable:!0,get:function(){return ci.decodeArrayStream}});Object.defineProperty(x,"decodeMultiStream",{enumerable:!0,get:function(){return ci.decodeMultiStream}});var jg=gt();Object.defineProperty(x,"Decoder",{enumerable:!0,get:function(){return jg.Decoder}});var $g=ot();Object.defineProperty(x,"DecodeError",{enumerable:!0,get:function(){return $g.DecodeError}});var Og=Xt();Object.defineProperty(x,"Encoder",{enumerable:!0,get:function(){return Og.Encoder}});var Pg=ct();Object.defineProperty(x,"ExtensionCodec",{enumerable:!0,get:function(){return Pg.ExtensionCodec}});var Dg=Gt();Object.defineProperty(x,"ExtData",{enumerable:!0,get:function(){return Dg.ExtData}});var ye=Yt();Object.defineProperty(x,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return ye.EXT_TIMESTAMP}});Object.defineProperty(x,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return ye.encodeDateToTimeSpec}});Object.defineProperty(x,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return ye.encodeTimeSpecToTimestamp}});Object.defineProperty(x,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return ye.decodeTimestampToTimeSpec}});Object.defineProperty(x,"encodeTimestampExtension",{enumerable:!0,get:function(){return ye.encodeTimestampExtension}});Object.defineProperty(x,"decodeTimestampExtension",{enumerable:!0,get:function(){return ye.decodeTimestampExtension}})});var yn=I(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});function A(e){return{enumerable:!0,value:e}}function rn(e){return{enumerable:!0,writable:!0,value:e}}var ee={},Ug=()=>!0,nn=()=>({}),an=e=>e,Ng=(e,t,i,r)=>e.apply(i,r)&&t.apply(i,r),zg=(e,t,i,[r,n])=>t.call(i,e.call(i,r,n),n),K=(e,t)=>Object.freeze(Object.create(e,t));function on(e,t,i){return e.reduce((r,n)=>function(...o){return i(r,n,this,o)},t)}function sn(e){return K(this,{fn:A(e)})}var ln={},cn=sn.bind(ln),Fg=e=>cn((t,i)=>!!~e(t,i)&&t),un={},Lg=sn.bind(un);function ht(e,t){return t.filter(i=>e.isPrototypeOf(i))}function dn(e,t,...i){let r=on(ht(un,i).map(o=>o.fn),Ug,Ng),n=on(ht(ln,i).map(o=>o.fn),an,zg);return K(this,{from:A(e),to:A(t),guards:A(r),reducers:A(n)})}var gn={},pn={},Bg=dn.bind(gn),Rg=dn.bind(pn,null);function qg(e,t,i){return di(t,e,i,this.immediates)||e}function hn(e){let t=new Map;for(let i of e)t.has(i.from)||t.set(i.from,[]),t.get(i.from).push(i);return t}var Vg={enter:an};function Hg(...e){let t=ht(gn,e),i=ht(pn,e),r={final:A(e.length===0),transitions:A(hn(t))};return i.length&&(r.immediates=A(i),r.enter=A(qg)),K(Vg,r)}var Gg={enter(e,t,i){let r=this.fn.call(t,t.context,i);return ui.isPrototypeOf(r)?K(fn,{machine:A(r),transitions:A(this.transitions)}).enter(e,t,i):(r.then(n=>t.send({type:"done",data:n})).catch(n=>t.send({type:"error",error:n})),e)}},fn={enter(e,t,i){if(t.child=mn(this.machine,r=>{t.onChange(r),t.child==r&&r.machine.state.value.final&&(delete t.child,t.send({type:"done",data:r.context}))},t.context,i),t.child.machine.state.value.final){let r=t.child.context;return delete t.child,di(t,e,{type:"done",data:r},this.transitions.get("done"))}return e}};function Kg(e,...t){let i=A(hn(t));return ui.isPrototypeOf(e)?K(fn,{machine:A(e),transitions:i}):K(Gg,{fn:A(e),transitions:i})}var ui={get state(){return{name:this.current,value:this.states[this.current]}}};function Yg(e,t,i=nn){return typeof e!="string"&&(i=t||nn,t=e,e=Object.keys(t)[0]),ee._create&&ee._create(e,t),K(ui,{context:A(i),current:A(e),states:A(t)})}function di(e,t,i,r){let{context:n}=e;for(let{to:o,guards:a,reducers:s}of r)if(a(n,i)){e.context=s.call(e,n,i);let c=t.original||t,d=K(c,{current:A(o),original:{value:c}});return ee._onEnter&&ee._onEnter(t,o,e.context,n,i),d.state.value.enter(d,e,i)}}function Wg(e,t){let i=t.type||t,{machine:r}=e,{value:n,name:o}=r.state;return n.transitions.has(i)?di(e,r,t,n.transitions.get(i))||r:(ee._send&&ee._send(i,o),r)}var Qg={send(e){this.machine=Wg(this,e),this.onChange(this)}};function mn(e,t,i,r){let n=Object.create(Qg,{machine:rn(e),context:rn(e.context(i,r)),onChange:A(t)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}M.action=Fg;M.createMachine=Yg;M.d=ee;M.guard=Lg;M.immediate=Rg;M.interpret=mn;M.invoke=Kg;M.reduce=cn;M.state=Hg;M.transition=Bg});var xn=I(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.createRealtimeClient=dp;var mt=tn(),y=yn(),bn=Rt(),gi=Q(),_n=Xe(),fi=Z(),Zg=()=>({enqueuedMessage:void 0});function Xg(e){return e.token!==void 0}function Jg(e){return!Xg(e)}function ft(e,t){return Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function L(e){return e.websocket&&e.websocket.readyState===WebSocket.OPEN&&e.websocket.close(),Object.assign(Object.assign({},e),{websocket:void 0})}function ep(e,t){return e.websocket&&e.websocket.readyState===WebSocket.OPEN?(t.message instanceof Uint8Array?e.websocket.send(t.message):e.websocket.send((0,mt.encode)(t.message)),Object.assign(Object.assign({},e),{enqueuedMessage:void 0})):Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function pi(e){return Object.assign(Object.assign({},e),{token:void 0})}function tp(e,t){return Object.assign(Object.assign({},e),{token:t.token})}function ip(e,t){return Object.assign(Object.assign({},e),{websocket:t.websocket})}var rp=(0,y.createMachine)("idle",{idle:(0,y.state)((0,y.transition)("send","connecting",(0,y.reduce)(ft)),(0,y.transition)("expireToken","idle",(0,y.reduce)(pi)),(0,y.transition)("close","idle",(0,y.reduce)(L))),connecting:(0,y.state)((0,y.transition)("connecting","connecting"),(0,y.transition)("connected","active",(0,y.reduce)(ip)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("send","connecting",(0,y.reduce)(ft)),(0,y.transition)("close","idle",(0,y.reduce)(L)),(0,y.immediate)("authRequired",(0,y.guard)(Jg))),authRequired:(0,y.state)((0,y.transition)("initiateAuth","authInProgress"),(0,y.transition)("send","authRequired",(0,y.reduce)(ft)),(0,y.transition)("close","idle",(0,y.reduce)(L))),authInProgress:(0,y.state)((0,y.transition)("authenticated","connecting",(0,y.reduce)(tp)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(pi),(0,y.reduce)(L)),(0,y.transition)("send","authInProgress",(0,y.reduce)(ft)),(0,y.transition)("close","idle",(0,y.reduce)(L))),active:(0,y.state)((0,y.transition)("send","active",(0,y.reduce)(ep)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(pi)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("close","idle",(0,y.reduce)(L))),failed:(0,y.state)((0,y.transition)("send","failed"),(0,y.transition)("close","idle",(0,y.reduce)(L)))},Zg);function np(e,{token:t,maxBuffering:i}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let r=new URLSearchParams({fal_jwt_token:t});return i!==void 0&&r.set("max_buffering",i.toFixed(0)),`wss://fal.run/${(0,fi.ensureEndpointIdFormat)(e)}/realtime?${r.toString()}`}var op=128;function ap(e){return e.status==="error"&&e.error==="Unauthorized"}var sp={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},hi=new Map,vn=new Map;function lp(e,t,i){if(!hi.has(e)){let r=(0,y.interpret)(rp,i);hi.set(e,Object.assign(Object.assign({},r),{throttledSend:t>0?(0,fi.throttle)(r.send,t,!0):r.send}))}return hi.get(e)}var ze=()=>{},cp={send:ze,close:ze};function up(e){return e.status!=="error"&&e.type!=="x-fal-message"&&!wn(e)}function wn(e){return e.type==="x-fal-error"}function dp({config:e}){return{connect(t,i){let{clientOnly:r=(0,fi.isReact)()&&!(0,_n.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:a=op}=i;if(r&&!(0,_n.isBrowser)())return cp;let s;vn.set(n,{onError:i.onError,onResult:i.onResult});let c=()=>vn.get(n),d=lp(n,a,({context:f,machine:p,send:m})=>{let{enqueuedMessage:v,token:w}=f;if(p.current==="active"&&v&&m({type:"send",message:v}),p.current==="authRequired"&&w===void 0&&s!==p.current&&(m({type:"initiateAuth"}),(0,bn.getTemporaryAuthToken)(t,e).then(g=>{m({type:"authenticated",token:g});let h=Math.round(bn.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{m({type:"expireToken"})},h)}).catch(g=>{m({type:"unauthorized",error:g})})),p.current==="connecting"&&s!==p.current&&w!==void 0){let g=new WebSocket(np(t,{token:w,maxBuffering:o}));g.onopen=()=>{m({type:"connected",websocket:g})},g.onclose=h=>{if(h.code!==sp.NORMAL_CLOSURE){let{onError:_=ze}=c();_(new gi.ApiError({message:`Error closing the connection: ${h.reason}`,status:h.code}))}m({type:"connectionClosed",code:h.code})},g.onerror=h=>{let{onError:_=ze}=c();_(new gi.ApiError({message:"Unknown error",status:500}))},g.onmessage=h=>{let{onResult:_}=c();if(h.data instanceof ArrayBuffer){let C=(0,mt.decode)(new Uint8Array(h.data));_(C);return}if(h.data instanceof Uint8Array){let C=(0,mt.decode)(h.data);_(C);return}if(h.data instanceof Blob){h.data.arrayBuffer().then(C=>{let wi=(0,mt.decode)(new Uint8Array(C));_(wi)});return}let b=JSON.parse(h.data);if(ap(b)){m({type:"unauthorized",error:new Error("Unauthorized")});return}if(up(b)){_(b);return}if(wn(b)){if(b.error==="TIMEOUT")return;let{onError:C=ze}=c();C(new gi.ApiError({message:`${b.error}: ${b.reason}`,status:400,body:b}));return}}}s=p.current});return{send:f=>{d.throttledSend({type:"send",message:f})},close:()=>{d.send({type:"close"})}}}}}});var An=I(Fe=>{"use strict";var te=Fe&&Fe.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.createStorageClient=mp;var In=Je(),kn=fe(),gp=Z();function Sn(e){var t;let[i,r]=e.split("/");return(t=r.split(/[-;]/)[0])!==null&&t!==void 0?t:"bin"}function pp(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Sn(i)}`;return yield(0,kn.dispatchRequest)({method:"POST",targetUrl:`${(0,In.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function hp(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Sn(i)}`;return yield(0,kn.dispatchRequest)({method:"POST",targetUrl:`${(0,In.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function En(e,t,i){return te(this,arguments,void 0,function*(r,n,o,a=3){if(a===0)throw new Error("Part upload failed, retries exhausted");let{fetch:s,responseHandler:c}=o;try{let d=yield s(r,{method:"PUT",body:n});return yield c(d)}catch{return yield En(r,n,o,a-1)}})}function fp(e,t){return te(this,void 0,void 0,function*(){let{fetch:i,responseHandler:r}=t,n=e.type||"application/octet-stream",{upload_url:o,file_url:a}=yield hp(e,t,n),s=10*1024*1024,c=Math.ceil(e.size/s),d=new URL(o),l=[];for(let p=0;p<c;p++){let m=p*s,v=Math.min(m+s,e.size),w=e.slice(m,v),g=p+1,h=`${d.origin}${d.pathname}/${g}${d.search}`;l.push(yield En(h,w,t))}let u=`${d.origin}${d.pathname}/complete${d.search}`,f=yield i(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:l.map(p=>({partNumber:p.partNumber,etag:p.etag}))})});return yield r(f),a})}function mp({config:e}){let t={upload:i=>te(this,void 0,void 0,function*(){if(i.size>94371840)return yield fp(i,e);let r=i.type||"application/octet-stream",{fetch:n,responseHandler:o}=e,{upload_url:a,file_url:s}=yield pp(i,e,r),c=yield n(a,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield o(c),s}),transformInput:i=>te(this,void 0,void 0,function*(){if(Array.isArray(i))return Promise.all(i.map(r=>t.transformInput(r)));if(i instanceof Blob)return yield t.upload(i);if((0,gp.isPlainObject)(i)){let n=Object.entries(i).map(a=>te(this,[a],void 0,function*([s,c]){return[s,yield t.transformInput(c)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return i})};return t}});var yi=I(Le=>{"use strict";var Cn=Le&&Le.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(l){try{d(r.next(l))}catch(u){a(u)}}function c(l){try{d(r.throw(l))}catch(u){a(u)}}function d(l){l.done?o(l.value):n(l.value).then(s,c)}d((r=r.apply(e,t||[])).next())})};Object.defineProperty(Le,"__esModule",{value:!0});Le.createFalClient=Ip;var yp=Je(),bp=Tr(),_p=xn(),Tn=fe(),vp=Q(),wp=An(),xp=Vt();function Ip(e={}){let t=(0,yp.createConfig)(e),i=(0,wp.createStorageClient)({config:t}),r=(0,bp.createQueueClient)({config:t,storage:i}),n=(0,xp.createStreamingClient)({config:t,storage:i}),o=(0,_p.createRealtimeClient)({config:t});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(a){return Cn(this,arguments,void 0,function*(s,c={}){let d=c.input?yield i.transformInput(c.input):void 0;return(0,Tn.dispatchRequest)({method:c.method,targetUrl:(0,Tn.buildUrl)(s,c),input:d,config:Object.assign(Object.assign({},t),{responseHandler:vp.resultResponseHandler}),options:{signal:c.abortSignal}})})},subscribe:(a,s)=>Cn(this,void 0,void 0,function*(){let{request_id:c}=yield r.submit(a,s);return s.onEnqueue&&s.onEnqueue(c),yield r.subscribeToStatus(a,Object.assign({requestId:c},s)),r.result(a,{requestId:c})})}}});var jn=I(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.isQueueStatus=Mn;yt.isCompletedQueueStatus=kp;function Mn(e){return e&&e.status&&e.response_url}function kp(e){return Mn(e)&&e.status==="COMPLETED"}});var bi=I(E=>{"use strict";var Sp=E&&E.__createBinding||(Object.create?function(e,t,i,r){r===void 0&&(r=i);var n=Object.getOwnPropertyDescriptor(t,i);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,n)}:function(e,t,i,r){r===void 0&&(r=i),e[r]=t[i]}),Ep=E&&E.__exportStar||function(e,t){for(var i in e)i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&Sp(t,e,i)};Object.defineProperty(E,"__esModule",{value:!0});E.fal=E.parseEndpointId=E.ValidationError=E.ApiError=E.withProxy=E.withMiddleware=E.createFalClient=void 0;var $n=yi(),Ap=yi();Object.defineProperty(E,"createFalClient",{enumerable:!0,get:function(){return Ap.createFalClient}});var On=Ft();Object.defineProperty(E,"withMiddleware",{enumerable:!0,get:function(){return On.withMiddleware}});Object.defineProperty(E,"withProxy",{enumerable:!0,get:function(){return On.withProxy}});var Pn=Q();Object.defineProperty(E,"ApiError",{enumerable:!0,get:function(){return Pn.ApiError}});Object.defineProperty(E,"ValidationError",{enumerable:!0,get:function(){return Pn.ValidationError}});Ep(jn(),E);var Cp=Z();Object.defineProperty(E,"parseEndpointId",{enumerable:!0,get:function(){return Cp.parseEndpointId}});E.fal=function(){let t=(0,$n.createFalClient)();return{config(i){t=(0,$n.createFalClient)(i)},get queue(){return t.queue},get realtime(){return t.realtime},get storage(){return t.storage},get streaming(){return t.streaming},run(i,r){return t.run(i,r)},subscribe(i,r){return t.subscribe(i,r)},stream(i,r){return t.stream(i,r)}}}()});var Vn=`
|
|
6
|
+
<svg>
|
|
7
|
+
<symbol
|
|
8
|
+
fill="none"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
viewBox="0 0 24 24"
|
|
11
|
+
id="@imgly/plugin/formats/ratioFree"
|
|
12
|
+
>
|
|
13
|
+
<path d="M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z" fill="currentColor"/>
|
|
14
|
+
<path d="M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z" fill="currentColor"/>
|
|
15
|
+
<path d="M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z" fill="currentColor"/>
|
|
16
|
+
<path d="M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z" fill="currentColor"/>
|
|
17
|
+
</symbol>
|
|
18
|
+
<symbol
|
|
19
|
+
fill="none"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
viewBox="0 0 24 24"
|
|
22
|
+
id="@imgly/plugin/formats/ratio4by3"
|
|
23
|
+
>
|
|
24
|
+
<path d="M6.5 13H8V15H10V16.5H6.5V13Z" fill="currentColor"/>
|
|
25
|
+
<path d="M14 9V7.5H17.5V11H16V9H14Z" fill="currentColor"/>
|
|
26
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z" fill="currentColor"/>
|
|
27
|
+
</symbol>
|
|
28
|
+
<symbol
|
|
29
|
+
fill="none"
|
|
30
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
id="@imgly/plugin/formats/ratio16by9"
|
|
33
|
+
>
|
|
34
|
+
<path d="M4.5 13H6V15H8V16.5H4.5V13Z" fill="currentColor"/>
|
|
35
|
+
<path d="M16 9V7.5H19.5V11H18V9H16Z" fill="currentColor"/>
|
|
36
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z" fill="currentColor"/>
|
|
37
|
+
</symbol>
|
|
38
|
+
<symbol
|
|
39
|
+
fill="none"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
id="@imgly/plugin/formats/ratio9by16"
|
|
43
|
+
>
|
|
44
|
+
<path d="M7.5 16H9V18H11V19.5H7.5V16Z" fill="currentColor"/>
|
|
45
|
+
<path d="M13 6V4.5H16.5V8H15V6H13Z" fill="currentColor"/>
|
|
46
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z" fill="currentColor"/>
|
|
47
|
+
</symbol>
|
|
48
|
+
<symbol
|
|
49
|
+
fill="none"
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
viewBox="0 0 24 24"
|
|
52
|
+
id="@imgly/plugin/formats/ratio3by4"
|
|
53
|
+
>
|
|
54
|
+
<path d="M11 17.5V16H9V14H7.5V17.5H11Z" fill="currentColor"/>
|
|
55
|
+
<path d="M15 10H16.5V6.5H13V8H15V10Z" fill="currentColor"/>
|
|
56
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z" fill="currentColor"/>
|
|
57
|
+
</symbol>
|
|
58
|
+
<symbol
|
|
59
|
+
fill="none"
|
|
60
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
+
viewBox="0 0 24 24"
|
|
62
|
+
id="@imgly/plugin/formats/ratio1by1"
|
|
63
|
+
>
|
|
64
|
+
<path d="M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z" fill="currentColor"/>
|
|
65
|
+
<path d="M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z" fill="currentColor"/>
|
|
66
|
+
<path d="M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z" fill="currentColor"/>
|
|
67
|
+
<path d="M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z" fill="currentColor"/>
|
|
68
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z" fill="currentColor"/>
|
|
69
|
+
</symbol>
|
|
70
|
+
</svg>
|
|
71
|
+
`,zi=class{constructor(e,t=[]){this.id=e,this.assets=t.map(i=>{if(typeof i.label=="string"&&!(i.label&&typeof i.label=="object")){let r=i;return{id:r.id,label:{en:r.label},meta:r.thumbUri?{...r.meta??{},thumbUri:r.thumbUri}:r.meta}}return i}),this.activeAssetIds=new Set}async findAssets(e){let{page:t,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:a,groups:s,excludeGroups:c,sortingOrder:d,sortKey:l}=e,u=[...this.assets];if(s&&s.length>0&&(u=u.filter(g=>g.groups&&s.some(h=>g.groups?.includes(h)))),c&&c.length>0&&(u=u.filter(g=>!g.groups||!c.some(h=>g.groups?.includes(h)))),o){let g=o.toLowerCase();u=u.filter(h=>{let _=h.label?.[r]?.toLowerCase(),b=h.tags?.[r]||[];return _&&_.includes(g)||b.some(C=>C.toLowerCase().includes(g))})}if(a&&a.length>0){let g=Array.isArray(a)?a:[a];u=u.filter(h=>{let _=h.tags?.[r]||[];return g.some(b=>_.includes(b))})}n&&u.sort((g,h)=>{let _=this.activeAssetIds.has(g.id),b=this.activeAssetIds.has(h.id);return _&&!b?-1:!_&&b?1:0}),l&&l!=="id"?u.sort((g,h)=>{let _=g.meta?.[l],b=h.meta?.[l];return _===void 0?1:b===void 0?-1:typeof _=="string"&&typeof b=="string"?d==="Descending"?b.localeCompare(_):_.localeCompare(b):typeof _=="number"&&typeof b=="number"?d==="Descending"?b-_:_-b:0}):l==="id"&&u.sort((g,h)=>d==="Descending"?h.id.localeCompare(g.id):g.id.localeCompare(h.id));let f=u.length,p=t*i,m=p+i,v=u.slice(p,m).map(g=>({id:g.id,groups:g.groups,meta:g.meta,payload:g.payload,locale:r,label:g.label?.[r],tags:g.tags?.[r],active:this.activeAssetIds.has(g.id)})),w=m<f?t+1:void 0;return{assets:v,currentPage:t,nextPage:w,total:f}}updateLabel(e,t,i){this.assets.forEach(r=>{r.id===e&&(r.label=r.label||{},r.label[i]=t)})}getAssetSelectValue(e){let t=this.assets.find(({id:i})=>i===e);if(t)return{id:t.id,label:t.label?.en||"",thumbUri:t.meta?.thumbUri}}getAsset(e){return this.assets.find(t=>t.id===e)}setAssetActive(e){this.activeAssetIds.add(e)}getActiveAssetIds(){return Array.from(this.activeAssetIds)}setAssetsActive(e){e.forEach(t=>this.activeAssetIds.add(t))}setAssetInactive(e){this.activeAssetIds.delete(e)}clearActiveAssets(){this.activeAssetIds.clear()}isAssetActive(e){return this.activeAssetIds.has(e)}addAsset(e){let t=this.assets.findIndex(i=>i.id===e.id);t>=0?this.assets[t]=e:this.assets.push(e)}removeAsset(e){let t=this.assets.findIndex(i=>i.id===e);t!==-1&&(this.assets.splice(t,1),this.activeAssetIds.delete(e))}async getGroups(){let e=new Set;return this.assets.forEach(t=>{t.groups&&t.groups.forEach(i=>e.add(i))}),Array.from(e)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var Hn=typeof global=="object"&&global&&global.Object===Object&&global,Fi=Hn,Gn=typeof self=="object"&&self&&self.Object===Object&&self,Kn=Fi||Gn||Function("return this")(),D=Kn,Yn=D.Symbol,re=Yn,Li=Object.prototype,Wn=Li.hasOwnProperty,Qn=Li.toString,be=re?re.toStringTag:void 0;function Zn(e){var t=Wn.call(e,be),i=e[be];try{e[be]=void 0;var r=!0}catch{}var n=Qn.call(e);return r&&(t?e[be]=i:delete e[be]),n}var Xn=Zn,Jn=Object.prototype,eo=Jn.toString;function to(e){return eo.call(e)}var io=to,ro="[object Null]",no="[object Undefined]",ki=re?re.toStringTag:void 0;function oo(e){return e==null?e===void 0?no:ro:ki&&ki in Object(e)?Xn(e):io(e)}var xe=oo;function ao(e){return e!=null&&typeof e=="object"}var Et=ao,Op=Array.isArray;function so(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Bi=so,lo="[object AsyncFunction]",co="[object Function]",uo="[object GeneratorFunction]",go="[object Proxy]";function po(e){if(!Bi(e))return!1;var t=xe(e);return t==co||t==uo||t==lo||t==go}var ho=po,fo=D["__core-js_shared__"],_t=fo,Si=function(){var e=/[^.]+$/.exec(_t&&_t.keys&&_t.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function mo(e){return!!Si&&Si in e}var yo=mo,bo=Function.prototype,_o=bo.toString;function vo(e){if(e!=null){try{return _o.call(e)}catch{}try{return e+""}catch{}}return""}var Y=vo,wo=/[\\^$.*+?()[\]{}|]/g,xo=/^\[object .+?Constructor\]$/,Io=Function.prototype,ko=Object.prototype,So=Io.toString,Eo=ko.hasOwnProperty,Ao=RegExp("^"+So.call(Eo).replace(wo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Co(e){if(!Bi(e)||yo(e))return!1;var t=ho(e)?Ao:xo;return t.test(Y(e))}var To=Co;function Mo(e,t){return e?.[t]}var jo=Mo;function $o(e,t){var i=jo(e,t);return To(i)?i:void 0}var ne=$o,Oo=ne(D,"WeakMap"),wt=Oo;function Po(e,t){return e===t||e!==e&&t!==t}var Do=Po,Uo=9007199254740991;function No(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Uo}var zo=No;var Pp=Object.prototype;var Fo="[object Arguments]";function Lo(e){return Et(e)&&xe(e)==Fo}var Ei=Lo,Ri=Object.prototype,Bo=Ri.hasOwnProperty,Ro=Ri.propertyIsEnumerable,Dp=Ei(function(){return arguments}())?Ei:function(e){return Et(e)&&Bo.call(e,"callee")&&!Ro.call(e,"callee")};var qi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ai=qi&&typeof module=="object"&&module&&!module.nodeType&&module,qo=Ai&&Ai.exports===qi,Ci=qo?D.Buffer:void 0,Up=Ci?Ci.isBuffer:void 0;var Vo="[object Arguments]",Ho="[object Array]",Go="[object Boolean]",Ko="[object Date]",Yo="[object Error]",Wo="[object Function]",Qo="[object Map]",Zo="[object Number]",Xo="[object Object]",Jo="[object RegExp]",ea="[object Set]",ta="[object String]",ia="[object WeakMap]",ra="[object ArrayBuffer]",na="[object DataView]",oa="[object Float32Array]",aa="[object Float64Array]",sa="[object Int8Array]",la="[object Int16Array]",ca="[object Int32Array]",ua="[object Uint8Array]",da="[object Uint8ClampedArray]",ga="[object Uint16Array]",pa="[object Uint32Array]",k={};k[oa]=k[aa]=k[sa]=k[la]=k[ca]=k[ua]=k[da]=k[ga]=k[pa]=!0;k[Vo]=k[Ho]=k[ra]=k[Go]=k[na]=k[Ko]=k[Yo]=k[Wo]=k[Qo]=k[Zo]=k[Xo]=k[Jo]=k[ea]=k[ta]=k[ia]=!1;function ha(e){return Et(e)&&zo(e.length)&&!!k[xe(e)]}var fa=ha;function ma(e){return function(t){return e(t)}}var ya=ma,Vi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_e=Vi&&typeof module=="object"&&module&&!module.nodeType&&module,ba=_e&&_e.exports===Vi,vt=ba&&Fi.process,_a=function(){try{var e=_e&&_e.require&&_e.require("util").types;return e||vt&&vt.binding&&vt.binding("util")}catch{}}(),Ti=_a,Mi=Ti&&Ti.isTypedArray,Np=Mi?ya(Mi):fa;var va=Object.prototype,zp=va.hasOwnProperty;function wa(e,t){return function(i){return e(t(i))}}var xa=wa,Fp=xa(Object.keys,Object);var Ia=Object.prototype,Lp=Ia.hasOwnProperty;var ka=ne(Object,"create"),ve=ka;function Sa(){this.__data__=ve?ve(null):{},this.size=0}var Ea=Sa;function Aa(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ca=Aa,Ta="__lodash_hash_undefined__",Ma=Object.prototype,ja=Ma.hasOwnProperty;function $a(e){var t=this.__data__;if(ve){var i=t[e];return i===Ta?void 0:i}return ja.call(t,e)?t[e]:void 0}var Oa=$a,Pa=Object.prototype,Da=Pa.hasOwnProperty;function Ua(e){var t=this.__data__;return ve?t[e]!==void 0:Da.call(t,e)}var Na=Ua,za="__lodash_hash_undefined__";function Fa(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=ve&&t===void 0?za:t,this}var La=Fa;function oe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}oe.prototype.clear=Ea;oe.prototype.delete=Ca;oe.prototype.get=Oa;oe.prototype.has=Na;oe.prototype.set=La;var ji=oe;function Ba(){this.__data__=[],this.size=0}var Ra=Ba;function qa(e,t){for(var i=e.length;i--;)if(Do(e[i][0],t))return i;return-1}var Re=qa,Va=Array.prototype,Ha=Va.splice;function Ga(e){var t=this.__data__,i=Re(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():Ha.call(t,i,1),--this.size,!0}var Ka=Ga;function Ya(e){var t=this.__data__,i=Re(t,e);return i<0?void 0:t[i][1]}var Wa=Ya;function Qa(e){return Re(this.__data__,e)>-1}var Za=Qa;function Xa(e,t){var i=this.__data__,r=Re(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var Ja=Xa;function ae(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ae.prototype.clear=Ra;ae.prototype.delete=Ka;ae.prototype.get=Wa;ae.prototype.has=Za;ae.prototype.set=Ja;var qe=ae,es=ne(D,"Map"),we=es;function ts(){this.size=0,this.__data__={hash:new ji,map:new(we||qe),string:new ji}}var is=ts;function rs(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ns=rs;function os(e,t){var i=e.__data__;return ns(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ve=os;function as(e){var t=Ve(this,e).delete(e);return this.size-=t?1:0,t}var ss=as;function ls(e){return Ve(this,e).get(e)}var cs=ls;function us(e){return Ve(this,e).has(e)}var ds=us;function gs(e,t){var i=Ve(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var ps=gs;function se(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}se.prototype.clear=is;se.prototype.delete=ss;se.prototype.get=cs;se.prototype.has=ds;se.prototype.set=ps;var Hi=se;function hs(){this.__data__=new qe,this.size=0}var fs=hs;function ms(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var ys=ms;function bs(e){return this.__data__.get(e)}var _s=bs;function vs(e){return this.__data__.has(e)}var ws=vs,xs=200;function Is(e,t){var i=this.__data__;if(i instanceof qe){var r=i.__data__;if(!we||r.length<xs-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Hi(r)}return i.set(e,t),this.size=i.size,this}var ks=Is;function Ie(e){var t=this.__data__=new qe(e);this.size=t.size}Ie.prototype.clear=fs;Ie.prototype.delete=ys;Ie.prototype.get=_s;Ie.prototype.has=ws;Ie.prototype.set=ks;var Ss=Object.prototype,Bp=Ss.propertyIsEnumerable;var Es=ne(D,"DataView"),xt=Es,As=ne(D,"Promise"),It=As,Cs=ne(D,"Set"),kt=Cs,$i="[object Map]",Ts="[object Object]",Oi="[object Promise]",Pi="[object Set]",Di="[object WeakMap]",Ui="[object DataView]",Ms=Y(xt),js=Y(we),$s=Y(It),Os=Y(kt),Ps=Y(wt),ie=xe;(xt&&ie(new xt(new ArrayBuffer(1)))!=Ui||we&&ie(new we)!=$i||It&&ie(It.resolve())!=Oi||kt&&ie(new kt)!=Pi||wt&&ie(new wt)!=Di)&&(ie=function(e){var t=xe(e),i=t==Ts?e.constructor:void 0,r=i?Y(i):"";if(r)switch(r){case Ms:return Ui;case js:return $i;case $s:return Oi;case Os:return Pi;case Ps:return Di}return t});var Rp=D.Uint8Array;var Ds="__lodash_hash_undefined__";function Us(e){return this.__data__.set(e,Ds),this}var Ns=Us;function zs(e){return this.__data__.has(e)}var Fs=zs;function St(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new Hi;++t<i;)this.add(e[t])}St.prototype.add=St.prototype.push=Ns;St.prototype.has=Fs;var Ni=re?re.prototype:void 0,qp=Ni?Ni.valueOf:void 0;var Ls=Object.prototype,Vp=Ls.hasOwnProperty;var Bs=Object.prototype,Hp=Bs.hasOwnProperty;var Gp=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Kp=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Yp=new RegExp(/[A-Fa-f0-9]{2}/,"g");function At(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}var Gi={Formats:Vn};function Rs(e,t){let{cesdk:i}=t,r=t.propertyKey??"image_url",n=jt(e);return i.i18n.setTranslations({en:{[`panel.${n}`]:"Select Image To Change"}}),qs(e,i),{[r]:(o,a)=>{let{builder:s,experimental:{global:c},payload:d}=o,l=d?.url??t.defaultUrl,u=c(`${e}.${a.id}`,l);return s.MediaPreview(a.id,{preview:{type:"image",uri:u.value},action:{label:"Select Image",onClick:()=>{i?.ui.openPanel(n,{payload:{onSelect:f=>{f.meta?.uri!=null&&u.setValue(f.meta?.uri)}}})}}}),()=>({id:a.id,type:"string",value:u.value})}}}function qs(e,t){t?.ui.registerPanel(jt(e),({builder:i,payload:r})=>{i.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async n=>{let o=n?.meta?.uri;if(o==null)return;let a=await t.engine.editor.getMimeType(o);a==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"SVG images are not supported. Please choose a different image."}):a.startsWith("image/")?(r?.onSelect(n),t?.ui.closePanel(jt(e))):t.ui.showNotification({type:"warning",message:`Only images are supported. Found '${a}'. Please choose a different image.`})}})})}function jt(e){return`ly.img.ai.${e}.imageSelection`}var Vs=Rs,Hs=class{constructor(e,t=[]){this.id=e,this.assets=t.map(i=>{if(typeof i.label=="string"&&!(i.label&&typeof i.label=="object")){let r=i;return{id:r.id,label:{en:r.label},meta:r.thumbUri?{...r.meta??{},thumbUri:r.thumbUri}:r.meta}}return i}),this.activeAssetIds=new Set}async findAssets(e){let{page:t,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:a,groups:s,excludeGroups:c,sortingOrder:d,sortKey:l}=e,u=[...this.assets];if(s&&s.length>0&&(u=u.filter(g=>g.groups&&s.some(h=>g.groups?.includes(h)))),c&&c.length>0&&(u=u.filter(g=>!g.groups||!c.some(h=>g.groups?.includes(h)))),o){let g=o.toLowerCase();u=u.filter(h=>{let _=h.label?.[r]?.toLowerCase(),b=h.tags?.[r]||[];return _&&_.includes(g)||b.some(C=>C.toLowerCase().includes(g))})}if(a&&a.length>0){let g=Array.isArray(a)?a:[a];u=u.filter(h=>{let _=h.tags?.[r]||[];return g.some(b=>_.includes(b))})}n&&u.sort((g,h)=>{let _=this.activeAssetIds.has(g.id),b=this.activeAssetIds.has(h.id);return _&&!b?-1:!_&&b?1:0}),l&&l!=="id"?u.sort((g,h)=>{let _=g.meta?.[l],b=h.meta?.[l];return _===void 0?1:b===void 0?-1:typeof _=="string"&&typeof b=="string"?d==="Descending"?b.localeCompare(_):_.localeCompare(b):typeof _=="number"&&typeof b=="number"?d==="Descending"?b-_:_-b:0}):l==="id"&&u.sort((g,h)=>d==="Descending"?h.id.localeCompare(g.id):g.id.localeCompare(h.id));let f=u.length,p=t*i,m=p+i,v=u.slice(p,m).map(g=>({id:g.id,groups:g.groups,meta:g.meta,payload:g.payload,locale:r,label:g.label?.[r],tags:g.tags?.[r],active:this.activeAssetIds.has(g.id)})),w=m<f?t+1:void 0;return{assets:v,currentPage:t,nextPage:w,total:f}}updateLabel(e,t,i){this.assets.forEach(r=>{r.id===e&&(r.label=r.label||{},r.label[i]=t)})}getAssetSelectValue(e){let t=this.assets.find(({id:i})=>i===e);if(t)return{id:t.id,label:t.label?.en||"",thumbUri:t.meta?.thumbUri}}getAsset(e){return this.assets.find(t=>t.id===e)}setAssetActive(e){this.activeAssetIds.add(e)}getActiveAssetIds(){return Array.from(this.activeAssetIds)}setAssetsActive(e){e.forEach(t=>this.activeAssetIds.add(t))}setAssetInactive(e){this.activeAssetIds.delete(e)}clearActiveAssets(){this.activeAssetIds.clear()}isAssetActive(e){return this.activeAssetIds.has(e)}addAsset(e){let t=this.assets.findIndex(i=>i.id===e.id);t>=0?this.assets[t]=e:this.assets.push(e)}removeAsset(e){let t=this.assets.findIndex(i=>i.id===e);t!==-1&&(this.assets.splice(t,1),this.activeAssetIds.delete(e))}async getGroups(){let e=new Set;return this.assets.forEach(t=>{t.groups&&t.groups.forEach(i=>e.add(i))}),Array.from(e)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var Gs=typeof global=="object"&&global&&global.Object===Object&&global,sr=Gs,Ks=typeof self=="object"&&self&&self.Object===Object&&self,Ys=sr||Ks||Function("return this")(),U=Ys,Ws=U.Symbol,ce=Ws,lr=Object.prototype,Qs=lr.hasOwnProperty,Zs=lr.toString,ke=ce?ce.toStringTag:void 0;function Xs(e){var t=Qs.call(e,ke),i=e[ke];try{e[ke]=void 0;var r=!0}catch{}var n=Zs.call(e);return r&&(t?e[ke]=i:delete e[ke]),n}var Js=Xs,el=Object.prototype,tl=el.toString;function il(e){return tl.call(e)}var rl=il,nl="[object Null]",ol="[object Undefined]",Ki=ce?ce.toStringTag:void 0;function al(e){return e==null?e===void 0?ol:nl:Ki&&Ki in Object(e)?Js(e):rl(e)}var Ce=al;function sl(e){return e!=null&&typeof e=="object"}var Nt=sl,Zp=Array.isArray;function ll(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var cr=ll,cl="[object AsyncFunction]",ul="[object Function]",dl="[object GeneratorFunction]",gl="[object Proxy]";function pl(e){if(!cr(e))return!1;var t=Ce(e);return t==ul||t==dl||t==cl||t==gl}var hl=pl,fl=U["__core-js_shared__"],Ct=fl,Yi=function(){var e=/[^.]+$/.exec(Ct&&Ct.keys&&Ct.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ml(e){return!!Yi&&Yi in e}var yl=ml,bl=Function.prototype,_l=bl.toString;function vl(e){if(e!=null){try{return _l.call(e)}catch{}try{return e+""}catch{}}return""}var W=vl,wl=/[\\^$.*+?()[\]{}|]/g,xl=/^\[object .+?Constructor\]$/,Il=Function.prototype,kl=Object.prototype,Sl=Il.toString,El=kl.hasOwnProperty,Al=RegExp("^"+Sl.call(El).replace(wl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Cl(e){if(!cr(e)||yl(e))return!1;var t=hl(e)?Al:xl;return t.test(W(e))}var Tl=Cl;function Ml(e,t){return e?.[t]}var jl=Ml;function $l(e,t){var i=jl(e,t);return Tl(i)?i:void 0}var ue=$l,Ol=ue(U,"WeakMap"),$t=Ol;function Pl(e,t){return e===t||e!==e&&t!==t}var Dl=Pl,Ul=9007199254740991;function Nl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ul}var zl=Nl,Xp=Object.prototype,Fl="[object Arguments]";function Ll(e){return Nt(e)&&Ce(e)==Fl}var Wi=Ll,ur=Object.prototype,Bl=ur.hasOwnProperty,Rl=ur.propertyIsEnumerable,Jp=Wi(function(){return arguments}())?Wi:function(e){return Nt(e)&&Bl.call(e,"callee")&&!Rl.call(e,"callee")},dr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Qi=dr&&typeof module=="object"&&module&&!module.nodeType&&module,ql=Qi&&Qi.exports===dr,Zi=ql?U.Buffer:void 0,eh=Zi?Zi.isBuffer:void 0,Vl="[object Arguments]",Hl="[object Array]",Gl="[object Boolean]",Kl="[object Date]",Yl="[object Error]",Wl="[object Function]",Ql="[object Map]",Zl="[object Number]",Xl="[object Object]",Jl="[object RegExp]",ec="[object Set]",tc="[object String]",ic="[object WeakMap]",rc="[object ArrayBuffer]",nc="[object DataView]",oc="[object Float32Array]",ac="[object Float64Array]",sc="[object Int8Array]",lc="[object Int16Array]",cc="[object Int32Array]",uc="[object Uint8Array]",dc="[object Uint8ClampedArray]",gc="[object Uint16Array]",pc="[object Uint32Array]",S={};S[oc]=S[ac]=S[sc]=S[lc]=S[cc]=S[uc]=S[dc]=S[gc]=S[pc]=!0;S[Vl]=S[Hl]=S[rc]=S[Gl]=S[nc]=S[Kl]=S[Yl]=S[Wl]=S[Ql]=S[Zl]=S[Xl]=S[Jl]=S[ec]=S[tc]=S[ic]=!1;function hc(e){return Nt(e)&&zl(e.length)&&!!S[Ce(e)]}var fc=hc;function mc(e){return function(t){return e(t)}}var yc=mc,gr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=gr&&typeof module=="object"&&module&&!module.nodeType&&module,bc=Se&&Se.exports===gr,Tt=bc&&sr.process,_c=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||Tt&&Tt.binding&&Tt.binding("util")}catch{}}(),Xi=_c,Ji=Xi&&Xi.isTypedArray,th=Ji?yc(Ji):fc,vc=Object.prototype,ih=vc.hasOwnProperty;function wc(e,t){return function(i){return e(t(i))}}var xc=wc,rh=xc(Object.keys,Object),Ic=Object.prototype,nh=Ic.hasOwnProperty,kc=ue(Object,"create"),Ee=kc;function Sc(){this.__data__=Ee?Ee(null):{},this.size=0}var Ec=Sc;function Ac(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Cc=Ac,Tc="__lodash_hash_undefined__",Mc=Object.prototype,jc=Mc.hasOwnProperty;function $c(e){var t=this.__data__;if(Ee){var i=t[e];return i===Tc?void 0:i}return jc.call(t,e)?t[e]:void 0}var Oc=$c,Pc=Object.prototype,Dc=Pc.hasOwnProperty;function Uc(e){var t=this.__data__;return Ee?t[e]!==void 0:Dc.call(t,e)}var Nc=Uc,zc="__lodash_hash_undefined__";function Fc(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ee&&t===void 0?zc:t,this}var Lc=Fc;function de(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}de.prototype.clear=Ec;de.prototype.delete=Cc;de.prototype.get=Oc;de.prototype.has=Nc;de.prototype.set=Lc;var er=de;function Bc(){this.__data__=[],this.size=0}var Rc=Bc;function qc(e,t){for(var i=e.length;i--;)if(Dl(e[i][0],t))return i;return-1}var He=qc,Vc=Array.prototype,Hc=Vc.splice;function Gc(e){var t=this.__data__,i=He(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():Hc.call(t,i,1),--this.size,!0}var Kc=Gc;function Yc(e){var t=this.__data__,i=He(t,e);return i<0?void 0:t[i][1]}var Wc=Yc;function Qc(e){return He(this.__data__,e)>-1}var Zc=Qc;function Xc(e,t){var i=this.__data__,r=He(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var Jc=Xc;function ge(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ge.prototype.clear=Rc;ge.prototype.delete=Kc;ge.prototype.get=Wc;ge.prototype.has=Zc;ge.prototype.set=Jc;var Ge=ge,eu=ue(U,"Map"),Ae=eu;function tu(){this.size=0,this.__data__={hash:new er,map:new(Ae||Ge),string:new er}}var iu=tu;function ru(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var nu=ru;function ou(e,t){var i=e.__data__;return nu(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ke=ou;function au(e){var t=Ke(this,e).delete(e);return this.size-=t?1:0,t}var su=au;function lu(e){return Ke(this,e).get(e)}var cu=lu;function uu(e){return Ke(this,e).has(e)}var du=uu;function gu(e,t){var i=Ke(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var pu=gu;function pe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}pe.prototype.clear=iu;pe.prototype.delete=su;pe.prototype.get=cu;pe.prototype.has=du;pe.prototype.set=pu;var pr=pe;function hu(){this.__data__=new Ge,this.size=0}var fu=hu;function mu(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var yu=mu;function bu(e){return this.__data__.get(e)}var _u=bu;function vu(e){return this.__data__.has(e)}var wu=vu,xu=200;function Iu(e,t){var i=this.__data__;if(i instanceof Ge){var r=i.__data__;if(!Ae||r.length<xu-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new pr(r)}return i.set(e,t),this.size=i.size,this}var ku=Iu;function Te(e){var t=this.__data__=new Ge(e);this.size=t.size}Te.prototype.clear=fu;Te.prototype.delete=yu;Te.prototype.get=_u;Te.prototype.has=wu;Te.prototype.set=ku;var Su=Object.prototype,oh=Su.propertyIsEnumerable,Eu=ue(U,"DataView"),Ot=Eu,Au=ue(U,"Promise"),Pt=Au,Cu=ue(U,"Set"),Dt=Cu,tr="[object Map]",Tu="[object Object]",ir="[object Promise]",rr="[object Set]",nr="[object WeakMap]",or="[object DataView]",Mu=W(Ot),ju=W(Ae),$u=W(Pt),Ou=W(Dt),Pu=W($t),le=Ce;(Ot&&le(new Ot(new ArrayBuffer(1)))!=or||Ae&&le(new Ae)!=tr||Pt&&le(Pt.resolve())!=ir||Dt&&le(new Dt)!=rr||$t&&le(new $t)!=nr)&&(le=function(e){var t=Ce(e),i=t==Tu?e.constructor:void 0,r=i?W(i):"";if(r)switch(r){case Mu:return or;case ju:return tr;case $u:return ir;case Ou:return rr;case Pu:return nr}return t});var ah=U.Uint8Array,Du="__lodash_hash_undefined__";function Uu(e){return this.__data__.set(e,Du),this}var Nu=Uu;function zu(e){return this.__data__.has(e)}var Fu=zu;function Ut(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new pr;++t<i;)this.add(e[t])}Ut.prototype.add=Ut.prototype.push=Nu;Ut.prototype.has=Fu;var ar=ce?ce.prototype:void 0,sh=ar?ar.valueOf:void 0,Lu=Object.prototype,lh=Lu.hasOwnProperty,Bu=Object.prototype,ch=Bu.hasOwnProperty,uh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),dh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),gh=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Ru(e){return e!==void 0}var qu=Ru;function Vu(e,t){let{cesdk:i}=t;if(i==null)return{};let r=t.propertyKey??"style",n=Gu(e);i.i18n.setTranslations({en:{[`panel.${n}`]:"Select Style",[`${e}.${r}`]:"Style"}});let o=Yu({baseURL:t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",includeNone:!0}),a=o;t.styles!=null&&(Array.isArray(t.styles)?a=t.styles:typeof t.styles=="function"&&(a=t.styles(o)));let s=Wu({cesdk:i,providerId:e,styles:a}),c=s.id;return Qu(s,{cesdk:i}),Hu({providerId:e,cesdk:i,panelId:n,entryId:c}),{[t.propertyKeyForPrompt??"prompt"]:(d,l)=>{let u=d.state("prompt","");return d.builder.TextArea(`${l.id}`,{inputLabel:t.i18n?.prompt?.inputLabel??t.propertyKeyForPrompt??"prompt",placeholder:t.i18n?.prompt?.placeholder,...u}),()=>{let[f]=s.getActiveAssetIds(),p=s.getAsset(f);return{id:l.id,type:"string",value:p?.meta?.prompt==null?u.value:`${u.value}; ${p.meta.prompt}`}}},[r]:(d,l)=>{let{builder:u,state:f}=d;if(a.length>0){let p=f("style",a[0]);return u.Button(`${l.id}`,{inputLabel:`${e}.${l.id}`,icon:"@imgly/Appearance",isDisabled:a.length===0,trailingIcon:"@imgly/ChevronRight",label:p.value.label,labelAlignment:"left",onClick:()=>{let m={onSelect:async v=>{s.clearActiveAssets(),s.setAssetActive(v.id),p.setValue({id:v.id,label:v.label??v.id}),i.ui.closePanel(n)}};i.ui.openPanel(n,{payload:m})}}),()=>({id:l.id,type:"string",value:p.value.id})}return()=>({id:l.id,type:"string",value:"none"})}}}function Hu(e){let{providerId:t,cesdk:i,panelId:r,entryId:n}=e;i?.ui.registerPanel(r,({builder:o,payload:a})=>{a?.onSelect==null&&o.Section(`${t}.error`,{children:()=>{o.Text("error",{content:"No onSelect function provided for the style selection panel."})}}),o.Library(`${t}.library.image`,{entries:[n],onSelect:async s=>{a?.onSelect?.(s)}})})}function Gu(e){return`ly.img.ai.${e}.styleSelection`}var Ku=[{id:"none",label:"None",prompt:""},{id:"anime-celshaded",label:"Anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",label:"Cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",label:"Kodak 400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",label:"Watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",label:"Dark Fantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",label:"Vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",label:"Vector Flat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",label:"3D Animation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",label:"Ukiyo\u2011e",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",label:"Surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",label:"Steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",label:"Night Bokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",label:"Pop Art",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}];function Yu(e){return Ku.map(t=>t.id==="none"?e.includeNone?{...t,thumbUri:`${e.baseURL}/thumbnails/None.svg`}:void 0:{...t,thumbUri:`${e.baseURL}/thumbnails/${t.id}.jpeg`}).filter(qu)}var Wu=e=>{let t=e.styles.map(a=>({...a,meta:{prompt:a.prompt}})),i=e.cesdk.engine.asset.findAllSources(),r=`${e.providerId}/styles`;for(;i.includes(r);)r+=`-${Math.random().toString(36).substring(2,5)}`;let n=new Hs(r,t),o=e.styles[0];return n.setAssetActive(o.id),n},Qu=(e,t)=>{t.cesdk.engine.asset.addSource(e),t.cesdk.ui.addAssetLibraryEntry({id:e.id,sourceIds:[e.id],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:i})=>i,cardLabelPosition:()=>"below"})},Zu=Vu;var Xu="ly.img.ai";function Me(e){return`${Xu}.${e}`}var Mt="@imgly/plugin-ai-generation",ph=`
|
|
72
|
+
<svg>
|
|
73
|
+
<symbol
|
|
74
|
+
fill="none"
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
viewBox="0 0 24 24"
|
|
77
|
+
id="@imgly/Sparkle"
|
|
78
|
+
>
|
|
79
|
+
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
|
|
80
|
+
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
|
|
81
|
+
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
|
|
82
|
+
|
|
83
|
+
</symbol>
|
|
84
|
+
|
|
85
|
+
<symbol
|
|
86
|
+
fill="none"
|
|
87
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
88
|
+
viewBox="0 0 24 24"
|
|
89
|
+
id="${Mt}/image"
|
|
90
|
+
>
|
|
91
|
+
<path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
|
|
92
|
+
<path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
|
|
93
|
+
<path d="M6.40053 5.38488C6.52538 5.06832 6.97338 5.06832 7.09823 5.38488L8.17455 8.11392C8.21267 8.21057 8.28917 8.28707 8.38582 8.32519L11.1149 9.40151C11.4314 9.52636 11.4314 9.97436 11.1149 10.0992L8.38582 11.1755C8.28917 11.2136 8.21267 11.2901 8.17455 11.3868L7.09823 14.1158C6.97338 14.4324 6.52538 14.4324 6.40053 14.1158L5.32421 11.3868C5.2861 11.2901 5.20959 11.2136 5.11295 11.1755L2.3839 10.0992C2.06735 9.97436 2.06735 9.52636 2.3839 9.40151L5.11295 8.32519C5.20959 8.28707 5.2861 8.21057 5.32421 8.11392L6.40053 5.38488Z" fill="currentColor"/>
|
|
94
|
+
<path d="M18.9994 16.5008V18.0004C18.9994 18.5526 18.5517 19.0004 17.9994 19.0004H9.33302L14.3753 11.4369C14.6722 10.9916 15.3266 10.9916 15.6234 11.4369L18.9994 16.5008Z" fill="currentColor"/>
|
|
95
|
+
|
|
96
|
+
</symbol>
|
|
97
|
+
<symbol
|
|
98
|
+
fill="none"
|
|
99
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
100
|
+
viewBox="0 0 24 24"
|
|
101
|
+
id="${Mt}/video"
|
|
102
|
+
>
|
|
103
|
+
<path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
|
|
104
|
+
<path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
|
|
105
|
+
<path d="M18.9019 3.3845C19.0267 3.06795 19.4747 3.06795 19.5996 3.3845L20.6759 6.11355C20.714 6.2102 20.7905 6.2867 20.8872 6.32482L23.6162 7.40114C23.9328 7.52598 23.9328 7.97399 23.6162 8.09883L20.8872 9.17515C20.7905 9.21327 20.714 9.28977 20.6759 9.38642L19.5996 12.1155C19.4747 12.432 19.0267 12.432 18.9019 12.1155L17.8255 9.38642C17.7874 9.28977 17.7109 9.21327 17.6143 9.17515L14.8852 8.09883C14.5687 7.97399 14.5687 7.52598 14.8852 7.40114L17.6143 6.32482C17.7109 6.2867 17.7874 6.2102 17.8255 6.11355L18.9019 3.3845Z" fill="currentColor"/>
|
|
106
|
+
<path d="M14.9994 13.2862C15.5089 12.8859 15.5089 12.1141 14.9995 11.7137L10.618 8.27047C9.96188 7.75485 9.00011 8.22225 9.00011 9.05673L9.00011 15.9429C9.00011 16.7773 9.96185 17.2448 10.618 16.7292L14.9994 13.2862Z" fill="currentColor"/>
|
|
107
|
+
</symbol>
|
|
108
|
+
<symbol
|
|
109
|
+
fill="none"
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
viewBox="0 0 24 24"
|
|
112
|
+
id="${Mt}/audio"
|
|
113
|
+
>
|
|
114
|
+
<path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
|
|
115
|
+
<path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
|
|
116
|
+
<path d="M19.5996 4.3845C19.4747 4.06795 19.0267 4.06795 18.9019 4.3845L17.8255 7.11355C17.7874 7.2102 17.7109 7.2867 17.6143 7.32482L14.8852 8.40114C14.5687 8.52598 14.5687 8.97399 14.8852 9.09883L17.6143 10.1752C17.7109 10.2133 17.7874 10.2898 17.8255 10.3864L18.9019 13.1155C19.0267 13.432 19.4747 13.432 19.5996 13.1155L20.6759 10.3864C20.714 10.2898 20.7905 10.2133 20.8872 10.1752L23.6162 9.09883C23.9328 8.97399 23.9328 8.52598 23.6162 8.40114L20.8872 7.32482C20.7905 7.2867 20.714 7.2102 20.6759 7.11355L19.5996 4.3845Z" fill="currentColor"/>
|
|
117
|
+
</symbol>
|
|
118
|
+
<symbol
|
|
119
|
+
fill="none"
|
|
120
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
121
|
+
viewBox="0 0 24 24"
|
|
122
|
+
id="@imgly/MixingPlate"
|
|
123
|
+
>
|
|
124
|
+
<path d="M9.75 9C10.5784 9 11.25 8.32843 11.25 7.5C11.25 6.67157 10.5784 6 9.75 6C8.92157 6 8.25 6.67157 8.25 7.5C8.25 8.32843 8.92157 9 9.75 9Z" fill="currentColor"/>
|
|
125
|
+
<path d="M7 13C7.82843 13 8.5 12.3284 8.5 11.5C8.5 10.6716 7.82843 10 7 10C6.17157 10 5.5 10.6716 5.5 11.5C5.5 12.3284 6.17157 13 7 13Z" fill="currentColor"/>
|
|
126
|
+
<path d="M15.75 7.5C15.75 8.32843 15.0784 9 14.25 9C13.4216 9 12.75 8.32843 12.75 7.5C12.75 6.67157 13.4216 6 14.25 6C15.0784 6 15.75 6.67157 15.75 7.5Z" fill="currentColor"/>
|
|
127
|
+
<path d="M17 13C17.8284 13 18.5 12.3284 18.5 11.5C18.5 10.6716 17.8284 10 17 10C16.1716 10 15.5 10.6716 15.5 11.5C15.5 12.3284 16.1716 13 17 13Z" fill="currentColor"/>
|
|
128
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26309 2.77709C10.6681 1.77921 13.4829 1.7322 15.9209 2.64297C18.1572 3.47923 20.0876 5.09285 21.1766 7.28598C22.3395 9.62772 22.4889 13.1077 20.3864 15.2982C19.2693 16.4621 17.7657 16.9982 16.0026 16.9997C15.7897 16.9997 15.5555 16.9864 15.3497 16.9745C15.309 16.9722 15.2694 16.9699 15.2313 16.9679C14.9817 16.9542 14.761 16.9455 14.5569 16.9539C14.124 16.9718 13.9598 17.0612 13.89 17.1324C13.718 17.3081 13.6946 17.6672 13.8854 17.8895C14.2899 18.3608 14.5016 18.9277 14.5016 19.5497C14.5016 20.2206 14.3086 20.9011 13.7542 21.3896C13.2471 21.837 12.6082 21.9997 11.9635 21.9997C10.6049 21.9997 9.31155 21.7367 8.0934 21.2067C6.89058 20.6831 5.84501 19.9687 4.94363 19.0666C4.04281 18.1651 3.31836 17.107 2.79369 15.8978C1.72761 13.4409 1.72662 10.5261 2.81247 8.07034C3.88024 5.65548 5.84206 3.78161 8.26309 2.77709ZM15.2207 4.51639C13.2556 3.78239 10.9651 3.82132 9.02956 4.62439C7.06888 5.43791 5.49559 6.94785 4.64163 8.87914C3.78373 10.8194 3.78253 13.1522 4.62841 15.1017C5.05312 16.0805 5.63511 16.9291 6.35838 17.6529C7.08102 18.3761 7.91671 18.9484 8.89123 19.3728C9.8492 19.7895 10.87 19.9997 11.9635 19.9997C12.2815 19.9997 12.394 19.9225 12.431 19.8899L12.4319 19.8891C12.4367 19.8849 12.4487 19.8743 12.4631 19.8359C12.4799 19.7911 12.5016 19.7024 12.5016 19.5497C12.5016 19.4091 12.4633 19.3034 12.3677 19.192C11.5353 18.222 11.5272 16.6868 12.4611 15.7331C13.0741 15.1071 13.8844 14.98 14.4745 14.9556C14.7819 14.943 15.085 14.9568 15.3409 14.9709C15.3906 14.9736 15.4379 14.9763 15.4832 14.9788C15.6876 14.9904 15.8508 14.9997 16.0009 14.9997C17.3405 14.9986 18.2792 14.6054 18.9435 13.9133C20.2633 12.5382 20.3186 10.055 19.3853 8.1755C18.5436 6.48051 17.0293 5.19281 15.2207 4.51639Z" fill="currentColor"/>
|
|
129
|
+
|
|
130
|
+
</symbol>
|
|
131
|
+
</svg>
|
|
132
|
+
`;var hr={ImageUrl:Vs,StyleTransfer:Zu};var fr={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API."},components:{securitySchemes:{apiKeyAuth:{type:"apiKey",in:"header",name:"Authorization",description:"Fal Key"}},schemas:{QueueStatus:{type:"object",properties:{status:{type:"string",enum:["IN_QUEUE","IN_PROGRESS","COMPLETED"]},request_id:{type:"string",description:"The request id."},response_url:{type:"string",description:"The response url."},status_url:{type:"string",description:"The status url."},cancel_url:{type:"string",description:"The cancel url."},logs:{type:"object",description:"The logs.",additionalProperties:!0},metrics:{type:"object",description:"The metrics.",additionalProperties:!0},queue_position:{type:"integer",description:"The queue position."}},required:["status","request_id"]},Recraft20bInput:{title:"TextToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},image_size:{anyOf:[{enum:["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],type:"string"},{$ref:"#/components/schemas/ImageSize"}],title:"Format",default:"square_hd","x-imgly-enum-labels":{ImageSize:"Custom",square_hd:"Square HD",square:"Square",portrait_4_3:"Portrait 4:3",portrait_16_9:"Portrait 16:9",landscape_4_3:"Landscape 4:3",landscape_16_9:"Landscape 16:9"},"x-imgly-enum-icons":{square:"@imgly/plugin/formats/ratio1by1",square_hd:"@imgly/plugin/formats/ratio1by1",portrait_4_3:"@imgly/plugin/formats/ratio3by4",portrait_16_9:"@imgly/plugin/formats/ratio9by16",landscape_4_3:"@imgly/plugin/formats/ratio4by3",landscape_16_9:"@imgly/plugin/formats/ratio16by9",ImageSize:"@imgly/plugin/formats/ratioFree"}},style:{enum:["any","realistic_image","digital_illustration","vector_illustration","realistic_image/b_and_w","realistic_image/hard_flash","realistic_image/hdr","realistic_image/natural_light","realistic_image/studio_portrait","realistic_image/enterprise","realistic_image/motion_blur","realistic_image/evening_light","realistic_image/faded_nostalgia","realistic_image/forest_life","realistic_image/mystic_naturalism","realistic_image/natural_tones","realistic_image/organic_calm","realistic_image/real_life_glow","realistic_image/retro_realism","realistic_image/retro_snapshot","realistic_image/urban_drama","realistic_image/village_realism","realistic_image/warm_folk","digital_illustration/pixel_art","digital_illustration/hand_drawn","digital_illustration/grain","digital_illustration/infantile_sketch","digital_illustration/2d_art_poster","digital_illustration/handmade_3d","digital_illustration/hand_drawn_outline","digital_illustration/engraving_color","digital_illustration/2d_art_poster_2","digital_illustration/antiquarian","digital_illustration/bold_fantasy","digital_illustration/child_book","digital_illustration/child_books","digital_illustration/cover","digital_illustration/crosshatch","digital_illustration/digital_engraving","digital_illustration/expressionism","digital_illustration/freehand_details","digital_illustration/grain_20","digital_illustration/graphic_intensity","digital_illustration/hard_comics","digital_illustration/long_shadow","digital_illustration/modern_folk","digital_illustration/multicolor","digital_illustration/neon_calm","digital_illustration/noir","digital_illustration/nostalgic_pastel","digital_illustration/outline_details","digital_illustration/pastel_gradient","digital_illustration/pastel_sketch","digital_illustration/pop_art","digital_illustration/pop_renaissance","digital_illustration/street_art","digital_illustration/tablet_sketch","digital_illustration/urban_glow","digital_illustration/urban_sketching","digital_illustration/vanilla_dreams","digital_illustration/young_adult_book","digital_illustration/young_adult_book_2","vector_illustration/bold_stroke","vector_illustration/chemistry","vector_illustration/colored_stencil","vector_illustration/contour_pop_art","vector_illustration/cosmics","vector_illustration/cutout","vector_illustration/depressive","vector_illustration/editorial","vector_illustration/emotional_flat","vector_illustration/infographical","vector_illustration/marker_outline","vector_illustration/mosaic","vector_illustration/naivector","vector_illustration/roundish_flat","vector_illustration/segmented_colors","vector_illustration/sharp_contrast","vector_illustration/thin","vector_illustration/vector_photo","vector_illustration/vivid_shapes","vector_illustration/engraving","vector_illustration/line_art","vector_illustration/line_circuit","vector_illustration/linocut","icon/broken_line","icon/colored_outline","icon/colored_shapes","icon/colored_shapes_gradient","icon/doodle_fill","icon/doodle_offset_fill","icon/offset_fill","icon/outline","icon/outline_gradient","icon/uneven_fill"],title:"Style",type:"string",description:"The style of the generated images. Vector images cost 2X as much.",default:"realistic_image"},colors:{title:"Colors",type:"array",description:"An array of preferable colors",items:{$ref:"#/components/schemas/RGBColor"},default:[]}},"x-fal-order-properties":["prompt","style","image_size"],required:["prompt"]},Recraft20bOutput:{title:"TextToImageOutput",type:"object",properties:{images:{title:"Images",type:"array",items:{$ref:"#/components/schemas/File"}}},"x-fal-order-properties":["images"],required:["images"]},ImageSize:{title:"ImageSize",type:"object",properties:{height:{maximum:14142,type:"integer",title:"Height",description:"The height of the generated image.",exclusiveMinimum:0,default:512},width:{maximum:14142,type:"integer",title:"Width",description:"The width of the generated image.",exclusiveMinimum:0,default:512}},"x-fal-order-properties":["width","height"]},RGBColor:{title:"RGBColor",type:"object",properties:{r:{minimum:0,maximum:255,type:"integer",title:"R",description:"Red color value",default:0},b:{minimum:0,maximum:255,type:"integer",title:"B",description:"Blue color value",default:0},g:{minimum:0,maximum:255,type:"integer",title:"G",description:"Green color value",default:0}},"x-fal-order-properties":["r","g","b"]},File:{title:"File",type:"object",properties:{file_size:{title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{title:"Content Type",type:"string",description:"The mime type of the file."},url:{title:"Url",type:"string",description:"The URL where the file can be downloaded from."},file_data:{format:"binary",title:"File Data",type:"string",description:"File data"}},"x-fal-order-properties":["url","content_type","file_name","file_size","file_data"],required:["url"]}}},paths:{"/fal-ai/recraft/v2/text-to-image/requests/{request_id}/status":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}},{name:"logs",in:"query",required:!1,schema:{type:"number",description:"Whether to include logs (`1`) in the response or not (`0`)."}}],responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft/v2/text-to-image/requests/{request_id}/cancel":{put:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"The request was cancelled.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/recraft/v2/text-to-image":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Recraft20bInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft/v2/text-to-image/requests/{request_id}":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"Result of the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/Recraft20bOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};var ed={square_hd:{width:1024,height:1024},square:{width:512,height:512},portrait_4_3:{width:1024,height:1365},portrait_16_9:{width:1024,height:1820},landscape_4_3:{width:1365,height:1024},landscape_16_9:{width:1820,height:1024}};function Ye(e){return ed[e]}var td=[{id:"realistic_image",label:"Realistic Image"},{id:"digital_illustration",label:"Digital Illustration"},{id:"realistic_image/b_and_w",label:"Black & White"},{id:"realistic_image/hard_flash",label:"Hard Flash"},{id:"realistic_image/hdr",label:"HDR"},{id:"realistic_image/natural_light",label:"Natural Light"},{id:"realistic_image/studio_portrait",label:"Studio Portrait"},{id:"realistic_image/enterprise",label:"Enterprise"},{id:"realistic_image/motion_blur",label:"Motion Blur"},{id:"realistic_image/evening_light",label:"Evening Light"},{id:"realistic_image/faded_nostalgia",label:"Faded Nostalgia"},{id:"realistic_image/forest_life",label:"Forest Life"},{id:"realistic_image/mystic_naturalism",label:"Mystic Naturalism"},{id:"realistic_image/natural_tones",label:"Natural Tones"},{id:"realistic_image/organic_calm",label:"Organic Calm"},{id:"realistic_image/real_life_glow",label:"Real Life Glow"},{id:"realistic_image/retro_realism",label:"Retro Realism"},{id:"realistic_image/retro_snapshot",label:"Retro Snapshot"},{id:"realistic_image/urban_drama",label:"Urban Drama"},{id:"realistic_image/village_realism",label:"Village Realism"},{id:"realistic_image/warm_folk",label:"Warm Folk"},{id:"digital_illustration/pixel_art",label:"Pixel Art"},{id:"digital_illustration/hand_drawn",label:"Hand Drawn"},{id:"digital_illustration/grain",label:"Grain"},{id:"digital_illustration/infantile_sketch",label:"Infantile Sketch"},{id:"digital_illustration/2d_art_poster",label:"2D Art Poster"},{id:"digital_illustration/handmade_3d",label:"Handmade 3D"},{id:"digital_illustration/hand_drawn_outline",label:"Hand Drawn Outline"},{id:"digital_illustration/engraving_color",label:"Engraving Color"},{id:"digital_illustration/2d_art_poster_2",label:"2D Art Poster 2"},{id:"digital_illustration/antiquarian",label:"Antiquarian"},{id:"digital_illustration/bold_fantasy",label:"Bold Fantasy"},{id:"digital_illustration/child_book",label:"Child Book"},{id:"digital_illustration/child_books",label:"Child Books"},{id:"digital_illustration/cover",label:"Cover"},{id:"digital_illustration/crosshatch",label:"Crosshatch"},{id:"digital_illustration/digital_engraving",label:"Digital Engraving"},{id:"digital_illustration/expressionism",label:"Expressionism"},{id:"digital_illustration/freehand_details",label:"Freehand Details"},{id:"digital_illustration/grain_20",label:"Grain 20"},{id:"digital_illustration/graphic_intensity",label:"Graphic Intensity"},{id:"digital_illustration/hard_comics",label:"Hard Comics"},{id:"digital_illustration/long_shadow",label:"Long Shadow"},{id:"digital_illustration/modern_folk",label:"Modern Folk"},{id:"digital_illustration/multicolor",label:"Multicolor"},{id:"digital_illustration/neon_calm",label:"Neon Calm"},{id:"digital_illustration/noir",label:"Noir"},{id:"digital_illustration/nostalgic_pastel",label:"Nostalgic Pastel"},{id:"digital_illustration/outline_details",label:"Outline Details"},{id:"digital_illustration/pastel_gradient",label:"Pastel Gradient"},{id:"digital_illustration/pastel_sketch",label:"Pastel Sketch"},{id:"digital_illustration/pop_art",label:"Pop Art"},{id:"digital_illustration/pop_renaissance",label:"Pop Renaissance"},{id:"digital_illustration/street_art",label:"Street Art"},{id:"digital_illustration/tablet_sketch",label:"Tablet Sketch"},{id:"digital_illustration/urban_glow",label:"Urban Glow"},{id:"digital_illustration/urban_sketching",label:"Urban Sketching"},{id:"digital_illustration/vanilla_dreams",label:"Vanilla Dreams"},{id:"digital_illustration/young_adult_book",label:"Young Adult Book"},{id:"digital_illustration/young_adult_book_2",label:"Young Adult Book 2"}],yh=td[0],id=[{id:"vector_illustration",label:"Vector Illustration"},{id:"vector_illustration/bold_stroke",label:"Bold Stroke"},{id:"vector_illustration/chemistry",label:"Chemistry"},{id:"vector_illustration/colored_stencil",label:"Colored Stencil"},{id:"vector_illustration/contour_pop_art",label:"Contour Pop Art"},{id:"vector_illustration/cosmics",label:"Cosmics"},{id:"vector_illustration/cutout",label:"Cutout"},{id:"vector_illustration/depressive",label:"Depressive"},{id:"vector_illustration/editorial",label:"Editorial"},{id:"vector_illustration/emotional_flat",label:"Emotional Flat"},{id:"vector_illustration/infographical",label:"Infographical"},{id:"vector_illustration/marker_outline",label:"Marker Outline"},{id:"vector_illustration/mosaic",label:"Mosaic"},{id:"vector_illustration/naivector",label:"Naive Vector"},{id:"vector_illustration/roundish_flat",label:"Roundish Flat"},{id:"vector_illustration/segmented_colors",label:"Segmented Colors"},{id:"vector_illustration/sharp_contrast",label:"Sharp Contrast"},{id:"vector_illustration/thin",label:"Thin"},{id:"vector_illustration/vector_photo",label:"Vector Photo"},{id:"vector_illustration/vivid_shapes",label:"Vivid Shapes"},{id:"vector_illustration/engraving",label:"Engraving"},{id:"vector_illustration/line_art",label:"Line Art"},{id:"vector_illustration/line_circuit",label:"Line Circuit"},{id:"vector_illustration/linocut",label:"Linocut"}],bh=id[0],zt=[{id:"icon/broken_line",label:"Broken Line"},{id:"icon/colored_outline",label:"Colored Outline"},{id:"icon/colored_shapes",label:"Colored Shapes"},{id:"icon/colored_shapes_gradient",label:"Colored Shapes Gradient"},{id:"icon/doodle_fill",label:"Doodle Fill"},{id:"icon/doodle_offset_fill",label:"Doodle Offset Fill"},{id:"icon/offset_fill",label:"Offset Fill"},{id:"icon/outline",label:"Outline"},{id:"icon/outline_gradient",label:"Outline Gradient"},{id:"icon/uneven_fill",label:"Uneven Fill"}],_h=zt[0],rd=e=>({realistic_image:`${e}/realistic_image.webp`,digital_illustration:`${e}/digital_illustration.webp`,"realistic_image/b_and_w":`${e}/realistic_image_black_&_white.webp`,"realistic_image/hard_flash":`${e}/realistic_image_hard_flash.webp`,"realistic_image/hdr":`${e}/realistic_image_hdr.webp`,"realistic_image/natural_light":`${e}/realistic_image_natural_light.webp`,"realistic_image/studio_portrait":`${e}/realistic_image_studio_portrait.webp`,"realistic_image/enterprise":`${e}/realistic_image_enterprise.webp`,"realistic_image/motion_blur":`${e}/realistic_image_motion_blur.webp`,"digital_illustration/pixel_art":`${e}/digital_illustration_pixel_art.webp`,"digital_illustration/hand_drawn":`${e}/digital_illustration_hand_drawn.webp`,"digital_illustration/grain":`${e}/digital_illustration_grain.webp`,"digital_illustration/infantile_sketch":`${e}/digital_illustration_infantile_sketch.webp`,"digital_illustration/2d_art_poster":`${e}/digital_illustration_2d_art_poster.webp`,"digital_illustration/handmade_3d":`${e}/digital_illustration_handmade_3d.webp`,"digital_illustration/hand_drawn_outline":`${e}/digital_illustration_handdrawn_outline.webp`,"digital_illustration/engraving_color":`${e}/digital_illustration_engraving_color.webp`,"digital_illustration/2d_art_poster_2":`${e}/digital_illustration_2d_artposter_2.webp`,vector_illustration:`${e}/vector_illustration.svg`,"vector_illustration/bold_stroke":`${e}/vector_illustration_bold_stroke.svg`,"vector_illustration/chemistry":`${e}/vector_illustration_chemistry.svg`,"vector_illustration/colored_stencil":`${e}/vector_illustration_colored_stencil.svg`,"vector_illustration/contour_pop_art":`${e}/vector_illustration_contour_pop_art.svg`,"vector_illustration/cosmics":`${e}/vector_illustration_cosmics.svg`,"vector_illustration/cutout":`${e}/vector_illustration_cutout.svg`,"vector_illustration/depressive":`${e}/vector_illustration_depressive.svg`,"vector_illustration/editorial":`${e}/vector_illustration_editorial.svg`,"vector_illustration/emotional_flat":`${e}/vector_illustration_emotional_flat.svg`,"vector_illustration/infographical":`${e}/vector_illustration_infographical.svg`,"vector_illustration/marker_outline":`${e}/vector_illustration_marker_outline.svg`,"vector_illustration/mosaic":`${e}/vector_illustration_mosaic.svg`,"vector_illustration/naivector":`${e}/vector_illustration_naivector.svg`,"vector_illustration/roundish_flat":`${e}/vector_illustration_roundish_flat.svg`,"vector_illustration/segmented_colors":`${e}/vector_illustration_segmented_colors.svg`,"vector_illustration/sharp_contrast":`${e}/vector_illustration_sharp_contrast.svg`,"vector_illustration/thin":`${e}/vector_illustration_thin.svg`,"vector_illustration/vector_photo":`${e}/vector_illustration_vector_photo.svg`,"vector_illustration/vivid_shapes":`${e}/vector_illustration_vivid_shapes.svg`,"vector_illustration/engraving":`${e}/vector_illustration_engraving.svg`,"vector_illustration/line_art":`${e}/vector_illustration_line_art.svg`,"vector_illustration/line_circuit":`${e}/vector_illustration_line_circuit.svg`,"vector_illustration/linocut":`${e}/vector_illustration_linocut.svg`,"realistic_image/evening_light":`${e}/realistic_image_evening_light.webp`,"realistic_image/faded_nostalgia":`${e}/realistic_image_faded_nostalgia.webp`,"realistic_image/forest_life":`${e}/realistic_image_forest_life.webp`,"realistic_image/mystic_naturalism":`${e}/realistic_image_mystic_naturalism.webp`,"realistic_image/natural_tones":`${e}/realistic_image_natural_tones.webp`,"realistic_image/organic_calm":`${e}/realistic_image_organic_calm.webp`,"realistic_image/real_life_glow":`${e}/realistic_image_real_life_glow.webp`,"realistic_image/retro_realism":`${e}/realistic_image_retro_realism.webp`,"realistic_image/retro_snapshot":`${e}/realistic_image_retro_snapshot.webp`,"realistic_image/urban_drama":`${e}/realistic_image_urban_drama.webp`,"realistic_image/village_realism":`${e}/realistic_image_village_realism.webp`,"realistic_image/warm_folk":`${e}/realistic_image_warm_folk.webp`,"digital_illustration/antiquarian":`${e}/digital_illustration_antiquarian.webp`,"digital_illustration/bold_fantasy":`${e}/digital_illustration_bold_fantasy.webp`,"digital_illustration/child_book":`${e}/digital_illustration_child_book.webp`,"digital_illustration/child_books":`${e}/digital_illustration_child_books.webp`,"digital_illustration/cover":`${e}/digital_illustration_cover.webp`,"digital_illustration/crosshatch":`${e}/digital_illustration_crosshatch.webp`,"digital_illustration/digital_engraving":`${e}/digital_illustration_digital_engraving.webp`,"digital_illustration/expressionism":`${e}/digital_illustration_expressionism.webp`,"digital_illustration/freehand_details":`${e}/digital_illustration_freehand_details.webp`,"digital_illustration/grain_20":`${e}/digital_illustration_grain_20.webp`,"digital_illustration/graphic_intensity":`${e}/digital_illustration_graphic_intensity.webp`,"digital_illustration/hard_comics":`${e}/digital_illustration_hard_comics.webp`,"digital_illustration/long_shadow":`${e}/digital_illustration_long_shadow.webp`,"digital_illustration/modern_folk":`${e}/digital_illustration_modern_folk.webp`,"digital_illustration/multicolor":`${e}/digital_illustration_multicolor.webp`,"digital_illustration/neon_calm":`${e}/digital_illustration_neon_calm.webp`,"digital_illustration/noir":`${e}/digital_illustration_noir.webp`,"digital_illustration/nostalgic_pastel":`${e}/digital_illustration_nostalgic_pastel.webp`,"digital_illustration/outline_details":`${e}/digital_illustration_outline_details.webp`,"digital_illustration/pastel_gradient":`${e}/digital_illustration_pastel_gradient.webp`,"digital_illustration/pastel_sketch":`${e}/digital_illustration_pastel_sketch.webp`,"digital_illustration/pop_art":`${e}/digital_illustration_pop_art.webp`,"digital_illustration/pop_renaissance":`${e}/digital_illustration_pop_renaissance.webp`,"digital_illustration/street_art":`${e}/digital_illustration_street_art.webp`,"digital_illustration/tablet_sketch":`${e}/digital_illustration_tablet_sketch.webp`,"digital_illustration/urban_glow":`${e}/digital_illustration_urban_glow.webp`,"digital_illustration/urban_sketching":`${e}/digital_illustration_urban_sketching.webp`,"digital_illustration/vanilla_dreams":`${e}/digital_illustration_vanilla_dreams.webp`,"digital_illustration/young_adult_book":`${e}/digital_illustration_young_adult_book.webp`,"digital_illustration/young_adult_book_2":`${e}/digital_illustration_young_adult_book_2.webp`,"icon/broken_line":`${e}/icon_broken_line.svg`,"icon/colored_outline":`${e}/icon_colored_outline.svg`,"icon/colored_shapes":`${e}/icon_colored_shapes.svg`,"icon/colored_shapes_gradient":`${e}/icon_colored_shapes_gradient.svg`,"icon/doodle_fill":`${e}/icon_doodle_fill.svg`,"icon/doodle_offset_fill":`${e}/icon_doodle_offset_fill.svg`,"icon/offset_fill":`${e}/icon_offset_fill.svg`,"icon/outline":`${e}/icon_outline.svg`,"icon/outline_gradient":`${e}/icon_outline_gradient.svg`,"icon/uneven_fill":`${e}/icon_uneven_fill.svg`});function mr(e,t){return rd(`${t}thumbnails/`)[e]}var vi=Ii(bi());var _i=Ii(bi());function bt(e){return e!=null&&typeof e!="string"&&"width"in e&&"height"in e}async function Dn(e,t){if(e!=null){if(e.startsWith("blob:")){let i=t!=null?await t.engine.editor.getMimeType(e):"image/png",n=await(await fetch(e)).blob(),o=new File([n],`image.${At(i)}`,{type:i});return _i.fal.storage.upload(o)}if(t!=null&&e.startsWith("buffer:")){let i=await t.engine.editor.getMimeType(e),r=t.engine.editor.getBufferLength(e),n=t.engine.editor.getBufferData(e,0,r),o=new File([n],`image.${At(i)}`,{type:i});return _i.fal.storage.upload(o)}return e}}function Tp(e,t){let i=e.middleware??t.middlewares??t.middleware??[],r={id:e.modelKey,kind:"sticker",name:e.name,initialize:async n=>{vi.fal.config({proxyUrl:t.proxyUrl,requestMiddleware:async o=>({...o,headers:{...o.headers,...e.headers??{}}})}),e.initialize?.(n)},input:{quickActions:{supported:e.supportedQuickActions??{}},panel:{type:"schema",document:e.schema,inputReference:e.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...e.cesdk!=null?hr.ImageUrl(e.modelKey,{cesdk:e.cesdk}):{},...e.renderCustomProperty},getBlockInput:n=>{if(e.getBlockInput!=null)return e.getBlockInput(n);if(e.getStickerSize!=null){let{width:o,height:a}=e.getStickerSize(n);return Promise.resolve({sticker:{width:o,height:a}})}if(n.image_size!=null&&bt(n.image_size))return Promise.resolve({sticker:{width:n.image_size.width??512,height:n.image_size.height??512}});if(n.image_size!=null&&typeof n.image_size=="string"){let o=Ye(n.image_size);return Promise.resolve({sticker:o})}throw new Error("getBlockInput or getStickerSize must be provided")},userFlow:e.userFlow??"placeholder"}},output:{abortable:!0,middleware:i,history:"@imgly/indexedDB",generate:async(n,{abortSignal:o})=>{let a=await Dn(n.image_url,e.cesdk),s=await vi.fal.subscribe(e.falKey??e.modelKey,{abortSignal:o,input:a!=null?{...n,image_url:a}:n,logs:!0}),c=s?.data?.images;if(c!=null&&Array.isArray(c)){let l=c[0]?.url;if(l!=null)return{kind:"sticker",url:l}}else{let d=s?.data?.image;if(d!=null){let l=d?.url;if(l!=null)return{kind:"sticker",url:l}}}throw console.error("Cannot extract generated sticker from response:",s),new Error("Cannot find generated sticker")}}};return t.debug&&console.log("Created Provider:",r),r}var Un=Tp;var Be;function Nn(e){return async({cesdk:t})=>Mp(t,e)}function Mp(e,t){let i="fal-ai/recraft/v2/text-to-image",r="fal-ai/recraft/v2/text-to-sticker",n=`${r}/styles/icon`,o=t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/recraft-v3/";return e.ui.addIconSet("@imgly/plugin/formats",Gi.Formats),Be=new zi(n,zt.map(({id:a,label:s})=>({id:a,label:s,thumbUri:mr(a,o)}))),Be.setAssetActive("icon/broken_line"),e.engine.asset.addSource(Be),e.ui.addAssetLibraryEntry({id:n,sourceIds:[n],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:a})=>a,cardLabelPosition:()=>"below"}),e.ui.registerPanel(`${Me(r)}.styleSelection`,({builder:a,payload:s})=>{if(s==null)return null;a.Library(`${r}.library.style`,{entries:[n],onSelect:async c=>{s.onSelect(c)}})}),e.i18n.setTranslations({en:{[`panel.${Me("fal-ai/recraft/v2/text-to-sticker")}.styleSelection`]:"Style Selection",[`${r}.style`]:"Style",[`${r}.style.type`]:"Type",[`${r}.style.type.icon`]:"Icon"}}),Un({falKey:i,modelKey:r,name:"Recraft 20b",schema:fr,inputReference:"#/components/schemas/Recraft20bInput",middleware:t.middlewares??t.middleware??[],headers:t.headers,userFlow:"placeholder",renderCustomProperty:{style:({builder:a,state:s},c)=>{let d=s("style/icon",{id:"icon/broken_line",label:"Broken Line"});return a.Button(`${c.id}`,{inputLabel:`${r}.${c.id}`,icon:"@imgly/Appearance",trailingIcon:"@imgly/ChevronRight",label:d.value.label,labelAlignment:"left",onClick:()=>{let l={onSelect:async u=>{if(u.id==="back")return;let f={id:u.id,label:u.label??u.id};Be.clearActiveAssets(),Be.setAssetActive(u.id),d.setValue(f),e.ui.closePanel(`${Me(r)}.styleSelection`)}};e.ui.openPanel(`${Me(r)}.styleSelection`,{payload:l})}}),()=>({id:c.id,type:"string",value:d.value.id??"icon/broken_line"})}},getBlockInput:a=>{if(bt(a.image_size))return Promise.resolve({sticker:{width:a.image_size.width??512,height:a.image_size.height??512}});let s=Ye(a.image_size??"square_hd");return Promise.resolve({sticker:s})}},t)}var jp={Recraft20b:Nn},bf=jp;export{bf as default};
|
|
133
|
+
/*! Bundled license information:
|
|
134
|
+
|
|
135
|
+
@imgly/plugin-utils/dist/index.mjs:
|
|
136
|
+
(*! Bundled license information:
|
|
137
|
+
|
|
138
|
+
lodash-es/lodash.js:
|
|
139
|
+
(**
|
|
140
|
+
* @license
|
|
141
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
142
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
143
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
144
|
+
* Released under MIT license <https://lodash.com/license>
|
|
145
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
146
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
147
|
+
*)
|
|
148
|
+
*)
|
|
149
|
+
|
|
150
|
+
@imgly/plugin-ai-generation-web/dist/index.mjs:
|
|
151
|
+
(*! Bundled license information:
|
|
152
|
+
|
|
153
|
+
@imgly/plugin-utils/dist/index.mjs:
|
|
154
|
+
(*! Bundled license information:
|
|
155
|
+
|
|
156
|
+
lodash-es/lodash.js:
|
|
157
|
+
(**
|
|
158
|
+
* @license
|
|
159
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
160
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
161
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
162
|
+
* Released under MIT license <https://lodash.com/license>
|
|
163
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
164
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
165
|
+
*)
|
|
166
|
+
*)
|
|
167
|
+
*)
|
|
168
|
+
*/
|
|
169
|
+
//# sourceMappingURL=index.mjs.map
|