@cesdk/cesdk-js 1.64.0-nightly.20251030 → 1.64.0-nightly.20251105

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesdk/cesdk-js",
3
- "version": "1.64.0-nightly.20251030",
3
+ "version": "1.64.0-nightly.20251105",
4
4
  "module": "./index.js",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",
@@ -27,6 +27,18 @@
27
27
  "import": "./angular/index.js",
28
28
  "module": "./angular/index.js",
29
29
  "default": "./angular/index.js"
30
+ },
31
+ "./plugins": {
32
+ "types": "./plugins/index.d.ts",
33
+ "import": "./plugins/index.js",
34
+ "module": "./plugins/index.js",
35
+ "default": "./plugins/index.js"
36
+ },
37
+ "./configs": {
38
+ "types": "./configs/index.d.ts",
39
+ "import": "./configs/index.js",
40
+ "module": "./configs/index.js",
41
+ "default": "./configs/index.js"
30
42
  }
31
43
  },
32
44
  "homepage": "https://www.img.ly",
@@ -34,7 +46,7 @@
34
46
  "license": "SEE LICENSE IN LICENSE.md",
35
47
  "readme": "README.md",
36
48
  "dependencies": {
37
- "@cesdk/engine": "1.64.0-nightly.20251030"
49
+ "@cesdk/engine": "1.64.0-nightly.20251105"
38
50
  },
39
51
  "peerDependencies": {
40
52
  "@angular/common": ">=14.0.0",
@@ -0,0 +1,231 @@
1
+ import type { EditorPlugin } from '@cesdk/cesdk-js';
2
+ import type { EditorPluginContext } from '@cesdk/cesdk-js';
3
+
4
+ /**
5
+ * Provides blur effect assets for the Creative Editor SDK.
6
+ * @public
7
+ */
8
+ export declare class BlurAssetSource implements EditorPlugin {
9
+ private config;
10
+ name: string;
11
+ version: string;
12
+ private addedAssetSourceIds;
13
+ constructor(config?: BlurAssetSourceConfig);
14
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
15
+ cleanup({ engine }: EditorPluginContext): void;
16
+ }
17
+
18
+ declare interface BlurAssetSourceConfig {
19
+ baseURL?: string;
20
+ matcher?: string[];
21
+ }
22
+
23
+ /**
24
+ * Provides caption preset assets for the Creative Editor SDK.
25
+ * @public
26
+ */
27
+ export declare class CaptionPresetsAssetSource implements EditorPlugin {
28
+ private config;
29
+ name: string;
30
+ version: string;
31
+ private addedAssetSourceIds;
32
+ constructor(config?: CaptionPresetsAssetSourceConfig);
33
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
34
+ cleanup({ engine }: EditorPluginContext): void;
35
+ }
36
+
37
+ declare interface CaptionPresetsAssetSourceConfig {
38
+ baseURL?: string;
39
+ customFetchImpl?: typeof fetch;
40
+ }
41
+
42
+ /**
43
+ * Provides color palette assets for the Creative Editor SDK.
44
+ * @public
45
+ */
46
+ export declare class ColorPaletteAssetSource implements EditorPlugin {
47
+ private config;
48
+ name: string;
49
+ version: string;
50
+ private addedAssetSourceIds;
51
+ constructor(config?: ColorPaletteAssetSourceConfig);
52
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
53
+ cleanup({ engine }: EditorPluginContext): void;
54
+ }
55
+
56
+ declare interface ColorPaletteAssetSourceConfig {
57
+ baseURL?: string;
58
+ matcher?: string[];
59
+ }
60
+
61
+ /**
62
+ * Provides crop preset assets for the Creative Editor SDK.
63
+ * @public
64
+ */
65
+ export declare class CropPresetsAssetSource implements EditorPlugin {
66
+ private config;
67
+ name: string;
68
+ version: string;
69
+ private addedAssetSourceIds;
70
+ constructor(config?: CropPresetsAssetSourceConfig);
71
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
72
+ cleanup({ engine }: EditorPluginContext): void;
73
+ }
74
+
75
+ declare interface CropPresetsAssetSourceConfig {
76
+ baseURL?: string;
77
+ matcher?: string[];
78
+ }
79
+
80
+ /**
81
+ * Provides demo assets and templates for testing and development.
82
+ * @public
83
+ */
84
+ export declare class DemoAssetSources implements EditorPlugin {
85
+ private config;
86
+ name: string;
87
+ version: string;
88
+ private addedAssetSourceIds;
89
+ constructor(config?: DemoAssetSourcesConfig);
90
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
91
+ cleanup({ engine }: EditorPluginContext): void;
92
+ }
93
+
94
+ declare interface DemoAssetSourcesConfig {
95
+ baseURL?: string;
96
+ }
97
+
98
+ /**
99
+ * Provides visual effect assets for the Creative Editor SDK.
100
+ * @public
101
+ */
102
+ export declare class EffectsAssetSource implements EditorPlugin {
103
+ private config;
104
+ name: string;
105
+ version: string;
106
+ private addedAssetSourceIds;
107
+ constructor(config?: EffectsAssetSourceConfig);
108
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
109
+ cleanup({ engine }: EditorPluginContext): void;
110
+ }
111
+
112
+ declare interface EffectsAssetSourceConfig {
113
+ baseURL?: string;
114
+ matcher?: string[];
115
+ }
116
+
117
+ /**
118
+ * Provides filter assets for the Creative Editor SDK.
119
+ * @public
120
+ */
121
+ export declare class FiltersAssetSource implements EditorPlugin {
122
+ private config;
123
+ name: string;
124
+ version: string;
125
+ private addedAssetSourceIds;
126
+ constructor(config?: FiltersAssetSourceConfig);
127
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
128
+ cleanup({ engine }: EditorPluginContext): void;
129
+ }
130
+
131
+ declare interface FiltersAssetSourceConfig {
132
+ baseURL?: string;
133
+ matcher?: string[];
134
+ }
135
+
136
+ /**
137
+ * Provides page layout preset assets for the Creative Editor SDK.
138
+ * @public
139
+ */
140
+ export declare class PagePresetsAssetSource implements EditorPlugin {
141
+ private config;
142
+ name: string;
143
+ version: string;
144
+ private addedAssetSourceIds;
145
+ constructor(config?: PagePresetsAssetSourceConfig);
146
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
147
+ cleanup({ engine }: EditorPluginContext): void;
148
+ }
149
+
150
+ declare interface PagePresetsAssetSourceConfig {
151
+ baseURL?: string;
152
+ matcher?: string[];
153
+ }
154
+
155
+ /**
156
+ * Provides sticker assets for the Creative Editor SDK.
157
+ * @public
158
+ */
159
+ export declare class StickerAssetSource implements EditorPlugin {
160
+ private config;
161
+ name: string;
162
+ version: string;
163
+ private addedAssetSourceIds;
164
+ constructor(config?: StickerAssetSourceConfig);
165
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
166
+ cleanup({ engine }: EditorPluginContext): void;
167
+ }
168
+
169
+ declare interface StickerAssetSourceConfig {
170
+ baseURL?: string;
171
+ matcher?: string[];
172
+ }
173
+
174
+ /**
175
+ * Provides text component assets for the Creative Editor SDK.
176
+ * @public
177
+ */
178
+ export declare class TextComponentAssetSource implements EditorPlugin {
179
+ private config;
180
+ name: string;
181
+ version: string;
182
+ private addedAssetSourceIds;
183
+ constructor(config?: TextComponentAssetSourceConfig);
184
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
185
+ cleanup({ engine }: EditorPluginContext): void;
186
+ }
187
+
188
+ declare interface TextComponentAssetSourceConfig {
189
+ baseURL?: string;
190
+ matcher?: string[];
191
+ }
192
+
193
+ /**
194
+ * Provides typeface and font assets for the Creative Editor SDK.
195
+ * @public
196
+ */
197
+ export declare class TypefaceAssetSource implements EditorPlugin {
198
+ private config;
199
+ name: string;
200
+ version: string;
201
+ private addedAssetSourceIds;
202
+ constructor(config?: TypefaceAssetSourceConfig);
203
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
204
+ cleanup({ engine }: EditorPluginContext): void;
205
+ }
206
+
207
+ declare interface TypefaceAssetSourceConfig {
208
+ baseURL?: string;
209
+ matcher?: string[];
210
+ }
211
+
212
+ /**
213
+ * Provides vector path shape assets for the Creative Editor SDK.
214
+ * @public
215
+ */
216
+ export declare class VectorPathAssetSource implements EditorPlugin {
217
+ private config;
218
+ name: string;
219
+ version: string;
220
+ private addedAssetSourceIds;
221
+ constructor(config?: VectorPathAssetSourceConfig);
222
+ initialize({ engine, cesdk }: EditorPluginContext): Promise<void>;
223
+ cleanup({ engine }: EditorPluginContext): void;
224
+ }
225
+
226
+ declare interface VectorPathAssetSourceConfig {
227
+ baseURL?: string;
228
+ matcher?: string[];
229
+ }
230
+
231
+ export { }
@@ -0,0 +1 @@
1
+ import CreativeEditorSDK from"@cesdk/cesdk-js";var e=class{constructor(e={}){this.config=e}name="cesdk-blur-asset-source";version=CreativeEditorSDK.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.blur";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import s from"@cesdk/cesdk-js";var t="ly.img.captionPresets",o=["backgroundColor/enabled","backgroundColor/color","backgroundColor/cornerRadius","backgroundColor/paddingBottom","backgroundColor/paddingLeft","backgroundColor/paddingRight","backgroundColor/paddingTop","blend/mode","dropShadow/enabled","dropShadow/color","dropShadow/offset/x","dropShadow/offset/y","dropShadow/blurRadius/x","dropShadow/blurRadius/y","dropShadow/clip","fill/enabled","fill/solid/color","opacity","stroke/enabled","stroke/color","stroke/width","stroke/style","stroke/position","stroke/cornerGeometry","{{blockType}}/typeface","{{blockType}}/fontSize","{{blockType}}/horizontalAlignment","{{blockType}}/verticalAlignment","{{blockType}}/letterSpacing","{{blockType}}/lineHeight","{{blockType}}/automaticFontSizeEnabled","{{blockType}}/maxAutomaticFontSize","{{blockType}}/minAutomaticFontSize","{{blockType}}/paragraphSpacing"];function n(e){const s=e.scene.getCurrentPage();if(null!=s)return e.block.getChildren(s).find((s=>"//ly.img.ubq/captionTrack"===e.block.getType(s)))}function i(e){const s=n(e);if(null==s)return 1;try{const t=e.block.getMetadata(s,"previousScale"),o=parseFloat(t);return Number.isNaN(o)?1:o}catch(e){return 1}}function a(e,s,t){const o=i(e),a=e.block.getTextFontSizes(s)[0]/o,r=Math.round(a*t);if(e.block.setTextFontSize(s,r),e.block.isStrokeEnabled(s)){const n=e.block.getStrokeWidth(s)/o*t;e.block.setStrokeWidth(s,n)}if(e.block.isDropShadowEnabled(s)){const n=e.block.getDropShadowOffsetX(s)/o,i=e.block.getDropShadowOffsetY(s)/o,a=e.block.getDropShadowBlurRadiusX(s)/o,r=e.block.getDropShadowBlurRadiusY(s)/o;e.block.setDropShadowOffsetX(s,n*t),e.block.setDropShadowOffsetY(s,i*t),e.block.setDropShadowBlurRadiusX(s,a*t),e.block.setDropShadowBlurRadiusY(s,r*t)}!function(e,s){const t=n(e);null!=t&&e.block.setMetadata(t,"previousScale",s.toString())}(e,t)}var r=class{engine;assets=[];customFetchImpl;baseURL;constructor(e,s,t){this.engine=e,this.baseURL=s,this.customFetchImpl=t??window.fetch.bind(window)}async initialize(){await this.fetchAssets(),this.createSource()}async fetchAssets(){const e=function(...e){return e.map(((e,s)=>0===s?e.replace(/\/$/,""):e.replace(/^\//,"").replace(/\/$/,""))).join("/")}(this.baseURL,`/${t}/content.json`);try{const s=await this.customFetchImpl(e);if(!s.ok)throw new Error(s.statusText);const o=await s.json();if(void 0===o.assets)throw new Error(`Invalid content.json for assets: ${t}`);this.assets=o.assets.map((e=>(e.meta&&Object.entries(e.meta).forEach((([s,t])=>{const o=t.toString();if(o.includes("{{base_url}}")){const t=o.replace("{{base_url}}",this.baseURL);e.meta&&(e.meta[s]=t)}})),e)))}catch(e){console.warn("Could not load caption presets:",e),this.assets=[]}}createSource(){if(new Set(this.engine.asset.findAllSources()).has(t))return;const e={id:t,findAssets:e=>{const{page:s,perPage:o,excludeGroups:a,groups:r,locale:c="en",query:d,sortActiveFirst:l,sortKey:u,sortingOrder:h,tags:p}=e,g=n(this.engine),m=null!=g&&this.engine.block.hasMetadata(g,"activePreset")?this.engine.block.getMetadata(g,"activePreset"):void 0;let f=[...this.assets];if(r&&r.length>0&&(f=f.filter((e=>e.groups?.some((e=>r.includes(e)))))),d&&""!==d.trim()){const e=d.toLowerCase().trim();f=f.filter((s=>(s.label?.[c]?.toLowerCase()||"").includes(e)))}p&&p.length>0&&(f=f.filter((e=>(e.tags?.[c]??[]).some((e=>p.includes(e)))))),a&&a.length>0&&(f=f.filter((e=>!(e.groups??[]).some((e=>a.includes(e)))))),"label"===u&&"None"!==h&&f.sort(((e,s)=>{const t=e.label?.[c]?.toLocaleLowerCase()||"",o=s.label?.[c]?.toLocaleLowerCase()||"";return t<o?"Ascending"===h?-1:1:t>o?"Ascending"===h?1:-1:0})),l&&m&&f.sort(((e,s)=>e.id===m?-1:s.id===m?1:0));const S=f.length,b=s*o,k=b+o,y=f.slice(b,k).map((e=>{const s=e.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:i(this.engine)}:e));return{id:e.id,label:e.label?.[c],active:e.id===m,context:{id:t},meta:e.meta,groups:e.groups,tags:e.tags?.[c],payload:{...e.payload,properties:s},locale:c}}));return Promise.resolve({assets:y,total:S,currentPage:s})},getGroups:()=>{const e=new Set;return this.assets.forEach((s=>{s.groups&&s.groups.forEach((s=>{e.add(s)}))})),Promise.resolve(Array.from(e))},removeAsset:e=>{const s=this.assets.findIndex((s=>s.id===e));-1!==s&&this.assets.splice(s,1)},addAsset:e=>{const s=this.assets.findIndex((s=>s.id===e.id));-1!==s?this.assets[s]=e:this.assets.push(e)},applyAssetToBlock:(e,s)=>this.applyPreset(e,s),applyAssetProperty:(e,s)=>this.applyProperty(e,s),fetchAsset:async(e,s)=>new Promise((t=>{const o=this.assets.find((s=>s.id===e));if(null==o)t(null);else{const e=s?.locale??"en",a=n(this.engine),r=null!=a&&this.engine.block.hasMetadata(a,"activePreset")?this.engine.block.getMetadata(a,"activePreset"):void 0,c=o.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:i(this.engine)}:e));t({id:o.id,label:o.label?.[e],active:o.id===r,meta:o.meta,groups:o.groups,tags:o.tags?.[e],payload:{...o.payload,properties:c}})}}))};this.engine.asset.addSource(e)}async applyPreset(e,s){const i=e?.meta?.uri;if(null==i)throw new Error(`The asset ${e.id} does not have a preset block URL.`);const a=await this.customFetchImpl(i);if(!a.ok)throw new Error(`Failed to fetch the preset block from ${i}`);const r=await a.text(),[c]=await this.engine.block.loadFromString(r),d=null!=c?this.engine.block.getType(c):void 0;if("//ly.img.ubq/text"!==d&&"//ly.img.ubq/caption"!==d)return;const l=n(this.engine),u=null!=l?this.engine.block.getChildren(l):[];o.forEach((e=>{const t=e.replace("{{blockType}}","//ly.img.ubq/text"===d?"text":"caption"),o=this.engine.block.getPropertyType(t),n=e.replace("{{blockType}}","caption");switch(o){case"Int":{const e=this.engine.block.getInt(c,t);this.engine.block.setInt(s,n,e);break}case"Float":{const e=this.engine.block.getFloat(c,t);this.engine.block.setFloat(s,n,e);break}case"Double":{const e=this.engine.block.getDouble(c,t);this.engine.block.setDouble(s,n,e);break}case"Bool":{const e=this.engine.block.getBool(c,t);this.engine.block.setBool(s,n,e);break}case"Enum":{if("stroke/position"===t)break;const e=this.engine.block.getEnum(c,t);this.engine.block.setEnum(s,n,e);break}case"Color":{if("fill/solid/color"===t){const[e]=this.engine.block.getTextColors(c);this.engine.block.setColor(s,n,e),"Text"===this.engine.editor.getEditMode()&&this.engine.editor.setEditMode("Transform"),this.engine.block.setTextColor(s,e);break}const e=this.engine.block.getColor(c,t);this.engine.block.setColor(s,n,e);break}case"String":{if("text/typeface"===t||"caption/typeface"===t){const e=this.engine.block.getTypeface(c);this.engine.block.setTypeface(s,e);break}const e=this.engine.block.getString(c,t);this.engine.block.setString(s,n,e);break}}})),e.payload?.properties?.forEach((async s=>{"Color"===s.type&&await this.applyProperty(e,s)}));const[h]=this.engine.block.getTextFontWeights(c);null!=h&&this.engine.block.setTextFontWeight(s,h);const[p]=this.engine.block.getTextFontStyles(c);null!=p&&this.engine.block.setTextFontStyle(s,p),function(e,s,t){const o={in:e.block.getInAnimation(s),loop:e.block.getLoopAnimation(s),out:e.block.getOutAnimation(s)},n=(s,t)=>{const n=o[t],i=(()=>{switch(t){case"in":return e.block.getInAnimation(s);case"loop":return e.block.getLoopAnimation(s);case"out":return e.block.getOutAnimation(s);default:return}})();if(null!=i&&e.block.isValid(i)&&e.block.destroy(i),e.block.isValid(n)){const o=e.block.duplicate(n);switch(t){case"in":e.block.setInAnimation(s,o);break;case"loop":e.block.setLoopAnimation(s,o);break;case"out":e.block.setOutAnimation(s,o)}}};t.forEach((e=>{n(e,"in"),n(e,"loop"),n(e,"out")}))}(this.engine,c,u),null!=l&&this.engine.block.setMetadata(l,"activePreset",e.id),this.engine.block.destroy(c),this.engine.editor.addUndoStep(),this.engine.asset.assetSourceContentsChanged(t)}async applyProperty(e,s){const o=n(this.engine);if(null==o)return;const[i]=this.engine.block.findAllSelected(),r="//ly.img.ubq/caption"===(null!=i?this.engine.block.getType(i):void 0)?i:this.engine.block.getChildren(o)[0];if(null!=r){switch(s.type){case"Color":if("fill/solid/color"===s.property){this.engine.block.setColor(r,s.property,s.value),this.engine.block.setTextColor(r,s.value);break}this.engine.block.setColor(r,s.property,s.value);break;case"Int":this.engine.block.setInt(r,s.property,s.value);break;case"Float":if("caption/scale"===s.property){a(this.engine,r,s.value);break}this.engine.block.setFloat(r,s.property,s.value);break;case"Double":this.engine.block.setDouble(r,s.property,s.value);break;case"Boolean":this.engine.block.setBool(r,s.property,s.value);break;case"Enum":this.engine.block.setEnum(r,s.property,s.value);break;case"String":this.engine.block.setString(r,s.property,s.value)}this.assets=function(e,s,t){return e.map((e=>{if("caption/scale"===t.property){const s=e.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:t.value}:e));return{...e,payload:{...e.payload,properties:s}}}if(e.id===s.id){const s=e.payload?.properties?.map((e=>e.property===t.property?{...e,value:t.value}:e));return{...e,payload:{...e.payload,properties:s}}}return e}))}(this.assets,e,s),this.engine.asset.assetSourceContentsChanged(t)}}},c=class{constructor(e={}){this.config=e}name="cesdk-caption-presets-asset-source";version=s.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new r(e,o,this.config.customFetchImpl);await n.initialize();const i="ly.img.captionPresets";this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}},d=class{constructor(e={}){this.config=e}name="cesdk-color-palette-asset-source";version="1.61";addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.colors.defaultPalette";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import l from"@cesdk/cesdk-js";var u=class{constructor(e={}){this.config=e}name="cesdk-crop-presets-asset-source";version=l.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.crop.presets";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry("ly.img.cropPresets",{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import h from"@cesdk/cesdk-js";var p=class{constructor(e={}){this.config=e}name="cesdk-demo-asset-sources";version=h.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.image.upload";n.has(i)||(e.asset.addLocalSource(i,["image/jpeg","image/png","image/webp","image/svg+xml","image/bmp","image/gif"]),this.addedAssetSourceIds.push(i));const a="ly.img.video.upload";n.has(a)||(e.asset.addLocalSource(a,["application/json","video/mp4","video/quicktime","video/webm","video/matroska","image/gif"]),this.addedAssetSourceIds.push(a));const r="ly.img.audio.upload";n.has(r)||(e.asset.addLocalSource(r,["audio/mpeg","audio/mp3","audio/x-m4a","audio/wav"]),this.addedAssetSourceIds.push(r));const c="ly.img.template";n.has(c)||(e.asset.addLocalSource(c,void 0,(async s=>{const t=s.meta?.uri;if(t)if(t.startsWith("UBQ1"))e.scene.applyTemplateFromString(t);else{const s=new URL(t,window.location.href);e.scene.applyTemplateFromURL(s.href)}})),this.addedAssetSourceIds.push(c));const d="ly.img.video.template";n.has(d)||(e.asset.addLocalSource(d,void 0,(async s=>{const t=s.meta?.uri;if(t)if(t.startsWith("UBQ1"))e.scene.applyTemplateFromString(t);else{const s=new URL(t,window.location.href);e.scene.applyTemplateFromURL(s.href)}})),this.addedAssetSourceIds.push(d));const l=["ly.img.audio","ly.img.video","ly.img.image",c,d];for(const s of l){if(!n.has(s)){const t=`${o}${s}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(t)}this.addedAssetSourceIds.push(s)}if(s){s.onReset((()=>this.cleanup({engine:e})));const t=[i,a,r];s.ui.updateAssetLibraryEntry("ly.img.image",{sourceIds:({currentIds:e})=>[...new Set([...e,i,"ly.img.image"])]}),s.ui.updateAssetLibraryEntry("ly.img.video",{sourceIds:({currentIds:e})=>[...new Set([...e,a,"ly.img.video"])]}),s.ui.updateAssetLibraryEntry("ly.img.audio",{sourceIds:({currentIds:e})=>[...new Set([...e,r,"ly.img.audio"])]}),s.ui.updateAssetLibraryEntry("ly.img.upload",{sourceIds:({currentIds:e})=>[...new Set([...e,...t])]}),s.ui.updateAssetLibraryEntry("ly.img.template",{sourceIds:({currentIds:e})=>[...new Set([...e,c])]}),s.ui.updateAssetLibraryEntry("ly.img.video.template",{sourceIds:({currentIds:e})=>[...new Set([...e,d])]})}}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)if(s.has(t))try{e.asset.removeSource(t)}catch(e){console.warn("Unable to remove source with id: ",t)}this.addedAssetSourceIds=[]}};import g from"@cesdk/cesdk-js";var m=class{constructor(e={}){this.config=e}name="cesdk-effects-asset-source";version=g.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.effect";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import f from"@cesdk/cesdk-js";var S=class{constructor(e={}){this.config=e}name="cesdk-filters-asset-source";version=f.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i=["ly.img.filter.lut","ly.img.filter.duotone"];for(const s of i){if(!n.has(s)){const t=`${o}${s}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(t,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(s)}if(s){s.onReset((()=>this.cleanup({engine:e})));for(const e of i)s.ui.updateAssetLibraryEntry(e,{sourceIds:({currentIds:s})=>[...new Set([...s,e])]})}}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import b from"@cesdk/cesdk-js";var k=class{constructor(e={}){this.config=e}name="cesdk-page-presets-asset-source";version=b.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i=["ly.img.page.presets","ly.img.page.presets.video"];for(const s of i){if(!n.has(s)){const t=`${o}${s}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(t,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(s)}if(s)for(const e of i)s.ui.updateAssetLibraryEntry("ly.img.pagePresets",{sourceIds:({currentIds:s})=>[...new Set([...s,e])]})}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import y from"@cesdk/cesdk-js";var w=class{constructor(e={}){this.config=e}name="cesdk-sticker-asset-source";version=y.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.sticker";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import A from"@cesdk/cesdk-js";var I=class{constructor(e={}){this.config=e}name="cesdk-text-component-asset-source";version=A.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n="ly.img.textComponents";if(!new Set(e.asset.findAllSources()).has(n)){const s=`${o}${n}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}if(this.addedAssetSourceIds.push(n),s){s.onReset((()=>this.cleanup({engine:e})));const t="ly.img.text",o=["ly.img.text","ly.img.textComponents"];s.ui.updateAssetLibraryEntry(t,{sourceIds:({currentIds:e})=>[...new Set([...e,...o])]})}}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import v from"@cesdk/cesdk-js";var L=class{constructor(e={}){this.config=e}name="cesdk-typeface-asset-source";version=v.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.typeface";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]})}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};import R from"@cesdk/cesdk-js";var U=class{constructor(e={}){this.config=e}name="cesdk-vectorpath-asset-source";version=R.version;addedAssetSourceIds=[];async initialize({engine:e,cesdk:s}){const t=this.config.baseURL||s?.getBaseURL()||e.editor.getSetting("basePath");if(!t)throw new Error("Cannot determine baseURL");const o=t.replace(/\/*$/,"/"),n=new Set(e.asset.findAllSources()),i="ly.img.vectorpath";if(!n.has(i)){const s=`${o}${i}/content.json`;await e.asset.addLocalAssetSourceFromJSONURI(s,{matcher:this.config.matcher})}this.addedAssetSourceIds.push(i),s&&(s.onReset((()=>this.cleanup({engine:e}))),s.ui.updateAssetLibraryEntry(i,{sourceIds:({currentIds:e})=>[...new Set([...e,i])]}))}cleanup({engine:e}){const s=new Set(e.asset.findAllSources());for(const t of this.addedAssetSourceIds)s.has(t)&&e.asset.removeSource(t);this.addedAssetSourceIds=[]}};export{e as BlurAssetSource,c as CaptionPresetsAssetSource,d as ColorPaletteAssetSource,u as CropPresetsAssetSource,p as DemoAssetSources,m as EffectsAssetSource,S as FiltersAssetSource,k as PagePresetsAssetSource,w as StickerAssetSource,I as TextComponentAssetSource,L as TypefaceAssetSource,U as VectorPathAssetSource};