@imgly/plugin-ai-video-generation-web 0.1.0-rc.0 → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -17
- package/dist/fal-ai/MinimaxVideo01Live.d.ts +2 -1
- package/dist/fal-ai/MinimaxVideo01LiveImageToVideo.d.ts +2 -1
- package/dist/fal-ai/PixverseV35TextToVideo.d.ts +2 -1
- package/dist/fal-ai/createVideoProvider.d.ts +2 -1
- package/dist/fal-ai/index.mjs +6 -6
- package/dist/fal-ai/index.mjs.map +4 -4
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +3 -3
- package/package.json +2 -2
package/LICENSE.md
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
GNU Affero General Public License
|
|
3
|
-
=================================
|
|
4
|
-
|
|
5
|
-
_Version 3, 19 November 2007_
|
|
6
|
-
_Copyright © 2007 Free Software Foundation, Inc. <<http://fsf.org/>>_
|
|
7
|
-
|
|
8
|
-
Everyone is permitted to copy and distribute verbatim copies
|
|
9
|
-
of this license document, but changing it is not allowed.
|
|
10
|
-
|
|
11
|
-
## Preamble
|
|
12
|
-
|
|
13
|
-
The GNU Affero General Public License is a free, copyleft license for
|
|
14
|
-
software and other kinds of works, specifically designed to ensure
|
|
15
|
-
cooperation with the community in the case of network server software.
|
|
16
|
-
|
|
17
|
-
[Full license text omitted for brevity]
|
|
1
|
+
The licensed code may be used by the customer solely in connection with an IMG.LY licensed product and for commercial purposes under the terms set forth in this agreement. Any other use of the licensed code is strictly prohibited unless otherwise agreed in writing by IMG.LY.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type MinimaxVideo01LiveInput } from '@fal-ai/client/endpoints';
|
|
2
|
-
import { VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
2
|
+
import { Middleware, VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
3
3
|
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
4
4
|
type ProviderConfiguration = {
|
|
5
5
|
proxyUrl: string;
|
|
6
6
|
debug?: boolean;
|
|
7
|
+
middleware?: Middleware<MinimaxVideo01LiveInput, VideoOutput>[];
|
|
7
8
|
};
|
|
8
9
|
export declare function MinimaxVideo01Live(config: ProviderConfiguration): (context: {
|
|
9
10
|
cesdk: CreativeEditorSDK;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type MinimaxVideo01LiveImageToVideoInput } from '@fal-ai/client/endpoints';
|
|
2
|
-
import { VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
2
|
+
import { Middleware, VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
3
3
|
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
4
4
|
type ProviderConfiguration = {
|
|
5
5
|
proxyUrl: string;
|
|
6
6
|
debug?: boolean;
|
|
7
|
+
middleware?: Middleware<MinimaxVideo01LiveImageToVideoInput, VideoOutput>[];
|
|
7
8
|
};
|
|
8
9
|
export declare function MinimaxVideo01LiveImageToVideo(config: ProviderConfiguration): (context: {
|
|
9
10
|
cesdk: CreativeEditorSDK;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
1
|
+
import { Middleware, VideoOutput, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
2
2
|
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
3
3
|
type ProviderConfiguration = {
|
|
4
4
|
proxyUrl: string;
|
|
5
5
|
debug?: boolean;
|
|
6
|
+
middleware?: Middleware<PixverseV35TextToVideoInput, VideoOutput>[];
|
|
6
7
|
};
|
|
7
8
|
type PixverseV35TextToVideoInput = {
|
|
8
9
|
prompt: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import CreativeEditorSDK, { CreativeEngine } from '@cesdk/cesdk-js';
|
|
3
|
-
import { Provider, RenderCustomProperty, GetBlockInput } from '@imgly/plugin-ai-generation-web';
|
|
3
|
+
import { Provider, RenderCustomProperty, VideoOutput, GetBlockInput, Middleware } from '@imgly/plugin-ai-generation-web';
|
|
4
4
|
type VideoProviderConfiguration = {
|
|
5
5
|
proxyUrl: string;
|
|
6
6
|
debug?: boolean;
|
|
@@ -20,6 +20,7 @@ declare function createVideoProvider<I extends Record<string, any>>(options: {
|
|
|
20
20
|
}) => void;
|
|
21
21
|
renderCustomProperty?: RenderCustomProperty;
|
|
22
22
|
getBlockInput: GetBlockInput<'video', I>;
|
|
23
|
+
middleware?: Middleware<I, VideoOutput>[];
|
|
23
24
|
cesdk?: CreativeEditorSDK;
|
|
24
25
|
}, config: VideoProviderConfiguration): Provider<'video', I, {
|
|
25
26
|
kind: 'video';
|
package/dist/fal-ai/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`&&++p,
|
|
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,
|
|
1
|
+
var Dn=Object.create;var mr=Object.defineProperty;var Un=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var $n=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var qn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ln(e))!Nn.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?Dn($n(t)):{},qn(e||!t||!t.__esModule?mr(r,"default",{value:t,enumerable:!0}):r,t));var mt=v(O=>{"use strict";var Bn=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=Rn;function Fn(...t){let e=r=>typeof r=="function";return r=>Bn(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 Rn(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=Hn;var Vn="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 Be=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=Be;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?Be: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 Hn(t){return vr(this,void 0,void 0,function*(){return{data:yield wr(t),requestId:t.headers.get(Vn)||""}})}});var xr=v((wh,Gn)=>{Gn.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(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.isBrowser=Kn;Re.getUserAgent=Qn;function Kn(){return typeof window<"u"&&typeof window.document<"u"}var Fe=null;function Qn(){if(Fe!==null)return Fe;let t=xr();return Fe=`${t.name}/${t.version}`,Fe}});var He=v(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.credentialsFromEnv=void 0;B.resolveDefaultFetch=Er;B.createConfig=eo;B.getRestApiUrl=to;var _r=mt(),Wn=Q(),Zn=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 Yn(){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 Xn=()=>{if(Yn())return typeof process.env.FAL_KEY<"u"?process.env.FAL_KEY:process.env.FAL_KEY_ID?`${process.env.FAL_KEY_ID}:${process.env.FAL_KEY_SECRET}`:void 0};B.credentialsFromEnv=Xn;var Jn={credentials:B.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:Wn.defaultResponseHandler};function eo(t){var e;let r=Object.assign(Object.assign(Object.assign({},Jn),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,Zn.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 to(){return"https://rest.alpha.fal.ai"}});var W=v(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ensureEndpointIdFormat=Ir;F.parseEndpointId=io;F.isValidUrl=no;F.throttle=oo;F.isReact=so;F.isPlainObject=ao;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 ro=["workflows","comfy"];function io(t){let r=Ir(t).split("/");return ro.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 no(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function oo(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 so(){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 ao(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}});var ie=v(R=>{"use strict";var lo=R&&R.__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())})},co=R&&R.__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(R,"__esModule",{value:!0});R.dispatchRequest=po;R.buildUrl=ho;var Sr=Ve(),Cr=W(),uo=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function po(t){return lo(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:f,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=co(a,["responseHandler"]),T=yield d(b,Object.assign(Object.assign(Object.assign(Object.assign({},C),{method:f,headers:Object.assign(Object.assign({},x),(i=C.headers)!==null&&i!==void 0?i:{})}),!uo&&{mode:"cors"}),{signal:a.signal,body:f.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(A??c)(T)})}function ho(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&&go(r)&&(r=r.slice(Ar.length)),e=!1;let g=r.length,p=0,f=!1;for(;p<g;){f&&(r[p]===`
|
|
2
|
+
`&&++p,f=!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"?(f=!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,f){if(f===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?f:p)),m=0;b?m=f:d[g+p+1]===" "?m=p+2:m=p+1;let x=g+m,A=f-m,C=d.slice(x,x+A).toString();if(w==="data")a+=C?"".concat(C,`
|
|
4
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=`
|
|
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 go(t){return Ar.every((e,r)=>t.charCodeAt(r)===e)}bt.createParser=fo});var vt=v(V=>{"use strict";var mo=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=wo;var yo=He(),bo=ie(),vo=W();V.TOKEN_EXPIRATION_SECONDS=120;function wo(t,e){return mo(this,void 0,void 0,function*(){let r=(0,vo.parseEndpointId)(t),i=yield(0,bo.dispatchRequest)({method:"POST",targetUrl:`${(0,yo.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)},xo=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(f){return Promise.resolve(f).then(p,d)}}function a(p,f){i[p]&&(n[p]=function(b){return new Promise(function(w,m){o.push([p,b,w,m])>1||l(p,b)})},f&&(n[p]=f(n[p])))}function l(p,f){try{u(i[p](f))}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,f){p(f),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(j,"__esModule",{value:!0});j.FalStream=void 0;j.createStreamingClient=So;var _o=Tr(),Eo=vt(),Mr=ie(),ne=Q(),wt="text/event-stream",Io=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,Eo.getTemporaryAuthToken)(a,this.config),{fetch:p}=this.config,f=new URL(this.url);f.searchParams.set("fal_jwt_token",g);let b=yield p(f.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,_o.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:Io,f=()=>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):f().catch(this.handleError)});f().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 xo(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 So({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())})},Co=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 U=ie(),Ao=Q(),To=xt(),Ke=W(),kr=500,Mo=({config:t,storage:e})=>{let r={submit(i,n){return Z(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s}=n,a=Co(n,["webhookUrl","priority"]),l=n.input?yield e.transformInput(n.input):void 0;return(0,U.dispatchRequest)({method:n.method,targetUrl:(0,U.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,U.dispatchRequest)({method:"get",targetUrl:(0,U.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,U.buildUrl)(`${c}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:d});return new To.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,f=()=>{a&&clearTimeout(a),g&&clearTimeout(g)};s&&(a=setTimeout(()=>{f(),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"){f(),u(m);return}g=setTimeout(b,p)}catch(m){f(),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,U.dispatchRequest)({method:"get",targetUrl:(0,U.buildUrl)(`${u}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${s}`}),config:Object.assign(Object.assign({},t),{responseHandler:Ao.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,U.dispatchRequest)({method:"put",targetUrl:(0,U.buildUrl)(`${u}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${s}/cancel`}),config:t,options:{signal:a}})})}};return r};H.createQueueClient=Mo});var Qe=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.utf8Count=ko;L.utf8EncodeJs=Or;L.utf8EncodeTE=Pr;L.utf8Encode=Po;L.utf8DecodeJs=Dr;L.utf8DecodeTD=Ur;L.utf8Decode=$o;function ko(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 jo=new TextEncoder,Oo=50;function Pr(t,e,r){jo.encodeInto(t,e.subarray(r))}function Po(t,e,r){t.length>Oo?Pr(t,e,r):Or(t,e,r)}var Do=4096;function Dr(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>=Do&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var Uo=new TextDecoder,Lo=200;function Ur(t,e,r){let i=t.subarray(e,e+r);return Uo.decode(i)}function $o(t,e,r){return r>Lo?Ur(t,e,r):Dr(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=No;G.setInt64=qo;G.getInt64=zo;G.getUint64=Bo;G.UINT32_MAX=4294967295;function No(t,e,r){let i=r/4294967296,n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function qo(t,e,r){let i=Math.floor(r/4294967296),n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function zo(t,e){let r=t.getInt32(e),i=t.getUint32(e+4);return r*4294967296+i}function Bo(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=zr;M.decodeTimestampExtension=Br;var Fo=Ye(),Lr=Xe();M.EXT_TIMESTAMP=-1;var Ro=4294967296-1,Vo=17179869184-1;function $r({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Vo)if(e===0&&t<=Ro){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 zr(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 Br(t){let e=zr(t);return new Date(e.sec*1e3+e.nsec/1e6)}M.timestampExtension={type:M.EXT_TIMESTAMP,encode:qr,decode:Br}});var tt=v(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.ExtensionCodec=void 0;var Je=Et(),Ho=St(),xe=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Ho.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=Ko;function Go(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Ko(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Go(t)?new Uint8Array(t):Uint8Array.from(t)}});var Mt=v(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.Encoder=D.DEFAULT_INITIAL_BUFFER_SIZE=D.DEFAULT_MAX_DEPTH=void 0;var Fr=Qe(),Qo=tt(),Rr=Xe(),Wo=At();D.DEFAULT_MAX_DEPTH=100;D.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Tt=class t{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??Qo.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??D.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??D.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,Fr.utf8Count)(e);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),(0,Fr.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,Wo.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,Rr.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,Rr.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}};D.Encoder=Tt});var Vr=v(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.encode=Yo;var Zo=Mt();function Yo(t,e){return new Zo.Encoder(e).encodeSharedRef(t)}});var Hr=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.prettyByte=Xo;function Xo(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 Jo=Qe(),es=16,ts=16,Ot=class{constructor(e=es,r=ts){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,Jo.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(),rs=tt(),Y=Xe(),is=Qe(),Kr=At(),ns=Gr(),$=Ye(),Dt="array",Ee="map_key",Wr="map_value",os=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)},Ut=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=Dt,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===Dt){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)),ss=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"),as=new ns.CachedKeyDecoder,Lt=class t{constructor(e){this.totalPos=0,this.pos=0,this.view=$t,this.bytes=ss,this.headByte=_e,this.stack=new Ut,this.entered=!1,this.extensionCodec=e?.extensionCodec??rs.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:as,this.mapKeyConverter=e?.mapKeyConverter??os}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===Dt)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,is.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=ls;ot.decodeMulti=cs;var Zr=nt();function ls(t,e){return new Zr.Decoder(e).decode(t)}function cs(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=us;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 us(t){return Xr(t)?t:Jr(t)}});var ti=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.decodeAsync=ds;Se.decodeArrayStream=ps;Se.decodeMultiStream=hs;var Nt=nt(),qt=ei();async function ds(t,e){let r=(0,qt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeAsync(r)}function ps(t,e){let r=(0,qt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeArrayStream(r)}function hs(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 zt=ti();Object.defineProperty(y,"decodeAsync",{enumerable:!0,get:function(){return zt.decodeAsync}});Object.defineProperty(y,"decodeArrayStream",{enumerable:!0,get:function(){return zt.decodeArrayStream}});Object.defineProperty(y,"decodeMultiStream",{enumerable:!0,get:function(){return zt.decodeMultiStream}});var gs=nt();Object.defineProperty(y,"Decoder",{enumerable:!0,get:function(){return gs.Decoder}});var ms=Ye();Object.defineProperty(y,"DecodeError",{enumerable:!0,get:function(){return ms.DecodeError}});var ys=Mt();Object.defineProperty(y,"Encoder",{enumerable:!0,get:function(){return ys.Encoder}});var bs=tt();Object.defineProperty(y,"ExtensionCodec",{enumerable:!0,get:function(){return bs.ExtensionCodec}});var vs=Et();Object.defineProperty(y,"ExtData",{enumerable:!0,get:function(){return vs.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={},ws=()=>!0,oi=()=>({}),ai=t=>t,xs=(t,e,r,i)=>t.apply(r,i)&&e.apply(r,i),_s=(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),Es=t=>ui((e,r)=>!!~t(e,r)&&e),di={},Is=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),ws,xs),n=si(st(ci,r).map(o=>o.fn),ai,_s);return K(this,{from:S(t),to:S(e),guards:S(i),reducers:S(n)})}var hi={},fi={},Ss=pi.bind(hi),Cs=pi.bind(fi,null);function As(t,e,r){return Ft(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 Ts={enter:ai};function Ms(...t){let e=st(hi,t),r=st(fi,t),i={final:S(t.length===0),transitions:S(gi(e))};return r.length&&(i.immediates=S(r),i.enter=S(As)),K(Ts,i)}var ks={enter(t,e,r){let i=this.fn.call(e,e.context,r);return Bt.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,Ft(e,t,{type:"done",data:i},this.transitions.get("done"))}return t}};function js(t,...e){let r=S(gi(e));return Bt.isPrototypeOf(t)?K(mi,{machine:S(t),transitions:r}):K(ks,{fn:S(t),transitions:r})}var Bt={get state(){return{name:this.current,value:this.states[this.current]}}};function Os(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(Bt,{context:S(r),current:S(t),states:S(e)})}function Ft(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 Ps(t,e){let r=e.type||e,{machine:i}=t,{value:n,name:o}=i.state;return n.transitions.has(r)?Ft(t,i,e,n.transitions.get(r))||i:(X._send&&X._send(r,o),i)}var Ds={send(t){this.machine=Ps(this,t),this.onChange(this)}};function yi(t,e,r,i){let n=Object.create(Ds,{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=Es;k.createMachine=Os;k.d=X;k.guard=Is;k.immediate=Cs;k.interpret=yi;k.invoke=js;k.reduce=ui;k.state=Ms;k.transition=Ss});var Ei=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.createRealtimeClient=Ws;var lt=ii(),h=bi(),vi=vt(),Rt=Q(),wi=Ve(),Gt=W(),Us=()=>({enqueuedMessage:void 0});function Ls(t){return t.token!==void 0}function $s(t){return!Ls(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 Ns(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 qs(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function zs(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var Bs=(0,h.createMachine)("idle",{idle:(0,h.state)((0,h.transition)("send","connecting",(0,h.reduce)(at)),(0,h.transition)("expireToken","idle",(0,h.reduce)(Vt)),(0,h.transition)("close","idle",(0,h.reduce)(N))),connecting:(0,h.state)((0,h.transition)("connecting","connecting"),(0,h.transition)("connected","active",(0,h.reduce)(zs)),(0,h.transition)("connectionClosed","idle",(0,h.reduce)(N)),(0,h.transition)("send","connecting",(0,h.reduce)(at)),(0,h.transition)("close","idle",(0,h.reduce)(N)),(0,h.immediate)("authRequired",(0,h.guard)($s))),authRequired:(0,h.state)((0,h.transition)("initiateAuth","authInProgress"),(0,h.transition)("send","authRequired",(0,h.reduce)(at)),(0,h.transition)("close","idle",(0,h.reduce)(N))),authInProgress:(0,h.state)((0,h.transition)("authenticated","connecting",(0,h.reduce)(qs)),(0,h.transition)("unauthorized","idle",(0,h.reduce)(Vt),(0,h.reduce)(N)),(0,h.transition)("send","authInProgress",(0,h.reduce)(at)),(0,h.transition)("close","idle",(0,h.reduce)(N))),active:(0,h.state)((0,h.transition)("send","active",(0,h.reduce)(Ns)),(0,h.transition)("unauthorized","idle",(0,h.reduce)(Vt)),(0,h.transition)("connectionClosed","idle",(0,h.reduce)(N)),(0,h.transition)("close","idle",(0,h.reduce)(N))),failed:(0,h.state)((0,h.transition)("send","failed"),(0,h.transition)("close","idle",(0,h.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 Rs=128;function Vs(t){return t.status==="error"&&t.error==="Unauthorized"}var Hs={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Ht=new Map,xi=new Map;function Gs(t,e,r){if(!Ht.has(t)){let i=(0,h.interpret)(Bs,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=()=>{},Ks={send:Ce,close:Ce};function Qs(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!_i(t)}function _i(t){return t.type==="x-fal-error"}function Ws({config:t}){return{connect(e,r){let{clientOnly:i=(0,Gt.isReact)()&&!(0,wi.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:s=Rs}=r;if(i&&!(0,wi.isBrowser)())return Ks;let a;xi.set(n,{onError:r.onError,onResult:r.onResult});let l=()=>xi.get(n),u=Gs(n,s,({context:g,machine:p,send:f})=>{let{enqueuedMessage:b,token:w}=g;if(p.current==="active"&&b&&f({type:"send",message:b}),p.current==="authRequired"&&w===void 0&&a!==p.current&&(f({type:"initiateAuth"}),(0,vi.getTemporaryAuthToken)(e,t).then(m=>{f({type:"authenticated",token:m});let x=Math.round(vi.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{f({type:"expireToken"})},x)}).catch(m=>{f({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=()=>{f({type:"connected",websocket:m})},m.onclose=x=>{if(x.code!==Hs.NORMAL_CLOSURE){let{onError:A=Ce}=l();A(new Rt.ApiError({message:`Error closing the connection: ${x.reason}`,status:x.code}))}f({type:"connectionClosed",code:x.code})},m.onerror=x=>{let{onError:A=Ce}=l();A(new Rt.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(Vs(C)){f({type:"unauthorized",error:new Error("Unauthorized")});return}if(Qs(C)){A(C);return}if(_i(C)){if(C.error==="TIMEOUT")return;let{onError:T=Ce}=l();T(new Rt.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=ea;var Ii=He(),Si=ie(),Zs=W();function Ci(t){var e;let[r,i]=t.split("/");return(e=i.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}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?storage_type=fal-cdn-v3`,input:{content_type:r,file_name:i},config:e})})}function Xs(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 Js(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 Xs(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 f=p*a,b=Math.min(f+a,t.size),w=t.slice(f,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 ea({config:t}){let e={upload:r=>J(this,void 0,void 0,function*(){if(r.size>94371840)return yield Js(r,t);let i=r.type||"application/octet-stream",{fetch:n,responseHandler:o}=t,{upload_url:s,file_url:a}=yield Ys(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,Zs.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=aa;var ta=He(),ra=jr(),ia=Ei(),ki=ie(),na=Q(),oa=Ti(),sa=xt();function aa(t={}){let e=(0,ta.createConfig)(t),r=(0,oa.createStorageClient)({config:e}),i=(0,ra.createQueueClient)({config:e,storage:r}),n=(0,sa.createStreamingClient)({config:e,storage:r}),o=(0,ia.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:na.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=la;function ji(t){return t&&t.status&&t.response_url}function la(t){return ji(t)&&t.status==="COMPLETED"}});var Wt=v(I=>{"use strict";var ca=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]}),ua=I&&I.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ca(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(),da=Qt();Object.defineProperty(I,"createFalClient",{enumerable:!0,get:function(){return da.createFalClient}});var Di=mt();Object.defineProperty(I,"withMiddleware",{enumerable:!0,get:function(){return Di.withMiddleware}});Object.defineProperty(I,"withProxy",{enumerable:!0,get:function(){return Di.withProxy}});var Ui=Q();Object.defineProperty(I,"ApiError",{enumerable:!0,get:function(){return Ui.ApiError}});Object.defineProperty(I,"ValidationError",{enumerable:!0,get:function(){return Ui.ValidationError}});ua(Oi(),I);var pa=W();Object.defineProperty(I,"parseEndpointId",{enumerable:!0,get:function(){return pa.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 ha(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 ga=ha;function ma(){return async(t,e,r)=>{console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(t,null,2));let i,n=Date.now();try{return i=await r(t,e),i}finally{i!=null&&(console.log(`Generation took ${Date.now()-n}ms`),console.log("Generation result:",JSON.stringify(i,null,2))),console.groupEnd()}}}var Yi=ma;var ya=typeof global=="object"&&global&&global.Object===Object&&global,Xi=ya,ba=typeof self=="object"&&self&&self.Object===Object&&self,va=Xi||ba||Function("return this")(),q=va,wa=q.Symbol,ae=wa,Ji=Object.prototype,xa=Ji.hasOwnProperty,_a=Ji.toString,Me=ae?ae.toStringTag:void 0;function Ea(t){var e=xa.call(t,Me),r=t[Me];try{t[Me]=void 0;var i=!0}catch{}var n=_a.call(t);return i&&(e?t[Me]=r:delete t[Me]),n}var Ia=Ea,Sa=Object.prototype,Ca=Sa.toString;function Aa(t){return Ca.call(t)}var Ta=Aa,Ma="[object Null]",ka="[object Undefined]",$i=ae?ae.toStringTag:void 0;function ja(t){return t==null?t===void 0?ka:Ma:$i&&$i in Object(t)?Ia(t):Ta(t)}var Pe=ja;function Oa(t){return t!=null&&typeof t=="object"}var or=Oa,Xh=Array.isArray;function Pa(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var en=Pa,Da="[object AsyncFunction]",Ua="[object Function]",La="[object GeneratorFunction]",$a="[object Proxy]";function Na(t){if(!en(t))return!1;var e=Pe(t);return e==Ua||e==La||e==Da||e==$a}var qa=Na,za=q["__core-js_shared__"],Yt=za,Ni=function(){var t=/[^.]+$/.exec(Yt&&Yt.keys&&Yt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ba(t){return!!Ni&&Ni in t}var Fa=Ba,Ra=Function.prototype,Va=Ra.toString;function Ha(t){if(t!=null){try{return Va.call(t)}catch{}try{return t+""}catch{}}return""}var ee=Ha,Ga=/[\\^$.*+?()[\]{}|]/g,Ka=/^\[object .+?Constructor\]$/,Qa=Function.prototype,Wa=Object.prototype,Za=Qa.toString,Ya=Wa.hasOwnProperty,Xa=RegExp("^"+Za.call(Ya).replace(Ga,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ja(t){if(!en(t)||Fa(t))return!1;var e=qa(t)?Xa:Ka;return e.test(ee(t))}var el=Ja;function tl(t,e){return t?.[e]}var rl=tl;function il(t,e){var r=rl(t,e);return el(r)?r:void 0}var le=il,nl=le(q,"WeakMap"),er=nl;function ol(t,e){return t===e||t!==t&&e!==e}var sl=ol,al=9007199254740991;function ll(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=al}var cl=ll,Jh=Object.prototype,ul="[object Arguments]";function dl(t){return or(t)&&Pe(t)==ul}var qi=dl,tn=Object.prototype,pl=tn.hasOwnProperty,hl=tn.propertyIsEnumerable,ef=qi(function(){return arguments}())?qi:function(t){return or(t)&&pl.call(t,"callee")&&!hl.call(t,"callee")},rn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zi=rn&&typeof module=="object"&&module&&!module.nodeType&&module,fl=zi&&zi.exports===rn,Bi=fl?q.Buffer:void 0,tf=Bi?Bi.isBuffer:void 0,gl="[object Arguments]",ml="[object Array]",yl="[object Boolean]",bl="[object Date]",vl="[object Error]",wl="[object Function]",xl="[object Map]",_l="[object Number]",El="[object Object]",Il="[object RegExp]",Sl="[object Set]",Cl="[object String]",Al="[object WeakMap]",Tl="[object ArrayBuffer]",Ml="[object DataView]",kl="[object Float32Array]",jl="[object Float64Array]",Ol="[object Int8Array]",Pl="[object Int16Array]",Dl="[object Int32Array]",Ul="[object Uint8Array]",Ll="[object Uint8ClampedArray]",$l="[object Uint16Array]",Nl="[object Uint32Array]",_={};_[kl]=_[jl]=_[Ol]=_[Pl]=_[Dl]=_[Ul]=_[Ll]=_[$l]=_[Nl]=!0;_[gl]=_[ml]=_[Tl]=_[yl]=_[Ml]=_[bl]=_[vl]=_[wl]=_[xl]=_[_l]=_[El]=_[Il]=_[Sl]=_[Cl]=_[Al]=!1;function ql(t){return or(t)&&cl(t.length)&&!!_[Pe(t)]}var zl=ql;function Bl(t){return function(e){return t(e)}}var Fl=Bl,nn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ke=nn&&typeof module=="object"&&module&&!module.nodeType&&module,Rl=ke&&ke.exports===nn,Xt=Rl&&Xi.process,Vl=function(){try{var t=ke&&ke.require&&ke.require("util").types;return t||Xt&&Xt.binding&&Xt.binding("util")}catch{}}(),Fi=Vl,Ri=Fi&&Fi.isTypedArray,rf=Ri?Fl(Ri):zl,Hl=Object.prototype,nf=Hl.hasOwnProperty;function Gl(t,e){return function(r){return t(e(r))}}var Kl=Gl,of=Kl(Object.keys,Object),Ql=Object.prototype,sf=Ql.hasOwnProperty,Wl=le(Object,"create"),je=Wl;function Zl(){this.__data__=je?je(null):{},this.size=0}var Yl=Zl;function Xl(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Jl=Xl,ec="__lodash_hash_undefined__",tc=Object.prototype,rc=tc.hasOwnProperty;function ic(t){var e=this.__data__;if(je){var r=e[t];return r===ec?void 0:r}return rc.call(e,t)?e[t]:void 0}var nc=ic,oc=Object.prototype,sc=oc.hasOwnProperty;function ac(t){var e=this.__data__;return je?e[t]!==void 0:sc.call(e,t)}var lc=ac,cc="__lodash_hash_undefined__";function uc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=je&&e===void 0?cc:e,this}var dc=uc;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=Yl;ce.prototype.delete=Jl;ce.prototype.get=nc;ce.prototype.has=lc;ce.prototype.set=dc;var Vi=ce;function pc(){this.__data__=[],this.size=0}var hc=pc;function fc(t,e){for(var r=t.length;r--;)if(sl(t[r][0],e))return r;return-1}var ut=fc,gc=Array.prototype,mc=gc.splice;function yc(t){var e=this.__data__,r=ut(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():mc.call(e,r,1),--this.size,!0}var bc=yc;function vc(t){var e=this.__data__,r=ut(e,t);return r<0?void 0:e[r][1]}var wc=vc;function xc(t){return ut(this.__data__,t)>-1}var _c=xc;function Ec(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 Ic=Ec;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=hc;ue.prototype.delete=bc;ue.prototype.get=wc;ue.prototype.has=_c;ue.prototype.set=Ic;var dt=ue,Sc=le(q,"Map"),Oe=Sc;function Cc(){this.size=0,this.__data__={hash:new Vi,map:new(Oe||dt),string:new Vi}}var Ac=Cc;function Tc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Mc=Tc;function kc(t,e){var r=t.__data__;return Mc(e)?r[typeof e=="string"?"string":"hash"]:r.map}var pt=kc;function jc(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e}var Oc=jc;function Pc(t){return pt(this,t).get(t)}var Dc=Pc;function Uc(t){return pt(this,t).has(t)}var Lc=Uc;function $c(t,e){var r=pt(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Nc=$c;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=Ac;de.prototype.delete=Oc;de.prototype.get=Dc;de.prototype.has=Lc;de.prototype.set=Nc;var on=de;function qc(){this.__data__=new dt,this.size=0}var zc=qc;function Bc(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Fc=Bc;function Rc(t){return this.__data__.get(t)}var Vc=Rc;function Hc(t){return this.__data__.has(t)}var Gc=Hc,Kc=200;function Qc(t,e){var r=this.__data__;if(r instanceof dt){var i=r.__data__;if(!Oe||i.length<Kc-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new on(i)}return r.set(t,e),this.size=r.size,this}var Wc=Qc;function De(t){var e=this.__data__=new dt(t);this.size=e.size}De.prototype.clear=zc;De.prototype.delete=Fc;De.prototype.get=Vc;De.prototype.has=Gc;De.prototype.set=Wc;var Zc=Object.prototype,af=Zc.propertyIsEnumerable,Yc=le(q,"DataView"),tr=Yc,Xc=le(q,"Promise"),rr=Xc,Jc=le(q,"Set"),ir=Jc,Hi="[object Map]",eu="[object Object]",Gi="[object Promise]",Ki="[object Set]",Qi="[object WeakMap]",Wi="[object DataView]",tu=ee(tr),ru=ee(Oe),iu=ee(rr),nu=ee(ir),ou=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==eu?t.constructor:void 0,i=r?ee(r):"";if(i)switch(i){case tu:return Wi;case ru:return Hi;case iu:return Gi;case nu:return Ki;case ou:return Qi}return e});var lf=q.Uint8Array,su="__lodash_hash_undefined__";function au(t){return this.__data__.set(t,su),this}var lu=au;function cu(t){return this.__data__.has(t)}var uu=cu;function nr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new on;++e<r;)this.add(t[e])}nr.prototype.add=nr.prototype.push=lu;nr.prototype.has=uu;var Zi=ae?ae.prototype:void 0,cf=Zi?Zi.valueOf:void 0,du=Object.prototype,uf=du.hasOwnProperty,pu=Object.prototype,df=pu.hasOwnProperty,pf=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),hf=new RegExp(/[A-Fa-f0-9]{1}/,"g"),ff=new RegExp(/[A-Fa-f0-9]{2}/,"g"),Jt="@imgly/plugin-ai-generation",gf=`
|
|
6
6
|
<svg>
|
|
7
7
|
<symbol
|
|
8
8
|
fill="none"
|
|
@@ -63,10 +63,10 @@ var Pn=Object.create;var mr=Object.defineProperty;var Un=Object.getOwnPropertyDe
|
|
|
63
63
|
|
|
64
64
|
</symbol>
|
|
65
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:`
|
|
66
|
+
`;var sn={ImageUrl:ga};var sr=yr(Wt());function hu(t,e){let r=t.middleware??[];e.debug&&r.unshift(Yi());let i={id:t.modelKey,kind:"video",initialize:async n=>{sr.fal.config({proxyUrl:e.proxyUrl}),t.initialize?.(n)},input:{panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?sn.ImageUrl(t.modelKey,{cesdk:t.cesdk}):{},...t.renderCustomProperty},getBlockInput:t.getBlockInput,userFlow:t.useFlow??"placeholder"}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:r,generate:async(n,{abortSignal:o})=>{let s=await Li(n.image_url,t.cesdk),a=await sr.fal.subscribe(t.modelKey,{abortSignal:o,input:s!=null?{...n,image_url:s}:n,logs:!0}),l=a?.data?.video;if(l!=null){let u=l?.url;if(u!=null)return{kind:"video",url:u}}throw console.error("Cannot extract generated video from response:",a),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:",i),i}var pe=hu;function an(t){return async({cesdk:e})=>fu(e,t)}function fu(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live",schema:br,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",middleware:e.middleware,cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var gu=typeof global=="object"&&global&&global.Object===Object&&global,_n=gu,mu=typeof self=="object"&&self&&self.Object===Object&&self,yu=_n||mu||Function("return this")(),z=yu,bu=z.Symbol,fe=bu,En=Object.prototype,vu=En.hasOwnProperty,wu=En.toString,Ue=fe?fe.toStringTag:void 0;function xu(t){var e=vu.call(t,Ue),r=t[Ue];try{t[Ue]=void 0;var i=!0}catch{}var n=wu.call(t);return i&&(e?t[Ue]=r:delete t[Ue]),n}var _u=xu,Eu=Object.prototype,Iu=Eu.toString;function Su(t){return Iu.call(t)}var Cu=Su,Au="[object Null]",Tu="[object Undefined]",ln=fe?fe.toStringTag:void 0;function Mu(t){return t==null?t===void 0?Tu:Au:ln&&ln in Object(t)?_u(t):Cu(t)}var qe=Mu;function ku(t){return t!=null&&typeof t=="object"}var fr=ku,Tf=Array.isArray;function ju(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var In=ju,Ou="[object AsyncFunction]",Pu="[object Function]",Du="[object GeneratorFunction]",Uu="[object Proxy]";function Lu(t){if(!In(t))return!1;var e=qe(t);return e==Pu||e==Du||e==Ou||e==Uu}var $u=Lu,Nu=z["__core-js_shared__"],ar=Nu,cn=function(){var t=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function qu(t){return!!cn&&cn in t}var zu=qu,Bu=Function.prototype,Fu=Bu.toString;function Ru(t){if(t!=null){try{return Fu.call(t)}catch{}try{return t+""}catch{}}return""}var te=Ru,Vu=/[\\^$.*+?()[\]{}|]/g,Hu=/^\[object .+?Constructor\]$/,Gu=Function.prototype,Ku=Object.prototype,Qu=Gu.toString,Wu=Ku.hasOwnProperty,Zu=RegExp("^"+Qu.call(Wu).replace(Vu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Yu(t){if(!In(t)||zu(t))return!1;var e=$u(t)?Zu:Hu;return e.test(te(t))}var Xu=Yu;function Ju(t,e){return t?.[e]}var ed=Ju;function td(t,e){var r=ed(t,e);return Xu(r)?r:void 0}var ge=td,rd=ge(z,"WeakMap"),cr=rd;function id(t,e){return t===e||t!==t&&e!==e}var nd=id,od=9007199254740991;function sd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=od}var ad=sd;var Mf=Object.prototype;var ld="[object Arguments]";function cd(t){return fr(t)&&qe(t)==ld}var un=cd,Sn=Object.prototype,ud=Sn.hasOwnProperty,dd=Sn.propertyIsEnumerable,kf=un(function(){return arguments}())?un:function(t){return fr(t)&&ud.call(t,"callee")&&!dd.call(t,"callee")};var Cn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dn=Cn&&typeof module=="object"&&module&&!module.nodeType&&module,pd=dn&&dn.exports===Cn,pn=pd?z.Buffer:void 0,jf=pn?pn.isBuffer:void 0;var hd="[object Arguments]",fd="[object Array]",gd="[object Boolean]",md="[object Date]",yd="[object Error]",bd="[object Function]",vd="[object Map]",wd="[object Number]",xd="[object Object]",_d="[object RegExp]",Ed="[object Set]",Id="[object String]",Sd="[object WeakMap]",Cd="[object ArrayBuffer]",Ad="[object DataView]",Td="[object Float32Array]",Md="[object Float64Array]",kd="[object Int8Array]",jd="[object Int16Array]",Od="[object Int32Array]",Pd="[object Uint8Array]",Dd="[object Uint8ClampedArray]",Ud="[object Uint16Array]",Ld="[object Uint32Array]",E={};E[Td]=E[Md]=E[kd]=E[jd]=E[Od]=E[Pd]=E[Dd]=E[Ud]=E[Ld]=!0;E[hd]=E[fd]=E[Cd]=E[gd]=E[Ad]=E[md]=E[yd]=E[bd]=E[vd]=E[wd]=E[xd]=E[_d]=E[Ed]=E[Id]=E[Sd]=!1;function $d(t){return fr(t)&&ad(t.length)&&!!E[qe(t)]}var Nd=$d;function qd(t){return function(e){return t(e)}}var zd=qd,An=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=An&&typeof module=="object"&&module&&!module.nodeType&&module,Bd=Le&&Le.exports===An,lr=Bd&&_n.process,Fd=function(){try{var t=Le&&Le.require&&Le.require("util").types;return t||lr&&lr.binding&&lr.binding("util")}catch{}}(),hn=Fd,fn=hn&&hn.isTypedArray,Of=fn?zd(fn):Nd;var Rd=Object.prototype,Pf=Rd.hasOwnProperty;function Vd(t,e){return function(r){return t(e(r))}}var Hd=Vd,Df=Hd(Object.keys,Object);var Gd=Object.prototype,Uf=Gd.hasOwnProperty;var Kd=ge(Object,"create"),$e=Kd;function Qd(){this.__data__=$e?$e(null):{},this.size=0}var Wd=Qd;function Zd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Yd=Zd,Xd="__lodash_hash_undefined__",Jd=Object.prototype,ep=Jd.hasOwnProperty;function tp(t){var e=this.__data__;if($e){var r=e[t];return r===Xd?void 0:r}return ep.call(e,t)?e[t]:void 0}var rp=tp,ip=Object.prototype,np=ip.hasOwnProperty;function op(t){var e=this.__data__;return $e?e[t]!==void 0:np.call(e,t)}var sp=op,ap="__lodash_hash_undefined__";function lp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=$e&&e===void 0?ap:e,this}var cp=lp;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=Wd;me.prototype.delete=Yd;me.prototype.get=rp;me.prototype.has=sp;me.prototype.set=cp;var gn=me;function up(){this.__data__=[],this.size=0}var dp=up;function pp(t,e){for(var r=t.length;r--;)if(nd(t[r][0],e))return r;return-1}var ht=pp,hp=Array.prototype,fp=hp.splice;function gp(t){var e=this.__data__,r=ht(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():fp.call(e,r,1),--this.size,!0}var mp=gp;function yp(t){var e=this.__data__,r=ht(e,t);return r<0?void 0:e[r][1]}var bp=yp;function vp(t){return ht(this.__data__,t)>-1}var wp=vp;function xp(t,e){var r=this.__data__,i=ht(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}var _p=xp;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=dp;ye.prototype.delete=mp;ye.prototype.get=bp;ye.prototype.has=wp;ye.prototype.set=_p;var ft=ye,Ep=ge(z,"Map"),Ne=Ep;function Ip(){this.size=0,this.__data__={hash:new gn,map:new(Ne||ft),string:new gn}}var Sp=Ip;function Cp(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ap=Cp;function Tp(t,e){var r=t.__data__;return Ap(e)?r[typeof e=="string"?"string":"hash"]:r.map}var gt=Tp;function Mp(t){var e=gt(this,t).delete(t);return this.size-=e?1:0,e}var kp=Mp;function jp(t){return gt(this,t).get(t)}var Op=jp;function Pp(t){return gt(this,t).has(t)}var Dp=Pp;function Up(t,e){var r=gt(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Lp=Up;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=Sp;be.prototype.delete=kp;be.prototype.get=Op;be.prototype.has=Dp;be.prototype.set=Lp;var Tn=be;function $p(){this.__data__=new ft,this.size=0}var Np=$p;function qp(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var zp=qp;function Bp(t){return this.__data__.get(t)}var Fp=Bp;function Rp(t){return this.__data__.has(t)}var Vp=Rp,Hp=200;function Gp(t,e){var r=this.__data__;if(r instanceof ft){var i=r.__data__;if(!Ne||i.length<Hp-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Tn(i)}return r.set(t,e),this.size=r.size,this}var Kp=Gp;function ze(t){var e=this.__data__=new ft(t);this.size=e.size}ze.prototype.clear=Np;ze.prototype.delete=zp;ze.prototype.get=Fp;ze.prototype.has=Vp;ze.prototype.set=Kp;var Qp=Object.prototype,Lf=Qp.propertyIsEnumerable;var Wp=ge(z,"DataView"),ur=Wp,Zp=ge(z,"Promise"),dr=Zp,Yp=ge(z,"Set"),pr=Yp,mn="[object Map]",Xp="[object Object]",yn="[object Promise]",bn="[object Set]",vn="[object WeakMap]",wn="[object DataView]",Jp=te(ur),eh=te(Ne),th=te(dr),rh=te(pr),ih=te(cr),he=qe;(ur&&he(new ur(new ArrayBuffer(1)))!=wn||Ne&&he(new Ne)!=mn||dr&&he(dr.resolve())!=yn||pr&&he(new pr)!=bn||cr&&he(new cr)!=vn)&&(he=function(t){var e=qe(t),r=e==Xp?t.constructor:void 0,i=r?te(r):"";if(i)switch(i){case Jp:return wn;case eh:return mn;case th:return yn;case rh:return bn;case ih:return vn}return e});var $f=z.Uint8Array;var nh="__lodash_hash_undefined__";function oh(t){return this.__data__.set(t,nh),this}var sh=oh;function ah(t){return this.__data__.has(t)}var lh=ah;function hr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Tn;++e<r;)this.add(t[e])}hr.prototype.add=hr.prototype.push=sh;hr.prototype.has=lh;var xn=fe?fe.prototype:void 0,Nf=xn?xn.valueOf:void 0;var ch=Object.prototype,qf=ch.hasOwnProperty;var uh=Object.prototype,zf=uh.hasOwnProperty;var Bf=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Ff=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Rf=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function Mn(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 kn={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 jn(t){return async({cesdk:e})=>ph(e,t)}function ph(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live/image-to-video",schema:kn,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,middleware:e.middleware,getBlockInput:async r=>{let i=await Mn(r.image_url);return Promise.resolve({video:{width:i.width??1280,height:i.height??720,duration:5}})}},e)}var On={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
67
|
The same seed and the same prompt given to the same version of the model
|
|
68
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
|
|
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 Pn(t){return async({cesdk:e})=>fh(e,t)}function fh(t,e){return pe({modelKey:"fal-ai/pixverse/v3.5/text-to-video",schema:On,inputReference:"#/components/schemas/PixverseV35TextToVideoInput",cesdk:t,middleware:e.middleware,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 gh={MinimaxVideo01Live:an,MinimaxVideo01LiveImageToVideo:jn,PixverseV35TextToVideo:Pn},ig=gh;export{ig as default};
|
|
70
70
|
/*! Bundled license information:
|
|
71
71
|
|
|
72
72
|
@imgly/plugin-ai-generation-web/dist/index.mjs:
|