https://videoprompt.online/_next/static/chunks/0_aipfk4yuyoy.js?dpl=dpl_Bhm76LKqPFNCZDNiBS4RmE7aHGwJ
1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,198718,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.TARGET_URL_HEADER=void 0,a.withMiddleware=function(...e){let t=e=>"function"==typeof e;return a=>r(this,void 0,void 0,function*(){let r=Object.assign({},a);for(let a of e.filter(t))r=yield a(r);return r})},a.withProxy=function(e){return t=>{var r;let i;return t.headers&&a.TARGET_URL_HEADER in t.headers?Promise.resolve(t):(r=e.when,i={isBrowser:"u">typeof window&&void 0!==window.document},"function"==typeof r?r(i):"always"===r||i.isBrowser)?Promise.resolve(Object.assign(Object.assign({},t),{url:e.targetUrl,headers:Object.assign(Object.assign({},t.headers||{}),{[a.TARGET_URL_HEADER]:t.url})})):Promise.resolve(t)}},a.TARGET_URL_HEADER="x-fal-target-url"},99186,(e,t,a)=>{"use strict";function r(e){if("number"!=typeof e||isNaN(e))throw Error(`Timeout must be a number, got ${e}`);if(e<=a.MIN_REQUEST_TIMEOUT_SECONDS)throw Error(`Timeout must be greater than ${a.MIN_REQUEST_TIMEOUT_SECONDS} seconds`);return e.toString()}Object.defineProperty(a,"__esModule",{value:!0}),a.RUNNER_HINT_HEADER=a.QUEUE_PRIORITY_HEADER=a.REQUEST_TIMEOUT_TYPE_HEADER=a.REQUEST_TIMEOUT_HEADER=a.MIN_REQUEST_TIMEOUT_SECONDS=void 0,a.validateTimeoutHeader=r,a.buildTimeoutHeaders=function(e){return void 0===e?{}:{[a.REQUEST_TIMEOUT_HEADER]:r(e)}},a.MIN_REQUEST_TIMEOUT_SECONDS=1,a.REQUEST_TIMEOUT_HEADER="x-fal-request-timeout",a.REQUEST_TIMEOUT_TYPE_HEADER="x-fal-request-timeout-type",a.QUEUE_PRIORITY_HEADER="x-fal-queue-priority",a.RUNNER_HINT_HEADER="x-fal-runner-hint"},462951,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.ValidationError=a.ApiError=void 0,a.defaultResponseHandler=l,a.resultResponseHandler=function(e){return r(this,void 0,void 0,function*(){return{data:yield l(e),requestId:e.headers.get(o)||""}})};let i=e.r(99186),o="x-fal-request-id";class s extends Error{constructor({message:e,status:t,body:a,requestId:r,timeoutType:i}){super(e),this.name="ApiError",this.status=t,this.body=a,this.requestId=r||"",this.timeoutType=i}get isUserTimeout(){return 504===this.status&&"user"===this.timeoutType}}a.ApiError=s;class n extends s{constructor(e){super(e),this.name="ValidationError"}get fieldErrors(){return"string"==typeof this.body.detail?[{loc:["body"],msg:this.body.detail,type:"value_error"}]:this.body.detail||[]}getFieldErrors(e){return this.fieldErrors.filter(t=>t.loc[t.loc.length-1]===e)}}function l(e){return r(this,void 0,void 0,function*(){var t;let{status:a,statusText:r}=e,l=null!=(t=e.headers.get("Content-Type"))?t:"",d=e.headers.get(o)||void 0,c=e.headers.get(i.REQUEST_TIMEOUT_TYPE_HEADER)||void 0;if(!e.ok){if(l.includes("application/json")){let t=yield e.json();throw new(422===a?n:s)({message:t.message||r,status:a,body:t,requestId:d,timeoutType:c})}throw new s({message:`HTTP ${a}: ${r}`,status:a,requestId:d,timeoutType:c})}return l.includes("application/json")?e.json():l.includes("text/html")?e.text():l.includes("application/octet-stream")?e.arrayBuffer():e.text()})}a.ValidationError=n},13991,(e,t,a)=>{"use strict";let r;var i=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};function o(e){if(e.split("/").length>1)return e;let[,t,a]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(e)||[];if(t&&a)return`${t}/${a}`;throw Error(`Invalid app id: ${e}. Must be in the format <appOwner>/<appId>`)}Object.defineProperty(a,"__esModule",{value:!0}),a.ensureEndpointIdFormat=o,a.parseEndpointId=function(e){let t=o(e).split("/");return s.includes(t[0])?{owner:t[1],alias:t[2],path:t.slice(3).join("/")||void 0,namespace:t[0]}:{owner:t[0],alias:t[1],path:t.slice(2).join("/")||void 0}},a.resolveEndpointPath=function(e,t,a){return t?`/${t.replace(/^\/+/,"")}`:e.endsWith(a)?void 0:a},a.isValidUrl=function(e){try{let{host:t}=new URL(e);return/(fal\.(ai|run))$/.test(t)}catch(e){return!1}},a.throttle=function(e,t,a=!1){let r,i;return(...o)=>{!i&&a?(e(...o),i=Date.now()):(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-i>=t&&(e(...o),i=Date.now())},t-(Date.now()-i)))}},a.isReact=function(){if(void 0===r){let e=Error().stack;r=!!e&&(e.includes("node_modules/react-dom/")||e.includes("node_modules/next/"))}return r},a.isPlainObject=function(e){return!!e&&Object.getPrototypeOf(e)===Object.prototype},a.sleep=function(e){return i(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})};let s=["workflows","comfy"]},327356,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_RETRY_OPTIONS=a.DEFAULT_RETRYABLE_STATUS_CODES=void 0,a.isRetryableNetworkError=n,a.isRetryableError=l,a.calculateBackoffDelay=d,a.executeWithRetry=function(e,t,a){return r(this,void 0,void 0,function*(){let r,i={totalAttempts:0,totalDelay:0};for(let s=0;s<=t.maxRetries;s++){i.totalAttempts++;try{return{result:yield e(),metrics:i}}catch(n){if(r=n,i.lastError=n,s===t.maxRetries||!l(n,t.retryableStatusCodes))throw n;let e=d(s,t.baseDelay,t.maxDelay,t.backoffMultiplier,t.enableJitter);i.totalDelay+=e,a&&a(s+1,n,e),yield(0,o.sleep)(e)}}throw r})};let i=e.r(462951),o=e.r(13991);a.DEFAULT_RETRYABLE_STATUS_CODES=[429,502,503,504],a.DEFAULT_RETRY_OPTIONS={maxRetries:3,baseDelay:1e3,maxDelay:3e4,backoffMultiplier:2,retryableStatusCodes:a.DEFAULT_RETRYABLE_STATUS_CODES,enableJitter:!0};let s=new Set(["ECONNABORTED","ECONNREFUSED","ECONNRESET","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EPIPE","ETIMEDOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"]);function n(e){if(!e||"object"!=typeof e)return!1;let t=new Set,a=e,r=!1;for(;a&&"object"==typeof a&&!t.has(a);){t.add(a);let e=a.name;if("AbortError"===e||"TimeoutError"===e)return!1;let i=a.code;"string"==typeof i&&s.has(i)&&(r=!0),a=a.cause}return!!(r||e instanceof TypeError&&"string"==typeof e.message&&/fetch failed/i.test(e.message))}function l(e,t){return e instanceof i.ApiError?!e.isUserTimeout&&t.includes(e.status):n(e)}function d(e,t,a,r,i){let o=Math.min(t*Math.pow(r,e),a);if(i){let e=.25*o*(2*Math.random()-1);return Math.max(0,o+e)}return o}},722408,(e,t,a)=>{t.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.10.1",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"}},291154,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.isBrowser=function(){return"u">typeof window&&void 0!==window.document},a.getUserAgent=function(){if(null!==r)return r;let t=e.r(722408);return r=`${t.name}/${t.version}`};let r=null},691874,(e,t,a)=>{"use strict";var r=e.i(923106);Object.defineProperty(a,"__esModule",{value:!0}),a.credentialsFromEnv=void 0,a.resolveDefaultFetch=l,a.createConfig=function(e){var t;let a=Object.assign(Object.assign(Object.assign({},d),e),{fetch:null!=(t=e.fetch)?t:l(),retry:Object.assign(Object.assign({},s.DEFAULT_RETRY_OPTIONS),e.retry||{})});if(e.proxyUrl){let t="string"==typeof e.proxyUrl?{url:e.proxyUrl}:e.proxyUrl;a=Object.assign(Object.assign({},a),{requestMiddleware:(0,i.withMiddleware)(a.requestMiddleware,(0,i.withProxy)({targetUrl:t.url,when:t.when}))})}let{credentials:r,suppressLocalCredentialsWarning:o}=a,c="function"==typeof r?r():r;return(0,n.isBrowser)()&&c&&!o&&console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases."),a},a.getRestApiUrl=function(){return"https://rest.fal.ai"};let i=e.r(198718),o=e.r(462951),s=e.r(327356),n=e.r(291154);function l(){if("u"<typeof fetch)throw Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}a.credentialsFromEnv=()=>{if(void 0!==r.default&&r.default.env&&(void 0!==r.default.env.FAL_KEY||void 0!==r.default.env.FAL_KEY_ID&&void 0!==r.default.env.FAL_KEY_SECRET))return void 0!==r.default.env.FAL_KEY?r.default.env.FAL_KEY:r.default.env.FAL_KEY_ID?`${r.default.env.FAL_KEY_ID}:${r.default.env.FAL_KEY_SECRET}`:void 0};let d={credentials:a.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:e=>Promise.resolve(e),responseHandler:o.defaultResponseHandler,retry:s.DEFAULT_RETRY_OPTIONS}},673450,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})},i=e.e&&e.e.__rest||function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]]);return a};Object.defineProperty(a,"__esModule",{value:!0}),a.dispatchRequest=function(e){return r(this,void 0,void 0,function*(){var t;
1let a,{targetUrl:d,input:c,config:p,options:u={}}=e,{credentials:m,requestMiddleware:h,responseHandler:g,fetch:f}=p,v=Object.assign(Object.assign({},p.retry),u.retry||{}),y=()=>r(this,void 0,void 0,function*(){var t,a,r;let o=(0,s.isBrowser)()?{}:{"User-Agent":(0,s.getUserAgent)()},n="function"==typeof m?m():m,{method:p,url:v,headers:y}=yield h({method:(null!=(a=null!=(t=e.method)?t:u.method)?a:"post").toUpperCase(),url:d,headers:e.headers}),b=Object.assign(Object.assign(Object.assign(Object.assign({},n?{Authorization:`Key ${n}`}:{}),{Accept:"application/json","Content-Type":"application/json"}),o),null!=y?y:{}),{responseHandler:w,retry:x}=u,_=i(u,["responseHandler","retry"]),k=yield f(v,Object.assign(Object.assign(Object.assign(Object.assign({},_),{method:p,headers:Object.assign(Object.assign({},b),null!=(r=_.headers)?r:{})}),!l&&{mode:"cors"}),{signal:u.signal,body:"get"!==p.toLowerCase()&&c?JSON.stringify(c):void 0}));return yield(null!=w?w:g)(k)});for(let e=0;e<=v.maxRetries;e++)try{return yield y()}catch(i){if(a=i,e===v.maxRetries||!(0,o.isRetryableError)(i,v.retryableStatusCodes)||(null==(t=u.signal)?void 0:t.aborted))throw i;let r=(0,o.calculateBackoffDelay)(e,v.baseDelay,v.maxDelay,v.backoffMultiplier,v.enableJitter);yield(0,n.sleep)(r)}throw a})},a.buildUrl=function(e,t={}){var a,r;let i=(null!=(a=t.method)?a:"post").toLowerCase(),o=(null!=(r=t.path)?r:"").replace(/^\//,"").replace(/\/{2,}/,"/"),s=t.input,l=Object.assign(Object.assign({},t.query||{}),"get"===i?s:{}),d=Object.keys(l).length>0?`?${new URLSearchParams(l).toString()}`:"";if((0,n.isValidUrl)(e)){let t=e.endsWith("/")?e:`${e}/`;return`${t}${o}${d}`}let c=(0,n.ensureEndpointIdFormat)(e),p=t.subdomain?`${t.subdomain}.`:"",u=`https://${p}fal.run/${c}/${o}`;return`${u.replace(/\/$/,"")}${d}`};let o=e.r(327356),s=e.r(291154),n=e.r(13991),l="u">typeof navigator&&(null==navigator?void 0:navigator.userAgent)==="Cloudflare-Workers"},297714,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.OBJECT_LIFECYCYLE_PREFERENCE_HEADER=void 0,a.getExpirationDurationSeconds=l,a.buildObjectLifecycleHeaders=function(e){let t=d(e);return t?{[a.OBJECT_LIFECYCYLE_PREFERENCE_HEADER]:JSON.stringify(t)}:{}},a.createStorageClient=function({config:e}){let t={upload:(t,a)=>r(this,void 0,void 0,function*(){let s=null==a?void 0:a.lifecycle;if(t.size>0x5a00000)return yield function(e,t,a){return r(this,void 0,void 0,function*(){let{fetch:s,responseHandler:n}=t,l=e.type||"application/octet-stream",{upload_url:p,file_url:u}=yield function(e,t,a,s){return r(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${c(a)}`,n={},l=d(s);return l&&(n["X-Fal-Object-Lifecycle"]=JSON.stringify(l)),yield(0,o.dispatchRequest)({method:"POST",targetUrl:`${(0,i.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:a,file_name:r},config:t,headers:n})})}(e,t,l,a),m=Math.ceil(e.size/0xa00000),h=new URL(p),g=[];for(let a=0;a<m;a++){let i=0xa00000*a,o=Math.min(i+0xa00000,e.size),s=e.slice(i,o),n=a+1,l=`${h.origin}${h.pathname}/${n}${h.search}`;g.push((yield function e(t,a,i){return r(this,arguments,void 0,function*(t,a,r,i=3){if(0===i)throw Error("Part upload failed, retries exhausted");let{fetch:o,responseHandler:s}=r;try{let e=yield o(t,{method:"PUT",body:a});return yield s(e)}catch(o){return yield e(t,a,r,i-1)}})}(l,s,t)))}let f=`${h.origin}${h.pathname}/complete${h.search}`,v=yield s(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:g.map(e=>({partNumber:e.partNumber,etag:e.etag}))})});return yield n(v),u})}(t,e,s);let n=t.type||"application/octet-stream",{fetch:l,responseHandler:p}=e,{upload_url:u,file_url:m}=yield function(e,t,a,s){return r(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${c(a)}`,n={},l=d(s);return l&&(n["X-Fal-Object-Lifecycle"]=JSON.stringify(l)),yield(0,o.dispatchRequest)({method:"POST",targetUrl:`${(0,i.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:a,file_name:r},config:t,headers:n})})}(t,e,n,s),h=yield l(u,{method:"PUT",body:t,headers:{"Content-Type":t.type||"application/octet-stream"}});return yield p(h),m}),transformInput:e=>r(this,void 0,void 0,function*(){if(Array.isArray(e))return Promise.all(e.map(e=>t.transformInput(e)));if(e instanceof Blob)return yield t.upload(e);if((0,s.isPlainObject)(e)){let a=Object.entries(e).map(e=>r(this,[e],void 0,function*([e,a]){return[e,(yield t.transformInput(a))]}));return Object.fromEntries((yield Promise.all(a)))}return e})};return t};let i=e.r(691874),o=e.r(673450),s=e.r(13991);a.OBJECT_LIFECYCYLE_PREFERENCE_HEADER="x-fal-object-lifecycle-preference";let n={never:void 0,immediate:60,"1h":3600,"1d":86400,"7d":604800,"30d":2592e3,"1y":31536e3};function l(e){let{expiresIn:t}=e;if(void 0!==t)return"number"==typeof t?t:n[t]}function d(e){if(!e)return;let t=l(e),a={};return void 0!==t&&(a.expiration_duration_seconds=t),void 0!==e.initialAcl&&(a.initial_acl=e.initialAcl),Object.keys(a).length>0?a:void 0}function c(e){var t;let[,a]=e.split("/");return null!=(t=a.split(/[-;]/)[0])?t:"bin"}},176034,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});let r=[239,187,191];a.createParser=function(e){let t,a,i,o,s,n,l;return d(),{feed:function(d){var c;a=a?a+d:d,t&&(c=a,r.every((e,t)=>c.charCodeAt(t)===e))&&(a=a.slice(r.length)),t=!1;let p=a.length,u=0,m=!1;for(;u<p;){let t;m&&("\n"===a[u]&&++u,m=!1);let r=-1,d=o;for(let e=i;r<0&&e<p;++e)":"===(t=a[e])&&d<0?d=e-u:"\r"===t?(m=!0,r=e-u):"\n"===t&&(r=e-u);
1if(r<0){i=p-u,o=d;break}i=0,o=-1,function(t,a,r,i){if(0===i){l.length>0&&(e({type:"event",id:s,event:n||void 0,data:l.slice(0,-1)}),l="",s=void 0),n=void 0;return}let o=r<0,d=t.slice(a,a+(o?i:r)),c=0;c=o?i:" "===t[a+r+1]?r+2:r+1;let p=a+c,u=i-c,m=t.slice(p,p+u).toString();if("data"===d)l+=m?"".concat(m,"\n"):"\n";else if("event"===d)n=m;else if("id"!==d||m.includes("\0")){if("retry"===d){let t=parseInt(m,10);Number.isNaN(t)||e({type:"reconnect-interval",value:t})}}else s=m}(a,u,d,r),u+=r+1}u===p?a="":u>0&&(a=a.slice(u))},reset:d};function d(){t=!0,a="",i=0,o=-1,s=void 0,n=void 0,l=""}}},417768,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.TOKEN_EXPIRATION_SECONDS=void 0,a.getTemporaryAuthToken=function(e,t){return r(this,void 0,void 0,function*(){let r=(0,s.parseEndpointId)(e),n=yield(0,o.dispatchRequest)({method:"POST",targetUrl:`${(0,i.getRestApiUrl)()}/tokens/`,config:t,input:{allowed_apps:[r.alias],token_expiration:a.TOKEN_EXPIRATION_SECONDS}});return"string"!=typeof n&&n.detail?n.detail:n})};let i=e.r(691874),o=e.r(673450),s=e.r(13991);a.TOKEN_EXPIRATION_SECONDS=120},793996,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})},i=e.e&&e.e.__await||function(e){return this instanceof i?(this.v=e,this):new i(e)},o=e.e&&e.e.__asyncGenerator||function(e,t,a){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,o=a.apply(e,t||[]),s=[];return r={},n("next"),n("throw"),n("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function n(e,t){o[e]&&(r[e]=function(t){return new Promise(function(a,r){s.push([e,t,a,r])>1||l(e,t)})},t&&(r[e]=t(r[e])))}function l(e,t){try{var a;(a=o[e](t)).value instanceof i?Promise.resolve(a.value.v).then(d,c):p(s[0][2],a)}catch(e){p(s[0][3],e)}}function d(e){l("next",e)}function c(e){l("throw",e)}function p(e,t){e(t),s.shift(),s.length&&l(s[0][0],s[0][1])}};Object.defineProperty(a,"__esModule",{value:!0}),a.FalStream=void 0,a.createStreamingClient=function({config:e,storage:t}){return{stream(a,i){return r(this,void 0,void 0,function*(){let r=i.input?yield t.transformInput(i.input):void 0;return new u(a,e,Object.assign(Object.assign({},i),{input:r}))})}}};let s=e.r(176034),n=e.r(417768),l=e.r(673450),d=e.r(462951),c=e.r(13991),p="text/event-stream";class u{constructor(e,t,a){var i;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=()=>r(this,void 0,void 0,function*(){var e,t,a;let{endpointId:i,options:o}=this,{input:s,method:d="post",connectionMode:u="server",tokenProvider:m}=o;try{if("client"===u){let a=(0,c.ensureEndpointIdFormat)(i),r=null!=(e=(0,c.resolveEndpointPath)(i,void 0,"/stream"))?e:"",l=m?()=>m(`${a}${r}`):()=>(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,n.getTemporaryAuthToken)(i,this.config)),u=yield l(),{fetch:h}=this.config,g=new URL(this.url);g.searchParams.set("fal_jwt_token",u);let f=yield h(g.toString(),{method:d.toUpperCase(),headers:{accept:null!=(t=o.accept)?t:p,"content-type":"application/json"},body:s&&"get"!==d?JSON.stringify(s):void 0,signal:this.abortController.signal});return this._requestId=f.headers.get("x-fal-request-id"),yield this.handleResponse(f)}return yield(0,l.dispatchRequest)({method:d.toUpperCase(),targetUrl:this.url,input:s,config:this.config,options:{headers:{accept:null!=(a=o.accept)?a:p},responseHandler:e=>r(this,void 0,void 0,function*(){return this._requestId=e.headers.get("x-fal-request-id"),yield this.handleResponse(e)}),signal:this.abortController.signal}})}catch(e){this.handleError(e)}}),this.handleResponse=e=>r(this,void 0,void 0,function*(){var t,a;if(!e.ok){try{yield(0,d.defaultResponseHandler)(e)}
1catch(e){this.emit("error",e)}return}let i=e.body;if(!i)return void this.emit("error",new d.ApiError({message:"Response body is empty.",status:400,body:void 0,requestId:this._requestId||void 0}));if(!(null!=(t=e.headers.get("content-type"))?t:"").startsWith(p)){let e=i.getReader(),t=()=>{e.read().then(({done:e,value:a})=>{e?this.emit("done",this.currentData):(this.buffer.push(a),this.currentData=a,this.emit("data",a),t())})};t();return}let o=new TextDecoder("utf-8"),n=e.body.getReader(),l=(0,s.createParser)(e=>{if("event"===e.type){let t=e.data;try{let e=JSON.parse(t);this.buffer.push(e),this.currentData=e,this.emit("data",e),this.emit("message",e)}catch(e){this.emit("error",e)}}}),c=null!=(a=this.options.timeout)?a:15e3,u=()=>r(this,void 0,void 0,function*(){let{value:e,done:t}=yield n.read();this.lastEventTimestamp=Date.now(),l.feed(o.decode(e)),Date.now()-this.lastEventTimestamp>c&&this.emit("error",new d.ApiError({message:`Event stream timed out after ${(c/1e3).toFixed(0)} seconds with no messages.`,status:408,requestId:this._requestId||void 0})),t?this.emit("done",this.currentData):u().catch(this.handleError)});u().catch(this.handleError)}),this.handleError=e=>{var t;if("AbortError"===e.name||this.signal.aborted)return;let a=e instanceof d.ApiError?e:new d.ApiError({message:null!=(t=e.message)?t:"An unknown error occurred",status:500,requestId:this._requestId||void 0});this.emit("error",a)},this.on=(e,t)=>{var a;this.listeners.has(e)||this.listeners.set(e,[]),null==(a=this.listeners.get(e))||a.push(t)},this.emit=(e,t)=>{for(let a of this.listeners.get(e)||[])a(t)},this.done=()=>r(this,void 0,void 0,function*(){return this.donePromise}),this.abort=e=>{this.streamClosed||this.abortController.abort(e)},this.endpointId=e,this.config=t,this.url=null!=(i=a.url)?i:(0,l.buildUrl)(e,{path:(0,c.resolveEndpointPath)(e,void 0,"/stream"),query:a.queryParams}),this.options=a,this.donePromise=new Promise((e,t)=>{this.streamClosed&&t(new d.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0,requestId:this._requestId||void 0})),this.signal.addEventListener("abort",()=>{var t;e(null!=(t=this.currentData)?t:{})}),this.on("done",t=>{this.streamClosed=!0,e(t)}),this.on("error",e=>{this.streamClosed=!0,t(e)})}),a.signal&&a.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return o(this,arguments,function*(){let e=!0,t=()=>e=!1;for(this.on("error",t),this.on("done",t);e||this.buffer.length>0;){let e=this.buffer.shift();e&&(yield yield i(e)),yield i(new Promise(e=>setTimeout(e,16)))}})}get signal(){return this.abortController.signal}get requestId(){return this._requestId}}a.FalStream=u},674161,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})},i=e.e&&e.e.__rest||function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]]);return a};Object.defineProperty(a,"__esModule",{value:!0}),a.createQueueClient=void 0;let o=e.r(99186),s=e.r(673450),n=e.r(462951),l=e.r(327356),d=e.r(297714),c=e.r(793996),p=e.r(13991),u={maxRetries:3,baseDelay:1e3,maxDelay:6e4,retryableStatusCodes:l.DEFAULT_RETRYABLE_STATUS_CODES},m={maxRetries:5,baseDelay:1e3,maxDelay:3e4,retryableStatusCodes:[...l.DEFAULT_RETRYABLE_STATUS_CODES,500]};a.createQueueClient=({config:e,storage:t})=>{let a={submit(a,n){return r(this,void 0,void 0,function*(){let{webhookUrl:r,priority:l,hint:c,startTimeout:p,headers:m,storageSettings:h}=n,g=i(n,["webhookUrl","priority","hint","startTimeout","headers","storageSettings"]),f=n.input?yield t.transformInput(n.input):void 0,v=Object.fromEntries(Object.entries(null!=m?m:{}).map(([e,t])=>[e.toLowerCase(),t]));return(0,s.dispatchRequest)({method:n.method,targetUrl:(0,s.buildUrl)(a,Object.assign(Object.assign({},g),{subdomain:"queue",query:r?{fal_webhook:r}:void 0})),headers:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),(0,d.buildObjectLifecycleHeaders)(h)),{[o.QUEUE_PRIORITY_HEADER]:null!=l?l:"normal"}),c&&{[o.RUNNER_HINT_HEADER]:c}
1),(0,o.buildTimeoutHeaders)(p)),input:f,config:e,options:{signal:n.abortSignal,retry:u}})})},status(t,a){return r(this,arguments,void 0,function*(t,{requestId:a,logs:r=!1,abortSignal:i}){let o=(0,p.parseEndpointId)(t),n=o.namespace?`${o.namespace}/`:"";return(0,s.dispatchRequest)({method:"get",targetUrl:(0,s.buildUrl)(`${n}${o.owner}/${o.alias}`,{subdomain:"queue",query:{logs:r?"1":"0"},path:`/requests/${a}/status`}),config:e,options:{signal:i,retry:m}})})},streamStatus(t,a){return r(this,arguments,void 0,function*(t,{requestId:a,logs:r=!1,connectionMode:i}){let o=(0,p.parseEndpointId)(t),n=o.namespace?`${o.namespace}/`:"",l={logs:r?"1":"0"},d=(0,s.buildUrl)(`${n}${o.owner}/${o.alias}`,{subdomain:"queue",path:`/requests/${a}/status/stream`,query:l});return new c.FalStream(t,e,{url:d,method:"get",connectionMode:i,queryParams:l})})},subscribeToStatus(e,t){return r(this,void 0,void 0,function*(){let i,o=t.requestId,s=t.timeout,n=()=>{};if("streaming"===t.mode){let r=yield a.streamStatus(e,{requestId:o,logs:t.logs,connectionMode:"connectionMode"in t?t.connectionMode:void 0}),l=[];s&&(i=setTimeout(()=>{throw r.abort(),a.cancel(e,{requestId:o}).catch(n),Error(`Client timed out waiting for the request to complete after ${s}ms`)},s)),r.on("data",e=>{t.onQueueUpdate&&("logs"in e&&Array.isArray(e.logs)&&e.logs.length>0&&l.push(...e.logs),t.onQueueUpdate("logs"in e?Object.assign(Object.assign({},e),{logs:l}):e))});let d=yield r.done();return i&&clearTimeout(i),d}return new Promise((l,d)=>{var c;let p,u="pollInterval"in t&&"number"==typeof t.pollInterval&&null!=(c=t.pollInterval)?c:500,m=()=>{i&&clearTimeout(i),p&&clearTimeout(p)};s&&(i=setTimeout(()=>{m(),a.cancel(e,{requestId:o}).catch(n),d(Error(`Client timed out waiting for the request to complete after ${s}ms`))},s));let h=()=>r(this,void 0,void 0,function*(){var r;try{let i=yield a.status(e,{requestId:o,logs:null!=(r=t.logs)&&r,abortSignal:t.abortSignal});if(t.onQueueUpdate&&t.onQueueUpdate(i),"COMPLETED"===i.status){m(),l(i);return}p=setTimeout(h,u)}catch(e){m(),d(e)}});h().catch(d)})})},result(t,a){return r(this,arguments,void 0,function*(t,{requestId:a,abortSignal:r}){let i=(0,p.parseEndpointId)(t),o=i.namespace?`${i.namespace}/`:"";return(0,s.dispatchRequest)({method:"get",targetUrl:(0,s.buildUrl)(`${o}${i.owner}/${i.alias}`,{subdomain:"queue",path:`/requests/${a}`}),config:Object.assign(Object.assign({},e),{responseHandler:n.resultResponseHandler}),options:{signal:r,retry:u}})})},cancel(t,a){return r(this,arguments,void 0,function*(t,{requestId:a,abortSignal:r}){let i=(0,p.parseEndpointId)(t),o=i.namespace?`${i.namespace}/`:"";yield(0,s.dispatchRequest)({method:"put",targetUrl:(0,s.buildUrl)(`${o}${i.owner}/${i.alias}`,{subdomain:"queue",path:`/requests/${a}/cancel`}),config:e,options:{signal:r}})})}};return a}},921336,e=>{"use strict";let t=new TextEncoder;function a(e,t,a){let r=t,i=r+a,o=[],s="";for(;r<i;){let t=e[r++];if((128&t)==0)o.push(t);else if((224&t)==192){let a=63&e[r++];o.push((31&t)<<6|a)}else if((240&t)==224){let a=63&e[r++],i=63&e[r++];o.push((31&t)<<12|a<<6|i)}else if((248&t)==240){let a=(7&t)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++];a>65535&&(a-=65536,o.push(a>>>10&1023|55296),a=56320|1023&a),o.push(a)}else o.push(t);o.length>=4096&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}let r=new TextDecoder;class i{type;data;constructor(e,t){this.type=e,this.data=t}}class o extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Object.create(o.prototype)),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:o.name})}}function s(e,t,a){let r=Math.floor(a/0x100000000);e.setUint32(t,r),e.setUint32(t+4,a)}function n(e,t){return 0x100000000*e.getInt32(t)+e.getUint32(t+4)}function l({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=0x3ffffffff)if(0===t&&e<=0xffffffff){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let a=e/0x100000000,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,t<<2|3&a),i.setUint32(4,0|e),r}{let a=new Uint8Array(12),r=new DataView(a.buffer);return r.setUint32(0,t),s(r,4,e),a}}function d(e){let t=e.getTime(),a=Math.floor(t/1e3),r=(t-1e3*a)*1e6,i=Math.floor(r/1e9);return{sec:a+i,nsec:r-1e9*i}}function c(e){return e instanceof Date?l(d(e)):null}function p(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let e=t.getUint32(0);return{sec:(3&e)*0x100000000+t.getUint32(4),nsec:e>>>2}}case 12:return{sec:n(t,4),nsec:t.getUint32(0)};default:throw new o(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function u(e){let t=p(e);return new Date(1e3*t.sec+t.nsec/1e6)}let m={type:-1,encode:c,decode:u};class h{static defaultCodec=new h;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(m)}register({type:e,encode:t,decode:a}){if(e>=0)this.encoders[e]=t,this.decoders[e]=a;else{let r=-1-e;this.builtInEncoders[r]=t,this.builtInDecoders[r]=a}}tryToEncode(e,t){for(let a=0;a<this.builtInEncoders.length;a++){let r=this.builtInEncoders[a];
1if(null!=r){let o=r(e,t);if(null!=o)return new i(-1-a,o)}}for(let a=0;a<this.encoders.length;a++){let r=this.encoders[a];if(null!=r){let o=r(e,t);if(null!=o)return new i(a,o)}}return e instanceof i?e:null}decode(e,t,a){let r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,a):new i(t,e)}}function g(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}class f{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??h.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??100,this.initialBufferSize=e?.initialBufferSize??2048,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 f({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,t){if(t>this.maxDepth)throw Error(`Too deep objects in depth ${t}`);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.useBigInt64&&"bigint"==typeof e?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){let t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)}resizeBuffer(e){let t=new ArrayBuffer(e),a=new Uint8Array(t),r=new DataView(t);a.set(this.bytes),this.view=r,this.bytes=a}encodeNil(){this.writeU8(192)}encodeBoolean(e){!1===e?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<0x100000000?(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>=-0x80000000?(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<0x100000000)this.writeU8(219),this.writeU32(e);else throw Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let a=function(e){let t=e.length,a=0,r=0;for(;r<t;){let i=e.charCodeAt(r++);if((0xffffff80&i)==0){a++;continue}if((0xfffff800&i)==0)a+=2;else{if(i>=55296&&i<=56319&&r<t){let t=e.charCodeAt(r);(64512&t)==56320&&(++r,i=((1023&i)<<10)+(1023&t)+65536)}(0xffff0000&i)==0?a+=3:a+=4}}return a}(e);this.ensureBufferSizeToWrite(5+a),this.writeStringHeader(a),function(e,a,r){if(e.length>50)t.encodeInto(e,a.subarray(r));else!function(e,t,a){let r=e.length,i=a,o=0;for(;o<r;){let a=e.charCodeAt(o++);if((0xffffff80&a)==0){t[i++]=a;continue}if((0xfffff800&a)==0)t[i++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<r){let t=e.charCodeAt(o);(64512&t)==56320&&(++o,a=((1023&a)<<10)+(1023&t)+65536)}(0xffff0000&a)==0?t[i++]=a>>12&15|224:(t[i++]=a>>18&7|240,t[i++]=a>>12&63|128),t[i++]=a>>6&63|128}t[i++]=63&a|128}}(e,a,r)}(e,this.bytes,this.pos),this.pos+=a}encodeObject(e,t){let a=this.extensionCodec.tryToEncode(e,this.context);if(null!=a)this.encodeExtension(a);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if("object"==typeof e)this.encodeMap(e,t);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<0x100000000)this.writeU8(198),this.writeU32(t);else throw Error(`Too large binary: ${t}`);let a=g(e);this.writeU8a(a)}encodeArray(e,t){let a=e.length;if(a<16)this.writeU8(144+a);
1else if(a<65536)this.writeU8(220),this.writeU16(a);else if(a<0x100000000)this.writeU8(221),this.writeU32(a);else throw Error(`Too large array: ${a}`);for(let a of e)this.doEncode(a,t+1)}countWithoutUndefined(e,t){let a=0;for(let r of t)void 0!==e[r]&&a++;return a}encodeMap(e,t){let a=Object.keys(e);this.sortKeys&&a.sort();let r=this.ignoreUndefined?this.countWithoutUndefined(e,a):a.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<0x100000000)this.writeU8(223),this.writeU32(r);else throw Error(`Too large map object: ${r}`);for(let r of a){let a=e[r];this.ignoreUndefined&&void 0===a||(this.encodeString(r),this.doEncode(a,t+1))}}encodeExtension(e){if("function"==typeof e.data){let t=e.data(this.pos+6),a=t.length;if(a>=0x100000000)throw Error(`Too large extension object: ${a}`);this.writeU8(201),this.writeU32(a),this.writeI8(e.type),this.writeU8a(t);return}let t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<0x100000000)this.writeU8(201),this.writeU32(t);else throw Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}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){var t,a;this.ensureBufferSizeToWrite(8),t=this.view,a=this.pos,t.setUint32(a,e/0x100000000),t.setUint32(a+4,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),s(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}}function v(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}let y="array",b="map_key",w="map_value",x=e=>{if("string"==typeof e||"number"==typeof e)return e;throw new o("The type of key must be string or number but "+typeof e)};class _{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=y,t.position=0,t.size=e,t.array=Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=b,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw Error("Invalid stack state. Released state is not on top of the stack.");e.type===y&&(e.size=0,e.array=void 0,e.position=0,e.type=void 0),(e.type===b||e.type===w)&&(e.size=0,e.map=void 0,e.readCount=0,e.type=void 0),this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}let k=new DataView(new ArrayBuffer(0)),S=new Uint8Array(k.buffer);try{k.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}let j=RangeError("Insufficient data"),C=new class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=16,t=16){this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,a){let r=this.caches[a-1];e:for(let i of r){let r=i.bytes;for(let i=0;i<a;i++)if(r[i]!==e[t+i])continue e;return i.str}return null}store(e,t){let a=this.caches[e.length-1],r={bytes:e,str:t};a.length>=this.maxLengthPerKey?a[Math.random()*a.length|0]=r:a.push(r)}decode(e,t,r){let i=this.find(e,t,r);if(null!=i)return this.hit++,i;this.miss++;let o=a(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o}};class I{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=k;bytes=S;headByte=-1;stack=new _;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??h.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??0xffffffff,this.maxBinLength=e?.maxBinLength??0xffffffff,this.maxArrayLength=e?.maxArrayLength??0xffffffff,this.maxMapLength=e?.maxMapLength??0xffffffff,this.maxExtLength=e?.maxExtLength??0xffffffff,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:C,this.mapKeyConverter=e?.mapKeyConverter??x}clone(){return new I({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=-1,this.stack.reset()}setBuffer(e){let t=g(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){let t=this.bytes.subarray(this.pos),a=g(e),r=new Uint8Array(t.length+a.length);r.set(t),r.set(a,t.length),this.setBuffer(r)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:a}=this;return RangeError(`Extra ${t.byteLength-a} of ${t.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 t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){let t=this.clone();yield*t.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{let t;this.entered=!0;let a=!1;for await(let r of e){if(a)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(r);try{t=this.doDecodeSync(),a=!0}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}if(a){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return t}let{headByte:r,pos:i,totalPos:o}=this;throw RangeError(`Insufficient data in parsing ${v(r)} at ${o} (${i} 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,t){if(this.entered){let a=this.clone();yield*a.decodeMultiAsync(e,t);return}try{this.entered=!0;let a=t,r=-1;for await(let i of e){if(t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),a&&(r=this.readArraySize(),a=!1,this.complete());try{for(;yield this.doDecodeSync(),0!=--r;);}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){let e,t=this.readHeadByte();if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){let a=t-128;if(0!==a){this.pushMapState(a),this.complete();continue}e={}}else if(t<160){let a=t-144;if(0!==a){this.pushArrayState(a),this.complete();continue}e=[]}else{let a=t-160;e=this.decodeString(a,0)}else if(192===t)e=null;else if(194===t)e=!1;else if(195===t)e=!0;else if(202===t)e=this.readF32();else if(203===t)e=this.readF64();else if(204===t)e=this.readU8();else if(205===t)e=this.readU16();else if(206===t)e=this.readU32();else if(207===t)e=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(208===t)e=this.readI8();else if(209===t)e=this.readI16();else if(210===t)e=this.readI32();else if(211===t)e=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(217===t){let t=this.lookU8();e=this.decodeString(t,1)}else if(218===t){let t=this.lookU16();e=this.decodeString(t,2)}else if(219===t){let t=this.lookU32();e=this.decodeString(t,4)}else if(220===t){let t=this.readU16();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(221===t){let t=this.readU32();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(222===t){let t=this.readU16();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(223===t){let t=this.readU32();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(196===t){let t=this.lookU8();e=this.decodeBinary(t,1)}else if(197===t){let t=this.lookU16();e=this.decodeBinary(t,2)}else if(198===t){let t=this.lookU32();e=this.decodeBinary(t,4)}else if(212===t)e=this.decodeExtension(1,0);else if(213===t)e=this.decodeExtension(2,0);else if(214===t)e=this.decodeExtension(4,0);else if(215===t)e=this.decodeExtension(8,0);else if(216===t)e=this.decodeExtension(16,0);else if(199===t){let t=this.lookU8();e=this.decodeExtension(t,1)}else if(200===t){let t=this.lookU16();e=this.decodeExtension(t,2)}else if(201===t){let t=this.lookU32();e=this.decodeExtension(t,4)}else throw new o(`Unrecognized type byte: ${v(t)}`);this.complete();let a=this.stack;for(;a.length>0;){let t=a.top();if(t.type===y)if(t.array[t.position]=e,t.position++,t.position===t.size)e=t.array,a.release(t);else continue t;else if(t.type===b){if("__proto__"===e)throw new o("The key __proto__ is not allowed");t.key=this.mapKeyConverter(e),t.type=w;continue t}else if(t.map[t.key]=e,t.readCount++,t.readCount===t.size)e=t.map,a.release(t);else{t.key=null,t.type=b;continue t}}return e}}readHeadByte(){return -1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}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 o(`Unrecognized array type byte: ${v(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new o(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new o(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){let i;if(e>this.maxStrLength)throw new o(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw j;let s=this.pos+t;return i=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?this.keyDecoder.decode(this.bytes,s,e):function(e,t,i){let o;if(!(i>200))return a(e,t,i);return o=e.subarray(t,t+i),r.decode(o)}(this.bytes,s,e),this.pos+=t+e,i}stateIsMapKey(){return this.stack.length>0&&this.stack.top().type===b}decodeBinary(e,t){if(e>this.maxBinLength)throw new o(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw j;let a=this.pos+t,r=this.bytes.subarray(a,a+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new o(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let a=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,a,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(){var e,t;let a=(e=this.view,t=this.pos,0x100000000*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,a}readI64(){let e=n(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}}async function*N(e){let t=e.getReader();try{for(;;){let{done:e,value:a}=await t.read();if(e)return;yield a}}finally{t.releaseLock()}}function A(e){return null!=e[Symbol.asyncIterator]?e:N(e)}async function T(e,t){let a=A(e);return new I(t).decodeAsync(a)}e.s([],2412),e.i(2412),e.s(["DecodeError",0,o,"Decoder",0,I,"EXT_TIMESTAMP",0,-1,"Encoder",0,f,"ExtData",0,i,"ExtensionCodec",0,h,"decode",0,function(e,t){return new I(t).decode(e)},"decodeArrayStream",0,function(e,t){let a=A(e);return new I(t).decodeArrayStream(a)},"decodeAsync",0,T,"decodeMulti",0,function(e,t){return new I(t).decodeMulti(e)},"decodeMultiStream",0,function(e,t){let a=A(e);return new I(t).decodeStream(a)},"decodeTimestampExtension",0,u,"decodeTimestampToTimeSpec",0,p,"encode",0,function(e,t){return new f(t).encodeSharedRef(e)},"encodeDateToTimeSpec",0,d,"encodeTimeSpecToTimestamp",0,l,"encodeTimestampExtension",0,c],921336)},640653,(e,t,a)=>{"use strict";function r(e){return{enumerable:!0,value:e}}function i(e){return{enumerable:!0,writable:!0,value:e}}Object.defineProperty(a,"__esModule",{value:!0});let o={},s=()=>!0,n=()=>({}),l=e=>e,d=(e,t,a,r)=>e.apply(a,r)&&t.apply(a,r),c=(e,t,a,[r,i])=>t.call(a,e.call(a,r,i),i),p=(e,t)=>Object.freeze(Object.create(e,t));function u(e,t,a){return e.reduce((e,t)=>
1function(...r){return a(e,t,this,r)},t)}function m(e){return p(this,{fn:r(e)})}let h={},g=m.bind(h),f={},v=m.bind(f);function y(e,t){return t.filter(t=>e.isPrototypeOf(t))}function b(e,t,...a){let i=u(y(f,a).map(e=>e.fn),s,d),o=u(y(h,a).map(e=>e.fn),l,c);return p(this,{from:r(e),to:r(t),guards:r(i),reducers:r(o)})}let w={},x={},_=b.bind(w),k=b.bind(x,null);function S(e,t,a){return T(t,e,a,this.immediates)||e}function j(e){let t=new Map;for(let a of e)t.has(a.from)||t.set(a.from,[]),t.get(a.from).push(a);return t}let C={enter:l},I={enter(e,t,a){let i=this.fn.call(t,t.context,a);return A.isPrototypeOf(i)?p(N,{machine:r(i),transitions:r(this.transitions)}).enter(e,t,a):(i.then(e=>t.send({type:"done",data:e})).catch(e=>t.send({type:"error",error:e})),e)}},N={enter(e,t,a){if(t.child=R(this.machine,e=>{t.onChange(e),t.child==e&&e.machine.state.value.final&&(delete t.child,t.send({type:"done",data:e.context}))},t.context,a),t.child.machine.state.value.final){let a=t.child.context;return delete t.child,T(t,e,{type:"done",data:a},this.transitions.get("done"))}return e}},A={get state(){return{name:this.current,value:this.states[this.current]}}};function T(e,t,a,i){let{context:s}=e;for(let{to:n,guards:l,reducers:d}of i)if(l(s,a)){e.context=d.call(e,s,a);let i=t.original||t,l=p(i,{current:r(n),original:{value:i}});return o._onEnter&&o._onEnter(t,n,e.context,s,a),l.state.value.enter(l,e,a)}}let E={send(e){this.machine=function(e,t){let a=t.type||t,{machine:r}=e,{value:i,name:s}=r.state;return i.transitions.has(a)?T(e,r,t,i.transitions.get(a))||r:(o._send&&o._send(a,s),r)}(this,e),this.onChange(this)}};function R(e,t,a,o){let s=Object.create(E,{machine:i(e),context:i(e.context(a,o)),onChange:r(t)});return s.send=s.send.bind(s),s.machine=s.machine.state.value.enter(s.machine,s,o),s}a.action=e=>g((t,a)=>!!~e(t,a)&&t),a.createMachine=function(e,t,a=n){return"string"!=typeof e&&(a=t||n,e=Object.keys(t=e)[0]),o._create&&o._create(e,t),p(A,{context:r(a),current:r(e),states:r(t)})},a.d=o,a.guard=v,a.immediate=k,a.interpret=R,a.invoke=function(e,...t){let a=r(j(t));return A.isPrototypeOf(e)?p(N,{machine:r(e),transitions:a}):p(I,{fn:r(e),transitions:a})},a.reduce=g,a.state=function(...e){let t=y(w,e),a=y(x,e),i={final:r(0===e.length),transitions:r(j(t))};return a.length&&(i.immediates=r(a),i.enter=r(S)),p(C,i)},a.transition=_},432570,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.createRealtimeClient=function({config:e}){return{connect(t,a){let c,p,u,{clientOnly:m=(0,d.isReact)()&&!(0,l.isBrowser)(),connectionKey:x=crypto.randomUUID(),maxBuffering:_,path:k,throttleInterval:S=128,encodeMessage:j,decodeMessage:C,tokenProvider:I,tokenExpirationSeconds:N}=a;if(m&&!(0,l.isBrowser)())return b;let A=null!=j?j:e=>e instanceof Uint8Array?e:(0,i.encode)(e),T=null!=C?C:e=>(function(e){return r(this,void 0,void 0,function*(){if("string"==typeof e)return JSON.parse(e);let t=e=>r(this,void 0,void 0,function*(){return e instanceof Uint8Array?e:e instanceof Blob?new Uint8Array((yield e.arrayBuffer())):new Uint8Array(e)});return e instanceof ArrayBuffer||e instanceof Uint8Array||e instanceof Blob?(0,i.decode)((yield t(e))):e})})(e),E=0;v.set(x,{decodeMessage:T,onError:a.onError,onResult:a.onResult});let R=function(e,t,a){if(!f.has(e)){let r=(0,o.interpret)(h,a);f.set(e,{service:r,throttledSend:t>0?(0,d.throttle)(r.send,t,!0):r.send})}return f.get(e)}(x,S,({context:a,machine:r,send:i})=>{var o;let{enqueuedMessage:l,token:m,websocket:h}=a;if(p=l,"active"===r.current&&l&&(null==h?void 0:h.readyState)===WebSocket.OPEN&&i({type:"send",message:l}),"authRequired"===r.current&&void 0===m&&c!==r.current){i({type:"initiateAuth"});let a=++E,r=(0,d.ensureEndpointIdFormat)(t),n=null!=(o=(0,d.resolveEndpointPath)(t,k,"/realtime"))?o:"",l=I?()=>I(`${r}${n}`):()=>(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/model-apis/client#client-side-usage-with-token-provider for more information."),(0,s.getTemporaryAuthToken)(t,e)),c=I?N:s.TOKEN_EXPIRATION_SECONDS,p=void 0!==c?()=>{clearTimeout(u),u=setTimeout(()=>{a===E&&l().then(e=>{a===E&&(queueMicrotask(()=>{i({type:"authenticated",token:e})}),p())}).catch(()=>{a!==E||(u=setTimeout(()=>{p()},Math.round(.05*c*1e3)))})},Math.round(.9*c*1e3))}:y;l().then(e=>{queueMicrotask(()=>{i({type:"authenticated",token:e})}),p()}).catch(e=>{queueMicrotask(()=>{i({type:"unauthorized",error:e})})})}if("connecting"===r.current&&c!==r.current&&void 0!==m){let e=new WebSocket(function(e,{token:t,maxBuffering:a,path:r}){var i;if(void 0!==a&&(a<1||a>60))throw Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let o=new URLSearchParams({fal_jwt_token:t});void 0!==a&&o.set("max_buffering",a.toFixed(0));let s=(0,d.ensureEndpointIdFormat)(e),n=null!=(i=(0,d.resolveEndpointPath)(e,r,"/realtime"))?i:"";return`wss://fal.run/${s}${n}?${o.toString()}`}
1(t,{token:m,maxBuffering:_,path:k}));e.onopen=()=>{var t,a;i({type:"connected",websocket:e});let r=null!=(a=null==(t=R.service.context)?void 0:t.enqueuedMessage)?a:p;r&&(e.send(A(r)),R.service.context=Object.assign(Object.assign({},R.service.context),{enqueuedMessage:void 0}))},e.onclose=e=>{if(e.code!==g){let{onError:t=y}=v.get(x);t(new n.ApiError({message:`Error closing the connection: ${e.reason}`,status:e.code}))}i({type:"connectionClosed",code:e.code})},e.onerror=e=>{let{onError:t=y}=v.get(x);t(new n.ApiError({message:"Unknown error",status:500}))},e.onmessage=e=>{let{decodeMessage:t=T,onResult:a,onError:r=y}=v.get(x);!function({data:e,decodeMessage:t,onResult:a,onError:r,send:i}){Promise.resolve(t?t(e):e).then(e=>{if("error"===e.status&&"Unauthorized"===e.error)return void i({type:"unauthorized",error:Error("Unauthorized")});if("error"!==e.status&&"x-fal-message"!==e.type&&!w(e))return void a(e);if(w(e)){if("TIMEOUT"===e.error)return;r(new n.ApiError({message:`${e.error}: ${e.reason}`,status:400,body:e}));return}}).catch(e=>{var t;r(new n.ApiError({message:null!=(t=null==e?void 0:e.message)?t:"Failed to decode realtime message",status:400}))})}({data:e.data,decodeMessage:t,onResult:a,onError:r,send:i})}}"active"===c&&"active"!==r.current&&(clearTimeout(u),u=void 0),c=r.current});return{send:e=>{R.throttledSend({type:"send",message:A(e)})},close:()=>{R.service.send({type:"close"})}}}}};let i=e.r(921336),o=e.r(640653),s=e.r(417768),n=e.r(462951),l=e.r(291154),d=e.r(13991);function c(e,t){return Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function p(e){return e.websocket&&e.websocket.readyState===WebSocket.OPEN&&e.websocket.close(),Object.assign(Object.assign({},e),{websocket:void 0})}function u(e){return Object.assign(Object.assign({},e),{token:void 0})}function m(e,t){return Object.assign(Object.assign({},e),{token:t.token})}let h=(0,o.createMachine)("idle",{idle:(0,o.state)((0,o.transition)("send","connecting",(0,o.reduce)(c)),(0,o.transition)("close","idle",(0,o.reduce)(p))),connecting:(0,o.state)((0,o.transition)("connecting","connecting"),(0,o.transition)("connected","active",(0,o.reduce)(function(e,t){return Object.assign(Object.assign({},e),{websocket:t.websocket})})),(0,o.transition)("connectionClosed","idle",(0,o.reduce)(p)),(0,o.transition)("send","connecting",(0,o.reduce)(c)),(0,o.transition)("close","idle",(0,o.reduce)(p)),(0,o.immediate)("authRequired",(0,o.guard)(function(e){return void 0===e.token}))),authRequired:(0,o.state)((0,o.transition)("initiateAuth","authInProgress"),(0,o.transition)("send","authRequired",(0,o.reduce)(c)),(0,o.transition)("close","idle",(0,o.reduce)(p))),authInProgress:(0,o.state)((0,o.transition)("authenticated","connecting",(0,o.reduce)(m)),(0,o.transition)("unauthorized","idle",(0,o.reduce)(u),(0,o.reduce)(p)),(0,o.transition)("send","authInProgress",(0,o.reduce)(c)),(0,o.transition)("close","idle",(0,o.reduce)(p))),active:(0,o.state)((0,o.transition)("send","active",(0,o.reduce)(function(e,t){return e.websocket&&e.websocket.readyState===WebSocket.OPEN?(t.message instanceof Uint8Array||"string"==typeof t.message?e.websocket.send(t.message):e.websocket.send((0,i.encode)(t.message)),Object.assign(Object.assign({},e),{enqueuedMessage:void 0})):Object.assign(Object.assign({},e),{enqueuedMessage:t.message})})),(0,o.transition)("authenticated","active",(0,o.reduce)(m)),(0,o.transition)("unauthorized","idle",(0,o.reduce)(u)),(0,o.transition)("connectionClosed","idle",(0,o.reduce)(u),(0,o.reduce)(p)),(0,o.transition)("close","idle",(0,o.reduce)(u),(0,o.reduce)(p)))},()=>({enqueuedMessage:void 0})),g=1e3,f=new Map,v=new Map,y=()=>{},b={send:y,close:y};function w(e){return"x-fal-error"===e.type}},244934,(e,t,a)=>{"use strict";var r=e.e&&e.e.__awaiter||function(e,t,a,r){return new(a||(a=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function n(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(s,n)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(a,"__esModule",{value:!0}),a.createFalClient=function(e={}){let t=(0,i.createConfig)(e),a=(0,c.createStorageClient)({config:t}),u=(0,s.createQueueClient)({config:t,storage:a}),m=(0,p.createStreamingClient)({config:t,storage:a});return{queue:u,realtime:(0,n.createRealtimeClient)({config:t}),storage:a,streaming:m,stream:m.stream,run(e){return r(this,arguments,void 0,function*(e,r={}){let i=r.input?yield a.transformInput(r.input):void 0;return(0,l.dispatchRequest)({method:r.method,targetUrl:(0,l.buildUrl)(e,r),input:i,headers:Object.assign(Object.assign({},(0,c.buildObjectLifecycleHeaders)(r.storageSettings)),(0,o.buildTimeoutHeaders)(r.startTimeout)),config:Object.assign(Object.assign({},t),{responseHandler:d.resultResponseHandler}),options:{signal:r.abortSignal,retry:{maxRetries:3,baseDelay:500,maxDelay:15e3}}})})},subscribe:(e,t)=>
1r(this,void 0,void 0,function*(){let{request_id:a}=yield u.submit(e,t);return t.onEnqueue&&t.onEnqueue(a),yield u.subscribeToStatus(e,Object.assign({requestId:a},t)),u.result(e,{requestId:a})})}};let i=e.r(691874),o=e.r(99186),s=e.r(674161),n=e.r(432570),l=e.r(673450),d=e.r(462951),c=e.r(297714),p=e.r(793996)},856723,(e,t,a)=>{"use strict";function r(e){return e&&e.status&&e.response_url}Object.defineProperty(a,"__esModule",{value:!0}),a.isQueueStatus=r,a.isCompletedQueueStatus=function(e){return r(e)&&"COMPLETED"===e.status}},229874,(e,t,a)=>{"use strict";let r;var i=e.e&&e.e.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var i=Object.getOwnPropertyDescriptor(t,a);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,i)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),o=e.e&&e.e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||i(t,e,a)};Object.defineProperty(a,"__esModule",{value:!0}),a.fal=a.parseEndpointId=a.isRetryableError=a.ValidationError=a.ApiError=a.withProxy=a.withMiddleware=a.createFalClient=void 0;let s=e.r(244934);var n=e.r(244934);Object.defineProperty(a,"createFalClient",{enumerable:!0,get:function(){return n.createFalClient}});var l=e.r(198718);Object.defineProperty(a,"withMiddleware",{enumerable:!0,get:function(){return l.withMiddleware}}),Object.defineProperty(a,"withProxy",{enumerable:!0,get:function(){return l.withProxy}});var d=e.r(462951);Object.defineProperty(a,"ApiError",{enumerable:!0,get:function(){return d.ApiError}}),Object.defineProperty(a,"ValidationError",{enumerable:!0,get:function(){return d.ValidationError}});var c=e.r(327356);Object.defineProperty(a,"isRetryableError",{enumerable:!0,get:function(){return c.isRetryableError}}),o(e.r(856723),a);var p=e.r(13991);Object.defineProperty(a,"parseEndpointId",{enumerable:!0,get:function(){return p.parseEndpointId}}),r=(0,s.createFalClient)(),a.fal={config(e){r=(0,s.createFalClient)(e)},get queue(){return r.queue},get realtime(){return r.realtime},get storage(){return r.storage},get streaming(){return r.streaming},run:(e,t)=>r.run(e,t),subscribe:(e,t)=>r.subscribe(e,t),stream:(e,t)=>r.stream(e,t)}},259873,(e,t,a)=>{"use strict";t.exports=e.r(879)},874213,(e,t,a)=>{"use strict";var r=e.i(917082);if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer="u">typeof ArrayBuffer&&"u">typeof Uint8Array,a.nodebuffer=void 0!==r.Buffer,a.uint8array="u">typeof Uint8Array,"u"<typeof ArrayBuffer)a.blob=!1;else{var i=new ArrayBuffer(0);try{a.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),a.blob=0===o.getBlob("application/zip").size}catch(e){a.blob=!1}}}try{a.nodestream=!!e.r(259873).Readable}catch(e){a.nodestream=!1}},145174,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(874213),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(e){for(var t,a,i,s,n,l,d,c=[],p=0,u=e.length,m=u,h="string"!==r.getTypeOf(e);p<e.length;)m=u-p,h?(t=e[p++],a=p<u?e[p++]:0,i=p<u?e[p++]:0):(t=e.charCodeAt(p++),a=p<u?e.charCodeAt(p++):0,i=p<u?e.charCodeAt(p++):0),s=t>>2,n=(3&t)<<4|a>>4,l=m>1?(15&a)<<2|i>>6:64,d=m>2?63&i:64,c.push(o.charAt(s)+o.charAt(n)+o.charAt(l)+o.charAt(d));return c.join("")},a.decode=function(e){var t,a,r,s,n,l,d,c,p=0,u=0,m="data:";if(e.substr(0,m.length)===m)throw Error("Invalid base64 input, it looks like a data url.");var h=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===o.charAt(64)&&h--,e.charAt(e.length-2)===o.charAt(64)&&h--,h%1!=0)throw Error("Invalid base64 input, bad content length.");for(c=i.uint8array?new Uint8Array(0|h):Array(0|h);p<e.length;)s=o.indexOf(e.charAt(p++)),n=o.indexOf(e.charAt(p++)),l=o.indexOf(e.charAt(p++)),d=o.indexOf(e.charAt(p++)),t=s<<2|n>>4,a=(15&n)<<4|l>>2,r=(3&l)<<6|d,c[u++]=t,64!==l&&(c[u++]=a),64!==d&&(c[u++]=r);return c}},71053,(e,t,a)=>{"use strict";var r=e.i(917082);t.exports={isNode:void 0!==r.Buffer,newBufferFrom:function(e,t){if(r.Buffer.from&&r.Buffer.from!==Uint8Array.from)return r.Buffer.from(e,t);if("number"==typeof e)throw Error('The "data" argument must not be a number');return new r.Buffer(e,t)},allocBuffer:function(e){if(r.Buffer.alloc)return r.Buffer.alloc(e);var t=new r.Buffer(e);return t.fill(0),t},isBuffer:function(e){return r.Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},445369,(e,t,a)=>{"use strict";var r,i,o=e.g.MutationObserver||e.g.WebKitMutationObserver;if(o){var s=0,n=new o(p),l=e.g.document.createTextNode("");n.observe(l,{characterData:!0}
1),r=function(){l.data=s=++s%2}}else if(e.g.setImmediate||void 0===e.g.MessageChannel)r="document"in e.g&&"onreadystatechange"in e.g.document.createElement("script")?function(){var t=e.g.document.createElement("script");t.onreadystatechange=function(){p(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.g.document.documentElement.appendChild(t)}:function(){setTimeout(p,0)};else{var d=new e.g.MessageChannel;d.port1.onmessage=p,r=function(){d.port2.postMessage(0)}}var c=[];function p(){i=!0;for(var e,t,a=c.length;a;){for(t=c,c=[],e=-1;++e<a;)t[e]();a=c.length}i=!1}t.exports=function(e){1!==c.push(e)||i||r()}},471425,(e,t,a)=>{"use strict";var r=e.r(445369);function i(){}var o={},s=["REJECTED"],n=["FULFILLED"],l=["PENDING"];function d(e){if("function"!=typeof e)throw TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&m(this,e)}function c(e,t,a){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof a&&(this.onRejected=a,this.callRejected=this.otherCallRejected)}function p(e,t,a){r(function(){var r;try{r=t(a)}catch(t){return o.reject(e,t)}r===e?o.reject(e,TypeError("Cannot resolve promise with itself")):o.resolve(e,r)})}function u(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var a=!1;function r(t){a||(a=!0,o.reject(e,t))}function i(t){a||(a=!0,o.resolve(e,t))}var s=h(function(){t(i,r)});"error"===s.status&&r(s.value)}function h(e,t){var a={};try{a.value=e(t),a.status="success"}catch(e){a.status="error",a.value=e}return a}t.exports=d,d.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(a){return t.resolve(e()).then(function(){return a})},function(a){return t.resolve(e()).then(function(){throw a})})},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.then=function(e,t){if("function"!=typeof e&&this.state===n||"function"!=typeof t&&this.state===s)return this;var a=new this.constructor(i);return this.state!==l?p(a,this.state===n?e:t,this.outcome):this.queue.push(new c(a,e,t)),a},c.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){p(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){o.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){p(this.promise,this.onRejected,e)},o.resolve=function(e,t){var a=h(u,t);if("error"===a.status)return o.reject(e,a.value);var r=a.value;if(r)m(e,r);else{e.state=n,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var a=-1,r=e.queue.length;++a<r;)e.queue[a].callRejected(t);return e},d.resolve=function(e){return e instanceof this?e:o.resolve(new this(i),e)},d.reject=function(e){var t=new this(i);return o.reject(t,e)},d.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var a=e.length,r=!1;if(!a)return this.resolve([]);for(var s=Array(a),n=0,l=-1,d=new this(i);++l<a;)!function(e,i){t.resolve(e).then(function(e){s[i]=e,++n!==a||r||(r=!0,o.resolve(d,s))},function(e){r||(r=!0,o.reject(d,e))})}(e[l],l);return d},d.race=function(e){var t,a=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var r=e.length,s=!1;if(!r)return this.resolve([]);for(var n=-1,l=new this(i);++n<r;){t=e[n],a.resolve(t).then(function(e){s||(s=!0,o.resolve(l,e))},function(e){s||(s=!0,o.reject(l,e))})}return l}},346939,(e,t,a)=>{"use strict";t.exports={Promise:"u">typeof Promise?Promise:e.r(471425)}},329359,(e,t,a)=>{var r=e.i(923106);"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/setimmediate/"),({189:function(){!function(e,t){"use strict";if(!e.setImmediate){var a,i,o,s,n,l=1,d={},c=!1,p=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"===({}).toString.call(e.process)?n=function(e){r.default.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,a=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=a,t}}()?(a="setImmediate$"+Math.random()+"$",i=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&h(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),n=function(t){e.postMessage(
1a+t,"*")}):e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){h(e.data)},n=function(e){o.port2.postMessage(e)}):p&&"onreadystatechange"in p.createElement("script")?(s=p.documentElement,n=function(e){var t=p.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):n=function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=Function(""+e));for(var t=Array(arguments.length-1),a=0;a<t.length;a++)t[a]=arguments[a+1];var r={callback:e,args:t};return d[l]=r,n(l),l++},u.clearImmediate=m}function m(e){delete d[e]}function h(e){if(c)setTimeout(h,0,e);else{var a=d[e];if(a){c=!0;try{var r=a.callback,i=a.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(t,i)}}finally{m(e),c=!1}}}}}("u"<typeof self?e.g:self)}})[189](),t.exports={}},563194,(e,t,a)=>{"use strict";var r=e.r(874213),i=e.r(145174),o=e.r(71053),s=e.r(346939);function n(e){return e}function l(e,t){for(var a=0;a<e.length;++a)t[a]=255&e.charCodeAt(a);return t}e.r(329359),a.newBlob=function(e,t){a.checkSupport("blob");try{return new Blob([e],{type:t})}catch(a){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(e,t,a){var r=[],i=0,o=e.length;if(o<=a)return String.fromCharCode.apply(null,e);for(;i<o;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+a,o)))):r.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+a,o)))),i+=a;return r.join("")},stringifyByChar:function(e){for(var t="",a=0;a<e.length;a++)t+=String.fromCharCode(e[a]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,r=a.getTypeOf(e),i=!0;if("uint8array"===r?i=d.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=d.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return d.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return d.stringifyByChar(e)}function p(e,t){for(var a=0;a<e.length;a++)t[a]=e[a];return t}a.applyFromCharCode=c;var u={};u.string={string:n,array:function(e){return l(e,Array(e.length))},arraybuffer:function(e){return u.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,o.allocBuffer(e.length))}},u.array={string:c,array:n,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(e)}},u.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return p(new Uint8Array(e),Array(e.byteLength))},arraybuffer:n,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(new Uint8Array(e))}},u.uint8array={string:c,array:function(e){return p(e,Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:n,nodebuffer:function(e){return o.newBufferFrom(e)}},u.nodebuffer={string:c,array:function(e){return p(e,Array(e.length))},arraybuffer:function(e){return u.nodebuffer.uint8array(e).buffer},uint8array:function(e){return p(e,new Uint8Array(e.length))},nodebuffer:n},a.transformTo=function(e,t){return(t||(t=""),e)?(a.checkSupport(e),u[a.getTypeOf(t)][e](t)):t},a.resolve=function(e){for(var t=e.split("/"),a=[],r=0;r<t.length;r++){var i=t[r];"."!==i&&(""!==i||0===r||r===t.length-1)&&(".."===i?a.pop():a.push(i))}return a.join("/")},a.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&o.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(e){if(!r[e.toLowerCase()])throw Error(e+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(e){var t,a,r="";for(a=0;a<(e||"").length;
1a++)r+="\\x"+((t=e.charCodeAt(a))<16?"0":"")+t.toString(16).toUpperCase();return r},a.delay=function(e,t,a){setImmediate(function(){e.apply(a||null,t||[])})},a.inherits=function(e,t){var a=function(){};a.prototype=t.prototype,e.prototype=new a},a.extend=function(){var e,t,a={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===a[t]&&(a[t]=arguments[e][t]);return a},a.prepareContent=function(e,t,o,n,d){return s.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"u">typeof FileReader?new s.Promise(function(t,a){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){a(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var c,p,u=a.getTypeOf(t);return u?("arraybuffer"===u?t=a.transformTo("uint8array",t):"string"===u&&(d?t=i.decode(t):o&&!0!==n&&(c=t,p=null,p=r.uint8array?new Uint8Array(c.length):Array(c.length),t=l(c,p))),t):s.Promise.reject(Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},832704,(e,t,a)=>{"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var a=0;a<this._listeners[e].length;a++)this._listeners[e][a].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},790354,(e,t,a)=>{"use strict";for(var r=e.r(563194),i=e.r(874213),o=e.r(71053),s=e.r(832704),n=Array(256),l=0;l<256;l++)n[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;n[254]=n[254]=1;var d=function(e){var t,a,r,o,s,n=e.length,l=0;for(o=0;o<n;o++)(64512&(a=e.charCodeAt(o)))==55296&&o+1<n&&(64512&(r=e.charCodeAt(o+1)))==56320&&(a=65536+(a-55296<<10)+(r-56320),o++),l+=a<128?1:a<2048?2:a<65536?3:4;for(s=0,t=i.uint8array?new Uint8Array(l):Array(l),o=0;s<l;o++)(64512&(a=e.charCodeAt(o)))==55296&&o+1<n&&(64512&(r=e.charCodeAt(o+1)))==56320&&(a=65536+(a-55296<<10)+(r-56320),o++),a<128?t[s++]=a:(a<2048?t[s++]=192|a>>>6:(a<65536?t[s++]=224|a>>>12:(t[s++]=240|a>>>18,t[s++]=128|a>>>12&63),t[s++]=128|a>>>6&63),t[s++]=128|63&a);return t},c=function(e,t){var a;for((t=t||e.length)>e.length&&(t=e.length),a=t-1;a>=0&&(192&e[a])==128;)a--;return a<0||0===a?t:a+n[e[a]]>t?a:t},p=function(e){var t,a,i,o,s=e.length,l=Array(2*s);for(a=0,t=0;t<s;){if((i=e[t++])<128){l[a++]=i;continue}if((o=n[i])>4){l[a++]=65533,t+=o-1;continue}for(i&=2===o?31:3===o?15:7;o>1&&t<s;)i=i<<6|63&e[t++],o--;
1if(o>1){l[a++]=65533;continue}i<65536?l[a++]=i:(i-=65536,l[a++]=55296|i>>10&1023,l[a++]=56320|1023&i)}return l.length!==a&&(l.subarray?l=l.subarray(0,a):l.length=a),r.applyFromCharCode(l)};function u(){s.call(this,"utf-8 decode"),this.leftOver=null}function m(){s.call(this,"utf-8 encode")}a.utf8encode=function(e){return i.nodebuffer?o.newBufferFrom(e,"utf-8"):d(e)},a.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):p(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(u,s),u.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=c(t),n=t;s!==t.length&&(i.uint8array?(n=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(n=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:a.utf8decode(n),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=u,r.inherits(m,s),m.prototype.processChunk=function(e){this.push({data:a.utf8encode(e.data),meta:e.meta})},a.Utf8EncodeWorker=m},709192,(e,t,a)=>{"use strict";var r=e.r(832704),i=e.r(563194);function o(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,r),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},383450,(e,t,a)=>{"use strict";var r=e.r(259873).Readable;function i(e,t,a){r.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),a&&a(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e.r(563194).inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},977405,(e,t,a)=>{"use strict";var r=e.i(917082),i=e.r(563194),o=e.r(709192),s=e.r(832704),n=e.r(145174),l=e.r(874213),d=e.r(346939),c=null;if(l.nodestream)try{c=e.r(383450)}catch(e){}function p(e,t,a){var r=t;switch(t){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=t,this._mimeType=a,i.checkSupport(r),this._worker=e.pipe(new o(r)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}p.prototype={accumulate:function(e){var t;return t=this,new d.Promise(function(a,o){var s=[],l=t._internalType,d=t._outputType,c=t._mimeType;t.on("data",function(t,a){s.push(t),e&&e(a)}).on("error",function(e){s=[],o(e)}).on("end",function(){try{var e=function(e,t,a){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),a);case"base64":return n.encode(t);default:return i.transformTo(e,t)}}(d,function(e,t){var a,i=0,o=null,s=0;for(a=0;a<t.length;a++)s+=t[a].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(a=0,o=new Uint8Array(s);a<t.length;a++)o.set(t[a],i),i+=t[a].length;return o;case"nodebuffer":return r.Buffer.concat(t);default:throw Error("concat : unsupported type '"+e+"'")}}(l,s),c);a(e)}catch(e){o(e)}s=[]}).resume()})},on:function(e,t){var a=this;return"data"===e?this._worker.on(e,function(e){t.call(a,e.data,e.meta)}):this._worker.on(e,function(){i.delay(t,arguments,a)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=p},424328,(e,t,a)=>{"use strict";a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},838965,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(832704);function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.c
1all(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},265915,(e,t,a)=>{"use strict";var r=e.r(563194),i=function(){for(var e,t=[],a=0;a<256;a++){e=a;for(var r=0;r<8;r++)e=1&e?0xedb88320^e>>>1:e>>>1;t[a]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,a){var r=0+a;e^=-1;for(var o=0;o<r;o++)e=e>>>8^i[(e^t[o])&255];return -1^e}(0|t,e,e.length):function(e,t,a){var r=0+a;e^=-1;for(var o=0;o<r;o++)e=e>>>8^i[(e^t.charCodeAt(o))&255];return -1^e}(0|t,e,e.length):0}},609672,(e,t,a)=>{"use strict";var r=e.r(832704),i=e.r(265915);function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e.r(563194).inherits(o,r),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},574653,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(832704);function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}
1r.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},659902,(e,t,a)=>{"use strict";var r=e.r(346939),i=e.r(838965),o=e.r(609672),s=e.r(574653);function n(e,t,a,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=a,this.compression=r,this.compressedContent=i}n.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},n.createWorkerFrom=function(e,t,a){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(a)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=n},91010,(e,t,a)=>{"use strict";var r=e.r(977405),i=e.r(838965),o=e.r(790354),s=e.r(659902),n=e.r(832704),l=function(e,t,a){this.name=e,this.dir=a.dir,this.date=a.date,this.comment=a.comment,this.unixPermissions=a.unixPermissions,this.dosPermissions=a.dosPermissions,this._data=t,this._dataBinary=a.binary,this.options={compression:a.compression,compressionOptions:a.compressionOptions}};l.prototype={internalStream:function(e){var t=null,a="string";try{if(!e)throw Error("No output type specified.");a=e.toLowerCase();var i="string"===a||"text"===a;("binarystring"===a||"text"===a)&&(a="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new n("error")).error(e)}return new r(t,a,"")},async:function(e,t){return this.internalStream(e).accumulate(t)}
1,nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var a=this._decompressWorker();return this._dataBinary||(a=a.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(a,e,t)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof n?this._data:new i(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<d.length;p++)l.prototype[d[p]]=c;t.exports=l},92775,(e,t,a)=>{"use strict";var r="u">typeof Uint8Array&&"u">typeof Uint16Array&&"u">typeof Int32Array;a.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var a=t.shift();if(a){if("object"!=typeof a)throw TypeError(a+"must be non-object");for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}}return e},a.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,a,r,i){if(t.subarray&&e.subarray)return void e.set(t.subarray(a,a+r),i);for(var o=0;o<r;o++)e[i+o]=t[a+o]},flattenChunks:function(e){var t,a,r,i,o,s;for(t=0,r=0,a=e.length;t<a;t++)r+=e[t].length;for(t=0,s=new Uint8Array(r),i=0,a=e.length;t<a;t++)o=e[t],s.set(o,i),i+=o.length;return s}},o={arraySet:function(e,t,a,r,i){for(var o=0;o<r;o++)e[i+o]=t[a+o]},flattenChunks:function(e){return[].concat.apply([],e)}};a.setTyped=function(e){e?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,i)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,o))},a.setTyped(r)},852125,(e,t,a)=>{"use strict";var r,i,o,s=e.r(92775);function n(e){for(var t=e.length;--t>=0;)e[t]=0}var l=573,d=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],m=Array(576);n(m);var h=Array(60);n(h);var g=Array(512);n(g);var f=Array(256);n(f);var v=Array(29);n(v);var y=Array(30);function b(e,t,a,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=a,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function w(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function x(e){return e<256?g[e]:g[256+(e>>>7)]}function _(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,a){e.bi_valid>16-a?(e.bi_buf|=t<<e.bi_valid&65535,_(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=a-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=a)}function S(e,t,a){k(e,a[2*t],a[2*t+1])}function j(e,t){var a=0;do a|=1&e,e>>>=1,a<<=1;while(--t>0)return a>>>1}function C(e,t,a){var r,i,o=Array(16),s=0;for(r=1;r<=15;r++)o[r]=s=s+a[r-1]<<1;for(i=0;i<=t;i++){var n=e[2*i+1];0!==n&&(e[2*i]=j(o[n]++,n))}}function I(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function N(e){e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function A(e,t,a,r){var i=2*t,o=2*a;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[a]}function T(e,t,a){for(var r=e.heap[a],i=a<<1;i<=e.heap_len&&(i<e.heap_len&&A(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!A(t,r,e.heap[i],e.depth));)e.heap[a]=e.heap[i],a=i,i<<=1;e.heap[a]=r}function E(e,t,a){var r,i,o,s,n=0;if(0!==e.last_lit)do r=e.pending_buf[e.d_buf+2*n]<<8|e.pending_buf[e.d_buf+2*n+1],i=e.pending_buf[e.l_buf+n],n++,0===r?S(e,i,t):(S(e,(o=f[i])+256+1,t),0!==(s=d[o])&&k(e,i-=v[o],s),S(e,o=x(--r),a),0!==(s=c[o])&&k(e,r-=y[o],s));while(n<e.last_lit)S(e,256,t)}function R(e,t){var a,r,i,o=t.dyn_tree,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,d=t.stat_desc.elems,c=-1;for(a=0,e.heap_len=0,e.heap_max=l;a<d;a++)0!==o[2*a]?(e.heap[++e.heap_len]=c=a,e.depth[a]=0):o[2*a+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,n&&(e.static_len-=s[2*i+1]);for(t.max_code=c,a=e.heap_len>>1;a>=1;a--)T(e,o,a);i=d;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],T(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=r,o[2*i]=o[2*a]+o[2*r],e.depth[i]=(e.depth[a]>=e.depth[r]?e.depth[a]:e.depth[r])+1,o[2*a+1]=o[2*r+1]=i,e.heap[1]=i++,T(e,o,1);while(e.heap_len>=2)e.heap[--e.heap_max]=e.heap[1],function(e,t){var a,r,i,o,s,n,d=t.dyn_tree,c=t.max_code,p=t.stat_desc.static_tree,u=t.
1stat_desc.has_stree,m=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,f=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(d[2*e.heap[e.heap_max]+1]=0,a=e.heap_max+1;a<l;a++)(o=d[2*d[2*(r=e.heap[a])+1]+1]+1)>g&&(o=g,f++),d[2*r+1]=o,!(r>c)&&(e.bl_count[o]++,s=0,r>=h&&(s=m[r-h]),n=d[2*r],e.opt_len+=n*(o+s),u&&(e.static_len+=n*(p[2*r+1]+s)));if(0!==f){do{for(o=g-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[g]--,f-=2}while(f>0)for(o=g;0!==o;o--)for(r=e.bl_count[o];0!==r;)!((i=e.heap[--a])>c)&&(d[2*i+1]!==o&&(e.opt_len+=(o-d[2*i+1])*d[2*i],d[2*i+1]=o),r--)}}(e,t),C(o,c,e.bl_count)}function U(e,t,a){var r,i,o=-1,s=t[1],n=0,l=7,d=4;for(0===s&&(l=138,d=3),t[(a+1)*2+1]=65535,r=0;r<=a;r++)i=s,s=t[(r+1)*2+1],++n<l&&i===s||(n<d?e.bl_tree[2*i]+=n:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):n<=10?e.bl_tree[34]++:e.bl_tree[36]++,n=0,o=i,0===s?(l=138,d=3):i===s?(l=6,d=3):(l=7,d=4))}function P(e,t,a){var r,i,o=-1,s=t[1],n=0,l=7,d=4;for(0===s&&(l=138,d=3),r=0;r<=a;r++)if(i=s,s=t[(r+1)*2+1],!(++n<l)||i!==s){if(n<d)do S(e,i,e.bl_tree);while(0!=--n)else 0!==i?(i!==o&&(S(e,i,e.bl_tree),n--),S(e,16,e.bl_tree),k(e,n-3,2)):n<=10?(S(e,17,e.bl_tree),k(e,n-3,3)):(S(e,18,e.bl_tree),k(e,n-11,7));n=0,o=i,0===s?(l=138,d=3):i===s?(l=6,d=3):(l=7,d=4)}}n(y);var D=!1;function z(e,t,a,r){k(e,0+ +!!r,3),N(e),_(e,a),_(e,~a),s.arraySet(e.pending_buf,e.window,t,a,e.pending),e.pending+=a}a._tr_init=function(e){D||(!function(){var e,t,a,s,n,l=Array(16);for(s=0,a=0;s<28;s++)for(e=0,v[s]=a;e<1<<d[s];e++)f[a++]=s;for(f[a-1]=s,n=0,s=0;s<16;s++)for(e=0,y[s]=n;e<1<<c[s];e++)g[n++]=s;for(n>>=7;s<30;s++)for(e=0,y[s]=n<<7;e<1<<c[s]-7;e++)g[256+n++]=s;for(t=0;t<=15;t++)l[t]=0;for(e=0;e<=143;)m[2*e+1]=8,e++,l[8]++;for(;e<=255;)m[2*e+1]=9,e++,l[9]++;for(;e<=279;)m[2*e+1]=7,e++,l[7]++;for(;e<=287;)m[2*e+1]=8,e++,l[8]++;for(C(m,287,l),e=0;e<30;e++)h[2*e+1]=5,h[2*e]=j(e,5);r=new b(m,d,257,286,15),i=new b(h,c,0,30,15),o=new b([],p,0,19,7)}(),D=!0),e.l_desc=new w(e.dyn_ltree,r),e.d_desc=new w(e.dyn_dtree,i),e.bl_desc=new w(e.bl_tree,o),e.bi_buf=0,e.bi_valid=0,I(e)},a._tr_stored_block=z,a._tr_flush_block=function(e,t,a,r){var i,o,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,a=0xf3ffc07f;for(t=0;t<=31;t++,a>>>=1)if(1&a&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),R(e,e.l_desc),R(e,e.d_desc),s=function(e){var t;for(U(e,e.dyn_ltree,e.l_desc.max_code),U(e,e.dyn_dtree,e.d_desc.max_code),R(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=a+5,a+4<=i&&-1!==t?z(e,t,a,r):4===e.strategy||o===i?(k(e,2+ +!!r,3),E(e,m,h)):(k(e,4+ +!!r,3),function(e,t,a,r){var i;for(k(e,t-257,5),k(e,a-1,5),k(e,r-4,4),i=0;i<r;i++)k(e,e.bl_tree[2*u[i]+1],3);P(e,e.dyn_ltree,t-1),P(e,e.dyn_dtree,a-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),E(e,e.dyn_ltree,e.dyn_dtree)),I(e),r&&N(e)},a._tr_tally=function(e,t,a){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&a,e.last_lit++,0===t?e.dyn_ltree[2*a]++:(e.matches++,t--,e.dyn_ltree[(f[a]+256+1)*2]++,e.dyn_dtree[2*x(t)]++),e.last_lit===e.lit_bufsize-1},a._tr_align=function(e){k(e,2,3),S(e,256,m),16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},837203,(e,t,a)=>{"use strict";t.exports=function(e,t,a,r){for(var i=65535&e,o=e>>>16&65535,s=0;0!==a;){s=a>2e3?2e3:a,a-=s;do o=o+(i=i+t[r++]|0)|0;while(--s)i%=65521,o%=65521}return i|o<<16}},812770,(e,t,a)=>{"use strict";var r=function(){for(var e,t=[],a=0;a<256;a++){e=a;for(var r=0;r<8;r++)e=1&e?0xedb88320^e>>>1:e>>>1;t[a]=e}return t}();t.exports=function(e,t,a,i){var o=i+a;e^=-1;for(var s=i;s<o;s++)e=e>>>8^r[(e^t[s])&255];return -1^e}},91360,(e,t,a)=>{"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},339160,(e,t,a)=>{"use strict";var r,i=e.r(92775),o=e.r(852125),s=e.r(837203),n=e.r(812770),l=e.r(91360),d=573;function c(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-9*(e>4)}function u(e){for(var t=e.length;--t>=0;)e[t]=0}function m(e){var t=e.state,a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(i.arraySet(e.output,t.pending_buf,t.pending_out,a,e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pen
1ding_out=0))}function h(e,t){o._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,m(e.strm)}function g(e,t){e.pending_buf[e.pending++]=t}function f(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function v(e,t){var a,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,n=e.nice_match,l=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,d=e.window,c=e.w_mask,p=e.prev,u=e.strstart+258,m=d[o+s-1],h=d[o+s];e.prev_length>=e.good_match&&(i>>=2),n>e.lookahead&&(n=e.lookahead);do{if(d[(a=t)+s]!==h||d[a+s-1]!==m||d[a]!==d[o]||d[++a]!==d[o+1])continue;o+=2,a++;do;while(d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&o<u)if(r=258-(u-o),o=u-258,r>s){if(e.match_start=t,s=r,r>=n)break;m=d[o+s-1],h=d[o+s]}}while((t=p[t&c])>l&&0!=--i)return s<=e.lookahead?s:e.lookahead}function y(e){var t,a,r,o,l,d=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-262)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=a=e.hash_size;do r=e.head[--t],e.head[t]=r>=d?r-d:0;while(--a)t=a=d;do r=e.prev[--t],e.prev[t]=r>=d?r-d:0;while(--a)o+=d}if(0===e.strm.avail_in)break;if(a=function(e,t,a,r){var o=e.avail_in;return(o>r&&(o=r),0===o)?0:(e.avail_in-=o,i.arraySet(t,e.input,e.next_in,o,a),1===e.state.wrap?e.adler=s(e.adler,t,o,a):2===e.state.wrap&&(e.adler=n(e.adler,t,o,a)),e.next_in+=o,e.total_in+=o,o)}(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=a,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function b(e,t){for(var a,r;;){if(e.lookahead<262){if(y(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-262&&(e.match_length=v(e,a)),e.match_length>=3)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!=--e.match_length)e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(h(e,!1),0===e.strm.avail_out))return 1}return(e.insert=e.strstart<2?e.strstart:2,4===t)?(h(e,!0),0===e.strm.avail_out)?3:4:e.last_lit&&(h(e,!1),0===e.strm.avail_out)?1:2}function w(e,t){for(var a,r,i;;){if(e.lookahead<262){if(y(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-262&&(e.match_length=v(e,a),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!=--e.prev_length)if(e.match_available=0,e.match_length=2,e.strstart++,r&&(h(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=o._tr_tally(e,0,e.window[e.strstart-1]))&&h(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}
1return(e.match_available&&(r=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t)?(h(e,!0),0===e.strm.avail_out)?3:4:e.last_lit&&(h(e,!1),0===e.strm.avail_out)?1:2}function x(e,t,a,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=r,this.func=i}function _(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*d),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),u(this.dyn_ltree),u(this.dyn_dtree),u(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),u(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),u(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=+(2!==t.wrap),t.last_flush=0,o._tr_init(t),0):c(e,-2)}function S(e){var t,a=k(e);return 0===a&&((t=e.state).window_size=2*t.w_size,u(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),a}function j(e,t,a,r,o,s){if(!e)return -2;var n=1;if(-1===t&&(t=6),r<0?(n=0,r=-r):r>15&&(n=2,r-=16),o<1||o>9||8!==a||r<8||r>15||t<0||t>9||s<0||s>4)return c(e,-2);8===r&&(r=9);var l=new _;return e.state=l,l.strm=e,l.wrap=n,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new i.Buf8(2*l.w_size),l.head=new i.Buf16(l.hash_size),l.prev=new i.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new i.Buf8(l.pending_buf_size),l.d_buf=+l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=s,l.method=a,S(e)}r=[new x(0,0,0,0,function(e,t){var a=65535;for(65535>e.pending_buf_size-5&&(a=e.pending_buf_size-5);;){if(e.lookahead<=1){if(y(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+a;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,h(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-262&&(h(e,!1),0===e.strm.avail_out))return 1}return(e.insert=0,4===t)?(h(e,!0),0===e.strm.avail_out)?3:4:(e.strstart>e.block_start&&(h(e,!1),e.strm.avail_out),1)}),new x(4,4,8,4,b),new x(4,5,16,8,b),new x(4,6,32,32,b),new x(4,4,16,16,w),new x(8,16,32,32,w),new x(8,16,128,128,w),new x(8,32,128,256,w),new x(32,128,258,1024,w),new x(32,258,258,4096,w)],a.deflateInit=function(e,t){return j(e,t,8,15,8,0)},a.deflateInit2=j,a.deflateReset=S,a.deflateResetKeep=k,a.deflateSetHeader=function(e,t){return e&&e.state&&2===e.state.wrap?(e.state.gzhead=t,0):-2},a.deflate=function(e,t){if(!e||!e.state||t>5||t<0)return e?c(e,-2):-2;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return c(e,0===e.avail_out?-5:-2);if(i.strm=e,a=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,g(i,31),g(i,139),g(i,8),i.gzhead?(g(i,+!!i.gzhead.text+2*!!i.gzhead.hcrc+4*!!i.gzhead.extra+8*!!i.gzhead.name+16*!!i.gzhead.comment),g(i,255&i.gzhead.time),g(i,i.gzhead.time>>8&255),g(i,i.gzhead.time>>16&255),g(i,i.gzhead.time>>24&255),g(i,9===i.level?2:4*(i.strategy>=2||i.level<2)),g(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(g(i,255&i.gzhead.extra.length),g(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=n(e.adler,i.pending_buf,i.pending,0)),i.gz
1index=0,i.status=69):(g(i,0),g(i,0),g(i,0),g(i,0),g(i,0),g(i,9===i.level?2:4*(i.strategy>=2||i.level<2)),g(i,3),i.status=113);else{var a,i,s,l,d=8+(i.w_bits-8<<4)<<8;d|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(d|=32),d+=31-d%31,i.status=113,f(i,d),0!==i.strstart&&(f(i,e.adler>>>16),f(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending!==i.pending_buf_size));)g(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,g(i,l)}while(0!==l)i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,g(i,l)}while(0!==l)i.gzhead.hcrc&&i.pending>s&&(e.adler=n(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&m(e),i.pending+2<=i.pending_buf_size&&(g(i,255&e.adler),g(i,e.adler>>8&255),e.adler=0,i.status=113)):i.status=113),0!==i.pending){if(m(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(a)&&4!==t)return c(e,-5);if(666===i.status&&0!==e.avail_in)return c(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var v=2===i.strategy?function(e,t){for(var a;;){if(0===e.lookahead&&(y(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,a=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(h(e,!1),0===e.strm.avail_out))return 1}return(e.insert=0,4===t)?(h(e,!0),0===e.strm.avail_out)?3:4:e.last_lit&&(h(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var a,r,i,s,n=e.window;;){if(e.lookahead<=258){if(y(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=n[i=e.strstart-1])===n[++i]&&r===n[++i]&&r===n[++i]){s=e.strstart+258;do;while(r===n[++i]&&r===n[++i]&&r===n[++i]&&r===n[++i]&&r===n[++i]&&r===n[++i]&&r===n[++i]&&r===n[++i]&&i<s)e.match_length=258-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(a=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(h(e,!1),0===e.strm.avail_out))return 1}return(e.insert=0,4===t)?(h(e,!0),0===e.strm.avail_out)?3:4:e.last_lit&&(h(e,!1),0===e.strm.avail_out)?1:2}(i,t):r[i.level].func(i,t);if((3===v||4===v)&&(i.status=666),1===v||3===v)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===v&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(u(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),m(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(g(i,255&e.adler),g(i,e.adler>>8&255),g(i,e.adler>>16&255),g(i,e.adler>>24&255),g(i,255&e.total_in),g(i,e.total_in>>8&255),g(i,e.total_in>>16&255),g(i,e.total_in>>24&255)):(f(i,e.adler>>>16),f(i,65535&e.adler)),m(e),i.wrap>0&&(i.wrap=-i.wrap),+(0===i.pending))},a.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?c(e,-2):(e.state=null,113===t?c(e,-3):0):-2},a.deflateSetDictionary=function(e,t){var a,r,o,n,l,d,c,p,m=t.length;if(!e||!e.state||2===(n=(a=e.state).wrap)||1===n&&42!==a.status||a.lookahead)return -2;for(1===n&&(e.adler=s(e.adler,t,m,0)),a.wrap=0,m>=a.w_size&&(0===n&&(u(a.head),a.strstart=0,a.block_start=0,a.insert=0),p=new i.Buf8(a.w_size),i.arraySet(p,t,m-a.w_size,a.w_size,0),t=p,m=a.w_size),l=e.avail_in,d=e.next_in,
1c=e.input,e.avail_in=m,e.next_in=0,e.input=t,y(a);a.lookahead>=3;){r=a.strstart,o=a.lookahead-2;do a.ins_h=(a.ins_h<<a.hash_shift^a.window[r+3-1])&a.hash_mask,a.prev[r&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=r,r++;while(--o)a.strstart=r,a.lookahead=2,y(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=2,a.match_available=0,e.next_in=d,e.input=c,e.avail_in=l,a.wrap=n,0},a.deflateInfo="pako deflate (from Nodeca project)"},577627,(e,t,a)=>{"use strict";var r=e.r(92775),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new r.Buf8(256),n=0;n<256;n++)s[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var a="",s=0;s<t;s++)a+=String.fromCharCode(e[s]);return a}s[254]=s[254]=1,a.string2buf=function(e){var t,a,i,o,s,n=e.length,l=0;for(o=0;o<n;o++)(64512&(a=e.charCodeAt(o)))==55296&&o+1<n&&(64512&(i=e.charCodeAt(o+1)))==56320&&(a=65536+(a-55296<<10)+(i-56320),o++),l+=a<128?1:a<2048?2:a<65536?3:4;for(s=0,t=new r.Buf8(l),o=0;s<l;o++)(64512&(a=e.charCodeAt(o)))==55296&&o+1<n&&(64512&(i=e.charCodeAt(o+1)))==56320&&(a=65536+(a-55296<<10)+(i-56320),o++),a<128?t[s++]=a:(a<2048?t[s++]=192|a>>>6:(a<65536?t[s++]=224|a>>>12:(t[s++]=240|a>>>18,t[s++]=128|a>>>12&63),t[s++]=128|a>>>6&63),t[s++]=128|63&a);return t},a.buf2binstring=function(e){return l(e,e.length)},a.binstring2buf=function(e){for(var t=new r.Buf8(e.length),a=0,i=t.length;a<i;a++)t[a]=e.charCodeAt(a);return t},a.buf2string=function(e,t){var a,r,i,o,n=t||e.length,d=Array(2*n);for(r=0,a=0;a<n;){if((i=e[a++])<128){d[r++]=i;continue}if((o=s[i])>4){d[r++]=65533,a+=o-1;continue}for(i&=2===o?31:3===o?15:7;o>1&&a<n;)i=i<<6|63&e[a++],o--;if(o>1){d[r++]=65533;continue}i<65536?d[r++]=i:(i-=65536,d[r++]=55296|i>>10&1023,d[r++]=56320|1023&i)}return l(d,r)},a.utf8border=function(e,t){var a;for((t=t||e.length)>e.length&&(t=e.length),a=t-1;a>=0&&(192&e[a])==128;)a--;return a<0||0===a?t:a+s[e[a]]>t?a:t}},976929,(e,t,a)=>{"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},85381,(e,t,a)=>{"use strict";var r=e.r(339160),i=e.r(92775),o=e.r(577627),s=e.r(91360),n=e.r(976929),l=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t,a=this.options;a.raw&&a.windowBits>0?a.windowBits=-a.windowBits:a.gzip&&a.windowBits>0&&a.windowBits<16&&(a.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var c=r.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(0!==c)throw Error(s[c]);if(a.header&&r.deflateSetHeader(this.strm,a.header),a.dictionary){if(t="string"==typeof a.dictionary?o.string2buf(a.dictionary):"[object ArrayBuffer]"===l.call(a.dictionary)?new Uint8Array(a.dictionary):a.dictionary,0!==(c=r.deflateSetDictionary(this.strm,t)))throw Error(s[c]);this._dict_set=!0}}function c(e,t){var a=new d(t);if(a.push(e,!0),a.err)throw a.msg||s[a.err];return a.result}d.prototype.push=function(e,t){var a,s,n=this.strm,d=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:4*(!0===t),"string"==typeof e?n.input=o.string2buf(e):"[object ArrayBuffer]"===l.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new i.Buf8(d),n.next_out=0,n.avail_out=d),1!==(a=r.deflate(n,s))&&0!==a)return this.onEnd(a),this.ended=!0,!1;(0===n.avail_out||0===n.avail_in&&(4===s||2===s))&&("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(n.output,n.next_out))):this.onData(i.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==a)return 4===s?(a=r.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,0===a):(2===s&&(this.onEnd(0),n.avail_out=0),!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},a.Deflate=d,a.deflate=c,a.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},a.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},68322,(e,t,a)=>{"use strict";
1t.exports=function(e,t){var a,r,i,o,s,n,l,d,c,p,u,m,h,g,f,v,y,b,w,x,_,k,S,j,C;a=e.state,r=e.next_in,j=e.input,i=r+(e.avail_in-5),o=e.next_out,C=e.output,s=o-(t-e.avail_out),n=o+(e.avail_out-257),l=a.dmax,d=a.wsize,c=a.whave,p=a.wnext,u=a.window,m=a.hold,h=a.bits,g=a.lencode,f=a.distcode,v=(1<<a.lenbits)-1,y=(1<<a.distbits)-1;a:do for(h<15&&(m+=j[r++]<<h,h+=8,m+=j[r++]<<h,h+=8),b=g[m&v];;){if(m>>>=w=b>>>24,h-=w,0==(w=b>>>16&255))C[o++]=65535&b;else if(16&w)for(x=65535&b,(w&=15)&&(h<w&&(m+=j[r++]<<h,h+=8),x+=m&(1<<w)-1,m>>>=w,h-=w),h<15&&(m+=j[r++]<<h,h+=8,m+=j[r++]<<h,h+=8),b=f[m&y];;){if(m>>>=w=b>>>24,h-=w,16&(w=b>>>16&255)){if(_=65535&b,h<(w&=15)&&(m+=j[r++]<<h,(h+=8)<w&&(m+=j[r++]<<h,h+=8)),(_+=m&(1<<w)-1)>l){e.msg="invalid distance too far back",a.mode=30;break a}if(m>>>=w,h-=w,_>(w=o-s)){if((w=_-w)>c&&a.sane){e.msg="invalid distance too far back",a.mode=30;break a}if(k=0,S=u,0===p){if(k+=d-w,w<x){x-=w;do C[o++]=u[k++];while(--w)k=o-_,S=C}}else if(p<w){if(k+=d+p-w,(w-=p)<x){x-=w;do C[o++]=u[k++];while(--w)if(k=0,p<x){x-=w=p;do C[o++]=u[k++];while(--w)k=o-_,S=C}}}else if(k+=p-w,w<x){x-=w;do C[o++]=u[k++];while(--w)k=o-_,S=C}for(;x>2;)C[o++]=S[k++],C[o++]=S[k++],C[o++]=S[k++],x-=3;x&&(C[o++]=S[k++],x>1&&(C[o++]=S[k++]))}else{k=o-_;do C[o++]=C[k++],C[o++]=C[k++],C[o++]=C[k++],x-=3;while(x>2)x&&(C[o++]=C[k++],x>1&&(C[o++]=C[k++]))}}else if((64&w)==0){b=f[(65535&b)+(m&(1<<w)-1)];continue}else{e.msg="invalid distance code",a.mode=30;break a}break}else if((64&w)==0){b=g[(65535&b)+(m&(1<<w)-1)];continue}else if(32&w){a.mode=12;break a}else{e.msg="invalid literal/length code",a.mode=30;break a}break}while(r<i&&o<n)r-=x=h>>3,h-=x<<3,m&=(1<<h)-1,e.next_in=r,e.next_out=o,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=o<n?257+(n-o):257-(o-n),a.hold=m,a.bits=h}},979013,(e,t,a)=>{"use strict";var r=e.r(92775),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,a,l,d,c,p,u){var m,h,g,f,v,y,b,w,x,_=u.bits,k=0,S=0,j=0,C=0,I=0,N=0,A=0,T=0,E=0,R=0,U=null,P=0,D=new r.Buf16(16),z=new r.Buf16(16),F=null,M=0;for(k=0;k<=15;k++)D[k]=0;for(S=0;S<l;S++)D[t[a+S]]++;for(C=15,I=_;C>=1&&0===D[C];C--);if(I>C&&(I=C),0===C)return d[c++]=0x1400000,d[c++]=0x1400000,u.bits=1,0;for(j=1;j<C&&0===D[j];j++);for(I<j&&(I=j),T=1,k=1;k<=15;k++)if(T<<=1,(T-=D[k])<0)return -1;if(T>0&&(0===e||1!==C))return -1;for(k=1,z[1]=0;k<15;k++)z[k+1]=z[k]+D[k];for(S=0;S<l;S++)0!==t[a+S]&&(p[z[t[a+S]]++]=S);if(0===e?(U=F=p,y=19):1===e?(U=i,P-=257,F=o,M-=257,y=256):(U=s,F=n,y=-1),R=0,S=0,k=j,v=c,N=I,A=0,g=-1,f=(E=1<<I)-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){b=k-A,p[S]<y?(w=0,x=p[S]):p[S]>y?(w=F[M+p[S]],x=U[P+p[S]]):(w=96,x=0),m=1<<k-A,j=h=1<<N;do d[v+(R>>A)+(h-=m)]=b<<24|w<<16|x;while(0!==h)for(m=1<<k-1;R&m;)m>>=1;if(0!==m?(R&=m-1,R+=m):R=0,S++,0==--D[k]){if(k===C)break;k=t[a+p[S]]}if(k>I&&(R&f)!==g){for(0===A&&(A=I),v+=j,T=1<<(N=k-A);N+A<C&&!((T-=D[N+A])<=0);)N++,T<<=1;if(E+=1<<N,1===e&&E>852||2===e&&E>592)return 1;d[g=R&f]=I<<24|N<<16|v-c}}return 0!==R&&(d[v+R]=k-A<<24|4194304),u.bits=I,0}},210929,(e,t,a)=>{"use strict";var r,i,o=e.r(92775),s=e.r(837203),n=e.r(812770),l=e.r(68322),d=e.r(979013);function c(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new o.Buf32(852),t.distcode=t.distdyn=new o.Buf32(592),t.sane=1,t.back=-1,0):-2}function m(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):-2}function h(e,t){var a,r;return e&&e.state?(r=e.state,t<0?(a=0,t=-t):(a=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=a,r.wbits=t,m(e)):-2}function g(e,t){var a,r;return e?(e.state=r=new p,r.window=null,0!==(a=h(e,t))&&(e.state=null),a):-2}var f=!0;function v(e,t,a,r){var i,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new o.Buf8(s.wsize)),r>=s.wsize?(o.arraySet(s.window,t,a-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((i=s.wsize-s.wnext)>r&&(i=r),o.arraySet(s.window,t,a-r,i,s.wnext),(r-=i)?(o.arraySet(s.window,t,a-r,r,0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}a.inflateReset=m,a.inflateReset2=h,a.inflateResetKeep=u,a.inflateInit=function(e){return g(e,15)},a.inflateInit2=g,a.inflate=function(e,t){var a,p,u,m,h,g,y,b,w,x,_,k,S,j,C,I,N,A,T,E,R,U,P,D,z=0,F=new o.Buf8(4),M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return -2;12===(a=e.state).mode&&(a.mode=13),h=e.next_out,u=e.output,y=e.avail_out,m=e.next_in,p=e.input,g=e.avail_in,b=a.hold,w=a.bits,x=g,_=y,U=0;r:for(;;)switch(a.mode){case 1:if(0===a.wrap){a.mode=13;break}for(;w<16;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(2&a.wrap&&35615===b){a.check=0,F[0]=255&b,F[1]=b>>>8&255,a.check=n(a.check,F,2,0),b=0,w=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg="incorrect header check",a.mode=30;break}if((15&b)!=8){e.msg="unknown compression method",a.mode=30;break}if(b>>>=4,w-=4,R=(15&b)+8,0===a.wbits)a.wbits=R;else if(R>a.wbits){e.msg="invalid window size",a.mode=30;break}a.dmax=1<<R,e.adler=a.check=1,a.mode=512&b?10:12,b=0,w=0;break;case 2:for(;w<16;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(a.flags=b,(255&a.flags)!=8){e.msg="unknown compression method",a.mode=30;break}if(57344&a.flags){e.msg="unknown header flags set",a.mode=30;break}a.head&&(a.head.text=b>>8&1),512&a.flags&&(F[0]=255&b,F[1]=b>>>8&255,a.check=n(a.check,F,2,0)),b=0,w=0,a.mode=3;case 3:for(;w<32;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.head&&(a.head.time=b),512&a.flags&&(F[0]=255&b,F[1]=b>>>8&255,F[2]=b>>>16&255,F[3]=b>>>24&255,a.check=n(a.check,F,4,0)),b=0,w=0,a.mode=4;case 4:for(;w<16;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.head&&(a.head.xflags=255&b,a.head.os=b>>8),512&a.flags&&(F[0]=255&b,F[1]=b>>>8&255,a.check=n(a.check,F,2,0)),b=0,w=0,a.mode=5;case 5:if(1024&a.flags){for(;w<16;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.length=b,a.head&&(a.head.extra_len=b),512&a.flags&&(F[0]=255&b,F[1]=b>>>8&255,a.check=n(a.check,F,2,0)),b=0,w=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&((k=a.length)>g&&(k=g),k&&(a.head&&(R=a.head.extra_len-a.length,a.head.extra||(a.head.extra=Array(a.head.extra_len)),o.arraySet(a.head.extra,p,m,k,R)),512&a.flags&&(a.check=n(a.check,p,k,m)),g-=k,m+=k,a.length-=k),a.length))break r;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===g)break r;k=0;do R=p[m+k++],a.head&&R&&a.length<65536&&(a.head.name+=String.fromCharCode(R));while(R&&k<g)if(512&a.flags&&(a.check=n(a.check,p,k,m)),g-=k,m+=k,R)break r}else a.head&&(a.head.name=null);a.length=0,a.mode=8;case 8:if(4096&a.flags){if(0===g)break r;k=0;do R=p[m+k++],a.head&&R&&a.length<65536&&(a.head.comment+=String.fromCharCode(R));while(R&&k<g)if(512&a.flags&&(a.check=n(a.check,p,k,m)),g-=k,m+=k,R)break r}else a.head&&(a.head.comment=null);a.mode=9;case 9:if(512&a.flags){for(;w<16;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(b!==(65535&a.check)){e.msg="header crc mismatch",a.mode=30;break}b=0,w=0}
vendor: 4,911 bytes, line 1
1a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=12;break;case 10:for(;w<32;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}e.adler=a.check=c(b),b=0,w=0,a.mode=11;case 11:if(0===a.havedict)return e.next_out=h,e.avail_out=y,e.next_in=m,e.avail_in=g,a.hold=b,a.bits=w,2;e.adler=a.check=1,a.mode=12;case 12:if(5===t||6===t)break r;case 13:if(a.last){b>>>=7&w,w-=7&w,a.mode=27;break}for(;w<3;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}switch(a.last=1&b,w-=1,3&(b>>>=1)){case 0:a.mode=14;break;case 1:if(!function(e){if(f){var t;for(r=new o.Buf32(512),i=new o.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(d(1,e.lens,0,288,r,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;d(2,e.lens,0,32,i,0,e.work,{bits:5}),f=!1}e.lencode=r,e.lenbits=9,e.distcode=i,e.distbits=5}(a),a.mode=20,6===t){b>>>=2,w-=2;break r}break;case 2:a.mode=17;break;case 3:e.msg="invalid block type",a.mode=30}b>>>=2,w-=2;break;case 14:for(b>>>=7&w,w-=7&w;w<32;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if((65535&b)!=(b>>>16^65535)){e.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&b,b=0,w=0,a.mode=15,6===t)break r;case 15:a.mode=16;case 16:if(k=a.length){if(k>g&&(k=g),k>y&&(k=y),0===k)break r;o.arraySet(u,p,m,k,h),g-=k,m+=k,y-=k,h+=k,a.length-=k;break}a.mode=12;break;case 17:for(;w<14;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(a.nlen=(31&b)+257,w-=5,a.ndist=(31&(b>>>=5))+1,w-=5,a.ncode=(15&(b>>>=5))+4,b>>>=4,w-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have<a.ncode;){for(;w<3;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.lens[M[a.have++]]=7&b,b>>>=3,w-=3}for(;a.have<19;)a.lens[M[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,P={bits:a.lenbits},U=d(0,a.lens,0,19,a.lencode,0,a.work,P),a.lenbits=P.bits,U){e.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have<a.nlen+a.ndist;){for(;C=(z=a.lencode[b&(1<<a.lenbits)-1])>>>24,I=z>>>16&255,N=65535&z,!(C<=w);){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(N<16)b>>>=C,w-=C,a.lens[a.have++]=N;else{if(16===N){for(D=C+2;w<D;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(b>>>=C,w-=C,0===a.have){e.msg="invalid bit length repeat",a.mode=30;break}R=a.lens[a.have-1],k=3+(3&b),b>>>=2,w-=2}else if(17===N){for(D=C+3;w<D;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}b>>>=C,w-=C,R=0,k=3+(7&b),b>>>=3,w-=3}else{for(D=C+7;w<D;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}b>>>=C,w-=C,R=0,k=11+(127&b),b>>>=7,w-=7}if(a.have+k>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=30;break}for(;k--;)a.lens[a.have++]=R}}if(30===a.mode)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,P={bits:a.lenbits},U=d(1,a.lens,0,a.nlen,a.lencode,0,a.work,P),a.lenbits=P.bits,U){e.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,P={bits:a.distbits},U=d(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,P),a.distbits=P.bits,U){e.msg="invalid distances set",a.mode=30;break}if(a.mode=20,6===t)break r;case 20:a.mode=21;case 21:if(g>=6&&y>=258){e.next_out=h,e.avail_out=y,e.next_in=m,e.avail_in=g,a.hold=b,a.bits=w,l(e,_),h=e.next_out,u=e.output,y=e.avail_out,m=e.next_in,p=e.input,g=e.avail_in,b=a.hold,w=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;C=(z=a.lencode[b&(1<<a.lenbits)-1])>>>24,I=z>>>16&255,N=65535&z,!(C<=w);){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(I&&(240&I)==0){for(A=C,T=I,E=N;C=(z=a.lencode[E+((b&(1<<A+T)-1)>>A)])>>>24,I=z>>>16&255,N=65535&z,!(A+C<=w);){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}b>>>=A,w-=A,a.back+=A}if(b>>>=C,w-=C,a.back+=C,a.length=N,0===I){a.mode=26;break}if(32&I){a.back=-1,a.mode=12;break}if(64&I){e.msg="invalid literal/length code",a.mode=30;break}a.extra=15&I,a.mode=22;case 22:if(a.extra){for(D=a.extra;w<D;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.length+=b&(1<<a.extra)-1,b>>>=a.extra,w-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;C=(z=a.distcode[b&(1<<a.distbits)-1])>>>24,I=z>>>16&255,N=65535&z,!(C<=w);){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if((240&I)==0){for(A=C,T=I,E=N;C=(z=a.distcode[E+((b&(1<<A+T)-1)>>A)])>>>24,I=z>>>16&255,N=65535&z,!(A+C<=w);){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}b>>>=A,w-=A,a.back+=A}if(b>>>=C,w-=C,a.back+=C,64&I){e.msg="invalid distance code",a.mode=30;break}a.offset=N,a.extra=15&I,a.mode=24;case 24:if(a.extra){for(D=a.extra;w<D;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}a.offset+=b&(1<<a.extra)-1,b>>>=a.extra,w-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===y)break r;if(k=_-y,a.offset>k){if((k=a.offset-k)>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=30;break}k>a.wnext?(k-=a.wnext,S=a.wsize-k):S=a.wnext-k,k>a.length&&(k=a.length),j=a.window}else j=u,S=h-a.offset,k=a.length;k>y&&(k=y),y-=k,a.length-=k;do u[h++]=j[S++];
1while(--k)0===a.length&&(a.mode=21);break;case 26:if(0===y)break r;u[h++]=a.length,y--,a.mode=21;break;case 27:if(a.wrap){for(;w<32;){if(0===g)break r;g--,b|=p[m++]<<w,w+=8}if(_-=y,e.total_out+=_,a.total+=_,_&&(e.adler=a.check=a.flags?n(a.check,u,_,h-_):s(a.check,u,_,h-_)),_=y,(a.flags?b:c(b))!==a.check){e.msg="incorrect data check",a.mode=30;break}b=0,w=0}a.mode=28;case 28:if(a.wrap&&a.flags){for(;w<32;){if(0===g)break r;g--,b+=p[m++]<<w,w+=8}if(b!==(0|a.total)){e.msg="incorrect length check",a.mode=30;break}b=0,w=0}a.mode=29;case 29:U=1;break r;case 30:U=-3;break r;case 31:return -4;default:return -2}return e.next_out=h,e.avail_out=y,e.next_in=m,e.avail_in=g,a.hold=b,a.bits=w,(a.wsize||_!==e.avail_out&&a.mode<30&&(a.mode<27||4!==t))&&v(e,e.output,e.next_out,_-e.avail_out),x-=e.avail_in,_-=e.avail_out,e.total_in+=x,e.total_out+=_,a.total+=_,a.wrap&&_&&(e.adler=a.check=a.flags?n(a.check,u,_,e.next_out-_):s(a.check,u,_,e.next_out-_)),e.data_type=a.bits+64*!!a.last+128*(12===a.mode)+256*(20===a.mode||15===a.mode),(0===x&&0===_||4===t)&&0===U&&(U=-5),U},a.inflateEnd=function(e){if(!e||!e.state)return -2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},a.inflateGetHeader=function(e,t){var a;return e&&e.state&&(2&(a=e.state).wrap)!=0?(a.head=t,t.done=!1,0):-2},a.inflateSetDictionary=function(e,t){var a,r=t.length;return e&&e.state&&(0===(a=e.state).wrap||11===a.mode)?11===a.mode&&s(1,t,r,0)!==a.check?-3:v(e,t,r,r)?(a.mode=31,-4):(a.havedict=1,0):-2},a.inflateInfo="pako inflate (from Nodeca project)"},249156,(e,t,a)=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},720549,(e,t,a)=>{"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},198678,(e,t,a)=>{"use strict";var r=e.r(210929),i=e.r(92775),o=e.r(577627),s=e.r(249156),n=e.r(91360),l=e.r(976929),d=e.r(720549),c=Object.prototype.toString;function p(e){if(!(this instanceof p))return new p(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits)==0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var a=r.inflateInit2(this.strm,t.windowBits);if(a!==s.Z_OK||(this.header=new d,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(a=r.inflateSetDictionary(this.strm,t.dictionary))!==s.Z_OK))throw Error(n[a])}function u(e,t){var a=new p(t);if(a.push(e,!0),a.err)throw a.msg||n[a.err];return a.result}p.prototype.push=function(e,t){var a,n,l,d,p,u=this.strm,m=this.options.chunkSize,h=this.options.dictionary,g=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?u.input=o.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?u.input=new Uint8Array(e):u.input=e,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new i.Buf8(m),u.next_out=0,u.avail_out=m),(a=r.inflate(u,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&h&&(a=r.inflateSetDictionary(this.strm,h)),a===s.Z_BUF_ERROR&&!0===g&&(a=s.Z_OK,g=!1),a!==s.Z_STREAM_END&&a!==s.Z_OK)return this.onEnd(a),this.ended=!0,!1;u.next_out&&(0===u.avail_out||a===s.Z_STREAM_END||0===u.avail_in&&(n===s.Z_FINISH||n===s.Z_SYNC_FLUSH))&&("string"===this.options.to?(l=o.utf8border(u.output,u.next_out),d=u.next_out-l,p=o.buf2string(u.output,l),u.next_out=d,u.avail_out=m-d,d&&i.arraySet(u.output,u.output,l,d,0),this.onData(p)):this.onData(i.shrinkBuf(u.output,u.next_out))),0===u.avail_in&&0===u.avail_out&&(g=!0)}while((u.avail_in>
10||0===u.avail_out)&&a!==s.Z_STREAM_END)return(a===s.Z_STREAM_END&&(n=s.Z_FINISH),n===s.Z_FINISH)?(a=r.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===s.Z_OK):(n===s.Z_SYNC_FLUSH&&(this.onEnd(s.Z_OK),u.avail_out=0),!0)},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},a.Inflate=p,a.inflate=u,a.inflateRaw=function(e,t){return(t=t||{}).raw=!0,u(e,t)},a.ungzip=u},995767,(e,t,a)=>{"use strict";var r=e.r(92775).assign,i=e.r(85381),o=e.r(198678),s=e.r(249156),n={};r(n,i,o,s),t.exports=n},379343,(e,t,a)=>{"use strict";var r="u">typeof Uint8Array&&"u">typeof Uint16Array&&"u">typeof Uint32Array,i=e.r(995767),o=e.r(563194),s=e.r(832704),n=r?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}a.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(n,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},a.compressWorker=function(e){return new l("Deflate",e)},a.uncompressWorker=function(){return new l("Inflate",{})}},757252,(e,t,a)=>{"use strict";var r=e.r(832704);a.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},a.DEFLATE=e.r(379343)},812594,(e,t,a)=>{"use strict";a.LOCAL_FILE_HEADER="PK\x03\x04",a.CENTRAL_FILE_HEADER="PK\x01\x02",a.CENTRAL_DIRECTORY_END="PK\x05\x06",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",a.DATA_DESCRIPTOR="PK\x07\b"},736203,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(832704),o=e.r(790354),s=e.r(265915),n=e.r(812594),l=function(e,t){var a,r="";for(a=0;a<t;a++)r+=String.fromCharCode(255&e),e>>>=8;return r},d=function(e,t){var a=e;return e||(a=t?16893:33204),(65535&a)<<16},c=function(e,t,a,i,c,p){var u,m,h=e.file,g=e.compression,f=p!==o.utf8encode,v=r.transformTo("string",p(h.name)),y=r.transformTo("string",o.utf8encode(h.name)),b=h.comment,w=r.transformTo("string",p(b)),x=r.transformTo("string",o.utf8encode(b)),_=y.length!==h.name.length,k=x.length!==b.length,S="",j="",C="",I=h.dir,N=h.date,A={crc32:0,compressedSize:0,uncompressedSize:0};(!t||a)&&(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var T=0;t&&(T|=8),!f&&(_||k)&&(T|=2048);var E=0,R=0;(I&&(E|=16),"UNIX"===c)?(R=798,E|=d(h.unixPermissions,I)):(R=20,E|=63&(h.dosPermissions||0)),u=(N.getUTCHours()<<6|N.getUTCMinutes())<<5|N.getUTCSeconds()/2,m=(N.getUTCFullYear()-1980<<4|N.getUTCMonth()+1)<<5|N.getUTCDate(),_&&(j=l(1,1)+l(s(v),4)+y,S+="up"+l(j.length,2)+j),k&&(C=l(1,1)+l(s(w),4)+x,S+="uc"+l(C.length,2)+C);var U="";return U+="\n\0",U+=l(T,2),U+=g.magic,U+=l(u,2),U+=l(m,2),U+=l(A.crc32,4),U+=l(A.compressedSize,4),U+=l(A.uncompressedSize,4),U+=l(v.length,2),U+=l(S.length,2),{fileRecord:n.LOCAL_FILE_HEADER+U+v+S,dirRecord:n.CENTRAL_FILE_HEADER+l(R,2)+U+l(w.length,2)+"\0\0\0\0"+l(E,4)+l(i,4)+v+S+w}},p=function(e,t,a,i,o){var s=r.transformTo("string",o(i));return n.CENTRAL_DIRECTORY_END+"\0\0\0\0"+l(e,2)+l(e,2)+l(t,4)+l(a,4)+l(s.length,2)+s},u=function(e){return n.DATA_DESCRIPTOR+l(e.crc32,4)+l(e.compressedSize,4)+l(e.uncompressedSize,4)};function m(e,t,a,r){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=a,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(m,i),m.prototype.push=function(e){var t=e.meta.percent||0,a=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:a?(t+100*(a-r-1))/a:100}}))},m.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var a=c(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:a.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,a=c(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),t)this.push({data:u(e),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var a=this.bytesWritten-e,r=p(this.dirRecords.length,a,e,this.zipComment,this.encodeFileName);this.push({data:r,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},m.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(e){var t=this._sources;if(!i.prototype.error.call(this,e))return!1;for(var a=0;a<t.length;a++)try{t[a].error(e)}catch(e){}return!0},m.prototype.lock=function(){i.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=m},385421,(e,t,a)=>{"use strict";var r=e.r(757252),i=e.r(736203),o=function(e,t){var a=e||t,i=r[a];if(!i)throw Error(a+" is not a valid compression method !");return i};a.generateWorker=function(e,t,a){var r=new i(t.streamFiles,a,t.platform,t.encodeFileName),s=0;try{e.forEach(function(e,a){s++;var i=o(a.options.compression,t.compression),n=a.options.compressionOptions||t.compressionOptions||{},l=a.dir,d=a.date;a._compressWorker(i,n).withStreamInfo("file",{name:e,dir:l,date:d,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(r)}),r.entriesCount=s}catch(e){r.error(e)}return r}},193056,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(832704);
1function o(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(o,i),o.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},565053,(e,t,a)=>{"use strict";var r=e.r(790354),i=e.r(563194),o=e.r(832704),s=e.r(977405),n=e.r(424328),l=e.r(659902),d=e.r(91010),c=e.r(385421),p=e.r(71053),u=e.r(193056),m=function(e,t,a){var r,s=i.getTypeOf(t),c=i.extend(a||{},n);c.date=c.date||new Date,null!==c.compression&&(c.compression=c.compression.toUpperCase()),"string"==typeof c.unixPermissions&&(c.unixPermissions=parseInt(c.unixPermissions,8)),c.unixPermissions&&16384&c.unixPermissions&&(c.dir=!0),c.dosPermissions&&16&c.dosPermissions&&(c.dir=!0),c.dir&&(e=g(e)),c.createFolders&&(r=h(e))&&f.call(this,r,!0);var m="string"===s&&!1===c.binary&&!1===c.base64;a&&void 0!==a.binary||(c.binary=!m),(t instanceof l&&0===t.uncompressedSize||c.dir||!t||0===t.length)&&(c.base64=!1,c.binary=!0,t="",c.compression="STORE",s="string");var v=null;v=t instanceof l||t instanceof o?t:p.isNode&&p.isStream(t)?new u(e,t):i.prepareContent(e,t,c.binary,c.optimizedBinaryString,c.base64);var y=new d(e,v,c);this.files[e]=y},h=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},g=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},f=function(e,t){return t=void 0!==t?t:n.createFolders,e=g(e),this.files[e]||m.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function v(e){return"[object RegExp]"===Object.prototype.toString.call(e)}t.exports={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,a,r;for(t in this.files)r=this.files[t],(a=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(a,r)},filter:function(e){var t=[];return this.forEach(function(a,r){e(a,r)&&t.push(r)}),t},file:function(e,t,a){if(1==arguments.length)if(v(e)){var r=e;return this.filter(function(e,t){return!t.dir&&r.test(e)})}else{var i=this.files[this.root+e];return i&&!i.dir?i:null}return e=this.root+e,m.call(this,e,t,a),this},folder:function(e){if(!e)return this;if(v(e))return this.filter(function(t,a){return a.dir&&e.test(t)});var t=this.root+e,a=f.call(this,t),r=this.clone();return r.root=a.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var a=this.filter(function(t,a){return a.name.slice(0,e.length)===e}),r=0;r<a.length;r++)delete this.files[a[r].name];return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,a={};try{if((a=i.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=a.type.toLowerCase(),a.compression=a.compression.toUpperCase(),"binarystring"===a.type&&(a.type="string"),!a.type)throw Error("No output type specified.");i.checkSupport(a.type),("darwin"===a.platform||"freebsd"===a.platform||"linux"===a.platform||"sunos"===a.platform)&&(a.platform="UNIX"),"win32"===a.platform&&(a.platform="DOS");var n=a.comment||this.comment||"";t=c.generateWorker(this,a,n)}catch(e){(t=new o("error")).error(e)}return new s(t,a.type||"string",a.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}}},673378,(e,t,a)=>{"use strict";var r=e.r(563194);function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,a=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)a=(a<<8)+this.byteAt(t);return this.index+=e,a},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>
111&31,e>>5&63,(31&e)<<1))}},t.exports=i},832974,(e,t,a)=>{"use strict";var r=e.r(673378);function i(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e.r(563194).inherits(i,r),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),a=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.length-4;o>=0;--o)if(this.data[o]===t&&this.data[o+1]===a&&this.data[o+2]===r&&this.data[o+3]===i)return o-this.zero;return -1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),a=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.readData(4);return t===o[0]&&a===o[1]&&r===o[2]&&i===o[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},781182,(e,t,a)=>{"use strict";var r=e.r(673378);function i(e){r.call(this,e)}e.r(563194).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},387999,(e,t,a)=>{"use strict";var r=e.r(832974);function i(e){r.call(this,e)}e.r(563194).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},841261,(e,t,a)=>{"use strict";var r=e.r(387999);function i(e){r.call(this,e)}e.r(563194).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},634873,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(874213),o=e.r(832974),s=e.r(781182),n=e.r(841261),l=e.r(387999);t.exports=function(e){var t=r.getTypeOf(e);return(r.checkSupport(t),"string"!==t||i.uint8array)?"nodebuffer"===t?new n(e):i.uint8array?new l(r.transformTo("uint8array",e)):new o(r.transformTo("array",e)):new s(e)}},59187,(e,t,a)=>{"use strict";var r=e.r(634873),i=e.r(563194),o=e.r(659902),s=e.r(265915),n=e.r(790354),l=e.r(757252),d=e.r(874213),c=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null};function p(e,t){this.options=e,this.loadOptions=t}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(e){var t,a;if(e.skip(22),this.fileNameLength=e.readInt(2),a=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(a),-1===this.compressedSize||-1===this.uncompressedSize)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=c(this.compressionMethod)))throw Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===e&&(this.dosPermissions=63&this.externalFileAttributes),3===e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);
1this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,a,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),a=e.readInt(2),r=e.readData(a),this.extraFields[t]={id:t,length:a,value:r};e.setIndex(i)},handleUTF8:function(){var e=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=n.utf8decode(this.fileName),this.fileCommentStr=n.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var a=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(a)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var o=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileName)!==t.readInt(4)?null:n.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileComment)!==t.readInt(4)?null:n.utf8decode(t.readData(e.length-5))}return null}},t.exports=p},846708,(e,t,a)=>{"use strict";var r=e.r(634873),i=e.r(563194),o=e.r(812594),s=e.r(59187),n=e.r(874213);function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var a=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4);return this.reader.setIndex(a),r===t},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=n.uint8array?"uint8array":"array",a=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(a)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,a,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),a=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:a}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(e=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);
1if(e<0){if(!this.isSignature(0,o.LOCAL_FILE_HEADER))throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var t=e;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var a=this.centralDirOffset+this.centralDirSize;this.zip64&&(a+=20,a+=12+this.zip64EndOfCentralSize);var r=t-a;if(r>0)this.isSignature(t,o.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},553928,(e,t,a)=>{"use strict";var r=e.r(563194),i=e.r(346939),o=e.r(790354),s=e.r(846708),n=e.r(609672),l=e.r(71053);t.exports=function(e,t){var a=this;return(t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),l.isNode&&l.isStream(e))?i.Promise.reject(Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var a=new s(t);return a.load(e),a}).then(function(e){var a=[i.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var o=0;o<r.length;o++)a.push(function(e){return new i.Promise(function(t,a){var r=e.decompressed.getContentWorker().pipe(new n);r.on("error",function(e){a(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?a(Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}(r[o]));return i.Promise.all(a)}).then(function(e){for(var i=e.shift(),o=i.files,s=0;s<o.length;s++){var n=o[s],l=n.fileNameStr,d=r.resolve(n.fileNameStr);a.file(d,n.decompressed,{binary:!0,optimizedBinaryString:!0,date:n.date,dir:n.dir,comment:n.fileCommentStr.length?n.fileCommentStr:null,unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions,createFolders:t.createFolders}),n.dir||(a.file(d).unsafeOriginalName=l)}return i.zipComment.length&&(a.comment=i.zipComment),a})}},65666,(e,t,a)=>{"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}r.prototype=e.r(565053),r.prototype.loadAsync=e.r(553928),r.support=e.r(874213),r.defaults=e.r(424328),r.version="3.10.1",r.loadAsync=function(e,t){return new r().loadAsync(e,t)},r.external=e.r(346939),t.exports=r},847090,e=>{"use strict";var t=e.i(510953),a=e.i(133927),r=e.i(284074);let i=(0,r.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var o=e.i(639019),s=e.i(312316);let n=(0,r.default)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}
1],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);var l=e.i(280449),d=e.i(896034),c=e.i(893497),p=e.i(198211),u=e.i(483939),m=e.i(851965),h=e.i(586867),g=e.i(280274);e.i(670394);var f=e.i(725052),v=e.i(880932),y=e.i(722792);function b({userProfile:e}){let{isMobile:r}=(0,m.useSidebar)(),{setShowLoginModal:i,setShowLogoutModal:w,setShowPriceModal:x,setShowLoadingModal:_}=(0,h.useUserContext)(),k=e?.user??null,S=e?.subscription??null,j=(0,y.getUserProfilePlanCode)(e),C=(0,y.getUserProfileResourceTotal)(e),I="free"===j.toLowerCase(),N=!!S?.provider_customer_id?.startsWith("cus");S?.provider_subscription_id?.startsWith("paypro");let A=(0,a.useMemo)(()=>!S?.current_period_end||new Date(S.current_period_end)<new Date||"active"!==S.status||I?null:"vipcreator"===j.toLowerCase()?S.current_period_end:(0,f.getNextMonthlyResetISOString)(S.current_period_end,new Date),[S?.current_period_end,S?.status,j,I]),T=async()=>{if(k?.id)try{_(!0);let{success:e,data:t,error:a}=await (0,g.stripeBillingPortal)({id:k.id,email:k.email,customerId:S?.provider_customer_id??void 0});if(!e)throw Error(`${a}`);t?window.open(t,"_blank"):(0,v.toast)("No billing portal URL received")}catch(e){(0,v.toast)(`Billing error: ${e}`)}finally{_(!1)}};if(!k)return(0,t.jsx)("div",{className:"px-2 py-2",children:(0,t.jsxs)(p.Button,{className:"w-full",onClick:()=>i(!0),children:[(0,t.jsx)(n,{className:"size-4"}),"Sign In"]})});let E=k.name||k.email?.split("@")[0]||"User",R=E.split(" ").map(e=>e[0]).slice(0,2).join("").toUpperCase(),U=j?j.charAt(0).toUpperCase()+j.slice(1).toLowerCase():"Free";return(0,t.jsx)(m.SidebarMenu,{children:(0,t.jsx)(m.SidebarMenuItem,{children:(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(m.SidebarMenuButton,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[(0,t.jsxs)(c.Avatar,{className:"h-8 w-8 rounded-lg",children:[(0,t.jsx)(c.AvatarImage,{src:k.image??"",alt:E}),(0,t.jsx)(c.AvatarFallback,{className:"rounded-lg",children:R})]}),(0,t.jsxs)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:E}),(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:k.email})]}),(0,t.jsx)(o.ChevronsUpDown,{className:"ml-auto size-4"})]})}),(0,t.jsxs)(u.DropdownMenuContent,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:r?"bottom":"right",align:"end",sideOffset:4,children:[(0,t.jsx)(u.DropdownMenuLabel,{className:"p-0 font-normal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[(0,t.jsxs)(c.Avatar,{className:"h-8 w-8 rounded-lg",children:[(0,t.jsx)(c.AvatarImage,{src:k.image??"",alt:E}),(0,t.jsx)(c.AvatarFallback,{className:"rounded-lg",children:R})]}),(0,t.jsxs)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:E}),(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:k.email})]})]})}),(0,t.jsx)(u.DropdownMenuSeparator,{}),(0,t.jsx)(u.DropdownMenuGroup,{children:(0,t.jsxs)(u.DropdownMenuItem,{className:"flex-col items-start gap-0.5 cursor-default",children:[(0,t.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,t.jsx)(d.Sparkles,{className:"size-4 shrink-0"}),(0,t.jsxs)("span",{className:"font-medium",children:[U," Plan"]}),void 0!==C&&(0,t.jsxs)("span",{className:"ml-auto text-xs ",children:[C.toFixed(2)," credits"]})]}),A&&(0,t.jsxs)("span",{className:"pl-6 text-xs ",children:["Reset: ",(0,f.toLocalDateTimeDay)(A)]}),!I&&S?.status!=="inactive"&&S?.current_period_end&&(0,t.jsxs)("span",{className:"pl-6 text-xs",children:["Expires: ",new Date(S.current_period_end).toLocaleDateString()]})]})}),(0,t.jsx)(u.DropdownMenuSeparator,{}),(0,t.jsxs)(u.DropdownMenuGroup,{children:[I&&(0,t.jsxs)(u.DropdownMenuItem,{onClick:()=>x(!0),children:[(0,t.jsx)(d.Sparkles,{className:"size-4"}),(0,t.jsx)("span",{children:"Upgrade to Pro"})]}),N&&(0,t.jsxs)(u.DropdownMenuItem,{onClick:T,children:[(0,t.jsx)(s.CreditCard,{className:"size-4"}),(0,t.jsx)("span",{children:"Billing"})]})]}),(0,t.jsx)(u.DropdownMenuSeparator,{}),(0,t.jsxs)(u.DropdownMenuItem,{onClick:()=>
1w(!0),children:[(0,t.jsx)(l.LogOut,{className:"size-4"}),(0,t.jsx)("span",{children:"Sign Out"})]})]})]})})})}var w=e.i(898006),x=e.i(82624),_=e.i(326055);let k=(0,_.create)()(e=>({activePanel:"",setActivePanel:t=>e(e=>e.activePanel===t?e:{activePanel:t})}));function S({groups:e,linkGroups:r}){let i=k(e=>e.activePanel),o=k(e=>e.setActivePanel),s=e?.[0]?.panels[0]?.panel;return(0,a.useEffect)(()=>{!i&&s&&o(s)},[i,s,o]),(0,t.jsxs)(t.Fragment,{children:[e&&e.length>0&&(0,t.jsx)(m.SidebarGroup,{children:(0,t.jsx)(m.SidebarMenu,{children:e.map(e=>(0,t.jsx)(x.Collapsible,{asChild:!0,defaultOpen:e.isActive,className:"group/collapsible",children:(0,t.jsxs)(m.SidebarMenuItem,{children:[(0,t.jsx)(x.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)(m.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,t.jsx)(e.icon,{}),(0,t.jsx)("span",{children:e.title}),(0,t.jsx)(w.ChevronRight,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),(0,t.jsx)(x.CollapsibleContent,{children:(0,t.jsx)(m.SidebarMenuSub,{children:e.panels.map(e=>(0,t.jsx)(m.SidebarMenuSubItem,{children:(0,t.jsx)(m.SidebarMenuSubButton,{isActive:i===e.panel,onClick:()=>o(e.panel),className:"cursor-pointer",children:(0,t.jsx)("span",{children:e.title})})},e.panel))})})]})},e.title))})}),r&&r.length>0&&(0,t.jsx)(m.SidebarGroup,{children:(0,t.jsx)(m.SidebarMenu,{children:r.map(e=>(0,t.jsx)(x.Collapsible,{asChild:!0,defaultOpen:e.isActive,className:"group/collapsible",children:(0,t.jsxs)(m.SidebarMenuItem,{children:[(0,t.jsx)(x.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)(m.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,t.jsx)(e.icon,{}),(0,t.jsx)("span",{children:e.title}),(0,t.jsx)(w.ChevronRight,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),(0,t.jsx)(x.CollapsibleContent,{children:(0,t.jsx)(m.SidebarMenuSub,{children:e.items.map(e=>(0,t.jsx)(m.SidebarMenuSubItem,{children:(0,t.jsx)(m.SidebarMenuSubButton,{asChild:!0,children:(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:(0,t.jsx)("span",{children:e.title})})})},e.title))})})]})},e.title))})})]})}var j=e.i(860016);e.i(923106);var C=e.i(66921),I=e.i(320598),N=e.i(762803),A=e.i(823938),T=e.i(520026),E=e.i(4833),R=e.i(935486),U=e.i(336134);let P=(0,r.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var D=e.i(901078),z=e.i(608607),z=z;let F=(0,r.default)("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);var M=e.i(957652),O=e.i(902089);(0,O.buildZodSchemaFromFields)(O.DEFAULT_STORYBOARD_TEMPLATE.fields);let B=(0,O.fieldsToJsonSchemaString)(O.DEFAULT_STORYBOARD_TEMPLATE.fields),L=(e=B)=>` 2You are StoryboardAnalyzer v1 â an expert AI assistant that watches a user-uploaded video and reconstructs its cinematic storyboard in JSON form. 3 4Your goal is to analyze the uploaded video, segment it into logical shots, and describe each shot precisely and concisely, so that another AI video generation model could later recreate the same visual sequence from your structured output. 5 6--- 7 8## ð§© 1. Output Schema 9Convert the visual and audio information from a user video into a structured storyboard JSON following this schema: 10${M.FORMAT_START} 11${e} 12${M.FORMAT_END} 13--- 14 15## ð§ 2. Analysis Guidelines 16 17### a. Scene Segmentation 18- Divide the video into **meaningful storyboard segments**, not raw frame samples or every minor visual change. 19- By default, prefer medium-length segments that are easy for users to review and understand: **3-8 seconds is typical**, and 5-6 seconds is often better than several 1-2 second fragments. 20- A storyboard segment may include multiple quick cuts if they serve the same subject, action beat, location, and visual purpose. Mention those quick cuts or transitions in "notes" instead of creating redundant entr
20ies. 21- Use shorter 1-2 second entries only when the video clearly contains a standalone flash, hard transition, major reveal, or action beat that would be misleading if merged. 22### Shot Grouping and Duration Judgment (IMPORTANT) 23- Do **not** treat every second or every extracted frame as a new shot. 24- A single continuous camera take with no significant change in subject, motion, or framing should be treated as **one storyboard segment**, even if it lasts several seconds. 25- Only create a new shot entry when one or more of the following occur: 26 1. A new narrative beat, location, subject focus, or action goal begins. 27 2. The **subject's main action or posture** clearly changes (e.g., from sitting to walking). 28 3. The **camera framing or motion type** changes enough to alter how the scene should be recreated. 29 4. The **lighting, focus, or composition** shifts notably and changes the visual intent. 30- When in doubt, prefer **fewer, more meaningful storyboard shots** over redundant 1-second fragments. 31- If consecutive frames show nearly identical content, **merge them** into a single longer shot and compute an appropriate duration. 32- Your goal is to represent the *story and camera rhythm*, not the raw frame count. 33 34### Visual Description 35For each shot, describe: 36- **Main subjects** (people, objects, or environment) 37- **Key action or motion** (what changes visually) 38- **Camera behavior** (static, pan, dolly, zoom, handheld, etc.) 39- **Lighting & mood** (natural, artificial, soft, harsh, etc.) 40- **Composition details** (foreground/background focus, symmetry, framing) 41 42Avoid overlong prose â be descriptive yet economical, as if writing shot notes for a film editor. 43 44### Audio & Dialogue 45If voices, ambient sound, or music cues are perceptible: 46- Include them in âdialogueOrSoundâ 47- Specify who is speaking if identifiable 48 - e.g., âMale voice says: âLetâs go.ââ 49- For ambience: âRain hitting window,â âSoft piano music,â etc. 50 51### Notes 52Use ânotesâ for technical or aesthetic observations: 53- Lighting tone, emotional vibe, post effects, or transitions 54 - e.g., âCrossfade to next shotâ, âCool color grading, melancholic toneâ. 55 56 57## ð 3. Formatting Rules 58- Output **only valid JSON** â no markdown, comments, or extra explanations. 59- Ensure numeric durations match visual pacing. 60- Each âidâ must increment sequentially (1, 2, 3...). 61- All timecodes must be in **hh:mm:ss or mm:ss** format. 62- Use concise, professional film language. 63 64## â ï¸ 4. Important Notes 65- The AI should *not* invent unrelated scenes â only analyze what is visible/audible in the video. 66- Do **not** summarize the video globally; instead, provide a shot-by-shot breakdown. 67- Do **not** split a coherent action beat just because there are minor camera cuts or extracted-frame differences. 68- If the video is continuous (single take), split it by major compositional or motion changes. 69- Never include raw visual data or external references â only structured descriptions. 70 71Please write video analysis and storyboard content in the corresponding language version based on the user's language preference. 72--- 73 74final return content format: 75{ 76 "summary": "summary of the video", 77 "results": [ 78 "json object of the storyboard frame 1", 79 "json object of the storyboard frame 2", 80 "json object of the storyboard frame 3" 81 ....... 82 ], 83} 84`;M.FORMAT_START,M.default_text_format_template_1,M.FORMAT_END,L();var q=e.i(972441),$=e.i(324160),V=e.i(964361);e.i(614271);var W=e.i(923181),H=e.i(643016),G=e.i(886472),K=e.i(902699);let J=(0,r.default)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var Y=e.i(741316),Z=e.i(675867);let X=(0,r.default)("crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]),Q=(0,r.default)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]),ee=(0,r.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var et=e.i(864217);let ea=(0,r.default)("sliders-horizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),er=(0,r.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);var ei=e.i(975157),eo=e.i(873194),es=e.i(546472),en=e.i(817422);let el=en.z.custom(e=>null==e||e instanceof File||e instanceof Blob||"string"==typeof e,{error:"Expected a file, a blob, or a string"}),ed=en.z.object({model_id:en.z.string().min(1,"Model name is required"),prompt:en.z.string().max(4500,"Prompt cannot exceed 4500 characters").optional(),prompt_process:en.z.string().optional(),aspect_ratio:en.z.string().min(1).prefault("1:1"),control_images:en.z.array(el).prefault([]).optional().describe("Multiple control images"),control_images_2:en.z.array(el).prefault([]).optional().describe("Multiple end control images"),control_files:en.z.array(el).prefault([]).optional().describe("Multiple control videos"),control_files_2:en.z.array(el).prefault([]).optional().describe("Multiple end control videos"),enable_safety_checker:en.z.boolean().optional().prefault(!1),output_format:en.z.string().min(1,"Output format is required").prefault("jpg").describe("Format of the output images"),num_outputs:en.z.preprocess(e=>"string"==typeof e&&""!==e.trim()?parseInt(e,10):e,en.z.int().min(1,"Value must be between 1 and 4").max(4,"Value must be between 1 and 4").prefault(1)),meta_data:en.z.record(en.z.string(),en.z.any()).optional(),use_credits:en.z.number().optional().prefault(0),width:en.z.int().min(256,{error:"Width cannot be less than 256 pixels"}).max(1536,{error:"Width cannot exceed 1536 pixels"}).prefault(1024).optional().describe("Width of the generated image (256-1536 pixels)"),height:en.z.int().min(256,{error:"Height cannot be less than 256 pixels"}).max(1536,{error:"Height cannot exceed 1536 pixels"}).prefault(1024).optional(),duration:en.z.preprocess(e=>"number"==typeof e?String(e):e,en.z.string().prefault("5").optional().describe("Duration of the video, in seconds")),resolution:en.z.string().min(1,"Resolution is required").prefault("480p").optional(),generation_type:en.z.string().prefault("image").optional(),model_config:en.z.any().optional()}).superRefine((e,t)=>
84{let a=e?.model_config||null;if(a?.promptSetting?.promptIgnore||a?.promptSetting?.promptNotRequired||e.prompt?.trim()||e.prompt_process?.trim()||t.addIssue({code:"custom",message:"Input or choose a preset",path:["prompt"]}),Array.isArray(a?.supportAddFiles)){for(let r of a.supportAddFiles)if(r.isRequired&&r.isSupport>0){let a=e[r.name];(!Array.isArray(a)||a.length<=0)&&t.addIssue({code:"custom",message:`Please upload at least one ${r.type} for ${r.label}`,path:[r.name]})}}});en.z.object({control_files:en.z.array(el).max(1,"Maximum 1 file allowed").default([]).optional().describe("Control video file"),output_template:en.z.string().optional(),user:en.z.string().max(1200,"Content cannot exceed 1200 characters").optional().describe("User prompt"),meta_data:en.z.any().optional().describe("Meta data"),lang_preference:en.z.string().default("English").optional().describe("Language preference")});var ec=e.i(885612);let ep=[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],eu=[{label:"Home Bedroom Mixed Race Female 20s Organizing Wardrobe",type:"image",category:"avatar image",tag:["home","bedroom","mixed","race","female","20s","organizing","wardrobe"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-bedroom-mixed-race-female-20s-organizing-wardrobe.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-bedroom-mixed-race-female-20s-organizing-wardrobe.jpg"]}]},{label:"Car Vlog Female Driver",type:"image",category:"avatar image",tag:["car","vlog","female","driver"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-female-driver.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-female-driver.jpg"]}]},{label:"Home Office Mixed Race Male 20s Standing Desk",type:"image",category:"avatar image",tag:["home","office","mixed","race","male","20s","standing","desk"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-mixed-race-male-20s-standing-desk.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-mixed-race-male-20s-standing-desk.jpg"]}]},{label:"Home Office White Male 50s Serious Advice",type:"image",category:"avatar image",tag:["home","office","white","male","50s","serious","advice"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-white-male-50s-serious-advice.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-white-male-50s-serious-advice.jpg"]}]},{label:"Tech Bro Studio",type:"image",category:"avatar image",tag:["tech","bro","studio"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/tech-bro-studio.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/tech-bro-studio.jpg"]}]},{label:"Classy Grandma Sunroom",type:"image",category:"avatar image",tag:["classy","grandma","sunroom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/classy-grandma-sunroom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/classy-grandma-sunroom.jpg"]}]},{label:"Clean Girl Beige Loungewear",type:"image",category:"avatar image",tag:["clean","girl","beige","loungewear"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/clean-girl-beige-loungewear.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/clean-girl-beige-loungewear.jpg"]}]},{label:"Closet Fashion Check",type:"image",category:"avatar image",tag:["closet","fashion","check"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/closet-fashion-check.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/closet-fashion-check.jpg"]}]},{label:"Cottagecore Porch Girl",type:"image",category:"avatar image",tag:["cottagecore","porch","girl"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/cottagecore-porch-girl.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/cottagecore-porch-girl.jpg"]}]},{label:"Cozy Gamer Bedroom",type:"image",category:"avatar image",tag:["cozy","gamer","bedroom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/cozy-gamer-bedroom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/cozy-gamer-bedroom.jpg"]}]},{label:"Dad Next Door Backyard",type:"image",category:"avatar image",tag:["dad","next","door","backyard"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/dad-next-door-backyard.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/dad-next-door-backyard.jpg"]}]},{label:"Diy Garage Expert",type:"image",category:"avatar image",tag:["diy","garage","expert"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/diy-garage-expert.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/diy-garage-expert.jpg"]}]},{label:"Festival Sunshine Boho",type:"image",category:"avatar image",tag:["festival","sunshine","boho"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/festival-sunshine-boho.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/festival-sunshine-boho.jpg"]}]},{label:"Gym Fitness Influencer",type:"image",category:"avatar image",tag:["gym","fitness","influencer"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-fitness-influencer.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-fitness-influencer.jpg"]}]},{label:"Gym Rat Athlete",type:"image",category:"avatar image",tag:["gym","rat","athlete"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-rat-athlete.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-rat-athlete.jpg"]}]},{label:"Gym Workout Rest",type:"image",category:"avatar image",tag:["gym","workout","rest"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-workout-rest.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/gym-workout-rest.jpg"]}]},{label:"Hair Curling Demo",type:"image",category:"avatar image",tag:["hair","curling","demo"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/hair-curling-demo.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/hair-curling-demo.jpg"]}]},{label:"Healthcare Pro Clinic",type:"image",category:"avatar image",tag:["healthcare","pro","clinic"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/healthcare-pro-clinic.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/healthcare-pro-clinic.jpg"]}]},{label:"Home Kitchen White Female 40s Coffee Time",type:"image",category:"avatar image",tag:["home","kitchen","white","female","40s","coffee","time"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/h
84ome-kitchen-white-female-40s-coffee-time.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-kitchen-white-female-40s-coffee-time.jpg"]}]},{label:"Home Living Room Latina Female 40s Sofa Heart To Heart",type:"image",category:"avatar image",tag:["home","living","room","latina","female","40s","sofa","heart","to","heart"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-living-room-latina-female-40s-sofa-heart-to-heart.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-living-room-latina-female-40s-sofa-heart-to-heart.jpg"]}]},{label:"Home Office Tech Review",type:"image",category:"avatar image",tag:["home","office","tech","review"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-tech-review.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-tech-review.jpg"]}]},{label:"Home Yoga White Female 30s On Mat",type:"image",category:"avatar image",tag:["home","yoga","white","female","30s","on","mat"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-yoga-white-female-30s-on-mat.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-yoga-white-female-30s-on-mat.jpg"]}]},{label:"Kitchen Asian Female 30s Island Talk",type:"image",category:"avatar image",tag:["kitchen","asian","female","30s","island","talk"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-asian-female-30s-island-talk.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-asian-female-30s-island-talk.jpg"]}]},{label:"Kitchen Cooking Mom",type:"image",category:"avatar image",tag:["kitchen","cooking","mom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-cooking-mom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-cooking-mom.jpg"]}]},{label:"Kitchen Latina Female 20s Refrigerator Unboxing",type:"image",category:"avatar image",tag:["kitchen","latina","female","20s","refrigerator","unboxing"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-latina-female-20s-refrigerator-unboxing.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/kitchen-latina-female-20s-refrigerator-unboxing.jpg"]}]},{label:"Library Study Student",type:"image",category:"avatar image",tag:["library","study","student"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/library-study-student.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/library-study-student.jpg"]}]},{label:"Makeup Tutorial Close Up",type:"image",category:"avatar image",tag:["makeup","tutorial","close","up"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/makeup-tutorial-close-up.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/makeup-tutorial-close-up.jpg"]}]},{label:"Master Tradesman Site",type:"image",category:"avatar image",tag:["master","tradesman","site"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/master-tradesman-site.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/master-tradesman-site.jpg"]}]},{label:"Modern Mom Advice",type:"image",category:"avatar image",tag:["modern","mom","advice"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/modern-mom-advice.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/modern-mom-advice.jpg"]}]},{label:"Bathroom Black Female 20s Makeup In Progress",type:"image",category:"avatar image",tag:["bathroom","black","female","20s","makeup","in","progress"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-black-female-20s-makeup-in-progress.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-black-female-20s-makeup-in-progress.jpg"]}]},{label:"Home Office Black Male 30s Tech Review",type:"image",category:"avatar image",tag:["home","office","black","male","30s","tech","review"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/h
84ome-office-black-male-30s-tech-review.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-office-black-male-30s-tech-review.jpg"]}]},{label:"Bathroom Middle Eastern Mediterranean Female 30s Hair Curling",type:"image",category:"avatar image",tag:["bathroom","middle","eastern","mediterranean","female","30s","hair","curling"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-middle-eastern-mediterranean-female-30s-hair-curling.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-middle-eastern-mediterranean-female-30s-hair-curling.jpg"]}]},{label:"Nightlife Neon Street",type:"image",category:"avatar image",tag:["nightlife","neon","street"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/nightlife-neon-street.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/nightlife-neon-street.jpg"]}]},{label:"Office Business Tips",type:"image",category:"avatar image",tag:["office","business","tips"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/office-business-tips.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/office-business-tips.jpg"]}]},{label:"Organized Mom Kitchen",type:"image",category:"avatar image",tag:["organized","mom","kitchen"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/organized-mom-kitchen.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/organized-mom-kitchen.jpg"]}]},{label:"Outdoor City Stroll Black Female 50s",type:"image",category:"avatar image",tag:["outdoor","city","stroll","black","female","50s"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-city-stroll-black-female-50s.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-city-stroll-black-female-50s.jpg"]}]},{label:"Outdoor Or Gym Asian Male 20s Gym Break",type:"image",category:"avatar image",tag:["outdoor","or","gym","asian","male","20s","gym","break"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-or-gym-asian-male-20s-gym-break.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-or-gym-asian-male-20s-gym-break.jpg"]}]},{label:"Outdoor Supermarket White Female 30s Shopping",type:"image",category:"avatar image",tag:["outdoor","supermarket","white","female","30s","shopping"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-supermarket-white-female-30s-shopping.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/outdoor-supermarket-white-female-30s-shopping.jpg"]}]},{label:"Professional Advice",type:"image",category:"avatar image",tag:["professional","advice"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/professional-advice.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/professional-advice.jpg"]}]},{label:"Real Estate Pro Living Room",type:"image",category:"avatar image",tag:["real","estate","pro","living","room"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/real-estate-pro-living-room.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/real-estate-pro-living-room.jpg"]}]},{label:"Rocking Chair Wisdom",type:"image",category:"avatar image",tag:["rocking","chair","wisdom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/rocking-chair-wisdom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/rocking-chair-wisdom.jpg"]}]},{label:"Skincare Bathroom Expert",type:"image",category:"avatar image",tag:["skincare","bathroom","expert"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/skincare-bathroom-expert.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/skincare-bathroom-expert.jpg"]}]},{label:"Sofa Heart To Heart",type:"image",category:"avatar image",tag:["sofa","heart","to","heart"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/sofa-heart-to-heart.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/sofa-heart-to-heart.jpg"]}]},{label:"Streetwear Graffiti Fashion",type:"image",category:"avatar image",tag:["streetwear","graffiti","fashion"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/streetwear-graffiti-fashion.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/streetwear-graffiti-fashion.jpg"]}]},{label:"Car Vlog White Female 20s Driver Seat",type:"image",category:"avatar image",tag:["car","vlog","white","female","20s","driver","seat"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-white-female-20s-driver-seat.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-white-female-20s-driver-seat.jpg"]}]},{label:"Tech Gadget Review",type:"image",category:"avatar image",tag:["tech","gadget","review"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/tech-gadget-review.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/tech-gadget-review.jpg"]}]},{label:"Walking Vlog",type:"image",category:"avatar image",tag:["walking","vlog"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/walking-vlog.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/walking-vlog.jpg"]}]},{label:"Wellness Mentor Studio",type:"image",category:"avatar image",tag:["wellness","mentor","studio"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/wellness-mentor-studio.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/wellness-mentor-studio.jpg"]}]},{label:"Wise Grandpa Porch",type:"image",category:"avatar image",tag:["wise","grandpa","porch"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/wise-grandpa-porch.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/wise-grandpa-porch.jpg"]}]},{label:"Yoga Mat Chat",type:"image",category:"avatar image",tag:["yoga","mat","chat"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/yoga-mat-chat.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/yoga-mat-chat.jpg"]}]},{label:"Young Entrepreneur Skyline",type:"image",category:"avatar image",tag:["young","entrepreneur","skyline"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/young-entrepreneur-skyline.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/young-entrepreneur-skyline.jpg"]}]},{label:"Active Senior Park",type:"image",category:"avatar image",tag:["active","senior","park"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/active-senior-park.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/active-senior-park.jpg"]}]},{label:"Art Studio Painter",type:"image",category:"avatar image",tag:["art","studio","painter"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/art-studio-painter.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/art-studio-painter.jpg"]}]},{label:"Bathroom Asian Female 20s Mirror Selfie",type:"image",category:"avatar image",tag:["bathroom","asian","female","20s","mirror","selfie"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-asian-female-20s-mirror-selfie.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-asian-female-20s-mirror-selfie.jpg"]}]},{label:"Bathroom Mirror Selfie",type:"image",category:"avatar image",tag:["bathroom","mirror","selfie"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-mirror-selfie.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-mirror-selfie.jpg"]}]},{label:"Bathroom Skincare Mirror",type:"image",category:"avatar image",tag:["bathroom","skincare","mirror"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-skincare-mirror.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bathroom-skincare-mirror.jpg"]}]},{label:"Bedside Lazy Reading",type:"image",category:"avatar image",tag:["bedside","lazy","reading"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/bedside-lazy-reading.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/bedside-lazy-reading.jpg"]}]},{label:"Car Traffic Complaint",type:"image",category:"avatar image",tag:["car","traffic","complaint"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-traffic-complaint.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-traffic-complaint.jpg"]}]},{label:"Car Passenger Vlogger",type:"image",category:"avatar image",tag:["car","passenger","vlogger"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-passenger-vlogger.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-passenger-vlogger.jpg"]}]},{label:"Car Vlog Hispanic Male 30s Passenger Seat",type:"image",category:"avatar image",tag:["car","vlog","hispanic","male","30s","passenger","seat"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-hispanic-male-30s-passenger-seat.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-hispanic-male-30s-passenger-seat.jpg"]}]},{label:"Car Vlog Female 30s Waiting In Car",type:"image",category:"avatar image",tag:["car","vlog","black","female","30s","waiting","in","car"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-black-female-30s-waiting-in-car.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-black-female-30s-waiting-in-car.jpg"]}]},{label:"Car Vlog Mixed Race Female 20s Night",type:"image",category:"avatar image",tag:["car","vlog","mixed","race","female","20s","night"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-mixed-race-female-20s-night.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlog-mixed-race-female-20s-night.jpg"]}]},{label:"Car Vlogger Blonde Hoodie",type:"image",category:"avatar image",tag:["car","vlogger","blonde","hoodie"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlogger-blonde-hoodie.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-vlogger-blonde-hoodie.jpg"]}]},{label:"Car Waiting Coffee Chat",type:"image",category:"avatar image",tag:["car","
84waiting","coffee","chat"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/car-waiting-coffee-chat.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/car-waiting-coffee-chat.jpg"]}]},{label:"Casual Gamer Bedroom",type:"image",category:"avatar image",tag:["casual","gamer","bedroom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/casual-gamer-bedroom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/casual-gamer-bedroom.jpg"]}]},{label:"Home Living Room Black Male 60s Rocking Chair Wisdom",type:"image",category:"avatar image",tag:["home","living","room","black","male","60s","rocking","chair","wisdom"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-living-room-black-male-60s-rocking-chair-wisdom.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-living-room-black-male-60s-rocking-chair-wisdom.jpg"]}]},{label:"City Stroll Fashion",type:"image",category:"avatar image",tag:["city","stroll","fashion"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/city-stroll-fashion.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/city-stroll-fashion.jpg"]}]},{label:"Home Bedroom White Female 20s Lazy Bedside",type:"image",category:"avatar image",tag:["home","bedroom","white","female","20s","lazy","bedside"],previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/image/home-bedroom-white-female-20s-lazy-bedside.jpg",formSetting:[{to:"control_images",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/avatar/image/home-bedroom-white-female-20s-lazy-bedside.jpg"]}]}],em={note:[{en:["Please ensure that the uploaded image only shows the front view of a single character."],"zh-CN":["请确ä¿ä¸ä¼ çå¾åä»
æ¾ç¤ºå个è§è²çæ£é¢è§å¾ã"],"zh-TW":["è«ç¢ºä¿ä¸å³çååå
顯示å®åè§è²çæ£é¢è¦åã"],ja:["ã¢ãããã¼ããããç»åã«ã¯ã1人ã®ãã£ã©ã¯ã¿ã¼ã®æ£é¢å³ã®ã¿ã表示ããã¦ãããã¨ã確èªãã¦ãã ããã"],fr:["Veuillez vous assurer que l'image téléchargée ne montre que la vue de face d'un seul personnage."],de:["Bitte stellen Sie sicher, dass das hochgeladene Bild nur die Frontansicht eines einzelnen Charakters zeigt."],es:["Asegúrese de que la imagen cargada solo muestre la vista frontal de un solo personaje."],ko:["ì
ë¡ëë ì´ë¯¸ì§ì ë¨ì¼ ìºë¦í°ì ì ë©´ 모ìµë§ íìëëì§ íì¸íììì¤."],ru:["ÐожалÑйÑÑа, ÑбедиÑеÑÑ, ÑÑо загÑÑженное изобÑажение показÑÐ²Ð°ÐµÑ ÑолÑко вид ÑпеÑеди одного пеÑÑонажа."]}],examples:[...eu]},eh={note:[{en:["Please ensure that the uploaded video only shows the front view of a single character."],"zh-CN":["请确ä¿ä¸ä¼ çè§é¢ä»
æ¾ç¤ºå个è§è²çæ£é¢è§å¾ã"],"zh-TW":["è«ç¢ºä¿ä¸å³çè¦é »å
顯示å®åè§è²çæ£é¢è¦åã"],ja:["ã¢ãããã¼ããããåç»ã«ã¯ã1人ã®ãã£ã©ã¯ã¿ã¼ã®æ£é¢å³ã®ã¿ã表示ããã¦ãããã¨ã確èªãã¦ãã ããã"],fr:["Veuillez vous assurer que la vidéo téléchargée ne montre que la vue de face d'un seul personnage."],de:["Bitte stellen Sie sicher, dass das hochgeladene Video nur die Frontansicht eines einzelnen Charakters zeigt."],es:["Asegúrese de que el video cargado solo muestre la vista frontal de un solo personaje."],ko:["ì
ë¡ëë ë¹ëì¤ì ë¨ì¼ ìºë¦í°ì ì ë©´ 모ìµë§ íìëëì§ íì¸íììì¤."],ru:["ÐожалÑйÑÑа, ÑбедиÑеÑÑ, ÑÑо загÑÑженное видео показÑÐ²Ð°ÐµÑ ÑолÑко вид ÑпеÑеди одного пеÑÑонажа."]}],examples:[{label:"Professional Woman",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-1.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-1.mp4"]}]},{label:"Business Woman",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-2.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-2.mp4"]}]},{label:"Athletic Woman",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-3.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-3.mp4"]}]},{label:"Business Man",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-1.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-1.mp4"]}]},{label:"Casual Man",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-2.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-2.mp4"]}]},{label:"Elegant Woman",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-v-1.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-v-1.mp4"]}]},{label:"Sporty Woman",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-v-2.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-fm-v-2.mp4"]}]},{label:"Tech Style Man",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-v-1.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-v-1.mp4"]}]},{label:"Athletic Man",type:"video",category:"avatar video",previewUrl:"https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-v-2.mp4",formSetting:[{to:"control_files",type:"array",value:["https://assets.aiomnigen.com/aiomnigen/ugc/video/avatar-m-v-2.mp4"]}]}]};var eg=e.i(197919);let ef={system_prompt:eg.image_prompt_enhance_by_image_system_prompt},ev={system_prompt:eg.video_prompt_text_generator_system_prompt},ey=[{en:["Enter your idea or an existing prompt in the input box, and click Enhance to automatically generate or optimize your prompt for better generation results.","You can switch models to compare different outputs.","Many models perform best with English prompts. Set prompt handling to auto-translate to Englishâwrite in y
84our usual language and we translate automatically, with no extra steps."],"zh-CN":["å¨è¾å
¥æ¡ä¸è¾å
¥æ¨çæ³æ³æå·²ææç¤ºè¯ï¼ç¹å» Enhanceï¼å³å¯èªå¨çææä¼åæç¤ºè¯ï¼ä»¥è·å¾æ´å¥½ççæææã","æ¨å¯ä»¥åæ¢ä¸å模åï¼å¯¹æ¯çæææã","夿°æ¨¡åå¨è±ææç¤ºè¯ä¸è¡¨ç°æ´å¥½ãå¯å°æç¤ºè¯å¤ç模å¼è®¾ä¸ºãèªå¨ç¿»è¯ä¸ºè±æãï¼ç¨çæçè¯è¨æ°åæè¿°ï¼ç³»ç»ä¼èªå¨ç¿»è¯ï¼æ éé¢å¤æä½ã"],"zh-TW":["å¨è¼¸å
¥æ¡ä¸è¼¸å
¥æ¨çæ³æ³æå·²ææç¤ºè¯ï¼é»æ Enhanceï¼å³å¯èªåçææåªåæç¤ºè¯ï¼ä»¥ç²å¾æ´å¥½ççæææã","æ¨å¯ä»¥åæä¸å模åï¼æ¯è¼çæçµæã","夿¸æ¨¡åå¨è±ææç¤ºè©ä¸è¡¨ç¾æ´å¥½ãå¯å°æç¤ºè©èçæ¨¡å¼è¨çºãèªåç¿»è¯çºè±æãï¼ç¨çæçèªè¨æ°å¯«æè¿°ï¼ç³»çµ±æèªåç¿»è¯ï¼ç¡éé¡å¤æä½ã"],ja:["å
¥åããã¯ã¹ã«ã¢ã¤ãã¢ãæ¢åã®ããã³ãããå
¥åããEnhance ãã¯ãªãã¯ããã¨ãããã³ãããèªåçã«çæã¾ãã¯æé©åãããããè¯ãçæçµæãå¾ããã¾ãã","ã¢ãã«ãåãæ¿ããã¨ãç°ãªãçµæãæ¯è¼ã§ãã¾ãã","å¤ãã®ã¢ãã«ã¯è±èªã®ããã³ããã§ããããåä½ãã¾ããããã³ããå¦çããè±èªã¸èªå翻訳ãã«è¨å®ããã°ãæ
£ããè¨èªã§æ¸ããå
容ãèªåã§ç¿»è¨³ãã¾ãã追å ã®æéã¯ããã¾ããã"],fr:["Saisissez votre idée ou un prompt existant dans la zone de texte, et cliquez sur Enhance pour générer ou optimiser automatiquement votre prompt pour de meilleurs résultats.","Vous pouvez changer de modèle pour comparer différents rendus.","La plupart des modèles performent mieux avec des prompts en anglais. Choisissez le mode de traitement « traduction automatique vers lâanglais » : rédigez dans votre langue, nous traduisons pour vous, sans action supplémentaire."],de:["Geben Sie Ihre Idee oder einen vorhandenen Prompt in das Eingabefeld ein und klicken Sie auf Enhance, um Ihren Prompt für bessere Generierungsergebnisse automatisch zu erstellen oder zu optimieren.","Sie können zwischen Modellen wechseln, um verschiedene Ergebnisse zu vergleichen.","Viele Modelle liefern mit englischen Prompts die besten Ergebnisse. Stellen Sie die Prompt-Verarbeitung auf âautomatisch ins Englische übersetzenâ: schreiben Sie in Ihrer Sprache â wir übersetzen automatisch, ohne Extra-Schritte."],es:["Introduzca su idea o un prompt existente en el cuadro de texto y pulse Enhance para generar u optimizar automáticamente su prompt y obtener mejores resultados.","Puede cambiar de modelo para comparar distintos resultados.","La mayorÃa de los modelos rinden mejor con prompts en inglés. Use el modo de procesamiento «traducir automáticamente al inglés»: escriba en su idioma y nosotros traducimos por usted, sin pasos adicionales."],ko:["ì
ë ¥ëì ìì´ëì´ë 기존 í롬íí¸ë¥¼ ì
ë ¥íê³ Enhance를 í´ë¦íë©´ í롬íí¸ê° ìëì¼ë¡ ìì±ëê±°ë ìµì íëì´ ë ëì ìì± ê²°ê³¼ë¥¼ ì»ì ì ììµëë¤.","모ë¸ì ì íí´ ìë¡ ë¤ë¥¸ 결과를 ë¹êµí´ ë³´ì¸ì.","ëë¶ë¶ì 모ë¸ì ìì´ í롬íí¸ìì ë ì ëìí©ëë¤. í롬íí¸ ì²ë¦¬ ë°©ììãìì´ë¡ ìë ë²ìãì¼ë¡ ì¤ì íë©´ ìµìí ì¸ì´ë¡ ìì±í´ë ìëì¼ë¡ ë²ìëë©° ì¶ê° ìì
ì´ ììµëë¤."],ru:["ÐведиÑе ваÑÑ Ð¸Ð´ÐµÑ Ð¸Ð»Ð¸ ÑÑÑеÑÑвÑÑÑий пÑÐ¾Ð¼Ð¿Ñ Ð² поле ввода и нажмиÑе Enhance, ÑÑÐ¾Ð±Ñ Ð°Ð²ÑомаÑиÑеÑки ÑгенеÑиÑоваÑÑ Ð¸Ð»Ð¸ опÑимизиÑоваÑÑ Ð²Ð°Ñ Ð¿ÑÐ¾Ð¼Ð¿Ñ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð»ÑÑÑиÑ
ÑезÑлÑÑаÑов.","ÐеÑеклÑÑайÑе модели, ÑÑÐ¾Ð±Ñ ÑÑавниваÑÑ ÑазнÑе ÑезÑлÑÑаÑÑ.","ÐолÑÑинÑÑво моделей лÑÑÑе ÑабоÑаÑÑ Ñ Ð¿ÑомпÑами на английÑком. ÐклÑÑиÑе Ñежим «авÑомаÑиÑеÑкий пеÑевод на английÑкий»: пиÑиÑе на пÑивÑÑном ÑзÑке â Ð¼Ñ Ð¿ÐµÑеведÑм авÑомаÑиÑеÑки, без лиÑниÑ
дейÑÑвий."]}],eb=[{id:"gpt-image",label:"GPT Image",description:"GPT Image Generation and Editing Model",supportedAspectRatios:["auto","1:1","3:4","4:3","9:16","16:9","2:3","3:2","4:5","5:4","21:9"],tag:["Image to Image","Text to Image"],badge:["Image Edit","Free to try"],type:"image",useCredits:.3,customParameters:[{name:"quality",label:"Quality",type:"select",defaultValue:"low",description:"Choose the quality of image generation.",options:[{value:"low",label:"low"},{value:"medium",label:"medium",multiple:2},{value:"high",label:"high",multiple:8}]},{name:"resolution",label:"Resolution",type:"select",defaultValue:"1k",description:"Choose the resolution to use.",multiple:2,options:[{value:"1k",label:"1k"},{value:"2k",label:"2k"},{value:"4k",label:"4k"}]}],supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!1,isSupport:3}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/text-to-image",rules:[{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"aspect_ratio",from:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}}},{to:"resolution",from:"resolution",transform:[{op:"toString"},{op:"lowercase"},{op:"default",value:"1k"}]},{to:"quality",from:"meta_data.quality",transform:[{op:"toString"},{op:"lowercase"},{op:"default",value:"low"}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/text-to-image",rules:[{when:{lenGte:["control_images",1]},use:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/edit"}]}},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/text-to-image",rules:[{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"aspect_ratio",from:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}}},{to:"resolution",const:"1k"},{to:"quality",const:"low"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/text-to-image",rules:[{when:{lenGte:["control_images",1]},use:"https://api.wavespeed.ai/api/v3/openai/gpt-image-2/edit"}]}},fal:{provider:"fal",endpoint:"openai/gpt-image-2",rules:[{to:"image_urls",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_size",from:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_2K_gpt,default:"auto"}]},{to:"quality",from:"meta_data.quality",transform:[{op:"toString"},{op:"default",value:"low"}]}],endpointSelect:{default:"openai/gpt-image-2",rules:[{when:{lenGte:["control_images",1]},use:"openai/gpt-image-2/edit"}]}},tuzi:{provider:"tuzi",endpoint:"https://api.tu-zi.com/v1/images/generations",rules:[{to:"model",const:"gpt-image-2-vip"},{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"size",from:"aspect_ratio",transform:[{op:"enumMap",map:ec.aspectRatioDimensions_2K_gpt,default:"auto"}]},{to:"quality",from:"meta_data.quality",transform:[{op:"toString"},{op:"lowercase"},{op:"default",value:"low"}]},{to:"response_format",const:"url"}],endpointSelect:{default:"https://api.tu-zi.com/v1/images/generations",rules:[{when:{lenGte:["control_images",1]},use:"https://api.tu-zi.com/v1/images/edits"}]}}}},{id:"z-image-turbo",label:"Z Image",description:"Fast image generation",supportedAspectRatios:["1:1","3:4","4:3","2:3","3:2","4:5","5:4","16:9","9:16","21:9","9:21"],tag:["Text to Image"],badge:["Free to try"],type:"image",provider:["fal"],useCredits:.01,customParameters:[{name:"num_outputs",label:"Number",type:"select",defaultValue:"1",description:"Number of images to generate.",options:[{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"}]}],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/z-image/turbo",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_size.width",from:"width",transform:[{op:"toNumber"}]},{to:"image_size.height",from:"height",transform:[{op:"toNumber"}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"num_images",from:"num_outputs",transform:[{op:"toNumber"}]}]}}},{id:"z-image-turbo-wavespeed",label:"Z Image wavespeed test",description:"Fast image generation",supportedAspectRatios:["1:1","3:4","4:3","2:3","3:2","4:5","5:4","16:9","9:16","21:9","9:21"],tag:["Text to Image"],badge:["Free to try"],type:"image",useCredits:.01,customParameters:[{name:"num_outputs",label:"Number",type:"select",defaultValue:"1",description:"Number of images to generate.",options:[{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/z-image/turbo",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:2048}}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]}]}}}],ew=[{id:"gemini-ai-image",label:"Nano Banana",description:"High-realism portrait image generation and editing model",supportedAspectRatios:["auto","1:1","3:4","4:3","9:16","16:9","2:3","3:2","4:5","5:4","21:9"],tag:["Image to Image","Text to Image"],badge:["Image Edit","Free to try"],type:"image",useCredits:1,customParameters:[{name:"resolution",label:"Resolution",type:"select",defaultValue:"2K",description:"Choose the resolution to use.",multiple:1.5,options:[{value:"2K",label:"2K"},{value:"4K",label:"4K"}]},{name:"model_version",label:"Model Version",type:"select",defaultValue:"banana-v2",multiple:1.6,description:"Specifies the model version. v2 is the latest, while Pro refers to the previous v1 Pro. v2 is faster and more cost-efficient.",options:[{value:"banana-v2",label:"banana v2"},{value:"banana-pro",label:"banana pro"}]}],supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!1,isSupport:6}],apiInputs:{"default-fal":{provider:"fal",endpoint:"fal-ai/gemini-3-pro-image-preview/edit",rules:[{to:"image_urls",from:"control_images",transform:[{op:"slice",start:0,end:6}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}},from:"aspect_ratio"},{to:"resolution",from:"resolution",transform:[{op:"toString"},{op:"default",value:"2K"}]}],endpointSelect:{default:"fal-ai/gemini-3-pro-image-preview/edit",rules:[{when:{not:{lenGte:["control_images",1]}},use:"fal-ai/gemini-3-pro-image-preview"}]}},default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/edit",rules:[{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:6}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}},from:"aspect_ratio"},{to:"resolution",from:"resolution",transform:[{op:"lowercase"},{op:"default",value:"2K"}]},{to:"output_format",const:"png"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/google/nano-banana-pro/edit",rules:[{when:{all:[{equals:["meta_data.model_version","banana-pro"]},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-pro/text-to-image"},{when:{all:[{equals:["meta_data.model_version","banana-pro"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-pro/edit"},{when:{all:[{not:{equals:["meta_data.model_version","banana-pro"]}},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/text-to-image"},{when:{all:[{not:{equals:["meta_data.model_version","banana-pro"]}},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/edit"}]}},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/edit",rules:[{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:6}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"aspect_ratio",when:{not:{equals:["aspect_ratio","auto"]}},from:"aspect_ratio"},{to:"resolution",const:"0.5k"},{to:"output_format",const:"png"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/edit",rules:[{when:{all:[{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/text-to-image"},{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/google/nano-banana-2/edit"}]}}
84,tuzi:{provider:"gemini",endpoint:"https://api.tu-zi.com/v1/chat/completion",options:{provider:"tuzi",endpoints:{tuzi:"https://api.tu-zi.com/v1/chat/completions",type:"completions"}},rules:[{to:"model",from:"resolution",transform:[{op:"toString"},{op:"enumMap",map:{"2K":"gemini-3-pro-image-preview-2k","4K":"gemini-3-pro-image-preview-4k"},default:"gemini-3-pro-image-preview-2k"}]},{to:"stream",const:!1},{to:"messages",from:"raw",transform:[{op:"customFn",fn:"build_messages"}]}]}}}],ex=[{id:"seedream-image",label:"Seedream",description:"Prowerful image editing and reference generation",supportedAspectRatios:["auto","1:1","3:4","4:3","2:3","3:2","16:9","9:16","21:9"],tag:["Image to Image","Text to Image"],badge:["4K","Image Edit","Free to try"],type:"image",useCredits:.4,supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!1,isSupport:6}],customParameters:[{name:"model_version",label:"Model Version",type:"select",defaultValue:"v4.5",description:"Specifies the model version. v5.0 is the latest(beta), while v4.5 is the previous version.",options:[{value:"v5.0",label:"v5.0"},{value:"v4.5",label:"v4.5"}]},{name:"max_images",label:"Max Images",type:"select",defaultValue:"1",multiple:2,description:"The number of images generated at once can be specified in the prompt, Example prompt: I want to generate 2 images. First, transform into Japanese manga style... Second, transform into cyberpunk neon style",options:[{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"},{value:"5",label:"5"},{value:"6",label:"6"}]}],options:{note:ey},apiInputs:{"default-byteplus":{provider:"byteplus",endpoint:"https://ark.ap-southeast.bytepluses.com/api/v3/images/generations",rules:[{to:"model",when:{equals:["meta_data.model_version","v4.5"]},const:"ep-20260222173750-gvqn7"},{to:"model",when:{not:{equals:["meta_data.model_version","v4.5"]}},const:"ep-20260225173250-srcrd"},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"sequential_image_generation",const:"auto"},{to:"sequential_image_generation_options.max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"image",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"size",from:"aspect_ratio",when:{equals:["meta_data.model_version","v4.5"]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream_size,default:"4K"}]},{to:"size",from:"aspect_ratio",when:{not:{equals:["meta_data.model_version","v4.5"]}},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream_size,default:"3K"}]},{to:"response_format",const:"b64_json"},{to:"watermark",const:!1}],endpointSelect:{default:"https://ark.ap-southeast.bytepluses.com/api/v3/images/generations"}},"free-byteplus":{provider:"byteplus",endpoint:"https://ark.ap-southeast.bytepluses.com/api/v3/images/generations",rules:[{to:"model",when:{equals:["meta_data.model_version","v4.5"]},const:"ep-20260222173750-gvqn7"},{to:"model",when:{not:{equals:["meta_data.model_version","v4.5"]}},const:"ep-20260225173250-srcrd"},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"sequential_image_generation",const:"auto"},{to:"sequential_image_generation_options.max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"image",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"size",from:"aspect_ratio",when:{equals:["meta_data.model_version","v4.5"]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream_size,default:"4K"}]},{to:"size",from:"aspect_ratio",when:{not:{equals:["meta_data.model_version","v4.5"]}},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream_size,default:"3K"}]},{to:"response_format",const:"b64_json"},{to:"watermark",const:!1}],endpointSelect:{default:"https://ark.ap-southeast.bytepluses.com/api/v3/images/generations"}},"default-fal":{provider:"fal",endpoint:"fal-ai/bytedance/seedream/v5/lite/text-to-image",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_urls",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"image_size",from:"aspect_ratio",when:{equals:["meta_data.model_version","v4.5"]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream,default:{width:2048,height:2048}}]},{to:"image_size",from:"aspect_ratio",when:{not:{equals:["meta_data.model_version","v4.5"]}},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream,default:{width:2048,height:2048}}]},{to:"max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"fal-ai/bytedance/seedream/v4.5/text-to-image",rules:[{when:{all:[{equals:["meta_data.model_version","v4.5"]},{not:{lenGte:["control_images",1]}}]},use:"fal-ai/bytedance/seedream/v4.5/text-to-image"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{lenGte:["control_images",1]}]},use:"fal-ai/bytedance/seedream/v4.5/edit"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{not:{lenGte:["control_images",1]}}]},use:"fal-ai/bytedance/seedream/v5/lite/text-to-image"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{lenGte:["control_images",1]}]},use:"fal-ai/bytedance/seedream/v5/lite/edit"}]}},"free-fal":{provider:"fal",endpoint:"fal-ai/bytedance/seedream/v4.5/text-to-image",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_urls",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"image_size",from:"aspect_ratio",when:{equals:["meta_data.model_version","v4.5"]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream,default:{width:2048,height:2048}}]},{to:"image_size",from:"aspect_ratio",when:{not:{equals:["meta_data.model_version","v4.5"]}},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream,default:{width:2048,height:2048}}]},{to:"max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"fal-ai/bytedance/seedream/v4.5/text-to-image",rules:[{when:{all:[{equals:["meta_data.model_version","v4.5"]},{not:{lenGte:["control_images",1]}}]},use:"fal-ai/bytedance/seedream/v4.5/text-to-image"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{lenGte:["control_images",1]}]},use:"fal-ai/bytedance/seedream/v4.5/edit"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{not:{lenGte:["control_images",1]}}]},use:"fal-ai/bytedance/seedream/v5/lite/text-to-image"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{lenGte:["control_images",1]}]},use:"fal-ai/bytedance/seedream/v5/lite/edit"}]}},default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/sequential",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"size",from:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}},{not:{equals:["meta_data.model_version","v4.5"]}}]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream_size,default:"3K"}]},{to:"size",from:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}},{equals:["meta_data.model_version","v4.5"]}]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream_size,default:"4K"}]},{to:"max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/sequential",rules:[{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/sequential"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/edit-sequential"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/sequential"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/edit-sequential"}]}},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/sequential",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:6}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"size",from:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}},{not:{equals:["meta_data.model_version","v4.5"]}}]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_3K_seedream_size,default:"3K"}]},{to:"size",from:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}},{equals:["meta_data.model_version","v4.5"]}]},transform:[{op:"enumMap",map:ec.aspectRatioDimensions_4K_seedream_size,default:"4K"}]},{to:"max_images",from:"meta_data.max_images",transform:[{op:"toNumber"},{op:"default",value:1}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/sequential",rules:[{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/sequential"},{when:{all:[{not:{equals:["meta_data.model_version","v4.5"]}},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v5.0-lite/edit-sequential"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/sequential"},{when:{all:[{equals:["meta_data.model_version","v4.5"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedream-v4.5/edit-sequential"}]}}}}
84],e_=[{id:"qwen-image",label:"Qwen Image",description:"Qwen AI image editing and reference generation",supportedAspectRatios:["auto","1:1","3:4","4:3","2:3","3:2","16:9","9:16","21:9","9:21"],tag:["Image to Image","Text to Image"],badge:["Image Edit","Free to try"],type:"image",useCredits:.4,supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!1,isSupport:3}],options:{note:ey},apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/text-to-image",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:2048}}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/text-to-image",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/edit"}]}},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/text-to-image",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:2048}}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/text-to-image",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image-2.0/edit"}]}},"wan-image-version":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/image-edit",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:2048}}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/text-to-image",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/image-edit"}]}}}}
84],ek=[{id:"image-remove-bg-imageutils",label:"Remove Background",description:"Remove background from image",promptSetting:{promptIgnore:!0},tag:["Image to Image"],badge:["Image Edit","Remove Background"],supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],type:"image",provider:["fal"],useCredits:.01,apiInputs:{default:{provider:"fal",endpoint:"fal-ai/imageutils/rembg",rules:[{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]}]},free:{provider:"huggingface",endpoint:"not-lain/background-removal",options:{infer_endpoint:"/image",outputPick:"data.[0].[1].url"},rules:[{to:"image",from:"control_images",transform:[{op:"pick",index:0}]}]}}},{id:"image-upscale-recraft-crisp",label:"Image Upscale",description:"Upscale image",promptSetting:{promptIgnore:!0},tag:["Image to Image"],badge:["Upscale","Image Edit"],supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],type:"image",provider:["fal"],useCredits:.1,apiInputs:{default:{provider:"fal",endpoint:"fal-ai/recraft/upscale/crisp",rules:[{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]}]},free:{provider:"fal",endpoint:"fal-ai/recraft/upscale/crisp",rules:[{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]}]}}},{id:"image-upscale-crystal-upscaler",label:"Image Crystal Upscaler",description:"Upscale image",promptSetting:{promptIgnore:!0},tag:["Image to Image"],badge:["Upscale","Image Edit"],type:"image",provider:["wavespeed"],useCredits:.5,supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],customParameters:[{name:"target_megapixels",label:"Megapixels",type:"select",defaultValue:"4",multiple:2,description:"Choose the target megapixels of the image.",options:[{value:"4",label:"2K (4MP)"},{value:"8",label:"4K (8MP)"},{value:"16",label:"8K (16MP)"},{value:"25",label:"12K (25MP)"},{value:"50",label:"24K (50MP)"},{value:"100",label:"48K (100MP)"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/clarity-ai/crystal-upscaler",rules:[{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"target_megapixels",from:"meta_data.target_megapixels",transform:[{op:"default",value:"4"}]}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/clarity-ai/crystal-upscaler",rules:[{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"target_megapixels",from:"meta_data.target_megapixels",transform:[{op:"default",value:"4"}]}]}}}],eS=[{id:"wan2-2-spicy",label:"Wan spicy",description:"Perfect video generation model for generating unlimited content with vey high quality and smooth animation.",tag:["Image to Video"],badge:["Cinematic"],type:"video",provider:["wavespeed"],useCredits:1.75,supportAddFiles:[{name:"control_images",label:"Start Image",type:"image",isRequired:!0,isSupport:1}],options:{promptEnhanceSettings:ev,note:ey},customParameters:[{name:"duration",label:"Duration",type:"select",defaultValue:"5",description:"Choose the duration of the video.",options:[{value:"5",label:"5 s"},{value:"8",label:"8 s"}]},{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/wan-2.2-spicy/image-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/wan-2.2-spicy/image-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]}]}}},{id:"wan2-2-turbo-image2video",label:"Wan 2.2 Turbo",description:"Fast, cinematic videos",tag:["Image to Video"],badge:["Free to try","Fast"],type:"video",provider:["fal"],supportAddFiles:[{name:"control_images",label:"Start Image",type:"image",isRequired:!0,isSupport:1}],supportedAspectRatios:["auto"],customParameters:[{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]}],options:{note:[{en:["For better results, you can try other models: Wan spicy, Wan 2.6, Seedance, Kling or Hailuo."],"zh-CN":["为äºè·å¾æ´å¥½çææï¼æ¨å¯ä»¥å°è¯å
¶ä»æ¨¡åï¼Wan spicy, Wan 2.6, Seedance, Kling æ Hailuoã"],"zh-TW":["çºäºç²å¾æ´å¥½çææï¼æ¨å¯ä»¥å試å
¶ä»æ¨¡åï¼Wan spicy, Wan 2.6, Seedance, Kling æ Hailuoã"],ja:["ããè¯ãçµæãå¾ãã«ã¯ãä»ã®ã¢ãã«ã試ããã¨ãã§ãã¾ãï¼Wan spicy, Wan 2.6, Seedance, Kling ã¾ã㯠Hailuoã"],fr:["Pour de meilleurs résultats, vous pouvez essayer d'autres modèles : Wan spicy, Wan 2.6, Seedance, Kling ou Hailuo."],de:["Für bessere Ergebnisse können Sie andere Modelle ausprobieren: Wan spicy, Wan 2.6, Seedance, Kling oder Hailuo."],es:["Para obtener mejores resultados, puede probar otros modelos: Wan spicy, Wan 2.6, Seedance, Kling o Hailuo."],ko:["ë ëì ê²°ê
84³¼ë¥¼ ìí´ ë¤ë¥¸ 모ë¸ì ìëí ì ììµëë¤: Wan spicy, Wan 2.6, Seedance, Kling ëë Hailuo."],ru:["ÐÐ»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð»ÑÑÑиÑ
ÑезÑлÑÑаÑов Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе попÑобоваÑÑ Ð´ÑÑгие модели: Wan spicy, Wan 2.6, Seedance, Kling или Hailuo."]}]},useCredits:.75,apiInputs:{default:{provider:"fal",endpoint:"fal-ai/wan/v2.2-a14b/image-to-video/turbo",rules:[...ep,{to:"aspect_ratio",from:"aspect_ratio",transform:[{op:"default",value:"auto"}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"enable_safety_checker",const:!0}]},free:{provider:"huggingface",endpoint:"linoyts/wan2-2-i2v-rCM",options:{infer_endpoint:"/generate_video",outputPick:"data.[0].url"},rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"input_image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"negative_prompt",const:"Vibrant colors, overexposed, static, blurred details, subtitles, style, artwork, painting, image, still, overall gray, worst quality, low quality, JPEG compression residue, ugly, mutilated, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, deformed limbs, fused fingers, still image, cluttered background, three legs, crowded background, walking backwards"},{to:"duration_seconds",const:5},{to:"randomize_seed",const:!0}]}}},{id:"wan-ai-video",label:"Wan AI Video",description:"Generate video with audio",tag:["Image to Video","Text to Video"],badge:["Cinematic"],type:"video",useCredits:1,supportedAspectRatios:["16:9","9:16","1:1"],supportAddFiles:[{name:"control_images",label:"Start Image (Optional)",type:"image",isRequired:!1,isSupport:1},{name:"control_images_2",label:"End Image (Optional)",type:"image",isRequired:!1,isSupport:1},{name:"control_files",label:"Ref Audio (Optional)",type:"audio",isRequired:!1,isSupport:1,options:{maxDuration:15}}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:ey},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:15,step:1},{name:"resolution",label:"Resolution",type:"select",defaultValue:"720p",multiple:1.5,description:"Choose the resolution of the video.",options:[{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]},{name:"prompt_enhance",label:"Prompt Enhance",type:"switch",defaultValue:!0,description:"Whether to enable intelligent prompt enhance"}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/text-to-vi
84deo",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"audio",from:"control_files",transform:[{op:"pick",index:0}]},{when:{lenGte:["control_images",1]},to:"last_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"720p"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{when:{not:{lenGte:["control_images",1]}},to:"aspect_ratio",from:"aspect_ratio",transform:[{op:"default",value:"16:9"}]},{to:"enable_prompt_expansion",from:"meta_data.prompt_enhance",transform:[{op:"default",value:!1}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/text-to-video",rules:[{when:{lenGte:["control_images",1]},use:"https://api.wavespeed.ai/api/v3/alibaba/wan-2.7/image-to-video"}]}},"fal-2-6":{provider:"fal",endpoint:"wan/v2.6/text-to-video",rules:[...ep,{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"audio_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toString"},{op:"default",value:"5"}]},{when:{not:{lenGte:["control_images",1]}},to:"aspect_ratio",from:"aspect_ratio",transform:[{op:"default",value:"16:9"}]},{to:"multi_shots",from:"meta_data.multi_shots",transform:[{op:"default",value:!1}]}],endpointSelect:{default:"wan/v2.6/text-to-video",rules:[{when:{lenGte:["control_images",1]},use:"wan/v2.6/image-to-video"}]}}}}],ej=[{id:"Hailuo-v2",label:"Hailuo V2.3",description:"Smooth motion, Good quality",tag:["Image to Video","Text to Video"],badge:["High Quality"],type:"video",provider:["fal"],useCredits:3,supportAddFiles:[{name:"control_images",label:"Start Image",type:"image",isRequired:!1,isSupport:1}],options:{promptEnhanceSettings:ev,note:ey},customParameters:[{name:"version",label:"Version",type:"select",defaultValue:"standard",multiple:2,description:"Choose the version of the Model.",options:[{value:"standard",label:"Standard"},{value:"pro",label:"Pro"}]},{name:"duration",label:"Duration",type:"select",defaultValue:"6",description:"Choose the duration of the video.",options:[{value:"6",label:"6"}]}],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/minimax/hailuo-2.3/standard/text-to-vi
84deo",rules:[...ep,{to:"duration",from:"duration",when:{equals:["meta_data.version","standard"]},transform:[{op:"toString"},{op:"default",value:"6"}]}],endpointSelect:{default:"fal-ai/minimax/hailuo-2.3/standard/text-to-video",rules:[{when:{all:[{not:{lenGte:["control_images",1]}},{equals:["meta_data.version","pro"]}]},use:"fal-ai/minimax/hailuo-2.3/pro/text-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","standard"]}]},use:"fal-ai/minimax/hailuo-2.3/standard/image-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","pro"]}]},use:"fal-ai/minimax/hailuo-2.3/pro/image-to-video"}]}}}}],eC=[{id:"kling-v3-ai-video",label:"Kling V3 AI Video",description:"High quality, realistic videos",tag:["Image to Video","Text to Video"],badge:["Realistic"],supportedAspectRatios:["16:9","9:16","1:1"],type:"video",useCredits:.8,supportAddFiles:[{name:"control_images",label:"Start Frame",type:"image",isRequired:!1,isSupport:1},{name:"control_images_2",label:"End Frame (Optional)",type:"image",isRequired:!1,isSupport:1}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:[]},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:3,max:15,step:1},{name:"version",label:"Version",type:"select",defaultValue:"standard",description:"Choose the version of the Model.",multiple:1.5,options:[{value:"standard",label:"Standard"},{value:"pro",label:"Pro"}]},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!1,multiple:1.5,description:"Whether to generate audio for the video."}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/text-to-vi
84deo",rules:[{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{when:{lenGte:["control_images",1]},to:"end_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"aspect_ratio",when:{all:[{not:{lenGte:["control_images",1]}},{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"sound",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/text-to-video",rules:[{when:{all:[{equals:["meta_data.version","pro"]},{not:{lenGte:["control_images",1]}}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-pro/text-to-video"},{when:{all:[{equals:["meta_data.version","standard"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/image-to-video"},{when:{all:[{equals:["meta_data.version","pro"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-pro/image-to-video"}]}}}},{id:"kling-o3-ai-video",label:"Kling O3 Reference Video",description:"High quality, realistic videos",tag:["Image to Video","Reference to Video","Text to Video"],badge:["Realistic"],supportedAspectRatios:["16:9","9:16","1:1"],type:"video",useCredits:1.2,supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:3}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:3,max:15,step:1},{name:"version",label:"Version",type:"select",defaultValue:"standard",description:"Choose the version of the Model.",multiple:1.5,options:[{value:"standard",label:"Standard"},{value:"pro",label:"Pro"}]},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!1,multiple:1.25,description:"Whether to generate audio for the video."}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-video-o3-std/reference-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"images",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"sound",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-video-o3-std/reference-to-video",rules:[{when:{all:[{equals:["meta_data.version","standard"]}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-video-o3-std/reference-to-video"},{when:{all:[{equals:["meta_data.version","pro"]}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-video-o3-pro/reference-to-video"}]}}}}],eI=[{id:"veo-video",label:"Veo3.1",description:"High quality, storytelling, cinematic videos",tag:["Image to Video","Text to Video"],supportedAspectRatios:["9:16","16:9"],badge:["High Quality","Cinematic","With audio"],type:"video",provider:["fal"],useCredits:4,options:{promptEnhanceSettings:ev},supportAddFiles:[{name:"control_images",label:"Start Image",type:"image",isRequired:!1,isSupport:1},{name:"control_images_2",label:"End Image",type:"image",isRequired:!1,isSupport:1}],customParameters:[{name:"version",label:"Version",type:"select",defaultValue:"fast",description:"Choose the version of the Model.",multiple:2.5,options:[{value:"fast",label:"Fast"},{value:"pro",label:"Pro"}]},{name:"duration",label:"Duration",type:"select",defaultValue:"4",description:"Choose the duration of the video.",options:[{value:"4",label:"4"},{value:"8",label:"8"}]},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!0,multiple:1.5,description:"Whether to generate audio for the video."},{name:"video_resolution",label:"Resolution",type:"select",defaultValue:"720p",description:"Choose the resolution of the video.",options:[{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/google/veo3.1-fast/text-to-vi
84deo",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:4}]},{to:"resolution",from:"meta_data.video_resolution",transform:[{op:"default",value:"720p"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]},{when:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]}]},to:"last_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},to:"aspect_ratio",from:"aspect_ratio",transform:[{op:"default",value:"9:16"}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/google/veo3.1-fast/text-to-video",rules:[{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","fast"]}]},use:"https://api.wavespeed.ai/api/v3/google/veo3.1-fast/image-to-video"},{when:{all:[{not:{lenGte:["control_images",1]}},{equals:["meta_data.version","pro"]}]},use:"https://api.wavespeed.ai/api/v3/google/veo3.1/text-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","pro"]}]},use:"https://api.wavespeed.ai/api/v3/google/veo3.1/image-to-video"}]}},"default-fal":{provider:"fal",endpoint:"fal-ai/veo3.1/fast",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"duration",from:"duration",transform:[{op:"toString"},{op:"default",value:"4s"}]},{to:"auto_fix",const:!0},{to:"resolution",const:"1080p"},{when:{all:[{lenGte:["control_images",1]},{not:{lenGte:["control_images_2",1]}}]},to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]},{when:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]}]},to:"first_frame_url",from:"control_images",transform:[{op:"pick",index:0}]},{when:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]}]},to:"last_frame_url",from:"control_images_2",transform:[{op:"pick",index:0}]},{when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},to:"aspect_ratio",from:"aspect_ratio",transform:[{op:"default",value:"9:16"}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!1}]}],endpointSelect:{default:"fal-ai/veo3.1/fast",rules:[{when:{all:[{lenGte:["control_images",1]},{not:{lenGte:["control_images_2",1]}},{equals:["meta_data.version","fast"]}]},use:"fal-ai/veo3.1/fast/image-to-video"},{when:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]},{equals:["meta_data.version","fast"]}]},use:"fal-ai/veo3.1/fast/first-last-frame-to-video"},{when:{all:[{not:{lenGte:["control_images",1]}},{equals:["meta_data.version","pro"]}]},use:"fal-ai/veo3.1"},{when:{all:[{lenGte:["control_images",1]},{not:{lenGte:["control_images_2",1]}},{equals:["meta_data.version","pro"]}]},use:"fal-ai/veo3.1/image-to-video"},{when:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]},{equals:["meta_data.version","pro"]}]},use:"fal-ai/veo3.1/first-last-frame-to-video"}]}},free:{provider:"tuzi",endpoint:"https://api.tu-zi.com/v1/videos",rules:[{to:"model",from:"meta_data.model_type",transform:[{op:"enumMap",map:{standard:"veo3.1",pro:"veo3.1"},default:"veo3.1"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"seconds",const:"8"},{to:"input_reference",from:"control_images",transform:[{op:"pick",index:0},{op:"toFile"}]},{to:"input_reference",from:"control_images_2",transform:[{op:"pick",index:0},{op:"toFile"}]},{to:"size",from:"aspect_ratio",when:{not:{all:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]}]}},transform:[{op:"enumMap",map:{"9:16":"720x1280","16:9":"1280x720"},default:"1280x720"}]}]}}}],eN=[{id:"seedance-v1",label:"Seedance V1.5 Pro",description:"Smooth motion, Audio Support",tag:["Image to Video","Text to Video"],badge:["High Quality"],type:"video",useCredits:.15,supportedAspectRatios:["auto","9:16","16:9","1:1","4:3","3:4"],supportAddFiles:[{name:"control_images",label:"Start Image (Optional)",type:"image",isRequired:!1,isSupport:1},{name:"control_images_2",label:"End Image (Optional)",type:"image",isRequired:!1,isSupport:1}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:ey},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:12,step:1},{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]},{name:"camera_fixed",label:"Camera Fixed",type:"switch",defaultValue:!1,description:"Choose the camera fixed of the video."},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!1,multiple:2,description:"Whether to generate audio for the video."}],apiInputs:{default:{provider:"byteplus",endpoint:"https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks",rules:[{to:"model",const:"seedance-1-5-pro-251215"},{to:"content",from:"raw",transform:[{op:"customFn",fn:"build_byteplus_content"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"camera_fixed",from:"meta_data.camera_fixed",transform:[{op:"default",value:!1}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!0}]},{to:"watermark",const:!1}],endpointSelect:{default:"https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks"}},"free-":{provider:"byteplus",endpoint:"https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks",rules:[{to:"model",const:"ep-20260222164326-j8ppq"},{to:"content",from:"raw",transform:[{op:"customFn",fn:"build_byteplus_content"}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"camera_fixed",from:"meta_data.camera_fixed",transform:[{op:"default",value:!1}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!0}]},{to:"watermark",const:!1}],endpointSelect:{default:"https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks"}},"default-wavespeed":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/image-to-vi
84deo",rules:[{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{when:{lenGte:["control_images",1]},to:"last_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"camera_fixed",from:"meta_data.camera_fixed",transform:[{op:"default",value:!1}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/text-to-video",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/image-to-video"}]}},"free-wavespeed":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/image-to-video",rules:[{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{when:{lenGte:["control_images",1]},to:"last_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"camera_fixed",from:"meta_data.camera_fixed",transform:[{op:"default",value:!1}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/text-to-vi
84deo",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-v1.5-pro/image-to-video"}]}}}},{id:"seedance-2",label:"Seedance V2",description:"Latest model from Bytedance",tag:["Image to Video","Text to Video"],badge:["Best Quality"],type:"video",useCredits:1.2,supportedAspectRatios:["auto","9:16","16:9","1:1","4:3","3:4"],supportAddFiles:[{name:"control_images",label:"Start Image (Optional)",type:"image",isRequired:!1,isSupport:1},{name:"control_images_2",label:"End Image (Optional)",type:"image",isRequired:!1,isSupport:1}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:[{en:["This model may take longer to generate. If a timeout occurs, please check your result later in âCreationsâ.","Please note this model enforces stricter content policies.","Inputs with real human images will be rejected. We recommend using storyboard images instead of a single real human image."],"zh-CN":["该模åçææ¶é´è¾é¿ãå¦éè¶
æ¶ï¼è¯·ç¨åå¨ãCreationsã䏿¥çç»æã","请注æï¼è¯¥æ¨¡å对è¾å
¥åçæå
å®¹ææ´ä¸¥æ ¼çéå¶ã","ç´æ¥è¾å
¥ç人å¾çä¼è¢«æç»ï¼å»ºè®®ä½¿ç¨æ
äºæ¿çå¾çæ¥æ¿ä»£åä¸çç人形象ã"],"zh-TW":["æ¤æ¨¡åçææéè¼é·ãå¦é龿ï¼è«ç¨å¾å¨ãCreationsã䏿¥ççµæã","è«æ³¨æï¼æ¤æ¨¡åå°è¼¸å
¥èçæå
§å®¹æè¼å´æ ¼çéå¶ã","ç´æ¥è¼¸å
¥ç人åçæè¢«æçµï¼å»ºè°ä½¿ç¨æ
äºæ¿çåç便¿ä»£å®ä¸çç人形象ã"],ja:["ãã®ã¢ãã«ã¯çæã«æéããããå ´åãããã¾ããã¿ã¤ã ã¢ã¦ãããå ´åã¯ããCreationsãã§å¾ã»ã©çµæãã確èªãã ããã","ãã®ã¢ãã«ã¯å
¥åããã³çæå
容ã«å¯¾ãã¦ããå³ããå¶éãããã¾ãã","å®å¨ã®äººç©ãå«ã¾ããç»åå
¥åã¯æå¦ããã¾ããåä¸ã®äººç©ç»åã®ä»£ããã«ãçµµã³ã³ãï¼ã¹ãã¼ãªã¼ãã¼ãï¼ã®ç»åã使ç¨ãããã¨ããå§ããã¾ãã"],fr:["Ce modèle peut prendre plus de temps pour générer. En cas de délai dépassé, veuillez vérifier votre résultat plus tard dans « Creations ».","Veuillez noter que ce modèle applique des règles de modération plus strictes.","Les images contenant de vraies personnes seront refusées. Il est recommandé d'utiliser des images de storyboard au lieu d'une seule image de personne réelle."],de:["Dieses Modell benötigt möglicherweise mehr Zeit für die Generierung. Bei einem Timeout prüfen Sie bitte später Ihre Ergebnisse unter âCreationsâ.","Bitte beachten Sie, dass dieses Modell strengere Inhaltsrichtlinien durchsetzt.","Eingaben mit echten Personenbildern werden abgelehnt. Es wird empfohlen, stattdessen Storyboard-Bilder anstelle eines einzelnen echten Menschenbildes zu verwenden."],es:["Este modelo puede tardar más en generar. Si se produce un tiempo de espera, revise el resultado más tarde en «Creations».","Tenga en cuenta que este modelo aplica polÃticas de contenido más estrictas.","Las imágenes con personas reales serán rechazadas. Se recomienda utilizar imágenes de guiones gráficos en lugar de una sola imagen de una persona real."],ko:["ì´ ëª¨ë¸ì ìì±ì ë ë§ì ìê°ì´ 걸릴 ì ììµëë¤. ìê° ì´ê³¼ê° ë°ìíë©´ ëì¤ì «Creations»ìì 결과를 íì¸íì¸ì.","ì´ ëª¨ë¸ì ì
ë ¥ ë° ìì± ì½í
ì¸ ì ëí´ ë ì격í ì íì´ ì ì©ë©ëë¤.","ì¤ì ì¸ë¬¼ì´ í¬í¨ë ì´ë¯¸ì§ë ê±°ë¶ë©ëë¤. ë¨ì¼ ì¤ì ì¸ë¬¼ ì´ë¯¸ì§ ëì ì¤í 리보ë ì´ë¯¸ì§ë¥¼ ì¬ì©íë ê²ì´ ì¢ìµëë¤."],ru:["ÐÑа Ð¼Ð¾Ð´ÐµÐ»Ñ Ð¼Ð¾Ð¶ÐµÑ Ð³ÐµÐ½ÐµÑиÑоваÑÑ Ð´Ð¾Ð»ÑÑе. Ð ÑлÑÑае Ñайм-аÑÑа пÑовеÑÑÑе ÑезÑлÑÑÐ°Ñ Ð¿Ð¾Ð·Ð¶Ðµ в Ñазделе «Creations».","ÐбÑаÑиÑе внимание, ÑÑо Ñ ÑÑой модели более ÑÑÑогие огÑаниÑÐµÐ½Ð¸Ñ Ð½Ð° ввод и ÑоздаваемÑй конÑенÑ.","ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ñ ÑеалÑнÑми лÑдÑми бÑдÑÑ Ð¾ÑклоненÑ. РекомендÑеÑÑÑ Ð¸ÑполÑзоваÑÑ Ð¸Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑаÑкадÑовки вмеÑÑо одного изобÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑеалÑного Ñеловека."]}]},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:15,step:5},{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]},{name:"version",label:"Version",type:"select",defaultValue:"standard",multiple:1.25,description:"Choose the version of the Model.",options:[{value:"fast",label:"Fast"},{value:"standard",label:"Standard"}]}],apiInputs:{default:{provider:"fal",endpoint:"bytedance/seedance-2.0/fast/text-to-vi
84deo",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"end_image_url",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toString"},{op:"default",value:"5"}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"bytedance/seedance-2.0/fast/text-to-video",rules:[{when:{all:[{not:{lenGte:["control_images",1]}},{equals:["meta_data.version","standard"]}]},use:"bytedance/seedance-2.0/text-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","fast"]}]},use:"bytedance/seedance-2.0/fast/image-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","standard"]}]},use:"bytedance/seedance-2.0/image-to-video"}]}},"default-wavespeed":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0-fast/text-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"last_image",from:"control_images_2",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0-fast/text-to-video",rules:[{when:{all:[{not:{lenGte:["control_images",1]}},{equals:["meta_data.version","standard"]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0/text-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","fast"]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0-fast/image-to-video"},{when:{all:[{lenGte:["control_images",1]},{equals:["meta_data.version","standard"]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0/image-to-video"}]}},"default-evolink":{provider:"evolink",endpoint:"https://api.evolink.ai/v1/videos/generations",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_urls",from:["control_images","control_images_2"],transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:2}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"quality",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{when:{all:[{not:{lenGte:["control_images",1]}},{not:{lenGte:["control_images_2",1]}}]},to:"model",from:"meta_data.version",transform:[{op:"enumMap",map:{fast:"seedance-2.0-fast-text-to-vi
84deo",standard:"seedance-2.0-text-to-video"},default:"seedance-2.0-fast-text-to-video"}]},{when:{any:[{lenGte:["control_images",1]},{lenGte:["control_images_2",1]}]},to:"model",from:"meta_data.version",transform:[{op:"enumMap",map:{fast:"seedance-2.0-fast-image-to-video",standard:"seedance-2.0-image-to-video"},default:"seedance-2.0-fast-image-to-video"}]},{to:"generate_audio",const:!0}],endpointSelect:{default:"https://api.evolink.ai/v1/videos/generations",rules:[]}}}},{id:"seedance-ref",label:"Seedance V2 Reference",description:"Latest model from Bytedance",tag:["Image to Video","Text to Video"],badge:["Best Quality"],type:"video",useCredits:1.2,supportedAspectRatios:["auto","9:16","16:9","1:1"],supportAddFiles:[{name:"control_images",label:"Reference Image (Optional)",type:"image",isRequired:!1,isSupport:3},{name:"control_files",label:"Reference Video (Optional)",type:"video",isRequired:!1,isSupport:1,options:{maxDuration:14.5}},{name:"control_files_2",label:"Reference Audio (Optional)",type:"audio",isRequired:!1,isSupport:1,options:{maxDuration:14.5}}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:[{en:["This model may take longer to generate. If a timeout occurs, please check your result later in âCreationsâ.","Please note this model enforces stricter content policies.","Inputs with real human images will be rejected. We recommend using storyboard images instead of a single real human image."],"zh-CN":["该模åçææ¶é´è¾é¿ãå¦éè¶
æ¶ï¼è¯·ç¨åå¨ãCreationsã䏿¥çç»æã","请注æï¼è¯¥æ¨¡å对è¾å
¥åçæå
å®¹ææ´ä¸¥æ ¼çéå¶ã","ç´æ¥è¾å
¥ç人å¾çä¼è¢«æç»ï¼å»ºè®®ä½¿ç¨æ
äºæ¿çå¾çæ¥æ¿ä»£åä¸çç人形象ã"],"zh-TW":["æ¤æ¨¡åçææéè¼é·ãå¦é龿ï¼è«ç¨å¾å¨ãCreationsã䏿¥ççµæã","è«æ³¨æï¼æ¤æ¨¡åå°è¼¸å
¥èçæå
§å®¹æè¼å´æ ¼çéå¶ã","ç´æ¥è¼¸å
¥ç人åçæè¢«æçµï¼å»ºè°ä½¿ç¨æ
äºæ¿çåç便¿ä»£å®ä¸çç人形象ã"],ja:["ãã®ã¢ãã«ã¯çæã«æéããããå ´åãããã¾ããã¿ã¤ã ã¢ã¦ãããå ´åã¯ããCreationsãã§å¾ã»ã©çµæãã確èªãã ããã","ãã®ã¢ãã«ã¯å
¥åããã³çæå
容ã«å¯¾ãã¦ããå³ããå¶éãããã¾ãã","å®å¨ã®äººç©ãå«ã¾ããç»åå
¥åã¯æå¦ããã¾ããåä¸ã®äººç©ç»åã®ä»£ããã«ãçµµã³ã³ãï¼ã¹ãã¼ãªã¼ãã¼ãï¼ã®ç»åã使ç¨ãããã¨ããå§ããã¾ãã"],fr:["Ce modèle peut prendre plus de temps pour générer. En cas de délai dépassé, veuillez vérifier votre résultat plus tard dans « Creations ».","Veuillez noter que ce modèle applique des règles de modération plus strictes.","Les images contenant de vraies personnes seront refusées. Il est recommandé d'utiliser des images de storyboard au lieu d'une seule image de personne réelle."],de:["Dieses Modell benötigt möglicherweise mehr Zeit für die Generierung. Bei einem Timeout prüfen Sie bitte später Ihre Ergebnisse unter âCreationsâ.","Bitte beachten Sie, dass dieses Modell strengere Inhaltsrichtlinien durchsetzt.","Eingaben mit echten Personenbildern werden abgelehnt. Es wird empfohlen, stattdessen Storyboard-Bilder anstelle eines einzelnen echten Menschenbildes zu verwenden."],es:["Este modelo puede tardar más en generar. Si se produce un tiempo de espera, revise el resultado más tarde en «Creations».","Tenga en cuenta que este modelo aplica polÃticas de contenido más estrictas.","Las imágenes con personas reales serán rechazadas. Se recomienda utilizar imágenes de guiones gráficos en lugar de una sola imagen de una persona real."],ko:["ì´ ëª¨ë¸ì ìì±ì ë ë§ì ìê°ì´ 걸릴 ì ììµëë¤. ìê° ì´ê³¼ê° ë°ìíë©´ ëì¤ì «Creations»ìì 결과를 íì¸íì¸ì.","ì´ ëª¨ë¸ì ì
ë ¥ ë° ìì± ì½í
ì¸ ì ëí´ ë ì격í ì íì´ ì ì©ë©ëë¤.","ì¤ì ì¸ë¬¼ì´ í¬í¨ë ì´ë¯¸ì§ë ê±°ë¶ë©ëë¤. ë¨ì¼ ì¤ì ì¸ë¬¼ ì´ë¯¸ì§ ëì ì¤í 리보ë ì´ë¯¸ì§ë¥¼ ì¬ì©íë ê²ì´ ì¢ìµëë¤."],ru:["ÐÑа Ð¼Ð¾Ð´ÐµÐ»Ñ Ð¼Ð¾Ð¶ÐµÑ Ð³ÐµÐ½ÐµÑиÑоваÑÑ Ð´Ð¾Ð»ÑÑе. Ð ÑлÑÑае Ñайм-аÑÑа пÑовеÑÑÑе ÑезÑлÑÑÐ°Ñ Ð¿Ð¾Ð·Ð¶Ðµ в Ñазделе «Creations».","ÐбÑаÑиÑе внимание, ÑÑо Ñ ÑÑой модели более ÑÑÑогие огÑаниÑÐµÐ½Ð¸Ñ Ð½Ð° ввод и ÑоздаваемÑй конÑенÑ.","ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ñ ÑеалÑнÑми лÑдÑми бÑдÑÑ Ð¾ÑклоненÑ. РекомендÑеÑÑÑ Ð¸ÑполÑзоваÑÑ Ð¸Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑаÑкадÑовки вмеÑÑо одного изобÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑеалÑного Ñеловека."]}]},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:15,step:1},{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]},{name:"version",label:"Version",type:"select",defaultValue:"standard",multiple:1.25,description:"Choose the version of the Model.",options:[{value:"fast",label:"Fast"},{value:"standard",label:"Standard"}]}],apiInputs:{default:{provider:"fal",endpoint:"bytedance/seedance-2.0/fast/reference-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_urls",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"video_urls",from:"control_files",transform:[{op:"slice",start:0,end:1}]},{to:"audio_urls",from:"control_files_2",transform:[{op:"slice",start:0,end:1}]},{to:"duration",from:"duration",transform:[{op:"toString"},{op:"default",value:"5"}
84]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"}],endpointSelect:{default:"bytedance/seedance-2.0/fast/reference-to-video",rules:[{when:{all:[{equals:["meta_data.version","standard"]}]},use:"bytedance/seedance-2.0/reference-to-video"}]}},"default-wavespeed":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0-fast/text-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"reference_images",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"reference_videos",from:"control_files",transform:[{op:"slice",start:0,end:1}]},{to:"reference_audios",from:"control_files_2",transform:[{op:"slice",start:0,end:1}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0-fast/text-to-video",rules:[{when:{all:[{equals:["meta_data.version","standard"]}]},use:"https://api.wavespeed.ai/api/v3/bytedance/seedance-2.0/text-to-video"}]}},"default-evolink":{provider:"evolink",endpoint:"https://api.evolink.ai/v1/videos/generations",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_urls",from:"control_images",transform:[{op:"slice",start:0,end:3}]},{to:"video_urls",from:"control_files",transform:[{op:"slice",start:0,end:1}]},{to:"audio_urls",from:"control_files_2",transform:[{op:"slice",start:0,end:1}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"quality",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"aspect_ratio",when:{all:[{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"model",from:"meta_data.version",transform:[{op:"enumMap",map:{fast:"seedance-2.0-fast-reference-to-video",standard:"seedance-2.0-reference-to-video"},default:"seedance-2.0-fast-reference-to-video"}]},{to:"generate_audio",const:!0}],endpointSelect:{default:"https://api.evolink.ai/v1/videos/generations",rules:[]}}}}],eA=[{id:"vidu",label:"Vidu",description:"Smooth motion, Audio Support",tag:["Image to Video","Text to Video"],badge:["High Quality"],type:"video",useCredits:.8,supportedAspectRatios:["auto","9:16","16:9","1:1","4:3","3:4"],supportAddFiles:[{name:"control_images",label:"Start Frame",type:"image",isRequired:!1,isSupport:1}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:ey},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:16,step:1},{name:"resolution",label:"Resolution",type:"select",defaultValue:"540p",description:"Choose the resolution of the video.",options:[{value:"540p",label:"540p"},{value:"1080p",label:"1080p"}]},{name:"version",label:"Version",type:"select",defaultValue:"standard",description:"Choose the version of the Model.",options:[{value:"standard",label:"Standard"},{value:"spicy",label:"Spicy"}]},{name:"movement_amplitude",label:"Movement Amplitude",type:"select",defaultValue:"auto",description:"Choose the movement amplitude of the video.",options:[{value:"auto",label:"auto"},{value:"small",label:"small"},{value:"medium",label:"medium"},{value:"large",label:"large"}]},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!0,description:"Whether to generate audio for the video."},{name:"bgm",label:"BGM",type:"switch",defaultValue:!0,description:"Whether to generate BGM for the video."}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/vidu/q3/text-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"540p"}]},{to:"aspect_ratio",when:{all:[{not:{lenGte:["control_images",1]}},{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"bgm",from:"meta_data.bgm",transform:[{op:"default",value:!0}]},{to:"generate_audio",from:"meta_data.generate_audio",transform:[{op:"default",value:!0}]},{to:"movement_amplitude",from:"meta_data.movement_amplitude",transform:[{op:"default",value:"auto"}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/vidu/q3/text-to-vi
84deo",rules:[{when:{all:[{equals:["meta_data.version","standard"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/vidu/q3/image-to-video"},{when:{all:[{equals:["meta_data.version","spicy"]},{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/vidu/q3/image-to-video-spicy"}]}}}}],eT=[{id:"grok",label:"Grok",description:"Grok AI Video Generator",tag:["Image to Video","Text to Video"],badge:["High Quality"],type:"video",useCredits:.5,supportedAspectRatios:["auto","9:16","16:9","1:1","4:3","3:4"],supportAddFiles:[{name:"control_images",label:"Start Frame",type:"image",isRequired:!1,isSupport:1}],options:{creditBySecond:!0,creditsByControl:"duration",promptEnhanceSettings:ev,note:ey},customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:6,description:"Choose the duration of the video.",min:6,max:10,step:4}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/x-ai/grok-imagine-video/text-to-video",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"duration",from:"duration",transform:[{op:"toNumber"},{op:"default",value:5}]},{to:"resolution",from:"resolution",transform:[{op:"default",value:"720p"}]},{to:"aspect_ratio",when:{all:[{not:{lenGte:["control_images",1]}},{not:{equals:["aspect_ratio","auto"]}}]},from:"aspect_ratio"},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/x-ai/grok-imagine-video/text-to-vi
84deo",rules:[{when:{all:[{lenGte:["control_images",1]}]},use:"https://api.wavespeed.ai/api/v3/x-ai/grok-imagine-video/image-to-video"}]}}}}],eE=[{id:"infinite-talk-lipsync",label:"Avatar Talk Lipsync (Image)",description:"Image-to-video that turns any image into a talking video, 0.4 credits/s",tag:["Lipsync"],badge:["avatar lipsync"],type:"video",provider:["wavespeed"],useCredits:.4,options:{creditBySecond:!0,creditsByControl:"control_files",...em},promptSetting:{promptNotRequired:!0},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1},{name:"control_files",label:"Ref Audio",type:"audio",isRequired:!0,isSupport:1,options:{maxDuration:120}}],customParameters:[{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/infinitetalk",rules:[{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"audio",from:"control_files",transform:[{op:"pick",index:0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/infinitetalk",rules:[{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"audio",from:"control_files",transform:[{op:"pick",index:0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]}}},{id:"infinite-talk-lipsync-v2v",label:"Avatar Talk Lipsync (Video)",description:"video-to-video that turns any video into a talking video, 0.4 credits/s",tag:["Lipsync"],badge:["avatar lipsync"],type:"video",provider:["wavespeed"],useCredits:.4,options:{creditBySecond:!0,creditsByControl:"control_files_2",...eh},promptSetting:{promptNotRequired:!0},supportAddFiles:[{name:"control_files",label:"Reference Video",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:120}},{name:"control_files_2",label:"Ref Audio",type:"audio",isRequired:!0,isSupport:1,options:{maxDuration:120}}],customParameters:[{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/infinitetalk/video-to-video",rules:[{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]},{to:"audio",from:"control_files_2",transform:[{op:"pick",index:0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/infinitetalk/video-to-video",rules:[{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]},{to:"audio",from:"control_files_2",transform:[{op:"pick",index:0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]}}},{id:"heygen-lipsync-video",label:"Heygen Video Lipsync ",description:"Generate realistic lipsync animations from audio with Heygen Lipsync, 0.05 credits/s",tag:["Lipsync"],badge:["Good Quality"],type:"video",provider:["fal"],useCredits:.5,promptSetting:{promptIgnore:!0},options:{creditBySecond:!0,creditsByControl:"control_files_2",...eh},supportAddFiles:[{name:"control_files",label:"Ref Video",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:90}},{name:"control_files_2",label:"Ref Audio",type:"audio",isRequired:!0,isSupport:1,options:{maxDuration:90}}],customParameters:[{name:"version",label:"Version",type:"select",defaultValue:"speed",description:"How to handle video-audio length mismatches.",multiple:2,options:[{value:"speed",label:"Speed"},{value:"precision",label:"Precision"}]}],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/heygen/v3/lipsync/speed",rules:[{to:"video_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"audio_url",from:"control_files_2",transform:[{op:"pick",index:0}]}],endpointSelect:{default:"fal-ai/heygen/v3/lipsync/speed",rules:[{when:{all:[{equals:["meta_data.version","precision"]}]},use:"fal-ai/heygen/v3/lipsync/precision"}]}},free:{provider:"fal",endpoint:"fal-ai/heygen/v3/lipsync/speed",rules:[{to:"video_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"audio_url",from:"control_files_2",transform:[{op:"pick",index:0}]}]}}},{id:"wan2-2-animate",label:"wan animate",description:"Character animation, 0.5 credits/s",tag:["Video to Video"],badge:["Talking Avatar","Video Motion Transfer"],type:"video",provider:["wavespeed"],options:{creditBySecond:!0,creditsByControl:"control_files",note:[{en:["For better results, we recommend the reference image and video only have one person and whole body is visible"],"zh-CN":["为äºè·å¾æ´å¥½çææï¼æä»¬å»ºè®®åèå¾ååè§é¢ä¸ä»
84å
å«ä¸ä¸ªäººä¸å
¨èº«å¯è§ã"],"zh-TW":["çºäºç²å¾æ´å¥½çææï¼æå建è°åèåååè¦é »ä¸å
å
å«ä¸å人ä¸å
¨èº«å¯è¦ã"],ja:["ããè¯ãçµæãå¾ãã«ã¯ãåç
§ç»åã¨åç»ã«äººç©ã1人ã®ã¿ã§ãå
¨èº«ãåã£ã¦ãããã¨ããå§ããã¾ãã"],fr:["Pour de meilleurs résultats, nous recommandons que l'image et la vidéo de référence ne montrent qu'une seule personne et que le corps entier soit visible."],de:["Für bessere Ergebnisse empfehlen wir, dass das Referenzbild und -video nur eine Person zeigen und der ganze Körper sichtbar ist."],es:["Para obtener mejores resultados, recomendamos que la imagen y el video de referencia solo tengan una persona y que todo el cuerpo sea visible."],ko:["ë ëì 결과를 ìí´ ì°¸ì¡° ì´ë¯¸ì§ì ë¹ëì¤ì í ëª
ì ì¬ëë§ ìê³ ì ì ì´ ë³´ì´ë ê²ì ê¶ì¥í©ëë¤."],ru:["ÐÐ»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð»ÑÑÑиÑ
ÑезÑлÑÑаÑов Ð¼Ñ ÑекомендÑем, ÑÑÐ¾Ð±Ñ Ð½Ð° ÑÑалонном изобÑажении и видео бÑл ÑолÑко один Ñеловек и бÑло видно вÑе Ñело."]}]},promptSetting:{promptNotRequired:!0},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1},{name:"control_files",label:"Ref Video",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:20}}],customParameters:[{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]},{name:"mode",label:"Mode",type:"select",defaultValue:"replace",options:[{value:"animate",label:"Animate the character in the image based on the ref video"},{value:"replace",label:"Replace the character in the ref video"}]}],useCredits:.5,apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/wan-2.2/animate",rules:[{to:"resolution",from:"resolution",transform:[{op:"default",value:"480p"}]},{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]},{to:"mode",from:"meta_data.mode",transform:[{op:"default",value:"animate"}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]}}},{id:"kling-motion-control",label:"Kling Motion Control",description:"Video motion transfer, 1.3 credits/s",tag:["Video to Video"],badge:["Video Motion Transfer"],type:"video",options:{creditBySecond:!0,creditsByControl:"control_files",note:[{en:["For best results, we recommend that the reference images and videos include full-body."],"zh-CN":["为äºè·å¾æä½³ææï¼æä»¬å»ºè®®åèå¾ååè§é¢å
å«å
¨èº«ã"],"zh-TW":["çºäºç²å¾æä½³ææï¼æå建è°åèåååè¦é »å
å«å
¨èº«ã"],ja:["æè¯ã®çµæãå¾ãã«ã¯ãåç
§ç»åã¨åç»ã«å
¨èº«ãå«ã¾ãã¦ãããã¨ããå§ããã¾ãã"],fr:["Pour de meilleurs résultats, nous recommandons que les images et vidéos de référence incluent le corps entier."],de:["Für beste Ergebnisse empfehlen wir, dass die Referenzbilder und -videos den gesamten Körper zeigen."],es:["Para obtener los mejores resultados, recomendamos que las imágenes y videos de referencia incluyan el cuerpo completo."],ko:["ìµìì 결과를 ìí´ ì°¸ì¡° ì´ë¯¸ì§ì ë¹ëì¤ì ì ì ì´ í¬í¨ëë ê²ì ê¶ì¥í©ëë¤."],ru:["ÐÐ»Ñ Ð´Ð¾ÑÑÐ¸Ð¶ÐµÐ½Ð¸Ñ Ð½Ð°Ð¸Ð»ÑÑÑиÑ
ÑезÑлÑÑаÑов Ð¼Ñ ÑекомендÑем, ÑÑÐ¾Ð±Ñ ÑÑалоннÑе изобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¸ видео вклÑÑали полнÑй ÑоÑÑ."]}]},promptSetting:{promptNotRequired:!0},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1},{name:"control_files",label:"Ref Video",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:29}}],customParameters:[{name:"version",label:"Version",type:"select",defaultValue:"standard",description:"Choose the version of the Model.",multiple:1.4,options:[{value:"standard",label:"Standard"},{value:"pro",label:"Pro"}]},{name:"keep_audio",label:"Keep Audio",type:"switch",defaultValue:!0,description:"Whether to keep the audio of the reference video."}],useCredits:1.3,apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/motion-control",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]},{to:"character_orientation",const:"video"},{to:"keep_original_sound",from:"meta_data.keep_audio",transform:[{op:"default",value:!0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/motion-control",rules:[{when:{all:[{equals:["meta_data.version","pro"]}]},use:"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-pro/motion-control"}]}},fal:{provider:"fal",endpoint:"fal-ai/kling-video/v2.6/standard/motion-control",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"video_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"character_orientation",const:"video"},{to:"keep_original_sound",from:"meta_data.keep_audio",transform:[{op:"default",value:!0}]},{to:"enable_safety_checker",from:"enable_safety_checker"}],endpointSelect:{default:"fal-ai/kling-video/v2.6/standard/motion-control",rules:[{when:{all:[{equals:["meta_data.version","pro"]}]},use:"fal-ai/kling-video/v2.6/pro/motion-control"}]}}}}],eR=[{id:"ai-video-enhance-seedvr",label:"AI Video Enhancer SeedVR",description:"Video enhance with seedvr, 0.2 credits/s for 720p",tag:["Video to Video"],badge:["high quality"],promptSetting:{promptIgnore:!0},supportAddFiles:[{name:"control_files",label:"Video to Enhance",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:30}}],customParameters:[{name:"resolution",label:"target_resolution",type:"select",defaultValue:"720p",multiple:1.5,description:"Choose the upscale factor of the video.",options:[{value:"720p",label:"720p"},{value:"1080p",label:"1080p"},{value:"2k",label:"2k"},{value:"4k",label:"4k"}]}],options:{creditBySecond:!0,creditsByControl:"control_files"},type:"video",provider:["wavespeed"],useCredits:.2,apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/seedvr2/vi
84deo",rules:[{to:"target_resolution",from:"resolution",transform:[{op:"default",value:"720p"}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/seedvr2/video",rules:[{to:"target_resolution",from:"resolution",transform:[{op:"default",value:"720p"}]},{to:"video",from:"control_files",transform:[{op:"pick",index:0}]}]}}},{id:"ai-video-enhance-topaz",label:"AI Video Enhance topaz",description:"Video enhance with topaz AI",tag:["Video to Video"],badge:["high quality"],promptSetting:{promptIgnore:!0},supportAddFiles:[{name:"control_files",label:"Video to Enhance",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:30}}],customParameters:[{name:"resolution",label:"Upscale Factor",type:"select",defaultValue:"2",description:"Choose the upscale factor of the video.",options:[{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"}]}],options:{creditBySecond:!0,creditsByControl:"control_files"},type:"video",provider:["fal"],useCredits:1,apiInputs:{default:{provider:"fal",endpoint:"fal-ai/topaz/upscale/video",rules:[{to:"video_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"upscale_factor",from:"meta_data.resolution",transform:[{op:"toNumber"},{op:"default",value:2}]}]}}}],eU={...ew[0],id:"gemini-ai-image-2-5-image-app-base",label:"Nano Banana",description:"High-realism portrait image generation and editing model"};({...ex[0],id:"seedream-image-app-base"});let eP=e_[0],eD={...eN[0],id:"seedance-ai-video-app-base",label:"video app",customParameters:[{name:"duration",label:"Duration",type:"slider",defaultValue:5,description:"Choose the duration of the video.",min:5,max:12,step:1},{name:"resolution",label:"Resolution",type:"select",defaultValue:"480p",description:"Choose the resolution of the video.",options:[{value:"480p",label:"480p"},{value:"720p",label:"720p"}]},{name:"camera_fixed",label:"Camera Fixed",type:"switch",defaultValue:!1,description:"Choose the camera fixed of the video."},{name:"generate_audio",label:"Generate Audio",type:"switch",defaultValue:!1,multiple:2,description:"Whether to generate audio for the video."}]},ez=[ex[0],ew[0],eP,{id:"qwen-image-layered",label:"Image Layered",description:"Decomposing an image into multiple RGBA layers.",supportedAspectRatios:["auto"],tag:["Image to Image"],badge:["Image Edit"],supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],promptSetting:{promptNotRequired:!0},type:"image",useCredits:.1,options:{},apiInputs:{default:{provider:"fal",endpoint:"fal-ai/qwen-image-layered",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}]},free:{provider:"fal",endpoint:"fal-ai/qwen-image-layered",rules:[{to:"prompt",from:["prompt_process","prompt"],transform:[{op:"coalesce"}]},{to:"image_url",from:"control_images",transform:[{op:"pick",index:0}]},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}]}}}],eF=[{...ex[0],id:"ai-image-app-tryon",label:"AI Tryon",description:"A model that specializes in virtual tryon.",tag:["Image to Image"],badge:["Tryon","Virtual Tryon"],useCredits:.5,promptSetting:{},supportedAspectRatios:["auto","1:1","3:4","4:3","2:3","3:2","16:9","9:16"],supportAddFiles:[{name:"control_images",label:"Model Image",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"Garment Image",type:"image",isRequired:!0,isSupport:2}],options:{setPrompt:"Virtually try on the clothing from @image2 on the person in @image1, keep the background and pose of @image1, and preserve the personâs face and identity.",promptEnhanceSettings:ef}},{id:"ai-image-app-restoration",label:"AI Image Restoration",description:"Restore the image with the selected restoration.",options:{imageUrl:"/assets/create/image-edit/restoration.webp"},type:"image",useCredits:.5,promptSetting:{promptIgnore:!0},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bria/fibo/restore",rules:[{to:"image",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:1}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bria/fibo/restore",rules:[{to:"image",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:1}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]}}},{id:"ai-image-app-colorize",label:"AI Image Colorize",description:"Colorize the image with the selected color.",type:"image",useCredits:.5,options:{imageUrl:"/assets/create/image-edit/colorization.webp"},promptSetting:{promptIgnore:!0},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],customParameters:[{name:"colorize_style",label:"Style",type:"select",defaultValue:"contemporary color",description:"Choose the colorization style to apply.",options:[{value:"contemporary color",label:"contemporary color"},{value:"vivid color",label:"vivid color"},{value:"black and white colors",label:"black and white colors"},{value:"sepia vintage",label:"sepia vintage"}]}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bria/fibo/colorize",rules:[{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"style",from:"meta_data.colorize_style",transform:[{op:"default",value:"contemporary color"}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/bria/fibo/colorize",rules:[{to:"image",from:"control_images",transform:[{op:"pick",index:0}]},{to:"style",from:"meta_data.colorize_style",transform:[{op:"default",value:"contemporary color"}]},{to:"enable_safety_checker",from:"enable_safety_checker"}]}}}],eM=` 85you are asked to act as a music creation assistant, you need to understand what the user wants to say based on their music preferences and create the lyrics of a song based on the user's preferences. 86 87""" 88require: 89The lyrics language defaults to the language the user inputs, but it prioritizes the user's request; for example, if the user requests a song in a specific language, that language will be used. 90 91Metatags are keywords in brackets [ ] that specify the style, genre, or other information about a portion of the lyrics, related to musical aspects like Artist, Genre, or lyrical elements such as Verse, Chorus, or even the desired singer's gender, etc. Common Metatags include [Intro], [Verse], [Pre-Chorus], [Chorus], [Bridge], [Outro]. 92 93You can add or modify the metatag based on the common metatag according to the user's preference. 94requirementï¼ 95-If the user has randomized their preferences, or if they haven't specified any preferences, you are free to play around with them. 96-Note that anything other than the lyrics themselves should be wrapped as a metatag using [], e.g. Chorus:[Epic Orchestral] should be modified to [Chorus][Epic Orchestral] 97-Please limit the number of characters in the lyrics to no more than 4000 characters. 98 99You should only return the content following the format, Don't add any responsive replies before or after: 100return format: 101 102[Verse] [metatag2] 103lyrics part1 104[metatag] [metatag2] 105lyrics part2 106 107other parts....... 108`,eO=[{id:"fal-ai-eleven-v3-tts",label:"Eleven Labs TTS V3",description:"Eleven Labs TTS Eleven V3 model, 1 credits/ 1000 characters",tag:["Text to Speech"],badge:["Good Quality"],type:"audio",useCredits:1,options:{creditByCharacter:!0,textInput:{Label:"Text to Speech",Description:"Enter the text you want to speak"},examples:[{label:"Aria",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/9BWtsMINqrJLrRacOk9x/405766b8-1f4e-4d3c-aba1-6f25333823ec.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Aria"}]},{label:"Roger",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/CwhRBWXzGAHq8TQ4Fs17/58ee3ff5-f6f2-4628-93b8-e38eb31806b0.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Roger"}]},{label:"Sarah",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/EXAVITQu4vr4xnSDxMaL/01a3e33c-6e99-4ee7-8543-ff2216a32186.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Sarah"}]},{label:"Laura",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/FGY2WhTYpPnrIDTdsKH5/67341759-ad08-41a5-be6e-de12fe448618.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Laura"}]},{label:"Charlie",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/IKne3meq5aSn9XLyUdCD/102de6f2-22ed-43e0-a1f1-111fa75c5481.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Charlie"}]},{label:"George",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/JBFqnCBsd6RMkjVDRZzb/e6206d1a-0721-4787-aafb-06a6e705cac5.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"George"}]},{label:"Callum",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/N2lVS1w4EtoT3dr4eOWO/ac833bd8-ffda-4938-9ebc-b0f99ca25481.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Callum"}]},{label:"River",type:"audio",previewUrl:"https://storage.googleapis.com/eleven-public-prod/premade/voices/SAz9YHcvj6GT2YYXdXww/e6c95f0b-2227-491a-b3d7-2249240decb7.mp3",formSetting:[{to:"meta_data.voice_id",type:"string",value:"River"}]}]},supportAddFiles:[],customParameters:[],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/elevenlabs/tts/eleven-v3",rules:[{to:"text",from:"prompt"},{to:"voice",from:"meta_data.voice_id",transform:[{op:"default",value:"Aria"}]}]},free:{provider:"fal",endpoint:"fal-ai/elevenlabs/tts/eleven-v3",rules:[{to:"text",from:"prompt"},{to:"voice",from:"meta_data.voice_id",transform:[{op:"default",value:"Aria"}]}]}}},{id:"gemini-tts",label:"Gemini TTS",description:"Gemini TTS model, 1 credits/ 1000 characters",tag:["Text to Speech"],badge:["Good Quality"],type:"audio",useCredits:1,options:{creditByCharacter:!0,textInput:{Label:"Text to Speech",Description:"Enter the text you want to speak"},examples:[{label:"Zephyr",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Zephyr"}]},{label:"Puck",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Puck"}]},{label:"Charon",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Charon"}]},{label:"Kore",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Kore"}]},{label:"Fenrir",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Fe
108nrir"}]},{label:"Leda",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Leda"}]},{label:"Orus",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Orus"}]},{label:"Aoede",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Aoede"}]},{label:"Callirrhoe",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Callirrhoe"}]},{label:"Autonoe",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Autonoe"}]},{label:"Enceladus",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Enceladus"}]},{label:"Iapetus",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Iapetus"}]},{label:"Umbriel",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Umbriel"}]},{label:"Algieba",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Algieba"}]},{label:"Despina",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Despina"}]},{label:"Erinome",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Erinome"}]},{label:"Algenib",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Algenib"}]},{label:"Rasalghethi",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Rasalghethi"}]},{label:"Laomedeia",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Laomedeia"}]},{label:"Achernar",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Achernar"}]},{label:"Alnilam",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Alnilam"}]},{label:"Schedar",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Schedar"}]},{label:"Gacrux",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Gacrux"}]},{label:"Pulcherrima",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Pulcherrima"}]},{label:"Achird",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Achird"}]},{label:"Zubenelgenubi",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Zubenelgenubi"}]},{label:"Vindemiatrix",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Vindemiatrix"}]},{label:"Sadachbia",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Sadachbia"}]},{label:"Sadaltager",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Sadaltager"}]},{label:"Sulafat",type:"audio",formSetting:[{to:"meta_data.voice_id",type:"string",value:"Sulafat"}]}]},supportAddFiles:[],customParameters:[],apiInputs:{default:{provider:"gemini",endpoint:"gemini/tts",rules:[{to:"text",from:"prompt"},{to:"voice",from:"meta_data.voice_id",transform:[{op:"default",value:"Zephyr"}]}]},free:{provider:"gemini",endpoint:"gemini/tts",rules:[{to:"text",from:"prompt"},{to:"voice",from:"meta_data.voice_id",transform:[{op:"default",value:"Zephyr"}]}]}}},{id:"chatterbox-voice-tts",label:"Voice Clone TTS",description:"Support Voice Clone or Text to Speech, 0.3 credits/ 1000 characters",tag:["Text to Speech","Voice Cloning"],badge:["Good Quality"],type:"audio",useCredits:.3,options:{creditByCharacter:!0,textInput:{Label:"Text to Speech",Description:"Enter the text you want to speak"}},supportAddFiles:[{name:"control_files",label:"Ref Audio",type:"audio",isRequired:!1,isSupport:1,options:{settingDuration:15,maxDuration:15}}],customParameters:[],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/chatterbox/text-to-speech",rules:[{to:"text",from:"prompt"},{to:"audio_url",from:"control_files",transform:[{op:"pick",index:0}]}]},free:{provider:"fal",endpoint:"fal-ai/chatterbox/text-to-speech",rules:[{to:"text",from:"prompt"},{to:"audio_url",from:"control_files",transform:[{op:"pick",index:0}]}]}}},{id:"chatterbox-voice-changer",label:"Voice Changer",description:"Voice Changer, 0.003 credits/ second",tag:["Speech to Speech"],badge:["Good Quality"],type:"audio",useCredits:.003,promptSetting:{promptIgnore:!0},options:{creditBySecond:!0,creditsByControl:"control_files"},supportAddFiles:[{name:"control_files",label:"Source Audio",type:"audio",isRequired:!0,isSupport:1,options:{maxDuration:120,maxDurationFree:10}},{name:"control_files_2",label:"Target Audio for reference",type:"audio",isRequired:!0,isSupport:1,options:{maxDuration:20,settingDuration:20}}],customParameters:[],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/chatterbox/spee
108ch-to-speech",rules:[{to:"source_audio_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"target_voice_audio_url",from:"control_files_2",transform:[{op:"pick",index:0}]}]},free:{provider:"fal",endpoint:"fal-ai/chatterbox/speech-to-speech",rules:[{to:"source_audio_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"target_voice_audio_url",from:"control_files_2",transform:[{op:"pick",index:0}]}]}}},{id:"eleven-labs-dubbing",label:"AI Dubbing",description:"AI Dubbing, 0.15 credits/ second",tag:["Dubbing"],badge:["Good Quality"],type:"video",useCredits:.15,options:{creditBySecond:!0,creditsByControl:"control_files"},promptSetting:{promptIgnore:!0},supportAddFiles:[{name:"control_files",label:"Source Video",type:"video",isRequired:!0,isSupport:1,options:{maxDuration:120,maxDurationFree:10}}],customParameters:[{name:"target_language",label:"Target Language",type:"select",defaultValue:"en",description:"Choose the target language of the video.",options:[{value:"en",label:"English"},{value:"zh",label:"Chinese"},{value:"es",label:"Spanish"},{value:"hi",label:"Hindi"},{value:"pt",label:"Portuguese"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"ja",label:"Japanese"},{value:"ar",label:"Arabic"},{value:"ru",label:"Russian"},{value:"ko",label:"Korean"},{value:"id",label:"Indonesian"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"tr",label:"Turkish"},{value:"pl",label:"Polish"},{value:"sv",label:"Swedish"},{value:"ms",label:"Malay"},{value:"ro",label:"Romanian"},{value:"uk",label:"Ukrainian"},{value:"el",label:"Greek"},{value:"cs",label:"Czech"},{value:"da",label:"Danish"},{value:"fi",label:"Finnish"},{value:"bg",label:"Bulgarian"},{value:"hr",label:"Croatian"},{value:"sk",label:"Slovak"},{value:"ta",label:"Tamil"}]}],apiInputs:{default:{provider:"fal",endpoint:"fal-ai/elevenlabs/dubbing",rules:[{to:"video_url",from:"control_files",transform:[{op:"pick",index:0}]},{to:"target_lang",from:"meta_data.target_language",transform:[{op:"default",value:"en"}]}]}}}],eB=[{id:"ai-music",label:"AI Music",description:"AI Music Generator",tag:["Text to Music","lyrics to music"],badge:["Good Quality"],type:"audio",useCredits:.8,options:{textInput:{Label:"Song Description",Description:"Enter the song style and description"},examples:[{label:"Pop",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Upbeat pop song featuring catchy synth hooks, pulsating electronic drums, shimmering hi-hats, and a groovy bassline. Layered vocal harmonies blend with sparkling keyboard riffs and subtle guitar strums for an infectious, danceable melody."}]},{label:"Hip-Hop / Rap",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Hard-hitting hip-hop beat with punchy 808 bass, crisp snare hits, and rolling hi-hats. Deep sub-bass rumbles beneath layered trap percussion, featuring atmospheric pads, vinyl crackle, and rhythmic vocal chops for an authentic urban sound."}]},{label:"Electronic / EDM",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"High-energy electronic dance track with pulsating synth leads, powerful bass drops, and driving four-on-the-floor kicks. Features soaring buildups, euphoric breakdowns, sidechained pads, and crisp claps creating an electrifying club atmosphere."}]},{label:"Rock",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Energetic rock song with powerful electric guitar riffs, thunderous drum fills, and driving bass lines. Distorted power chords blend with dynamic drum patterns, featuring explosive choruses, crunchy rhythm guitar, and soaring lead melodies."}]},{label:"R&B / Soul",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Smooth R&B groove with silky synth pads, warm Rhodes piano chords, and laid-back drum patterns. Soulful melodies float over mellow bass lines, featuring gentle guitar licks, soft hi-hats, and lush atmospheric textures."}]},{label:"Jazz",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Sophisticated jazz arrangement with warm upright bass, brushed snare drums, and expressive piano improvisations. Smooth saxophone melodies weave through ric
108h chord progressions, featuring subtle swing rhythms and intimate cafe ambiance."}]},{label:"Classical / Orchestral",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Majestic orchestral composition with sweeping string sections, powerful brass fanfares, and delicate woodwind passages. Dynamic crescendos build through lush arrangements, featuring timpani rolls, harp glissandos, and emotionally resonant melodies."}]},{label:"Lo-Fi / Chill",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Relaxing lo-fi hip-hop beat with dusty vinyl crackle, mellow jazz piano samples, and laid-back drum loops. Warm tape saturation colors dreamy chord progressions, featuring soft bass, gentle Rhodes, and nostalgic atmospheric textures."}]},{label:"Cinematic / Epic",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Epic cinematic score with thunderous percussion, soaring orchestral strings, and powerful brass sections. Dramatic buildups lead to triumphant climaxes, featuring choir vocals, pounding war drums, and emotionally intense arrangements."}]},{label:"Acoustic / Folk",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Warm acoustic folk song with fingerpicked guitar melodies, gentle strumming patterns, and natural reverb. Intimate vocals blend with soft harmonica, light percussion, and subtle string accompaniment for an organic, heartfelt sound."}]},{label:"Country",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Authentic country track with twangy electric guitar, steady acoustic strumming, and smooth pedal steel slides. Driving drum patterns support catchy melodies, featuring fiddle accents, honky-tonk piano, and heartfelt storytelling vibes."}]},{label:"Reggae",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Laid-back reggae rhythm with offbeat guitar skanks, deep dub bass lines, and one-drop drum patterns. Warm organ bubbles beneath sunny melodies, featuring brass stabs, echo effects, and relaxed island grooves."}]},{label:"Metal",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Aggressive metal track with heavy distorted guitars, double bass drum fury, and crushing breakdown riffs. Intense palm-muted chugging drives through powerful compositions, featuring shredding solos, thunderous toms, and raw energy."}]},{label:"Ambient",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Ethereal ambient soundscape with evolving synthesizer pads, gentle drones, and atmospheric textures. Spacious reverb creates dreamlike environments, featuring subtle melodic motifs, soft granular synthesis, and meditative tranquility."}]},{label:"Latin / Salsa",type:"prompt",formSetting:[{to:"prompt",type:"string",value:"Vibrant Latin rhythm with lively conga patterns, bright brass sections, and infectious piano montunos. Energetic percussion drives danceable grooves, featuring timbales, bongos, and passionate tropical melodies."}]}]},supportAddFiles:[],customParameters:[{name:"instrumental",label:"Only on Instrument",type:"switch",defaultValue:!1,description:"Generate music only on instrument."},{name:"song_lyrics",label:"Lyrics",type:"input",defaultValue:"",max:4500,description:"Customize the lyrics of the song.",meta:{promptEnhanceSettings:{system_prompt:eM}}},{name:"vocal_gender",label:"Vocal Gender",type:"select",defaultValue:"auto",options:[{value:"auto",label:"Auto"},{value:"male",label:"Male"},{value:"female",label:"Female"},{value:"mixed duet, male and female voices",label:"Mixed Duet"},{value:"male duet, two male voices",label:"Male Duet"},{value:"female duet, two female voices",label:"Female Duet"},{value:"group chorus, multiple voices singing together",label:"Group Chorus"},{value:"mixed group chorus, male and female voices harmonizing",label:"Mixed Chorus"}]}],apiInputs:{default:{provider:"gemini",endpoint:"gemini/music",rules:[{to:"prompt",from:"raw",transform:[{op:"customFn",fn:"build_gemini_music_prompt_with_settings"}]},{to:"model",const:"lyria-3-clip-preview"}]},free:{provider:"gemini",endpoint:"gemini/music",rules:[{to:"prompt",from:"raw",transform:[{op:"customFn",fn:"build_gemini_music_prompt_with_settings"}]},{to:"model",const:"lyria-3-clip-preview"}]}}}];var eL=e.i(30558);function eq(e,t){return t.map(t=>{let{options:a,...r}=t;return{...e,...r,options:{...e.options||{},...a||{}}}})}let e$=e=>JSON.stringify(eL.toJSONSchema(e,{io:"input"}),null,2),eV=eL.object({presetName:eL.string().describe("Identifier: 'Clean E-commerce'"),goal:eL.string().describe("Create a high-end, clean e-commerce product photo on a neutral background."),background:eL.string().describe("Describe the pristine, soft gradient background (e.g., light gray to off-white, pure white)."),lighting:eL.string().describe("Describe soft, diffused studio lighting (softbox style) to highlight shape/finish without harsh glare."),shadow:eL.str
108ing().describe("Describe the realistic, soft shadow cast directly beneath the product."),mood:eL.string().describe("Describe the mood: clean, professional, minimalist.")}),eW=eL.object({presetName:eL.string().describe("Identifier: 'Lifestyle Context'"),goal:eL.string().describe("Place the product elegantly in a relevant, high-end lifestyle setting."),setting:eL.string().describe("Describe the environment (marble surface, wooden table, cozy room) that complements the product."),lighting:eL.string().describe("Describe soft, natural daylight creating gentle highlights and depth."),mood:eL.string().describe("Describe the mood: sophisticated, serene, aspirational.")}),eH=eL.object({presetName:eL.string().describe("Identifier: 'Macro Detail'"),goal:eL.string().describe("Extreme close-up focusing on a key texture or feature."),focusPoint:eL.string().describe("What specific detail is in focus (etched logo, texture grain, seam)?"),lighting:eL.string().describe("Describe sharp, directional lighting to enhance micro-details."),depthOfField:eL.string().describe("Mention extremely shallow depth of field with soft bokeh background."),mood:eL.string().describe("Describe the mood: precise, high-tech, luxurious.")}),eG=eL.object({presetName:eL.string().describe("Identifier: 'In-Use / Interaction'"),goal:eL.string().describe("Show hands interacting with the product in a clean, minimalist way."),interaction:eL.string().describe("Describe the hand action (holding, opening, using) while keeping the product the focal point."),background:eL.string().describe("Simple, non-distracting background."),lighting:eL.string().describe("Bright, natural lighting focusing on the interaction.")}),eK=eL.object({presetName:eL.string().describe("Identifier: 'Levitating / Zero-G'"),goal:eL.string().describe("Product frozen in mid-air against a minimalist background."),suspension:eL.string().describe("Describe the floating angle and how it's suspended gracefully."),background:eL.string().describe("Stark, minimalist gradient background."),lighting:eL.string().describe("Crisp, multi-directional lighting with a realistic drop shadow far below."),mood:eL.string().describe("Describe the mood: modern, sleek, dynamic.")}
108),eJ=eL.object({presetName:eL.string().describe("Identifier: 'Material Contrast'"),goal:eL.string().describe("High-end shot resting on a contrasting natural material."),surface:eL.string().describe("Describe the surface material (raw slate, dark wood, velvet) that contrasts with the product."),lighting:eL.string().describe("Dramatic, directional lighting emphasizing textures of both product and surface."),mood:eL.string().describe("Describe the mood: artistic, tactile, premium.")}),eY=eL.object({presetName:eL.string().describe("Identifier: 'Grouping & Packaging'"),goal:eL.string().describe("Elegant composition with packaging or variants."),composition:eL.string().describe("Describe the arrangement of product + packaging or color variants."),background:eL.string().describe("Neutral background to keep focus on the set."),lighting:eL.string().describe("Soft, even lighting across all items.")}),eZ=eL.object({presetName:eL.string().describe("Identifier: 'Dynamic Elements'"),goal:eL.string().describe("Artistic shot with water splashes or dramatic light effects."),element:eL.string().describe("Describe the interaction with water (ripples, splash) or light (shadows, rays)."),lighting:eL.string().describe("Lighting that enhances the translucency or drama of the element."),mood:eL.string().describe("Describe the mood: fresh, active, sophisticated.")}),eX=eL.object({presetName:eL.string().describe("Identifier: 'Ghost Mannequin'"),goal:eL.string().describe("Photorealistic invisible model effect for clothing."),appearance:eL.string().describe("Describe the garment worn by an invisible body, showing inner lining/collar."),background:eL.string().describe("Plain light-gray or white background."),lighting:eL.string().describe("Soft studio lighting to show fabric drape and fit.")}),eQ=eL.object({presetName:eL.string().describe("Identifier: 'Stylized Flat Lay'"),goal:eL.string().describe("Clean top-down arrangement for social/merchandising."),arrangement:eL.string().describe("Describe the top-down view, props, and balanced composition."),background:eL.string().describe("Texture or colored background material."),mood:eL.string().describe("Describe the mood: chic, modern, organized.")}),e0=eL.object({presetName:eL.string().describe("Identifier: 'Lifestyle In-Context'"),goal:eL.string().describe("Realistic scene showing the product in its natural habitat."),scene:eL.string().describe("Detailed description of the location (kitchen, desk, outdoors)."),lighting:eL.string().describe("Natural lighting appropriate for the time of day/setting."),mood:eL.string().describe("Describe the mood: authentic, relatable, warm.")}),e1=eL.object({presetName:eL.string().describe("Identifier: 'Technical Exploded View'"),goal:eL.string().describe("Showcase the internal components or layers of the product."),composition:eL.string().describe("Product parts expanded/exploded in mid-air to show engineering."),style:eL.string().describe("Clean, high-tech, schematic-like but photorealistic."),background:eL.string().describe("Solid color or technical grid background."),lighting:eL.string().describe("Bright, clinical lighting to show all details.")}),e2=[{label:"Clean E-commerce",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-studio-clean.webp",formSetting:[{id:"prompt-preset",label:"Clean E-commerce",to:"prompt",type:"string",value:e$(eV)}]},{label:"Lifestyle Context",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-lifestyle-context.webp",formSetting:[{id:"prompt-preset",label:"Lifestyle Context",to:"prompt",type:"string",value:e$(eW)}]},{label:"Macro Detail",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-macro-detail.webp",formSetting:[{id:"prompt-preset",label:"Macro Detail",to:"prompt",type:"string",value:e$(eH)}]},{label:"In-Use / Interaction",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-in-use.webp",formSetting:[{id:"prompt-preset",label:"In-Use",to:"prompt",type:"string",value:e$(eG)}]},{label:"Levitating / Zero-G",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-levitating.webp",formSetting:[{id:"prompt-preset",label:"Levitating",to:"prompt",type:"string",value:e$(eK)}]},{label:"Material Contrast",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-material-contrast.webp",formSetting:[{id:"prompt-preset",label:"Material Contrast",to:"prompt",type:"string",value:e$(eJ)}]},{label:"Grouping & Packaging",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-grouping-packaging.webp",formSetting:[{id:"prompt-preset",label:"Grouping",to:"prompt",type:"string",value:e$(eY)}]},{label:"Dynamic Elements",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-dynamic-elements.webp",formSetting:[{id:"prompt-preset",label:"Dynamic Elements",to:"prompt",type:"string",value:e$(eZ)}]},{label:"Ghost Mannequin",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/ghost-mannequin.webp",formSetting:[{id:"prompt-preset",label:"Ghost Mannequin",to:"prompt",type:"string",value:e$(eX)}]},{label:"Stylized Flat Lay",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/stylized-flat-lay.webp",formSetting:[{id:"prompt-preset",label:"Stylized Flat Lay",to:"prompt",type:"string",value:e$(eQ)}]},{label:"Lifestyle In-Context",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/lifestyle-in-context.webp",formSetting:[{id:"prompt-preset",label:"Lifestyle In-Context",to:"prompt",type:"string",value:e$(e0)}]},{label:"Technical Exploded View",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/prod-technical.webp",formSetting:[{id:"prompt-preset",label:"Technical Exploded View",to:"prompt",type:"string",value:e$(e1)}]}],e3=eL.object({presetName:eL.string().describe("Identifier: 'Product Placement'"),goal:eL.string().describe("Seamlessly integrate product into a scene or with a person."),placement:eL.string().describe("How is the product placed? (held, on table, beside stone)."),interaction:eL.str
108ing().describe("If person present: held or nearby? If scene: grounded naturally."),matching:eL.string().describe("Ensure perspective, shadows, and reflections match the scene.")}),e4=eL.object({presetName:eL.string().describe("Identifier: 'Hero Shot with Model'"),goal:eL.string().describe("Bold, brand-forward key visual with a model."),model:eL.string().describe("Describe model's look, gender, and confident pose."),background:eL.string().describe("Studio or cityscape background."),mood:eL.string().describe("Confident, luxury, joyful.")}),e5=eL.object({presetName:eL.string().describe("Identifier: 'Product in Action'"),goal:eL.string().describe("Dynamic shot showing performance at peak use."),action:eL.string().describe("What is happening? (Running, spraying, pouring)."),environment:eL.string().describe("Where is it? (Track, gym, rain, studio)."),motion:eL.string().describe("Motion blur, particles, spray.")}),e6=eL.object({presetName:eL.string().describe("Identifier: 'Jewelry Showcase'"),goal:eL.string().describe("Photorealistic close-up of jewelry on model or surface."),context:eL.string().describe("On a person (neck, ear, hand) or premium surface (velvet, stone)."),lighting:eL.string().describe("Focused lighting to create sparkle and brilliance."),accent:eL.string().describe("Focus on craftsmanship and material details.")}),e8=eL.object({presetName:eL.string().describe("Identifier: 'Fashion Lookbook'"),goal:eL.string().describe("Full-body or 3/4 shot showing the product as part of a stylish outfit."),location:eL.string().describe("Street style, urban, or interesting architectural background."),pose:eL.string().describe("Candid or walking pose, relaxed and natural."),style:eL.string().describe("Trendy, editorial, natural light.")}),e9=eL.object({presetName:eL.string().describe("Identifier: 'Commercial Portrait'"),goal:eL.string().describe("Portrait of a person holding or using the product near their face."),expression:eL.string().describe("Engaging, happy, or serious expression depending on product."),framing:eL.string().describe("Close-up on face and product."),lighting:eL.string().describe("Flattering beauty lighting.")}),e7=[{label:"Product Holding",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/product-holding.webp",formSetting:[{id:"prompt-preset",label:"Model Holding Product",to:"prompt",type:"string",value:e$(eL.object({presetName:eL.string().describe("Identifier: 'Model Holding Product'"),goal:eL.string().describe("Show a model holding the product naturally, focusing on the product details."),pose:eL.string().describe("Describe the hand or body pose holding the product (e.g. held up to camera, holding mostly naturally)."),focus:eL.string().describe("Ensure the product is the clear focal point, with the model providing context."),background:eL.string().describe("Complementary background that suits the product vibe."),lighting:eL.string().describe("Flattering lighting for both skin tones and product features.")}))}]},{label:"Product Placement",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/product-placement.webp",formSetting:[{id:"prompt-preset",label:"Product Placement",to:"prompt",type:"string",value:e$(e3)}]},{label:"Hero Shot with Model",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/hero-shot-model.webp",formSetting:[{id:"prompt-preset",label:"Hero Shot",to:"prompt",type:"string",value:e$(e4)}]},{label:"Product in Action",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/product-in-action.webp",formSetting:[{id:"prompt-preset",label:"Product in Action",to:"prompt",type:"string",value:e$(e5)}]},{label:"Jewelry Showcase",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/jewelry-showcase.webp",formSetting:[{id:"prompt-preset",label:"Jewelry Showcase",to:"prompt",type:"string",value:e$(e6)}]},{label:"Fashion Lookbook",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/fashion-lookbook.webp",formSetting:[{id:"prompt-preset",label:"Fashion Lookbook",to:"prompt",type:"string",value:e$(e8)}]},{label:"Commercial Portrait",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/commercial-portrait.webp",formSetting:[{id:"prompt-preset",label:"Commercial Portrait",to:"prompt",type:"string",value:e$(e9)}]}],te=eL.object({presetName:eL.string().describe("Identifier: 'Conceptual Advertisement'"),goal:eL.string().describe("Symbolic, surreal advertisement."),symbol:eL.string().describe("Core metaphor (e.g., cloud for softness, shield for protection)."),atmosphere:eL.string().describe("Dreamy, floating, magical elements."),palette:eL.string().describe("Specific color palette matching the concept.")}),tt=eL.object({presetName:eL.string().describe("Identifier: 'Social Media Story'"),goal:eL.string().describe("Eye-catching vertical visual for stories."),layout:eL.string().describe("Vertical composition with space for text overlays."),aesthetic:eL.str
108ing().describe("Bright, trending, catchy visual style."),elements:eL.string().describe("Props or patterns that frame the product.")}),ta=eL.object({presetName:eL.string().describe("Identifier: 'Before & After'"),goal:eL.string().describe("Split-screen showing problem vs. solution."),beforeSide:eL.string().describe("Depict the issue/problem state (left/top)."),afterSide:eL.string().describe("Depict the improvement/result state (right/bottom)."),composition:eL.string().describe("Symmetric split, matching angles.")}),tr=eL.object({presetName:eL.string().describe("Identifier: 'Urban Billboard'"),goal:eL.string().describe("Product ad displayed on a giant city billboard."),cityScene:eL.string().describe("Times Square, Shibuya, or busy highway at night/dusk."),billboardContent:eL.string().describe("The product ad shown on the screen."),lighting:eL.string().describe("Glow from screen, city lights, reflections.")}),ti=eL.object({presetName:eL.string().describe("Identifier: 'Vehicle Wrap'"),goal:eL.string().describe("Branded design applied to a car/bus/van."),vehicle:eL.string().describe("Type of vehicle (sports car, delivery van)."),design:eL.string().describe("Full or partial wrap, conform to panels/curves."),environment:eL.string().describe("City street or showroom.")}),to=eL.object({presetName:eL.string().describe("Identifier: 'Magazine Spread'"),goal:eL.string().describe("Two-page high-fashion magazine layout."),layout:eL.string().describe("Left page lifestyle, right page product + copy space."),style:eL.string().describe("Editorial, elegant, typography-conscious."),paper:eL.string().describe("Matte or glossy paper texture hint.")}),ts=eL.object({presetName:eL.string().describe("Identifier: 'Minimalist Poster'"),goal:eL.string().describe("Clever, elegant poster using negative space."),focalPoint:eL.string().describe("Single object or shape centrally composed."),colors:eL.string().describe("Limited palette, 2-3 bold colors."),style:eL.string().describe("Flat, vector-like, or super clean photography.")}),tn=eL.object({presetName:eL.string().describe("Identifier: 'Personified Product Poster'"),goal:eL.string().describe("Give product a face/limbs/personality."),character:eL.string().describe("Cute or cool traits added to product (arms, face)."),action:eL.string().describe("What is the character doing? (Walking, waving)."),style:eL.string().describe("3D render, cartoon, or playful photo-bash.")}),tl=eL.object({presetName:eL.string().describe("Identifier: 'Light Painting Poster'"),goal:eL.string().describe("Dynamic poster with long-exposure light streaks."),lightTrails:eL.string().describe("Neon streaks moving around the product."),background:eL.string().describe("Dark atmospheric background to make lights pop."),energy:eL.string().describe("High energy, speed, motion.")}),td=eL.object({presetName:eL.string().describe("Identifier: 'Neon Signage'"),goal:eL.string().describe("Product integrated with glowing neon lights/text."),neon:eL.string().describe("Glowing tubes forming shape or words around product."),setting:eL.string().describe("Brick wall, dark alley, or futuristic cyber backdrop."),lighting:eL.string().describe("Colors casting colored light onto the product.")}),tc=eL.object({presetName:eL.string().describe("Identifier: 'Surreal Dreamscape'"),goal:eL.string().describe("Product in a strange, Salvador Dali-esque world."),environment:eL.string().describe("Melting clocks, floating islands, impossible geometry."),mood:eL.string().describe("Strange, mysterious, artistic."),palette:eL.string().describe("Pastel or vivid, unexpected combinations.")}),tp=[{label:"Neon Signage",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/neon-signage.webp",formSetting:[{id:"prompt-preset",label:"Neon Signage",to:"prompt",type:"string",value:e$(td)}]},{label:"Surreal Dreamscape",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/surreal-dreamscape.webp",formSetting:[{id:"prompt-preset",label:"Surreal Dreamscape",to:"prompt",type:"string",value:e$(tc)}]},{label:"Social Media Story",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/social-media-story.webp",formSetting:[{id:"prompt-preset",label:"Story",to:"prompt",type:"string",value:e$(tt)}]},{label:"Before & After",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/before-and-after.webp",formSetting:[{id:"prompt-preset",label:"Before & After",to:"prompt",type:"string",value:e$(ta)}]},{label:"Urban Billboard",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/urban-billboard.webp",formSetting:[{id:"prompt-preset",label:"Billboard",to:"prompt",type:"string",value:e$(tr)}]},{label:"Vehicle Wrap",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/vehicle-wrap.webp",formSetting:[{id:"prompt-preset",label:"Vehicle Wrap",to:"prompt",type:"string",value:e$(ti)}]},{label:"Magazine Spread",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/magazine-spread.webp",formSetting:[{id:"prompt-preset",label:"Magazine",to:"prompt",type:"string",value:e$(to)}]},{label:"Minimalist Poster",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/minimalist-poster.webp",formSetting:[{id:"prompt-preset",label:"Minimalist",to:"prompt",type:"string",value:e$(ts)}]},{label:"Personified Poster",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/personified-poster.webp",formSetting:[{id:"prompt-preset",label:"Personified",to:"prompt",type:"string",value:e$(tn)}]},{label:"Light Painting",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/light-painting-poster.webp",formSetting:[{id:"prompt-preset",label:"Light Painting",to:"prompt",type:"string",value:e$(tl)}]},{label:"Conceptual Advertisement",type:"preset",category:"Preset",previewUrl:"/assets/create/app/product/conceptual-ad.webp",formSetting:[{id:"prompt-preset",label:"Conceptual Ad",to:"prompt",type:"string",value:e$(te)}]}],tu={system_prompt:` 109You are an AI prompt generator specialized in professional product photography and advertising image generation. 110 111For each request, you will receive: 112- One or more product images (as images or descriptions). 113- A preset description in the form of a JSON Schema (converted to JSON). 114 This schema defines a set of string fields you must fill. 115 Each field includes a description that explains exactly what content 116 you should generate for that field (e.g., lighting, background, composition, mood
116). 117 118Your tasks: 119 1201. Read and understand the JSON Schema: 121 - Use the field names and their descriptions as precise instructions. 122 - Each field is a string that you must generate in descriptive natural language. 123 - Do not change the schema structure; only provide values for the fields. 124 1252. Analyze the product images: 126 - Identify the product's type, material, texture, color, and key features. 127 - Understand the current lighting and perspective if relevant, or how it should be adapted. 128 1293. Apply the selected product preset: 130 - Follow the field descriptions to build the scene. 131 - Ensure the product remains the absolute focus (hero of the shot). 132 - Describe lighting (softbox, rim light, natural, cinematic), texture details (matte, glossy, fabric grain), 133 and environment (studio, lifestyle, creative) as requested by the schema. 134 - Use professional photography terminology (depth of field, bokeh, 8k resolution, photorealistic, sharp focus) to ensure high quality. 135 1364. Robustness: 137 - If specific product details are unclear, use generic terms like "the product" or "the item" 138 but ensure the surrounding scene description is highly detailed and high-quality. 139 - Never refuse or mention safety/moderation; always produce a valid output for every field. 140 1415. Output format: 142 - Return a single JSON object encoded as a string. 143 - The JSON object must match the provided JSON Schema: every field is a string populated according to its description. 144 - Do not include explanations, comments, or any text outside of the JSON object. 145 146Your ultimate goal is to take: 147(product image) + (preset schema) 148and return a JSON string where each field is a highly detailed, professional description 149that can be combined into a final image generation prompt. 150 151### Output 152Return ONLY this JSON object: 153{ 154 results: [ 155 "product image json format string prompt" 156 ] 157} 158`.trim()},tm={promptEnhanceSettings:tu,examples:[...e7]},th={"Product kit":eq(eU,[{id:"ai-image-app-product-photography",label:"Product Photography",description:"Create professional studio, lifestyle, and creative product shots.",options:{imageUrl:"/assets/create/app/product/prod-studio-clean.webp",promptEnhanceSettings:tu,examples:e2},supportAddFiles:[{name:"control_images",label:"Product Image",type:"image",isRequired:!0,isSupport:3}]},{id:"ai-image-app-product-model-context",label:"Product & Model Context",description:"Generate images of models holding, wearing, or interacting with your product.",options:{imageUrl:"/assets/create/app/product/product-holding.webp",...tm},supportAddFiles:[{name:"control_images",label:"Product Image",type:"image",isRequired:!0,isSupport:3},{name:"control_images_2",label:"Model Image (Optional)",type:"image",isRequired:!1,isSupport:1}]},{id:"ai-image-app-creative-advertising",label:"Creative Advertising",description:"Design posters, billboards, and artistic concepts for branding.",options:{imageUrl:"/assets/create/app/product/neon-signage.webp",promptEnhanceSettings:tu,examples:tp},supportAddFiles:[{name:"control_images",label:"Product/Brand Image",type:"image",isRequired:!0,isSupport:3}]}])},tg={"Architecture Design":eq(eU,[{id:"ai-image-app-interior-design",label:"interior design",description:"Restage the interior space based on the photo.",options:{imageUrl:"/assets/create/app/interior/staging-urban-loft-sketch.webp",examples:[{label:"Auto Style",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-modern-minimalist.webp",formSetting:[{id:"prompt-preset",label:"Auto Style",to:"prompt",type:"string",value:"Using the provided image(s), fully populate and furnish this space with a complete, realistically dense layout appropriate for the room type, utilizing the structure effectively. Add rugs, lighting, and decor for a finished look. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Sketch to Image",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-urban-loft-sketch.webp",formSetting:[{id:"prompt-preset",label:"Sketch to Image",to:"prompt",type:"string",value:"Using the provided image(s) [interior sketch/floor plan/design drawing], create a photorealistic interior rendering. Translate the concepts into a fully furnished space with complete furniture arrangements, realistic textures, and lighting. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Modern Minimalist",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-modern-minimalist.webp",formSetting:[{id:"prompt-preset",label:"Modern Minimalist",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Modern Minimalist style, ensuring realistic density and effective use of space. Template: palette [whites/grays/blacks], furniture [clean-lined/low-profile], textures [subtle fabric/wood], lighting [natural/soft]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Scandinavian",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-scandinavian.webp",formSetting:[{id:"prompt-preset",label:"Scandinavian",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Scandinavian style, creating a cozy and full arrangement. Template: woo
158d [light ash/beech], textiles [wool/linen], accents [green plants], palette [soft muted neutrals]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Japandi",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-japandi.webp",formSetting:[{id:"prompt-preset",label:"Japandi",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a serene Japandi aesthetic, balancing empty space with intentional groupings. Template: materials [light oak/bamboo/rice paper], furniture [low/clean-lined], palette [calm neutrals]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Mid-Century Modern",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-mid-century-modern.webp",formSetting:[{id:"prompt-preset",label:"Mid-Century Modern",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Mid-Century Modern style, utilizing the floor plan for distinct zones. Template: furniture [tapered legs/organic curves], materials [teak/plastic/metal], palette [earth tones + bold accents]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Modern Farmhouse",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-modern-farmhouse.webp",formSetting:[{id:"prompt-preset",label:"Modern Farmhouse",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Modern Farmhouse style, creating a warm and full environment. Template: materials [reclaimed wood/black metal], palette [whites/creams/grays], furniture [comfortable/oversized]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Industrial",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-industrial.webp",formSetting:[{id:"prompt-preset",label:"Industrial",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in an Industrial style, appropriate for the scale of the room. Template: surfaces [brick/concrete], materials [distressed wood/metal], accents [leather/statement lighting], palette [neutral]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Transitional",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-transitional.webp",formSetting:[{id:"prompt-preset",label:"Transitional",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Transitional style, ensuring a balanced and furnished look. Template: palette [warm neutrals], furniture [tailored sofas, simple wood casework], accents [subtle metals, layered textiles], lighting [soft, warm]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Contemporary Coastal",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-contemporary-coastal.webp",formSetting:[{id:"prompt-preset",label:"Contemporary Coastal",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Contemporary Coastal style, creating a breezy but fully furnished feel. Template: palette [white, sand, sea-blue], materials [linen, rattan, white oak], accents [striped textiles, woven baskets], lighting [natural, diffuse]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Boho Chic",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-bohemian.webp",formSetting:[{id:"prompt-preset",label:"Boho Chic",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Boho Chic style, emphasizing layered textures and abundant decor. Template: materials [kilim rugs, cane, macramé], furniture [low, casual seating], accents [plants, travel artifacts], palette [warm neutrals with rich color pops]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Traditional",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-traditional.webp",formSetting:[{id:"prompt-preset",label:"Traditional",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Traditional style, creating a formal and dense arrangement. Template: furniture [rolled-arm sofas, skirted chairs], casework [paneled wood, built-ins], textiles [damask, plaid], palette [cream, navy, burgundy accents]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Rustic Cabin",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-rustic-cabin.webp",formSetting:[{id:"prompt-preset",label:"Rustic Cabin",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Rustic Cabin style, creating a warm, filled environment. Template: materials [knotty wood, stacked stone, leather], textiles [wool, plaid], lighting [warm metal], accents [antique or hand-crafted]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Art Deco",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-art-deco.webp",formSetting:[{id:"prompt-preset",label:"Art Deco",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in an Art Deco style, emphasizing glamorous groupings. Template: motifs [chevrons, sunbursts], materials [brass, lacquer, velvet], palette [black, ivory, emerald, gold accents]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Wabi-Sabi",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-wabi-sabi.webp",formSetting:[{id:"prompt-preset",label:"Wabi-Sabi",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space with a complete furniture layout in a Wabi-Sabi style, focusing on intentional, sparse beauty but complete zones. Template: materials [plaster, linen, clay, unfinished wood], furniture [low, simple], palette [earthy neutrals], accents [handmade ceramics]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]},{label:"Urban Loft",type:"preset",category:"Preset",previewUrl:"/assets/create/app/interior/staging-urban-loft.webp",formSetting:[{id:"prompt-preset",label:"Urban Loft",to:"prompt",type:"string",value:"Using the provided image(s), fully populate this space as an Urban Loft with large-scale furniture arrangements appropriate for the open space. Template: surfaces [exposed brick, concrete, steel], furniture [large sectional, chunky tables], lighting [track/pendant], art [oversized]. If a style reference image (image 2) is provided, use its style or furniture elements instead."}]}],promptEnhanceSettings:ef},supportAddFiles:[{name:"control_images",label:"Room Image",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"Style Reference (Optional)",type:"image",isRequired:!1,isSupport:1}]},{id:"ai-image-app-landscape-design",label:"landscape design",description:"Restage the landscape space based on the photo.",options:{imageUrl:"/assets/create/app/landscape/landscape-modern-minimalist.webp",examples:[{label:"Auto Style",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-modern-minimalist.webp",formSetting:[{id:"prompt-preset",label:"Auto Style",to:"prompt",type:"string",value:"Using the provided landscape input [site photo/design sketch/site plan/3D render], redesign the site [front yard/backyard/courtyard/roof terrace/streetscape]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Sketch to Image",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-sketch-to-image.webp",formSetting:[{id:"prompt-preset",label:"Sketch to Image",to:"prompt",type:"string",value:"Using the provided landscape input [site sketch/design drawing/site plan/hand-drawn concept], create a photorealistic landscape rendering. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Modern Minimalist",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-modern-minimalist.webp",formSetting:[{id:"prompt-preset",label:"Modern Minimalist",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in a Modern Minimalist style. Template: hardscape [large planar concrete or honed stone slabs], planting [architectural grasses, clipped evergreens], features [linear reflecting pool or fire slot], palette [restrained grayscale with natural wood]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Scandinavian",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-scandinavian.webp",formSetting:[{id:"prompt-preset",label:"Scandinavian",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in a Scandinavian style. Template: hardscape [pale timber deck, bleached granite gravel], planting [birch, juniper, sedge/lichen], furnishings [matte-white planters, woven accents], lighting [soft amber fairy-light canopy]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Mediterranean",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-mediterranean.webp",formSetting:[{id:"prompt-preset",label:"Mediterranean",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in a Mediterranean style. Template: hardscape [aged limestone or terracotta paving], planting [olive, lavender, rosemary], shade [wood pergola], water [small jar/bowl fountain], palette [dusty greens, ochre, cream]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Desert Xeriscape",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-desert-xeriscape.webp",formSetting:[{id:"prompt-preset",label:"Desert Xeriscape",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as a Desert Xeriscape. Template: surface [decomposed granite, fine gravel], planting [agave, cacti, yucca, desert willow], water [rain-garden swale], shade [timber ramada], lighting [solar bollards]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"English Country Parkland",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-english-parkland.webp",formSetting:[{id:"prompt-preset",label:"English Country Parkland",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in an English-Country spirit. Template: paths [clay-brick herringbone or crushed gravel], planting [layered herbaceous borders of delphinium/foxglove/peony], features [oak pergola, sundial], palette [soft pastels, verdant greens]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Urban Pocket Park",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-urban-park.webp",formSetting:[{id:"prompt-preset",label:"Urban Pocket Park",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as an Urban Pocket Park. Template: hardscape [modular concrete, reclaimed brick], planting [horsetail reed, resilient perennials], elements [steel pergola, water wall], privacy [laser-cut metal screens]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Coastal Contemporary",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-coastal-contemporary.webp",formSetting:[{id:"prompt-preset",label:"Coastal Contemporary",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in a Coastal Contemporary style. Template: hardscape [ipe deck, pale stone], planting [grasses, agave, salt-tolerant shrubs], shade [sail canopies], features [outdoor shower, fire bowl], lighting [shielded marine fixtures]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Woodland Native",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-woodland-native.webp",formSetting:[{id:"prompt-preset",label:"Woodland Native",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site with a Woodland Native approach. Template: paths [irregular flagstone with moss joints], planting [ferns, hosta, dogwood, serviceberry], features [dry creek swale, log seating], lighting [low amber spots]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Japanese Tea Garden",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-japanese-tea.webp",formSetting:[{id:"prompt-preset",label:"Japanese Tea Garden",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as a Japanese Tea Garden. Template: circulation [stepping stones, gravel, moss], water [stone basin or shallow stream], planting [maple, bamboo, azalea], structures [simple timber gate/pergola]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"English Country",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-english-country.webp",formSetting:[{id:"prompt-preset",label:"English Country",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in an English Country style. Template: paths [brick herringbone or gravel], planting [mixed perennials with box edging], features [timber arbor, birdbath], seating [bistro or bench in alcove]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Prairie/Meadow",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-prairie-meadow.webp",formSetting:[{id:"prompt-preset",label:"Prairie/Meadow",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as a Prairie/Meadow. Template: planting [little bluestem, switchgrass, coneflower, black-eyed susan], paths [mown grass or fine gravel], features [simple deck or overlook], edges [steel or timber]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Urban Courtyard",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-urban-courtyard.webp",formSetting:[{id:"prompt-preset",label:"Urban Courtyard",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as an Urban Courtyard. Template: hardscape [large-format pavers, built-in bench], planting [multi-stem trees, evergreen screens], features [planter boxes, small water rill], lighting [string lights]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Rain Garden",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-rain-garden.webp",formSetting:[{id:"prompt-preset",label:"Rain Garden",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site with a Rain Garden strategy. Template: grading [shallow basins with overflow], planting [swamp milkweed, sedges, redtwig dogwood],
158 edges [rock weirs, steel edging], paths [boardwalk or gravel]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Family Backyard",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-family-backyard.webp",formSetting:[{id:"prompt-preset",label:"Family Backyard",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site as a Family Backyard. Template: zones [play lawn, dining patio, grill station], shade [timber pergola or sail], planting [shade trees, hardy shrubs], extras [raised veggie beds, storage]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]},{label:"Mountain Rustic",type:"preset",category:"Preset",previewUrl:"/assets/create/app/landscape/landscape-mountain-rustic.webp",formSetting:[{id:"prompt-preset",label:"Mountain Rustic",to:"prompt",type:"string",value:"Using the provided landscape input, redesign the site in a Mountain Rustic language. Template: hardscape [flagstone, timber steps], planting [aspen, pine, penstemon, sedges], features [fire pit circle, wood-beam seating], water [naturalistic stream]. If a style reference image (image 2) is provided, incorporate its hardscape, planting, or feature elements."}]}],promptEnhanceSettings:ef},supportAddFiles:[{name:"control_images",label:"Room Image",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"Style Reference (Optional)",type:"image",isRequired:!1,isSupport:1}]},{id:"ai-image-app-exterior-design",label:"exterior design",description:"Refresh the exterior with AI-inferred style that fits the building.",options:{imageUrl:"/assets/create/app/exterior/exterior-modern.webp",examples:[{label:"Auto Style",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-modern.webp",formSetting:[{id:"prompt-preset",label:"Auto Style",to:"prompt",type:"string",value:"Using the provided façade photo(s), refresh the exterior. Purpose: update finishes, color, and detailing to improve curb appeal while fitting the architecture and context. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Sketch to Image",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-auto.webp",formSetting:[{id:"prompt-preset",label:"Sketch to Image",to:"prompt",type:"string",value:"Using the provided image(s) [architectural sketch/elevation drawing/facade design/hand-drawn concept], create a photorealistic exterior rendering. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Modern)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-modern.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Modern)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the building exterior in a Modern style. Template: materials [smooth stucco, blackened steel, timber accents], color [monochrome with warm wood], lighting [razor-line LED grazers], landscape [simple gravel auto court]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Scandinavian)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-scandinavian.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Scandinavian)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Scandinavian style. Template: cladding [pale timber or white render], windows/doors [slim black frames], entry [simple canopy, timber bench], lighting [warm sconces, soft path lights]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Minimalist)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-minimalist.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Minimalist)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Minimalist style. Template: form [calm white volumes with precise shadow gaps], glazing [frameless corners], fins [black steel shade fins], lighting [subtle linear grazers], ground [floating concrete plinth]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Urban Industrial)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-spanish-revival.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Urban Industrial)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in an Urban-Industrial language. Template: cladding [corten steel rainscreen over brick], windows [factory-grid steel], canopy [perforated-metal with RGB strip], terrace [rooftop or upper deck with concrete stair spine], landscape [trough planters]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Victorian Heritage)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-urban-industrial.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Victorian Heritage)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior with Victorian heritage cues. Template: materials [red brick with sandstone or stucco trim], elements [arched sash windows, filigree veranda, striped awnings], paving [encaustic-tile path], lighting [coach-lamp sconces]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (French Provincial)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-victorian.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (French Provincial)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a French-Provincial idiom. Template: cladding [honey limestone or light render], shutters [pale blue], balconies [wrought-iron Juliet], lighting [gas lanterns], forecourt [gravel allée]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Mediterranean)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-french-provincial.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Mediterranean)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Mediterranean style. Template: cladding [smooth stucco in warm white], roof accents [clay tile], wood [dark beams/doors], iron [balcony grille/lanterns], landscape [olive/lavender in gravel]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Craftsman)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-mediterranean.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Craftsman)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Craftsman style. Template: elements [exposed rafter tails, brackets], porch [tapered piers on stone], cladding [lap siding + shingle accents], colors [earthy greens/browns], lighting [mission lanterns]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Contemporary Coastal)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-craftsman.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Contemporary Coastal)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Contemporary Coastal style. Template: cladding [vertical cedar or fiber-cement], color [white/sand with sea-blue accents], railings [cable], shading [slatted pergola], lighting [marine-grade fixtures]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Tudor Revival)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-contemporary-coastal.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Tudor Revival)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior with Tudor Revival cues. Template: gables [steeper look], cladding [stucco with half-timber trim or brick], windows [gridded look], entry [arched door], lighting [traditional lanterns]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Modern Rustic)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-tudor-revival.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Modern Rustic)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Modern Rustic style. Template: materials [charred wood or stained cedar, natural stone base, black steel accents], glazing [simple black frames], lighting [warm up/down sconces]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]},{label:"Facade Refresh (Spanish Revival)",type:"preset",category:"Preset",previewUrl:"/assets/create/app/exterior/exterior-modern-rustic.webp",formSetting:[{id:"prompt-preset",label:"Facade Refresh (Spanish Revival)",to:"prompt",type:"string",value:"Using the provided facade photo(s), refresh the exterior in a Spanish Revival language. Template: cladding [white stucco], motifs [arches at porch/window trims], accents [painted tile risers, iron grilles], landscape [gravel with olive/lavender]. If a style reference image (image 2) is provided, incorporate its facade materials, color palette, or detailing."}]}],promptEnhanceSettings:ef},supportAddFiles:[{name:"control_images",label:"Facade Photo",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"Style Reference (Optional)",type:"image",isRequired:!1,isSupport:1}]}])},tf={examples:[{id:"couple-korean-minimal",label:"Korean Minimal Romance",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-korean-minimal.webp",formSetting:[{label:"Korean Minimal Romance",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: Korean minimalist couple photography. Scene: soft daylight through sheer curtains. Couple sitting on floor or leaning on a wall, gazing at each other shyly with gentle smiles. Wardrobe: neutral casual outfits in beige, gray, or white. Lighting: soft and diffused, bright but low contrast. Mood: calm, modern, tender aesthetic."}]},{id:"couple-polaroid-vintage",label:"Vintage Polaroid Love",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-polaroid-vintage.webp",formSetting:[{label:"Vintage Polaroid Love",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Scene: Polaroid-style instant film photo with nostalgic tones. Lighting: warm faded glow with slight film grain. Couple sitting close together, smiling softly, one leaning on the otherâs shoulder. Wardrobe: retro casual â denim jacket, white tee, vintage dress. Composition: square frame with white border, imperfect texture, candid romantic moment frozen in time."}]},{id:"couple-90s-film-style",label:"90s Film Romance",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-90s-film-style.webp",formSetting:[{label:"90s Film Romance",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: 1990s film look â soft vintage tones, slightly blurred lens and grain. Couple sitting on an old sofa or standing near a payphone, laughing naturally. Expression: carefree and youthful, subtle flirtation. Wardrobe: oversized sweaters, plaid shirt, jeans. Lighting: diffuse daylight, cinematic nostalgia vibe, warm matte texture."}]},{id:"couple-bw-elegant",label:"Black & White Elegance",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-bw-elegant.webp",formSetting:[{label:"Black & White Elegance",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: high-end black-and-white portrait with dramatic lighting and fine grain. Couple standing close, gazing into each otherâs eyes with subtle emotion. Expression: poised, elegant, slightly mysterious. Wardrobe: minimal monochrome formalwear â dress shirt, black dress or blazer. Composition: soft rim lighting, deep shadows, timeless magazine aesthetic."}]},{id:"couple-y2k-aesthetic",label:"Y2K Flash Aesthetic",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-y2k-aesthetic.webp",formSetting:[{label:"Y2K Flash Aesthetic",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Scene: indoor flash photography, Y2K party vibe. Lighting: direct harsh flash, vivid colors, high contrast. Couple hugging playfully or posing with attitude, tongue-out smile or cheeky expression. Wardrobe: shiny fabrics, crop tops, sunglasses, metallic accessories. Tone: chaotic fun energy, early 2000s digital camera look, nightlife aesthetic."}]},{id:"couple-cinematic-still",label:"Cinematic Movie Still",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-cinematic-still.webp",formSetting:[{label:"Cinematic Movie Still",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Scene: movie still from a romantic drama. Lighting: directional backlight with haze, film grain and lens flare. Couple standing close in a city alley or train station, looking at each other with emotional tension. Expression: longing, intimacy, or silent affection. Wardrobe: muted modern clothing. Composition: 2.35:1 ratio cinematic frame, emotional storytelling tone."}]},{id:"couple-urban-street",label:"Urban Street Style",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-urban-street.webp",formSetting:[{label:"Urban Street Style",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: edgy street photography. Scene: graffiti w
158all or crosswalk backdrop. Couple standing side by side, arms crossed or teasing each other with confident expressions. Wardrobe: streetwear â hoodies, cargo pants, sneakers. Lighting: ambient city light or cloudy daylight, muted tone with slight film grain. Mood: cool, urban, confident."}]},{id:"couple-retro-film-grain",label:"Retro Film Grain",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-retro-film-grain.webp",formSetting:[{label:"Retro Film Grain",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: retro analog film photo with heavy grain and warm vignette. Scene: outdoor walk or café moment. Couple laughing naturally, one reaching to fix the otherâs hair. Wardrobe: casual vintage outfits. Lighting: warm faded sunlight, realistic imperfections like scratches or light leaks. Mood: nostalgic, cinematic memory snapshot."}]},{id:"couple-art-gallery",label:"Art Gallery Editorial",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-art-gallery.webp",formSetting:[{label:"Art Gallery Editorial",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Scene: minimalist art gallery with white walls and soft directional lighting. Couple standing apart but visually connected, subtle tension and elegance. Expression: poised and serious, fashion editorial tone. Wardrobe: structured minimalist outfits â black and ivory palette. Lighting: high contrast spotlights, fine-art magazine atmosphere."}]},{id:"couple-lifestyle-analog",label:"Lifestyle Analog Snapshot",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-lifestyle-analog.webp",formSetting:[{label:"Lifestyle Analog Snapshot",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Scene: candid everyday life captured on analog film. Couple lying on the bed laughing, or brushing teeth together in morning light. Expression: natural, playful, real. Wardrobe: simple homewear or tees. Lighting: grainy daylight or tungsten bulb glow. Mood: authentic, documentary, heartfelt."}]},{id:"couple-high-fashion-bw",label:"High-Fashion Black & White",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-high-fashion-bw.webp",formSetting:[{label:"High-Fashion Black & White",id:"prompt-preset",to:"prompt",type:"string",value:"Use the human figures in the provided images to generate an AI couple photo. Style: luxury fashion editorial in black and white. Scene: studio setup with dramatic spotlight and geometric shadows. Couple posing with high-fashion attitude â one standing behind the other, both looking at camera with confidence. Wardrobe: tailored suits, structured dress, refined silhouette. Lighting: crisp contrast, glossy highlights, magazine-grade polish."}]},{id:"couple-modern-magazine-cover",label:"Modern Romance Magazine",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-modern-magazine-cover.webp",formSetting:[{label:"Modern Romance Magazine",id:"prompt-preset",to:"prompt",type:"string",value:'Use the human figures in the provided images to generate an AI couple photo as the cover of a high-end fashion magazine. Masthead reads "ICONIC PAIRS". The main headline is "THE POWER COUPLE ISSUE". The couple dominates the entire cover in a single, large, stylish, professional studio photograph. They are wearing chic, coordinated designer outfits with confident expressions. The lighting is high-contrast and glossy. Text overlays on the sides read "Style Secrets" and "Better Together".'}]},{id:"couple-vintage-romance-gazette",label:"Vintage Romance Gazette",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-vintage-romance-gazette.webp",formSetting:[{label:"Vintage Romance Gazette",id:"prompt-preset",to:"prompt",type:"string",value:'Use the human figures in the provided images to generate an AI couple photo in the style of an antique, sepia-toned newspaper front page. Main headline in old-fashioned serif font reads: "EXTRA! ETERNAL LOVE DECLARED!". The layout features one large, central engraving-style photograph of the couple posing formally in vintage attire. Below this main image, there is a row of three smaller, distinct candid photos showing different happy moments. Text columns with ornamental borders surround the photos. Date stamp reads "EST. TRUE LOVE".'}]},{id:"couple-pop-art-romance",label:"Pop Art Passion",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-pop-art-romance.webp",formSetting:[{label:"Pop Art Passion",id:"prompt-preset",to:"prompt",type:"string",value:'Use the human figures in the provided images to generate an AI couple photo in a retro Pop Art style inspired by Roy Lichtenstein. The image is a single, dramatic comic panel featuring a close-up of the couple in a passionate embrace or kiss. Heavy black outlines, bold primary colors (red, blue, yellow), and halftone dots. A large speech bubble above them reads: "MY ONE & ONLY!". A stylized sound effect text "SMOOCH!" is in the background. The mood is energetic and romantic.'}]},{id:"couple-wizarding-world-news",label:"Wizarding World Daily",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/couple/couple-wizarding-world-news.webp",formSetting:[{label:"Wizarding World Daily",id:"prompt-preset",to:"prompt",type:"string",value:'Use the human figures in the provided images to generate an AI couple photo modeled after a "Daily Prophet" magical newspaper. The masthead reads: "THE WIZARDING WEEKLY". The main headline screams: "MAGICAL UNION CONFIRMED!". The layout features a single, large "moving photograph" (still image with motion blur effect) of the couple waving or casting a spell together in wizard robes. The parchment texture is old and magical. Sub-headline reads: "A Love Spell That Cannot Be Broken."'}]}]},tv=[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:3}],ty={"AI Photo":eq(eU,[{id:"ai-image-app-photo-style",label:"Photo Style",description:"Apply creative photographic styles to your portrait.",options:{imageUrl:"/assets/create/app/photo/style-low-key-gradient-portrait.webp",setPrompt:"Using the provided image, create an editorial low-key color portrait. Purpose: sculpt the subject with dramatic side lighting against a dark-to-light gradient. Template [lighting: [soft directional rim]; background: [black-to-light gradient]; palette: [refined, slightly desaturated]]. Notes: keep likeness and natural skin tones; preserve negative space and clean contours.",examples:[{id:"style-vintage-polaroid",label:"Style (Vintage Polaroid)",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/style-vintage-polaroid.webp",formSetting:[{label:"Style (Vintage Polaroid)",id:"prompt-preset",to:"prompt",type:"string",value:"Using the provided image, apply a vintage Polaroid look. Purpose: evoke nostalgic instant-film aesthetics. Template [focu
158s: [soft]; palette: [faded warm]; border: [white Polaroid]; imperfections: [subtle grain/light leak]]. Notes: keep subject legible; avoid heavy artifacts or text overlays."}]},{id:"pf-fashion-studio",label:"Fashion Studio Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/pf-fashion-studio.webp",formSetting:[{label:"Fashion Studio Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image. Realistic studio portrait in high resolution, with professional fashion styling. Subject wearing a tailored blazer and fitted trousers with white sneakers; seated on a tall stool. (beige|studio gray|deep blue|warm tan) gradient studio background, single spotlight key, cinematic composition, fashion editorial tone."}]},{id:"pf-cinematic-side",label:"Cinematic Side Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/pf-cinematic-side.webp",formSetting:[{label:"Cinematic Side Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image. Cinematic side portrait of the subject with head tilted upward and eyes closed. Deep blue backdrop with a warm spotlight from the upper right, forming contrast between orange highlights and cool blue shadows. Studio lighting with soft gradient tones, minimalist artistic atmosphere, resembling a modern fashion magazine shoot."}]},{id:"pf-moody-editorial-chair",label:"Moody Editorial Chair Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/pf-moody-editorial-chair.webp",formSetting:[{label:"Moody Editorial Chair Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image. Cinematic editorial portrait indoors, subject seated on a modern chair with relaxed yet confident posture at a 3/4 angle. Dark wardrobe with structured silhouette (e.g. turtleneck and blazer), soft moody lighting with geometric light reflections on a dark wall. Emphasize color contrast between soft pink-purple highlights and deep shadows. High-end fashion aesthetic, art magazine tone, no text or watermark."}]},{id:"style-low-key-gradient-portrait",label:"Style (Low-Key Gradient Portrait)",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/style-low-key-gradient-portrait.webp",formSetting:[{label:"Style (Low-Key Gradient Portrait)",id:"prompt-preset",to:"prompt",type:"string",value:"Using the provided image, create an editorial low-key color portrait. Purpose: sculpt the subject with dramatic side lighting against a dark-to-light gradient. Template [lighting: [soft directional rim]; background: [black-to-light gradient]; palette: [refined, slightly desaturated]]. Notes: keep likeness and natural skin tones; preserve negative space and clean contours."}]},{id:"style-cinematic-film",label:"Style (Cinematic Film Look)",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/style-cinematic-film.webp",formSetting:[{label:"Style (Cinematic Film Look)",id:"prompt-preset",to:"prompt",type:"string",value:"Using the provided image, regrade to a cinematic film look. Purpose: deliver a cohesive movie-style aesthetic. Template [reference: [director/film]; palette: [teal-orange/pastel/etc.]; grain: [subtle]; aspect: [2.35:1]]. Notes: retain natural skin tones and balanced exposure."}]},{id:"style-golden-hour",label:"Style (Golden Hour Glow)",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/style-golden-hour.webp",formSetting:[{label:"Style (Golden Hour Glow)",id:"prompt-preset",to:"prompt",type:"string",value:"Using the provided image, relight to golden-hour glow. Purpose: create warm, nostalgic ambiance. Template [sun: [low/directional]; shadows: [long/soft]; temperature: [warm]]. Notes: keep composition and pose unchanged; avoid over-orange skin."}]},{id:"style-fashion-cover",label:"Fashion Magazine Cover",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/style-fashion-cover.webp",formSetting:[{label:"Fashion Magazine Cover",id:"prompt-preset",to:"prompt",type:"string",value:"Using the provided image, craft a high-fashion magazine cover. Purpose: elevate the subject into a bold, editorial key visual. Template [pose/expression: [impactful/refined]; lighting: [dramatic studio]; color grade: [stylized]; layout: [negative space for magazine title/headlines]]. Notes: keep identity consistent;
158 maintain crisp focus on eyes and product if present."}]},{id:"pf-editorial-bw-cover",label:"Black-and-White Editorial Cover",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/pf-editorial-bw-cover.webp",formSetting:[{label:"Black-and-White Editorial Cover",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image. Black-and-white fashion magazine editorial cover style, minimalist gray backdrop, soft dramatic lighting. Subject wearing loose white shirt and dark trousers, expressive pose partially obscuring the face. Include bold fashion typography composition elements (ZARA-like aesthetic), cinematic tone, refined editorial elegance."}]},{id:"pf-dramatic-bw-silhouette",label:"Dramatic Monochrome Silhouette",type:"prompt",category:"preset",previewUrl:"/assets/create/app/photo/pf-dramatic-bw-silhouette.webp",formSetting:[{label:"Dramatic Monochrome Silhouette",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image. Dramatic black-and-white studio portrait with high contrast lighting and minimalist mood. Subject standing with back to camera, head slightly lowered, side face partially visible. Emphasize silhouette, clean horizontal light beam on backdrop, dark jacket blending with shadow. Cinematic and introspective tone, fine art editorial composition."}]}],promptEnhanceSettings:ef},supportAddFiles:tv},{id:"ai-image-app-headshot-photo",label:"Professional Headshots",description:"Female & Male Professional Headshots presets",options:{imageUrl:"/assets/create/app/photo/style-professional-headshot.webp",setPrompt:"Use the provided image. Create a photo based on the person in the reference image, Person in charcoal tailored blazer and ivory silk blouse; confident soft smile; three-quarter left angle; medium-gray seamless background; soft key at 45 degrees, fill minus one, gentle hair light, clear cheek highlight, refined texture.",examples:[{id:"hs-f-classicblazersilk",label:"Classic Blazer + Silk",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-classicblazersilk.webp",formSetting:[{label:"Classic Blazer + Silk",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in charcoal tailored blazer and ivory silk blouse; confident soft smile; three-quarter left angle; medium-gray seamless background; soft key at 45 degrees, fill minus one, gentle hair light, clear cheek highlight, refined texture."}]},{id:"hs-f-lowkey-charcoal",label:"Low-Key Charcoal",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-lowkey-charcoal.webp",formSetting:[{label:"Low-Key Charcoal",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in black blazer and simple stud earrings; serious focused expression; three-quarter right angle; deep charcoal textured background; Rembrandt key at 45 degrees, fill minus two, crisp rim light, elegant separation."}]},{id:"hs-m-classicnavy",label:"Classic Navy Corporate",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-classicnavy.webp",formSetting:[{label:"Classic Navy Corporate",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in navy two-button suit and white oxford shirt; neutral confident expression, slight smile; three-quarter turn left; medium-gray seamless background; soft key at 45 degrees, fill minus one, subtle hair light, clear catchlights."}]},{id:"hs-m-lowkey-charcoal",label:"Low-Key Charcoal",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-lowkey-charcoal.webp",formSetting:[{label:"Low-Key Charcoal",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in dar
158k blazer over black crew shirt; serious focused expression; three-quarter left pose; deep charcoal textured background; Rembrandt key light, fill minus two, strong hair rim, sculpted contrast, sharp jawline definition."}]},{id:"hs-f-creative-dress",label:"Creative Dress",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-creative-dress.webp",formSetting:[{label:"Creative Dress",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in soft beige wrap dress; relaxed friendly smile; slight head tilt to right; pale slate gradient background; large softbox key at 30 degrees, fill minus one, subtle hair rim, natural glow, refined posture."}]},{id:"hs-f-outdoor-greenshade",label:"Outdoor Green Shade",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-outdoor-greenshade.webp",formSetting:[{label:"Outdoor Green Shade",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in navy blazer over white blouse; open pleasant smile; relaxed shoulders, eyes straight to lens; greenery bokeh background; soft open shade light, sky fill, gold reflector, natural tones, delicate catchlights."}]},{id:"hs-f-highkey-white",label:"High-Key White",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-highkey-white.webp",formSetting:[{label:"High-Key White",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in ivory blouse with ruffled detail; bright friendly smile; chin lifted slightly; seamless pure white background; twin softboxes, minimal shadows, airy glow, subtle hair light, clear catchlights."}]},{id:"hs-f-office-window",label:"Office Window Blur",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-office-window.webp",formSetting:[{label:"Office Window Blur",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in gray blazer over white tee; confident half-smile; hands folded at waist; blurred office skyline background; window light at 45 degrees, desk bounce fill, soft hair light, natural balanced color."}]},{id:"hs-f-casual-knit",label:"Casual Knit Top",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-casual-knit.webp",formSetting:[{label:"Casual Knit Top",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in soft pastel knit top; gentle approachable smile; square to camera with relaxed shoulders; pale blue gradient background; soft large-diffusion key, fill minus one, smooth hair rim, even skin tones, clean natural look."}]},{id:"hs-f-tealtop-clamshell",label:"Teal Blouse Clamshell",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-f-tealtop-clamshell.webp",formSetting:[{label:"Teal Blouse Clamshell",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in teal blouse with subtle jewelry; warm approachable smile; squared shoulders, chin slightly down; warm gray background; clamshell lighting with top key and reflector, balanced skin tone, sparkling eyes, graceful neckline."}]},{id:"hs-m-bizcasual-tealgray",label:"Business Casual (Charcoal + Light Blue)",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-bizcasual-tealgray.webp",formSetting:[{label:"Business Casual (Charcoal + Light Blue)",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in light blue button-down with charcoal blazer, no tie; relaxed approachable smile; shoulders squared, leaning slightly forward; warm gray vignette background; clamshell lighting with top key and reflector, bright eyes, smooth skin tone."}]},{id:"hs-m-tech-turtleneck",label:"Tech Turtleneck",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-tech-turtleneck.webp",formSetting:[{label:"Tech Turtleneck",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in black merino turtleneck; calm neutral expression with direct eye contact; three-quarter right pose; dark charcoal textured background; soft diffusion key at 45 degrees, negative fill far side, subtle hair rim, controlled highlights."}]},{id:"hs-m-creative-sweater",label:"Creative Knit Sweater",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-creative-sweater.webp",formSetting:[{label:"Creative Knit Sweater",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in light gray crew-neck knit sweater; gentle half-smile, approachable demeanor; square to camera, relaxed shoulders; slate blue gradient background; large softbox key, fill minus one and a half stops, subtle rim, natural tones."}]},{id:"hs-m-outdoor-greenshade",label:"Outdoor Green Shade",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-outdoor-greenshade.webp",formSetting:[{label:"Outdoor Green Shade",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in navy oxford shirt, top button open; friendly small smile; standing relaxed, eyes toward lens; greenery bokeh background; open shade, sky key light, reflector at waist, cool fill, crisp catchlights, natural skin color."}]},{id:"hs-m-highkey-white",label:"High-Key White",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-highkey-white.webp",formSetting:[{label:"High-Key White",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in white dress shirt with pale gray tie; bright confident smile; chin slightly forward, straight posture; seamless white background; twin softboxes left and right, even fill, subtle hair light, vivid catchlights, airy exposure."}]},{id:"hs-m-office-window",label:"Office Window Blur",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/headshot/hs-m-office-window.webp",formSetting:[{label:"Office Window Blur",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in light sweater layered under navy blazer; relaxed confident smile, arms loosely crossed; blurred office windows in background; natural window key, bounce fill from desk, subtle hair light, balanced tone, professional warmth."}]}],promptEnhanceSettings:ef},supportAddFiles:tv},{id:"ai-image-app-profile-picture",label:"Profile Picture",description:"Female & Male Profile Picture presets",options:{imageUrl:"/assets/create/app/style-lifestyle-profile.webp",setPrompt:"Use the provided image. Create a realistic photo based on the person in the reference image, Person in light denim jacket over pastel blouse, soft approachable smile; blurred park greenery background; side daylight key, subtle hair rim, natural candid expression.",examples:[{id:"pf-f-outdoor-casual",label:"Outdoor Casual Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-outdoor-casual.webp",formSetting:[{label:"Outdoor Casual Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in light denim jacket over pastel blouse, soft approachable smile; blurred park greenery background; side daylight key, subtle hair rim, natural candid expression."}]},{id:"pf-f-coffeeshop",label:"Coffee Shop Vibe",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-coffeeshop.webp",formSetting:[{label:"Coffee Shop Vibe",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in beige knit sweater, bright warm smile, chin slightly tilted; blurred coffee shop interior with golden lights; window daylight key, reflector bounce, cozy lifestyle mood."}]},{id:"pf-f-beachsunset",label:"Beach Sunset Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-beachsunset.webp",formSetting:[{label:"Beach Sunset Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in flowy white dress, joyful open smile, hair moving in breeze; blurred ocean horizon at sunset; warm golden rim light, balanced fill, relaxed vacation spirit."}]},{id:"pf-f-selfie-natural",label:"Natural Selfie",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-selfie-natural.webp",formSetting:[{label:"Natural Selfie",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in casual t-shirt, playful smile, eyes slightly squinting toward lens; blurred indoor wall background; daylight from window, minimal fill, authentic natural selfie tone."}]},{id:"pf-f-flatcolor-pinktop",label:"Flat Color Illustration (Pink Top)",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-flatcolor-pinktop.webp",formSetting:[{label:"Flat Color Illustration (Pink Top)",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in pink sleeveless top, soft smile, head tilted gently; flat-color illustration style; minimal pastel purple and teal background;
158 bold clean lines, simple shapes, playful clarity, social-friendly mood."}]},{id:"pf-f-disney-sparkle",label:"Disney Style",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-disney-sparkle.webp",formSetting:[{label:"Disney Style",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in teal blouse with soft ruffles, radiant confident smile, eyes slightly widened; Disney 3D style with polished shading; glowing pastel background; glossy eyes, delicate highlights, rounded stylization."}]},{id:"pf-f-3d-moderncasual",label:"3D Render Modern Casual",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-3d-moderncasual.webp",formSetting:[{label:"3D Render Modern Casual",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in white off-shoulder top, small friendly smile, head turned three-quarter; realistic 3D render with soft GI lighting; muted warm gradient background; smooth textures, natural skin shading, cinematic balance."}]},{id:"pf-f-cartoon-vivid",label:"Vivid Cartoon",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-f-cartoon-vivid.webp",formSetting:[{label:"Vivid Cartoon",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in yellow t-shirt, lively wide smile, exaggerated hair silhouette; cartoon style with bold black outlines; solid turquoise background; simplified shading, playful shapes, energetic vibe."}]},{id:"pf-m-outdoor-casual",label:"Outdoor Casual Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-outdoor-casual.webp",formSetting:[{label:"Outdoor Casual Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in denim jacket over white tee, relaxed half-smile, natural gaze; blurred urban street background; golden hour light from side, soft rim glow, candid posture, approachable tone."}]},{id:"pf-m-coffeeshop",label:"Coffee Shop Vibe",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-coffeeshop.webp",formSetting:[{label:"Coffee Shop Vibe",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in light sweater, warm genuine smile, leaning forward slightly; blurred coffee shop interior with warm bokeh lights; daylight window key, soft reflector fill, cozy lifestyle feel."}]},{id:"pf-m-beachsunset",label:"Beach Sunset Portrait",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-beachsunset.webp",formSetting:[{label:"Beach Sunset Portrait",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in casual linen shirt, cheerful smile, wind in hair; blurred ocean horizon at sunset; warm backlight rim from low sun, balanced fill on face, relaxed vacation vibe."}]},{id:"pf-m-selfie-natural",label:"Natural Selfie",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-selfie-natural.webp",formSetting:[{label:"Natural Selfie",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Realistic photo, Person in casual hoodie, playful smile, head slightly tilted toward camera; indoor background with soft blur; overhead daylight from window, natural contrast, authentic candid style."}]},{id:"pf-m-flatcolor-bluehoodie",label:"Flat Color Illustration (Blue Hoodie)",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-flatcolor-bluehoodie.webp",formSetting:[{label:"Flat Color Illustration (Blue Hoodie)",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in casual blue hoodie, relaxed smile, head slightly tilted; clean flat-color illustration style; minimal geometric background with two-tone pastel; bold outlines, simplified shading, clear silhouette, friendly social vibe."}]},{id:"pf-m-disney-clean",label:"Disney Style",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-disney-clean.webp",formSetting:[{label:"Disney Style",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in navy polo shirt, cheerful approachable grin, chin slightly lifted; Disney 3D style with smooth shading; whimsical gradient sky background; rounded features, glossy eyes, polished cinematic light."}]},{id:"pf-m-3d-casualshirt",label:"3D Render Casual",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-3d-casualshirt.webp",formSetting:[{label:"3D Render Casual",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in casual plaid shirt, half-smile with playful expression, facing camera; realistic 3D render style with soft ray-traced lighting; minimal gray backdrop with subtle vignette; smooth textures, stylized realism."}]},{id:"pf-m-cartoon-bold",label:"Bold Cartoon",type:"prompt",category:"preset",previewUrl:"/assets/create/ai-photo/avatar/pf-m-cartoon-bold.webp",formSetting:[{label:"Bold Cartoon",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo based on the person in the reference image, Person in red crew-neck tee, wide grin, slightly exaggerated features; cartoon comic style with thick outlines; bright yellow flat background; playful proportions, simplified shadows, saturated tones."}]}],promptEnhanceSettings:ef},supportAddFiles:tv},{id:"ai-image-app-passport-photo",label:"Passport Photo",description:"Passport Photo presets",options:{imageUrl:"/assets/create/app/ai-passport-photo.webp",setPrompt:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background,",examples:[{id:"default",label:"Original Outfit",type:"prompt",category:"preset",formSetting:[{label:"Original Outfit",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background,"}]},{id:"dark-collared-shirt",label:"Dark Business Shirt",type:"prompt",category:"preset",formSetting:[{label:"Dark Business Shirt",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background, wearing a plain dark-colored collared business shirt,"}]},{id:"dark-polo-shirt",label:"Dark Polo Shirt",type:"prompt",category:"preset",formSetting:[{label:"Dark Polo Shirt",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background, wearing a simple dark-colored polo shirt,"}]},{id:"dark-crew-neck-sweater",label:"Dark Crew Neck Sweater",type:"prompt",category:"preset",formSetting:[{label:"Dark Crew Neck Sweater",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background, wearing a dark, solid-color crew neck sweater,"}]},{id:"business-suit",label:"Business Suit",type:"prompt",category:"preset",formSetting:[{label:"Business Suit",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background, wearing a dark business suit jacket over a white collared shirt,"}]},{id:"simple-blouse",label:"Simple Solid Blouse",type:"prompt",category:"preset",formSetting:[{label:"Simple Solid Blouse",id:"prompt-preset",to:"prompt",type:"string",value:"Use the provided image. Create a photo for passport of the person in the reference image, bust shot, facing forward, neutral expression, solid white background, wearing a simple dark-colored blouse with a modest neckline,"}]}],promptEnhanceSettings:ef},supportAddFiles:tv},{id:"ai-image-app-couple-photo",label:"Couple Photo",description:"Couple Photo presets",options:{imageUrl:"/assets/create/app/photo/couple/couple-korean-minimal.webp",setPrompt:tf.examples[0].formSetting[0].value,...tf,promptEnhanceSettings:ef},supportAddFiles:[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"Reference Image 2",type:"image",isRequired:!0,isSupport:1}]}])};eL.object({subject_appearance:eL.string().describe("Describe the appearance of this influencer/character. **Aesthetic Goal: 'Attractive everyday person' or 'aspiring KOL'.** Emphasize ultra-realistic skin texture and natural pores. Avoid plastic-like artificial skin. The look should be polished but authentic. Clearly state the race, age, and hairstyle."),outfit_styling:eL.string().describe("Wardrobe choices that define the specific niche (e.g., casual hoodie, blazer, activewear). Clothing should look natural and fit the specific sce
158nario (e.g., comfortable top if sitting at a desk)."),environment_context:eL.string().describe("The background setting. **Context matters:** If the scene implies a workspace, describe a desk environment; if lifestyle, a living room or outdoor street. Focus on 'realistic environments' with natural lighting."),pose_interaction:eL.string().describe("Body language and engagement. **Mandatory: Completely FRONT-FACING and looking directly at the camera.** \n**Dynamic Poses:** Avoid static, stiff 'arms-down' poses. Use context-appropriate postures: e.g., 'sitting at a desk leaning slightly forward', 'standing with conversational hand gestures', or 'relaxed posture'. \n**Hand Rule:** Hands must be **EMPTY** (holding nothing) to avoid AI generation errors, but should be **expressive**âgesturing naturally or resting on a surface. DO NOT hide hands unnaturaly, but DO NOT hold objects."),facial_expression:eL.string().describe("Facial emotion matching the script. **Lip-Sync Safe:** Mouth must be 'slightly closed' or 'naturally relaxed'. **Strictly NO wide open mouths or teeth-showing smiles** to ensure high-quality voiceover syncing."),composition_photography:eL.string().describe("Technical framing for vertical video (9:16). **Variable Framing:** Choose the framing that best fits the intimacy of the sceneâcan be **'Close-Up' (head and shoulders)** for intimate talks, or **'Waist-Up' / 'Medium Shot'** for general storytelling. \n**Key Requirements:** Front view, sharp focus on the face, and maintain a small empty space at the very top for subtitles. High-quality phone camera aesthetic.")});let tb=eL.object({hook_concept:eL.string().describe("Identifier: 'Shocking Reveal'. The concept is a sudden, unbelievable discovery."),character_appearance:eL.string().describe("Describe a distinct persona (e.g., 'Gen-Z fashionista' or 'Casual Gamer'). Mention everyday clothing details like a loose hoodie or messy bun."),expression_emotion:eL.string().describe("MICRO-EXPRESSION SHOCK: The moment of realization. Eyes widen significantly, eyebrows shoot up, breath catches in the throat (inhale). A split-second 'freeze' before the reaction. Not a cartoonish jaw-drop; keep mouth natural."),action_movement:eL.string().describe("Handheld Jolt: The camera shakes slightly as if the holder is startled. The body leans back instinctively. A hand might fly up to cover the mouth or chest in a natural, swift motion."),visual_style:eL.string().describe("Phone Selfie Style: Vertical framing, slightly shaky handheld camera. Natural indoor lighting (maybe mixed color temp). High-quality texture (pores, hair strands visible).")}),tw=eL.object({hook_concept:eL.string().describe("Identifier: 'Heartbreaking Realization'. The concept is intense sadness, vulnerability, or bad news."),character_appearance:eL.string().describe("Vulnerable look: minimal makeup, perhaps messy hair or comfortable 'home' clothes. Looks tired or worn out."),expression_emotion:eL.string().describe("RAW VULNERABILITY: Red-rimmed eyes, tears pooling or a single tear tracking down. The chin quivers (micro-tremor). The subject looks down, then forces eye contact with the lens. The attempt to *stop* crying is often more powerful than wailing."),action_movement:eL.string().describe("Subtle, heavy movements: Shoulders slumped. A slow wipe of a tear with a knuckle or sleeve. Deep, shaky breath. The camera drifts slowly, matching the low energy."),visual_style:eL.string().describe("Intimate Selfie: Close-up on face. Soft, possibly low-light or window light. Shallow depth of field but keeping eyes in sharp focus. No filters.")}),tx=eL.object({hook_concept:eL.string().describe("Identifier: 'POV: Look at This'. The concept is sharing something exciting or secret directly with the viewer."),character_appearance:eL.string().describe("Engaging Presenter: Bright, approachable look. Smart casual or trendy outfit."),expression_emotion:eL.string().describe("CONVERSATIONAL INTIMACY: Eyebrows raised in interest ('You won't believe this'). A genuine, asymmetrical smile. Intense, friendly eye contact that feels like they are gossiping with a best friend."),action_movement:eL.string().describe("Engagement Gestures: Leaning in confidentially toward the lens. One hand gestures broadly or points to a text-space, then returns to a relaxed position. Head tilts and nods to emphasize points."),visual_style:eL.string().describe("Bright Vlogging Style: Well-lit (ring light or bright window). Clear, sharp focus. Stable but handheld camera feel. Vibrant but realistic colors.")}),t_=[{label:"Shocked / Surprise",type:"preset",category:"preset",previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/video/hook_shocked.mp4",formSetting:[{id:"preset-prompt",label:"Shocked Reaction",to:"prompt",type:"string",value:e$(tb)}]},{label:"Crying / Sadness",type:"preset",category:"preset",previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/video/hook_crying.mp4",formSetting:[{id:"preset-prompt",label:"Crying Reaction",to:"prompt",type:"string",value:e$(tw)}]},{label:"POV / Pointing",type:"preset",category:"preset",previewUrl:"https://assets.aiomnigen.com/aiomnigen/avatar/video/hook_pointing.mp4",formSetting:[{id:"preset-prompt",label:"POV Pointing",to:"prompt",type:"string",value:e$(tx)}]}],tk=eq(eD,[{id:"ai-video-app-ai-video-hook",label:"AI Video Hook",de
158scription:"Create scroll-stopping hook videos with exaggerated expressions.",options:{...{promptEnhanceSettings:{system_prompt:` 159You are an AI prompt generator specialized in HYPER-REALISTIC UGC (User Generated Content) video hooks. 160Your goal is to generate prompts that create characters who feel like real people filming on their phones, not AI avatars. 161 162For each request, you will receive: 163- User intent and any extra notes (optionally with referenced media such as an image). 164- A preset description in the form of a JSON Schema (converted to JSON). 165 This schema defines a set of string fields you must fill. 166 Each field includes a description that tells you exactly what to generate. 167 168Your tasks: 169 1701. **Character & Context Analysis (CRITICAL)**: 171 - **Persona**: Define who this person is (e.g., "stressed student", "excited foodie", "tired parent"). 172 - **Setting**: Ensure the background matches the persona (e.g., messy dorm, busy street, car interior). 173 - **Lighting**: Specify natural, imperfect lighting (e.g., "phone screen glow", "harsh overhead light", "window light hitting one side of face"). 174 1752. **Design "Micro-Acting" & Expressions**: 176 - Avoid generic terms like "happy" or "sad". Describe the **physical mechanics**: "corners of mouth twitch," "rapid blinking," "deep inhale before speaking," "biting lip." 177 - **Eyes**: The eyes must be alive. Mention gaze direction, pupil dilation, or squinting. The subject should mostly look AT the lens (audience connection). 178 - **Mouth**: Ensure the mouth shape is natural (e.g., "slightly parted," "relaxed"). Avoid "wide open scream" unless specified, as it ruins lip-sync potential. 179 1803. **Natural Movement & Camera Work**: 181 - **Camera**: It must feel handheld. Mention "subtle sway," "adjusting grip," or "walking bounce." 182 - **Body**: Characters shouldn't be statues. They should shift weight, touch their hair, fix their collar, or lean in/out. 183 1844. **Realism Constraints (VERY IMPORTANT)**: 185 - **Imperfection is Key**: Perfect skin/hair looks fake. Mention texture, flyaway hairs, skin pores, or slight sweat. 186 - **No Glitches**: Avoid complex hand interactions (holding complex objects) that AI struggles with. Keep hands simple but expressive (open palm gestures, touching face). 187 - **NO Cinematic Effects**: No crash zoom, no heavy contrast, no bokeh overload. It should look like a smartphone video. 188 1895. **Output format**: 190 - Return a single JSON object encoded as a string. 191 - The JSON object must match the provided JSON Schema: every field present and every value a string. 192 - Do not include explanations, comments, markdown, or any text outside of the JSON object. 193 194### Output 195Return ONLY this JSON object: 196{ 197 results: [ 198 "ugc video hook json format string prompt" 199 ] 200} 201`.trim()},examples:[...t_,...eu]}},supportAddFiles:[{name:"control_images",label:"Start Image",type:"image",isRequired:!0,isSupport:1}]}]),tS=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Possession POV'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea as a SINGLE CONTINUOUS SHOT: the camera starts in a third-person view and smoothly becomes the Point of View (POV) of a character or entity. CRITICAL: Mention how the subject's action in the start frame motivates this shift (e.g., they look at something, and we swoop in to see it). The transition must be seamless, with no jump cuts."),startAndEndFocus:eL.string().describe("In 1â2 English sentences, describe the Start and End frames, focusing on the SUBJECTS. What is the subject doing in Frame A that leads to Frame B? (e.g., 'The woman turns her head left in Frame A, matching the street view in Frame B'). Ensure the environment connects logically."),povOwnerAndTakeover:eL.string().describe("In 1â2 English sentences, describe the 'Takeover Moment'. Who becomes the POV owner? How does the camera move relative to the subject to enter their eyes/perspective? (e.g., 'The camera zooms into the visor of the astronaut'). The motion should be physically motivated by the subject's movement or position."),povJourneyStyleAndMood:eL.string().describe("In 1â2 English sentences, describe the camera's journey. Is it a shaky handheld run, a smooth glide, or a predatory stalk? How does the world look from this new perspective? Connect the mood to the subject's emotion (e.g., 'Frantic breathing as the camera rushes forward').")}),tj=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Masked-by-Motion Transition'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: a moving object sweeps across the frame, covering the lens and revealing the next scene. CRITICAL: The masking object must be part of the scene's action (e.g., a passing bus, a closing door, a person walking by)."),startAndMaskingObject:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Object that will mask the cut. How does the SUBJECT interact with this object? (e.g., 'The man steps behind a pillar', 'The car drives past the camera'). The object's motion must be motivated by the scene."),cameraAndCoverageMoment:eL.string().describe("In 1â2 English sentences, describe the moment of full coverage. Does the camera track the object, or does the object rush at the lens? Describe the texture/blur of the object as it fills the screen, ensuring it matches the lighting of the Start frame."),revealAndMood:eL.string().describe("In 1â2 English sentences, describe the Reveal. As the object moves away, how is the End frame revealed? Does the new subject in Frame B step out from behind the mask? Ensure the motion of the reveal continues the momentum of the masking object.")}),tC=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Screen / Frame Jump'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: the camera pushes into a picture, screen, or window in the Start frame and enters the world inside it (the End frame). CRITICAL: Describe how the subject in Frame A interacts with this frame (e.g., 'The boy looks intently at the TV')."),startAndPortalSurface:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Portal (screen, painting, mirror). What is the subject doing relative to it? Is the End frame visible inside this portal initially? (e.g., 'The painting on the wall shows the landscape of Frame B')."),pushInAndBoundaryMoment:eL.string().describe("In 1â2 English sentences, describe the Push-In. The camera dives toward the surface. Describe the shift in depth of field or resolution as we get closer. The boundary crossing should feel like stepping through a window, not a digital glitch."),emergenceAndMood:eL.string().describe("In 1â2 English sentences, describe the Emergence. We are now inside the world of Frame B. How does the camera settle? Does the subject of Frame B acknowledge the arrival? (e.g., 'We emerge on the street, and the cyclist rides past').")}),tI=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Object-Ride Camera'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: the camera attaches to or chases a moving object that travels from Scene A to Scene B. CRITICAL: The object must be launched or controlled by the subject in Frame A (e.g., 'The girl throws a paper plane')."),startAndObjectChoice:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Object (ball, drone, arrow, bird). How does the subject set it in motion? (e.g., 'The pitcher throws the baseball'). The object bridges the two worlds."),pathAndInFlightVisuals:eL.string().describe("In 1â2 English sentences, describe the Flight. What does the camera see as it rides the object? Blur, wind, passing scenery? Describe how the environment morphs or travels from the setting of Frame A to Frame B."),arrivalAndStyle:eL.string().describe("In 1â2 English sentences, describe the Arrival. The object lands, hits, or passes through the End frame. How does the subject in Frame B interact with it? (e.g., 'The dog catches the ball in the park').")}),tN=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Micro-to-Macro'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: the camera zooms into a tiny detail in Frame A (e.g., an eye, a fabric texture) and pulls back to reveal it is part of Frame B. CRITICAL: Use a feature of the Subject (eye, skin, jewelry) as the bridge."),microDetailAndEntry:eL.string().describe("In 1â2 English sentences, describe the Micro Detail. What specific part of the Subject in Frame A do we zoom into? (e.g., 'The reflection in the warrior's eye'). Describe the texture and color."),diveAndAbstractWorld:eL.str
201ing().describe("In 1â2 English sentences, describe the Dive. As we get extremely close, the image becomes abstract patterns of light/texture. This abstract phase bridges the gap. How does the motion feel? (Fast, disorienting, or slow and precise?)"),macroRevealAndMood:eL.string().describe("In 1â2 English sentences, describe the Pull Back. The abstract texture resolves into a large object in Frame B. (e.g., 'The golden texture becomes the sun setting over the ocean'). The transition reveals the scale difference.")}),tA=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Reflection Handover'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: the camera moves into a reflection (mirror, water, glass) which contains the End scene. CRITICAL: The subject in Frame A should be looking at or interacting with this reflection."),surfaceAndStartView:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Reflective Surface. How does the Subject interact with it? (e.g., 'The woman touches the rainy window'). What do we see reflected initially?"),cameraApproachAndReflectionShift:eL.string().describe("In 1â2 English sentences, describe the Approach. The camera moves closer to the reflection. As it does, the reflection shifts or clarifies to show the End frame more clearly. The world 'outside' the reflection blurs."),crossingAndMood:eL.string().describe("In 1â2 English sentences, describe the Crossing. We pass through the surface (ripples, glass refraction) and emerge fully into the End scene. The subject of Frame B is now real, not a reflection.")}),tT=[{label:"Possession POV",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Possession POV",to:"prompt",type:"string",value:e$(tS)}]},{label:"Masked-by-Motion Transition",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Masked-by-Motion Transition",to:"prompt",type:"string",value:e$(tj)}]},{label:"Screen / Frame Jump",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Screen / Frame Jump",to:"prompt",type:"string",value:e$(tC)}]},{label:"Object-Ride Camera",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Object-Ride Camera",to:"prompt",type:"string",value:e$(tI)}]},{label:"Micro-to-Macro",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Micro-to-Macro",to:"prompt",type:"string",value:e$(tN)}]},{label:"Reflection Handover",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Reflection Handover",to:"prompt",type:"string",value:e$(tA)}]}],tE=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Smoke Sweep Transition'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: a wave of smoke drifts across the screen, covering the view. CRITICAL: Describe how the smoke interacts with the SUBJECT in the Start frame (e.g., 'The smoke curls around the dancer's legs before enveloping her')."),startAndSmokeOrigin:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Smoke Source. Where does it come from relative to the subject? (e.g., 'Smoke rises from the floor'). Describe the subject's reaction if applicable."),coverageAndReveal:eL.string().describe("In 1â2 English sentences, describe the Coverage and Reveal. The smoke thickens to block the view. As it clears, how is the End frame revealed? Does the new subject emerge from the haze? (e.g., 'The smoke dissipates to reveal the warrior standing in the same spot')."),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Style. Is it ink-like, wispy, or thick industrial smoke? Ensure the mood fits the subject's emotion.")}),tR=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Nature Element Push'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: natural elements (leaves, petals) blow across the frame. CRITICAL: The elements must exist in the same 3D space as the subject (e.g., 'Petals blow past the bride's face')."),startSceneAndElements:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Elements. What triggers them? (Wind, a movement?). Describe the subject's interaction (e.g., 'The girl reaches out to catch a feather')."),flowCoverageAndReveal:eL.string().describe("In 1â2 English sentences, describe the Flow. The elements fill the screen. How does the End frame appear? Do the elements transform into the background of the new scene? (e.g., 'The autumn leaves settle to reveal the winter snow')."),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Mood. Is it romantic, stormy, or playful? Match the motion of the elements to the energy of the transition.")}),tU=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Dust / Sand Drift Transition'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: dust or sand sweeps across the camera. CRITICAL: Describe the physical impact on the subject (e.g., 'The traveler shields their eyes from the sandstorm')."),startEnvironmentAndDust:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Dust. Is it a desert wind or urban debris? How does it affect the visibility of the subject initially?"),sweepCoverageAndReveal:eL.string().describe("In 1â2 English sentences, describe the Sweep. The dust obliterates the view. As it settles or blows past, what is revealed? Ensure the transition of the ground/floor is logical."),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Mood. Gritty, ancient, or chaotic? The texture of the dust should match the environment.")}
201),tP=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Water Mist / Fog Reveal'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: mist or fog rolls in. CRITICAL: The mist should interact with the subject's depth (e.g., 'The fog swallows the figure walking away')."),startViewAndFogAppearance:eL.string().describe("In 1â2 English sentences, describe the Start frame and the Fog. Does it rise from the ground or roll in from the sea? How does the subject react to the change in atmosphere?"),obscuringAndRevealProcess:eL.string().describe("In 1â2 English sentences, describe the Obscuring. The subject becomes a silhouette. Then the fog lifts to reveal the End frame. Does the new subject step forward out of the mist?"),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Mood. Eerie, dreamlike, or cold? The density of the fog sets the emotional tone.")}),tD=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Ember / Sparkle Drift Transition'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: glowing embers or sparks drift across the frame. CRITICAL: Relate the light source to the subject (e.g., 'The blacksmith strikes the anvil, sending sparks that become the stars of the next scene')."),startSceneAndParticleSource:eL.string().describe("In 1â2 English sentences, describe the Start frame and Source. Where do the sparks come from? (Fire, magic, reflection). How do they light up the subject's face?"),particleBuildUpAndBlend:eL.string().describe("In 1â2 English sentences, describe the Build-Up. The particles fill the foreground. Describe how their light blends into the colors of the End frame."),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Style. Warm and cozy, or intense and magical? The motion should be floaty or energetic.")}),tz=eL.object({presetName:eL.string().describe("Short identifier of this preset. Always set this to the exact string: 'Light Burst Transition'."),goal:eL.string().describe("In 1â2 concise English sentences, describe the core idea: an intense burst of light. CRITICAL: The light must affect the scene exposure and the subject (e.g., 'The subject shields their eyes as the portal opens')."),lightSourceAndStartView:eL.string().describe("In 1â2 English sentences, describe the Start frame and Light Source. Is it the sun, a camera flash, or a magical orb? How does the lighting on the subject change before the full burst?"),flashCoverageAndTransition:eL.string().describe("In 1â2 English sentences, describe the Flash. The screen goes white/bright. As it fades, the End frame is revealed. Does the light recede to show the new landscape?"),styleAndMood:eL.string().describe("In 1â2 English sentences, describe the Mood. Divine, shocking, or energetic? The transition implies a high-energy shift.")}),tF=[{label:"Smoke Sweep",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Smoke Sweep",to:"prompt",type:"string",value:e$(tE)}]},{label:"Nature Element Push",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Nature Element Push",to:"prompt",type:"string",value:e$(tR)}]},{label:"Dust / Sand Drift",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Dust / Sand Drift",to:"prompt",type:"string",value:e$(tU)}]},{label:"Water Mist / Fog Reveal",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Water Mist / Fog Reveal",to:"prompt",type:"string",value:e$(tP)}]},{label:"Ember / Sparkle Drift",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Ember / Sparkle Drift",to:"prompt",type:"string",value:e$(tD)}]},{label:"Light Burst / Flash",type:"preset",category:"Preset",formSetting:[{id:"prompt-preset",label:"Light Burst / Flash",to:"prompt",type:"string",value:e$(tz)}]}],tM=[{name:"control_images",label:"Start Frame",type:"image",isRequired:!0,isSupport:1},{name:"control_images_2",label:"End Frame",type:"image",isRequired:!0,isSupport:1}],tO=[{id:"ai-video-app-camera-motion",label:"Camera Motion",description:"Create a cinematic camera-motion transition.",options:{promptEnhanceSettings:{system_prompt:` 202You are an AI prompt generator specialized in cinematic video transitions. 203Your goal is to bridge a Start Frame and an End Frame seamlessly using specific camera movements, ensuring the transition feels motivated by the subjects in the scene. 204 205For each request, you will receive: 206- A start frame and an end frame (as images or image descriptions). 207- A preset description in the form of a JSON Schema (converted to JSON). 208 209Your tasks: 210 2111. **Holistic Scene & Subject Analysis (CRITICAL)**: 212 - **Subjects**: Analyze the characters or main objects in both frames. Identify their actions, expressions, gaze directions, and micro-movements (e.g., turning head, walking forward, smiling). 213 - **Continuity**: Find visual links between the two frames. Does the subject's motion in Frame A naturally lead to the composition of Frame B? matches in lighting, color palette, or horizon line? 214 - **Environment**: How does the space physically connect? (e.g., "The hallway in Frame A opens up into the street in Frame B"). 215 2162. **Design the Dynamic Movement**:
217 - Do not just move the camera. **Move the world and the subjects.** 218 - If there is a person, describe their action during the transition (e.g., "As the camera pushes in, the subject looks up, bridging the cut"). 219 - Ensure the camera motion *reacts* to the subject (e.g., following a hand gesture, chasing a moving vehicle). 220 2213. **Apply the Preset Schema**: 222 - Follow the field descriptions in the provided JSON Schema. 223 - Use the fields to weave the subject's action and the camera's motion into one continuous shot description. 224 - **Smoothness Rule**: Avoid "morphing" or "fading" language. Describe physical travel, occlusion, or focus shifts that logically connect the two states. 225 2264. **Output format**: 227 - Return a single JSON object encoded as a string matching the schema. 228 - No markdown, no explanations outside the JSON. 229 230### Output 231Return ONLY this JSON object: 232{ 233 results: [ 234 "camera-motion transition json format string prompt" 235 ] 236} 237`.trim()},examples:tT},supportAddFiles:tM},{id:"ai-video-app-elemental-transition",label:"Elemental Transition",description:"Create a cinematic elemental transition.",options:{promptEnhanceSettings:{system_prompt:` 238You are an AI prompt generator specialized in elemental video transitions. 239Your goal is to seamlessly blend a Start Frame into an End Frame using elemental effects (smoke, light, particles) that interact physically with the subjects, rather than just overlaying them. 240 241For each request, you will receive: 242- A start frame and an end frame. 243- A preset description in the form of a JSON Schema. 244 245Your tasks: 246 2471. **Holistic Scene & Subject Analysis (CRITICAL)**: 248 - **Subjects**: Analyze the subjects in both frames. How should they react to the element? (e.g., shielding eyes from light, hair blowing in wind/smoke, looking towards the particle source). 249 - **Interaction**: The element must feel like it exists in the *same 3D space* as the subject. It should wrap around them, reflect on their skin, or be generated by their movement. 250 - **Bridge**: How does the element visually transform the subject from Frame A to Frame B? (e.g., "The smoke swirls around the warrior in Frame A, and as it clears, we reveal the modern dancer in Frame B in the same pose"). 251 2522. **Design the Dynamic Transition**: 253 - **Scene Dynamics**: Describe how the lighting and atmosphere change *caused* by the element affect the subject (e.g., "The burst of light casts long dynamic shadows on the subject's face before washing out the scene"). 254 - **Motion Continuity**: Match the direction of the elemental flow with the subject's movement (e.g., "The sand drifts right, following the runner's path"). 255 2563. **Apply the Preset Schema**: 257 - Follow the field descriptions in the schema. 258 - Describe the transition as a sequence: Reaction (Subject sees/feels element) -> Interaction (Element envelops scene) -> Transformation (Scene shifts behind element) -> Reveal (New subject emerges). 259 2604. **Output format**: 261 - Return a single JSON object encoded as a string matching the schema. 262 - No markdown, no explanations outside the JSON. 263 264### Output 265Return ONLY this JSON object: 266{ 267 results: [ 268 "elemental transition json format string prompt" 269 ] 270} 271`.trim()},examples:tF},supportAddFiles:tM}],tB=eq(eD,tO);eq(eD,tO);let tL={examples:[{label:"Studio White",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/white.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Pure seamless white sweep, soft floor gradient, shadow-free clarity, clinical cleanliness, product-ready minimalism, bright neutral professional backdrop."}]},{label:"Smooth Gradient",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/gradient.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Smooth tonal gradient, subtle color transition, gentle vignetting, added depth, elegant simplicity, unobtrusive background supporting primary subject."}]},{label:"Pro Studio",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/studio.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Neutral studio environment, controlled walls, uncluttered floor, light-friendly surfaces, tidy corners, professional control, versatile production space."}]},{label:"Wood Surface",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/wooden.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Warm wooden tabletop, visible grain texture, handcrafted tone, artisanal feel, cozy color, natural imperfections, rustic culinary presentation."}]},{label:"Marble Slab",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/marble.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Polished marble slab, elegant veining, cool luxury, reflective sheen, refined minimalism, premium product staging, timeless editorial sophistication."}]},{label:"Color Block",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/colorblock.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Bold solid color field, saturated tone, modern minimal composition, graphic punch, strong separation, brand-forward clarity, contemporary vibe."}]},{label:"Subtle Texture",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/textured.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Fine textured backdrop with subtle pattern, adds interest, maintains simplicity, gentle variation, tasteful depth, photography-friendly surface."}]},{label:"Geometric Pattern",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/geometric.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Clean geometric patterning, contemporary shapes, rhythm
271ic repetition, modern design accent, crisp lines, visual structure supporting focused subjects."}]},{label:"Urban City",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/urban.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Suggestive urban cityscape, architectural lines, distant glass reflections, implied traffic glow, energetic atmosphere, contemporary metropolitan backdrop."}]},{label:"Nature Set",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/nature.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Lush natural setting, greenery layers, soft ambient light, organic textures, tranquil mood, gentle depth, restorative outdoor atmosphere."}]},{label:"Coastal Beach",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/beach.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Sandy shoreline with gentle waves, bright horizon, airy sunlight, coastal breeze suggestion, relaxed vacation mood, summery openness."}]},{label:"Forest Fog",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/forest.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Backlit forest clearing, thin mist, rays through branches, damp ground texture, serene atmosphere, emerald tones, contemplative woodland calm."}]}
271,{label:"Mountain View",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/mountain.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Dramatic mountain vista, distant ridgelines, crisp air haze, layered depth, alpine grandeur, panoramic scale, inspiring outdoor perspective."}]},{label:"Cozy Café",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/cafe.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Warm café interior, window reflections, wood and ceramic textures, intimate seating, cozy light, lived-in ambience, lifestyle storytelling."}]},{label:"Industrial Loft",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/loft.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Industrial loft character, exposed brick, broad factory windows, steel details, soft daylight spill, urban chic, creative workspace energy."}]},{label:"Abstract Art",type:"prompt",previewUrl:"/assets/create/relight/preset/background-options/abstract.webp",formSetting:[{to:"prompt",type:"string",value:"change the image background, Expressive abstract backdrop, painterly gestures, layered textures, artistic motion, color interplay, evocative mood, dynamic nonliteral environment."}]}]},tq={examples:[{label:"Three-Point",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/three-point.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Balanced three-point setup: left key medium, right fill low, rear rim crisp; dimensional separation, natural faces, controlled reflections."}]},{label:"High Key",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/high-key.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Bright high-key lighting, multi-source soft fill, high but diffused intensity, lifted shadows, airy atmosphere, gentle contrast, polished clarity."}]},{label:"Low Key",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/low-key.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Hard key from right around fifty degrees, medium-high intensity, deep sculpted shadows, dramatic contrast, dark surround, defined highlights."}]},{label:"Product Spotlight",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/product-spot.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Tight overhead spotlight, concentrated center with rapid falloff, circular pool, surrounding darkness, theatrical focus, crisp edges, jewel-box emphasis."}]},{label:"Color Gel Mix",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/color-gel.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Magenta key from left, cyan fill from right, reflective accents, saturated highlights, playful chroma contrast, nightlife attitude, stylized pop."}]},{label:"Reflective Control",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/reflective.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Large low-intensity front-left key, flagged control for speculars, gentle back-right kicker, polished highlights, smooth surfaces, premium product sheen."}]},{label:"Ring Light",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/ring-light.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Lens-centered ring light, medium intensity, even shadowless illumination, circular catchlights, flattering skin, beauty focus, direct symmetrical presentation."}]},{label:"Golden Hour",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/golden-hour.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Warm low sun about fifteen degrees, medium intensity, elongated soft shadows, gentle haze, golden rims, outdoor glow, nostalgic radiance."}]},{label:"Blue Hour",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/blue-hour.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Cool ambient skylight from above, low-medium intensity, soft contrast, subtle city glow, clean midtones, tranquil palette, evening calm."}]},{label:"Backlit Rim",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/backlit.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Strong backlight slightly above horizon, medium-high intensity, crisp rim outline, faint frontal fill, gentle flare, luminous silhouette drama."}]},{label:"Dappled Sun",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/dappled.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Sunlight filtered through leaves, medium key from above-right, irregular mottled shadows, organic highlights, summery texture, relaxed garden feeling."}]},{label:"Overcast Soft",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/overcast.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Large sky-sized softbox effect, low-medium intensity, omnidirectional fill, diffuse shadows, neutral color, flattering skin, evenly balanced exposure."}]},{label:"Dramatic Contrast",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/dramatic.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Hard key from left about sixty degrees, medium-high intensity, steep falloff, selective highlights, bold contrast, cinematic sculpted mood."}]},{label:"Neon Mix",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/neon.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Cyan wash from right, magenta from left, reflective surfaces catching color, saturated reflections, nightlife vibe, vibrant urban energy."}]},{label:"Candlelight",type:"prompt",previewUrl:"/assets/create/relight/preset/lighting-options/candlelight.webp",formSetting:[{to:"prompt",type:"string",value:"change the image lighting, Warm candlelike point source below front, low intensity, rapid falloff, gentle flicker, intimate shadows, amber highlights, cozy atmosphere."}]}]},t$=[{name:"control_images",label:"Reference Image",type:"image",isRequired:!0,isSupport:1}],tV={"Image Apps":[...Object.values({"AI Image Edit App":eq(eP,[{id:"qwen-image-edit-relight",label:"AI Image Relight",description:"Relight the image with the selected lighting.",options:{imageUrl:"/assets/create/image-edit/product-bed-1.webp",setPrompt:tq.examples[0].formSetting[0].value,...tq},supportAddFiles:t$}
271,{id:"qwen-image-edit-background",label:"AI Background Changer",description:"Change the image background",options:{imageUrl:"/assets/create/image-edit/bg-change-2.webp",setPrompt:tL.examples[0].formSetting[0].value,...tL},supportAddFiles:t$},{id:"qwen-image-edit-multi-angle",label:"AI Image Multi Angle",description:"Change the image view with the selected angle.",options:{imageUrl:"",textInput:{Label:"Prompt (Optional)",Description:"Describe the other changes you want to make to the image."}},supportAddFiles:t$,promptSetting:{promptNotRequired:!0},customParameters:[{name:"horizontal_angle",label:"Horizontal Angle",type:"slider",defaultValue:30,description:"eg, 0°=front view, 90°=right side, 180°=back view, 270°=left side, 360°=front view again.",min:0,max:360,step:1},{name:"vertical_angle",label:"Vertical Angle",type:"slider",defaultValue:0,description:"eg, -30°=low-angle shot, 0°=eye-level, 30°=elevated, 60°=high-angle, 90°=bird's-eye view.",min:-30,max:90,step:1},{name:"zoom_distance",label:"Zoom (Distance)",type:"slider",defaultValue:5,description:"eg, 0=wide shot, 5=medium shot, 10=close-up.",min:0,max:10,step:1}],apiInputs:{default:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/edit-multiple-angles",rules:[{to:"prompt",from:"raw",transform:[{op:"customFn",fn:"build_prompt_with_angles"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:1536}}]},{to:"horizontal_angle",from:"meta_data.horizontal_angle",transform:[{op:"toNumber"}]},{to:"vertical_angle",from:"meta_data.vertical_angle",transform:[{op:"toNumber"}]},{to:"zoom_distance",from:"meta_data.zoom_distance",transform:[{op:"toNumber"}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}]},"default-lora":{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/edit-2511-lora",rules:[{to:"prompt",from:"raw",transform:[{op:"customFn",fn:"build_prompt_with_angles"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:1536}}]},{to:"loras",const:[{path:"fal/Qwen-Image-Edit-2511-Multiple-Angles-LoRA",scale:1}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}]},free:{provider:"wavespeed",endpoint:"https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/edit-multiple-angles",rules:[{to:"prompt",from:"raw",transform:[{op:"customFn",fn:"build_prompt_with_angles"}]},{to:"images",from:"control_images",transform:[{op:"customFn",fn:"flatten_all"},{op:"slice",start:0,end:3}]},{when:{not:{equals:["aspect_ratio","auto"]}},to:"size",from:["width","height"],transform:[{op:"customFn",fn:"arrayToResolutionString",params:{maxValue:1536}}]},{to:"horizontal_angle",from:"meta_data.horizontal_angle",transform:[{op:"toNumber"}]},{to:"vertical_angle",from:"meta_data.vertical_angle",transform:[{op:"toNumber"}]},{to:"zoom_distance",from:"meta_data.zoom_distance",transform:[{op:"toNumber"}]},{to:"enable_safety_checker",from:"enable_safety_checker"},{to:"output_format",from:"output_format",transform:[{op:"enumMap",map:{png:"png",jpg:"jpeg",jpeg:"jpeg"},default:"png"}]}]}}},{id:"qwen-image-edit-ai-bikini",label:"AI Bikini",description:"AI bikini try-on",options:{imageUrl:"",setPrompt:"put her in bikini try-on"}}])}).flat(),...eF],...tg,...ty,...th},tW={"Video Apps":[...tk,...tB]},tH=["flux-2","seedream-image","seedance-v1","ai-image-app","ai-video-app","veo-video","gemini-ai-image","infinite-talk-lipsync","infinite-talk-lipsync-v2v","ai-video-enhance-seedvr","ai-video-face-swap-wavespeed","image-upscale-crystal-upscaler","ai-tryon-app","qwen-image-layered","qwen-image","fal-ai-eleven-v3-tts","google-tts","chatterbox-voice-changer","eleven-labs-dubbing","ai-music"],tG=["flux-2","image-upscale-recraft-crisp","ai-image-app","ai-video-app","veo-video","gemini-ai-image","infinite-talk-lipsync","infinite-talk-lipsync-v2v","ai-video-enhance-seedvr","ai-video-face-swap-wavespeed","image-upscale-crystal-upscaler","ai-tryon-app","qwen-image-layered","qwen-image","live-avatar","fal-ai-eleven-v3-tts","google-tts","chatterbox-voice-changer","eleven-labs-dubbing","ai-music"],tK=["gpt-image","z-image-turbo","flux-schnell","flux-dev","flux-krea-dev","flux-dev-pulid","flux-dev-kontext-image-edit","flux-2","seedream-image","image-remove-bg-imageutils","qwen-image","qwen-image-edit","qwen-image-layered","gemini-ai-image","veo-video","infinite-talk-lipsync","infinite-talk-lipsync-v2v","ai-video-enhance-seedvr","ai-video-face-swap-wavespeed","image-upscale-crystal-upscaler","ai-tryon-app","ai-background-changer","seedance-v1","live-avatar","fal-ai-eleven-v3-tts","gemini-tts","google-tts","chatterbox-voice-changer","eleven-labs-dubbing","ai-music"];function tJ(e){return!!e&&tK.some(t=>e.includes(t))}function tY(e){return!e||tH.some(t=>e.includes(t))}let tZ=[...ex,...ew,...e_,...ek,...eF,...ez,...eb],tX=[...eN,...eS,...eA,...eT,...eC,...eI,...ej,...eE,...eR],tQ=e=>Array.from(new Map(e.map(e=>[e.id,e])).values()),t0=tQ(tZ.filter(e=>e.tag?.includes("Text to Image"))),t1=tQ(tZ.filter(e=>e.tag?.includes("Image to Image"))),t2=tQ(tX.filter(e=>e.tag?.includes("Text to Video"))),t3=tQ(tX.filter(e=>e.tag?.includes("Image to Video"))),t4=tQ(tX.filter(e=>e.tag?.includes("Video to Video"))),t5=[...tZ,...tX];[...eE,...tk],["seedance-v1","z-image-turbo","seedream-image","veo-video","kling-v3-ai-video","wan2-2-animate","gemini-ai-image","ai-tryon-app"].map(e=>t5.find(t=>
271t.id===e)).filter(e=>!!e);let t6=[...ek,...eR];({"ai avatar":[...eE,...tk],...tV,...tW});let t8={"text to image":t0,"image to image":t1,"Image Editing":ez,"ai tools":t6,...tV},t9={"text to video":t2,"image to video":t3,"ai avatar":[...eE,...tk],"video to video":t4,"ai tools":t6,...tW};[...eE,...tk];var t7=e.i(631871),ae=e.i(346054),at=e.i(701104),aa=e.i(229999);let ar=(e,t="")=>String(null==e?t:e),ai=(e,t=!1)=>{let a=null==e?t:e;if("boolean"==typeof a)return a;if("number"==typeof a)return!Number.isNaN(a)&&0!==a;if("string"==typeof a){let e=a.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e&&"no"!==e&&"n"!==e&&"off"!==e&&("1"===e||"true"===e||"yes"===e||"y"===e||"on"===e||!!e)}return!!a};var ao=e.i(674214),as=e.i(599836);let an=async e=>{let{model_id:t,model_config:a}=e,r=a?.type;return t.includes("ai-image-app")?ad(e):"video"!==r||["sora-2-ai"].some(e=>t.includes(e))?t.includes("sora-2-ai")?al(e):e:ac(e)},al=async e=>{let{aspect_ratio:t="auto",prompt_process:a,control_images:r,meta_data:i}=e,o=[];return i?.video_type==="pro"&&o.push("15s + HD"),i?.resolution=="16:9"||"16:9"==t?o.push("orientation : landscape"):o.push("orientation : portrait"),o.length>1?e.prompt_process=`create video: (${o.join(", ")}) HD, `+(e.prompt_process||e.prompt||""):1===o.length&&(e.prompt_process=`create video: ${o[0]} HD, `+(e.prompt_process||e.prompt||"")),e},ad=async e=>{let{aspect_ratio:t="auto",control_images:a,control_images_2:r,model_config:i}=e,o=[...a,...r],s=await (0,$.normalizeToFiles)(o),n=await (0,$.compressImageFiles)(s),l=await (0,$.normalizeToBase64)(n),{options:d={}}=i,{promptEnhanceSettings:c=ef}=d,p=e.prompt_process||e.prompt;if(c){let{system_prompt:t}=c,a=await (0,q.handleAppAutoPromptEnhance)(t,p,l);e.prompt_process=Array.isArray(a)&&a?.length>0?a?.[0]:p}return e},ac=async e=>{let{aspect_ratio:t="auto",control_images:a,control_images_2:r,model_config:i,duration:o="5"}=e,s=[...a,...r],n=await (0,$.normalizeToFiles)(s),l=await (0,$.compressImageFiles)(n),d=await (0,$.normalizeToBase64)(l),{options:c={}}=i,{promptEnhanceSettings:p=ev}=c,u=e.prompt_process||e.prompt;if(p){let{system_prompt:t}=p,a=await (0,q.handleAppAutoPromptEnhance)(t,`${u} duration(seconds): ${o}`,d);e.prompt_process=Array.isArray(a)&&a?.length>0?a?.[0]:u}return e},ap=async e=>{let{control_images:t,control_images_2:a}=e;e?.model_config;let r=ec.aspectRatioDimensions_1440;if(!(t?.length>0))return e;{let a=await (0,$.normalizeToFiles)(t),i=String(await (0,$.findClosestAspectRatio)(a[0])??"").trim(),{width:o=1024,height:s=1024}=r?.[i]??{width:1024,height:1024};return e.width=o,e.height=s,e}},au=async({userInputData:e,promptProcessMode:t,isUseCredits:a=!0})=>{try{"auto"===e.aspect_ratio&&(e=await ap(e)),a||(e=await am(e));let{model_id:r}=e,i=e.model_config,o=i?.promptSetting?.promptIgnore||i?.promptSetting?.promptNotRequired||!1,s=e.prompt_process||e.prompt||"",n=["ai-image-app","ai-video-app","seedance","wan-2.2-spicy","wan2-6","kling","hailuo"].some(e=>r.includes(e));if(o||!s)return e;if(n)return e=await an(e);let l=["tts"].some(e=>i?.id?.includes(e));if(!o&&!l&&s)switch(t){case"none":break;case"translate":let d=await (0,q.handleTextTranslate)(s);e.prompt_process=d}}catch(e){console.error("Prompt processing error:",e)}return e},am=async e=>{e.num_outputs=1;let{model_config:t}=e;return["resolution","duration","num_outputs"].forEach(a=>{let r=t?.customParameters?.find(e=>e?.name===a);r&&(e[a]=r.defaultValue)}),e.meta_data&&Object.keys(e.meta_data).forEach(a=>{let r=t?.customParameters?.find(e=>e?.name===a);r?.multiple&&(e.meta_data[a]=r.defaultValue)}),e},ah=async({userInputData:e,userData:t,isUseCredits:a=!0,creditUsed:r=1,handleFunc:i={}})=>{let{model_id:o,generation_type:s="image",model_config:n}=e,l={model_id:o,user_id:(0,y.getUserProfileUserId)(t),user_email:(0,y.getUserProfileEmail)(t),user_name:(0,y.getUserProfileName)(t)};if(!a&&(!o||tG.some(e=>o.includes(e))||tY(o))){let e=r>=2?2:r>=1?1:r>.5?r:.6;["infinite-talk-lipsync"].some(e=>o.includes(e))&&(e=1);let a=(0,y.getUserProfileUserId)(t);if((!t||!a)&&tY(o))throw i?.setShowLoginModal(!0),Error("Please login to continue");let s=await (0,as.guestUsageProcess)(e,a||"guest",!1,l);if(!s.canGenerate)throw Error(s?.message||"You have exceeded your usage quota. Please upgrade to get credits for more generations.");return{success:!0,data:{identifier:s?.identifier||""}}}{let t=e?.generation_type||"image",a=`${t}-generation`,r=(0,as.localFeatureRateLimit)(a,1,24);if(!r.canGenerate)throw Error(r.message||"You have exceeded your usage quota. Please upgrade to get credits for more generations.")}return{success:!0}};
271class ag extends Error{code;provider;retryable;raw;constructor(e){super(e.message),this.name="AiGeneratorError",this.code=e.code,this.provider=e.provider,this.retryable=e.retryable,this.raw=e.raw}}let af=(e,t="generation_error")=>e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?{code:"code"in e&&"string"==typeof e.code?e.code:t,message:e.message,retryable:"retryable"in e&&"boolean"==typeof e.retryable?e.retryable:void 0,raw:"raw"in e?e.raw:e}:e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:e instanceof Error?{code:t,message:e.message,raw:e}:{code:t,message:"Unknown generation error",raw:e},av=e=>e.trim().toLowerCase();class ay{providers=new Map;register(e){let t=av(e.key);if(this.providers.has(t))throw new ag({code:"configuration_error",message:`AI provider "${t}" has already been registered.`,provider:t});return this.providers.set(t,e),this}get(e){let t=av(e),a=this.providers.get(t);if(!a)throw new ag({code:"provider_not_found",message:`AI provider "${e}" is not registered.`,provider:t});return a}has(e){return this.providers.has(av(e))}listProviders(){return Array.from(this.providers.values())}}let ab="__DOT__TOKEN__",aw=e=>e.replace(/\[(\d+)\]/g,".$1").replace(/\[["']([^"']+)["']\]/g,".$1").replace(/\\\./g,ab).split(".").filter(Boolean).map(e=>e.replaceAll(ab,".")),ax=(e,t)=>{if(t&&null!=e)return"object"==typeof e&&null!==e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:aw(t).reduce((e,t)=>{if(null!=e&&"object"==typeof e)return e[t]},e)},a_=(e,t,a)=>{let r=aw(t),i=e;for(let e=0;e<r.length-1;e+=1){let t=r[e],a=i[t];(!a||"object"!=typeof a||Array.isArray(a))&&(i[t]={}),i=i[t]}i[r[r.length-1]]=a},ak=e=>null==e||"string"==typeof e&&""===e.trim()||Array.isArray(e)&&0===e.length,aS={flatten_all:e=>null==e?[]:(Array.isArray(e)?e:[e]).flat(1/0).filter(e=>null!=e),arrayToResolutionString:(e,t)=>((e,t)=>{if(!Array.isArray(e)||e.length<2)return"";let a=Number(e[0]),r=Number(e[1]);if(!Number.isFinite(a)||!Number.isFinite(r)||a<=0||r<=0)return"";let i="number"==typeof t?.maxValue&&Number.isFinite(t.maxValue)?t.maxValue:-1;if(i>0){let e=Math.max(a,r);if(e>i){let t=i/e;a=Math.round(a*t),r=Math.round(r*t)}}return`${a}*${r}`})(e,t),build_prompt_with_angles:e=>(e=>{if(!e||"object"!=typeof e)return"";let t=e.meta_data??{};return[[e.prompt_process,e.prompt].filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>String(e).trim())[0],...["number"==typeof t.horizontal_angle||"string"==typeof t.horizontal_angle?`horizontal angle ${t.horizontal_angle}`:null,"number"==typeof t.vertical_angle||"string"==typeof t.vertical_angle?`vertical angle ${t.vertical_angle}`:null,"number"==typeof t.zoom_distance||"string"==typeof t.zoom_distance?`zoom distance ${t.zoom_distance}`:null].filter(Boolean)].filter(Boolean).join(", ")})(e),build_messages:e=>(e=>{if(!e||"object"!=typeof e)return[];let t=[e.prompt_process,e.prompt].filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>String(e).trim())[0],a=Array.isArray(e.control_images)?e.control_images.filter(e=>"string"==typeof e&&e.trim().length>0):[],r=[];for(let e of(t&&r.push({type:"text",text:t}),a))r.push({type:"image_url",image_url:{url:e}});return 0===r.length?[]:[{role:"user",content:r}]})(e),build_gemini_music_prompt_with_settings:e=>(e=>{if(!e||"object"!=typeof e)return"";let t=e.meta_data??{},a=!!t.instrumental,r="string"==typeof t.song_lyrics?t.song_lyrics.trim():"",i="string"==typeof t.vocal_gender&&t.vocal_gender.trim().length>0?t.vocal_gender.trim():"auto",o=[e.prompt_process,e.prompt].filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>String(e).trim())[0];return a?o?`Create a song, Instrumental only, no vocals. ${o}`:"Create a song, Instrumental only, no vocals.":r?`Song Style: ${o||""} 272 Vocal Gender: ${i} 273 Create a song with the following lyrics: ${r}`.trim():`Song Style: ${o||""} 274 Vocal Gender: ${i}`.trim()})(e),build_byteplus_content:e=>(function(e){let t=e?.prompt_process||e?.prompt||"",a=Array.isArray(e?.control_images)?e.control_images:[],r=Array.isArray(e?.control_images_2)?e.control_images_2:[],i=[{type:"text",text:t}],o=a[0];if(o){i.push({type:"image_url",image_url:{url:o},role:"first_frame"});let e=r[0];e&&i.push({type:"image_url",image_url:{url:e},role:"last_frame"})}return i})(e)},aj=(e,t)=>{switch(t.op){case"not":return!e;case"coalesce":return Array.isArray(e)?e.find(e=>!ak(e)):e;case"randomInt":{let e=t.min??1;return Math.floor(Math.random()*((t.max??0x7fffffff)-e+1))+e}case"array":return Array.isArray(e)?e:void 0===e?[]:[e];case"toNumber":{let t=Number(e);return Number.isFinite(t)?t:e}case"toString":return null==e?e:String(e);case"pick":if(!Array.isArray(e))return e;return e[t.index??0];case"trim":return"string"==typeof e?e.trim():e;case"lowercase":return"string"==typeof e?e.toLowerCase():e;case"uppercase":return"string"==typeof e?e.toUpperCase():e;case"enumMap":{let a=null==e?"":String(e);return t.map[a]??t.default}case"default":return ak(e)?t.value:e;case"slice":return Array.isArray(e)||"string"==typeof e?e.slice(t.start??0,t.end):e;case"getProperty":return e&&"object"==typeof e?e[t.property]:e;case"toFile":default:return e;case"customFn":{let a=aS[t.fn];return a?a(e,t.params):e}}},aC=(e,t)=>{if(!t)return!0;
274if("exists"in t)return!ak(ax(e,t.exists));if("equals"in t){let[a,r]=t.equals;return ax(e,a)===r}if("lenGte"in t){let[a,r]=t.lenGte,i=ax(e,a);return(Array.isArray(i)||"string"==typeof i?i.length:0)>=r}if("gt"in t){let[a,r]=t.gt,i=Number(ax(e,a));return Number.isFinite(i)&&i>r}if("gte"in t){let[a,r]=t.gte,i=Number(ax(e,a));return Number.isFinite(i)&&i>=r}if("includes"in t){let[a,r]=t.includes,i=ax(e,a);return Array.isArray(i)?i.includes(r):"string"==typeof i&&i.includes(String(r))}return"not"in t?!aC(e,t.not):"all"in t?t.all.every(t=>aC(e,t)):"any"in t&&t.any.some(t=>aC(e,t))},aI=(e,t)=>{if(t)return(e.endpointCandidates??e.enpointCandicates??{})[t]??t},aN=(e,t)=>{if(t)return Array.isArray(t)?t.map(t=>"raw"===t?e:ax(e,t)):"raw"===t?e:ax(e,t)},aA=(e,t)=>{let a={};for(let r of e.rules){if(!aC(t,r.when))continue;let e=void 0!==r.const?r.const:aN(t,r.from);for(let t of r.transform??[])e=aj(e,t);ak(e)||a_(a,r.to,e)}return a},aT=(e,t)=>(Array.isArray(e)?e:null==e?[]:[e]).reduce((e,a)=>{let r=(e=>{if("string"==typeof e&&e.trim())return e;if(!e||"object"!=typeof e)return;let t=e.url;return"string"==typeof t&&t.trim()?t:void 0})(a);if(!r)return e;let i=a&&"object"==typeof a?Object.fromEntries(Object.entries(a).filter(([e])=>"url"!==e)):void 0;return e.push({url:r,type:t,...i?{metadata:i}:{}}),e},[]),aE=(e,t,a,r)=>({success:!0,provider:e.provider,modelId:e.modelId,type:e.generationKind,taskId:r,items:t,raw:a}),aR=(e,t,a)=>({success:!1,provider:e.provider,modelId:e.modelId,type:e.generationKind,taskId:a,error:af(t)});var aU=e.i(470050);let aP=(0,aU.createServerReference)("408181f02f59a4831ab115a68f661b889ebad6953d",aU.callServer,void 0,aU.findSourceMapURL,"submitBytePlusImageTask"),aD={kind:"image",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"succeeded",raw:await aP({endpoint:e.endpoint,payload:t})}},normalizeResult:(e,t,a)=>{var r;let i;return r=a?.taskId,0===(i=aT((e=>{if(e)return e.data??e.images??e.image})(e),"image")).length?aR(t,{code:"byteplus_image_result_empty",message:"BytePlus image generation returned no image items.",raw:e},r):aE(t,i,e,r)},normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"byteplus_image_generation_failed",message:e?.message||"image generation failed.",raw:e}},az=(0,aU.createServerReference)("404618a16708fe1788507d40e276ec949e7d26952b",aU.callServer,void 0,aU.findSourceMapURL,"getBytePlusTaskStatus"),aF=(0,aU.createServerReference)("40920ae7393605a1f1c34aded2f9de29488e8495a2",aU.callServer,void 0,aU.findSourceMapURL,"submitBytePlusVideoTask"),aM={kind:"video",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await aF({endpoint:e.endpoint,payload:t,webhookUrl:e.options.webhookUrl,modelId:e.modelId})}},pollTask:(e,t)=>az(t),normalizeResult:(e,t,a)=>{var r;let i;return r=a?.taskId,0===(i=aT((e=>{if(!e)return;let t=e.content&&"object"==typeof e.content?e.content:null,a=t?.video_url;if("string"==typeof a&&a.trim()){let{video_url:e,...r}=t;return{url:a,...r}}return e.videos??e.video??e.outputs})(e),"video")).length?aR(t,{code:"byteplus_video_result_empty",message:"BytePlus video generation returned no video items.",raw:e},r):aE(t,i,e,r)},normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"byteplus_video_generation_failed",message:e?.message||"video generation failed.",raw:e}},aO={image:!0,video:!0,audio:!0},aB=(0,aU.createServerReference)("403eeb97a020c4dd7d2de069943de4b723cc0ba150",aU.callServer,void 0,aU.findSourceMapURL,"submitFalTask"),aL=(0,aU.createServerReference)("40d5a1d667ca0e434d69f47cc13e6f4c0022516841",aU.callServer,void 0,aU.findSourceMapURL,"getFalTaskStatus"),aq=(e,t,a)=>{let r=aT(e?.audios??e?.audio??e?.results,"audio");return 0===r.length?aR(t,{code:"fal_audio_result_empty",message:"audio generation returned no audio items.",raw:e},a):aE(t,r,e,a)},a$={kind:"audio",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await aB({endpoint:e.endpoint,payload:t})}},pollTask:(e,t)=>aL({endpoint:e.endpoint,taskId:t}),normalizeResult:(e,t,a)=>aq(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"fal_audio_generation_failed",message:e?.message||"audio generation failed.",raw:e}},aV=(e,t,a)=>{let r=aT(e?.images??e?.image??e?.results,"image");return 0===r.length?aR(t,{code:"fal_image_result_empty",message:"image generation returned no image items.",raw:e},a):aE(t,r,e,a)},aW={kind:"image",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await aB({endpoint:e.endpoint,payload:t})}},pollTask:(e,t)=>aL({endpoint:e.endpoint,taskId:t}),normalizeResult:(e,t,a)=>aV(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"fal_image_generation_failed",message:e?.message||"image generation failed.",raw:e}},aH=(e,t,a)=>{let r=aT(e?.videos??e?.video??e?.results,"video");return 0===r.length?aR(t,{code:"fal_video_result_empty",message:"video generation returned no video items.",raw:e},a):aE(t,r,e,a)},aG=(e,t)=>
274{let a=e?.trim();if(a){if(!t)return a;try{let e=new URL(a);return e.searchParams.set("model_id",t),e.toString()}catch{let e=a.includes("?")?"&":"?";return`${a}${e}model_id=${encodeURIComponent(t)}`}}},aK={kind:"video",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await aB({endpoint:e.endpoint,payload:t,webhookUrl:aG(e.options.webhookUrl,e.modelId)})}},pollTask:(e,t)=>aL({endpoint:e.endpoint,taskId:t}),normalizeResult:(e,t,a)=>aH(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"fal_video_generation_failed",message:e?.message||" video generation failed.",raw:e}},aJ={audio:!0},aY=(e,t,a)=>e?.success&&e.data?aE(t,[{url:`data:${e.mimeType};base64,${e.data}`,type:"audio",mimeType:e.mimeType,metadata:{endpoint:e.endpoint}}],e,a):aR(t,{code:"gemini_audio_result_empty",message:e?.error||"audio generation returned no audio items.",raw:e},a),aZ=(0,aU.createServerReference)("404debf5943354239bfc86b0d3877afe1895c5a72c",aU.callServer,void 0,aU.findSourceMapURL,"submitGeminiAudioTask"),aX={kind:"audio",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"succeeded",raw:await aZ({endpoint:e.endpoint,payload:t,inputData:e.inputData})}},normalizeResult:(e,t,a)=>aY(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"gemini_audio_generation_failed",message:e?.message||"audio generation failed.",raw:e}},aQ={image:!0},a0=(e,t,a)=>{let r=aT(e?.images,"image");return e?.success&&0!==r.length?aE(t,r,e,a):aR(t,{code:"tuzi_image_result_empty",message:e?.error||"image generation returned no image items.",raw:e},a)},a1=(0,aU.createServerReference)("404291c40c050e5e07a6819961d4033ad3edfb3393",aU.callServer,void 0,aU.findSourceMapURL,"submitTuziImageTask"),a2={kind:"image",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"succeeded",raw:await a1({endpoint:e.endpoint,payload:t,apiConfigOptions:e.apiConfig.options})}},normalizeResult:(e,t,a)=>a0(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"tuzi_image_generation_failed",message:e?.message||"image generation failed.",raw:e}},a3={image:!0,video:!0,audio:!1},a4=(e,t,a)=>aR(t,{code:"wavespeed_audio_unsupported",message:"[WSP] audio generation is not implemented in phase 1.",raw:e},a),a5={kind:"audio",async submitTask(){throw new ag({code:"wavespeed_audio_unsupported",message:"WaveSpeed audio generation is not implemented in phase 1.",provider:"wavespeed"})},normalizeResult:(e,t,a)=>a4(e,t,a?.taskId)},a6=(0,aU.createServerReference)("4003c8ff18aa2cf7f5dd2270bb1bdf822ba66e54d9",aU.callServer,void 0,aU.findSourceMapURL,"getWaveSpeedTaskStatus"),a8=(0,aU.createServerReference)("4015e9b8490dc354e5d576852f8d039d04e2f9cff6",aU.callServer,void 0,aU.findSourceMapURL,"submitWaveSpeedTask"),a9=(e,t,a)=>{let r=aT((e=>{if(e)return e.images??e.image??e.outputs})(e),"image");return 0===r.length?aR(t,{code:"wavespeed_image_result_empty",message:"[WSP] image generation returned no image items.",raw:e},a):aE(t,r,e,a)},a7={kind:"image",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await a8({endpoint:e.endpoint,payload:t})}},pollTask:(e,t)=>a6(t),normalizeResult:(e,t,a)=>a9(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"wavespeed_image_generation_failed",message:e?.message||"image generation failed.",raw:e}},re=(e,t,a)=>{let r=aT((e=>{if(e)return e.videos??e.video??e.outputs})(e),"video");return 0===r.length?aR(t,{code:"wavespeed_video_result_empty",message:"[WSP] video generation returned no video items.",raw:e},a):aE(t,r,e,a)},rt={kind:"video",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await a8({endpoint:e.endpoint,payload:t,webhookUrl:e.options.webhookUrl,modelId:e.modelId})}},pollTask:(e,t)=>a6(t),normalizeResult:(e,t,a)=>re(e,t,a?.taskId),normalizeError:e=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:"wavespeed_video_generation_failed",message:e?.message||" video generation failed.",raw:e}},ra=new ay().register({key:"byteplus",displayName:"BytePlus",capabilities:{image:!0,video:!0,audio:!1},getOperation(e){switch(e.generationKind){case"image":return aD;case"video":return aM;default:throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"byteplus"})}}}).register({key:"fal",displayName:"FAL",capabilities:aO,getOperation(e){switch(e.generationKind){case"image":return aW;case"video":return aK;case"audio":return a$;default:throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"fal"})}}}).register({key:"gemini",displayName:"Gemini",capabilities:aJ,getOperation(e){if("audio"===e.generationKind)return aX;throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"gemini"})}}).register({key:"tuzi",displayName:"Tuzi",capabilities:aQ,getOperation(e){if("image"===e.generationKind)return a2;throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"tuzi"})}}).register({key:"wavespeed",displayName:"WaveSpeed",capabilities:a3,getOperation(e){switch(e.generationKind){case"image":return a7;case"video":return rt;case"audio":return a5;default:throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"wavespeed"})}}}),rr=e=>new Promise(t=>setTimeout(t,e)),ri=async(e,t)=>{let a=0;for(;a<=t.maxRetries;){let r=await e();if("network_error"===r.status&&r.retryable&&a<t.maxRetries){a+=1,await rr(t.retryBackoff*2**a);continue}return r}return{status:"network_error",error:"Polling retries exhausted.",retryable:!1}},ro=async e=>{let{poller:t,options:a}=e;await rr(a.heartbeatDelay);let r=await ri(t,a);if("in_progress"!==r.status)return r;let i=Math.max(a.initialWait-a.heartbeatDelay,0);i>0&&await rr(i);let o=Date.now()+a.maxWaitTime;for(;Date.now()<o;){let e=await ri(t,a);if("in_progress"!==e.status)return e;await rr(a.pollingInterval)}return{status:"failed",error:"Generation status check timed out.",retryable:!1}},rs={1:{initialWait:5e3,pollingInterval:8e3,maxWaitTime:72e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3},2:{initialWait:15e3,pollingInterval:8e3,maxWaitTime:72e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3},3:{initialWait:25e3,pollingInterval:1e4,maxWaitTime:72e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3},4:{initialWait:9e4,pollingInterval:15e3,maxWaitTime:72e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3},5:{initialWait:12e4,pollingInterval:15e3,maxWaitTime:108e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3},6:{initialWait:36e4,pollingInterval:15e3,maxWaitTime:108e4,heartbeatDelay:3e3,maxRetries:2,retryBackoff:1e3}},rn=new Set(["image","video","audio"]),rl=e=>{if("sourceModel"in e&&e.sourceModel)return e;if(!e.apiInputs||0===Object.keys(e.apiInputs).length)throw new ag({code:"invalid_model_config",message:`Model "${e.id}" does not provide apiInputs.`});
274let t=Object.entries(e.apiInputs).reduce((e,[t,a])=>a?.provider?(e[t]={provider:String(a.provider||"").trim(),endpoint:a.endpoint,endpointCandidates:"endpointCandidates"in a?a.endpointCandidates:void 0,enpointCandicates:"enpointCandicates"in a?a.enpointCandicates:void 0,endpointSelect:a.endpointSelect,options:a.options,rules:a.rules.map(e=>({to:e.to,from:e.from,const:e.const,when:e.when,transform:e.transform}))},e):e,{});if(0===Object.keys(t).length)throw new ag({code:"invalid_model_config",message:`Model "${e.id}" does not provide valid apiInputs entries.`});return{id:e.id,label:e.label,description:e.description,type:(e=>{let t=e?.trim().toLowerCase();if(t&&rn.has(t))return t;throw new ag({code:"unsupported_generation_type",message:`Unsupported generation type: ${e||"unknown"}`})})(e.type),provider:e.provider,supportAddFiles:e.supportAddFiles,customParameters:e.customParameters,options:e.options,supportedAspectRatios:e.supportedAspectRatios,apiInputs:t,sourceModel:e}},rd=async e=>{let t=(e=>{var t,a;let r,{model:i,apiMode:o,apiConfig:s}=((e,t="default")=>{let a=rl(e),{apiInput:r,mode:i}=((e,t="default")=>{let a=e.apiInputs[t];if(a)return{mode:t,apiInput:a};let r=e.apiInputs.default;if(r)return{mode:"default",apiInput:r};throw new ag({code:"api_mode_not_found",message:`Model "${e.id}" does not provide apiInputs for mode "${t}".`})})(a,t);return{model:a,apiMode:i,apiConfig:r}})(e.model,e.mode??"default"),n=((e,t)=>{let a=e.endpointSelect;if(!a)return e.endpoint;for(let r of a.rules??[])if(aC(t,r.when))return aI(e,r.use);return aI(e,a.default)??e.endpoint})(s,e.input);if(!n)throw new ag({code:"endpoint_not_found",message:`Model "${i.id}" did not resolve a generation endpoint.`,provider:s.provider});let l=e.options?.waitLevel??(t=i.id,a=i.type,(r=t.toLowerCase()).includes("ai-tryon")||r.includes("seedream-image")||r.includes("ai-image-app")||r.includes("gemini-ai-image")?2:r.includes("wan")||r.includes("seedance")?3:r.includes("kling")||r.includes("veo")||r.includes("sora")?4:r.includes("kling-motion")?5:"image"===a?1:"audio"===a?3:5);return{model:i,modelId:i.id,provider:av(s.provider),generationKind:i.type,apiMode:o,apiConfig:s,endpoint:n,inputData:e.input,options:{...e.options,waitLevel:l,polling:{...((e=1)=>{let t=rs[e]?e:1;return{waitLevel:t,...rs[t]}})(l),...e.options?.polling}}}})(e),a=ra.get(t.provider).getOperation(t);try{let r=await a.submitTask(t);if("succeeded"===r.status)return a.normalizeResult(r.raw,t,{taskId:r.taskId});if(!r.taskId)throw new ag({code:"missing_task_id",message:`Provider "${t.provider}" submit response missing task id.`,provider:t.provider,raw:r});if(await e.options?.onSubmitted?.({taskId:r.taskId,context:t}),!a.pollTask)throw new ag({code:"polling_not_supported",message:`Provider "${t.provider}" operation does not expose pollTask.`,provider:t.provider});let i={...t.options.polling,...a.getPollingOptions?.(t)},o=await ro({poller:()=>a.pollTask(t,r.taskId),options:i});if("succeeded"===o.status)return a.normalizeResult(o.raw,t,{taskId:r.taskId});let s=await a.normalizeError?.({code:`${t.provider}_${o.status}`,message:o.error||"Generation task failed.",retryable:o.retryable,raw:o.raw},t)??{code:`${t.provider}_${o.status}`,message:o.error||"Generation task failed.",retryable:o.retryable,raw:o.raw};return aR(t,s,r.taskId)}catch(r){let e=await a.normalizeError?.(r,t)??r;return aR(t,e)}},rc=["control_images","control_images_2","control_files","control_files_2"],rp=["control_images","control_images_2"],ru=new Set(rc),rm=new Set(rp),rh=["tryon","upscale","creatify","lipsync","wan2-2-animate","remove-bg"],rg=e=>Array.isArray(e)?e:null==e?[]:[e],rf=e=>{let t=String(e||"").toLowerCase();if(t){if(t.startsWith("image/"))return"image";if(t.startsWith("video/"))return"video";if(t.startsWith("audio/"))return"audio"}},rv=e=>{let t=String(e||"").trim().toLowerCase();if(!t)return;let a=t.startsWith("http://")||t.startsWith("https://")?(()=>{try{return new URL(t).pathname.toLowerCase()}catch{return t}})():t;return/\.(png|jpe?g|gif|webp|bmp|svg|tiff?|avif)(?:$|[?#])/.test(a)?"image":/\.(mp4|mov|avi|webm|mkv|m4v)(?:$|[?#])/.test(a)?"video":/\.(mp3|wav|m4a|aac|ogg|flac|opus|mpeg)(?:$|[?#])/.test(a)?"audio":void 0},ry=e=>{let t=e.trim();if(!t)return!1;let a=["videoprompt.online","https://file.videoprompt.online"].filter(
274Boolean);return t.startsWith("data:")||t.startsWith("blob:")||/^https?:\/\//i.test(t)||a.some(e=>t.includes(e))},rb=(e,t)=>{var a;if(!t||t.isSupport<=0)return!1;let r=(e=>{if(e instanceof File)return rf(e.type)||rv(e.name);if(e instanceof Blob)return rf(e.type);if("string"!=typeof e)return;let t=e.trim();if(t){if(t.startsWith("data:")){let e=t.match(/^data:([^;,]+)[;,]/i);return rf(e?.[1])}return rv(t)}})(e);return r?(a=t.type,!!r&&("media_file"===a||a===r)):"string"==typeof e&&ry(e)},rw=async(e,t)=>{let a={...e};for(let e of rp){if("base64"!==t.get(e))continue;let r=rg(a[e]);if(0===r.length)continue;let i=[];for(let e of r){if("string"==typeof e&&/^https?:\/\//i.test(e.trim())){i.push(e);continue}let[t]=await (0,$.normalizeToFiles)([e]);if(t instanceof Blob&&t.type?.startsWith("image/"))try{let e=await (0,ao.default)(t,{maxSizeMB:.8,maxWidthOrHeight:1280,useWebWorker:!0,fileType:"image/jpeg"});i.push(e)}catch{i.push(t)}else i.push(t)}a[e]=i}return a},rx=async e=>{let t=[];for(let a of e){if("string"==typeof a){let e=a.trim();if(!e)continue;if(e.startsWith("data:")||!ry(e)){t.push(a);continue}}let[e]=await (0,$.normalizeToBase64)([a]);t.push(e)}return t},r_=async(e,t={})=>{let{sanitizedInput:a,summary:r}=(e=>{let t=(e=>{let t={};for(let a of e?.supportAddFiles||[])ru.has(a.name)&&(t[a.name]=a);return t.control_images||"number"!=typeof e?.isSupportImageRef||(t.control_images={name:"control_images",label:"Control Images",type:"image",isRequired:e.isRequiredImageRef||!1,isSupport:e.isSupportImageRef||0}),t.control_images_2||"number"!=typeof e?.isSupportEndImageRef||(t.control_images_2={name:"control_images_2",label:"End Control Images",type:"image",isRequired:!1,isSupport:e.isSupportEndImageRef||0}),t})(e.model_config),a={...e},r={},i=0,o=0;for(let s of rc){let n=t[s],l=rg(e[s]),d=[],c=0;for(let e of l){if(!rb(e,n)||d.length>=Math.max(0,n?.isSupport||0)){c+=1;continue}d.push(e)}a[s]=d,i+=d.length,o+=c,r[s]={acceptedCount:d.length,ignoredCount:c,transport:"base64"}}return{sanitizedInput:a,summary:{acceptedCount:i,ignoredCount:o,uploadCounts:{base64:0,url:0},byKey:r}}})(e),i=((e,t,a)=>{let r=e.model_config,i=new Map;for(let e of rc)i.set(e,"base64");let o=rp.reduce((e,a)=>{let r=t.byKey[a];return e+(r?.acceptedCount||0)},0),s=[r?.apiInputs?.default?.provider,r?.apiInputs?.free?.provider,...r?.provider||[]].filter(Boolean).map(e=>String(e).toLowerCase()),n=String(e.model_id||"").toLowerCase();if(a.shouldUploadImages||o>3||s.includes("kie")||rh.some(e=>n.includes(e)))for(let e of rp)(t.byKey[e]?.acceptedCount||0)>0&&i.set(e,"url");for(let e of["control_files","control_files_2"])(t.byKey[e]?.acceptedCount||0)>0&&i.set(e,"url");return i})(a,r,t),o={...await rw(a,i)},s=[],n=[];for(let e of rc){let t=rg(o[e]),a=i.get(e)||"base64";if(r.byKey[e]&&(r.byKey[e].transport=a),r.uploadCounts[a]+=t.length,0!==t.length){if("url"===a){rm.has(e)?s.push(e):n.push(e);continue}o[e]=await rx(t)}}return{inputData:await (0,$.processFileUrlToApiInput)({inputData:o,process_image_keys:s,process_media_keys:n,shouldUploadImages:s.length>0,fileUploadCache:t.fileUploadCache}),summary:r}},rk=(0,aU.createServerReference)("40cb57622a84fab3fa104c64898697ec5d6a8c127a",aU.callServer,void 0,aU.findSourceMapURL,"insertAiAudioGenerationRecord"),rS=(0,aU.createServerReference)("40ebb29dfe6f99e3e2ff93f3068e2d9cb572dfb33d",aU.callServer,void 0,aU.findSourceMapURL,"insertAiImageGenerationRecord"),rj=(0,aU.createServerReference)("406cecf77065647dac0c944012e5cbc1c35035b82a",aU.callServer,void 0,aU.findSourceMapURL,"insertAiVideoGenerationRecord");var rC=e.i(519425),rI=e.i(280624);async function rN(e){let t=[];return{items:await Promise.all(e.items.map(async(a,r)=>{var i,o;let s,n,l,d,c=(n=e.userId,l=`${e.generationId}-${r}`,d=a.url,(0,rI.objectKeyUserGen)(n,l,d)),p=await (0,rC.uploadFileFromUrlToR2)(a.url,c);return p?.success?(t.push(c),{...a,url:(i=e.kind,o=c,(s="https://file.videoprompt.online".replace(/\/$/,""))?`${s}/${o}`:o),metadata:{...a.metadata??{},objectKey:c,originalUrl:a.url}}):a})),uploadedObjectKeys:t}}async function rA(e,t){let a=t.generationId||e.taskId||crypto.randomUUID();if(!t.enabled||!e.success||!e.items?.length)return{persisted:!1,generationId:a,result:e};let r=e.items;if(t.shouldUploadToR2&&(r=(await rN({userId:t.userId,generationId:a,kind:e.type,items:e.items})).items),t.shouldInsertRecord){var i,o,s,n,l;let d=JSON.stringify({...t.metaData??{},provider:e.provider,modelId:e.modelId,type:e.type,taskId:e.taskId}),c=(i=e.type,o=r.map(e=>e.url),"video"===i?o[0]??null:JSON.stringify(o)),p=(s=e.type,n=t.creditsUsed??0,l=r.length,"image"===s&&l>0?Number((n/l).toFixed(2)):n);
274"image"===e.type?await rS({generationId:a,userId:t.userId,status:"succeeded",metaData:d,generationUrl:c,creditsUsed:p}):"video"===e.type?await rj({generationId:a,userId:t.userId,status:"succeeded",metaData:d,generationUrl:c,creditsUsed:p}):"audio"===e.type&&await rk({generationId:a,userId:t.userId,status:"succeeded",metaData:d,generationUrl:c,creditsUsed:p})}return{persisted:!0,generationId:a,result:{...e,items:r}}}var rT=e.i(229874);let rE=e=>(0,rT.createFalClient)({credentials:e.apiKey,suppressLocalCredentialsWarning:!0}),rR=e=>{let t=e.body?.detail;if(Array.isArray(t)&&t.length>0){let a=t[0];return`status: ${e.status}; error_type: ${a.type||"unknown"}; error_message: ${a.msg||"Unknown error"}`}return"string"==typeof t&&t.trim()?`api error: ${e.status}; ${t}`:`api error: ${e.status}; Unknown error`},rU=async e=>{let t=rE(e.credential);try{return(await t.queue.submit(e.endpoint,{input:e.payload,webhookUrl:e.webhookUrl})).request_id}catch(e){if(e instanceof rT.ApiError)throw new ag({code:"fal_submit_failed",message:rR(e),provider:"fal",raw:e.body});throw new ag({code:"fal_submit_failed",message:e instanceof Error?e.message:"FAL submit failed.",provider:"fal",raw:e})}},rP=async e=>{let t=rE(e.credential);try{let a=await t.queue.status(e.endpoint,{requestId:e.taskId,logs:!0});if("COMPLETED"!==a.status)return{status:"in_progress"};let r=await t.queue.result(e.endpoint,{requestId:e.taskId}),i=r.data??r;if(!(i&&"object"==typeof i&&(Array.isArray(i.images)&&i.images.length>0||i.image||Array.isArray(i.videos)&&i.videos.length>0||i.video||Array.isArray(i.audios)&&i.audios.length>0||i.audio||Array.isArray(i.results)&&i.results.length>0)))return{status:"failed",error:"No data generated.",raw:i};return{status:"succeeded",raw:i}}catch(a){let e=a instanceof rT.ApiError?rR(a):a instanceof Error?a.message:"FAL polling failed.",t=a instanceof TypeError&&(e.includes("fetch failed")||e.includes("network")||e.includes("Failed to fetch"));return{status:t?"network_error":"error",error:e,retryable:t,raw:a}}},rD=e=>{let t=e.credential;if(!t?.apiKey)throw new ag({code:"byok_missing_api_key",message:"BYOK generation requires a user API key.",provider:e.provider});return t},rz=(e,t,a)=>e instanceof ag?{code:e.code,message:e.message,retryable:e.retryable,raw:e.raw}:{code:t,message:e instanceof Error?e.message:a,raw:e},rF=async e=>{let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch(e){throw new ag({code:"provider_invalid_json",message:"Failed to parse provider response.",raw:{error:e,rawText:t}})}},rM=(e,t)=>({kind:e,async submitTask(e){let t=rD(e),a=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await rU({credential:t,endpoint:e.endpoint,payload:a})}},pollTask:(e,t)=>rP({credential:rD(e),endpoint:e.endpoint,taskId:t}),normalizeResult:t,normalizeError:t=>rz(t,`fal_${e}_generation_failed`,`${e} generation failed.`)}),rO=rM("image",(e,t,a)=>aV(e,t,a?.taskId)),rB=rM("video",(e,t,a)=>aH(e,t,a?.taskId)),rL=rM("audio",(e,t,a)=>aq(e,t,a?.taskId)),rq=[{category:"HARM_CATEGORY_SEXUALLY_EXPLICIT",threshold:"BLOCK_NONE"},{category:"HARM_CATEGORY_HATE_SPEECH",threshold:"BLOCK_NONE"},{category:"HARM_CATEGORY_HARASSMENT",threshold:"BLOCK_NONE"},{category:"HARM_CATEGORY_DANGEROUS_CONTENT",threshold:"BLOCK_NONE"}],r$=(e,t)=>{let a=new URL(`${(e.baseUrl?.trim()||"https://generativelanguage.googleapis.com/v1beta").replace(/\/$/,"")}/models/${encodeURIComponent(t)}:generateContent`);return a.searchParams.set("key",e.apiKey),a.toString()},rV=async e=>{let t=await e.text(),a=null;if(t)try{a=JSON.parse(t)}catch(e){throw new ag({code:"gemini_invalid_json",message:"Failed to parse response.",provider:"gemini",raw:{error:e,rawText:t}})}if(!e.ok){let r=a?.error;throw new ag({code:"gemini_request_failed",message:`${e.status}: ${String(r?.message||e.statusText||"request failed")}`,provider:"gemini",raw:a??t})}return a},rW=(e,t,a)=>{for(let r=0;r<a.length;r+=1)e.setUint8(t+r,a.charCodeAt(r))},rH=e=>{let t=(Array.isArray(e?.candidates)?e.candidates:[])[0],a=t?.content;for(let e of Array.isArray(a?.parts)?a.parts:[]){let t=e.inlineData,a=t?.data;if("string"==typeof a&&a.trim())return a.trim()}},rG=e=>{let t=e.trim(),a=t.match(/^data:([^;]+);base64,(.+)$/);return a?{inlineData:{mimeType:a[1],data:a[2]}}:/^https?:\/\//i.test(t)?{fileData:{fileUri:t,mimeType:"image/jpeg"}}:void 0},rK=async(e,t)=>{let a="string"==typeof t.text?t.text.trim():"",r="string"==typeof t.voice&&t.voice.trim()?t.voice.trim():"Zephyr";if(!a)throw new ag({code:"gemini_tts_missing_text",message:"Gemini TTS requires text input.",provider:"gemini",raw:t});try{let t=await fetch(r$(e,"gemini-2.5-flash-preview-tts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:a}]}],safetySettings:rq,generationConfig:{responseModalities:["AUDIO"],speechConfig:{voiceConfig:{prebuiltVoiceConfig:{voiceName:r}}}}})}),i=await rV(t),o=rH(i);if(!o)return{success:!1,data:null,error:"No audio data returned",endpoint:"gemini/tts"};return{success:!0,data:((e,{channels:t=1,sampleRate:a=24e3,bitDepth:r=16}={})=>{let i=(e=>{let t=atob(e),a=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=t.charCodeAt(e);return a})(e),o=r/8*t,s=new ArrayBuffer(44+i.byteLength),n=new DataView(s);rW(n,0,"RIFF"),n.setUint32(4,36+i.byteLength,!0),rW(n,8,"WAVE"),rW(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,t,!0),n.setUint32(24,a,!0),n.setUint32(28,a*o,!0),n.setUint16(32,o,!0),n.setUint16(34,r,!0),rW(n,36,"data"),n.setUint32(40,i.byteLength,!0),new Uint8Array(s,44).set(i);var l=new Uint8Array(s);let d="";for(let e=0;e<l.length;e+=32768)d+=String.fromCharCode(...l.subarray(e,e+32768));return btoa(d)})(o),error:null,mimeType:"audio/wav",endpoint:"gemini/tts"}}catch(e){return{success:!1,data:null,error:`Gemini TTS ERROR: ${e?.message||String(e)}`,endpoint:"gemini/tts"}}},rJ=async(e,t,a)=>{let r="string"==typeof t.prompt?t.prompt.trim():"",i="string"==typeof t.model&&t.model.trim()?t.model.trim():"lyria-3-pro-preview",o=Array.isArray(a?.control_images)?a.control_images.filter(e=>"string"==typeof e&&e.trim().length>0):[];if(!r)throw new ag({code:"gemini_music_missing_prompt",message:"Gemini music generation requires a prompt.",provider:"gemini",raw:t});
274try{let t=o.map(rG).filter(e=>!!e),a=await fetch(r$(e,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{parts:[...t,{text:r}]}],safetySettings:rq,generationConfig:{responseModalities:["AUDIO"]}})}),s=await rV(a),n=rH(s);if(!n)return{success:!1,data:null,error:"No audio data returned",endpoint:"gemini/music"};return{success:!0,data:n,error:null,mimeType:"audio/mp3",endpoint:"gemini/music"}}catch(e){return{success:!1,data:null,error:`Gemini Music ERROR: ${e?.message||String(e)}`,endpoint:"gemini/music"}}},rY=async e=>{switch(e.endpoint.trim().toLowerCase()){case"gemini/tts":return rK(e.credential,e.payload);case"gemini/music":return rJ(e.credential,e.payload,e.inputData);default:throw new ag({code:"gemini_audio_endpoint_unsupported",message:`Unsupported Gemini audio endpoint "${e.endpoint}".`,provider:"gemini",raw:e})}},rZ={kind:"audio",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"succeeded",raw:await rY({credential:rD(e),endpoint:e.endpoint,payload:t,inputData:e.inputData})}},normalizeResult:(e,t,a)=>aY(e,t,a?.taskId),normalizeError:e=>rz(e,"gemini_audio_generation_failed","audio generation failed.")},rX="https://api.tu-zi.com/v1/images/generations",rQ=async(e,t,a=24e4)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),a);try{return await fetch(e,{...t,signal:r.signal})}catch(e){if(e?.name==="AbortError")throw new ag({code:"tuzi_request_timeout",message:"Request timed out.",provider:"tuzi"});throw e}finally{clearTimeout(i)}},r0=async e=>{let t=await e.text();if(!t)return{rawText:t,json:null};try{return{rawText:t,json:JSON.parse(t)}}catch(e){throw new ag({code:"tuzi_invalid_json",message:"Failed to parse response.",provider:"tuzi",raw:{error:e,rawText:t}})}},r1=e=>"string"==typeof e.prompt?e.prompt.trim():"",r2=e=>"string"==typeof e.model&&e.model.trim()?e.model.trim():"gpt-image-2",r3=e=>"string"==typeof e.quality&&e.quality.trim()?e.quality.trim().toLowerCase():"low",r4=e=>{if("string"==typeof e&&e.trim())return e.trim();if(!e||"object"!=typeof e)return"auto";let t=Number(e.width),a=Number(e.height);return!Number.isFinite(t)||!Number.isFinite(a)||t<=0||a<=0?"auto":`${Math.round(t)}x${Math.round(a)}`},r5=e=>"u">typeof Blob&&e instanceof Blob,r6=e=>{let t=e.toLowerCase();
274return t.includes("jpeg")||t.includes("jpg")?"jpg":t.includes("webp")?"webp":t.includes("gif")?"gif":"png"},r8=(e,t)=>{let a=atob(e),r=new Uint8Array(a.length);for(let e=0;e<a.length;e+=1)r[e]=a.charCodeAt(e);return new Blob([r],{type:t})},r9=async(e,t)=>{if(r5(e))return{blob:e,fileName:"u">typeof File&&e instanceof File&&e.name?e.name:`image-${t+1}.${r6(e.type||"image/png")}`};if("string"!=typeof e)throw new ag({code:"tuzi_invalid_image_input",message:"Tuzi image edit requires image URLs, data URLs, or Blob inputs.",provider:"tuzi",raw:e});let a=e.trim();if(a.startsWith("data:")){let r=(e=>{let t=e.match(/^data:([^;,]+)?(;base64)?,(.*)$/i);if(!t)return null;let a=t[1]||"image/png",r=!!t[2],i=t[3]||"";return r?r8(i,a):new Blob([decodeURIComponent(i)],{type:a})})(a);if(!r)throw new ag({code:"tuzi_invalid_data_url",message:"Invalid image data URL.",provider:"tuzi",raw:e});return{blob:r,fileName:`image-${t+1}.${r6(r.type||"image/png")}`}}if(/^https?:\/\//i.test(a)){let e=await rQ(a,{method:"GET"},6e4);if(!e.ok)throw new ag({code:"tuzi_image_fetch_failed",message:`Failed to fetch reference image: ${e.status} ${e.statusText}`,provider:"tuzi",raw:a});let r=await e.blob(),i=r.type||e.headers.get("content-type")||"image/png";return{blob:r.type?r:new Blob([await r.arrayBuffer()],{type:i}),fileName:((e,t,a)=>{try{let t=new URL(e).pathname.split("/").filter(Boolean).pop();if(t&&/\.[a-z0-9]+$/i.test(t))return t}catch{}return`image-${a+1}.${r6(t)}`})(a,i,t)}}return{blob:r8(a,"image/png"),fileName:`image-${t+1}.png`}},r7=async e=>{let t=Array.isArray(e.images)?e.images.filter(e=>"string"==typeof e?e.trim().length>0:r5(e)):[];if(0===t.length)throw new ag({code:"tuzi_edit_missing_image",message:"Tuzi image edit requires at least one reference image.",provider:"tuzi",raw:e});let a=new FormData;a.append("model",r2(e)),a.append("prompt",r1(e)),a.append("size",r4(e.size)),a.append("response_format",String(e.response_format||"url")),a.append("quality",r3(e)),e.output_format&&a.append("output_format",e.output_format),e.n&&a.append("n",String(e.n));for(let e=0;e<t.length;e+=1){let{blob:r,fileName:i}=await r9(t[e],e);a.append("image",r,i)}return a},ie=async e=>{var t,a;let r,i,o,s=(t=e.endpoint,a=e.apiConfigOptions,r=a?.endpoints&&"object"==typeof a.endpoints&&null!==a.endpoints?a.endpoints:null,i="string"==typeof r?.tuzi?r.tuzi.trim():"",o="str
274ing"==typeof t?t.trim():"",i||o||rX),n=e.payload;if(!n||"object"!=typeof n)throw new ag({code:"tuzi_invalid_payload",message:"Invalid Tuzi payload.",provider:"tuzi",raw:e.payload});if(!r1(n))throw new ag({code:"tuzi_missing_prompt",message:"Tuzi image generation requires a prompt.",provider:"tuzi",raw:n});let l=s.replace(/\/$/,"").toLowerCase().endsWith("/v1/images/edits")?await rQ(s||"https://api.tu-zi.com/v1/images/edits",{method:"POST",headers:{Authorization:`Bearer ${e.credential.apiKey}`},body:await r7(n)}):await rQ(s||rX,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.credential.apiKey}`},body:JSON.stringify({model:r2(n),prompt:r1(n),response_format:n.response_format||"url",quality:r3(n),size:r4(n.size),...n.output_format?{output_format:n.output_format}:{},...n.n?{n:Number(n.n)||n.n}:{}})}),{rawText:d,json:c}=await r0(l);if(!l.ok)throw new ag({code:"tuzi_submit_failed",message:`${l.status}: ${String(c?.error?.message||c?.error||c?.message||c?.msg||d||l.statusText||"status request failed: unknown error")}`,provider:"tuzi",raw:c??d});let{images:p,text:u}=(e=>{let t=[],a=[];if(!e)return{images:t,text:a};let r=(e,a)=>{"string"==typeof e&&e.trim()&&t.push(((e,t)=>{if(e.startsWith("data:"))return e;let a="string"==typeof t&&t.trim()?t.trim().toLowerCase():"png";return`data:image/${a};base64,${e}`})(e.trim(),a))},i=e=>{"string"==typeof e&&e.trim()&&t.push(e.trim())};if(Array.isArray(e.data))for(let t of e.data){if(!t||"object"!=typeof t){i(t);continue}i(t.url),r(t.b64_json,t.output_format||e.output_format),"string"==typeof t.revised_prompt&&t.revised_prompt.trim()&&a.push(t.revised_prompt.trim())}if(Array.isArray(e.images))for(let t of e.images)i(t);return i(e.url),r(e.b64_json,e.output_format),{images:[...new Set(t)],text:a}})(c);return 0===p.length?{success:!1,images:p,text:u,error:u[0]||d||"No image data returned"}:{success:!0,images:p,text:u,error:null}},it={kind:"image",async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"succeeded",raw:await ie({credential:rD(e),endpoint:e.endpoint,payload:t,apiConfigOptions:e.apiConfig.options})}},normalizeResult:(e,t,a)=>a0(e,t,a?.taskId),normalizeError:e=>rz(e,"tuzi_image_generation_failed","image generation failed.")},ia=async e=>{let t=await fetch(((e,t,a)=>{let r=aG(t,a);if(!r)return e;try{let t=new URL(e);return t.searchParams.set("webhook",r),t.toString()}catch(t){return console.warn("Failed to attach webhook to WaveSpeed endpoint:",t),e}})(e.endpoint,e.webhookUrl,e.modelId),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.credential.apiKey}`},body:JSON.stringify(e.payload)}),a=await rF(t);if(!t.ok){let e=a?.error?.message||a?.error||a?.message||t.statusText;throw new ag({code:"wavespeed_submit_failed",message:`${t.status}: ${String(e||"request failed")}`,provider:"wavespeed",raw:a})}let r=a?.data&&"object"==typeof a.data&&null!==a.data?a.data.id??a.data.request_id:void 0,i=a?.id??a?.request_id,o=r??i;if("string"!=typeof o||!o.trim())throw new ag({code:"wavespeed_missing_task_id",message:"response missing request id.",provider:"wavespeed",raw:a});return o},ir=async e=>{try{let t,a=await fetch(`${(t=e.credential,(t.baseUrl?.trim()||"https://api.wavespeed.ai/api/v3").replace(/\/$/,""))}/predictions/${encodeURIComponent(e.taskId)}/result`,{method:"GET",headers:{Authorization:`Bearer ${e.credential.apiKey}`}}),r=await rF(a);if(!a.ok){let e=r?.error?.message||r?.error||r?.message||a.statusText;return{status:"error",error:`${a.status}: ${String(e||"status request failed")}`,raw:r}}let i=r?.data&&"object"==typeof r.data&&null!==r.data?r.data:r??{},o=("string"==typeof i.status?i.status:"string"==typeof r?.status?r.status:"").toLowerCase();if("completed"===o||"succeeded"===o)return{status:"succeeded",raw:i};if("failed"===o)return{status:"failed",error:String(i.error||r?.error||"WaveSpeed generation failed."),raw:i};if(Array.isArray(i.outputs)&&i.outputs.length>0)return{status:"succeeded",raw:i};return{status:"in_progress",raw:i}}catch(a){let e=a instanceof Error?a.message:"WaveSpeed polling failed.",t=a instanceof TypeError&&(e.includes("fetch failed")||e.includes("network")||e.includes("Failed to fetch"));return{status:t?"network_error":"error",error:e,retryable:t,raw:a}}},ii=(e,t)=>({kind:e,async submitTask(e){let t=aA(e.apiConfig,e.inputData);return{status:"submitted",taskId:await ia({credential:rD(e),endpoint:e.endpoint,payload:t,modelId:e.modelId})}},pollTask:(e,t)=>ir({credential:rD(e),taskId:t}),normalizeResult:t,normalizeError:t=>rz(t,`wavespeed_${e}_generation_failed`,`${e} generation failed.`)}),io=ii("image",(e,t,a)=>a9(e,t,a?.taskId)),is=ii("video",(e,t,a)=>re(e,t,a?.taskId)),il={kind:"audio",async submitTask(){throw new ag({code:"wavespeed_audio_unsupported",message:"WaveSpeed audio generation is not implemented in phase 1.",provider:"wavespeed"})},normalizeResult:(e,t,a)=>a4(e,t,a?.taskId),normalizeError:e=>rz(e,"wavespeed_audio_generation_failed","audio generation failed.")};new ay().register({key:"fal",displayName:"FAL",capabilities:aO,getOperation(e){switch(e.generationKind){case"image":return rO;case"video":return rB;case"audio":return rL;default:throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"fal"})}}}).register({key:"gemini",displayName:"Gemini",capabilities:aJ,getOperation(e){if("audio"===e.generationKind)return rZ;throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"gemini"})}}).register({key:"tuzi",displayName:"Tuzi",capabilities:aQ,getOperation(e){if("image"===e.generationKind)return it;throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"tuzi"})}}).register({key:"wavespeed",displayName:"WaveSpeed",capabilities:a3,getOperation(e){switch(e.generationKind){case"image":return io;case"video":return is;case"audio":return il;default:throw new ag({code:"unsupported_generation_type",message:`This provider does not support "${e.generationKind}" generation.`,provider:"wavespeed"})}}});let id={free:1,lite:1,starter:2,premium:3,pro:3,platinum:4,vipcreator:4,default:1};var ic=e.i(185202),ip=e.i(673572);let iu=async e=>{let t=e.items??[],a=new Date().toISOString();return Promise.all(t.map(async(t,r)=>({...await (async()=>{let i,o=await ip.localResourceStore.save(t.url,{source:"ai-generation",type:"image"===(i=t.type)||"video"===i||"audio"===i?i:"other",mime:t.mimeType,url:t.url,metadata:{...t.metadata??{},taskId:e.taskId,itemIndex:r}});return{id:o.resourceKey,resourceKey:o.resourceKey,taskId:e.taskId,type:t.type,createdAt:a,updatedAt:a,sourceUrl:t.url,mimeType:o.mime,metadata:{...t.metadata??{},resourceKey:o.resourceKey}}})()})))};var im=e.i(341454);let ih=Promise.resolve();function ig(e){let t=ih.then(e,e);return ih=t.then(()=>void 0,()=>void 0),t}let iv=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:0},iy=e=>{let t=e.now??Date.now(),a=new Date(t).toISOString(),r=e.records.map(e=>"running"!==e.status&&"polling"!==e.status?e:iv(e.timeoutAt)<=t?{...e,status:"timeout",updatedAt:a,completedAt:a,error:{code:"generation_timeout",message:"Pending generation expired before resume completed."}}:e).filter(e=>t-(iv(e.completedAt)||iv(e.updatedAt)||iv(e.createdAt))<=1296e6),i=new Set(r.map(e=>e.id));return{records:r,mediaAssets:e.mediaAssets.filter(e=>{let a=iv(e.createdAt);return i.has(e.taskId)&&t-a<=1296e6})}},ib=e=>e.map(e=>e.resourceKey??e.metadata?.resourceKey??(e.id.includes(":")?e.id:void 0)).filter(e=>"string"==typeof e&&e.length>0),iw=e=>{let t=e.resourceKey??("string"==typeof e.metadata?.resourceKey?e.metadata.resourceKey:void 0)??(e.id.includes(":")?e.id:"");return{id:t||e.id,resourceKey:t,taskId:e.taskId,type:e.type,createdAt:e.createdAt,updatedAt:e.updatedAt,sourceUrl:e.sourceUrl,mimeType:e.mimeType,metadata:{...e.metadata??{},...t?{resourceKey:t}:{}}}},ix=async()=>
274{await ic.localStore.init();let e=await im.localRecordStore.list({recordType:"ai-generation",orderBy:"updatedAt",order:"desc"}),t=[],a=[];return e.forEach(e=>{let r;r=e.payload,"ai-generation"===e.recordType&&r?.record&&(t.push(e.payload.record),a.push(...(e.payload.mediaAssets??[]).map(iw)))}),{records:t,mediaAssets:a}},i_={read:async()=>(await ix()).records,async write(e){let t=await ix();await iI({records:e,mediaAssets:t.mediaAssets})}},ik={read:async()=>(await ix()).mediaAssets,async write(e){let t=await ix();await iI({records:t.records,mediaAssets:e})}},iS=async()=>iy({records:await i_.read(),mediaAssets:await ik.read()}),ij=async e=>ig(async()=>{let t=await ix(),a=new Set(e.records.map(e=>e.id)),r=iy({records:[...e.records,...t.records.filter(e=>!a.has(e.id))],mediaAssets:[...e.mediaAssets,...t.mediaAssets.filter(e=>!a.has(e.taskId))]});return await iN(r),r}),iC=e=>({resumeUntil:new Date(Date.parse(e)+12e5).toISOString(),timeoutAt:new Date(Date.parse(e)+18e5).toISOString()});async function iI(e){await ig(async()=>{let t=iy(e);await iN(t)})}async function iN(e){await ic.localStore.init();let t=new Map;e.mediaAssets.forEach(e=>{let a=iw(e),r=t.get(a.taskId)??[];r.push(a),t.set(a.taskId,r)});let a=new Set(e.records.map(e=>
274e.id)),r=await im.localRecordStore.list({recordType:"ai-generation"});await Promise.all(r.map(async e=>{a.has(e.id)||await im.localRecordStore.delete(e.id,{cascadeResources:!1})})),await Promise.all(e.records.map(async e=>{let a,r,i,o=t.get(e.id)??[];await im.localRecordStore.upsert((a=iv(e.completedAt)||iv(e.updatedAt)||iv(e.createdAt)||Date.now(),i=ib(r=o.map(iw)),{id:e.id,recordType:"ai-generation",scope:"string"==typeof e.metadata?.userId?e.metadata.userId:void 0,title:e.summary??e.prompt??e.modelLabel??e.modelId,status:e.status,resourceKeys:i,payload:{record:{...e,resourceKeys:i,mediaAssetIds:i.length>0?i:e.mediaAssetIds},mediaAssets:r},metadata:e.metadata,createdAt:iv(e.createdAt)||a,updatedAt:iv(e.updatedAt)||a,expiresAt:a+1296e6,version:1}))}));let i=new Set(ib(e.mediaAssets.map(iw)));await iA(i)}async function iA(e){let t=Date.now(),a=(await ip.localResourceStore.listBySource("ai-generation")).filter(t=>!e.has(t.resourceKey)).filter(e=>t-e.updatedAt>=3e5).map(e=>e.resourceKey);await ip.localResourceStore.deleteMany(a)}let iT=null,iE=(0,_.create)(e=>({hydrated:!1,runtimeTasks:[],records:[],mediaAssets:[],hydrate:async()=>{iE.getState().hydrated||(iT||(iT=(async()=>{let t=await iS();e(e=>e.hydrated?e:{hydrated:!0,records:t.records,mediaAssets:t.mediaAssets})})().finally(()=>{iT=null})),await iT)},setRuntimeTasks:t=>e(e=>({runtimeTasks:"function"==typeof t?t(e.runtimeTasks):t})),setPersistedState:async t=>{await iE.getState().hydrate();let a=await ij(t);return e(()=>({records:a.records,mediaAssets:a.mediaAssets})),a}})),iR=e=>new Promise(t=>setTimeout(t,e)),iU=()=>iE.getState().hydrate(),iP=e=>"running"===e||"polling"===e,iD=e=>{iE.getState().setRuntimeTasks(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[e,...t])},iz=async(e,t)=>{if(!e.providerTaskId)return;await iU();let a=iE.getState(),r=iC(e.createdAt),i={id:e.id,modelId:t.modelId??e.modelId,modelLabel:t.modelLabel??e.modelLabel,provider:t.provider??e.provider,type:t.type??e.type,prompt:t.prompt??e.prompt,summary:t.summary??e.summary,resumeContext:t.resumeContext??e.resumeContext,metadata:{...e.metadata??{},...t.metadata??{}},status:t.status??("starting"===e.status?"polling":e.status),createdAt:e.createdAt,updatedAt:e.updatedAt,providerTaskId:e.providerTaskId,resumeUntil:r.resumeUntil,timeoutAt:r.timeoutAt,error:t.error},o=a.records.some(t=>t.id===e.id)?a.records.map(t=>t.id===e.id?{...t,...i}:t):[i,...a.records];await a.setPersistedState({records:o,mediaAssets:a.mediaAssets})},iF=async(e,t)=>{let a;await iU();let r=iE.getState(),i=r.records.find(t=>t.id===e.id),o=!!(t.result||t.error||t.forcePersist);if(!i&&!o)return;let s=t.result,n=!1!==t.persistGeneratedMedia,l=new Date().toISOString(),d=s?.success===!1?s.error:t.error?af(t.error):void 0,c=r.mediaAssets,p=i?.mediaAssetIds;if(s?.success&&s.items?.length&&n)try{let t=new Set(i?.mediaAssetIds??[]);c=c.filter(e=>!t.has(e.resourceKey||e.id));let a=await iu({taskId:e.id,items:s.items});c=[...a,...c],p=a.map(e=>e.resourceKey)}catch(e){a=e instanceof Error?e.message:"Failed to persist media assets."}let u={id:e.id,modelId:e.modelId,modelLabel:e.modelLabel,provider:s?.provider??e.provider,type:s?.type??e.type,prompt:e.prompt,summary:e.summary,resumeContext:e.resumeContext,metadata:{...i?.metadata??{},...e.metadata??{},...t.metadata??{},...a?{mediaPersistError:a}:{}},status:s?.success===!0?"succeeded":d?.code==="generation_timeout"?"timeout":"failed",createdAt:e.createdAt,updatedAt:l,completedAt:l,providerTaskId:e.providerTaskId??i?.providerTaskId??e.id,resumeUntil:i?.resumeUntil??iC(e.createdAt).resumeUntil,timeoutAt:i?.timeoutAt??iC(e.createdAt).timeoutAt,items:s?.items,resourceKeys:p,mediaAssetIds:p,error:d},m=i?r.records.map(e=>e.id===u.id?u:e):[u,...r.records];return await r.setPersistedState({records:m,mediaAssets:c}),u},iM=async()=>(await iU(),iE.getState()),iO=async()=>{let e=await iM();return await e.setPersistedState({records:e.records,mediaAssets:e.mediaAssets}),iE.getState()},iB=async e=>{await iU();let t=iE.getState(),a=t.mediaAssets.find(t=>t.resourceKey===e||t.id===e);if(!a)return!1;let r=a.resourceKey||a.id,i=t.mediaAssets.filter(e=>
274e.resourceKey!==r&&e.id!==r),o=t.records.map(e=>{if(!e.mediaAssetIds?.includes(r))return e;let t=e.mediaAssetIds.indexOf(r),a=e.mediaAssetIds.filter(e=>e!==r),i=e.resourceKeys?.filter(e=>e!==r),o=t>=0&&e.items?.length?e.items.filter((e,a)=>a!==t):e.items;return{...e,updatedAt:new Date().toISOString(),resourceKeys:i?.length?i:void 0,mediaAssetIds:a.length>0?a:void 0,items:o?.length?o:void 0}});return await ip.localResourceStore.delete(r),await t.setPersistedState({records:o,mediaAssets:i}),!0},iL=e=>{let t;iU();let a=(t=new Date().toISOString(),{...e,id:`gen_${Date.now()}_${crypto.randomUUID().slice(0,8)}`,status:"starting",createdAt:t,updatedAt:t,persisted:!1});return iD(a),a},iq=(e,t)=>{iU();let a=iE.getState().runtimeTasks.find(t=>t.id===e);if(!a)return;let r={...a,...t,providerTaskId:t.providerTaskId??a.providerTaskId,status:t.status??(t.providerTaskId?"polling":a.status),updatedAt:new Date().toISOString(),persisted:a.persisted||!!t.providerTaskId};return iD(r),r.providerTaskId&&iz(r,t),r},i$=async(e,t)=>{iU();let a=iE.getState().runtimeTasks.find(t=>t.id===e);if(!a)return;let r=await iF(a,t);return iE.getState().setRuntimeTasks(t=>t.filter(t=>t.id!==e)),r},iV=async e=>{await iU(),await iO();let t=Date.now(),a=iE.getState(),r=a.records.filter(e=>!!iP(e.status)&&t-Date.parse(e.createdAt)<=12e5);for(let e of a.records.filter(e=>!!iP(e.status)&&t-Date.parse(e.createdAt)>12e5))iD({...e,updatedAt:new Date().toISOString(),persisted:!0}),await i$(e.id,{forcePersist:!0,error:{code:"generation_timeout",message:"Pending generation exceeded the 20 minute resume window."}});for(let t of r){iD({...t,updatedAt:new Date().toISOString(),persisted:!0});let a=Date.now()+18e4,r=!1;for(;Date.now()<a;){let a=await e(t);if(a.done){await i$(t.id,{result:a.result,error:a.error,forcePersist:!0,metadata:a.metadata}),r=!0;break}iq(t.id,{status:a.status??"polling",metadata:a.metadata}),await iR(15e3)}r||await i$(t.id,{forcePersist:!0,error:{code:"generation_timeout",message:"Resume polling timed out after 3 minutes."}})}return iE.getState().records},iW=async e=>{await iU();let t=e.startTask??iL(e.draft),a=!1!==e.persistGeneratedMedia;try{let r=await e.execute({localId:t.id,startTask:t,handleGenerationUpdate:e=>iq(t.id,e),handleGenerationComplete:e=>i$(t.id,{...e,persistGeneratedMedia:e.persistGeneratedMedia??a})});return await i$(t.id,{result:r,persistGeneratedMedia:a,forcePersist:!!(iE.getState().runtimeTasks.find(e=>e.id===t.id)?.providerTaskId||r.taskId)}),r}catch(e){throw i$(t.id,{error:af(e),forcePersist:!1,persistGeneratedMedia:a}),e}},iH="user-use",iG=e=>new Date(e).toISOString();async function iK(e){var t;let a=e.resource.url??"";try{a=await ip.localResourceStore.getValue(e.resource.resourceKey,{format:"dataUrl"})}catch{a=e.resource.url??""}return{...{id:e.resource.fileHash,resourceKey:e.resource.resourceKey,type:"video"===(t=e.resource).type||"audio"===t.type?t.type:"image",createdAt:iG(e.resource.createdAt),updatedAt:iG(e.resource.updatedAt),source:e.source,fileName:e.resource.fileName,fileSize:e.resource.size,mimeType:e.resource.mime,title:e.title??e.resource.fileName,metadata:{...e.resource.metadata??{},...e.metadata??{},resourceKey:e.resource.resourceKey}},url:"string"==typeof a?a:e.resource.url??""}}async function iJ(e,t){await ic.localStore.init();let a=await ip.localResourceStore.save(e,{source:iH,metadata:t,retentionMs:1296e6});return await im.localRecordStore.upsert({id:`${iH}:${a.fileHash}`,recordType:iH,title:a.fileName,status:"ready",resourceKeys:[a.resourceKey],payload:{resourceKey:a.resourceKey,fileName:a.fileName,mimeType:a.mime,fileSize:a.size},metadata:t,expiresAt:a.expiresAt,version:1}),iK({resource:a,source:"history-user-use",title:a.fileName,metadata:t})}async function iY(e){await ic.localStore.init();
274let t=await im.localRecordStore.list({recordType:iH,orderBy:"updatedAt",order:"desc"}),a=(await Promise.all(t.map(async e=>{let t=e.resourceKeys?.[0]??e.payload.resourceKey,a=t?await ip.localResourceStore.get(t):null;return a?iK({resource:a,source:"history-user-use",title:e.title,metadata:e.metadata}):null}))).filter(e=>!!e);return(e?a.filter(t=>t.type===e):a).sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}async function iZ(e){let t=e.includes(":")?e.split(":").at(-1):e;t&&await im.localRecordStore.delete(`${iH}:${t}`)}async function iX(){await im.localRecordStore.clear({recordType:iH})}async function iQ(){await ic.localStore.init();let e=await im.localRecordStore.list({recordType:"ai-generation",orderBy:"updatedAt",order:"desc"});return(await Promise.all(e.flatMap(e=>(e.resourceKeys??[]).map(async t=>{let a=await ip.localResourceStore.get(t);return a?iK({resource:a,source:"history-generated",title:e.title,metadata:e.metadata}):null})))).filter(e=>!!e).sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}e.i(463308),e.i(444773);var i0=e.i(594606),i1=e.i(857846),i2=e.i(65666);let i3=(0,r.default)("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);var i4=e.i(999255),i5=e.i(379983);let i6=(0,r.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var i8=e.i(723422),i9=e.i(533361),i7=e.i(351976),oe=e.i(521672);let ot={image:"image/png",video:"video/mp4",audio:"audio/mp3"},oa={image:"png",video:"mp4",audio:"mp3"},or={image:"Images",video:"Videos",audio:"Audios"},oi=(e,t="bin")=>e&&e.split(";")[0].split("/")[1]||t,oo=(e,t)=>e.id||`${e.type}-${t}`,os=e=>{if(e){if("string"==typeof e)try{let t=JSON.parse(e);return t&&"object"==typeof t?t:void 0}catch{return}return"object"==typeof e?e:void 0}},on=(e,t)=>{let a=window.URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(a)},ol=async e=>{let t=e.downloadUrl||e.url,a="https://file.videoprompt.online";if(!a||t.startsWith("data:")||!t.startsWith(a))return t;let r=t.replace(`${a}/`,"").split("?")[0],i=await (0,i9.getPresignedUrl)(r,e.mimeType||ot[e.type],"get");if(!i.success||!i.data)throw Error(i.error||"Failed to get presigned URL");return i.data},od=async e=>{let t=e.downloadUrl||e.url;if(t.startsWith("data:")){let a,r=await fetch(t),i=await r.blob(),o=oi((a=t.match(/^data:([^;,]+)/i),a?.[1]||i.type||e.mimeType),oa[e.type]);return{blob:i,extension:o,fileName:`${e.type}-${Date.now()}.${o}`}}let a=await ol(e),r=await fetch(a),i=await r.blob(),o=(t.split("?")[0].split("#")[0].split("/").pop()||"").trim(),s=o.includes(".")?o.split(".").pop()?.toLowerCase():"",n=r.headers.get("content-type")?.split(";")[0]||"",l=s||oi(n||e.mimeType,oa[e.type]),d=o||`${e.type}-${Date.now()}.${l}`;return{blob:i,extension:l,fileName:d}},oc=a.default.memo(({items:e=[],enableDownload:r=!0,enableInfo:i=!0,mediaStyle:o="",basis:s="",title:n="Generated Media",handleFunc:l,onDeleteItems:d})=>{let c,u,m,h,g,[f,y]=(0,a.useState)(null),[b,w]=(0,a.useState)(null),[x,_]=(0,a.useState)(!1),[k,S]=(0,a.useState)(!1),[j,C]=(0,a.useState)(new Set),[I,N]=(0,a.useState)(!1),[A,T]=(0,a.useState)(!1),E=(0,a.useMemo)(()=>e.filter(e=>e?.url&&["image","video","audio"].includes(e.type)),[e]),U=E.length>0&&j.size===E.length,P=e=>{i&&(y(e),_(!0))},D=async e=>{e&&(await navigator.clipboard.writeText(e),S(!0),window.setTimeout(()=>S(!1),3e3))},z=async e=>{v.toast.info(`Downloading ${e.type}...`);let{blob:t,fileName:a}=await od(e);on(t,a),v.toast.success("Downloaded successfully!")},F=async()=>{if(0===j.size)return void v.toast.error("Please select media to download");let e=E.filter((e,t)=>j.has(oo(e,t)));if(0===e.length)return void v.toast.error("Please select media to download");N(!0);try{if(1===e.length)await z(e[0]);else{v.toast.info(`Downloading ${e.length} files...`);let t=new i2.default;await Promise.all(e.map(async(e,a)=>{let{blob:r,extension:i}=await od(e);t.file(`${e.type}_${a+1}
274.${i}`,r)}));let a=await t.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}),r=new Date().toISOString().slice(0,19).replace(/[:-]/g,"").replace("T","_"),i=Array.from(new Set(e.map(e=>e.type))),o=1===i.length?or[i[0]]:"Media";on(a,`AI_Generated_${o}_${r}.zip`),v.toast.success(`Successfully downloaded ${e.length} files!`)}C(new Set)}catch(e){console.error("Bulk download error:",e),v.toast.error("Bulk download failed, please try again later")}finally{N(!1)}},M=async()=>{if(b?.length&&d){T(!0);try{await d(b);let e=new Set(b.map(e=>e.id||e.url));C(new Set),f&&e.has(f.id||f.url)&&(_(!1),y(null)),v.toast.success("Selected assets were deleted from local history.")}catch(e){console.error("Failed to delete asset:",e),v.toast.error(e instanceof Error?e.message:"Failed to delete selected assets.")}finally{T(!1),w(null)}}};if(0===E.length)return null;let O=f?(c=os(f.input),"string"==typeof(u=c?.prompt||c?.prompt_process)?u:f.prompt||""):"",B=f?(m=os(f.input),h=new Map,(g=(e,t)=>{("string"==typeof t||"number"==typeof t)&&h.set(e,t)})("aspect_ratio",m?.aspect_ratio),g("created_at",m?.created_at),g("model",m?.model),!h.has("created_at")&&f.createdAt&&h.set("created_at",String(f.createdAt)),h.has("model")||g("model",f.modelLabel||f.model),Array.from(h.entries())):[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col gap-4 w-auto",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[n?(0,t.jsx)("p",{className:"text-lg font-medium font-bold",children:n}):(0,t.jsx)("div",{className:"flex-1"}),r?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j.size>0&&d?(0,t.jsxs)(p.Button,{onClick:()=>{let e=E.filter((e,t)=>j.has(oo(e,t)));e.length>0&&w(e)},variant:"destructive",className:"flex items-center gap-2",size:"sm",children:[(0,t.jsx)(i8.Trash2,{className:"w-4 h-4"}),`Delete (${j.size})`]}):null,j.size>0?(0,t.jsxs)(p.Button,{onClick:F,disabled:I,className:"flex items-center gap-2",size:"sm",children:[(0,t.jsx)(i4.Download,{className:"w-4 h-4"}),I?"Downloading...":`Download (${j.size})`]}):null,(0,t.jsxs)(p.Button,{variant:"outline",size:"sm",onClick:()=>{U?C(new Set):C(new Set(E.map((e,t)=>oo(e,t))))},className:"flex items-center gap-2",children:[U?(0,t.jsx)(J,{className:"w-4 h-4"}):(0,t.jsx)(i6,{className:"w-4 h-4"}),U?"Deselect All":"Select All"]})]}):null]}),(0,t.jsx)("div",{className:"grid grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1 w-full max-h-[70vh] overflow-y-auto",children:E.map((e,a)=>{var n;let d=oo(e,a),c=j.has(d);return(0,t.jsxs)("div",{className:(0,ei.cn)("relative group overflow-hidden transition-all duration-300 flex items-center justify-center w-full bg-card rounded-lg","audio"===e.type?"p-1":"",s,c&&"ring-2 ring-primary/10"),children:[(n=()=>P(e),"video"===e.type?(0,t.jsx)("video",{src:e.url,className:(0,ei.cn)("w-full h-full object-contain object-center rounded-lg cursor-pointer touch-manipulation",o),onClick:n,onMouseEnter:e=>e.currentTarget.setAttribute("controls",""),onMouseLeave:e=>e.currentTarget.removeAttribute("controls"),title:`Generated video ${a+1}`,muted:!0,preload:"metadata"}):"audio"===e.type?(0,t.jsxs)("div",{className:(0,ei.cn)("w-full aspect-square bg-accent/20 flex flex-col justify-between rounded-lg cursor-pointer touch-manipulation relative overflow-hidden",o),onClick:n,title:`Generated audio ${a+1}`,children:[(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center w-full",children:(0,t.jsx)(et.Music,{className:"w-16 h-16 opacity-50"})}),(0,t.jsx)("div",{className:"w-full mt-auto",onClick:e=>e.stopPropagation(),children:(0,t.jsx)("audio",{src:e.url,className:"w-full h-8 opacity-90 hover:opacity-100 transition-opacity",controls:!0,preload:"metadata",title:`Generated audio ${a+1}`})})]}):(0,t.jsx)("img",{src:e.url,className:(0,ei.cn)("w-full h-full object-cover object-center rounded-lg cursor-pointer touch-manipulation",o),onClick:n,alt:`Generated image ${a+1}`})),r?(0,t.jsx)("div",{className:"absolute top-2 left-2",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(Y.Checkbox,{checked:c,onCheckedChange:()=>{let t,r;return t=oo(e,a),void((r=new Set(j)).has(t)?r.delete(t):r.add(t),C(r))},className:"bg-background/50 border-2 w-6 h-6"})}):null,(0,t.jsxs)("div",{className:"absolute top-2 right-2 flex flex-col gap-1",onClick:e=>e.stopPropagation(),children:[r?(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",type:"button",className:"p-2 rounded-md opacity-75 text-foreground",onClick:()=>z(e),title:"Download",children:(0,t.jsx)(i3,{className:"h-5 w-5"})}):null,i?(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",type:"button",className:"p-2 rounded-md opacity-75 text-foreground",onClick:()=>P(e),title:"View Details",children:(0,t.jsx)(i5.Info,{className:"h-5 w-5"})}):null,"image"===e.type&&l?.addImageToForm?(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",type:"button",className:"p-2 rounded-md opacity-75 text-foreground",onClick:()=>l.addImageToForm?.(e.url),title:"Add to Image ref",children:(0,t.jsx)(R.Plus,{className:"h-5 w-5"})}):null]})]},d)})}),(0,t.jsx)(i7.Dialog,{open:x,onOpenChange:_,children:(0,t.jsxs)(i7.DialogContent,{className:"p-0 flex flex-col rounded-none md:max-w-[70vw] md:max-h-[80vh] max-w-[90vw] max-h-[70vh]",children:[(0,t.jsx)(i7.DialogTitle,{asChild:!0,children:(0,t.jsx)(i1.Root,{children:"Media Details"})}),f?"video"===f.type?(0,t.jsx)("div",{className:"w-full flex items-center justify-center mb-4",children:(0,t.jsx)("video",{src:f.url,className:"w-full max-w-full max-h-[50vh] object-contain rounded-md",controls:!0,preload:"metadata",title:"Selected video"})}):"audio"===f.type?(0,t.jsx)("div",{className:"w-full flex items-center justify-center mb-4",children:(0,t.jsx)("audio",{src:f.url,className:"w-[80%] max-w-full",controls:!0,preload:"metadata",title:"Selected audio"})}):(0,t.jsx)("div",{className:"w-full flex items-center justify-center md:h-[60vh] h-[30vh] p-2 shrink-0",children:(0,t.jsx)("img",{src:f.url,className:"max-w-full max-h-full w-auto h-auto object-contain rounded-md",alt:"Selected image"})}):null,f?(0,t.jsxs)("div",{className:"w-full mb-4 px-4 text-left md:pl-6 flex-1 max-h-[20vh] overflow-auto",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2",children:[O?(0,t.jsxs)(p.Button,{variant:"ghost",size:"icon",type:"button",className:"p-2",onClick:()=>D(O),children:[k?(0,t.jsx)(K.CopyCheck,{className:"h-5 w-5"}):(0,t.jsx)(G.Copy,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"sr-only",children:"Copy"})]}):null,r?(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",type:"button",className:"p-2",onClick:()=>z(f),children:(0,t.jsx)(i3,{className:"h-5 w-5"})}):null]}),O?(0,t.jsx)("div",{className:"bg-primary/10 p-4 rounded-md text-sm md:text-base",children:(0,t.jsx)("p",{className:"whitespace-pre-wrap",children:O})}):null,B.length>0?(0,t.jsx)("div",{className:"flex flex-wrap w-full gap-2 mt-4",children:B.map(([e,a])=>(0,t.jsx)(ae.Badge,{variant:"outline",className:"text-xs",children:"created_at"===e?`created at: ${new Date(String(a)).toLocaleStr
274ing()}`:`${(0,rI.toKebabCase)(e).replace(/[-_]/g," ")}: ${String(a)}`},e))}):null]}):null]})})]}),(0,t.jsx)(oe.AlertDialog,{open:!!b?.length,onOpenChange:e=>{e||A||w(null)},children:(0,t.jsxs)(oe.AlertDialogContent,{children:[(0,t.jsxs)(oe.AlertDialogHeader,{children:[(0,t.jsx)(oe.AlertDialogTitle,{children:"Delete selected assets?"}),(0,t.jsx)(oe.AlertDialogDescription,{children:"Selected assets will be removed from local history only."})]}),(0,t.jsxs)(oe.AlertDialogFooter,{children:[(0,t.jsx)(oe.AlertDialogCancel,{disabled:A,children:"Cancel"}),(0,t.jsx)(oe.AlertDialogAction,{onClick:e=>{e.preventDefault(),M()},disabled:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})});oc.displayName="MediaGalleryWithDelete";var op=e.i(707330);let ou=(0,r.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),om=(0,r.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),oh=(0,r.default)("clock-3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]),og=(0,r.default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),of=(0,r.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),ov=(0,r.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),oy=["image","video","audio"],ob={image:"Images",video:"Videos",audio:"Audios"},ow=({status:e})=>"succeeded"===e?(0,t.jsx)(om,{className:"h-4 w-4 text-green-600"}):"failed"===e||"timeout"===e?(0,t.jsx)(ou,{className:"h-4 w-4 text-red-600"}):(0,t.jsx)(E.Loader2,{className:"h-4 w-4 animate-spin text-blue-600"}),ox=({type:e})=>"video"===e?(0,t.jsx)(er,{className:"h-4 w-4"}):"audio"===e?(0,t.jsx)(ov,{className:"h-4 w-4"}):(0,t.jsx)(of,{className:"h-4 w-4"}),o_=async(e,t,a)=>{let r=[];for(let i of e)for(let e of i.mediaAssetIds||[]){let o=t.get(e),s=o?.resourceKey??("string"==typeof o?.metadata?.resourceKey?o.metadata.resourceKey:void 0)??(e.includes(":")?e:void 0),n=o?.sourceUrl??null;if(s)try{let e=await ip.localResourceStore.getValue(s,{format:"url"});"string"==typeof e&&(n=e,e.startsWith("blob:")&&a.push(e))}catch{n=o?.sourceUrl??null}n&&r.push({id:s??o?.id??e,type:o?.type??i.type??"image",url:n,downloadUrl:o?.sourceUrl||n,mimeType:o?.mimeType,prompt:i.prompt||i.summary,input:i.metadata,createdAt:i.completedAt||o?.createdAt||i.updatedAt,model:i.modelId,modelLabel:i.modelLabel,metadata:{...o?.metadata??{},...s?{resourceKey:s}:{}},raw:i})}return r},ok=async e=>{for(let t of e){if(!t.id)throw Error("Missing asset id.");if(!await iB(t.id))throw Error("Failed to find one of the selected assets.")}},oS=()=>{(0,a.useEffect)(()=>{iM()},[])},oj=({className:e})=>{let r=iE(e=>e.runtimeTasks);oS();let i=(0,a.useMemo)(()=>[...r].filter(e=>"starting"===e.status||"running"===e.status||"polling"===e.status).sort((e,t)=>Date.parse(t.updatedAt)-Date.parse(e.updatedAt)),[r]);return 0===i.length?null:(0,t.jsxs)(Z.Card,{className:e,children:[(0,t.jsx)(Z.CardHeader,{className:"pb-3",children:(0,t.jsxs)(Z.CardTitle,{className:"flex items-center justify-between text-base",children:[(0,t.jsx)("span",{children:"Running Tasks"}),(0,t.jsx)(ae.Badge,{variant:"outline",children:i.length})]})}),(0,t.jsx)(Z.CardContent,{children:(0,t.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:i.map(e=>(0,t.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,t.jsx)(ow,{status:e.status}),(0,t.jsx)(ox,{type:e.type}),(0,t.jsx)("span",{children:e.modelLabel||e.modelId})]}),(0,t.jsx)(ae.Badge,{variant:"secondary",children:e.status})]}),(0,t.jsx)("div",{className:"line-clamp-2 text-sm text-muted-foreground",children:e.prompt||e.summary||"No prompt"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)(oh,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:(e=>{if(!e)return"--";let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString()}`})(e.updatedAt)})]})]},e.id))})})]})},oC=({results:e,className:r,contentClassName:i,maxItems:o=24})=>{let s=iE(e=>e.records),n=iE(e=>e.mediaAssets),[l,d]=(0,a.useState)("image"),[c,u]=(0,a.useState)("image"),[m,h]=(0,a.useState)(12),[g,f]=(0,a.useState)(12),[v,y]=(0,a.useState)(!1);oS();let b=(0,a.useMemo)(()=>{let e=new Map;
274return n.forEach(t=>{e.set(t.id,t),e.set(t.resourceKey,t)}),e},[n]),w=(0,a.useMemo)(()=>e.some(e=>e.items.length>0),[e]),x=(0,a.useMemo)(()=>s.some(e=>(e.mediaAssetIds?.length||0)>0),[s]),_=(0,a.useMemo)(()=>oy.filter(t=>e.some(e=>e.type===t&&e.items.length>0)),[e]),k=(0,a.useMemo)(()=>oy.filter(e=>s.some(t=>t.type===e&&(t.mediaAssetIds?.length||0)>0)),[s]),S=_.includes(l)?l:_[0],j=k.includes(c)?c:k[0],C=(0,a.useMemo)(()=>S?[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)).filter(e=>e.type===S&&e.items.length>0).slice(0,o):[],[S,o,e]),I=(0,a.useMemo)(()=>C.slice(0,m),[m,C]),N=(0,a.useMemo)(()=>I.flatMap(e=>e.items.map(t=>({...t,prompt:t.prompt||e.prompt,createdAt:t.createdAt||e.createdAt,model:t.model||e.modelId,modelLabel:t.modelLabel||e.modelLabel}))),[I]),A=(0,a.useMemo)(()=>C.reduce((e,t)=>e+t.items.length,0),[C]),T=m<C.length,E=(0,a.useMemo)(()=>j?[...s].sort((e,t)=>{let a=Date.parse(e.completedAt||e.updatedAt||e.createdAt);return Date.parse(t.completedAt||t.updatedAt||t.createdAt)-a}).filter(e=>!!e.mediaAssetIds?.length&&e.type===j).slice(0,o):[],[j,o,s]),R=(0,a.useMemo)(()=>E.slice(0,g),[E,g]),U=(0,a.useMemo)(()=>E.reduce((e,t)=>e+(t.mediaAssetIds?.length||0),0),[E]),P=g<E.length,D=((e,t)=>{let[r,i]=(0,a.useState)([]);return(0,a.useEffect)(()=>{let a=!1,r=[];return o_(e,t,r).then(e=>{a||i(e)}),()=>{a=!0,r.forEach(e=>URL.revokeObjectURL(e))}},[e,t]),r})(R,b),z=(0,a.useCallback)(e=>{d(e),h(12)},[]),F=(0,a.useCallback)(e=>{u(e),f(12)},[]),M=(0,a.useCallback)(ok,[]);return w||x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(Z.Card,{className:r,children:[(0,t.jsxs)(Z.CardHeader,{className:"gap-3 pb-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)(Z.CardTitle,{className:"text-base",children:"Latest Results"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w?(0,t.jsx)(ae.Badge,{variant:"outline",children:A}):null,(0,t.jsx)(op.TooltipProvider,{children:(0,t.jsxs)(op.Tooltip,{children:[(0,t.jsx)(op.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:x?void 0:"cursor-not-allowed",children:(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Open stored generation history",disabled:!x,onClick:()=>y(!0),children:(0,t.jsx)(og,{className:"h-4 w-4"})})})}),(0,t.jsx)(op.TooltipContent,{children:"Stored history"})]})})]})]}),_.length>0?(0,t.jsx)(aa.Tabs,{value:S,onValueChange:z,children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsx)(aa.TabsList,{className:"inline-grid w-auto min-w-0",style:{gridTemplateColumns:`repeat(${_.length}, minmax(88px, max-content))`},children:_.map(e=>(0,t.jsx)(aa.TabsTrigger,{value:e,children:ob[e]},e))})})}):null]}),(0,t.jsxs)(Z.CardContent,{className:(0,ei.cn)(i),children:[0===N.length?(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:"No generated media in this session."}):(0,t.jsx)(oc,{items:N,enableDownload:!0,enableInfo:!0,basis:"aspect-[1/1]",title:""}),T?(0,t.jsx)("div",{className:"mt-4 flex justify-center",children:(0,t.jsx)(p.Button,{variant:"outline",onClick:()=>h(e=>e+12),children:"Load More"})}):null]})]}),(0,t.jsx)(i7.Dialog,{open:v,onOpenChange:y,children:(0,t.jsxs)(i7.DialogContent,{className:"flex max-h-[90dvh] w-full max-w-[calc(100vw-1rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl",children:[(0,t.jsxs)(i7.DialogHeader,{className:"border-b px-4 py-4 pr-12",children:[(0,t.jsx)(i7.DialogTitle,{className:"text-base",children:"Stored Results"}),(0,t.jsx)(i7.DialogDescription,{children:"Browse results saved in local history by media type."})]}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[k.length>0?(0,t.jsx)(aa.Tabs,{value:j,onValueChange:F,children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsx)(aa.TabsList,{className:"inline-grid w-auto min-w-0",style:{gridTemplateColumns:`repeat(${k.length}, minmax(88px, max-content))`},children:k.map(e=>(0,t.jsx)(aa.TabsTrigger,{value:e,children:ob[e]},e))})})}):null,(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:j?ob[j]:"History"}),x?(0,t.jsx)(ae.Badge,{variant:"outline",children:U}):null]}),0===D.length?(0,t.jsx)("div",{className:"rounded-lg border border-dashed p-6 text-center text-sm text-muted-foreground",children:"No stored media for this type."}):(0,t.jsx)(oc,{items:D,enableDownload:!0,enableInfo:!0,basis:"aspect-[1/1]",title:"",onDeleteItems:M}),P?(0,t.jsx)("div",{className:"flex justify-center pb-2",children:(0,t.jsx)(p.Button,{variant:"outline",onClick:()=>f(e=>e+12),children:"Load More"})}):null]})]})})]}):null},oI=(0,r.default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}
274],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]),oN=(0,r.default)("pencil-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);e.i(265497);var oA=e.i(99341);let oT=({prompt:e="",onPromptSelect:r,type:i="image",control_images:o=[],promptEnhanceSettings:s,isPromptIgnore:n=!1})=>{let{t:l}=(0,oA.useTranslation)(),d=l("app/generator:ai-generator-app",{returnObjects:!0})||oE,[c,u]=(0,a.useState)(!1),[m,h]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e;return m>0&&(e=setInterval(()=>{h(e=>e-1)},1e3)),()=>{e&&clearInterval(e)}},[m]);let g=async()=>{if(e.length<6)return void v.toast.error("Please enter at least 6 characters");if(e.length>1200)return void v.toast.error("Please enter no more than 1200 characters");u(!0);try{let t=eg.image_prompt_enhance_by_image_system_prompt;"image"===i?t=o.length>0?eg.image_prompt_generator_system_prompt:eg.image_prompt_enhance_by_image_system_prompt:"video"===i&&(t=eg.video_prompt_text_generator_system_prompt),s&&s?.system_prompt&&(t=s?.system_prompt);let a=await (0,q.handleAutoPromptEnhance)(t,e,o||[]),n=Array.isArray(a)&&a?.length>0?a?.[0]:e;r(n)}catch(e){console.error("Failed to enhance prompt: "+e?.message)}finally{u(!1)}},f=c||n||e.length<6||e.length>1200||m>0||"audio"===i&&!s?.system_prompt;return(0,t.jsx)("div",{className:"",children:(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)(p.Button,{onClick:g,disabled:f,variant:"ghost",className:"absolute bottom-2 right-5 text-xs hover:bg-accent/40 min-w-[80px]",type:"button",size:"sm",children:c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oI,{className:"mr-2 h-3 w-3 animate-spin"}),(0,t.jsxs)("span",{className:"text-xs",children:[" ",d?.promptEnhancer?.enhancing||"Enhancing..."]})]}):m>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oN,{className:"mr-2 h-3 w-3"}),(0,t.jsxs)("span",{className:"text-xs",children:[m,"s"]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oN,{className:"mr-2 h-3 w-3"}),(0,t.jsxs)("span",{className:"text-xs",children:[" ",d?.promptEnhancer?.enhance||"Enhance"]})]})})})})},oE={promptEnhancer:{enhancing:"Enhancing...",enhance:"Enhance"}};var oR=e.i(291967),oU=e.i(748508),oP=e.i(89045),oD=e.i(79053),oz=e.i(317791),oF=e.i(723983),oM=e.i(938128),oO=e.i(858404),oB=e.i(39161),oL=e.i(88630),oq=e.i(332789),o$=e.i(316213),oV=e.i(824195),oW=e.i(73772),oH=e.i(898811),oG="Popover",[oK,oJ]=(0,oP.createContextScope)(oG,[oO.createPopperScope]),oY=(0,oO.createPopperScope)(),[oZ,oX]=oK(oG),oQ=e=>{let{__scopePopover:r,children:i,open:o,defaultOpen:s,onOpenChange:n,modal:l=!1}=e,d=oY(r),c=a.useRef(null),[p,u]=a.useState(!1),[m,h]=(0,oV.useControllableState)({prop:o,defaultProp:s??!1,onChange:n,caller:oG});return(0,t.jsx)(oO.Root,{...d,children:(0,t.jsx)(oZ,{scope:r,contentId:(0,oM.useId)(),triggerRef:c,open:m,onOpenChange:h,onOpenToggle:a.useCallback(()=>h(e=>!e),[h]),hasCustomAnchor:p,onCustomAnchorAdd:a.useCallback(()=>u(!0),[]),onCustomAnchorRemove:a.useCallback(()=>u(!1),[]),modal:l,children:i})})};oQ.displayName=oG;var o0="PopoverAnchor",o1=a.forwardRef((e,r)=>{let{__scopePopover:i,...o}=e,s=oX(o0,i),n=oY(i),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=s;return a.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(oO.Anchor,{...n,...o,ref:r})});o1.displayName=o0;var o2="PopoverTrigger",o3=a.forwardRef((e,a)=>{let{__scopePopover:r,...i}=e,o=oX(o2,r),s=oY(r),n=(0,oU.useComposedRefs)(a,o.triggerRef),l=(0,t.jsx)(oq.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sn(o.open),...i,ref:n,onClick:(0,oR.composeEventHandlers)(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:(0,t.jsx)(oO.Anchor,{asChild:!0,...s,children:l})});o3.displayName=o2;var o4="PopoverPortal",[o5,o6]=oK(o4,{forceMount:void 0}),o8=e=>{let{__scopePopover:a,forceMount:r,children:i,container:o}=e,s=oX(o4,a);return(0,t.jsx)(o5,{scope:a,forceMount:r,children:(0,t.jsx)(oL.Presence,{present:r||s.open,children:(0,t.jsx)(oB.Portal,{asChild:!0,container:o,children:i})})})};o8.displayName=o4;var o9="PopoverContent",o7=a.forwardRef((e,a)=>{let r=o6(o9,e.__scopePopover),{forceMount:i=r.forceMount,...o}=e,s=oX(o9,e.__scopePopover);return(0,t.jsx)(oL.Presence,{present:i||s.open,children:s.modal?(0,t.jsx)(st,{...o,ref:a}):(0,t.jsx)(sa,{...o,ref:a})})});o7.displayName=o9;var se=(0,o$.createSlot)("PopoverContent.RemoveScroll"),st=a.forwardRef((e,r)=>{let i=oX(o9,e.__scopePopover),o=a.useRef(null),s=(0,oU.useComposedRefs)(r,o),n=a.useRef(!1);return a.useEffect(()=>{let e=o.current;if(e)return(0,oW.hideOthers)(e)},[]),(0,t.jsx)(oH.RemoveScroll,{as:se,allowPinchZoom:!0,children:(0,t.jsx)(sr,{...e,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,oR.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),n.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,oR.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,a=0===t.button&&!0===t.ctrlKey;n.current=2===t.button||a},{checkForDefaultPrevented:!1}),onFocusOutside:(0,oR.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),sa=a.forwardRef((e,r)=>{let i=oX(o9,e.__scopePopover),o=a.useRef(!1),s=a.useRef(!1);return(0,t.jsx)(sr,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||i.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let a=t.target;i.triggerRef.current?.contains(a)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),sr=a.forwardRef((e,a)=>{let{__scopePopover:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:n,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:p,...u}=e,m=oX(o9,r),h=oY(r);return(0,oz.useFocusGuards)(),(0,t.jsx)(oF.FocusScope,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:s,children:(0,t.jsx)(oD.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:n,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:(0,t.jsx)(oO.Content,{"data-state":sn(m.open),role:"dialog",id:m.contentId,...h,...u,ref:a,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),si="PopoverClose",so=a.forwardRef((e,a)=>{let{__scopePopover:r,...i}=e,o=oX(si,r);return(0,t.jsx)(oq.Primitive.button,{type:"button",...i,ref:a,onClick:(0,oR.composeEventHandlers)(e.onClick,()=>o.onOpenChange(!1))})});so.displayName=si;var ss=a.forwardRef((e,a)=>{let{__scopePopover:r,...i}=e,o=oY(r);return(0,t.jsx)(oO.Arrow,{...o,...i,ref:a})});function sn(e){return e?"open":"closed"}ss.displayName="PopoverArrow",e.s(["Anchor",0,o1,"Arrow",0,ss,"Close",0,so,"Content",0,o7,"Popover",0,oQ,"PopoverAnchor",0,o1,"PopoverArrow",0,ss,"PopoverClose",0,so,"PopoverContent",0,o7,"PopoverPortal",0,o8,"PopoverTrigger",0,o3,"Portal",0,o8,"Root",0,oQ,"Trigger",0,o3,"createPopoverScope",0,oJ],365199);var sl=e.i(365199),sl=sl;function sd({...e}){return(0,t.jsx)(sl.Root,{"data-slot":"popover",...e})}function sc({...e}){return(0,t.jsx)(sl.Trigger,{"data-slot":"popover-trigger",...e})}function sp({className:e,align:a="center",sideOffset:r=4,...i}){return(0,t.jsx)(sl.Portal,{children:(0,t.jsx)(sl.Content,{"data-slot":"popover-content",align:a,sideOffset:r,className:(0,ei.cn)("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
274de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...i})})}var su=e.i(256465);let sm=Object.keys(ec.aspectRatioDimensions_1440),sh=({handleAspectRatioChange:e,customAspectRatios:r,selectedRatio:i,disabled:o})=>{let[s,n]=(0,a.useState)(!1),l=r||sm,d=l.includes(i)?l:[...l,i];return(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsxs)(sd,{onOpenChange:e=>n(e),children:[(0,t.jsx)(sc,{asChild:!0,children:(0,t.jsxs)(p.Button,{variant:"ghost",className:"flex items-center gap-2 px-3 py-2",disabled:o,children:[(0,t.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,t.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,t.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),(0,t.jsx)("span",{children:i||"1:1"}),(0,t.jsx)(su.ChevronDown,{className:`w-4 h-4 transition-transform duration-300 ${s?"rotate-180":""}`})]})}),(0,t.jsx)(sp,{className:"w-auto p-4",children:(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",children:d.map(a=>(0,t.jsx)(p.Button,{variant:i===a?"default":"outline",onClick:()=>{e(a)},type:"button",className:"text-sm",disabled:o,children:a},a))})})]})})};var sg=e.i(573839);let sf=(0,r.default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var sv=e.i(293753);let sy=e=>e.split(" ").map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" ");function sb({modelSeries:e,onModelSelect:r,currentModel:i,open:o,onOpenChange:s,triggerText:n="Choose Settings"}){let[l,c]=a.default.useState(""),[u,m]=a.default.useState(!1),h=void 0!==o&&void 0!==s;a.default.useEffect(()=>{Object.keys(e).length>0&&!l&&c(Object.keys(e)[0])},[e,l]);let g=a.default.useMemo(()=>Object.keys(e||{}).map(t=>({name:t,icon:t.includes("video")?er:t.includes("image")?of:d.Sparkles,displayName:sy(t),count:e[t]?.length??0})),[e]);a.default.useEffect(()=>{if(!g.length){l&&c("");return}l&&l in e||c(g[0]?.name??"")},[g,e,l]);let f=a.default.useMemo(()=>Object.values(e||{}).flat(),[e]),v=a.default.useMemo(()=>{if(i)return f.find(e=>e.id===i)},[f,i]),y=a.default.useRef(void 0);a.default.useEffect(()=>{v&&(y.current=v)},[v]);let b=v??y.current,w=a.default.useMemo(()=>l?e[l]??[]:[],[e,l]),x=l?sy(l):"Models",_=a.default.useCallback(e=>{r(e)},[r]);return(0,t.jsxs)(sv.Sheet,{open:h?o:u,onOpenChange:h?s:m,children:[(0,t.jsx)(sv.SheetTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer gap-2 rounded-lg border-2 border-dashed border-foreground
274/20 p-3 transition-all hover:border-foreground/60 hover:bg-accent/50 group",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(sf,{className:"h-4 w-4 text-muted-foreground transition-all group-hover:rotate-90 group-hover:text-foreground"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:n||"Choose Settings"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[b?.tag&&b.tag.length>0&&(0,t.jsx)(ae.Badge,{className:"text-xs",variant:"outline",children:b.tag[0]}),b&&(0,t.jsx)(ae.Badge,{className:"text-xs",variant:"default",children:b.label||i})]})]})}),(0,t.jsxs)(sv.SheetContent,{side:"bottom",className:"h-[75vh] max-h-[75vh] rounded-t-xl p-0 sm:inset-x-auto sm:top-0 sm:right-0 sm:bottom-0 sm:h-full sm:max-h-none sm:w-[520px] sm:max-w-[520px] sm:rounded-none sm:data-[state=closed]:slide-out-to-right sm:data-[state=open]:slide-in-from-right",children:[(0,t.jsx)(sv.SheetHeader,{className:"p-4 pr-12 sm:p-5 sm:pr-12",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(sv.SheetTitle,{children:"Model Settings"}
274),(0,t.jsx)(sv.SheetDescription,{children:b?b.label:"Choose the model you want to use"})]})}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 px-4 pb-4 sm:px-5 sm:pb-5",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:x}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[w.length," ",1===w.length?"model":"models"]})]}),b&&(0,t.jsx)(ae.Badge,{variant:"secondary",className:"max-w-[45%] truncate",children:b.label})]}),(0,t.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 sm:grid sm:grid-cols-2 sm:overflow-visible sm:pb-0",children:g.map(e=>(0,t.jsxs)(p.Button,{type:"button",variant:l===e.name?"default":"outline",size:"sm",onClick:()=>c(e.name),className:"shrink-0 justify-start gap-2 sm:w-full",children:[(0,t.jsx)(e.icon,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"truncate text-xs capitalize",children:e.displayName}),(0,t.jsx)(ae.Badge,{variant:l===e.name?"secondary":"outline",className:"ml-auto",children:e.count})]},e.name))})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:w.length>0?(0,t.jsx)("div",{className:"flex flex-col gap-2",children:w.map((e,a)=>{let r,o=i===e.id,s=Array.isArray(r=e.options?.imageUrl)?r[0]??"":r||"";return(0,t.jsx)(Z.Card,{className:(0,ei.cn)("overflow-hidden py-0 transition-all",o?"border-primary bg-primary/5 shadow-sm ring-2 ring-primary/30":"hover:border-primary/60 hover:bg-accent/50"),children:(0,t.jsxs)("button",{type:"button",onClick:()=>_(e),className:"flex w-full items-stretch gap-3 p-3 text-left",children:[!!s&&(0,t.jsx)("img",{src:s,alt:"",className:"aspect-square w-20 shrink-0 rounded-md object-cover sm:w-24",loading:"lazy"}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:(0,ei.cn)("truncate text-sm font-medium capitalize",o&&"text-primary"),children:e.label}),(0,t.jsx)("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:e.description})]}),o&&(0,t.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground",children:(0,t.jsx)(sg.CheckIcon,{className:"h-3 w-3"})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.useCredits&&(0,t.jsxs)(ae.Badge,{variant:"outline",className:"capitalize",children:[e.useCredits,(0,t.jsx)(D.Zap,{className:"h-3 w-3 text-[#facc15]"})]}),Array.isArray(e.tag)&&e.tag.map(e=>(0,t.jsx)(ae.Badge,{variant:o?"default":"secondary",className:"capitalize",children:e},e)),Array.isArray(e.badge)&&e.badge.slice(0,2).map(e=>(0,t.jsx)(ae.Badge,{variant:"outline",className:"capitalize",children:e},e))]})]})]})},`${e.id}-${a}`)})}):(0,t.jsx)("div",{className:"flex h-full min-h-40 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground",children:"No available models in this category"})})]})]})]})}(0,r.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),(0,r.default)("circle-help",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);let sw=({presetList:e,onHandlePresetList:r})=>{let[i,o]=(0,a.useState)(null),[s,n]=(0,a.useState)(""),[l,d]=(0,a.useState)(!1);return e&&0!==e.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mt-4 ",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(a=>(0,t.jsxs)(ae.Badge,{className:"group",variant:"outline",children:[(0,t.jsx)("span",{children:a.label||a.id||"Preset"}),(0,t.jsx)("div",{className:"flex items-center gap-1 ",children:(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon",onClick:()=>{var t;(t=a.id)&&r&&r(e.filter(e=>e.id!==t))},"aria-label":"Delete preset",children:(0,t.jsx)(i8.Trash2,{className:"h-5 w-5 text-destructive"})})})]},a.id))})}),(0,t.jsx)(i7.Dialog,{open:l,onOpenChange:d,children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-[500px]",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:"Edit Preset"})}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("label",{className:"text-sm font-medium",children:i?.label})}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(N.Textarea,{value:s,onChange:e=>n(e.target.value),className:"min-h-[200px] font-mono text-sm",placeholder:"è¾å
¥é¢è®¾å¼..."})})]}),(0,t.jsxs)(i7.DialogFooter,{children:[(0,t.jsx)(p.Button,{type:"button",variant:"outline",onClick:()=>{d(!1),o(null),n("")},children:"cancel"}),(0,t.jsx)(p.Button,{type:"button",onClick:()=>{i&&r&&(r(e.map(e=>{if(e.id===i.id){let t=s;try{t=JSON.parse(s)}catch{t=s}return{...e,value:t}}return e})),d(!1),o(null),n(""))},children:"Confirm"})]})]})})]}):null},sx=(0,r.default)("book-open-check",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);var s_=e.i(960730);let sk=(0,r.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),sS=(0,r.default)("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),sj=(0,r.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),sC=({label:e,previewSrc:r,hasSettings:i,isSelected:o,media:s,isInDialog:n=!1,onSelect:l})=>{let[d,c]=(0,a.useState)(!1),u=()=>{i&&l()};return r&&"none"!==s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",onClick:u,disabled:!i,className:(0,ei.cn)("group relative flex flex-col overflow-hidden rounded transition-all hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 cursor-pointer",!i&&"cursor-not-allowed opacity-60",o?"border-primary ring-2 ring-primary/30 shadow-lg bg-primary/5 ":"border-border hover:shadow-md",n?"h-full w-full border-2":"w-full border"),children:[o&&(0,t.jsx)("div",{className:"absolute inset-0 z-[5] bg-foreground
274/40 pointer-events-none rounded"}),o&&(0,t.jsx)("div",{className:"absolute right-0.5 top-0.5 md:right-1 md:top-1 z-20 rounded-full p-0.5",children:(0,t.jsx)(sk,{className:"h-5 w-5 "})}),("video"===s||"audio"===s)&&r&&(0,t.jsx)("div",{onClick:e=>{e.stopPropagation(),c(!0)},className:(0,ei.cn)("absolute z-20 rounded-full bg-black/60 p-1 md:p-1.5 transition-all hover:bg-black/80 hover:scale-110 cursor-pointer","left-0.5 top-0.5 md:left-1 md:top-1"),title:"Preview",role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),c(!0))},children:(0,t.jsx)(sj,{className:"h-3 w-3 md:h-4 md:w-4 text-white"})}),(0,t.jsxs)("div",{className:(0,ei.cn)("relative flex items-center justify-center bg-muted aspect-[1/1]",n?"w-full":"h-16 md:h-20"),children:["image"===s&&r?(0,t.jsx)("img",{src:r,alt:e,className:"h-full w-full object-contain"}):null,"video"===s&&r?(0,t.jsx)("video",{src:r,className:"h-full w-full object-cover",muted:!0,loop:!0,playsInline:!0}):null,"audio"===s&&r?(0,t.jsxs)("div",{className:"w-full flex-1 flex flex-col items-center justify-center gap-1 md:gap-2",children:[(0,t.jsx)(sS,{className:"h-6 w-6 "}),(0,t.jsx)("span",{className:"text-[10px] md:text-xs text-muted-foreground",children:"Audio"})]}):null]}),(0,t.jsx)("div",{className:(0,ei.cn)("flex items-center justify-between gap-1 px-1.5 py-0.5 md:px-2 md:py-1 mt-auto",o&&"bg-primary/10"),children:(0,t.jsx)("span",{className:"line-clamp-2 text-left font-medium truncate text-[10px] md:text-xs",children:e})})]}),(0,t.jsx)(i7.Dialog,{open:d,onOpenChange:c,children:(0,t.jsxs)(i7.DialogContent,{className:"max-w-3xl",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:e})}),(0,t.jsxs)("div",{className:"flex items-center justify-center bg-muted rounded-lg overflow-hidden",children:["video"===s&&r?(0,t.jsx)("video",{src:r,className:"w-full max-h-[70vh]",controls:!0,autoPlay:!0,loop:!0}):null,"audio"===s&&r?(0,t.jsxs)("div",{className:"w-full p-8 flex flex-col items-center gap-6",children:[(0,t.jsx)(sS,{className:"h-16 w-16 text-primary"}),(0,t.jsx)("audio",{src:r,className:"w-full",controls:!0})]}):null]})]})})]}):(0,t.jsxs)(p.Button,{type:"button",variant:"outline",size:n?"default":"sm",disabled:!i,onClick:u,className:(0,ei.cn)("relative whitespace-nowrap transition-all border-2",o?"border-primary bg-primary/5 ring-2 ring-primary/30 shadow-md":"hover:shadow-md",n&&"text-sm md:text-base"),children:[o&&(0,t.jsx)(sk,{className:"mr-1.5 h-4 w-4 text-primary"}),(0,t.jsx)("span",{className:"line-clamp-2 text-left font-medium truncate text-[10px] md:text-xs",children:e})]})},sI=e=>{let t=e.trim().toLowerCase();return t&&"other"!==t?t.replace(/[-_]/g," ").replace(/^(\w)/,e=>e.toUpperCase()):"Examples"},sN=e=>{let t=e?.previewUrl;if(!t)return"none";let a=t.toLowerCase();return a.includes(".mp4")||a.includes(".webm")||a.includes(".mov")?"video":a.includes(".mp3")||a.includes(".wav")||a.includes(".ogg")?"audio":"image"},sA=({options:e,onHandleExampleFunc:r,onHandleFormSetting:i,className:o})=>{let[s,n]=(0,a.useState)(!1),[l,d]=(0,a.useState)(""),[c,u]=(0,a.useState)([]),[m,h]=(0,a.useState)(null),g=Array.isArray(e?.examples)?e?.examples:Array.isArray(e?.example)?e?.example:[];if(0===g.length)return null;let f=Object.entries(g.reduce((e,t)=>{let a=(t?.category||t?.type||"other").toLowerCase();return e[a]||(e[a]=[]),e[a].push(t),e},{})),v=(e,a,o,s=!1)=>{let n=e?.label??`Example ${a+1}`,l=e?.previewUrl,d=!!e?.formSetting,c=`${o}-${n}-${a}`;return(0,t.jsx)(sC,{label:n,previewSrc:l,hasSettings:d,isSelected:m===c,media:o,isInDialog:s,onSelect:()=>{var t;return t=e.formSetting,void(r?.(e),i?.(t),c&&h(c))}},`${n}-${a}`)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,ei.cn)("flex flex-col gap-3 items-start justify-center",o),children:f.map(([e,a])=>((e,a)=>{if(!a.length)return null;let r=e.toLowerCase(),i=a.map((e,t)=>({example:e,originalIndex:t,renderKind:sN(e)})),o=i.findIndex(({example:e,originalIndex:t,renderKind:a})=>{let r=e?.label??`Example ${t+1}`;return m===`${a}-${r}-${t}`});if(o>0){let[e]=i.splice(o,1);i.unshift(e)}let s=i.length>5,l=s?i.slice(0,4):i;return i[0]?.renderKind,(0,t.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[(0,t.jsxs)("div",{className:"flex items-start justify-start gap-1",children:[(0,t.jsx)(sx,{className:"h-5 w-5 cursor-help text-muted-foreground"}),(0,t.jsxs)("span",{className:"text-xs font-semibold tracking-wide text-muted-foreground",children:["Choose ",sI(r)]})]}),(0,t.jsx)("div",{className:"grid grid-cols-4 md:grid-cols-4 gap-1.5 md:gap-2 items-start justify-start ",children:l.map(e=>(({example:e,originalIndex:t,renderKind:a})=>v(e,t,a))(e))}),s&&(0,t.jsxs)(p.Button,{type:"button",onClick:()=>{d(e),u(a),n(!0)},size:"sm",variant:"outline",children:[(0,t.jsx)(s_.MoreHorizontal,{className:"h-4 w-4 mr-1"}),"More (",a.length,")"]},"more-button")]},e)})(e,a))}),(0,t.jsx)(i7.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(i7.DialogContent,{className:"max-w-[95vw] lg:max-w-[65vw] llg:max-w-[55vw] max-h-[50vh] md:max-h-[80vh] overflow-y-auto w-full",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{className:"text-base md:text-lg",children:sI(l)})}),(0,t.jsx)("div",{className:"grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-2 py-4 w-full",children:c.map((e,t)=>{let a=sN(e);return v(e,t,a,!0)})})]})})]})};function sT({text:e,className:a}){let r=function(e){let t,a=[],r=/\[([^\]]+)\]\(([^)]+)\)/g,i=0;for(;null!==(t=r.exec(e));)t.index>i&&a.push(e.slice(i,t.index)),a.push({type:"link",text:t[1],url:t[2]}),i=t.index+t[0].length;return i<e.length&&a.push(e.slice(i)),a.length>0?a:[e]}(e);return(0,t.jsx)("p",{className:(0,ei.cn)("text-sm leading-relaxed text-left text-muted-foreground",a),children:r.map((e,a)=>"string"==typeof e?(0,t.jsx)("span",{children:e},a):(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>{},className:"text-primary hover:text-primary/80 underline underline-offset-2 transition-colors font-medium cursor-pointer inline-flex items-center gap-1",children:e.text},a))})}function sE({note:e,className:r,variant:i="default"}){let{i18n:o}=(0,oA.useTranslation)(),s=o.language,[n,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(0);if((0,a.useEffect)(()=>{c(0)},[e,s]),!e||Array.isArray(e)&&0===e.length)return null;let p=(Array.isArray(e)?e:[e]).flatMap(e=>(function(e,t){if("string"==typeof e)return[e];let a=e[t]??e.en??Object.values(e)[0];return a?Array.isArray(a)?a:[a]:[]})(e,s)).filter(e=>e.length>0);if(0===p.length)return null;let u=p.length>1;(0,a.useEffect)(()=>
274{if(u&&!n){let e=setInterval(()=>{c(e=>(e+1)%p.length)},3500);return()=>clearInterval(e)}},[u,n,p.length]);let m=u&&!n?[p[d]??p[0]]:p;return(0,t.jsx)("div",{className:(0,ei.cn)("w-full rounded-lg border px-4 py-2 transition-colors",{default:"bg-muted/50 border-border",info:"bg-blue-50 dark:bg-blue-950/20 border-blue-200 dark:border-blue-900",warning:"bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-900"}[i],r),children:(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(i5.Info,{className:(0,ei.cn)("h-5 w-5 flex-shrink-0 mt-0.5",{default:"text-muted-foreground",info:"text-blue-600 dark:text-blue-400",warning:"text-amber-600 dark:text-amber-400"}[i])}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 relative",children:[(0,t.jsx)("div",{className:(0,ei.cn)("space-y-2",u&&"pr-16"),children:m.map((e,a)=>(0,t.jsx)(sT,{text:e,className:(0,ei.cn)(!n&&u&&"line-clamp-1")},a))}),u&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(e=>!e),className:(0,ei.cn)("absolute right-0 bottom-0","inline-flex items-center gap-0.5 text-xs font-medium transition-colors","text-muted-foreground/70 hover:text-muted-foreground","cursor-pointer select-none"),children:[(0,t.jsx)("span",{children:n?"Less":`+${p.length-1} more`}),(0,t.jsx)(su.ChevronDown,{className:(0,ei.cn)("h-3.5 w-3.5 transition-transform duration-200",n&&"rotate-180")})]})]})]})})}var sR=e.i(628226);let sU=(0,r.default)("mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),sP=(0,r.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var sD=e.i(709336),sD=sD,sz=e.i(991348);e.i(208539);let sF={"16:9":{w:1280,h:720,css:"16 / 9"},"9:16":{w:720,h:1280,css:"9 / 16"}};function sM({onFileReady:e,mode:r="audio",maxDurationSec:i=15}){let[o,s]=(0,a.useState)(!1),[n,l]=(0,a.useState)(0),[d,c]=(0,a.useState)(null),[u,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),f=(0,a.useRef)(null),y=(0,a.useRef)(null),[b,w]=(0,a.useState)([]),[x,_]=(0,a.useState)([]),[k,S]=(0,a.useState)(""),[j,C]=(0,a.useState)(""),[N,T]=(0,a.useState)("16:9"),E=(0,a.useRef)(null),R=(0,a.useRef)(null),U=(0,a.useRef)(null),P=(0,a.useRef)([]),D=(0,a.useRef)(void 0),[z,F]=(0,a.useState)(null),[M,O]=(0,a.useState)(null),[B,L]=(0,a.useState)(null),[q,$]=(0,a.useState)(null),V=(0,a.useMemo)(()=>Math.max(1,i),[i]),W=()=>{z&&URL.revokeObjectURL(z),F(null),O(null),L(null),$(null)},H=async()=>{try{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await navigator.mediaDevices.enumerateDevices(),t=e.filter(e=>"audioinput"===e.kind&&e.deviceId).map(e=>({deviceId:e.deviceId,label:e.label||"Microphone"})),a=e.filter(e=>"videoinput"===e.kind&&e.deviceId).map(e=>({deviceId:e.deviceId,label:e.label||"Camera"}));w(t),_(a),!k&&t[0]?.deviceId&&S(t[0].deviceId),!j&&a[0]?.deviceId&&C(a[0].deviceId)}catch(e){console.warn("enumerateDevices failed",e?.message??e),v.toast.error("Failed to enumerate devices")}};(0,a.useEffect)(()=>{H();let e=()=>H();return navigator.mediaDevices?.addEventListener?.("devicechange",e),()=>{navigator.mediaDevices?.removeEventListener?.("devicechange",e)}},[]);let G=()=>{y.current&&(window.clearInterval(y.current),y.current=null)},K=()=>{U.current?.state==="recording"&&U.current.stop()},J=()=>{G(),U.current=null,f.current=null,P.current=[],R.current&&(R.current.getTracks().forEach(e=>e.stop()),R.current=null),E.current&&(E.current.pause(),E.current.srcObject=null)},Y=async()=>{if(c(null),l(0),m(!1),W(),!navigator.mediaDevices?.getUserMedia){c("Current environment does not support recording"),v.toast.error("Current environment does not support recording");return}try{let e=("audio"===r||"video"===r)&&{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,...k?{deviceId:{exact:k}}:{}},{w:t,h:a}=sF[N],i="video"===r&&{width:{ideal:t,max:t},height:{ideal:a,max:a},aspectRatio:{ideal:t/a},frameRate:{ideal:30,max:30},...j?{deviceId:{exact:j}}:{}},o=await navigator.mediaDevices.getUserMedia({audio:e,video:i});if(R.current=o,"video"===r&&E.current){let e=E.current;
274e.srcObject=o,e.muted=!0,e.playsInline=!0,await e.play().catch(()=>void 0)}D.current=function(e){for(let t of"audio"===e?["audio/webm;codecs=opus","audio/webm","audio/mp4"]:["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"])if("MediaRecorder"in window&&MediaRecorder.isTypeSupported?.(t))return t}(r),P.current=[];let n=new MediaRecorder(o,D.current?{mimeType:D.current}:void 0);U.current=n,n.ondataavailable=e=>{e.data&&e.data.size>0&&P.current.push(e.data)},n.onstart=()=>{f.current=Date.now(),G(),y.current=window.setInterval(()=>{if(null==f.current)return;let e=Math.floor((Date.now()-f.current)/1e3);l(e),e>=V&&(m(!0),K())},250),s(!0)},n.onstop=()=>{G(),s(!1);let e=D.current||("audio"===r?"audio/webm":"video/webm"),t=new Date().toISOString().replace(/[:.]/g,"-"),a=e.includes("mp4")?"mp4":e.includes("webm")?"webm":"audio"===r?"wav":"mp4",i=new Blob(P.current,{type:e}),o=new File([i],`recording-${t}.${a}`,{type:e}),n=URL.createObjectURL(o);F(n),O(r),L(o),$(null),g(!0),(async()=>{try{let e=await (0,sz.getMediaDuration)(o);$(e)}catch{try{var e,t;let a=await (e=n,t=r,new Promise((a,r)=>{let i=document.createElement("audio"===t?"audio":"video");i.preload="metadata",i.src=e,i.onloadedmetadata=()=>{Number.isNaN(i.duration)?r(Error("duration unavailable")):a(i.duration),i.removeAttribute("src"),i.load()},i.onerror=()=>{r(Error("metadata load error")),i.removeAttribute("src"),i.load()}}));$(a)}catch{$(null)}}finally{g(!1)}})(),J()},n.start(250)}catch(e){J(),s(!1),c(e?.message||"Failed to start recording (permission or device problem)"),v.toast.error(e instanceof Error?e.message:"Failed to start recording (permission or device problem)")}};(0,a.useEffect)(()=>()=>{J(),W()},[]);let X=()=>{W(),g(!1),m(!1)},Q=async()=>{if(B)try{if(c(null),"audio"===M){let t=await (0,sz.convertAudioToMp3)(B);e(t)}else{let t=await (0,sz.convertVideoToMp4)(B);e(t)}}catch(e){console.error("Failed to convert recording",e),c(e instanceof Error?e.message:"Failed to convert recording."),v.toast.error(e instanceof Error?e.message:"Failed to convert recording.")}},ee=`${sO(n)} / ${sO(V)}`,et="video"===r?`${sF[N].w}\xd7${sF[N].h}`:"";return(0,t.jsxs)("div",{className:"w-full space-y-4 ",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.Label,{className:"text-sm text-muted-foreground",children:"Microphone"}),(0,t.jsxs)(I.Select,{value:k,onValueChange:S,disabled:!b.length||o,children:[(0,t.jsx)(I.SelectTrigger,{className:"min-w-40",children:(0,t.jsx)(I.SelectValue,{placeholder:"choose microphone"})}),(0,t.jsx)(I.SelectContent,{children:b.map(e=>(0,t.jsx)(I.SelectItem,{value:e.deviceId,className:"truncate text-ellipsis",children:e.label},e.deviceId))})]})]}),"video"===r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.Label,{className:"text-sm",children:"Camera"}),(0,t.jsxs)(I.Select,{value:j,onValueChange:C,disabled:!x.length||o,children:[(0,t.jsx)(I.SelectTrigger,{className:"min-w-40",children:(0,t.jsx)(I.SelectValue,{placeholder:"choose camera"})}),(0,t.jsx)(I.SelectContent,{children:x.map(e=>(0,t.jsx)(I.SelectItem,{value:e.deviceId,children:e.label},e.deviceId))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.Label,{className:"text-sm",children:"Aspect"}),(0,t.jsxs)(I.Select,{value:N,onValueChange:e=>T(e),disabled:o,children:[(0,t.jsx)(I.SelectTrigger,{className:"min-w-28",children:(0,t.jsx)(I.SelectValue,{placeholder:"ratio"})}),(0,t.jsxs)(I.SelectContent,{children:[(0,t.jsx)(I.SelectItem,{value:"16:9",children:"16:9"}),(0,t.jsx)(I.SelectItem,{value:"9:16",children:"9:16"})]})]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:et})]})]})]}),"video"===r&&(0,t.jsx)("div",{className:`rounded-xl border bg-muted/30 p-3 ${o?"":"hidden"}`,children:(0,t.jsx)("div",{className:"mx-auto w-full ",style:{maxHeight:420,maxWidth:Math.round(420*sF[N].w/sF[N].h),width:"100%"},children:(0,t.jsx)("div",{className:"w-full max-h-[420px] rounded-lg bg-black",style:{aspectRatio:sF[N].css},children:(0,t.jsx)("video",{ref:E,className:"h-full w-full object-contain",muted:!0,playsInl
274ine:!0,autoPlay:!0})})})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(p.Button,{variant:o?"destructive":"default",onClick:o?K:Y,disabled:h,size:"sm",className:"flex items-center gap-2",children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i6,{className:"size-4"}),"Stop recording"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sD.default,{className:"size-4 fill-primary text-primary-foreground"}),"Start recording"]})}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ee}),z&&(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon",onClick:X,"aria-label":"Clear recording",children:(0,t.jsx)(sP,{className:"size-4"})}),u&&(0,t.jsxs)(ae.Badge,{variant:"secondary",children:["Reached ",V," seconds limit"]})]}),d&&(0,t.jsx)("div",{className:"text-sm text-destructive",children:d}),z&&M&&B&&(0,t.jsxs)(Z.Card,{className:"border-muted",children:[(0,t.jsx)(Z.CardHeader,{className:"space-y-1",children:(0,t.jsx)(Z.CardTitle,{className:"text-base",children:"recording preview"})}),(0,t.jsxs)(Z.CardContent,{className:"space-y-3",children:["audio"===M?(0,t.jsx)("audio",{src:z,controls:!0,className:"w-full"}):(0,t.jsx)("video",{src:z,controls:!0,playsInline:!0,className:"w-full rounded-lg bg-black"}),(0,t.jsx)("div",{className:"grid gap-1 text-sm text-muted-foreground",children:(0,t.jsxs)("span",{children:["Size: ",function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB"][t]}`}(B.size)]})})]}),(0,t.jsxs)(Z.CardFooter,{className:"flex items-center justify-end gap-2",children:[(0,t.jsx)(p.Button,{type:"button",variant:"outline",onClick:X,children:"Re-record"}),(0,t.jsx)(p.Button,{type:"button",onClick:Q,disabled:!B,children:"Use this recording"})]})]})]})}function sO(e){let t=Math.max(0,Math.floor(e)),a=String(t%60).padStart(2,"0"),r=String(Math.floor(t/60%60)).padStart(2,"0"),i=Math.floor(t/3600);return i>0?`${i}:${r}:${a}`:`${r}:${a}`}let sB=(0,r.default)("headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);var sL=e.i(631043);function sq({open:e,onOpenChange:r,acceptType:i,onFileReady:o}){let[s,n]=(0,a.useState)([]),[l,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(null),[m,h]=(0,a.useState)(!1),[g,f]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[b,w]=(0,a.useState)("recent-generation"),[x,_]=(0,a.useState)("image"),k=(0,a.useCallback)(async()=>{let[e,t]=await Promise.all([iQ(),iY()]);n(e),d(t)},[]);(0,a.useEffect)(()=>{if(!e)return void f(!1);let t=!0;(async()=>{h(!0);try{await k()}finally{t&&(h(!1),f(!0))}})();let a=(0,sL.subscribeLocalStoreChanges)(()=>{k()});return()=>{t=!1,a()}},[k,e]);let S=(0,a.useMemo)(()=>(function(e){switch(e){case"image":return["image"];case"audio":return["audio"];case"video":return["video"];default:return["image","video","audio"]}})(i),[i]),j=e=>e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),C=(0,a.useMemo)(()=>[...s].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)).map(e=>({id:e.resourceKey,resourceKey:e.resourceKey,type:e.type,url:e.url,createdAt:e.createdAt,source:"history-generated",fileName:e.fileName,title:e.title})),[s]),I=(0,a.useMemo)(()=>[...l].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)).map(e=>({id:e.resourceKey,resourceKey:e.resourceKey,type:e.type,url:e.url,createdAt:e.createdAt,source:"history-user-use",fileName:e.fileName,title:e.fileName})),[l]),N=(0,a.useMemo)(()=>"recent-generation"===b?C:I,[b,C,I]),A=(0,a.useMemo)(()=>N.filter(e=>"image"===e.type),[N]),T=(0,a.useMemo)(()=>N.filter(e=>"video"===e.type),[N]),R=(0,a.useMemo)(()=>N.filter(e=>"audio"===e.type),[N]),U=S.includes("image")&&A.length>0,P=(S.includes("image")||S.includes("video"))&&T.length>0,D=S.includes("audio")&&R.length>0;(0,a.useEffect)(()=>{e&&(U?_("image"):P?_("video"):D&&_("audio"),u(null))},[b,e,D,U,P]);let z=(0,a.useMemo)(()=>{switch(x){case"image":return A;case"video":return T;case"audio":return R;default:return[]}},[x,R,A,T]),F=(0,a.useMemo)(()=>z.find(e=>e.id===c)||null,[z,c]),M=(0,a.useCallback)(async()=>
274{if(F){y(!0);try{let e=await ip.localResourceStore.getValue(F.resourceKey,{format:"file",fileName:F.fileName});e instanceof File&&(o(e,F.source),r(!1))}catch(e){console.error("Failed to convert asset to file:",e)}finally{y(!1)}}},[o,r,F]),O=(0,a.useCallback)(async()=>{if(F&&"history-user-use"===F.source){y(!0);try{await iZ(F.resourceKey),u(null)}finally{y(!1)}}},[F]),B=(0,a.useCallback)(async()=>{y(!0);try{await iX(),u(null)}finally{y(!1)}},[]),L=U||P||D,q="user-use"===b;return(0,t.jsx)(i7.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(i7.DialogContent,{className:"w-full max-w-2xl h-[80vh] md:h-[65vh] flex flex-col",children:[(0,t.jsxs)(i7.DialogHeader,{className:"shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-start gap-4 mb-2",children:[(0,t.jsx)(i7.DialogTitle,{children:"Pick from Assets"}),q?(0,t.jsxs)(oe.AlertDialog,{children:[(0,t.jsx)(oe.AlertDialogTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:0===I.length,children:(0,t.jsx)(i8.Trash2,{className:"h-4 w-4"})})}),(0,t.jsxs)(oe.AlertDialogContent,{children:[(0,t.jsxs)(oe.AlertDialogHeader,{children:[(0,t.jsx)(oe.AlertDialogTitle,{children:"Clear User Use History?"}),(0,t.jsx)(oe.AlertDialogDescription,{children:"This will remove all stored user-use files from your browser history."})]}),(0,t.jsxs)(oe.AlertDialogFooter,{children:[(0,t.jsx)(oe.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(oe.AlertDialogAction,{onClick:B,children:"Continue"})]})]})]}):null]}),(0,t.jsx)(i7.DialogDescription,{children:"Select an asset from recent generations or stored user-use files to use as input."})]}),(0,t.jsx)(aa.Tabs,{value:b,onValueChange:e=>w(e),className:"w-full mb-4 shrink-0",children:(0,t.jsxs)(aa.TabsList,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(aa.TabsTrigger,{value:"recent-generation",children:j("recent-generation")}),(0,t.jsx)(aa.TabsTrigger,{value:"user-use",children:j("user-use")})]})}),m||!g?(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 text-muted-foreground",role:"status","aria-live":"polite",children:[(0,t.jsx)(E.Loader2,{className:"h-7 w-7 animate-spin text-primary"}),(0,t.jsx)("span",{className:"text-sm",children:"Loading assets..."})]}):L?(0,t.jsxs)(aa.Tabs,{value:x,onValueChange:_,className:"w-full flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)(aa.TabsList,{className:"flex flex-wrap gap-2 shrink-0",children:[U?(0,t.jsxs)(aa.TabsTrigger,{value:"image",className:"flex items-center gap-2",children:[(0,t.jsx)(of,{className:"w-4 h-4"}),"Images (",A.length,")"]}):null,P?(0,t.jsxs)(aa.TabsTrigger,{value:"video",className:"flex items-center gap-2",children:[(0,t.jsx)(er,{className:"w-4 h-4"}),"Videos (",T.length,")"]}):null,D?(0,t.jsxs)(aa.TabsTrigger,{value:"audio",className:"flex items-center gap-2",children:[(0,t.jsx)(sB,{className:"w-4 h-4"}),"Audios (",R.length,")"]}):null]}),(0,t.jsx)(aa.TabsContent,{value:x,className:"mt-4 flex-1 overflow-y-auto min-h-0",children:(0,t.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-2 p-1",children:z.map(e=>(0,t.jsxs)("div",{onClick:()=>u(e.id),className:(0,ei.cn)("relative aspect-square rounded-lg overflow-hidden cursor-pointer border-2 transition-all hover:border-primary/50",c===e.id?"border-primary ring-2 ring-primary/30":"border-transparent"),children:["image"===e.type?(0,t.jsx)("img",{src:e.url,alt:"Asset",className:"w-full h-full object-cover"}):null,"video"===e.type?(0,t.jsx)("video",{src:e.url,className:"w-full h-full object-cover",muted:!0,playsInline:!0}):null,"audio"===e.type?(0,t.jsxs)("div",{className:"w-full h-full flex items-center justify-center bg-muted relative",children:[(0,t.jsx)(sB,{className:"w-8 h-8 text-muted-foreground"}),(0,t.jsx)("span",{className:"absolute bottom-1 left-1 text-xs text-muted-foreground truncate max-w-[160px]",children:e.title||e.fileName||"Audio"})]}):null,c===e.id?(0,t.jsx)("div",{className:"absolute top-1 right-1",children:(0,t.jsx)(om,{className:"w-5 h-5 text-primary fill-background"})}):null]},e.id))})})]}):(0,t.jsxs)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:["No ","recent-generation"===b?"recent generations":"user-use files"," available for this type."]}),(0,t.jsxs)(i7.DialogFooter,{className:"shrink-0 mt-4 gap-2",children:[q&&F?.source==="history-user-use"?(0,t.jsx)(p.Button,{variant:"destructive",onClick:O,disabled:v,children:"Delete Selected"}):null,(0,t.jsx)(p.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,t.jsxs)(p.Button,{onClick:M,disabled:!F||v,children:[v?(0,t.jsx)(E.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Use Selected"]})]})]})})}let s$=[".png",".jpg",".jpeg",".gif",".webp",".bmp",".tif",".tiff",".svg"],sV=[".mp3",".wav",".ogg",".m4a",".aac",".flac",".opus"],sW=[".mp4",".mov",".webm",".mkv"];function sH(e){let[t,r]=(0,a.useState)(null);return(0,a.useEffect)(()=>
274{if(!e)return void r(null);let t=URL.createObjectURL(e);return r(t),()=>{URL.revokeObjectURL(t)}},[e]),t}let sG=(0,a.memo)(function({framePreviewUrl:e}){return(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-4 items-center justify-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Preview"}),e?(0,t.jsx)("div",{className:"flex-1 w-full rounded-lg border",children:(0,t.jsx)("img",{src:e,alt:"Selected frame preview",className:"h-full w-full object-contain"})}):(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center rounded-lg border border-dashed border-gray-300 dark:border-gray-600",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"No frame captured yet"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Use the slider to scrub through the video and capture a frame"})]})})]})});function sK(e,t){return t.some(t=>e.includes(t))}function sJ(e){return e.type.startsWith("image/")||s$.some(t=>e.name.toLowerCase().endsWith(t))}function sY(e){return e.type.startsWith("audio/")||sV.some(t=>e.name.toLowerCase().endsWith(t))}function sZ(e){return e.type.startsWith("video/")||sW.some(t=>e.name.toLowerCase().endsWith(t))}function sX(e){return"video/mp4"===e.type||e.name.toLowerCase().endsWith(".mp4")}function sQ(e){if("u"<typeof DataTransfer)return e;let t=new DataTransfer;return e.forEach(e=>t.items.add(e)),t.files}async function s0(e){return new File([await e.arrayBuffer()],e.name,{type:e.type,lastModified:e.lastModified})}function s1(e){if(!Number.isFinite(e)||e<0)return"00:00";let t=Math.floor(e),a=Math.floor(t/60);return`${String(a).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}let s2=(0,a.memo)(function({onFileSelect:e,accept:r="any",className:i,disabled:o=!1,componentDescription:s={title:"Upload your file",description:"Drag and drop or click to select",buttonText:"Select"},maxRecordingDurationSec:n=60}){let l=(0,a.useRef)(null),d=(0,a.useRef)(null),[c,u]=(0,a.useState)(!1),[m,h]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[b,w]=(0,a.useState)(null),[x,_]=(0,a.useState)("upload"),[k,S]=(0,a.useState)(0),[j,C]=(0,a.useState)(0),[I,N]=(0,a.useState)(null),[A,T]=(0,a.useState)(!1),[R,U]=(0,a.useState)(null),P=sH(b),D=sH(I?.file),z=(0,a.useMemo)(()=>(function(e){if(!e||"any"===e)return"any";if("media_file"===e)return"media_file";let t=e.toLowerCase(),a=sK(t,["image",...s$]),r=sK(t,["audio",...sV]),i=sK(t,["video",...sW]);return a&&r&&i?"media_file":!r||a||i?!i||r||a?a&&!r?"image":"any":"video":"audio"})(r),[r]),F=(0,a.useMemo)(()=>"any"===r?"image"===z?"image/*,video/mp4":"audio"===z?"audio/*":"video"===z?"video/*":"":"image"===z?Array.from(new Set([...r.split(",").map(e=>e.trim()).filter(Boolean),"video/mp4"])).join(","):r,[r,z]),M="audio"===z||"any"===z||"media_file"===z,O="video"===z||"any"===z||"image"===z||"media_file"===z,B=(0,a.useCallback)(()=>{N(null),w(null),_("upload"),C(0),S(0),U(null),T(!1)},[]),L=(0,a.useCallback)(()=>{l.current&&(l.current.value="")},[]),q=(0,a.useCallback)((e,t)=>{w(e),_(t),y(!0)},[]),$=(0,a.useCallback)(e=>{o||(e.preventDefault(),u(!0))},[o]),V=(0,a.useCallback)(e=>{o||(e.preventDefault(),u(!1))},[o]),W=(0,a.useCallback)(()=>{o||l.current?.click()},[o]),H=(0,a.useCallback)((t,a="upload")=>{if(t.length){if("image"===z){let r=t.filter(sJ);if(r.length>0)return void e(sQ(r),a);let i=t.filter(sX);return void(i.length>0&&q(i[0],a))}if("audio"===z){let r=t.find(sY);r&&e(sQ([r]),a);return}if("video"===z){let r=t.find(sZ);r&&e(sQ([r]),a);return}if("media_file"===z){let r=t.filter(e=>sJ(e)||sY(e)||sZ(e));r.length>0&&e(sQ(r),a);return}e(sQ(t),a)}},[z,e,q]),G=(0,a.useCallback)(e=>{if(o)return;e.preventDefault(),u(!1);let t=Array.from(e.dataTransfer.files||[]);t.length&&H(t,"upload")},[o,H]),K=(0,a.useCallback)(e=>{let t=Array.from(e.target.files||[]);t.length&&H(t,"upload"),L()},[H,L]),J=(0,a.useCallback)((e,t)=>{H([e],t)},[H]),Y=(0,a.useCallback)((e,t)=>{o||h({mode:e,purpose:t})},[o]),Z=(0,a.useCallback)(()=>{h(null)},[]),X=(0,a.useCallback)(t=>{if(!m)return;let{purpose:a}=m;if("audio"===a||"video-file"===a){e(sQ([t]),"upload"),Z();return}"video-frame"===a&&(Z(),q(t,"upload"))},[Z,e,q,m]),Q=(0,a.useCallback)(async()=>
274{if(b){T(!0),U(null);try{let e=await s0(b),t=await (0,sz.extractVideoFrameToPng)({file:e,time:j});N({file:t})}catch(e){U(e instanceof Error?e.message:"Failed to capture frame.")}finally{T(!1)}}},[j,b]),ee=(0,a.useCallback)(e=>{y(e),e||B()},[B]),et=!b||A;s?.title;let ea=s?.description||"Drag and drop or click to select",eo=s?.buttonText||"Select file";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{onDragOver:$,onDragLeave:V,onDrop:G,className:(0,ei.cn)("group relative flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-muted-foreground/30 bg-muted/20 px-6 py-2 text-center transition-colors h-full",c?"border-primary bg-primary/5":"hover:border-muted-foreground/50",o&&"pointer-events-none opacity-50",i),children:[(0,t.jsx)("input",{ref:l,type:"file",multiple:"image"===z||"any"===z,accept:F,onChange:K,className:"hidden"}),(0,t.jsx)("div",{children:(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ea})}),(0,t.jsxs)(p.Button,{onClick:W,type:"button",disabled:o,children:[(0,t.jsx)(sR.Upload,{className:"h-4 w-4"}),eo]}),(0,t.jsx)("span",{children:"or"}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-1",children:[M?(0,t.jsx)(p.Button,{type:"button",variant:"ghost",onClick:()=>Y("audio","audio"),disabled:o,"aria-label":"Record audio",children:(0,t.jsx)(sU,{className:"h-8 w-8"})}):null,O?(0,t.jsx)(p.Button,{type:"button",variant:"ghost",onClick:()=>Y("video","image"===z?"video-frame":"video-file"),disabled:o,"aria-label":"Record video",children:(0,t.jsx)(er,{className:"h-8 w-8"})}):null,(0,t.jsxs)(p.Button,{type:"button",variant:"ghost",onClick:()=>f(!0),disabled:o,"aria-label":"Pick from recent generations",children:[(0,t.jsx)("span",{className:"text-xs",children:"Recent"}),(0,t.jsx)(og,{className:"h-8 w-8"})]})]})]}),(0,t.jsx)(sq,{open:g,onOpenChange:f,acceptType:z,onFileReady:J}),(0,t.jsx)(i7.Dialog,{open:!!m,onOpenChange:e=>!e&&Z(),children:(0,t.jsxs)(i7.DialogContent,{className:"w-full max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,t.jsxs)(i7.DialogHeader,{children:[(0,t.jsx)(i7.DialogTitle,{children:m?.mode==="audio"?"Record audio":"Record video"}),(0,t.jsx)(i7.DialogDescription,{children:m?.mode==="audio"?"Capture a new audio clip or choose an existing file.":"image"===z?"Record a short video to capture a thumbnail frame.":"Record a new video to upload."})]}),m?(0,t.jsx)(sM,{mode:m.mode,maxDurationSec:n,onFileReady:X}):null,(0,t.jsx)(i7.DialogFooter,{className:"justify-end",children:(0,t.jsx)(p.Button,{variant:"outline",onClick:Z,children:"Cancel"})})]})}),(0,t.jsx)(i7.Dialog,{open:v,onOpenChange:ee,children:(0,t.jsxs)(i7.DialogContent,{className:"w-[calc(100vw-2rem)] sm:w-full max-w-[100vw] sm:max-w-2xl md:max-w-4xl lg:max-w-5xl sm:h-auto max-h-[80vh] md:max-h-[90vh] overflow-y-auto p-4 sm:p-6 rounded-xl flex flex-col gap-2",children:[(0,t.jsxs)(i7.DialogHeader,{className:"pb-4",children:[(0,t.jsx)(i7.DialogTitle,{className:"text-lg sm:text-xl",children:"Select a frame"}),(0,t.jsx)(i7.DialogDescription,{className:"text-sm",children:"Scrub through the video and capture the exact frame you want to use."})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:gap-6 gap-4",children:[(0,t.jsx)("div",{className:"flex flex-col gap-4 min-h-0",children:(0,t.jsx)("div",{className:"flex-1 flex flex-col gap-4 justify-end",children:(0,t.jsx)("div",{className:"w-full rounded-lg bg-black flex-shrink-0 sm:max-h-none overflow-y-auto",children:P?(0,t.jsx)("video",{ref:d,src:P,controls:!0,playsInline:!0,onLoadedMetadata:()=>{d.current&&(S(Number.isFinite(d.current.duration)?d.current.duration:0),C(0),d.current.currentTime=0)},onTimeUpdate:()=>{d.current&&C(Number.isFinite(d.current.currentTime)?d.current.currentTime:0)},className:"h-full w-full object-contain"}):(0,t.jsx)("div",{className:"flex h-full w-full items-center justify-center border border-dashed border-gray-600",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Video preview unavailable."})})})})}),(0,t.jsx)("div",{className:"flex flex-col gap-4",children:(0,t.jsx)(sG,{framePreviewUrl:D})})]}),(0,t.jsxs)("div",{className:"flex-shrink-0 space-y-1",children:[(0,t.jsx)(t7.Slider,{value:[Math.min(j,k||0)],min:0,max:k||0,step:.033,onValueChange:e=>{let[t]=e;C(t),d.current&&Number.isFinite(t)&&(d.current.currentTime=t)},disabled:!k,className:"[&_[role=slider]]:h-6 [&_[role=slider]]:w-6 touch-pan-x"}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,t.jsxs)("span",{children:["Current: ",s1(j)]}),(0,t.jsxs)("span",{children:["Duration: ",s1(k)]})]})]}),(0,t.jsx)("div",{className:"sm:flex items-center gap-3",children:(0,t.jsxs)(p.Button,{type:"button",onClick:Q,disabled:et,className:"w-full",children:[A?(0,t.jsx)(E.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Capture frame"]})}),(0,t.jsxs)(i7.DialogFooter,{className:"flex-shrink-0 pt-4 border-t",children:[(0,t.jsxs)("div",{className:"flex w-full gap-3",children:[(0,t.jsx)(p.Button,{variant:"outline",onClick:()=>{y(!1),B()},className:"flex-1 sm:flex-none sm:min-w-[100px]",children:"Cancel"}),(0,t.jsx)(p.Button,{onClick:()=>{I?.file&&(e(sQ([I.file]),x),y(!1),B())},disabled:!I?.file,className:"flex-1 sm:flex-none sm:min-w-[120px]",children:"Use this frame"})]}),R?(0,t.jsx)("div",{className:"w-full mt-2",children:(0,t.jsx)("p",{className:"text-center text-sm text-destructive",children:R})}):null]})]})})]})});s2.displayName="AdvanceFileDropzoneCombineAssetV2";var s3=e.i(589449),s4=e.i(263367);let s5={images:t8,videos:t9,audios:{audio:eO,music:eB}},s6=[{key:"images",label:"Image",icon:Q},{key:"videos",label:"Video",icon:er},{key:"audios",label:"Audio",icon:et.Music}],s8={byteplus:"byteplus",fal:"fal",wavespeed:"wavespeed"},s9=e=>{let t=e.provider?s8[e.provider.toLowerCase().trim()]:void 0,a="videoprompt.online".replace(/\/$/,"");
274if("video"!==e.type||!t||!a||!e.userId||!e.credits||e.credits<=0)return;let r=encodeURIComponent(e.userId),i=encodeURIComponent(String(e.credits));return((e,t)=>{let a=e?.trim();if(a)try{let e=new URL(a);return Object.entries(t).forEach(([t,a])=>{null!=a&&""!==a&&e.searchParams.set(t,String(a))}),e.toString()}catch{let e=new URLSearchParams;Object.entries(t).forEach(([t,a])=>{null!=a&&""!==a&&e.set(t,String(a))});let r=e.toString();if(!r)return a;let i=a.includes("?")?"&":"?";return`${a}${i}${r}`}})(`https://${a}/api/ai/${t}/webhookVideo/${r}/${i}`,{transaction_id:e.consumeTransactionId})},s7=(e,t="Generation failed.")=>e instanceof Error?e.message:t,ne=e=>"string"==typeof e?e.slice(0,100):"",nt=e=>Object.values(e).flat(),na=(e,t)=>{if(t)return Object.keys(e).find(a=>e[a]?.some(e=>e.id===t))},nr=(e,t)=>{if(!t||!(t in e))return e;let a={[t]:e[t]};return Object.keys(e).forEach(r=>{r!==t&&(a[r]=e[r])}),a},ni=(e,t)=>{if(null==t)return e;if("number"==typeof t){let a=Number(e);return Number.isFinite(a)?a:t}return"string"==typeof t?String(e):e},no=(e,t)=>{if(!e)return 0;let a=Number(e.useCredits??5),r=e=>Math.round((e+Number.EPSILON)*100)/100,i=new Map((e.customParameters??[]).map(e=>[e.name,e])),o=e=>{let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0},s=(e,t)=>{let a=i.get(e);if(!a)return -1;if("switch"===a.type)return+!!ai(t,a.defaultValue??!1);if(!a.options?.length)return -1;let r=a.options.findIndex(e=>e.value===t);if(r>=0)return r;let o=String(t);return a.options.findIndex(e=>String(e.value)===o)},n=(e,t)=>{if(e&&!(t<0))return o(e.options?.[t]?.multiple)},l=(e,t)=>
274{let a=o(e?.multiple);return a?1+(a-1)*t:void 0},d=e=>t?.[e]??t?.meta_data?.[e],c=d("resolution")??t?.resolution,p=d("duration")??t?.duration,u=d("num_outputs")??t?.num_outputs,m=i.get("resolution"),h=s("resolution",c),g=h>=0?n(m,h)??l(m,h)??h+1:1,f=i.has("num_outputs")?Number(u??1):1,v=Number.isFinite(f)&&f>0?f:1,y=1;for(let[e,t]of i){if(["resolution","duration","num_outputs"].includes(e))continue;let a=d(e);if(null==a)continue;let r=s(e,a);r>=0&&(y*=n(t,r)??l(t,r)??1)}if(e.options?.creditBySecond){let e=Number(p??0);return r(a*Math.max(Number.isFinite(e)&&e>0?e:0,5)*g*v*y)}if(e.options?.creditByCharacter)return r(Math.max(a*String(t?.prompt??"").length*y*.001,.01));let b=s("duration",p),w=i.get("duration");return r(a*g*(b>=0?n(w,b)??b+1:1)*v*y)},ns=e=>{if(e?.supportAddFiles?.length)return e.supportAddFiles;let t=[];return"number"==typeof e?.isSupportImageRef&&t.push({name:"control_images",label:"Control Images",type:"image",isRequired:e?.isRequiredImageRef||!1,isSupport:e?.isSupportImageRef||0}),"number"==typeof e?.isSupportEndImageRef&&t.push({name:"control_images_2",label:"End Control Images",type:"image",isRequired:!1,isSupport:e?.isSupportEndImageRef||0}),t},nn=e=>{let{model:t,values:a}=e,r={...a,model_id:t.id,model_config:t,generation_type:t.type,type:t.type,meta_data:{..."object"==typeof a.meta_data&&a.meta_data?a.meta_data:{}}};for(let e of t.customParameters||[]){let t=a[e.name]??r.meta_data?.[e.name];r[e.name]=t,r.meta_data[e.name]=t}for(let e of ns(t))r[e.name]=Array.isArray(a[e.name])?a[e.name]:[];return r},nl=e=>{let t={...e,meta_data:{...e.meta_data||{}}},a=e.prompt||"",r=(e.meta_data?.preset||[]).map(e=>e.value).filter(e=>e&&""!==String(e).trim()).map(e=>String(e));if(r.length>0){let e=r.join("\n");t.prompt_process=a?`${e} 275${a}`:e}return t};(0,a.forwardRef)(({initialFormValues:e,hideFormFields:r,customOptions:i,onGenerateSuccess:o,tabModelSeriesSetting:s=s5},n)=>{var l;let d,c,{t:u}=(0,oA.useTranslation)(),m=u("app/generator:ai-generator-app",{returnObjects:!0})||nd,{setShowPriceModal:g,setShowLoginModal:f}=(0,h.useUserContext)(),b=(0,eo.useIsTablet)(),{userProfile:w,organizationProfile:x,consumeCredits:_,restoreCredits:k}=(0,es.useUserResourceStore)(),S=(0,y.getUserProfilePlanCode)(w),j=iE(e=>e.runtimeTasks),A=iE(e=>e.records),R=(0,a.useRef)(new Map),U=(0,a.useRef)(new Set),P=(0,a.useRef)(!1),z=(0,a.useRef)(!1),F=(0,a.useRef)(void 0),M=(0,a.useRef)(e?.model_id),O=(0,a.useMemo)(()=>{let e={images:s.images||{},videos:s.videos||{},audios:s.audios||{}},t=M.current;if(!t)return{initialTab:"images",seriesByTab:e};let a=na(e.images,t);if(a)return{initialTab:"images",seriesByTab:{...e,images:nr(e.images,a)}};let r=na(e.videos,t);if(r)return{initialTab:"videos",seriesByTab:{...e,videos:nr(e.videos,r)}};let i=na(e.audios,t);return i?{initialTab:"audios",seriesByTab:{...e,audios:nr(e.audios,i)}}:{initialTab:"images",seriesByTab:e}},[s]),[B,L]=(0,a.useState)(O.initialTab),[q,$]=(0,a.useState)(!1),[V,G]=(0,a.useState)("none"),[K,J]=(0,a.useState)(!1),[Y,Z]=(0,a.useState)(""),[Q,et]=(0,a.useState)(""),[er,en]=(0,a.useState)([]),[el,ep]=(0,a.useState)(null),[eu,em]=(0,a.useState)(!1),[eh,eg]=(0,a.useState)([]),ef=(0,a.useRef)(null),ev=(0,C.useForm)({defaultValues:{model_id:e?.model_id||"",duration:5,aspect_ratio:e?.aspect_ratio||"1:1",width:e?.width||1024,height:e?.height||1024,prompt:e?.prompt||"",prompt_process:"",num_outputs:1,output_format:e?.output_format||"png",control_images:[],control_images_2:[],control_files:[],control_files_2:[],seed:0,randomize_seed:!0,enable_safety_checker:!1,meta_data:{},resolution:e?.resolution||"480p",use_credits:e?.use_credits??1,generation_type:"image",type:"image",model_config:null,...e||{}}}),{clearErrors:ey,getValues:eb,reset:ew,setValue:ex}=ev,e_=(0,C.useWatch)({control:ev.control,name:"model_id"})||"",ek=(0,a.useMemo)(()=>{let e,t;return e=[...nt(s?.images||{}),...nt(s?.videos||{}),...nt(s?.audios||{})],t=new Set,e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))},[s]),eS=(0,a.useMemo)(()=>new Map(ek.map(e=>[e.id,e])),[ek]),ej=e_?eS.get(e_)??ek[0]:ek[0],eC=(0,a.useMemo)(()=>ns(ej),[ej]),eI=(0,a.useMemo)(()=>Array.from(new Set(["prompt","duration","aspect_ratio","resolution","num_outputs","meta_data",...eC.map(e=>e.name),...(ej?.customParameters??[]).map(e=>e.name)])),[ej,eC]),eN=(0,C.useWatch)({control:ev.control,name:eI}),eA=(0,a.useMemo)(()=>{let e={model_id:ej?.id||e_};return eI.forEach((t,a)=>{var r;let i,o;
275r=eN?.[a],i=t.split("."),o=e,i.forEach((e,t)=>{if(t===i.length-1){o[e]=r;return}let a=o[e];(!a||"object"!=typeof a||Array.isArray(a))&&(o[e]={}),o=o[e]})}),e},[e_,ej?.id,eI,eN]),eT=eA?.meta_data?.maxDuration,eE=(0,a.useMemo)(()=>(0,y.isUserProfileActivePaid)(w),[w]),eR=(0,a.useMemo)(()=>(0,y.getUserProfileResourceTotal)(w,"credit",x)>0,[x,w]),eU=(0,a.useMemo)(()=>tJ(ej?.id||""),[ej?.id]),eP=(0,a.useMemo)(()=>{let e=ej?.id||"";return!w&&tY(e)&&tJ(e)},[ej?.id,w]),eD=(0,a.useMemo)(()=>eE||eR||!eU,[eU,eR,eE]),ez=O.seriesByTab[B]||{},eF=(0,a.useMemo)(()=>eC.filter(e=>"image"===e.type).flatMap(e=>{let t=eA?.[e.name];return Array.isArray(t)?t:[]}),[eC,eA]),eM=(0,a.useMemo)(()=>{if(!ej)return null;let e=ej.options?.examples??[];return{...ej.options,examples:e,...i||{}}},[i,ej]),eO=(0,a.useMemo)(()=>ej?.options?.note??i?.note,[i,ej]),eB=j.filter(e=>["starting","running","polling"].includes(e.status)).length,eL=id[S?.toLowerCase().trim()||"default"]||id.default,eq=(0,a.useMemo)(()=>no(ej,eA||{}),[ej,eA]),e$=eh.some(e=>e.items.length>0),eV=!b&&!r?.recentGeneration&&(e$||A.some(e=>(e.mediaAssetIds?.length||0)>0)),eW=(l=ev.formState.errors,d=[],(c=e=>{if(e){if("object"==typeof e&&"message"in e){let t=e.message;"string"==typeof t&&t.trim()&&d.push(t)}"object"==typeof e&&Object.values(e).forEach(c)}})(l),Array.from(new Set(d))),eH=(0,a.useCallback)(e=>{let t=e||"Generation failed.",a=(0,rI.filterSensitiveInfo)(t),r=t.toLowerCase();return r.includes("exceeded")||r.includes("no credits")?(en(m?.creditsMode?.toast?.creditsNotEnough||nd?.creditsMode?.toast?.creditsNotEnough||[]),Z("")):(en([]),Z(a)),a},[m]);(0,a.useEffect)(()=>{iM()},[]),(0,a.useEffect)(()=>()=>{ef.current&&clearTimeout(ef.current)},[]);let eG=(0,a.useCallback)(async e=>{let t=eS.get(e.modelId);if(!t)return{done:!0,error:{code:"model_not_found",message:`Model ${e.modelId} is no longer available for resume.`}};let a=rl(t),r="string"==typeof e.resumeContext?.apiMode?e.resumeContext.apiMode:"default",i=a.apiInputs[r]||a.apiInputs.default;if(!i)return{done:!0,error:{code:"api_config_missing",message:`Model ${e.modelId} has no apiInputs for resume mode ${r}.`}};let o="string"==typeof e.resumeContext?.endpoint?e.resumeContext.endpoint:i.endpoint;if(!o)return{done:!0,error:{code:"endpoint_missing",message:`Model ${e.modelId} has no endpoint for resume polling.`}};let s={model:a,modelId:a.id,provider:String(e.provider||i.provider),generationKind:a.type,apiMode:r,apiConfig:i,endpoint:o,inputData:{},options:{}},n=ra.get(String(s.provider)).getOperation(s);if(!n.pollTask)return{done:!0,error:{code:"polling_not_supported",message:`Provider ${s.provider} does not support polling.`}};let l=await n.pollTask(s,e.providerTaskId);return"succeeded"===l.status?{done:!0,result:await n.normalizeResult(l.raw,s,{taskId:e.providerTaskId})}:"failed"===l.status||"error"===l.status?{done:!0,error:{code:`${s.provider}_${l.status}`,message:l.error||"Generation failed during resume.",raw:l.raw}}:{done:!1,status:"polling",metadata:"network_error"===l.status?{lastPollError:l.error}:void 0}},[eS]);(0,a.useEffect)(()=>{P.current||(P.current=!0,iV(eG).catch(e=>{console.error("resumePendingGenerationTasks failed",e)}))},[eG]),(0,a.useCallback)(()=>{iM()},[]);let eK=(0,a.useCallback)(e=>{let t=ec.aspectRatioDimensions_1440[e];ex("aspect_ratio",e,{shouldDirty:!0}),t&&(ex("width",t.width,{shouldDirty:!0}),ex("height",t.height,{shouldDirty:!0}))},[ex]);(0,a.useEffect)(()=>{ej&&(F.current!==ej.id||e_!==ej.id)&&(F.current=ej.id,ew((e=>{let{currentValues:t,model:a}=e,r=t?.meta_data??{},i=new Map((a.customParameters??[]).map(e=>[e.name,e])),o=(e,t,a)=>{let r=i.get(t);return r?r.options?.length&&r.options.some(t=>t.value===e)?e:ni(r.defaultValue,e):void 0!==a?ni(a,e):e},s={...t,control_files:[],control_files_2:[]},n=a.type??"image",l=o(s.duration,"duration",a.options?.creditBySecond?void 0:"5"),d=o(s.resolution,"resolution","480p"),c=o(s.num_outputs,"num_outputs",1),p=new Set(["duration","resolution","num_outputs"]),u={},m={};i.forEach((e,t)=>{if(p.has(t))return;let a=void 0!==e.defaultValue?e.defaultValue:"switch"!==e.type&&"";u[t]=a,m[t]=ni(a,s[t])});let h=a.supportedAspectRatios?.[0],g=h?ec.aspectRatioDimensions_1440[h]:void 0;a.options?.setPrompt&&(s.prompt=a.options.setPrompt);let f=a.options?.setForm??{},v={...s,model_id:a.id,generation_type:n,type:n,duration:l,resolution:d,num_outputs:c,...h?{aspect_ratio:h}:{},...g??{},...m,model_config:a,meta_data:{...r,...u},...f};return{...v,use_credits:no(a,v)}})({currentValues:eb(),model:ej}),{keepDirty:!1,keepTouched:!0}))},[e_,eb,ew,ej]);let eJ=(0,a.useCallback)(e=>{ex("model_id",e.id,{shouldDirty:!0}),ey()},[ey,ex]),eY=(0,a.useCallback)(async e=>{if(e instanceof File)return`file:${await (0,rI.computeFileHash)(e)}`;if(e instanceof Blob){let t=new File([await e.arrayBuffer()],"blob",{type:e.type});return`blob:${await (0,rI.computeFileHash)(t)}`}return"string"==typeof e?`string:${e}`:null},[]),eZ=(0,a.useCallback)(async e=>{let t=[],a=new Set;for(let r of e){let e=await eY(r);if(!e){t.push(r);continue}a.has(e)||(a.add(e),t.push(r))}return t},[eY]),eX=(0,a.useCallback)(async e=>{for(let t of(await eZ(e.filter(e=>((e,t)=>{if(e instanceof File)return!0;
275if("string"==typeof e){let a=e.trim();return!(!a||/^https?:\/\//i.test(a))&&(!t||!e.includes(t))}return!1})(e,"videoprompt.online"))))){let e=await eY(t);e&&U.current.has(e)||(e&&U.current.add(e),iJ(t).catch(e=>{console.warn("Failed to save upload to local store:",e)}))}},[eY,eZ]),eQ=(0,a.useCallback)(()=>{em(!1),ep(null)},[]),e0=(0,a.useCallback)(async e=>{if(!el?.support)throw Error("No pending media to trim");let{support:t,maxFileSize:a}=el,r=ev.getValues(t.name)||[];if(e.size>a)throw Error("File size exceeds "+a/1024/1024+"MB limit, try another file");let i=await (0,sz.getMediaDuration)(e).catch(()=>void 0);ev.setValue(t.name,[e,...r].slice(0,t.isSupport||0)),ev.trigger(t.name),eX([e]),i&&ej?.options?.creditsByControl===t.name&&(ev.setValue("duration",i),ev.setValue("meta_data.duration",i)),v.toast.success("Trimmed media added"),em(!1),ep(null)},[ev,eX,ej,el]),e1=(0,a.useCallback)(async(e,t,a="upload")=>{let r=Array.from(e||[]);if(!r.length)return;let i=Array.isArray(ev.getValues(t.name))?ev.getValues(t.name):[],o=Math.max(0,t.isSupport||0),s=await eZ([...i,...r]);o>0&&s.length>o&&(s=s.slice(0,o),v.toast.info(`Added up to ${o} item(s) for ${t.label}.`)),ev.setValue(t.name,s,{shouldDirty:!0,shouldTouch:!0}),ev.trigger(t.name),eX(r)},[eZ,ev,eX]),e2=(0,a.useCallback)(async(e,t)=>{let a=1048576*(t?.options?.maxFileSize||80),r=eE?t?.options?.settingDuration||t?.options?.maxDuration||eT||10:t?.options?.settingDuration||t?.options?.maxDurationFree||5,i=Array.from(e||[])[0];if(!i)return;let o=i.name.toLowerCase();try{let e=i,s=!1,n=!1;if("audio"===t.type)if(o.endsWith(".mp3"))e=i;else if(o.endsWith(".wav")||o.endsWith(".m4a")||o.endsWith(".aac")||o.endsWith(".ogg")||o.endsWith(".webm"))n=!0;else if(o.endsWith(".mp4")||o.endsWith(".mov")||o.endsWith(".avi"))s=!0;else throw Error("Only mp3, wav, m4a, aac, or mp4, mov, avi video files are allowed for audio input");else if("video"===t.type){if(!(o.endsWith(".mp4")||o.endsWith(".mov")||o.endsWith(".avi")))throw Error("Only mp4, mov, avi video files are allowed");e=i}let l=ev.getValues(t.name)||[];if(n&&(et("Converting audio to MP3..."),e=await (0,sz.convertAudioToMp3)({file:i,audioSetter:void 0,setMessage:et}),v.toast.success("Audio converted to MP3 successfully")),s)try{et("Extracting audio from video..."),e=await (0,sz.extractAudioFromVideo)({file:i,audioSetter:void 0,setMessage:et}),v.toast.success("Audio extracted successfully")}catch{throw Error("Failed to extract audio from video, Please ensure your video has audio track")}let d=await (0,sz.getMediaDuration)(e);if(d<4)return void v.toast.warning(`Media duration is too short (${d.toFixed(2)}s). Please upload a file of at least 4 seconds.`);if(d>5){ep({file:e,support:t,maxDuration:r,maxFileSize:a}),em(!0),v.toast.info(`Media is ${d.toFixed(2)}s (> ${r}s). Please trim before uploading.`);return}if(e.size>a)throw Error("File size exceeds "+a/1024/1024+"MB limit, try another file");ev.setValue(t.name,[e,...l].slice(0,t.isSupport||0)),ev.trigger(t.name),eX([e]),ej?.options?.creditsByControl===t.name&&(ev.setValue("duration",d),ev.setValue("meta_data.duration",d)),v.toast.success("Media file added")}catch(e){console.error("Error processing media file:",e),v.toast.warning(e?.message||"Failed to process media file")}finally{et("")}},[ev,eT,eX,ej,eE]),e3=(0,a.useCallback)(async(e,t,a="upload")=>{"image"===t.type?await e1(e,t,a):await e2(e,t)},[e1,e2]),e4=(0,a.useCallback)((e,t)=>{ev.setValue(e,t,{shouldDirty:!0})},[ev]),e5=(0,a.useCallback)(e=>{ev.setValue("meta_data.preset",e,{shouldDirty:!0,shouldTouch:!0})},[ev]),e6=(0,a.useCallback)(async e=>{let t=e.formSetting||[];if("preset"===e.type){let e=[...ev.getValues("meta_data.preset")||[]];t.forEach(t=>{if(!t?.id)return;let a=e.findIndex(e=>e.id===t.id);a>=0?e[a]=t:e.push(t)}),ev.setValue("meta_data.preset",e,{shouldDirty:!0,shouldTouch:!0}),ev.clearErrors();return}for(let e of t){if(!e?.to)continue;let t=String(e.to),a=ev.getValues(t),r="add"===e.mode?Array.isArray(a)?[e.value,...a]:"string"==typeof a?`${String(e.value||"")}${a}`:[e.value]:e.isFileType&&e.value?Array.isArray(e.value)?e.value:[e.value]:e.value;ev.setValue(t,r,{shouldDirty:!0,shouldTouch:!0}),await ev.trigger(t)}ev.clearErrors()},[ev]),e8=(0,a.useCallback)(async()=>{var e;
275if(!ej)return v.toast.warning("No model selected."),null;let t=nl(ev.getValues()),a=(e=ej.customValidation)?ed.superRefine(e):ed;ev.clearErrors();let r=a.safeParse(t);return r.success?t:(r.error.issues.forEach(e=>{let t=e.path.join(".");t&&ev.setError(t,{type:"manual",message:e.message})}),null)},[ev,ej]),e9=(0,a.useCallback)(async()=>{if(!ej||!eD||eq<=0)return null;if(!w?.user.id)throw Error("Please login to continue");let e=(0,y.getUserProfileResourceTotal)(w,"credit",x);if(e<eq)throw Error(`Insufficient credit. Required ${eq}, available ${e}`);let t=`ai_generation:${ej.id}:${Date.now()}`,a=await _({amount:eq,resourceType:"credit",operationId:t,sourceType:"ai_generation",sourceId:ej.id,metaData:{source:"AiTabMultiGenerator",modelId:ej.id,provider:ej.provider?.[0],generationType:ej.type}});if(!a.success||!a.data?.transactionId)throw Error(a.error||"Failed to consume credits");return{operationId:t,transactionId:a.data.transactionId}},[_,eq,x,ej,eD,w]),e7=(0,a.useCallback)(async e=>{if(!e.consumeTransactionId||e.skipLocalRestore)return!1;let t=await k({consumeTransactionId:e.consumeTransactionId,sourceType:"ai_generation_restore",sourceId:ej?.id,metaData:{source:"AiTabMultiGenerator",modelId:ej?.id,provider:ej?.provider?.[0],generationType:e.selectedGenerationType,prompt:ne(e.prompt),providerTaskId:e.providerTaskId??void 0,reason:e.reason}});return!!t.success||(console.error("Failed to restore generation credits:",t.error),!1)},[k,ej?.id,ej?.provider]),te=(0,a.useCallback)(async()=>{let e;if(z.current)return;if(eB>=eL)return void v.toast.warning(`Max concurrent generations reached: ${eB}/${eL}`);Z(""),en([]),z.current=!0,J(!0);let t=()=>{ef.current&&clearTimeout(ef.current),z.current=!1,J(!1),ef.current=null};ef.current&&clearTimeout(ef.current),ef.current=setTimeout(t,1200);let a=await e8();if(!a||!ej)return void t();let r=w?.user.id??"",i=null,s=!1,n=null,l=ne(a.prompt),d=iL({modelId:ej.id,modelLabel:ej.label,provider:ej.provider?.[0],type:ej.type,prompt:String(a.prompt||"")}),c=!1,p=ej.type,u=eD?"default":"free",m=(e=ej?.apiInputs?.[u]??ej?.apiInputs?.default,e?.provider||ej?.provider?.[0]),h=eD&&!!s9({provider:m,type:ej.type,userId:r,credits:eq}),g={enabled:eE,shouldUploadToR2:!h&&eE,shouldInsertRecord:!h&&eE,metaData:void 0};try{let e=nn({model:ej,values:{...a,use_credits:eD?eq:0}});if(eD){let e=await e9();i=e?.transactionId??null}else await ah({userInputData:e,userData:w,isUseCredits:!1,creditUsed:eq,handleFunc:{setGenerationStatus:Z,setShowLoginModal:f}});e=await au({userInputData:e,promptProcessMode:V,isUseCredits:eD}),l=ne(e.prompt_process||e.prompt);let{inputData:t,summary:u}=await r_(e,{fileUploadCache:R.current});u.ignoredCount>0&&v.toast.info(`Ignored ${u.ignoredCount} unsupported file(s) for this model.`);let y=eD?s9({provider:m,type:ej.type,userId:r,credits:eq,consumeTransactionId:i??void 0}):void 0;c=!0;let b=await iW({draft:{modelId:ej.id,modelLabel:ej.label,provider:m,type:ej.type,prompt:String(e.prompt||"")},startTask:d??void 0,execute:async({handleGenerationUpdate:e})=>rd({model:ej,input:t,mode:eD?"default":"free",options:{webhookUrl:y,onSubmitted:async({taskId:t,context:a})=>{n=t,e({providerTaskId:t,provider:a.provider,status:"polling",resumeContext:{apiMode:a.apiMode,endpoint:a.endpoint},metadata:{endpoint:a.endpoint}})}}})});if(b.success){let t=new Date().toISOString(),a=String(e.prompt_process||e.prompt||""),i=(b.items??[]).map((r,i)=>({id:`${b.taskId||d?.id||t}-${i}`,type:r.type,url:r.url,downloadUrl:r.url,mimeType:r.mimeType,prompt:a,input:e,createdAt:t,model:ej.id,modelLabel:ej.label,metadata:r.metadata,raw:r}));i.length>0&&eg(e=>[{id:b.taskId||d?.id||`session-${Date.now()}`,taskId:b.taskId,modelId:ej.id,modelLabel:ej.label,type:b.type,prompt:a,createdAt:t,items:i},...e].slice(0,10)),v.toast.success("Generation completed."),o?.(b),g.enabled&&r&&rA(b,{enabled:!0,shouldUploadToR2:g.shouldUploadToR2,shouldInsertRecord:g.shouldInsertRecord,userId:r,generationId:b.taskId||d?.id||`generation-${Date.now()}`,creditsUsed:eD?eq:0,metaData:{...g.metaData??{},modelLabel:ej.label,prompt:String(e.prompt||"")}}).catch(e=>{console.error("Failed to persist generation result:",e)})}else{s||(s=await e7({consumeTransactionId:i,selectedGenerationType:p,skipLocalRestore:"video"===p&&h&&!!n,prompt:l,providerTaskId:n??b.taskId??null,reason:b.error?.message||"Generation failed."}));let e=b.error?.message||"Generation failed.",t=eH(e);
275v.toast.warning(t)}}catch(r){console.error("Generation failed",r);let e=d,t=e?.id;if(t&&!c){let e=s7(r);await i$(t,{forcePersist:!1,error:{code:"generation_prepare_failed",message:e}}),d=null}s||(s=await e7({consumeTransactionId:i,selectedGenerationType:p,prompt:l,providerTaskId:n,reason:s7(r)}));let a=eH(s7(r));v.toast.warning(a)}},[eB,eH,eq,eL,o,V,e9,e7,ej,eD,eE,w?.user.id,w,e8]),tt=(0,a.useCallback)((e,t)=>{ev.setValue(e,t,{shouldDirty:!0})},[ev]),ta=(0,a.useCallback)(e=>e?ev.getValues(e):ev.getValues(),[ev]),tr=(0,a.useCallback)(e=>async()=>{let t=ev.getValues(),a=eS.get(t.model_id||"")||ej;if(!a)return;let r=nn({model:a,values:{...nl(t),use_credits:no(a,t)}});e?.(r)},[ev,eS,ej]);return(0,a.useImperativeHandle)(n,()=>({form:ev,setValue:tt,getValues:ta,handleSubmit:tr,getSelectedModelConfig:()=>ej}),[ev,ta,tr,tt,ej]),(0,t.jsxs)("div",{className:(0,ei.cn)("flex flex-col gap-2 w-full",!eV&&"max-w-7xl"),children:[(0,t.jsxs)("div",{className:eV?"flex flex-row gap-4 w-full items-start":"",children:[(0,t.jsx)("div",{className:(0,ei.cn)("flex flex-col bg-card rounded-lg relative p-2",eV?"w-[500px] flex-shrink-0 h-[80vh]":"w-full max-w-2xl mx-auto gap-2"),children:(0,t.jsx)(T.Form,{...ev,children:(0,t.jsxs)("form",{className:(0,ei.cn)("flex flex-col gap-4",eV&&"flex-1 min-h-0 gap-0"),onSubmit:e=>{e.preventDefault(),te()},children:[(0,t.jsx)("div",{className:(0,ei.cn)("flex flex-wrap items-center justify-between gap-2",eV&&"shrink-0 pb-2"),children:r?.model_id?null:(0,t.jsx)(T.FormField,{control:ev.control,name:"model_id",render:({field:e})=>(0,t.jsxs)(T.FormItem,{className:"flex flex-col gap-2 w-full",children:[(0,t.jsx)(aa.Tabs,{value:B,onValueChange:e=>{L(e),$(!0)},children:(0,t.jsx)(aa.TabsList,{className:"w-full grid grid-cols-3 gap-1",children:s6.map(e=>{let a=e.icon;return(0,t.jsxs)(aa.TabsTrigger,{value:e.key,onClick:()=>$(!0),className:"cursor-pointer hover:bg-background/60 hover:border",children:[(0,t.jsx)(a,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:e.label})]},e.key)})})}),(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(sb,{modelSeries:ez,onModelSelect:eJ,currentModel:e.value,open:q,onOpenChange:$,triggerText:m?.buttons?.model||"Model"})}),(0,t.jsx)(T.FormMessage,{})]})})}),(0,t.jsxs)("div",{className:(0,ei.cn)(eV?"flex-1 overflow-y-auto flex flex-col gap-4 py-2 pr-0.5":"contents"),children:[eC.length>0?(0,t.jsx)("div",{className:`grid gap-2 ${1===eC.length?"grid-cols-1":"grid-cols-1 sm:grid-cols-2"}`,children:eC.map((e,a)=>(0,t.jsx)(T.FormField,{control:ev.control,name:e.name,render:({field:a})=>{var r;let i=Array.isArray(a.value)?a.value:[],o=e.isSupport??0,s=o>0,n=!s||i.length>=o;return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,t.jsx)(T.FormLabel,{className:"capitalize font-bold text-lg",children:s?(0,t.jsxs)("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:[e.label," (",i.length,"/",o,")"]}):(0,t.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:"Not supported by this model"})})}),(0,t.jsx)(s2,{onFileSelect:(t,a)=>{e3(t,e,a)},className:"w-full max-h-[200px]",disabled:n,accept:"image"===(r=e.type)?"image/*":"audio"===r?"audio/mp3, audio/wav, audio/mpeg, audio/*":"video"===r?"video/mp4, video/mov, video/webm, video/*":"image/*,audio/*,video/*"}),(0,t.jsx)(T.FormMessage,{})]})}},`${e.name}-${a}`))}):null,Q?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",role:"status","aria-live":"polite",children:Q}):null,eC.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eC.map((e,a)=>(0,t.jsx)(s3.AdvanceMediaPreview,{support:e,control:ev.control,setValue:e4,ignoredText:"Ignored",unsupportedText:"Unsupported"},`advance-media-${e.name}-${a}`))}):null,r?.prompt?null:(0,t.jsx)(T.FormField,{control:ev.control,name:"prompt",render:({field:e})=>(0,t.jsxs)(T.FormItem,{className:"flex flex-col gap-2",children:[ej?.options?.textInput?.Label?(0,t.jsx)(T.FormLabel,{children:ej.options.textInput.Label}):null,ej?.options?.textInput?.Description?(0,t.jsx)(T.FormDescription,{className:"text-xs",children:ej.options.textInput.Description}):null,(0,t.jsx)(sw,{presetList:eA?.meta_data?.preset||[],onHandlePresetList:e5}),(0,t.jsx)(T.FormControl,{children:(0,t.jsxs)("div",{className:"flex flex-col gap-2 relative w-full",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(N.Textarea,{...e,placeholder:"Describe your idea",className:"min-h-[200px] md:min-
275h-[150px] w-full max-w-2xl max-h-[600px] py-4 pb-12",maxLength:ej?.promptSetting?.max||void 0,autoFocus:!1,disabled:!!(ej?.promptSetting?.promptIgnore||ej?.promptSetting?.promptNotRequired)}),(0,t.jsx)("p",{className:(0,ei.cn)("absolute top-2 right-2 text-xs text-right",e.value?.length&&e.value?.length>(ej?.promptSetting?.max||1200)?"text-red-500":""),children:`${e.value?.length||0}/${ej?.promptSetting?.max||1200}`}),(0,t.jsx)(oT,{prompt:e.value||"",type:ej?.type,control_images:eF,onPromptSelect:t=>{e.onChange(t)},isPromptIgnore:!!(ej?.promptSetting?.promptIgnore||ej?.promptSetting?.promptNotRequired),promptEnhanceSettings:ej?.promptSetting?.promptEnhanceSettings})]}),(0,t.jsx)("div",{className:"w-full flex flex-col md:flex-wrap pb-2",children:(0,t.jsxs)("div",{className:"w-auto flex flex-wrap gap-1 items-center",children:[ej?.supportedAspectRatios?.length?(0,t.jsx)(sh,{handleAspectRatioChange:eK,selectedRatio:eA?.aspect_ratio,customAspectRatios:ej.supportedAspectRatios}):null,r?.prompt_process?null:(0,t.jsxs)(I.Select,{value:V,onValueChange:e=>{G(e)},children:[(0,t.jsx)(I.SelectTrigger,{className:"w-auto rounded-lg border-none bg-transparent hover:bg-accent/30 hover:text-accent-foreground",children:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(ee,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs",children:"none"===V?"Raw":"translate"===V?"EN":"AI+"})]})}),(0,t.jsxs)(I.SelectContent,{children:[(0,t.jsx)(I.SelectItem,{value:"none",children:"No processing"}),(0,t.jsx)(I.SelectItem,{value:"translate",children:"Translate to English"})]})]})]})})]})}),(0,t.jsx)(T.FormMessage,{})]})}),eM?(0,t.jsx)(sA,{options:eM,onHandleExampleFunc:e6}):null,eO?(0,t.jsx)(sE,{note:eO}):null,ej?.customParameters?.length&&!r?.advanced_settings?(0,t.jsx)(at.Accordion,{type:"multiple",className:"w-full",defaultValue:[],children:(0,t.jsxs)(at.AccordionItem,{value:"custom-settings",children:[(0,t.jsx)(at.AccordionTriggerText,{children:(0,t.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,t.jsx)(ea,{className:"h-5 w-5"}),m?.buttons?.advancedSettings||nd?.buttons?.advancedSettings||"Advanced Settings"]})}),(0,t.jsx)(at.AccordionContent,{className:"space-y-4 pt-4",children:(ej.customParameters||[]).map(e=>{let a=`${e.name}`;switch(e.type){case"select":return(0,t.jsx)(T.FormField,{control:ev.control,name:a,render:({field:a})=>(0,t.jsxs)(T.FormItem,{children:[(0,t.jsx)(T.FormLabel,{className:"text-sm",children:e.label}),(0,t.jsxs)(I.Select,{value:((e,t,a)=>{let r=t??[];if(0===r.length)return ar(null==e?a:e,"");let i=new Set(r.map(e=>String(e.value))),o=ar(null==e?a:e,String(r[0].value));return i.has(o)?o:String(r[0].value)})(a.value,e.options,e.defaultValue),onValueChange:t=>{a.onChange(t),ev.setValue(`meta_data.${e.name}`,t,{shouldDirty:!0,shouldValidate:!0})},children:[(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(I.SelectTrigger,{className:"w-full",children:(0,t.jsx)(I.SelectValue,{placeholder:`Select ${e.label}`})})}),(0,t.jsx)(I.SelectContent,{className:"w-full",children:e.options?.map(e=>(0,t.jsx)(I.SelectItem,{value:String(e.value),children:e.label},String(e.value)))})]}),e.description?(0,t.jsx)(T.FormDescription,{children:e.description}):null,(0,t.jsx)(T.FormMessage,{})]})},e.name);case"slider":return(0,t.jsx)(T.FormField,{control:ev.control,name:a,render:({field:a})=>{let r=((e,t=0)=>null==e||""===e?t:Number(e))(a.value,"number"==typeof e.defaultValue?e.defaultValue:e.min??0);return(0,t.jsxs)(T.FormItem,{children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)(T.FormLabel,{children:e.label}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:r})]}),(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(t7.Slider,{min:e.min,max:e.max,step:e.step,value:[r],onValueChange:t=>{let r=t[0];a.onChange(r),ev.setValue(`meta_data.${e.name}`,r,{shouldDirty:!0,shouldValidate:!0})}})}),e.description?(0,t.jsx)(T.FormDescription,{children:e.description}):null,(0,t.jsx)(T.FormMessage,{})]})}},e.name);case"switch":return(0,t.jsx)(T.FormField,{control:ev.control,name:a,render:({field:a})=>(0,t.jsxs)(T.FormItem,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)(T.FormLabel,{children:e.label}),e.description?(0,t.jsx)(T.FormDescription,{children:e.description}):null]}),(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(W.Switch,{checked:ai(a.value,e.defaultValue??!1),onCheckedChange:t=>{a.onChange(t),ev.setValue(`meta_data.${e.name}`,t,{shouldDirty:!0,shouldValidate:!0})}})})]})},e.name);case"input":return(0,t.jsx)(T.FormField,{control:ev.control,name:a,render:({field:a})=>(0,t.jsxs)(T.FormItem,{children:[(0,t.jsx)(T.FormLabel,{children:e.label}),(0,t.jsx)(T.FormControl,{children:e?.meta?.inputType==="input"?
275(0,t.jsx)(H.Input,{placeholder:e.description||`Enter ${e.label}`,value:ar(a.value,"string"==typeof e.defaultValue?e.defaultValue:""),onChange:t=>{let r=t.target.value;a.onChange(r),ev.setValue(`meta_data.${e.name}`,r,{shouldDirty:!0,shouldValidate:!0})},maxLength:e.max??300}):(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(N.Textarea,{placeholder:e.description||`Enter ${e.label}`,value:ar(a.value,"string"==typeof e.defaultValue?e.defaultValue:""),onChange:t=>{let r=t.target.value;a.onChange(r),ev.setValue(`meta_data.${e.name}`,r,{shouldDirty:!0,shouldValidate:!0})},className:"min-h-[200px] md:min-h-[150px] w-full max-w-2xl max-h-[450px] py-4 pb-12",maxLength:e.max??1e3}),(0,t.jsx)("p",{className:"absolute top-2 right-2 text-xs text-right",children:`${a.value?.length||0}/${e.max??1e3}`}),e?.meta?.promptEnhanceSettings?(0,t.jsx)(oT,{prompt:ar(a.value,"string"==typeof e.defaultValue?e.defaultValue:""),type:"text",control_images:eF,onPromptSelect:t=>{a.onChange(t),ev.setValue(`meta_data.${e.name}`,t,{shouldDirty:!0,shouldValidate:!0})},promptEnhanceSettings:e.meta.promptEnhanceSettings}):null]})}),(0,t.jsx)(T.FormMessage,{})]})},e.name);default:return null}})})]})}):null]}),(0,t.jsxs)("div",{className:(0,ei.cn)("flex flex-col w-full gap-2 items-center justify-center",eV&&"shrink-0 border-t mt-2 pt-3 pb-1"),children:[eP?(0,t.jsx)(ae.Badge,{onClick:()=>f(!0),className:"cursor-pointer hover:bg-accent/70 hover:text-accent-foreground",children:"Please sign in to continue"}):null,eB>0?(0,t.jsxs)("div",{className:"flex flex-row items-center gap-1 text-muted-foreground",children:[(0,t.jsx)(E.Loader2,{className:"h-4 w-4 text-yellow-400 animate-spin"}),(0,t.jsx)("span",{className:"text-xs",children:m?.generation?.maxQueueLabel?.replace("{{current}}",String(eB))?.replace("{{max}}",String(eL))||`Max concurrent: ${eB}/${eL}`})]}):null,er.length>0?(0,t.jsxs)("div",{className:"w-full flex flex-row items-center justify-between gap-3 p-3 mt-1 rounded-xl bg-gradient-to-br from-primary/10 via-sky-500/10 to-violet-500/10 shadow-sm transition-all duration-300",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 flex-1",children:[(0,t.jsx)(D.Zap,{className:"h-4 w-4 mt-0.5 text-yellow-500 shrink-0"}),(0,t.jsx)("div",{className:"flex flex-col gap-0.5 text-sm font-medium text-foreground",children:er.map((e,a)=>(0,t.jsx)("span",{className:1===a?"text-xs text-muted-foreground font-normal leading-snug":"text-sm leading-snug",children:e},`${e}-${a}`))})]}),(0,t.jsxs)(p.Button,{type:"button",variant:"default",className:"h-8 px-3 text-xs font-bold transition-all duration-300 shrink-0",onClick:()=>window.open("/pricing","_blank","noopener,noreferrer"),children:[(0,t.jsx)(X,{className:"w-3.5 h-3.5 mr-1.5"}),m?.creditsMode?.upgradeButton||nd?.creditsMode?.upgradeButton||"Upgrade Plan"]})]}):null,(0,t.jsxs)(p.Button,{type:"submit",variant:"default",className:"w-full",disabled:K||eB>=eL,children:[(0,t.jsx)("span",{className:"ml-1 ",children:m?.buttons?.generate||"Generate"}),(0,t.jsx)(D.Zap,{className:"ml-1 h-4 text-[#facc15]"}),eq]}),Y?(0,t.jsx)("div",{className:"w-full px-3 py-2 rounded-md bg-muted/40 text-muted-foreground",children:(0,t.jsx)("p",{className:"text-center text-sm",children:(0,rI.filterSensitiveInfo)(Y)})}):null,eW.length>0?(0,t.jsx)("div",{className:"w-full p-3 border border-destructive bg-white/85 rounded-md text-destructive",children:(0,t.jsx)("ul",{className:"list-disc list-inside text-sm",children:eW.map((e,a)=>(0,t.jsx)("li",{children:e},a))})}):null]})]})})}),eV?(0,t.jsx)("div",{className:"flex-1 min-w-0 h-[80vh] overflow-y-auto rounded-lg",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(oC,{results:eh,className:"flex min-h-[420px] flex-col",contentClassName:"flex-1"}),(0,t.jsx)(oj,{})]})}):null]}),eV||r?.recentGeneration?null:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(oj,{}),(0,t.jsx)(oC,{results:eh})]}),(0,t.jsx)(s4.AppTrimMediaDialog,{isOpen:eu,mediaFile:el?.file??null,maxDuration:el?.maxDuration??eT??0,onClose:eQ,onHandleTrimMedia:e0})]})}).displayName="AiTabMultiGenerator";let nd={tabTitle:"AI Multi APP Image Step",modelLabel:"Model",promptPlaceholder:"Describe your idea",characterCount:"{{current}}/{{max}}",apiSettings:{useCustomApiKey:"Use Custom API Key:",none:"None"},generationType:{selectType:"Choose Type"},tabLabels:{images:"Image",videos:"Video",audios:"Audio"},stepLabels:{uploadYourImage:"Upload your Image"},tips:{notSupported:"This model does not support image reference"},buttons:{model:"Model",promptLibrary:"Prompt Library",imageUpload:"Image",endImageUpload:"End",style:"Style",generate:"Generate",advancedSettings:"Advanced Settings",promptPreset:"Prompt Preset",chooseImage:"Cho
275ose Image",choose:"Choose",clear:"Clear",remove:"Remove",clearAll:"Clear All",aspectRatio:"Aspect Ratio"},imageUpload:{startImageLabel:"Start Image",endImageLabel:"End Image",unsupported:"Unsupported",ignored:"Ignored",uploadModes:{single:"Single",combine:"Combine (2)"},imageLabels:{firstImage:"First Image",secondImage:"Second Image"},status:{noImageSelected:"No image selected",combinedPreview:"Combined preview â",selectTwoImages:"Select two images to auto-combine"},altTexts:{uploaded:"uploaded image",firstImage:"first image",secondImage:"second image",mergedImage:"merged image"},tooltips:{imageNotSupported:"This model does not support image reference",uploadReference:"Upload reference image (max {{maxImages}})",endImageNotSupported:"This model does not support end image reference",uploadEndReference:"Upload end image reference (max {{maxImages}})",uploadSingle:"Upload 1 image (max {{max}})"}},mediaTypes:{audio:"Audio",video:"Video",tooltips:{uploadMedia:"Upload {{type}} (max {{max}})",mediaNotSupported:"This model does not support this media input"}},form:{labels:{customPrompt:"Custom Prompt"},placeholders:{selectField:"Select {{field}}",enterField:"Enter {{field}}"}},promptProcessing:{noProcessing:"No processing",translateToEnglish:"Translate input to English For better result",enhancePrompt:"Enhance prompt",displayModes:{raw:"Raw",en:"EN",aiPlus:"AI+"}},creditsMode:{free:"free",freeTooltip:"Use free quota, shared compute, watermarked, public by default",useCredits:"use credits",useCreditsTooltip:"Use credits, faster and private generation",termsNote:"Note: By using this feature, you agree to our website's Terms of Service and Privacy Policy.",modeStatus:{creditMode:"Credit Mode: Use credits, faster and private generation",freeMode:"Free Mode: Use free quota, shared compute, watermarked, public by default"},toast:{creditsNotEnough:["Oops! You don't have enough credits.","Upgrade your plan to use advanced models, generate longer videos, and unlock more creative freedom!"]},upgradeButton:"Upgrade Plan"},generation:{maxQueueLabel:"Max concurrent: {{current}}/{{max}}",generating:{tips1:"This may take a moment",tips2:"Generating image..."}},adapter:{removeStyle:"Remove Style",description:"Description:"},results:{},toast:{}};var nc=e.i(89236);let np=(0,r.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),nu=(0,r.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),nm=(0,r.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),nh=(0,r.default)("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);var ng=e.i(579900),nf=e.i(40199),nv=e.i(921447),ny=e.i(82114);async function nb(e,t){let a,r=t||"download",i="";try{if(e instanceof File)a=e,r=t||e.name,i=e.type;else if(e instanceof Blob)a=e,i=e.type;else if("string"==typeof e)if(e.startsWith("data:")){let t=e.split(","),r=t[0].match(/:(.*?);/);i=r?r[1]:"";let o=atob(t[1]),s=o.length,n=new Uint8Array(s);for(;s--;)n[s]=o.charCodeAt(s);a=new Blob([n],{type:i})}else{let o=e;if(e.startsWith("https://file.videoprompt.online"))try{let t=e.replace("https://file.videoprompt.online/",""),a=await (0,i9.getPresignedUrl)(t,"application/octet-stream","get");a.success&&a.data?o=a.data:console.error("Failed to get presigned URL:",a.error)}catch(e){console.error("Error getting presigned URL:",e)}let s=await fetch(o);if(!s.ok)throw Error(`Failed to fetch file: ${s.statusText}`);if(a=await s.blob(),i=s.headers.get("content-type")?.split(";")[0]?.trim()||a.type||"",!t){let t=e.split("?")[0].split("#")[0].split("/").pop();if(t&&t.length<50)try{r=decodeURIComponent(t)}catch{r=t}}}else throw Error("Invalid input type");if(!(e=>{let t=e.lastIndexOf(".");if(-1===t||t===e.length-1)return!1;let a=e.slice(t+1).toLowerCase();return a.length>=1&&a.length<=10&&/^[a-z0-9]+$/.test(a)})(r)){let t="";
275if(i&&(t=({"image/jpeg":"jpg","image/jpg":"jpg","image/png":"png","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","audio/mpeg":"mp3","audio/mp3":"mp3","audio/wav":"wav","audio/ogg":"ogg","audio/webm":"webm","application/pdf":"pdf","application/zip":"zip","text/plain":"txt","text/html":"html","application/json":"json"})[i]||""),!t&&"string"==typeof e){let a=await (0,rI.extractFileExtension)(e,i);a&&(t=a)}if(!t&&i){let e=await (0,rI.extractFileExtension)(a,i);e&&(t=e)}t||(t="bin"),r=r.replace(/\.$/,"")+"."+t}let o=window.URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=r,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(o)}catch(e){throw console.error("Download failed:",e),e}}let nw=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),nx=e=>{if(null==e)return"N/A";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}},n_=e=>{if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}},nk=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase()),nS=new Set(["storyboard_images","meta_info"]),nj=e=>e?Object.keys(e).filter(e=>!nS.has(e)):[];function nC({results:e,onFrameUpdate:r,onFramesChange:i,onResultUpdate:o,onResultDelete:s,onResultsChange:n,selectedId:l,onSelectedIdChange:d}){let{t:c}=(0,oA.useTranslation)(),u=c("app/generator:storyboard-breakdown",{returnObjects:!0})||nT,m=(0,a.useRef)(null),[h,g]=(0,a.useState)(!1),[f,y]=(0,a.useState)(void 0),b=void 0!==l||"function"==typeof d,w=b?l:f,x=w&&e.some(e=>e.id===w)?w:void 0,_=(0,a.useCallback)(e=>{let t="function"==typeof e?e(x):e;""!==t&&(b?d?.(t):y(t))},[b,x,d]),k=(0,a.useMemo)(()=>new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[]),S=e.find(e=>e.id===x),j=S?.templateName??"Template",[C,N]=(0,a.useState)(!1),A=(0,a.useCallback)(()=>`storyboard-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,[]),T=(0,a.useCallback)(async e=>{let t=e.target.files?.[0];if(t){if(m.current&&(m.current.value=""),!t.name.endsWith(".json"))return void v.toast.error(u?.toast?.invalidFileType||"Please select a JSON file");g(!0);try{let e,a,r=await t.text();try{e=JSON.parse(r)}catch{v.toast.error(u?.toast?.invalidJson||"Invalid JSON format. Please check the file content."),g(!1);return}if("object"!=typeof e||null===e){v.toast.error(u?.toast?.invalidStructure||"Invalid JSON structure. Expected an object or array."),g(!1);return}if(!(a=Array.isArray(e)?{outputs:e}:e).outputs||!Array.isArray(a.outputs)){v.toast.error(u?.toast?.missingOutputs||"Missing required field: 'outputs'. The JSON must contain an 'outputs' array."),g(!1);return}if(0===a.outputs.length){v.toast.error(u?.toast?.emptyOutputs||"The 'outputs' array cannot be empty."),g(!1);return}let i={id:a.id||A(),label:a.label||"New Project",outputs:a.outputs,summary:a.summary,createdAt:"number"==typeof a.createdAt?a.createdAt:Date.now(),templateName:a.templateName,videoName:a.videoName,...a},o=await i0.storyboardStorage.saveResult(i),s=await i0.storyboardStorage.getAllResults();n?.(s),_(o.id),v.toast.success(u?.toast?.importSuccess?.replace("${name}",i.label??o.id)||`Successfully imported: ${i.label??o.id}`)}catch(e){console.error("Failed to import JSON:",e),v.toast.error(u?.toast?.importFailed||"Failed to import JSON file. Please try again.")}finally{g(!1)}}},[A,n,_,u]),R=(0,a.useCallback)(async()=>{if(!S?.id)return;let t=S.id;try{await i0.storyboardStorage.deleteResult(t),window.localStorage.removeItem(`storyboard-auto-save:${t}`),s?.(t);let a=e.filter(e=>e.id!==t),r=a[0]?.id;r!==x&&_(r),v.toast.success(u?.toast?.projectDeleted||"Project deleted")}catch(e){console.error("Failed to delete Project",e),v.toast.error(u?.toast?.projectDeleteFailed||"Failed to delete project")}finally{N(!1)}},[s,e,x,S?.id,_,u?.toast?.projectDeleteFailed,u?.toast?.projectDeleted]),U=(0,a.useCallback)(()=>{S?.id&&N(!0)},[S?.id]);return(0,t.jsxs)(Z.Card,{className:"border-border",children:[(0,t.jsxs)(Z.CardHeader,{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Z.CardTitle,{className:"text-base",children:u?.ui?.storyboardProject||"Project"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[(0,t.jsx)("input",{ref:m,type:"file",accept:".json,application/json",onChange:T,className:"hidden",id:"storyboard-json-import"}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"outline",onClick:()=>m.current?.click(),disabled:h,title:u?.ui?.importTitle||"Import",className:"shrink-0",children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.Loader2,{className:"h-3.5 w-3.5 animate-spin sm:mr-1"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:u?.ui?.importing||"Importing..."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sR.Upload,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:u?.ui?.importTitle||"Import"})]})}),(0,t.jsxs)(I.Select,{value:x??"",onValueChange:e=>_(e),disabled:0===e.length,children:[(0,t.jsx)(I.SelectTrigger,{className:"w-full sm:w-[260px]",children:(0,t.jsx)(I.SelectValue,{placeholder:u?.ui?.selectProjectPlaceholder||"select a Project"})}),(0,t.jsx)(I.SelectContent,{children:e.map(e=>(0,t.jsx)(I.SelectItem,{value:e.id,children:e.label??e.id},e.id))})]}),(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"text-destructive shrink-0",onClick:U,disabled:!S,children:(0,t.jsx)(i8.Trash2,{className:"h-4 w-4"})})]})]}),(0,t.jsx)(Z.CardContent,{className:"space-y-3",children:S?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:(e=>{if(!e)return"N/A";try{return k.format(new Date(e))}catch{return nw.format(new Date(e))}})(S.createdAt)}),j&&(0,t.jsx)("span",{children:j}),S.videoName&&(0,t.jsx)("span",{children:u?.ui?.sourceLabel?.replace("${name}",S.videoName)||`Source: ${S.videoName}`})]}),(0,t.jsx)(nI,{resultId:S.id,frames:S.outputs,summary:S.summary,createdAt:S.createdAt,templateName:S.templateName,videoName:S.videoName,label:S.label,onFrameUpdate:r?(e,t)=>r(S.id,e,t):void 0,onFramesChange:i?e=>
275i(S.id,e):void 0,onResultUpdate:o?e=>o(S.id,e):void 0},S.id)]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:0===e.length?u?.ui?.noProjectsMessage||"No Projects yet. Import a JSON file or generate a new project.":u?.ui?.selectProjectMessage||"Please select a Project to view details."})}),(0,t.jsx)(i7.Dialog,{open:C,onOpenChange:N,children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:"Delete project?"})}),(0,t.jsxs)("div",{className:"space-y-3 text-sm text-muted-foreground",children:[(0,t.jsx)("p",{children:"This will permanently delete the selected project from local storage."}),S?.label&&(0,t.jsx)("p",{className:"font-medium text-foreground",children:S.label})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>N(!1),children:"Cancel"}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"destructive",onClick:R,children:"Delete"})]})]})})]})}function nI({resultId:e,frames:r,summary:i,createdAt:o,templateName:s,videoName:n,label:l,disableInternalAutosave:d=!1,onFrameUpdate:c,onFramesChange:m,onResultUpdate:h}){let{t:g}=(0,oA.useTranslation)(),f=g("app/generator:storyboard-breakdown",{returnObjects:!0})||nT,[y,b]=(0,a.useState)(r),w=(0,a.useRef)(r),[x,_]=(0,a.useState)(!1),[k,S]=(0,a.useState)({}),[j,C]=(0,a.useState)(new Set),[I,N]=(0,a.useState)(!1),[T,E]=(0,a.useState)(null),[U,P]=(0,a.useState)(!1),[D,z]=(0,a.useState)(""),[F,M]=(0,a.useState)(""),[O,B]=(0,a.useState)(null),[L,q]=(0,a.useState)("list"),[$,V]=(0,a.useState)("edit"),[X,Q]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(""),ea=(0,a.useRef)(o??Date.now());w.current=y;let er=`storyboard-auto-save:${e}`,ei="string"==typeof i&&i.trim().length>0,eo=y.length>0,es=y.some(e=>(e.meta_info?.storyboard_images||[]).length>0);(0,a.useEffect)(()=>{d?N(!1):N("true"===window.localStorage.getItem(er))},[d,er]),(0,a.useEffect)(()=>{w.current=r,b(r)},[r,e]),(0,a.useEffect)(()=>{ea.current=o??Date.now()},[o,e]);let en=(0,a.useCallback)(async(t,a=i)=>{if(I&&!d)try{let r=await i0.storyboardStorage.upsertResult({id:e,label:l,outputs:t,summary:a,createdAt:ea.current,templateName:s,videoName:n},t);E(r.updatedAt)}catch(e){console.error("Failed to save storyboard locally",e)}},[I,d,e,l,i,s,n]);(0,a.useEffect)(()=>{!I||d||en(r,i)},[r,I,d,en,i]);let el=(0,a.useCallback)(e=>{w.current=e,b(e)},[]),ed=(0,a.useCallback)(e=>{let t=w.current,a=e(t);a!==t&&(el(a),m?.(a),en(a,i))},[el,m,en,i]),ec=(0,a.useCallback)(e=>{if(d)return;let t=!!e;N(t),window.localStorage.setItem(er,t?"true":"false"),t&&en(y,i)},[d,er,en,y,i]),ep=(0,a.useCallback)(async()=>{if(y.length)try{let e=y.map(({meta_info:e,...t})=>t),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),_(!0),setTimeout(()=>_(!1),2e3),v.toast.success(f?.toast?.copiedAll||"Copied all")}catch{v.toast.error(f?.toast?.copyFailed||"Copy failed, please try again")}},[y]),eu=(0,a.useCallback)(async(e,t)=>{try{let{meta_info:a,...r}=e,i=JSON.stringify(r,null,2);await navigator.clipboard.writeText(i),S(e=>({...e,[t]:!0})),setTimeout(()=>{S(e=>{let a={...e};return delete a[t],a})},2e3),v.toast.success(f?.toast?.copiedFrame||"Copied prompt")}catch{v.toast.error(f?.toast?.copyFailed||"Copy failed")}},[f]),em=(0,a.useCallback)(e=>{C(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),eh=(0,a.useCallback)(async()=>{if(0===j.size)return;let e=y.filter((e,t)=>j.has(t)).sort((e,t)=>y.indexOf(e)-y.indexOf(t)).map(({meta_info:e,...t})=>t);try{let t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),v.toast.success(f?.toast?.copiedFrames?.replace("${count}",e.length.toString())||`Copied ${e.length} frames`)}catch{v.toast.error(f?.toast?.copyFailed||"Copy failed")}},[j,y]),eg=(0,a.useCallback)(e=>{let t="",a=new Uint8Array(e);for(let e=0;e<a.length;e+=32768)t+=String.fromCharCode(...a.subarray(e,e+32768));return btoa(t)},[]),ef=(0,a.useCallback)(e=>{if(!e?.startsWith("data:image"))return null;let t=e.match(/^data:image\/(png|jpeg|jpg);base64,(.+)$/i);if(!t)return null;let a="jpg"===t[1]?"jpeg":t[1];return{base64:t[2],extension:a}},[]),ev=(0,a.useCallback)(async e=>{if(!e)return null;let t=ef(e);if(t)return t;try{let t=await fetch(e);if(!t.ok)return null;let a=(t.headers.get("content-type")??"").includes("png")?"png":"jpeg",r=await t.arrayBuffer();return{base64:eg(r),extension:a}}catch(e){return console.error("Failed to fetch image for Excel export",e),null}},[eg,ef]),ey=(0,a.useCallback)(async()=>
275{if(!y.length)return void v.toast.error(f?.toast?.noFramesToExport||"No storyboard frames to export yet.");try{let t,a,r=new nv.default.Workbook,i=r.addWorksheet("Storyboard"),o=(t=new Set,a=[],y.forEach(e=>{Object.keys(e??{}).forEach(e=>{t.has(e)||nS.has(e)||(t.add(e),a.push(e))})}),a),s=o.map(e=>({header:nk(e),key:e,width:35}));i.columns=[{header:"Id",key:"id",width:8},{header:"Image",key:"image",width:40},...s];let n=e=>new Promise(t=>{let a=new window.Image;a.onload=()=>t({width:a.naturalWidth,height:a.naturalHeight}),a.onerror=()=>t({width:180,height:120}),a.src=e}),d=(e,t)=>{let a=Math.min(180/e,120/t,1);return{width:Math.round(e*a),height:Math.round(t*a)}};for(let e=0;e<y.length;e+=1){let t=y[e],a=t.meta_info?.storyboard_images||[],s=a.length?a:[null];for(let a=0;a<s.length;a+=1){let l=s[a],c=0===a,p={id:c?e+1:"",image:""};o.forEach(e=>{p[e]=c?nx(t[e]):""});let u=i.addRow(p);if(u.height=24,l?.image_url){let e=ef(l.image_url)??await ev(l.image_url);if(e){let t=`data:image/${e.extension};base64,${e.base64}`,a=await n(t),{width:o,height:s}=d(a.width,a.height);u.height=Math.ceil(s/.75)+4;let l=r.addImage({base64:e.base64,extension:e.extension});i.addImage(l,{tl:{col:1,row:u.number-1},ext:{width:o,height:s}})}else u.getCell("image").value=l.image_url}}}let c=await r.xlsx.writeBuffer(),p=new Blob([c],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),u=l||e;(0,ny.saveAs)(p,`storyboard-${u}-${new Date().toISOString().split("T")[0]}.xlsx`),v.toast.success(f?.toast?.excelExported||"Excel exported")}catch(e){console.error("Failed to export storyboard Excel:",e),v.toast.error(f?.toast?.failedToExportExcel||"Failed to export Excel. Please try again.")}},[ef,ev,e,y]),eb=(0,a.useCallback)(()=>{if(!y.length)return void v.toast.error(f?.toast?.noFramesToExport||"No storyboard frames to export yet.");try{let t={id:e,label:l||"Storyboard",outputs:y,summary:i,createdAt:o||Date.now()},a=JSON.stringify(t,null,2),r=new Blob([a],{type:"application/json"}),s=l||e;(0,ny.saveAs)(r,`storyboard-${s}-${new Date().toISOString().split("T")[0]}.json`),v.toast.success(f?.toast?.jsonExported||"JSON exported")}catch(e){console.error("Failed to export storyboard JSON:",e),v.toast.error(f?.toast?.failedToExportJson||"Failed to export JSON. Please try again.")}},[e,y,l,i,o,f]),ew=(0,a.useCallback)(async()=>{if(!y.length)return void v.toast.error(f?.toast?.noFramesToExport||"No storyboard frames to export yet.");try{let t=new i2.default,a=0;for(let e=0;e<y.length;e+=1){let r=y[e],i=r.meta_info?.storyboard_images||[];if(0!==i.length)for(let r=0;r<i.length;r+=1){let o=i[r];if(o?.image_url)try{let i;if(o.image_url.startsWith("data:")){let e=o.image_url.split(","),t=e[0].match(/:(.*?);/),a=t?t[1]:"image/png",r=atob(e[1]),s=r.length,n=new Uint8Array(s);for(;s--;)n[s]=r.charCodeAt(s);i=new Blob([n],{type:a})}else{let e=await fetch(o.image_url);if(!e.ok){console.warn(`Failed to fetch image: ${o.image_url}`);continue}i=await e.blob()}let s="jpg";i.type.includes("jpeg")||i.type.includes("jpg")?s="jpg":i.type.includes("png")?s="png":i.type.includes("webp")?s="webp":i.type.includes("gif")&&(s="gif");let n=`${e+1}-${r+1}.${s}`;t.file(n,i),a++}catch(t){console.error(`Failed to process image ${e+1}-${r+1}:`,t)}}}if(0===a)return void v.toast.error(f?.toast?.noImagesToDownload||"No images to download.");let r=await t.generateAsync({type:"blob"}),i=l||e;(0,ny.saveAs)(r,`storyboard-images-${i}-${new Date().toISOString().split("T")[0]}.zip`),v.toast.success(f?.toast?.imagesDownloaded?.replace("${count}",a.toString())||`Downloaded ${a} image${a>1?"s":""}`)}catch(e){console.error("Failed to download images:",e),v.toast.error(f?.toast?.failedToDownloadImages||"Failed to download images. Please try again.")}},[e,y,l,f]),ex=(0,a.useCallback)(e=>{let t={meta_info:{storyboard_images:[]}};return e&&nj(e).forEach(e=>{t[e]=""}),t},[]),e_=(0,a.useCallback)(e=>{C(t=>{let a=new Set;return t.forEach(t=>{a.add(t>=e?t+1:t)}),a})},[]),ek=(0,a.useCallback)(e=>{C(t=>{let a=new Set;return t.forEach(t=>{t!==e&&a.add(t>e?t-1:t)}),a})},[]);async function eS(){await new Promise(e=>setTimeout(e,1500));let e=["https://plus.unsplash.com/premium_photo-1762548729534-ecd689a77503?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwyMHx8fGVufDB8fHx8fA%3D%3D","https://images.unsplash.com/photo-1763307411477-6bb3254f1496?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwzMXx8fGVufDB8fHx8fA%3D%3D","https://images.unsplash.com/photo-1763357021261-da70533bc68b?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwzMnx8fGVufDB8fHx8fA%3D%3D"],t=Math.floor(Math.random()*e.length);return e[t]}let ej=(0,a.useCallback)(async(e,t,a)=>{if(c)try{let r=Array.isArray(a?.items)?a.items:[],o=[];if(r.length>0)for(let e of r){let t=e.url;t&&o.push({prompt:a?.raw?.input?.prompt||"",image_url:t,input:a?.raw?.input,createdAt:Date.now()})}if(0===o.length)return;let s=w.current,n=[...s],l=s[e]??t,d=l.meta_info||{},p=d.storyboard_images||[],u={...l,meta_info:{...d,storyboard_images:[...o,...p]}};n[e]=u,el(n),c(e,u),en(n,i),v.toast.success(f?.toast?.imageGenerated?.replace("${plural}",o.length>
2751?"s":"")||`Image${o.length>1?"s":""} generated successfully`)}catch(e){console.error(e),v.toast.error(f?.toast?.failedToGenerateImage||"Failed to generate image")}},[el,c,en,i,f]);(0,a.useCallback)(async(e,t,a,r)=>{if(c)try{let o=await eS(),s=w.current,n=[...s],l=s[e]??t,d=l.meta_info||{},p=[...d.storyboard_images||[]],u={prompt:r,image_url:o,createdAt:Date.now(),parentImageIndex:a},m=[...p,u],h={...l,meta_info:{...d,storyboard_images:m}};n[e]=h,el(n),en(n,i),c(e,h),v.toast.success(f?.toast?.newImageGenerated||"New image generated and added")}catch(e){v.toast.error(f?.toast?.failedToGenerateImage||"Failed to generate new image")}},[el,c,en,i,f]);let eC=(0,a.useCallback)((e,t,a)=>{if(!c)return;let r=w.current,o=[...r],s=r[e]??t,n=s.meta_info||{},l=[...n.storyboard_images||[]];l.splice(a,1);let d={...s,meta_info:{...n,storyboard_images:l}};o[e]=d,el(o),c(e,d),en(o,i),v.toast.success(f?.toast?.imageDeleted||"Image deleted")},[el,c,en,i,f]),eI=(0,a.useCallback)((e,t,a)=>{let r=w.current,o=[...r],s=r[e];if(!s)return;let n={...s,[t]:a};o[e]=n,el(o),c?.(e,n),en(o,i)},[el,c,en,i]),eN=(0,a.useCallback)((e,t)=>{ed(a=>{let r="before"===t?e:e+1,i=ex(a[e]),o=[...a.slice(0,r),i,...a.slice(r)];return e_(r),o})},[e_,ed,ex]),eA=(0,a.useCallback)(e=>{ed(t=>{if(0===t.length)return t;let a=t.filter((t,a)=>a!==e);return ek(e),a})},[ek,ed]),eT=(0,a.useCallback)((e,t,a="after")=>{B({rowIndex:e,target:t??null,position:a}),z(""),M(""),P(!0)},[]),eE=(0,a.useCallback)(()=>{if(!O)return void P(!1);let e=D.trim();if(!e)return void v.toast.error(f?.errors?.columnNameRequired||"Column name is required");let t=e.replace(/\s+/g,"_"),a=new Set(["meta_info","storyboard_images"]),r=w.current[O.rowIndex];if(!r)return void P(!1);if(a.has(t)||Object.prototype.hasOwnProperty.call(r,t))return void v.toast.error(f?.errors?.columnNameExists||"Column name already exists");let i=F??"";ed(e=>{let a=[...e],r=e[O.rowIndex];if(!r)return e;let o=nj(r),s=O.position??"after",n=O.target&&o.includes(O.target)?o.indexOf(O.target):o.length-1,l=O.target&&o.includes(O.target)?Math.max(0,Math.min(o.length,n+ +("after"===s))):o.length,d=[...o];d.splice(l,0,t);let c={};return d.forEach(e=>{c[e]=e===t?i:r[e]}),Object.prototype.hasOwnProperty.call(r,"meta_info")&&(c.meta_info=r.meta_info),a[O.rowIndex]=c,a}),B(null),P(!1),z(""),M(""),v.toast.success(f?.toast?.columnAdded||"Column added")},[ed,F,D,O,f]),eR=(0,a.useCallback)((e,t)=>{new Set(["meta_info","storyboard_images"]).has(t)||(ed(a=>{let r=a[e];if(!r||!Object.prototype.hasOwnProperty.call(r,t))return a;let i={};nj(r).forEach(e=>{e!==t&&(i[e]=r[e])}),Object.prototype.hasOwnProperty.call(r,"meta_info")&&(i.meta_info=r.meta_info);let o=[...a];return o[e]=i,o}),v.toast.success(f?.toast?.columnDeleted||"Column deleted"))},[ed,f]),eU=(0,a.useCallback)(()=>{et(l||""),Q(!0)},[l]),eP=(0,a.useCallback)(()=>{if(!h)return void Q(!1);let e=ee.trim();e!==l&&h({label:e}),Q(!1)},[ee,l,h]);return ei||eo?(0,t.jsxs)("div",{className:"space-y-4 w-full",children:[(0,t.jsx)(oj,{}),eo?(0,t.jsxs)("div",{className:"rounded-lg bg-muted/30",children:[(0,t.jsxs)("div",{className:"border-b border-border/60 p-3 flex flex-wrap items-end gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col items-start",children:[(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:eU,children:[(0,t.jsx)(sf,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.editInfoButton||"Edit Info"]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center border rounded-md bg-muted/50 p-0.5 mr-2",children:[(0,t.jsxs)("div",{className:"flex items-center border rounded-md bg-muted/50 p-0.5 mr-2",children:[(0,t.jsxs)(p.Button,{variant:"list"===L?"default":"secondary",size:"sm",className:"h-7 px-3 text-xs shadow-none",onClick:()=>q("list"),children:[(0,t.jsx)(nh,{className:"h-3.5 w-3.5 mr-1.5"}),f?.ui?.list||"List"]}),(0,t.jsxs)(p.Button,{variant:"grid"===L?"default":"secondary",size:"sm",className:"h-7 px-3 text-xs shadow-none",onClick:()=>q("grid"),children:[(0,t.jsx)(nm,{className:"h-3.5 w-3.5 mr-1.5"}),f?.ui?.grid||"Grid"]})]}),(0,t.jsxs)("div",{className:"flex items-center border rounded-md bg-muted/50 p-0.5",children:[(0,t.jsxs)(p.Button,{variant:"preview"===$?"default":"secondary",size:"sm",className:"h-7 px-3 text-xs shadow-none",onClick:()=>V("preview"),children:[(0,t.jsx)(sj,{className:"h-3.5 w-3.5 mr-1.5"}),f?.ui?.preview||"Preview"]}),(0,t.jsxs)(p.Button,{variant:"edit"===$?"default":"secondary",size:"sm",className:"h-7 px-3 text-xs shadow-none",onClick:()=>V("edit"),children:[(0,t.jsx)(np,{className:"h-3.5 w-3.5 mr-1.5"}),f?.ui?.edit||"Edit"]})]})]})]}),es&&(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:ew,children:[(0,t.jsx)(i4.Download,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.downloadImages||"Download All Images"]}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:ep,children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.CopyCheck,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.allCopied||"All copied"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(G.Copy,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.copyAll||"Copy all Description"]})}),j.size>0&&(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"secondary",onClick:eh,children:[(0,t.jsx)(J,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.copySelected?.replace("${count}",j.size.toString())||`Copy selected (${j.size})`]}),(0,t.jsxs)("div",{className:"ml-auto flex flex-col items-center gap-2",children:[(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"outline",className:"ml-auto",children:[f?.ui?.export||"Export",(0,t.jsx)(su.ChevronDown,{className:"ml-1 h-3.5 w-3.5"})]})}),(0,t.jsxs)(u.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(u.DropdownMenuItem,{onClick:ey,children:[(0,t.jsx)(ng.FileSpreadsheet,{className:"mr-2 h-4 w-4"}),f?.ui?.exportExcel||"Export as Excel"]}),(0,t.jsxs)(u.DropdownMenuItem,{onClick:eb,children:[(0,t.jsx)(nf.FileJson,{className:"mr-2 h-4 w-4"}),f?.ui?.exportJson||"Export as JSON"]})]})]}
275),!d&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.Label,{htmlFor:`storyboard-auto-save-${e}`,className:"text-xs text-muted-foreground",children:f?.ui?.autoSaveLabel||"Auto-save to device"}),(0,t.jsx)(W.Switch,{id:`storyboard-auto-save-${e}`,checked:I,onCheckedChange:ec}),I&&T&&(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:f?.ui?.savedAt?.replace("${time}",new Date(T).toLocaleTimeString())||`Saved ${new Date(T).toLocaleTimeString()}`})]})]})]}),"list"===L?(0,t.jsx)("div",{className:"space-y-4 p-4 max-h-[80vh] overflow-y-auto",children:y.map((a,r)=>{let i=a.meta_info?.storyboard_images||[],o=nj(a),s=JSON.stringify(o.reduce((e,t)=>(e[t]=a[t],e),{}),null,2);return(0,t.jsxs)(Z.Card,{className:"flex flex-col shadow-sm",children:[(0,t.jsxs)(Z.CardHeader,{className:"flex flex-row items-start justify-between space-y-0 p-4 pb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",children:r+1}),(0,t.jsx)(Y.Checkbox,{checked:j.has(r),onCheckedChange:()=>em(r),"aria-label":f?.ui?.selectClip?.replace("${index}",(r+1).toString())||`Select clip ${r+1}`})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",children:(0,t.jsx)(nu,{className:"h-4 w-4"})})}),(0,t.jsxs)(u.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eN(r,"before"),children:f?.ui?.addRowBefore||"Add new row before"}),(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eN(r,"after"),children:f?.ui?.addRowAfter||"Add new row after"})]})]}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>eu(a,r),children:k[r]?(0,t.jsx)(K.CopyCheck,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(G.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>eA(r),children:(0,t.jsx)(i8.Trash2,{className:"h-4 w-4"})})]})]}),(0,t.jsx)(Z.CardContent,{className:"p-4 space-y-4",children:(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,280px)_1fr]",children:[(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/10 p-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:f?.ui?.storyboardLabel||"Images"}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full",children:i.length})]})}),i.length>0?(0,t.jsx)(nN,{images:i,onGenerate:e=>ej(r,a,e),onDelete:e=>eC(r,a,e)}):(0,t.jsx)("div",{className:"flex h-[160px] w-full items-center justify-center rounded-md border border-dashed bg-muted/20 text-xs text-muted-foreground",children:f?.ui?.noImages||"No images"})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(A.Label,{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"preview"===$?f?.ui?.jsonPreviewLabel||"Preview":f?.ui?.fieldsLabel||"Fields"}),"edit"===$&&(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>eT(r),children:[(0,t.jsx)(R.Plus,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.addField||"Add field"]})]}),"preview"===$?(0,t.jsx)("div",{className:"max-h-[350px] overflow-y-auto rounded-md border bg-background p-3",children:(0,t.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-words font-mono",children:s})}):(0,t.jsx)("div",{className:"space-y-3 max-h-[350px] overflow-y-auto pr-1",children:o.length>0?o.map(e=>(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(A.Label,{className:"text-xs font-medium text-muted-foreground capitalize",children:nk(e)}),(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 opacity-50 hover:opacity-100",children:(0,t.jsx)(nu,{className:"h-3 w-3"})})}),(0,t.jsxs)(u.DropdownMenuContent,{align:"end",className:"w-44",children:[(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eT(r,e,"before"),children:f?.ui?.addBefore||"Add before"}),(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eT(r,e,"after"),children:f?.ui?.addAfter||"Add after"}),(0,t.jsx)(u.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>eR(r,e),children:f?.ui?.delete||"Delete"})]})]})]}),(0,t.jsx)(nA,{className:"min-h-[80px] text-sm resize-y bg-background",value:a[e],onCommit:t=>eI(r,e,t),readOnly:!c})]},e)):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:f?.ui?.noDataMessage||"No structured data available for these clips."})})]})]})})]},`${e}-${r}`)})}):(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-4 max-h-[80vh] overflow-y-auto",children:y.map((a,r)=>
275{let i=a.meta_info?.storyboard_images||[],o=nj(a),s=JSON.stringify(o.reduce((e,t)=>(e[t]=a[t],e),{}),null,2);return(0,t.jsxs)(Z.Card,{className:"flex flex-col shadow-sm hover:shadow-md transition-shadow",children:[(0,t.jsxs)(Z.CardHeader,{className:"flex flex-row items-start justify-between space-y-0 p-4 pb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",children:r+1}),(0,t.jsx)(Y.Checkbox,{checked:j.has(r),onCheckedChange:()=>em(r),"aria-label":f?.ui?.selectClip?.replace("${index}",(r+1).toString())||`Select clip ${r+1}`})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",children:(0,t.jsx)(nu,{className:"h-4 w-4"})})}),(0,t.jsxs)(u.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eN(r,"before"),children:f?.ui?.addBefore||"Add before"}),(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eN(r,"after"),children:f?.ui?.addAfter||"Add after"})]})]}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>eu(a,r),children:k[r]?(0,t.jsx)(K.CopyCheck,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(G.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>eA(r),children:(0,t.jsx)(i8.Trash2,{className:"h-4 w-4"})})]})]}),(0,t.jsxs)(Z.CardContent,{className:"p-4 space-y-4 max-h-[600px] overflow-y-auto",children:[(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/10 p-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:f?.ui?.storyboardLabel||"Images"}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full",children:i.length})]})}),i.length>0?(0,t.jsx)(nN,{images:i,onGenerate:e=>ej(r,a,e),onDelete:e=>eC(r,a,e)}):(0,t.jsx)("div",{className:"flex h-[160px] w-full items-center justify-center rounded-md border border-dashed bg-muted/20 text-xs text-muted-foreground",children:f?.ui?.noImages||"No images"})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(A.Label,{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"preview"===$?f?.ui?.jsonPreviewLabel||"Preview":f?.ui?.fieldsLabel||"Fields"}),"edit"===$&&(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>eT(r),children:[(0,t.jsx)(R.Plus,{className:"mr-1 h-3.5 w-3.5"}),f?.ui?.addField||"Add field"]})]}),"preview"===$?(0,t.jsx)("div",{className:"max-h-[280px] overflow-y-auto rounded-md border bg-background p-3",children:(0,t.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-words font-mono",children:s})}):(0,t.jsx)("div",{className:"space-y-3 max-h-[280px] overflow-y-auto pr-1",children:o.length>0?o.map(e=>(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(A.Label,{className:"text-xs font-medium text-muted-foreground capitalize",children:nk(e)}),(0,t.jsxs)(u.DropdownMenu,{children:[(0,t.jsx)(u.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 opacity-50 hover:opacity-100",children:(0,t.jsx)(nu,{className:"h-3 w-3"})})}),(0,t.jsxs)(u.DropdownMenuContent,{align:"end",className:"w-44",children:[(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eT(r,e,"before"),children:f?.ui?.addBefore||"Add before"}),(0,t.jsx)(u.DropdownMenuItem,{onClick:()=>eT(r,e,"after"),children:f?.ui?.addAfter||"Add after"}),(0,t.jsx)(u.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>eR(r,e),children:f?.ui?.delete||"Delete"})]})]})]}),(0,t.jsx)(nA,{className:"min-h-[80px] text-sm resize-y bg-background",value:a[e],onCommit:t=>eI(r,e,t),readOnly:!c})]},e)):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:f?.ui?.noDataMessage||"No structured data available for these clips."})})]})]})]},`${e}-${r}`)})})]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:f?.ui?.noClipsMessage||"No clips generated for this result."}),(0,t.jsx)(i7.Dialog,{open:X,onOpenChange:Q,children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:f?.ui?.editProjectInfoTitle||"Edit Project Info"})}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(A.Label,{htmlFor:"edit-label",className:"text-sm font-medium",children:f?.ui?.projectNameLabel||"Project Name"}
275),(0,t.jsx)(H.Input,{id:"edit-label",value:ee,autoFocus:!0,placeholder:f?.ui?.projectNamePlaceholder||"Enter project Name",onChange:e=>et(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eP())}}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f?.ui?.projectNameHelp||"This name helps you identify this project in your local storage"})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>Q(!1),children:f?.ui?.cancelButton||"Cancel"}),(0,t.jsx)(p.Button,{type:"button",size:"sm",onClick:eP,children:f?.ui?.saveButton||"Save"})]})]})]})}),(0,t.jsx)(i7.Dialog,{open:U,onOpenChange:P,children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:f?.ui?.addNewColumn||"add new column"})}),(0,t.jsxs)("div",{className:"space-y-3",children:[O&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:O.target?f?.ui?.willInsert?.replace("${position}","before"===O.position?"before":"after").replace("${target}",nk(O.target))||`will insert ${"before"===O.position?"before":"after"} "${nk(O.target)}"`:f?.ui?.willAddToClip?.replace("${index}",(O.rowIndex+1).toString())||`Add field to clip ${O.rowIndex+1}`}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(A.Label,{htmlFor:"new-column-name",className:"text-xs text-muted-foreground",children:f?.ui?.columnNameLabel||"column name *"}),(0,t.jsx)(H.Input,{id:"new-column-name",value:D,autoFocus:!0,placeholder:f?.ui?.columnNamePlaceholder||"e.g. scene_summary",onChange:e=>z(e.target.value)})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(A.Label,{htmlFor:"new-column-default",className:"text-xs text-muted-foreground",children:f?.ui?.defaultValueLabel||"default value (optional)"}),(0,t.jsx)(H.Input,{id:"new-column-default",value:F,placeholder:f?.ui?.defaultValuePlaceholder||"leave empty if you want to leave it empty",onChange:e=>M(e.target.value)})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>P(!1),children:f?.ui?.cancel||"cancel"}),(0,t.jsx)(p.Button,{type:"button",size:"sm",onClick:eE,children:f?.ui?.confirmAdd||"confirm add"})]})]})]})})]}):null}function nN({images:e,onGenerate:r,onDelete:i}){let{t:o}=(0,oA.useTranslation)(),s=o("app/generator:storyboard-breakdown",{returnObjects:!0})||nT,[n,l]=(0,a.useState)(0),[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(null);if(0===e.length)return null;let f=Math.min(n,Math.max(0,e.length-1)),v=e[f],y=()=>{l(t=>(t+1)%e.length)},b=()=>{l(t=>(t-1+e.length)%e.length)};return(0,t.jsxs)("div",{className:"relative group border rounded-md overflow-hidden bg-black/5 w-full min-h-[280px] h-[280px] flex items-center justify-center",children:[(0,t.jsx)("img",{src:v.image_url,alt:v.prompt||"Storyboard image",className:"max-h-full max-w-full object-contain"}),e.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",className:"absolute left-1 top-1/2 -translate-y-1/2 h-8 w-8 bg-black/20 hover:bg-black/40 text-white rounded-full",onClick:e=>{e.stopPropagation(),b()},children:(0,t.jsx)(nc.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 bg-black/20 hover:bg-black/40 text-white rounded-full",onClick:e=>{e.stopPropagation(),y()},children:(0,t.jsx)(w.ChevronRight,{className:"h-4 w-4"})}),(0,t.jsx)("span",{className:"absolute left-2 bottom-2",children:f+1})]}),(0,t.jsxs)("div",{className:"absolute bottom-2 right-2 flex gap-1",children:[(0,t.jsxs)(i7.Dialog,{open:d,onOpenChange:c,children:[(0,t.jsx)(i7.DialogTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{variant:"secondary",size:"icon",className:"h-7 w-7 shadow-sm",children:(0,t.jsx)(sj,{className:"h-3.5 w-3.5"})})}),(0,t.jsxs)(i7.DialogContent,{className:"flex flex-col items-center justify-center rounded-none md:max-w-[70vh] md:h-[80vh] max-w-[80vw] h-[60vh]",children:[(0,t.jsx)(i7.DialogHeader,{className:"w-full",children:(0,t.jsxs)(i7.DialogTitle,{children:["Storyboard Images (",e.length,")"]})}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-4 min-h-0 w-full",children:[(0,t.jsxs)("div",{className:"flex-1 rounded-lg flex items-center justify-center overflow-hidden relative min-h-0 bg-black/5 border border-border/50",children:[(0,t.jsx)("img",{src:e[f].image_url,alt:e[f].prompt,className:"max-h-full max-w-full object-contain"}),e.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",className:"absolute left-4 top-1/2 -translate-y-1/2 h-10 w-10 bg-black/20 hover:bg-black/40 text-white rounded-full",onClick:b,children:(0,t.jsx)(nc.ChevronLeft,{className:"h-6 w-6"})}),(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",className:"absolute right-4 top-1/2 -translate-y-1/2 h-10 w-10 bg-black/20 hover:bg-black/40 text-white rounded-full",onClick:y,children:(0,t.jsx)(w.ChevronRight,{className:"h-6 w-6"})})]})]}),(0,t.jsx)("div",{className:"h-24 w-full shrink-0 overflow-x-auto scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground
275/20",children:(0,t.jsx)("div",{className:"flex gap-2 pb-2 min-w-max px-1",children:e.map((e,a)=>(0,t.jsx)("button",{className:`relative h-20 aspect-video rounded-md overflow-hidden border-2 transition-all flex-shrink-0 ${a===f?"border-primary ring-2 ring-primary/20":"border-transparent opacity-70 hover:opacity-100"}`,onClick:()=>l(a),children:(0,t.jsx)("img",{src:e.image_url,alt:"",className:"w-full h-full object-cover"})},a))})}),(0,t.jsx)("div",{className:"flex justify-end gap-2",children:(0,t.jsxs)(p.Button,{variant:"destructive",size:"sm",onClick:()=>{g(f),m(!0)},children:[(0,t.jsx)(i8.Trash2,{className:"mr-2 h-4 w-4"}),"Delete Current"]})})]})]})]}),(0,t.jsx)(p.Button,{variant:"secondary",size:"icon",className:"h-7 w-7 shadow-sm",onClick:()=>{let e=`storyboard-${f+1}.jpg`;nb(v.image_url,e)},children:(0,t.jsx)(i4.Download,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(p.Button,{variant:"destructive",size:"icon",className:"h-7 w-7 shadow-sm",onClick:()=>{g(f),m(!0)},children:(0,t.jsx)(i8.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(i7.Dialog,{open:u,onOpenChange:m,children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(i7.DialogHeader,{children:(0,t.jsx)(i7.DialogTitle,{children:s?.ui?.deleteImageTitle||"Delete Image"})}),(0,t.jsx)("div",{className:"space-y-3 text-sm text-muted-foreground",children:(0,t.jsx)("p",{children:s?.ui?.deleteImageConfirm||"Are you sure you want to delete this image?"})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(!1),children:s?.ui?.cancelButton||"Cancel"}),(0,t.jsx)(p.Button,{type:"button",size:"sm",variant:"destructive",onClick:()=>{null!==h&&(i(h),e.length<=1&&c(!1)),m(!1),g(null)},children:s?.ui?.delete||"Delete"})]})]})})]})}function nA({value:e,onCommit:r,className:i,readOnly:o}){let[s,n]=(0,a.useState)("");(0,a.useEffect)(()=>{n(n_(e))},[e]);let l=(0,a.useRef)(r);return(0,a.useEffect)(()=>{l.current=r},[r]),(0,a.useEffect)(()=>{if(o||s===n_(e))return;let t=setTimeout(()=>{l.current(s)},800);return()=>clearTimeout(t)},[s,e,o]),(0,t.jsx)(N.Textarea,{className:i,value:s,onChange:e=>n(e.target.value),readOnly:o,placeholder:null==e?"N/A":""})}let nT={toast:{copiedAll:"Copied all",copyFailed:"Copy failed, please try again",copiedFrame:"Copied prompt",copiedFrames:"Copied ${count} frames",imageGenerated:"Image${plural} generated successfully",failedToGenerateImage:"Failed to generate image",newImageGenerated:"New image generated and added",imageDeleted:"Image deleted",columnAdded:"Column added",columnDeleted:"Column deleted",excelExported:"Excel exported",failedToExportExcel:"Failed to export Excel. Please try again.",noFramesToExport:"No storyboard frames to export yet.",importSuccess:"Successfully imported: ${name}",importFailed:"Failed to import JSON file. Please try again.",invalidJson:"Invalid JSON format. Please check the file content.",invalidStructure:"Invalid JSON structure. Expected an object or array.",missingOutputs:"Missing required field: 'outputs'. The JSON must contain an 'outputs' array.",emptyOutputs:"The 'outputs' array cannot be empty.",invalidFileType:"Please select a JSON file",projectDeleted:"Project deleted",projectDeleteFailed:"Failed to delete project",noImagesToDownload:"No images to download.",imagesDownloaded:"Downloaded ${count} images",failedToDownloadImages:"Failed to download images. Please try again.",jsonExported:"JSON exported"},ui:{storyboardProject:"Project",selectProjectPlaceholder:"select a project",selectProjectMessage:"Please select a project to view details.",noProjectsMessage:"No projects yet. Import a JSON file or generate a new project.",summaryLabel:"Summary",sourceLabel:"Source: ${name}",editInfoButton:"Edit Info",list:"List",grid:"Grid",copyAll:"Copy all",allCopied:"All copied",copySelected:"Copy selected (${count})",preview:"Preview",edit:"Edit",jsonPreviewLabel:"Preview",downloadImages:"Download Images",exportExcel:"Export as Excel",exportJson:"Export as JSON",export:"Export",autoSaveLabel:"Auto-save to device",savedAt:"Saved ${time}",idHeader:"Id",imageHeader:"Image",storyboardHeader:"Storyboard",imagesCount:"${count} images",actionsHeader:"Actions",noDataMessage:"No structured data available for these clips.",noClipsMessage:"No clips generated for this result.",noImages:"No images",addBefore:"Add before",addAfter:"Add after",copy:"Copy",addRowBefore:"Add new row before",addRowAfter:"Add new row after",addColumnBefore:"Add column before",addColumnAfter:"Add column after",delete:"Delete",deleteCurrent:"Delete Current",deleteImageTitle:"Delete Image",deleteImageConfirm:"Are you sure you want to delete this image?",editProjectInfoTitle:"Edit Project Info",projectNameLabel:"Project Name",projectNamePlaceholder:"Enter project label",projectNameHelp:"This label helps you identify this project in your local storage",saveButton:"Save",cancelButton:"Cancel",addNewColumn:"add new column",willInsert:'will insert ${position} "${target}"',columnNameLabel:"column name *",columnNamePlaceholder:"e.g. scene_summary",defaultValueLabel:"default value (optional)",defaultValuePlaceholder:"leave empty if you want to leave it empty",confirmAdd:"confirm add",cancel:"cancel",storyboardImages:"Images (${count})",storyboardLabel:"Images",selectClip:"Select clip ${index}",fieldsLabel:"Fields",addField:"Add field",willAddToClip:"Add field to clip ${index}",importTitle:"Import",importDescription:"Import a JSON file to add a new Project",selectJson:"Select JSON",importing:"Importing..."},errors:{columnNameRequired:"Column name is required",columnNameExists:"Column name already exists"},placeholders:{na:"N/A"}};var nE=e.i(503499);let nR="storyboard:legacy-local-store-migration-done",nU=null;async function nP(){if("true"!==window.localStorage.getItem(nR)){if(nU)return nU;nU=nD();try{await nU}catch(e){throw nU=null,e}}}async function nD(){for(let e of(await nE.storyboardStorage.getAllResults())){if("migrated"===e.legacyMigrationStatus)continue;await i0.storyboardStorage.getResult(e.id)||await i0.storyboardStorage.upsertResult(e,e.outputs);let t={legacyMigrationStatus:"migrated",legacyMigratedAt:Date.now(),legacyMigratedTo:"local-store"};await nE.storyboardStorage.updateResult(e.id,t)}window.localStorage.setItem(nR,"true")}var nz=e.i(736783);let nF=en.z.custom(e=>null==e||e instanceof File||e instanceof Blob||"string"==typeof e,{message:"Expected a file, a blob, or a string"}),nM=en.z.object({control_files:en.z.array(nF).max(1,"Maximum 1 file allowed").default([]).optional().describe("Control video file"),output_template:en.z.string().optional(),user:en.z.string().max(1200,"Content cannot exceed 1200 characters").optional().describe("User prompt"),meta_data:en.z.any().optional().describe("Meta data"),lang_preference:en.z.string().default("English").optional().describe("Language preference")}).superRefine((e,t)=>
275{let a,r;"string"==typeof(a=e.user)&&a.trim().length>0||Array.isArray(r=e.control_files)&&r.some(e=>"string"==typeof e?e.trim().length>0:e instanceof File||e instanceof Blob)||t.addIssue({code:en.z.ZodIssueCode.custom,path:["user"],message:"Please enter instructions text or upload a video to analyze."})});var nO=e.i(857990),nB=e.i(878449),nL=e.i(50716),nq=e.i(527069),n$="ScrollArea",[nV,nW]=(0,oP.createContextScope)(n$),[nH,nG]=nV(n$),nK=a.forwardRef((e,r)=>{let{__scopeScrollArea:i,type:o="hover",dir:s,scrollHideDelay:n=600,...l}=e,[d,c]=a.useState(null),[p,u]=a.useState(null),[m,h]=a.useState(null),[g,f]=a.useState(null),[v,y]=a.useState(null),[b,w]=a.useState(0),[x,_]=a.useState(0),[k,S]=a.useState(!1),[j,C]=a.useState(!1),I=(0,oU.useComposedRefs)(r,e=>c(e)),N=(0,nB.useDirection)(s);return(0,t.jsx)(nH,{scope:i,type:o,dir:N,scrollHideDelay:n,scrollArea:d,viewport:p,onViewportChange:u,content:m,onContentChange:h,scrollbarX:g,onScrollbarXChange:f,scrollbarXEnabled:k,onScrollbarXEnabledChange:S,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:j,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:_,children:(0,t.jsx)(oq.Primitive.div,{dir:N,...l,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});nK.displayName=n$;var nJ="ScrollAreaViewport",nY=a.forwardRef((e,r)=>{let{__scopeScrollArea:i,children:o,nonce:s,...n}=e,l=nG(nJ,i),d=a.useRef(null),c=(0,oU.useComposedRefs)(r,d,l.onViewportChange);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),(0,t.jsx)(oq.Primitive.div,{"data-radix-scroll-area-viewport":"",...n,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,t.jsx)("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});nY.displayName=nJ;var nZ="ScrollAreaScrollbar",nX=a.forwardRef((e,r)=>{let{forceMount:i,...o}=e,s=nG(nZ,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:l}=s,d="horizontal"===e.orientation;return a.useEffect(()=>(d?n(!0):l(!0),()=>{d?n(!1):l(!1)}),[d,n,l]),"hover"===s.type?(0,t.jsx)(nQ,{...o,ref:r,forceMount:i}):"scroll"===s.type?(0,t.jsx)(n0,{...o,ref:r,forceMount:i}):"auto"===s.type?(0,t.jsx)(n1,{...o,ref:r,forceMount:i}):"always"===s.type?(0,t.jsx)(n2,{...o,ref:r}):null});nX.displayName=nZ;var nQ=a.forwardRef((e,r)=>{let{forceMount:i,...o}=e,s=nG(nZ,e.__scopeScrollArea),[n,l]=a.useState(!1);return a.useEffect(()=>{let e=s.scrollArea,t=0;if(e){let a=()=>{window.clearTimeout(t),l(!0)},r=()=>{t=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return e.addEventListener("pointerenter",a),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",a),e.removeEventListener("pointerleave",r)}}},[s.scrollArea,s.scrollHideDelay]),(0,t.jsx)(oL.Presence,{present:i||n,children:(0,t.jsx)(n1,{"data-state":n?"visible":"hidden",...o,ref:r})})}),n0=a.forwardRef((e,r)=>{var i;let{forceMount:o,...s}=e,n=nG(nZ,e.__scopeScrollArea),l="horizontal"===e.orientation,d=lc(()=>p("SCROLL_END"),100),[c,p]=(i={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},a.useReducer((e,t)=>i[e][t]??e,"hidden"));return a.useEffect(()=>{if("idle"===c){let e=window.setTimeout(()=>p("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,n.scrollHideDelay,p]),a.useEffect(()=>{let e=n.viewport,t=l?"scrollLeft":"scrollTop";if(e){let a=e[t],r=()=>{let r=e[t];a!==r&&(p("SCROLL"),d()),a=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[n.viewport,l,p,d]),(0,t.jsx)(oL.Presence,{present:o||"hidden"!==c,children:(0,t.jsx)(n2,{"data-state":"hidden"===c?"hidden":"visible",...s,ref:r,onPointerEnter:(0,oR.composeEventHandlers)(e.onPointerEnter,()=>p("POINTER_ENTER")),onPointerLeave:(0,oR.composeEventHandlers)(e.onPointerLeave,()=>p("POINTER_LEAVE"))})})}),n1=a.forwardRef((e,r)=>{let i=nG(nZ,e.__scopeScrollArea),{forceMount:o,...s}=e,[n,l]=a.useState(!1),d="horizontal"===e.orientation,c=lc(()=>
275{if(i.viewport){let e=i.viewport.offsetWidth<i.viewport.scrollWidth,t=i.viewport.offsetHeight<i.viewport.scrollHeight;l(d?e:t)}},10);return lp(i.viewport,c),lp(i.content,c),(0,t.jsx)(oL.Presence,{present:o||n,children:(0,t.jsx)(n2,{"data-state":n?"visible":"hidden",...s,ref:r})})}),n2=a.forwardRef((e,r)=>{let{orientation:i="vertical",...o}=e,s=nG(nZ,e.__scopeScrollArea),n=a.useRef(null),l=a.useRef(0),[d,c]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=lo(d.viewport,d.content),u={...o,sizes:d,onSizesChange:c,hasThumb:!!(p>0&&p<1),onThumbChange:e=>n.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function m(e,t){return function(e,t,a,r="ltr"){let i=ls(a),o=t||i/2,s=a.scrollbar.paddingStart+o,n=a.scrollbar.size-a.scrollbar.paddingEnd-(i-o),l=a.content-a.viewport;return ll([s,n],"ltr"===r?[0,l]:[-1*l,0])(e)}(e,l.current,d,t)}return"horizontal"===i?(0,t.jsx)(n3,{...u,ref:r,onThumbPositionChange:()=>{if(s.viewport&&n.current){let e=ln(s.viewport.scrollLeft,d,s.dir);n.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollLeft=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollLeft=m(e,s.dir))}}):"vertical"===i?(0,t.jsx)(n4,{...u,ref:r,onThumbPositionChange:()=>{if(s.viewport&&n.current){let e=ln(s.viewport.scrollTop,d);n.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollTop=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollTop=m(e))}}):null}),n3=a.forwardRef((e,r)=>{let{sizes:i,onSizesChange:o,...s}=e,n=nG(nZ,e.__scopeScrollArea),[l,d]=a.useState(),c=a.useRef(null),p=(0,oU.useComposedRefs)(r,c,n.onScrollbarXChange);return a.useEffect(()=>{c.current&&d(getComputedStyle(c.current))},[c]),(0,t.jsx)(n8,{"data-orientation":"horizontal",...s,ref:p,sizes:i,style:{bottom:0,left:"rtl"===n.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===n.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ls(i)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,a)=>{if(n.viewport){var r,i;let o=n.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),r=o,i=a,r>0&&r<i&&t.preventDefault()}},onResize:()=>{c.current&&n.viewport&&l&&o({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:li(l.paddingLeft),paddingEnd:li(l.paddingRight)}})}})}),n4=a.forwardRef((e,r)=>{let{sizes:i,onSizesChange:o,...s}=e,n=nG(nZ,e.__scopeScrollArea),[l,d]=a.useState(),c=a.useRef(null),p=(0,oU.useComposedRefs)(r,c,n.onScrollbarYChange);return a.useEffect(()=>{c.current&&d(getComputedStyle(c.current))},[c]),(0,t.jsx)(n8,{"data-orientation":"vertical",...s,ref:p,sizes:i,style:{top:0,right:"ltr"===n.dir?0:void 0,left:"rtl"===n.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ls(i)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,a)=>{if(n.viewport){var r,i;let o=n.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),r=o,i=a,r>0&&r<i&&t.preventDefault()}},onResize:()=>{c.current&&n.viewport&&l&&o({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:li(l.paddingTop),paddingEnd:li(l.paddingBottom)}})}})}),[n5,n6]=nV(nZ),n8=a.forwardRef((e,r)=>{let{__scopeScrollArea:i,sizes:o,hasThumb:s,onThumbChange:n,onThumbPointerUp:l,onThumbPointerDown:d,onThumbPositionChange:c,onDragScroll:p,onWheelScroll:u,onResize:m,...h}=e,g=nG(nZ,i),[f,v]=a.useState(null),y=(0,oU.useComposedRefs)(r,e=>v(e)),b=a.useRef(null),w=a.useRef(""),x=g.viewport,_=o.content-o.viewport,k=(0,nO.useCallbackRef)(u),S=(0,nO.useCallbackRef)(c),j=lc(m,10);function C(e){b.current&&p({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return a.useEffect(()=>{let e=e=>{let t=e.target;f?.contains(t)&&k(e,_)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,f,_,k]),a.useEffect(S,[o,S]),lp(f,j),lp(g.content,j),(0,t.jsx)(n5,{scope:i,scrollbar:f,hasThumb:s,onThumbChange:(0,nO.useCallbackRef)(n),onThumbPointerUp:(0,nO.useCallbackRef)(l),onThumbPositionChange:S,onThumbPointerDown:(0,nO.useCallbackRef)(d),children:(0,t.jsx)(oq.Primitive.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:(0,oR.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),b.current=f.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),C(e))}),onPointerMove:(0,oR.composeEventHandlers)(e.onPointerMove,C),onPointerUp:(0,oR.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,g.viewport&&(g.viewport.style.scrollBehavior=""),b.current=null})})})}),n9="ScrollAreaThumb",n7=a.forwardRef((e,a)=>{let{forceMount:r,...i}=e,o=n6(n9,e.__scopeScrollArea);return(0,t.jsx)(oL.Presence,{present:r||o.hasThumb,children:(0,t.jsx)(le,{ref:a,...i})})}),le=a.forwardRef((e,r)=>{let{__scopeScrollArea:i,style:o,...s}=e,n=nG(n9,i),l=n6(n9,i),{onThumbPositionChange:d}=l,c=(0,oU.useComposedRefs)(r,e=>l.onThumbChange(e)),p=a.useRef(void 0),u=lc(()=>{p.current&&(p.current(),p.current=void 0)},100);return a.useEffect(()=>{let e=n.viewport;if(e){let t=()=>{u(),p.current||(p.current=ld(e,d),d())};return d(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[n.viewport,u,d]),(0,t.jsx)(oq.Primitive.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:(0,oR.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),a=e.clientX-t.left,r=e.clientY-t.top;l.onThumbPointerDown({x:a,y:r})}),onPointerUp:(0,oR.composeEventHandlers)(e.onPointerUp,l.onThumbPointerUp)})});n7.displayName=n9;var lt="ScrollAreaCorner",la=a.forwardRef((e,a)=>{let r=nG(lt,e.__scopeScrollArea),i=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&i?(0,t.jsx)(lr,{...e,ref:a}):null});la.displayName=lt;var lr=a.forwardRef((e,r)=>{let{__scopeScrollArea:i,...o}=e,s=nG(lt,i),[n,l]=a.useState(0),[d,c]=a.useState(0),p=!!(n&&d);return lp(s.scrollbarX,()=>{let e=s.scrollbarX?.offsetHeight||0;
275s.onCornerHeightChange(e),c(e)}),lp(s.scrollbarY,()=>{let e=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(e),l(e)}),p?(0,t.jsx)(oq.Primitive.div,{...o,ref:r,style:{width:n,height:d,position:"absolute",right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:0,...e.style}}):null});function li(e){return e?parseInt(e,10):0}function lo(e,t){let a=e/t;return isNaN(a)?0:a}function ls(e){let t=lo(e.viewport,e.content),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-a)*t,18)}function ln(e,t,a="ltr"){let r=ls(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,n=(0,nq.clamp)(e,"ltr"===a?[0,s]:[-1*s,0]);return ll([0,s],[0,o-r])(n)}function ll(e,t){return a=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(a-e[0])}}var ld=(e,t=()=>{})=>{let a={left:e.scrollLeft,top:e.scrollTop},r=0;return!function i(){let o={left:e.scrollLeft,top:e.scrollTop},s=a.left!==o.left,n=a.top!==o.top;(s||n)&&t(),a=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function lc(e,t){let r=(0,nO.useCallbackRef)(e),i=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(i.current),[]),a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(r,t)},[r,t])}function lp(e,t){let a=(0,nO.useCallbackRef)(t);(0,nL.useLayoutEffect)(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(a)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,a])}function lu({className:e,children:a,...r}){return(0,t.jsxs)(nK,{"data-slot":"scroll-area",className:(0,ei.cn)("relative",e),...r,children:[(0,t.jsx)(nY,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:a}),(0,t.jsx)(lm,{}),(0,t.jsx)(la,{})]})}function lm({className:e,orientation:a="vertical",...r}){return(0,t.jsx)(nX,{"data-slot":"scroll-area-scrollbar",orientation:a,className:(0,ei.cn)("flex touch-none p-px transition-colors select-none","vertical"===a&&"h-full w-2.5 border-l border-l-transparent","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:(0,t.jsx)(n7,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function lh({fields:e,className:a}){return e&&0!==e.length?(0,t.jsx)("div",{className:(0,ei.cn)("rounded-md border bg-muted/30",a),children:(0,t.jsx)(lu,{className:"max-h-[300px] w-full rounded-md p-4 overflow-y-auto",children:(0,t.jsxs)("div",{className:"font-mono text-sm space-y-1",children:[(0,t.jsx)("div",{className:"text-muted-foreground",children:"{"}),(0,t.jsx)("div",{className:"pl-4 space-y-4",children:e.map((e,a)=>(0,t.jsxs)("div",{className:"group flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsxs)("span",{className:"font-semibold text-foreground text-primary",children:[e.key,":"]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground font-normal",children:e.type}),e.optional&&(0,t.jsx)(ae.Badge,{variant:"outline",className:"text-[10px] h-5 px-1.5 py-0 font-normal text-muted-foreground border-muted-foreground/40",children:"Optional"})]}),e.description&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground/80 pl-2 border-l-2 border-primary/20 ml-1",children:e.description})]},`${e.key}-${a}`))}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"}"})]})})}):(0,t.jsx)("div",{className:(0,ei.cn)("rounded-md border border-dashed p-8 text-center text-muted-foreground",a),children:"No fields defined"})}let lg=(e={})=>({key:"",type:"string",optional:!1,description:"",clientId:void 0!==globalThis.crypto&&"function"==typeof globalThis.crypto.randomUUID?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2,10),...e});function lf({open:e,onClose:r,onSave:i,editingTemplate:o}){let{t:s}=(0,oA.useTranslation)(),n=s("app/generator:storyboard-template-dialog",{returnObjects:!0})||lv,[l,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(O.DEFAULT_STORYBOARD_FIELDS.map(e=>lg(e))),[m,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(o?(d(o.name),u(o.fields.map(e=>lg(e)))):(d(""),u(O.DEFAULT_STORYBOARD_FIELDS.map(e=>lg(e)))),h(null))},[e,o]);let g=(0,a.useMemo)(()=>c.map(({clientId:e,...t})=>({...t,key:(e=>{if(!e)return"";let t=e.replace(/[^a-zA-Z0-9_]/g,"_");return/^[0-9]/.test(t)&&(t="_"+t),t})(t.key.trim()),description:t.description?.trim()||void 0})),[c]),f=(e,t)=>{u(a=>a.map(a=>a.clientId===e?{...a,...t}:a))};return(0,t.jsx)(i7.Dialog,{open:e,onOpenChange:e=>e?void 0:r(),children:(0,t.jsxs)(i7.DialogContent,{className:"sm:max-w-[80vw] md:max-w-4xl max-h-[75vh] md:max-h-[85vh] overflow-y-auto w-full",children:[(0,t.jsx)(i7.DialogHeader,{className:"px-6 pt-6 pb-2",children:(0,t.jsx)(i7.DialogTitle,{children:o?n?.ui?.editTemplateTitle||"Edit Storyboard Template":n?.ui?.addTemplateTitle||"Add Template"})}),(0,t.jsxs)("div",{className:"w-full space-y-4 overflow-y-auto px-4 pb-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:n?.ui?.templateNameLabel||"Template name"}
275),(0,t.jsx)(H.Input,{value:l,onChange:e=>d(e.target.value),placeholder:n?.ui?.templateNamePlaceholder||"e.g. Timestamped"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:n?.ui?.jsonSchemaPreview||"JSON schema preview"}),(0,t.jsx)(lh,{fields:g})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:n?.ui?.fieldsLabel||"Fields"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n?.ui?.fieldsDescription||"Invalid characters in keys will be replaced with underscores (Max: 12 fields)"})]}),(0,t.jsx)(p.Button,{type:"button",size:"sm",onClick:()=>{u(e=>e.length>=12?(h(n?.errors?.maxFieldsReached||"Maximum 12 fields allowed"),e):[...e,lg({key:`field_${e.length+1}`})])},disabled:c.length>=12,children:n?.ui?.addFieldButton||"Add field"})]}),(0,t.jsxs)("div",{className:"space-y-3 ",children:[c.map(e=>(0,t.jsxs)("div",{className:"rounded-md border p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n?.ui?.fieldKeyLabel||"Field key"}),(0,t.jsx)(H.Input,{value:e.key,onChange:t=>f(e.clientId,{key:t.target.value}),placeholder:n?.ui?.fieldKeyPlaceholder||"sceneDescription"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n?.ui?.typeLabel||"Type"}),(0,t.jsxs)("select",{className:"w-full rounded-md border px-2 py-1 text-sm",value:e.type,onChange:t=>f(e.clientId,{type:t.target.value}),children:[(0,t.jsx)("option",{value:"string",children:n?.ui?.stringOption||"string"}),(0,t.jsx)("option",{value:"number",children:n?.ui?.numberOption||"number"})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(Y.Checkbox,{checked:e.optional,onCheckedChange:t=>f(e.clientId,{optional:!!t})}),n?.ui?.optionalLabel||"Optional"]}),"number"===e.type&&(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)(Y.Checkbox,{checked:e.integer??!1,onCheckedChange:t=>f(e.clientId,{integer:!!t})}),n?.ui?.integerOnlyLabel||"Integer-only"]}),"number"===e.type&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:n?.ui?.minLabel||"Min"}),(0,t.jsx)(H.Input,{type:"number",className:"w-full",value:e.minValue??"",onChange:t=>f(e.clientId,{minValue:""===t.target.value?void 0:Number(t.target.value)})})]}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>{var t;return t=e.clientId,void u(e=>e.filter(e=>e.clientId!==t))},children:n?.ui?.removeButton||"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n?.ui?.descriptionLabel||"Description"}),(0,t.jsx)(N.Textarea,{value:e.description??"",onChange:t=>f(e.clientId,{description:t.target.value}),rows:2,placeholder:n?.ui?.descriptionPlaceholder||"Explain what the model should capture"})]})]},e.clientId)),0===c.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n?.ui?.noFieldsMessage||"No fields yet. Add at least one field to define the schema."})]})]}),m&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:m})]}),(0,t.jsxs)(i7.DialogFooter,{className:"gap-2 border-t px-6 py-4",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",onClick:r,children:n?.ui?.cancelButton||"Cancel"}),(0,t.jsx)(p.Button,{type:"button",onClick:()=>{if(!l.trim())return void h(n?.errors?.templateNameRequired||"Template name is required");if(0===g.length)return void h(n?.errors?.atLeastOneField||"Add at least one field to define the schema");if(g.length>12)return void h(n?.errors?.maxFieldsReached||"Maximum 12 fields allowed");let e=new Set;for(let t of g){if(!t.key)return void h(n?.errors?.fieldKeyRequired||"Every field needs a key");if(e.has(t.key))return void h(n?.errors?.duplicateFieldKey?.replace("${key}",t.key)||`Field key "${t.key}" is duplicated`);e.add(t.key)}h(null),i(l.trim(),g,o?.id)},children:o?n?.ui?.updateTemplateButton||"Update template":n?.ui?.saveTemplateButton||"Save template"})]})]})})}let lv={ui:{editTemplateTitle:"Edit Storyboard Template",addTemplateTitle:"Add Template",templateNameLabel:"Template name",templateNamePlaceholder:"e.g. Timestamped",jsonSchemaPreview:"JSON schema preview",fieldsLabel:"Fields",fieldsDescription:"Invalid characters in keys will be replaced with underscores (Max: 12 fields)",addFieldButton:"Add field",fieldKeyLabel:"Field key",fieldKeyPlaceholder:"sceneDescription",typeLabel:"Type",stringOption:"string",numberOption:"number",optionalLabel:"Optional",integerOnlyLabel:"Integer-only",minLabel:"Min",removeButton:"Remove",descriptionLabel:"Description",descriptionPlaceholder:"Explain what the model should capture",noFieldsMessage:"No fields yet. Add at least one field to define the schema.",cancelButton:"Cancel",updateTemplateButton:"Update template",saveTemplateButton:"Save template"},errors:{maxFieldsReached:"Maximum 12 fields allowed",templateNameRequired:"Template name is required",atLeastOneField:"Add at least one field to define the schema",fieldKeyRequired:"Every field needs a key",duplicateFieldKey:'Field key "${key}" is duplicated'}};var ly=e.i(191700),lb=e.i(606869);let lw=(0,r.default)("arrow-big-right-dash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]),lx=(0,r.default)("arrow-big-down-dash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]),l_=({data:e})=>e?(0,t.jsx)("section",{className:"bg-gradient-to-b from-background to-muted/30",children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-16 md:px-6 md:py-20",children:[(0,t.jsxs)("div",{className:"text-center mb-12",children:[(0,t.jsx)("h2",{className:"text-3xl md:text-4xl lg:text-5xl text-foreground mb-4",children:e.title}
275),e.description&&(0,t.jsx)("div",{className:"max-w-3xl mx-auto space-y-2",children:e.description.map((e,a)=>(0,t.jsx)("p",{className:"text-lg text-muted-foreground",children:e},a))})]}),e.image_urls&&e.image_urls.length>0&&(0,t.jsx)("div",{className:"flex justify-center mb-16",children:(0,t.jsx)("div",{className:"w-full max-w-2xl rounded-2xl overflow-hidden shadow-2xl",children:e.image_urls.length>1?(0,t.jsx)(lb.ReactCompareSlider,{itemOne:(0,t.jsx)(lb.ReactCompareSliderImage,{src:e.image_urls[0],alt:"Before",className:"rounded-2xl"}),itemTwo:(0,t.jsx)(lb.ReactCompareSliderImage,{src:e.image_urls[1],alt:"After",className:"rounded-2xl"})}):(0,t.jsx)("img",{src:e.image_urls[0],alt:"Feature showcase",className:"w-full h-auto object-cover rounded-2xl"})})}),e.steps&&e.steps.length>0&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"block md:hidden space-y-6",children:e.steps?.map((a,r)=>(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-full max-w-sm bg-card rounded-2xl border shadow-lg p-6 text-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 bg-primary text-primary-foreground rounded-full flex items-center justify-center text-xl font-bold",children:a.number}),(0,t.jsx)("p",{className:"text-xl font-semibold text-foreground",children:a.title}),a.description&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a.description}),a.image_urls&&a.image_urls.length>0&&(0,t.jsx)("div",{className:"w-full mt-4",children:a.image_urls.length>1?(0,t.jsx)("div",{className:"rounded-lg overflow-hidden",children:(0,t.jsx)(lb.ReactCompareSlider,{itemOne:(0,t.jsx)(lb.ReactCompareSliderImage,{src:a.image_urls[1],alt:"Before",className:"rounded-lg"}),itemTwo:(0,t.jsx)(lb.ReactCompareSliderImage,{src:a.image_urls[0],alt:"After",className:"rounded-lg"})})}):(0,t.jsx)("img",{src:a.image_urls[0],alt:`Step ${a.number}`,className:"w-full h-auto object-cover rounded-lg"})})]})}),r<(e.steps?.length??0)-1&&(0,t.jsx)("div",{className:"my-3",children:(0,t.jsx)(lx,{className:"w-6 h-6 text-primary"})})]},a.number))}),(0,t.jsx)("div",{className:"hidden md:block",children:(0,t.jsx)("div",{className:"flex flex-col items-center gap-2 w-full",children:Array.from({length:Math.ceil((e.steps?.length??0)/3)}).map((r,i)=>{let o=3*i,s=Math.min(o+3,e.steps?.length??0),n=e.steps?.slice(o,s)??[],l=i===Math.ceil((e.steps?.length??0)/3)-1,d=l&&n.length<3;return(0,t.jsxs)(a.default.Fragment,{children:[(0,t.jsx)("div",{className:(0,ei.cn)("flex items-center w-full max-w-6xl mx-auto",d?"justify-center gap-6":"justify-between gap-4"),children:n.map((e,r)=>(0,t.jsxs)(a.default.Fragment,{children:[(0,t.jsx)("div",{className:(0,ei.cn)("flex-1 min-w-0",d?"max-w-sm":"max-w-xs"),children:(0,t.jsx)("div",{className:"bg-card rounded-2xl border shadow-lg p-6 text-center h-full flex flex-col",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-4 flex-grow",children:[(0,t.jsx)("div",{className:"w-12 h-12 bg-primary text-primary-foreground rounded-full flex items-center justify-center text-xl font-bold",children:e.number}),(0,t.jsx)("p",{className:"text-xl font-semibold text-foreground",children:e.title}),e.description&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed flex-grow",children:e.description}),e.image_urls&&e.image_urls.length>0&&(0,t.jsx)("div",{className:"w-full mt-4",children:e.image_urls.length>1?(0,t.jsx)("div",{className:"rounded-lg overflow-hidden",children:(0,t.jsx)(lb.ReactCompareSlider,{itemOne:(0,t.jsx)(lb.ReactCompareSliderImage,{src:e.image_urls[1],alt:"Before",className:"rounded-lg"}),itemTwo:(0,t.jsx)(lb.ReactCompareSliderImage,{src:e.image_urls[0],alt:"After",className:"rounded-lg"})})}):(0,t.jsx)("img",{src:e.image_urls[0],alt:`Step ${e.number}`,className:"w-full h-auto object-cover rounded-lg"})})]})})}),!d&&r<n.length-1&&(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)(lw,{className:"w-6 h-6 text-primary"})})]},e.number))}),!l&&(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)(lx,{className:"w-6 h-6 text-primary"})})]},i)})})})]})]})}):null,lk=[{label:"English",value:"English-en"},{label:"䏿(Chinese)",value:"䏿(simplified Chinese)-zh"},{label:"ç¹é«ä¸æ(Traditional Chinese)",value:"ç¹é«ä¸æ(Traditional Chinese)-tw"},{label:"Español(Spanish)",value:"Español(Spanish)-es"},{label:"æ¥æ¬èª(Japanese)",value:"æ¥æ¬èª(Japanese)-ja"},{label:"íêµì´(Korean)",value:"íêµì´(Korean)-ko"},{label:"Deutsch(German)",value:"Deutsch(German)-de"},{label:"Français(French)",value:"Français(French)-fr"},{label:"Polski(Polish)",value:"Polski(Polish)-pl"},{label:"عربÙ(Arabic)",value:"عربÙ(Arabic)-ar"},{label:"Português(Portuguese)",value:"Português(Portuguese)-pt"},{label:"বাà¦à¦²à¦¾(Bengali)",value:"বাà¦à¦²à¦¾(Bengali)-bn"},{label:"Ð ÑÑÑкий(Russian)",value:"Ð ÑÑÑкий(Russian)-ru"},{label:"ਪੰà¨à¨¾à¨¬à©(Punjabi)",value:"ਪੰà¨à¨¾à¨¬à©(Punjabi)-pa"},{label:"RomânÄ(Romanian)",value:"RomânÄ(Romanian)-ro"},{label:"Jawa(Javanese)",value:"Jawa(Javanese)-jv"},{label:"Türkçe(Turkish)",value:"Türkçe(Turkish)-tr"},{label:"Italiano(Italian)",value:"Italiano(Italian)-it"}],lS=O.BUILTIN_STORYBOARD_TEMPLATES,lj=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),lC=e=>{if(!lj(e))return null;let t=e.key;if("string"!=typeof t)return null;let a=t.trim();if(!a)return null;let r="number"===e.type?"number":"string",i="string"==typeof e.description&&e.description.trim().length>0?e.description.trim():void 0,o={key:a,type:r,optional:"boolean"==typeof e.o
275ptional?e.optional:!!e.optional,description:i};if("number"===r){let t=void 0===e.integer?void 0:"boolean"==typeof e.integer?e.integer:!!e.integer;void 0!==t&&(o.integer=t),"number"==typeof e.minValue&&Number.isFinite(e.minValue)&&(o.minValue=e.minValue)}return o},lI=e=>{if(!lj(e))return null;let{id:t,name:a,fields:r}=e;if("string"!=typeof t||"string"!=typeof a||!Array.isArray(r))return null;let i=r.map(lC).filter(e=>!!e);return{id:t.trim(),name:a.trim(),fields:i,builtin:"boolean"==typeof e.builtin?e.builtin:void 0,createdAt:"number"==typeof e.createdAt&&Number.isFinite(e.createdAt)?e.createdAt:void 0}},lN=new Map,lA={toast:{uploadBeforeGenerating:"Upload a video before generating.",templateCannotBeEmpty:"Prompt template cannot be empty.",trimFile:"Media is ${duration}s (> ${maxDuration}s). Please trim before uploading.",fileAdded:"Media file added",failedToProcessMedia:"Failed to process media file",trimmedMediaAdded:"Trimmed media added",generationComplete:"Generation complete",generationFailed:"Generation failed. Please try again later.",processMediaError:"Please wait for the current generation to complete before uploading a new video.",freeTierUsage:"free tier usage",templateDeleted:"Template deleted",templateUpdated:"Template updated",templateSaved:"Template saved",projectInfoUpdated:"Project info updated"},ui:{pageTitle:"Video Analysis",pageDescription:"Upload a video, tweak the template, then generate ready-to-use storyboards.",projectLabel:"Project",selectProjectPlaceholder:"Select project",newProject:"New Project",uploadVideoLabel:"Upload video",instructionsLabel:"Instructions or idea",instructionsPlaceholder:"Add any scene notes, constraints, or narration goals",outputLanguageLabel:"Output Language",outputLanguagePlaceholder:"Select output language",storyboardTemplateLabel:"Storyboard template",addTemplate:"Add Template",selectTemplatePlaceholder:"Select prompt template",templatePreviewLabel:"Template preview",templateNote:'Use "Add Template" to customize fields; the generated JSON schema is read-only here to reduce mistakes.',generateButton:"Generate",generating:"Generating...",creditsCost:"${credits} credits cost",generatedResultsTitle:"Projects",resultsPlaceholder:"Projects will appear here.",processingVideo:"Processing video...",ignored:"Ignored",unsupported:"Unsupported"},errors:{freeTierLimit:"Free tier uploads are limited to this file size and duration. Upgrade to upload larger files.",uploadFailed:"Failed to upload video, please try again.",activationFailed:"Failed to upload and activate video.",creditsCalculationFailed:"Unable to calculate credits for this video.",creditDeductionFailed:"Failed to deduct credits.",fileTypeNotAllowed:"Only mp4, mov, avi video files are allowed",fileSizeExceeded:"File size exceeds ${maxSize}MB limit, try another file",noMediaToTrim:"No pending media to trim"},howToWork:{title:"How to Analyze & Recreate Viral Hooks",description:["Upload a viral video, let AI break it into storyboard clips, then copy prompts directly into the AI Generator to recreate any hook."],steps:[{number:1,title:"Upload Your Video",description:"Drop any short-form video (mp4 / mov / avi) from TikTok, Instagram, or YouTube into the upload zone. Use the trim tool to cut the clip down if needed."},{number:2,title:"Add Instructions (Optional)",description:'Describe your focus in the instructions box â e.g. "focus on the hook opening" or "extract the visual transition style" â to guide the AI analysis.'},{number:3,title:"Choose a Storyboard Template",description:"Select a built-in template or create a custom one with 'Add Template'. The template defines the fields the AI will fill in for each clip (prompt, shot type, pacing, etc.)."},{number:4,title:"Generate Storyboard",description:"Click Generate. The AI analyzes the full video and splits it into timestamped storyboard clips â a 30 s video may produce 4â8 segments, each with its own detailed prompt."},{number:5,title:"Select the Clips You Need",description:"Check the clips that cover the hook you want to recreate. For example, to recreate the first 5â10
275seconds, select only the matching early segments."},{number:6,title:"Copy Selected Prompts",description:"Click 'Copy Selected Prompts' on the storyboard panel. This copies the AI-generated video prompts from your chosen clips to the clipboard."},{number:7,title:"Paste into AI Generator",description:"Open the AI Generator, paste the copied prompt into the video generation input box, pick an AI video model, and hit Generate to recreate the hook."},{number:8,title:"Compare Across Models",description:"Try the same prompt with different AI video models to find the style that best matches the original hook. Refine the prompt and repeat until you get the perfect result."}]}},lT=[{title:"Playground",icon:i,isActive:!0,panels:[{panel:"video-prompt",title:"Video Prompt",component:j.default},{panel:"video-storyboard",title:"Video Storyboard",component:function(e){let{results:r=[],selectedResultId:i,onResultsChange:o,onSelectedResultIdChange:s,selectedProjectId:n,onSelectedProjectIdChange:l,showProjectSelect:d=!0}=e,{setShowPriceModal:c,setShowLoginModal:u}=(0,h.useUserContext)(),{userProfile:m,consumeCredits:g}=(0,es.useUserResourceStore)(),f=(0,y.getUserProfilePlanCode)(m),b=(0,eo.useIsTablet)(),w=(0,V.useUserSettingStore)(e=>e.getSetting),x=(0,V.useUserSettingStore)(e=>e.setSetting),[_,k]=(0,a.useState)(lS),[S,j]=(0,a.useState)(!1),[W,H]=(0,a.useState)(null),G=lS[0],K=G?.id??"",J=(G?(0,O.templateToJsonSchemaString)(G):B)??B,{t:Y}=(0,oA.useTranslation)(),Z=Y("app/generator:video-to-storyboard",{returnObjects:!0})||lA,[X,Q]=(0,a.useState)(null),[ee,et]=(0,a.useState)(null),[ea,er]=(0,a.useState)(!1),ei={name:"control_files",label:"Video to Analyze",type:"video",isSupport:1},en=(0,C.useForm)({resolver:(0,nz.zodResolver)(nM),defaultValues:{control_files:[],user:"",output_template:J,meta_data:{templateId:K,duration:void 0},lang_preference:"English-en"},shouldUnregister:!1}),{getValues:el,setValue:ed}=en,ec=en.watch("meta_data.templateId")??K,ep=en.watch("control_files")??[],eu=Array.isArray(ep)&&ep[0]instanceof File?ep[0]:null,em=en.watch("user")??"",eh=!!eu||em.trim().length>0,[eg,ef]=(0,a.useState)(!1),ev="function"==typeof o,[ey,eb]=(0,a.useState)([]),[ew,ex]=(0,a.useState)(void 0),e_=ev?r:ey,ek=ev?o:eb,eS=Object.prototype.hasOwnProperty.call(e,"selectedResultId"),ej=eS?i:ew,eC=ej&&e_.some(e=>e.id===ej)?ej:void 0,eI=(0,a.useCallback)(async()=>{let e=await i0.storyboardStorage.getAllResults();return eb(e),ex(t=>{if(t&&e.some(e=>e.id===t))return t}),e},[]),eN=(0,a.useCallback)(e=>{""!==e&&(eS||ex(e),s?.(e))},[eS,s]),eA="new-project",[eT,eE]=(0,a.useState)(eA),eR="string"==typeof n&&"function"==typeof l,eU=eR?n:eT,eP=eU===eA||e_.some(e=>e.id===eU)?eU:eA,eD=(0,a.useCallback)(e=>{e&&(eR?l?.(e):eE(e))},[eR,l]),[ez,eF]=(0,a.useState)(null),[eM,eO]=(0,a.useState)(!1),[eB,eL]=(0,a.useState)(""),eq=(0,a.useCallback)(e=>{e&&(eD(e),e===eA?eN(void 0):eN(e))},[eA,eD,eN]);(0,a.useEffect)(()=>{if(ev)return;let e=!0,t=async()=>{try{if(await nP(),await eI(),!e)return}catch(e){console.error("Failed to load local projects",e)}};t();let a=(0,sL.subscribeLocalStoreChanges)(()=>{t()});return()=>{e=!1,a()}},[ev,eI]),(0,a.useEffect)(()=>{let e=w(O.STORYBOARD_TEMPLATES_STORAGE_KEY);Array.isArray(e)?k([...lS,...e.map(lI).filter(e=>!!e)]):k(lS)},[w]);let e$=(0,a.useCallback)(e=>{let t=e.filter(e=>!e.builtin);x(O.STORYBOARD_TEMPLATES_STORAGE_KEY,t,{persistent:!0,category:"video-storyboard",description:"Custom storyboard templates"})},[x]),eV=_.find(e=>e.id===ec)??_[0],eW=eV?.id??"",eH=ez&&!Number.isNaN(ez)?Number((.01*ez).toFixed(2)):0,eG=(0,y.isUserProfileActivePaid)(m);(0,a.useEffect)(()=>{let e=!1;return(async()=>{if(!eu)return eF(null);try{let{duration:t}=await (0,sz.extractVideoMetadata)(eu);if(e)return;eF(t??null);let a=el("meta_data")||{};ed("meta_data",{...a,duration:t},{shouldDirty:!1})}catch(t){console.error("Failed to read video metadata:",t),e||eF(null)}})(),()=>{e=!0}},[el,ed,eu]);let eK=(0,a.useCallback)(e=>{let t=_.find(t=>t.id===e);if(!t||t.builtin)return;let a=_.filter(t=>t.id!==e);if(k(a),e$(a),ec===e){let e=a[0]??lS[0];e?(en.setValue("meta_data.templateId",e.id,{shouldDirty:!1}),en.setValue("output_template",(0,O.templateToJsonSchemaString)(e),{shouldDirty:!1})):(en.setValue("meta_data.templateId","",{shouldDirty:!1}),en.setValue("output_template","",{shouldDirty:!1}))}v.toast.success(Z?.toast?.templateDeleted||"Template deleted")},[_,en,e$,ec]),eJ=(0,a.useCallback)((e,t,a)=>{if(a){let r=_.map(r=>r.id===a?{...r,name:e,fields:t}:r);if(k(r),e$(r),ec===a){let e=r.find(e=>e.id===a);e&&en.setValue("output_template",(0,O.templateToJsonSchemaString)(e),{shouldDirty:!0})}j(!1),H(null),v.toast.success(Z?.toast?.templateUpdated||"Template updated")}else{let a={id:`story-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,name:e,fields:t,builtin:!1,createdAt:Date.now()},r=[..._,a];k(r),e$(r),en.setValue("meta_data.templateId",a.id,{shouldDirty:!0}),en.setValue("output_template",(0,O.templateToJsonSchemaString)(a),{shouldDirty:!0}),j(!1),v.toast.success(Z?.toast?.templateSaved||"Template saved")}},[_,en,e$,ec]),eY=(0,a.useCallback)(()=>{H(null),j(!0)},[]),eZ=(0,a.useCallback)(e=>{H(e),j(!0)},[]),eX=(0,a.useCallback)(async e=>{let t=(Array.isArray(e.control_files)?e.control_files:[])[0],a=t instanceof File?t:null,r=e.user?.trim()??"",i=r.length>0,o=a instanceof File,s="https://file.videoprompt.online".replace(/\/+$/,"");if(Q(null),!i&&!o)return void v.toast.error("Please enter instructions text or upload a video before generating.");let n=(eV?(0,O.templateToJsonSchemaString)(eV):e.output_template??"").trim();if(!n)return void v.toast.error(Z?.toast?.templateCannotBeEmpty||"Prompt template cannot be empty.");ef(!0);try{let t,l=[i?`User instructions: 276${r}`:null,"Output format: json",`Prompt template: 277${n}`,`The returned content, such as video descriptions, should be in the specified language. ${e.lang_preference}`].filter(e=>"string"==typeof e),d=L(n);if(o&&a){let e;if(a.size,a.size>=0x3c00000||ez&&ez>30){let t,r=await (0,rI.computeFileHash)(a),i=lN?.get(r);if(i)t=i;else{let e=a.name.trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9._-]/g,""),i=`tmp_file_upload/${r}-${e}`,o=await (0,rC.uploadTmpFileToR2)(a,i);if(!o?.success)throw Error(o?.error||Z?.errors?.uploadFailed||"Failed to upload video, please try again.");t=(e=>{if(!e)throw Error("Upload result missing url/key");return/^https?:\/\//i.test(e)?e:`${s}/${String(e).replace(/^\/+/,"")}`})(o.data)}e=[t]}else e=await (0,$.convertVideo_to_base64)([a]);if(eG){if(m&&ez&&!(eH<=0)){if(!m.user.id)throw Error("No user data")}else throw Error(Z?.errors?.creditsCalculationFailed||"Unable to calculate credits for this video.");let e=await g({amount:eH,resourceType:"credit",sourceType:"video-to-prompt",sourceId:`storyboard-${Date.now()}`});if(!e?.success)throw Error(e.error||"User credits auth failed")}else{let e=(0,as.localFeatureRateLimit)("video-prompt-generator",3,24,!1,"You have exceeded your usage quota. Please upgrade to get credits for more generations.");if(!e.canGenerate)throw Error(e.message||"An error occurred while generating the description")}t=await (0,q.handleStudioBoardGenerator)(d,l,[],e)}else{let e=(0,M.buildIdeaToStoryboardJsonSystemPrompt)(n);t=await (0,q.handleIdeaToStoryboard)(e,l)}if(!t?.success)throw Error(Z?.toast?.generationFailed||"Generation failed. Please try again later.");let c=t?.data?.results,p=t?.data?.summary,u=Array.isArray(c)?c.map((e,t)=>e&&"object"==typeof e?e:{value:e,index:t+1}):[];try{let e=[];
277if(u.forEach((t,a)=>{if(t.time&&"string"==typeof t.time){let r=(0,sz.parseTimeStringToSeconds)(t.time);null!==r&&e.push({time:r,index:a})}}),e.length>0&&a instanceof File){let t=e.map(e=>e.time);(await (0,sz.extractVideoFramesAtTimes)({file:a,times:t})).forEach(t=>{e.filter(e=>.001>Math.abs(e.time-t.time)).map(e=>e.index).forEach(e=>{u[e]&&(u[e].meta_info||(u[e].meta_info={}),u[e].meta_info.storyboard_images||(u[e].meta_info.storyboard_images=[]),u[e].meta_info.storyboard_images.push({id:`auto-frame-${Date.now()}-${Math.random()}`,image_url:t.image,prompt:"Auto-extracted frame",createdAt:Date.now()}))})})}}catch(e){console.error("Failed to auto-extract frames:",e),v.toast.error("Failed to extract some video frames automatically.")}let h="string"==typeof p?p:void 0,f=`video-copy-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,y=a?.name||r.slice(0,40)||"Storyboard project",b=eV?.name??"Custom template",w=eP!==eA?e_.find(e=>e.id===eP):void 0;if(w){let e=[...Array.isArray(w.outputs)?w.outputs:[],...u],t={...w,outputs:e,summary:w.summary??h,label:w.label??y,templateName:w.templateName??b,videoName:w.videoName??a?.name},r=await i0.storyboardStorage.upsertResult(t);ek(e=>{let t=e.filter(e=>e.id!==w.id);return[r,...t]}),eN(w.id)}else{let e={id:f,label:y,outputs:u,summary:h,createdAt:Date.now(),outputFormat:"json",templateId:eV?.id??"custom",templateName:b,videoName:a?.name},t=await i0.storyboardStorage.upsertResult(e);ek(e=>[t,...e]),eD(e.id),eN(e.id)}v.toast.success(Z?.toast?.generationComplete||"Generation complete")}catch(t){let e=t instanceof Error?t.message:Z?.toast?.generationFailed||"Generation failed. Please try again later.";v.toast.error(e),Q(e)}finally{ef(!1)}},[eH,ez,eG,e_,eP,Z,eV,m,ek,eD,eN,g]),eQ=(0,a.useCallback)(async(e,t=ei)=>{let a,r;if(eg)return void v.toast.error(Z?.toast?.processMediaError||"Please wait for the current generation to complete before uploading a new video.");eL("");let i=(r={free:15,starter:300,pro:300,platinum:300,premium:300,ultra:300,default:15})[(f||"default").toLowerCase()]??r.default;if(e?.target&&e?.target?.files?a=e.target.files[0]:e&&e?.length>0&&(a=e[0]),!a)return;let o=a.name.toLowerCase();try{if(!(o.endsWith(".mp4")||o.endsWith(".mov")||o.endsWith(".avi")))throw Error(Z?.errors?.fileTypeNotAllowed||"Only mp4, mov, avi video files are allowed");let{duration:e}=await (0,sz.extractVideoMetadata)(a);e>i+.1&&v.toast.info(Z?.toast?.trimFile?.replace("${duration}",e.toFixed(2))?.replace("${maxDuration}",i.toString())||`Media is ${e.toFixed(2)}s (> ${i}s). Please trim before uploading.`),et({file:a,support:t,maxDuration:Math.min(e,i),maxFileSize:0x3c00000}),er(!0)}catch(e){console.error("Error processing media file:",e),v.toast.error(e?.message||Z?.toast?.failedToProcessMedia||"Failed to process media file")}finally{e?.target&&(e.target.value=""),eL("")}},[eg,f,Z]),e0=(0,a.useCallback)(()=>{er(!1),et(null)},[]),e1=(0,a.useCallback)(async e=>{if(!ee?.support)throw Error(Z?.errors?.noMediaToTrim||"No pending media to trim");let{support:t,maxFileSize:a}=ee,r=e;er(!1),et(null);try{let{width:i,height:o}=await (0,sz.extractVideoMetadata)(e);if((i>960||o>960||e.size>a)&&(eL(Z?.ui?.processingVideo||"Processing video..."),r=await (0,sz.compressVideoToMp4)({file:e,resolution:i>=o?{width:960}:{height:960},setMessage:eL})),r.size>a)throw Error(Z?.errors?.fileSizeExceeded?.replace("${maxSize}",(a/1024/1024).toString())||"File size exceeds "+a/1024/1024+"MB limit, try another file");en.setValue(t.name,[r]),en.trigger(t.name),v.toast.success(Z?.toast?.trimmedMediaAdded||"Trimmed media added")}catch(e){throw v.toast.error(e?.message||Z?.toast?.failedToProcessMedia||"Failed to process media file"),e}finally{eL("")}},[en,Z,ee]),e2=(e,t)=>{let a=e?.meta_info??{},r=t.meta_info;return{...e??{},...t,meta_info:r?{...a,...r,storyboard_images:r.storyboard_images??a.storyboard_images}:e?.meta_info}},e3=async(e,t,a)=>{let r=await i0.storyboardStorage.getResult(e);if(!r)return;let i=[...r.outputs];i[t]=e2(r.outputs[t],a),await i0.storyboardStorage.updateFrames(e,i,r.summary),await eI()},e4=async(e,t)=>{let a=await i0.storyboardStorage.getResult(e);if(!a)return;let r=t.map((e,t)=>e2(a.outputs[t],e));await i0.storyboardStorage.updateFrames(e,r,a.summary),await eI()},e5=(e,t,a)=>{ek(r=>r.map(r=>{if(r.id===e){let e=[...r.outputs];return e[t]=a,{...r,outputs:e}}return r})),e3(e,t,a)},e6=(e,t)=>{ek(a=>a.map(a=>a.id===e?{...a,outputs:t}:a)),e4(e,t)},e8=(e,t)=>
277{ek(a=>a.map(a=>a.id===e?{...a,...t}:a)),i0.storyboardStorage.updateResult(e,t).then(()=>eI()),v.toast.success(Z?.toast?.projectInfoUpdated||"Project info updated")},e9=e=>{ek(t=>{let a=t.filter(t=>t.id!==e);return eN(eC&&eC!==e?eC:a[0]?.id),a}),eP===e&&eD(eA),i0.storyboardStorage.deleteResult(e).then(()=>eI())};return(0,t.jsxs)("div",{className:"w-full flex flex-col items-stretch overflow-x-hidden px-4 py-6",children:[(0,t.jsxs)("div",{className:`w-full flex ${b?"flex-col":"flex-row"}`,children:[(0,t.jsx)("div",{className:` 278 w-full shrink-0 overflow-hidden 279 transition-[max-width,opacity] duration-300 ease-in-out 280 ${!b&&(eM?"max-w-0 opacity-0 pointer-events-none":"max-w-[480px] lg:max-w-[500px] opacity-100")} 281 `,children:(0,t.jsxs)("div",{className:b?"w-full":"w-[440px] lg:w-[480px]",children:[(0,t.jsx)(T.Form,{...en,children:(0,t.jsxs)("form",{onSubmit:en.handleSubmit(eX),className:"flex w-full flex-col gap-6 rounded-xl border bg-card p-6 shadow-sm",children:[d&&(0,t.jsxs)("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[(0,t.jsx)(A.Label,{className:"text-xs text-muted-foreground",children:Z?.ui?.projectLabel||"Project"}),(0,t.jsxs)(I.Select,{value:eP,onValueChange:eq,children:[(0,t.jsx)(I.SelectTrigger,{className:"w-full md:w-[220px]",children:(0,t.jsx)(I.SelectValue,{placeholder:Z?.ui?.selectProjectPlaceholder||"Select project"})}),(0,t.jsxs)(I.SelectContent,{children:[(0,t.jsx)(I.SelectItem,{value:eA,children:Z?.ui?.newProject||"New Project"}),e_.map(e=>(0,t.jsx)(I.SelectItem,{value:e.id,children:e.label??e.id},e.id))]})]})]}),(0,t.jsx)(T.FormField,{control:en.control,name:"user",render:({field:e})=>(0,t.jsxs)(T.FormItem,{className:"space-y-2",children:[(0,t.jsx)(T.FormLabel,{children:Z?.ui?.instructionsLabel||"Instructions or idea"}),(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(N.Textarea,{...e,rows:4,placeholder:Z?.ui?.instructionsPlaceholder||"Add any scene notes, constraints, or narration goals"})}),(0,t.jsx)(T.FormMessage,{})]})}),(0,t.jsx)(T.FormField,{control:en.control,name:"control_files",render:({field:e})=>(0,t.jsxs)(T.FormItem,{className:"w-full space-y-2",children:[(0,t.jsx)(T.FormLabel,{children:Z?.ui?.uploadVideoLabel||"Upload video"}),(0,t.jsx)(T.FormDescription,{className:"text-xs",children:Z?.ui?.pageDescription||"Upload a video, tweak the template, then generate ready-to-use storyboards."}),(0,t.jsx)(ly.VideoDropzone,{onFileSelect:e=>eQ(e,ei),className:"w-full max-h-[160px]",disabled:eg,accept:"video/mp4"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:Z?.ui?.videoLengthTip||"Recommended to use videos under 2 minutes for best results. Longer videos take longer to process."}),eB&&(0,t.jsx)("div",{className:"text-muted-foreground rounded-md text-center text-sm",children:(0,t.jsx)("span",{children:eB})}),(0,t.jsx)(T.FormMessage,{})]})}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 w-full",children:(0,t.jsx)(s3.AdvanceMediaPreview,{support:ei,control:en.control,setValue:en.setValue,ignoredText:Z?.ui?.ignored||"Ignored",unsupportedText:Z?.ui?.unsupported||"Unsupported"},`media-${ei.name}`)}),(0,t.jsx)(T.FormField,{control:en.control,name:"lang_preference",render:({field:e})=>(0,t.jsxs)(T.FormItem,{className:"space-y-2",children:[(0,t.jsx)(T.FormLabel,{children:Z?.ui?.outputLanguageLabel||"Output Language"}),(0,t.jsxs)(I.Select,{value:e.value??"English-en",onValueChange:e.onChange,children:[(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(I.SelectTrigger,{className:"w-full",children:(0,t.jsx)(I.SelectValue,{placeholder:Z?.ui?.outputLanguagePlaceholder||"Select output language"})})}),(0,t.jsx)(I.SelectContent,{className:"max-h-[300px] overflow-y-auto",children:lk.map(e=>(0,t.jsx)(I.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,t.jsx)(T.FormMessage,{})]})}),(0,t.jsxs)("div",{className:"w-full space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(T.FormLabel,{className:"text-sm font-medium",children:Z?.ui?.storyboardTemplateLabel||"Storyboard template"}),(0,t.jsxs)(p.Button,{type:"button",variant:"ghost",size:"sm",onClick:eY,children:[(0,t.jsx)(R.Plus,{className:"mr-1 h-4 w-4"}),Z?.ui?.addTemplate||"Add Template"]})]}),(0,t.jsx)(T.FormField,{control:en.control,name:"meta_data.templateId",render:({field:e})=>(0,t.jsxs)(T.FormItem,{children:[(0,t.jsxs)(I.Select,{value:eW,onValueChange:t=>{e.onChange(t);let a=_.find(e=>e.id===t);a&&en.setValue("output_template",(0,O.templateToJsonSchemaString)(a),{shouldDirty:!0})},children:[(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(I.SelectTrigger,{className:"w-full",children:(0,t.jsx)(I.SelectValue,{placeholder:Z?.ui?.selectTemplatePlaceholder||"Select prompt template"})})}),(0,t.jsx)(I.SelectContent,{children:_.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-1 pr-1",children:[(0,t.jsx)(I.SelectItem,{value:e.id,className:"flex-1 truncate",children:e.name}),!e.builtin&&(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t=>{t.stopPropagation(),eZ(e)},children:(0,t.jsx)(P,{className:"h-4 w-4"})}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t=>{t.stopPropagation(),eK(e.id)},children:(0,t.jsx)(U.Trash,{className:"h-4 w-4"})})]})]},e.id))})]}),(0,t.jsx)(T.FormMessage,{})]})}),(0,t.jsx)(T.FormField,{control:en.control,name:"output_template",render:({field:e})=>(0,t.jsxs)(T.FormItem,{children:[(0,t.jsx)(T.FormLabel,{children:Z?.ui?.templatePreviewLabel||"Template preview"}),(0,t.jsx)(T.FormControl,{children:(0,t.jsx)(lh,{fields:eV?.fields||[],className:"min-h-[200px]"})}),(0,t.jsx)(T.FormMessage,{})]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:Z?.ui?.templateNote||'Use "Add Template" to customize fields;
281 the generated JSON schema is read-only here to reduce mistakes.'})]}),(0,t.jsx)("div",{className:"flex flex-col items-center gap-2",children:(0,t.jsx)(p.Button,{type:"submit",disabled:eg||!eh,className:"w-full",children:eg?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),Z?.ui?.generating||"Generating..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-1 ",children:Z?.buttons?.generate||"Generate"}),eG&&eu&&eH>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D.Zap,{className:"ml-1 h-4 text-[#facc15]"}),eH]})]})})})]})}),X&&(0,t.jsx)("div",{className:"p-3 my-4 border border-destructive bg-white/85 rounded-md text-destructive",children:(0,t.jsx)("span",{children:X})}),(0,t.jsx)(s4.AppTrimMediaDialog,{isOpen:ea,mediaFile:ee?.file??null,maxDuration:ee?.maxDuration??15,onClose:e0,onHandleTrimMedia:e1}),(0,t.jsx)(lf,{open:S,onClose:()=>{j(!1),H(null)},onSave:eJ,editingTemplate:W})]})}),!ev&&!b&&(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-w-0 pl-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-4",children:(0,t.jsx)(p.Button,{onClick:()=>eO(e=>!e),title:eM?"Show generator panel":"Hide generator panel",variant:"ghost",size:"icon",children:eM?(0,t.jsx)(z.default,{className:"w-5 h-5"}):(0,t.jsx)(F,{className:"w-5 h-5"})})}),(0,t.jsx)(nC,{results:e_,onFrameUpdate:e5,onFramesChange:e6,onResultUpdate:e8,onResultDelete:e9,onResultsChange:ek,selectedId:eC,onSelectedIdChange:eN})]})]}),!ev&&b&&(0,t.jsx)("div",{className:"mt-8 w-full",children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(nC,{results:e_,onFrameUpdate:e5,onFramesChange:e6,onResultUpdate:e8,onResultDelete:e9,onResultsChange:ek,selectedId:eC,onSelectedIdChange:eN})})}),(0,t.jsx)(l_,{data:Z?.howToWork})]})}}]}],lE=[];function lR({...e}){let{userProfile:a}=(0,es.useUserResourceStore)();return(0,t.jsxs)(m.Sidebar,{collapsible:"icon",...e,children:[(0,t.jsx)(m.SidebarContent,{children:(0,t.jsx)(S,{groups:lT,linkGroups:lE})}),(0,t.jsx)(m.SidebarFooter,{children:(0,t.jsx)(b,{userProfile:a})}),(0,t.jsx)(m.SidebarRail,{})]})}function lU({...e}){return(0,t.jsx)("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function lP({className:e,...a}){return(0,t.jsx)("ol",{"data-slot":"breadcrumb-list",className:(0,ei.cn)("flex flex-wrap items-center gap-1.5 text-sm break-words text-muted-foreground sm:gap-2.5",e),...a})}function lD({className:e,...a}){return(0,t.jsx)("li",{"data-slot":"breadcrumb-item",className:(0,ei.cn)("inline-flex items-center gap-1.5",e),...a})}function lz({className:e,...a}){return(0,t.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:(0,ei.cn)("font-normal text-foreground",e),...a})}e.i(900905);var lF=e.i(813078);e.s(["default",0,function(){let e=k(e=>e.activePanel),r=(0,a.useMemo)(()=>lT.flatMap(e=>e.panels),[]),i=r.find(t=>t.panel===e)?.title??e;return(0,t.jsxs)(m.SidebarProvider,{className:"md:[&_[data-slot=sidebar-container]]:top-[86px] md:[&_[data-slot=sidebar-container]]:h-[calc(100svh-86px)] !min-h-[calc(100svh-86px)]",children:[(0,t.jsx)(lR,{}),(0,t.jsxs)(m.SidebarInset,{children:[(0,t.jsx)("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4",children:[(0,t.jsx)(m.SidebarTrigger,{className:"-ml-1"}),(0,t.jsx)(lF.Separator,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4"}),(0,t.jsx)(lU,{children:(0,t.jsx)(lP,{children:(0,t.jsx)(lD,{children:(0,t.jsx)(lz,{children:i})})})})]})}),(0,t.jsx)("div",{className:"flex flex-1 flex-col",children:r.map(({panel:a,component:r})=>(0,t.jsx)("div",{className:e===a?"flex w-full flex-1 justify-center px-4":"hidden",children:(0,t.jsx)(r,{})},a))})]})]})}],847090)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.