@imgly/plugin-ai-image-generation-web 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -5
- package/dist/fal-ai/index.mjs +9 -9
- package/dist/fal-ai/index.mjs.map +4 -4
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +4 -4
- package/dist/open-ai/GptImage1.image2image.d.ts +20 -0
- package/dist/open-ai/GptImage1.text2image.d.ts +21 -0
- package/dist/open-ai/index.d.ts +9 -0
- package/dist/open-ai/index.mjs +165 -0
- package/dist/open-ai/index.mjs.map +7 -0
- package/dist/open-ai/utils.d.ts +1 -0
- package/package.json +20 -5
- package/dist/fal-ai/GeminiFlashEditQuickActions.d.ts +0 -13
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Middleware, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
2
|
+
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
3
|
+
type GptImage1Input = {
|
|
4
|
+
prompt: string;
|
|
5
|
+
image_url: string;
|
|
6
|
+
};
|
|
7
|
+
type GptImage1Output = {
|
|
8
|
+
kind: 'image';
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
type ProviderConfiguration = {
|
|
12
|
+
proxyUrl: string;
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
middleware?: Middleware<GptImage1Input, GptImage1Output>[];
|
|
15
|
+
};
|
|
16
|
+
export declare function GptImage1(config: ProviderConfiguration): (context: {
|
|
17
|
+
cesdk: CreativeEditorSDK;
|
|
18
|
+
}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>>;
|
|
19
|
+
declare function getProvider(cesdk: CreativeEditorSDK, config: ProviderConfiguration): Provider<'image', GptImage1Input, GptImage1Output>;
|
|
20
|
+
export default getProvider;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Middleware, type Provider } from '@imgly/plugin-ai-generation-web';
|
|
2
|
+
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
3
|
+
type GptImage1Input = {
|
|
4
|
+
prompt: string;
|
|
5
|
+
size: 'auto' | '1024x1024' | '1536x1024' | '1024x1536';
|
|
6
|
+
background: 'transparent' | 'opaque' | 'auto';
|
|
7
|
+
};
|
|
8
|
+
type GptImage1Output = {
|
|
9
|
+
kind: 'image';
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
type ProviderConfiguration = {
|
|
13
|
+
proxyUrl: string;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
middleware?: Middleware<GptImage1Input, GptImage1Output>[];
|
|
16
|
+
};
|
|
17
|
+
export declare function GptImage1(config: ProviderConfiguration): (context: {
|
|
18
|
+
cesdk: CreativeEditorSDK;
|
|
19
|
+
}) => Promise<Provider<'image', GptImage1Input, GptImage1Output>>;
|
|
20
|
+
declare function getProvider(cesdk: CreativeEditorSDK, config: ProviderConfiguration): Provider<'image', GptImage1Input, GptImage1Output>;
|
|
21
|
+
export default getProvider;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GptImage1 as GptImage1Text2Image } from './GptImage1.text2image';
|
|
2
|
+
import { GptImage1 as GptImage1Image2Image } from './GptImage1.image2image';
|
|
3
|
+
declare const OpenAi: {
|
|
4
|
+
GptImage1: {
|
|
5
|
+
Text2Image: typeof GptImage1Text2Image;
|
|
6
|
+
Image2Image: typeof GptImage1Image2Image;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default OpenAi;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
var xt=`
|
|
2
|
+
<svg>
|
|
3
|
+
<symbol
|
|
4
|
+
fill="none"
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
id="@imgly/plugin/formats/ratioFree"
|
|
8
|
+
>
|
|
9
|
+
<path d="M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z" fill="currentColor"/>
|
|
10
|
+
<path d="M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z" fill="currentColor"/>
|
|
11
|
+
<path d="M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z" fill="currentColor"/>
|
|
12
|
+
<path d="M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z" fill="currentColor"/>
|
|
13
|
+
</symbol>
|
|
14
|
+
<symbol
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
id="@imgly/plugin/formats/ratio4by3"
|
|
19
|
+
>
|
|
20
|
+
<path d="M6.5 13H8V15H10V16.5H6.5V13Z" fill="currentColor"/>
|
|
21
|
+
<path d="M14 9V7.5H17.5V11H16V9H14Z" fill="currentColor"/>
|
|
22
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z" fill="currentColor"/>
|
|
23
|
+
</symbol>
|
|
24
|
+
<symbol
|
|
25
|
+
fill="none"
|
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
id="@imgly/plugin/formats/ratio16by9"
|
|
29
|
+
>
|
|
30
|
+
<path d="M4.5 13H6V15H8V16.5H4.5V13Z" fill="currentColor"/>
|
|
31
|
+
<path d="M16 9V7.5H19.5V11H18V9H16Z" fill="currentColor"/>
|
|
32
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z" fill="currentColor"/>
|
|
33
|
+
</symbol>
|
|
34
|
+
<symbol
|
|
35
|
+
fill="none"
|
|
36
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
id="@imgly/plugin/formats/ratio9by16"
|
|
39
|
+
>
|
|
40
|
+
<path d="M7.5 16H9V18H11V19.5H7.5V16Z" fill="currentColor"/>
|
|
41
|
+
<path d="M13 6V4.5H16.5V8H15V6H13Z" fill="currentColor"/>
|
|
42
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z" fill="currentColor"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol
|
|
45
|
+
fill="none"
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
viewBox="0 0 24 24"
|
|
48
|
+
id="@imgly/plugin/formats/ratio3by4"
|
|
49
|
+
>
|
|
50
|
+
<path d="M11 17.5V16H9V14H7.5V17.5H11Z" fill="currentColor"/>
|
|
51
|
+
<path d="M15 10H16.5V6.5H13V8H15V10Z" fill="currentColor"/>
|
|
52
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z" fill="currentColor"/>
|
|
53
|
+
</symbol>
|
|
54
|
+
<symbol
|
|
55
|
+
fill="none"
|
|
56
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
57
|
+
viewBox="0 0 24 24"
|
|
58
|
+
id="@imgly/plugin/formats/ratio1by1"
|
|
59
|
+
>
|
|
60
|
+
<path d="M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z" fill="currentColor"/>
|
|
61
|
+
<path d="M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z" fill="currentColor"/>
|
|
62
|
+
<path d="M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z" fill="currentColor"/>
|
|
63
|
+
<path d="M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z" fill="currentColor"/>
|
|
64
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z" fill="currentColor"/>
|
|
65
|
+
</symbol>
|
|
66
|
+
</svg>
|
|
67
|
+
`;var St=typeof global=="object"&&global&&global.Object===Object&&global,Fe=St,Et=typeof self=="object"&&self&&self.Object===Object&&self,Mt=Fe||Et||Function("return this")(),g=Mt,jt=g.Symbol,w=jt,Be=Object.prototype,Ot=Be.hasOwnProperty,$t=Be.toString,L=w?w.toStringTag:void 0;function _t(e){var t=Ot.call(e,L),r=e[L];try{e[L]=void 0;var n=!0}catch{}var i=$t.call(e);return n&&(t?e[L]=r:delete e[L]),i}var Lt=_t,Nt=Object.prototype,Dt=Nt.toString;function Pt(e){return Dt.call(e)}var Tt=Pt,zt="[object Null]",Ft="[object Undefined]",xe=w?w.toStringTag:void 0;function Bt(e){return e==null?e===void 0?Ft:zt:xe&&xe in Object(e)?Lt(e):Tt(e)}var T=Bt;function Ut(e){return e!=null&&typeof e=="object"}var de=Ut,zl=Array.isArray;function Vt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ue=Vt,Gt="[object AsyncFunction]",Rt="[object Function]",qt="[object GeneratorFunction]",Ht="[object Proxy]";function Qt(e){if(!Ue(e))return!1;var t=T(e);return t==Rt||t==qt||t==Gt||t==Ht}var Zt=Qt,Yt=g["__core-js_shared__"],ie=Yt,Se=function(){var e=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Wt(e){return!!Se&&Se in e}var Kt=Wt,Jt=Function.prototype,Xt=Jt.toString;function er(e){if(e!=null){try{return Xt.call(e)}catch{}try{return e+""}catch{}}return""}var y=er,tr=/[\\^$.*+?()[\]{}|]/g,rr=/^\[object .+?Constructor\]$/,nr=Function.prototype,ir=Object.prototype,or=nr.toString,ar=ir.hasOwnProperty,lr=RegExp("^"+or.call(ar).replace(tr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sr(e){if(!Ue(e)||Kt(e))return!1;var t=Zt(e)?lr:rr;return t.test(y(e))}var cr=sr;function ur(e,t){return e?.[t]}var dr=ur;function pr(e,t){var r=dr(e,t);return cr(r)?r:void 0}var I=pr,gr=I(g,"WeakMap"),ae=gr;function mr(e,t){return e===t||e!==e&&t!==t}var fr=mr,br=9007199254740991;function hr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=br}var yr=hr;var Fl=Object.prototype;var vr="[object Arguments]";function kr(e){return de(e)&&T(e)==vr}var Ee=kr,Ve=Object.prototype,wr=Ve.hasOwnProperty,Ir=Ve.propertyIsEnumerable,Bl=Ee(function(){return arguments}())?Ee:function(e){return de(e)&&wr.call(e,"callee")&&!Ir.call(e,"callee")};var Ge=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Me=Ge&&typeof module=="object"&&module&&!module.nodeType&&module,Ar=Me&&Me.exports===Ge,je=Ar?g.Buffer:void 0,Ul=je?je.isBuffer:void 0;var Cr="[object Arguments]",xr="[object Array]",Sr="[object Boolean]",Er="[object Date]",Mr="[object Error]",jr="[object Function]",Or="[object Map]",$r="[object Number]",_r="[object Object]",Lr="[object RegExp]",Nr="[object Set]",Dr="[object String]",Pr="[object WeakMap]",Tr="[object ArrayBuffer]",zr="[object DataView]",Fr="[object Float32Array]",Br="[object Float64Array]",Ur="[object Int8Array]",Vr="[object Int16Array]",Gr="[object Int32Array]",Rr="[object Uint8Array]",qr="[object Uint8ClampedArray]",Hr="[object Uint16Array]",Qr="[object Uint32Array]",s={};s[Fr]=s[Br]=s[Ur]=s[Vr]=s[Gr]=s[Rr]=s[qr]=s[Hr]=s[Qr]=!0;s[Cr]=s[xr]=s[Tr]=s[Sr]=s[zr]=s[Er]=s[Mr]=s[jr]=s[Or]=s[$r]=s[_r]=s[Lr]=s[Nr]=s[Dr]=s[Pr]=!1;function Zr(e){return de(e)&&yr(e.length)&&!!s[T(e)]}var Yr=Zr;function Wr(e){return function(t){return e(t)}}var Kr=Wr,Re=typeof exports=="object"&&exports&&!exports.nodeType&&exports,N=Re&&typeof module=="object"&&module&&!module.nodeType&&module,Jr=N&&N.exports===Re,oe=Jr&&Fe.process,Xr=function(){try{var e=N&&N.require&&N.require("util").types;return e||oe&&oe.binding&&oe.binding("util")}catch{}}(),Oe=Xr,$e=Oe&&Oe.isTypedArray,Vl=$e?Kr($e):Yr;var en=Object.prototype,Gl=en.hasOwnProperty;function tn(e,t){return function(r){return e(t(r))}}var rn=tn,Rl=rn(Object.keys,Object);var nn=Object.prototype,ql=nn.hasOwnProperty;var on=I(Object,"create"),D=on;function an(){this.__data__=D?D(null):{},this.size=0}var ln=an;function sn(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var cn=sn,un="__lodash_hash_undefined__",dn=Object.prototype,pn=dn.hasOwnProperty;function gn(e){var t=this.__data__;if(D){var r=t[e];return r===un?void 0:r}return pn.call(t,e)?t[e]:void 0}var mn=gn,fn=Object.prototype,bn=fn.hasOwnProperty;function hn(e){var t=this.__data__;return D?t[e]!==void 0:bn.call(t,e)}var yn=hn,vn="__lodash_hash_undefined__";function kn(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=D&&t===void 0?vn:t,this}var wn=kn;function A(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}A.prototype.clear=ln;A.prototype.delete=cn;A.prototype.get=mn;A.prototype.has=yn;A.prototype.set=wn;var _e=A;function In(){this.__data__=[],this.size=0}var An=In;function Cn(e,t){for(var r=e.length;r--;)if(fr(e[r][0],t))return r;return-1}var H=Cn,xn=Array.prototype,Sn=xn.splice;function En(e){var t=this.__data__,r=H(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Sn.call(t,r,1),--this.size,!0}var Mn=En;function jn(e){var t=this.__data__,r=H(t,e);return r<0?void 0:t[r][1]}var On=jn;function $n(e){return H(this.__data__,e)>-1}var _n=$n;function Ln(e,t){var r=this.__data__,n=H(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Nn=Ln;function C(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}C.prototype.clear=An;C.prototype.delete=Mn;C.prototype.get=On;C.prototype.has=_n;C.prototype.set=Nn;var Q=C,Dn=I(g,"Map"),P=Dn;function Pn(){this.size=0,this.__data__={hash:new _e,map:new(P||Q),string:new _e}}var Tn=Pn;function zn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Fn=zn;function Bn(e,t){var r=e.__data__;return Fn(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Z=Bn;function Un(e){var t=Z(this,e).delete(e);return this.size-=t?1:0,t}var Vn=Un;function Gn(e){return Z(this,e).get(e)}var Rn=Gn;function qn(e){return Z(this,e).has(e)}var Hn=qn;function Qn(e,t){var r=Z(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Zn=Qn;function x(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}x.prototype.clear=Tn;x.prototype.delete=Vn;x.prototype.get=Rn;x.prototype.has=Hn;x.prototype.set=Zn;var qe=x;function Yn(){this.__data__=new Q,this.size=0}var Wn=Yn;function Kn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Jn=Kn;function Xn(e){return this.__data__.get(e)}var ei=Xn;function ti(e){return this.__data__.has(e)}var ri=ti,ni=200;function ii(e,t){var r=this.__data__;if(r instanceof Q){var n=r.__data__;if(!P||n.length<ni-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qe(n)}return r.set(e,t),this.size=r.size,this}var oi=ii;function z(e){var t=this.__data__=new Q(e);this.size=t.size}z.prototype.clear=Wn;z.prototype.delete=Jn;z.prototype.get=ei;z.prototype.has=ri;z.prototype.set=oi;var ai=Object.prototype,Hl=ai.propertyIsEnumerable;var li=I(g,"DataView"),le=li,si=I(g,"Promise"),se=si,ci=I(g,"Set"),ce=ci,Le="[object Map]",ui="[object Object]",Ne="[object Promise]",De="[object Set]",Pe="[object WeakMap]",Te="[object DataView]",di=y(le),pi=y(P),gi=y(se),mi=y(ce),fi=y(ae),k=T;(le&&k(new le(new ArrayBuffer(1)))!=Te||P&&k(new P)!=Le||se&&k(se.resolve())!=Ne||ce&&k(new ce)!=De||ae&&k(new ae)!=Pe)&&(k=function(e){var t=T(e),r=t==ui?e.constructor:void 0,n=r?y(r):"";if(n)switch(n){case di:return Te;case pi:return Le;case gi:return Ne;case mi:return De;case fi:return Pe}return t});var Ql=g.Uint8Array;var bi="__lodash_hash_undefined__";function hi(e){return this.__data__.set(e,bi),this}var yi=hi;function vi(e){return this.__data__.has(e)}var ki=vi;function ue(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new qe;++t<r;)this.add(e[t])}ue.prototype.add=ue.prototype.push=yi;ue.prototype.has=ki;var ze=w?w.prototype:void 0,Zl=ze?ze.valueOf:void 0;var wi=Object.prototype,Yl=wi.hasOwnProperty;var Ii=Object.prototype,Wl=Ii.hasOwnProperty;var Kl=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Jl=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Xl=new RegExp(/[A-Fa-f0-9]{2}/,"g");function He(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}async function pe(e,t){if(e.startsWith("buffer:")){let r=await t.editor.getMimeType(e),n=t.editor.getBufferLength(e),i=t.editor.getBufferData(e,0,n),o=new Blob([i],{type:r});return URL.createObjectURL(o)}else return e}async function Qe(e,t){let r=await pe(e,t);return new Promise((n,i)=>{let o=new Image;o.onload=()=>{n({width:o.width,height:o.height})},o.onerror=i,o.src=r})}var Y={Formats:xt};var Ze={openapi:"3.0.0",components:{schemas:{GptImage1Input:{title:"TextToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},size:{enum:["1024x1024","1536x1024","1024x1536"],type:"string",title:"Format",default:"1024x1024","x-imgly-enum-labels":{"1024x1024":"Square","1536x1024":"Landscape","1024x1536":"Portrait"},"x-imgly-enum-icons":{"1024x1024":"@imgly/plugin/formats/ratio1by1","1024x1536":"@imgly/plugin/formats/ratio3by4","1536x1024":"@imgly/plugin/formats/ratio4by3"}},background:{enum:["auto","transparent","opaque"],type:"string",title:"Background",default:"auto","x-imgly-enum-labels":{auto:"Auto",transparent:"Transparent",opaque:"Opaque"}}},"x-order-properties":["prompt","size","background"],required:["prompt"]}}}};function W(e,t){let r=e.split(",")[1]||e,n=atob(r),i=[];for(let l=0;l<n.length;l++)i.push(n.charCodeAt(l));let o=new Uint8Array(i);return new Blob([o],{type:t})}function Ye(e){return async({cesdk:t})=>Ci(t,e)}function Ci(e,t){return e.ui.addIconSet("@imgly/plugin/formats",Y.Formats),{id:"open-ai/gpt-image-1/text2image",kind:"image",name:"gpt-image-1",input:{panel:{type:"schema",document:Ze,inputReference:"#/components/schemas/GptImage1Input",includeHistoryLibrary:!0,orderExtensionKeyword:"x-order-properties",getBlockInput:n=>{switch(n.size){case"auto":return Promise.resolve({image:{width:512,height:512}});case"1024x1024":return Promise.resolve({image:{width:1024,height:1024}});case"1536x1024":return Promise.resolve({image:{width:1536,height:1024}});case"1024x1536":return Promise.resolve({image:{width:1024,height:1536}});default:throw new Error("Invalid image size")}},userFlow:"placeholder"}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:t.middleware??[],generate:async(n,{abortSignal:i})=>{let l=(await(await fetch(`${t.proxyUrl}/images/generations`,{signal:i,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"gpt-image-1",prompt:n.prompt,n:1,size:n.size,background:n.background})})).json()).data?.[0].b64_json;if(l==null)throw new Error("No image data returned");let p=W(l,"image/png");return{kind:"image",url:URL.createObjectURL(p)}}}}}function xi(e,t){let{cesdk:r}=t,n=t.propertyKey??"image_url";return Si(e,r),{[n]:(i,o)=>{let{builder:a,experimental:{global:l},payload:p}=i,f=p?.url??t.defaultUrl,b=l(`${e}.${o.id}`,f);return a.MediaPreview(o.id,{preview:{type:"image",uri:b.value},action:{label:"Select Image",onClick:()=>{if(r==null)return;let h=be(e);r.ui.openPanel(h,{payload:{onSelect:u=>{u.meta?.uri!=null&&b.setValue(u.meta?.uri)}}})}}}),()=>({id:o.id,type:"string",value:b.value})}}}function Si(e,t){t?.ui.registerPanel(be(e),({builder:r,payload:n})=>{r.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async i=>{let o=i?.meta?.uri;if(o==null)return;let a=await t.engine.editor.getMimeType(o);a==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"SVG images are not supported. Please choose a different image."}):a.startsWith("image/")?(n?.onSelect(i),t?.ui.closePanel(be(e))):t.ui.showNotification({type:"warning",message:`Only images are supported. Found '${a}'. Please choose a different image.`})}})})}function be(e){return`ly.img.ai/${e}.imageSelection`}var Ei=xi;var Mi=typeof global=="object"&&global&&global.Object===Object&&global,dt=Mi,ji=typeof self=="object"&&self&&self.Object===Object&&self,Oi=dt||ji||Function("return this")(),m=Oi,$i=m.Symbol,E=$i,pt=Object.prototype,_i=pt.hasOwnProperty,Li=pt.toString,F=E?E.toStringTag:void 0;function Ni(e){var t=_i.call(e,F),r=e[F];try{e[F]=void 0;var n=!0}catch{}var i=Li.call(e);return n&&(t?e[F]=r:delete e[F]),i}var Di=Ni,Pi=Object.prototype,Ti=Pi.toString;function zi(e){return Ti.call(e)}var Fi=zi,Bi="[object Null]",Ui="[object Undefined]",We=E?E.toStringTag:void 0;function Vi(e){return e==null?e===void 0?Ui:Bi:We&&We in Object(e)?Di(e):Fi(e)}var R=Vi;function Gi(e){return e!=null&&typeof e=="object"}var Ie=Gi,ls=Array.isArray;function Ri(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gt=Ri,qi="[object AsyncFunction]",Hi="[object Function]",Qi="[object GeneratorFunction]",Zi="[object Proxy]";function Yi(e){if(!gt(e))return!1;var t=R(e);return t==Hi||t==Qi||t==qi||t==Zi}var Wi=Yi,Ki=m["__core-js_shared__"],ge=Ki,Ke=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ji(e){return!!Ke&&Ke in e}var Xi=Ji,eo=Function.prototype,to=eo.toString;function ro(e){if(e!=null){try{return to.call(e)}catch{}try{return e+""}catch{}}return""}var v=ro,no=/[\\^$.*+?()[\]{}|]/g,io=/^\[object .+?Constructor\]$/,oo=Function.prototype,ao=Object.prototype,lo=oo.toString,so=ao.hasOwnProperty,co=RegExp("^"+lo.call(so).replace(no,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function uo(e){if(!gt(e)||Xi(e))return!1;var t=Wi(e)?co:io;return t.test(v(e))}var po=uo;function go(e,t){return e?.[t]}var mo=go;function fo(e,t){var r=mo(e,t);return po(r)?r:void 0}var M=fo,bo=M(m,"WeakMap"),he=bo;function ho(e,t){return e===t||e!==e&&t!==t}var yo=ho,vo=9007199254740991;function ko(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=vo}var wo=ko,ss=Object.prototype,Io="[object Arguments]";function Ao(e){return Ie(e)&&R(e)==Io}var Je=Ao,mt=Object.prototype,Co=mt.hasOwnProperty,xo=mt.propertyIsEnumerable,cs=Je(function(){return arguments}())?Je:function(e){return Ie(e)&&Co.call(e,"callee")&&!xo.call(e,"callee")},ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xe=ft&&typeof module=="object"&&module&&!module.nodeType&&module,So=Xe&&Xe.exports===ft,et=So?m.Buffer:void 0,us=et?et.isBuffer:void 0,Eo="[object Arguments]",Mo="[object Array]",jo="[object Boolean]",Oo="[object Date]",$o="[object Error]",_o="[object Function]",Lo="[object Map]",No="[object Number]",Do="[object Object]",Po="[object RegExp]",To="[object Set]",zo="[object String]",Fo="[object WeakMap]",Bo="[object ArrayBuffer]",Uo="[object DataView]",Vo="[object Float32Array]",Go="[object Float64Array]",Ro="[object Int8Array]",qo="[object Int16Array]",Ho="[object Int32Array]",Qo="[object Uint8Array]",Zo="[object Uint8ClampedArray]",Yo="[object Uint16Array]",Wo="[object Uint32Array]",c={};c[Vo]=c[Go]=c[Ro]=c[qo]=c[Ho]=c[Qo]=c[Zo]=c[Yo]=c[Wo]=!0;c[Eo]=c[Mo]=c[Bo]=c[jo]=c[Uo]=c[Oo]=c[$o]=c[_o]=c[Lo]=c[No]=c[Do]=c[Po]=c[To]=c[zo]=c[Fo]=!1;function Ko(e){return Ie(e)&&wo(e.length)&&!!c[R(e)]}var Jo=Ko;function Xo(e){return function(t){return e(t)}}var ea=Xo,bt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,U=bt&&typeof module=="object"&&module&&!module.nodeType&&module,ta=U&&U.exports===bt,me=ta&&dt.process,ra=function(){try{var e=U&&U.require&&U.require("util").types;return e||me&&me.binding&&me.binding("util")}catch{}}(),tt=ra,rt=tt&&tt.isTypedArray,ds=rt?ea(rt):Jo,na=Object.prototype,ps=na.hasOwnProperty;function ia(e,t){return function(r){return e(t(r))}}var oa=ia,gs=oa(Object.keys,Object),aa=Object.prototype,ms=aa.hasOwnProperty,la=M(Object,"create"),V=la;function sa(){this.__data__=V?V(null):{},this.size=0}var ca=sa;function ua(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var da=ua,pa="__lodash_hash_undefined__",ga=Object.prototype,ma=ga.hasOwnProperty;function fa(e){var t=this.__data__;if(V){var r=t[e];return r===pa?void 0:r}return ma.call(t,e)?t[e]:void 0}var ba=fa,ha=Object.prototype,ya=ha.hasOwnProperty;function va(e){var t=this.__data__;return V?t[e]!==void 0:ya.call(t,e)}var ka=va,wa="__lodash_hash_undefined__";function Ia(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=V&&t===void 0?wa:t,this}var Aa=Ia;function j(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}j.prototype.clear=ca;j.prototype.delete=da;j.prototype.get=ba;j.prototype.has=ka;j.prototype.set=Aa;var nt=j;function Ca(){this.__data__=[],this.size=0}var xa=Ca;function Sa(e,t){for(var r=e.length;r--;)if(yo(e[r][0],t))return r;return-1}var K=Sa,Ea=Array.prototype,Ma=Ea.splice;function ja(e){var t=this.__data__,r=K(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Ma.call(t,r,1),--this.size,!0}var Oa=ja;function $a(e){var t=this.__data__,r=K(t,e);return r<0?void 0:t[r][1]}var _a=$a;function La(e){return K(this.__data__,e)>-1}var Na=La;function Da(e,t){var r=this.__data__,n=K(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Pa=Da;function O(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}O.prototype.clear=xa;O.prototype.delete=Oa;O.prototype.get=_a;O.prototype.has=Na;O.prototype.set=Pa;var J=O,Ta=M(m,"Map"),G=Ta;function za(){this.size=0,this.__data__={hash:new nt,map:new(G||J),string:new nt}}var Fa=za;function Ba(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Ua=Ba;function Va(e,t){var r=e.__data__;return Ua(t)?r[typeof t=="string"?"string":"hash"]:r.map}var X=Va;function Ga(e){var t=X(this,e).delete(e);return this.size-=t?1:0,t}var Ra=Ga;function qa(e){return X(this,e).get(e)}var Ha=qa;function Qa(e){return X(this,e).has(e)}var Za=Qa;function Ya(e,t){var r=X(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Wa=Ya;function $(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$.prototype.clear=Fa;$.prototype.delete=Ra;$.prototype.get=Ha;$.prototype.has=Za;$.prototype.set=Wa;var ht=$;function Ka(){this.__data__=new J,this.size=0}var Ja=Ka;function Xa(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var el=Xa;function tl(e){return this.__data__.get(e)}var rl=tl;function nl(e){return this.__data__.has(e)}var il=nl,ol=200;function al(e,t){var r=this.__data__;if(r instanceof J){var n=r.__data__;if(!G||n.length<ol-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ht(n)}return r.set(e,t),this.size=r.size,this}var ll=al;function q(e){var t=this.__data__=new J(e);this.size=t.size}q.prototype.clear=Ja;q.prototype.delete=el;q.prototype.get=rl;q.prototype.has=il;q.prototype.set=ll;var sl=Object.prototype,fs=sl.propertyIsEnumerable,cl=M(m,"DataView"),ye=cl,ul=M(m,"Promise"),ve=ul,dl=M(m,"Set"),ke=dl,it="[object Map]",pl="[object Object]",ot="[object Promise]",at="[object Set]",lt="[object WeakMap]",st="[object DataView]",gl=v(ye),ml=v(G),fl=v(ve),bl=v(ke),hl=v(he),S=R;(ye&&S(new ye(new ArrayBuffer(1)))!=st||G&&S(new G)!=it||ve&&S(ve.resolve())!=ot||ke&&S(new ke)!=at||he&&S(new he)!=lt)&&(S=function(e){var t=R(e),r=t==pl?e.constructor:void 0,n=r?v(r):"";if(n)switch(n){case gl:return st;case ml:return it;case fl:return ot;case bl:return at;case hl:return lt}return t});var bs=m.Uint8Array,yl="__lodash_hash_undefined__";function vl(e){return this.__data__.set(e,yl),this}var kl=vl;function wl(e){return this.__data__.has(e)}var Il=wl;function we(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ht;++t<r;)this.add(e[t])}we.prototype.add=we.prototype.push=kl;we.prototype.has=Il;var ct=E?E.prototype:void 0,hs=ct?ct.valueOf:void 0,Al=Object.prototype,ys=Al.hasOwnProperty,Cl=Object.prototype,vs=Cl.hasOwnProperty,ks=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),ws=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Is=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function xl(e,t){if(e.startsWith("buffer:")){let r=await t.editor.getMimeType(e),n=t.editor.getBufferLength(e),i=t.editor.getBufferData(e,0,n),o=new Blob([i],{type:r});return URL.createObjectURL(o)}else return e}async function ee(e,t,r){let n,i=t.block.getFill(e),o=t.block.getSourceSet(i,"fill/image/sourceSet"),[a]=o;if(a==null){if(n=t.block.getString(i,"fill/image/imageFileURI"),n==null)throw new Error("No image source/uri found")}else n=a.uri;if(r?.throwErrorIfSvg&&await t.editor.getMimeType(n)==="image/svg+xml")throw new Error("SVG images are not supported");return xl(n,t)}var fe="@imgly/plugin-ai-generation",As=`
|
|
68
|
+
<svg>
|
|
69
|
+
<symbol
|
|
70
|
+
fill="none"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
viewBox="0 0 24 24"
|
|
73
|
+
id="@imgly/Sparkle"
|
|
74
|
+
>
|
|
75
|
+
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
|
|
76
|
+
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
|
|
77
|
+
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
|
|
78
|
+
|
|
79
|
+
</symbol>
|
|
80
|
+
|
|
81
|
+
<symbol
|
|
82
|
+
fill="none"
|
|
83
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
+
viewBox="0 0 24 24"
|
|
85
|
+
id="${fe}/image"
|
|
86
|
+
>
|
|
87
|
+
<path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
|
|
88
|
+
<path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
|
|
89
|
+
<path d="M6.40053 5.38488C6.52538 5.06832 6.97338 5.06832 7.09823 5.38488L8.17455 8.11392C8.21267 8.21057 8.28917 8.28707 8.38582 8.32519L11.1149 9.40151C11.4314 9.52636 11.4314 9.97436 11.1149 10.0992L8.38582 11.1755C8.28917 11.2136 8.21267 11.2901 8.17455 11.3868L7.09823 14.1158C6.97338 14.4324 6.52538 14.4324 6.40053 14.1158L5.32421 11.3868C5.2861 11.2901 5.20959 11.2136 5.11295 11.1755L2.3839 10.0992C2.06735 9.97436 2.06735 9.52636 2.3839 9.40151L5.11295 8.32519C5.20959 8.28707 5.2861 8.21057 5.32421 8.11392L6.40053 5.38488Z" fill="currentColor"/>
|
|
90
|
+
<path d="M18.9994 16.5008V18.0004C18.9994 18.5526 18.5517 19.0004 17.9994 19.0004H9.33302L14.3753 11.4369C14.6722 10.9916 15.3266 10.9916 15.6234 11.4369L18.9994 16.5008Z" fill="currentColor"/>
|
|
91
|
+
|
|
92
|
+
</symbol>
|
|
93
|
+
<symbol
|
|
94
|
+
fill="none"
|
|
95
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
96
|
+
viewBox="0 0 24 24"
|
|
97
|
+
id="${fe}/video"
|
|
98
|
+
>
|
|
99
|
+
<path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
|
|
100
|
+
<path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
|
|
101
|
+
<path d="M18.9019 3.3845C19.0267 3.06795 19.4747 3.06795 19.5996 3.3845L20.6759 6.11355C20.714 6.2102 20.7905 6.2867 20.8872 6.32482L23.6162 7.40114C23.9328 7.52598 23.9328 7.97399 23.6162 8.09883L20.8872 9.17515C20.7905 9.21327 20.714 9.28977 20.6759 9.38642L19.5996 12.1155C19.4747 12.432 19.0267 12.432 18.9019 12.1155L17.8255 9.38642C17.7874 9.28977 17.7109 9.21327 17.6143 9.17515L14.8852 8.09883C14.5687 7.97399 14.5687 7.52598 14.8852 7.40114L17.6143 6.32482C17.7109 6.2867 17.7874 6.2102 17.8255 6.11355L18.9019 3.3845Z" fill="currentColor"/>
|
|
102
|
+
<path d="M14.9994 13.2862C15.5089 12.8859 15.5089 12.1141 14.9995 11.7137L10.618 8.27047C9.96188 7.75485 9.00011 8.22225 9.00011 9.05673L9.00011 15.9429C9.00011 16.7773 9.96185 17.2448 10.618 16.7292L14.9994 13.2862Z" fill="currentColor"/>
|
|
103
|
+
</symbol>
|
|
104
|
+
<symbol
|
|
105
|
+
fill="none"
|
|
106
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
107
|
+
viewBox="0 0 24 24"
|
|
108
|
+
id="${fe}/audio"
|
|
109
|
+
>
|
|
110
|
+
<path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
|
|
111
|
+
<path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
|
|
112
|
+
<path d="M19.5996 4.3845C19.4747 4.06795 19.0267 4.06795 18.9019 4.3845L17.8255 7.11355C17.7874 7.2102 17.7109 7.2867 17.6143 7.32482L14.8852 8.40114C14.5687 8.52598 14.5687 8.97399 14.8852 9.09883L17.6143 10.1752C17.7109 10.2133 17.7874 10.2898 17.8255 10.3864L18.9019 13.1155C19.0267 13.432 19.4747 13.432 19.5996 13.1155L20.6759 10.3864C20.714 10.2898 20.7905 10.2133 20.8872 10.1752L23.6162 9.09883C23.9328 8.97399 23.9328 8.52598 23.6162 8.40114L20.8872 7.32482C20.7905 7.2867 20.714 7.2102 20.6759 7.11355L19.5996 4.3845Z" fill="currentColor"/>
|
|
113
|
+
</symbol>
|
|
114
|
+
<symbol
|
|
115
|
+
fill="none"
|
|
116
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
117
|
+
viewBox="0 0 24 24"
|
|
118
|
+
id="@imgly/MixingPlate"
|
|
119
|
+
>
|
|
120
|
+
<path d="M9.75 9C10.5784 9 11.25 8.32843 11.25 7.5C11.25 6.67157 10.5784 6 9.75 6C8.92157 6 8.25 6.67157 8.25 7.5C8.25 8.32843 8.92157 9 9.75 9Z" fill="currentColor"/>
|
|
121
|
+
<path d="M7 13C7.82843 13 8.5 12.3284 8.5 11.5C8.5 10.6716 7.82843 10 7 10C6.17157 10 5.5 10.6716 5.5 11.5C5.5 12.3284 6.17157 13 7 13Z" fill="currentColor"/>
|
|
122
|
+
<path d="M15.75 7.5C15.75 8.32843 15.0784 9 14.25 9C13.4216 9 12.75 8.32843 12.75 7.5C12.75 6.67157 13.4216 6 14.25 6C15.0784 6 15.75 6.67157 15.75 7.5Z" fill="currentColor"/>
|
|
123
|
+
<path d="M17 13C17.8284 13 18.5 12.3284 18.5 11.5C18.5 10.6716 17.8284 10 17 10C16.1716 10 15.5 10.6716 15.5 11.5C15.5 12.3284 16.1716 13 17 13Z" fill="currentColor"/>
|
|
124
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26309 2.77709C10.6681 1.77921 13.4829 1.7322 15.9209 2.64297C18.1572 3.47923 20.0876 5.09285 21.1766 7.28598C22.3395 9.62772 22.4889 13.1077 20.3864 15.2982C19.2693 16.4621 17.7657 16.9982 16.0026 16.9997C15.7897 16.9997 15.5555 16.9864 15.3497 16.9745C15.309 16.9722 15.2694 16.9699 15.2313 16.9679C14.9817 16.9542 14.761 16.9455 14.5569 16.9539C14.124 16.9718 13.9598 17.0612 13.89 17.1324C13.718 17.3081 13.6946 17.6672 13.8854 17.8895C14.2899 18.3608 14.5016 18.9277 14.5016 19.5497C14.5016 20.2206 14.3086 20.9011 13.7542 21.3896C13.2471 21.837 12.6082 21.9997 11.9635 21.9997C10.6049 21.9997 9.31155 21.7367 8.0934 21.2067C6.89058 20.6831 5.84501 19.9687 4.94363 19.0666C4.04281 18.1651 3.31836 17.107 2.79369 15.8978C1.72761 13.4409 1.72662 10.5261 2.81247 8.07034C3.88024 5.65548 5.84206 3.78161 8.26309 2.77709ZM15.2207 4.51639C13.2556 3.78239 10.9651 3.82132 9.02956 4.62439C7.06888 5.43791 5.49559 6.94785 4.64163 8.87914C3.78373 10.8194 3.78253 13.1522 4.62841 15.1017C5.05312 16.0805 5.63511 16.9291 6.35838 17.6529C7.08102 18.3761 7.91671 18.9484 8.89123 19.3728C9.8492 19.7895 10.87 19.9997 11.9635 19.9997C12.2815 19.9997 12.394 19.9225 12.431 19.8899L12.4319 19.8891C12.4367 19.8849 12.4487 19.8743 12.4631 19.8359C12.4799 19.7911 12.5016 19.7024 12.5016 19.5497C12.5016 19.4091 12.4633 19.3034 12.3677 19.192C11.5353 18.222 11.5272 16.6868 12.4611 15.7331C13.0741 15.1071 13.8844 14.98 14.4745 14.9556C14.7819 14.943 15.085 14.9568 15.3409 14.9709C15.3906 14.9736 15.4379 14.9763 15.4832 14.9788C15.6876 14.9904 15.8508 14.9997 16.0009 14.9997C17.3405 14.9986 18.2792 14.6054 18.9435 13.9133C20.2633 12.5382 20.3186 10.055 19.3853 8.1755C18.5436 6.48051 17.0293 5.19281 15.2207 4.51639Z" fill="currentColor"/>
|
|
125
|
+
|
|
126
|
+
</symbol>
|
|
127
|
+
</svg>
|
|
128
|
+
`;var ut="ly.img.ai.quickAction.order",B="ly.img.ai.quickAction.actions";function Sl(e,t){return{id:t,setQuickActionMenuOrder:r=>{e.ui.experimental.setGlobalStateValue(`${ut}.${t}`,r)},getQuickActionMenuOrder:()=>e.ui.experimental.getGlobalStateValue(`${ut}.${t}`,[]),registerQuickAction:r=>{if(!e.ui.experimental.hasGlobalStateValue(`${B}.${t}`))e.ui.experimental.setGlobalStateValue(`${B}.${t}`,{[r.id]:r});else{let n=e.ui.experimental.getGlobalStateValue(`${B}.${t}`,{});e.ui.experimental.setGlobalStateValue(`${B}.${t}`,{...n,[r.id]:r})}},getQuickAction:r=>e.ui.experimental.getGlobalStateValue(`${B}.${t}`,{})[r]}}var Ae=Sl;function El(e){let t=e.quickAction.id;return{confirmation:!0,lockDuringConfirmation:!1,...e.quickAction,render:({builder:r},{toggleExpand:n})=>{r.Button(`${t}.button`,{label:`ly.img.ai.quickAction.${t}`,icon:"@imgly/Sparkle",labelAlignment:"left",variant:"plain",...e.buttonOptions,onClick:n})},renderExpanded:({builder:r,state:n,experimental:i},o)=>{let a=n(`${t}.prompt`,"");r.TextArea(`${t}.textarea`,{inputLabel:`ly.img.ai.quickAction.${t}.prompt.inputLabel`,placeholder:`ly.img.ai.quickAction.${t}.prompt.placeholder`,...e.textAreaOptions,...a}),r.Separator(`${t}.separator`),i.builder.ButtonRow(`${t}.footer`,{justifyContent:"space-between",children:()=>{r.Button(`${t}.footer.cancel`,{label:"common.back",icon:"@imgly/ChevronLeft",onClick:o.toggleExpand}),r.Button(`${t}.footer.apply`,{label:`ly.img.ai.quickAction.${t}.apply`,icon:"@imgly/MagicWand",color:"accent",isDisabled:a.value.length===0,onClick:async()=>{try{let l=a.value;if(!l)return;e.onApply(l,o),o.toggleExpand(),o.closeMenu()}catch(l){o.handleGenerationError(l)}}})}})}}}var te=El;function Ml(e){let t=e.id??"changeToImage";if(e.mapInput==null&&e.onApply==null)throw new Error(`QuickAction '${t}': Either mapInput or onApply must be provided to QuickActionChangeImage`);if(e.mapInput!=null&&e.onApply!=null)throw new Error(`QuickAction '${t}': Only one of mapInput or onApply can be provided to QuickActionChangeImage, not both`);return e.cesdk.i18n.setTranslations({en:{[`ly.img.ai.quickAction.${t}.apply`]:"Change",[`ly.img.ai.quickAction.${t}`]:"Change Text Style...",[`ly.img.ai.quickAction.${t}.prompt.inputLabel`]:"Change Text Style...",[`ly.img.ai.quickAction.${t}.prompt.placeholder`]:"e.g. add a 3d texture with wires..."}}),te({buttonOptions:{icon:"@imgly/plugin-ai-generation/image"},quickAction:{kind:"text",id:t,version:"1",confirmation:!1,enable:({engine:r})=>{let n=r.block.findAllSelected();if(n==null||n.length!==1)return!1;let[i]=n;return r.block.getType(i)==="//ly.img.ubq/text"}},onApply:async(r,n)=>{let[i]=e.cesdk.engine.block.findAllSelected(),o=e.cesdk.engine.block.getParent(i);if(o==null)throw new Error("Parent block not found");let a=await e.cesdk.engine.block.export(i),l=URL.createObjectURL(a),p=e.cesdk.engine.block.getFrameWidth(i),f=e.cesdk.engine.block.getFrameHeight(i),b=e.cesdk.engine.block.getPositionX(i),h=e.cesdk.engine.block.getPositionY(i),u=e.cesdk.engine.block.createShape("rect"),d=e.cesdk.engine.block.create("graphic");e.cesdk.engine.block.setShape(d,u),e.cesdk.engine.block.appendChild(o,d),e.cesdk.engine.block.setWidth(d,p),e.cesdk.engine.block.setHeight(d,f),e.cesdk.engine.block.setPositionX(d,b),e.cesdk.engine.block.setPositionY(d,h);let re=e.cesdk.engine.block.createFill("image");e.cesdk.engine.block.setString(re,"fill/image/imageFileURI",l),e.cesdk.engine.block.setFill(d,re),e.cesdk.engine.block.destroy(i),e.cesdk.engine.block.setSelected(d,!0);let _=await ee(d,e.cesdk.engine,{throwErrorIfSvg:!0});if(e.mapInput){let ne=e.mapInput({prompt:r,uri:_,duplicatedBlockId:d});return n.generate(ne)}else{if(e.onApply)return e.onApply({prompt:r,uri:_,duplicatedBlockId:d},n);throw new Error("Please provide either mapInput or onApply")}}})}var yt=Ml;function jl(){return({engine:e})=>{let t=e.block.findAllSelected();if(t==null||t.length!==1)return!1;let[r]=t;if(e.block.getType(r)!=="//ly.img.ubq/graphic"&&!e.block.supportsFill(r))return!1;let n=e.block.getFill(r);return e.block.getType(n)==="//ly.img.ubq/fill/image"}}var Ce=jl;function Ol(e){let t=e.id??"changeImage";if(e.mapInput==null&&e.onApply==null)throw new Error(`QuickAction '${t}': Either mapInput or onApply must be provided to QuickActionChangeImage`);if(e.mapInput!=null&&e.onApply!=null)throw new Error(`QuickAction '${t}': Only one of mapInput or onApply can be provided to QuickActionChangeImage, not both`);return e.cesdk.i18n.setTranslations({en:{[`ly.img.ai.quickAction.${t}.apply`]:"Change",[`ly.img.ai.quickAction.${t}`]:"Edit Image...",[`ly.img.ai.quickAction.${t}.prompt.inputLabel`]:"Change image...",[`ly.img.ai.quickAction.${t}.prompt.placeholder`]:"Describe what you want to change..."}}),te({buttonOptions:{icon:"@imgly/plugin-ai-generation/image"},quickAction:{id:t,version:"1",confirmation:!0,lockDuringConfirmation:!1,scopes:["fill/change"],enable:Ce()},onApply:async(r,n)=>{let[i]=e.cesdk.engine.block.findAllSelected(),o=await ee(i,e.cesdk.engine,{throwErrorIfSvg:!0});if(e.mapInput){let a=e.mapInput({prompt:r,uri:o,blockId:i});return n.generate(a)}else{if(e.onApply)return e.onApply({prompt:r,uri:o,blockId:i},n);throw new Error("Please provide either mapInput or onApply")}}})}var vt=Ol;function $l(e){let t=e.id??"createVariant";if(e.mapInput==null&&e.onApply==null)throw new Error(`QuickAction '${t}': Either mapInput or onApply must be provided to QuickActionChangeImage`);if(e.mapInput!=null&&e.onApply!=null)throw new Error(`QuickAction '${t}': Only one of mapInput or onApply can be provided to QuickActionChangeImage, not both`);return e.cesdk.i18n.setTranslations({en:{[`ly.img.ai.quickAction.${t}.apply`]:"Create",[`ly.img.ai.quickAction.${t}`]:"Create Variant...",[`ly.img.ai.quickAction.${t}.prompt.inputLabel`]:"Describe Your Variant...",[`ly.img.ai.quickAction.${t}.prompt.placeholder`]:"e.g., same character with arms raised"}}),te({buttonOptions:{icon:"@imgly/ImageVariation"},quickAction:{id:t,version:"1",confirmation:!1,lockDuringConfirmation:!1,scopes:["lifecycle/duplicate","fill/change"],enable:r=>{if(!Ce()(r))return!1;let[n]=r.engine.block.findAllSelected();if(!e.cesdk.feature.isEnabled("ly.img.duplicate",{engine:r.engine})||!r.engine.block.isAllowedByScope(n,"lifecycle/duplicate"))return!1;let i=r.engine.block.getParent(n);return!(i!=null&&r.engine.block.getType(i)==="//ly.img.ubq/track"&&r.engine.block.isPageDurationSource(i)||r.engine.block.getType(n)==="//ly.img.ubq/page")}},onApply:async(r,n)=>{let i=e.cesdk.engine,[o]=i.block.findAllSelected(),a=i.block.duplicate(o);i.block.setSelected(o,!1),i.block.setSelected(a,!0);let l=i.block.getParent(a);if(l==null)throw new Error("Parent not found");let p=1,f=i.block.getWidth(l),b=i.block.getHeight(l),h=.02*Math.min(f,b)*p;i.block.setPositionX(a,i.block.getPositionX(a)+h),i.block.setPositionY(a,i.block.getPositionY(a)+h);let u=await ee(a,e.cesdk.engine,{throwErrorIfSvg:!0});if(e.mapInput){let d=e.mapInput({prompt:r,uri:u,duplicatedBlockId:a});return n.generate(d)}else{if(e.onApply)return e.onApply({prompt:r,uri:u,duplicatedBlockId:a},n);throw new Error("Please provide either mapInput or onApply")}}})}var kt=$l;function _l(e){let t=e.id??"swapBackground";if(e.mapInput==null&&e.onApply==null)throw new Error(`QuickAction '${t}': Either mapInput or onApply must be provided to QuickActionChangeImage`);if(e.mapInput!=null&&e.onApply!=null)throw new Error(`QuickAction '${t}': Only one of mapInput or onApply can be provided to QuickActionChangeImage, not both`);return e.cesdk.i18n.setTranslations({en:{[`ly.img.ai.quickAction.${t}.apply`]:"Change",[`ly.img.ai.quickAction.${t}`]:"Change Background...",[`ly.img.ai.quickAction.${t}.prompt.inputLabel`]:"Change background...",[`ly.img.ai.quickAction.${t}.prompt.placeholder`]:"Describe the background you want..."}}),te({buttonOptions:{icon:"@imgly/plugin-ai-generation/image"},quickAction:{id:t,version:"1",confirmation:!0,lockDuringConfirmation:!1,scopes:["fill/change"],enable:Ce()},onApply:async(r,n)=>{let[i]=e.cesdk.engine.block.findAllSelected(),o=await ee(i,e.cesdk.engine,{throwErrorIfSvg:!0}),a=`Swap the background to ${r}`;if(e.mapInput){let l=e.mapInput({prompt:a,uri:o,blockId:i});return n.generate(l)}else{if(e.onApply)return e.onApply({prompt:a,uri:o,blockId:i},n);throw new Error("Please provide either mapInput or onApply")}}})}var wt=_l,It={ImageUrl:Ei};var At={openapi:"3.0.0",components:{schemas:{GptImage1Input:{title:"ImageToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"Optional URL of an input image for editing."}},"x-order-properties":["image_url","prompt","background"],required:["image_url","prompt"]}}}};function Ct(e){return async({cesdk:t})=>Nl(t,e)}function Nl(e,t){e.ui.addIconSet("@imgly/plugin/formats",Y.Formats);let r=Dl(e),n=Ae(e,"image"),i=Ae(e,"text");return n.setQuickActionMenuOrder(["swapBackground","changeImage","createVariant","ly.img.separator",...n.getQuickActionMenuOrder()]),i.setQuickActionMenuOrder([...i.getQuickActionMenuOrder(),"ly.img.separator","changeToImage"]),{id:"open-ai/gpt-image-1/image2image",kind:"image",name:"gpt-image-1",input:{panel:{type:"schema",document:At,inputReference:"#/components/schemas/GptImage1Input",includeHistoryLibrary:!0,orderExtensionKeyword:"x-order-properties",renderCustomProperty:{...e!=null?It.ImageUrl("gpt-image-1",{cesdk:e}):{}},getBlockInput:async a=>{let{width:l,height:p}=await Qe(a.image_url,e.engine);return Promise.resolve({image:{width:l,height:p}})},userFlow:"placeholder"},quickActions:{actions:r??[]}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:t.middleware??[],generate:async(a,{abortSignal:l})=>{let p=await e.engine.editor.getMimeType(a.image_url),f=await pe(a.image_url,e.engine),h=await(await fetch(f)).blob(),u=new FormData;u.append("image",h,`image.${He(p)}`),u.append("prompt",a.prompt),u.append("model","gpt-image-1"),u.append("size","auto"),u.append("n","1");let _=(await(await fetch(`${t.proxyUrl}/images/edits`,{signal:l,method:"POST",body:u})).json()).data?.[0].b64_json;if(_==null)throw new Error("No image data returned");let ne=W(_,"image/png");return{kind:"image",url:URL.createObjectURL(ne)}}}}}function Dl(e){return[yt({onApply:async({prompt:t,uri:r,duplicatedBlockId:n},i)=>i.generate({prompt:t,image_url:r},{blockIds:[n]}),cesdk:e}),wt({mapInput:t=>({...t,image_url:t.uri}),cesdk:e}),vt({mapInput:t=>({...t,image_url:t.uri}),cesdk:e}),kt({onApply:async({prompt:t,uri:r,duplicatedBlockId:n},i)=>i.generate({prompt:t,image_url:r},{blockIds:[n]}),cesdk:e})]}var Pl={GptImage1:{Text2Image:Ye,Image2Image:Ct}},Ds=Pl;export{Ds as default};
|
|
129
|
+
/*! Bundled license information:
|
|
130
|
+
|
|
131
|
+
@imgly/plugin-utils/dist/index.mjs:
|
|
132
|
+
(*! Bundled license information:
|
|
133
|
+
|
|
134
|
+
lodash-es/lodash.js:
|
|
135
|
+
(**
|
|
136
|
+
* @license
|
|
137
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
138
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
139
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
140
|
+
* Released under MIT license <https://lodash.com/license>
|
|
141
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
142
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
143
|
+
*)
|
|
144
|
+
*)
|
|
145
|
+
|
|
146
|
+
@imgly/plugin-ai-generation-web/dist/index.mjs:
|
|
147
|
+
(*! Bundled license information:
|
|
148
|
+
|
|
149
|
+
@imgly/plugin-utils/dist/index.mjs:
|
|
150
|
+
(*! Bundled license information:
|
|
151
|
+
|
|
152
|
+
lodash-es/lodash.js:
|
|
153
|
+
(**
|
|
154
|
+
* @license
|
|
155
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
156
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
157
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
158
|
+
* Released under MIT license <https://lodash.com/license>
|
|
159
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
160
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
161
|
+
*)
|
|
162
|
+
*)
|
|
163
|
+
*)
|
|
164
|
+
*/
|
|
165
|
+
//# sourceMappingURL=index.mjs.map
|