@imgly/plugin-ai-video-generation-web 0.1.0-rc.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.
@@ -0,0 +1,106 @@
1
+ var Pn=Object.create;var mr=Object.defineProperty;var Un=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var Ln=Object.getPrototypeOf,$n=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Nn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Dn(e))!$n.call(t,n)&&n!==r&&mr(t,n,{get:()=>e[n],enumerable:!(i=Un(e,n))||i.enumerable});return t};var yr=(t,e,r)=>(r=t!=null?Pn(Ln(t)):{},Nn(e||!t||!t.__esModule?mr(r,"default",{value:t,enumerable:!0}):r,t));var mt=v(O=>{"use strict";var Rn=O&&O.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(O,"__esModule",{value:!0});O.TARGET_URL_HEADER=void 0;O.withMiddleware=Fn;O.withProxy=Bn;function Fn(...t){let e=r=>typeof r=="function";return r=>Rn(this,void 0,void 0,function*(){let i=Object.assign({},r);for(let n of t.filter(e))i=yield n(i);return i})}O.TARGET_URL_HEADER="x-fal-target-url";function Bn(t){let e=r=>Promise.resolve(r);return typeof window>"u"?e:r=>r.headers&&O.TARGET_URL_HEADER in r?e(r):Promise.resolve(Object.assign(Object.assign({},r),{url:t.targetUrl,headers:Object.assign(Object.assign({},r.headers||{}),{[O.TARGET_URL_HEADER]:r.url})}))}});var Q=v(P=>{"use strict";var vr=P&&P.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(P,"__esModule",{value:!0});P.ValidationError=P.ApiError=void 0;P.defaultResponseHandler=wr;P.resultResponseHandler=Vn;var zn="x-fal-request-id",re=class extends Error{constructor({message:e,status:r,body:i}){super(e),this.name="ApiError",this.status=r,this.body=i}};P.ApiError=re;var Fe=class extends re{constructor(e){super(e),this.name="ValidationError"}get fieldErrors(){return typeof this.body.detail=="string"?[{loc:["body"],msg:this.body.detail,type:"value_error"}]:this.body.detail||[]}getFieldErrors(e){return this.fieldErrors.filter(r=>r.loc[r.loc.length-1]===e)}};P.ValidationError=Fe;function wr(t){return vr(this,void 0,void 0,function*(){var e;let{status:r,statusText:i}=t,n=(e=t.headers.get("Content-Type"))!==null&&e!==void 0?e:"";if(!t.ok){if(n.includes("application/json")){let o=yield t.json(),s=r===422?Fe:re;throw new s({message:o.message||i,status:r,body:o})}throw new re({message:`HTTP ${r}: ${i}`,status:r})}return n.includes("application/json")?t.json():n.includes("text/html")?t.text():n.includes("application/octet-stream")?t.arrayBuffer():t.text()})}function Vn(t){return vr(this,void 0,void 0,function*(){return{data:yield wr(t),requestId:t.headers.get(zn)||""}})}});var xr=v((vf,Hn)=>{Hn.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 Ve=v(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.isBrowser=Gn;ze.getUserAgent=Kn;function Gn(){return typeof window<"u"&&typeof window.document<"u"}var Be=null;function Kn(){if(Be!==null)return Be;let t=xr();return Be=`${t.name}/${t.version}`,Be}});var He=v(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.credentialsFromEnv=void 0;F.resolveDefaultFetch=Er;F.createConfig=Jn;F.getRestApiUrl=eo;var _r=mt(),Qn=Q(),Wn=Ve();function Er(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function Zn(){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 Yn=()=>{if(Zn())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};F.credentialsFromEnv=Yn;var Xn={credentials:F.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:Qn.defaultResponseHandler};function Jn(t){var e;let r=Object.assign(Object.assign(Object.assign({},Xn),t),{fetch:(e=t.fetch)!==null&&e!==void 0?e:Er()});t.proxyUrl&&(r=Object.assign(Object.assign({},r),{requestMiddleware:(0,_r.withMiddleware)(r.requestMiddleware,(0,_r.withProxy)({targetUrl:t.proxyUrl}))}));let{credentials:i,suppressLocalCredentialsWarning:n}=r,o=typeof i=="function"?i():i;return(0,Wn.isBrowser)()&&o&&!n&&console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases."),r}function eo(){return"https://rest.alpha.fal.ai"}});var W=v(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.ensureEndpointIdFormat=Ir;B.parseEndpointId=ro;B.isValidUrl=io;B.throttle=no;B.isReact=oo;B.isPlainObject=so;function Ir(t){if(t.split("/").length>1)return t;let[,r,i]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(t)||[];if(r&&i)return`${r}/${i}`;throw new Error(`Invalid app id: ${t}. Must be in the format <appOwner>/<appId>`)}var to=["workflows","comfy"];function ro(t){let r=Ir(t).split("/");return to.includes(r[0])?{owner:r[1],alias:r[2],path:r.slice(3).join("/")||void 0,namespace:r[0]}:{owner:r[0],alias:r[1],path:r.slice(2).join("/")||void 0}}function io(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function no(t,e,r=!1){let i,n;return(...o)=>{!n&&r?(t(...o),n=Date.now()):(i&&clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=e&&(t(...o),n=Date.now())},e-(Date.now()-n)))}}var yt;function oo(){if(yt===void 0){let t=new Error().stack;yt=!!t&&(t.includes("node_modules/react-dom/")||t.includes("node_modules/next/"))}return yt}function so(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}});var ie=v(z=>{"use strict";var ao=z&&z.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})},lo=z&&z.__rest||function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r};Object.defineProperty(z,"__esModule",{value:!0});z.dispatchRequest=uo;z.buildUrl=po;var Sr=Ve(),Cr=W(),co=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function uo(t){return ao(this,void 0,void 0,function*(){var e,r,i;let{targetUrl:n,input:o,config:s,options:a={}}=t,{credentials:l,requestMiddleware:u,responseHandler:c,fetch:d}=s,g=(0,Sr.isBrowser)()?{}:{"User-Agent":(0,Sr.getUserAgent)()},p=typeof l=="function"?l():l,{method:h,url:b,headers:w}=yield u({method:((r=(e=t.method)!==null&&e!==void 0?e:a.method)!==null&&r!==void 0?r:"post").toUpperCase(),url:n,headers:t.headers}),m=p?{Authorization:`Key ${p}`}:{},x=Object.assign(Object.assign(Object.assign(Object.assign({},m),{Accept:"application/json","Content-Type":"application/json"}),g),w??{}),{responseHandler:A}=a,C=lo(a,["responseHandler"]),T=yield d(b,Object.assign(Object.assign(Object.assign(Object.assign({},C),{method:h,headers:Object.assign(Object.assign({},x),(i=C.headers)!==null&&i!==void 0?i:{})}),!co&&{mode:"cors"}),{signal:a.signal,body:h.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(A??c)(T)})}function po(t,e={}){var r,i;let n=((r=e.method)!==null&&r!==void 0?r:"post").toLowerCase(),o=((i=e.path)!==null&&i!==void 0?i:"").replace(/^\//,"").replace(/\/{2,}/,"/"),s=e.input,a=Object.assign(Object.assign({},e.query||{}),n==="get"?s:{}),l=Object.keys(a).length>0?`?${new URLSearchParams(a).toString()}`:"";if((0,Cr.isValidUrl)(t))return`${t.endsWith("/")?t:`${t}/`}${o}${l}`;let u=(0,Cr.ensureEndpointIdFormat)(t);return`${`https://${e.subdomain?`${e.subdomain}.`:""}fal.run/${u}/${o}`.replace(/\/$/,"")}${l}`}});var Tr=v(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});function fo(t){let e,r,i,n,o,s,a;return l(),{feed:u,reset:l};function l(){e=!0,r="",i=0,n=-1,o=void 0,s=void 0,a=""}function u(d){r=r?r+d:d,e&&ho(r)&&(r=r.slice(Ar.length)),e=!1;let g=r.length,p=0,h=!1;for(;p<g;){h&&(r[p]===`
2
+ `&&++p,h=!1);let b=-1,w=n,m;for(let x=i;b<0&&x<g;++x)m=r[x],m===":"&&w<0?w=x-p:m==="\r"?(h=!0,b=x-p):m===`
3
+ `&&(b=x-p);if(b<0){i=g-p,n=w;break}else i=0,n=-1;c(r,p,w,b),p+=b+1}p===g?r="":p>0&&(r=r.slice(p))}function c(d,g,p,h){if(h===0){a.length>0&&(t({type:"event",id:o,event:s||void 0,data:a.slice(0,-1)}),a="",o=void 0),s=void 0;return}let b=p<0,w=d.slice(g,g+(b?h:p)),m=0;b?m=h:d[g+p+1]===" "?m=p+2:m=p+1;let x=g+m,A=h-m,C=d.slice(x,x+A).toString();if(w==="data")a+=C?"".concat(C,`
4
+ `):`
5
+ `;else if(w==="event")s=C;else if(w==="id"&&!C.includes("\0"))o=C;else if(w==="retry"){let T=parseInt(C,10);Number.isNaN(T)||t({type:"reconnect-interval",value:T})}}}var Ar=[239,187,191];function ho(t){return Ar.every((e,r)=>t.charCodeAt(r)===e)}bt.createParser=fo});var vt=v(V=>{"use strict";var go=V&&V.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(V,"__esModule",{value:!0});V.TOKEN_EXPIRATION_SECONDS=void 0;V.getTemporaryAuthToken=vo;var mo=He(),yo=ie(),bo=W();V.TOKEN_EXPIRATION_SECONDS=120;function vo(t,e){return go(this,void 0,void 0,function*(){let r=(0,bo.parseEndpointId)(t),i=yield(0,yo.dispatchRequest)({method:"POST",targetUrl:`${(0,mo.getRestApiUrl)()}/tokens/`,config:e,input:{allowed_apps:[r.alias],token_expiration:V.TOKEN_EXPIRATION_SECONDS}});return typeof i!="string"&&i.detail?i.detail:i})}});var xt=v(j=>{"use strict";var ve=j&&j.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})},we=j&&j.__await||function(t){return this instanceof we?(this.v=t,this):new we(t)},wo=j&&j.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,o=[];return n={},a("next"),a("throw"),a("return",s),n[Symbol.asyncIterator]=function(){return this},n;function s(p){return function(h){return Promise.resolve(h).then(p,d)}}function a(p,h){i[p]&&(n[p]=function(b){return new Promise(function(w,m){o.push([p,b,w,m])>1||l(p,b)})},h&&(n[p]=h(n[p])))}function l(p,h){try{u(i[p](h))}catch(b){g(o[0][3],b)}}function u(p){p.value instanceof we?Promise.resolve(p.value.v).then(c,d):g(o[0][2],p)}function c(p){l("next",p)}function d(p){l("throw",p)}function g(p,h){p(h),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(j,"__esModule",{value:!0});j.FalStream=void 0;j.createStreamingClient=Io;var xo=Tr(),_o=vt(),Mr=ie(),ne=Q(),wt="text/event-stream",Eo=15*1e3,Ge=class{constructor(e,r,i){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this.abortController=new AbortController,this.start=()=>ve(this,void 0,void 0,function*(){var o,s;let{endpointId:a,options:l}=this,{input:u,method:c="post",connectionMode:d="server"}=l;try{if(d==="client"){let g=yield(0,_o.getTemporaryAuthToken)(a,this.config),{fetch:p}=this.config,h=new URL(this.url);h.searchParams.set("fal_jwt_token",g);let b=yield p(h.toString(),{method:c.toUpperCase(),headers:{accept:(o=l.accept)!==null&&o!==void 0?o:wt,"content-type":"application/json"},body:u&&c!=="get"?JSON.stringify(u):void 0,signal:this.abortController.signal});return yield this.handleResponse(b)}return yield(0,Mr.dispatchRequest)({method:c.toUpperCase(),targetUrl:this.url,input:u,config:this.config,options:{headers:{accept:(s=l.accept)!==null&&s!==void 0?s:wt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(g){this.handleError(g)}}),this.handleResponse=o=>ve(this,void 0,void 0,function*(){var s,a;if(!o.ok){try{yield(0,ne.defaultResponseHandler)(o)}catch(b){this.emit("error",b)}return}let l=o.body;if(!l){this.emit("error",new ne.ApiError({message:"Response body is empty.",status:400,body:void 0}));return}if(!((s=o.headers.get("content-type"))!==null&&s!==void 0?s:"").startsWith(wt)){let b=l.getReader(),w=()=>{b.read().then(({done:m,value:x})=>{if(m){this.emit("done",this.currentData);return}this.currentData=x,this.emit("data",x),w()})};w();return}let c=new TextDecoder("utf-8"),d=o.body.getReader(),g=(0,xo.createParser)(b=>{if(b.type==="event"){let w=b.data;try{let m=JSON.parse(w);this.buffer.push(m),this.currentData=m,this.emit("data",m),this.emit("message",m)}catch(m){this.emit("error",m)}}}),p=(a=this.options.timeout)!==null&&a!==void 0?a:Eo,h=()=>ve(this,void 0,void 0,function*(){let{value:b,done:w}=yield d.read();this.lastEventTimestamp=Date.now(),g.feed(c.decode(b)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new ne.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408})),w?this.emit("done",this.currentData):h().catch(this.handleError)});h().catch(this.handleError)}),this.handleError=o=>{var s;if(o.name==="AbortError"||this.signal.aborted)return;let a=o instanceof ne.ApiError?o:new ne.ApiError({message:(s=o.message)!==null&&s!==void 0?s:"An unknown error occurred",status:500});this.emit("error",a)},this.on=(o,s)=>{var a;this.listeners.has(o)||this.listeners.set(o,[]),(a=this.listeners.get(o))===null||a===void 0||a.push(s)},this.emit=(o,s)=>{let a=this.listeners.get(o)||[];for(let l of a)l(s)},this.done=()=>ve(this,void 0,void 0,function*(){return this.donePromise}),this.abort=o=>{this.streamClosed||this.abortController.abort(o)},this.endpointId=e,this.config=r,this.url=(n=i.url)!==null&&n!==void 0?n:(0,Mr.buildUrl)(e,{path:"/stream",query:i.queryParams}),this.options=i,this.donePromise=new Promise((o,s)=>{this.streamClosed&&s(new ne.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0})),this.signal.addEventListener("abort",()=>{var a;o((a=this.currentData)!==null&&a!==void 0?a:{})}),this.on("done",a=>{this.streamClosed=!0,o(a)}),this.on("error",a=>{this.streamClosed=!0,s(a)})}),i.signal&&i.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return wo(this,arguments,function*(){let r=!0,i=()=>r=!1;for(this.on("error",i),this.on("done",i);r||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield we(n)),yield we(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}};j.FalStream=Ge;function Io({config:t,storage:e}){return{stream(r,i){return ve(this,void 0,void 0,function*(){let n=i.input?yield e.transformInput(i.input):void 0;return new Ge(r,t,Object.assign(Object.assign({},i),{input:n}))})}}}});var jr=v(H=>{"use strict";var Z=H&&H.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})},So=H&&H.__rest||function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r};Object.defineProperty(H,"__esModule",{value:!0});H.createQueueClient=void 0;var D=ie(),Co=Q(),Ao=xt(),Ke=W(),kr=500,To=({config:t,storage:e})=>{let r={submit(i,n){return Z(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s}=n,a=So(n,["webhookUrl","priority"]),l=n.input?yield e.transformInput(n.input):void 0;return(0,D.dispatchRequest)({method:n.method,targetUrl:(0,D.buildUrl)(i,Object.assign(Object.assign({},a),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:{"x-fal-queue-priority":s??"normal"},input:l,config:t,options:{signal:n.abortSignal}})})},status(i,n){return Z(this,arguments,void 0,function*(o,{requestId:s,logs:a=!1,abortSignal:l}){let u=(0,Ke.parseEndpointId)(o),c=u.namespace?`${u.namespace}/`:"";return(0,D.dispatchRequest)({method:"get",targetUrl:(0,D.buildUrl)(`${c}${u.owner}/${u.alias}`,{subdomain:"queue",query:{logs:a?"1":"0"},path:`/requests/${s}/status`}),config:t,options:{signal:l}})})},streamStatus(i,n){return Z(this,arguments,void 0,function*(o,{requestId:s,logs:a=!1,connectionMode:l}){let u=(0,Ke.parseEndpointId)(o),c=u.namespace?`${u.namespace}/`:"",d={logs:a?"1":"0"},g=(0,D.buildUrl)(`${c}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:d});return new Ao.FalStream(o,t,{url:g,method:"get",connectionMode:l,queryParams:d})})},subscribeToStatus(i,n){return Z(this,void 0,void 0,function*(){let o=n.requestId,s=n.timeout,a,l=()=>{};if(n.mode==="streaming"){let u=yield r.streamStatus(i,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),c=[];s&&(a=setTimeout(()=>{throw u.abort(),r.cancel(i,{requestId:o}).catch(l),new Error(`Client timed out waiting for the request to complete after ${s}ms`)},s)),u.on("data",g=>{n.onQueueUpdate&&("logs"in g&&Array.isArray(g.logs)&&g.logs.length>0&&c.push(...g.logs),n.onQueueUpdate("logs"in g?Object.assign(Object.assign({},g),{logs:c}):g))});let d=yield u.done();return a&&clearTimeout(a),d}return new Promise((u,c)=>{var d;let g,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(d=n.pollInterval)!==null&&d!==void 0?d:kr,h=()=>{a&&clearTimeout(a),g&&clearTimeout(g)};s&&(a=setTimeout(()=>{h(),r.cancel(i,{requestId:o}).catch(l),c(new Error(`Client timed out waiting for the request to complete after ${s}ms`))},s));let b=()=>Z(this,void 0,void 0,function*(){var w;try{let m=yield r.status(i,{requestId:o,logs:(w=n.logs)!==null&&w!==void 0?w:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(m),m.status==="COMPLETED"){h(),u(m);return}g=setTimeout(b,p)}catch(m){h(),c(m)}});b().catch(c)})})},result(i,n){return Z(this,arguments,void 0,function*(o,{requestId:s,abortSignal:a}){let l=(0,Ke.parseEndpointId)(o),u=l.namespace?`${l.namespace}/`:"";return(0,D.dispatchRequest)({method:"get",targetUrl:(0,D.buildUrl)(`${u}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${s}`}),config:Object.assign(Object.assign({},t),{responseHandler:Co.resultResponseHandler}),options:{signal:a}})})},cancel(i,n){return Z(this,arguments,void 0,function*(o,{requestId:s,abortSignal:a}){let l=(0,Ke.parseEndpointId)(o),u=l.namespace?`${l.namespace}/`:"";yield(0,D.dispatchRequest)({method:"put",targetUrl:(0,D.buildUrl)(`${u}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${s}/cancel`}),config:t,options:{signal:a}})})}};return r};H.createQueueClient=To});var Qe=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.utf8Count=Mo;L.utf8EncodeJs=Or;L.utf8EncodeTE=Pr;L.utf8Encode=Oo;L.utf8DecodeJs=Ur;L.utf8DecodeTD=Dr;L.utf8Decode=Lo;function Mo(t){let e=t.length,r=0,i=0;for(;i<e;){let n=t.charCodeAt(i++);if(n&4294967168)if(!(n&4294965248))r+=2;else{if(n>=55296&&n<=56319&&i<e){let o=t.charCodeAt(i);(o&64512)===56320&&(++i,n=((n&1023)<<10)+(o&1023)+65536)}n&4294901760?r+=4:r+=3}else{r++;continue}}return r}function Or(t,e,r){let i=t.length,n=r,o=0;for(;o<i;){let s=t.charCodeAt(o++);if(s&4294967168)if(!(s&4294965248))e[n++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<i){let a=t.charCodeAt(o);(a&64512)===56320&&(++o,s=((s&1023)<<10)+(a&1023)+65536)}s&4294901760?(e[n++]=s>>18&7|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128):(e[n++]=s>>12&15|224,e[n++]=s>>6&63|128)}else{e[n++]=s;continue}e[n++]=s&63|128}}var ko=new TextEncoder,jo=50;function Pr(t,e,r){ko.encodeInto(t,e.subarray(r))}function Oo(t,e,r){t.length>jo?Pr(t,e,r):Or(t,e,r)}var Po=4096;function Ur(t,e,r){let i=e,n=i+r,o=[],s="";for(;i<n;){let a=t[i++];if(!(a&128))o.push(a);else if((a&224)===192){let l=t[i++]&63;o.push((a&31)<<6|l)}else if((a&240)===224){let l=t[i++]&63,u=t[i++]&63;o.push((a&31)<<12|l<<6|u)}else if((a&248)===240){let l=t[i++]&63,u=t[i++]&63,c=t[i++]&63,d=(a&7)<<18|l<<12|u<<6|c;d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d)}else o.push(a);o.length>=Po&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var Uo=new TextDecoder,Do=200;function Dr(t,e,r){let i=t.subarray(e,e+r);return Uo.decode(i)}function Lo(t,e,r){return r>Do?Dr(t,e,r):Ur(t,e,r)}});var Et=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.ExtData=void 0;var _t=class{constructor(e,r){this.type=e,this.data=r}};We.ExtData=_t});var Ye=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.DecodeError=void 0;var It=class t extends Error{constructor(e){super(e);let r=Object.create(t.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:t.name})}};Ze.DecodeError=It});var Xe=v(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.UINT32_MAX=void 0;G.setUint64=$o;G.setInt64=No;G.getInt64=qo;G.getUint64=Ro;G.UINT32_MAX=4294967295;function $o(t,e,r){let i=r/4294967296,n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function No(t,e,r){let i=Math.floor(r/4294967296),n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function qo(t,e){let r=t.getInt32(e),i=t.getUint32(e+4);return r*4294967296+i}function Ro(t,e){let r=t.getUint32(e),i=t.getUint32(e+4);return r*4294967296+i}});var St=v(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.timestampExtension=M.EXT_TIMESTAMP=void 0;M.encodeTimeSpecToTimestamp=$r;M.encodeDateToTimeSpec=Nr;M.encodeTimestampExtension=qr;M.decodeTimestampToTimeSpec=Rr;M.decodeTimestampExtension=Fr;var Fo=Ye(),Lr=Xe();M.EXT_TIMESTAMP=-1;var Bo=4294967296-1,zo=17179869184-1;function $r({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=zo)if(e===0&&t<=Bo){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{let r=t/4294967296,i=t&4294967295,n=new Uint8Array(8),o=new DataView(n.buffer);return o.setUint32(0,e<<2|r&3),o.setUint32(4,i),n}else{let r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,e),(0,Lr.setInt64)(i,4,t),r}}function Nr(t){let e=t.getTime(),r=Math.floor(e/1e3),i=(e-r*1e3)*1e6,n=Math.floor(i/1e9);return{sec:r+n,nsec:i-n*1e9}}function qr(t){if(t instanceof Date){let e=Nr(t);return $r(e)}else return null}function Rr(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let r=e.getUint32(0),i=e.getUint32(4),n=(r&3)*4294967296+i,o=r>>>2;return{sec:n,nsec:o}}case 12:{let r=(0,Lr.getInt64)(e,4),i=e.getUint32(0);return{sec:r,nsec:i}}default:throw new Fo.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Fr(t){let e=Rr(t);return new Date(e.sec*1e3+e.nsec/1e6)}M.timestampExtension={type:M.EXT_TIMESTAMP,encode:qr,decode:Fr}});var tt=v(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.ExtensionCodec=void 0;var Je=Et(),Vo=St(),xe=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Vo.timestampExtension)}register({type:e,encode:r,decode:i}){if(e>=0)this.encoders[e]=r,this.decoders[e]=i;else{let n=-1-e;this.builtInEncoders[n]=r,this.builtInDecoders[n]=i}}tryToEncode(e,r){for(let i=0;i<this.builtInEncoders.length;i++){let n=this.builtInEncoders[i];if(n!=null){let o=n(e,r);if(o!=null){let s=-1-i;return new Je.ExtData(s,o)}}}for(let i=0;i<this.encoders.length;i++){let n=this.encoders[i];if(n!=null){let o=n(e,r);if(o!=null){let s=i;return new Je.ExtData(s,o)}}}return e instanceof Je.ExtData?e:null}decode(e,r,i){let n=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return n?n(e,r,i):new Je.ExtData(r,e)}};et.ExtensionCodec=xe;xe.defaultCodec=new xe});var At=v(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.ensureUint8Array=Go;function Ho(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Go(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Ho(t)?new Uint8Array(t):Uint8Array.from(t)}});var Mt=v(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.Encoder=U.DEFAULT_INITIAL_BUFFER_SIZE=U.DEFAULT_MAX_DEPTH=void 0;var Br=Qe(),Ko=tt(),zr=Xe(),Qo=At();U.DEFAULT_MAX_DEPTH=100;U.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Tt=class t{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??Ko.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??U.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??U.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new t({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(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,r)}ensureBufferSizeToWrite(e){let r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){let r=new ArrayBuffer(e),i=new Uint8Array(r),n=new DataView(r);i.set(this.bytes),this.view=n,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let i=(0,Br.utf8Count)(e);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),(0,Br.utf8Encode)(e,this.bytes,this.pos),this.pos+=i}encodeObject(e,r){let i=this.extensionCodec.tryToEncode(e,this.context);if(i!=null)this.encodeExtension(i);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);let i=(0,Qo.ensureUint8Array)(e);this.writeU8a(i)}encodeArray(e,r){let i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else if(i<4294967296)this.writeU8(221),this.writeU32(i);else throw new Error(`Too large array: ${i}`);for(let n of e)this.doEncode(n,r+1)}countWithoutUndefined(e,r){let i=0;for(let n of r)e[n]!==void 0&&i++;return i}encodeMap(e,r){let i=Object.keys(e);this.sortKeys&&i.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.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 i){let s=e[o];this.ignoreUndefined&&s===void 0||(this.encodeString(o),this.doEncode(s,r+1))}}encodeExtension(e){if(typeof e.data=="function"){let i=e.data(this.pos+6),n=i.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(e.type),this.writeU8a(i);return}let r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),(0,zr.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,zr.setInt64)(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};U.Encoder=Tt});var Vr=v(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.encode=Zo;var Wo=Mt();function Zo(t,e){return new Wo.Encoder(e).encodeSharedRef(t)}});var Hr=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.prettyByte=Yo;function Yo(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var Gr=v(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.CachedKeyDecoder=void 0;var Xo=Qe(),Jo=16,es=16,Ot=class{constructor(e=Jo,r=es){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let i=0;i<this.maxKeyLength;i++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,i){let n=this.caches[i-1];e:for(let o of n){let s=o.bytes;for(let a=0;a<i;a++)if(s[a]!==e[r+a])continue e;return o.str}return null}store(e,r){let i=this.caches[e.length-1],n={bytes:e,str:r};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=n:i.push(n)}decode(e,r,i){let n=this.find(e,r,i);if(n!=null)return this.hit++,n;this.miss++;let o=(0,Xo.utf8DecodeJs)(e,r,i),s=Uint8Array.prototype.slice.call(e,r,r+i);return this.store(s,o),o}};rt.CachedKeyDecoder=Ot});var nt=v(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.Decoder=void 0;var Pt=Hr(),ts=tt(),Y=Xe(),rs=Qe(),Kr=At(),is=Gr(),$=Ye(),Ut="array",Ee="map_key",Wr="map_value",ns=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new $.DecodeError("The type of key must be string or number but "+typeof t)},Dt=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let r=this.getUninitializedStateFromPool();r.type=Ut,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){let r=this.getUninitializedStateFromPool();r.type=Ee,r.readCount=0,r.size=e,r.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Ut){let i=e;i.size=0,i.array=void 0,i.position=0,i.type=void 0}if(e.type===Ee||e.type===Wr){let i=e;i.size=0,i.map=void 0,i.readCount=0,i.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},_e=-1,$t=new DataView(new ArrayBuffer(0)),os=new Uint8Array($t.buffer);try{$t.getInt8(0)}catch(t){if(!(t 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 Qr=new RangeError("Insufficient data"),ss=new is.CachedKeyDecoder,Lt=class t{constructor(e){this.totalPos=0,this.pos=0,this.view=$t,this.bytes=os,this.headByte=_e,this.stack=new Dt,this.entered=!1,this.extensionCodec=e?.extensionCodec??ts.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Y.UINT32_MAX,this.maxBinLength=e?.maxBinLength??Y.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??Y.UINT32_MAX,this.maxMapLength=e?.maxMapLength??Y.UINT32_MAX,this.maxExtLength=e?.maxExtLength??Y.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:ss,this.mapKeyConverter=e?.mapKeyConverter??ns}clone(){return new t({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=_e,this.stack.reset()}setBuffer(e){let r=(0,Kr.ensureUint8Array)(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===_e&&!this.hasRemaining(1))this.setBuffer(e);else{let r=this.bytes.subarray(this.pos),i=(0,Kr.ensureUint8Array)(e),n=new Uint8Array(r.length+i.length);n.set(r),n.set(i,r.length),this.setBuffer(n)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:r,pos:i}=this;return new RangeError(`Extra ${r.byteLength-i} of ${r.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let r=!1,i;for await(let a of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),r=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return i}let{headByte:n,pos:o,totalPos:s}=this;throw new RangeError(`Insufficient data in parsing ${(0,Pt.prettyByte)(n)} at ${s} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let i=r,n=-1;for await(let o of e){if(r&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),i&&(n=this.readArraySize(),i=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(s){if(!(s instanceof RangeError))throw s}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){let n=e-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else r={}}else if(e<160){let n=e-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else r=[]}else{let n=e-160;r=this.decodeString(n,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){let n=this.lookU8();r=this.decodeString(n,1)}else if(e===218){let n=this.lookU16();r=this.decodeString(n,2)}else if(e===219){let n=this.lookU32();r=this.decodeString(n,4)}else if(e===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else r=[]}else if(e===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else r=[]}else if(e===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else r={}}else if(e===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else r={}}else if(e===196){let n=this.lookU8();r=this.decodeBinary(n,1)}else if(e===197){let n=this.lookU16();r=this.decodeBinary(n,2)}else if(e===198){let n=this.lookU32();r=this.decodeBinary(n,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){let n=this.lookU8();r=this.decodeExtension(n,1)}else if(e===200){let n=this.lookU16();r=this.decodeExtension(n,2)}else if(e===201){let n=this.lookU32();r=this.decodeExtension(n,4)}else throw new $.DecodeError(`Unrecognized type byte: ${(0,Pt.prettyByte)(e)}`);this.complete();let i=this.stack;for(;i.length>0;){let n=i.top();if(n.type===Ut)if(n.array[n.position]=r,n.position++,n.position===n.size)r=n.array,i.release(n);else continue e;else if(n.type===Ee){if(r==="__proto__")throw new $.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(r),n.type=Wr;continue e}else if(n.map[n.key]=r,n.readCount++,n.readCount===n.size)r=n.map,i.release(n);else{n.key=null,n.type=Ee;continue e}}return r}}readHeadByte(){return this.headByte===_e&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=_e}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new $.DecodeError(`Unrecognized array type byte: ${(0,Pt.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new $.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new $.DecodeError(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new $.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw Qr;let i=this.pos+r,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?n=this.keyDecoder.decode(this.bytes,i,e):n=(0,rs.utf8Decode)(this.bytes,i,e),this.pos+=r+e,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ee:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new $.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw Qr;let i=this.pos+r,n=this.bytes.subarray(i,i+e);return this.pos+=r+e,n}decodeExtension(e,r){if(e>this.maxExtLength)throw new $.DecodeError(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let i=this.view.getInt8(this.pos+r),n=this.decodeBinary(e,r+1);return this.extensionCodec.decode(n,i,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 e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=(0,Y.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,Y.getInt64)(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}};it.Decoder=Lt});var Yr=v(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.decode=as;ot.decodeMulti=ls;var Zr=nt();function as(t,e){return new Zr.Decoder(e).decode(t)}function ls(t,e){return new Zr.Decoder(e).decodeMulti(t)}});var ei=v(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.isAsyncIterable=Xr;Ie.asyncIterableFromStream=Jr;Ie.ensureAsyncIterable=cs;function Xr(t){return t[Symbol.asyncIterator]!=null}async function*Jr(t){let e=t.getReader();try{for(;;){let{done:r,value:i}=await e.read();if(r)return;yield i}}finally{e.releaseLock()}}function cs(t){return Xr(t)?t:Jr(t)}});var ti=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.decodeAsync=us;Se.decodeArrayStream=ds;Se.decodeMultiStream=ps;var Nt=nt(),qt=ei();async function us(t,e){let r=(0,qt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeAsync(r)}function ds(t,e){let r=(0,qt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeArrayStream(r)}function ps(t,e){let r=(0,qt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeStream(r)}});var ii=v(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.decodeTimestampExtension=y.encodeTimestampExtension=y.decodeTimestampToTimeSpec=y.encodeTimeSpecToTimestamp=y.encodeDateToTimeSpec=y.EXT_TIMESTAMP=y.ExtData=y.ExtensionCodec=y.Encoder=y.DecodeError=y.Decoder=y.decodeMultiStream=y.decodeArrayStream=y.decodeAsync=y.decodeMulti=y.decode=y.encode=void 0;var fs=Vr();Object.defineProperty(y,"encode",{enumerable:!0,get:function(){return fs.encode}});var ri=Yr();Object.defineProperty(y,"decode",{enumerable:!0,get:function(){return ri.decode}});Object.defineProperty(y,"decodeMulti",{enumerable:!0,get:function(){return ri.decodeMulti}});var Rt=ti();Object.defineProperty(y,"decodeAsync",{enumerable:!0,get:function(){return Rt.decodeAsync}});Object.defineProperty(y,"decodeArrayStream",{enumerable:!0,get:function(){return Rt.decodeArrayStream}});Object.defineProperty(y,"decodeMultiStream",{enumerable:!0,get:function(){return Rt.decodeMultiStream}});var hs=nt();Object.defineProperty(y,"Decoder",{enumerable:!0,get:function(){return hs.Decoder}});var gs=Ye();Object.defineProperty(y,"DecodeError",{enumerable:!0,get:function(){return gs.DecodeError}});var ms=Mt();Object.defineProperty(y,"Encoder",{enumerable:!0,get:function(){return ms.Encoder}});var ys=tt();Object.defineProperty(y,"ExtensionCodec",{enumerable:!0,get:function(){return ys.ExtensionCodec}});var bs=Et();Object.defineProperty(y,"ExtData",{enumerable:!0,get:function(){return bs.ExtData}});var oe=St();Object.defineProperty(y,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return oe.EXT_TIMESTAMP}});Object.defineProperty(y,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return oe.encodeDateToTimeSpec}});Object.defineProperty(y,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return oe.encodeTimeSpecToTimestamp}});Object.defineProperty(y,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return oe.decodeTimestampToTimeSpec}});Object.defineProperty(y,"encodeTimestampExtension",{enumerable:!0,get:function(){return oe.encodeTimestampExtension}});Object.defineProperty(y,"decodeTimestampExtension",{enumerable:!0,get:function(){return oe.decodeTimestampExtension}})});var bi=v(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});function S(t){return{enumerable:!0,value:t}}function ni(t){return{enumerable:!0,writable:!0,value:t}}var X={},vs=()=>!0,oi=()=>({}),ai=t=>t,ws=(t,e,r,i)=>t.apply(r,i)&&e.apply(r,i),xs=(t,e,r,[i,n])=>e.call(r,t.call(r,i,n),n),K=(t,e)=>Object.freeze(Object.create(t,e));function si(t,e,r){return t.reduce((i,n)=>function(...o){return r(i,n,this,o)},e)}function li(t){return K(this,{fn:S(t)})}var ci={},ui=li.bind(ci),_s=t=>ui((e,r)=>!!~t(e,r)&&e),di={},Es=li.bind(di);function st(t,e){return e.filter(r=>t.isPrototypeOf(r))}function pi(t,e,...r){let i=si(st(di,r).map(o=>o.fn),vs,ws),n=si(st(ci,r).map(o=>o.fn),ai,xs);return K(this,{from:S(t),to:S(e),guards:S(i),reducers:S(n)})}var fi={},hi={},Is=pi.bind(fi),Ss=pi.bind(hi,null);function Cs(t,e,r){return Bt(e,t,r,this.immediates)||t}function gi(t){let e=new Map;for(let r of t)e.has(r.from)||e.set(r.from,[]),e.get(r.from).push(r);return e}var As={enter:ai};function Ts(...t){let e=st(fi,t),r=st(hi,t),i={final:S(t.length===0),transitions:S(gi(e))};return r.length&&(i.immediates=S(r),i.enter=S(Cs)),K(As,i)}var Ms={enter(t,e,r){let i=this.fn.call(e,e.context,r);return Ft.isPrototypeOf(i)?K(mi,{machine:S(i),transitions:S(this.transitions)}).enter(t,e,r):(i.then(n=>e.send({type:"done",data:n})).catch(n=>e.send({type:"error",error:n})),t)}},mi={enter(t,e,r){if(e.child=yi(this.machine,i=>{e.onChange(i),e.child==i&&i.machine.state.value.final&&(delete e.child,e.send({type:"done",data:i.context}))},e.context,r),e.child.machine.state.value.final){let i=e.child.context;return delete e.child,Bt(e,t,{type:"done",data:i},this.transitions.get("done"))}return t}};function ks(t,...e){let r=S(gi(e));return Ft.isPrototypeOf(t)?K(mi,{machine:S(t),transitions:r}):K(Ms,{fn:S(t),transitions:r})}var Ft={get state(){return{name:this.current,value:this.states[this.current]}}};function js(t,e,r=oi){return typeof t!="string"&&(r=e||oi,e=t,t=Object.keys(e)[0]),X._create&&X._create(t,e),K(Ft,{context:S(r),current:S(t),states:S(e)})}function Bt(t,e,r,i){let{context:n}=t;for(let{to:o,guards:s,reducers:a}of i)if(s(n,r)){t.context=a.call(t,n,r);let l=e.original||e,u=K(l,{current:S(o),original:{value:l}});return X._onEnter&&X._onEnter(e,o,t.context,n,r),u.state.value.enter(u,t,r)}}function Os(t,e){let r=e.type||e,{machine:i}=t,{value:n,name:o}=i.state;return n.transitions.has(r)?Bt(t,i,e,n.transitions.get(r))||i:(X._send&&X._send(r,o),i)}var Ps={send(t){this.machine=Os(this,t),this.onChange(this)}};function yi(t,e,r,i){let n=Object.create(Ps,{machine:ni(t),context:ni(t.context(r,i)),onChange:S(e)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,i),n}k.action=_s;k.createMachine=js;k.d=X;k.guard=Es;k.immediate=Ss;k.interpret=yi;k.invoke=ks;k.reduce=ui;k.state=Ts;k.transition=Is});var Ei=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.createRealtimeClient=Qs;var lt=ii(),f=bi(),vi=vt(),zt=Q(),wi=Ve(),Gt=W(),Us=()=>({enqueuedMessage:void 0});function Ds(t){return t.token!==void 0}function Ls(t){return!Ds(t)}function at(t,e){return Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function N(t){return t.websocket&&t.websocket.readyState===WebSocket.OPEN&&t.websocket.close(),Object.assign(Object.assign({},t),{websocket:void 0})}function $s(t,e){return t.websocket&&t.websocket.readyState===WebSocket.OPEN?(e.message instanceof Uint8Array?t.websocket.send(e.message):t.websocket.send((0,lt.encode)(e.message)),Object.assign(Object.assign({},t),{enqueuedMessage:void 0})):Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function Vt(t){return Object.assign(Object.assign({},t),{token:void 0})}function Ns(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function qs(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var Rs=(0,f.createMachine)("idle",{idle:(0,f.state)((0,f.transition)("send","connecting",(0,f.reduce)(at)),(0,f.transition)("expireToken","idle",(0,f.reduce)(Vt)),(0,f.transition)("close","idle",(0,f.reduce)(N))),connecting:(0,f.state)((0,f.transition)("connecting","connecting"),(0,f.transition)("connected","active",(0,f.reduce)(qs)),(0,f.transition)("connectionClosed","idle",(0,f.reduce)(N)),(0,f.transition)("send","connecting",(0,f.reduce)(at)),(0,f.transition)("close","idle",(0,f.reduce)(N)),(0,f.immediate)("authRequired",(0,f.guard)(Ls))),authRequired:(0,f.state)((0,f.transition)("initiateAuth","authInProgress"),(0,f.transition)("send","authRequired",(0,f.reduce)(at)),(0,f.transition)("close","idle",(0,f.reduce)(N))),authInProgress:(0,f.state)((0,f.transition)("authenticated","connecting",(0,f.reduce)(Ns)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Vt),(0,f.reduce)(N)),(0,f.transition)("send","authInProgress",(0,f.reduce)(at)),(0,f.transition)("close","idle",(0,f.reduce)(N))),active:(0,f.state)((0,f.transition)("send","active",(0,f.reduce)($s)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Vt)),(0,f.transition)("connectionClosed","idle",(0,f.reduce)(N)),(0,f.transition)("close","idle",(0,f.reduce)(N))),failed:(0,f.state)((0,f.transition)("send","failed"),(0,f.transition)("close","idle",(0,f.reduce)(N)))},Us);function Fs(t,{token:e,maxBuffering:r}){if(r!==void 0&&(r<1||r>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let i=new URLSearchParams({fal_jwt_token:e});return r!==void 0&&i.set("max_buffering",r.toFixed(0)),`wss://fal.run/${(0,Gt.ensureEndpointIdFormat)(t)}/realtime?${i.toString()}`}var Bs=128;function zs(t){return t.status==="error"&&t.error==="Unauthorized"}var Vs={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Ht=new Map,xi=new Map;function Hs(t,e,r){if(!Ht.has(t)){let i=(0,f.interpret)(Rs,r);Ht.set(t,Object.assign(Object.assign({},i),{throttledSend:e>0?(0,Gt.throttle)(i.send,e,!0):i.send}))}return Ht.get(t)}var Ce=()=>{},Gs={send:Ce,close:Ce};function Ks(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!_i(t)}function _i(t){return t.type==="x-fal-error"}function Qs({config:t}){return{connect(e,r){let{clientOnly:i=(0,Gt.isReact)()&&!(0,wi.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:s=Bs}=r;if(i&&!(0,wi.isBrowser)())return Gs;let a;xi.set(n,{onError:r.onError,onResult:r.onResult});let l=()=>xi.get(n),u=Hs(n,s,({context:g,machine:p,send:h})=>{let{enqueuedMessage:b,token:w}=g;if(p.current==="active"&&b&&h({type:"send",message:b}),p.current==="authRequired"&&w===void 0&&a!==p.current&&(h({type:"initiateAuth"}),(0,vi.getTemporaryAuthToken)(e,t).then(m=>{h({type:"authenticated",token:m});let x=Math.round(vi.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{h({type:"expireToken"})},x)}).catch(m=>{h({type:"unauthorized",error:m})})),p.current==="connecting"&&a!==p.current&&w!==void 0){let m=new WebSocket(Fs(e,{token:w,maxBuffering:o}));m.onopen=()=>{h({type:"connected",websocket:m})},m.onclose=x=>{if(x.code!==Vs.NORMAL_CLOSURE){let{onError:A=Ce}=l();A(new zt.ApiError({message:`Error closing the connection: ${x.reason}`,status:x.code}))}h({type:"connectionClosed",code:x.code})},m.onerror=x=>{let{onError:A=Ce}=l();A(new zt.ApiError({message:"Unknown error",status:500}))},m.onmessage=x=>{let{onResult:A}=l();if(x.data instanceof ArrayBuffer){let T=(0,lt.decode)(new Uint8Array(x.data));A(T);return}if(x.data instanceof Uint8Array){let T=(0,lt.decode)(x.data);A(T);return}if(x.data instanceof Blob){x.data.arrayBuffer().then(T=>{let gr=(0,lt.decode)(new Uint8Array(T));A(gr)});return}let C=JSON.parse(x.data);if(zs(C)){h({type:"unauthorized",error:new Error("Unauthorized")});return}if(Ks(C)){A(C);return}if(_i(C)){if(C.error==="TIMEOUT")return;let{onError:T=Ce}=l();T(new zt.ApiError({message:`${C.error}: ${C.reason}`,status:400,body:C}));return}}}a=p.current});return{send:g=>{u.throttledSend({type:"send",message:g})},close:()=>{u.send({type:"close"})}}}}}});var Ti=v(Ae=>{"use strict";var J=Ae&&Ae.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.createStorageClient=Js;var Ii=He(),Si=ie(),Ws=W();function Ci(t){var e;let[r,i]=t.split("/");return(e=i.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}function Zs(t,e,r){return J(this,void 0,void 0,function*(){let i=t.name||`${Date.now()}.${Ci(r)}`;return yield(0,Si.dispatchRequest)({method:"POST",targetUrl:`${(0,Ii.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:r,file_name:i},config:e})})}function Ys(t,e,r){return J(this,void 0,void 0,function*(){let i=t.name||`${Date.now()}.${Ci(r)}`;return yield(0,Si.dispatchRequest)({method:"POST",targetUrl:`${(0,Ii.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:r,file_name:i},config:e})})}function Ai(t,e,r){return J(this,arguments,void 0,function*(i,n,o,s=3){if(s===0)throw new Error("Part upload failed, retries exhausted");let{fetch:a,responseHandler:l}=o;try{let u=yield a(i,{method:"PUT",body:n});return yield l(u)}catch{return yield Ai(i,n,o,s-1)}})}function Xs(t,e){return J(this,void 0,void 0,function*(){let{fetch:r,responseHandler:i}=e,n=t.type||"application/octet-stream",{upload_url:o,file_url:s}=yield Ys(t,e,n),a=10*1024*1024,l=Math.ceil(t.size/a),u=new URL(o),c=[];for(let p=0;p<l;p++){let h=p*a,b=Math.min(h+a,t.size),w=t.slice(h,b),m=p+1,x=`${u.origin}${u.pathname}/${m}${u.search}`;c.push(yield Ai(x,w,e))}let d=`${u.origin}${u.pathname}/complete${u.search}`,g=yield r(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:c.map(p=>({partNumber:p.partNumber,etag:p.etag}))})});return yield i(g),s})}function Js({config:t}){let e={upload:r=>J(this,void 0,void 0,function*(){if(r.size>94371840)return yield Xs(r,t);let i=r.type||"application/octet-stream",{fetch:n,responseHandler:o}=t,{upload_url:s,file_url:a}=yield Zs(r,t,i),l=yield n(s,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});return yield o(l),a}),transformInput:r=>J(this,void 0,void 0,function*(){if(Array.isArray(r))return Promise.all(r.map(i=>e.transformInput(i)));if(r instanceof Blob)return yield e.upload(r);if((0,Ws.isPlainObject)(r)){let n=Object.entries(r).map(s=>J(this,[s],void 0,function*([a,l]){return[a,yield e.transformInput(l)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return r})};return e}});var Qt=v(Te=>{"use strict";var Mi=Te&&Te.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(Te,"__esModule",{value:!0});Te.createFalClient=sa;var ea=He(),ta=jr(),ra=Ei(),ki=ie(),ia=Q(),na=Ti(),oa=xt();function sa(t={}){let e=(0,ea.createConfig)(t),r=(0,na.createStorageClient)({config:e}),i=(0,ta.createQueueClient)({config:e,storage:r}),n=(0,oa.createStreamingClient)({config:e,storage:r}),o=(0,ra.createRealtimeClient)({config:e});return{queue:i,realtime:o,storage:r,streaming:n,stream:n.stream,run(s){return Mi(this,arguments,void 0,function*(a,l={}){let u=l.input?yield r.transformInput(l.input):void 0;return(0,ki.dispatchRequest)({method:l.method,targetUrl:(0,ki.buildUrl)(a,l),input:u,config:Object.assign(Object.assign({},e),{responseHandler:ia.resultResponseHandler}),options:{signal:l.abortSignal}})})},subscribe:(s,a)=>Mi(this,void 0,void 0,function*(){let{request_id:l}=yield i.submit(s,a);return a.onEnqueue&&a.onEnqueue(l),yield i.subscribeToStatus(s,Object.assign({requestId:l},a)),i.result(s,{requestId:l})})}}});var Oi=v(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.isQueueStatus=ji;ct.isCompletedQueueStatus=aa;function ji(t){return t&&t.status&&t.response_url}function aa(t){return ji(t)&&t.status==="COMPLETED"}});var Wt=v(I=>{"use strict";var la=I&&I.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),ca=I&&I.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&la(e,t,r)};Object.defineProperty(I,"__esModule",{value:!0});I.fal=I.parseEndpointId=I.ValidationError=I.ApiError=I.withProxy=I.withMiddleware=I.createFalClient=void 0;var Pi=Qt(),ua=Qt();Object.defineProperty(I,"createFalClient",{enumerable:!0,get:function(){return ua.createFalClient}});var Ui=mt();Object.defineProperty(I,"withMiddleware",{enumerable:!0,get:function(){return Ui.withMiddleware}});Object.defineProperty(I,"withProxy",{enumerable:!0,get:function(){return Ui.withProxy}});var Di=Q();Object.defineProperty(I,"ApiError",{enumerable:!0,get:function(){return Di.ApiError}});Object.defineProperty(I,"ValidationError",{enumerable:!0,get:function(){return Di.ValidationError}});ca(Oi(),I);var da=W();Object.defineProperty(I,"parseEndpointId",{enumerable:!0,get:function(){return da.parseEndpointId}});I.fal=function(){let e=(0,Pi.createFalClient)();return{config(r){e=(0,Pi.createFalClient)(r)},get queue(){return e.queue},get realtime(){return e.realtime},get storage(){return e.storage},get streaming(){return e.streaming},run(r,i){return e.run(r,i)},subscribe(r,i){return e.subscribe(r,i)},stream(r,i){return e.stream(r,i)}}}()});var br={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"]},MinimaxVideo01LiveInput:{title:"TextToVideoLiveRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},prompt_optimizer:{title:"Prompt Optimizer",type:"boolean",description:"Whether to use the model's prompt optimizer",default:!0}},"x-fal-order-properties":["prompt"],required:["prompt"]},MinimaxVideo01LiveOutput:{title:"T2VLiveOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]}},"x-fal-order-properties":["video"],required:["video"]},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/minimax/video-01-live/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/minimax/video-01-live/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/minimax/video-01-live":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MinimaxVideo01LiveInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/minimax/video-01-live/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/MinimaxVideo01LiveOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};var Zt=yr(Wt());async function Li(t,e){if(t!=null){if(t.startsWith("blob:")){let i=await(await fetch(t)).blob(),n=new File([i],"image.png",{type:"image/png"});return Zt.fal.storage.upload(n)}if(e!=null&&t.startsWith("buffer:")){let r=await e.engine.editor.getMimeType(t),i=e.engine.editor.getBufferLength(t),n=e.engine.editor.getBufferData(t,0,i),o=new File([n],"image.png",{type:r});return Zt.fal.storage.upload(o)}return t}}function pa(t,e){let{cesdk:r}=e,i=e.propertyKey??"image_url";return fa(t,r),{[i]:(n,o)=>{let{builder:s,experimental:{global:a},payload:l}=n,u=l?.url??e.defaultUrl,c=a(`${t}.${o.id}`,u);return s.MediaPreview(o.id,{preview:{type:"image",uri:c.value},action:{label:"Select Image",onClick:()=>{r?.ui.openPanel(`${t}.imageSelection`,{payload:{onSelect:d=>{d.meta?.uri!=null&&c.setValue(d.meta?.uri)}}})}}}),()=>({id:o.id,type:"string",value:c.value})}}}function fa(t,e){e?.ui.registerPanel(`${t}.imageSelection`,({builder:r,payload:i})=>{r.Library(`${t}.library.image`,{entries:["ly.img.image"],onSelect:async n=>{let o=n?.meta?.uri;if(o==null)return;let s=await e.engine.editor.getMimeType(o);s==="image/svg+xml"?e.ui.showNotification({type:"warning",message:"SVG images are not supported. Please choose a different image."}):s.startsWith("image/")?(i?.onSelect(n),e?.ui.closePanel(`${t}.imageSelection`)):e.ui.showNotification({type:"warning",message:`Only images are supported. Found '${s}'. Please choose a different image.`})}})})}var ha=pa;var ga=typeof global=="object"&&global&&global.Object===Object&&global,Yi=ga,ma=typeof self=="object"&&self&&self.Object===Object&&self,ya=Yi||ma||Function("return this")(),q=ya,ba=q.Symbol,ae=ba,Xi=Object.prototype,va=Xi.hasOwnProperty,wa=Xi.toString,Me=ae?ae.toStringTag:void 0;function xa(t){var e=va.call(t,Me),r=t[Me];try{t[Me]=void 0;var i=!0}catch{}var n=wa.call(t);return i&&(e?t[Me]=r:delete t[Me]),n}var _a=xa,Ea=Object.prototype,Ia=Ea.toString;function Sa(t){return Ia.call(t)}var Ca=Sa,Aa="[object Null]",Ta="[object Undefined]",$i=ae?ae.toStringTag:void 0;function Ma(t){return t==null?t===void 0?Ta:Aa:$i&&$i in Object(t)?_a(t):Ca(t)}var Pe=Ma;function ka(t){return t!=null&&typeof t=="object"}var or=ka,Yf=Array.isArray;function ja(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ji=ja,Oa="[object AsyncFunction]",Pa="[object Function]",Ua="[object GeneratorFunction]",Da="[object Proxy]";function La(t){if(!Ji(t))return!1;var e=Pe(t);return e==Pa||e==Ua||e==Oa||e==Da}var $a=La,Na=q["__core-js_shared__"],Yt=Na,Ni=function(){var t=/[^.]+$/.exec(Yt&&Yt.keys&&Yt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function qa(t){return!!Ni&&Ni in t}var Ra=qa,Fa=Function.prototype,Ba=Fa.toString;function za(t){if(t!=null){try{return Ba.call(t)}catch{}try{return t+""}catch{}}return""}var ee=za,Va=/[\\^$.*+?()[\]{}|]/g,Ha=/^\[object .+?Constructor\]$/,Ga=Function.prototype,Ka=Object.prototype,Qa=Ga.toString,Wa=Ka.hasOwnProperty,Za=RegExp("^"+Qa.call(Wa).replace(Va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ya(t){if(!Ji(t)||Ra(t))return!1;var e=$a(t)?Za:Ha;return e.test(ee(t))}var Xa=Ya;function Ja(t,e){return t?.[e]}var el=Ja;function tl(t,e){var r=el(t,e);return Xa(r)?r:void 0}var le=tl,rl=le(q,"WeakMap"),er=rl;function il(t,e){return t===e||t!==t&&e!==e}var nl=il,ol=9007199254740991;function sl(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ol}var al=sl,Xf=Object.prototype,ll="[object Arguments]";function cl(t){return or(t)&&Pe(t)==ll}var qi=cl,en=Object.prototype,ul=en.hasOwnProperty,dl=en.propertyIsEnumerable,Jf=qi(function(){return arguments}())?qi:function(t){return or(t)&&ul.call(t,"callee")&&!dl.call(t,"callee")},tn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ri=tn&&typeof module=="object"&&module&&!module.nodeType&&module,pl=Ri&&Ri.exports===tn,Fi=pl?q.Buffer:void 0,eh=Fi?Fi.isBuffer:void 0,fl="[object Arguments]",hl="[object Array]",gl="[object Boolean]",ml="[object Date]",yl="[object Error]",bl="[object Function]",vl="[object Map]",wl="[object Number]",xl="[object Object]",_l="[object RegExp]",El="[object Set]",Il="[object String]",Sl="[object WeakMap]",Cl="[object ArrayBuffer]",Al="[object DataView]",Tl="[object Float32Array]",Ml="[object Float64Array]",kl="[object Int8Array]",jl="[object Int16Array]",Ol="[object Int32Array]",Pl="[object Uint8Array]",Ul="[object Uint8ClampedArray]",Dl="[object Uint16Array]",Ll="[object Uint32Array]",_={};_[Tl]=_[Ml]=_[kl]=_[jl]=_[Ol]=_[Pl]=_[Ul]=_[Dl]=_[Ll]=!0;_[fl]=_[hl]=_[Cl]=_[gl]=_[Al]=_[ml]=_[yl]=_[bl]=_[vl]=_[wl]=_[xl]=_[_l]=_[El]=_[Il]=_[Sl]=!1;function $l(t){return or(t)&&al(t.length)&&!!_[Pe(t)]}var Nl=$l;function ql(t){return function(e){return t(e)}}var Rl=ql,rn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ke=rn&&typeof module=="object"&&module&&!module.nodeType&&module,Fl=ke&&ke.exports===rn,Xt=Fl&&Yi.process,Bl=function(){try{var t=ke&&ke.require&&ke.require("util").types;return t||Xt&&Xt.binding&&Xt.binding("util")}catch{}}(),Bi=Bl,zi=Bi&&Bi.isTypedArray,th=zi?Rl(zi):Nl,zl=Object.prototype,rh=zl.hasOwnProperty;function Vl(t,e){return function(r){return t(e(r))}}var Hl=Vl,ih=Hl(Object.keys,Object),Gl=Object.prototype,nh=Gl.hasOwnProperty,Kl=le(Object,"create"),je=Kl;function Ql(){this.__data__=je?je(null):{},this.size=0}var Wl=Ql;function Zl(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Yl=Zl,Xl="__lodash_hash_undefined__",Jl=Object.prototype,ec=Jl.hasOwnProperty;function tc(t){var e=this.__data__;if(je){var r=e[t];return r===Xl?void 0:r}return ec.call(e,t)?e[t]:void 0}var rc=tc,ic=Object.prototype,nc=ic.hasOwnProperty;function oc(t){var e=this.__data__;return je?e[t]!==void 0:nc.call(e,t)}var sc=oc,ac="__lodash_hash_undefined__";function lc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=je&&e===void 0?ac:e,this}var cc=lc;function ce(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}ce.prototype.clear=Wl;ce.prototype.delete=Yl;ce.prototype.get=rc;ce.prototype.has=sc;ce.prototype.set=cc;var Vi=ce;function uc(){this.__data__=[],this.size=0}var dc=uc;function pc(t,e){for(var r=t.length;r--;)if(nl(t[r][0],e))return r;return-1}var ut=pc,fc=Array.prototype,hc=fc.splice;function gc(t){var e=this.__data__,r=ut(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():hc.call(e,r,1),--this.size,!0}var mc=gc;function yc(t){var e=this.__data__,r=ut(e,t);return r<0?void 0:e[r][1]}var bc=yc;function vc(t){return ut(this.__data__,t)>-1}var wc=vc;function xc(t,e){var r=this.__data__,i=ut(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}var _c=xc;function ue(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}ue.prototype.clear=dc;ue.prototype.delete=mc;ue.prototype.get=bc;ue.prototype.has=wc;ue.prototype.set=_c;var dt=ue,Ec=le(q,"Map"),Oe=Ec;function Ic(){this.size=0,this.__data__={hash:new Vi,map:new(Oe||dt),string:new Vi}}var Sc=Ic;function Cc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ac=Cc;function Tc(t,e){var r=t.__data__;return Ac(e)?r[typeof e=="string"?"string":"hash"]:r.map}var pt=Tc;function Mc(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e}var kc=Mc;function jc(t){return pt(this,t).get(t)}var Oc=jc;function Pc(t){return pt(this,t).has(t)}var Uc=Pc;function Dc(t,e){var r=pt(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Lc=Dc;function de(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}de.prototype.clear=Sc;de.prototype.delete=kc;de.prototype.get=Oc;de.prototype.has=Uc;de.prototype.set=Lc;var nn=de;function $c(){this.__data__=new dt,this.size=0}var Nc=$c;function qc(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Rc=qc;function Fc(t){return this.__data__.get(t)}var Bc=Fc;function zc(t){return this.__data__.has(t)}var Vc=zc,Hc=200;function Gc(t,e){var r=this.__data__;if(r instanceof dt){var i=r.__data__;if(!Oe||i.length<Hc-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new nn(i)}return r.set(t,e),this.size=r.size,this}var Kc=Gc;function Ue(t){var e=this.__data__=new dt(t);this.size=e.size}Ue.prototype.clear=Nc;Ue.prototype.delete=Rc;Ue.prototype.get=Bc;Ue.prototype.has=Vc;Ue.prototype.set=Kc;var Qc=Object.prototype,oh=Qc.propertyIsEnumerable,Wc=le(q,"DataView"),tr=Wc,Zc=le(q,"Promise"),rr=Zc,Yc=le(q,"Set"),ir=Yc,Hi="[object Map]",Xc="[object Object]",Gi="[object Promise]",Ki="[object Set]",Qi="[object WeakMap]",Wi="[object DataView]",Jc=ee(tr),eu=ee(Oe),tu=ee(rr),ru=ee(ir),iu=ee(er),se=Pe;(tr&&se(new tr(new ArrayBuffer(1)))!=Wi||Oe&&se(new Oe)!=Hi||rr&&se(rr.resolve())!=Gi||ir&&se(new ir)!=Ki||er&&se(new er)!=Qi)&&(se=function(t){var e=Pe(t),r=e==Xc?t.constructor:void 0,i=r?ee(r):"";if(i)switch(i){case Jc:return Wi;case eu:return Hi;case tu:return Gi;case ru:return Ki;case iu:return Qi}return e});var sh=q.Uint8Array,nu="__lodash_hash_undefined__";function ou(t){return this.__data__.set(t,nu),this}var su=ou;function au(t){return this.__data__.has(t)}var lu=au;function nr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new nn;++e<r;)this.add(t[e])}nr.prototype.add=nr.prototype.push=su;nr.prototype.has=lu;var Zi=ae?ae.prototype:void 0,ah=Zi?Zi.valueOf:void 0,cu=Object.prototype,lh=cu.hasOwnProperty,uu=Object.prototype,ch=uu.hasOwnProperty,uh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),dh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),ph=new RegExp(/[A-Fa-f0-9]{2}/,"g"),Jt="@imgly/plugin-ai-generation",fh=`
6
+ <svg>
7
+ <symbol
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ viewBox="0 0 24 24"
11
+ id="@imgly/Sparkle"
12
+ >
13
+ <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"/>
14
+ <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"/>
15
+ <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"/>
16
+
17
+ </symbol>
18
+
19
+ <symbol
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ viewBox="0 0 24 24"
23
+ id="${Jt}/image"
24
+ >
25
+ <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"/>
26
+ <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"/>
27
+ <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"/>
28
+ <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"/>
29
+
30
+ </symbol>
31
+ <symbol
32
+ fill="none"
33
+ xmlns="http://www.w3.org/2000/svg"
34
+ viewBox="0 0 24 24"
35
+ id="${Jt}/video"
36
+ >
37
+ <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"/>
38
+ <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"/>
39
+ <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"/>
40
+ <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"/>
41
+ </symbol>
42
+ <symbol
43
+ fill="none"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ viewBox="0 0 24 24"
46
+ id="${Jt}/audio"
47
+ >
48
+ <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"/>
49
+ <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"/>
50
+ <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"/>
51
+ </symbol>
52
+ <symbol
53
+ fill="none"
54
+ xmlns="http://www.w3.org/2000/svg"
55
+ viewBox="0 0 24 24"
56
+ id="@imgly/MixingPlate"
57
+ >
58
+ <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"/>
59
+ <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"/>
60
+ <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"/>
61
+ <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"/>
62
+ <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"/>
63
+
64
+ </symbol>
65
+ </svg>
66
+ `;var on={ImageUrl:ha};var sr=yr(Wt());function du(t,e){let r={id:t.modelKey,kind:"video",initialize:async i=>{sr.fal.config({proxyUrl:e.proxyUrl}),t.initialize?.(i)},input:{panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?on.ImageUrl(t.modelKey,{cesdk:t.cesdk}):{},...t.renderCustomProperty},getBlockInput:t.getBlockInput,userFlow:t.useFlow??"placeholder"}},output:{abortable:!0,history:"@imgly/indexedDB",generate:async(i,{abortSignal:n})=>{let o=await Li(i.image_url,t.cesdk),s=await sr.fal.subscribe(t.modelKey,{abortSignal:n,input:o!=null?{...i,image_url:o}:i,logs:!0}),a=s?.data?.video;if(a!=null){let l=a?.url;if(l!=null)return{kind:"video",url:l}}throw console.error("Cannot extract generated video from response:",s),new Error("Cannot find generated video")},generationHintText:"Video generation may take up to a few minutes. This panel can be closed and you'll be notified when it's ready."}};return e.debug&&console.log("Created Provider:",r),r}var pe=du;function sn(t){return async({cesdk:e})=>pu(e,t)}function pu(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live",schema:br,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var fu=typeof global=="object"&&global&&global.Object===Object&&global,xn=fu,hu=typeof self=="object"&&self&&self.Object===Object&&self,gu=xn||hu||Function("return this")(),R=gu,mu=R.Symbol,he=mu,_n=Object.prototype,yu=_n.hasOwnProperty,bu=_n.toString,De=he?he.toStringTag:void 0;function vu(t){var e=yu.call(t,De),r=t[De];try{t[De]=void 0;var i=!0}catch{}var n=bu.call(t);return i&&(e?t[De]=r:delete t[De]),n}var wu=vu,xu=Object.prototype,_u=xu.toString;function Eu(t){return _u.call(t)}var Iu=Eu,Su="[object Null]",Cu="[object Undefined]",an=he?he.toStringTag:void 0;function Au(t){return t==null?t===void 0?Cu:Su:an&&an in Object(t)?wu(t):Iu(t)}var qe=Au;function Tu(t){return t!=null&&typeof t=="object"}var hr=Tu,Sh=Array.isArray;function Mu(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var En=Mu,ku="[object AsyncFunction]",ju="[object Function]",Ou="[object GeneratorFunction]",Pu="[object Proxy]";function Uu(t){if(!En(t))return!1;var e=qe(t);return e==ju||e==Ou||e==ku||e==Pu}var Du=Uu,Lu=R["__core-js_shared__"],ar=Lu,ln=function(){var t=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $u(t){return!!ln&&ln in t}var Nu=$u,qu=Function.prototype,Ru=qu.toString;function Fu(t){if(t!=null){try{return Ru.call(t)}catch{}try{return t+""}catch{}}return""}var te=Fu,Bu=/[\\^$.*+?()[\]{}|]/g,zu=/^\[object .+?Constructor\]$/,Vu=Function.prototype,Hu=Object.prototype,Gu=Vu.toString,Ku=Hu.hasOwnProperty,Qu=RegExp("^"+Gu.call(Ku).replace(Bu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wu(t){if(!En(t)||Nu(t))return!1;var e=Du(t)?Qu:zu;return e.test(te(t))}var Zu=Wu;function Yu(t,e){return t?.[e]}var Xu=Yu;function Ju(t,e){var r=Xu(t,e);return Zu(r)?r:void 0}var ge=Ju,ed=ge(R,"WeakMap"),cr=ed;function td(t,e){return t===e||t!==t&&e!==e}var rd=td,id=9007199254740991;function nd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=id}var od=nd;var Ch=Object.prototype;var sd="[object Arguments]";function ad(t){return hr(t)&&qe(t)==sd}var cn=ad,In=Object.prototype,ld=In.hasOwnProperty,cd=In.propertyIsEnumerable,Ah=cn(function(){return arguments}())?cn:function(t){return hr(t)&&ld.call(t,"callee")&&!cd.call(t,"callee")};var Sn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,un=Sn&&typeof module=="object"&&module&&!module.nodeType&&module,ud=un&&un.exports===Sn,dn=ud?R.Buffer:void 0,Th=dn?dn.isBuffer:void 0;var dd="[object Arguments]",pd="[object Array]",fd="[object Boolean]",hd="[object Date]",gd="[object Error]",md="[object Function]",yd="[object Map]",bd="[object Number]",vd="[object Object]",wd="[object RegExp]",xd="[object Set]",_d="[object String]",Ed="[object WeakMap]",Id="[object ArrayBuffer]",Sd="[object DataView]",Cd="[object Float32Array]",Ad="[object Float64Array]",Td="[object Int8Array]",Md="[object Int16Array]",kd="[object Int32Array]",jd="[object Uint8Array]",Od="[object Uint8ClampedArray]",Pd="[object Uint16Array]",Ud="[object Uint32Array]",E={};E[Cd]=E[Ad]=E[Td]=E[Md]=E[kd]=E[jd]=E[Od]=E[Pd]=E[Ud]=!0;E[dd]=E[pd]=E[Id]=E[fd]=E[Sd]=E[hd]=E[gd]=E[md]=E[yd]=E[bd]=E[vd]=E[wd]=E[xd]=E[_d]=E[Ed]=!1;function Dd(t){return hr(t)&&od(t.length)&&!!E[qe(t)]}var Ld=Dd;function $d(t){return function(e){return t(e)}}var Nd=$d,Cn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=Cn&&typeof module=="object"&&module&&!module.nodeType&&module,qd=Le&&Le.exports===Cn,lr=qd&&xn.process,Rd=function(){try{var t=Le&&Le.require&&Le.require("util").types;return t||lr&&lr.binding&&lr.binding("util")}catch{}}(),pn=Rd,fn=pn&&pn.isTypedArray,Mh=fn?Nd(fn):Ld;var Fd=Object.prototype,kh=Fd.hasOwnProperty;function Bd(t,e){return function(r){return t(e(r))}}var zd=Bd,jh=zd(Object.keys,Object);var Vd=Object.prototype,Oh=Vd.hasOwnProperty;var Hd=ge(Object,"create"),$e=Hd;function Gd(){this.__data__=$e?$e(null):{},this.size=0}var Kd=Gd;function Qd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Wd=Qd,Zd="__lodash_hash_undefined__",Yd=Object.prototype,Xd=Yd.hasOwnProperty;function Jd(t){var e=this.__data__;if($e){var r=e[t];return r===Zd?void 0:r}return Xd.call(e,t)?e[t]:void 0}var ep=Jd,tp=Object.prototype,rp=tp.hasOwnProperty;function ip(t){var e=this.__data__;return $e?e[t]!==void 0:rp.call(e,t)}var np=ip,op="__lodash_hash_undefined__";function sp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=$e&&e===void 0?op:e,this}var ap=sp;function me(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}me.prototype.clear=Kd;me.prototype.delete=Wd;me.prototype.get=ep;me.prototype.has=np;me.prototype.set=ap;var hn=me;function lp(){this.__data__=[],this.size=0}var cp=lp;function up(t,e){for(var r=t.length;r--;)if(rd(t[r][0],e))return r;return-1}var ft=up,dp=Array.prototype,pp=dp.splice;function fp(t){var e=this.__data__,r=ft(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():pp.call(e,r,1),--this.size,!0}var hp=fp;function gp(t){var e=this.__data__,r=ft(e,t);return r<0?void 0:e[r][1]}var mp=gp;function yp(t){return ft(this.__data__,t)>-1}var bp=yp;function vp(t,e){var r=this.__data__,i=ft(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}var wp=vp;function ye(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}ye.prototype.clear=cp;ye.prototype.delete=hp;ye.prototype.get=mp;ye.prototype.has=bp;ye.prototype.set=wp;var ht=ye,xp=ge(R,"Map"),Ne=xp;function _p(){this.size=0,this.__data__={hash:new hn,map:new(Ne||ht),string:new hn}}var Ep=_p;function Ip(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Sp=Ip;function Cp(t,e){var r=t.__data__;return Sp(e)?r[typeof e=="string"?"string":"hash"]:r.map}var gt=Cp;function Ap(t){var e=gt(this,t).delete(t);return this.size-=e?1:0,e}var Tp=Ap;function Mp(t){return gt(this,t).get(t)}var kp=Mp;function jp(t){return gt(this,t).has(t)}var Op=jp;function Pp(t,e){var r=gt(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Up=Pp;function be(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}be.prototype.clear=Ep;be.prototype.delete=Tp;be.prototype.get=kp;be.prototype.has=Op;be.prototype.set=Up;var An=be;function Dp(){this.__data__=new ht,this.size=0}var Lp=Dp;function $p(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Np=$p;function qp(t){return this.__data__.get(t)}var Rp=qp;function Fp(t){return this.__data__.has(t)}var Bp=Fp,zp=200;function Vp(t,e){var r=this.__data__;if(r instanceof ht){var i=r.__data__;if(!Ne||i.length<zp-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new An(i)}return r.set(t,e),this.size=r.size,this}var Hp=Vp;function Re(t){var e=this.__data__=new ht(t);this.size=e.size}Re.prototype.clear=Lp;Re.prototype.delete=Np;Re.prototype.get=Rp;Re.prototype.has=Bp;Re.prototype.set=Hp;var Gp=Object.prototype,Ph=Gp.propertyIsEnumerable;var Kp=ge(R,"DataView"),ur=Kp,Qp=ge(R,"Promise"),dr=Qp,Wp=ge(R,"Set"),pr=Wp,gn="[object Map]",Zp="[object Object]",mn="[object Promise]",yn="[object Set]",bn="[object WeakMap]",vn="[object DataView]",Yp=te(ur),Xp=te(Ne),Jp=te(dr),ef=te(pr),tf=te(cr),fe=qe;(ur&&fe(new ur(new ArrayBuffer(1)))!=vn||Ne&&fe(new Ne)!=gn||dr&&fe(dr.resolve())!=mn||pr&&fe(new pr)!=yn||cr&&fe(new cr)!=bn)&&(fe=function(t){var e=qe(t),r=e==Zp?t.constructor:void 0,i=r?te(r):"";if(i)switch(i){case Yp:return vn;case Xp:return gn;case Jp:return mn;case ef:return yn;case tf:return bn}return e});var Uh=R.Uint8Array;var rf="__lodash_hash_undefined__";function nf(t){return this.__data__.set(t,rf),this}var of=nf;function sf(t){return this.__data__.has(t)}var af=sf;function fr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new An;++e<r;)this.add(t[e])}fr.prototype.add=fr.prototype.push=of;fr.prototype.has=af;var wn=he?he.prototype:void 0,Dh=wn?wn.valueOf:void 0;var lf=Object.prototype,Lh=lf.hasOwnProperty;var cf=Object.prototype,$h=cf.hasOwnProperty;var Nh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),qh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Rh=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function Tn(t){return new Promise((e,r)=>{let i=new Image;i.onload=()=>{e({width:i.width,height:i.height})},i.onerror=r,i.src=t})}var Mn={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"]},MinimaxVideo01LiveImageToVideoInput:{title:"ImageToVideoRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},prompt_optimizer:{title:"Prompt Optimizer",type:"boolean",description:"Whether to use the model's prompt optimizer",default:!0},image_url:{title:"Image Url",type:"string",description:"URL of the image to use as the first frame"}},"x-fal-order-properties":["image_url","prompt"],required:["prompt","image_url"]},MinimaxVideo01LiveImageToVideoOutput:{title:"I2VLiveOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]}},"x-fal-order-properties":["video"],required:["video"]},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/minimax/video-01-live/image-to-video/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/minimax/video-01-live/image-to-video/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/minimax/video-01-live/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/minimax/video-01-live/image-to-video/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/MinimaxVideo01LiveImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function kn(t){return async({cesdk:e})=>df(e,t)}function df(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live/image-to-video",schema:Mn,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,getBlockInput:async r=>{let i=await Tn(r.image_url);return Promise.resolve({video:{width:i.width??1280,height:i.height??720,duration:5}})}},e)}var jn={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"]},PixverseV35TextToVideoInput:{title:"TextToVideoRequest",type:"object",properties:{prompt:{maxLength:2048,type:"string",title:"Prompt","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{enum:["16:9","4:3","1:1","3:4","9:16"],title:"Aspect Ratio",type:"string",description:"The aspect ratio of the generated video",default:"16:9"},resolution:{enum:["360p","540p","720p","1080p"],title:"Resolution",type:"string",description:"The resolution of the generated video",default:"720p"},style:{enum:["anime","3d_animation","clay","comic","cyberpunk"],title:"Style",type:"string",description:"The style of the generated video"},duration:{enum:["5","8"],title:"Duration",type:"string",description:"The duration of the generated video in seconds. 8s videos cost double. 1080p videos are limited to 5 seconds",default:5},seed:{title:"Seed",type:"integer",description:`
67
+ The same seed and the same prompt given to the same version of the model
68
+ will output the same video every time.
69
+ `},negative_prompt:{maxLength:2048,type:"string",title:"Negative Prompt",description:"Negative prompt to be used for the generation",default:""}},"x-fal-order-properties":["prompt","aspect_ratio","resolution","style","duration"],required:["prompt"]},PixverseV35TextToVideoOutput:{title:"VideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]}},"x-fal-order-properties":["video"],required:["video"]},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/pixverse/v3.5/text-to-video/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/pixverse/v3.5/text-to-video/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/pixverse/v3.5/text-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/PixverseV35TextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/pixverse/v3.5/text-to-video/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/PixverseV35TextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function On(t){return async({cesdk:e})=>ff(e,t)}function ff(t,e){return pe({modelKey:"fal-ai/pixverse/v3.5/text-to-video",schema:jn,inputReference:"#/components/schemas/PixverseV35TextToVideoInput",cesdk:t,getBlockInput:r=>{if(r.aspect_ratio!=null&&r.resolution!=null){let[i,n]=r.aspect_ratio.split(":").map(Number),o=parseInt(r.resolution,10),s=Math.round(o*i/n);if(r.duration!=null){let a=typeof r.duration=="string"?parseInt(r.duration,10):r.duration;return Promise.resolve({video:{width:s,height:o,duration:a}})}throw new Error("Cannot determine video duration")}else throw new Error("Cannot determine video dimensions \u2013 aspect ratio and resolution must be set")}},e)}var hf={MinimaxVideo01Live:sn,MinimaxVideo01LiveImageToVideo:kn,PixverseV35TextToVideo:On},eg=hf;export{eg as default};
70
+ /*! Bundled license information:
71
+
72
+ @imgly/plugin-ai-generation-web/dist/index.mjs:
73
+ (*! Bundled license information:
74
+
75
+ @imgly/plugin-utils/dist/index.mjs:
76
+ (*! Bundled license information:
77
+
78
+ lodash-es/lodash.js:
79
+ (**
80
+ * @license
81
+ * Lodash (Custom Build) <https://lodash.com/>
82
+ * Build: `lodash modularize exports="es" -o ./`
83
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
84
+ * Released under MIT license <https://lodash.com/license>
85
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
86
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
87
+ *)
88
+ *)
89
+ *)
90
+
91
+ @imgly/plugin-utils/dist/index.mjs:
92
+ (*! Bundled license information:
93
+
94
+ lodash-es/lodash.js:
95
+ (**
96
+ * @license
97
+ * Lodash (Custom Build) <https://lodash.com/>
98
+ * Build: `lodash modularize exports="es" -o ./`
99
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
100
+ * Released under MIT license <https://lodash.com/license>
101
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
102
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
103
+ *)
104
+ *)
105
+ */
106
+ //# sourceMappingURL=index.mjs.map