@creaditor/newsletter-starterkit 1.0.54 → 1.0.56

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.
Files changed (55) hide show
  1. package/dist/1260.creaditor.bundle.js +66 -22
  2. package/dist/1260.creaditor.bundle.js.gz +0 -0
  3. package/dist/1271.creaditor.bundle.js +1 -439
  4. package/dist/1271.creaditor.bundle.js.gz +0 -0
  5. package/dist/1403.creaditor.bundle.js +110 -0
  6. package/dist/1403.creaditor.bundle.js.gz +0 -0
  7. package/dist/1565.creaditor.bundle.js +106 -105
  8. package/dist/1565.creaditor.bundle.js.gz +0 -0
  9. package/dist/168.creaditor.bundle.js +4 -4
  10. package/dist/168.creaditor.bundle.js.gz +0 -0
  11. package/dist/170.creaditor.bundle.js +21 -20
  12. package/dist/170.creaditor.bundle.js.gz +0 -0
  13. package/dist/2384.creaditor.bundle.js +4 -4
  14. package/dist/2384.creaditor.bundle.js.gz +0 -0
  15. package/dist/4186.creaditor.bundle.js +1 -1
  16. package/dist/4186.creaditor.bundle.js.gz +0 -0
  17. package/dist/453.creaditor.bundle.js +11 -111
  18. package/dist/453.creaditor.bundle.js.gz +0 -0
  19. package/dist/4569.creaditor.bundle.js +64 -257
  20. package/dist/4569.creaditor.bundle.js.gz +0 -0
  21. package/dist/4819.creaditor.bundle.js +1 -1
  22. package/dist/4819.creaditor.bundle.js.gz +0 -0
  23. package/dist/4970.creaditor.bundle.js +1314 -0
  24. package/dist/4970.creaditor.bundle.js.gz +0 -0
  25. package/dist/5340.creaditor.bundle.js +19 -18
  26. package/dist/5340.creaditor.bundle.js.gz +0 -0
  27. package/dist/574.creaditor.bundle.js +5 -5
  28. package/dist/574.creaditor.bundle.js.gz +0 -0
  29. package/dist/5926.creaditor.bundle.js +10 -6
  30. package/dist/5926.creaditor.bundle.js.gz +0 -0
  31. package/dist/752.creaditor.bundle.js +4 -4
  32. package/dist/752.creaditor.bundle.js.gz +0 -0
  33. package/dist/763.creaditor.bundle.js +34 -1
  34. package/dist/763.creaditor.bundle.js.gz +0 -0
  35. package/dist/7789.creaditor.bundle.js +25 -0
  36. package/dist/7789.creaditor.bundle.js.LICENSE.txt +32 -0
  37. package/dist/7789.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  38. package/dist/7789.creaditor.bundle.js.gz +0 -0
  39. package/dist/7937.creaditor.bundle.js +17 -17
  40. package/dist/7937.creaditor.bundle.js.gz +0 -0
  41. package/dist/8173.creaditor.bundle.js +1 -1
  42. package/dist/8173.creaditor.bundle.js.gz +0 -0
  43. package/dist/8646.creaditor.bundle.js +1 -0
  44. package/dist/8646.creaditor.bundle.js.gz +0 -0
  45. package/dist/9158.creaditor.bundle.js +613 -0
  46. package/dist/9158.creaditor.bundle.js.LICENSE.txt +10 -0
  47. package/dist/9158.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  48. package/dist/9158.creaditor.bundle.js.gz +0 -0
  49. package/dist/9994.creaditor.bundle.js +114 -0
  50. package/dist/9994.creaditor.bundle.js.gz +0 -0
  51. package/dist/creaditor.bundle.js +1653 -565
  52. package/dist/creaditor.bundle.js.gz +0 -0
  53. package/dist/service-worker.js +1 -1
  54. package/dist/service-worker.js.gz +0 -0
  55. package/package.json +1 -1
@@ -1,201 +1,8 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3095,4569],{73095(t,e,i){i.r(e),i.d(e,{default:()=>n});var o=i(59929),s=i(21421),r=i(69600);class n extends o.WF{constructor(){super(),this.contentRef=(0,s._)(),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return o.qy`
2
- <slot @click=${()=>this.toggle()} tabindex="0" name="trigger"></slot>
3
- ${this.opened?o.qy` <div
4
- @mouseup=${this.onClickOutside}
5
- @mousemove=${this.onPointerMove}
6
- class="backdrop"
7
- style="z-index:${(0,r.A)()};"
8
- >
9
- <div
10
- ${(0,s.K)(this.contentRef)}
11
- @mouseup=${this.preventClosing}
12
- style="z-index:${(0,r.A)()};left:${this.left}px;top:${this.top}px;"
13
- class="dropdown-content fade-in ${this.custom?"":"dropdown-background"}"
14
- >
15
- ${this.search?o.qy`<cdtr-input
16
- @input=${this.onBouncing}
17
- type="search"
18
- value=${this.searchText}
19
- ></cdtr-input>`:null}
20
- <slot name="content"></slot>
21
- </div>
22
- </div>`:null}
23
- `}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),o=this.contentRef?.value?.getBoundingClientRect();o&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+o.width>window.innerWidth&&(t=window.innerWidth-o.width),e+o.height>window.innerHeight&&(e=window.innerHeight-o.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.style.removeProperty("--cdtr-item-hover"),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onPointerMove(){this.style.removeProperty("--cdtr-item-hover")}onKeydown(t){40!==t.keyCode&&38!==t.keyCode||this.style.setProperty("--cdtr-item-hover","transparent"),this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}n.styles=o.AH`
24
- :host {
25
- display: inline-block;
26
- overflow: hidden;
27
- box-sizing: border-box;
28
- }
29
-
30
- .backdrop {
31
- position: fixed;
32
- top: 0;
33
- left: 0;
34
- width: 100%;
35
- height: 100%;
36
- background: transparent;
37
- overflow: hidden;
38
- }
39
- /* padding lives here so custom content stays flush against the panel */
40
- .dropdown-background {
41
- background: #fff;
42
- padding: 4px;
43
- }
44
- .dropdown-content {
45
- box-sizing: border-box;
46
- min-width: 180px;
47
- min-height: 40px;
48
- position: fixed;
49
- border-radius: 10px;
50
- border: 1px solid #eceef1;
51
- /* layered depth: a tight ambient edge + a soft key shadow */
52
- box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06),
53
- 0 8px 24px -6px rgba(16, 24, 40, 0.16);
54
- transition: box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
55
- }
56
- .fade-in {
57
- animation: fade-in 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
58
- }
59
- .fade-out {
60
- animation: fade-out 140ms ease both;
61
- opacity: 0;
62
- }
63
- @keyframes fade-in {
64
- from {
65
- opacity: 0;
66
- transform: translateY(-6px) scale(0.98);
67
- }
68
- to {
69
- opacity: 1;
70
- transform: none;
71
- }
72
- }
73
- @keyframes fade-out {
74
- from {
75
- opacity: 1;
76
- }
77
- to {
78
- opacity: 0;
79
- transform: translateY(-4px);
80
- }
81
- }
82
- @media (prefers-reduced-motion: reduce) {
83
- .fade-in,
84
- .fade-out {
85
- animation-duration: 1ms;
86
- transform: none;
87
- }
88
- }
89
- `,n.properties={search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}};class a extends o.WF{constructor(){super(),this.minWidth=50}render(){return o.qy`<paper-button style="min-width:${this.minWidth}px"
90
- ><slot></slot> <cdtr-dd-arrow-icon></cdtr-dd-arrow-icon
91
- ></paper-button>`}}a.properties={minWidth:{type:Number}},a.styles=o.AH`
92
- paper-button {
93
- display: flex;
94
- align-items: center;
95
- justify-content: space-between;
96
- gap: 8px;
97
- text-transform: capitalize;
98
- width: 100%;
99
- line-height: 1.4;
100
- font-size: 13px;
101
- font-weight: 500;
102
- color: rgb(33, 37, 41);
103
- background: rgb(255, 255, 255);
104
- background-clip: padding-box;
105
- border: 1px solid var(--input-border-color, #ced4da);
106
- appearance: none;
107
- border-radius: 8px;
108
- transition: border-color 0.15s ease-in-out 0s,
109
- box-shadow 0.15s ease-in-out 0s, background-color 0.15s ease-in-out 0s;
110
- margin: 0px;
111
- font-family: var(--font-family, "Inter", Arial, sans-serif);
112
- box-sizing: border-box;
113
- padding: 7px 10px;
114
- cursor: pointer;
115
- }
116
- paper-button:hover {
117
- border-color: #9aa1a9;
118
- background: #fbfbfc;
119
- }
120
- paper-button:focus,
121
- paper-button:focus-within {
122
- outline: none;
123
- border-color: var(--cdtr-dropdown-accent, #7c5cf6);
124
- box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.2);
125
- }
126
- `;class l extends o.WF{constructor(){super(),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}focus(){this.shadowRoot.querySelector(".dropdown-item").focus()}onFocus(){this.focused=!0}onBlur(){this.focused=!1}onClick(t){if(this.notClickable)return;const e=this.closest("cdtr-dropdown");e&&e.patch(this.value,t,this)}onPress(t){if(13===t.keyCode){const e=new UIEvent("click",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e);const i=this.closest("cdtr-dropdown");i&&i.patch(this.value,t,this)}}connectedCallback(){super.connectedCallback(),this.selected&&this.scrollIntoView({behavior:"smooth",block:"start"})}render(){return o.qy`<div role="button"
127
- @click=${this.onClick}
128
- @keydown=${this.onPress}
129
- @blur=${this.onBlur}
130
- @focus=${this.onFocus}
131
- class="dropdown-item"
132
- tabindex="0"
133
- >
134
- <slot></slot>
135
- ${this.selected?o.qy` <svg
136
- class="check"
137
- fill="currentColor"
138
- xmlns="http://www.w3.org/2000/svg"
139
- viewBox="0 0 24 24"
140
- aria-hidden="true"
141
- >
142
- <path fill="none" d="M0 0h24v24H0z" />
143
- <path
144
- d="M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z"
145
- />
146
- </svg>`:null}
147
- </div>`}}l.properties={focused:{type:Boolean,reflect:!0},selected:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},notClickable:{type:Boolean}},l.styles=o.AH`
148
- .dropdown-item {
149
- position: relative;
150
- box-sizing: border-box;
151
- display: flex;
152
- align-items: center;
153
- justify-content: space-between;
154
- gap: 10px;
155
- width: 100%;
156
- padding: 8px 12px;
157
- border-radius: 6px;
158
- font-family: var(--font-family, "Inter", Arial, sans-serif);
159
- font-size: 13px;
160
- line-height: 1.4;
161
- color: #212529;
162
- cursor: pointer;
163
- user-select: none;
164
- transition: background-color 120ms ease, color 120ms ease,
165
- box-shadow 120ms ease;
166
- }
167
- /* hover = a translucent violet wash: ephemeral pointer feedback. The
168
- parent sets --cdtr-item-hover to transparent while arrow-key
169
- navigating so it never competes with the keyboard cursor below. */
170
- .dropdown-item:hover {
171
- background: var(--cdtr-item-hover, rgba(124, 92, 246, 0.1));
172
- }
173
- /* keyboard cursor: stronger wash + a left accent bar, so "where am I"
174
- reads at a glance and is distinct from both hover and selected */
175
- .dropdown-item:focus {
176
- outline: none;
177
- background: rgba(124, 92, 246, 0.16);
178
- color: var(--cdtr-dropdown-accent-ink, #5a3cc9);
179
- box-shadow: inset 3px 0 0 var(--cdtr-dropdown-accent, #7c5cf6);
180
- }
181
- /* selected = the committed choice: a SOLID chip (opaque, not a wash),
182
- accent text, weight, and a check — so it can't be mistaken for hover */
183
- :host([selected]) .dropdown-item {
184
- color: var(--cdtr-dropdown-accent-ink, #5a3cc9);
185
- font-weight: 600;
186
- background: var(--cdtr-dropdown-selected-bg, #efeaff);
187
- }
188
- .check {
189
- width: 16px;
190
- height: 16px;
191
- flex: none;
192
- color: var(--cdtr-dropdown-accent, #7c5cf6);
193
- }
194
- `,customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",l),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",a),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",n)},70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var o=i(59929),s=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var d=i(86319);const h=(0,r.S)();class p extends o.WF{constructor(){super(),this.inputRef=(0,s._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=d.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?o.qy` <textarea
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,4569],{70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var s=i(59929),o=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var h=i(86319);const d=(0,r.S)();class p extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=h.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?s.qy` <textarea
195
2
  row=${this.row||4}
196
3
  .disabled=${this.disabled}
197
4
  dir="auto"
198
- ${(0,s.K)(this.inputRef)}
5
+ ${(0,o.K)(this.inputRef)}
199
6
  style="${this.inputStyle}"
200
7
  .autofocus="${this.autofocus}"
201
8
  .placeholder="${t}"
@@ -205,10 +12,10 @@
205
12
  .max="${String(this.max)}"
206
13
  .step="${String(this.step)}"
207
14
  .value="${String(this.value)}"
208
- />`:o.qy` <input
15
+ />`:s.qy` <input
209
16
  .disabled=${this.disabled}
210
17
  dir="auto"
211
- ${(0,s.K)(this.inputRef)}
18
+ ${(0,o.K)(this.inputRef)}
212
19
  style="${this.inputStyle}"
213
20
  .autofocus="${this.autofocus}"
214
21
  .placeholder="${t}"
@@ -219,9 +26,9 @@
219
26
  .max="${String(this.max)}"
220
27
  .step="${String(this.step)}"
221
28
  .value="${String(this.value)}"
222
- />`;return o.qy`<form @submit=${this.onSubmit}>
29
+ />`;return s.qy`<form @submit=${this.onSubmit}>
223
30
  ${e}
224
- ${!this.icon||this.couchOnEmpty||this.successActive?null:o.qy`<cdtr-icon
31
+ ${!this.icon||this.couchOnEmpty||this.successActive?null:s.qy`<cdtr-icon
225
32
  color="#d9d9d9"
226
33
  width=${20}
227
34
  height=${20}
@@ -230,19 +37,19 @@
230
37
  left: 10px;"
231
38
  icon="${this.icon}"
232
39
  ></cdtr-icon>`}
233
- ${this.successActive?o.qy`<div class="success-overlay" aria-live="polite">
40
+ ${this.successActive?s.qy`<div class="success-overlay" aria-live="polite">
234
41
  <cdtr-couch-mark></cdtr-couch-mark>
235
42
  <span class="success-icon">✓</span>
236
43
  </div>`:null}
237
- ${!this.couchOnEmpty||this.value||this.successActive?null:o.qy`<cdtr-couch-mark
44
+ ${!this.couchOnEmpty||this.value||this.successActive?null:s.qy`<cdtr-couch-mark
238
45
  style="position: absolute;
239
46
  transform: translateY(-50%);
240
47
  left: 0;"
241
48
  ></cdtr-couch-mark>`}
242
- ${"text"===this.type&&this.maxLength?o.qy`<span class="counter"
49
+ ${"text"===this.type&&this.maxLength?s.qy`<span class="counter"
243
50
  >${this.value.length}/${this.maxLength}</span
244
51
  > `:null}
245
- </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};h.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=o.AH`
52
+ </form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};d.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=s.AH`
246
53
  :host {
247
54
  display: inline-block;
248
55
  --cdtr-input-height: 30px;
@@ -376,7 +183,7 @@
376
183
  box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
377
184
  }
378
185
  }
379
- `,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var o=i(59929),s=i(86319),r=i(88385);const n=o.AH`
186
+ `,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var s=i(59929),o=i(86319),r=i(88385);const n=s.AH`
380
187
  :host {
381
188
  --paper-radio-button-checked-color: var(--primary);
382
189
  box-sizing: border-box;
@@ -527,33 +334,33 @@
527
334
  margin-top: 0.75rem;
528
335
  padding-left: 1rem;
529
336
  }
530
- `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],d="cdtrAdd",h="cdtrRemove",p="cdtrAutomation",u=[d,h,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:s,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return o.qy`
337
+ `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return s.qy`
531
338
  <cdtr-row alignItems="center" spacing="5">
532
339
  <cdtr-dropdown
533
340
  @change=${t=>{n({target:{value:"#"+t.target.value},anchor:!0}),a()}}
534
- .opened=${i.length>0&&"anchor:"===r&&!s}
341
+ .opened=${i.length>0&&"anchor:"===r&&!o}
535
342
  class="anchor-dd"
536
343
  >
537
344
  <cdtr-dropdown-button
538
345
  minWidth=${100}
539
346
  class=" dropdown-button"
540
347
  slot="trigger"
541
- ><lang-text .text=${e.isAnchor?s:""}></lang-text>
348
+ ><lang-text .text=${e.isAnchor?o:""}></lang-text>
542
349
  </cdtr-dropdown-button>
543
350
  <div style="min-width:150px" slot="content">
544
- ${i.map(t=>o.qy`<cdtr-dropdown-item
351
+ ${i.map(t=>s.qy`<cdtr-dropdown-item
545
352
  value="${t.props.name||t.props.element_ID}"
546
353
  >${t.props.name||t.props.element_ID}
547
354
  </cdtr-dropdown-item>`)}
548
355
  </div>
549
356
  </cdtr-dropdown>
550
- ${0===i.length?o.qy`<paper-button
357
+ ${0===i.length?s.qy`<paper-button
551
358
  @click=${()=>{"function"===l&&l("anchor")}}
552
359
  ><cdtr-title
553
360
  ><lang-text text="create_anchor"></lang-text></cdtr-title
554
361
  ></paper-button>`:null}
555
362
  </cdtr-row>
556
- `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:s,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,d="string"==typeof e?m("subject",e):s||e.params.subject;return o.qy`
363
+ `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,h="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
557
364
  <cdtr-row spacing="5">
558
365
  <cdtr-title class="explain-title"
559
366
  ><lang-text text="add_catchy_subject"></lang-text
@@ -562,7 +369,7 @@
562
369
  inputStyle="height:${"40px"};"
563
370
  style="width:${l};"
564
371
  @change=${t=>{let{target:e}=t;a(e.value),r()}}
565
- value=${d||s||""}
372
+ value=${h||o||""}
566
373
  ></cdtr-input>
567
374
  <cdtr-title class="explain-title"
568
375
  ><lang-text text="email_body_if_needed"></lang-text
@@ -574,7 +381,7 @@
574
381
  @change=${t=>{let{target:e}=t;n(e.value),r()}}
575
382
  ></cdtr-input>
576
383
  </cdtr-row>
577
- `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:s,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return o.qy`
384
+ `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return s.qy`
578
385
  <cdtr-row spacing="5">
579
386
  <cdtr-title class="explain-title"
580
387
  ><lang-text text="sms_body_if_needed"></lang-text
@@ -583,10 +390,10 @@
583
390
  .multiline=${!0}
584
391
  value="${n||i||""}"
585
392
  style="width:${l};"
586
- @change=${t=>{let{target:e}=t;r(e.value),s()}}
393
+ @change=${t=>{let{target:e}=t;r(e.value),o()}}
587
394
  ></cdtr-input>
588
395
  </cdtr-row>
589
- `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:s,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return o.qy`
396
+ `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
590
397
  <cdtr-row spacing="5">
591
398
  <cdtr-title class="explain-title"
592
399
  ><lang-text text="whatsapp_body_if_needed"></lang-text
@@ -595,10 +402,10 @@
595
402
  .multiline=${!0}
596
403
  value="${n||i||""}"
597
404
  style="width:${l};"
598
- @change=${t=>{let{target:e}=t;r(e.value),s()}}
405
+ @change=${t=>{let{target:e}=t;r(e.value),o()}}
599
406
  ></cdtr-input>
600
407
  </cdtr-row>
601
- `}(e);default:return""}}function g(t,e,i,o,s,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,o,s){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=o||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new r.A(d);return h.target=s||h.target||"_blank",{url:h,params:h.params,protocol:"whatsapp:"}}(t,e,i,o,n):(a.isEmail?function(t,e,i){let o=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,o=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,o=!0),o&&(t.href=t.getUrlWithParams())}(a,s,o):o?a.addParam("body",o):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function b(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const o=r.A.getProtocol(t);let s=e;o&&(s=o+":");const n=new r.A({href:t,protocol:s||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function y(t){const{value:e="",inputRef:i,autofocus:s=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return o.qy`
408
+ `}(e);default:return""}}function g(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function y(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function b(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
602
409
  <cdtr-row style="position:relative;" spacing="5">
603
410
  <span style="display:none;" aria-hidden="true">${e}</span>
604
411
  <cdtr-input
@@ -606,18 +413,18 @@
606
413
  ${i?(0,a.K)(i):""}
607
414
  style="${u}"
608
415
  inputStyle="${p}"
609
- .autofocus=${s}
416
+ .autofocus=${o}
610
417
  type="search"
611
418
  width="${m}"
612
- placeholder="${h}"
419
+ placeholder="${d}"
613
420
  @input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||r&&r(t)}}
614
421
  @change=${f}
615
422
  @focus=${c}
616
- @submit=${d||f}
423
+ @submit=${h||f}
617
424
  .value="${g}"
618
425
  ></cdtr-input>
619
426
  </cdtr-row>
620
- `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=s.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=s.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,o=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];o.push(`${e}=${encodeURIComponent(i)}`)}});let s=e.join("");return o.length>0&&(s+=`?${o.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${d}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${h}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],o=e[2],s={};o.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const n=s.url;let a;if(delete s.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),s[d]&&(a.params[d]=s[d]),s[h]&&(a.params[h]=s[h]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],o={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const s=o.url,n=s?new r.A(s):new r.A("https://example.com");n.params||(n.params={}),o[d]&&(n.params[d]=o[d]),o[h]&&(n.params[h]=o[h]),n.params[p]=e[1],n.href=t,n.url=s||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,o=t.href||t;if("string"==typeof o&&o.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=o.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof o&&o.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=o.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,o]=t.split("=");i&&o&&(e[decodeURIComponent(i)]=decodeURIComponent(o))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForAdd=t}if(e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForAdd=e}if(t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():o.qy`
427
+ `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=o.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${h}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${d}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const n=o.url;let a;if(delete o.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),o[h]&&(a.params[h]=o[h]),o[d]&&(a.params[d]=o[d]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=s.url,n=o?new r.A(o):new r.A("https://example.com");n.params||(n.params={}),s[h]&&(n.params[h]=s[h]),s[d]&&(n.params[d]=s[d]),n.params[p]=e[1],n.href=t,n.url=o||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForAdd=t}if(e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForAdd=e}if(t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
621
428
  <div class="automations-view">
622
429
  <cdtr-row justify="space-between" alignItems="center" mb="1">
623
430
  <cdtr-title
@@ -634,7 +441,7 @@
634
441
  </cdtr-row>
635
442
  <cdtr-divider></cdtr-divider>
636
443
  <div class="automations-list" style="margin-top: 1rem;">
637
- ${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return o.qy`
444
+ ${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return s.qy`
638
445
  <div
639
446
  class="automation-card ${e?"active":""}"
640
447
  @click=${()=>this.onAutomationClick(t)}
@@ -656,7 +463,7 @@
656
463
  >
657
464
  <lang-text text="${t.name}"></lang-text>
658
465
  </cdtr-title>
659
- ${e?o.qy`
466
+ ${e?s.qy`
660
467
  <span
661
468
  style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
662
469
  >✓</span
@@ -671,7 +478,7 @@
671
478
  </h6>
672
479
  </div>
673
480
  </div>
674
- `}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return o.qy`
481
+ `}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return s.qy`
675
482
  <div
676
483
  class="automation-details-view"
677
484
  style="display: flex; flex-direction: column; height: 100%;"
@@ -695,7 +502,7 @@
695
502
 
696
503
  <div class="automation-content">
697
504
  <!-- Success Message -->
698
- ${this.showSaveSuccess?o.qy`
505
+ ${this.showSaveSuccess?s.qy`
699
506
  <style>
700
507
  .save-success-container {
701
508
  margin-bottom: 1rem;
@@ -815,7 +622,7 @@
815
622
  >
816
623
  <lang-text text="url"></lang-text> (Optional)
817
624
  </cdtr-title>
818
- ${y({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=b(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
625
+ ${b({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=y(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
819
626
  </div>
820
627
 
821
628
  <h6
@@ -865,10 +672,10 @@
865
672
  </div>
866
673
 
867
674
  <!-- Add to mailing list section -->
868
- ${"add"===this.activeTab?o.qy`
675
+ ${"add"===this.activeTab?s.qy`
869
676
  <div class="action-section">
870
677
  <div class="mailing-lists-list" style="padding-left: 1rem;">
871
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return o.qy`
678
+ ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return s.qy`
872
679
  <div
873
680
  class="mailing-list-item ${e?"selected":""}"
874
681
  @click=${()=>this.onMailingListToggle(t.id,"add")}
@@ -893,12 +700,12 @@
893
700
  >
894
701
  ${t.name}
895
702
  </cdtr-title>
896
- ${e?o.qy`
703
+ ${e?s.qy`
897
704
  <span
898
705
  style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
899
706
  >✓</span
900
707
  >
901
- `:o.qy`
708
+ `:s.qy`
902
709
  <span
903
710
  style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
904
711
  >○</span
@@ -912,10 +719,10 @@
912
719
  `:null}
913
720
 
914
721
  <!-- Remove from mailing list section -->
915
- ${"remove"===this.activeTab?o.qy`
722
+ ${"remove"===this.activeTab?s.qy`
916
723
  <div class="action-section">
917
724
  <div class="mailing-lists-list" style="padding-left: 1rem;">
918
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return o.qy`
725
+ ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return s.qy`
919
726
  <div
920
727
  class="mailing-list-item ${e?"selected":""}"
921
728
  @click=${()=>this.onMailingListToggle(t.id,"remove")}
@@ -940,12 +747,12 @@
940
747
  >
941
748
  ${t.name}
942
749
  </cdtr-title>
943
- ${e?o.qy`
750
+ ${e?s.qy`
944
751
  <span
945
752
  style="color: #f44336; font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
946
753
  >✓</span
947
754
  >
948
- `:o.qy`
755
+ `:s.qy`
949
756
  <span
950
757
  style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
951
758
  >○</span
@@ -981,52 +788,52 @@
981
788
  </cdtr-row>
982
789
  </div>
983
790
  </div>
984
- `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(o.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=s.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:o,body:s,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,o,s,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=b(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=s.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,o){const s=e.find(e=>e.type===t);if(!s)return{forceProtocolChange:!1};const r="anchor"===s.text,n=o!==s.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:s.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=s.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let o=[];return t.isEmail?o=[]:t.isPhone?o=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(o=[{type:"https:",text:s.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(o=[]),o}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(h)c=d;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(o=>{if(!t.includes(o)){const t=i.params[o];e.push(`${o}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const o=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${o}`:`${i.protocol}${o}`:o,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],v=b.findIndex(t=>"http:"===t.type);v>-1&&b.splice(v,1);const x=s.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?o.qy` <div class="root">${this.renderAutomationsView()}</div>`:o.qy` <div class="root">
985
- ${q=this.label,q?o.qy`<cdtr-title
791
+ `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=y(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=o.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),y=[...this.options],v=y.findIndex(t=>"http:"===t.type);v>-1&&y.splice(v,1);const x=o.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",A=this._urlInputRawValue!==$,k=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!k;A&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):A||(this._lastSyncedMyHref=$);const S=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,R={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:S};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
792
+ ${j=this.label,j?s.qy`<cdtr-title
986
793
  style="font-weight: 700;
987
794
  font-size: 14.4px;
988
795
  margin-bottom: 0.6rem;
989
796
  color: #000000b0;"
990
- ><lang-text text=${q}></lang-text
797
+ ><lang-text text=${j}></lang-text
991
798
  ><cdtr-divider></cdtr-divider
992
799
  ></cdtr-title>`:null}
993
800
  <cdtr-row alignItems="center" justify="space-between" spacing="10">
994
- ${E=this.options,M=this.protocol,B=this.onChangeType.bind(this),o.qy`
995
- <cdtr-dropdown @change=${t=>B(t.target.value)}>
801
+ ${M=this.options,F=this.protocol,q=this.onChangeType.bind(this),s.qy`
802
+ <cdtr-dropdown @change=${t=>q(t.target.value)}>
996
803
  <cdtr-dropdown-button
997
804
  minWidth=${100}
998
805
  class=" dropdown-button"
999
806
  slot="trigger"
1000
807
  ><lang-text
1001
- .text="${E.find(t=>t.type===M)?.text||"link"}"
808
+ .text="${M.find(t=>t.type===F)?.text||"link"}"
1002
809
  ></lang-text>
1003
810
  </cdtr-dropdown-button>
1004
811
  <div slot="content">
1005
- ${E.map(t=>o.qy`<cdtr-dropdown-item
1006
- .focused=${t.type===M}
1007
- .selected=${t.type===M}
812
+ ${M.map(t=>s.qy`<cdtr-dropdown-item
813
+ .focused=${t.type===F}
814
+ .selected=${t.type===F}
1008
815
  value="${t.type}"
1009
816
  ><lang-text text="${t.text}"></lang-text>
1010
817
  </cdtr-dropdown-item>`)}
1011
818
  </div>
1012
819
  </cdtr-dropdown>
1013
820
  `}
1014
- ${L=this.target,U=this.onChangeTarget.bind(this),o.qy`
1015
- <cdtr-dropdown @change=${t=>U(t)} style="min-width: 120px;">
821
+ ${C=this.target,I=this.onChangeTarget.bind(this),s.qy`
822
+ <cdtr-dropdown @change=${t=>I(t)} style="min-width: 120px;">
1016
823
  <cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
1017
- <lang-text .text=${L}></lang-text>
824
+ <lang-text .text=${C}></lang-text>
1018
825
  </cdtr-dropdown-button>
1019
826
  <div slot="content">
1020
- <cdtr-dropdown-item value="_blank" .selected=${"_blank"===L}>
827
+ <cdtr-dropdown-item value="_blank" .selected=${"_blank"===C}>
1021
828
  <lang-text text="open_in_new_tab"></lang-text>
1022
829
  </cdtr-dropdown-item>
1023
- <cdtr-dropdown-item value="_self" .selected=${"_self"===L}>
830
+ <cdtr-dropdown-item value="_self" .selected=${"_self"===C}>
1024
831
  <lang-text text="open_in_same_tab"></lang-text>
1025
832
  </cdtr-dropdown-item>
1026
- <cdtr-dropdown-item value="_parent" .selected=${"_parent"===L}>
833
+ <cdtr-dropdown-item value="_parent" .selected=${"_parent"===C}>
1027
834
  <lang-text text="open_in_parent_frame"></lang-text>
1028
835
  </cdtr-dropdown-item>
1029
- <cdtr-dropdown-item value="_top" .selected=${"_top"===L}>
836
+ <cdtr-dropdown-item value="_top" .selected=${"_top"===C}>
1030
837
  <lang-text text="open_in_top_frame"></lang-text>
1031
838
  </cdtr-dropdown-item>
1032
839
  </div>
@@ -1034,7 +841,7 @@
1034
841
  `}
1035
842
  </cdtr-row>
1036
843
  <cdtr-row mt="1">
1037
- ${function(t,e){return 0===t.length?null:o.qy`${t.map(t=>o.qy`<paper-button
844
+ ${function(t,e){return 0===t.length?null:s.qy`${t.map(t=>s.qy`<paper-button
1038
845
  @click=${()=>e(t.type)}
1039
846
  style="background:rgb(233, 237, 243);color:#000;font-size:13px;margin:0;margin-right:5px;"
1040
847
  ><lang-text text="${t.text}"></lang-text
@@ -1045,9 +852,9 @@
1045
852
  <cdtr-title class="explain-title"
1046
853
  ><lang-text .text="${g}"></lang-text
1047
854
  ></cdtr-title>
1048
- ${function(t){const{protocol:e,url:i,autofocus:o,inputRef:s,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:y({value:c,inputRef:s,autofocus:o,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
855
+ ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:b({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(R)}
1049
856
  ${f(this.protocol,w)}
1050
- ${x?o.qy` <cdtr-divider></cdtr-divider>
857
+ ${x?s.qy` <cdtr-divider></cdtr-divider>
1051
858
  <cdtr-row justify="flex-start" mt="1">
1052
859
  <cdtr-title class="explain-title"
1053
860
  ><lang-text
@@ -1063,18 +870,18 @@
1063
870
  </paper-button>
1064
871
  <cdtr-divider></cdtr-divider
1065
872
  ></cdtr-row>`:null}
1066
- ${function(t,e,i,s){return t&&Array.isArray(t)&&0!==t.length?o.qy`<cdtr-list-picker
873
+ ${function(t,e,i,o){return t&&Array.isArray(t)&&0!==t.length?s.qy`<cdtr-list-picker
1067
874
  .selected=${e}
1068
- @change=${t=>{i({target:{value:t.target.value}}),s()}}
875
+ @change=${t=>{i({target:{value:t.target.value}}),o()}}
1069
876
  heading="saved_links"
1070
877
  .list=${t}
1071
878
  ></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
1072
879
  </div>
1073
880
 
1074
- ${C=this.hasButton,I=this.onClickOk.bind(this),C?o.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
881
+ ${U=this.hasButton,L=this.onClickOk.bind(this),U?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
1075
882
  <cdtr-row justify="flex-end" mt="1">
1076
- <paper-button fullWidth @click=${I} raised class="add-button">
883
+ <paper-button fullWidth @click=${L} raised class="add-button">
1077
884
  <lang-text text="add_now"></lang-text>
1078
885
  </paper-button>
1079
886
  </cdtr-row>`:null}
1080
- </div>`;var C,I,L,U,E,M,B,q}}x.styles=n,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const o=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,}))$/)),s=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 r(t){const e={},i=/([^&=]+)=?([^&]*)/g,o=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},s=t.indexOf("?");let r,n=-1!==s?t.substring(s+1):"";for(;null!==(r=i.exec(n));){const t=o(r[1]),i=o(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{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,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=o(i),this.isPhone=s(i),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,...r(this.href)},this.url=n(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.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}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 i in this.params){const o=this.params[i],s=encodeURIComponent(i).replace(/%24/g,"$");if(o){const i=encodeURIComponent(o).replace(/%24/g,"$");t+=`${s}=${i}&`,e+=`${s}=${i}&`}else t+=`${s}&`,e+=`${s}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const o=this.extractPhoneFromTextUsingRegex(t);return o.length>0?i("https://wa.me/"+o[0]+e):i("https://wa.me/"+e)}return i(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)}}a.resetURL=n}}]);
887
+ </div>`;var U,L,C,I,M,F,q,j}}x.styles=n,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const s=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 r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{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,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),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,...r(this.href)},this.url=n(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 i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(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)}}a.resetURL=n}}]);