@imgly/plugin-ai-video-generation-web 1.75.0-rc.1 → 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var Mo=Object.create;var Di=Object.defineProperty;var Do=Object.getOwnPropertyDescriptor;var jo=Object.getOwnPropertyNames;var Fo=Object.getPrototypeOf,Oo=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ro=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of jo(e))!Oo.call(t,n)&&n!==i&&Di(t,n,{get:()=>e[n],enumerable:!(r=Do(e,n))||r.enumerable});return t};var Lo=(t,e,i)=>(i=t!=null?Mo(Fo(t)):{},Ro(e||!t||!t.__esModule?Di(i,"default",{value:t,enumerable:!0}):i,t));var $t=T($=>{"use strict";var eu=$&&$.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty($,"__esModule",{value:!0});$.TARGET_URL_HEADER=void 0;$.withMiddleware=tu;$.withProxy=iu;function tu(...t){let e=i=>typeof i=="function";return i=>eu(this,void 0,void 0,function*(){let r=Object.assign({},i);for(let n of t.filter(e))r=yield n(r);return r})}$.TARGET_URL_HEADER="x-fal-target-url";function iu(t){let e=i=>Promise.resolve(i);return typeof window>"u"?e:i=>i.headers&&$.TARGET_URL_HEADER in i?e(i):Promise.resolve(Object.assign(Object.assign({},i),{url:t.targetUrl,headers:Object.assign(Object.assign({},i.headers||{}),{[$.TARGET_URL_HEADER]:i.url})}))}});var J=T(N=>{"use strict";var or=N&&N.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(N,"__esModule",{value:!0});N.ValidationError=N.ApiError=void 0;N.defaultResponseHandler=ar;N.resultResponseHandler=ru;var sr="x-fal-request-id",we=class extends Error{constructor({message:e,status:i,body:r,requestId:n}){super(e),this.name="ApiError",this.status=i,this.body=r,this.requestId=n||""}};N.ApiError=we;var ot=class extends we{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)}};N.ValidationError=ot;function ar(t){return or(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:"",o=t.headers.get(sr)||void 0;if(!t.ok){if(n.includes("application/json")){let s=yield t.json(),l=i===422?ot:we;throw new l({message:s.message||r,status:i,body:s,requestId:o})}throw new we({message:`HTTP ${i}: ${r}`,status:i,requestId:o})}return n.includes("application/json")?t.json():n.includes("text/html")?t.text():n.includes("application/octet-stream")?t.arrayBuffer():t.text()})}function ru(t){return or(this,void 0,void 0,function*(){return{data:yield ar(t),requestId:t.headers.get(sr)||""}})}});var X=T(R=>{"use strict";var nu=R&&R.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(R,"__esModule",{value:!0});R.ensureEndpointIdFormat=lr;R.parseEndpointId=su;R.isValidUrl=au;R.throttle=lu;R.isReact=uu;R.isPlainObject=du;R.sleep=cu;function lr(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 ou=["workflows","comfy"];function su(t){let i=lr(t).split("/");return ou.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 au(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function lu(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 Nt;function uu(){if(Nt===void 0){let t=new Error().stack;Nt=!!t&&(t.includes("node_modules/react-dom/")||t.includes("node_modules/next/"))}return Nt}function du(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}function cu(t){return nu(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}});var Ue=T(V=>{"use strict";var pu=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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(V,"__esModule",{value:!0});V.DEFAULT_RETRY_OPTIONS=V.DEFAULT_RETRYABLE_STATUS_CODES=void 0;V.isRetryableError=ur;V.calculateBackoffDelay=dr;V.executeWithRetry=gu;var mu=J(),fu=X();V.DEFAULT_RETRYABLE_STATUS_CODES=[429,502,503,504];V.DEFAULT_RETRY_OPTIONS={maxRetries:3,baseDelay:1e3,maxDelay:3e4,backoffMultiplier:2,retryableStatusCodes:V.DEFAULT_RETRYABLE_STATUS_CODES,enableJitter:!0};function ur(t,e){return t instanceof mu.ApiError&&e.includes(t.status)}function dr(t,e,i,r,n){let o=Math.min(e*Math.pow(r,t),i);if(n){let s=.25*o*(Math.random()*2-1);return Math.max(0,o+s)}return o}function gu(t,e,i){return pu(this,void 0,void 0,function*(){let r={totalAttempts:0,totalDelay:0},n;for(let o=0;o<=e.maxRetries;o++){r.totalAttempts++;try{return{result:yield t(),metrics:r}}catch(s){if(n=s,r.lastError=s,o===e.maxRetries||!ur(s,e.retryableStatusCodes))throw s;let l=dr(o,e.baseDelay,e.maxDelay,e.backoffMultiplier,e.enableJitter);r.totalDelay+=l,i&&i(o+1,s,l),yield(0,fu.sleep)(l)}}throw n})}});var cr=T((Ug,hu)=>{hu.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.8.3",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:">=22.0.0"},type:"commonjs"}});var lt=T(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.isBrowser=yu;at.getUserAgent=bu;function yu(){return typeof window<"u"&&typeof window.document<"u"}var st=null;function bu(){if(st!==null)return st;let t=cr();return st=`${t.name}/${t.version}`,st}});var ut=T(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.credentialsFromEnv=void 0;ee.resolveDefaultFetch=fr;ee.createConfig=Iu;ee.getRestApiUrl=Su;var pr=$t(),vu=J(),mr=Ue(),wu=lt();function fr(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function _u(){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 xu=()=>{if(_u())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};ee.credentialsFromEnv=xu;var Tu={credentials:ee.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:vu.defaultResponseHandler,retry:mr.DEFAULT_RETRY_OPTIONS};function Iu(t){var e;let i=Object.assign(Object.assign(Object.assign({},Tu),t),{fetch:(e=t.fetch)!==null&&e!==void 0?e:fr(),retry:Object.assign(Object.assign({},mr.DEFAULT_RETRY_OPTIONS),t.retry||{})});t.proxyUrl&&(i=Object.assign(Object.assign({},i),{requestMiddleware:(0,pr.withMiddleware)(i.requestMiddleware,(0,pr.withProxy)({targetUrl:t.proxyUrl}))}));let{credentials:r,suppressLocalCredentialsWarning:n}=i,o=typeof r=="function"?r():r;return(0,wu.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 Su(){return"https://rest.alpha.fal.ai"}});var _e=T(te=>{"use strict";var gr=te&&te.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},Eu=te&&te.__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(te,"__esModule",{value:!0});te.dispatchRequest=Cu;te.buildUrl=ku;var hr=Ue(),yr=lt(),zt=X(),Au=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function Cu(t){return gr(this,void 0,void 0,function*(){var e;let{targetUrl:i,input:r,config:n,options:o={}}=t,{credentials:s,requestMiddleware:l,responseHandler:u,fetch:d}=n,a=Object.assign(Object.assign({},n.retry),o.retry||{}),c=()=>gr(this,void 0,void 0,function*(){var p,f,h;let v=(0,yr.isBrowser)()?{}:{"User-Agent":(0,yr.getUserAgent)()},g=typeof s=="function"?s():s,{method:b,url:I,headers:x}=yield l({method:((f=(p=t.method)!==null&&p!==void 0?p:o.method)!==null&&f!==void 0?f:"post").toUpperCase(),url:i,headers:t.headers}),U=g?{Authorization:`Key ${g}`}:{},Ve=Object.assign(Object.assign(Object.assign(Object.assign({},U),{Accept:"application/json","Content-Type":"application/json"}),v),x??{}),{responseHandler:se,retry:F}=o,q=Eu(o,["responseHandler","retry"]),O=yield d(I,Object.assign(Object.assign(Object.assign(Object.assign({},q),{method:b,headers:Object.assign(Object.assign({},Ve),(h=q.headers)!==null&&h!==void 0?h:{})}),!Au&&{mode:"cors"}),{signal:o.signal,body:b.toLowerCase()!=="get"&&r?JSON.stringify(r):void 0}));return yield(se??u)(O)}),m;for(let p=0;p<=a.maxRetries;p++)try{return yield c()}catch(f){if(m=f,p===a.maxRetries||!(0,hr.isRetryableError)(f,a.retryableStatusCodes)||((e=o.signal)===null||e===void 0?void 0:e.aborted))throw f;let v=(0,hr.calculateBackoffDelay)(p,a.baseDelay,a.maxDelay,a.backoffMultiplier,a.enableJitter);yield(0,zt.sleep)(v)}throw m})}function ku(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,l=Object.assign(Object.assign({},e.query||{}),n==="get"?s:{}),u=Object.keys(l).length>0?`?${new URLSearchParams(l).toString()}`:"";if((0,zt.isValidUrl)(t))return`${t.endsWith("/")?t:`${t}/`}${o}${u}`;let d=(0,zt.ensureEndpointIdFormat)(t);return`${`https://${e.subdomain?`${e.subdomain}.`:""}fal.run/${d}/${o}`.replace(/\/$/,"")}${u}`}});var Kt=T(z=>{"use strict";var le=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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(z,"__esModule",{value:!0});z.OBJECT_LIFECYCYLE_PREFERENCE_HEADER=void 0;z.getExpirationDurationSeconds=Bt;z.buildObjectLifecycleHeaders=Vu;z.createStorageClient=Fu;var br=ut(),vr=_e(),Pu=X();z.OBJECT_LIFECYCYLE_PREFERENCE_HEADER="x-fal-object-lifecycle-preference";var qu={never:31536e5,immediate:void 0,"1h":3600,"1d":86400,"7d":604800,"30d":2592e3,"1y":31536e3};function Bt(t){let{expiresIn:e}=t;return typeof e=="number"?e:qu[e]}function Vu(t){if(!t)return{};let e=Bt(t);return e===void 0?{}:{[z.OBJECT_LIFECYCYLE_PREFERENCE_HEADER]:JSON.stringify({expiration_duration_seconds:e})}}function wr(t){var e;let[,i]=t.split("/");return(e=i.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}function Mu(t,e,i,r){return le(this,void 0,void 0,function*(){let n=t.name||`${Date.now()}.${wr(i)}`,o={};if(r){let s={expiration_duration_seconds:Bt(r),allow_io_storage:r.expiresIn!=="immediate"};o["X-Fal-Object-Lifecycle"]=JSON.stringify(s)}return yield(0,vr.dispatchRequest)({method:"POST",targetUrl:`${(0,br.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:n},config:e,headers:o})})}function Du(t,e,i,r){return le(this,void 0,void 0,function*(){let n=t.name||`${Date.now()}.${wr(i)}`,o={};return r&&(o["X-Fal-Object-Lifecycle"]=JSON.stringify(r)),yield(0,vr.dispatchRequest)({method:"POST",targetUrl:`${(0,br.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:n},config:e,headers:o})})}function _r(t,e,i){return le(this,arguments,void 0,function*(r,n,o,s=3){if(s===0)throw new Error("Part upload failed, retries exhausted");let{fetch:l,responseHandler:u}=o;try{let d=yield l(r,{method:"PUT",body:n});return yield u(d)}catch{return yield _r(r,n,o,s-1)}})}function ju(t,e,i){return le(this,void 0,void 0,function*(){let{fetch:r,responseHandler:n}=e,o=t.type||"application/octet-stream",{upload_url:s,file_url:l}=yield Du(t,e,o,i),u=10*1024*1024,d=Math.ceil(t.size/u),a=new URL(s),c=[];for(let f=0;f<d;f++){let h=f*u,v=Math.min(h+u,t.size),g=t.slice(h,v),b=f+1,I=`${a.origin}${a.pathname}/${b}${a.search}`;c.push(yield _r(I,g,e))}let m=`${a.origin}${a.pathname}/complete${a.search}`,p=yield r(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:c.map(f=>({partNumber:f.partNumber,etag:f.etag}))})});return yield n(p),l})}function Fu({config:t}){let e={upload:(i,r)=>le(this,void 0,void 0,function*(){let n=r?.lifecycle;if(i.size>94371840)return yield ju(i,t,n);let o=i.type||"application/octet-stream",{fetch:s,responseHandler:l}=t,{upload_url:u,file_url:d}=yield Mu(i,t,o,n),a=yield s(u,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield l(a),d}),transformInput:i=>le(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,Pu.isPlainObject)(i)){let n=Object.entries(i).map(s=>le(this,[s],void 0,function*([l,u]){return[l,yield e.transformInput(u)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return i})};return e}});var Tr=T(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});function Ou(t){let e,i,r,n,o,s,l;return u(),{feed:d,reset:u};function u(){e=!0,i="",r=0,n=-1,o=void 0,s=void 0,l=""}function d(c){i=i?i+c:c,e&&Ru(i)&&(i=i.slice(xr.length)),e=!1;let m=i.length,p=0,f=!1;for(;p<m;){f&&(i[p]===`
2
- `&&++p,f=!1);let h=-1,v=n,g;for(let b=r;h<0&&b<m;++b)g=i[b],g===":"&&v<0?v=b-p:g==="\r"?(f=!0,h=b-p):g===`
3
- `&&(h=b-p);if(h<0){r=m-p,n=v;break}else r=0,n=-1;a(i,p,v,h),p+=h+1}p===m?i="":p>0&&(i=i.slice(p))}function a(c,m,p,f){if(f===0){l.length>0&&(t({type:"event",id:o,event:s||void 0,data:l.slice(0,-1)}),l="",o=void 0),s=void 0;return}let h=p<0,v=c.slice(m,m+(h?f:p)),g=0;h?g=f:c[m+p+1]===" "?g=p+2:g=p+1;let b=m+g,I=f-g,x=c.slice(b,b+I).toString();if(v==="data")l+=x?"".concat(x,`
1
+ var Uo=Object.create;var Ui=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var No=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Bo=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $o(e))!zo.call(t,n)&&n!==i&&Ui(t,n,{get:()=>e[n],enumerable:!(r=Lo(e,n))||r.enumerable});return t};var Ko=(t,e,i)=>(i=t!=null?Uo(No(t)):{},Bo(e||!t||!t.__esModule?Ui(i,"default",{value:t,enumerable:!0}):i,t));var Kt=_(N=>{"use strict";var su=N&&N.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(N,"__esModule",{value:!0});N.TARGET_URL_HEADER=void 0;N.withMiddleware=au;N.withProxy=lu;function au(...t){let e=i=>typeof i=="function";return i=>su(this,void 0,void 0,function*(){let r=Object.assign({},i);for(let n of t.filter(e))r=yield n(r);return r})}N.TARGET_URL_HEADER="x-fal-target-url";function lu(t){let e=i=>Promise.resolve(i);return typeof window>"u"?e:i=>i.headers&&N.TARGET_URL_HEADER in i?e(i):Promise.resolve(Object.assign(Object.assign({},i),{url:t.targetUrl,headers:Object.assign(Object.assign({},i.headers||{}),{[N.TARGET_URL_HEADER]:i.url})}))}});var lt=_(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.RUNNER_HINT_HEADER=q.QUEUE_PRIORITY_HEADER=q.REQUEST_TIMEOUT_TYPE_HEADER=q.REQUEST_TIMEOUT_HEADER=q.MIN_REQUEST_TIMEOUT_SECONDS=void 0;q.validateTimeoutHeader=dr;q.buildTimeoutHeaders=uu;q.MIN_REQUEST_TIMEOUT_SECONDS=1;q.REQUEST_TIMEOUT_HEADER="x-fal-request-timeout";q.REQUEST_TIMEOUT_TYPE_HEADER="x-fal-request-timeout-type";q.QUEUE_PRIORITY_HEADER="x-fal-queue-priority";q.RUNNER_HINT_HEADER="x-fal-runner-hint";function dr(t){if(typeof t!="number"||isNaN(t))throw new Error(`Timeout must be a number, got ${t}`);if(t<=q.MIN_REQUEST_TIMEOUT_SECONDS)throw new Error(`Timeout must be greater than ${q.MIN_REQUEST_TIMEOUT_SECONDS} seconds`);return t.toString()}function uu(t){return t===void 0?{}:{[q.REQUEST_TIMEOUT_HEADER]:dr(t)}}});var ee=_(z=>{"use strict";var cr=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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(z,"__esModule",{value:!0});z.ValidationError=z.ApiError=void 0;z.defaultResponseHandler=mr;z.resultResponseHandler=cu;var du=lt(),pr="x-fal-request-id",Ie=class extends Error{constructor({message:e,status:i,body:r,requestId:n,timeoutType:o}){super(e),this.name="ApiError",this.status=i,this.body=r,this.requestId=n||"",this.timeoutType=o}get isUserTimeout(){return this.status===504&&this.timeoutType==="user"}};z.ApiError=Ie;var ut=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)}};z.ValidationError=ut;function mr(t){return cr(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:"",o=t.headers.get(pr)||void 0,s=t.headers.get(du.REQUEST_TIMEOUT_TYPE_HEADER)||void 0;if(!t.ok){if(n.includes("application/json")){let l=yield t.json(),u=i===422?ut:Ie;throw new u({message:l.message||r,status:i,body:l,requestId:o,timeoutType:s})}throw new Ie({message:`HTTP ${i}: ${r}`,status:i,requestId:o,timeoutType:s})}return n.includes("application/json")?t.json():n.includes("text/html")?t.text():n.includes("application/octet-stream")?t.arrayBuffer():t.text()})}function cu(t){return cr(this,void 0,void 0,function*(){return{data:yield mr(t),requestId:t.headers.get(pr)||""}})}});var te=_(U=>{"use strict";var pu=U&&U.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(U,"__esModule",{value:!0});U.ensureEndpointIdFormat=fr;U.parseEndpointId=fu;U.isValidUrl=gu;U.throttle=hu;U.isReact=yu;U.isPlainObject=bu;U.sleep=vu;function fr(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 mu=["workflows","comfy"];function fu(t){let i=fr(t).split("/");return mu.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 gu(t){try{let{host:e}=new URL(t);return/(fal\.(ai|run))$/.test(e)}catch{return!1}}function hu(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 Ht;function yu(){if(Ht===void 0){let t=new Error().stack;Ht=!!t&&(t.includes("node_modules/react-dom/")||t.includes("node_modules/next/"))}return Ht}function bu(t){return!!t&&Object.getPrototypeOf(t)===Object.prototype}function vu(t){return pu(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}});var Ne=_(j=>{"use strict";var wu=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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(j,"__esModule",{value:!0});j.DEFAULT_RETRY_OPTIONS=j.DEFAULT_RETRYABLE_STATUS_CODES=void 0;j.isRetryableError=gr;j.calculateBackoffDelay=hr;j.executeWithRetry=Tu;var _u=ee(),xu=te();j.DEFAULT_RETRYABLE_STATUS_CODES=[429,502,503,504];j.DEFAULT_RETRY_OPTIONS={maxRetries:3,baseDelay:1e3,maxDelay:3e4,backoffMultiplier:2,retryableStatusCodes:j.DEFAULT_RETRYABLE_STATUS_CODES,enableJitter:!0};function gr(t,e){return!(t instanceof _u.ApiError)||t.isUserTimeout?!1:e.includes(t.status)}function hr(t,e,i,r,n){let o=Math.min(e*Math.pow(r,t),i);if(n){let s=.25*o*(Math.random()*2-1);return Math.max(0,o+s)}return o}function Tu(t,e,i){return wu(this,void 0,void 0,function*(){let r={totalAttempts:0,totalDelay:0},n;for(let o=0;o<=e.maxRetries;o++){r.totalAttempts++;try{return{result:yield t(),metrics:r}}catch(s){if(n=s,r.lastError=s,o===e.maxRetries||!gr(s,e.retryableStatusCodes))throw s;let l=hr(o,e.baseDelay,e.maxDelay,e.backoffMultiplier,e.enableJitter);r.totalDelay+=l,i&&i(o+1,s,l),yield(0,xu.sleep)(l)}}throw n})}});var yr=_((Qg,Iu)=>{Iu.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.9.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 pt=_(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.isBrowser=Su;ct.getUserAgent=Eu;function Su(){return typeof window<"u"&&typeof window.document<"u"}var dt=null;function Eu(){if(dt!==null)return dt;let t=yr();return dt=`${t.name}/${t.version}`,dt}});var mt=_(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.credentialsFromEnv=void 0;ie.resolveDefaultFetch=wr;ie.createConfig=Vu;ie.getRestApiUrl=Mu;var br=Kt(),Au=ee(),vr=Ne(),Cu=pt();function wr(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function ku(){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 Pu=()=>{if(ku())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};ie.credentialsFromEnv=Pu;var qu={credentials:ie.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:t=>Promise.resolve(t),responseHandler:Au.defaultResponseHandler,retry:vr.DEFAULT_RETRY_OPTIONS};function Vu(t){var e;let i=Object.assign(Object.assign(Object.assign({},qu),t),{fetch:(e=t.fetch)!==null&&e!==void 0?e:wr(),retry:Object.assign(Object.assign({},vr.DEFAULT_RETRY_OPTIONS),t.retry||{})});t.proxyUrl&&(i=Object.assign(Object.assign({},i),{requestMiddleware:(0,br.withMiddleware)(i.requestMiddleware,(0,br.withProxy)({targetUrl:t.proxyUrl}))}));let{credentials:r,suppressLocalCredentialsWarning:n}=i,o=typeof r=="function"?r():r;return(0,Cu.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 Mu(){return"https://rest.alpha.fal.ai"}});var Se=_(re=>{"use strict";var _r=re&&re.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},Du=re&&re.__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(re,"__esModule",{value:!0});re.dispatchRequest=Ou;re.buildUrl=Fu;var xr=Ne(),Tr=pt(),Gt=te(),ju=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function Ou(t){return _r(this,void 0,void 0,function*(){var e;let{targetUrl:i,input:r,config:n,options:o={}}=t,{credentials:s,requestMiddleware:l,responseHandler:u,fetch:d}=n,a=Object.assign(Object.assign({},n.retry),o.retry||{}),c=()=>_r(this,void 0,void 0,function*(){var p,g,h;let b=(0,Tr.isBrowser)()?{}:{"User-Agent":(0,Tr.getUserAgent)()},f=typeof s=="function"?s():s,{method:v,url:C,headers:T}=yield l({method:((g=(p=t.method)!==null&&p!==void 0?p:o.method)!==null&&g!==void 0?g:"post").toUpperCase(),url:i,headers:t.headers}),M=f?{Authorization:`Key ${f}`}:{},$=Object.assign(Object.assign(Object.assign(Object.assign({},M),{Accept:"application/json","Content-Type":"application/json"}),b),T??{}),{responseHandler:le,retry:nt}=o,ge=Du(o,["responseHandler","retry"]),H=yield d(C,Object.assign(Object.assign(Object.assign(Object.assign({},ge),{method:v,headers:Object.assign(Object.assign({},$),(h=ge.headers)!==null&&h!==void 0?h:{})}),!ju&&{mode:"cors"}),{signal:o.signal,body:v.toLowerCase()!=="get"&&r?JSON.stringify(r):void 0}));return yield(le??u)(H)}),m;for(let p=0;p<=a.maxRetries;p++)try{return yield c()}catch(g){if(m=g,p===a.maxRetries||!(0,xr.isRetryableError)(g,a.retryableStatusCodes)||((e=o.signal)===null||e===void 0?void 0:e.aborted))throw g;let b=(0,xr.calculateBackoffDelay)(p,a.baseDelay,a.maxDelay,a.backoffMultiplier,a.enableJitter);yield(0,Gt.sleep)(b)}throw m})}function Fu(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,l=Object.assign(Object.assign({},e.query||{}),n==="get"?s:{}),u=Object.keys(l).length>0?`?${new URLSearchParams(l).toString()}`:"";if((0,Gt.isValidUrl)(t))return`${t.endsWith("/")?t:`${t}/`}${o}${u}`;let d=(0,Gt.ensureEndpointIdFormat)(t);return`${`https://${e.subdomain?`${e.subdomain}.`:""}fal.run/${d}/${o}`.replace(/\/$/,"")}${u}`}});var Wt=_(B=>{"use strict";var de=B&&B.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(B,"__esModule",{value:!0});B.OBJECT_LIFECYCYLE_PREFERENCE_HEADER=void 0;B.getExpirationDurationSeconds=Qt;B.buildObjectLifecycleHeaders=Lu;B.createStorageClient=Bu;var Ir=mt(),Sr=Se(),Ru=te();B.OBJECT_LIFECYCYLE_PREFERENCE_HEADER="x-fal-object-lifecycle-preference";var Uu={never:31536e5,immediate:void 0,"1h":3600,"1d":86400,"7d":604800,"30d":2592e3,"1y":31536e3};function Qt(t){let{expiresIn:e}=t;return typeof e=="number"?e:Uu[e]}function Lu(t){if(!t)return{};let e=Qt(t);return e===void 0?{}:{[B.OBJECT_LIFECYCYLE_PREFERENCE_HEADER]:JSON.stringify({expiration_duration_seconds:e})}}function Er(t){var e;let[,i]=t.split("/");return(e=i.split(/[-;]/)[0])!==null&&e!==void 0?e:"bin"}function $u(t,e,i,r){return de(this,void 0,void 0,function*(){let n=t.name||`${Date.now()}.${Er(i)}`,o={};if(r){let s={expiration_duration_seconds:Qt(r),allow_io_storage:r.expiresIn!=="immediate"};o["X-Fal-Object-Lifecycle"]=JSON.stringify(s)}return yield(0,Sr.dispatchRequest)({method:"POST",targetUrl:`${(0,Ir.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:n},config:e,headers:o})})}function Nu(t,e,i,r){return de(this,void 0,void 0,function*(){let n=t.name||`${Date.now()}.${Er(i)}`,o={};return r&&(o["X-Fal-Object-Lifecycle"]=JSON.stringify(r)),yield(0,Sr.dispatchRequest)({method:"POST",targetUrl:`${(0,Ir.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:n},config:e,headers:o})})}function Ar(t,e,i){return de(this,arguments,void 0,function*(r,n,o,s=3){if(s===0)throw new Error("Part upload failed, retries exhausted");let{fetch:l,responseHandler:u}=o;try{let d=yield l(r,{method:"PUT",body:n});return yield u(d)}catch{return yield Ar(r,n,o,s-1)}})}function zu(t,e,i){return de(this,void 0,void 0,function*(){let{fetch:r,responseHandler:n}=e,o=t.type||"application/octet-stream",{upload_url:s,file_url:l}=yield Nu(t,e,o,i),u=10*1024*1024,d=Math.ceil(t.size/u),a=new URL(s),c=[];for(let g=0;g<d;g++){let h=g*u,b=Math.min(h+u,t.size),f=t.slice(h,b),v=g+1,C=`${a.origin}${a.pathname}/${v}${a.search}`;c.push(yield Ar(C,f,e))}let m=`${a.origin}${a.pathname}/complete${a.search}`,p=yield r(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:c.map(g=>({partNumber:g.partNumber,etag:g.etag}))})});return yield n(p),l})}function Bu({config:t}){let e={upload:(i,r)=>de(this,void 0,void 0,function*(){let n=r?.lifecycle;if(i.size>94371840)return yield zu(i,t,n);let o=i.type||"application/octet-stream",{fetch:s,responseHandler:l}=t,{upload_url:u,file_url:d}=yield $u(i,t,o,n),a=yield s(u,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield l(a),d}),transformInput:i=>de(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,Ru.isPlainObject)(i)){let n=Object.entries(i).map(s=>de(this,[s],void 0,function*([l,u]){return[l,yield e.transformInput(u)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return i})};return e}});var kr=_(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});function Ku(t){let e,i,r,n,o,s,l;return u(),{feed:d,reset:u};function u(){e=!0,i="",r=0,n=-1,o=void 0,s=void 0,l=""}function d(c){i=i?i+c:c,e&&Hu(i)&&(i=i.slice(Cr.length)),e=!1;let m=i.length,p=0,g=!1;for(;p<m;){g&&(i[p]===`
2
+ `&&++p,g=!1);let h=-1,b=n,f;for(let v=r;h<0&&v<m;++v)f=i[v],f===":"&&b<0?b=v-p:f==="\r"?(g=!0,h=v-p):f===`
3
+ `&&(h=v-p);if(h<0){r=m-p,n=b;break}else r=0,n=-1;a(i,p,b,h),p+=h+1}p===m?i="":p>0&&(i=i.slice(p))}function a(c,m,p,g){if(g===0){l.length>0&&(t({type:"event",id:o,event:s||void 0,data:l.slice(0,-1)}),l="",o=void 0),s=void 0;return}let h=p<0,b=c.slice(m,m+(h?g:p)),f=0;h?f=g:c[m+p+1]===" "?f=p+2:f=p+1;let v=m+f,C=g-f,T=c.slice(v,v+C).toString();if(b==="data")l+=T?"".concat(T,`
4
4
  `):`
5
- `;else if(v==="event")s=x;else if(v==="id"&&!x.includes("\0"))o=x;else if(v==="retry"){let U=parseInt(x,10);Number.isNaN(U)||t({type:"reconnect-interval",value:U})}}}var xr=[239,187,191];function Ru(t){return xr.every((e,i)=>t.charCodeAt(i)===e)}Ht.createParser=Ou});var Gt=T(ie=>{"use strict";var Lu=ie&&ie.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(ie,"__esModule",{value:!0});ie.TOKEN_EXPIRATION_SECONDS=void 0;ie.getTemporaryAuthToken=zu;var Uu=ut(),$u=_e(),Nu=X();ie.TOKEN_EXPIRATION_SECONDS=120;function zu(t,e){return Lu(this,void 0,void 0,function*(){let i=(0,Nu.parseEndpointId)(t),r=yield(0,$u.dispatchRequest)({method:"POST",targetUrl:`${(0,Uu.getRestApiUrl)()}/tokens/`,config:e,input:{allowed_apps:[i.alias],token_expiration:ie.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var Wt=T(L=>{"use strict";var Te=L&&L.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},$e=L&&L.__await||function(t){return this instanceof $e?(this.v=t,this):new $e(t)},Bu=L&&L.__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={},l("next"),l("throw"),l("return",s),n[Symbol.asyncIterator]=function(){return this},n;function s(p){return function(f){return Promise.resolve(f).then(p,c)}}function l(p,f){r[p]&&(n[p]=function(h){return new Promise(function(v,g){o.push([p,h,v,g])>1||u(p,h)})},f&&(n[p]=f(n[p])))}function u(p,f){try{d(r[p](f))}catch(h){m(o[0][3],h)}}function d(p){p.value instanceof $e?Promise.resolve(p.value.v).then(a,c):m(o[0][2],p)}function a(p){u("next",p)}function c(p){u("throw",p)}function m(p,f){p(f),o.shift(),o.length&&u(o[0][0],o[0][1])}};Object.defineProperty(L,"__esModule",{value:!0});L.FalStream=void 0;L.createStreamingClient=Qu;var Ku=Tr(),Hu=Gt(),Ir=_e(),xe=J(),Qt="text/event-stream",Gu=15*1e3,dt=class{constructor(e,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this._requestId=null,this.abortController=new AbortController,this.start=()=>Te(this,void 0,void 0,function*(){var o,s;let{endpointId:l,options:u}=this,{input:d,method:a="post",connectionMode:c="server"}=u;try{if(c==="client"){let m=yield(0,Hu.getTemporaryAuthToken)(l,this.config),{fetch:p}=this.config,f=new URL(this.url);f.searchParams.set("fal_jwt_token",m);let h=yield p(f.toString(),{method:a.toUpperCase(),headers:{accept:(o=u.accept)!==null&&o!==void 0?o:Qt,"content-type":"application/json"},body:d&&a!=="get"?JSON.stringify(d):void 0,signal:this.abortController.signal});return this._requestId=h.headers.get("x-fal-request-id"),yield this.handleResponse(h)}return yield(0,Ir.dispatchRequest)({method:a.toUpperCase(),targetUrl:this.url,input:d,config:this.config,options:{headers:{accept:(s=u.accept)!==null&&s!==void 0?s:Qt},responseHandler:m=>Te(this,void 0,void 0,function*(){return this._requestId=m.headers.get("x-fal-request-id"),yield this.handleResponse(m)}),signal:this.abortController.signal}})}catch(m){this.handleError(m)}}),this.handleResponse=o=>Te(this,void 0,void 0,function*(){var s,l;if(!o.ok){try{yield(0,xe.defaultResponseHandler)(o)}catch(h){this.emit("error",h)}return}let u=o.body;if(!u){this.emit("error",new xe.ApiError({message:"Response body is empty.",status:400,body:void 0,requestId:this._requestId||void 0}));return}if(!((s=o.headers.get("content-type"))!==null&&s!==void 0?s:"").startsWith(Qt)){let h=u.getReader(),v=()=>{h.read().then(({done:g,value:b})=>{if(g){this.emit("done",this.currentData);return}this.buffer.push(b),this.currentData=b,this.emit("data",b),v()})};v();return}let a=new TextDecoder("utf-8"),c=o.body.getReader(),m=(0,Ku.createParser)(h=>{if(h.type==="event"){let v=h.data;try{let g=JSON.parse(v);this.buffer.push(g),this.currentData=g,this.emit("data",g),this.emit("message",g)}catch(g){this.emit("error",g)}}}),p=(l=this.options.timeout)!==null&&l!==void 0?l:Gu,f=()=>Te(this,void 0,void 0,function*(){let{value:h,done:v}=yield c.read();this.lastEventTimestamp=Date.now(),m.feed(a.decode(h)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new xe.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408,requestId:this._requestId||void 0})),v?this.emit("done",this.currentData):f().catch(this.handleError)});f().catch(this.handleError)}),this.handleError=o=>{var s;if(o.name==="AbortError"||this.signal.aborted)return;let l=o instanceof xe.ApiError?o:new xe.ApiError({message:(s=o.message)!==null&&s!==void 0?s:"An unknown error occurred",status:500,requestId:this._requestId||void 0});this.emit("error",l)},this.on=(o,s)=>{var l;this.listeners.has(o)||this.listeners.set(o,[]),(l=this.listeners.get(o))===null||l===void 0||l.push(s)},this.emit=(o,s)=>{let l=this.listeners.get(o)||[];for(let u of l)u(s)},this.done=()=>Te(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,Ir.buildUrl)(e,{path:"/stream",query:r.queryParams}),this.options=r,this.donePromise=new Promise((o,s)=>{this.streamClosed&&s(new xe.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0,requestId:this._requestId||void 0})),this.signal.addEventListener("abort",()=>{var l;o((l=this.currentData)!==null&&l!==void 0?l:{})}),this.on("done",l=>{this.streamClosed=!0,o(l)}),this.on("error",l=>{this.streamClosed=!0,s(l)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return Bu(this,arguments,function*(){let i=!0,r=()=>i=!1;for(this.on("error",r),this.on("done",r);i||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield $e(n)),yield $e(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}get requestId(){return this._requestId}};L.FalStream=dt;function Qu({config:t,storage:e}){return{stream(i,r){return Te(this,void 0,void 0,function*(){let n=r.input?yield e.transformInput(r.input):void 0;return new dt(i,t,Object.assign(Object.assign({},r),{input:n}))})}}}});var Cr=T(re=>{"use strict";var ue=re&&re.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},Wu=re&&re.__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(re,"__esModule",{value:!0});re.createQueueClient=void 0;var H=_e(),Yu=J(),Ar=Ue(),Zu=Kt(),Ju=Wt(),ct=X(),Sr=500,Xu="x-fal-queue-priority",ed="x-fal-runner-hint",Er={maxRetries:3,baseDelay:1e3,maxDelay:6e4,retryableStatusCodes:Ar.DEFAULT_RETRYABLE_STATUS_CODES},td={maxRetries:5,baseDelay:1e3,maxDelay:3e4,retryableStatusCodes:[...Ar.DEFAULT_RETRYABLE_STATUS_CODES,500]},id=({config:t,storage:e})=>{let i={submit(r,n){return ue(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s,hint:l,headers:u,storageSettings:d}=n,a=Wu(n,["webhookUrl","priority","hint","headers","storageSettings"]),c=n.input?yield e.transformInput(n.input):void 0,m=Object.fromEntries(Object.entries(u??{}).map(([p,f])=>[p.toLowerCase(),f]));return(0,H.dispatchRequest)({method:n.method,targetUrl:(0,H.buildUrl)(r,Object.assign(Object.assign({},a),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:Object.assign(Object.assign(Object.assign(Object.assign({},m),(0,Zu.buildObjectLifecycleHeaders)(d)),{[Xu]:s??"normal"}),l&&{[ed]:l}),input:c,config:t,options:{signal:n.abortSignal,retry:Er}})})},status(r,n){return ue(this,arguments,void 0,function*(o,{requestId:s,logs:l=!1,abortSignal:u}){let d=(0,ct.parseEndpointId)(o),a=d.namespace?`${d.namespace}/`:"";return(0,H.dispatchRequest)({method:"get",targetUrl:(0,H.buildUrl)(`${a}${d.owner}/${d.alias}`,{subdomain:"queue",query:{logs:l?"1":"0"},path:`/requests/${s}/status`}),config:t,options:{signal:u,retry:td}})})},streamStatus(r,n){return ue(this,arguments,void 0,function*(o,{requestId:s,logs:l=!1,connectionMode:u}){let d=(0,ct.parseEndpointId)(o),a=d.namespace?`${d.namespace}/`:"",c={logs:l?"1":"0"},m=(0,H.buildUrl)(`${a}${d.owner}/${d.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:c});return new Ju.FalStream(o,t,{url:m,method:"get",connectionMode:u,queryParams:c})})},subscribeToStatus(r,n){return ue(this,void 0,void 0,function*(){let o=n.requestId,s=n.timeout,l,u=()=>{};if(n.mode==="streaming"){let d=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),a=[];s&&(l=setTimeout(()=>{throw d.abort(),i.cancel(r,{requestId:o}).catch(u),new Error(`Client timed out waiting for the request to complete after ${s}ms`)},s)),d.on("data",m=>{n.onQueueUpdate&&("logs"in m&&Array.isArray(m.logs)&&m.logs.length>0&&a.push(...m.logs),n.onQueueUpdate("logs"in m?Object.assign(Object.assign({},m),{logs:a}):m))});let c=yield d.done();return l&&clearTimeout(l),c}return new Promise((d,a)=>{var c;let m,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(c=n.pollInterval)!==null&&c!==void 0?c:Sr,f=()=>{l&&clearTimeout(l),m&&clearTimeout(m)};s&&(l=setTimeout(()=>{f(),i.cancel(r,{requestId:o}).catch(u),a(new Error(`Client timed out waiting for the request to complete after ${s}ms`))},s));let h=()=>ue(this,void 0,void 0,function*(){var v;try{let g=yield i.status(r,{requestId:o,logs:(v=n.logs)!==null&&v!==void 0?v:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(g),g.status==="COMPLETED"){f(),d(g);return}m=setTimeout(h,p)}catch(g){f(),a(g)}});h().catch(a)})})},result(r,n){return ue(this,arguments,void 0,function*(o,{requestId:s,abortSignal:l}){let u=(0,ct.parseEndpointId)(o),d=u.namespace?`${u.namespace}/`:"";return(0,H.dispatchRequest)({method:"get",targetUrl:(0,H.buildUrl)(`${d}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}`}),config:Object.assign(Object.assign({},t),{responseHandler:Yu.resultResponseHandler}),options:{signal:l,retry:Er}})})},cancel(r,n){return ue(this,arguments,void 0,function*(o,{requestId:s,abortSignal:l}){let u=(0,ct.parseEndpointId)(o),d=u.namespace?`${u.namespace}/`:"";yield(0,H.dispatchRequest)({method:"put",targetUrl:(0,H.buildUrl)(`${d}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/cancel`}),config:t,options:{signal:l}})})}};return i};re.createQueueClient=id});var pt=T(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.utf8Count=rd;G.utf8EncodeJs=kr;G.utf8EncodeTE=Pr;G.utf8Encode=sd;G.utf8DecodeJs=qr;G.utf8DecodeTD=Vr;G.utf8Decode=dd;function rd(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 kr(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 l=t.charCodeAt(o);(l&64512)===56320&&(++o,s=((s&1023)<<10)+(l&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 nd=new TextEncoder,od=50;function Pr(t,e,i){nd.encodeInto(t,e.subarray(i))}function sd(t,e,i){t.length>od?Pr(t,e,i):kr(t,e,i)}var ad=4096;function qr(t,e,i){let r=e,n=r+i,o=[],s="";for(;r<n;){let l=t[r++];if(!(l&128))o.push(l);else if((l&224)===192){let u=t[r++]&63;o.push((l&31)<<6|u)}else if((l&240)===224){let u=t[r++]&63,d=t[r++]&63;o.push((l&31)<<12|u<<6|d)}else if((l&248)===240){let u=t[r++]&63,d=t[r++]&63,a=t[r++]&63,c=(l&7)<<18|u<<12|d<<6|a;c>65535&&(c-=65536,o.push(c>>>10&1023|55296),c=56320|c&1023),o.push(c)}else o.push(l);o.length>=ad&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var ld=new TextDecoder,ud=200;function Vr(t,e,i){let r=t.subarray(e,e+i);return ld.decode(r)}function dd(t,e,i){return i>ud?Vr(t,e,i):qr(t,e,i)}});var Zt=T(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.ExtData=void 0;var Yt=class{type;data;constructor(e,i){this.type=e,this.data=i}};mt.ExtData=Yt});var gt=T(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.DecodeError=void 0;var Jt=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})}};ft.DecodeError=Jt});var ht=T(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.UINT32_MAX=void 0;ne.setUint64=cd;ne.setInt64=pd;ne.getInt64=md;ne.getUint64=fd;ne.UINT32_MAX=4294967295;function cd(t,e,i){let r=i/4294967296,n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function pd(t,e,i){let r=Math.floor(i/4294967296),n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function md(t,e){let i=t.getInt32(e),r=t.getUint32(e+4);return i*4294967296+r}function fd(t,e){let i=t.getUint32(e),r=t.getUint32(e+4);return i*4294967296+r}});var Xt=T(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.timestampExtension=M.EXT_TIMESTAMP=void 0;M.encodeTimeSpecToTimestamp=Dr;M.encodeDateToTimeSpec=jr;M.encodeTimestampExtension=Fr;M.decodeTimestampToTimeSpec=Or;M.decodeTimestampExtension=Rr;var gd=gt(),Mr=ht();M.EXT_TIMESTAMP=-1;var hd=4294967296-1,yd=17179869184-1;function Dr({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=yd)if(e===0&&t<=hd){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,Mr.setInt64)(r,4,t),i}}function jr(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 Fr(t){if(t instanceof Date){let e=jr(t);return Dr(e)}else return null}function Or(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,Mr.getInt64)(e,4),r=e.getUint32(0);return{sec:i,nsec:r}}default:throw new gd.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Rr(t){let e=Or(t);return new Date(e.sec*1e3+e.nsec/1e6)}M.timestampExtension={type:M.EXT_TIMESTAMP,encode:Fr,decode:Rr}});var vt=T(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.ExtensionCodec=void 0;var yt=Zt(),bd=Xt(),ei=class t{static defaultCodec=new t;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(bd.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 yt.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 yt.ExtData(s,o)}}}return e instanceof yt.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 yt.ExtData(i,e)}};bt.ExtensionCodec=ei});var ii=T(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ensureUint8Array=wd;function vd(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function wd(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):vd(t)?new Uint8Array(t):Uint8Array.from(t)}});var ni=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.Encoder=B.DEFAULT_INITIAL_BUFFER_SIZE=B.DEFAULT_MAX_DEPTH=void 0;var Lr=pt(),_d=vt(),Ur=ht(),xd=ii();B.DEFAULT_MAX_DEPTH=100;B.DEFAULT_INITIAL_BUFFER_SIZE=2048;var ri=class t{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??_d.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??B.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??B.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,Lr.utf8Count)(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,Lr.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,xd.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,Ur.setUint64)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,Ur.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}};B.Encoder=ri});var $r=T(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.encode=Id;var Td=ni();function Id(t,e){return new Td.Encoder(e).encodeSharedRef(t)}});var Nr=T(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.prettyByte=Sd;function Sd(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var zr=T(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.CachedKeyDecoder=void 0;var Ed=pt(),Ad=16,Cd=16,ai=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=Ad,i=Cd){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 l=0;l<r;l++)if(s[l]!==e[i+l])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,Ed.utf8DecodeJs)(e,i,r),s=Uint8Array.prototype.slice.call(e,i,i+r);return this.store(s,o),o}};wt.CachedKeyDecoder=ai});var xt=T(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.Decoder=void 0;var li=Nr(),kd=vt(),de=ht(),Pd=pt(),Br=ii(),qd=zr(),Q=gt(),ui="array",ze="map_key",Hr="map_value",Vd=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new Q.DecodeError("The type of key must be string or number but "+typeof t)},di=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let i=this.getUninitializedStateFromPool();i.type=ui,i.position=0,i.size=e,i.array=new Array(e)}pushMapState(e){let i=this.getUninitializedStateFromPool();i.type=ze,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===ui){let r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===ze||e.type===Hr){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}},Ne=-1,pi=new DataView(new ArrayBuffer(0)),Md=new Uint8Array(pi.buffer);try{pi.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 Kr=new RangeError("Insufficient data"),Dd=new qd.CachedKeyDecoder,ci=class t{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=pi;bytes=Md;headByte=Ne;stack=new di;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??kd.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??de.UINT32_MAX,this.maxBinLength=e?.maxBinLength??de.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??de.UINT32_MAX,this.maxMapLength=e?.maxMapLength??de.UINT32_MAX,this.maxExtLength=e?.maxExtLength??de.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:Dd,this.mapKeyConverter=e?.mapKeyConverter??Vd}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=Ne,this.stack.reset()}setBuffer(e){let i=(0,Br.ensureUint8Array)(e);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Ne&&!this.hasRemaining(1))this.setBuffer(e);else{let i=this.bytes.subarray(this.pos),r=(0,Br.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 l of e){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(l);try{r=this.doDecodeSync(),i=!0}catch(u){if(!(u instanceof RangeError))throw u}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,li.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 Q.DecodeError(`Unrecognized type byte: ${(0,li.prettyByte)(e)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===ui)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===ze){if(i==="__proto__")throw new Q.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=Hr;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=ze;continue e}}return i}}readHeadByte(){return this.headByte===Ne&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Ne}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 Q.DecodeError(`Unrecognized array type byte: ${(0,li.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Q.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Q.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 Q.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+e)throw Kr;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?n=this.keyDecoder.decode(this.bytes,r,e):n=(0,Pd.utf8Decode)(this.bytes,r,e),this.pos+=i+e,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===ze:!1}decodeBinary(e,i){if(e>this.maxBinLength)throw new Q.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+i))throw Kr;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 Q.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,de.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,de.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}};_t.Decoder=ci});var Qr=T(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.decode=jd;Tt.decodeMulti=Fd;var Gr=xt();function jd(t,e){return new Gr.Decoder(e).decode(t)}function Fd(t,e){return new Gr.Decoder(e).decodeMulti(t)}});var Zr=T(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.isAsyncIterable=Wr;Be.asyncIterableFromStream=Yr;Be.ensureAsyncIterable=Od;function Wr(t){return t[Symbol.asyncIterator]!=null}async function*Yr(t){let e=t.getReader();try{for(;;){let{done:i,value:r}=await e.read();if(i)return;yield r}}finally{e.releaseLock()}}function Od(t){return Wr(t)?t:Yr(t)}});var Jr=T(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.decodeAsync=Rd;Ke.decodeArrayStream=Ld;Ke.decodeMultiStream=Ud;var mi=xt(),fi=Zr();async function Rd(t,e){let i=(0,fi.ensureAsyncIterable)(t);return new mi.Decoder(e).decodeAsync(i)}function Ld(t,e){let i=(0,fi.ensureAsyncIterable)(t);return new mi.Decoder(e).decodeArrayStream(i)}function Ud(t,e){let i=(0,fi.ensureAsyncIterable)(t);return new mi.Decoder(e).decodeStream(i)}});var en=T(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.decodeTimestampExtension=w.encodeTimestampExtension=w.decodeTimestampToTimeSpec=w.encodeTimeSpecToTimestamp=w.encodeDateToTimeSpec=w.EXT_TIMESTAMP=w.ExtData=w.ExtensionCodec=w.Encoder=w.DecodeError=w.Decoder=w.decodeMultiStream=w.decodeArrayStream=w.decodeAsync=w.decodeMulti=w.decode=w.encode=void 0;var $d=$r();Object.defineProperty(w,"encode",{enumerable:!0,get:function(){return $d.encode}});var Xr=Qr();Object.defineProperty(w,"decode",{enumerable:!0,get:function(){return Xr.decode}});Object.defineProperty(w,"decodeMulti",{enumerable:!0,get:function(){return Xr.decodeMulti}});var gi=Jr();Object.defineProperty(w,"decodeAsync",{enumerable:!0,get:function(){return gi.decodeAsync}});Object.defineProperty(w,"decodeArrayStream",{enumerable:!0,get:function(){return gi.decodeArrayStream}});Object.defineProperty(w,"decodeMultiStream",{enumerable:!0,get:function(){return gi.decodeMultiStream}});var Nd=xt();Object.defineProperty(w,"Decoder",{enumerable:!0,get:function(){return Nd.Decoder}});var zd=gt();Object.defineProperty(w,"DecodeError",{enumerable:!0,get:function(){return zd.DecodeError}});var Bd=ni();Object.defineProperty(w,"Encoder",{enumerable:!0,get:function(){return Bd.Encoder}});var Kd=vt();Object.defineProperty(w,"ExtensionCodec",{enumerable:!0,get:function(){return Kd.ExtensionCodec}});var Hd=Zt();Object.defineProperty(w,"ExtData",{enumerable:!0,get:function(){return Hd.ExtData}});var Ie=Xt();Object.defineProperty(w,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return Ie.EXT_TIMESTAMP}});Object.defineProperty(w,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return Ie.encodeDateToTimeSpec}});Object.defineProperty(w,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return Ie.encodeTimeSpecToTimestamp}});Object.defineProperty(w,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return Ie.decodeTimestampToTimeSpec}});Object.defineProperty(w,"encodeTimestampExtension",{enumerable:!0,get:function(){return Ie.encodeTimestampExtension}});Object.defineProperty(w,"decodeTimestampExtension",{enumerable:!0,get:function(){return Ie.decodeTimestampExtension}})});var hn=T(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});function P(t){return{enumerable:!0,value:t}}function tn(t){return{enumerable:!0,writable:!0,value:t}}var ce={},Gd=()=>!0,rn=()=>({}),on=t=>t,Qd=(t,e,i,r)=>t.apply(i,r)&&e.apply(i,r),Wd=(t,e,i,[r,n])=>e.call(i,t.call(i,r,n),n),oe=(t,e)=>Object.freeze(Object.create(t,e));function nn(t,e,i){return t.reduce((r,n)=>function(...o){return i(r,n,this,o)},e)}function sn(t){return oe(this,{fn:P(t)})}var an={},ln=sn.bind(an),Yd=t=>ln((e,i)=>!!~t(e,i)&&e),un={},Zd=sn.bind(un);function It(t,e){return e.filter(i=>t.isPrototypeOf(i))}function dn(t,e,...i){let r=nn(It(un,i).map(o=>o.fn),Gd,Qd),n=nn(It(an,i).map(o=>o.fn),on,Wd);return oe(this,{from:P(t),to:P(e),guards:P(r),reducers:P(n)})}var cn={},pn={},Jd=dn.bind(cn),Xd=dn.bind(pn,null);function ec(t,e,i){return yi(e,t,i,this.immediates)||t}function mn(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 tc={enter:on};function ic(...t){let e=It(cn,t),i=It(pn,t),r={final:P(t.length===0),transitions:P(mn(e))};return i.length&&(r.immediates=P(i),r.enter=P(ec)),oe(tc,r)}var rc={enter(t,e,i){let r=this.fn.call(e,e.context,i);return hi.isPrototypeOf(r)?oe(fn,{machine:P(r),transitions:P(this.transitions)}).enter(t,e,i):(r.then(n=>e.send({type:"done",data:n})).catch(n=>e.send({type:"error",error:n})),t)}},fn={enter(t,e,i){if(e.child=gn(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,yi(e,t,{type:"done",data:r},this.transitions.get("done"))}return t}};function nc(t,...e){let i=P(mn(e));return hi.isPrototypeOf(t)?oe(fn,{machine:P(t),transitions:i}):oe(rc,{fn:P(t),transitions:i})}var hi={get state(){return{name:this.current,value:this.states[this.current]}}};function oc(t,e,i=rn){return typeof t!="string"&&(i=e||rn,e=t,t=Object.keys(e)[0]),ce._create&&ce._create(t,e),oe(hi,{context:P(i),current:P(t),states:P(e)})}function yi(t,e,i,r){let{context:n}=t;for(let{to:o,guards:s,reducers:l}of r)if(s(n,i)){t.context=l.call(t,n,i);let u=e.original||e,d=oe(u,{current:P(o),original:{value:u}});return ce._onEnter&&ce._onEnter(e,o,t.context,n,i),d.state.value.enter(d,t,i)}}function sc(t,e){let i=e.type||e,{machine:r}=t,{value:n,name:o}=r.state;return n.transitions.has(i)?yi(t,r,e,n.transitions.get(i))||r:(ce._send&&ce._send(i,o),r)}var ac={send(t){this.machine=sc(this,t),this.onChange(this)}};function gn(t,e,i,r){let n=Object.create(ac,{machine:tn(t),context:tn(t.context(i,r)),onChange:P(e)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}D.action=Yd;D.createMachine=oc;D.d=ce;D.guard=Zd;D.immediate=Xd;D.interpret=gn;D.invoke=nc;D.reduce=ln;D.state=ic;D.transition=Jd});var xn=T(Qe=>{"use strict";var yn=Qe&&Qe.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createRealtimeClient=Sc;var Ge=en(),y=hn(),bn=Gt(),Et=J(),vn=lt(),wi=X(),lc=()=>({enqueuedMessage:void 0});function uc(t){return t.token!==void 0}function dc(t){return!uc(t)}function St(t,e){return Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function W(t){return t.websocket&&t.websocket.readyState===WebSocket.OPEN&&t.websocket.close(),Object.assign(Object.assign({},t),{websocket:void 0})}function cc(t,e){return t.websocket&&t.websocket.readyState===WebSocket.OPEN?(e.message instanceof Uint8Array||typeof e.message=="string"?t.websocket.send(e.message):t.websocket.send((0,Ge.encode)(e.message)),Object.assign(Object.assign({},t),{enqueuedMessage:void 0})):Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function bi(t){return Object.assign(Object.assign({},t),{token:void 0})}function pc(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function mc(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var fc=(0,y.createMachine)("idle",{idle:(0,y.state)((0,y.transition)("send","connecting",(0,y.reduce)(St)),(0,y.transition)("expireToken","idle",(0,y.reduce)(bi)),(0,y.transition)("close","idle",(0,y.reduce)(W))),connecting:(0,y.state)((0,y.transition)("connecting","connecting"),(0,y.transition)("connected","active",(0,y.reduce)(mc)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(W)),(0,y.transition)("send","connecting",(0,y.reduce)(St)),(0,y.transition)("close","idle",(0,y.reduce)(W)),(0,y.immediate)("authRequired",(0,y.guard)(dc))),authRequired:(0,y.state)((0,y.transition)("initiateAuth","authInProgress"),(0,y.transition)("send","authRequired",(0,y.reduce)(St)),(0,y.transition)("close","idle",(0,y.reduce)(W))),authInProgress:(0,y.state)((0,y.transition)("authenticated","connecting",(0,y.reduce)(pc)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(bi),(0,y.reduce)(W)),(0,y.transition)("send","authInProgress",(0,y.reduce)(St)),(0,y.transition)("close","idle",(0,y.reduce)(W))),active:(0,y.state)((0,y.transition)("send","active",(0,y.reduce)(cc)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(bi)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(W)),(0,y.transition)("close","idle",(0,y.reduce)(W))),failed:(0,y.state)((0,y.transition)("send","failed"),(0,y.transition)("close","idle",(0,y.reduce)(W)))},lc);function gc(t,{token:e,maxBuffering:i,path:r}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let n=new URLSearchParams({fal_jwt_token:e});i!==void 0&&n.set("max_buffering",i.toFixed(0));let o=(0,wi.ensureEndpointIdFormat)(t),s=r?`/${r.replace(/^\/+/,"")}`:"/realtime";return`wss://fal.run/${o}${s}?${n.toString()}`}var hc=128;function yc(t){return t.status==="error"&&t.error==="Unauthorized"}var bc={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},vi=new Map,wn=new Map;function vc(t,e,i){if(!vi.has(t)){let r=(0,y.interpret)(fc,i);vi.set(t,Object.assign(Object.assign({},r),{throttledSend:e>0?(0,wi.throttle)(r.send,e,!0):r.send}))}return vi.get(t)}var He=()=>{},wc={send:He,close:He};function _c(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!_n(t)}function _n(t){return t.type==="x-fal-error"}function xc(t){return yn(this,void 0,void 0,function*(){if(typeof t=="string")return JSON.parse(t);let e=i=>yn(this,void 0,void 0,function*(){return i instanceof Uint8Array?i:i instanceof Blob?new Uint8Array(yield i.arrayBuffer()):new Uint8Array(i)});return t instanceof ArrayBuffer||t instanceof Uint8Array?(0,Ge.decode)(yield e(t)):t instanceof Blob?(0,Ge.decode)(yield e(t)):t})}function Tc(t){return t instanceof Uint8Array?t:(0,Ge.encode)(t)}function Ic({data:t,decodeMessage:e,onResult:i,onError:r,send:n}){let o=s=>{if(yc(s)){n({type:"unauthorized",error:new Error("Unauthorized")});return}if(_c(s)){i(s);return}if(_n(s)){if(s.error==="TIMEOUT")return;r(new Et.ApiError({message:`${s.error}: ${s.reason}`,status:400,body:s}));return}};Promise.resolve(e(t)).then(o).catch(s=>{var l;r(new Et.ApiError({message:(l=s?.message)!==null&&l!==void 0?l:"Failed to decode realtime message",status:400}))})}function Sc({config:t}){return{connect(e,i){let{clientOnly:r=(0,wi.isReact)()&&!(0,vn.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,path:s,throttleInterval:l=hc,encodeMessage:u,decodeMessage:d}=i;if(r&&!(0,vn.isBrowser)())return wc;let a=u??(b=>Tc(b)),c=d??(b=>xc(b)),m,p;wn.set(n,{decodeMessage:c,onError:i.onError,onResult:i.onResult});let f=()=>wn.get(n),h=vc(n,l,({context:b,machine:I,send:x})=>{let{enqueuedMessage:U,token:Ve,websocket:se}=b;if(p=U,I.current==="active"&&U&&se?.readyState===WebSocket.OPEN&&x({type:"send",message:U}),I.current==="authRequired"&&Ve===void 0&&m!==I.current&&(x({type:"initiateAuth"}),(0,bn.getTemporaryAuthToken)(e,t).then(F=>{x({type:"authenticated",token:F});let q=Math.round(bn.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{x({type:"expireToken"})},q)}).catch(F=>{x({type:"unauthorized",error:F})})),I.current==="connecting"&&m!==I.current&&Ve!==void 0){let F=new WebSocket(gc(e,{token:Ve,maxBuffering:o,path:s}));F.onopen=()=>{var q,O;x({type:"connected",websocket:F});let Me=(O=(q=h.context)===null||q===void 0?void 0:q.enqueuedMessage)!==null&&O!==void 0?O:p;Me&&(F.send(a(Me)),h.context=Object.assign(Object.assign({},h.context),{enqueuedMessage:void 0}))},F.onclose=q=>{if(q.code!==bc.NORMAL_CLOSURE){let{onError:O=He}=f();O(new Et.ApiError({message:`Error closing the connection: ${q.reason}`,status:q.code}))}x({type:"connectionClosed",code:q.code})},F.onerror=q=>{let{onError:O=He}=f();O(new Et.ApiError({message:"Unknown error",status:500}))},F.onmessage=q=>{let{decodeMessage:O=c,onResult:Me,onError:Vo=He}=f();Ic({data:q.data,decodeMessage:O,onResult:Me,onError:Vo,send:x})}}m=I.current});return{send:b=>{h.throttledSend({type:"send",message:a(b)})},close:()=>{h.send({type:"close"})}}}}}});var _i=T(We=>{"use strict";var Tn=We&&We.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(We,"__esModule",{value:!0});We.createFalClient=qc;var Ec=ut(),Ac=Cr(),Cc=xn(),In=_e(),kc=J(),Sn=Kt(),Pc=Wt();function qc(t={}){let e=(0,Ec.createConfig)(t),i=(0,Sn.createStorageClient)({config:e}),r=(0,Ac.createQueueClient)({config:e,storage:i}),n=(0,Pc.createStreamingClient)({config:e,storage:i}),o=(0,Cc.createRealtimeClient)({config:e});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(s){return Tn(this,arguments,void 0,function*(l,u={}){let d=u.input?yield i.transformInput(u.input):void 0;return(0,In.dispatchRequest)({method:u.method,targetUrl:(0,In.buildUrl)(l,u),input:d,headers:(0,Sn.buildObjectLifecycleHeaders)(u.storageSettings),config:Object.assign(Object.assign({},e),{responseHandler:kc.resultResponseHandler}),options:{signal:u.abortSignal,retry:{maxRetries:3,baseDelay:500,maxDelay:15e3}}})})},subscribe:(s,l)=>Tn(this,void 0,void 0,function*(){let{request_id:u}=yield r.submit(s,l);return l.onEnqueue&&l.onEnqueue(u),yield r.subscribeToStatus(s,Object.assign({requestId:u},l)),r.result(s,{requestId:u})})}}});var An=T(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.isQueueStatus=En;At.isCompletedQueueStatus=Vc;function En(t){return t&&t.status&&t.response_url}function Vc(t){return En(t)&&t.status==="COMPLETED"}});var qn=T(k=>{"use strict";var Mc=k&&k.__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]}),Dc=k&&k.__exportStar||function(t,e){for(var i in t)i!=="default"&&!Object.prototype.hasOwnProperty.call(e,i)&&Mc(e,t,i)};Object.defineProperty(k,"__esModule",{value:!0});k.fal=k.parseEndpointId=k.isRetryableError=k.ValidationError=k.ApiError=k.withProxy=k.withMiddleware=k.createFalClient=void 0;var Cn=_i(),jc=_i();Object.defineProperty(k,"createFalClient",{enumerable:!0,get:function(){return jc.createFalClient}});var kn=$t();Object.defineProperty(k,"withMiddleware",{enumerable:!0,get:function(){return kn.withMiddleware}});Object.defineProperty(k,"withProxy",{enumerable:!0,get:function(){return kn.withProxy}});var Pn=J();Object.defineProperty(k,"ApiError",{enumerable:!0,get:function(){return Pn.ApiError}});Object.defineProperty(k,"ValidationError",{enumerable:!0,get:function(){return Pn.ValidationError}});var Fc=Ue();Object.defineProperty(k,"isRetryableError",{enumerable:!0,get:function(){return Fc.isRetryableError}});Dc(An(),k);var Oc=X();Object.defineProperty(k,"parseEndpointId",{enumerable:!0,get:function(){return Oc.parseEndpointId}});k.fal=function(){let e=(0,Cn.createFalClient)();return{config(i){e=(0,Cn.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 ji={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:[]}]};async function Z(t,e,i){if(e!=null){if(e.startsWith("blob:")){let n=await(await fetch(e)).blob(),o=new File([n],"image.png",{type:"image/png"});return t.storage.upload(o)}if(i!=null&&e.startsWith("buffer:")){let r=await i.engine.editor.getMimeType(e),n=i.engine.editor.getBufferLength(e),o=i.engine.editor.getBufferData(e,0,n),s=new Uint8Array(o),l=new File([s],"image.png",{type:r});return t.storage.upload(l)}return e}}var $o=class{constructor(t,e=[],i){this.id=t,this.translateLabel=i?.translateLabel,this.assets=e.map(r=>{if(typeof r.label=="string"&&!(r.label&&typeof r.label=="object")){let n=r;return{id:n.id,label:{en:n.label},meta:n.thumbUri?{...n.meta??{},thumbUri:n.thumbUri}:n.meta}}return r}),this.activeAssetIds=new Set,this.assets.length>0&&this.activeAssetIds.add(this.assets[0].id)}async findAssets(t){let{page:e,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:s,groups:l,excludeGroups:u,sortingOrder:d,sortKey:a}=t,c=[...this.assets];if(l&&l.length>0&&(c=c.filter(g=>g.groups&&l.some(b=>g.groups?.includes(b)))),u&&u.length>0&&(c=c.filter(g=>!g.groups||!u.some(b=>g.groups?.includes(b)))),o){let g=o.toLowerCase();c=c.filter(b=>{let I=b.label?.[r]?.toLowerCase(),x=b.tags?.[r]||[];return I&&I.includes(g)||x.some(U=>U.toLowerCase().includes(g))})}if(s&&s.length>0){let g=Array.isArray(s)?s:[s];c=c.filter(b=>{let I=b.tags?.[r]||[];return g.some(x=>I.includes(x))})}n&&c.sort((g,b)=>{let I=this.activeAssetIds.has(g.id),x=this.activeAssetIds.has(b.id);return I&&!x?-1:!I&&x?1:0}),a&&a!=="id"?c.sort((g,b)=>{let I=g.meta?.[a],x=b.meta?.[a];return I===void 0?1:x===void 0?-1:typeof I=="string"&&typeof x=="string"?d==="Descending"?x.localeCompare(I):I.localeCompare(x):typeof I=="number"&&typeof x=="number"?d==="Descending"?x-I:I-x:0}):a==="id"&&c.sort((g,b)=>d==="Descending"?b.id.localeCompare(g.id):g.id.localeCompare(b.id));let m=c.length,p=e*i,f=p+i,h=c.slice(p,f).map(g=>{let b=g.label?.[r]||"",I=this.translateLabel?this.translateLabel(g.id,b,r):b;return{id:g.id,groups:g.groups,meta:g.meta,payload:g.payload,locale:r,label:I,tags:g.tags?.[r],active:this.activeAssetIds.has(g.id)}}),v=f<m?e+1:void 0;return{assets:h,currentPage:e,nextPage:v,total:m}}updateLabel(t,e,i){this.assets.forEach(r=>{r.id===t&&(r.label=r.label||{},r.label[i]=e)})}getAssetSelectValue(t){let e=this.assets.find(({id:i})=>i===t);if(e){let i=this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||"";return{id:e.id,label:i,thumbUri:e.meta?.thumbUri}}}getActiveSelectValue(){let t=this.getActiveAssetIds();if(t.length>0){let e=this.assets.find(({id:i})=>i===t[0]);if(e){let i=this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||"";return{id:e.id,label:i,thumbUri:e.meta?.thumbUri}}}}getTranslatedLabel(t){let e=this.assets.find(({id:i})=>i===t);if(e)return this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||""}getAsset(t){return this.assets.find(e=>e.id===t)}setAssetActive(t){this.activeAssetIds.add(t)}getActiveAssetIds(){return Array.from(this.activeAssetIds)}setAssetsActive(t){t.forEach(e=>this.activeAssetIds.add(e))}setAssetInactive(t){this.activeAssetIds.delete(t)}clearActiveAssets(){this.activeAssetIds.clear()}isAssetActive(t){return this.activeAssetIds.has(t)}addAsset(t){let e=this.assets.findIndex(i=>i.id===t.id);e>=0?this.assets[e]=t:this.assets.push(t)}removeAsset(t){let e=this.assets.findIndex(i=>i.id===t);e!==-1&&(this.assets.splice(e,1),this.activeAssetIds.delete(t))}async getGroups(){let t=new Set;return this.assets.forEach(e=>{e.groups&&e.groups.forEach(i=>t.add(i))}),Array.from(t)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var No=typeof global=="object"&&global&&global.Object===Object&&global,Zi=No,zo=typeof self=="object"&&self&&self.Object===Object&&self,Bo=Zi||zo||Function("return this")(),K=Bo,Ko=K.Symbol,fe=Ko,Ji=Object.prototype,Ho=Ji.hasOwnProperty,Go=Ji.toString,De=fe?fe.toStringTag:void 0;function Qo(t){var e=Ho.call(t,De),i=t[De];try{t[De]=void 0;var r=!0}catch{}var n=Go.call(t);return r&&(e?t[De]=i:delete t[De]),n}var Wo=Qo,Yo=Object.prototype,Zo=Yo.toString;function Jo(t){return Zo.call(t)}var Xo=Jo,es="[object Null]",ts="[object Undefined]",Fi=fe?fe.toStringTag:void 0;function is(t){return t==null?t===void 0?ts:es:Fi&&Fi in Object(t)?Wo(t):Xo(t)}var Re=is;function rs(t){return t!=null&&typeof t=="object"}var Ut=rs,yg=Array.isArray;function ns(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Xi=ns,os="[object AsyncFunction]",ss="[object Function]",as="[object GeneratorFunction]",ls="[object Proxy]";function us(t){if(!Xi(t))return!1;var e=Re(t);return e==ss||e==as||e==os||e==ls}var ds=us,cs=K["__core-js_shared__"],qt=cs,Oi=function(){var t=/[^.]+$/.exec(qt&&qt.keys&&qt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ps(t){return!!Oi&&Oi in t}var ms=ps,fs=Function.prototype,gs=fs.toString;function hs(t){if(t!=null){try{return gs.call(t)}catch{}try{return t+""}catch{}}return""}var ae=hs,ys=/[\\^$.*+?()[\]{}|]/g,bs=/^\[object .+?Constructor\]$/,vs=Function.prototype,ws=Object.prototype,_s=vs.toString,xs=ws.hasOwnProperty,Ts=RegExp("^"+_s.call(xs).replace(ys,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Is(t){if(!Xi(t)||ms(t))return!1;var e=ds(t)?Ts:bs;return e.test(ae(t))}var Ss=Is;function Es(t,e){return t?.[e]}var As=Es;function Cs(t,e){var i=As(t,e);return Ss(i)?i:void 0}var ge=Cs,ks=ge(K,"WeakMap"),Dt=ks;function Ps(t,e){return t===e||t!==t&&e!==e}var qs=Ps,Vs=9007199254740991;function Ms(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Vs}var Ds=Ms,bg=Object.prototype,js="[object Arguments]";function Fs(t){return Ut(t)&&Re(t)==js}var Ri=Fs,er=Object.prototype,Os=er.hasOwnProperty,Rs=er.propertyIsEnumerable,vg=Ri(function(){return arguments}())?Ri:function(t){return Ut(t)&&Os.call(t,"callee")&&!Rs.call(t,"callee")},tr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Li=tr&&typeof module=="object"&&module&&!module.nodeType&&module,Ls=Li&&Li.exports===tr,Ui=Ls?K.Buffer:void 0,wg=Ui?Ui.isBuffer:void 0,Us="[object Arguments]",$s="[object Array]",Ns="[object Boolean]",zs="[object Date]",Bs="[object Error]",Ks="[object Function]",Hs="[object Map]",Gs="[object Number]",Qs="[object Object]",Ws="[object RegExp]",Ys="[object Set]",Zs="[object String]",Js="[object WeakMap]",Xs="[object ArrayBuffer]",ea="[object DataView]",ta="[object Float32Array]",ia="[object Float64Array]",ra="[object Int8Array]",na="[object Int16Array]",oa="[object Int32Array]",sa="[object Uint8Array]",aa="[object Uint8ClampedArray]",la="[object Uint16Array]",ua="[object Uint32Array]",A={};A[ta]=A[ia]=A[ra]=A[na]=A[oa]=A[sa]=A[aa]=A[la]=A[ua]=!0;A[Us]=A[$s]=A[Xs]=A[Ns]=A[ea]=A[zs]=A[Bs]=A[Ks]=A[Hs]=A[Gs]=A[Qs]=A[Ws]=A[Ys]=A[Zs]=A[Js]=!1;function da(t){return Ut(t)&&Ds(t.length)&&!!A[Re(t)]}var ca=da;function pa(t){return function(e){return t(e)}}var ma=pa,ir=typeof exports=="object"&&exports&&!exports.nodeType&&exports,je=ir&&typeof module=="object"&&module&&!module.nodeType&&module,fa=je&&je.exports===ir,Vt=fa&&Zi.process,ga=function(){try{var t=je&&je.require&&je.require("util").types;return t||Vt&&Vt.binding&&Vt.binding("util")}catch{}}(),$i=ga,Ni=$i&&$i.isTypedArray,_g=Ni?ma(Ni):ca,ha=Object.prototype,xg=ha.hasOwnProperty;function ya(t,e){return function(i){return t(e(i))}}var ba=ya,Tg=ba(Object.keys,Object),va=Object.prototype,Ig=va.hasOwnProperty,wa=ge(Object,"create"),Fe=wa;function _a(){this.__data__=Fe?Fe(null):{},this.size=0}var xa=_a;function Ta(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ia=Ta,Sa="__lodash_hash_undefined__",Ea=Object.prototype,Aa=Ea.hasOwnProperty;function Ca(t){var e=this.__data__;if(Fe){var i=e[t];return i===Sa?void 0:i}return Aa.call(e,t)?e[t]:void 0}var ka=Ca,Pa=Object.prototype,qa=Pa.hasOwnProperty;function Va(t){var e=this.__data__;return Fe?e[t]!==void 0:qa.call(e,t)}var Ma=Va,Da="__lodash_hash_undefined__";function ja(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Fe&&e===void 0?Da:e,this}var Fa=ja;function he(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])}}he.prototype.clear=xa;he.prototype.delete=Ia;he.prototype.get=ka;he.prototype.has=Ma;he.prototype.set=Fa;var zi=he;function Oa(){this.__data__=[],this.size=0}var Ra=Oa;function La(t,e){for(var i=t.length;i--;)if(qs(t[i][0],e))return i;return-1}var it=La,Ua=Array.prototype,$a=Ua.splice;function Na(t){var e=this.__data__,i=it(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():$a.call(e,i,1),--this.size,!0}var za=Na;function Ba(t){var e=this.__data__,i=it(e,t);return i<0?void 0:e[i][1]}var Ka=Ba;function Ha(t){return it(this.__data__,t)>-1}var Ga=Ha;function Qa(t,e){var i=this.__data__,r=it(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var Wa=Qa;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=Ra;ye.prototype.delete=za;ye.prototype.get=Ka;ye.prototype.has=Ga;ye.prototype.set=Wa;var rt=ye,Ya=ge(K,"Map"),Oe=Ya;function Za(){this.size=0,this.__data__={hash:new zi,map:new(Oe||rt),string:new zi}}var Ja=Za;function Xa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var el=Xa;function tl(t,e){var i=t.__data__;return el(e)?i[typeof e=="string"?"string":"hash"]:i.map}var nt=tl;function il(t){var e=nt(this,t).delete(t);return this.size-=e?1:0,e}var rl=il;function nl(t){return nt(this,t).get(t)}var ol=nl;function sl(t){return nt(this,t).has(t)}var al=sl;function ll(t,e){var i=nt(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var ul=ll;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=Ja;be.prototype.delete=rl;be.prototype.get=ol;be.prototype.has=al;be.prototype.set=ul;var rr=be;function dl(){this.__data__=new rt,this.size=0}var cl=dl;function pl(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var ml=pl;function fl(t){return this.__data__.get(t)}var gl=fl;function hl(t){return this.__data__.has(t)}var yl=hl,bl=200;function vl(t,e){var i=this.__data__;if(i instanceof rt){var r=i.__data__;if(!Oe||r.length<bl-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new rr(r)}return i.set(t,e),this.size=i.size,this}var wl=vl;function Le(t){var e=this.__data__=new rt(t);this.size=e.size}Le.prototype.clear=cl;Le.prototype.delete=ml;Le.prototype.get=gl;Le.prototype.has=yl;Le.prototype.set=wl;var _l=Object.prototype,Sg=_l.propertyIsEnumerable,xl=ge(K,"DataView"),jt=xl,Tl=ge(K,"Promise"),Ft=Tl,Il=ge(K,"Set"),Ot=Il,Bi="[object Map]",Sl="[object Object]",Ki="[object Promise]",Hi="[object Set]",Gi="[object WeakMap]",Qi="[object DataView]",El=ae(jt),Al=ae(Oe),Cl=ae(Ft),kl=ae(Ot),Pl=ae(Dt),me=Re;(jt&&me(new jt(new ArrayBuffer(1)))!=Qi||Oe&&me(new Oe)!=Bi||Ft&&me(Ft.resolve())!=Ki||Ot&&me(new Ot)!=Hi||Dt&&me(new Dt)!=Gi)&&(me=function(t){var e=Re(t),i=e==Sl?t.constructor:void 0,r=i?ae(i):"";if(r)switch(r){case El:return Qi;case Al:return Bi;case Cl:return Ki;case kl:return Hi;case Pl:return Gi}return e});var Eg=K.Uint8Array,ql="__lodash_hash_undefined__";function Vl(t){return this.__data__.set(t,ql),this}var Ml=Vl;function Dl(t){return this.__data__.has(t)}var jl=Dl;function Rt(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new rr;++e<i;)this.add(t[e])}Rt.prototype.add=Rt.prototype.push=Ml;Rt.prototype.has=jl;var Wi=fe?fe.prototype:void 0,Ag=Wi?Wi.valueOf:void 0,Fl=Object.prototype,Cg=Fl.hasOwnProperty,Ol=Object.prototype,kg=Ol.hasOwnProperty,Pg=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),qg=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Vg=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Rl(t){return t!==void 0}var Ll=Rl;function Ul(t){return t?.version?t.version.localeCompare("1.59.0",void 0,{numeric:!0,sensitivity:"base"})>=0&&typeof t.i18n?.translate=="function":!1}function $l(t){return typeof t?.translate=="function"}function Yi(t,e,i){return t&&Ul(t)&&$l(t.i18n)?t.i18n.translate(e):i}function S(t,e){if(typeof t.i18n?.getTranslations!="function"){t.i18n.setTranslations(e);return}let i=Object.keys(e),r=t.i18n.getTranslations(i),n={};for(let o of i){let s=e[o];if(!s)continue;let l=r[o]??{},u={};for(let[d,a]of Object.entries(s))!(d in l)&&a!==void 0&&(u[d]=a);Object.keys(u).length>0&&(n[o]=u)}Object.keys(n).length>0&&t.i18n.setTranslations(n)}function Nl(t,e){let{cesdk:i}=e,r=e.propertyKey??"image_url",n=Lt(t);return S(i,{en:{[`panel.${n}`]:"Select Image To Change","ly.img.ai.imageSelection.selectImage.label":"Select Image","ly.img.ai.imageSelection.error.svg":"SVG images are not supported. Please choose a different image.","ly.img.ai.imageSelection.error.invalidType":"Only images are supported. Found '{mimeType}'. Please choose a different image."}}),zl(t,i),{[r]:(o,s)=>{let{builder:l,experimental:{global:u},payload:d}=o,a,c=o.providerConfig,m=o.config,p=c?.properties?.[s.id]??m?.properties?.[s.id];p?.default&&(typeof p.default=="function"?a=p.default({}):a=p.default);let f=a??d?.url??e.defaultUrl,h=u(`${t}.${s.id}`,f);return l.MediaPreview(s.id,{preview:{type:"image",uri:h.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{i?.ui.openPanel(n,{payload:{onSelect:v=>{v.meta?.uri!=null&&h.setValue(v.meta?.uri)}}})}}}),()=>({id:s.id,type:"string",value:h.value})}}}function zl(t,e){e?.ui.registerPanel(Lt(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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Lt(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})})}function Lt(t){return`ly.img.ai.${t}.imageSelection`}var Bl=Nl;function Kl(t,e){let{cesdk:i}=e;if(i==null)return{};let r=e.propertyKey??"style",n=Gl(t);S(i,{en:{[`panel.${n}`]:"Select Style",[`${t}.${r}`]:"Style","ly.img.ai.styleTransfer.none":"None","ly.img.ai.styleTransfer.anime":"Anime","ly.img.ai.styleTransfer.cyberpunk":"Cyberpunk","ly.img.ai.styleTransfer.kodak400":"Kodak 400","ly.img.ai.styleTransfer.watercolor":"Watercolor","ly.img.ai.styleTransfer.darkFantasy":"Dark Fantasy","ly.img.ai.styleTransfer.vaporwave":"Vaporwave","ly.img.ai.styleTransfer.vectorFlat":"Vector Flat","ly.img.ai.styleTransfer.3dAnimation":"3D Animation","ly.img.ai.styleTransfer.ukiyoe":"Ukiyo\u2011e","ly.img.ai.styleTransfer.surreal":"Surreal","ly.img.ai.styleTransfer.steampunk":"Steampunk","ly.img.ai.styleTransfer.nightBokeh":"Night Bokeh","ly.img.ai.styleTransfer.popArt":"Pop Art"}});let o=Wl({baseURL:e.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",includeNone:!0,cesdk:i}),s=o;e.styles!=null&&(Array.isArray(e.styles)?s=e.styles:typeof e.styles=="function"&&(s=e.styles(o)));let l=Yl({cesdk:i,providerId:t,styles:s}),u=l.id;return Zl(l,{cesdk:i}),Hl({providerId:t,cesdk:i,panelId:n,entryId:u}),{[e.propertyKeyForPrompt??"prompt"]:(d,a)=>{let c=d.state("prompt","");return d.builder.TextArea(`${a.id}`,{inputLabel:e.i18n?.prompt?.inputLabel??e.propertyKeyForPrompt??"prompt",placeholder:e.i18n?.prompt?.placeholder,...c}),()=>{let[m]=l.getActiveAssetIds(),p=l.getAsset(m);return{id:a.id,type:"string",value:p?.meta?.prompt==null?c.value:`${c.value}; ${p.meta.prompt}`}}},[r]:(d,a)=>{let{builder:c,state:m}=d;if(s.length>0){let p=m("style",s[0]);return c.Button(`${a.id}`,{inputLabel:`${t}.${a.id}`,icon:"@imgly/Appearance",isDisabled:s.length===0,trailingIcon:"@imgly/ChevronRight",label:p.value.label,labelAlignment:"left",onClick:()=>{let f={onSelect:async h=>{l.clearActiveAssets(),l.setAssetActive(h.id),p.setValue({id:h.id,label:h.label??h.id}),i.ui.closePanel(n)}};i.ui.openPanel(n,{payload:f})}}),()=>({id:a.id,type:"string",value:p.value.id})}return()=>({id:a.id,type:"string",value:"none"})}}}function Hl(t){let{providerId:e,cesdk:i,panelId:r,entryId:n}=t;i?.ui.registerPanel(r,({builder:o,payload:s})=>{s?.onSelect==null&&o.Section(`${e}.error`,{children:()=>{o.Text("error",{content:"No onSelect function provided for the style selection panel."})}}),o.Library(`${e}.library.image`,{entries:[n],onSelect:async l=>{s?.onSelect?.(l)}})})}function Gl(t){return`ly.img.ai.${t}.styleSelection`}var Ql=[{id:"none",labelKey:"ly.img.ai.styleTransfer.none",prompt:""},{id:"anime-celshaded",labelKey:"ly.img.ai.styleTransfer.anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",labelKey:"ly.img.ai.styleTransfer.cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",labelKey:"ly.img.ai.styleTransfer.kodak400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",labelKey:"ly.img.ai.styleTransfer.watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",labelKey:"ly.img.ai.styleTransfer.darkFantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",labelKey:"ly.img.ai.styleTransfer.vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",labelKey:"ly.img.ai.styleTransfer.vectorFlat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",labelKey:"ly.img.ai.styleTransfer.3dAnimation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",labelKey:"ly.img.ai.styleTransfer.ukiyoe",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",labelKey:"ly.img.ai.styleTransfer.surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",labelKey:"ly.img.ai.styleTransfer.steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",labelKey:"ly.img.ai.styleTransfer.nightBokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",labelKey:"ly.img.ai.styleTransfer.popArt",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}];function Wl(t){return Ql.map(e=>e.id==="none"?t.includeNone?{id:e.id,label:Yi(t.cesdk,e.labelKey,e.labelKey),prompt:e.prompt,thumbUri:`${t.baseURL}thumbnails/None.svg`}:void 0:{id:e.id,label:Yi(t.cesdk,e.labelKey,e.labelKey),prompt:e.prompt,thumbUri:`${t.baseURL}thumbnails/${e.id}.jpeg`}).filter(Ll)}var Yl=t=>{let e=t.styles.map(s=>({...s,meta:{prompt:s.prompt}})),i=t.cesdk.engine.asset.findAllSources(),r=`${t.providerId}/styles`;for(;i.includes(r);)r+=`-${Math.random().toString(36).substring(2,5)}`;let n=new $o(r,e),o=t.styles[0];return n.setAssetActive(o.id),n},Zl=(t,e)=>{e.cesdk.engine.asset.addSource(t),e.cesdk.ui.addAssetLibraryEntry({id:t.id,sourceIds:[t.id],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:i})=>i,cardLabelPosition:()=>"below"})},Jl=Kl;var Xl="ly.img.ai";function _(t){return`${Xl}.${t}`}function ve(t,e){let i={...t};if(!e)return i;for(let[r,n]of Object.entries(e))n===!1||n===null||n===void 0?delete i[r]:n===!0?r in t||(i[r]=!0):i[r]=n;return i}var Mt="@imgly/plugin-ai-generation",Mg=`
5
+ `;else if(b==="event")s=T;else if(b==="id"&&!T.includes("\0"))o=T;else if(b==="retry"){let M=parseInt(T,10);Number.isNaN(M)||t({type:"reconnect-interval",value:M})}}}var Cr=[239,187,191];function Hu(t){return Cr.every((e,i)=>t.charCodeAt(i)===e)}Yt.createParser=Ku});var Zt=_(ne=>{"use strict";var Gu=ne&&ne.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(ne,"__esModule",{value:!0});ne.TOKEN_EXPIRATION_SECONDS=void 0;ne.getTemporaryAuthToken=Zu;var Qu=mt(),Wu=Se(),Yu=te();ne.TOKEN_EXPIRATION_SECONDS=120;function Zu(t,e){return Gu(this,void 0,void 0,function*(){let i=(0,Yu.parseEndpointId)(t),r=yield(0,Wu.dispatchRequest)({method:"POST",targetUrl:`${(0,Qu.getRestApiUrl)()}/tokens/`,config:e,input:{allowed_apps:[i.alias],token_expiration:ne.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var Xt=_(L=>{"use strict";var Ae=L&&L.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},ze=L&&L.__await||function(t){return this instanceof ze?(this.v=t,this):new ze(t)},Ju=L&&L.__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={},l("next"),l("throw"),l("return",s),n[Symbol.asyncIterator]=function(){return this},n;function s(p){return function(g){return Promise.resolve(g).then(p,c)}}function l(p,g){r[p]&&(n[p]=function(h){return new Promise(function(b,f){o.push([p,h,b,f])>1||u(p,h)})},g&&(n[p]=g(n[p])))}function u(p,g){try{d(r[p](g))}catch(h){m(o[0][3],h)}}function d(p){p.value instanceof ze?Promise.resolve(p.value.v).then(a,c):m(o[0][2],p)}function a(p){u("next",p)}function c(p){u("throw",p)}function m(p,g){p(g),o.shift(),o.length&&u(o[0][0],o[0][1])}};Object.defineProperty(L,"__esModule",{value:!0});L.FalStream=void 0;L.createStreamingClient=id;var Xu=kr(),ed=Zt(),Pr=Se(),Ee=ee(),Jt="text/event-stream",td=15*1e3,ft=class{constructor(e,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this._requestId=null,this.abortController=new AbortController,this.start=()=>Ae(this,void 0,void 0,function*(){var o,s;let{endpointId:l,options:u}=this,{input:d,method:a="post",connectionMode:c="server",tokenProvider:m}=u;try{if(c==="client"){let g=yield(m?()=>m(l):()=>(console.warn('[fal.stream] Using the default token provider is deprecated. Please provide a `tokenProvider` function when using `connectionMode: "client"`. See https://docs.fal.ai/fal-client/authentication for more information.'),(0,ed.getTemporaryAuthToken)(l,this.config)))(),{fetch:h}=this.config,b=new URL(this.url);b.searchParams.set("fal_jwt_token",g);let f=yield h(b.toString(),{method:a.toUpperCase(),headers:{accept:(o=u.accept)!==null&&o!==void 0?o:Jt,"content-type":"application/json"},body:d&&a!=="get"?JSON.stringify(d):void 0,signal:this.abortController.signal});return this._requestId=f.headers.get("x-fal-request-id"),yield this.handleResponse(f)}return yield(0,Pr.dispatchRequest)({method:a.toUpperCase(),targetUrl:this.url,input:d,config:this.config,options:{headers:{accept:(s=u.accept)!==null&&s!==void 0?s:Jt},responseHandler:p=>Ae(this,void 0,void 0,function*(){return this._requestId=p.headers.get("x-fal-request-id"),yield this.handleResponse(p)}),signal:this.abortController.signal}})}catch(p){this.handleError(p)}}),this.handleResponse=o=>Ae(this,void 0,void 0,function*(){var s,l;if(!o.ok){try{yield(0,Ee.defaultResponseHandler)(o)}catch(h){this.emit("error",h)}return}let u=o.body;if(!u){this.emit("error",new Ee.ApiError({message:"Response body is empty.",status:400,body:void 0,requestId:this._requestId||void 0}));return}if(!((s=o.headers.get("content-type"))!==null&&s!==void 0?s:"").startsWith(Jt)){let h=u.getReader(),b=()=>{h.read().then(({done:f,value:v})=>{if(f){this.emit("done",this.currentData);return}this.buffer.push(v),this.currentData=v,this.emit("data",v),b()})};b();return}let a=new TextDecoder("utf-8"),c=o.body.getReader(),m=(0,Xu.createParser)(h=>{if(h.type==="event"){let b=h.data;try{let f=JSON.parse(b);this.buffer.push(f),this.currentData=f,this.emit("data",f),this.emit("message",f)}catch(f){this.emit("error",f)}}}),p=(l=this.options.timeout)!==null&&l!==void 0?l:td,g=()=>Ae(this,void 0,void 0,function*(){let{value:h,done:b}=yield c.read();this.lastEventTimestamp=Date.now(),m.feed(a.decode(h)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new Ee.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408,requestId:this._requestId||void 0})),b?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 l=o instanceof Ee.ApiError?o:new Ee.ApiError({message:(s=o.message)!==null&&s!==void 0?s:"An unknown error occurred",status:500,requestId:this._requestId||void 0});this.emit("error",l)},this.on=(o,s)=>{var l;this.listeners.has(o)||this.listeners.set(o,[]),(l=this.listeners.get(o))===null||l===void 0||l.push(s)},this.emit=(o,s)=>{let l=this.listeners.get(o)||[];for(let u of l)u(s)},this.done=()=>Ae(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,Pr.buildUrl)(e,{path:"/stream",query:r.queryParams}),this.options=r,this.donePromise=new Promise((o,s)=>{this.streamClosed&&s(new Ee.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0,requestId:this._requestId||void 0})),this.signal.addEventListener("abort",()=>{var l;o((l=this.currentData)!==null&&l!==void 0?l:{})}),this.on("done",l=>{this.streamClosed=!0,o(l)}),this.on("error",l=>{this.streamClosed=!0,s(l)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return Ju(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 ze(n)),yield ze(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}get requestId(){return this._requestId}};L.FalStream=ft;function id({config:t,storage:e}){return{stream(i,r){return Ae(this,void 0,void 0,function*(){let n=r.input?yield e.transformInput(r.input):void 0;return new ft(i,t,Object.assign(Object.assign({},r),{input:n}))})}}}});var Dr=_(oe=>{"use strict";var ce=oe&&oe.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})},rd=oe&&oe.__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(oe,"__esModule",{value:!0});oe.createQueueClient=void 0;var ei=lt(),Q=Se(),nd=ee(),Mr=Ne(),od=Wt(),sd=Xt(),gt=te(),qr=500,Vr={maxRetries:3,baseDelay:1e3,maxDelay:6e4,retryableStatusCodes:Mr.DEFAULT_RETRYABLE_STATUS_CODES},ad={maxRetries:5,baseDelay:1e3,maxDelay:3e4,retryableStatusCodes:[...Mr.DEFAULT_RETRYABLE_STATUS_CODES,500]},ld=({config:t,storage:e})=>{let i={submit(r,n){return ce(this,void 0,void 0,function*(){let{webhookUrl:o,priority:s,hint:l,startTimeout:u,headers:d,storageSettings:a}=n,c=rd(n,["webhookUrl","priority","hint","startTimeout","headers","storageSettings"]),m=n.input?yield e.transformInput(n.input):void 0,p=Object.fromEntries(Object.entries(d??{}).map(([g,h])=>[g.toLowerCase(),h]));return(0,Q.dispatchRequest)({method:n.method,targetUrl:(0,Q.buildUrl)(r,Object.assign(Object.assign({},c),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p),(0,od.buildObjectLifecycleHeaders)(a)),{[ei.QUEUE_PRIORITY_HEADER]:s??"normal"}),l&&{[ei.RUNNER_HINT_HEADER]:l}),(0,ei.buildTimeoutHeaders)(u)),input:m,config:t,options:{signal:n.abortSignal,retry:Vr}})})},status(r,n){return ce(this,arguments,void 0,function*(o,{requestId:s,logs:l=!1,abortSignal:u}){let d=(0,gt.parseEndpointId)(o),a=d.namespace?`${d.namespace}/`:"";return(0,Q.dispatchRequest)({method:"get",targetUrl:(0,Q.buildUrl)(`${a}${d.owner}/${d.alias}`,{subdomain:"queue",query:{logs:l?"1":"0"},path:`/requests/${s}/status`}),config:t,options:{signal:u,retry:ad}})})},streamStatus(r,n){return ce(this,arguments,void 0,function*(o,{requestId:s,logs:l=!1,connectionMode:u}){let d=(0,gt.parseEndpointId)(o),a=d.namespace?`${d.namespace}/`:"",c={logs:l?"1":"0"},m=(0,Q.buildUrl)(`${a}${d.owner}/${d.alias}`,{subdomain:"queue",path:`/requests/${s}/status/stream`,query:c});return new sd.FalStream(o,t,{url:m,method:"get",connectionMode:u,queryParams:c})})},subscribeToStatus(r,n){return ce(this,void 0,void 0,function*(){let o=n.requestId,s=n.timeout,l,u=()=>{};if(n.mode==="streaming"){let d=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),a=[];s&&(l=setTimeout(()=>{throw d.abort(),i.cancel(r,{requestId:o}).catch(u),new Error(`Client timed out waiting for the request to complete after ${s}ms`)},s)),d.on("data",m=>{n.onQueueUpdate&&("logs"in m&&Array.isArray(m.logs)&&m.logs.length>0&&a.push(...m.logs),n.onQueueUpdate("logs"in m?Object.assign(Object.assign({},m),{logs:a}):m))});let c=yield d.done();return l&&clearTimeout(l),c}return new Promise((d,a)=>{var c;let m,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(c=n.pollInterval)!==null&&c!==void 0?c:qr,g=()=>{l&&clearTimeout(l),m&&clearTimeout(m)};s&&(l=setTimeout(()=>{g(),i.cancel(r,{requestId:o}).catch(u),a(new Error(`Client timed out waiting for the request to complete after ${s}ms`))},s));let h=()=>ce(this,void 0,void 0,function*(){var b;try{let f=yield i.status(r,{requestId:o,logs:(b=n.logs)!==null&&b!==void 0?b:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(f),f.status==="COMPLETED"){g(),d(f);return}m=setTimeout(h,p)}catch(f){g(),a(f)}});h().catch(a)})})},result(r,n){return ce(this,arguments,void 0,function*(o,{requestId:s,abortSignal:l}){let u=(0,gt.parseEndpointId)(o),d=u.namespace?`${u.namespace}/`:"";return(0,Q.dispatchRequest)({method:"get",targetUrl:(0,Q.buildUrl)(`${d}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}`}),config:Object.assign(Object.assign({},t),{responseHandler:nd.resultResponseHandler}),options:{signal:l,retry:Vr}})})},cancel(r,n){return ce(this,arguments,void 0,function*(o,{requestId:s,abortSignal:l}){let u=(0,gt.parseEndpointId)(o),d=u.namespace?`${u.namespace}/`:"";yield(0,Q.dispatchRequest)({method:"put",targetUrl:(0,Q.buildUrl)(`${d}${u.owner}/${u.alias}`,{subdomain:"queue",path:`/requests/${s}/cancel`}),config:t,options:{signal:l}})})}};return i};oe.createQueueClient=ld});var ht=_(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.utf8Count=ud;W.utf8EncodeJs=jr;W.utf8EncodeTE=Or;W.utf8Encode=pd;W.utf8DecodeJs=Fr;W.utf8DecodeTD=Rr;W.utf8Decode=hd;function ud(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 jr(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 l=t.charCodeAt(o);(l&64512)===56320&&(++o,s=((s&1023)<<10)+(l&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 dd=new TextEncoder,cd=50;function Or(t,e,i){dd.encodeInto(t,e.subarray(i))}function pd(t,e,i){t.length>cd?Or(t,e,i):jr(t,e,i)}var md=4096;function Fr(t,e,i){let r=e,n=r+i,o=[],s="";for(;r<n;){let l=t[r++];if(!(l&128))o.push(l);else if((l&224)===192){let u=t[r++]&63;o.push((l&31)<<6|u)}else if((l&240)===224){let u=t[r++]&63,d=t[r++]&63;o.push((l&31)<<12|u<<6|d)}else if((l&248)===240){let u=t[r++]&63,d=t[r++]&63,a=t[r++]&63,c=(l&7)<<18|u<<12|d<<6|a;c>65535&&(c-=65536,o.push(c>>>10&1023|55296),c=56320|c&1023),o.push(c)}else o.push(l);o.length>=md&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}var fd=new TextDecoder,gd=200;function Rr(t,e,i){let r=t.subarray(e,e+i);return fd.decode(r)}function hd(t,e,i){return i>gd?Rr(t,e,i):Fr(t,e,i)}});var ii=_(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.ExtData=void 0;var ti=class{type;data;constructor(e,i){this.type=e,this.data=i}};yt.ExtData=ti});var vt=_(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.DecodeError=void 0;var ri=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})}};bt.DecodeError=ri});var wt=_(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.UINT32_MAX=void 0;se.setUint64=yd;se.setInt64=bd;se.getInt64=vd;se.getUint64=wd;se.UINT32_MAX=4294967295;function yd(t,e,i){let r=i/4294967296,n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function bd(t,e,i){let r=Math.floor(i/4294967296),n=i;t.setUint32(e,r),t.setUint32(e+4,n)}function vd(t,e){let i=t.getInt32(e),r=t.getUint32(e+4);return i*4294967296+r}function wd(t,e){let i=t.getUint32(e),r=t.getUint32(e+4);return i*4294967296+r}});var ni=_(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.timestampExtension=O.EXT_TIMESTAMP=void 0;O.encodeTimeSpecToTimestamp=Lr;O.encodeDateToTimeSpec=$r;O.encodeTimestampExtension=Nr;O.decodeTimestampToTimeSpec=zr;O.decodeTimestampExtension=Br;var _d=vt(),Ur=wt();O.EXT_TIMESTAMP=-1;var xd=4294967296-1,Td=17179869184-1;function Lr({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Td)if(e===0&&t<=xd){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,Ur.setInt64)(r,4,t),i}}function $r(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 Nr(t){if(t instanceof Date){let e=$r(t);return Lr(e)}else return null}function zr(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let 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,Ur.getInt64)(e,4),r=e.getUint32(0);return{sec:i,nsec:r}}default:throw new _d.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Br(t){let e=zr(t);return new Date(e.sec*1e3+e.nsec/1e6)}O.timestampExtension={type:O.EXT_TIMESTAMP,encode:Nr,decode:Br}});var Tt=_(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.ExtensionCodec=void 0;var _t=ii(),Id=ni(),oi=class t{static defaultCodec=new t;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Id.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 _t.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 _t.ExtData(s,o)}}}return e instanceof _t.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 _t.ExtData(i,e)}};xt.ExtensionCodec=oi});var ai=_(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.ensureUint8Array=Ed;function Sd(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Ed(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Sd(t)?new Uint8Array(t):Uint8Array.from(t)}});var ui=_(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.Encoder=K.DEFAULT_INITIAL_BUFFER_SIZE=K.DEFAULT_MAX_DEPTH=void 0;var Kr=ht(),Ad=Tt(),Hr=wt(),Cd=ai();K.DEFAULT_MAX_DEPTH=100;K.DEFAULT_INITIAL_BUFFER_SIZE=2048;var li=class t{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Ad.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??K.DEFAULT_MAX_DEPTH,this.initialBufferSize=e?.initialBufferSize??K.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,Kr.utf8Count)(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,Kr.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,Cd.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,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}};K.Encoder=li});var Gr=_(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.encode=Pd;var kd=ui();function Pd(t,e){return new kd.Encoder(e).encodeSharedRef(t)}});var Qr=_(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.prettyByte=qd;function qd(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}});var Wr=_(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.CachedKeyDecoder=void 0;var Vd=ht(),Md=16,Dd=16,pi=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=Md,i=Dd){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 l=0;l<r;l++)if(s[l]!==e[i+l])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,Vd.utf8DecodeJs)(e,i,r),s=Uint8Array.prototype.slice.call(e,i,i+r);return this.store(s,o),o}};It.CachedKeyDecoder=pi});var Et=_(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.Decoder=void 0;var mi=Qr(),jd=Tt(),pe=wt(),Od=ht(),Yr=ai(),Fd=Wr(),Y=vt(),fi="array",Ke="map_key",Jr="map_value",Rd=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new Y.DecodeError("The type of key must be string or number but "+typeof t)},gi=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let i=this.getUninitializedStateFromPool();i.type=fi,i.position=0,i.size=e,i.array=new Array(e)}pushMapState(e){let i=this.getUninitializedStateFromPool();i.type=Ke,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===fi){let r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Ke||e.type===Jr){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}},Be=-1,yi=new DataView(new ArrayBuffer(0)),Ud=new Uint8Array(yi.buffer);try{yi.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 Zr=new RangeError("Insufficient data"),Ld=new Fd.CachedKeyDecoder,hi=class t{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=yi;bytes=Ud;headByte=Be;stack=new gi;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??jd.ExtensionCodec.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??pe.UINT32_MAX,this.maxBinLength=e?.maxBinLength??pe.UINT32_MAX,this.maxArrayLength=e?.maxArrayLength??pe.UINT32_MAX,this.maxMapLength=e?.maxMapLength??pe.UINT32_MAX,this.maxExtLength=e?.maxExtLength??pe.UINT32_MAX,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:Ld,this.mapKeyConverter=e?.mapKeyConverter??Rd}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=Be,this.stack.reset()}setBuffer(e){let i=(0,Yr.ensureUint8Array)(e);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Be&&!this.hasRemaining(1))this.setBuffer(e);else{let i=this.bytes.subarray(this.pos),r=(0,Yr.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 l of e){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(l);try{r=this.doDecodeSync(),i=!0}catch(u){if(!(u instanceof RangeError))throw u}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,mi.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 Y.DecodeError(`Unrecognized type byte: ${(0,mi.prettyByte)(e)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===fi)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===Ke){if(i==="__proto__")throw new Y.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=Jr;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=Ke;continue e}}return i}}readHeadByte(){return this.headByte===Be&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Be}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 Y.DecodeError(`Unrecognized array type byte: ${(0,mi.prettyByte)(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Y.DecodeError(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Y.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 Y.DecodeError(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+e)throw Zr;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?n=this.keyDecoder.decode(this.bytes,r,e):n=(0,Od.utf8Decode)(this.bytes,r,e),this.pos+=i+e,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ke:!1}decodeBinary(e,i){if(e>this.maxBinLength)throw new Y.DecodeError(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+i))throw Zr;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 Y.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,pe.getUint64)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,pe.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}};St.Decoder=hi});var en=_(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.decode=$d;At.decodeMulti=Nd;var Xr=Et();function $d(t,e){return new Xr.Decoder(e).decode(t)}function Nd(t,e){return new Xr.Decoder(e).decodeMulti(t)}});var nn=_(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.isAsyncIterable=tn;He.asyncIterableFromStream=rn;He.ensureAsyncIterable=zd;function tn(t){return t[Symbol.asyncIterator]!=null}async function*rn(t){let e=t.getReader();try{for(;;){let{done:i,value:r}=await e.read();if(i)return;yield r}}finally{e.releaseLock()}}function zd(t){return tn(t)?t:rn(t)}});var on=_(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.decodeAsync=Bd;Ge.decodeArrayStream=Kd;Ge.decodeMultiStream=Hd;var bi=Et(),vi=nn();async function Bd(t,e){let i=(0,vi.ensureAsyncIterable)(t);return new bi.Decoder(e).decodeAsync(i)}function Kd(t,e){let i=(0,vi.ensureAsyncIterable)(t);return new bi.Decoder(e).decodeArrayStream(i)}function Hd(t,e){let i=(0,vi.ensureAsyncIterable)(t);return new bi.Decoder(e).decodeStream(i)}});var an=_(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.decodeTimestampExtension=w.encodeTimestampExtension=w.decodeTimestampToTimeSpec=w.encodeTimeSpecToTimestamp=w.encodeDateToTimeSpec=w.EXT_TIMESTAMP=w.ExtData=w.ExtensionCodec=w.Encoder=w.DecodeError=w.Decoder=w.decodeMultiStream=w.decodeArrayStream=w.decodeAsync=w.decodeMulti=w.decode=w.encode=void 0;var Gd=Gr();Object.defineProperty(w,"encode",{enumerable:!0,get:function(){return Gd.encode}});var sn=en();Object.defineProperty(w,"decode",{enumerable:!0,get:function(){return sn.decode}});Object.defineProperty(w,"decodeMulti",{enumerable:!0,get:function(){return sn.decodeMulti}});var wi=on();Object.defineProperty(w,"decodeAsync",{enumerable:!0,get:function(){return wi.decodeAsync}});Object.defineProperty(w,"decodeArrayStream",{enumerable:!0,get:function(){return wi.decodeArrayStream}});Object.defineProperty(w,"decodeMultiStream",{enumerable:!0,get:function(){return wi.decodeMultiStream}});var Qd=Et();Object.defineProperty(w,"Decoder",{enumerable:!0,get:function(){return Qd.Decoder}});var Wd=vt();Object.defineProperty(w,"DecodeError",{enumerable:!0,get:function(){return Wd.DecodeError}});var Yd=ui();Object.defineProperty(w,"Encoder",{enumerable:!0,get:function(){return Yd.Encoder}});var Zd=Tt();Object.defineProperty(w,"ExtensionCodec",{enumerable:!0,get:function(){return Zd.ExtensionCodec}});var Jd=ii();Object.defineProperty(w,"ExtData",{enumerable:!0,get:function(){return Jd.ExtData}});var Ce=ni();Object.defineProperty(w,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return Ce.EXT_TIMESTAMP}});Object.defineProperty(w,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return Ce.encodeDateToTimeSpec}});Object.defineProperty(w,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return Ce.encodeTimeSpecToTimestamp}});Object.defineProperty(w,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return Ce.decodeTimestampToTimeSpec}});Object.defineProperty(w,"encodeTimestampExtension",{enumerable:!0,get:function(){return Ce.encodeTimestampExtension}});Object.defineProperty(w,"decodeTimestampExtension",{enumerable:!0,get:function(){return Ce.decodeTimestampExtension}})});var xn=_(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});function P(t){return{enumerable:!0,value:t}}function ln(t){return{enumerable:!0,writable:!0,value:t}}var me={},Xd=()=>!0,un=()=>({}),cn=t=>t,ec=(t,e,i,r)=>t.apply(i,r)&&e.apply(i,r),tc=(t,e,i,[r,n])=>e.call(i,t.call(i,r,n),n),ae=(t,e)=>Object.freeze(Object.create(t,e));function dn(t,e,i){return t.reduce((r,n)=>function(...o){return i(r,n,this,o)},e)}function pn(t){return ae(this,{fn:P(t)})}var mn={},fn=pn.bind(mn),ic=t=>fn((e,i)=>!!~t(e,i)&&e),gn={},rc=pn.bind(gn);function Ct(t,e){return e.filter(i=>t.isPrototypeOf(i))}function hn(t,e,...i){let r=dn(Ct(gn,i).map(o=>o.fn),Xd,ec),n=dn(Ct(mn,i).map(o=>o.fn),cn,tc);return ae(this,{from:P(t),to:P(e),guards:P(r),reducers:P(n)})}var yn={},bn={},nc=hn.bind(yn),oc=hn.bind(bn,null);function sc(t,e,i){return xi(e,t,i,this.immediates)||t}function vn(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 ac={enter:cn};function lc(...t){let e=Ct(yn,t),i=Ct(bn,t),r={final:P(t.length===0),transitions:P(vn(e))};return i.length&&(r.immediates=P(i),r.enter=P(sc)),ae(ac,r)}var uc={enter(t,e,i){let r=this.fn.call(e,e.context,i);return _i.isPrototypeOf(r)?ae(wn,{machine:P(r),transitions:P(this.transitions)}).enter(t,e,i):(r.then(n=>e.send({type:"done",data:n})).catch(n=>e.send({type:"error",error:n})),t)}},wn={enter(t,e,i){if(e.child=_n(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,xi(e,t,{type:"done",data:r},this.transitions.get("done"))}return t}};function dc(t,...e){let i=P(vn(e));return _i.isPrototypeOf(t)?ae(wn,{machine:P(t),transitions:i}):ae(uc,{fn:P(t),transitions:i})}var _i={get state(){return{name:this.current,value:this.states[this.current]}}};function cc(t,e,i=un){return typeof t!="string"&&(i=e||un,e=t,t=Object.keys(e)[0]),me._create&&me._create(t,e),ae(_i,{context:P(i),current:P(t),states:P(e)})}function xi(t,e,i,r){let{context:n}=t;for(let{to:o,guards:s,reducers:l}of r)if(s(n,i)){t.context=l.call(t,n,i);let u=e.original||e,d=ae(u,{current:P(o),original:{value:u}});return me._onEnter&&me._onEnter(e,o,t.context,n,i),d.state.value.enter(d,t,i)}}function pc(t,e){let i=e.type||e,{machine:r}=t,{value:n,name:o}=r.state;return n.transitions.has(i)?xi(t,r,e,n.transitions.get(i))||r:(me._send&&me._send(i,o),r)}var mc={send(t){this.machine=pc(this,t),this.onChange(this)}};function _n(t,e,i,r){let n=Object.create(mc,{machine:ln(t),context:ln(t.context(i,r)),onChange:P(e)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}F.action=ic;F.createMachine=cc;F.d=me;F.guard=rc;F.immediate=oc;F.interpret=_n;F.invoke=dc;F.reduce=fn;F.state=lc;F.transition=nc});var Cn=_(Ye=>{"use strict";var Tn=Ye&&Ye.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createRealtimeClient=qc;var We=an(),y=xn(),In=Zt(),Pt=ee(),Sn=pt(),Si=te(),fc=()=>({enqueuedMessage:void 0});function gc(t){return t.token!==void 0}function hc(t){return!gc(t)}function kt(t,e){return Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function Z(t){return t.websocket&&t.websocket.readyState===WebSocket.OPEN&&t.websocket.close(),Object.assign(Object.assign({},t),{websocket:void 0})}function yc(t,e){return t.websocket&&t.websocket.readyState===WebSocket.OPEN?(e.message instanceof Uint8Array||typeof e.message=="string"?t.websocket.send(e.message):t.websocket.send((0,We.encode)(e.message)),Object.assign(Object.assign({},t),{enqueuedMessage:void 0})):Object.assign(Object.assign({},t),{enqueuedMessage:e.message})}function Ti(t){return Object.assign(Object.assign({},t),{token:void 0})}function bc(t,e){return Object.assign(Object.assign({},t),{token:e.token})}function vc(t,e){return Object.assign(Object.assign({},t),{websocket:e.websocket})}var wc=(0,y.createMachine)("idle",{idle:(0,y.state)((0,y.transition)("send","connecting",(0,y.reduce)(kt)),(0,y.transition)("expireToken","idle",(0,y.reduce)(Ti)),(0,y.transition)("close","idle",(0,y.reduce)(Z))),connecting:(0,y.state)((0,y.transition)("connecting","connecting"),(0,y.transition)("connected","active",(0,y.reduce)(vc)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(Z)),(0,y.transition)("send","connecting",(0,y.reduce)(kt)),(0,y.transition)("close","idle",(0,y.reduce)(Z)),(0,y.immediate)("authRequired",(0,y.guard)(hc))),authRequired:(0,y.state)((0,y.transition)("initiateAuth","authInProgress"),(0,y.transition)("send","authRequired",(0,y.reduce)(kt)),(0,y.transition)("close","idle",(0,y.reduce)(Z))),authInProgress:(0,y.state)((0,y.transition)("authenticated","connecting",(0,y.reduce)(bc)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(Ti),(0,y.reduce)(Z)),(0,y.transition)("send","authInProgress",(0,y.reduce)(kt)),(0,y.transition)("close","idle",(0,y.reduce)(Z))),active:(0,y.state)((0,y.transition)("send","active",(0,y.reduce)(yc)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(Ti)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(Z)),(0,y.transition)("close","idle",(0,y.reduce)(Z))),failed:(0,y.state)((0,y.transition)("send","failed"),(0,y.transition)("close","idle",(0,y.reduce)(Z)))},fc);function _c(t,{token:e,maxBuffering:i,path:r}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let n=new URLSearchParams({fal_jwt_token:e});i!==void 0&&n.set("max_buffering",i.toFixed(0));let o=(0,Si.ensureEndpointIdFormat)(t),s=r?`/${r.replace(/^\/+/,"")}`:"/realtime";return`wss://fal.run/${o}${s}?${n.toString()}`}var xc=128;function Tc(t){return t.status==="error"&&t.error==="Unauthorized"}var Ic={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Ii=new Map,En=new Map;function Sc(t,e,i){if(!Ii.has(t)){let r=(0,y.interpret)(wc,i);Ii.set(t,Object.assign(Object.assign({},r),{throttledSend:e>0?(0,Si.throttle)(r.send,e,!0):r.send}))}return Ii.get(t)}var Qe=()=>{},Ec={send:Qe,close:Qe};function Ac(t){return t.status!=="error"&&t.type!=="x-fal-message"&&!An(t)}function An(t){return t.type==="x-fal-error"}function Cc(t){return Tn(this,void 0,void 0,function*(){if(typeof t=="string")return JSON.parse(t);let e=i=>Tn(this,void 0,void 0,function*(){return i instanceof Uint8Array?i:i instanceof Blob?new Uint8Array(yield i.arrayBuffer()):new Uint8Array(i)});return t instanceof ArrayBuffer||t instanceof Uint8Array?(0,We.decode)(yield e(t)):t instanceof Blob?(0,We.decode)(yield e(t)):t})}function kc(t){return t instanceof Uint8Array?t:(0,We.encode)(t)}function Pc({data:t,decodeMessage:e,onResult:i,onError:r,send:n}){let o=s=>{if(Tc(s)){n({type:"unauthorized",error:new Error("Unauthorized")});return}if(Ac(s)){i(s);return}if(An(s)){if(s.error==="TIMEOUT")return;r(new Pt.ApiError({message:`${s.error}: ${s.reason}`,status:400,body:s}));return}};Promise.resolve(e?e(t):t).then(o).catch(s=>{var l;r(new Pt.ApiError({message:(l=s?.message)!==null&&l!==void 0?l:"Failed to decode realtime message",status:400}))})}function qc({config:t}){return{connect(e,i){let{clientOnly:r=(0,Si.isReact)()&&!(0,Sn.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,path:s,throttleInterval:l=xc,encodeMessage:u,decodeMessage:d,tokenProvider:a,tokenExpirationSeconds:c}=i;if(r&&!(0,Sn.isBrowser)())return Ec;let m=u??(T=>kc(T)),p=d??(T=>Cc(T)),g,h;En.set(n,{decodeMessage:p,onError:i.onError,onResult:i.onResult});let b=()=>En.get(n),f=Sc(n,l,({context:T,machine:M,send:$})=>{let{enqueuedMessage:le,token:nt,websocket:ge}=T;if(h=le,M.current==="active"&&le&&ge?.readyState===WebSocket.OPEN&&$({type:"send",message:le}),M.current==="authRequired"&&nt===void 0&&g!==M.current&&($({type:"initiateAuth"}),(a?()=>a(e):()=>(console.warn("[fal.realtime] Using the default token provider is deprecated. Please provide a `tokenProvider` function to `fal.realtime.connect()`. See https://docs.fal.ai/fal-client/authentication for more information."),(0,In.getTemporaryAuthToken)(e,t)))().then(V=>{$({type:"authenticated",token:V});let D=a?c:In.TOKEN_EXPIRATION_SECONDS;if(D!==void 0){let he=Math.round(D*.9*1e3);setTimeout(()=>{$({type:"expireToken"})},he)}}).catch(V=>{$({type:"unauthorized",error:V})})),M.current==="connecting"&&g!==M.current&&nt!==void 0){let H=new WebSocket(_c(e,{token:nt,maxBuffering:o,path:s}));H.onopen=()=>{var V,D;$({type:"connected",websocket:H});let he=(D=(V=f.context)===null||V===void 0?void 0:V.enqueuedMessage)!==null&&D!==void 0?D:h;he&&(H.send(m(he)),f.context=Object.assign(Object.assign({},f.context),{enqueuedMessage:void 0}))},H.onclose=V=>{if(V.code!==Ic.NORMAL_CLOSURE){let{onError:D=Qe}=b();D(new Pt.ApiError({message:`Error closing the connection: ${V.reason}`,status:V.code}))}$({type:"connectionClosed",code:V.code})},H.onerror=V=>{let{onError:D=Qe}=b();D(new Pt.ApiError({message:"Unknown error",status:500}))},H.onmessage=V=>{let{decodeMessage:D=p,onResult:he,onError:Ro=Qe}=b();Pc({data:V.data,decodeMessage:D,onResult:he,onError:Ro,send:$})}}g=M.current});return{send:T=>{f.throttledSend({type:"send",message:m(T)})},close:()=>{f.send({type:"close"})}}}}}});var Ei=_(Ze=>{"use strict";var kn=Ze&&Ze.__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 l(a){try{d(r.next(a))}catch(c){s(c)}}function u(a){try{d(r.throw(a))}catch(c){s(c)}}function d(a){a.done?o(a.value):n(a.value).then(l,u)}d((r=r.apply(t,e||[])).next())})};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createFalClient=Rc;var Vc=mt(),Mc=lt(),Dc=Dr(),jc=Cn(),Pn=Se(),Oc=ee(),qn=Wt(),Fc=Xt();function Rc(t={}){let e=(0,Vc.createConfig)(t),i=(0,qn.createStorageClient)({config:e}),r=(0,Dc.createQueueClient)({config:e,storage:i}),n=(0,Fc.createStreamingClient)({config:e,storage:i}),o=(0,jc.createRealtimeClient)({config:e});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(s){return kn(this,arguments,void 0,function*(l,u={}){let d=u.input?yield i.transformInput(u.input):void 0;return(0,Pn.dispatchRequest)({method:u.method,targetUrl:(0,Pn.buildUrl)(l,u),input:d,headers:Object.assign(Object.assign({},(0,qn.buildObjectLifecycleHeaders)(u.storageSettings)),(0,Mc.buildTimeoutHeaders)(u.startTimeout)),config:Object.assign(Object.assign({},e),{responseHandler:Oc.resultResponseHandler}),options:{signal:u.abortSignal,retry:{maxRetries:3,baseDelay:500,maxDelay:15e3}}})})},subscribe:(s,l)=>kn(this,void 0,void 0,function*(){let{request_id:u}=yield r.submit(s,l);return l.onEnqueue&&l.onEnqueue(u),yield r.subscribeToStatus(s,Object.assign({requestId:u},l)),r.result(s,{requestId:u})})}}});var Mn=_(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.isQueueStatus=Vn;qt.isCompletedQueueStatus=Uc;function Vn(t){return t&&t.status&&t.response_url}function Uc(t){return Vn(t)&&t.status==="COMPLETED"}});var Fn=_(k=>{"use strict";var Lc=k&&k.__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]}),$c=k&&k.__exportStar||function(t,e){for(var i in t)i!=="default"&&!Object.prototype.hasOwnProperty.call(e,i)&&Lc(e,t,i)};Object.defineProperty(k,"__esModule",{value:!0});k.fal=k.parseEndpointId=k.isRetryableError=k.ValidationError=k.ApiError=k.withProxy=k.withMiddleware=k.createFalClient=void 0;var Dn=Ei(),Nc=Ei();Object.defineProperty(k,"createFalClient",{enumerable:!0,get:function(){return Nc.createFalClient}});var jn=Kt();Object.defineProperty(k,"withMiddleware",{enumerable:!0,get:function(){return jn.withMiddleware}});Object.defineProperty(k,"withProxy",{enumerable:!0,get:function(){return jn.withProxy}});var On=ee();Object.defineProperty(k,"ApiError",{enumerable:!0,get:function(){return On.ApiError}});Object.defineProperty(k,"ValidationError",{enumerable:!0,get:function(){return On.ValidationError}});var zc=Ne();Object.defineProperty(k,"isRetryableError",{enumerable:!0,get:function(){return zc.isRetryableError}});$c(Mn(),k);var Bc=te();Object.defineProperty(k,"parseEndpointId",{enumerable:!0,get:function(){return Bc.parseEndpointId}});k.fal=function(){let e=(0,Dn.createFalClient)();return{config(i){e=(0,Dn.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 Li={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:[]}]};async function X(t,e,i){if(e!=null){if(e.startsWith("blob:")){let n=await(await fetch(e)).blob(),o=new File([n],"image.png",{type:"image/png"});return t.storage.upload(o)}if(i!=null&&e.startsWith("buffer:")){let r=await i.engine.editor.getMimeType(e),n=i.engine.editor.getBufferLength(e),o=i.engine.editor.getBufferData(e,0,n),s=new Uint8Array(o),l=new File([s],"image.png",{type:r});return t.storage.upload(l)}return e}}var Go=class{constructor(t,e=[],i){this.id=t,this.translateLabel=i?.translateLabel,this.assets=e.map(r=>{if(typeof r.label=="string"&&!(r.label&&typeof r.label=="object")){let n=r;return{id:n.id,label:{en:n.label},meta:n.thumbUri?{...n.meta??{},thumbUri:n.thumbUri}:n.meta}}return r}),this.activeAssetIds=new Set,this.assets.length>0&&this.activeAssetIds.add(this.assets[0].id)}async findAssets(t){let{page:e,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:s,groups:l,excludeGroups:u,sortingOrder:d,sortKey:a}=t,c=[...this.assets];if(l&&l.length>0&&(c=c.filter(f=>f.groups&&l.some(v=>f.groups?.includes(v)))),u&&u.length>0&&(c=c.filter(f=>!f.groups||!u.some(v=>f.groups?.includes(v)))),o){let f=o.toLowerCase();c=c.filter(v=>{let C=v.label?.[r]?.toLowerCase(),T=v.tags?.[r]||[];return C&&C.includes(f)||T.some(M=>M.toLowerCase().includes(f))})}if(s&&s.length>0){let f=Array.isArray(s)?s:[s];c=c.filter(v=>{let C=v.tags?.[r]||[];return f.some(T=>C.includes(T))})}n&&c.sort((f,v)=>{let C=this.activeAssetIds.has(f.id),T=this.activeAssetIds.has(v.id);return C&&!T?-1:!C&&T?1:0}),a&&a!=="id"?c.sort((f,v)=>{let C=f.meta?.[a],T=v.meta?.[a];return C===void 0?1:T===void 0?-1:typeof C=="string"&&typeof T=="string"?d==="Descending"?T.localeCompare(C):C.localeCompare(T):typeof C=="number"&&typeof T=="number"?d==="Descending"?T-C:C-T:0}):a==="id"&&c.sort((f,v)=>d==="Descending"?v.id.localeCompare(f.id):f.id.localeCompare(v.id));let m=c.length,p=e*i,g=p+i,h=c.slice(p,g).map(f=>{let v=f.label?.[r]||"",C=this.translateLabel?this.translateLabel(f.id,v,r):v;return{id:f.id,groups:f.groups,meta:f.meta,payload:f.payload,locale:r,label:C,tags:f.tags?.[r],active:this.activeAssetIds.has(f.id)}}),b=g<m?e+1:void 0;return{assets:h,currentPage:e,nextPage:b,total:m}}updateLabel(t,e,i){this.assets.forEach(r=>{r.id===t&&(r.label=r.label||{},r.label[i]=e)})}getAssetSelectValue(t){let e=this.assets.find(({id:i})=>i===t);if(e){let i=this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||"";return{id:e.id,label:i,thumbUri:e.meta?.thumbUri}}}getActiveSelectValue(){let t=this.getActiveAssetIds();if(t.length>0){let e=this.assets.find(({id:i})=>i===t[0]);if(e){let i=this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||"";return{id:e.id,label:i,thumbUri:e.meta?.thumbUri}}}}getTranslatedLabel(t){let e=this.assets.find(({id:i})=>i===t);if(e)return this.translateLabel?this.translateLabel(e.id,e.label?.en||"",""):e.label?.en||""}getAsset(t){return this.assets.find(e=>e.id===t)}setAssetActive(t){this.activeAssetIds.add(t)}getActiveAssetIds(){return Array.from(this.activeAssetIds)}setAssetsActive(t){t.forEach(e=>this.activeAssetIds.add(e))}setAssetInactive(t){this.activeAssetIds.delete(t)}clearActiveAssets(){this.activeAssetIds.clear()}isAssetActive(t){return this.activeAssetIds.has(t)}addAsset(t){let e=this.assets.findIndex(i=>i.id===t.id);e>=0?this.assets[e]=t:this.assets.push(t)}removeAsset(t){let e=this.assets.findIndex(i=>i.id===t);e!==-1&&(this.assets.splice(e,1),this.activeAssetIds.delete(t))}async getGroups(){let t=new Set;return this.assets.forEach(e=>{e.groups&&e.groups.forEach(i=>t.add(i))}),Array.from(t)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var Qo=typeof global=="object"&&global&&global.Object===Object&&global,ir=Qo,Wo=typeof self=="object"&&self&&self.Object===Object&&self,Yo=ir||Wo||Function("return this")(),G=Yo,Zo=G.Symbol,be=Zo,rr=Object.prototype,Jo=rr.hasOwnProperty,Xo=rr.toString,Oe=be?be.toStringTag:void 0;function es(t){var e=Jo.call(t,Oe),i=t[Oe];try{t[Oe]=void 0;var r=!0}catch{}var n=Xo.call(t);return r&&(e?t[Oe]=i:delete t[Oe]),n}var ts=es,is=Object.prototype,rs=is.toString;function ns(t){return rs.call(t)}var os=ns,ss="[object Null]",as="[object Undefined]",$i=be?be.toStringTag:void 0;function ls(t){return t==null?t===void 0?as:ss:$i&&$i in Object(t)?ts(t):os(t)}var Le=ls;function us(t){return t!=null&&typeof t=="object"}var Bt=us,Ig=Array.isArray;function ds(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var nr=ds,cs="[object AsyncFunction]",ps="[object Function]",ms="[object GeneratorFunction]",fs="[object Proxy]";function gs(t){if(!nr(t))return!1;var e=Le(t);return e==ps||e==ms||e==cs||e==fs}var hs=gs,ys=G["__core-js_shared__"],jt=ys,Ni=function(){var t=/[^.]+$/.exec(jt&&jt.keys&&jt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function bs(t){return!!Ni&&Ni in t}var vs=bs,ws=Function.prototype,_s=ws.toString;function xs(t){if(t!=null){try{return _s.call(t)}catch{}try{return t+""}catch{}}return""}var ue=xs,Ts=/[\\^$.*+?()[\]{}|]/g,Is=/^\[object .+?Constructor\]$/,Ss=Function.prototype,Es=Object.prototype,As=Ss.toString,Cs=Es.hasOwnProperty,ks=RegExp("^"+As.call(Cs).replace(Ts,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ps(t){if(!nr(t)||vs(t))return!1;var e=hs(t)?ks:Is;return e.test(ue(t))}var qs=Ps;function Vs(t,e){return t?.[e]}var Ms=Vs;function Ds(t,e){var i=Ms(t,e);return qs(i)?i:void 0}var ve=Ds,js=ve(G,"WeakMap"),Rt=js;function Os(t,e){return t===e||t!==t&&e!==e}var Fs=Os,Rs=9007199254740991;function Us(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rs}var Ls=Us,Sg=Object.prototype,$s="[object Arguments]";function Ns(t){return Bt(t)&&Le(t)==$s}var zi=Ns,or=Object.prototype,zs=or.hasOwnProperty,Bs=or.propertyIsEnumerable,Eg=zi(function(){return arguments}())?zi:function(t){return Bt(t)&&zs.call(t,"callee")&&!Bs.call(t,"callee")},sr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bi=sr&&typeof module=="object"&&module&&!module.nodeType&&module,Ks=Bi&&Bi.exports===sr,Ki=Ks?G.Buffer:void 0,Ag=Ki?Ki.isBuffer:void 0,Hs="[object Arguments]",Gs="[object Array]",Qs="[object Boolean]",Ws="[object Date]",Ys="[object Error]",Zs="[object Function]",Js="[object Map]",Xs="[object Number]",ea="[object Object]",ta="[object RegExp]",ia="[object Set]",ra="[object String]",na="[object WeakMap]",oa="[object ArrayBuffer]",sa="[object DataView]",aa="[object Float32Array]",la="[object Float64Array]",ua="[object Int8Array]",da="[object Int16Array]",ca="[object Int32Array]",pa="[object Uint8Array]",ma="[object Uint8ClampedArray]",fa="[object Uint16Array]",ga="[object Uint32Array]",E={};E[aa]=E[la]=E[ua]=E[da]=E[ca]=E[pa]=E[ma]=E[fa]=E[ga]=!0;E[Hs]=E[Gs]=E[oa]=E[Qs]=E[sa]=E[Ws]=E[Ys]=E[Zs]=E[Js]=E[Xs]=E[ea]=E[ta]=E[ia]=E[ra]=E[na]=!1;function ha(t){return Bt(t)&&Ls(t.length)&&!!E[Le(t)]}var ya=ha;function ba(t){return function(e){return t(e)}}var va=ba,ar=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fe=ar&&typeof module=="object"&&module&&!module.nodeType&&module,wa=Fe&&Fe.exports===ar,Ot=wa&&ir.process,_a=function(){try{var t=Fe&&Fe.require&&Fe.require("util").types;return t||Ot&&Ot.binding&&Ot.binding("util")}catch{}}(),Hi=_a,Gi=Hi&&Hi.isTypedArray,Cg=Gi?va(Gi):ya,xa=Object.prototype,kg=xa.hasOwnProperty;function Ta(t,e){return function(i){return t(e(i))}}var Ia=Ta,Pg=Ia(Object.keys,Object),Sa=Object.prototype,qg=Sa.hasOwnProperty,Ea=ve(Object,"create"),Re=Ea;function Aa(){this.__data__=Re?Re(null):{},this.size=0}var Ca=Aa;function ka(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Pa=ka,qa="__lodash_hash_undefined__",Va=Object.prototype,Ma=Va.hasOwnProperty;function Da(t){var e=this.__data__;if(Re){var i=e[t];return i===qa?void 0:i}return Ma.call(e,t)?e[t]:void 0}var ja=Da,Oa=Object.prototype,Fa=Oa.hasOwnProperty;function Ra(t){var e=this.__data__;return Re?e[t]!==void 0:Fa.call(e,t)}var Ua=Ra,La="__lodash_hash_undefined__";function $a(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Re&&e===void 0?La:e,this}var Na=$a;function we(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])}}we.prototype.clear=Ca;we.prototype.delete=Pa;we.prototype.get=ja;we.prototype.has=Ua;we.prototype.set=Na;var Qi=we;function za(){this.__data__=[],this.size=0}var Ba=za;function Ka(t,e){for(var i=t.length;i--;)if(Fs(t[i][0],e))return i;return-1}var ot=Ka,Ha=Array.prototype,Ga=Ha.splice;function Qa(t){var e=this.__data__,i=ot(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Ga.call(e,i,1),--this.size,!0}var Wa=Qa;function Ya(t){var e=this.__data__,i=ot(e,t);return i<0?void 0:e[i][1]}var Za=Ya;function Ja(t){return ot(this.__data__,t)>-1}var Xa=Ja;function el(t,e){var i=this.__data__,r=ot(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var tl=el;function _e(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])}}_e.prototype.clear=Ba;_e.prototype.delete=Wa;_e.prototype.get=Za;_e.prototype.has=Xa;_e.prototype.set=tl;var st=_e,il=ve(G,"Map"),Ue=il;function rl(){this.size=0,this.__data__={hash:new Qi,map:new(Ue||st),string:new Qi}}var nl=rl;function ol(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var sl=ol;function al(t,e){var i=t.__data__;return sl(e)?i[typeof e=="string"?"string":"hash"]:i.map}var at=al;function ll(t){var e=at(this,t).delete(t);return this.size-=e?1:0,e}var ul=ll;function dl(t){return at(this,t).get(t)}var cl=dl;function pl(t){return at(this,t).has(t)}var ml=pl;function fl(t,e){var i=at(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var gl=fl;function xe(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])}}xe.prototype.clear=nl;xe.prototype.delete=ul;xe.prototype.get=cl;xe.prototype.has=ml;xe.prototype.set=gl;var lr=xe;function hl(){this.__data__=new st,this.size=0}var yl=hl;function bl(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var vl=bl;function wl(t){return this.__data__.get(t)}var _l=wl;function xl(t){return this.__data__.has(t)}var Tl=xl,Il=200;function Sl(t,e){var i=this.__data__;if(i instanceof st){var r=i.__data__;if(!Ue||r.length<Il-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new lr(r)}return i.set(t,e),this.size=i.size,this}var El=Sl;function $e(t){var e=this.__data__=new st(t);this.size=e.size}$e.prototype.clear=yl;$e.prototype.delete=vl;$e.prototype.get=_l;$e.prototype.has=Tl;$e.prototype.set=El;var Al=Object.prototype,Vg=Al.propertyIsEnumerable,Cl=ve(G,"DataView"),Ut=Cl,kl=ve(G,"Promise"),Lt=kl,Pl=ve(G,"Set"),$t=Pl,Wi="[object Map]",ql="[object Object]",Yi="[object Promise]",Zi="[object Set]",Ji="[object WeakMap]",Xi="[object DataView]",Vl=ue(Ut),Ml=ue(Ue),Dl=ue(Lt),jl=ue($t),Ol=ue(Rt),ye=Le;(Ut&&ye(new Ut(new ArrayBuffer(1)))!=Xi||Ue&&ye(new Ue)!=Wi||Lt&&ye(Lt.resolve())!=Yi||$t&&ye(new $t)!=Zi||Rt&&ye(new Rt)!=Ji)&&(ye=function(t){var e=Le(t),i=e==ql?t.constructor:void 0,r=i?ue(i):"";if(r)switch(r){case Vl:return Xi;case Ml:return Wi;case Dl:return Yi;case jl:return Zi;case Ol:return Ji}return e});var Mg=G.Uint8Array,Fl="__lodash_hash_undefined__";function Rl(t){return this.__data__.set(t,Fl),this}var Ul=Rl;function Ll(t){return this.__data__.has(t)}var $l=Ll;function Nt(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new lr;++e<i;)this.add(t[e])}Nt.prototype.add=Nt.prototype.push=Ul;Nt.prototype.has=$l;var er=be?be.prototype:void 0,Dg=er?er.valueOf:void 0,Nl=Object.prototype,jg=Nl.hasOwnProperty,zl=Object.prototype,Og=zl.hasOwnProperty,Fg=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Rg=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Ug=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Bl(t){return t!==void 0}var Kl=Bl;function Hl(t){return t?.version?t.version.localeCompare("1.59.0",void 0,{numeric:!0,sensitivity:"base"})>=0&&typeof t.i18n?.translate=="function":!1}function Gl(t){return typeof t?.translate=="function"}function tr(t,e,i){return t&&Hl(t)&&Gl(t.i18n)?t.i18n.translate(e):i}function I(t,e){if(typeof t.i18n?.getTranslations!="function"){t.i18n.setTranslations(e);return}let i=Object.keys(e),r=t.i18n.getTranslations(i),n={};for(let o of i){let s=e[o];if(!s)continue;let l=r[o]??{},u={};for(let[d,a]of Object.entries(s))!(d in l)&&a!==void 0&&(u[d]=a);Object.keys(u).length>0&&(n[o]=u)}Object.keys(n).length>0&&t.i18n.setTranslations(n)}function Ql(t,e){let{cesdk:i}=e,r=e.propertyKey??"image_url",n=zt(t);return I(i,{en:{[`panel.${n}`]:"Select Image To Change","ly.img.ai.imageSelection.selectImage.label":"Select Image","ly.img.ai.imageSelection.error.svg":"SVG images are not supported. Please choose a different image.","ly.img.ai.imageSelection.error.invalidType":"Only images are supported. Found '{mimeType}'. Please choose a different image."}}),Wl(t,i),{[r]:(o,s)=>{let{builder:l,experimental:{global:u},payload:d}=o,a,c=o.providerConfig,m=o.config,p=c?.properties?.[s.id]??m?.properties?.[s.id];p?.default&&(typeof p.default=="function"?a=p.default({}):a=p.default);let g=a??d?.url??e.defaultUrl,h=u(`${t}.${s.id}`,g);return l.MediaPreview(s.id,{preview:{type:"image",uri:h.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{i?.ui.openPanel(n,{payload:{onSelect:b=>{b.meta?.uri!=null&&h.setValue(b.meta?.uri)}}})}}}),()=>({id:s.id,type:"string",value:h.value})}}}function Wl(t,e){e?.ui.registerPanel(zt(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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(zt(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})})}function zt(t){return`ly.img.ai.${t}.imageSelection`}var Yl=Ql;function Zl(t,e){let{cesdk:i}=e;if(i==null)return{};let r=e.propertyKey??"style",n=Xl(t);I(i,{en:{[`panel.${n}`]:"Select Style",[`${t}.${r}`]:"Style","ly.img.ai.styleTransfer.none":"None","ly.img.ai.styleTransfer.anime":"Anime","ly.img.ai.styleTransfer.cyberpunk":"Cyberpunk","ly.img.ai.styleTransfer.kodak400":"Kodak 400","ly.img.ai.styleTransfer.watercolor":"Watercolor","ly.img.ai.styleTransfer.darkFantasy":"Dark Fantasy","ly.img.ai.styleTransfer.vaporwave":"Vaporwave","ly.img.ai.styleTransfer.vectorFlat":"Vector Flat","ly.img.ai.styleTransfer.3dAnimation":"3D Animation","ly.img.ai.styleTransfer.ukiyoe":"Ukiyo\u2011e","ly.img.ai.styleTransfer.surreal":"Surreal","ly.img.ai.styleTransfer.steampunk":"Steampunk","ly.img.ai.styleTransfer.nightBokeh":"Night Bokeh","ly.img.ai.styleTransfer.popArt":"Pop Art"}});let o=tu({baseURL:e.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",includeNone:!0,cesdk:i}),s=o;e.styles!=null&&(Array.isArray(e.styles)?s=e.styles:typeof e.styles=="function"&&(s=e.styles(o)));let l=iu({cesdk:i,providerId:t,styles:s}),u=l.id;return ru(l,{cesdk:i}),Jl({providerId:t,cesdk:i,panelId:n,entryId:u}),{[e.propertyKeyForPrompt??"prompt"]:(d,a)=>{let c=d.state("prompt","");return d.builder.TextArea(`${a.id}`,{inputLabel:e.i18n?.prompt?.inputLabel??e.propertyKeyForPrompt??"prompt",placeholder:e.i18n?.prompt?.placeholder,...c}),()=>{let[m]=l.getActiveAssetIds(),p=l.getAsset(m);return{id:a.id,type:"string",value:p?.meta?.prompt==null?c.value:`${c.value}; ${p.meta.prompt}`}}},[r]:(d,a)=>{let{builder:c,state:m}=d;if(s.length>0){let p=m("style",s[0]);return c.Button(`${a.id}`,{inputLabel:`${t}.${a.id}`,icon:"@imgly/Appearance",isDisabled:s.length===0,trailingIcon:"@imgly/ChevronRight",label:p.value.label,labelAlignment:"left",onClick:()=>{let g={onSelect:async h=>{l.clearActiveAssets(),l.setAssetActive(h.id),p.setValue({id:h.id,label:h.label??h.id}),i.ui.closePanel(n)}};i.ui.openPanel(n,{payload:g})}}),()=>({id:a.id,type:"string",value:p.value.id})}return()=>({id:a.id,type:"string",value:"none"})}}}function Jl(t){let{providerId:e,cesdk:i,panelId:r,entryId:n}=t;i?.ui.registerPanel(r,({builder:o,payload:s})=>{s?.onSelect==null&&o.Section(`${e}.error`,{children:()=>{o.Text("error",{content:"No onSelect function provided for the style selection panel."})}}),o.Library(`${e}.library.image`,{entries:[n],onSelect:async l=>{s?.onSelect?.(l)}})})}function Xl(t){return`ly.img.ai.${t}.styleSelection`}var eu=[{id:"none",labelKey:"ly.img.ai.styleTransfer.none",prompt:""},{id:"anime-celshaded",labelKey:"ly.img.ai.styleTransfer.anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",labelKey:"ly.img.ai.styleTransfer.cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",labelKey:"ly.img.ai.styleTransfer.kodak400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",labelKey:"ly.img.ai.styleTransfer.watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",labelKey:"ly.img.ai.styleTransfer.darkFantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",labelKey:"ly.img.ai.styleTransfer.vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",labelKey:"ly.img.ai.styleTransfer.vectorFlat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",labelKey:"ly.img.ai.styleTransfer.3dAnimation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",labelKey:"ly.img.ai.styleTransfer.ukiyoe",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",labelKey:"ly.img.ai.styleTransfer.surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",labelKey:"ly.img.ai.styleTransfer.steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",labelKey:"ly.img.ai.styleTransfer.nightBokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",labelKey:"ly.img.ai.styleTransfer.popArt",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}];function tu(t){return eu.map(e=>e.id==="none"?t.includeNone?{id:e.id,label:tr(t.cesdk,e.labelKey,e.labelKey),prompt:e.prompt,thumbUri:`${t.baseURL}thumbnails/None.svg`}:void 0:{id:e.id,label:tr(t.cesdk,e.labelKey,e.labelKey),prompt:e.prompt,thumbUri:`${t.baseURL}thumbnails/${e.id}.jpeg`}).filter(Kl)}var iu=t=>{let e=t.styles.map(s=>({...s,meta:{prompt:s.prompt}})),i=t.cesdk.engine.asset.findAllSources(),r=`${t.providerId}/styles`;for(;i.includes(r);)r+=`-${Math.random().toString(36).substring(2,5)}`;let n=new Go(r,e),o=t.styles[0];return n.setAssetActive(o.id),n},ru=(t,e)=>{e.cesdk.engine.asset.addSource(t),e.cesdk.ui.addAssetLibraryEntry({id:t.id,sourceIds:[t.id],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:i})=>i,cardLabelPosition:()=>"below"})},nu=Zl;var ou="ly.img.ai";function x(t){return`${ou}.${t}`}function Te(t,e){let i={...t};if(!e)return i;for(let[r,n]of Object.entries(e))n===!1||n===null||n===void 0?delete i[r]:n===!0?r in t||(i[r]=!0):i[r]=n;return i}var Ft="@imgly/plugin-ai-generation",Lg=`
6
6
  <svg>
7
7
  <symbol
8
8
  fill="none"
@@ -20,7 +20,7 @@ var Mo=Object.create;var Di=Object.defineProperty;var Do=Object.getOwnPropertyDe
20
20
  fill="none"
21
21
  xmlns="http://www.w3.org/2000/svg"
22
22
  viewBox="0 0 24 24"
23
- id="${Mt}/image"
23
+ id="${Ft}/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 Mo=Object.create;var Di=Object.defineProperty;var Do=Object.getOwnPropertyDe
32
32
  fill="none"
33
33
  xmlns="http://www.w3.org/2000/svg"
34
34
  viewBox="0 0 24 24"
35
- id="${Mt}/video"
35
+ id="${Ft}/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 Mo=Object.create;var Di=Object.defineProperty;var Do=Object.getOwnPropertyDe
43
43
  fill="none"
44
44
  xmlns="http://www.w3.org/2000/svg"
45
45
  viewBox="0 0 24 24"
46
- id="${Mt}/audio"
46
+ id="${Ft}/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,13 +63,13 @@ var Mo=Object.create;var Di=Object.defineProperty;var Do=Object.getOwnPropertyDe
63
63
 
64
64
  </symbol>
65
65
  </svg>
66
- `;var nr={ImageUrl:Bl,StyleTransfer:Jl};var Vn=Lo(qn());function Se(t,e){return(0,Vn.createFalClient)({proxyUrl:t,requestMiddleware:async r=>({...r,headers:{...r.headers,...e??{}}})})}function Rc(t,e){let i=t.middleware??e.middlewares??e.middleware??[],r=null,n={id:t.modelKey,name:t.name??t.modelKey,kind:"video",initialize:async o=>{r=Se(e.proxyUrl,t.headers),t.initialize?.(o)},input:{quickActions:{supported:ve(t.supportedQuickActions??{},e.supportedQuickActions)},panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?nr.ImageUrl(t.modelKey,{cesdk:t.cesdk}):{},...t.renderCustomProperty},getBlockInput:t.getBlockInput,userFlow:t.useFlow??"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:i,generate:async(o,{abortSignal:s})=>{if(!r)throw new Error("Provider not initialized");let l=await Z(r,o.image_url,t.cesdk),u=await r.subscribe(t.modelKey,{abortSignal:s,input:l!=null?{...o,image_url:l}:o,logs:!0}),d=u?.data?.video;if(d!=null){let a=d?.url;if(a!=null)return{kind:"video",url:a}}throw console.error("Cannot extract generated video from response:",u),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}};return e.debug&&console.log("Created Provider:",n),n}var E=Rc;function Mn(t){return async({cesdk:e})=>Lc(e,t)}function Lc(t,e){return E({modelKey:"fal-ai/minimax/video-01-live",name:"Minimax Video 01 Live",schema:ji,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",headers:e.headers,middleware:e.middlewares??e.middleware??[],cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var Uc=typeof global=="object"&&global&&global.Object===Object&&global,Qn=Uc,$c=typeof self=="object"&&self&&self.Object===Object&&self,Nc=Qn||$c||Function("return this")(),Y=Nc,zc=Y.Symbol,Ae=zc,Wn=Object.prototype,Bc=Wn.hasOwnProperty,Kc=Wn.toString,Ye=Ae?Ae.toStringTag:void 0;function Hc(t){var e=Bc.call(t,Ye),i=t[Ye];try{t[Ye]=void 0;var r=!0}catch{}var n=Kc.call(t);return r&&(e?t[Ye]=i:delete t[Ye]),n}var Gc=Hc,Qc=Object.prototype,Wc=Qc.toString;function Yc(t){return Wc.call(t)}var Zc=Yc,Jc="[object Null]",Xc="[object Undefined]",Dn=Ae?Ae.toStringTag:void 0;function ep(t){return t==null?t===void 0?Xc:Jc:Dn&&Dn in Object(t)?Gc(t):Zc(t)}var et=ep;function tp(t){return t!=null&&typeof t=="object"}var ki=tp,Ph=Array.isArray;function ip(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Yn=ip,rp="[object AsyncFunction]",np="[object Function]",op="[object GeneratorFunction]",sp="[object Proxy]";function ap(t){if(!Yn(t))return!1;var e=et(t);return e==np||e==op||e==rp||e==sp}var lp=ap,up=Y["__core-js_shared__"],xi=up,jn=function(){var t=/[^.]+$/.exec(xi&&xi.keys&&xi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function dp(t){return!!jn&&jn in t}var cp=dp,pp=Function.prototype,mp=pp.toString;function fp(t){if(t!=null){try{return mp.call(t)}catch{}try{return t+""}catch{}}return""}var pe=fp,gp=/[\\^$.*+?()[\]{}|]/g,hp=/^\[object .+?Constructor\]$/,yp=Function.prototype,bp=Object.prototype,vp=yp.toString,wp=bp.hasOwnProperty,_p=RegExp("^"+vp.call(wp).replace(gp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xp(t){if(!Yn(t)||cp(t))return!1;var e=lp(t)?_p:hp;return e.test(pe(t))}var Tp=xp;function Ip(t,e){return t?.[e]}var Sp=Ip;function Ep(t,e){var i=Sp(t,e);return Tp(i)?i:void 0}var Ce=Ep,Ap=Ce(Y,"WeakMap"),Ii=Ap;function Cp(t,e){return t===e||t!==t&&e!==e}var kp=Cp,Pp=9007199254740991;function qp(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Pp}var Vp=qp;var qh=Object.prototype;var Mp="[object Arguments]";function Dp(t){return ki(t)&&et(t)==Mp}var Fn=Dp,Zn=Object.prototype,jp=Zn.hasOwnProperty,Fp=Zn.propertyIsEnumerable,Vh=Fn(function(){return arguments}())?Fn:function(t){return ki(t)&&jp.call(t,"callee")&&!Fp.call(t,"callee")};var Jn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,On=Jn&&typeof module=="object"&&module&&!module.nodeType&&module,Op=On&&On.exports===Jn,Rn=Op?Y.Buffer:void 0,Mh=Rn?Rn.isBuffer:void 0;var Rp="[object Arguments]",Lp="[object Array]",Up="[object Boolean]",$p="[object Date]",Np="[object Error]",zp="[object Function]",Bp="[object Map]",Kp="[object Number]",Hp="[object Object]",Gp="[object RegExp]",Qp="[object Set]",Wp="[object String]",Yp="[object WeakMap]",Zp="[object ArrayBuffer]",Jp="[object DataView]",Xp="[object Float32Array]",em="[object Float64Array]",tm="[object Int8Array]",im="[object Int16Array]",rm="[object Int32Array]",nm="[object Uint8Array]",om="[object Uint8ClampedArray]",sm="[object Uint16Array]",am="[object Uint32Array]",C={};C[Xp]=C[em]=C[tm]=C[im]=C[rm]=C[nm]=C[om]=C[sm]=C[am]=!0;C[Rp]=C[Lp]=C[Zp]=C[Up]=C[Jp]=C[$p]=C[Np]=C[zp]=C[Bp]=C[Kp]=C[Hp]=C[Gp]=C[Qp]=C[Wp]=C[Yp]=!1;function lm(t){return ki(t)&&Vp(t.length)&&!!C[et(t)]}var um=lm;function dm(t){return function(e){return t(e)}}var cm=dm,Xn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ze=Xn&&typeof module=="object"&&module&&!module.nodeType&&module,pm=Ze&&Ze.exports===Xn,Ti=pm&&Qn.process,mm=function(){try{var t=Ze&&Ze.require&&Ze.require("util").types;return t||Ti&&Ti.binding&&Ti.binding("util")}catch{}}(),Ln=mm,Un=Ln&&Ln.isTypedArray,Dh=Un?cm(Un):um;var fm=Object.prototype,jh=fm.hasOwnProperty;function gm(t,e){return function(i){return t(e(i))}}var hm=gm,Fh=hm(Object.keys,Object);var ym=Object.prototype,Oh=ym.hasOwnProperty;var bm=Ce(Object,"create"),Je=bm;function vm(){this.__data__=Je?Je(null):{},this.size=0}var wm=vm;function _m(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var xm=_m,Tm="__lodash_hash_undefined__",Im=Object.prototype,Sm=Im.hasOwnProperty;function Em(t){var e=this.__data__;if(Je){var i=e[t];return i===Tm?void 0:i}return Sm.call(e,t)?e[t]:void 0}var Am=Em,Cm=Object.prototype,km=Cm.hasOwnProperty;function Pm(t){var e=this.__data__;return Je?e[t]!==void 0:km.call(e,t)}var qm=Pm,Vm="__lodash_hash_undefined__";function Mm(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Je&&e===void 0?Vm:e,this}var Dm=Mm;function ke(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])}}ke.prototype.clear=wm;ke.prototype.delete=xm;ke.prototype.get=Am;ke.prototype.has=qm;ke.prototype.set=Dm;var $n=ke;function jm(){this.__data__=[],this.size=0}var Fm=jm;function Om(t,e){for(var i=t.length;i--;)if(kp(t[i][0],e))return i;return-1}var Ct=Om,Rm=Array.prototype,Lm=Rm.splice;function Um(t){var e=this.__data__,i=Ct(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Lm.call(e,i,1),--this.size,!0}var $m=Um;function Nm(t){var e=this.__data__,i=Ct(e,t);return i<0?void 0:e[i][1]}var zm=Nm;function Bm(t){return Ct(this.__data__,t)>-1}var Km=Bm;function Hm(t,e){var i=this.__data__,r=Ct(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var Gm=Hm;function Pe(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])}}Pe.prototype.clear=Fm;Pe.prototype.delete=$m;Pe.prototype.get=zm;Pe.prototype.has=Km;Pe.prototype.set=Gm;var kt=Pe,Qm=Ce(Y,"Map"),Xe=Qm;function Wm(){this.size=0,this.__data__={hash:new $n,map:new(Xe||kt),string:new $n}}var Ym=Wm;function Zm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Jm=Zm;function Xm(t,e){var i=t.__data__;return Jm(e)?i[typeof e=="string"?"string":"hash"]:i.map}var Pt=Xm;function ef(t){var e=Pt(this,t).delete(t);return this.size-=e?1:0,e}var tf=ef;function rf(t){return Pt(this,t).get(t)}var nf=rf;function of(t){return Pt(this,t).has(t)}var sf=of;function af(t,e){var i=Pt(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var lf=af;function qe(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])}}qe.prototype.clear=Ym;qe.prototype.delete=tf;qe.prototype.get=nf;qe.prototype.has=sf;qe.prototype.set=lf;var eo=qe;function uf(){this.__data__=new kt,this.size=0}var df=uf;function cf(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var pf=cf;function mf(t){return this.__data__.get(t)}var ff=mf;function gf(t){return this.__data__.has(t)}var hf=gf,yf=200;function bf(t,e){var i=this.__data__;if(i instanceof kt){var r=i.__data__;if(!Xe||r.length<yf-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new eo(r)}return i.set(t,e),this.size=i.size,this}var vf=bf;function tt(t){var e=this.__data__=new kt(t);this.size=e.size}tt.prototype.clear=df;tt.prototype.delete=pf;tt.prototype.get=ff;tt.prototype.has=hf;tt.prototype.set=vf;var wf=Object.prototype,Rh=wf.propertyIsEnumerable;var _f=Ce(Y,"DataView"),Si=_f,xf=Ce(Y,"Promise"),Ei=xf,Tf=Ce(Y,"Set"),Ai=Tf,Nn="[object Map]",If="[object Object]",zn="[object Promise]",Bn="[object Set]",Kn="[object WeakMap]",Hn="[object DataView]",Sf=pe(Si),Ef=pe(Xe),Af=pe(Ei),Cf=pe(Ai),kf=pe(Ii),Ee=et;(Si&&Ee(new Si(new ArrayBuffer(1)))!=Hn||Xe&&Ee(new Xe)!=Nn||Ei&&Ee(Ei.resolve())!=zn||Ai&&Ee(new Ai)!=Bn||Ii&&Ee(new Ii)!=Kn)&&(Ee=function(t){var e=et(t),i=e==If?t.constructor:void 0,r=i?pe(i):"";if(r)switch(r){case Sf:return Hn;case Ef:return Nn;case Af:return zn;case Cf:return Bn;case kf:return Kn}return e});var Lh=Y.Uint8Array;var Pf="__lodash_hash_undefined__";function qf(t){return this.__data__.set(t,Pf),this}var Vf=qf;function Mf(t){return this.__data__.has(t)}var Df=Mf;function Ci(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new eo;++e<i;)this.add(t[e])}Ci.prototype.add=Ci.prototype.push=Vf;Ci.prototype.has=Df;var Gn=Ae?Ae.prototype:void 0,Uh=Gn?Gn.valueOf:void 0;var jf=Object.prototype,$h=jf.hasOwnProperty;var Ff=Object.prototype,Nh=Ff.hasOwnProperty;var zh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Bh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Kh=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function to(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 Uint8Array(n),s=new Blob([o],{type:i});return URL.createObjectURL(s)}else return t}async function j(t,e){let i=await to(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 io(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 to(r,e)}var ro={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 no(t){return async({cesdk:e})=>{let i="fal-ai/minimax/video-01-live/image-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),Rf(e,t)}}function Rf(t,e){return E({modelKey:"fal-ai/minimax/video-01-live/image-to-video",name:"Minimax Video 01 Live",schema:ro,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r=await j(i.image_url,t.engine);return Promise.resolve({video:{width:r.width??1280,height:r.height??720,duration:5}})}},e)}var oo={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/minimax/hailuo-02/standard/image-to-video",version:"1.0.0",description:"The OpenAPI schema for the fal-ai/minimax/hailuo-02/standard/image-to-video queue.","x-fal-metadata":{endpointId:"fal-ai/minimax/hailuo-02/standard/image-to-video",category:"image-to-video",thumbnailUrl:"https://storage.googleapis.com/fal_cdn/fal/Upscale.jpg",playgroundUrl:"https://fal.ai/models/fal-ai/minimax/hailuo-02/standard/image-to-video",documentationUrl:"https://fal.ai/models/fal-ai/minimax/hailuo-02/standard/image-to-video/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"]},MinimaxHailuo02StandardImageToVideoInput:{title:"StandardImageToVideoHailuo02Input",type:"object",properties:{prompt_optimizer:{title:"Prompt Optimizer",type:"boolean",description:"Whether to use the model's prompt optimizer",default:!0},duration:{enum:["6","10"],title:"Duration",type:"string",description:"The duration of the video in seconds. 10 seconds videos are not supported for 1080p resolution.",default:"6","x-imgly-builder":{component:"Select"}},prompt:{examples:["Man walked into winter cave with polar bear"],title:"Prompt",type:"string",maxLength:2e3,"x-imgly-builder":{component:"TextArea"}},resolution:{enum:["512P","768P"],title:"Resolution",type:"string",description:"The resolution of the generated video.",default:"768P","x-imgly-builder":{component:"Select"}},image_url:{examples:["https://storage.googleapis.com/falserverless/model_tests/minimax/1749891352437225630-389852416840474630_1749891352.png"],title:"Image Url",type:"string",description:"URL of the image to use as the first frame"}},"x-fal-order-properties":["image_url","prompt","duration","resolution"],required:["prompt","image_url"]},MinimaxHailuo02StandardImageToVideoOutput:{title:"ImageToVideoHailuo02Output",type:"object",properties:{video:{examples:[{url:"https://v3.fal.media/files/monkey/xF9OsLwGjjNURyAxD8RM1_output.mp4"}],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:{examples:[4404019],title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{examples:["z9RV14K95DvU.png"],title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{examples:["image/png"],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/hailuo-02/standard/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/hailuo-02/standard/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/hailuo-02/standard/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MinimaxHailuo02StandardImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/minimax/hailuo-02/standard/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/MinimaxHailuo02StandardImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function so(t){return async({cesdk:e})=>{let i="fal-ai/minimax/hailuo-02/standard/image-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),Uf(e,t)}}function Uf(t,e){return E({modelKey:"fal-ai/minimax/hailuo-02/standard/image-to-video",name:"Minimax Hailuo 02 Standard",schema:oo,inputReference:"#/components/schemas/MinimaxHailuo02StandardImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r=await j(i.image_url,t.engine),n=i.duration==="10"?10:6,o=i.resolution==="512P"?912:1280,s=i.resolution==="512P"?512:720;return Promise.resolve({video:{width:r.width??o,height:r.height??s,duration:n}})}},e)}var ao={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/kling-video/v2.1/master/image-to-video",version:"1.0.0",description:"Automatically generated schema for Kling 2.1 Master \u2013 Image to Video model"},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"]},KlingVideoV21MasterImageToVideoInput:{title:"ImageToVideoV21MasterRequest",type:"object",properties:{prompt:{maxLength:2500,type:"string",title:"Prompt","x-imgly-builder":{component:"TextArea"}},duration:{enum:["5","10"],title:"Duration",type:"string",description:"The duration of the generated video in seconds",default:"5"},cfg_scale:{minimum:0,maximum:1,type:"number",title:"Cfg Scale",description:`
66
+ `;var ur={ImageUrl:Yl,StyleTransfer:nu};var Rn=Ko(Fn());function ke(t,e){return(0,Rn.createFalClient)({proxyUrl:t,requestMiddleware:async r=>({...r,headers:{...r.headers,...e??{}}})})}function Kc(t,e){let i=t.middleware??e.middlewares??e.middleware??[],r=null,n={id:t.modelKey,name:t.name??t.modelKey,kind:"video",initialize:async o=>{r=ke(e.proxyUrl,t.headers),t.initialize?.(o)},input:{quickActions:{supported:Te(t.supportedQuickActions??{},e.supportedQuickActions)},panel:{type:"schema",document:t.schema,inputReference:t.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...t.cesdk!=null?ur.ImageUrl(t.modelKey,{cesdk:t.cesdk}):{},...t.renderCustomProperty},getBlockInput:t.getBlockInput,userFlow:t.useFlow??"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:i,generate:async(o,{abortSignal:s})=>{if(!r)throw new Error("Provider not initialized");let l=await X(r,o.image_url,t.cesdk),u=await r.subscribe(t.modelKey,{abortSignal:s,input:l!=null?{...o,image_url:l}:o,logs:!0}),d=u?.data?.video;if(d!=null){let a=d?.url;if(a!=null)return{kind:"video",url:a}}throw console.error("Cannot extract generated video from response:",u),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}};return e.debug&&console.log("Created Provider:",n),n}var S=Kc;function Un(t){return async({cesdk:e})=>Hc(e,t)}function Hc(t,e){return S({modelKey:"fal-ai/minimax/video-01-live",name:"Minimax Video 01 Live",schema:Li,inputReference:"#/components/schemas/MinimaxVideo01LiveInput",headers:e.headers,middleware:e.middlewares??e.middleware??[],cesdk:t,getBlockInput:()=>Promise.resolve({video:{width:1280,height:720,duration:5}})},e)}var Gc=typeof global=="object"&&global&&global.Object===Object&&global,eo=Gc,Qc=typeof self=="object"&&self&&self.Object===Object&&self,Wc=eo||Qc||Function("return this")(),J=Wc,Yc=J.Symbol,qe=Yc,to=Object.prototype,Zc=to.hasOwnProperty,Jc=to.toString,Je=qe?qe.toStringTag:void 0;function Xc(t){var e=Zc.call(t,Je),i=t[Je];try{t[Je]=void 0;var r=!0}catch{}var n=Jc.call(t);return r&&(e?t[Je]=i:delete t[Je]),n}var ep=Xc,tp=Object.prototype,ip=tp.toString;function rp(t){return ip.call(t)}var np=rp,op="[object Null]",sp="[object Undefined]",Ln=qe?qe.toStringTag:void 0;function ap(t){return t==null?t===void 0?sp:op:Ln&&Ln in Object(t)?ep(t):np(t)}var it=ap;function lp(t){return t!=null&&typeof t=="object"}var Di=lp,Rh=Array.isArray;function up(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var io=up,dp="[object AsyncFunction]",cp="[object Function]",pp="[object GeneratorFunction]",mp="[object Proxy]";function fp(t){if(!io(t))return!1;var e=it(t);return e==cp||e==pp||e==dp||e==mp}var gp=fp,hp=J["__core-js_shared__"],Ai=hp,$n=function(){var t=/[^.]+$/.exec(Ai&&Ai.keys&&Ai.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function yp(t){return!!$n&&$n in t}var bp=yp,vp=Function.prototype,wp=vp.toString;function _p(t){if(t!=null){try{return wp.call(t)}catch{}try{return t+""}catch{}}return""}var fe=_p,xp=/[\\^$.*+?()[\]{}|]/g,Tp=/^\[object .+?Constructor\]$/,Ip=Function.prototype,Sp=Object.prototype,Ep=Ip.toString,Ap=Sp.hasOwnProperty,Cp=RegExp("^"+Ep.call(Ap).replace(xp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kp(t){if(!io(t)||bp(t))return!1;var e=gp(t)?Cp:Tp;return e.test(fe(t))}var Pp=kp;function qp(t,e){return t?.[e]}var Vp=qp;function Mp(t,e){var i=Vp(t,e);return Pp(i)?i:void 0}var Ve=Mp,Dp=Ve(J,"WeakMap"),ki=Dp;function jp(t,e){return t===e||t!==t&&e!==e}var Op=jp,Fp=9007199254740991;function Rp(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fp}var Up=Rp;var Uh=Object.prototype;var Lp="[object Arguments]";function $p(t){return Di(t)&&it(t)==Lp}var Nn=$p,ro=Object.prototype,Np=ro.hasOwnProperty,zp=ro.propertyIsEnumerable,Lh=Nn(function(){return arguments}())?Nn:function(t){return Di(t)&&Np.call(t,"callee")&&!zp.call(t,"callee")};var no=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zn=no&&typeof module=="object"&&module&&!module.nodeType&&module,Bp=zn&&zn.exports===no,Bn=Bp?J.Buffer:void 0,$h=Bn?Bn.isBuffer:void 0;var Kp="[object Arguments]",Hp="[object Array]",Gp="[object Boolean]",Qp="[object Date]",Wp="[object Error]",Yp="[object Function]",Zp="[object Map]",Jp="[object Number]",Xp="[object Object]",em="[object RegExp]",tm="[object Set]",im="[object String]",rm="[object WeakMap]",nm="[object ArrayBuffer]",om="[object DataView]",sm="[object Float32Array]",am="[object Float64Array]",lm="[object Int8Array]",um="[object Int16Array]",dm="[object Int32Array]",cm="[object Uint8Array]",pm="[object Uint8ClampedArray]",mm="[object Uint16Array]",fm="[object Uint32Array]",A={};A[sm]=A[am]=A[lm]=A[um]=A[dm]=A[cm]=A[pm]=A[mm]=A[fm]=!0;A[Kp]=A[Hp]=A[nm]=A[Gp]=A[om]=A[Qp]=A[Wp]=A[Yp]=A[Zp]=A[Jp]=A[Xp]=A[em]=A[tm]=A[im]=A[rm]=!1;function gm(t){return Di(t)&&Up(t.length)&&!!A[it(t)]}var hm=gm;function ym(t){return function(e){return t(e)}}var bm=ym,oo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xe=oo&&typeof module=="object"&&module&&!module.nodeType&&module,vm=Xe&&Xe.exports===oo,Ci=vm&&eo.process,wm=function(){try{var t=Xe&&Xe.require&&Xe.require("util").types;return t||Ci&&Ci.binding&&Ci.binding("util")}catch{}}(),Kn=wm,Hn=Kn&&Kn.isTypedArray,Nh=Hn?bm(Hn):hm;var _m=Object.prototype,zh=_m.hasOwnProperty;function xm(t,e){return function(i){return t(e(i))}}var Tm=xm,Bh=Tm(Object.keys,Object);var Im=Object.prototype,Kh=Im.hasOwnProperty;var Sm=Ve(Object,"create"),et=Sm;function Em(){this.__data__=et?et(null):{},this.size=0}var Am=Em;function Cm(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var km=Cm,Pm="__lodash_hash_undefined__",qm=Object.prototype,Vm=qm.hasOwnProperty;function Mm(t){var e=this.__data__;if(et){var i=e[t];return i===Pm?void 0:i}return Vm.call(e,t)?e[t]:void 0}var Dm=Mm,jm=Object.prototype,Om=jm.hasOwnProperty;function Fm(t){var e=this.__data__;return et?e[t]!==void 0:Om.call(e,t)}var Rm=Fm,Um="__lodash_hash_undefined__";function Lm(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=et&&e===void 0?Um:e,this}var $m=Lm;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=Am;Me.prototype.delete=km;Me.prototype.get=Dm;Me.prototype.has=Rm;Me.prototype.set=$m;var Gn=Me;function Nm(){this.__data__=[],this.size=0}var zm=Nm;function Bm(t,e){for(var i=t.length;i--;)if(Op(t[i][0],e))return i;return-1}var Vt=Bm,Km=Array.prototype,Hm=Km.splice;function Gm(t){var e=this.__data__,i=Vt(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Hm.call(e,i,1),--this.size,!0}var Qm=Gm;function Wm(t){var e=this.__data__,i=Vt(e,t);return i<0?void 0:e[i][1]}var Ym=Wm;function Zm(t){return Vt(this.__data__,t)>-1}var Jm=Zm;function Xm(t,e){var i=this.__data__,r=Vt(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}var ef=Xm;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=zm;De.prototype.delete=Qm;De.prototype.get=Ym;De.prototype.has=Jm;De.prototype.set=ef;var Mt=De,tf=Ve(J,"Map"),tt=tf;function rf(){this.size=0,this.__data__={hash:new Gn,map:new(tt||Mt),string:new Gn}}var nf=rf;function of(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var sf=of;function af(t,e){var i=t.__data__;return sf(e)?i[typeof e=="string"?"string":"hash"]:i.map}var Dt=af;function lf(t){var e=Dt(this,t).delete(t);return this.size-=e?1:0,e}var uf=lf;function df(t){return Dt(this,t).get(t)}var cf=df;function pf(t){return Dt(this,t).has(t)}var mf=pf;function ff(t,e){var i=Dt(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}var gf=ff;function je(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])}}je.prototype.clear=nf;je.prototype.delete=uf;je.prototype.get=cf;je.prototype.has=mf;je.prototype.set=gf;var so=je;function hf(){this.__data__=new Mt,this.size=0}var yf=hf;function bf(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}var vf=bf;function wf(t){return this.__data__.get(t)}var _f=wf;function xf(t){return this.__data__.has(t)}var Tf=xf,If=200;function Sf(t,e){var i=this.__data__;if(i instanceof Mt){var r=i.__data__;if(!tt||r.length<If-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new so(r)}return i.set(t,e),this.size=i.size,this}var Ef=Sf;function rt(t){var e=this.__data__=new Mt(t);this.size=e.size}rt.prototype.clear=yf;rt.prototype.delete=vf;rt.prototype.get=_f;rt.prototype.has=Tf;rt.prototype.set=Ef;var Af=Object.prototype,Hh=Af.propertyIsEnumerable;var Cf=Ve(J,"DataView"),Pi=Cf,kf=Ve(J,"Promise"),qi=kf,Pf=Ve(J,"Set"),Vi=Pf,Qn="[object Map]",qf="[object Object]",Wn="[object Promise]",Yn="[object Set]",Zn="[object WeakMap]",Jn="[object DataView]",Vf=fe(Pi),Mf=fe(tt),Df=fe(qi),jf=fe(Vi),Of=fe(ki),Pe=it;(Pi&&Pe(new Pi(new ArrayBuffer(1)))!=Jn||tt&&Pe(new tt)!=Qn||qi&&Pe(qi.resolve())!=Wn||Vi&&Pe(new Vi)!=Yn||ki&&Pe(new ki)!=Zn)&&(Pe=function(t){var e=it(t),i=e==qf?t.constructor:void 0,r=i?fe(i):"";if(r)switch(r){case Vf:return Jn;case Mf:return Qn;case Df:return Wn;case jf:return Yn;case Of:return Zn}return e});var Gh=J.Uint8Array;var Ff="__lodash_hash_undefined__";function Rf(t){return this.__data__.set(t,Ff),this}var Uf=Rf;function Lf(t){return this.__data__.has(t)}var $f=Lf;function Mi(t){var e=-1,i=t==null?0:t.length;for(this.__data__=new so;++e<i;)this.add(t[e])}Mi.prototype.add=Mi.prototype.push=Uf;Mi.prototype.has=$f;var Xn=qe?qe.prototype:void 0,Qh=Xn?Xn.valueOf:void 0;var Nf=Object.prototype,Wh=Nf.hasOwnProperty;var zf=Object.prototype,Yh=zf.hasOwnProperty;var Zh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Jh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Xh=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function ao(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 Uint8Array(n),s=new Blob([o],{type:i});return URL.createObjectURL(s)}else return t}async function R(t,e){let i=await ao(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 lo(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 ao(r,e)}var uo={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 co(t){return async({cesdk:e})=>{let i="fal-ai/minimax/video-01-live/image-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),Kf(e,t)}}function Kf(t,e){return S({modelKey:"fal-ai/minimax/video-01-live/image-to-video",name:"Minimax Video 01 Live",schema:uo,inputReference:"#/components/schemas/MinimaxVideo01LiveImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r=await R(i.image_url,t.engine);return Promise.resolve({video:{width:r.width??1280,height:r.height??720,duration:5}})}},e)}var po={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/minimax/hailuo-02/standard/image-to-video",version:"1.0.0",description:"The OpenAPI schema for the fal-ai/minimax/hailuo-02/standard/image-to-video queue.","x-fal-metadata":{endpointId:"fal-ai/minimax/hailuo-02/standard/image-to-video",category:"image-to-video",thumbnailUrl:"https://storage.googleapis.com/fal_cdn/fal/Upscale.jpg",playgroundUrl:"https://fal.ai/models/fal-ai/minimax/hailuo-02/standard/image-to-video",documentationUrl:"https://fal.ai/models/fal-ai/minimax/hailuo-02/standard/image-to-video/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"]},MinimaxHailuo02StandardImageToVideoInput:{title:"StandardImageToVideoHailuo02Input",type:"object",properties:{prompt_optimizer:{title:"Prompt Optimizer",type:"boolean",description:"Whether to use the model's prompt optimizer",default:!0},duration:{enum:["6","10"],title:"Duration",type:"string",description:"The duration of the video in seconds. 10 seconds videos are not supported for 1080p resolution.",default:"6","x-imgly-builder":{component:"Select"}},prompt:{examples:["Man walked into winter cave with polar bear"],title:"Prompt",type:"string",maxLength:2e3,"x-imgly-builder":{component:"TextArea"}},resolution:{enum:["512P","768P"],title:"Resolution",type:"string",description:"The resolution of the generated video.",default:"768P","x-imgly-builder":{component:"Select"}},image_url:{examples:["https://storage.googleapis.com/falserverless/model_tests/minimax/1749891352437225630-389852416840474630_1749891352.png"],title:"Image Url",type:"string",description:"URL of the image to use as the first frame"}},"x-fal-order-properties":["image_url","prompt","duration","resolution"],required:["prompt","image_url"]},MinimaxHailuo02StandardImageToVideoOutput:{title:"ImageToVideoHailuo02Output",type:"object",properties:{video:{examples:[{url:"https://v3.fal.media/files/monkey/xF9OsLwGjjNURyAxD8RM1_output.mp4"}],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:{examples:[4404019],title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{examples:["z9RV14K95DvU.png"],title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{examples:["image/png"],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/hailuo-02/standard/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/hailuo-02/standard/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/hailuo-02/standard/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MinimaxHailuo02StandardImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/minimax/hailuo-02/standard/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/MinimaxHailuo02StandardImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function mo(t){return async({cesdk:e})=>{let i="fal-ai/minimax/hailuo-02/standard/image-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),Gf(e,t)}}function Gf(t,e){return S({modelKey:"fal-ai/minimax/hailuo-02/standard/image-to-video",name:"Minimax Hailuo 02 Standard",schema:po,inputReference:"#/components/schemas/MinimaxHailuo02StandardImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r=await R(i.image_url,t.engine),n=i.duration==="10"?10:6,o=i.resolution==="512P"?912:1280,s=i.resolution==="512P"?512:720;return Promise.resolve({video:{width:r.width??o,height:r.height??s,duration:n}})}},e)}var fo={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/kling-video/v2.1/master/image-to-video",version:"1.0.0",description:"Automatically generated schema for Kling 2.1 Master \u2013 Image to Video model"},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"]},KlingVideoV21MasterImageToVideoInput:{title:"ImageToVideoV21MasterRequest",type:"object",properties:{prompt:{maxLength:2500,type:"string",title:"Prompt","x-imgly-builder":{component:"TextArea"}},duration:{enum:["5","10"],title:"Duration",type:"string",description:"The duration of the generated video in seconds",default:"5"},cfg_scale:{minimum:0,maximum:1,type:"number",title:"Cfg Scale",description:`
67
67
  The CFG (Classifier Free Guidance) scale is a measure of how close you want
68
68
  the model to stick to your prompt.
69
- `,default:.5},negative_prompt:{maxLength:2500,type:"string",title:"Negative Prompt",default:"blur, distort, and low quality"},image_url:{format:"uri",description:"URL of the image to be used for the video",type:"string",examples:["https://v3.fal.media/files/rabbit/NEvlE6DqEks4afmShK9tY_image.webp"],maxLength:2083,minLength:1,title:"Image Url"}},"x-fal-order-properties":["image_url","prompt","duration"],required:["prompt","image_url"]},KlingVideoV21MasterImageToVideoOutput:{title:"ImageToVideoV21MasterOutput",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/kling-video/v2.1/master/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/kling-video/v2.1/master/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/kling-video/v2.1/master/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/KlingVideoV21MasterImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/kling-video/v2.1/master/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/KlingVideoV21MasterImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function lo(t){return async({cesdk:e})=>{let i="fal-ai/kling-video/v2.1/master/image-to-video";return S(e,{en:{"ly.img.ai.quickAction.createVideoKling":"Create Video (Kling)...",[`panel.${_(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),Nf(e,t)}}function Nf(t,e){return E({modelKey:"fal-ai/kling-video/v2.1/master/image-to-video",name:"Kling Video V2.1 Master",schema:ao,inputReference:"#/components/schemas/KlingVideoV21MasterImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{createVideoKling:{mapInput:async i=>{let[r]=t.engine.block.findAllSelected(),n=await io(r,t.engine,{throwErrorIfSvg:!0});return 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/kling-video/v2.1/master/image-to-video.image_url",n),{prompt:i.prompt,image_url:n,duration:i.duration,negative_prompt:i.negative_prompt,cfg_scale:i.cfg_scale}}}},getBlockInput:async i=>{let r=await j(i.image_url,t.engine);return Promise.resolve({video:{width:r.width??1280,height:r.height??720,duration:parseInt(i.duration??"5",10)}})}},e)}var uo={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:`
69
+ `,default:.5},negative_prompt:{maxLength:2500,type:"string",title:"Negative Prompt",default:"blur, distort, and low quality"},image_url:{format:"uri",description:"URL of the image to be used for the video",type:"string",examples:["https://v3.fal.media/files/rabbit/NEvlE6DqEks4afmShK9tY_image.webp"],maxLength:2083,minLength:1,title:"Image Url"}},"x-fal-order-properties":["image_url","prompt","duration"],required:["prompt","image_url"]},KlingVideoV21MasterImageToVideoOutput:{title:"ImageToVideoV21MasterOutput",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/kling-video/v2.1/master/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/kling-video/v2.1/master/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/kling-video/v2.1/master/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/KlingVideoV21MasterImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/kling-video/v2.1/master/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/KlingVideoV21MasterImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function go(t){return async({cesdk:e})=>{let i="fal-ai/kling-video/v2.1/master/image-to-video";return I(e,{en:{"ly.img.ai.quickAction.createVideoKling":"Create Video (Kling)...",[`panel.${x(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),Wf(e,t)}}function Wf(t,e){return S({modelKey:"fal-ai/kling-video/v2.1/master/image-to-video",name:"Kling Video V2.1 Master",schema:fo,inputReference:"#/components/schemas/KlingVideoV21MasterImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{createVideoKling:{mapInput:async i=>{let[r]=t.engine.block.findAllSelected(),n=await lo(r,t.engine,{throwErrorIfSvg:!0});return 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/kling-video/v2.1/master/image-to-video.image_url",n),{prompt:i.prompt,image_url:n,duration:i.duration,negative_prompt:i.negative_prompt,cfg_scale:i.cfg_scale}}}},getBlockInput:async i=>{let r=await R(i.image_url,t.engine);return Promise.resolve({video:{width:r.width??1280,height:r.height??720,duration:parseInt(i.duration??"5",10)}})}},e)}var ho={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:`
70
70
  The same seed and the same prompt given to the same version of the model
71
71
  will output the same video every time.
72
- `},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 co(t){return async({cesdk:e})=>(S(e,{en:{[`libraries.${_("fal-ai/pixverse/v3.5/text-to-video")}.history.label`]:"Generated From Text"}}),Bf(e,t))}function Bf(t,e){return E({modelKey:"fal-ai/pixverse/v3.5/text-to-video",name:"Pixverse V3.5",schema:uo,inputReference:"#/components/schemas/PixverseV35TextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??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 l=typeof i.duration=="string"?parseInt(i.duration,10):i.duration;return Promise.resolve({video:{width:s,height:o,duration:l}})}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 po={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/kling-video/v2.1/master/text-to-video",version:"1.0.0",description:"Automatically generated schema for Kling 2.1 Master \u2013 Text to Video model"},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"]},KlingVideoV21MasterTextToVideoInput:{title:"TextToVideoV21MasterRequest",type:"object",properties:{prompt:{type:"string",maxLength:2500,title:"Prompt","x-imgly-builder":{component:"TextArea"}},duration:{type:"string",enum:["5","10"],title:"Duration",description:"The duration of the generated video in seconds",default:"5"},aspect_ratio:{type:"string",enum:["16:9","9:16","1:1"],title:"Aspect Ratio",description:"The aspect ratio of the generated video frame",default:"16:9"},negative_prompt:{type:"string",maxLength:2500,title:"Negative Prompt",default:"blur, distort, and low quality"},cfg_scale:{type:"number",minimum:0,maximum:1,title:"Cfg Scale",description:"The CFG scale determines adherence to the prompt",default:.5}},"x-fal-order-properties":["prompt","duration","aspect_ratio"],required:["prompt"]},KlingVideoV21MasterTextToVideoOutput:{title:"TextToVideoV21MasterOutput",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:{type:"integer",title:"File Size",description:"The size of the file in bytes."},file_name:{type:"string",title:"File Name",description:"The name of the file."},content_type:{type:"string",title:"Content Type",description:"The mime type of the file."},url:{type:"string",title:"Url",description:"The URL where the file can be downloaded from."},file_data:{type:"string",format:"binary",title:"File Data",description:"File data"}},"x-fal-order-properties":["url","content_type","file_name","file_size","file_data"],required:["url"]}}},paths:{},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function mo(t){return async({cesdk:e})=>Hf(e,t)}function Hf(t,e){return E({modelKey:"fal-ai/kling-video/v2.1/master/text-to-video",name:"Kling Video V2.1 Master",schema:po,inputReference:"#/components/schemas/KlingVideoV21MasterTextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middleware,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=720,l=Math.round(s*n/o),u=i.duration!=null?parseInt(i.duration,10):5;return Promise.resolve({video:{width:l,height:s,duration:u}})}},e)}var fo={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/veo3",version:"1.0.0",description:"","x-fal-metadata":{endpointId:"fal-ai/veo3",category:"text-to-video",thumbnailUrl:"https://storage.googleapis.com/fal_cdn/fal/Sound-2.jpg",playgroundUrl:"https://fal.ai/models/fal-ai/veo3",documentationUrl:"https://fal.ai/models/fal-ai/veo3/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"]},Veo3Input:{title:"TextToVideoPreviewInput",type:"object",properties:{prompt:{examples:["A casual street interview on a busy New York City sidewalk in the afternoon. The interviewer holds a plain, unbranded microphone and asks: Have you seen Google's new Veo3 model It is a super good model. Person replies: Yeah I saw it, it's already available on fal. It's crazy good."],title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{enum:["16:9","9:16","1:1"],title:"Aspect Ratio",type:"string",description:"The aspect ratio of the generated video",default:"16:9","x-imgly-builder":{component:"Select"}},duration:{enum:["8s"],title:"Duration",type:"string",description:"The duration of the generated video in seconds",default:"8s","x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",description:"Whether to generate audio for the video. If false, %33 less credits will be used.",default:!0,"x-imgly-builder":{component:"Switch"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","negative_prompt","enhance_prompt","seed","generate_audio"],required:["prompt"]},Veo3Output:{title:"TextToVideoPreviewOutput",type:"object",properties:{video:{examples:[{url:"https://v3.fal.media/files/penguin/Q-2dpcjIoQOldJRL3grsc_output.mp4"}],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:{examples:[4404019],title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{examples:["z9RV14K95DvU.png"],title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{examples:["image/png"],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/veo3/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/veo3/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/veo3":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo3Input"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3/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/Veo3Output"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function go(t){return async({cesdk:e})=>{let i="fal-ai/veo3";return S(e,{en:{[`panel.${_(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${_(i)}.history.label`]:"Generated Videos"}}),Qf(e,t)}}function Qf(t,e){return E({modelKey:"fal-ai/veo3",name:"Veo3",schema:fo,inputReference:"#/components/schemas/Veo3Input",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{if(i.aspect_ratio!=null){let[r,n]=i.aspect_ratio.split(":").map(Number),o=720,s=Math.round(o*r/n);return Promise.resolve({video:{width:s,height:o,duration:8}})}else return Promise.resolve({video:{width:1280,height:720,duration:8}})}},e)}var ho={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1"},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"]},Veo31TextToVideoInput:{title:"Veo31TextToVideoInput",type:"object",properties:{prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["4s","6s","8s"],default:"8s",description:"The duration of the generated video","x-imgly-enum-labels":{"4s":"4 seconds","6s":"6 seconds","8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","resolution","generate_audio"],required:["prompt"]},Veo31TextToVideoOutput:{title:"Veo31TextToVideoOutput",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/veo3.1/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/veo3.1/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/veo3.1":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31TextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/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/Veo31TextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function yo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1";return S(e,{en:{[`panel.${_(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${_(i)}.history.label`]:"Generated Videos"}}),Yf(e,t)}}function Yf(t,e){return E({modelKey:"fal-ai/veo3.1",name:"Veo 3.1",schema:ho,inputReference:"#/components/schemas/Veo31TextToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=i.resolution??"720p",u={"720p":720,"1080p":1080}[s],d=Math.round(u*n/o),a=i.duration??"8s",c=parseInt(a.replace("s",""),10);return Promise.resolve({video:{width:d,height:u,duration:c}})}},e)}var bo={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/fast"},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"]},Veo31FastTextToVideoInput:{title:"Veo31FastTextToVideoInput",type:"object",properties:{prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["4s","6s","8s"],default:"8s",description:"The duration of the generated video","x-imgly-enum-labels":{"4s":"4 seconds","6s":"6 seconds","8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","resolution","generate_audio"],required:["prompt"]},Veo31FastTextToVideoOutput:{title:"Veo31FastTextToVideoOutput",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/veo3.1/fast/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/veo3.1/fast/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/veo3.1/fast":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastTextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/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/Veo31FastTextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function vo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast";return S(e,{en:{[`panel.${_(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${_(i)}.history.label`]:"Generated Videos"}}),Jf(e,t)}}function Jf(t,e){return E({modelKey:"fal-ai/veo3.1/fast",name:"Veo 3.1 Fast",schema:bo,inputReference:"#/components/schemas/Veo31FastTextToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=i.resolution??"720p",u={"720p":720,"1080p":1080}[s],d=Math.round(u*n/o),a=i.duration??"8s",c=parseInt(a.replace("s",""),10);return Promise.resolve({video:{width:d,height:u,duration:c}})}},e)}var wo={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"]},ByteDanceSeedanceV1ProImageToVideoInput:{title:"SeedanceImageToVideoRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"URL of the image to use as the first frame"},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["21:9","16:9","4:3","1:1","3:4","9:16","auto"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{"21:9":"21:9 (Ultra Wide)","16:9":"16:9 (Landscape)","4:3":"4:3 (Standard)","1:1":"1:1 (Square)","3:4":"3:4 (Portrait)","9:16":"9:16 (Vertical)",auto:"Auto (From Image)"}},duration:{title:"Duration",type:"integer",minimum:3,maximum:12,default:5,description:"Duration of the generated video in seconds"}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","duration"],required:["prompt","image_url"]},ByteDanceSeedanceV1ProImageToVideoOutput:{title:"SeedanceImageToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ByteDanceSeedanceV1ProImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/bytedance/seedance/v1/pro/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/ByteDanceSeedanceV1ProImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function _o(t){return async({cesdk:e})=>{let i="fal-ai/bytedance/seedance/v1/pro/image-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),eg(e,t)}}function eg(t,e){return E({modelKey:"fal-ai/bytedance/seedance/v1/pro/image-to-video",name:"ByteDance Seedance v1 Pro",schema:wo,inputReference:"#/components/schemas/ByteDanceSeedanceV1ProImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r,n,o={"480p":{height:480},"720p":{height:720},"1080p":{height:1080}},s=i.resolution??"1080p",l=o[s].height;if(i.aspect_ratio&&i.aspect_ratio!=="auto"){let[u,d]=i.aspect_ratio.split(":").map(Number);n=l,r=Math.round(n*u/d)}else{let u=await j(i.image_url,t.engine),d=u.width??1920,a=u.height??1080,c=d/a;n=l,r=Math.round(n*c)}return Promise.resolve({video:{width:r,height:n,duration:i.duration??5}})}},e)}var xo={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"]},ByteDanceSeedanceV1ProTextToVideoInput:{title:"SeedanceTextToVideoRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["21:9","16:9","4:3","1:1","3:4","9:16"],default:"16:9",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{"21:9":"21:9 (Ultra Wide)","16:9":"16:9 (Landscape)","4:3":"4:3 (Standard)","1:1":"1:1 (Square)","3:4":"3:4 (Portrait)","9:16":"9:16 (Vertical)"}},resolution:{title:"Resolution",type:"string",enum:["480p","720p","1080p"],default:"1080p",description:"Resolution for the generated video"},duration:{title:"Duration",type:"integer",minimum:3,maximum:12,default:5,description:"Duration of the generated video in seconds"},camera_fixed:{title:"Camera Fixed",type:"boolean",default:!1,description:"Whether to fix the camera position"},seed:{title:"Seed",type:"integer",default:-1,description:"Seed for reproducible generation (-1 for random)"},enable_safety_checker:{title:"Enable Safety Checker",type:"boolean",default:!0,description:"Whether to enable safety checking"}},"x-fal-order-properties":["prompt","aspect_ratio","duration"],required:["prompt"]},ByteDanceSeedanceV1ProTextToVideoOutput:{title:"SeedanceTextToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/text-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ByteDanceSeedanceV1ProTextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/bytedance/seedance/v1/pro/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/ByteDanceSeedanceV1ProTextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function To(t){return async({cesdk:e})=>ig(e,t)}function ig(t,e){return E({modelKey:"fal-ai/bytedance/seedance/v1/pro/text-to-video",name:"ByteDance Seedance v1 Pro",schema:xo,inputReference:"#/components/schemas/ByteDanceSeedanceV1ProTextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],getBlockInput:async i=>{let r,n,o={"480p":{height:480},"720p":{height:720},"1080p":{height:1080}},s=i.resolution??"1080p",l=o[s].height;if(i.aspect_ratio){let[u,d]=i.aspect_ratio.split(":").map(Number);n=l,r=Math.round(n*u/d)}else n=l,r=Math.round(n*16/9);return Promise.resolve({video:{width:r,height:n,duration:i.duration??5}})}},e)}var Io={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"]},Veo31FastFirstLastFrameToVideoInput:{title:"Veo31FastFirstLastFrameToVideoRequest",type:"object",properties:{first_frame_url:{title:"First Frame",type:"string",description:"URL of the image to use as the first frame"},last_frame_url:{title:"Last Frame",type:"string",description:"URL of the image to use as the last frame"},prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["auto","9:16","16:9","1:1"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{auto:"Auto (From Images)","9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"Video resolution quality","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"Duration of the generated video","x-imgly-enum-labels":{"8s":"8 seconds"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!1,description:"Whether to generate audio for the video"}},"x-fal-order-properties":["first_frame_url","last_frame_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","first_frame_url","last_frame_url"]},Veo31FastFirstLastFrameToVideoOutput:{title:"Veo31FastFirstLastFrameToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/veo3.1/fast/first-last-frame-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/veo3.1/fast/first-last-frame-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/veo3.1/fast/first-last-frame-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastFirstLastFrameToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/first-last-frame-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/Veo31FastFirstLastFrameToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function So(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast/first-last-frame-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Images To Generate",[`panel.${i}.imageSelection`]:"Select Images To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Images","ly.img.ai.veo31.firstFrame.label":"First Frame","ly.img.ai.veo31.lastFrame.label":"Last Frame","ly.img.ai.veo31.swapFrames.label":"Swap First and Last Frame","ly.img.ai.imageSelection.selectImage.label":"Select Image"}}),og(i,e),ng(e,t)}}function ng(t,e){let i="fal-ai/veo3.1/fast/first-last-frame-to-video",r=e.middlewares??e.middleware??[],n=null;return{id:i,name:"Veo 3.1 Fast (First/Last Frame)",kind:"video",initialize:async()=>{n=Se(e.proxyUrl,e.headers)},input:{quickActions:{supported:ve({"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}},"ly.img.animateBetweenImages":{mapInput:s=>({prompt:"",first_frame_url:s.firstFrameUri,last_frame_url:s.lastFrameUri})}},e.supportedQuickActions)},panel:{type:"schema",document:Io,inputReference:"#/components/schemas/Veo31FastFirstLastFrameToVideoInput",includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{first_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.first_frame_url`,""),c=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Pi(i),{payload:{onSelect:m=>{let p=m.meta?.uri;p!=null&&a.setValue(p)}}})}}}),u.Button(`${l.id}.swap`,{label:"ly.img.ai.veo31.swapFrames.label",icon:"@imgly/Replace",labelAlignment:"center",variant:"regular",onClick:()=>{let m=a.value;a.setValue(c.value),c.setValue(m)}}),()=>({id:l.id,type:"string",value:a.value})},last_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(qi(i),{payload:{onSelect:c=>{let m=c.meta?.uri;m!=null&&a.setValue(m)}}})}}}),()=>({id:l.id,type:"string",value:a.value})}},getBlockInput:async s=>{let l,u,d={"720p":{height:720},"1080p":{height:1080}},a=s.resolution??"720p",c=d[a].height;if(s.aspect_ratio&&s.aspect_ratio!=="auto"){let[p,f]=s.aspect_ratio.split(":").map(Number);u=c,l=Math.round(u*p/f)}else try{let p=await j(s.first_frame_url,t.engine),f=p.width??1920,h=p.height??1080,v=f/h;u=c,l=Math.round(u*v)}catch{u=c,l=Math.round(u*16/9)}let m=s.duration?parseInt(s.duration.replace("s",""),10):8;return Promise.resolve({video:{width:l,height:u,duration:m}})},userFlow:"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:r,generate:async(s,{abortSignal:l})=>{if(!n)throw new Error("Provider not initialized");let u=await Z(n,s.first_frame_url,t),d=await Z(n,s.last_frame_url,t),a=await n.subscribe(i,{abortSignal:l,input:{...s,first_frame_url:u??s.first_frame_url,last_frame_url:d??s.last_frame_url},logs:!0}),c=a?.data?.video;if(c!=null){let m=c?.url;if(m!=null)return{kind:"video",url:m}}throw console.error("Cannot extract generated video from response:",a),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}}}function og(t,e){e.ui.registerPanel(Pi(t),({builder:i,payload:r})=>{i.Section("first_frame_section",{children:()=>{i.Text("first_frame_title",{content:"ly.img.ai.veo31.firstFrame.label"}),i.Library(`${t}.library.first_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Pi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})}),e.ui.registerPanel(qi(t),({builder:i,payload:r})=>{i.Section("last_frame_section",{children:()=>{i.Text("last_frame_title",{content:"ly.img.ai.veo31.lastFrame.label"}),i.Library(`${t}.library.last_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(qi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})})}function Pi(t){return`ly.img.ai.${t}.firstFrameSelection`}function qi(t){return`ly.img.ai.${t}.lastFrameSelection`}var Eo={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"]},Veo31FirstLastFrameToVideoInput:{title:"Veo31FirstLastFrameToVideoRequest",type:"object",properties:{first_frame_url:{title:"First Frame",type:"string",description:"URL of the image to use as the first frame"},last_frame_url:{title:"Last Frame",type:"string",description:"URL of the image to use as the last frame"},prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["auto","9:16","16:9","1:1"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{auto:"Auto (From Images)","9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"Video resolution quality","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"}},duration:{title:"Duration",type:"string",enum:["8s","16s"],default:"8s",description:"Duration of the generated video","x-imgly-enum-labels":{"8s":"8 seconds","16s":"16 seconds"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!1,description:"Whether to generate audio for the video"}},"x-fal-order-properties":["first_frame_url","last_frame_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","first_frame_url","last_frame_url"]},Veo31FirstLastFrameToVideoOutput:{title:"Veo31FirstLastFrameToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/veo3.1/first-last-frame-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/veo3.1/first-last-frame-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/veo3.1/first-last-frame-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FirstLastFrameToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/first-last-frame-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/Veo31FirstLastFrameToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Ao(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/first-last-frame-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Images To Generate",[`panel.${i}.imageSelection`]:"Select Images To Generate",[`libraries.${_(i)}.history.label`]:"Generated From Images","ly.img.ai.veo31.firstFrame.label":"First Frame","ly.img.ai.veo31.lastFrame.label":"Last Frame","ly.img.ai.veo31.swapFrames.label":"Swap First and Last Frame","ly.img.ai.imageSelection.selectImage.label":"Select Image"}}),lg(i,e),ag(e,t)}}function ag(t,e){let i="fal-ai/veo3.1/first-last-frame-to-video",r=e.middlewares??e.middleware??[],n=null;return{id:i,name:"Veo 3.1 (First/Last Frame)",kind:"video",initialize:async()=>{n=Se(e.proxyUrl,e.headers)},input:{quickActions:{supported:ve({"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}},"ly.img.animateBetweenImages":{mapInput:s=>({prompt:"",first_frame_url:s.firstFrameUri,last_frame_url:s.lastFrameUri})}},e.supportedQuickActions)},panel:{type:"schema",document:Eo,inputReference:"#/components/schemas/Veo31FirstLastFrameToVideoInput",includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{first_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.first_frame_url`,""),c=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Vi(i),{payload:{onSelect:m=>{let p=m.meta?.uri;p!=null&&a.setValue(p)}}})}}}),u.Button(`${l.id}.swap`,{label:"ly.img.ai.veo31.swapFrames.label",icon:"@imgly/Replace",labelAlignment:"center",variant:"regular",onClick:()=>{let m=a.value;a.setValue(c.value),c.setValue(m)}}),()=>({id:l.id,type:"string",value:a.value})},last_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Mi(i),{payload:{onSelect:c=>{let m=c.meta?.uri;m!=null&&a.setValue(m)}}})}}}),()=>({id:l.id,type:"string",value:a.value})}},getBlockInput:async s=>{let l,u,d={"720p":{height:720},"1080p":{height:1080}},a=s.resolution??"720p",c=d[a].height;if(s.aspect_ratio&&s.aspect_ratio!=="auto"){let[p,f]=s.aspect_ratio.split(":").map(Number);u=c,l=Math.round(u*p/f)}else try{let p=await j(s.first_frame_url,t.engine),f=p.width??1920,h=p.height??1080,v=f/h;u=c,l=Math.round(u*v)}catch{u=c,l=Math.round(u*16/9)}let m=s.duration?parseInt(s.duration.replace("s",""),10):8;return Promise.resolve({video:{width:l,height:u,duration:m}})},userFlow:"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:r,generate:async(s,{abortSignal:l})=>{if(!n)throw new Error("Provider not initialized");let u=await Z(n,s.first_frame_url,t),d=await Z(n,s.last_frame_url,t),a=await n.subscribe(i,{abortSignal:l,input:{...s,first_frame_url:u??s.first_frame_url,last_frame_url:d??s.last_frame_url},logs:!0}),c=a?.data?.video;if(c!=null){let m=c?.url;if(m!=null)return{kind:"video",url:m}}throw console.error("Cannot extract generated video from response:",a),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}}}function lg(t,e){e.ui.registerPanel(Vi(t),({builder:i,payload:r})=>{i.Section("first_frame_section",{children:()=>{i.Text("first_frame_title",{content:"ly.img.ai.veo31.firstFrame.label"}),i.Library(`${t}.library.first_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Vi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})}),e.ui.registerPanel(Mi(t),({builder:i,payload:r})=>{i.Section("last_frame_section",{children:()=>{i.Text("last_frame_title",{content:"ly.img.ai.veo31.lastFrame.label"}),i.Library(`${t}.library.last_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Mi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})})}function Vi(t){return`ly.img.ai.${t}.firstFrameSelection`}function Mi(t){return`ly.img.ai.${t}.lastFrameSelection`}var Co={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/image-to-video"},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"]},Veo31ImageToVideoInput:{title:"Veo31ImageToVideoInput",type:"object",properties:{image_url:{format:"uri",description:"URL of the image to animate",type:"string",examples:["https://v3.fal.media/files/rabbit/NEvlE6DqEks4afmShK9tY_image.webp"],maxLength:2083,minLength:1,title:"Source Image"},prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the desired video motion and content","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"The duration of the generated video (fixed at 8 seconds for Veo 3.1)","x-imgly-enum-labels":{"8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","image_url"]},Veo31ImageToVideoOutput:{title:"Veo31ImageToVideoOutput",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/veo3.1/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/veo3.1/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/veo3.1/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31ImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/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/Veo31ImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function ko(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/image-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Image To Animate",[`panel.${i}.imageSelection`]:"Select Image To Animate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),dg(e,t)}}function dg(t,e){return E({modelKey:"fal-ai/veo3.1/image-to-video",name:"Veo 3.1",schema:Co,inputReference:"#/components/schemas/Veo31ImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{"ly.img.createVideo":{mapInput:i=>({prompt:"",image_url:i.uri})}},getBlockInput:async i=>{let r=i.resolution??"720p",o={"720p":720,"1080p":1080}[r],s=i.aspect_ratio??"16:9",[l,u]=s.split(":").map(Number),d=o,a=Math.round(d*l/u),c=i.duration??"8s",m=parseInt(c.replace("s",""),10);return Promise.resolve({video:{width:a,height:d,duration:m}})}},e)}var Po={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/fast/image-to-video"},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"]},Veo31FastImageToVideoInput:{title:"Veo31FastImageToVideoInput",type:"object",properties:{image_url:{format:"uri",description:"URL of the image to be animated",type:"string",maxLength:2083,minLength:1,title:"Image URL"},prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing how to animate the image","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"The duration of the generated video (fixed at 8 seconds)","x-imgly-enum-labels":{"8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","image_url"]},Veo31FastImageToVideoOutput:{title:"Veo31FastImageToVideoOutput",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/veo3.1/fast/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/veo3.1/fast/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/veo3.1/fast/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/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/Veo31FastImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function qo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast/image-to-video";return S(e,{en:{[`panel.${_(i)}.imageSelection`]:"Select Image To Animate",[`panel.${i}.imageSelection`]:"Select Image To Animate",[`libraries.${_(i)}.history.label`]:"Generated From Image"}}),pg(e,t)}}function pg(t,e){return E({modelKey:"fal-ai/veo3.1/fast/image-to-video",name:"Veo 3.1 Fast",schema:Po,inputReference:"#/components/schemas/Veo31FastImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{"ly.img.createVideo":{mapInput:i=>({prompt:"",image_url:i.uri})}},getBlockInput:async i=>{let r=i.resolution??"720p",o={"720p":720,"1080p":1080}[r],s=i.aspect_ratio??"16:9",[l,u]=s.split(":").map(Number),d=o,a=Math.round(d*l/u),c=i.duration??"8s",m=parseInt(c.replace("s",""),10);return Promise.resolve({video:{width:a,height:d,duration:m}})}},e)}var mg={MinimaxVideo01Live:Mn,MinimaxVideo01LiveImageToVideo:no,MinimaxHailuo02StandardImageToVideo:so,KlingVideoV21MasterImageToVideo:lo,PixverseV35TextToVideo:co,KlingVideoV21MasterTextToVideo:mo,Veo3TextToVideo:go,Veo31TextToVideo:yo,Veo31FastTextToVideo:vo,ByteDanceSeedanceV1ProImageToVideo:_o,ByteDanceSeedanceV1ProTextToVideo:To,Veo31FastFirstLastFrameToVideo:So,Veo31FirstLastFrameToVideo:Ao,Veo31ImageToVideo:ko,Veo31FastImageToVideo:qo},i0=mg;export{i0 as default};
72
+ `},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 yo(t){return async({cesdk:e})=>(I(e,{en:{[`libraries.${x("fal-ai/pixverse/v3.5/text-to-video")}.history.label`]:"Generated From Text"}}),Zf(e,t))}function Zf(t,e){return S({modelKey:"fal-ai/pixverse/v3.5/text-to-video",name:"Pixverse V3.5",schema:ho,inputReference:"#/components/schemas/PixverseV35TextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??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 l=typeof i.duration=="string"?parseInt(i.duration,10):i.duration;return Promise.resolve({video:{width:s,height:o,duration:l}})}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 bo={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/kling-video/v2.1/master/text-to-video",version:"1.0.0",description:"Automatically generated schema for Kling 2.1 Master \u2013 Text to Video model"},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"]},KlingVideoV21MasterTextToVideoInput:{title:"TextToVideoV21MasterRequest",type:"object",properties:{prompt:{type:"string",maxLength:2500,title:"Prompt","x-imgly-builder":{component:"TextArea"}},duration:{type:"string",enum:["5","10"],title:"Duration",description:"The duration of the generated video in seconds",default:"5"},aspect_ratio:{type:"string",enum:["16:9","9:16","1:1"],title:"Aspect Ratio",description:"The aspect ratio of the generated video frame",default:"16:9"},negative_prompt:{type:"string",maxLength:2500,title:"Negative Prompt",default:"blur, distort, and low quality"},cfg_scale:{type:"number",minimum:0,maximum:1,title:"Cfg Scale",description:"The CFG scale determines adherence to the prompt",default:.5}},"x-fal-order-properties":["prompt","duration","aspect_ratio"],required:["prompt"]},KlingVideoV21MasterTextToVideoOutput:{title:"TextToVideoV21MasterOutput",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:{type:"integer",title:"File Size",description:"The size of the file in bytes."},file_name:{type:"string",title:"File Name",description:"The name of the file."},content_type:{type:"string",title:"Content Type",description:"The mime type of the file."},url:{type:"string",title:"Url",description:"The URL where the file can be downloaded from."},file_data:{type:"string",format:"binary",title:"File Data",description:"File data"}},"x-fal-order-properties":["url","content_type","file_name","file_size","file_data"],required:["url"]}}},paths:{},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function vo(t){return async({cesdk:e})=>Xf(e,t)}function Xf(t,e){return S({modelKey:"fal-ai/kling-video/v2.1/master/text-to-video",name:"Kling Video V2.1 Master",schema:bo,inputReference:"#/components/schemas/KlingVideoV21MasterTextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middleware,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=720,l=Math.round(s*n/o),u=i.duration!=null?parseInt(i.duration,10):5;return Promise.resolve({video:{width:l,height:s,duration:u}})}},e)}var wo={openapi:"3.0.4",info:{title:"Queue OpenAPI for fal-ai/veo3",version:"1.0.0",description:"","x-fal-metadata":{endpointId:"fal-ai/veo3",category:"text-to-video",thumbnailUrl:"https://storage.googleapis.com/fal_cdn/fal/Sound-2.jpg",playgroundUrl:"https://fal.ai/models/fal-ai/veo3",documentationUrl:"https://fal.ai/models/fal-ai/veo3/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"]},Veo3Input:{title:"TextToVideoPreviewInput",type:"object",properties:{prompt:{examples:["A casual street interview on a busy New York City sidewalk in the afternoon. The interviewer holds a plain, unbranded microphone and asks: Have you seen Google's new Veo3 model It is a super good model. Person replies: Yeah I saw it, it's already available on fal. It's crazy good."],title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{enum:["16:9","9:16","1:1"],title:"Aspect Ratio",type:"string",description:"The aspect ratio of the generated video",default:"16:9","x-imgly-builder":{component:"Select"}},duration:{enum:["8s"],title:"Duration",type:"string",description:"The duration of the generated video in seconds",default:"8s","x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",description:"Whether to generate audio for the video. If false, %33 less credits will be used.",default:!0,"x-imgly-builder":{component:"Switch"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","negative_prompt","enhance_prompt","seed","generate_audio"],required:["prompt"]},Veo3Output:{title:"TextToVideoPreviewOutput",type:"object",properties:{video:{examples:[{url:"https://v3.fal.media/files/penguin/Q-2dpcjIoQOldJRL3grsc_output.mp4"}],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:{examples:[4404019],title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{examples:["z9RV14K95DvU.png"],title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{examples:["image/png"],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/veo3/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/veo3/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/veo3":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo3Input"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3/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/Veo3Output"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function _o(t){return async({cesdk:e})=>{let i="fal-ai/veo3";return I(e,{en:{[`panel.${x(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${x(i)}.history.label`]:"Generated Videos"}}),tg(e,t)}}function tg(t,e){return S({modelKey:"fal-ai/veo3",name:"Veo3",schema:wo,inputReference:"#/components/schemas/Veo3Input",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{if(i.aspect_ratio!=null){let[r,n]=i.aspect_ratio.split(":").map(Number),o=720,s=Math.round(o*r/n);return Promise.resolve({video:{width:s,height:o,duration:8}})}else return Promise.resolve({video:{width:1280,height:720,duration:8}})}},e)}var xo={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1"},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"]},Veo31TextToVideoInput:{title:"Veo31TextToVideoInput",type:"object",properties:{prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["4s","6s","8s"],default:"8s",description:"The duration of the generated video","x-imgly-enum-labels":{"4s":"4 seconds","6s":"6 seconds","8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","resolution","generate_audio"],required:["prompt"]},Veo31TextToVideoOutput:{title:"Veo31TextToVideoOutput",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/veo3.1/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/veo3.1/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/veo3.1":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31TextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/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/Veo31TextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function To(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1";return I(e,{en:{[`panel.${x(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${x(i)}.history.label`]:"Generated Videos"}}),rg(e,t)}}function rg(t,e){return S({modelKey:"fal-ai/veo3.1",name:"Veo 3.1",schema:xo,inputReference:"#/components/schemas/Veo31TextToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=i.resolution??"720p",u={"720p":720,"1080p":1080}[s],d=Math.round(u*n/o),a=i.duration??"8s",c=parseInt(a.replace("s",""),10);return Promise.resolve({video:{width:d,height:u,duration:c}})}},e)}var Io={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/fast"},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"]},Veo31FastTextToVideoInput:{title:"Veo31FastTextToVideoInput",type:"object",properties:{prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the video you want to generate","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["4s","6s","8s"],default:"8s",description:"The duration of the generated video","x-imgly-enum-labels":{"4s":"4 seconds","6s":"6 seconds","8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["prompt","aspect_ratio","duration","resolution","generate_audio"],required:["prompt"]},Veo31FastTextToVideoOutput:{title:"Veo31FastTextToVideoOutput",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/veo3.1/fast/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/veo3.1/fast/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/veo3.1/fast":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastTextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/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/Veo31FastTextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function So(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast";return I(e,{en:{[`panel.${x(i)}.prompt`]:"Enter your prompt",[`panel.${i}.prompt`]:"Enter your prompt",[`libraries.${x(i)}.history.label`]:"Generated Videos"}}),og(e,t)}}function og(t,e){return S({modelKey:"fal-ai/veo3.1/fast",name:"Veo 3.1 Fast",schema:Io,inputReference:"#/components/schemas/Veo31FastTextToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,getBlockInput:i=>{let r=i.aspect_ratio??"16:9",[n,o]=r.split(":").map(Number),s=i.resolution??"720p",u={"720p":720,"1080p":1080}[s],d=Math.round(u*n/o),a=i.duration??"8s",c=parseInt(a.replace("s",""),10);return Promise.resolve({video:{width:d,height:u,duration:c}})}},e)}var Eo={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"]},ByteDanceSeedanceV1ProImageToVideoInput:{title:"SeedanceImageToVideoRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"URL of the image to use as the first frame"},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["21:9","16:9","4:3","1:1","3:4","9:16","auto"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{"21:9":"21:9 (Ultra Wide)","16:9":"16:9 (Landscape)","4:3":"4:3 (Standard)","1:1":"1:1 (Square)","3:4":"3:4 (Portrait)","9:16":"9:16 (Vertical)",auto:"Auto (From Image)"}},duration:{title:"Duration",type:"integer",minimum:3,maximum:12,default:5,description:"Duration of the generated video in seconds"}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","duration"],required:["prompt","image_url"]},ByteDanceSeedanceV1ProImageToVideoOutput:{title:"SeedanceImageToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ByteDanceSeedanceV1ProImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/bytedance/seedance/v1/pro/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/ByteDanceSeedanceV1ProImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Ao(t){return async({cesdk:e})=>{let i="fal-ai/bytedance/seedance/v1/pro/image-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Image To Generate",[`panel.${i}.imageSelection`]:"Select Image To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),ag(e,t)}}function ag(t,e){return S({modelKey:"fal-ai/bytedance/seedance/v1/pro/image-to-video",name:"ByteDance Seedance v1 Pro",schema:Eo,inputReference:"#/components/schemas/ByteDanceSeedanceV1ProImageToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}}},getBlockInput:async i=>{let r,n,o={"480p":{height:480},"720p":{height:720},"1080p":{height:1080}},s=i.resolution??"1080p",l=o[s].height;if(i.aspect_ratio&&i.aspect_ratio!=="auto"){let[u,d]=i.aspect_ratio.split(":").map(Number);n=l,r=Math.round(n*u/d)}else{let u=await R(i.image_url,t.engine),d=u.width??1920,a=u.height??1080,c=d/a;n=l,r=Math.round(n*c)}return Promise.resolve({video:{width:r,height:n,duration:i.duration??5}})}},e)}var Co={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"]},ByteDanceSeedanceV1ProTextToVideoInput:{title:"SeedanceTextToVideoRequest",type:"object",properties:{prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["21:9","16:9","4:3","1:1","3:4","9:16"],default:"16:9",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{"21:9":"21:9 (Ultra Wide)","16:9":"16:9 (Landscape)","4:3":"4:3 (Standard)","1:1":"1:1 (Square)","3:4":"3:4 (Portrait)","9:16":"9:16 (Vertical)"}},resolution:{title:"Resolution",type:"string",enum:["480p","720p","1080p"],default:"1080p",description:"Resolution for the generated video"},duration:{title:"Duration",type:"integer",minimum:3,maximum:12,default:5,description:"Duration of the generated video in seconds"},camera_fixed:{title:"Camera Fixed",type:"boolean",default:!1,description:"Whether to fix the camera position"},seed:{title:"Seed",type:"integer",default:-1,description:"Seed for reproducible generation (-1 for random)"},enable_safety_checker:{title:"Enable Safety Checker",type:"boolean",default:!0,description:"Whether to enable safety checking"}},"x-fal-order-properties":["prompt","aspect_ratio","duration"],required:["prompt"]},ByteDanceSeedanceV1ProTextToVideoOutput:{title:"SeedanceTextToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/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/bytedance/seedance/v1/pro/text-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ByteDanceSeedanceV1ProTextToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/bytedance/seedance/v1/pro/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/ByteDanceSeedanceV1ProTextToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function ko(t){return async({cesdk:e})=>ug(e,t)}function ug(t,e){return S({modelKey:"fal-ai/bytedance/seedance/v1/pro/text-to-video",name:"ByteDance Seedance v1 Pro",schema:Co,inputReference:"#/components/schemas/ByteDanceSeedanceV1ProTextToVideoInput",cesdk:t,headers:e.headers,middleware:e.middlewares??e.middleware??[],getBlockInput:async i=>{let r,n,o={"480p":{height:480},"720p":{height:720},"1080p":{height:1080}},s=i.resolution??"1080p",l=o[s].height;if(i.aspect_ratio){let[u,d]=i.aspect_ratio.split(":").map(Number);n=l,r=Math.round(n*u/d)}else n=l,r=Math.round(n*16/9);return Promise.resolve({video:{width:r,height:n,duration:i.duration??5}})}},e)}var Po={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"]},Veo31FastFirstLastFrameToVideoInput:{title:"Veo31FastFirstLastFrameToVideoRequest",type:"object",properties:{first_frame_url:{title:"First Frame",type:"string",description:"URL of the image to use as the first frame"},last_frame_url:{title:"Last Frame",type:"string",description:"URL of the image to use as the last frame"},prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["auto","9:16","16:9","1:1"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{auto:"Auto (From Images)","9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"Video resolution quality","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"Duration of the generated video","x-imgly-enum-labels":{"8s":"8 seconds"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!1,description:"Whether to generate audio for the video"}},"x-fal-order-properties":["first_frame_url","last_frame_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","first_frame_url","last_frame_url"]},Veo31FastFirstLastFrameToVideoOutput:{title:"Veo31FastFirstLastFrameToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/veo3.1/fast/first-last-frame-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/veo3.1/fast/first-last-frame-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/veo3.1/fast/first-last-frame-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastFirstLastFrameToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/first-last-frame-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/Veo31FastFirstLastFrameToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function qo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast/first-last-frame-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Images To Generate",[`panel.${i}.imageSelection`]:"Select Images To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Images","ly.img.ai.veo31.firstFrame.label":"First Frame","ly.img.ai.veo31.lastFrame.label":"Last Frame","ly.img.ai.veo31.swapFrames.label":"Swap First and Last Frame","ly.img.ai.imageSelection.selectImage.label":"Select Image"}}),pg(i,e),cg(e,t)}}function cg(t,e){let i="fal-ai/veo3.1/fast/first-last-frame-to-video",r=e.middlewares??e.middleware??[],n=null;return{id:i,name:"Veo 3.1 Fast (First/Last Frame)",kind:"video",initialize:async()=>{n=ke(e.proxyUrl,e.headers)},input:{quickActions:{supported:Te({"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}},"ly.img.animateBetweenImages":{mapInput:s=>({prompt:"",first_frame_url:s.firstFrameUri,last_frame_url:s.lastFrameUri})}},e.supportedQuickActions)},panel:{type:"schema",document:Po,inputReference:"#/components/schemas/Veo31FastFirstLastFrameToVideoInput",includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{first_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.first_frame_url`,""),c=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(ji(i),{payload:{onSelect:m=>{let p=m.meta?.uri;p!=null&&a.setValue(p)}}})}}}),u.Button(`${l.id}.swap`,{label:"ly.img.ai.veo31.swapFrames.label",icon:"@imgly/Replace",labelAlignment:"center",variant:"regular",onClick:()=>{let m=a.value;a.setValue(c.value),c.setValue(m)}}),()=>({id:l.id,type:"string",value:a.value})},last_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Oi(i),{payload:{onSelect:c=>{let m=c.meta?.uri;m!=null&&a.setValue(m)}}})}}}),()=>({id:l.id,type:"string",value:a.value})}},getBlockInput:async s=>{let l,u,d={"720p":{height:720},"1080p":{height:1080}},a=s.resolution??"720p",c=d[a].height;if(s.aspect_ratio&&s.aspect_ratio!=="auto"){let[p,g]=s.aspect_ratio.split(":").map(Number);u=c,l=Math.round(u*p/g)}else try{let p=await R(s.first_frame_url,t.engine),g=p.width??1920,h=p.height??1080,b=g/h;u=c,l=Math.round(u*b)}catch{u=c,l=Math.round(u*16/9)}let m=s.duration?parseInt(s.duration.replace("s",""),10):8;return Promise.resolve({video:{width:l,height:u,duration:m}})},userFlow:"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:r,generate:async(s,{abortSignal:l})=>{if(!n)throw new Error("Provider not initialized");let u=await X(n,s.first_frame_url,t),d=await X(n,s.last_frame_url,t),a=await n.subscribe(i,{abortSignal:l,input:{...s,first_frame_url:u??s.first_frame_url,last_frame_url:d??s.last_frame_url},logs:!0}),c=a?.data?.video;if(c!=null){let m=c?.url;if(m!=null)return{kind:"video",url:m}}throw console.error("Cannot extract generated video from response:",a),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}}}function pg(t,e){e.ui.registerPanel(ji(t),({builder:i,payload:r})=>{i.Section("first_frame_section",{children:()=>{i.Text("first_frame_title",{content:"ly.img.ai.veo31.firstFrame.label"}),i.Library(`${t}.library.first_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(ji(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})}),e.ui.registerPanel(Oi(t),({builder:i,payload:r})=>{i.Section("last_frame_section",{children:()=>{i.Text("last_frame_title",{content:"ly.img.ai.veo31.lastFrame.label"}),i.Library(`${t}.library.last_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Oi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})})}function ji(t){return`ly.img.ai.${t}.firstFrameSelection`}function Oi(t){return`ly.img.ai.${t}.lastFrameSelection`}var Vo={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"]},Veo31FirstLastFrameToVideoInput:{title:"Veo31FirstLastFrameToVideoRequest",type:"object",properties:{first_frame_url:{title:"First Frame",type:"string",description:"URL of the image to use as the first frame"},last_frame_url:{title:"Last Frame",type:"string",description:"URL of the image to use as the last frame"},prompt:{title:"Prompt",type:"string",description:"Text description for the video generation","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["auto","9:16","16:9","1:1"],default:"auto",description:"Aspect ratio for the generated video","x-imgly-enum-labels":{auto:"Auto (From Images)","9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"Video resolution quality","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"}},duration:{title:"Duration",type:"string",enum:["8s","16s"],default:"8s",description:"Duration of the generated video","x-imgly-enum-labels":{"8s":"8 seconds","16s":"16 seconds"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!1,description:"Whether to generate audio for the video"}},"x-fal-order-properties":["first_frame_url","last_frame_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","first_frame_url","last_frame_url"]},Veo31FirstLastFrameToVideoOutput:{title:"Veo31FirstLastFrameToVideoOutput",type:"object",properties:{video:{title:"Video",description:"The generated video",allOf:[{$ref:"#/components/schemas/File"}]},seed:{title:"Seed",type:"integer",description:"The seed used for generation"}},"x-fal-order-properties":["video","seed"],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/veo3.1/first-last-frame-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/veo3.1/first-last-frame-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/veo3.1/first-last-frame-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FirstLastFrameToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/first-last-frame-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/Veo31FirstLastFrameToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Mo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/first-last-frame-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Images To Generate",[`panel.${i}.imageSelection`]:"Select Images To Generate",[`libraries.${x(i)}.history.label`]:"Generated From Images","ly.img.ai.veo31.firstFrame.label":"First Frame","ly.img.ai.veo31.lastFrame.label":"Last Frame","ly.img.ai.veo31.swapFrames.label":"Swap First and Last Frame","ly.img.ai.imageSelection.selectImage.label":"Select Image"}}),gg(i,e),fg(e,t)}}function fg(t,e){let i="fal-ai/veo3.1/first-last-frame-to-video",r=e.middlewares??e.middleware??[],n=null;return{id:i,name:"Veo 3.1 (First/Last Frame)",kind:"video",initialize:async()=>{n=ke(e.proxyUrl,e.headers)},input:{quickActions:{supported:Te({"ly.img.createVideo":{mapInput:()=>{throw new Error("This generation should not be triggered by this quick action")}},"ly.img.animateBetweenImages":{mapInput:s=>({prompt:"",first_frame_url:s.firstFrameUri,last_frame_url:s.lastFrameUri})}},e.supportedQuickActions)},panel:{type:"schema",document:Vo,inputReference:"#/components/schemas/Veo31FirstLastFrameToVideoInput",includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{first_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.first_frame_url`,""),c=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Fi(i),{payload:{onSelect:m=>{let p=m.meta?.uri;p!=null&&a.setValue(p)}}})}}}),u.Button(`${l.id}.swap`,{label:"ly.img.ai.veo31.swapFrames.label",icon:"@imgly/Replace",labelAlignment:"center",variant:"regular",onClick:()=>{let m=a.value;a.setValue(c.value),c.setValue(m)}}),()=>({id:l.id,type:"string",value:a.value})},last_frame_url:(s,l)=>{let{builder:u,experimental:{global:d}}=s,a=d(`${i}.last_frame_url`,"");return u.MediaPreview(l.id,{preview:{type:"image",uri:a.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{t.ui.openPanel(Ri(i),{payload:{onSelect:c=>{let m=c.meta?.uri;m!=null&&a.setValue(m)}}})}}}),()=>({id:l.id,type:"string",value:a.value})}},getBlockInput:async s=>{let l,u,d={"720p":{height:720},"1080p":{height:1080}},a=s.resolution??"720p",c=d[a].height;if(s.aspect_ratio&&s.aspect_ratio!=="auto"){let[p,g]=s.aspect_ratio.split(":").map(Number);u=c,l=Math.round(u*p/g)}else try{let p=await R(s.first_frame_url,t.engine),g=p.width??1920,h=p.height??1080,b=g/h;u=c,l=Math.round(u*b)}catch{u=c,l=Math.round(u*16/9)}let m=s.duration?parseInt(s.duration.replace("s",""),10):8;return Promise.resolve({video:{width:l,height:u,duration:m}})},userFlow:"placeholder"}},output:{abortable:!0,history:e.history??"@imgly/indexedDB",middleware:r,generate:async(s,{abortSignal:l})=>{if(!n)throw new Error("Provider not initialized");let u=await X(n,s.first_frame_url,t),d=await X(n,s.last_frame_url,t),a=await n.subscribe(i,{abortSignal:l,input:{...s,first_frame_url:u??s.first_frame_url,last_frame_url:d??s.last_frame_url},logs:!0}),c=a?.data?.video;if(c!=null){let m=c?.url;if(m!=null)return{kind:"video",url:m}}throw console.error("Cannot extract generated video from response:",a),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}}}function gg(t,e){e.ui.registerPanel(Fi(t),({builder:i,payload:r})=>{i.Section("first_frame_section",{children:()=>{i.Text("first_frame_title",{content:"ly.img.ai.veo31.firstFrame.label"}),i.Library(`${t}.library.first_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Fi(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})}),e.ui.registerPanel(Ri(t),({builder:i,payload:r})=>{i.Section("last_frame_section",{children:()=>{i.Text("last_frame_title",{content:"ly.img.ai.veo31.lastFrame.label"}),i.Library(`${t}.library.last_frame`,{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:"ly.img.ai.imageSelection.error.svg"}):s.startsWith("image/")?(r?.onSelect(n),e?.ui.closePanel(Ri(t))):e.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})}})})}function Fi(t){return`ly.img.ai.${t}.firstFrameSelection`}function Ri(t){return`ly.img.ai.${t}.lastFrameSelection`}var Do={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/image-to-video"},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"]},Veo31ImageToVideoInput:{title:"Veo31ImageToVideoInput",type:"object",properties:{image_url:{format:"uri",description:"URL of the image to animate",type:"string",examples:["https://v3.fal.media/files/rabbit/NEvlE6DqEks4afmShK9tY_image.webp"],maxLength:2083,minLength:1,title:"Source Image"},prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing the desired video motion and content","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"The duration of the generated video (fixed at 8 seconds for Veo 3.1)","x-imgly-enum-labels":{"8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","image_url"]},Veo31ImageToVideoOutput:{title:"Veo31ImageToVideoOutput",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/veo3.1/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/veo3.1/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/veo3.1/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31ImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/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/Veo31ImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function jo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/image-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Image To Animate",[`panel.${i}.imageSelection`]:"Select Image To Animate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),yg(e,t)}}function yg(t,e){return S({modelKey:"fal-ai/veo3.1/image-to-video",name:"Veo 3.1",schema:Do,inputReference:"#/components/schemas/Veo31ImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{"ly.img.createVideo":{mapInput:i=>({prompt:"",image_url:i.uri})}},getBlockInput:async i=>{let r=i.resolution??"720p",o={"720p":720,"1080p":1080}[r],s=i.aspect_ratio??"16:9",[l,u]=s.split(":").map(Number),d=o,a=Math.round(d*l/u),c=i.duration??"8s",m=parseInt(c.replace("s",""),10);return Promise.resolve({video:{width:a,height:d,duration:m}})}},e)}var Oo={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API for fal-ai/veo3.1/fast/image-to-video"},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"]},Veo31FastImageToVideoInput:{title:"Veo31FastImageToVideoInput",type:"object",properties:{image_url:{format:"uri",description:"URL of the image to be animated",type:"string",maxLength:2083,minLength:1,title:"Image URL"},prompt:{title:"Prompt",type:"string",minLength:1,description:"The text prompt describing how to animate the image","x-imgly-builder":{component:"TextArea"}},aspect_ratio:{title:"Aspect Ratio",type:"string",enum:["9:16","16:9","1:1"],default:"16:9",description:"The aspect ratio of the generated video","x-imgly-enum-labels":{"9:16":"9:16 (Vertical)","16:9":"16:9 (Landscape)","1:1":"1:1 (Square)"},"x-imgly-builder":{component:"Select"}},resolution:{title:"Resolution",type:"string",enum:["720p","1080p"],default:"720p",description:"The resolution of the generated video","x-imgly-enum-labels":{"720p":"720p (HD)","1080p":"1080p (Full HD)"},"x-imgly-builder":{component:"Select"}},duration:{title:"Duration",type:"string",enum:["8s"],default:"8s",description:"The duration of the generated video (fixed at 8 seconds)","x-imgly-enum-labels":{"8s":"8 seconds"},"x-imgly-builder":{component:"Select"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Whether to generate audio for the video","x-imgly-builder":{component:"Switch"}},negative_prompt:{title:"Negative Prompt",type:"string",description:"Content to avoid in the generated video","x-imgly-builder":{component:"TextArea"}},enhance_prompt:{title:"Enhance Prompt",type:"boolean",default:!0,description:"Enhance the prompt for better generation quality","x-imgly-builder":{component:"Switch"}},auto_fix:{title:"Auto Fix",type:"boolean",default:!0,description:"Automatically fix prompts that fail content policy","x-imgly-builder":{component:"Switch"}},seed:{title:"Seed",type:"integer",description:"Seed for reproducible generation","x-imgly-builder":{component:"Number"}}},"x-fal-order-properties":["image_url","prompt","aspect_ratio","resolution","generate_audio"],required:["prompt","image_url"]},Veo31FastImageToVideoOutput:{title:"Veo31FastImageToVideoOutput",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/veo3.1/fast/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/veo3.1/fast/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/veo3.1/fast/image-to-video":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Veo31FastImageToVideoInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/veo3.1/fast/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/Veo31FastImageToVideoOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Fo(t){return async({cesdk:e})=>{let i="fal-ai/veo3.1/fast/image-to-video";return I(e,{en:{[`panel.${x(i)}.imageSelection`]:"Select Image To Animate",[`panel.${i}.imageSelection`]:"Select Image To Animate",[`libraries.${x(i)}.history.label`]:"Generated From Image"}}),vg(e,t)}}function vg(t,e){return S({modelKey:"fal-ai/veo3.1/fast/image-to-video",name:"Veo 3.1 Fast",schema:Oo,inputReference:"#/components/schemas/Veo31FastImageToVideoInput",cesdk:t,headers:e.headers,middlewares:e.middlewares,supportedQuickActions:{"ly.img.createVideo":{mapInput:i=>({prompt:"",image_url:i.uri})}},getBlockInput:async i=>{let r=i.resolution??"720p",o={"720p":720,"1080p":1080}[r],s=i.aspect_ratio??"16:9",[l,u]=s.split(":").map(Number),d=o,a=Math.round(d*l/u),c=i.duration??"8s",m=parseInt(c.replace("s",""),10);return Promise.resolve({video:{width:a,height:d,duration:m}})}},e)}var wg={MinimaxVideo01Live:Un,MinimaxVideo01LiveImageToVideo:co,MinimaxHailuo02StandardImageToVideo:mo,KlingVideoV21MasterImageToVideo:go,PixverseV35TextToVideo:yo,KlingVideoV21MasterTextToVideo:vo,Veo3TextToVideo:_o,Veo31TextToVideo:To,Veo31FastTextToVideo:So,ByteDanceSeedanceV1ProImageToVideo:Ao,ByteDanceSeedanceV1ProTextToVideo:ko,Veo31FastFirstLastFrameToVideo:qo,Veo31FirstLastFrameToVideo:Mo,Veo31ImageToVideo:jo,Veo31FastImageToVideo:Fo},d0=wg;export{d0 as default};
73
73
  /*! Bundled license information:
74
74
 
75
75
  lodash-es/lodash.js: