@creaditor/web-starterkit 1.0.22 → 1.0.23
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/dist/1260.creaditor.bundle.js +55 -41
- package/dist/1260.creaditor.bundle.js.gz +0 -0
- package/dist/1271.creaditor.bundle.js +469 -364
- package/dist/1271.creaditor.bundle.js.gz +0 -0
- package/dist/1334.creaditor.bundle.js +1 -1
- package/dist/1334.creaditor.bundle.js.gz +0 -0
- package/dist/170.creaditor.bundle.js +15 -15
- package/dist/170.creaditor.bundle.js.gz +0 -0
- package/dist/2590.creaditor.bundle.js +1 -1
- package/dist/2590.creaditor.bundle.js.gz +0 -0
- package/dist/271.creaditor.bundle.js +6 -6
- package/dist/271.creaditor.bundle.js.gz +0 -0
- package/dist/3521.creaditor.bundle.js +2 -2
- package/dist/3521.creaditor.bundle.js.gz +0 -0
- package/dist/3553.creaditor.bundle.js +1 -1
- package/dist/3553.creaditor.bundle.js.gz +0 -0
- package/dist/3606.creaditor.bundle.js +12 -4
- package/dist/3606.creaditor.bundle.js.gz +0 -0
- package/dist/3932.creaditor.bundle.js +4 -4
- package/dist/3932.creaditor.bundle.js.gz +0 -0
- package/dist/4186.creaditor.bundle.js +5 -1
- package/dist/4186.creaditor.bundle.js.gz +0 -0
- package/dist/453.creaditor.bundle.js +8 -6
- package/dist/453.creaditor.bundle.js.gz +0 -0
- package/dist/4762.creaditor.bundle.js +1 -1
- package/dist/4762.creaditor.bundle.js.gz +0 -0
- package/dist/5133.creaditor.bundle.js +3 -3
- package/dist/5133.creaditor.bundle.js.gz +0 -0
- package/dist/567.creaditor.bundle.js +469 -364
- package/dist/567.creaditor.bundle.js.gz +0 -0
- package/dist/5849.creaditor.bundle.js +2 -2
- package/dist/5849.creaditor.bundle.js.gz +0 -0
- package/dist/5909.creaditor.bundle.js +33 -30
- package/dist/5909.creaditor.bundle.js.gz +0 -0
- package/dist/5926.creaditor.bundle.js +74 -13
- package/dist/5926.creaditor.bundle.js.gz +0 -0
- package/dist/638.creaditor.bundle.js +1 -1
- package/dist/638.creaditor.bundle.js.gz +0 -0
- package/dist/7209.creaditor.bundle.js +1 -1
- package/dist/7209.creaditor.bundle.js.gz +0 -0
- package/dist/752.creaditor.bundle.js +6 -4
- package/dist/752.creaditor.bundle.js.gz +0 -0
- package/dist/7654.creaditor.bundle.js +37 -14
- package/dist/7654.creaditor.bundle.js.gz +0 -0
- package/dist/7997.creaditor.bundle.js +1 -1
- package/dist/7997.creaditor.bundle.js.gz +0 -0
- package/dist/8443.creaditor.bundle.js +1 -1
- package/dist/8443.creaditor.bundle.js.gz +0 -0
- package/dist/8547.creaditor.bundle.js +125 -108
- package/dist/8547.creaditor.bundle.js.gz +0 -0
- package/dist/8570.creaditor.bundle.js +3 -3
- package/dist/8570.creaditor.bundle.js.gz +0 -0
- package/dist/8854.creaditor.bundle.js +4 -4
- package/dist/8854.creaditor.bundle.js.gz +0 -0
- package/dist/8916.creaditor.bundle.js +3 -1
- package/dist/8916.creaditor.bundle.js.gz +0 -0
- package/dist/9041.creaditor.bundle.js +1 -1
- package/dist/9041.creaditor.bundle.js.gz +0 -0
- package/dist/9250.creaditor.bundle.js +1 -1
- package/dist/9250.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +192 -181
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2384,8547],{58691(t,e,a){a.r(e),a.d(e,{ImagePromptEditor:()=>l});var r,i
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[2384,8547],{58691(t,e,a){a.r(e),a.d(e,{ImagePromptEditor:()=>l});var r,o,i=a(59929),s=a(49410);const n=new Set;let l=(0,s.EM)("cdtr-image-prompt-editor")(((o=class extends i.WF{constructor(){super(),this.prompt="",this.generatedImage="",this.isLoading=!1,this.addEventListener("keydown",this._handleKeyDown.bind(this))}_handleKeyDown(t){"Enter"===t.key&&t.ctrlKey&&this._submitPrompt()}_handlePromptChange(t){this.prompt=t.target.value}_submitPrompt(){this.prompt.trim()&&!this.isLoading&&(this.isLoading=!0,this.dispatchEvent(new CustomEvent("generate-image",{detail:{prompt:this.prompt,options:{size:"1024x1024",quality:"standard",style:"natural"}}})))}_handleInsertImage(){const t=(e=this.generatedImage).length<100?e:e.slice(0,50)+e.slice(-50);var e;n.has(t)||(n.add(t),this.dispatchEvent(new CustomEvent("insert-image",{detail:{imageUrl:this.generatedImage}})))}setGeneratedImage(t){this.isLoading=!1,this.generatedImage=t,this.requestUpdate()}copyToClipboard(){navigator.clipboard.writeText(this.generatedImage),window.snackbar&&window.snackbar({message:"copied_to_clipboard",type:"success"})}render(){return i.qy`
|
|
2
2
|
<div class="container">
|
|
3
3
|
<h6>
|
|
4
4
|
<lang-text
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
text="image_prompt_editor_description"
|
|
7
7
|
></lang-text>
|
|
8
8
|
</h6>
|
|
9
|
-
${this.generatedImage?
|
|
9
|
+
${this.generatedImage?i.qy`
|
|
10
10
|
<cdtr-input
|
|
11
11
|
@click="${this.copyToClipboard}"
|
|
12
12
|
fullWidth
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
/>
|
|
21
21
|
</div>
|
|
22
22
|
`:null}
|
|
23
|
-
${this.generatedImage?
|
|
23
|
+
${this.generatedImage?i.qy`
|
|
24
24
|
<paper-button
|
|
25
25
|
class="insert-button"
|
|
26
26
|
@click="${this._handleInsertImage}"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
?disabled="${!this.prompt.trim()||this.isLoading}"
|
|
44
44
|
@click="${this._submitPrompt}"
|
|
45
45
|
>
|
|
46
|
-
${this.isLoading?
|
|
47
|
-
<lang-text text="generating"></lang-text>`:
|
|
46
|
+
${this.isLoading?i.qy`<div class="spinner"></div>
|
|
47
|
+
<lang-text text="generating"></lang-text>`:i.qy`<lang-text text="generate_image"></lang-text>`}
|
|
48
48
|
</paper-button>
|
|
49
49
|
|
|
50
50
|
<div class="loading ${this.isLoading?"active":""}">
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
`}}).properties={prompt:{type:String},generatedImage:{type:String},isLoading:{type:Boolean}},
|
|
56
|
+
`}}).properties={prompt:{type:String},generatedImage:{type:String},isLoading:{type:Boolean}},o.styles=i.AH`
|
|
57
57
|
* {
|
|
58
58
|
box-sizing: border-box;
|
|
59
59
|
}
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
margin-bottom: 0.5rem;
|
|
170
170
|
color: #495057;
|
|
171
171
|
}
|
|
172
|
-
`,r=
|
|
172
|
+
`,r=o))||r},15155(t,e,a){a.d(e,{A:()=>s});var r=a(59929),o=a(57176);class i extends r.WF{constructor(){super(),this.items=[],this.columns=2}async openPicker(t){const e=this.shadowRoot.querySelector(`#picker-${t}`);if(!e)return;await e.updateComplete;const a=e.shadowRoot?.querySelector("color-playground");if(a)if(await a.updateComplete,"function"==typeof a.openColorpicker)a.openColorpicker();else{(a.shadowRoot?.querySelector('[role="button"]')||a.shadowRoot?.querySelector("div")||a).click()}}render(){const t=1===this.columns?"grid single-col":"grid";return r.qy`
|
|
173
173
|
<div class="${t}">
|
|
174
174
|
${(this.items||[]).map((t,e)=>r.qy`
|
|
175
175
|
<div class="swatch-item" @click=${()=>this.openPicker(e)}>
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
</div>
|
|
194
194
|
`)}
|
|
195
195
|
</div>
|
|
196
|
-
`}}
|
|
196
|
+
`}}i.styles=[o.L,r.AH`
|
|
197
197
|
:host {
|
|
198
198
|
display: block;
|
|
199
199
|
direction: var(--direction-locale, ltr);
|
|
@@ -241,12 +241,12 @@
|
|
|
241
241
|
clip: rect(0,0,0,0);
|
|
242
242
|
pointer-events: none;
|
|
243
243
|
}
|
|
244
|
-
`],
|
|
244
|
+
`],i.properties={items:{type:Array},columns:{type:Number}},customElements.define("cdtr-color-swatch-group",i);const s=t=>r.qy`
|
|
245
245
|
<cdtr-color-swatch-group
|
|
246
246
|
.items=${t.items}
|
|
247
247
|
.columns=${t.columns||2}
|
|
248
248
|
></cdtr-color-swatch-group>
|
|
249
|
-
`},12258(t,e,a){a.d(e,{A:()=>s});var r=a(59929),
|
|
249
|
+
`},12258(t,e,a){a.d(e,{A:()=>s});var r=a(59929),o=a(40648);class i extends r.WF{constructor(){super(),this.label="",this.open=!0,this.persistKey=""}toggle(){this.open=!this.open,(0,o.Q)(this.persistKey,this.open)}render(){return r.qy`
|
|
250
250
|
<div class="section">
|
|
251
251
|
<div class="header" @click=${this.toggle}>
|
|
252
252
|
<span class="title"><lang-text text="${this.label}"></lang-text></span>
|
|
@@ -260,14 +260,26 @@
|
|
|
260
260
|
</div>
|
|
261
261
|
</div>
|
|
262
262
|
</div>
|
|
263
|
-
`}}
|
|
263
|
+
`}}i.styles=r.AH`
|
|
264
264
|
:host {
|
|
265
265
|
display: block;
|
|
266
266
|
direction: var(--direction-locale, ltr);
|
|
267
267
|
--editor-container-inline-padding: 0;
|
|
268
268
|
}
|
|
269
269
|
.section {
|
|
270
|
-
|
|
270
|
+
position: relative;
|
|
271
|
+
}
|
|
272
|
+
/* Inset to the content gutter, not full-bleed: an edge-to-edge rule reads
|
|
273
|
+
as a table border. */
|
|
274
|
+
.section::after {
|
|
275
|
+
content: "";
|
|
276
|
+
display: block;
|
|
277
|
+
height: 1px;
|
|
278
|
+
margin: 0 var(--space-4, 16px);
|
|
279
|
+
background: var(--color-border-subtle, rgba(0, 0, 0, 0.06));
|
|
280
|
+
}
|
|
281
|
+
:host(:last-of-type) .section::after {
|
|
282
|
+
display: none;
|
|
271
283
|
}
|
|
272
284
|
.header {
|
|
273
285
|
display: flex;
|
|
@@ -276,16 +288,26 @@
|
|
|
276
288
|
padding: var(--space-3) var(--space-4);
|
|
277
289
|
cursor: pointer;
|
|
278
290
|
user-select: none;
|
|
291
|
+
/* Keeps the group name visible while its controls scroll past. */
|
|
292
|
+
position: sticky;
|
|
293
|
+
top: 0;
|
|
294
|
+
z-index: 1;
|
|
295
|
+
background: var(--color-bg, #fff);
|
|
296
|
+
}
|
|
297
|
+
.header:hover {
|
|
298
|
+
background: var(--color-bg-subtle, #fafbfc);
|
|
279
299
|
}
|
|
280
300
|
.title {
|
|
301
|
+
/* Larger and lighter than the labels inside it, not bolder — the labels
|
|
302
|
+
are what you act on. */
|
|
281
303
|
font-size: var(--text-md);
|
|
282
|
-
font-weight:
|
|
304
|
+
font-weight: 500;
|
|
283
305
|
color: var(--color-text);
|
|
284
|
-
letter-spacing: 0
|
|
306
|
+
letter-spacing: 0;
|
|
285
307
|
}
|
|
286
308
|
.chevron {
|
|
287
|
-
width:
|
|
288
|
-
height:
|
|
309
|
+
width: 14px;
|
|
310
|
+
height: 14px;
|
|
289
311
|
transition: transform var(--duration-normal) var(--ease-default), color var(--duration-fast) var(--ease-default);
|
|
290
312
|
color: var(--color-text-faint);
|
|
291
313
|
}
|
|
@@ -306,9 +328,10 @@
|
|
|
306
328
|
opacity: 1;
|
|
307
329
|
}
|
|
308
330
|
.content-inner {
|
|
309
|
-
|
|
331
|
+
/* Light on top: the controls inside bring their own leading pad. */
|
|
332
|
+
padding: var(--space-1) var(--space-4) var(--space-3) var(--space-4);
|
|
310
333
|
}
|
|
311
|
-
`,
|
|
334
|
+
`,i.properties={label:{type:String,reflect:!0,attribute:"data-label"},open:{type:Boolean,reflect:!0},persistKey:{type:String}},customElements.define("cdtr-editor-section",i);const s=(t,e)=>r.qy`
|
|
312
335
|
<cdtr-editor-section
|
|
313
336
|
.label=${t.label}
|
|
314
337
|
.open=${!1!==t.open}
|
|
@@ -316,7 +339,7 @@
|
|
|
316
339
|
>
|
|
317
340
|
${e}
|
|
318
341
|
</cdtr-editor-section>
|
|
319
|
-
`},88547(t,e,a){a.r(e),a.d(e,{EditorBuilder:()=>lt});var r=a(59929),
|
|
342
|
+
`},88547(t,e,a){a.r(e),a.d(e,{EditorBuilder:()=>lt});var r=a(59929),o=a(86319),i=a(32325),s=a(50220),n=a(36565);a(92384);const l=t=>r.qy`<cdtr-font-family-editor
|
|
320
343
|
.name=${t.value}
|
|
321
344
|
.showWeight=${!0===t.weight}
|
|
322
345
|
.weight=${t.weightValue}
|
|
@@ -353,7 +376,7 @@
|
|
|
353
376
|
@change=${t.onChange}
|
|
354
377
|
.sizes=${t.sizes||[]}
|
|
355
378
|
></cdtr-width-editor>
|
|
356
|
-
</cdtr-editor-container>`;var h=a(25879);const g=/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/,m=t=>{if("string"!=typeof t||!t.trim()||"none"===t)return{x:0,y:0,blur:0,spread:0,color:"#000000",inset:!1};const e=/\binset\b/.test(t),a=t.match(g),r=a?a[0]:"#000000",
|
|
379
|
+
</cdtr-editor-container>`;var h=a(25879);const g=/#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)/,m=t=>{if("string"!=typeof t||!t.trim()||"none"===t)return{x:0,y:0,blur:0,spread:0,color:"#000000",inset:!1};const e=/\binset\b/.test(t),a=t.match(g),r=a?a[0]:"#000000",o=(t.replace(g,"").match(/-?\d+(?:\.\d+)?/g)||[]).map(Number);return{x:o[0]??0,y:o[1]??0,blur:o[2]??0,spread:o[3]??0,color:r,inset:e}};class u extends r.WF{constructor(){super(),this.value="",this.title="",this._parts=m(""),this._lastEmitted=null}createRenderRoot(){return this}willUpdate(t){t.has("value")&&this.value!==this._lastEmitted&&(this._parts=m(this.value))}_emit(t){this._parts={...this._parts,...t},this.value=(t=>{let{x:e,y:a,blur:r,spread:o,color:i,inset:s}=t;return`${s?"inset ":""}${e}px ${a}px ${r}px ${o}px ${i}`})(this._parts),this._lastEmitted=this.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}render(){const t=this._parts,e=t=>e=>{e.stopPropagation(),this._emit(t(e))};return r.qy`
|
|
357
380
|
<div @input=${t=>t.stopPropagation()}>
|
|
358
381
|
${this.title?(0,h.A)({level:6,text:this.title}):""}
|
|
359
382
|
${d({title:"shadow_color",value:t.color,alpha:!0,onChange:e(t=>({color:t.target.value}))})}
|
|
@@ -369,33 +392,34 @@
|
|
|
369
392
|
></cdtr-box-shadow-editor-compose>`,b=t=>r.qy`<cdtr-divider></cdtr-divider>`,f=t=>r.qy` <cdtr-editor-container pt="0">
|
|
370
393
|
<paper-button
|
|
371
394
|
@click=${t.onClick}
|
|
372
|
-
style="margin:0;padding:0;color:${t.color||"var(--primary)"};font-size:10px;"
|
|
395
|
+
style="margin:0;padding:0;color:${t.color||"var(--color-primary, #6366f1)"};font-size:10px;"
|
|
373
396
|
>
|
|
374
397
|
<cdtr-icon
|
|
375
|
-
color="${t.color||"var(--primary)"}"
|
|
398
|
+
color="${t.color||"var(--color-primary, #6366f1)"}"
|
|
376
399
|
width="15"
|
|
377
400
|
icon="${t.icon||"doubleArrow"}"
|
|
378
401
|
></cdtr-icon>
|
|
379
402
|
<lang-text whiteSpace="break-spaces" text="${t.text}"></lang-text>
|
|
380
403
|
</paper-button>
|
|
381
404
|
</cdtr-editor-container>`,y=t=>r.qy` <cdtr-editor-container>
|
|
382
|
-
<
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
405
|
+
<div
|
|
406
|
+
class="checkbox-wrapper"
|
|
407
|
+
style="display:flex;align-items:center;gap:8px;"
|
|
408
|
+
@click=${t=>{if(t.target.closest("cdtr-checkbox"))return;const e=t.currentTarget.querySelector("cdtr-checkbox");e&&e.toggle()}}
|
|
409
|
+
>
|
|
410
|
+
<cdtr-checkbox
|
|
411
|
+
style="flex:0 0 auto;"
|
|
412
|
+
.controlled=${t.controlled}
|
|
413
|
+
@change=${t.onChange}
|
|
414
|
+
.checked=${!!t.checked}
|
|
415
|
+
></cdtr-checkbox>
|
|
416
|
+
<cdtr-title pb="0" style="flex:1 1 auto;min-width:0;cursor:pointer;"
|
|
417
|
+
><lang-text text="${t.title}"></lang-text
|
|
418
|
+
></cdtr-title>
|
|
419
|
+
${t.info?r.qy`<cdtr-tooltip style="flex:0 0 auto;" content="${t.info}">
|
|
420
|
+
<cdtr-icon color="#484553" icon="info" width="18"></cdtr-icon>
|
|
421
|
+
</cdtr-tooltip>`:null}
|
|
422
|
+
</div>
|
|
399
423
|
</cdtr-editor-container>`,x=t=>r.qy` <cdtr-editor-container>
|
|
400
424
|
<cdtr-title><lang-text text="${t.title}"></lang-text></cdtr-title>
|
|
401
425
|
${t.items?.length?t?.items.map((e,a)=>r.qy`
|
|
@@ -437,19 +461,19 @@
|
|
|
437
461
|
<cdtr-chips-input
|
|
438
462
|
.removeable=${!!t.removeable}
|
|
439
463
|
@remove=${t.onRemove}
|
|
440
|
-
@click=${()=>function(t){let{items:e,title:a,onChange:
|
|
464
|
+
@click=${()=>function(t){let{items:e,title:a,onChange:o,onCreate:i}=t;const s=document.createElement("cdtr-drawer");s.width="500px",s.headerText=a,s.opened=!0;const n=document.createElement("div");s.appendChild(n),document.body.appendChild(s);const l=t=>{let{target:a}=t;const s=a.value,c=e.filter(t=>{const e={...t};return e.name||(e.name=""),e.label||(e.label=""),-1!==e.name.indexOf(s)||-1!==e.label.indexOf(s)});(0,r.XX)((0,w.A)({items:c,onChange:o,debounce:l,onCreate:i}),n)};(0,r.XX)((0,w.A)({items:e,onChange:o,debounce:l,onCreate:i}),n)}({items:t.list||[],title:t.title,onChange:t.onChange,onCreate:t.onCreate})}
|
|
441
465
|
.items=${t.items}
|
|
442
466
|
.freeSolo=${!!t.freeSolo}
|
|
443
467
|
>
|
|
444
468
|
</cdtr-chips-input>
|
|
445
|
-
</cdtr-editor-container>`;var
|
|
469
|
+
</cdtr-editor-container>`;var z=a(88385),_=a(75068),k=a.n(_),L=a(70980);const C={minWidth:0,margin:0},M=t=>r.qy`
|
|
446
470
|
<cdtr-row alignItems="center" spacing="10px">
|
|
447
471
|
<paper-button
|
|
448
472
|
class="${t.underline?"bold":""}"
|
|
449
473
|
style=${(0,L.W)(C)}
|
|
450
474
|
@click=${e=>t.onChange("bold",e)}
|
|
451
475
|
><cdtr-icon
|
|
452
|
-
color="${t.bold?"var(--primary)":""}"
|
|
476
|
+
color="${t.bold?"var(--color-primary, #6366f1)":""}"
|
|
453
477
|
width="20"
|
|
454
478
|
icon="bold"
|
|
455
479
|
></cdtr-icon>
|
|
@@ -458,7 +482,7 @@
|
|
|
458
482
|
style=${(0,L.W)(C)}
|
|
459
483
|
@click=${e=>t.onChange("underline",e)}
|
|
460
484
|
><cdtr-icon
|
|
461
|
-
color="${t.underline?"var(--primary)":""}"
|
|
485
|
+
color="${t.underline?"var(--color-primary, #6366f1)":""}"
|
|
462
486
|
width="20"
|
|
463
487
|
icon="underline"
|
|
464
488
|
></cdtr-icon>
|
|
@@ -467,7 +491,7 @@
|
|
|
467
491
|
style=${(0,L.W)(C)}
|
|
468
492
|
@click=${e=>t.onChange("italic",e)}
|
|
469
493
|
><cdtr-icon
|
|
470
|
-
color="${t.italic?"var(--primary)":""}"
|
|
494
|
+
color="${t.italic?"var(--color-primary, #6366f1)":""}"
|
|
471
495
|
width="20"
|
|
472
496
|
icon="italic"
|
|
473
497
|
></cdtr-icon>
|
|
@@ -506,7 +530,7 @@
|
|
|
506
530
|
`:""}
|
|
507
531
|
</div>
|
|
508
532
|
`:""}
|
|
509
|
-
<paper-button style="margin-top:10px;width:100%;background:var(--primary);color:${t.buttonProps?.color||"var(--primary-text)"};"><lang-text text="${t.text||"gallery"}" ></lang-text>
|
|
533
|
+
<paper-button style="margin-top:10px;width:100%;background:var(--color-primary, #6366f1);color:${t.buttonProps?.color||"var(--color-primary-text, #ffffff)"};"><lang-text text="${t.text||"gallery"}" ></lang-text>
|
|
510
534
|
</paper-button>
|
|
511
535
|
<cdtr-gallery
|
|
512
536
|
@close=${e=>{e.opened=!1,"function"==typeof t.close&&t.close(e)}}
|
|
@@ -525,30 +549,30 @@
|
|
|
525
549
|
>
|
|
526
550
|
<thead>
|
|
527
551
|
<tr>
|
|
528
|
-
${e[0].items.map((a,
|
|
552
|
+
${e[0].items.map((a,o)=>r.qy`<th
|
|
529
553
|
style=" border: 1px solid #dddddd;
|
|
530
554
|
padding: 8px;"
|
|
531
555
|
>
|
|
532
556
|
<cdtr-input
|
|
533
557
|
inputStyle="font-weight:700;border:none;"
|
|
534
|
-
@change=${a=>((a,r)=>{t.onChangeHeader&&(e.forEach((t,e)=>{t.items[r].key=a}),
|
|
558
|
+
@change=${a=>((a,r)=>{t.onChangeHeader&&(e.forEach((t,e)=>{t.items[r].key=a}),V(e),t.onChangeHeader(e,a,r))})(a.target.value,o)}
|
|
535
559
|
value=${a.key}
|
|
536
560
|
></cdtr-input>
|
|
537
561
|
</th> `)}
|
|
538
562
|
</tr>
|
|
539
563
|
</thead>
|
|
540
564
|
<tbody>
|
|
541
|
-
${e.map((a,
|
|
565
|
+
${e.map((a,o)=>r.qy`
|
|
542
566
|
<tr style="color: ${a.color}">
|
|
543
|
-
${a.items.map((
|
|
567
|
+
${a.items.map((i,s)=>r.qy`<td
|
|
544
568
|
style=" border: 1px solid #dddddd;
|
|
545
569
|
padding: 8px;"
|
|
546
570
|
>
|
|
547
571
|
<cdtr-input
|
|
548
572
|
inputStyle="border:none;"
|
|
549
573
|
.disabled=${0!==s&&""===a.items[0].value}
|
|
550
|
-
@change=${a=>((a,r)=>{let{groupIndex:
|
|
551
|
-
value=${
|
|
574
|
+
@change=${a=>((a,r)=>{let{groupIndex:o,itemIndex:i}=r;t.onChangeValue&&(e[o].items[i].value=a,V(e),t.onChangeValue(e,{groupIndex:o,itemIndex:i,value:a}))})(a.target.value,{itemIndex:s,groupIndex:o})}
|
|
575
|
+
value=${i.value}
|
|
552
576
|
></cdtr-input>
|
|
553
577
|
</td>`)}
|
|
554
578
|
</tr>
|
|
@@ -563,20 +587,20 @@
|
|
|
563
587
|
</h3>
|
|
564
588
|
</cdtr-editor-container>
|
|
565
589
|
|
|
566
|
-
${e[0].items.map((a,
|
|
590
|
+
${e[0].items.map((a,o)=>r.qy`
|
|
567
591
|
<cdtr-editor-container>
|
|
568
592
|
<cdtr-row justify="space-between" alignItems="center">
|
|
569
593
|
<b>${a.key}</b>
|
|
570
594
|
${t.editableColor&&a.key?r.qy`<color-playground
|
|
571
|
-
@change=${a=>((a,r)=>{t.onChangeHeader&&(e[r].color=a,
|
|
572
|
-
value=${e[
|
|
595
|
+
@change=${a=>((a,r)=>{t.onChangeHeader&&(e[r].color=a,V(e),t.onChangeHeader(e,a,r))})(a.target.value,o)}
|
|
596
|
+
value=${e[o].color}
|
|
573
597
|
style="height:18px"
|
|
574
598
|
></color-playground>`:null}
|
|
575
599
|
</cdtr-row>
|
|
576
600
|
</cdtr-editor-container>
|
|
577
601
|
`)}
|
|
578
602
|
</div>
|
|
579
|
-
`};function
|
|
603
|
+
`};function V(t){t.forEach((t,e)=>{t.items=Array.from(t.items).filter(t=>t.key)})}const q=t=>r.qy`
|
|
580
604
|
<cdtr-editor-container>
|
|
581
605
|
<cdtr-link-element
|
|
582
606
|
.autofocus=${t.autofocus}
|
|
@@ -585,7 +609,7 @@
|
|
|
585
609
|
.target=${t.target}
|
|
586
610
|
@change=${t.onChange}
|
|
587
611
|
></cdtr-link-element
|
|
588
|
-
></cdtr-editor-container>`,
|
|
612
|
+
></cdtr-editor-container>`,E=[{name:"solid",value:"solid"},{name:"dashed",value:"dashed"},{name:"dotted",value:"dotted"},{name:"outset",value:"outset"},{name:"groove",value:"groove"},{name:"double",value:"double"},{name:"ridge",value:"ridge"}],B=t=>r.qy`<cdtr-editor-container>
|
|
589
613
|
<cdtr-row alignItems="center" jusitfyContent="space-between">
|
|
590
614
|
<cdtr-col>
|
|
591
615
|
<cdtr-title><lang-text text="type"></lang-text></cdtr-title>
|
|
@@ -599,7 +623,7 @@
|
|
|
599
623
|
><lang-text text="${t.borderType||t.value}"></lang-text>
|
|
600
624
|
</cdtr-dropdown-button>
|
|
601
625
|
<div slot="content">
|
|
602
|
-
${
|
|
626
|
+
${E.map(e=>r.qy`<cdtr-dropdown-item
|
|
603
627
|
.focused=${e.value===t.borderStyle||e.value===t.value}
|
|
604
628
|
.selected=${e.value===t.borderStyle||e.value===t.value}
|
|
605
629
|
value="${e.value}"
|
|
@@ -636,7 +660,7 @@
|
|
|
636
660
|
</cdtr-dropdown-item>`)}
|
|
637
661
|
</div>
|
|
638
662
|
</cdtr-dropdown>
|
|
639
|
-
</cdtr-editor-container>`};class P extends r.WF{constructor(){super(),this.onInput=this.onInput.bind(this),this.isLocked=!0,this.borderTopRightRadius=0,this.borderTopLeftRadius=0,this.borderBottomRightRadius=0,this.borderBottomLeftRadius=0}connectedCallback(){super.connectedCallback()}onInput(t,e){t.preventDefault();const a=t.target.value,r=a;this.isLocked?(this.borderTopRightRadius=a,this.borderTopLeftRadius=a,this.borderBottomRightRadius=a,this.borderBottomLeftRadius=a,this.json={borderTopRightRadius:r,borderTopLeftRadius:r,borderBottomRightRadius:r,borderBottomLeftRadius:r,borderRadius:null}):(this.borderTopRightRadius=parseInt(this.borderTopRightRadius||0),this.borderTopLeftRadius=parseInt(this.borderTopLeftRadius||0),this.borderBottomRightRadius=parseInt(this.borderBottomRightRadius||0),this.borderBottomLeftRadius=parseInt(this.borderBottomLeftRadius||0),this.json={borderTopRightRadius:parseInt(this.borderTopRightRadius||0),borderTopLeftRadius:parseInt(this.borderTopLeftRadius||0),borderBottomRightRadius:parseInt(this.borderBottomRightRadius||0),borderBottomLeftRadius:parseInt(this.borderBottomLeftRadius||0),borderRadius:null},this.json[e]=r),this.value=a,this.radiusKey=e;const
|
|
663
|
+
</cdtr-editor-container>`};class P extends r.WF{constructor(){super(),this.onInput=this.onInput.bind(this),this.isLocked=!0,this.borderTopRightRadius=0,this.borderTopLeftRadius=0,this.borderBottomRightRadius=0,this.borderBottomLeftRadius=0}connectedCallback(){super.connectedCallback()}onInput(t,e){t.preventDefault();const a=t.target.value,r=a;this.isLocked?(this.borderTopRightRadius=a,this.borderTopLeftRadius=a,this.borderBottomRightRadius=a,this.borderBottomLeftRadius=a,this.json={borderTopRightRadius:r,borderTopLeftRadius:r,borderBottomRightRadius:r,borderBottomLeftRadius:r,borderRadius:null}):(this.borderTopRightRadius=parseInt(this.borderTopRightRadius||0),this.borderTopLeftRadius=parseInt(this.borderTopLeftRadius||0),this.borderBottomRightRadius=parseInt(this.borderBottomRightRadius||0),this.borderBottomLeftRadius=parseInt(this.borderBottomLeftRadius||0),this.json={borderTopRightRadius:parseInt(this.borderTopRightRadius||0),borderTopLeftRadius:parseInt(this.borderTopLeftRadius||0),borderBottomRightRadius:parseInt(this.borderBottomRightRadius||0),borderBottomLeftRadius:parseInt(this.borderBottomLeftRadius||0),borderRadius:null},this.json[e]=r),this.value=a,this.radiusKey=e;const o=new UIEvent("input",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(o)}resolveIcon(t){let e;switch(t){case"borderTopRightRadius":e="arrowTopRight";break;case"borderTopLeftRadius":e="arrowTopLeft";break;case"borderBottomRightRadius":e="arrowBottomRight";break;case"borderBottomLeftRadius":e="arrowBottomLeft"}return r.qy`<cdtr-icon
|
|
640
664
|
width="15"
|
|
641
665
|
height="15"
|
|
642
666
|
icon="${e}"
|
|
@@ -664,7 +688,7 @@
|
|
|
664
688
|
.icon="${this.isLocked?"lock":"unlock"}"
|
|
665
689
|
></cdtr-icon>
|
|
666
690
|
</cdtr-button>
|
|
667
|
-
</cdtr-row>`}}P.properties={value:{type:Number},json:{type:Object},onChange:{type:Function},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},isLocked:{type:Boolean},elementId:{type:String},radiusKey:{type:String}},customElements.define("cdtr-radius-editor",P);const
|
|
691
|
+
</cdtr-row>`}}P.properties={value:{type:Number},json:{type:Object},onChange:{type:Function},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},isLocked:{type:Boolean},elementId:{type:String},radiusKey:{type:String}},customElements.define("cdtr-radius-editor",P);const W=t=>r.qy` <cdtr-editor-container>
|
|
668
692
|
<cdtr-row>
|
|
669
693
|
<cdtr-title><lang-text text="${t.title}"></lang-text></cdtr-title>
|
|
670
694
|
</cdtr-row>
|
|
@@ -677,7 +701,7 @@
|
|
|
677
701
|
.borderBottomRightRadius=${t.borderBottomRightRadius||t.value||0}
|
|
678
702
|
.borderBottomLeftRadius=${t.borderBottomLeftRadius||t.value||0}
|
|
679
703
|
></cdtr-radius-editor>
|
|
680
|
-
</cdtr-editor-container>`,
|
|
704
|
+
</cdtr-editor-container>`,j=t=>r.qy` <cdtr-editor-container>
|
|
681
705
|
<cdtr-title class="dir-lang"
|
|
682
706
|
><lang-text text="choose_your_duo_date"></lang-text
|
|
683
707
|
></cdtr-title>
|
|
@@ -697,14 +721,14 @@
|
|
|
697
721
|
</cdtr-editor-container>`},U=t=>r.qy` <cdtr-editor-container>
|
|
698
722
|
<cdtr-title><lang-text text="${t.title}"></lang-text></cdtr-title>
|
|
699
723
|
<cdtr-merge-tags></cdtr-merge-tags>
|
|
700
|
-
</cdtr-editor-container>`;a(58691);var D=a(86959);const O=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{const a=await fetch((0,D.Ay)()?"http://localhost:8000/api/v1/prompt/image":"https://agent.creaditor.ai/api/v1/prompt/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,options:{size:e.size||"1024x1024",quality:e.quality||"standard",style:e.style||"vivid",context:e.context||""}})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const r=await a.json();return{status:r.status||"complete",image:r.image,metadata:{prompt:r.metadata?.prompt||t,size:r.metadata?.size||e.size||"1024x1024",quality:r.metadata?.quality||e.quality||"standard",style:r.metadata?.style||e.style||"vivid",fal_ai_result:r.metadata?.fal_ai_result||r}}}catch(t){throw console.error("Error generating image:",t),t}};var G=a(13681);class K extends r.WF{constructor(){super(),this.generatedImage=localStorage.getItem("lastGeneratedImage")||"",this.isGenerating=!1}handleInsertImage(t){const e=t.startsWith("data:")||!t.startsWith("http");G.vP.dispatch("on:upload-file",{image:t,type:e?"base64":"url"})}async handleGenerateImage(t,e){try{this.isGenerating=!0,this.requestUpdate();const a=n.Ay.getSelectedComponent(),r=a[0].closest("section"),
|
|
724
|
+
</cdtr-editor-container>`;a(58691);var D=a(86959);const O=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{const a=await fetch((0,D.Ay)()?"http://localhost:8000/api/v1/prompt/image":"https://agent.creaditor.ai/api/v1/prompt/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,options:{size:e.size||"1024x1024",quality:e.quality||"standard",style:e.style||"vivid",context:e.context||""}})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const r=await a.json();return{status:r.status||"complete",image:r.image,metadata:{prompt:r.metadata?.prompt||t,size:r.metadata?.size||e.size||"1024x1024",quality:r.metadata?.quality||e.quality||"standard",style:r.metadata?.style||e.style||"vivid",fal_ai_result:r.metadata?.fal_ai_result||r}}}catch(t){throw console.error("Error generating image:",t),t}};var G=a(13681);class K extends r.WF{constructor(){super(),this.generatedImage=localStorage.getItem("lastGeneratedImage")||"",this.isGenerating=!1}handleInsertImage(t){const e=t.startsWith("data:")||!t.startsWith("http");G.vP.dispatch("on:upload-file",{image:t,type:e?"base64":"url"})}async handleGenerateImage(t,e){try{this.isGenerating=!0,this.requestUpdate();const a=n.Ay.getSelectedComponent(),r=a[0].closest("section"),o=r?.element,i=o?o.innerText:"",s=i.length>500?i.slice(-500):i;e.context=s;const l=await O(t,e);return this.generatedImage=l.image,localStorage.setItem("lastGeneratedImage",l.image),this.isGenerating=!1,this.requestUpdate(),l}catch(t){throw this.isGenerating=!1,this.requestUpdate(),console.error("Failed to generate image:",t),t}}render(){return r.qy` <cdtr-editor-container>
|
|
701
725
|
<cdtr-image-prompt-editor
|
|
702
726
|
@insert-image=${t=>this.handleInsertImage(t.detail.imageUrl)}
|
|
703
727
|
.generatedImage=${this.generatedImage}
|
|
704
728
|
.isLoading=${this.isGenerating}
|
|
705
729
|
@generate-image=${t=>this.handleGenerateImage(t.detail.prompt,t.detail.options)}
|
|
706
730
|
></cdtr-image-prompt-editor>
|
|
707
|
-
</cdtr-editor-container>`}}K.properties={generatedImage:{type:String},isGenerating:{type:Boolean}},customElements.define("cdtr-image-prompt-builder",K);const J=JSON.parse('[{"src":"http://app.creaditor.com/assets/bullets/images/1.png","name":"Bullet 1"},{"src":"http://app.creaditor.com/assets/bullets/images/10.png","name":"Bullet 10"},{"src":"http://app.creaditor.com/assets/bullets/images/11.png","name":"Bullet 11"},{"src":"http://app.creaditor.com/assets/bullets/images/12.png","name":"Bullet 12"},{"src":"http://app.creaditor.com/assets/bullets/images/13.png","name":"Bullet 13"},{"src":"http://app.creaditor.com/assets/bullets/images/14.png","name":"Bullet 14"},{"src":"http://app.creaditor.com/assets/bullets/images/1468855650_office-65-14.png","name":"Office Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/1468857210_88.png","name":"Number 88"},{"src":"http://app.creaditor.com/assets/bullets/images/1469019930_heart.png","name":"Heart"},{"src":"http://app.creaditor.com/assets/bullets/images/1469019990_2.png","name":"Number 2"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020015_number-one.png","name":"Number One"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020019_number-two.png","name":"Number Two"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020022_number-three.png","name":"Number Three"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020025_number-four.png","name":"Number Four"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020028_number-six.png","name":"Number Six"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020031_number-five.png","name":"Number Five"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020035_number-seven.png","name":"Number Seven"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020041_number-eight.png","name":"Number Eight"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020045_number-nine.png","name":"Number Nine"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020299_free-16.png","name":"Free Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020371_pen_stroke_sketch_doodle_lineart_144.png","name":"Pen Sketch"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020375_sale.png","name":"Sale"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020407_question_mark.png","name":"Question Mark"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020420_check.png","name":"Check"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020468_pen_stroke_sketch_doodle_lineart_104.png","name":"Pen Doodle"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020485_help-questionmark.png","name":"Help Question"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020538_sign-check.png","name":"Sign Check"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020540_check.png","name":"Check Mark"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020585_ic_keyboard_arrow_right_48px.png","name":"Arrow Right"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020603_right.png","name":"Right Arrow"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020616_DoubleChevronRight.png","name":"Double Chevron Right"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020625_InterfaceExpendet-01.png","name":"Interface Expand"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020634_refresh.png","name":"Refresh"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020654_arrow_pencil_left-mediuem.png","name":"Arrow Pencil Left"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020664_Streamline-21.png","name":"Streamline"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020671_Next_Arrow_Direction_Forward_Continue_Move.png","name":"Next Arrow"},{"src":"http://app.creaditor.com/assets/bullets/images/15.png","name":"Bullet 15"},{"src":"http://app.creaditor.com/assets/bullets/images/16.png","name":"Bullet 16"},{"src":"http://app.creaditor.com/assets/bullets/images/17.png","name":"Bullet 17"},{"src":"http://app.creaditor.com/assets/bullets/images/18.png","name":"Bullet 18"},{"src":"http://app.creaditor.com/assets/bullets/images/19.png","name":"Bullet 19"},{"src":"http://app.creaditor.com/assets/bullets/images/2.png","name":"Bullet 2"},{"src":"http://app.creaditor.com/assets/bullets/images/20.png","name":"Bullet 20"},{"src":"http://app.creaditor.com/assets/bullets/images/21.png","name":"Bullet 21"},{"src":"http://app.creaditor.com/assets/bullets/images/22.png","name":"Bullet 22"},{"src":"http://app.creaditor.com/assets/bullets/images/23.png","name":"Bullet 23"},{"src":"http://app.creaditor.com/assets/bullets/images/24.png","name":"Bullet 24"},{"src":"http://app.creaditor.com/assets/bullets/images/25.png","name":"Bullet 25"},{"src":"http://app.creaditor.com/assets/bullets/images/3.png","name":"Bullet 3"},{"src":"http://app.creaditor.com/assets/bullets/images/4.png","name":"Bullet 4"},{"src":"http://app.creaditor.com/assets/bullets/images/5.png","name":"Bullet 5"},{"src":"http://app.creaditor.com/assets/bullets/images/6.png","name":"Bullet 6"},{"src":"http://app.creaditor.com/assets/bullets/images/7.png","name":"Bullet 7"},{"src":"http://app.creaditor.com/assets/bullets/images/8.png","name":"Bullet 8"},{"src":"http://app.creaditor.com/assets/bullets/images/9.png","name":"Bullet 9"},{"src":"http://app.creaditor.com/assets/bullets/images/Add-48.png","name":"Add"},{"src":"http://app.creaditor.com/assets/bullets/images/addition-icon.png","name":"Addition"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-next-3-icon.png","name":"Arrow Next 3"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-next-5-icon.png","name":"Arrow Next 5"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-previous-3-icon.png","name":"Arrow Previous 3"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-prevous-5-icon.png","name":"Arrow Previous 5"},{"src":"http://app.creaditor.com/assets/bullets/images/Bulb-icon.png","name":"Bulb"},{"src":"http://app.creaditor.com/assets/bullets/images/Cart-add-icon%20(1).png","name":"Cart Add"},{"src":"http://app.creaditor.com/assets/bullets/images/cart-add-icon.png","name":"Cart Add Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/cart-icon.png","name":"Cart"},{"src":"http://app.creaditor.com/assets/bullets/images/Check-3-icon.png","name":"Check 3"},{"src":"http://app.creaditor.com/assets/bullets/images/close-icon.png","name":"Close"},{"src":"http://app.creaditor.com/assets/bullets/images/cloud-icon.png","name":"Cloud"},{"src":"http://app.creaditor.com/assets/bullets/images/contact-icon.png","name":"Contact"},{"src":"http://app.creaditor.com/assets/bullets/images/Crown-48.png","name":"Crown"},{"src":"http://app.creaditor.com/assets/bullets/images/currency-icon.png","name":"Currency"},{"src":"http://app.creaditor.com/assets/bullets/images/Dollar-48.png","name":"Dollar"},{"src":"http://app.creaditor.com/assets/bullets/images/download-icon.png","name":"Download"},{"src":"http://app.creaditor.com/assets/bullets/images/error-48.png","name":"Error"},{"src":"http://app.creaditor.com/assets/bullets/images/fastforward-icon.png","name":"Fast Forward"},{"src":"http://app.creaditor.com/assets/bullets/images/fastrewind-icon.png","name":"Fast Rewind"},{"src":"http://app.creaditor.com/assets/bullets/images/Favorites-icon.png","name":"Favorites"},{"src":"http://app.creaditor.com/assets/bullets/images/Favourite-icon.png","name":"Favourite"},{"src":"http://app.creaditor.com/assets/bullets/images/Fire-48.png","name":"Fire"},{"src":"http://app.creaditor.com/assets/bullets/images/Heart-48.png","name":"Heart"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-favourite-icon.png","name":"Heart Favourite"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-icon.png","name":"Heart Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-plus-icon.png","name":"Heart Plus"},{"src":"http://app.creaditor.com/assets/bullets/images/Info-48.png","name":"Info"},{"src":"http://app.creaditor.com/assets/bullets/images/info-icon.png","name":"Info Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/information-icon.png","name":"Information"},{"src":"http://app.creaditor.com/assets/bullets/images/light-icon.png","name":"Light"},{"src":"http://app.creaditor.com/assets/bullets/images/like-icon.png","name":"Like"},{"src":"http://app.creaditor.com/assets/bullets/images/location-icon.png","name":"Location"},{"src":"http://app.creaditor.com/assets/bullets/images/love-48.png","name":"Love"},{"src":"http://app.creaditor.com/assets/bullets/images/new-icon.png","name":"New"},{"src":"http://app.creaditor.com/assets/bullets/images/next-icon%20(1).png","name":"Next Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/next-icon.png","name":"Next"},{"src":"http://app.creaditor.com/assets/bullets/images/phone-call-icon.png","name":"Phone Call"},{"src":"http://app.creaditor.com/assets/bullets/images/phone-icon.png","name":"Phone"},{"src":"http://app.creaditor.com/assets/bullets/images/plus-icon.png","name":"Plus"},{"src":"http://app.creaditor.com/assets/bullets/images/sale-tag-icon.png","name":"Sale Tag"},{"src":"http://app.creaditor.com/assets/bullets/images/settings-2-icon.png","name":"Settings 2"},{"src":"http://app.creaditor.com/assets/bullets/images/settings-icon.png","name":"Settings"},{"src":"http://app.creaditor.com/assets/bullets/images/shopping-icon.png","name":"Shopping"},{"src":"http://app.creaditor.com/assets/bullets/images/songs-icon.png","name":"Songs"},{"src":"http://app.creaditor.com/assets/bullets/images/sound-2-icon.png","name":"Sound 2"},{"src":"http://app.creaditor.com/assets/bullets/images/star-icon%20(1).png","name":"Star Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/star-icon.png","name":"Star"},{"src":"http://app.creaditor.com/assets/bullets/images/stop-icon.png","name":"Stop"},{"src":"http://app.creaditor.com/assets/bullets/images/sun-icon.png","name":"Sun"},{"src":"http://app.creaditor.com/assets/bullets/images/tick-icon.png","name":"Tick"},{"src":"http://app.creaditor.com/assets/bullets/images/warning-icon.png","name":"Warning"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-in-icon.png","name":"Zoom In"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-seach-icon.png","name":"Zoom Search"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-search-2-icon.png","name":"Zoom Search 2"}]'),Z="https://img.creaditor.ai",Q="creaditor_icons_last_search";function X(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e.width??24,r=e.height??24;let i=e.color??"000000";i.startsWith("#")&&(i=i.slice(1));return`${`${Z}/icons/serve/${encodeURIComponent(t.category)}/${encodeURIComponent(t.name)}.png`}?${new URLSearchParams({width:String(a),height:String(r),color:i}).toString()}`}class Y extends r.WF{constructor(){super(),this.selectedIcon="",this.searchTerm="",this.filteredImages=J,this.useIconsApi=!1,this.iconColor="000000",this.iconSize=24,this._tab="local",this._apiIcons=[],this._apiLoading=!1,this._apiSearchDebounce=null}updated(t){if(super.updated?.(t),t.has("useIconsApi")&&this.useIconsApi&&(this._tab="api"),"api"===this._tab&&0===this._apiIcons.length&&!this._apiLoading){const t=this._getLastSearch();t?(this.searchTerm=t,this._fetchApiIcons(t)):(this.searchTerm="",this._fetchCategories())}}render(){const t=this.useIconsApi,e="api"===this._tab;return r.qy`
|
|
731
|
+
</cdtr-editor-container>`}}K.properties={generatedImage:{type:String},isGenerating:{type:Boolean}},customElements.define("cdtr-image-prompt-builder",K);const J=JSON.parse('[{"src":"http://app.creaditor.com/assets/bullets/images/1.png","name":"Bullet 1"},{"src":"http://app.creaditor.com/assets/bullets/images/10.png","name":"Bullet 10"},{"src":"http://app.creaditor.com/assets/bullets/images/11.png","name":"Bullet 11"},{"src":"http://app.creaditor.com/assets/bullets/images/12.png","name":"Bullet 12"},{"src":"http://app.creaditor.com/assets/bullets/images/13.png","name":"Bullet 13"},{"src":"http://app.creaditor.com/assets/bullets/images/14.png","name":"Bullet 14"},{"src":"http://app.creaditor.com/assets/bullets/images/1468855650_office-65-14.png","name":"Office Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/1468857210_88.png","name":"Number 88"},{"src":"http://app.creaditor.com/assets/bullets/images/1469019930_heart.png","name":"Heart"},{"src":"http://app.creaditor.com/assets/bullets/images/1469019990_2.png","name":"Number 2"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020015_number-one.png","name":"Number One"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020019_number-two.png","name":"Number Two"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020022_number-three.png","name":"Number Three"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020025_number-four.png","name":"Number Four"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020028_number-six.png","name":"Number Six"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020031_number-five.png","name":"Number Five"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020035_number-seven.png","name":"Number Seven"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020041_number-eight.png","name":"Number Eight"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020045_number-nine.png","name":"Number Nine"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020299_free-16.png","name":"Free Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020371_pen_stroke_sketch_doodle_lineart_144.png","name":"Pen Sketch"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020375_sale.png","name":"Sale"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020407_question_mark.png","name":"Question Mark"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020420_check.png","name":"Check"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020468_pen_stroke_sketch_doodle_lineart_104.png","name":"Pen Doodle"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020485_help-questionmark.png","name":"Help Question"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020538_sign-check.png","name":"Sign Check"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020540_check.png","name":"Check Mark"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020585_ic_keyboard_arrow_right_48px.png","name":"Arrow Right"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020603_right.png","name":"Right Arrow"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020616_DoubleChevronRight.png","name":"Double Chevron Right"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020625_InterfaceExpendet-01.png","name":"Interface Expand"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020634_refresh.png","name":"Refresh"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020654_arrow_pencil_left-mediuem.png","name":"Arrow Pencil Left"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020664_Streamline-21.png","name":"Streamline"},{"src":"http://app.creaditor.com/assets/bullets/images/1469020671_Next_Arrow_Direction_Forward_Continue_Move.png","name":"Next Arrow"},{"src":"http://app.creaditor.com/assets/bullets/images/15.png","name":"Bullet 15"},{"src":"http://app.creaditor.com/assets/bullets/images/16.png","name":"Bullet 16"},{"src":"http://app.creaditor.com/assets/bullets/images/17.png","name":"Bullet 17"},{"src":"http://app.creaditor.com/assets/bullets/images/18.png","name":"Bullet 18"},{"src":"http://app.creaditor.com/assets/bullets/images/19.png","name":"Bullet 19"},{"src":"http://app.creaditor.com/assets/bullets/images/2.png","name":"Bullet 2"},{"src":"http://app.creaditor.com/assets/bullets/images/20.png","name":"Bullet 20"},{"src":"http://app.creaditor.com/assets/bullets/images/21.png","name":"Bullet 21"},{"src":"http://app.creaditor.com/assets/bullets/images/22.png","name":"Bullet 22"},{"src":"http://app.creaditor.com/assets/bullets/images/23.png","name":"Bullet 23"},{"src":"http://app.creaditor.com/assets/bullets/images/24.png","name":"Bullet 24"},{"src":"http://app.creaditor.com/assets/bullets/images/25.png","name":"Bullet 25"},{"src":"http://app.creaditor.com/assets/bullets/images/3.png","name":"Bullet 3"},{"src":"http://app.creaditor.com/assets/bullets/images/4.png","name":"Bullet 4"},{"src":"http://app.creaditor.com/assets/bullets/images/5.png","name":"Bullet 5"},{"src":"http://app.creaditor.com/assets/bullets/images/6.png","name":"Bullet 6"},{"src":"http://app.creaditor.com/assets/bullets/images/7.png","name":"Bullet 7"},{"src":"http://app.creaditor.com/assets/bullets/images/8.png","name":"Bullet 8"},{"src":"http://app.creaditor.com/assets/bullets/images/9.png","name":"Bullet 9"},{"src":"http://app.creaditor.com/assets/bullets/images/Add-48.png","name":"Add"},{"src":"http://app.creaditor.com/assets/bullets/images/addition-icon.png","name":"Addition"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-next-3-icon.png","name":"Arrow Next 3"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-next-5-icon.png","name":"Arrow Next 5"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-previous-3-icon.png","name":"Arrow Previous 3"},{"src":"http://app.creaditor.com/assets/bullets/images/Arrow-prevous-5-icon.png","name":"Arrow Previous 5"},{"src":"http://app.creaditor.com/assets/bullets/images/Bulb-icon.png","name":"Bulb"},{"src":"http://app.creaditor.com/assets/bullets/images/Cart-add-icon%20(1).png","name":"Cart Add"},{"src":"http://app.creaditor.com/assets/bullets/images/cart-add-icon.png","name":"Cart Add Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/cart-icon.png","name":"Cart"},{"src":"http://app.creaditor.com/assets/bullets/images/Check-3-icon.png","name":"Check 3"},{"src":"http://app.creaditor.com/assets/bullets/images/close-icon.png","name":"Close"},{"src":"http://app.creaditor.com/assets/bullets/images/cloud-icon.png","name":"Cloud"},{"src":"http://app.creaditor.com/assets/bullets/images/contact-icon.png","name":"Contact"},{"src":"http://app.creaditor.com/assets/bullets/images/Crown-48.png","name":"Crown"},{"src":"http://app.creaditor.com/assets/bullets/images/currency-icon.png","name":"Currency"},{"src":"http://app.creaditor.com/assets/bullets/images/Dollar-48.png","name":"Dollar"},{"src":"http://app.creaditor.com/assets/bullets/images/download-icon.png","name":"Download"},{"src":"http://app.creaditor.com/assets/bullets/images/error-48.png","name":"Error"},{"src":"http://app.creaditor.com/assets/bullets/images/fastforward-icon.png","name":"Fast Forward"},{"src":"http://app.creaditor.com/assets/bullets/images/fastrewind-icon.png","name":"Fast Rewind"},{"src":"http://app.creaditor.com/assets/bullets/images/Favorites-icon.png","name":"Favorites"},{"src":"http://app.creaditor.com/assets/bullets/images/Favourite-icon.png","name":"Favourite"},{"src":"http://app.creaditor.com/assets/bullets/images/Fire-48.png","name":"Fire"},{"src":"http://app.creaditor.com/assets/bullets/images/Heart-48.png","name":"Heart"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-favourite-icon.png","name":"Heart Favourite"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-icon.png","name":"Heart Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/heart-plus-icon.png","name":"Heart Plus"},{"src":"http://app.creaditor.com/assets/bullets/images/Info-48.png","name":"Info"},{"src":"http://app.creaditor.com/assets/bullets/images/info-icon.png","name":"Info Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/information-icon.png","name":"Information"},{"src":"http://app.creaditor.com/assets/bullets/images/light-icon.png","name":"Light"},{"src":"http://app.creaditor.com/assets/bullets/images/like-icon.png","name":"Like"},{"src":"http://app.creaditor.com/assets/bullets/images/location-icon.png","name":"Location"},{"src":"http://app.creaditor.com/assets/bullets/images/love-48.png","name":"Love"},{"src":"http://app.creaditor.com/assets/bullets/images/new-icon.png","name":"New"},{"src":"http://app.creaditor.com/assets/bullets/images/next-icon%20(1).png","name":"Next Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/next-icon.png","name":"Next"},{"src":"http://app.creaditor.com/assets/bullets/images/phone-call-icon.png","name":"Phone Call"},{"src":"http://app.creaditor.com/assets/bullets/images/phone-icon.png","name":"Phone"},{"src":"http://app.creaditor.com/assets/bullets/images/plus-icon.png","name":"Plus"},{"src":"http://app.creaditor.com/assets/bullets/images/sale-tag-icon.png","name":"Sale Tag"},{"src":"http://app.creaditor.com/assets/bullets/images/settings-2-icon.png","name":"Settings 2"},{"src":"http://app.creaditor.com/assets/bullets/images/settings-icon.png","name":"Settings"},{"src":"http://app.creaditor.com/assets/bullets/images/shopping-icon.png","name":"Shopping"},{"src":"http://app.creaditor.com/assets/bullets/images/songs-icon.png","name":"Songs"},{"src":"http://app.creaditor.com/assets/bullets/images/sound-2-icon.png","name":"Sound 2"},{"src":"http://app.creaditor.com/assets/bullets/images/star-icon%20(1).png","name":"Star Icon"},{"src":"http://app.creaditor.com/assets/bullets/images/star-icon.png","name":"Star"},{"src":"http://app.creaditor.com/assets/bullets/images/stop-icon.png","name":"Stop"},{"src":"http://app.creaditor.com/assets/bullets/images/sun-icon.png","name":"Sun"},{"src":"http://app.creaditor.com/assets/bullets/images/tick-icon.png","name":"Tick"},{"src":"http://app.creaditor.com/assets/bullets/images/warning-icon.png","name":"Warning"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-in-icon.png","name":"Zoom In"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-seach-icon.png","name":"Zoom Search"},{"src":"http://app.creaditor.com/assets/bullets/images/zoom-search-2-icon.png","name":"Zoom Search 2"}]'),Z="https://img.creaditor.ai",X="creaditor_icons_last_search";function Q(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e.width??24,r=e.height??24;let o=e.color??"000000";o.startsWith("#")&&(o=o.slice(1));return`${`${Z}/icons/serve/${encodeURIComponent(t.category)}/${encodeURIComponent(t.name)}.png`}?${new URLSearchParams({width:String(a),height:String(r),color:o}).toString()}`}class Y extends r.WF{constructor(){super(),this.selectedIcon="",this.searchTerm="",this.filteredImages=J,this.useIconsApi=!1,this.iconColor="000000",this.iconSize=24,this._tab="local",this._apiIcons=[],this._apiLoading=!1,this._apiSearchDebounce=null}updated(t){if(super.updated?.(t),t.has("useIconsApi")&&this.useIconsApi&&(this._tab="api"),"api"===this._tab&&0===this._apiIcons.length&&!this._apiLoading){const t=this._getLastSearch();t?(this.searchTerm=t,this._fetchApiIcons(t)):(this.searchTerm="",this._fetchCategories())}}render(){const t=this.useIconsApi,e="api"===this._tab;return r.qy`
|
|
708
732
|
<div class="gallery-container">
|
|
709
733
|
${t?r.qy`
|
|
710
734
|
<div class="tabs">
|
|
@@ -733,7 +757,7 @@
|
|
|
733
757
|
<cdtr-input
|
|
734
758
|
type="search"
|
|
735
759
|
class="search-input"
|
|
736
|
-
placeholder=${
|
|
760
|
+
placeholder=${o.M.get("lang",e?"icons_search_placeholder":"search")||(e?"Search icons (e.g. arrow, user, email)…":"search")}
|
|
737
761
|
.value=${this.searchTerm}
|
|
738
762
|
@input=${this._handleSearch}
|
|
739
763
|
></cdtr-input>
|
|
@@ -752,7 +776,7 @@
|
|
|
752
776
|
title="${a.name}"
|
|
753
777
|
>
|
|
754
778
|
<img
|
|
755
|
-
src="${
|
|
779
|
+
src="${Q(a,{width:e,height:e,color:t})}"
|
|
756
780
|
alt="${a.name}"
|
|
757
781
|
class="icon-image"
|
|
758
782
|
loading="lazy"
|
|
@@ -779,7 +803,7 @@
|
|
|
779
803
|
/>
|
|
780
804
|
<div class="icon-name">${t.name}</div>
|
|
781
805
|
</div>
|
|
782
|
-
`)}_isApiIconSelected(t,e,a){const r=
|
|
806
|
+
`)}_isApiIconSelected(t,e,a){const r=Q(t,{width:a,height:a,color:e});return this.selectedIcon===r}_handleSearch(t){this.searchTerm=t.target.value;const e=this.searchTerm.trim().toLowerCase();if("api"===this._tab)return this._apiSearchDebounce&&clearTimeout(this._apiSearchDebounce),e?void(this._apiSearchDebounce=setTimeout(()=>this._fetchApiIcons(e),550)):(this.searchTerm="",void this._fetchCategories());this.filteredImages=J.filter(t=>(t.name||"").toLowerCase().includes(e))}_getLastSearch(){try{return localStorage.getItem(X)||""}catch{return""}}_setLastSearch(t){try{t?localStorage.setItem(X,t):localStorage.removeItem(X)}catch{}}async _fetchCategories(){this._apiLoading=!0,this._apiIcons=[];try{const t=await fetch("https://img.creaditor.ai/icons/categories");if(!t.ok)throw new Error(t.statusText);const e=await t.json(),a=(e.categories||[]).flatMap(t=>t.icons||[]);this._apiIcons=a}catch(t){this._apiIcons=[],console.warn("Icons categories fetch failed:",t)}finally{this._apiLoading=!1}}async _fetchApiIcons(t){this._apiLoading=!0,this._apiIcons=[];const e=(t||"").trim();e&&this._setLastSearch(e);try{const t=new URLSearchParams({q:e,format:"png",limit:"50",width:String(this.iconSize||24),height:String(this.iconSize||24)}),a=(this.iconColor||"000000").replace(/^#/,"");t.set("color",a);const r=await fetch(`${Z}/icons/search?${t.toString()}`);if(!r.ok)throw new Error(r.statusText);const o=await r.json();this._apiIcons=o.icons||[]}catch(t){this._apiIcons=[],console.warn("Icons API search failed:",t)}finally{this._apiLoading=!1}}_selectApiIcon(t){const e=this.iconColor||"000000",a=this.iconSize||24,r=Q(t,{width:a,height:a,color:e});this.selectedIcon=r,this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:r,urlPng:r,urlSvg:t.urlSvg||t.src,name:t.name,category:t.category,size:{width:a,height:a},color:e},bubbles:!0,composed:!0}))}_selectIcon(t){this.selectedIcon=t.src,this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:t.src,name:t.name},bubbles:!0,composed:!0}))}_handleImageError(t){t.target.style.display="none";const e=t.target.parentElement.querySelector(".icon-name");e&&(e.textContent=o.M.get("lang","icons_error_loading")||"Error loading")}}Y.properties={selectedIcon:{type:String},useIconsApi:{type:Boolean},iconColor:{type:String},iconSize:{type:Number},searchTerm:{type:String},filteredImages:{type:Array},_tab:{type:String,state:!0},_apiIcons:{type:Array,state:!0},_apiLoading:{type:Boolean,state:!0},_apiSearchDebounce:{type:Object,state:!0}},Y.styles=r.AH`
|
|
783
807
|
:host {
|
|
784
808
|
display: block;
|
|
785
809
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
@@ -832,8 +856,8 @@
|
|
|
832
856
|
|
|
833
857
|
.search-input:focus {
|
|
834
858
|
outline: none;
|
|
835
|
-
border-color: #
|
|
836
|
-
box-shadow: 0 0 0
|
|
859
|
+
border-color: var(--color-primary, #6366f1);
|
|
860
|
+
box-shadow: 0 0 0 3px var(--color-primary-ring, rgba(99, 102, 241, 0.15));
|
|
837
861
|
}
|
|
838
862
|
|
|
839
863
|
.gallery-grid {
|
|
@@ -914,22 +938,22 @@
|
|
|
914
938
|
<input
|
|
915
939
|
type="search"
|
|
916
940
|
class="search-input"
|
|
917
|
-
placeholder=${
|
|
941
|
+
placeholder=${o.M.get("lang","giphy_search_placeholder")||"Search GIFs (e.g. happy, celebration…)"}
|
|
918
942
|
.value=${this.searchTerm}
|
|
919
943
|
@input=${this._handleSearchInput}
|
|
920
944
|
@keydown=${t=>"Enter"===t.key&&this._doSearch()}
|
|
921
945
|
/>
|
|
922
946
|
<button class="search-btn" @click=${()=>this._doSearch()}><lang-text text="search"></lang-text></button>
|
|
923
|
-
<button class="random-btn" @click=${this._loadRandom} title=${
|
|
947
|
+
<button class="random-btn" @click=${this._loadRandom} title=${o.M.get("lang","giphy_random_title")||"Random GIF"}>🎲</button>
|
|
924
948
|
</div>
|
|
925
949
|
|
|
926
950
|
<div class="gallery-grid">
|
|
927
951
|
${this._loading?r.qy`<div class="loading"><lang-text text="loading"></lang-text></div>`:0===this._gifs.length?r.qy`<div class="no-results"><lang-text text="${this._getEmptyMessageKey()}"></lang-text></div>`:this._gifs.map(t=>this._renderGifItem(t))}
|
|
928
952
|
</div>
|
|
929
953
|
</div>
|
|
930
|
-
`}_getEmptyMessageKey(){return this.searchTerm.trim()?"giphy_no_results":"giphy_no_available"}_renderGifItem(t){const e=function(t){return"string"==typeof t?t:t?.images.fixed_height.url||t?.images?.fixed_height?.url?t.images.fixed_height.url:t?.images?.fixed_height_small?.webp?t.images.fixed_height_small.url:t?.images?.original?.webp?t.images.original.url:t?.images?.downsized?.webp?t.images.downsized.url:null}(t);if(!e)return null;const a=function(t){return"string"==typeof t?"GIF":t?.title||t?.slug||"GIF"}(t),
|
|
954
|
+
`}_getEmptyMessageKey(){return this.searchTerm.trim()?"giphy_no_results":"giphy_no_available"}_renderGifItem(t){const e=function(t){return"string"==typeof t?t:t?.images.fixed_height.url||t?.images?.fixed_height?.url?t.images.fixed_height.url:t?.images?.fixed_height_small?.webp?t.images.fixed_height_small.url:t?.images?.original?.webp?t.images.original.url:t?.images?.downsized?.webp?t.images.downsized.url:null}(t);if(!e)return null;const a=function(t){return"string"==typeof t?"GIF":t?.title||t?.slug||"GIF"}(t),o=this.selectedSrc===e;return r.qy`
|
|
931
955
|
<div
|
|
932
|
-
class="gif-item ${
|
|
956
|
+
class="gif-item ${o?"selected":""}"
|
|
933
957
|
@click=${()=>this._selectGif(e,a)}
|
|
934
958
|
title="${a}"
|
|
935
959
|
>
|
|
@@ -964,7 +988,8 @@
|
|
|
964
988
|
|
|
965
989
|
.search-input:focus {
|
|
966
990
|
outline: none;
|
|
967
|
-
border-color: var(--primary, #
|
|
991
|
+
border-color: var(--color-primary, #6366f1);
|
|
992
|
+
box-shadow: 0 0 0 3px var(--color-primary-ring, rgba(99, 102, 241, 0.15));
|
|
968
993
|
}
|
|
969
994
|
|
|
970
995
|
.search-btn {
|
|
@@ -1019,7 +1044,7 @@
|
|
|
1019
1044
|
}
|
|
1020
1045
|
|
|
1021
1046
|
.gif-item:hover {
|
|
1022
|
-
border-color: var(--primary, #
|
|
1047
|
+
border-color: var(--color-primary, #6366f1);
|
|
1023
1048
|
}
|
|
1024
1049
|
|
|
1025
1050
|
.gif-item.selected {
|
|
@@ -1067,7 +1092,7 @@
|
|
|
1067
1092
|
.hasBottom=${t.hasBottom||!0}
|
|
1068
1093
|
></cdtr-spacing>
|
|
1069
1094
|
</cdtr-row>
|
|
1070
|
-
</cdtr-editor-container>`;var
|
|
1095
|
+
</cdtr-editor-container>`;var ot=a(12258),it=a(40648),st=a(15155);const nt=t=>r.qy`
|
|
1071
1096
|
<cdtr-editor-container pt="0">
|
|
1072
1097
|
<cdtr-row style="padding:0.7rem 0px;" justify="${t.justify||"center"}" alignItems="center">
|
|
1073
1098
|
${t.src&&t.hasPreview?r.qy`
|
|
@@ -1087,7 +1112,7 @@
|
|
|
1087
1112
|
`:""}
|
|
1088
1113
|
</div>
|
|
1089
1114
|
`:""}
|
|
1090
|
-
<paper-button @click=${t=>{const e=t.currentTarget;if(e){const a=t.target.parentElement?.closest("cdtr-gallery");if(a)return;const r=e.parentElement?.querySelector("cdtr-gallery");r&&(r.opened&&(r.opened=!1),setTimeout(()=>{r.opened=!0},100))}}} style="margin-top:10px;width:100%;background:var(--primary);color:${t.buttonProps?.color||"var(--primary-text)"};"><lang-text text="${t.text||"gallery"}" ></lang-text>
|
|
1115
|
+
<paper-button @click=${t=>{const e=t.currentTarget;if(e){const a=t.target.parentElement?.closest("cdtr-gallery");if(a)return;const r=e.parentElement?.querySelector("cdtr-gallery");r&&(r.opened&&(r.opened=!1),setTimeout(()=>{r.opened=!0},100))}}} style="margin-top:10px;width:100%;background:var(--color-primary, #6366f1);color:${t.buttonProps?.color||"var(--color-primary-text, #ffffff)"};"><lang-text text="${t.text||"gallery"}" ></lang-text>
|
|
1091
1116
|
</paper-button>
|
|
1092
1117
|
<cdtr-gallery
|
|
1093
1118
|
@close=${e=>{e.opened=!1,"function"==typeof t.close&&t.close(e)}}
|
|
@@ -1104,13 +1129,13 @@
|
|
|
1104
1129
|
`:null}
|
|
1105
1130
|
</cdtr-row>
|
|
1106
1131
|
</cdtr-editor-container>
|
|
1107
|
-
`;a.e(4217).then(a.bind(a,94217));a(45888);Promise.resolve().then(a.bind(a,58691));class lt extends r.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)
|
|
1132
|
+
`;a.e(4217).then(a.bind(a,94217));a(45888);Promise.resolve().then(a.bind(a,58691));class lt extends r.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)}$select(){this.editor&&this.editor.select&&this.editor.select({changeTab:this.changeTab,tab:this.tabName}),this.connectWith("select")}$update(){this.connectWith("update")}_sectionScope(){return`${this.type||""}:${this.tabName||""}`}_applyPersistedOpen(t){const e=this._sectionScope();for(const a of t)if(a&&"section"===a.type){a.persistKey=`${e}::${a.label}`;const t=(0,it.i)(a.persistKey);void 0!==t&&(a.open=t)}return t}connectedCallback(){super.connectedCallback(),n.Ay.on("update",this.$update),n.Ay.on("select",this.$select),this.connectWith("load")}disconnectedCallback(){super.disconnectedCallback(),n.Ay.off("update",this.$update),n.Ay.off("select",this.$select)}connectWith(){const t=new UIEvent(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"update",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t);const e=n.Ay.components.find(t=>t.type===this.type);e&&"function"==typeof e.createEditor&&(this.component={...e},this.props=e.props,this.editor=e.createEditor(this.commandsBuilder()))}factory(t,e){if("function"==typeof t&&(t=t()),t.debug,"boolean"==typeof t.active&&!t.active)return null;if("function"==typeof t.active){if(!1===t.active())return null}const a=t.type;switch(a){case"background":return nt(t);case"datetime":return j(t);case"radius":return W(t);case"justifyContent":case"alignItems":return F(t,a);case"node":case"lit":case"custom":return t.node();case"button":return N(t);case"borderpicker":return B(t);case"linkpicker":return q(t);case"input":return(0,i.A)(t);case"dropdown":return(0,s.A)(t);case"fontSize":return c(t);case"fontFamily":return l(t);case"mergeTags":return U(t);case"boxShadow":return v(t);case"colorpicker":return d(t);case"slider":return p(t);case"divider":return b(t);case"heading":return(0,h.A)(t);case"option":return f(t);case"checkbox":return y(t);case"stringListBuilder":return x(t);case"chipsInput":return $(t);case"typography":return M(t);case"icons":return r.qy`<icons-gallery
|
|
1108
1133
|
.selectedIcon=${t.selectedIcon}
|
|
1109
1134
|
.useIconsApi=${!0===t.useIconsApi}
|
|
1110
1135
|
.iconColor=${t.iconColor??"000000"}
|
|
1111
1136
|
.iconSize=${"number"==typeof t.iconSize?t.iconSize:24}
|
|
1112
1137
|
@icon-selected=${t.onChange}
|
|
1113
|
-
></icons-gallery>`;case"info":return I(t);case"svgpicker":return A(t);case"gallery":return"ai-edit"===
|
|
1138
|
+
></icons-gallery>`;case"info":return I(t);case"svgpicker":return A(t);case"gallery":return"ai-edit"===o.M.get("config","mode")?null:R(t);case"giphy":return r.qy`<giphy-picker
|
|
1114
1139
|
.selectedSrc=${t.selectedSrc||""}
|
|
1115
1140
|
@gif-selected=${t.onChange}
|
|
1116
1141
|
></giphy-picker>`;case"table":return T(t);case"accordion":return r.qy`<cdtr-accordion-item
|
|
@@ -1119,45 +1144,37 @@
|
|
|
1119
1144
|
.isOpen=${t.isOpen}
|
|
1120
1145
|
>
|
|
1121
1146
|
${t.children.map(t=>this.factory(t))}
|
|
1122
|
-
</cdtr-accordion-item>`;case"imagePrompt":return document.createElement("cdtr-image-prompt-builder");case"spacingPicker":return rt(t);case"section":return(0,
|
|
1147
|
+
</cdtr-accordion-item>`;case"imagePrompt":return document.createElement("cdtr-image-prompt-builder");case"spacingPicker":return rt(t);case"section":return(0,ot.A)(t,(t.children||[]).map((t,e)=>this.factory(t,e)));case"colorSwatchGroup":return(0,st.A)(t)}}execCommandWrapper(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a.components=[this.component],n.Ay.store().execCommand(t,e,a)}commandsBuilder(){return{tab:this.tabName,helpers:{Url:z.A,deepMerge:k()},commands:{execCommand:this.execCommandWrapper,injectEditor:o.M.get("injectEditor")}}}changeTab(t){this.tabName=t,"function"==typeof this.component?.createEditor&&(this.editor=this.component.createEditor(this.commandsBuilder()))}getColElementData(t){const e=t[0]?.closest("col");return e?{colElement:e,justifyValue:e.props.justify,alignItemsValue:e.props.alignItems,colElementRect:e.element.getBoundingClientRect()}:null}shouldShowDesignControls(t,e){const a=t[0]?.element.getBoundingClientRect(),r=t[0]?.type,o=e.find(t=>t.selected)?.text;let i=("design"===o||void 0===o)&&!["root","section","block","row","col"].includes(r);const s=this.getColElementData(t);return s&&s.colElementRect.width===a.width&&(i=!1),i}handleJustifyContent(t){const e=t.target.value,a=n.Ay.getSelectedComponent(),r=a[0]?.closest("col");r&&n.Ay.store().execCommand("justify",e,{find:"col"})}handleAlignItems(t){const e=t.target.value,a=n.Ay.getSelectedComponent(),r=a[0]?.closest("col");r&&n.Ay.store().execCommand("alignItems",e,{find:"col"})}renderJustifyAlignControls(t){return t?(0,ot.A)({label:"alignment",open:!1},[F({value:t.justifyValue,onChange:this.handleJustifyContent}),F({value:t.alignItemsValue,type:"alignItems",title:"alignItems",onChange:this.handleAlignItems})]):null}preprocessLayout(t){if(!t||0===t.length)return t;if(t.some(t=>t&&"section"===t.type))return this._applyPersistedOpen(t);t=t.filter(t=>!!t&&("boolean"==typeof t.active?t.active:"function"!=typeof t.active||!1!==t.active()));const e=[];let a=[];for(const r of t)r&&("function"!=typeof r?"divider"===r.type?(a.length>0&&e.push(a),a=[]):"heading"===r.type?(a.length>0&&e.push(a),a=[r]):a.push(r):a.push(r));a.length>0&&e.push(a);const r=[];let o=0;for(let t=0;t<e.length;t++){const a=e[t];if(a[0]&&"heading"===a[0].type){const t=a[0].text||"settings",e=a.slice(1);e.length>0&&(o++,r.push({type:"section",label:t,open:!0,children:e}))}else r.push(...a)}if(o>=4){let t=0;for(const e of r)"section"===e.type&&(t++,e.open=t<=2)}return this._applyPersistedOpen(r)}createRenderRoot(){return this}render(){if(!this.editor)return;if("function"!=typeof this.editor.tabs)return;const t=n.Ay.getSelectedComponent(),e=this.editor?.tabs(this.tabName),a=this.getColElementData(t),o=this.shouldShowDesignControls(t,e),i=this.preprocessLayout(this.editor.layout({tabs:e,tab:e.find(t=>t.selected)||e[0]||{text:"style"},changeTab:this.changeTab}));return r.qy`<cdtr-editor-tabs
|
|
1123
1148
|
.value=${this.tabName}
|
|
1124
1149
|
@tabChanged=${t=>this.changeTab(t.target.value)}
|
|
1125
1150
|
.tabs=${e}
|
|
1126
1151
|
>
|
|
1127
1152
|
<div slot="content">
|
|
1128
|
-
${
|
|
1129
|
-
|
|
1130
|
-
<span
|
|
1131
|
-
@click=${()=>this._onToggleAll()}
|
|
1132
|
-
@mouseover=${t=>{t.currentTarget.style.color="#333",t.currentTarget.style.textDecoration="underline"}}
|
|
1133
|
-
@mouseout=${t=>{t.currentTarget.style.color="#555",t.currentTarget.style.textDecoration="none"}}
|
|
1134
|
-
style="display:inline-flex;align-items:center;gap:3px;font-size:12px;color:#555;cursor:pointer;font-family:inherit;"
|
|
1135
|
-
>
|
|
1136
|
-
<lang-text text=${this._sectionsExpanded?"collapse_all":"expand_all"}></lang-text>
|
|
1137
|
-
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1138
|
-
<polyline points="7 8 12 3 17 8"></polyline>
|
|
1139
|
-
<polyline points="7 16 12 21 17 16"></polyline>
|
|
1140
|
-
</svg>
|
|
1141
|
-
</span>
|
|
1142
|
-
</div>
|
|
1143
|
-
`:null}
|
|
1144
|
-
${o.map(this.factory)}
|
|
1145
|
-
${i?this.renderJustifyAlignControls(a):null}
|
|
1153
|
+
${i.map(this.factory)}
|
|
1154
|
+
${o?this.renderJustifyAlignControls(a):null}
|
|
1146
1155
|
</div>
|
|
1147
1156
|
</cdtr-editor-tabs> `}}lt.styles=r.AH`
|
|
1148
1157
|
[disabled] {
|
|
1149
1158
|
opacity: 0.3;
|
|
1150
1159
|
pointer-events: none;
|
|
1151
1160
|
}
|
|
1161
|
+
/* Product accent, not --primary: that is the host's brand and may be a
|
|
1162
|
+
gradient. Mirrors block-editor's primary/secondary pair. */
|
|
1152
1163
|
paper-button.gallery {
|
|
1153
|
-
background: var(--primary);
|
|
1154
|
-
color: var(--primary-text);
|
|
1164
|
+
background: var(--color-primary, #6366f1);
|
|
1165
|
+
color: var(--color-primary-text, #ffffff);
|
|
1166
|
+
}
|
|
1167
|
+
paper-button.gallery:hover {
|
|
1168
|
+
background: var(--color-primary-hover, #4f46e5);
|
|
1155
1169
|
}
|
|
1156
1170
|
paper-button.backgrounds {
|
|
1157
|
-
background:
|
|
1158
|
-
color: #
|
|
1171
|
+
background: var(--color-bg-muted, #f4f4f6);
|
|
1172
|
+
color: var(--color-text-secondary, #555);
|
|
1173
|
+
}
|
|
1174
|
+
paper-button.backgrounds:hover {
|
|
1175
|
+
background: #eaeaed;
|
|
1159
1176
|
}
|
|
1160
|
-
`,lt.properties={type:{type:String},editor:{},tabName:{type:String},tabs:{type:Array}
|
|
1177
|
+
`,lt.properties={type:{type:String},editor:{},tabName:{type:String},tabs:{type:Array}},customElements.define("cdtr-editor-builder",lt)},92384(t,e,a){a.r(e),a.d(e,{FONT_WEIGHTS:()=>s,FontFamilyEditor:()=>n});var r=a(59929),o=a(40120),i=a(86319);const s=[{name:"Thin",value:100},{name:"Light",value:300},{name:"Regular",value:400},{name:"Medium",value:500},{name:"SemiBold",value:600},{name:"Bold",value:700},{name:"Black",value:900}];class n extends r.WF{constructor(){super(),this.onchangeFontWeight=t=>{const e=parseInt(t.target.value,10);Number.isNaN(e)||(this.weight=e,this.dispatchEvent(new CustomEvent("weightchange",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:e}})))},this.onchangeFontFamily=t=>{const e=t.target.value,a=this.fontFamilies.find(t=>t.name===e);if(!a)return void console.error("cant set font family, font family not founded..");(0,o.sw)(a),this.value=a.cssRule,this.name=e;const r=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(r)},this.onFilteredFonts=t=>{const e=t.target.value;this.filteredFonts=this.fontFamilies.filter(t=>t.name.toLowerCase().includes(e.toLowerCase()))},this.filteredFonts=[],this.fontFamilies=[],this.showWeight=!1}async connectedCallback(){super.connectedCallback();const t=await(0,o.VH)(),e=Array.isArray(t)?t:[];this.filteredFonts=this.fontFamilies=e,e.forEach(t=>{t&&t.url&&t.id&&function(t){if(document.getElementById(t.id))return;const e=document.createElement("link");e.href=t.url,e.id=t.id,e.setAttribute("data-name",t.name),e.rel="stylesheet",e.type="text/css",document.head.appendChild(e)}(t)})}disconnectedCallback(){super.disconnectedCallback()}render(){const t=this.fontFamilies.find(t=>"string"==typeof t?.cssRule&&(-1!==t.cssRule.indexOf(this.value||"")||-1!==t.cssRule.indexOf(this.name||"")));t&&(this.name=t.name);const e=r.qy`<cdtr-dropdown
|
|
1161
1178
|
style="width:100%"
|
|
1162
1179
|
.value="${this.name}"
|
|
1163
1180
|
@change=${this.onchangeFontFamily}
|
|
@@ -1170,7 +1187,7 @@
|
|
|
1170
1187
|
</cdtr-dropdown-button>
|
|
1171
1188
|
<div slot="content">
|
|
1172
1189
|
<cdtr-input
|
|
1173
|
-
.placeholder="${
|
|
1190
|
+
.placeholder="${i.M.get("lang","search")}.."
|
|
1174
1191
|
@input=${this.onFilteredFonts}
|
|
1175
1192
|
type="search"
|
|
1176
1193
|
></cdtr-input>
|
|
@@ -1195,21 +1212,21 @@
|
|
|
1195
1212
|
</cdtr-col>
|
|
1196
1213
|
</cdtr-row>
|
|
1197
1214
|
</cdtr-editor-container>
|
|
1198
|
-
`,
|
|
1215
|
+
`,o=s.find(t=>String(t.value)===String(this.weight))||s.find(t=>400===t.value),n=r.qy`<cdtr-dropdown
|
|
1199
1216
|
style="width:100%"
|
|
1200
|
-
.value="${String(
|
|
1217
|
+
.value="${String(o?.value)}"
|
|
1201
1218
|
@change=${this.onchangeFontWeight}
|
|
1202
1219
|
>
|
|
1203
1220
|
<cdtr-dropdown-button
|
|
1204
1221
|
minWidth=${100}
|
|
1205
1222
|
class="dropdown-button"
|
|
1206
1223
|
slot="trigger"
|
|
1207
|
-
>${
|
|
1224
|
+
>${o?.value}
|
|
1208
1225
|
</cdtr-dropdown-button>
|
|
1209
1226
|
<div slot="content">
|
|
1210
1227
|
${s.map(t=>r.qy`<cdtr-dropdown-item
|
|
1211
|
-
.focused=${String(t.value)===String(
|
|
1212
|
-
.selected=${String(t.value)===String(
|
|
1228
|
+
.focused=${String(t.value)===String(o?.value)}
|
|
1229
|
+
.selected=${String(t.value)===String(o?.value)}
|
|
1213
1230
|
value="${t.value}"
|
|
1214
1231
|
><span style="font-weight:${t.value};">${t.value}</span>
|
|
1215
1232
|
</cdtr-dropdown-item>`)}
|
|
@@ -1250,4 +1267,4 @@
|
|
|
1250
1267
|
background: rgba(16, 24, 40, 0.055) !important;
|
|
1251
1268
|
color: #14171f;
|
|
1252
1269
|
}
|
|
1253
|
-
`,customElements.define("cdtr-font-family-editor",n)},13681(t,e,a){a.d(e,{vP:()=>d});const r=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=r,window[r]||(window[r]={});const
|
|
1270
|
+
`,customElements.define("cdtr-font-family-editor",n)},13681(t,e,a){a.d(e,{vP:()=>d});const r=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=r,window[r]||(window[r]={});const o=window[r],i=window.__cdtrEvents||{};function s(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then(t=>Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join(""))}function n(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)e[a/2]=parseInt(t.substr(a,2),16);return e}async function l(t){const e=await s(t),a=o[e];if(a){const t=await crypto.subtle.importKey("raw",n(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),r=await async function(t,e,a){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,a);return(new TextDecoder).decode(r)}(t,a.iv,a.encrypted);return JSON.parse(r)}return null}function c(t,e){if(i[t])for(const a in i[t])Object.prototype.hasOwnProperty.call(i[t],a)&&i[t][a].forEach(t=>t(e));Array.isArray(i["*"])&&i["*"].forEach(t=>t(e))}window.__cdtrEvents=i;const d={set:async function(t,e){const a=JSON.parse(JSON.stringify(e)),r=await s(t),l=await crypto.subtle.importKey("raw",n(r),{name:"AES-GCM"},!1,["encrypt","decrypt"]),d=await async function(t,e){const a=crypto.getRandomValues(new Uint8Array(12)),r=(new TextEncoder).encode(e),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:a},t,r);return{iv:a,encrypted:new Uint8Array(o)}}(l,JSON.stringify(a));o[r]=d,i.set&&i.set[r]&&i.set[r].forEach(t=>t(a)),Array.isArray(i["*"])&&i["*"].forEach(t=>t(a)),c(t,a)},get:l,remove:async function(t){const e=await s(t);delete o[e]},on:async function(t,e,a){i[t]||(i[t]={});const r=await s(e);i[t][r]||(i[t][r]=[]),i[t][r].push(t=>{!function(){const t=(new Error).stack;if(t&&t.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),a(t)});const o=await l(e);return o&&a(o),r},off:function(t,e){i[t]&&i[t][e]&&delete i[t][e]},dispatch:c,OPTIONS:{SET:"set"}}},88385(t,e,a){a.d(e,{A:()=>n});const r=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function i(t){const e={},a=/([^&=]+)=?([^&]*)/g,r=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let i,s=-1!==o?t.substring(o+1):"";for(;null!==(i=a.exec(s));){const t=r(i[1]),a=r(i[2]);t&&(e[t]=a)}return e}function s(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class n{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...i(t)};const a=t.indexOf("?");return this.url=a>-1?t.slice(0,a):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??n.getProtocol(this.href);const a=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=r(a),this.isPhone=o(a),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...i(this.href)},this.url=s(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const a in this.params){const r=this.params[a],o=encodeURIComponent(a).replace(/%24/g,"$");if(r){const a=encodeURIComponent(r).replace(/%24/g,"$");t+=`${o}=${a}&`,e+=`${o}=${a}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const a=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return a(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const r=this.extractPhoneFromTextUsingRegex(t);return r.length>0?a("https://wa.me/"+r[0]+e):a("https://wa.me/"+e)}return a(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}n.resetURL=s}}]);
|