@imgly/plugin-ai-video-generation-web 0.1.4 → 0.1.6

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.
@@ -1,8 +1,8 @@
1
- var Fn=Object.create;var br=Object.defineProperty;var Vn=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var Hn=Object.getPrototypeOf,Qn=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Gn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of zn(e))!Qn.call(t,n)&&n!==r&&br(t,n,{get:()=>e[n],enumerable:!(i=Vn(e,n))||i.enumerable});return t};var vr=(t,e,r)=>(r=t!=null?Fn(Hn(t)):{},Gn(e||!t||!t.__esModule?br(r,"default",{value:t,enumerable:!0}):r,t));var yt=v(j=>{"use strict";var Wn=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())})};Object.defineProperty(j,"__esModule",{value:!0});j.TARGET_URL_HEADER=void 0;j.withMiddleware=Yn;j.withProxy=Zn;function Yn(...t){let e=r=>typeof r=="function";return r=>Wn(this,void 0,void 0,function*(){let i=Object.assign({},r);for(let n of t.filter(e))i=yield n(i);return i})}j.TARGET_URL_HEADER="x-fal-target-url";function Zn(t){let e=r=>Promise.resolve(r);return typeof window>"u"?e:r=>r.headers&&j.TARGET_URL_HEADER in r?e(r):Promise.resolve(Object.assign(Object.assign({},r),{url:t.targetUrl,headers:Object.assign(Object.assign({},r.headers||{}),{[j.TARGET_URL_HEADER]:r.url})}))}});var K=v(P=>{"use strict";var xr=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=Er;P.resultResponseHandler=Jn;var Xn="x-fal-request-id",re=class extends Error{constructor({message:e,status:r,body:i}){super(e),this.name="ApiError",this.status=r,this.body=i}};P.ApiError=re;var Fe=class extends re{constructor(e){super(e),this.name="ValidationError"}get fieldErrors(){return typeof this.body.detail=="string"?[{loc:["body"],msg:this.body.detail,type:"value_error"}]:this.body.detail||[]}getFieldErrors(e){return this.fieldErrors.filter(r=>r.loc[r.loc.length-1]===e)}};P.ValidationError=Fe;function Er(t){return xr(this,void 0,void 0,function*(){var e;let{status:r,statusText:i}=t,n=(e=t.headers.get("Content-Type"))!==null&&e!==void 0?e:"";if(!t.ok){if(n.includes("application/json")){let o=yield t.json(),s=r===422?Fe:re;throw new s({message:o.message||i,status:r,body:o})}throw new re({message:`HTTP ${r}: ${i}`,status:r})}return n.includes("application/json")?t.json():n.includes("text/html")?t.text():n.includes("application/octet-stream")?t.arrayBuffer():t.text()})}function Jn(t){return xr(this,void 0,void 0,function*(){return{data:yield Er(t),requestId:t.headers.get(Xn)||""}})}});var Ir=v((Pf,eo)=>{eo.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 He=v(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.isBrowser=to;ze.getUserAgent=ro;function to(){return typeof window<"u"&&typeof window.document<"u"}var Ve=null;function ro(){if(Ve!==null)return Ve;let t=Ir();return Ve=`${t.name}/${t.version}`,Ve}});var Qe=v(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.credentialsFromEnv=void 0;R.resolveDefaultFetch=_r;R.createConfig=lo;R.getRestApiUrl=co;var kr=yt(),io=K(),no=He();function _r(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function oo(){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 so=()=>{if(oo())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};R.credentialsFromEnv=so;var ao={credentials:R.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:io.defaultResponseHandler};function lo(t){var e;let r=Object.assign(Object.assign(Object.assign({},ao),t),{fetch:(e=t.fetch)!==null&&e!==void 0?e:_r()});t.proxyUrl&&(r=Object.assign(Object.assign({},r),{requestMiddleware:(0,kr.withMiddleware)(r.requestMiddleware,(0,kr.withProxy)({targetUrl:t.proxyUrl}))}));let{credentials:i,suppressLocalCredentialsWarning:n}=r,o=typeof i=="function"?i():i;return(0,no.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 co(){return"https://rest.alpha.fal.ai"}});var W=v(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ensureEndpointIdFormat=Ar;F.parseEndpointId=po;F.isValidUrl=fo;F.throttle=ho;F.isReact=go;F.isPlainObject=mo;function Ar(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 uo=["workflows","comfy"];function po(t){let r=Ar(t).split("/");return uo.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 fo(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function ho(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 bt;function go(){if(bt===void 0){let t=new Error().stack;bt=!!t&&(t.includes("node_modules/react-dom/")||t.includes("node_modules/next/"))}return bt}function mo(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}});var ie=v(V=>{"use strict";var yo=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())})},bo=V&&V.__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(V,"__esModule",{value:!0});V.dispatchRequest=wo;V.buildUrl=xo;var Sr=He(),Cr=W(),vo=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function wo(t){return yo(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,h=(0,Sr.isBrowser)()?{}:{"User-Agent":(0,Sr.getUserAgent)()},p=typeof l=="function"?l():l,{method:g,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"}),h),w??{}),{responseHandler:S}=a,A=bo(a,["responseHandler"]),C=yield d(b,Object.assign(Object.assign(Object.assign(Object.assign({},A),{method:g,headers:Object.assign(Object.assign({},x),(i=A.headers)!==null&&i!==void 0?i:{})}),!vo&&{mode:"cors"}),{signal:a.signal,body:g.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(S??c)(C)})}function xo(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 Mr=v(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});function Eo(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&&Io(r)&&(r=r.slice(Tr.length)),e=!1;let h=r.length,p=0,g=!1;for(;p<h;){g&&(r[p]===`
2
- `&&++p,g=!1);let b=-1,w=n,m;for(let x=i;b<0&&x<h;++x)m=r[x],m===":"&&w<0?w=x-p:m==="\r"?(g=!0,b=x-p):m===`
3
- `&&(b=x-p);if(b<0){i=h-p,n=w;break}else i=0,n=-1;c(r,p,w,b),p+=b+1}p===h?r="":p>0&&(r=r.slice(p))}function c(d,h,p,g){if(g===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(h,h+(b?g:p)),m=0;b?m=g:d[h+p+1]===" "?m=p+2:m=p+1;let x=h+m,S=g-m,A=d.slice(x,x+S).toString();if(w==="data")a+=A?"".concat(A,`
1
+ var Fn=Object.create;var bi=Object.defineProperty;var Vn=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var Hn=Object.getPrototypeOf,Qn=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Gn=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of zn(e))!Qn.call(t,n)&&n!==i&&bi(t,n,{get:()=>e[n],enumerable:!(r=Vn(e,n))||r.enumerable});return t};var vi=(t,e,i)=>(i=t!=null?Fn(Hn(t)):{},Gn(e||!t||!t.__esModule?bi(i,"default",{value:t,enumerable:!0}):i,t));var yt=v(j=>{"use strict";var Wn=j&&j.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(j,"__esModule",{value:!0});j.TARGET_URL_HEADER=void 0;j.withMiddleware=Yn;j.withProxy=Zn;function Yn(...t){let e=i=>typeof i=="function";return i=>Wn(this,void 0,void 0,function*(){let r=Object.assign({},i);for(let n of t.filter(e))r=yield n(r);return r})}j.TARGET_URL_HEADER="x-fal-target-url";function Zn(t){let e=i=>Promise.resolve(i);return typeof window>"u"?e:i=>i.headers&&j.TARGET_URL_HEADER in i?e(i):Promise.resolve(Object.assign(Object.assign({},i),{url:t.targetUrl,headers:Object.assign(Object.assign({},i.headers||{}),{[j.TARGET_URL_HEADER]:i.url})}))}});var K=v(P=>{"use strict";var xi=P&&P.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(P,"__esModule",{value:!0});P.ValidationError=P.ApiError=void 0;P.defaultResponseHandler=ki;P.resultResponseHandler=Jn;var Xn="x-fal-request-id",ie=class extends Error{constructor({message:e,status:i,body:r}){super(e),this.name="ApiError",this.status=i,this.body=r}};P.ApiError=ie;var Fe=class extends ie{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(i=>i.loc[i.loc.length-1]===e)}};P.ValidationError=Fe;function ki(t){return xi(this,void 0,void 0,function*(){var e;let{status:i,statusText:r}=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=i===422?Fe:ie;throw new s({message:o.message||r,status:i,body:o})}throw new ie({message:`HTTP ${i}: ${r}`,status:i})}return n.includes("application/json")?t.json():n.includes("text/html")?t.text():n.includes("application/octet-stream")?t.arrayBuffer():t.text()})}function Jn(t){return xi(this,void 0,void 0,function*(){return{data:yield ki(t),requestId:t.headers.get(Xn)||""}})}});var Ii=v((Pf,eo)=>{eo.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 He=v(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.isBrowser=to;ze.getUserAgent=io;function to(){return typeof window<"u"&&typeof window.document<"u"}var Ve=null;function io(){if(Ve!==null)return Ve;let t=Ii();return Ve=`${t.name}/${t.version}`,Ve}});var Qe=v(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.credentialsFromEnv=void 0;R.resolveDefaultFetch=Ai;R.createConfig=lo;R.getRestApiUrl=co;var Ei=yt(),ro=K(),no=He();function Ai(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function oo(){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 so=()=>{if(oo())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};R.credentialsFromEnv=so;var ao={credentials:R.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:ro.defaultResponseHandler};function lo(t){var e;let i=Object.assign(Object.assign(Object.assign({},ao),t),{fetch:(e=t.fetch)!==null&&e!==void 0?e:Ai()});t.proxyUrl&&(i=Object.assign(Object.assign({},i),{requestMiddleware:(0,Ei.withMiddleware)(i.requestMiddleware,(0,Ei.withProxy)({targetUrl:t.proxyUrl}))}));let{credentials:r,suppressLocalCredentialsWarning:n}=i,o=typeof r=="function"?r():r;return(0,no.isBrowser)()&&o&&!n&&console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases."),i}function co(){return"https://rest.alpha.fal.ai"}});var W=v(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ensureEndpointIdFormat=_i;F.parseEndpointId=po;F.isValidUrl=fo;F.throttle=ho;F.isReact=go;F.isPlainObject=mo;function _i(t){if(t.split("/").length>1)return t;let[,i,r]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(t)||[];if(i&&r)return`${i}/${r}`;throw new Error(`Invalid app id: ${t}. Must be in the format <appOwner>/<appId>`)}var uo=["workflows","comfy"];function po(t){let i=_i(t).split("/");return uo.includes(i[0])?{owner:i[1],alias:i[2],path:i.slice(3).join("/")||void 0,namespace:i[0]}:{owner:i[0],alias:i[1],path:i.slice(2).join("/")||void 0}}function fo(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function ho(t,e,i=!1){let r,n;return(...o)=>{!n&&i?(t(...o),n=Date.now()):(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-n>=e&&(t(...o),n=Date.now())},e-(Date.now()-n)))}}var bt;function go(){if(bt===void 0){let t=new Error().stack;bt=!!t&&(t.includes("node_modules/react-dom/")||t.includes("node_modules/next/"))}return bt}function mo(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}});var re=v(V=>{"use strict";var yo=V&&V.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},bo=V&&V.__rest||function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};Object.defineProperty(V,"__esModule",{value:!0});V.dispatchRequest=wo;V.buildUrl=xo;var Si=He(),Ci=W(),vo=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function wo(t){return yo(this,void 0,void 0,function*(){var e,i,r;let{targetUrl:n,input:o,config:s,options:a={}}=t,{credentials:l,requestMiddleware:u,responseHandler:c,fetch:d}=s,h=(0,Si.isBrowser)()?{}:{"User-Agent":(0,Si.getUserAgent)()},p=typeof l=="function"?l():l,{method:g,url:b,headers:w}=yield u({method:((i=(e=t.method)!==null&&e!==void 0?e:a.method)!==null&&i!==void 0?i:"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"}),h),w??{}),{responseHandler:S}=a,_=bo(a,["responseHandler"]),C=yield d(b,Object.assign(Object.assign(Object.assign(Object.assign({},_),{method:g,headers:Object.assign(Object.assign({},x),(r=_.headers)!==null&&r!==void 0?r:{})}),!vo&&{mode:"cors"}),{signal:a.signal,body:g.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(S??c)(C)})}function xo(t,e={}){var i,r;let n=((i=e.method)!==null&&i!==void 0?i:"post").toLowerCase(),o=((r=e.path)!==null&&r!==void 0?r:"").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,Ci.isValidUrl)(t))return`${t.endsWith("/")?t:`${t}/`}${o}${l}`;let u=(0,Ci.ensureEndpointIdFormat)(t);return`${`https://${e.subdomain?`${e.subdomain}.`:""}fal.run/${u}/${o}`.replace(/\/$/,"")}${l}`}});var Mi=v(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});function ko(t){let e,i,r,n,o,s,a;return l(),{feed:u,reset:l};function l(){e=!0,i="",r=0,n=-1,o=void 0,s=void 0,a=""}function u(d){i=i?i+d:d,e&&Io(i)&&(i=i.slice(Ti.length)),e=!1;let h=i.length,p=0,g=!1;for(;p<h;){g&&(i[p]===`
2
+ `&&++p,g=!1);let b=-1,w=n,m;for(let x=r;b<0&&x<h;++x)m=i[x],m===":"&&w<0?w=x-p:m==="\r"?(g=!0,b=x-p):m===`
3
+ `&&(b=x-p);if(b<0){r=h-p,n=w;break}else r=0,n=-1;c(i,p,w,b),p+=b+1}p===h?i="":p>0&&(i=i.slice(p))}function c(d,h,p,g){if(g===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(h,h+(b?g:p)),m=0;b?m=g:d[h+p+1]===" "?m=p+2:m=p+1;let x=h+m,S=g-m,_=d.slice(x,x+S).toString();if(w==="data")a+=_?"".concat(_,`
4
4
  `):`
5
- `;else if(w==="event")s=A;else if(w==="id"&&!A.includes("\0"))o=A;else if(w==="retry"){let C=parseInt(A,10);Number.isNaN(C)||t({type:"reconnect-interval",value:C})}}}var Tr=[239,187,191];function Io(t){return Tr.every((e,r)=>t.charCodeAt(r)===e)}vt.createParser=Eo});var wt=v(z=>{"use strict";var ko=z&&z.__awaiter||function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(d){s(d)}}function l(c){try{u(i.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(z,"__esModule",{value:!0});z.TOKEN_EXPIRATION_SECONDS=void 0;z.getTemporaryAuthToken=Co;var _o=Qe(),Ao=ie(),So=W();z.TOKEN_EXPIRATION_SECONDS=120;function Co(t,e){return ko(this,void 0,void 0,function*(){let r=(0,So.parseEndpointId)(t),i=yield(0,Ao.dispatchRequest)({method:"POST",targetUrl:`${(0,_o.getRestApiUrl)()}/tokens/`,config:e,input:{allowed_apps:[r.alias],token_expiration:z.TOKEN_EXPIRATION_SECONDS}});return typeof i!="string"&&i.detail?i.detail:i})}});var Et=v(O=>{"use strict";var ve=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())})},we=O&&O.__await||function(t){return this instanceof we?(this.v=t,this):new we(t)},To=O&&O.__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(g){return Promise.resolve(g).then(p,d)}}function a(p,g){i[p]&&(n[p]=function(b){return new Promise(function(w,m){o.push([p,b,w,m])>1||l(p,b)})},g&&(n[p]=g(n[p])))}function l(p,g){try{u(i[p](g))}catch(b){h(o[0][3],b)}}function u(p){p.value instanceof we?Promise.resolve(p.value.v).then(c,d):h(o[0][2],p)}function c(p){l("next",p)}function d(p){l("throw",p)}function h(p,g){p(g),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(O,"__esModule",{value:!0});O.FalStream=void 0;O.createStreamingClient=Po;var Mo=Mr(),Oo=wt(),Or=ie(),ne=K(),xt="text/event-stream",jo=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 h=yield(0,Oo.getTemporaryAuthToken)(a,this.config),{fetch:p}=this.config,g=new URL(this.url);g.searchParams.set("fal_jwt_token",h);let b=yield p(g.toString(),{method:c.toUpperCase(),headers:{accept:(o=l.accept)!==null&&o!==void 0?o:xt,"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,Or.dispatchRequest)({method:c.toUpperCase(),targetUrl:this.url,input:u,config:this.config,options:{headers:{accept:(s=l.accept)!==null&&s!==void 0?s:xt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(h){this.handleError(h)}}),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(xt)){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(),h=(0,Mo.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:jo,g=()=>ve(this,void 0,void 0,function*(){let{value:b,done:w}=yield d.read();this.lastEventTimestamp=Date.now(),h.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):g().catch(this.handleError)});g().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,Or.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 To(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}};O.FalStream=Ge;function Po({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 Pr=v(H=>{"use strict";var Y=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())})},Do=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(),Uo=K(),$o=Et(),Ke=W(),jr=500,Lo=({config:t,storage:e})=>{let r={submit(i,n){return Y(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s}=n,a=Do(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 Y(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 Y(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"},h=(0,U.buildUrl)(`${c}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:d});return new $o.FalStream(o,t,{url:h,method:"get",connectionMode:l,queryParams:d})})},subscribeToStatus(i,n){return Y(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",h=>{n.onQueueUpdate&&("logs"in h&&Array.isArray(h.logs)&&h.logs.length>0&&c.push(...h.logs),n.onQueueUpdate("logs"in h?Object.assign(Object.assign({},h),{logs:c}):h))});let d=yield u.done();return a&&clearTimeout(a),d}return new Promise((u,c)=>{var d;let h,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(d=n.pollInterval)!==null&&d!==void 0?d:jr,g=()=>{a&&clearTimeout(a),h&&clearTimeout(h)};s&&(a=setTimeout(()=>{g(),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=()=>Y(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"){g(),u(m);return}h=setTimeout(b,p)}catch(m){g(),c(m)}});b().catch(c)})})},result(i,n){return Y(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:Uo.resultResponseHandler}),options:{signal:a}})})},cancel(i,n){return Y(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=Lo});var We=v($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.utf8Count=No;$.utf8EncodeJs=Dr;$.utf8EncodeTE=Ur;$.utf8Encode=Ro;$.utf8DecodeJs=$r;$.utf8DecodeTD=Lr;$.utf8Decode=Ho;function No(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 Dr(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 qo=new TextEncoder,Bo=50;function Ur(t,e,r){qo.encodeInto(t,e.subarray(r))}function Ro(t,e,r){t.length>Bo?Ur(t,e,r):Dr(t,e,r)}var Fo=4096;function $r(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>=Fo&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var Vo=new TextDecoder,zo=200;function Lr(t,e,r){let i=t.subarray(e,e+r);return Vo.decode(i)}function Ho(t,e,r){return r>zo?Lr(t,e,r):$r(t,e,r)}});var kt=v(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.ExtData=void 0;var It=class{constructor(e,r){this.type=e,this.data=r}};Ye.ExtData=It});var Xe=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.DecodeError=void 0;var _t=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=_t});var Je=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.UINT32_MAX=void 0;Q.setUint64=Qo;Q.setInt64=Go;Q.getInt64=Ko;Q.getUint64=Wo;Q.UINT32_MAX=4294967295;function Qo(t,e,r){let i=r/4294967296,n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function Go(t,e,r){let i=Math.floor(r/4294967296),n=r;t.setUint32(e,i),t.setUint32(e+4,n)}function Ko(t,e){let r=t.getInt32(e),i=t.getUint32(e+4);return r*4294967296+i}function Wo(t,e){let r=t.getUint32(e),i=t.getUint32(e+4);return r*4294967296+i}});var At=v(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.timestampExtension=T.EXT_TIMESTAMP=void 0;T.encodeTimeSpecToTimestamp=qr;T.encodeDateToTimeSpec=Br;T.encodeTimestampExtension=Rr;T.decodeTimestampToTimeSpec=Fr;T.decodeTimestampExtension=Vr;var Yo=Xe(),Nr=Je();T.EXT_TIMESTAMP=-1;var Zo=4294967296-1,Xo=17179869184-1;function qr({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Xo)if(e===0&&t<=Zo){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,Nr.setInt64)(i,4,t),r}}function Br(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 Rr(t){if(t instanceof Date){let e=Br(t);return qr(e)}else return null}function Fr(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,Nr.getInt64)(e,4),i=e.getUint32(0);return{sec:r,nsec:i}}default:throw new Yo.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Vr(t){let e=Fr(t);return new Date(e.sec*1e3+e.nsec/1e6)}T.timestampExtension={type:T.EXT_TIMESTAMP,encode:Rr,decode:Vr}});var rt=v(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.ExtensionCodec=void 0;var et=kt(),Jo=At(),xe=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Jo.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 et.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 et.ExtData(s,o)}}}return e instanceof et.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 et.ExtData(r,e)}};tt.ExtensionCodec=xe;xe.defaultCodec=new xe});var Ct=v(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ensureUint8Array=ts;function es(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function ts(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):es(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 zr=We(),rs=rt(),Hr=Je(),is=Ct();D.DEFAULT_MAX_DEPTH=100;D.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Tt=class t{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??rs.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,zr.utf8Count)(e);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),(0,zr.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,is.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,Hr.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,Hr.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 Qr=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.encode=os;var ns=Mt();function os(t,e){return new ns.Encoder(e).encodeSharedRef(t)}});var Gr=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.prettyByte=ss;function ss(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var Kr=v(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.CachedKeyDecoder=void 0;var as=We(),ls=16,cs=16,Pt=class{constructor(e=ls,r=cs){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,as.utf8DecodeJs)(e,r,i),s=Uint8Array.prototype.slice.call(e,r,r+i);return this.store(s,o),o}};it.CachedKeyDecoder=Pt});var ot=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.Decoder=void 0;var Dt=Gr(),us=rt(),Z=Je(),ds=We(),Wr=Ct(),ps=Kr(),L=Xe(),Ut="array",Ie="map_key",Zr="map_value",fs=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new L.DecodeError("The type of key must be string or number but "+typeof t)},$t=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=Ie,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===Ie||e.type===Zr){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}},Ee=-1,Nt=new DataView(new ArrayBuffer(0)),hs=new Uint8Array(Nt.buffer);try{Nt.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 Yr=new RangeError("Insufficient data"),gs=new ps.CachedKeyDecoder,Lt=class t{constructor(e){this.totalPos=0,this.pos=0,this.view=Nt,this.bytes=hs,this.headByte=Ee,this.stack=new $t,this.entered=!1,this.extensionCodec=e?.extensionCodec??us.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Z.UINT32_MAX,this.maxBinLength=e?.maxBinLength??Z.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??Z.UINT32_MAX,this.maxMapLength=e?.maxMapLength??Z.UINT32_MAX,this.maxExtLength=e?.maxExtLength??Z.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:gs,this.mapKeyConverter=e?.mapKeyConverter??fs}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=Ee,this.stack.reset()}setBuffer(e){let r=(0,Wr.ensureUint8Array)(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Ee&&!this.hasRemaining(1))this.setBuffer(e);else{let r=this.bytes.subarray(this.pos),i=(0,Wr.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,Dt.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 L.DecodeError(`Unrecognized type byte: ${(0,Dt.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===Ie){if(r==="__proto__")throw new L.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(r),n.type=Zr;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=Ie;continue e}}return r}}readHeadByte(){return this.headByte===Ee&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Ee}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 L.DecodeError(`Unrecognized array type byte: ${(0,Dt.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new L.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new L.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 L.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw Yr;let i=this.pos+r,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?n=this.keyDecoder.decode(this.bytes,i,e):n=(0,ds.utf8Decode)(this.bytes,i,e),this.pos+=r+e,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ie:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new L.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw Yr;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 L.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,Z.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,Z.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}};nt.Decoder=Lt});var Jr=v(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.decode=ms;st.decodeMulti=ys;var Xr=ot();function ms(t,e){return new Xr.Decoder(e).decode(t)}function ys(t,e){return new Xr.Decoder(e).decodeMulti(t)}});var ri=v(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.isAsyncIterable=ei;ke.asyncIterableFromStream=ti;ke.ensureAsyncIterable=bs;function ei(t){return t[Symbol.asyncIterator]!=null}async function*ti(t){let e=t.getReader();try{for(;;){let{done:r,value:i}=await e.read();if(r)return;yield i}}finally{e.releaseLock()}}function bs(t){return ei(t)?t:ti(t)}});var ii=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.decodeAsync=vs;_e.decodeArrayStream=ws;_e.decodeMultiStream=xs;var qt=ot(),Bt=ri();async function vs(t,e){let r=(0,Bt.ensureAsyncIterable)(t);return new qt.Decoder(e).decodeAsync(r)}function ws(t,e){let r=(0,Bt.ensureAsyncIterable)(t);return new qt.Decoder(e).decodeArrayStream(r)}function xs(t,e){let r=(0,Bt.ensureAsyncIterable)(t);return new qt.Decoder(e).decodeStream(r)}});var oi=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 Es=Qr();Object.defineProperty(y,"encode",{enumerable:!0,get:function(){return Es.encode}});var ni=Jr();Object.defineProperty(y,"decode",{enumerable:!0,get:function(){return ni.decode}});Object.defineProperty(y,"decodeMulti",{enumerable:!0,get:function(){return ni.decodeMulti}});var Rt=ii();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 Is=ot();Object.defineProperty(y,"Decoder",{enumerable:!0,get:function(){return Is.Decoder}});var ks=Xe();Object.defineProperty(y,"DecodeError",{enumerable:!0,get:function(){return ks.DecodeError}});var _s=Mt();Object.defineProperty(y,"Encoder",{enumerable:!0,get:function(){return _s.Encoder}});var As=rt();Object.defineProperty(y,"ExtensionCodec",{enumerable:!0,get:function(){return As.ExtensionCodec}});var Ss=kt();Object.defineProperty(y,"ExtData",{enumerable:!0,get:function(){return Ss.ExtData}});var oe=At();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 wi=v(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});function _(t){return{enumerable:!0,value:t}}function si(t){return{enumerable:!0,writable:!0,value:t}}var X={},Cs=()=>!0,ai=()=>({}),ci=t=>t,Ts=(t,e,r,i)=>t.apply(r,i)&&e.apply(r,i),Ms=(t,e,r,[i,n])=>e.call(r,t.call(r,i,n),n),G=(t,e)=>Object.freeze(Object.create(t,e));function li(t,e,r){return t.reduce((i,n)=>function(...o){return r(i,n,this,o)},e)}function ui(t){return G(this,{fn:_(t)})}var di={},pi=ui.bind(di),Os=t=>pi((e,r)=>!!~t(e,r)&&e),fi={},js=ui.bind(fi);function at(t,e){return e.filter(r=>t.isPrototypeOf(r))}function hi(t,e,...r){let i=li(at(fi,r).map(o=>o.fn),Cs,Ts),n=li(at(di,r).map(o=>o.fn),ci,Ms);return G(this,{from:_(t),to:_(e),guards:_(i),reducers:_(n)})}var gi={},mi={},Ps=hi.bind(gi),Ds=hi.bind(mi,null);function Us(t,e,r){return Vt(e,t,r,this.immediates)||t}function yi(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 $s={enter:ci};function Ls(...t){let e=at(gi,t),r=at(mi,t),i={final:_(t.length===0),transitions:_(yi(e))};return r.length&&(i.immediates=_(r),i.enter=_(Us)),G($s,i)}var Ns={enter(t,e,r){let i=this.fn.call(e,e.context,r);return Ft.isPrototypeOf(i)?G(bi,{machine:_(i),transitions:_(this.transitions)}).enter(t,e,r):(i.then(n=>e.send({type:"done",data:n})).catch(n=>e.send({type:"error",error:n})),t)}},bi={enter(t,e,r){if(e.child=vi(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,Vt(e,t,{type:"done",data:i},this.transitions.get("done"))}return t}};function qs(t,...e){let r=_(yi(e));return Ft.isPrototypeOf(t)?G(bi,{machine:_(t),transitions:r}):G(Ns,{fn:_(t),transitions:r})}var Ft={get state(){return{name:this.current,value:this.states[this.current]}}};function Bs(t,e,r=ai){return typeof t!="string"&&(r=e||ai,e=t,t=Object.keys(e)[0]),X._create&&X._create(t,e),G(Ft,{context:_(r),current:_(t),states:_(e)})}function Vt(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=G(l,{current:_(o),original:{value:l}});return X._onEnter&&X._onEnter(e,o,t.context,n,r),u.state.value.enter(u,t,r)}}function Rs(t,e){let r=e.type||e,{machine:i}=t,{value:n,name:o}=i.state;return n.transitions.has(r)?Vt(t,i,e,n.transitions.get(r))||i:(X._send&&X._send(r,o),i)}var Fs={send(t){this.machine=Rs(this,t),this.onChange(this)}};function vi(t,e,r,i){let n=Object.create(Fs,{machine:si(t),context:si(t.context(r,i)),onChange:_(e)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,i),n}M.action=Os;M.createMachine=Bs;M.d=X;M.guard=js;M.immediate=Ds;M.interpret=vi;M.invoke=qs;M.reduce=pi;M.state=Ls;M.transition=Ps});var _i=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.createRealtimeClient=ia;var ct=oi(),f=wi(),xi=wt(),zt=K(),Ei=He(),Gt=W(),Vs=()=>({enqueuedMessage:void 0});function zs(t){return t.token!==void 0}function Hs(t){return!zs(t)}function lt(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 Qs(t,e){return t.websocket&&t.websocket.readyState===WebSocket.OPEN?(e.message instanceof Uint8Array?t.websocket.send(e.message):t.websocket.send((0,ct.encode)(e.message)),Object.assign(Object.assign({},t),{enqueuedMessage:void 0})):Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function Ht(t){return Object.assign(Object.assign({},t),{token:void 0})}function Gs(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function Ks(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var Ws=(0,f.createMachine)("idle",{idle:(0,f.state)((0,f.transition)("send","connecting",(0,f.reduce)(lt)),(0,f.transition)("expireToken","idle",(0,f.reduce)(Ht)),(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)(Ks)),(0,f.transition)("connectionClosed","idle",(0,f.reduce)(N)),(0,f.transition)("send","connecting",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(N)),(0,f.immediate)("authRequired",(0,f.guard)(Hs))),authRequired:(0,f.state)((0,f.transition)("initiateAuth","authInProgress"),(0,f.transition)("send","authRequired",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(N))),authInProgress:(0,f.state)((0,f.transition)("authenticated","connecting",(0,f.reduce)(Gs)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Ht),(0,f.reduce)(N)),(0,f.transition)("send","authInProgress",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(N))),active:(0,f.state)((0,f.transition)("send","active",(0,f.reduce)(Qs)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Ht)),(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)))},Vs);function Ys(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 Zs=128;function Xs(t){return t.status==="error"&&t.error==="Unauthorized"}var Js={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Qt=new Map,Ii=new Map;function ea(t,e,r){if(!Qt.has(t)){let i=(0,f.interpret)(Ws,r);Qt.set(t,Object.assign(Object.assign({},i),{throttledSend:e>0?(0,Gt.throttle)(i.send,e,!0):i.send}))}return Qt.get(t)}var Ae=()=>{},ta={send:Ae,close:Ae};function ra(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!ki(t)}function ki(t){return t.type==="x-fal-error"}function ia({config:t}){return{connect(e,r){let{clientOnly:i=(0,Gt.isReact)()&&!(0,Ei.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:s=Zs}=r;if(i&&!(0,Ei.isBrowser)())return ta;let a;Ii.set(n,{onError:r.onError,onResult:r.onResult});let l=()=>Ii.get(n),u=ea(n,s,({context:h,machine:p,send:g})=>{let{enqueuedMessage:b,token:w}=h;if(p.current==="active"&&b&&g({type:"send",message:b}),p.current==="authRequired"&&w===void 0&&a!==p.current&&(g({type:"initiateAuth"}),(0,xi.getTemporaryAuthToken)(e,t).then(m=>{g({type:"authenticated",token:m});let x=Math.round(xi.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{g({type:"expireToken"})},x)}).catch(m=>{g({type:"unauthorized",error:m})})),p.current==="connecting"&&a!==p.current&&w!==void 0){let m=new WebSocket(Ys(e,{token:w,maxBuffering:o}));m.onopen=()=>{g({type:"connected",websocket:m})},m.onclose=x=>{if(x.code!==Js.NORMAL_CLOSURE){let{onError:S=Ae}=l();S(new zt.ApiError({message:`Error closing the connection: ${x.reason}`,status:x.code}))}g({type:"connectionClosed",code:x.code})},m.onerror=x=>{let{onError:S=Ae}=l();S(new zt.ApiError({message:"Unknown error",status:500}))},m.onmessage=x=>{let{onResult:S}=l();if(x.data instanceof ArrayBuffer){let C=(0,ct.decode)(new Uint8Array(x.data));S(C);return}if(x.data instanceof Uint8Array){let C=(0,ct.decode)(x.data);S(C);return}if(x.data instanceof Blob){x.data.arrayBuffer().then(C=>{let yr=(0,ct.decode)(new Uint8Array(C));S(yr)});return}let A=JSON.parse(x.data);if(Xs(A)){g({type:"unauthorized",error:new Error("Unauthorized")});return}if(ra(A)){S(A);return}if(ki(A)){if(A.error==="TIMEOUT")return;let{onError:C=Ae}=l();C(new zt.ApiError({message:`${A.error}: ${A.reason}`,status:400,body:A}));return}}}a=p.current});return{send:h=>{u.throttledSend({type:"send",message:h})},close:()=>{u.send({type:"close"})}}}}}});var Mi=v(Se=>{"use strict";var J=Se&&Se.__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(Se,"__esModule",{value:!0});Se.createStorageClient=la;var Ai=Qe(),Si=ie(),na=W();function Ci(t){var e;let[r,i]=t.split("/");return(e=i.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}function oa(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,Ai.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:r,file_name:i},config:e})})}function sa(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,Ai.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:r,file_name:i},config:e})})}function Ti(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 Ti(i,n,o,s-1)}})}function aa(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 sa(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 g=p*a,b=Math.min(g+a,t.size),w=t.slice(g,b),m=p+1,x=`${u.origin}${u.pathname}/${m}${u.search}`;c.push(yield Ti(x,w,e))}let d=`${u.origin}${u.pathname}/complete${u.search}`,h=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(h),s})}function la({config:t}){let e={upload:r=>J(this,void 0,void 0,function*(){if(r.size>94371840)return yield aa(r,t);let i=r.type||"application/octet-stream",{fetch:n,responseHandler:o}=t,{upload_url:s,file_url:a}=yield oa(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,na.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 Wt=v(Ce=>{"use strict";var Oi=Ce&&Ce.__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(Ce,"__esModule",{value:!0});Ce.createFalClient=ga;var ca=Qe(),ua=Pr(),da=_i(),ji=ie(),pa=K(),fa=Mi(),ha=Et();function ga(t={}){let e=(0,ca.createConfig)(t),r=(0,fa.createStorageClient)({config:e}),i=(0,ua.createQueueClient)({config:e,storage:r}),n=(0,ha.createStreamingClient)({config:e,storage:r}),o=(0,da.createRealtimeClient)({config:e});return{queue:i,realtime:o,storage:r,streaming:n,stream:n.stream,run(s){return Oi(this,arguments,void 0,function*(a,l={}){let u=l.input?yield r.transformInput(l.input):void 0;return(0,ji.dispatchRequest)({method:l.method,targetUrl:(0,ji.buildUrl)(a,l),input:u,config:Object.assign(Object.assign({},e),{responseHandler:pa.resultResponseHandler}),options:{signal:l.abortSignal}})})},subscribe:(s,a)=>Oi(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 Di=v(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.isQueueStatus=Pi;ut.isCompletedQueueStatus=ma;function Pi(t){return t&&t.status&&t.response_url}function ma(t){return Pi(t)&&t.status==="COMPLETED"}});var Yt=v(k=>{"use strict";var ya=k&&k.__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]}),ba=k&&k.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ya(e,t,r)};Object.defineProperty(k,"__esModule",{value:!0});k.fal=k.parseEndpointId=k.ValidationError=k.ApiError=k.withProxy=k.withMiddleware=k.createFalClient=void 0;var Ui=Wt(),va=Wt();Object.defineProperty(k,"createFalClient",{enumerable:!0,get:function(){return va.createFalClient}});var $i=yt();Object.defineProperty(k,"withMiddleware",{enumerable:!0,get:function(){return $i.withMiddleware}});Object.defineProperty(k,"withProxy",{enumerable:!0,get:function(){return $i.withProxy}});var Li=K();Object.defineProperty(k,"ApiError",{enumerable:!0,get:function(){return Li.ApiError}});Object.defineProperty(k,"ValidationError",{enumerable:!0,get:function(){return Li.ValidationError}});ba(Di(),k);var wa=W();Object.defineProperty(k,"parseEndpointId",{enumerable:!0,get:function(){return wa.parseEndpointId}});k.fal=function(){let e=(0,Ui.createFalClient)();return{config(r){e=(0,Ui.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 wr={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=vr(Yt());async function Ni(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 xa(t,e){let{cesdk:r}=e,i=e.propertyKey??"image_url";return Ea(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:()=>{if(r==null)return;let d=tr(t);r.ui.openPanel(d,{payload:{onSelect:h=>{h.meta?.uri!=null&&c.setValue(h.meta?.uri)}}})}}}),()=>({id:o.id,type:"string",value:c.value})}}}function Ea(t,e){e?.ui.registerPanel(tr(t),({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(tr(t))):e.ui.showNotification({type:"warning",message:`Only images are supported. Found '${s}'. Please choose a different image.`})}})})}function tr(t){return`ly.img.ai/${t}.imageSelection`}var Ia=xa;function ka(){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 en=ka;var _a=typeof global=="object"&&global&&global.Object===Object&&global,tn=_a,Aa=typeof self=="object"&&self&&self.Object===Object&&self,Sa=tn||Aa||Function("return this")(),q=Sa,Ca=q.Symbol,ae=Ca,rn=Object.prototype,Ta=rn.hasOwnProperty,Ma=rn.toString,Te=ae?ae.toStringTag:void 0;function Oa(t){var e=Ta.call(t,Te),r=t[Te];try{t[Te]=void 0;var i=!0}catch{}var n=Ma.call(t);return i&&(e?t[Te]=r:delete t[Te]),n}var ja=Oa,Pa=Object.prototype,Da=Pa.toString;function Ua(t){return Da.call(t)}var $a=Ua,La="[object Null]",Na="[object Undefined]",qi=ae?ae.toStringTag:void 0;function qa(t){return t==null?t===void 0?Na:La:qi&&qi in Object(t)?ja(t):$a(t)}var De=qa;function Ba(t){return t!=null&&typeof t=="object"}var ar=Ba,dh=Array.isArray;function Ra(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var nn=Ra,Fa="[object AsyncFunction]",Va="[object Function]",za="[object GeneratorFunction]",Ha="[object Proxy]";function Qa(t){if(!nn(t))return!1;var e=De(t);return e==Va||e==za||e==Fa||e==Ha}var Ga=Qa,Ka=q["__core-js_shared__"],Xt=Ka,Bi=function(){var t=/[^.]+$/.exec(Xt&&Xt.keys&&Xt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wa(t){return!!Bi&&Bi in t}var Ya=Wa,Za=Function.prototype,Xa=Za.toString;function Ja(t){if(t!=null){try{return Xa.call(t)}catch{}try{return t+""}catch{}}return""}var ee=Ja,el=/[\\^$.*+?()[\]{}|]/g,tl=/^\[object .+?Constructor\]$/,rl=Function.prototype,il=Object.prototype,nl=rl.toString,ol=il.hasOwnProperty,sl=RegExp("^"+nl.call(ol).replace(el,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function al(t){if(!nn(t)||Ya(t))return!1;var e=Ga(t)?sl:tl;return e.test(ee(t))}var ll=al;function cl(t,e){return t?.[e]}var ul=cl;function dl(t,e){var r=ul(t,e);return ll(r)?r:void 0}var le=dl,pl=le(q,"WeakMap"),rr=pl;function fl(t,e){return t===e||t!==t&&e!==e}var hl=fl,gl=9007199254740991;function ml(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=gl}var yl=ml,ph=Object.prototype,bl="[object Arguments]";function vl(t){return ar(t)&&De(t)==bl}var Ri=vl,on=Object.prototype,wl=on.hasOwnProperty,xl=on.propertyIsEnumerable,fh=Ri(function(){return arguments}())?Ri:function(t){return ar(t)&&wl.call(t,"callee")&&!xl.call(t,"callee")},sn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fi=sn&&typeof module=="object"&&module&&!module.nodeType&&module,El=Fi&&Fi.exports===sn,Vi=El?q.Buffer:void 0,hh=Vi?Vi.isBuffer:void 0,Il="[object Arguments]",kl="[object Array]",_l="[object Boolean]",Al="[object Date]",Sl="[object Error]",Cl="[object Function]",Tl="[object Map]",Ml="[object Number]",Ol="[object Object]",jl="[object RegExp]",Pl="[object Set]",Dl="[object String]",Ul="[object WeakMap]",$l="[object ArrayBuffer]",Ll="[object DataView]",Nl="[object Float32Array]",ql="[object Float64Array]",Bl="[object Int8Array]",Rl="[object Int16Array]",Fl="[object Int32Array]",Vl="[object Uint8Array]",zl="[object Uint8ClampedArray]",Hl="[object Uint16Array]",Ql="[object Uint32Array]",E={};E[Nl]=E[ql]=E[Bl]=E[Rl]=E[Fl]=E[Vl]=E[zl]=E[Hl]=E[Ql]=!0;E[Il]=E[kl]=E[$l]=E[_l]=E[Ll]=E[Al]=E[Sl]=E[Cl]=E[Tl]=E[Ml]=E[Ol]=E[jl]=E[Pl]=E[Dl]=E[Ul]=!1;function Gl(t){return ar(t)&&yl(t.length)&&!!E[De(t)]}var Kl=Gl;function Wl(t){return function(e){return t(e)}}var Yl=Wl,an=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=an&&typeof module=="object"&&module&&!module.nodeType&&module,Zl=Oe&&Oe.exports===an,Jt=Zl&&tn.process,Xl=function(){try{var t=Oe&&Oe.require&&Oe.require("util").types;return t||Jt&&Jt.binding&&Jt.binding("util")}catch{}}(),zi=Xl,Hi=zi&&zi.isTypedArray,gh=Hi?Yl(Hi):Kl,Jl=Object.prototype,mh=Jl.hasOwnProperty;function ec(t,e){return function(r){return t(e(r))}}var tc=ec,yh=tc(Object.keys,Object),rc=Object.prototype,bh=rc.hasOwnProperty,ic=le(Object,"create"),je=ic;function nc(){this.__data__=je?je(null):{},this.size=0}var oc=nc;function sc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ac=sc,lc="__lodash_hash_undefined__",cc=Object.prototype,uc=cc.hasOwnProperty;function dc(t){var e=this.__data__;if(je){var r=e[t];return r===lc?void 0:r}return uc.call(e,t)?e[t]:void 0}var pc=dc,fc=Object.prototype,hc=fc.hasOwnProperty;function gc(t){var e=this.__data__;return je?e[t]!==void 0:hc.call(e,t)}var mc=gc,yc="__lodash_hash_undefined__";function bc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=je&&e===void 0?yc:e,this}var vc=bc;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=oc;ce.prototype.delete=ac;ce.prototype.get=pc;ce.prototype.has=mc;ce.prototype.set=vc;var Qi=ce;function wc(){this.__data__=[],this.size=0}var xc=wc;function Ec(t,e){for(var r=t.length;r--;)if(hl(t[r][0],e))return r;return-1}var dt=Ec,Ic=Array.prototype,kc=Ic.splice;function _c(t){var e=this.__data__,r=dt(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():kc.call(e,r,1),--this.size,!0}var Ac=_c;function Sc(t){var e=this.__data__,r=dt(e,t);return r<0?void 0:e[r][1]}var Cc=Sc;function Tc(t){return dt(this.__data__,t)>-1}var Mc=Tc;function Oc(t,e){var r=this.__data__,i=dt(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}var jc=Oc;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=xc;ue.prototype.delete=Ac;ue.prototype.get=Cc;ue.prototype.has=Mc;ue.prototype.set=jc;var pt=ue,Pc=le(q,"Map"),Pe=Pc;function Dc(){this.size=0,this.__data__={hash:new Qi,map:new(Pe||pt),string:new Qi}}var Uc=Dc;function $c(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Lc=$c;function Nc(t,e){var r=t.__data__;return Lc(e)?r[typeof e=="string"?"string":"hash"]:r.map}var ft=Nc;function qc(t){var e=ft(this,t).delete(t);return this.size-=e?1:0,e}var Bc=qc;function Rc(t){return ft(this,t).get(t)}var Fc=Rc;function Vc(t){return ft(this,t).has(t)}var zc=Vc;function Hc(t,e){var r=ft(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Qc=Hc;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=Uc;de.prototype.delete=Bc;de.prototype.get=Fc;de.prototype.has=zc;de.prototype.set=Qc;var ln=de;function Gc(){this.__data__=new pt,this.size=0}var Kc=Gc;function Wc(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Yc=Wc;function Zc(t){return this.__data__.get(t)}var Xc=Zc;function Jc(t){return this.__data__.has(t)}var eu=Jc,tu=200;function ru(t,e){var r=this.__data__;if(r instanceof pt){var i=r.__data__;if(!Pe||i.length<tu-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new ln(i)}return r.set(t,e),this.size=r.size,this}var iu=ru;function Ue(t){var e=this.__data__=new pt(t);this.size=e.size}Ue.prototype.clear=Kc;Ue.prototype.delete=Yc;Ue.prototype.get=Xc;Ue.prototype.has=eu;Ue.prototype.set=iu;var nu=Object.prototype,vh=nu.propertyIsEnumerable,ou=le(q,"DataView"),ir=ou,su=le(q,"Promise"),nr=su,au=le(q,"Set"),or=au,Gi="[object Map]",lu="[object Object]",Ki="[object Promise]",Wi="[object Set]",Yi="[object WeakMap]",Zi="[object DataView]",cu=ee(ir),uu=ee(Pe),du=ee(nr),pu=ee(or),fu=ee(rr),se=De;(ir&&se(new ir(new ArrayBuffer(1)))!=Zi||Pe&&se(new Pe)!=Gi||nr&&se(nr.resolve())!=Ki||or&&se(new or)!=Wi||rr&&se(new rr)!=Yi)&&(se=function(t){var e=De(t),r=e==lu?t.constructor:void 0,i=r?ee(r):"";if(i)switch(i){case cu:return Zi;case uu:return Gi;case du:return Ki;case pu:return Wi;case fu:return Yi}return e});var wh=q.Uint8Array,hu="__lodash_hash_undefined__";function gu(t){return this.__data__.set(t,hu),this}var mu=gu;function yu(t){return this.__data__.has(t)}var bu=yu;function sr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new ln;++e<r;)this.add(t[e])}sr.prototype.add=sr.prototype.push=mu;sr.prototype.has=bu;var Xi=ae?ae.prototype:void 0,xh=Xi?Xi.valueOf:void 0,vu=Object.prototype,Eh=vu.hasOwnProperty,wu=Object.prototype,Ih=wu.hasOwnProperty,kh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),_h=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Ah=new RegExp(/[A-Fa-f0-9]{2}/,"g");var er="@imgly/plugin-ai-generation",Sh=`
5
+ `;else if(w==="event")s=_;else if(w==="id"&&!_.includes("\0"))o=_;else if(w==="retry"){let C=parseInt(_,10);Number.isNaN(C)||t({type:"reconnect-interval",value:C})}}}var Ti=[239,187,191];function Io(t){return Ti.every((e,i)=>t.charCodeAt(i)===e)}vt.createParser=ko});var wt=v(z=>{"use strict";var Eo=z&&z.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(z,"__esModule",{value:!0});z.TOKEN_EXPIRATION_SECONDS=void 0;z.getTemporaryAuthToken=Co;var Ao=Qe(),_o=re(),So=W();z.TOKEN_EXPIRATION_SECONDS=120;function Co(t,e){return Eo(this,void 0,void 0,function*(){let i=(0,So.parseEndpointId)(t),r=yield(0,_o.dispatchRequest)({method:"POST",targetUrl:`${(0,Ao.getRestApiUrl)()}/tokens/`,config:e,input:{allowed_apps:[i.alias],token_expiration:z.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var kt=v(O=>{"use strict";var ve=O&&O.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},we=O&&O.__await||function(t){return this instanceof we?(this.v=t,this):new we(t)},To=O&&O.__asyncGenerator||function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.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(g){return Promise.resolve(g).then(p,d)}}function a(p,g){r[p]&&(n[p]=function(b){return new Promise(function(w,m){o.push([p,b,w,m])>1||l(p,b)})},g&&(n[p]=g(n[p])))}function l(p,g){try{u(r[p](g))}catch(b){h(o[0][3],b)}}function u(p){p.value instanceof we?Promise.resolve(p.value.v).then(c,d):h(o[0][2],p)}function c(p){l("next",p)}function d(p){l("throw",p)}function h(p,g){p(g),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(O,"__esModule",{value:!0});O.FalStream=void 0;O.createStreamingClient=Po;var Mo=Mi(),Oo=wt(),Oi=re(),ne=K(),xt="text/event-stream",jo=15*1e3,Ge=class{constructor(e,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this.abortController=new AbortController,this.start=()=>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 h=yield(0,Oo.getTemporaryAuthToken)(a,this.config),{fetch:p}=this.config,g=new URL(this.url);g.searchParams.set("fal_jwt_token",h);let b=yield p(g.toString(),{method:c.toUpperCase(),headers:{accept:(o=l.accept)!==null&&o!==void 0?o:xt,"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,Oi.dispatchRequest)({method:c.toUpperCase(),targetUrl:this.url,input:u,config:this.config,options:{headers:{accept:(s=l.accept)!==null&&s!==void 0?s:xt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(h){this.handleError(h)}}),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(xt)){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(),h=(0,Mo.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:jo,g=()=>ve(this,void 0,void 0,function*(){let{value:b,done:w}=yield d.read();this.lastEventTimestamp=Date.now(),h.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):g().catch(this.handleError)});g().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=i,this.url=(n=r.url)!==null&&n!==void 0?n:(0,Oi.buildUrl)(e,{path:"/stream",query:r.queryParams}),this.options=r,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)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return To(this,arguments,function*(){let i=!0,r=()=>i=!1;for(this.on("error",r),this.on("done",r);i||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield we(n)),yield we(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}};O.FalStream=Ge;function Po({config:t,storage:e}){return{stream(i,r){return ve(this,void 0,void 0,function*(){let n=r.input?yield e.transformInput(r.input):void 0;return new Ge(i,t,Object.assign(Object.assign({},r),{input:n}))})}}}});var Pi=v(H=>{"use strict";var Y=H&&H.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})},Do=H&&H.__rest||function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};Object.defineProperty(H,"__esModule",{value:!0});H.createQueueClient=void 0;var U=re(),Uo=K(),$o=kt(),Ke=W(),ji=500,Lo=({config:t,storage:e})=>{let i={submit(r,n){return Y(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s}=n,a=Do(n,["webhookUrl","priority"]),l=n.input?yield e.transformInput(n.input):void 0;return(0,U.dispatchRequest)({method:n.method,targetUrl:(0,U.buildUrl)(r,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(r,n){return Y(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(r,n){return Y(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"},h=(0,U.buildUrl)(`${c}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:d});return new $o.FalStream(o,t,{url:h,method:"get",connectionMode:l,queryParams:d})})},subscribeToStatus(r,n){return Y(this,void 0,void 0,function*(){let o=n.requestId,s=n.timeout,a,l=()=>{};if(n.mode==="streaming"){let u=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),c=[];s&&(a=setTimeout(()=>{throw u.abort(),i.cancel(r,{requestId:o}).catch(l),new Error(`Client timed out waiting for the request to complete after ${s}ms`)},s)),u.on("data",h=>{n.onQueueUpdate&&("logs"in h&&Array.isArray(h.logs)&&h.logs.length>0&&c.push(...h.logs),n.onQueueUpdate("logs"in h?Object.assign(Object.assign({},h),{logs:c}):h))});let d=yield u.done();return a&&clearTimeout(a),d}return new Promise((u,c)=>{var d;let h,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(d=n.pollInterval)!==null&&d!==void 0?d:ji,g=()=>{a&&clearTimeout(a),h&&clearTimeout(h)};s&&(a=setTimeout(()=>{g(),i.cancel(r,{requestId:o}).catch(l),c(new Error(`Client timed out waiting for the request to complete after ${s}ms`))},s));let b=()=>Y(this,void 0,void 0,function*(){var w;try{let m=yield i.status(r,{requestId:o,logs:(w=n.logs)!==null&&w!==void 0?w:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(m),m.status==="COMPLETED"){g(),u(m);return}h=setTimeout(b,p)}catch(m){g(),c(m)}});b().catch(c)})})},result(r,n){return Y(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:Uo.resultResponseHandler}),options:{signal:a}})})},cancel(r,n){return Y(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 i};H.createQueueClient=Lo});var We=v($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.utf8Count=qo;$.utf8EncodeJs=Di;$.utf8EncodeTE=Ui;$.utf8Encode=Ro;$.utf8DecodeJs=$i;$.utf8DecodeTD=Li;$.utf8Decode=Ho;function qo(t){let e=t.length,i=0,r=0;for(;r<e;){let n=t.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))i+=2;else{if(n>=55296&&n<=56319&&r<e){let o=t.charCodeAt(r);(o&64512)===56320&&(++r,n=((n&1023)<<10)+(o&1023)+65536)}n&4294901760?i+=4:i+=3}else{i++;continue}}return i}function Di(t,e,i){let r=t.length,n=i,o=0;for(;o<r;){let s=t.charCodeAt(o++);if(s&4294967168)if(!(s&4294965248))e[n++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<r){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 No=new TextEncoder,Bo=50;function Ui(t,e,i){No.encodeInto(t,e.subarray(i))}function Ro(t,e,i){t.length>Bo?Ui(t,e,i):Di(t,e,i)}var Fo=4096;function $i(t,e,i){let r=e,n=r+i,o=[],s="";for(;r<n;){let a=t[r++];if(!(a&128))o.push(a);else if((a&224)===192){let l=t[r++]&63;o.push((a&31)<<6|l)}else if((a&240)===224){let l=t[r++]&63,u=t[r++]&63;o.push((a&31)<<12|l<<6|u)}else if((a&248)===240){let l=t[r++]&63,u=t[r++]&63,c=t[r++]&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>=Fo&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var Vo=new TextDecoder,zo=200;function Li(t,e,i){let r=t.subarray(e,e+i);return Vo.decode(r)}function Ho(t,e,i){return i>zo?Li(t,e,i):$i(t,e,i)}});var Et=v(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.ExtData=void 0;var It=class{constructor(e,i){this.type=e,this.data=i}};Ye.ExtData=It});var Xe=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.DecodeError=void 0;var At=class t extends Error{constructor(e){super(e);let i=Object.create(t.prototype);Object.setPrototypeOf(this,i),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:t.name})}};Ze.DecodeError=At});var Je=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.UINT32_MAX=void 0;Q.setUint64=Qo;Q.setInt64=Go;Q.getInt64=Ko;Q.getUint64=Wo;Q.UINT32_MAX=4294967295;function Qo(t,e,i){let r=i/4294967296,n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function Go(t,e,i){let r=Math.floor(i/4294967296),n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function Ko(t,e){let i=t.getInt32(e),r=t.getUint32(e+4);return i*4294967296+r}function Wo(t,e){let i=t.getUint32(e),r=t.getUint32(e+4);return i*4294967296+r}});var _t=v(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.timestampExtension=T.EXT_TIMESTAMP=void 0;T.encodeTimeSpecToTimestamp=Ni;T.encodeDateToTimeSpec=Bi;T.encodeTimestampExtension=Ri;T.decodeTimestampToTimeSpec=Fi;T.decodeTimestampExtension=Vi;var Yo=Xe(),qi=Je();T.EXT_TIMESTAMP=-1;var Zo=4294967296-1,Xo=17179869184-1;function Ni({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Xo)if(e===0&&t<=Zo){let i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,t),i}else{let i=t/4294967296,r=t&4294967295,n=new Uint8Array(8),o=new DataView(n.buffer);return o.setUint32(0,e<<2|i&3),o.setUint32(4,r),n}else{let i=new Uint8Array(12),r=new DataView(i.buffer);return r.setUint32(0,e),(0,qi.setInt64)(r,4,t),i}}function Bi(t){let e=t.getTime(),i=Math.floor(e/1e3),r=(e-i*1e3)*1e6,n=Math.floor(r/1e9);return{sec:i+n,nsec:r-n*1e9}}function Ri(t){if(t instanceof Date){let e=Bi(t);return Ni(e)}else return null}function Fi(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 i=e.getUint32(0),r=e.getUint32(4),n=(i&3)*4294967296+r,o=i>>>2;return{sec:n,nsec:o}}case 12:{let i=(0,qi.getInt64)(e,4),r=e.getUint32(0);return{sec:i,nsec:r}}default:throw new Yo.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Vi(t){let e=Fi(t);return new Date(e.sec*1e3+e.nsec/1e6)}T.timestampExtension={type:T.EXT_TIMESTAMP,encode:Ri,decode:Vi}});var it=v(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.ExtensionCodec=void 0;var et=Et(),Jo=_t(),xe=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Jo.timestampExtension)}register({type:e,encode:i,decode:r}){if(e>=0)this.encoders[e]=i,this.decoders[e]=r;else{let n=-1-e;this.builtInEncoders[n]=i,this.builtInDecoders[n]=r}}tryToEncode(e,i){for(let r=0;r<this.builtInEncoders.length;r++){let n=this.builtInEncoders[r];if(n!=null){let o=n(e,i);if(o!=null){let s=-1-r;return new et.ExtData(s,o)}}}for(let r=0;r<this.encoders.length;r++){let n=this.encoders[r];if(n!=null){let o=n(e,i);if(o!=null){let s=r;return new et.ExtData(s,o)}}}return e instanceof et.ExtData?e:null}decode(e,i,r){let n=i<0?this.builtInDecoders[-1-i]:this.decoders[i];return n?n(e,i,r):new et.ExtData(i,e)}};tt.ExtensionCodec=xe;xe.defaultCodec=new xe});var Ct=v(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ensureUint8Array=ts;function es(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function ts(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):es(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 zi=We(),is=it(),Hi=Je(),rs=Ct();D.DEFAULT_MAX_DEPTH=100;D.DEFAULT_INITIAL_BUFFER_SIZE=2048;var Tt=class t{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??is.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,i){if(i>this.maxDepth)throw new Error(`Too deep objects in depth ${i}`);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,i)}ensureBufferSizeToWrite(e){let i=this.pos+e;this.view.byteLength<i&&this.resizeBuffer(i*2)}resizeBuffer(e){let i=new ArrayBuffer(e),r=new Uint8Array(i),n=new DataView(i);r.set(this.bytes),this.view=n,this.bytes=r}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 r=(0,zi.utf8Count)(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,zi.utf8Encode)(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,i){let r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,i);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,i);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let i=e.byteLength;if(i<256)this.writeU8(196),this.writeU8(i);else if(i<65536)this.writeU8(197),this.writeU16(i);else if(i<4294967296)this.writeU8(198),this.writeU32(i);else throw new Error(`Too large binary: ${i}`);let r=(0,rs.ensureUint8Array)(e);this.writeU8a(r)}encodeArray(e,i){let r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(let n of e)this.doEncode(n,i+1)}countWithoutUndefined(e,i){let r=0;for(let n of i)e[n]!==void 0&&r++;return r}encodeMap(e,i){let r=Object.keys(e);this.sortKeys&&r.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(let o of r){let s=e[o];this.ignoreUndefined&&s===void 0||(this.encodeString(o),this.doEncode(s,i+1))}}encodeExtension(e){if(typeof e.data=="function"){let r=e.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(e.type),this.writeU8a(r);return}let i=e.data.length;if(i===1)this.writeU8(212);else if(i===2)this.writeU8(213);else if(i===4)this.writeU8(214);else if(i===8)this.writeU8(215);else if(i===16)this.writeU8(216);else if(i<256)this.writeU8(199),this.writeU8(i);else if(i<65536)this.writeU8(200),this.writeU16(i);else if(i<4294967296)this.writeU8(201),this.writeU32(i);else throw new Error(`Too large extension object: ${i}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let i=e.length;this.ensureBufferSizeToWrite(i),this.bytes.set(e,this.pos),this.pos+=i}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,Hi.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,Hi.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 Qi=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.encode=os;var ns=Mt();function os(t,e){return new ns.Encoder(e).encodeSharedRef(t)}});var Gi=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.prettyByte=ss;function ss(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var Ki=v(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.CachedKeyDecoder=void 0;var as=We(),ls=16,cs=16,Pt=class{constructor(e=ls,i=cs){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=i,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,i,r){let n=this.caches[r-1];e:for(let o of n){let s=o.bytes;for(let a=0;a<r;a++)if(s[a]!==e[i+a])continue e;return o.str}return null}store(e,i){let r=this.caches[e.length-1],n={bytes:e,str:i};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(e,i,r){let n=this.find(e,i,r);if(n!=null)return this.hit++,n;this.miss++;let o=(0,as.utf8DecodeJs)(e,i,r),s=Uint8Array.prototype.slice.call(e,i,i+r);return this.store(s,o),o}};rt.CachedKeyDecoder=Pt});var ot=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.Decoder=void 0;var Dt=Gi(),us=it(),Z=Je(),ds=We(),Wi=Ct(),ps=Ki(),L=Xe(),Ut="array",Ie="map_key",Zi="map_value",fs=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new L.DecodeError("The type of key must be string or number but "+typeof t)},$t=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let i=this.getUninitializedStateFromPool();i.type=Ut,i.position=0,i.size=e,i.array=new Array(e)}pushMapState(e){let i=this.getUninitializedStateFromPool();i.type=Ie,i.readCount=0,i.size=e,i.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 r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Ie||e.type===Zi){let r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},ke=-1,qt=new DataView(new ArrayBuffer(0)),hs=new Uint8Array(qt.buffer);try{qt.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 Yi=new RangeError("Insufficient data"),gs=new ps.CachedKeyDecoder,Lt=class t{constructor(e){this.totalPos=0,this.pos=0,this.view=qt,this.bytes=hs,this.headByte=ke,this.stack=new $t,this.entered=!1,this.extensionCodec=e?.extensionCodec??us.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??Z.UINT32_MAX,this.maxBinLength=e?.maxBinLength??Z.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??Z.UINT32_MAX,this.maxMapLength=e?.maxMapLength??Z.UINT32_MAX,this.maxExtLength=e?.maxExtLength??Z.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:gs,this.mapKeyConverter=e?.mapKeyConverter??fs}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=ke,this.stack.reset()}setBuffer(e){let i=(0,Wi.ensureUint8Array)(e);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===ke&&!this.hasRemaining(1))this.setBuffer(e);else{let i=this.bytes.subarray(this.pos),r=(0,Wi.ensureUint8Array)(e),n=new Uint8Array(i.length+r.length);n.set(i),n.set(r,i.length),this.setBuffer(n)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:i,pos:r}=this;return new RangeError(`Extra ${i.byteLength-r} of ${i.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 i=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return i}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 i=!1,r;for await(let a of e){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{r=this.doDecodeSync(),i=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}let{headByte:n,pos:o,totalPos:s}=this;throw new RangeError(`Insufficient data in parsing ${(0,Dt.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,i){if(this.entered){yield*this.clone().decodeMultiAsync(e,i);return}try{this.entered=!0;let r=i,n=-1;for await(let o of e){if(i&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(s){if(!(s instanceof RangeError))throw s}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),i;if(e>=224)i=e-256;else if(e<192)if(e<128)i=e;else if(e<144){let n=e-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(e<160){let n=e-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else{let n=e-160;i=this.decodeString(n,0)}else if(e===192)i=null;else if(e===194)i=!1;else if(e===195)i=!0;else if(e===202)i=this.readF32();else if(e===203)i=this.readF64();else if(e===204)i=this.readU8();else if(e===205)i=this.readU16();else if(e===206)i=this.readU32();else if(e===207)this.useBigInt64?i=this.readU64AsBigInt():i=this.readU64();else if(e===208)i=this.readI8();else if(e===209)i=this.readI16();else if(e===210)i=this.readI32();else if(e===211)this.useBigInt64?i=this.readI64AsBigInt():i=this.readI64();else if(e===217){let n=this.lookU8();i=this.decodeString(n,1)}else if(e===218){let n=this.lookU16();i=this.decodeString(n,2)}else if(e===219){let n=this.lookU32();i=this.decodeString(n,4)}else if(e===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(e===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(e===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(e===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(e===196){let n=this.lookU8();i=this.decodeBinary(n,1)}else if(e===197){let n=this.lookU16();i=this.decodeBinary(n,2)}else if(e===198){let n=this.lookU32();i=this.decodeBinary(n,4)}else if(e===212)i=this.decodeExtension(1,0);else if(e===213)i=this.decodeExtension(2,0);else if(e===214)i=this.decodeExtension(4,0);else if(e===215)i=this.decodeExtension(8,0);else if(e===216)i=this.decodeExtension(16,0);else if(e===199){let n=this.lookU8();i=this.decodeExtension(n,1)}else if(e===200){let n=this.lookU16();i=this.decodeExtension(n,2)}else if(e===201){let n=this.lookU32();i=this.decodeExtension(n,4)}else throw new L.DecodeError(`Unrecognized type byte: ${(0,Dt.prettyByte)(e)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===Ut)if(n.array[n.position]=i,n.position++,n.position===n.size)i=n.array,r.release(n);else continue e;else if(n.type===Ie){if(i==="__proto__")throw new L.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=Zi;continue e}else if(n.map[n.key]=i,n.readCount++,n.readCount===n.size)i=n.map,r.release(n);else{n.key=null,n.type=Ie;continue e}}return i}}readHeadByte(){return this.headByte===ke&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=ke}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 L.DecodeError(`Unrecognized array type byte: ${(0,Dt.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new L.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new L.DecodeError(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,i){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,i):this.decodeBinary(e,i)}decodeUtf8String(e,i){if(e>this.maxStrLength)throw new L.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+e)throw Yi;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?n=this.keyDecoder.decode(this.bytes,r,e):n=(0,ds.utf8Decode)(this.bytes,r,e),this.pos+=i+e,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ie:!1}decodeBinary(e,i){if(e>this.maxBinLength)throw new L.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+i))throw Yi;let r=this.pos+i,n=this.bytes.subarray(r,r+e);return this.pos+=i+e,n}decodeExtension(e,i){if(e>this.maxExtLength)throw new L.DecodeError(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+i),n=this.decodeBinary(e,i+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let 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,Z.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,Z.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}};nt.Decoder=Lt});var Ji=v(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.decode=ms;st.decodeMulti=ys;var Xi=ot();function ms(t,e){return new Xi.Decoder(e).decode(t)}function ys(t,e){return new Xi.Decoder(e).decodeMulti(t)}});var ir=v(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.isAsyncIterable=er;Ee.asyncIterableFromStream=tr;Ee.ensureAsyncIterable=bs;function er(t){return t[Symbol.asyncIterator]!=null}async function*tr(t){let e=t.getReader();try{for(;;){let{done:i,value:r}=await e.read();if(i)return;yield r}}finally{e.releaseLock()}}function bs(t){return er(t)?t:tr(t)}});var rr=v(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.decodeAsync=vs;Ae.decodeArrayStream=ws;Ae.decodeMultiStream=xs;var Nt=ot(),Bt=ir();async function vs(t,e){let i=(0,Bt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeAsync(i)}function ws(t,e){let i=(0,Bt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeArrayStream(i)}function xs(t,e){let i=(0,Bt.ensureAsyncIterable)(t);return new Nt.Decoder(e).decodeStream(i)}});var or=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 ks=Qi();Object.defineProperty(y,"encode",{enumerable:!0,get:function(){return ks.encode}});var nr=Ji();Object.defineProperty(y,"decode",{enumerable:!0,get:function(){return nr.decode}});Object.defineProperty(y,"decodeMulti",{enumerable:!0,get:function(){return nr.decodeMulti}});var Rt=rr();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 Is=ot();Object.defineProperty(y,"Decoder",{enumerable:!0,get:function(){return Is.Decoder}});var Es=Xe();Object.defineProperty(y,"DecodeError",{enumerable:!0,get:function(){return Es.DecodeError}});var As=Mt();Object.defineProperty(y,"Encoder",{enumerable:!0,get:function(){return As.Encoder}});var _s=it();Object.defineProperty(y,"ExtensionCodec",{enumerable:!0,get:function(){return _s.ExtensionCodec}});var Ss=Et();Object.defineProperty(y,"ExtData",{enumerable:!0,get:function(){return Ss.ExtData}});var oe=_t();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 wr=v(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});function A(t){return{enumerable:!0,value:t}}function sr(t){return{enumerable:!0,writable:!0,value:t}}var X={},Cs=()=>!0,ar=()=>({}),cr=t=>t,Ts=(t,e,i,r)=>t.apply(i,r)&&e.apply(i,r),Ms=(t,e,i,[r,n])=>e.call(i,t.call(i,r,n),n),G=(t,e)=>Object.freeze(Object.create(t,e));function lr(t,e,i){return t.reduce((r,n)=>function(...o){return i(r,n,this,o)},e)}function ur(t){return G(this,{fn:A(t)})}var dr={},pr=ur.bind(dr),Os=t=>pr((e,i)=>!!~t(e,i)&&e),fr={},js=ur.bind(fr);function at(t,e){return e.filter(i=>t.isPrototypeOf(i))}function hr(t,e,...i){let r=lr(at(fr,i).map(o=>o.fn),Cs,Ts),n=lr(at(dr,i).map(o=>o.fn),cr,Ms);return G(this,{from:A(t),to:A(e),guards:A(r),reducers:A(n)})}var gr={},mr={},Ps=hr.bind(gr),Ds=hr.bind(mr,null);function Us(t,e,i){return Vt(e,t,i,this.immediates)||t}function yr(t){let e=new Map;for(let i of t)e.has(i.from)||e.set(i.from,[]),e.get(i.from).push(i);return e}var $s={enter:cr};function Ls(...t){let e=at(gr,t),i=at(mr,t),r={final:A(t.length===0),transitions:A(yr(e))};return i.length&&(r.immediates=A(i),r.enter=A(Us)),G($s,r)}var qs={enter(t,e,i){let r=this.fn.call(e,e.context,i);return Ft.isPrototypeOf(r)?G(br,{machine:A(r),transitions:A(this.transitions)}).enter(t,e,i):(r.then(n=>e.send({type:"done",data:n})).catch(n=>e.send({type:"error",error:n})),t)}},br={enter(t,e,i){if(e.child=vr(this.machine,r=>{e.onChange(r),e.child==r&&r.machine.state.value.final&&(delete e.child,e.send({type:"done",data:r.context}))},e.context,i),e.child.machine.state.value.final){let r=e.child.context;return delete e.child,Vt(e,t,{type:"done",data:r},this.transitions.get("done"))}return t}};function Ns(t,...e){let i=A(yr(e));return Ft.isPrototypeOf(t)?G(br,{machine:A(t),transitions:i}):G(qs,{fn:A(t),transitions:i})}var Ft={get state(){return{name:this.current,value:this.states[this.current]}}};function Bs(t,e,i=ar){return typeof t!="string"&&(i=e||ar,e=t,t=Object.keys(e)[0]),X._create&&X._create(t,e),G(Ft,{context:A(i),current:A(t),states:A(e)})}function Vt(t,e,i,r){let{context:n}=t;for(let{to:o,guards:s,reducers:a}of r)if(s(n,i)){t.context=a.call(t,n,i);let l=e.original||e,u=G(l,{current:A(o),original:{value:l}});return X._onEnter&&X._onEnter(e,o,t.context,n,i),u.state.value.enter(u,t,i)}}function Rs(t,e){let i=e.type||e,{machine:r}=t,{value:n,name:o}=r.state;return n.transitions.has(i)?Vt(t,r,e,n.transitions.get(i))||r:(X._send&&X._send(i,o),r)}var Fs={send(t){this.machine=Rs(this,t),this.onChange(this)}};function vr(t,e,i,r){let n=Object.create(Fs,{machine:sr(t),context:sr(t.context(i,r)),onChange:A(e)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}M.action=Os;M.createMachine=Bs;M.d=X;M.guard=js;M.immediate=Ds;M.interpret=vr;M.invoke=Ns;M.reduce=pr;M.state=Ls;M.transition=Ps});var Ar=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.createRealtimeClient=ra;var ct=or(),f=wr(),xr=wt(),zt=K(),kr=He(),Gt=W(),Vs=()=>({enqueuedMessage:void 0});function zs(t){return t.token!==void 0}function Hs(t){return!zs(t)}function lt(t,e){return Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function q(t){return t.websocket&&t.websocket.readyState===WebSocket.OPEN&&t.websocket.close(),Object.assign(Object.assign({},t),{websocket:void 0})}function Qs(t,e){return t.websocket&&t.websocket.readyState===WebSocket.OPEN?(e.message instanceof Uint8Array?t.websocket.send(e.message):t.websocket.send((0,ct.encode)(e.message)),Object.assign(Object.assign({},t),{enqueuedMessage:void 0})):Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function Ht(t){return Object.assign(Object.assign({},t),{token:void 0})}function Gs(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function Ks(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var Ws=(0,f.createMachine)("idle",{idle:(0,f.state)((0,f.transition)("send","connecting",(0,f.reduce)(lt)),(0,f.transition)("expireToken","idle",(0,f.reduce)(Ht)),(0,f.transition)("close","idle",(0,f.reduce)(q))),connecting:(0,f.state)((0,f.transition)("connecting","connecting"),(0,f.transition)("connected","active",(0,f.reduce)(Ks)),(0,f.transition)("connectionClosed","idle",(0,f.reduce)(q)),(0,f.transition)("send","connecting",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(q)),(0,f.immediate)("authRequired",(0,f.guard)(Hs))),authRequired:(0,f.state)((0,f.transition)("initiateAuth","authInProgress"),(0,f.transition)("send","authRequired",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(q))),authInProgress:(0,f.state)((0,f.transition)("authenticated","connecting",(0,f.reduce)(Gs)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Ht),(0,f.reduce)(q)),(0,f.transition)("send","authInProgress",(0,f.reduce)(lt)),(0,f.transition)("close","idle",(0,f.reduce)(q))),active:(0,f.state)((0,f.transition)("send","active",(0,f.reduce)(Qs)),(0,f.transition)("unauthorized","idle",(0,f.reduce)(Ht)),(0,f.transition)("connectionClosed","idle",(0,f.reduce)(q)),(0,f.transition)("close","idle",(0,f.reduce)(q))),failed:(0,f.state)((0,f.transition)("send","failed"),(0,f.transition)("close","idle",(0,f.reduce)(q)))},Vs);function Ys(t,{token:e,maxBuffering:i}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let r=new URLSearchParams({fal_jwt_token:e});return i!==void 0&&r.set("max_buffering",i.toFixed(0)),`wss://fal.run/${(0,Gt.ensureEndpointIdFormat)(t)}/realtime?${r.toString()}`}var Zs=128;function Xs(t){return t.status==="error"&&t.error==="Unauthorized"}var Js={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Qt=new Map,Ir=new Map;function ea(t,e,i){if(!Qt.has(t)){let r=(0,f.interpret)(Ws,i);Qt.set(t,Object.assign(Object.assign({},r),{throttledSend:e>0?(0,Gt.throttle)(r.send,e,!0):r.send}))}return Qt.get(t)}var _e=()=>{},ta={send:_e,close:_e};function ia(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!Er(t)}function Er(t){return t.type==="x-fal-error"}function ra({config:t}){return{connect(e,i){let{clientOnly:r=(0,Gt.isReact)()&&!(0,kr.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:s=Zs}=i;if(r&&!(0,kr.isBrowser)())return ta;let a;Ir.set(n,{onError:i.onError,onResult:i.onResult});let l=()=>Ir.get(n),u=ea(n,s,({context:h,machine:p,send:g})=>{let{enqueuedMessage:b,token:w}=h;if(p.current==="active"&&b&&g({type:"send",message:b}),p.current==="authRequired"&&w===void 0&&a!==p.current&&(g({type:"initiateAuth"}),(0,xr.getTemporaryAuthToken)(e,t).then(m=>{g({type:"authenticated",token:m});let x=Math.round(xr.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{g({type:"expireToken"})},x)}).catch(m=>{g({type:"unauthorized",error:m})})),p.current==="connecting"&&a!==p.current&&w!==void 0){let m=new WebSocket(Ys(e,{token:w,maxBuffering:o}));m.onopen=()=>{g({type:"connected",websocket:m})},m.onclose=x=>{if(x.code!==Js.NORMAL_CLOSURE){let{onError:S=_e}=l();S(new zt.ApiError({message:`Error closing the connection: ${x.reason}`,status:x.code}))}g({type:"connectionClosed",code:x.code})},m.onerror=x=>{let{onError:S=_e}=l();S(new zt.ApiError({message:"Unknown error",status:500}))},m.onmessage=x=>{let{onResult:S}=l();if(x.data instanceof ArrayBuffer){let C=(0,ct.decode)(new Uint8Array(x.data));S(C);return}if(x.data instanceof Uint8Array){let C=(0,ct.decode)(x.data);S(C);return}if(x.data instanceof Blob){x.data.arrayBuffer().then(C=>{let yi=(0,ct.decode)(new Uint8Array(C));S(yi)});return}let _=JSON.parse(x.data);if(Xs(_)){g({type:"unauthorized",error:new Error("Unauthorized")});return}if(ia(_)){S(_);return}if(Er(_)){if(_.error==="TIMEOUT")return;let{onError:C=_e}=l();C(new zt.ApiError({message:`${_.error}: ${_.reason}`,status:400,body:_}));return}}}a=p.current});return{send:h=>{u.throttledSend({type:"send",message:h})},close:()=>{u.send({type:"close"})}}}}}});var Mr=v(Se=>{"use strict";var J=Se&&Se.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(Se,"__esModule",{value:!0});Se.createStorageClient=la;var _r=Qe(),Sr=re(),na=W();function Cr(t){var e;let[i,r]=t.split("/");return(e=r.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}function oa(t,e,i){return J(this,void 0,void 0,function*(){let r=t.name||`${Date.now()}.${Cr(i)}`;return yield(0,Sr.dispatchRequest)({method:"POST",targetUrl:`${(0,_r.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:e})})}function sa(t,e,i){return J(this,void 0,void 0,function*(){let r=t.name||`${Date.now()}.${Cr(i)}`;return yield(0,Sr.dispatchRequest)({method:"POST",targetUrl:`${(0,_r.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:e})})}function Tr(t,e,i){return J(this,arguments,void 0,function*(r,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(r,{method:"PUT",body:n});return yield l(u)}catch{return yield Tr(r,n,o,s-1)}})}function aa(t,e){return J(this,void 0,void 0,function*(){let{fetch:i,responseHandler:r}=e,n=t.type||"application/octet-stream",{upload_url:o,file_url:s}=yield sa(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 g=p*a,b=Math.min(g+a,t.size),w=t.slice(g,b),m=p+1,x=`${u.origin}${u.pathname}/${m}${u.search}`;c.push(yield Tr(x,w,e))}let d=`${u.origin}${u.pathname}/complete${u.search}`,h=yield i(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:c.map(p=>({partNumber:p.partNumber,etag:p.etag}))})});return yield r(h),s})}function la({config:t}){let e={upload:i=>J(this,void 0,void 0,function*(){if(i.size>94371840)return yield aa(i,t);let r=i.type||"application/octet-stream",{fetch:n,responseHandler:o}=t,{upload_url:s,file_url:a}=yield oa(i,t,r),l=yield n(s,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield o(l),a}),transformInput:i=>J(this,void 0,void 0,function*(){if(Array.isArray(i))return Promise.all(i.map(r=>e.transformInput(r)));if(i instanceof Blob)return yield e.upload(i);if((0,na.isPlainObject)(i)){let n=Object.entries(i).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 i})};return e}});var Wt=v(Ce=>{"use strict";var Or=Ce&&Ce.__awaiter||function(t,e,i,r){function n(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{u(r.next(c))}catch(d){s(d)}}function l(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.createFalClient=ga;var ca=Qe(),ua=Pi(),da=Ar(),jr=re(),pa=K(),fa=Mr(),ha=kt();function ga(t={}){let e=(0,ca.createConfig)(t),i=(0,fa.createStorageClient)({config:e}),r=(0,ua.createQueueClient)({config:e,storage:i}),n=(0,ha.createStreamingClient)({config:e,storage:i}),o=(0,da.createRealtimeClient)({config:e});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(s){return Or(this,arguments,void 0,function*(a,l={}){let u=l.input?yield i.transformInput(l.input):void 0;return(0,jr.dispatchRequest)({method:l.method,targetUrl:(0,jr.buildUrl)(a,l),input:u,config:Object.assign(Object.assign({},e),{responseHandler:pa.resultResponseHandler}),options:{signal:l.abortSignal}})})},subscribe:(s,a)=>Or(this,void 0,void 0,function*(){let{request_id:l}=yield r.submit(s,a);return a.onEnqueue&&a.onEnqueue(l),yield r.subscribeToStatus(s,Object.assign({requestId:l},a)),r.result(s,{requestId:l})})}}});var Dr=v(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.isQueueStatus=Pr;ut.isCompletedQueueStatus=ma;function Pr(t){return t&&t.status&&t.response_url}function ma(t){return Pr(t)&&t.status==="COMPLETED"}});var Yt=v(E=>{"use strict";var ya=E&&E.__createBinding||(Object.create?function(t,e,i,r){r===void 0&&(r=i);var n=Object.getOwnPropertyDescriptor(e,i);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,n)}:function(t,e,i,r){r===void 0&&(r=i),t[r]=e[i]}),ba=E&&E.__exportStar||function(t,e){for(var i in t)i!=="default"&&!Object.prototype.hasOwnProperty.call(e,i)&&ya(e,t,i)};Object.defineProperty(E,"__esModule",{value:!0});E.fal=E.parseEndpointId=E.ValidationError=E.ApiError=E.withProxy=E.withMiddleware=E.createFalClient=void 0;var Ur=Wt(),va=Wt();Object.defineProperty(E,"createFalClient",{enumerable:!0,get:function(){return va.createFalClient}});var $r=yt();Object.defineProperty(E,"withMiddleware",{enumerable:!0,get:function(){return $r.withMiddleware}});Object.defineProperty(E,"withProxy",{enumerable:!0,get:function(){return $r.withProxy}});var Lr=K();Object.defineProperty(E,"ApiError",{enumerable:!0,get:function(){return Lr.ApiError}});Object.defineProperty(E,"ValidationError",{enumerable:!0,get:function(){return Lr.ValidationError}});ba(Dr(),E);var wa=W();Object.defineProperty(E,"parseEndpointId",{enumerable:!0,get:function(){return wa.parseEndpointId}});E.fal=function(){let e=(0,Ur.createFalClient)();return{config(i){e=(0,Ur.createFalClient)(i)},get queue(){return e.queue},get realtime(){return e.realtime},get storage(){return e.storage},get streaming(){return e.streaming},run(i,r){return e.run(i,r)},subscribe(i,r){return e.subscribe(i,r)},stream(i,r){return e.stream(i,r)}}}()});var wi={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=vi(Yt());async function qr(t,e){if(t!=null){if(t.startsWith("blob:")){let r=await(await fetch(t)).blob(),n=new File([r],"image.png",{type:"image/png"});return Zt.fal.storage.upload(n)}if(e!=null&&t.startsWith("buffer:")){let i=await e.engine.editor.getMimeType(t),r=e.engine.editor.getBufferLength(t),n=e.engine.editor.getBufferData(t,0,r),o=new File([n],"image.png",{type:i});return Zt.fal.storage.upload(o)}return t}}function xa(t,e){let{cesdk:i}=e,r=e.propertyKey??"image_url",n=ti(t);return i.i18n.setTranslations({en:{[`panel.${n}`]:"Select Image To Change"}}),ka(t,i),{[r]:(o,s)=>{let{builder:a,experimental:{global:l},payload:u}=o,c=u?.url??e.defaultUrl,d=l(`${t}.${s.id}`,c);return a.MediaPreview(s.id,{preview:{type:"image",uri:d.value},action:{label:"Select Image",onClick:()=>{i?.ui.openPanel(n,{payload:{onSelect:h=>{h.meta?.uri!=null&&d.setValue(h.meta?.uri)}}})}}}),()=>({id:s.id,type:"string",value:d.value})}}}function ka(t,e){e?.ui.registerPanel(ti(t),({builder:i,payload:r})=>{i.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/")?(r?.onSelect(n),e?.ui.closePanel(ti(t))):e.ui.showNotification({type:"warning",message:`Only images are supported. Found '${s}'. Please choose a different image.`})}})})}function ti(t){return`ly.img.ai/${t}.imageSelection`}var Ia=xa;function Ea(){return async(t,e,i)=>{console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(t,null,2));let r,n=Date.now();try{return r=await i(t,e),r}finally{r!=null&&(console.log(`Generation took ${Date.now()-n}ms`),console.log("Generation result:",JSON.stringify(r,null,2))),console.groupEnd()}}}var en=Ea;var Aa=typeof global=="object"&&global&&global.Object===Object&&global,tn=Aa,_a=typeof self=="object"&&self&&self.Object===Object&&self,Sa=tn||_a||Function("return this")(),N=Sa,Ca=N.Symbol,ae=Ca,rn=Object.prototype,Ta=rn.hasOwnProperty,Ma=rn.toString,Te=ae?ae.toStringTag:void 0;function Oa(t){var e=Ta.call(t,Te),i=t[Te];try{t[Te]=void 0;var r=!0}catch{}var n=Ma.call(t);return r&&(e?t[Te]=i:delete t[Te]),n}var ja=Oa,Pa=Object.prototype,Da=Pa.toString;function Ua(t){return Da.call(t)}var $a=Ua,La="[object Null]",qa="[object Undefined]",Nr=ae?ae.toStringTag:void 0;function Na(t){return t==null?t===void 0?qa:La:Nr&&Nr in Object(t)?ja(t):$a(t)}var De=Na;function Ba(t){return t!=null&&typeof t=="object"}var ai=Ba,dh=Array.isArray;function Ra(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var nn=Ra,Fa="[object AsyncFunction]",Va="[object Function]",za="[object GeneratorFunction]",Ha="[object Proxy]";function Qa(t){if(!nn(t))return!1;var e=De(t);return e==Va||e==za||e==Fa||e==Ha}var Ga=Qa,Ka=N["__core-js_shared__"],Xt=Ka,Br=function(){var t=/[^.]+$/.exec(Xt&&Xt.keys&&Xt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wa(t){return!!Br&&Br in t}var Ya=Wa,Za=Function.prototype,Xa=Za.toString;function Ja(t){if(t!=null){try{return Xa.call(t)}catch{}try{return t+""}catch{}}return""}var ee=Ja,el=/[\\^$.*+?()[\]{}|]/g,tl=/^\[object .+?Constructor\]$/,il=Function.prototype,rl=Object.prototype,nl=il.toString,ol=rl.hasOwnProperty,sl=RegExp("^"+nl.call(ol).replace(el,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function al(t){if(!nn(t)||Ya(t))return!1;var e=Ga(t)?sl:tl;return e.test(ee(t))}var ll=al;function cl(t,e){return t?.[e]}var ul=cl;function dl(t,e){var i=ul(t,e);return ll(i)?i:void 0}var le=dl,pl=le(N,"WeakMap"),ii=pl;function fl(t,e){return t===e||t!==t&&e!==e}var hl=fl,gl=9007199254740991;function ml(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=gl}var yl=ml,ph=Object.prototype,bl="[object Arguments]";function vl(t){return ai(t)&&De(t)==bl}var Rr=vl,on=Object.prototype,wl=on.hasOwnProperty,xl=on.propertyIsEnumerable,fh=Rr(function(){return arguments}())?Rr:function(t){return ai(t)&&wl.call(t,"callee")&&!xl.call(t,"callee")},sn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fr=sn&&typeof module=="object"&&module&&!module.nodeType&&module,kl=Fr&&Fr.exports===sn,Vr=kl?N.Buffer:void 0,hh=Vr?Vr.isBuffer:void 0,Il="[object Arguments]",El="[object Array]",Al="[object Boolean]",_l="[object Date]",Sl="[object Error]",Cl="[object Function]",Tl="[object Map]",Ml="[object Number]",Ol="[object Object]",jl="[object RegExp]",Pl="[object Set]",Dl="[object String]",Ul="[object WeakMap]",$l="[object ArrayBuffer]",Ll="[object DataView]",ql="[object Float32Array]",Nl="[object Float64Array]",Bl="[object Int8Array]",Rl="[object Int16Array]",Fl="[object Int32Array]",Vl="[object Uint8Array]",zl="[object Uint8ClampedArray]",Hl="[object Uint16Array]",Ql="[object Uint32Array]",k={};k[ql]=k[Nl]=k[Bl]=k[Rl]=k[Fl]=k[Vl]=k[zl]=k[Hl]=k[Ql]=!0;k[Il]=k[El]=k[$l]=k[Al]=k[Ll]=k[_l]=k[Sl]=k[Cl]=k[Tl]=k[Ml]=k[Ol]=k[jl]=k[Pl]=k[Dl]=k[Ul]=!1;function Gl(t){return ai(t)&&yl(t.length)&&!!k[De(t)]}var Kl=Gl;function Wl(t){return function(e){return t(e)}}var Yl=Wl,an=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=an&&typeof module=="object"&&module&&!module.nodeType&&module,Zl=Oe&&Oe.exports===an,Jt=Zl&&tn.process,Xl=function(){try{var t=Oe&&Oe.require&&Oe.require("util").types;return t||Jt&&Jt.binding&&Jt.binding("util")}catch{}}(),zr=Xl,Hr=zr&&zr.isTypedArray,gh=Hr?Yl(Hr):Kl,Jl=Object.prototype,mh=Jl.hasOwnProperty;function ec(t,e){return function(i){return t(e(i))}}var tc=ec,yh=tc(Object.keys,Object),ic=Object.prototype,bh=ic.hasOwnProperty,rc=le(Object,"create"),je=rc;function nc(){this.__data__=je?je(null):{},this.size=0}var oc=nc;function sc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ac=sc,lc="__lodash_hash_undefined__",cc=Object.prototype,uc=cc.hasOwnProperty;function dc(t){var e=this.__data__;if(je){var i=e[t];return i===lc?void 0:i}return uc.call(e,t)?e[t]:void 0}var pc=dc,fc=Object.prototype,hc=fc.hasOwnProperty;function gc(t){var e=this.__data__;return je?e[t]!==void 0:hc.call(e,t)}var mc=gc,yc="__lodash_hash_undefined__";function bc(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=je&&e===void 0?yc:e,this}var vc=bc;function ce(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}ce.prototype.clear=oc;ce.prototype.delete=ac;ce.prototype.get=pc;ce.prototype.has=mc;ce.prototype.set=vc;var Qr=ce;function wc(){this.__data__=[],this.size=0}var xc=wc;function kc(t,e){for(var i=t.length;i--;)if(hl(t[i][0],e))return i;return-1}var dt=kc,Ic=Array.prototype,Ec=Ic.splice;function Ac(t){var e=this.__data__,i=dt(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Ec.call(e,i,1),--this.size,!0}var _c=Ac;function Sc(t){var e=this.__data__,i=dt(e,t);return i<0?void 0:e[i][1]}var Cc=Sc;function Tc(t){return dt(this.__data__,t)>-1}var Mc=Tc;function Oc(t,e){var i=this.__data__,r=dt(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var jc=Oc;function ue(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}ue.prototype.clear=xc;ue.prototype.delete=_c;ue.prototype.get=Cc;ue.prototype.has=Mc;ue.prototype.set=jc;var pt=ue,Pc=le(N,"Map"),Pe=Pc;function Dc(){this.size=0,this.__data__={hash:new Qr,map:new(Pe||pt),string:new Qr}}var Uc=Dc;function $c(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Lc=$c;function qc(t,e){var i=t.__data__;return Lc(e)?i[typeof e=="string"?"string":"hash"]:i.map}var ft=qc;function Nc(t){var e=ft(this,t).delete(t);return this.size-=e?1:0,e}var Bc=Nc;function Rc(t){return ft(this,t).get(t)}var Fc=Rc;function Vc(t){return ft(this,t).has(t)}var zc=Vc;function Hc(t,e){var i=ft(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var Qc=Hc;function de(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}de.prototype.clear=Uc;de.prototype.delete=Bc;de.prototype.get=Fc;de.prototype.has=zc;de.prototype.set=Qc;var ln=de;function Gc(){this.__data__=new pt,this.size=0}var Kc=Gc;function Wc(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var Yc=Wc;function Zc(t){return this.__data__.get(t)}var Xc=Zc;function Jc(t){return this.__data__.has(t)}var eu=Jc,tu=200;function iu(t,e){var i=this.__data__;if(i instanceof pt){var r=i.__data__;if(!Pe||r.length<tu-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new ln(r)}return i.set(t,e),this.size=i.size,this}var ru=iu;function Ue(t){var e=this.__data__=new pt(t);this.size=e.size}Ue.prototype.clear=Kc;Ue.prototype.delete=Yc;Ue.prototype.get=Xc;Ue.prototype.has=eu;Ue.prototype.set=ru;var nu=Object.prototype,vh=nu.propertyIsEnumerable,ou=le(N,"DataView"),ri=ou,su=le(N,"Promise"),ni=su,au=le(N,"Set"),oi=au,Gr="[object Map]",lu="[object Object]",Kr="[object Promise]",Wr="[object Set]",Yr="[object WeakMap]",Zr="[object DataView]",cu=ee(ri),uu=ee(Pe),du=ee(ni),pu=ee(oi),fu=ee(ii),se=De;(ri&&se(new ri(new ArrayBuffer(1)))!=Zr||Pe&&se(new Pe)!=Gr||ni&&se(ni.resolve())!=Kr||oi&&se(new oi)!=Wr||ii&&se(new ii)!=Yr)&&(se=function(t){var e=De(t),i=e==lu?t.constructor:void 0,r=i?ee(i):"";if(r)switch(r){case cu:return Zr;case uu:return Gr;case du:return Kr;case pu:return Wr;case fu:return Yr}return e});var wh=N.Uint8Array,hu="__lodash_hash_undefined__";function gu(t){return this.__data__.set(t,hu),this}var mu=gu;function yu(t){return this.__data__.has(t)}var bu=yu;function si(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new ln;++e<i;)this.add(t[e])}si.prototype.add=si.prototype.push=mu;si.prototype.has=bu;var Xr=ae?ae.prototype:void 0,xh=Xr?Xr.valueOf:void 0,vu=Object.prototype,kh=vu.hasOwnProperty,wu=Object.prototype,Ih=wu.hasOwnProperty,Eh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Ah=new RegExp(/[A-Fa-f0-9]{1}/,"g"),_h=new RegExp(/[A-Fa-f0-9]{2}/,"g");var ei="@imgly/plugin-ai-generation",Sh=`
6
6
  <svg>
7
7
  <symbol
8
8
  fill="none"
@@ -20,7 +20,7 @@ var Fn=Object.create;var br=Object.defineProperty;var Vn=Object.getOwnPropertyDe
20
20
  fill="none"
21
21
  xmlns="http://www.w3.org/2000/svg"
22
22
  viewBox="0 0 24 24"
23
- id="${er}/image"
23
+ id="${ei}/image"
24
24
  >
25
25
  <path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
26
26
  <path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
@@ -32,7 +32,7 @@ var Fn=Object.create;var br=Object.defineProperty;var Vn=Object.getOwnPropertyDe
32
32
  fill="none"
33
33
  xmlns="http://www.w3.org/2000/svg"
34
34
  viewBox="0 0 24 24"
35
- id="${er}/video"
35
+ id="${ei}/video"
36
36
  >
37
37
  <path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
38
38
  <path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
@@ -43,7 +43,7 @@ var Fn=Object.create;var br=Object.defineProperty;var Vn=Object.getOwnPropertyDe
43
43
  fill="none"
44
44
  xmlns="http://www.w3.org/2000/svg"
45
45
  viewBox="0 0 24 24"
46
- id="${er}/audio"
46
+ id="${ei}/audio"
47
47
  >
48
48
  <path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
49
49
  <path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
@@ -63,10 +63,10 @@ var Fn=Object.create;var br=Object.defineProperty;var Vn=Object.getOwnPropertyDe
63
63
 
64
64
  </symbol>
65
65
  </svg>
66
- `;var Ji="ly.img.ai.quickAction.order",Me="ly.img.ai.quickAction.actions";function xu(t,e){return{id:e,setQuickActionMenuOrder:r=>{t.ui.experimental.setGlobalStateValue(`${Ji}.${e}`,r)},getQuickActionMenuOrder:()=>t.ui.experimental.getGlobalStateValue(`${Ji}.${e}`,[]),registerQuickAction:r=>{if(!t.ui.experimental.hasGlobalStateValue(`${Me}.${e}`))t.ui.experimental.setGlobalStateValue(`${Me}.${e}`,{[r.id]:r});else{let i=t.ui.experimental.getGlobalStateValue(`${Me}.${e}`,{});t.ui.experimental.setGlobalStateValue(`${Me}.${e}`,{...i,[r.id]:r})}},getQuickAction:r=>t.ui.experimental.getGlobalStateValue(`${Me}.${e}`,{})[r]}}var cn=xu;function Eu(t){let e=t.quickAction.id;return{...t.quickAction,render:({builder:r},i)=>{r.Button(`${e}.button`,{label:`ly.img.ai.quickAction.${e}`,icon:"@imgly/Sparkle",labelAlignment:"left",variant:"plain",...t.buttonOptions,onClick:async()=>{try{t.onClick(i),i.closeMenu()}catch(n){i.handleGenerationError(n)}}})}}}var un=Eu;function Iu(){return({engine:t})=>{let e=t.block.findAllSelected();if(e==null||e.length!==1)return!1;let[r]=e;if(t.block.getType(r)!=="//ly.img.ubq/graphic"&&!t.block.supportsFill(r))return!1;let i=t.block.getFill(r);return t.block.getType(i)==="//ly.img.ubq/fill/image"}}var dn=Iu;var pn={ImageUrl:Ia};var lr=vr(Yt());function ku(t,e){let r=t.middleware??[];e.debug&&r.unshift(en());let i={id:t.modelKey,kind:"video",initialize:async n=>{lr.fal.config({proxyUrl:e.proxyUrl}),t.initialize?.(n)},input:{quickActions:{actions:t.quickActions??[]},panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?pn.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 Ni(n.image_url,t.cesdk),a=await lr.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=ku;function fn(t){return async({cesdk:e})=>_u(e,t)}function _u(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live",schema:wr,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",middleware:e.middleware,cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var Au=typeof global=="object"&&global&&global.Object===Object&&global,Cn=Au,Su=typeof self=="object"&&self&&self.Object===Object&&self,Cu=Cn||Su||Function("return this")(),B=Cu,Tu=B.Symbol,he=Tu,Tn=Object.prototype,Mu=Tn.hasOwnProperty,Ou=Tn.toString,$e=he?he.toStringTag:void 0;function ju(t){var e=Mu.call(t,$e),r=t[$e];try{t[$e]=void 0;var i=!0}catch{}var n=Ou.call(t);return i&&(e?t[$e]=r:delete t[$e]),n}var Pu=ju,Du=Object.prototype,Uu=Du.toString;function $u(t){return Uu.call(t)}var Lu=$u,Nu="[object Null]",qu="[object Undefined]",hn=he?he.toStringTag:void 0;function Bu(t){return t==null?t===void 0?qu:Nu:hn&&hn in Object(t)?Pu(t):Lu(t)}var Be=Bu;function Ru(t){return t!=null&&typeof t=="object"}var mr=Ru,Rh=Array.isArray;function Fu(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Mn=Fu,Vu="[object AsyncFunction]",zu="[object Function]",Hu="[object GeneratorFunction]",Qu="[object Proxy]";function Gu(t){if(!Mn(t))return!1;var e=Be(t);return e==zu||e==Hu||e==Vu||e==Qu}var Ku=Gu,Wu=B["__core-js_shared__"],cr=Wu,gn=function(){var t=/[^.]+$/.exec(cr&&cr.keys&&cr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Yu(t){return!!gn&&gn in t}var Zu=Yu,Xu=Function.prototype,Ju=Xu.toString;function ed(t){if(t!=null){try{return Ju.call(t)}catch{}try{return t+""}catch{}}return""}var te=ed,td=/[\\^$.*+?()[\]{}|]/g,rd=/^\[object .+?Constructor\]$/,id=Function.prototype,nd=Object.prototype,od=id.toString,sd=nd.hasOwnProperty,ad=RegExp("^"+od.call(sd).replace(td,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(t){if(!Mn(t)||Zu(t))return!1;var e=Ku(t)?ad:rd;return e.test(te(t))}var cd=ld;function ud(t,e){return t?.[e]}var dd=ud;function pd(t,e){var r=dd(t,e);return cd(r)?r:void 0}var ge=pd,fd=ge(B,"WeakMap"),dr=fd;function hd(t,e){return t===e||t!==t&&e!==e}var gd=hd,md=9007199254740991;function yd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=md}var bd=yd;var Fh=Object.prototype;var vd="[object Arguments]";function wd(t){return mr(t)&&Be(t)==vd}var mn=wd,On=Object.prototype,xd=On.hasOwnProperty,Ed=On.propertyIsEnumerable,Vh=mn(function(){return arguments}())?mn:function(t){return mr(t)&&xd.call(t,"callee")&&!Ed.call(t,"callee")};var jn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yn=jn&&typeof module=="object"&&module&&!module.nodeType&&module,Id=yn&&yn.exports===jn,bn=Id?B.Buffer:void 0,zh=bn?bn.isBuffer:void 0;var kd="[object Arguments]",_d="[object Array]",Ad="[object Boolean]",Sd="[object Date]",Cd="[object Error]",Td="[object Function]",Md="[object Map]",Od="[object Number]",jd="[object Object]",Pd="[object RegExp]",Dd="[object Set]",Ud="[object String]",$d="[object WeakMap]",Ld="[object ArrayBuffer]",Nd="[object DataView]",qd="[object Float32Array]",Bd="[object Float64Array]",Rd="[object Int8Array]",Fd="[object Int16Array]",Vd="[object Int32Array]",zd="[object Uint8Array]",Hd="[object Uint8ClampedArray]",Qd="[object Uint16Array]",Gd="[object Uint32Array]",I={};I[qd]=I[Bd]=I[Rd]=I[Fd]=I[Vd]=I[zd]=I[Hd]=I[Qd]=I[Gd]=!0;I[kd]=I[_d]=I[Ld]=I[Ad]=I[Nd]=I[Sd]=I[Cd]=I[Td]=I[Md]=I[Od]=I[jd]=I[Pd]=I[Dd]=I[Ud]=I[$d]=!1;function Kd(t){return mr(t)&&bd(t.length)&&!!I[Be(t)]}var Wd=Kd;function Yd(t){return function(e){return t(e)}}var Zd=Yd,Pn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=Pn&&typeof module=="object"&&module&&!module.nodeType&&module,Xd=Le&&Le.exports===Pn,ur=Xd&&Cn.process,Jd=function(){try{var t=Le&&Le.require&&Le.require("util").types;return t||ur&&ur.binding&&ur.binding("util")}catch{}}(),vn=Jd,wn=vn&&vn.isTypedArray,Hh=wn?Zd(wn):Wd;var ep=Object.prototype,Qh=ep.hasOwnProperty;function tp(t,e){return function(r){return t(e(r))}}var rp=tp,Gh=rp(Object.keys,Object);var ip=Object.prototype,Kh=ip.hasOwnProperty;var np=ge(Object,"create"),Ne=np;function op(){this.__data__=Ne?Ne(null):{},this.size=0}var sp=op;function ap(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var lp=ap,cp="__lodash_hash_undefined__",up=Object.prototype,dp=up.hasOwnProperty;function pp(t){var e=this.__data__;if(Ne){var r=e[t];return r===cp?void 0:r}return dp.call(e,t)?e[t]:void 0}var fp=pp,hp=Object.prototype,gp=hp.hasOwnProperty;function mp(t){var e=this.__data__;return Ne?e[t]!==void 0:gp.call(e,t)}var yp=mp,bp="__lodash_hash_undefined__";function vp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ne&&e===void 0?bp:e,this}var wp=vp;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=sp;me.prototype.delete=lp;me.prototype.get=fp;me.prototype.has=yp;me.prototype.set=wp;var xn=me;function xp(){this.__data__=[],this.size=0}var Ep=xp;function Ip(t,e){for(var r=t.length;r--;)if(gd(t[r][0],e))return r;return-1}var ht=Ip,kp=Array.prototype,_p=kp.splice;function Ap(t){var e=this.__data__,r=ht(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():_p.call(e,r,1),--this.size,!0}var Sp=Ap;function Cp(t){var e=this.__data__,r=ht(e,t);return r<0?void 0:e[r][1]}var Tp=Cp;function Mp(t){return ht(this.__data__,t)>-1}var Op=Mp;function jp(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 Pp=jp;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=Ep;ye.prototype.delete=Sp;ye.prototype.get=Tp;ye.prototype.has=Op;ye.prototype.set=Pp;var gt=ye,Dp=ge(B,"Map"),qe=Dp;function Up(){this.size=0,this.__data__={hash:new xn,map:new(qe||gt),string:new xn}}var $p=Up;function Lp(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Np=Lp;function qp(t,e){var r=t.__data__;return Np(e)?r[typeof e=="string"?"string":"hash"]:r.map}var mt=qp;function Bp(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e}var Rp=Bp;function Fp(t){return mt(this,t).get(t)}var Vp=Fp;function zp(t){return mt(this,t).has(t)}var Hp=zp;function Qp(t,e){var r=mt(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}var Gp=Qp;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=$p;be.prototype.delete=Rp;be.prototype.get=Vp;be.prototype.has=Hp;be.prototype.set=Gp;var Dn=be;function Kp(){this.__data__=new gt,this.size=0}var Wp=Kp;function Yp(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Zp=Yp;function Xp(t){return this.__data__.get(t)}var Jp=Xp;function ef(t){return this.__data__.has(t)}var tf=ef,rf=200;function nf(t,e){var r=this.__data__;if(r instanceof gt){var i=r.__data__;if(!qe||i.length<rf-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Dn(i)}return r.set(t,e),this.size=r.size,this}var of=nf;function Re(t){var e=this.__data__=new gt(t);this.size=e.size}Re.prototype.clear=Wp;Re.prototype.delete=Zp;Re.prototype.get=Jp;Re.prototype.has=tf;Re.prototype.set=of;var sf=Object.prototype,Wh=sf.propertyIsEnumerable;var af=ge(B,"DataView"),pr=af,lf=ge(B,"Promise"),fr=lf,cf=ge(B,"Set"),hr=cf,En="[object Map]",uf="[object Object]",In="[object Promise]",kn="[object Set]",_n="[object WeakMap]",An="[object DataView]",df=te(pr),pf=te(qe),ff=te(fr),hf=te(hr),gf=te(dr),fe=Be;(pr&&fe(new pr(new ArrayBuffer(1)))!=An||qe&&fe(new qe)!=En||fr&&fe(fr.resolve())!=In||hr&&fe(new hr)!=kn||dr&&fe(new dr)!=_n)&&(fe=function(t){var e=Be(t),r=e==uf?t.constructor:void 0,i=r?te(r):"";if(i)switch(i){case df:return An;case pf:return En;case ff:return In;case hf:return kn;case gf:return _n}return e});var Yh=B.Uint8Array;var mf="__lodash_hash_undefined__";function yf(t){return this.__data__.set(t,mf),this}var bf=yf;function vf(t){return this.__data__.has(t)}var wf=vf;function gr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Dn;++e<r;)this.add(t[e])}gr.prototype.add=gr.prototype.push=bf;gr.prototype.has=wf;var Sn=he?he.prototype:void 0,Zh=Sn?Sn.valueOf:void 0;var xf=Object.prototype,Xh=xf.hasOwnProperty;var Ef=Object.prototype,Jh=Ef.hasOwnProperty;var eg=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),tg=new RegExp(/[A-Fa-f0-9]{1}/,"g"),rg=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function Un(t,e){if(t.startsWith("buffer:")){let r=await e.editor.getMimeType(t),i=e.editor.getBufferLength(t),n=e.editor.getBufferData(t,0,i),o=new Blob([n],{type:r});return URL.createObjectURL(o)}else return t}async function $n(t,e){let r=await Un(t,e);return new Promise((i,n)=>{let o=new Image;o.onload=()=>{i({width:o.width,height:o.height})},o.onerror=n,o.src=r})}async function Ln(t,e,r){let i,n=e.block.getFill(t),o=e.block.getSourceSet(n,"fill/image/sourceSet"),[s]=o;if(s==null){if(i=e.block.getString(n,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=s.uri;if(r?.throwErrorIfSvg&&await e.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return Un(i,e)}var Nn={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 qn(t){return async({cesdk:e})=>kf(e,t)}function kf(t,e){let r=_f(t),i=cn(t,"image");return i.setQuickActionMenuOrder([...i.getQuickActionMenuOrder(),"ly.img.separator","createVideo"]),pe({modelKey:"fal-ai/minimax/video-01-live/image-to-video",schema:Nn,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,middleware:e.middleware,quickActions:r,getBlockInput:async n=>{let o=await $n(n.image_url,t.engine);return Promise.resolve({video:{width:o.width??1280,height:o.height??720,duration:5}})}},e)}function _f(t){return t.i18n.setTranslations({en:{"ly.img.ai.quickAction.createVideo":"Create Video..."}}),[un({quickAction:{id:"createVideo",kind:"image",version:"1",enable:dn()},buttonOptions:{icon:"@imgly/plugin-ai-generation/video"},onClick:async()=>{let[e]=t.engine.block.findAllSelected(),r=await Ln(e,t.engine,{throwErrorIfSvg:!0});t.ui.openPanel("ly.img.ai/video-generation"),t.ui.experimental.setGlobalStateValue("ly.img.ai.video-generation.fromType","fromImage"),t.ui.experimental.setGlobalStateValue("fal-ai/minimax/video-01-live/image-to-video.image_url",r)}})]}var Bn={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 Jr="ly.img.ai.quickAction.order",Me="ly.img.ai.quickAction.actions";function xu(t,e){return{id:e,setQuickActionMenuOrder:i=>{t.ui.experimental.setGlobalStateValue(`${Jr}.${e}`,i)},getQuickActionMenuOrder:()=>t.ui.experimental.getGlobalStateValue(`${Jr}.${e}`,[]),registerQuickAction:i=>{if(!t.ui.experimental.hasGlobalStateValue(`${Me}.${e}`))t.ui.experimental.setGlobalStateValue(`${Me}.${e}`,{[i.id]:i});else{let r=t.ui.experimental.getGlobalStateValue(`${Me}.${e}`,{});t.ui.experimental.setGlobalStateValue(`${Me}.${e}`,{...r,[i.id]:i})}},getQuickAction:i=>t.ui.experimental.getGlobalStateValue(`${Me}.${e}`,{})[i]}}var cn=xu;function ku(t){let e=t.quickAction.id;return{confirmation:!0,lockDuringConfirmation:!1,...t.quickAction,render:({builder:i},r)=>{i.Button(`${e}.button`,{label:`ly.img.ai.quickAction.${e}`,icon:"@imgly/Sparkle",labelAlignment:"left",variant:"plain",...t.buttonOptions,onClick:async()=>{try{t.onClick(r),r.closeMenu()}catch(n){r.handleGenerationError(n)}}})}}}var un=ku;function Iu(){return({engine:t})=>{let e=t.block.findAllSelected();if(e==null||e.length!==1)return!1;let[i]=e;if(!t.block.supportsFill(i)||!["//ly.img.ubq/graphic","//ly.img.ubq/page"].includes(t.block.getType(i)))return!1;let r=t.block.getFill(i);return t.block.getType(r)==="//ly.img.ubq/fill/image"}}var dn=Iu;var pn={ImageUrl:Ia};var li=vi(Yt());function Eu(t,e){let i=t.middleware??[];e.debug&&i.unshift(en());let r={id:t.modelKey,kind:"video",initialize:async n=>{li.fal.config({proxyUrl:e.proxyUrl}),t.initialize?.(n)},input:{quickActions:{actions:t.quickActions??[]},panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?pn.ImageUrl(t.modelKey,{cesdk:t.cesdk}):{},...t.renderCustomProperty},getBlockInput:t.getBlockInput,userFlow:t.useFlow??"placeholder"}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:i,generate:async(n,{abortSignal:o})=>{let s=await qr(n.image_url,t.cesdk),a=await li.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:",r),r}var pe=Eu;function fn(t){return async({cesdk:e})=>Au(e,t)}function Au(t,e){return pe({modelKey:"fal-ai/minimax/video-01-live",schema:wi,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",middleware:e.middleware,cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var _u=typeof global=="object"&&global&&global.Object===Object&&global,Cn=_u,Su=typeof self=="object"&&self&&self.Object===Object&&self,Cu=Cn||Su||Function("return this")(),B=Cu,Tu=B.Symbol,he=Tu,Tn=Object.prototype,Mu=Tn.hasOwnProperty,Ou=Tn.toString,$e=he?he.toStringTag:void 0;function ju(t){var e=Mu.call(t,$e),i=t[$e];try{t[$e]=void 0;var r=!0}catch{}var n=Ou.call(t);return r&&(e?t[$e]=i:delete t[$e]),n}var Pu=ju,Du=Object.prototype,Uu=Du.toString;function $u(t){return Uu.call(t)}var Lu=$u,qu="[object Null]",Nu="[object Undefined]",hn=he?he.toStringTag:void 0;function Bu(t){return t==null?t===void 0?Nu:qu:hn&&hn in Object(t)?Pu(t):Lu(t)}var Be=Bu;function Ru(t){return t!=null&&typeof t=="object"}var mi=Ru,Rh=Array.isArray;function Fu(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Mn=Fu,Vu="[object AsyncFunction]",zu="[object Function]",Hu="[object GeneratorFunction]",Qu="[object Proxy]";function Gu(t){if(!Mn(t))return!1;var e=Be(t);return e==zu||e==Hu||e==Vu||e==Qu}var Ku=Gu,Wu=B["__core-js_shared__"],ci=Wu,gn=function(){var t=/[^.]+$/.exec(ci&&ci.keys&&ci.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Yu(t){return!!gn&&gn in t}var Zu=Yu,Xu=Function.prototype,Ju=Xu.toString;function ed(t){if(t!=null){try{return Ju.call(t)}catch{}try{return t+""}catch{}}return""}var te=ed,td=/[\\^$.*+?()[\]{}|]/g,id=/^\[object .+?Constructor\]$/,rd=Function.prototype,nd=Object.prototype,od=rd.toString,sd=nd.hasOwnProperty,ad=RegExp("^"+od.call(sd).replace(td,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(t){if(!Mn(t)||Zu(t))return!1;var e=Ku(t)?ad:id;return e.test(te(t))}var cd=ld;function ud(t,e){return t?.[e]}var dd=ud;function pd(t,e){var i=dd(t,e);return cd(i)?i:void 0}var ge=pd,fd=ge(B,"WeakMap"),di=fd;function hd(t,e){return t===e||t!==t&&e!==e}var gd=hd,md=9007199254740991;function yd(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=md}var bd=yd;var Fh=Object.prototype;var vd="[object Arguments]";function wd(t){return mi(t)&&Be(t)==vd}var mn=wd,On=Object.prototype,xd=On.hasOwnProperty,kd=On.propertyIsEnumerable,Vh=mn(function(){return arguments}())?mn:function(t){return mi(t)&&xd.call(t,"callee")&&!kd.call(t,"callee")};var jn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yn=jn&&typeof module=="object"&&module&&!module.nodeType&&module,Id=yn&&yn.exports===jn,bn=Id?B.Buffer:void 0,zh=bn?bn.isBuffer:void 0;var Ed="[object Arguments]",Ad="[object Array]",_d="[object Boolean]",Sd="[object Date]",Cd="[object Error]",Td="[object Function]",Md="[object Map]",Od="[object Number]",jd="[object Object]",Pd="[object RegExp]",Dd="[object Set]",Ud="[object String]",$d="[object WeakMap]",Ld="[object ArrayBuffer]",qd="[object DataView]",Nd="[object Float32Array]",Bd="[object Float64Array]",Rd="[object Int8Array]",Fd="[object Int16Array]",Vd="[object Int32Array]",zd="[object Uint8Array]",Hd="[object Uint8ClampedArray]",Qd="[object Uint16Array]",Gd="[object Uint32Array]",I={};I[Nd]=I[Bd]=I[Rd]=I[Fd]=I[Vd]=I[zd]=I[Hd]=I[Qd]=I[Gd]=!0;I[Ed]=I[Ad]=I[Ld]=I[_d]=I[qd]=I[Sd]=I[Cd]=I[Td]=I[Md]=I[Od]=I[jd]=I[Pd]=I[Dd]=I[Ud]=I[$d]=!1;function Kd(t){return mi(t)&&bd(t.length)&&!!I[Be(t)]}var Wd=Kd;function Yd(t){return function(e){return t(e)}}var Zd=Yd,Pn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=Pn&&typeof module=="object"&&module&&!module.nodeType&&module,Xd=Le&&Le.exports===Pn,ui=Xd&&Cn.process,Jd=function(){try{var t=Le&&Le.require&&Le.require("util").types;return t||ui&&ui.binding&&ui.binding("util")}catch{}}(),vn=Jd,wn=vn&&vn.isTypedArray,Hh=wn?Zd(wn):Wd;var ep=Object.prototype,Qh=ep.hasOwnProperty;function tp(t,e){return function(i){return t(e(i))}}var ip=tp,Gh=ip(Object.keys,Object);var rp=Object.prototype,Kh=rp.hasOwnProperty;var np=ge(Object,"create"),qe=np;function op(){this.__data__=qe?qe(null):{},this.size=0}var sp=op;function ap(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var lp=ap,cp="__lodash_hash_undefined__",up=Object.prototype,dp=up.hasOwnProperty;function pp(t){var e=this.__data__;if(qe){var i=e[t];return i===cp?void 0:i}return dp.call(e,t)?e[t]:void 0}var fp=pp,hp=Object.prototype,gp=hp.hasOwnProperty;function mp(t){var e=this.__data__;return qe?e[t]!==void 0:gp.call(e,t)}var yp=mp,bp="__lodash_hash_undefined__";function vp(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=qe&&e===void 0?bp:e,this}var wp=vp;function me(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}me.prototype.clear=sp;me.prototype.delete=lp;me.prototype.get=fp;me.prototype.has=yp;me.prototype.set=wp;var xn=me;function xp(){this.__data__=[],this.size=0}var kp=xp;function Ip(t,e){for(var i=t.length;i--;)if(gd(t[i][0],e))return i;return-1}var ht=Ip,Ep=Array.prototype,Ap=Ep.splice;function _p(t){var e=this.__data__,i=ht(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Ap.call(e,i,1),--this.size,!0}var Sp=_p;function Cp(t){var e=this.__data__,i=ht(e,t);return i<0?void 0:e[i][1]}var Tp=Cp;function Mp(t){return ht(this.__data__,t)>-1}var Op=Mp;function jp(t,e){var i=this.__data__,r=ht(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var Pp=jp;function ye(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}ye.prototype.clear=kp;ye.prototype.delete=Sp;ye.prototype.get=Tp;ye.prototype.has=Op;ye.prototype.set=Pp;var gt=ye,Dp=ge(B,"Map"),Ne=Dp;function Up(){this.size=0,this.__data__={hash:new xn,map:new(Ne||gt),string:new xn}}var $p=Up;function Lp(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qp=Lp;function Np(t,e){var i=t.__data__;return qp(e)?i[typeof e=="string"?"string":"hash"]:i.map}var mt=Np;function Bp(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e}var Rp=Bp;function Fp(t){return mt(this,t).get(t)}var Vp=Fp;function zp(t){return mt(this,t).has(t)}var Hp=zp;function Qp(t,e){var i=mt(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var Gp=Qp;function be(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}be.prototype.clear=$p;be.prototype.delete=Rp;be.prototype.get=Vp;be.prototype.has=Hp;be.prototype.set=Gp;var Dn=be;function Kp(){this.__data__=new gt,this.size=0}var Wp=Kp;function Yp(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var Zp=Yp;function Xp(t){return this.__data__.get(t)}var Jp=Xp;function ef(t){return this.__data__.has(t)}var tf=ef,rf=200;function nf(t,e){var i=this.__data__;if(i instanceof gt){var r=i.__data__;if(!Ne||r.length<rf-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new Dn(r)}return i.set(t,e),this.size=i.size,this}var of=nf;function Re(t){var e=this.__data__=new gt(t);this.size=e.size}Re.prototype.clear=Wp;Re.prototype.delete=Zp;Re.prototype.get=Jp;Re.prototype.has=tf;Re.prototype.set=of;var sf=Object.prototype,Wh=sf.propertyIsEnumerable;var af=ge(B,"DataView"),pi=af,lf=ge(B,"Promise"),fi=lf,cf=ge(B,"Set"),hi=cf,kn="[object Map]",uf="[object Object]",In="[object Promise]",En="[object Set]",An="[object WeakMap]",_n="[object DataView]",df=te(pi),pf=te(Ne),ff=te(fi),hf=te(hi),gf=te(di),fe=Be;(pi&&fe(new pi(new ArrayBuffer(1)))!=_n||Ne&&fe(new Ne)!=kn||fi&&fe(fi.resolve())!=In||hi&&fe(new hi)!=En||di&&fe(new di)!=An)&&(fe=function(t){var e=Be(t),i=e==uf?t.constructor:void 0,r=i?te(i):"";if(r)switch(r){case df:return _n;case pf:return kn;case ff:return In;case hf:return En;case gf:return An}return e});var Yh=B.Uint8Array;var mf="__lodash_hash_undefined__";function yf(t){return this.__data__.set(t,mf),this}var bf=yf;function vf(t){return this.__data__.has(t)}var wf=vf;function gi(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new Dn;++e<i;)this.add(t[e])}gi.prototype.add=gi.prototype.push=bf;gi.prototype.has=wf;var Sn=he?he.prototype:void 0,Zh=Sn?Sn.valueOf:void 0;var xf=Object.prototype,Xh=xf.hasOwnProperty;var kf=Object.prototype,Jh=kf.hasOwnProperty;var eg=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),tg=new RegExp(/[A-Fa-f0-9]{1}/,"g"),ig=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function Un(t,e){if(t.startsWith("buffer:")){let i=await e.editor.getMimeType(t),r=e.editor.getBufferLength(t),n=e.editor.getBufferData(t,0,r),o=new Blob([n],{type:i});return URL.createObjectURL(o)}else return t}async function $n(t,e){let i=await Un(t,e);return new Promise((r,n)=>{let o=new Image;o.onload=()=>{r({width:o.width,height:o.height})},o.onerror=n,o.src=i})}async function Ln(t,e,i){let r,n=e.block.getFill(t),o=e.block.getSourceSet(n,"fill/image/sourceSet"),[s]=o;if(s==null){if(r=e.block.getString(n,"fill/image/imageFileURI"),r==null)throw new Error("No image source/uri found")}else r=s.uri;if(i?.throwErrorIfSvg&&await e.editor.getMimeType(r)==="image/svg+xml")throw new Error("SVG images are not supported");return Un(r,e)}var qn={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 Nn(t){return async({cesdk:e})=>Ef(e,t)}function Ef(t,e){let i=Af(t),r=cn(t,"image");return r.setQuickActionMenuOrder([...r.getQuickActionMenuOrder(),"ly.img.separator","createVideo"]),pe({modelKey:"fal-ai/minimax/video-01-live/image-to-video",schema:qn,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,middleware:e.middleware,quickActions:i,getBlockInput:async n=>{let o=await $n(n.image_url,t.engine);return Promise.resolve({video:{width:o.width??1280,height:o.height??720,duration:5}})}},e)}function Af(t){return t.i18n.setTranslations({en:{"ly.img.ai.quickAction.createVideo":"Create Video..."}}),[un({quickAction:{id:"createVideo",kind:"image",version:"1",enable:dn()},buttonOptions:{icon:"@imgly/plugin-ai-generation/video"},onClick:async()=>{let[e]=t.engine.block.findAllSelected(),i=await Ln(e,t.engine,{throwErrorIfSvg:!0});t.ui.openPanel("ly.img.ai/video-generation"),t.ui.experimental.setGlobalStateValue("ly.img.ai.video-generation.fromType","fromImage"),t.ui.experimental.setGlobalStateValue("fal-ai/minimax/video-01-live/image-to-video.image_url",i)}})]}var Bn={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 Rn(t){return async({cesdk:e})=>Sf(e,t)}function Sf(t,e){return pe({modelKey:"fal-ai/pixverse/v3.5/text-to-video",schema:Bn,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 Cf={MinimaxVideo01Live:fn,MinimaxVideo01LiveImageToVideo:qn,PixverseV35TextToVideo:Rn},wg=Cf;export{wg as default};
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 Rn(t){return async({cesdk:e})=>Sf(e,t)}function Sf(t,e){return pe({modelKey:"fal-ai/pixverse/v3.5/text-to-video",schema:Bn,inputReference:"#/components/schemas/PixverseV35TextToVideoInput",cesdk:t,middleware:e.middleware,getBlockInput:i=>{if(i.aspect_ratio!=null&&i.resolution!=null){let[r,n]=i.aspect_ratio.split(":").map(Number),o=parseInt(i.resolution,10),s=Math.round(o*r/n);if(i.duration!=null){let a=typeof i.duration=="string"?parseInt(i.duration,10):i.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 Cf={MinimaxVideo01Live:fn,MinimaxVideo01LiveImageToVideo:Nn,PixverseV35TextToVideo:Rn},wg=Cf;export{wg as default};
70
70
  /*! Bundled license information:
71
71
 
72
72
  @imgly/plugin-ai-generation-web/dist/index.mjs: