@simai-studio/mail 0.0.0-stage → 1.0.1

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 (191) hide show
  1. package/LICENSE.md +188 -0
  2. package/README.md +79 -2
  3. package/dist/package-receipt.json +1176 -0
  4. package/dist/set.json +97 -0
  5. package/dist/smart/mail-canvas/component.json +562 -0
  6. package/dist/smart/mail-canvas/component.json.gz +0 -0
  7. package/dist/smart/mail-canvas/css/mail-canvas.css +85 -0
  8. package/dist/smart/mail-canvas/css/mail-canvas.css.gz +0 -0
  9. package/dist/smart/mail-canvas/css/mail-canvas.min.css +2 -0
  10. package/dist/smart/mail-canvas/css/mail-canvas.min.css.gz +0 -0
  11. package/dist/smart/mail-canvas/examples.json +731 -0
  12. package/dist/smart/mail-canvas/examples.json.gz +0 -0
  13. package/dist/smart/mail-canvas/js/mail-canvas.js +1039 -0
  14. package/dist/smart/mail-canvas/js/mail-canvas.js.gz +0 -0
  15. package/dist/smart/mail-canvas/js/mail-canvas.min.js +22 -0
  16. package/dist/smart/mail-canvas/js/mail-canvas.min.js.gz +0 -0
  17. package/dist/smart/mail-canvas/lang/en.json +25 -0
  18. package/dist/smart/mail-canvas/lang/en.json.gz +0 -0
  19. package/dist/smart/mail-canvas/lang/ru.json +25 -0
  20. package/dist/smart/mail-canvas/lang/ru.json.gz +0 -0
  21. package/dist/smart/mail-canvas/probe.json +465 -0
  22. package/dist/smart/mail-canvas/probe.json.gz +0 -0
  23. package/dist/smart/mail-canvas/smart.manifest.json +550 -0
  24. package/dist/smart/mail-canvas/smart.manifest.json.gz +0 -0
  25. package/dist/smart/mail-canvas/static/default/notes.html +43 -0
  26. package/dist/smart/mail-canvas/static/default/notes.html.gz +0 -0
  27. package/dist/smart/mail-canvas/static/default/phone.html +43 -0
  28. package/dist/smart/mail-canvas/static/default/phone.html.gz +0 -0
  29. package/dist/smart/mail-canvas/static/default/reference.html +48 -0
  30. package/dist/smart/mail-canvas/static/default/reference.html.gz +0 -0
  31. package/dist/smart/mail-canvas/static/sheets.json +132 -0
  32. package/dist/smart/mail-canvas/static/sheets.json.gz +0 -0
  33. package/dist/smart/mail-canvas/studio.fixture.json +63 -0
  34. package/dist/smart/mail-canvas/studio.fixture.json.gz +0 -0
  35. package/dist/smart/mail-canvas/studio.scenario.json +39 -0
  36. package/dist/smart/mail-canvas/studio.scenario.json.gz +0 -0
  37. package/dist/smart/mail-canvas/template/default.css +73 -0
  38. package/dist/smart/mail-canvas/template/default.css.gz +0 -0
  39. package/dist/smart/mail-canvas/template/default.js +38 -0
  40. package/dist/smart/mail-canvas/template/default.js.gz +0 -0
  41. package/dist/smart/mail-inspector/component.json +768 -0
  42. package/dist/smart/mail-inspector/component.json.gz +0 -0
  43. package/dist/smart/mail-inspector/css/mail-inspector.css +194 -0
  44. package/dist/smart/mail-inspector/css/mail-inspector.css.gz +0 -0
  45. package/dist/smart/mail-inspector/css/mail-inspector.min.css +2 -0
  46. package/dist/smart/mail-inspector/css/mail-inspector.min.css.gz +0 -0
  47. package/dist/smart/mail-inspector/examples.json +1301 -0
  48. package/dist/smart/mail-inspector/examples.json.gz +0 -0
  49. package/dist/smart/mail-inspector/js/mail-inspector.js +1619 -0
  50. package/dist/smart/mail-inspector/js/mail-inspector.js.gz +0 -0
  51. package/dist/smart/mail-inspector/js/mail-inspector.min.js +103 -0
  52. package/dist/smart/mail-inspector/js/mail-inspector.min.js.gz +0 -0
  53. package/dist/smart/mail-inspector/lang/en.json +29 -0
  54. package/dist/smart/mail-inspector/lang/en.json.gz +0 -0
  55. package/dist/smart/mail-inspector/lang/ru.json +29 -0
  56. package/dist/smart/mail-inspector/lang/ru.json.gz +0 -0
  57. package/dist/smart/mail-inspector/probe.json +648 -0
  58. package/dist/smart/mail-inspector/probe.json.gz +0 -0
  59. package/dist/smart/mail-inspector/smart.manifest.json +920 -0
  60. package/dist/smart/mail-inspector/smart.manifest.json.gz +0 -0
  61. package/dist/smart/mail-inspector/static/default/item.html +189 -0
  62. package/dist/smart/mail-inspector/static/default/item.html.gz +0 -0
  63. package/dist/smart/mail-inspector/static/default/letter.html +247 -0
  64. package/dist/smart/mail-inspector/static/default/letter.html.gz +0 -0
  65. package/dist/smart/mail-inspector/static/default/reference.html +545 -0
  66. package/dist/smart/mail-inspector/static/default/reference.html.gz +0 -0
  67. package/dist/smart/mail-inspector/static/sheets.json +226 -0
  68. package/dist/smart/mail-inspector/static/sheets.json.gz +0 -0
  69. package/dist/smart/mail-inspector/studio.fixture.json +232 -0
  70. package/dist/smart/mail-inspector/studio.fixture.json.gz +0 -0
  71. package/dist/smart/mail-inspector/studio.scenario.json +43 -0
  72. package/dist/smart/mail-inspector/studio.scenario.json.gz +0 -0
  73. package/dist/smart/mail-inspector/template/default.css +190 -0
  74. package/dist/smart/mail-inspector/template/default.css.gz +0 -0
  75. package/dist/smart/mail-inspector/template/default.js +249 -0
  76. package/dist/smart/mail-inspector/template/default.js.gz +0 -0
  77. package/dist/smart/mail-letters/component.json +455 -0
  78. package/dist/smart/mail-letters/component.json.gz +0 -0
  79. package/dist/smart/mail-letters/css/mail-letters.css +72 -0
  80. package/dist/smart/mail-letters/css/mail-letters.css.gz +0 -0
  81. package/dist/smart/mail-letters/css/mail-letters.min.css +2 -0
  82. package/dist/smart/mail-letters/css/mail-letters.min.css.gz +0 -0
  83. package/dist/smart/mail-letters/examples.json +477 -0
  84. package/dist/smart/mail-letters/examples.json.gz +0 -0
  85. package/dist/smart/mail-letters/js/mail-letters.js +1772 -0
  86. package/dist/smart/mail-letters/js/mail-letters.js.gz +0 -0
  87. package/dist/smart/mail-letters/js/mail-letters.min.js +35 -0
  88. package/dist/smart/mail-letters/js/mail-letters.min.js.gz +0 -0
  89. package/dist/smart/mail-letters/lang/en.json +29 -0
  90. package/dist/smart/mail-letters/lang/en.json.gz +0 -0
  91. package/dist/smart/mail-letters/lang/ru.json +31 -0
  92. package/dist/smart/mail-letters/lang/ru.json.gz +0 -0
  93. package/dist/smart/mail-letters/probe.json +290 -0
  94. package/dist/smart/mail-letters/probe.json.gz +0 -0
  95. package/dist/smart/mail-letters/smart.manifest.json +476 -0
  96. package/dist/smart/mail-letters/smart.manifest.json.gz +0 -0
  97. package/dist/smart/mail-letters/static/default/by-title.html +177 -0
  98. package/dist/smart/mail-letters/static/default/by-title.html.gz +0 -0
  99. package/dist/smart/mail-letters/static/default/empty.html +88 -0
  100. package/dist/smart/mail-letters/static/default/empty.html.gz +0 -0
  101. package/dist/smart/mail-letters/static/default/nothing-found.html +88 -0
  102. package/dist/smart/mail-letters/static/default/nothing-found.html.gz +0 -0
  103. package/dist/smart/mail-letters/static/default/reference.html +168 -0
  104. package/dist/smart/mail-letters/static/default/reference.html.gz +0 -0
  105. package/dist/smart/mail-letters/static/sheets.json +245 -0
  106. package/dist/smart/mail-letters/static/sheets.json.gz +0 -0
  107. package/dist/smart/mail-letters/studio.fixture.json +41 -0
  108. package/dist/smart/mail-letters/studio.fixture.json.gz +0 -0
  109. package/dist/smart/mail-letters/studio.scenario.json +41 -0
  110. package/dist/smart/mail-letters/studio.scenario.json.gz +0 -0
  111. package/dist/smart/mail-letters/template/default.css +79 -0
  112. package/dist/smart/mail-letters/template/default.css.gz +0 -0
  113. package/dist/smart/mail-letters/template/default.js +61 -0
  114. package/dist/smart/mail-letters/template/default.js.gz +0 -0
  115. package/dist/smart/mail-library/component.json +512 -0
  116. package/dist/smart/mail-library/component.json.gz +0 -0
  117. package/dist/smart/mail-library/css/mail-library.css +149 -0
  118. package/dist/smart/mail-library/css/mail-library.css.gz +0 -0
  119. package/dist/smart/mail-library/css/mail-library.min.css +2 -0
  120. package/dist/smart/mail-library/css/mail-library.min.css.gz +0 -0
  121. package/dist/smart/mail-library/examples.json +616 -0
  122. package/dist/smart/mail-library/examples.json.gz +0 -0
  123. package/dist/smart/mail-library/js/mail-library.js +559 -0
  124. package/dist/smart/mail-library/js/mail-library.js.gz +0 -0
  125. package/dist/smart/mail-library/js/mail-library.min.js +52 -0
  126. package/dist/smart/mail-library/js/mail-library.min.js.gz +0 -0
  127. package/dist/smart/mail-library/lang/en.json +21 -0
  128. package/dist/smart/mail-library/lang/en.json.gz +0 -0
  129. package/dist/smart/mail-library/lang/ru.json +21 -0
  130. package/dist/smart/mail-library/lang/ru.json.gz +0 -0
  131. package/dist/smart/mail-library/probe.json +275 -0
  132. package/dist/smart/mail-library/probe.json.gz +0 -0
  133. package/dist/smart/mail-library/smart.manifest.json +512 -0
  134. package/dist/smart/mail-library/smart.manifest.json.gz +0 -0
  135. package/dist/smart/mail-library/static/default/category.html +85 -0
  136. package/dist/smart/mail-library/static/default/category.html.gz +0 -0
  137. package/dist/smart/mail-library/static/default/nothing-found.html +81 -0
  138. package/dist/smart/mail-library/static/default/nothing-found.html.gz +0 -0
  139. package/dist/smart/mail-library/static/default/one-group.html +67 -0
  140. package/dist/smart/mail-library/static/default/one-group.html.gz +0 -0
  141. package/dist/smart/mail-library/static/default/reference.html +135 -0
  142. package/dist/smart/mail-library/static/default/reference.html.gz +0 -0
  143. package/dist/smart/mail-library/static/sheets.json +180 -0
  144. package/dist/smart/mail-library/static/sheets.json.gz +0 -0
  145. package/dist/smart/mail-library/studio.fixture.json +75 -0
  146. package/dist/smart/mail-library/studio.fixture.json.gz +0 -0
  147. package/dist/smart/mail-library/studio.scenario.json +41 -0
  148. package/dist/smart/mail-library/studio.scenario.json.gz +0 -0
  149. package/dist/smart/mail-library/template/default.css +133 -0
  150. package/dist/smart/mail-library/template/default.css.gz +0 -0
  151. package/dist/smart/mail-library/template/default.js +83 -0
  152. package/dist/smart/mail-library/template/default.js.gz +0 -0
  153. package/dist/smart/mail-structure/component.json +497 -0
  154. package/dist/smart/mail-structure/component.json.gz +0 -0
  155. package/dist/smart/mail-structure/css/mail-structure.css +106 -0
  156. package/dist/smart/mail-structure/css/mail-structure.css.gz +0 -0
  157. package/dist/smart/mail-structure/css/mail-structure.min.css +2 -0
  158. package/dist/smart/mail-structure/css/mail-structure.min.css.gz +0 -0
  159. package/dist/smart/mail-structure/examples.json +286 -0
  160. package/dist/smart/mail-structure/examples.json.gz +0 -0
  161. package/dist/smart/mail-structure/js/mail-structure.js +767 -0
  162. package/dist/smart/mail-structure/js/mail-structure.js.gz +0 -0
  163. package/dist/smart/mail-structure/js/mail-structure.min.js +48 -0
  164. package/dist/smart/mail-structure/js/mail-structure.min.js.gz +0 -0
  165. package/dist/smart/mail-structure/lang/en.json +22 -0
  166. package/dist/smart/mail-structure/lang/en.json.gz +0 -0
  167. package/dist/smart/mail-structure/lang/ru.json +22 -0
  168. package/dist/smart/mail-structure/lang/ru.json.gz +0 -0
  169. package/dist/smart/mail-structure/probe.json +112 -0
  170. package/dist/smart/mail-structure/probe.json.gz +0 -0
  171. package/dist/smart/mail-structure/smart.manifest.json +495 -0
  172. package/dist/smart/mail-structure/smart.manifest.json.gz +0 -0
  173. package/dist/smart/mail-structure/static/default/empty.html +76 -0
  174. package/dist/smart/mail-structure/static/default/empty.html.gz +0 -0
  175. package/dist/smart/mail-structure/static/default/reference.html +98 -0
  176. package/dist/smart/mail-structure/static/default/reference.html.gz +0 -0
  177. package/dist/smart/mail-structure/static/default/settings.html +98 -0
  178. package/dist/smart/mail-structure/static/default/settings.html.gz +0 -0
  179. package/dist/smart/mail-structure/static/sheets.json +142 -0
  180. package/dist/smart/mail-structure/static/sheets.json.gz +0 -0
  181. package/dist/smart/mail-structure/studio.fixture.json +45 -0
  182. package/dist/smart/mail-structure/studio.fixture.json.gz +0 -0
  183. package/dist/smart/mail-structure/studio.scenario.json +42 -0
  184. package/dist/smart/mail-structure/studio.scenario.json.gz +0 -0
  185. package/dist/smart/mail-structure/template/default.css +100 -0
  186. package/dist/smart/mail-structure/template/default.css.gz +0 -0
  187. package/dist/smart/mail-structure/template/default.js +80 -0
  188. package/dist/smart/mail-structure/template/default.js.gz +0 -0
  189. package/dist/smart/rule.js +161 -0
  190. package/dist/smart/rule.js.gz +0 -0
  191. package/package.json +29 -4
@@ -0,0 +1,559 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ "574c265c1562"
6
+ (module, __webpack_exports__, __webpack_require__) {
7
+
8
+ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony import */ var _core_js_smart_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("deb1a4d61565");
11
+ /* harmony import */ var _core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("5b7d7695b41b");
12
+ /* harmony import */ var _js_templates_default_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("bdef9ae8a01c");
13
+ /* harmony import */ var _component_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cb97c66065ab");
14
+ /* harmony import */ var _lang_en_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("8046e44dd4c5");
15
+ /* harmony import */ var _lang_ru_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("ed7fcfb3221f");
16
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_core_js_smart_base__WEBPACK_IMPORTED_MODULE_0__, _core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1__, _js_templates_default_js__WEBPACK_IMPORTED_MODULE_2__]);
17
+ ([_core_js_smart_base__WEBPACK_IMPORTED_MODULE_0__, _core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1__, _js_templates_default_js__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
18
+ /* harmony import */ var _core_js_smart_base__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_core_js_smart_base__WEBPACK_IMPORTED_MODULE_0__);
19
+ /* harmony import */ var _core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1__);
20
+ // sf-mail-library: the Library of SIMAI Email Editor -- the blocks a letter can
21
+ // take, grouped by what they are for, with category chips and a search over
22
+ // their names and purposes. A row says what the block is in the person's words
23
+ // and adds it; the element never touches a letter. It raises
24
+ // sf-mail-library-add {type} and the host decides where the block goes (after
25
+ // the selection, at the end).
26
+ //
27
+ // It came from simai/ui-mail (package/src/smart/mail-library, 0.2.0, ui-mail
28
+ // 330720b), where it was written as the first element of the editor's own
29
+ // component package; by the owner's decision D31 (2026-10-29) a product keeps
30
+ // no component set of its own, so it lives here beside the chat components,
31
+ // under its own name.
32
+ //
33
+ // The «Шапка и подвал» section holds the variants of the two places every
34
+ // letter has, the current one marked and not offered again; choosing another
35
+ // raises sf-mail-library-replace {family, type}. Like the editor's, that
36
+ // section shows with «Все» only -- a category is about content.
37
+ //
38
+ // The blocks are data, not a dependency: the host passes `items`
39
+ // ({type, title, purpose, icon, group, sample?}), `groups` ({id, title}) and
40
+ // `places` in the order they are shown, so the element works for any block
41
+ // library and knows nothing of the editor's manifest format.
42
+ //
43
+ // From its component.json (standard simai.smart-component 1.4 §3, §4, §8,
44
+ // §11): the settings are attributes and properties made by
45
+ // core/js/element-manifest.js, its words are lang/<locale>.json, and the
46
+ // actions answer outcomes.
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ const applied = () => ({
55
+ outcome: "applied"
56
+ });
57
+
58
+ const refused = reason => ({
59
+ outcome: "refused",
60
+ reason
61
+ });
62
+
63
+ const named = (one, key) => one && typeof one === "object" && typeof one[key] === "string" && one[key] !== "";
64
+
65
+ const MailLibraryElement = (0,_core_js_element_manifest__WEBPACK_IMPORTED_MODULE_1__.elementFromManifest)(_component_json__WEBPACK_IMPORTED_MODULE_3__, {
66
+ base: (_core_js_smart_base__WEBPACK_IMPORTED_MODULE_0___default()),
67
+ lang: {
68
+ en: _lang_en_json__WEBPACK_IMPORTED_MODULE_4__,
69
+ ru: _lang_ru_json__WEBPACK_IMPORTED_MODULE_5__
70
+ },
71
+ source: "ru",
72
+ actions: {
73
+ search({
74
+ query
75
+ } = {}) {
76
+ this.query = String(query ?? "");
77
+ return applied();
78
+ },
79
+
80
+ filter({
81
+ category
82
+ } = {}) {
83
+ this.category = String(category || "all");
84
+ return applied();
85
+ },
86
+
87
+ add({
88
+ type
89
+ } = {}) {
90
+ const id = String(type ?? "");
91
+ if (!this.blocks().some(item => item.type === id)) return refused("unknown");
92
+ this.sfEmit("add", {
93
+ type: id
94
+ });
95
+ return applied();
96
+ },
97
+
98
+ replace({
99
+ family,
100
+ type
101
+ } = {}) {
102
+ const place = this.placeList().find(candidate => candidate.family === String(family ?? ""));
103
+ const id = String(type ?? "");
104
+ if (!place || !place.items.some(item => item && item.type === id)) return refused("unknown"); // The variant the letter has now is not offered again.
105
+
106
+ if (place.current === id) return refused("current");
107
+ this.sfEmit("replace", {
108
+ family: place.family,
109
+ type: id
110
+ });
111
+ return applied();
112
+ }
113
+
114
+ }
115
+ });
116
+
117
+ class SfMailLibrary extends MailLibraryElement {
118
+ static get props() {
119
+ return { ...super.props,
120
+ templateName: {
121
+ attribute: "template",
122
+ default: "default"
123
+ }
124
+ };
125
+ }
126
+
127
+ constructor() {
128
+ super(); // A list set as a property before the element was defined is an own
129
+ // property that would hide the accessor; it is taken through it.
130
+
131
+ for (const name of ["items", "groups", "places"]) {
132
+ if (!Object.prototype.hasOwnProperty.call(this, name)) continue;
133
+ const early = this[name];
134
+ delete this[name];
135
+ this[name] = early;
136
+ }
137
+ } // [{type, title, purpose, icon, group, sample?}]: one row per block. A row
138
+ // whose group is not in `groups` is not shown, so a host that offers fewer
139
+ // groups offers fewer blocks, and nothing is drawn under a heading nobody
140
+ // named.
141
+
142
+
143
+ blocks() {
144
+ return Array.isArray(this.items) ? this.items.filter(item => named(item, "type")) : [];
145
+ } // [{id, title}]: the groups in the order they are shown.
146
+
147
+
148
+ groupList() {
149
+ return Array.isArray(this.groups) ? this.groups.filter(group => named(group, "id")) : [];
150
+ } // [{family, title, current, items: [{type, title, purpose, icon}]}]: the
151
+ // places every letter has (the header and the footer) and their variants.
152
+
153
+
154
+ placeList() {
155
+ return Array.isArray(this.places) ? this.places.filter(place => named(place, "family") && Array.isArray(place.items)) : [];
156
+ } // 'all', or the id of one group. An id no group has shows every group, so
157
+ // a stale filter never leaves the Library empty.
158
+
159
+
160
+ shownCategory() {
161
+ const value = String(this.category || "all");
162
+ return value === "all" || this.groupList().some(group => group.id === value) ? value : "all";
163
+ }
164
+
165
+ matcher() {
166
+ const query = String(this.query ?? "").trim().toLowerCase();
167
+ return item => !query || `${item.title ?? ""} ${item.purpose ?? ""} ${item.type}`.toLowerCase().includes(query);
168
+ }
169
+ /** The groups to draw, each with the rows the query and the category leave in it. */
170
+
171
+
172
+ shownGroups() {
173
+ const matches = this.matcher();
174
+ const category = this.shownCategory();
175
+ const items = this.blocks();
176
+ return this.groupList().filter(group => category === "all" || group.id === category).map(group => ({ ...group,
177
+ items: items.filter(item => item.group === group.id && matches(item))
178
+ })).filter(group => group.items.length > 0);
179
+ }
180
+ /** The places with the variants the query leaves; none while a category is chosen. */
181
+
182
+
183
+ shownPlaces() {
184
+ if (this.shownCategory() !== "all") return [];
185
+ const matches = this.matcher();
186
+ return this.placeList().map(place => ({ ...place,
187
+ items: place.items.filter(item => named(item, "type") && matches(item))
188
+ })).filter(place => place.items.length > 0);
189
+ }
190
+
191
+ templateContext() {
192
+ const groups = this.shownGroups();
193
+ const places = this.shownPlaces();
194
+ const groupList = this.groupList();
195
+ return {
196
+ component: this,
197
+ query: String(this.query ?? ""),
198
+ category: this.shownCategory(),
199
+ chips: groupList.length > 1 ? [{
200
+ id: "all",
201
+ title: this.sfWord("all-text")
202
+ }, ...groupList] : [],
203
+ groups,
204
+ places,
205
+ nothingFound: groups.length === 0 && places.length === 0 && (this.blocks().length > 0 || this.placeList().length > 0),
206
+ searchLabel: this.sfWord("search-label"),
207
+ addLabel: this.sfWord("add-text"),
208
+ categoryLabel: this.sfWord("category-label"),
209
+ changeVariantLabel: this.sfWord("change-variant-text"),
210
+ currentLabel: this.sfWord("current-text"),
211
+ nothingFoundTitle: this.sfWord("nothing-found-heading"),
212
+ nothingFoundText: this.sfWord("nothing-found-text"),
213
+ rootClass: this.getRootClass?.() ?? ""
214
+ };
215
+ }
216
+
217
+ template() {
218
+ return (0,_js_templates_default_js__WEBPACK_IMPORTED_MODULE_2__.renderMailLibraryTemplate)(this.templateContext());
219
+ }
220
+
221
+ }
222
+
223
+ SfMailLibrary.define("sf-mail-library");
224
+ __webpack_async_result__();
225
+ } catch(e) { __webpack_async_result__(e); } });
226
+
227
+ /***/ },
228
+
229
+ /***/ "bdef9ae8a01c"
230
+ (module, __webpack_exports__, __webpack_require__) {
231
+
232
+ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
233
+ __webpack_require__.r(__webpack_exports__);
234
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
235
+ /* harmony export */ renderMailLibraryTemplate: () => (/* binding */ renderMailLibraryTemplate)
236
+ /* harmony export */ });
237
+ /* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2a080a730149");
238
+ /* harmony import */ var _default_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("d334b24d9602");
239
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([lit__WEBPACK_IMPORTED_MODULE_0__]);
240
+ var __webpack_async_dependencies_result__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
241
+ lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_async_dependencies_result__[0];
242
+ /* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lit__WEBPACK_IMPORTED_MODULE_0__);
243
+
244
+ // One row: the icon, the name, what the block is for (up to two lines) and,
245
+ // for a screen reader only, the action. The name of the button is the row's
246
+ // own words, so a voice command that says the block's name reaches it (WCAG
247
+ // 2.5.3); «+» is drawn on hover and focus, never at rest.
248
+
249
+ function renderRow(context, item) {
250
+ const tip = item.sample && item.sample !== item.title ? `${item.title} — ${item.purpose ?? ""}\n«${item.sample}»` : `${item.title} — ${item.purpose ?? ""}`;
251
+ return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
252
+ <button type="button" class="sf-mail-library-row" data-add=${item.type} title=${tip}
253
+ @click=${() => context.component.add({
254
+ type: item.type
255
+ })}>
256
+ <sf-icon class="sf-mail-library-row-icon" icon=${item.icon || "widgets"} data-sf-icon-scale="ladder" size="1/2" aria-hidden="true"></sf-icon>
257
+ <span class="sf-mail-library-row-words">
258
+ <span class="sf-mail-library-row-title">${item.title}</span>
259
+ ${item.purpose ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-mail-library-row-purpose">${item.purpose}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
260
+ <span class="sr-only">${context.addLabel}</span>
261
+ </span>
262
+ <span class="sf-mail-library-row-add" aria-hidden="true"><sf-icon icon="add" data-sf-icon-scale="ladder" size="1/2"></sf-icon></span>
263
+ </button>
264
+ `;
265
+ } // A variant of a place: the one the letter has now is marked, carries its
266
+ // tick and is not offered again; another one replaces it.
267
+
268
+
269
+ function renderVariant(context, place, item) {
270
+ const current = item.type === place.current;
271
+ return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
272
+ <button type="button" class=${["sf-mail-library-row", current ? "is-selected" : ""].filter(Boolean).join(" ")}
273
+ data-variant=${item.type} data-family=${place.family} aria-pressed=${String(current)}
274
+ title=${`${item.title} — ${item.purpose ?? ""}`}
275
+ @click=${() => context.component.replace({
276
+ family: place.family,
277
+ type: item.type
278
+ })}>
279
+ <sf-icon class="sf-mail-library-row-icon" icon=${item.icon || "widgets"} data-sf-icon-scale="ladder" size="1/2" aria-hidden="true"></sf-icon>
280
+ <span class="sf-mail-library-row-words">
281
+ <span class="sf-mail-library-row-title">${item.title}</span>
282
+ ${item.purpose ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-mail-library-row-purpose">${item.purpose}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
283
+ <span class="sr-only">${current ? context.currentLabel : `${context.changeVariantLabel} ${place.title}`}</span>
284
+ </span>
285
+ <span class="sf-mail-library-row-add" aria-hidden="true"><sf-icon icon=${current ? "check" : "swap_horiz"} data-sf-icon-scale="ladder" size="1/2"></sf-icon></span>
286
+ </button>
287
+ `;
288
+ } // The Library: the search field, the category switch (an sf-segmented: «Все»
289
+ // and one per group, when there is more than one group), the groups the search and the category
290
+ // leave, then the places («Шапка и подвал») while «Все» is chosen, and the
291
+ // empty state when nothing is left.
292
+
293
+
294
+ function renderMailLibraryTemplate(context) {
295
+ return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
296
+ <div class=${["sf-mail-library", context.rootClass].filter(Boolean).join(" ")}>
297
+ <sf-input class="sf-mail-library-search" input-type="search" size="1/2" label=${context.searchLabel}
298
+ value=${context.query}
299
+ @input=${event => context.component.search({
300
+ query: event.target?.value ?? event.detail?.value ?? ""
301
+ })}></sf-input>
302
+ ${context.chips.length ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<div class="sf-mail-library-chips">
303
+ <sf-segmented size="1/2" aria-label=${context.categoryLabel}
304
+ .items=${context.chips.map(chip => ({
305
+ value: chip.id,
306
+ label: chip.title
307
+ }))} .value=${context.category}
308
+ @change=${event => context.component.filter({
309
+ category: event.detail?.value
310
+ })}></sf-segmented>
311
+ </div>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
312
+ <div class="sf-mail-library-groups">
313
+ ${context.groups.map(group => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
314
+ <div class="sf-mail-library-group" role="group" aria-label=${group.title} data-group=${group.id}>
315
+ <span class="sf-mail-library-group-title" aria-hidden="true">${group.title}</span>
316
+ ${group.items.map(item => renderRow(context, item))}
317
+ </div>
318
+ `)}
319
+ ${context.places.map(place => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
320
+ <div class="sf-mail-library-group" role="group" aria-label=${place.title} data-group=${`pinned-${place.family}`}>
321
+ <span class="sf-mail-library-group-title" aria-hidden="true">${place.title}</span>
322
+ ${place.items.map(item => renderVariant(context, place, item))}
323
+ </div>
324
+ `)}
325
+ </div>
326
+ ${context.nothingFound ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<sf-empty-state class="sf-mail-library-empty" kind="nothing-found" size="1/2" heading-level="3"
327
+ heading=${context.nothingFoundTitle} text=${context.nothingFoundText}></sf-empty-state>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
328
+ </div>
329
+ `;
330
+ }
331
+ __webpack_async_result__();
332
+ } catch(e) { __webpack_async_result__(e); } });
333
+
334
+ /***/ },
335
+
336
+ /***/ "d334b24d9602"
337
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
338
+
339
+ __webpack_require__.r(__webpack_exports__);
340
+ // extracted by mini-css-extract-plugin
341
+
342
+
343
+ /***/ },
344
+
345
+ /***/ "5b7d7695b41b"
346
+ (module) {
347
+
348
+ module.exports = (globalThis.SF && globalThis.SF.runtimeModule ? globalThis.SF.runtimeModule("element-manifest", 1) : new Promise((resolve, reject) => globalThis.addEventListener("sf-runtime-ready", () => globalThis.SF.runtimeModule("element-manifest", 1).then(resolve, reject), { once: true })));
349
+
350
+ /***/ },
351
+
352
+ /***/ "2a080a730149"
353
+ (module) {
354
+
355
+ module.exports = (globalThis.SF && globalThis.SF.runtimeModule ? globalThis.SF.runtimeModule("lit", 1) : new Promise((resolve, reject) => globalThis.addEventListener("sf-runtime-ready", () => globalThis.SF.runtimeModule("lit", 1).then(resolve, reject), { once: true })));
356
+
357
+ /***/ },
358
+
359
+ /***/ "deb1a4d61565"
360
+ (module) {
361
+
362
+ module.exports = (globalThis.SF && globalThis.SF.runtimeModule ? globalThis.SF.runtimeModule("smart-base", 1) : new Promise((resolve, reject) => globalThis.addEventListener("sf-runtime-ready", () => globalThis.SF.runtimeModule("smart-base", 1).then(resolve, reject), { once: true })));
363
+
364
+ /***/ },
365
+
366
+ /***/ "cb97c66065ab"
367
+ (module) {
368
+
369
+ module.exports = /*#__PURE__*/JSON.parse('{"id":"smart.mail-library","tag":"sf-mail-library","version":"1.0.8","kind":"leaf","settings":{"items":{"type":"list","default":[],"of":{"type":"id","title":"string","purpose":{"type":"string","optional":true},"icon":{"type":"icon","optional":true},"group":"id","sample":{"type":"string","optional":true}},"entries":{"key":"type","changes":"content"}},"groups":{"type":"list","default":[],"of":{"id":"id","title":"string"},"entries":{"key":"id","changes":"content"}},"places":{"type":"list","default":[],"of":{"family":"id","title":"string","current":{"type":"id","optional":true},"items":"list"},"entries":{"key":"family","changes":"content"}},"query":{"type":"string","default":""},"category":{"type":"string","default":"all"}},"values":{},"events":{"add":{"carries":{"type":"id"},"own-verb":true},"replace":{"carries":{"family":"id","type":"id"},"own-verb":true}},"actions":{"search":{"with":{"query":"string"}},"filter":{"with":{"category":"string"}},"add":{"with":{"type":"id"}},"replace":{"with":{"family":"id","type":"id"}}},"host-states":{},"css-variables":{}}');
370
+
371
+ /***/ },
372
+
373
+ /***/ "8046e44dd4c5"
374
+ (module) {
375
+
376
+ module.exports = /*#__PURE__*/JSON.parse('{"title":"Email block library","runtime":{"add-text":"Add","all-text":"All","category-label":"Category","change-variant-text":"Change the variant:","current-text":"in the letter now","nothing-found-heading":"Nothing found","nothing-found-text":"Try another word: a block is found by its name and by what it is for","search-label":"Find a block"},"events":{"add":{"label":"Add a block"},"replace":{"label":"Change the variant"}}}');
377
+
378
+ /***/ },
379
+
380
+ /***/ "ed7fcfb3221f"
381
+ (module) {
382
+
383
+ module.exports = /*#__PURE__*/JSON.parse('{"title":"Библиотека блоков письма","runtime":{"add-text":"Добавить","all-text":"Все","category-label":"Категория","change-variant-text":"Сменить вариант:","current-text":"сейчас в письме","nothing-found-heading":"Ничего не найдено","nothing-found-text":"Попробуйте другое слово: блок находится по названию и по тому, для чего он","search-label":"Найти блок"},"events":{"add":{"label":"Добавить блок"},"replace":{"label":"Сменить вариант"}}}');
384
+
385
+ /***/ }
386
+
387
+ /******/ });
388
+ /************************************************************************/
389
+ /******/ // The module cache
390
+ /******/ const __webpack_module_cache__ = {};
391
+ /******/
392
+ /******/ // The require function
393
+ /******/ function __webpack_require__(moduleId) {
394
+ /******/ // Check if module is in cache
395
+ /******/ const cachedModule = __webpack_module_cache__[moduleId];
396
+ /******/ if (cachedModule !== undefined) {
397
+ /******/ return cachedModule.exports;
398
+ /******/ }
399
+ /******/ // Create a new module (and put it into the cache)
400
+ /******/ const module = __webpack_module_cache__[moduleId] = {
401
+ /******/ // no module.id needed
402
+ /******/ // no module.loaded needed
403
+ /******/ exports: {}
404
+ /******/ };
405
+ /******/
406
+ /******/ // Execute the module function
407
+ /******/ if (!(moduleId in __webpack_modules__)) {
408
+ /******/ delete __webpack_module_cache__[moduleId];
409
+ /******/ const e = new Error("Cannot find module '" + moduleId + "'");
410
+ /******/ e.code = 'MODULE_NOT_FOUND';
411
+ /******/ throw e;
412
+ /******/ }
413
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
414
+ /******/
415
+ /******/ // Return the exports of the module
416
+ /******/ return module.exports;
417
+ /******/ }
418
+ /******/
419
+ /************************************************************************/
420
+ /******/ /* webpack/runtime/async module */
421
+ /******/ (() => {
422
+ /******/ const hasSymbol = typeof Symbol === "function";
423
+ /******/ const webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__";
424
+ /******/ const webpackExports = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__";
425
+ /******/ const webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__";
426
+ /******/
427
+ /******/ const resolveQueue = (queue) => {
428
+ /******/ if(queue?.d < 1) {
429
+ /******/ queue.d = 1;
430
+ /******/ queue.forEach((fn) => (fn.r--));
431
+ /******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
432
+ /******/ }
433
+ /******/ }
434
+ /******/ const wrapDeps = (deps) => (deps.map((dep) => {
435
+ /******/ if(dep !== null && typeof dep === "object") {
436
+ /******/
437
+ /******/ if(dep[webpackQueues]) return dep;
438
+ /******/ if(dep.then) {
439
+ /******/ const queue = [];
440
+ /******/ queue.d = 0;
441
+ /******/ dep.then((r) => {
442
+ /******/ obj[webpackExports] = r;
443
+ /******/ resolveQueue(queue);
444
+ /******/ }, (e) => {
445
+ /******/ obj[webpackError] = e;
446
+ /******/ resolveQueue(queue);
447
+ /******/ });
448
+ /******/ const obj = {};
449
+ /******/
450
+ /******/ obj[webpackQueues] = (fn) => (fn(queue));
451
+ /******/ return obj;
452
+ /******/ }
453
+ /******/ }
454
+ /******/ const ret = {};
455
+ /******/ ret[webpackQueues] = x => {};
456
+ /******/ ret[webpackExports] = dep;
457
+ /******/ return ret;
458
+ /******/ }));
459
+ /******/ __webpack_require__.a = (module, body, hasAwait) => {
460
+ /******/ let queue;
461
+ /******/ hasAwait && ((queue = []).d = -1);
462
+ /******/ const depQueues = new Set();
463
+ /******/ const exports = module.exports;
464
+ /******/ let currentDeps;
465
+ /******/ let outerResolve;
466
+ /******/ let reject;
467
+ /******/ const promise = new Promise((resolve, rej) => {
468
+ /******/ reject = rej;
469
+ /******/ outerResolve = resolve;
470
+ /******/ });
471
+ /******/ promise[webpackExports] = exports;
472
+ /******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
473
+ /******/ module.exports = promise;
474
+ /******/ const handle = (deps) => {
475
+ /******/ currentDeps = wrapDeps(deps);
476
+ /******/ let fn;
477
+ /******/ const getResult = () => (currentDeps.map((d) => {
478
+ /******/
479
+ /******/ if(d[webpackError]) throw d[webpackError];
480
+ /******/ return d[webpackExports];
481
+ /******/ }))
482
+ /******/ const promise = new Promise((resolve) => {
483
+ /******/ fn = () => (resolve(getResult));
484
+ /******/ fn.r = 0;
485
+ /******/ const fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
486
+ /******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
487
+ /******/ });
488
+ /******/ return fn.r ? promise : getResult();
489
+ /******/ }
490
+ /******/ const done = (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))
491
+ /******/ body(handle, done);
492
+ /******/ queue?.d < 0 && (queue.d = 0);
493
+ /******/ };
494
+ /******/ })();
495
+ /******/
496
+ /******/ /* webpack/runtime/compat get default export */
497
+ /******/ (() => {
498
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
499
+ /******/ __webpack_require__.n = (module) => {
500
+ /******/ const getter = module && module.__esModule ?
501
+ /******/ () => (module['default']) :
502
+ /******/ () => (module);
503
+ /******/ __webpack_require__.d(getter, { a: getter });
504
+ /******/ return getter;
505
+ /******/ };
506
+ /******/ })();
507
+ /******/
508
+ /******/ /* webpack/runtime/define property getters */
509
+ /******/ (() => {
510
+ /******/ // define getter/value functions for harmony exports
511
+ /******/ __webpack_require__.d = (exports, definition) => {
512
+ /******/ if(Array.isArray(definition)) {
513
+ /******/ var i = 0;
514
+ /******/ while(i < definition.length) {
515
+ /******/ var key = definition[i++];
516
+ /******/ var binding = definition[i++];
517
+ /******/ if(!__webpack_require__.o(exports, key)) {
518
+ /******/ if(binding === 0) {
519
+ /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
520
+ /******/ } else {
521
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
522
+ /******/ }
523
+ /******/ } else if(binding === 0) { i++; }
524
+ /******/ }
525
+ /******/ } else {
526
+ /******/ for(var key in definition) {
527
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
528
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
529
+ /******/ }
530
+ /******/ }
531
+ /******/ }
532
+ /******/ };
533
+ /******/ })();
534
+ /******/
535
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
536
+ /******/ (() => {
537
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
538
+ /******/ })();
539
+ /******/
540
+ /******/ /* webpack/runtime/make namespace object */
541
+ /******/ (() => {
542
+ /******/ // define __esModule on exports
543
+ /******/ __webpack_require__.r = (exports) => {
544
+ /******/ if(Symbol.toStringTag) {
545
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
546
+ /******/ }
547
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
548
+ /******/ };
549
+ /******/ })();
550
+ /******/
551
+ /************************************************************************/
552
+ /******/
553
+ /******/ // startup
554
+ /******/ // Load entry module and return exports
555
+ /******/ // This entry module used 'module' so it can't be inlined
556
+ /******/ let __webpack_exports__ = __webpack_require__("574c265c1562");
557
+ /******/
558
+ /******/ })()
559
+ ;
@@ -0,0 +1,52 @@
1
+ (()=>{"use strict";var e={"574c265c1562"(e,t,a){a.a(e,async(e,t)=>{try{var r=a("deb1a4d61565"),s=a("5b7d7695b41b"),i=a("bdef9ae8a01c"),n=a("cb97c66065ab"),l=a("8046e44dd4c5"),o=a("ed7fcfb3221f"),c=e([r,s,i]);[r,s,i]=c.then?(await c)():c;var p=a.n(r);const d=()=>({outcome:"applied"}),u=e=>({outcome:"refused",reason:e}),h=(e,t)=>e&&"object"==typeof e&&"string"==typeof e[t]&&""!==e[t],f=(0,s.elementFromManifest)(n,{base:p(),lang:{en:l,ru:o},source:"ru",actions:{search({query:e}={}){return this.query=String(e??""),d()},filter({category:e}={}){return this.category=String(e||"all"),d()},add({type:e}={}){const t=String(e??"");return this.blocks().some(e=>e.type===t)?(this.sfEmit("add",{type:t}),d()):u("unknown")},replace({family:e,type:t}={}){const a=this.placeList().find(t=>t.family===String(e??"")),r=String(t??"");return a&&a.items.some(e=>e&&e.type===r)?a.current===r?u("current"):(this.sfEmit("replace",{family:a.family,type:r}),d()):u("unknown")}}});class y extends f{static get props(){return{...super.props,templateName:{attribute:"template",default:"default"}}}constructor(){super();for(const e of["items","groups","places"]){if(!Object.prototype.hasOwnProperty.call(this,e))continue;const t=this[e];delete this[e],this[e]=t}}blocks(){return Array.isArray(this.items)?this.items.filter(e=>h(e,"type")):[]}groupList(){return Array.isArray(this.groups)?this.groups.filter(e=>h(e,"id")):[]}placeList(){return Array.isArray(this.places)?this.places.filter(e=>h(e,"family")&&Array.isArray(e.items)):[]}shownCategory(){const e=String(this.category||"all");return"all"===e||this.groupList().some(t=>t.id===e)?e:"all"}matcher(){const e=String(this.query??"").trim().toLowerCase();return t=>!e||`${t.title??""} ${t.purpose??""} ${t.type}`.toLowerCase().includes(e)}shownGroups(){const e=this.matcher(),t=this.shownCategory(),a=this.blocks();return this.groupList().filter(e=>"all"===t||e.id===t).map(t=>({...t,items:a.filter(a=>a.group===t.id&&e(a))})).filter(e=>e.items.length>0)}shownPlaces(){if("all"!==this.shownCategory())return[];const e=this.matcher();return this.placeList().map(t=>({...t,items:t.items.filter(t=>h(t,"type")&&e(t))})).filter(e=>e.items.length>0)}templateContext(){const e=this.shownGroups(),t=this.shownPlaces(),a=this.groupList();return{component:this,query:String(this.query??""),category:this.shownCategory(),chips:a.length>1?[{id:"all",title:this.sfWord("all-text")},...a]:[],groups:e,places:t,nothingFound:0===e.length&&0===t.length&&(this.blocks().length>0||this.placeList().length>0),searchLabel:this.sfWord("search-label"),addLabel:this.sfWord("add-text"),categoryLabel:this.sfWord("category-label"),changeVariantLabel:this.sfWord("change-variant-text"),currentLabel:this.sfWord("current-text"),nothingFoundTitle:this.sfWord("nothing-found-heading"),nothingFoundText:this.sfWord("nothing-found-text"),rootClass:this.getRootClass?.()??""}}template(){return(0,i.B)(this.templateContext())}}y.define("sf-mail-library"),t()}catch(e){t(e)}})},bdef9ae8a01c(e,t,a){a.a(e,async(e,r)=>{try{a.d(t,{B:()=>c});var s=a("2a080a730149"),i=e([s]),n=i.then?(await i)():i;s=n[0];function l(e,t){const a=t.sample&&t.sample!==t.title?`${t.title} — ${t.purpose??""}\n«${t.sample}»`:`${t.title} — ${t.purpose??""}`;return s.html`
2
+ <button type="button" class="sf-mail-library-row" data-add=${t.type} title=${a}
3
+ @click=${()=>e.component.add({type:t.type})}>
4
+ <sf-icon class="sf-mail-library-row-icon" icon=${t.icon||"widgets"} data-sf-icon-scale="ladder" size="1/2" aria-hidden="true"></sf-icon>
5
+ <span class="sf-mail-library-row-words">
6
+ <span class="sf-mail-library-row-title">${t.title}</span>
7
+ ${t.purpose?s.html`<span class="sf-mail-library-row-purpose">${t.purpose}</span>`:s.nothing}
8
+ <span class="sr-only">${e.addLabel}</span>
9
+ </span>
10
+ <span class="sf-mail-library-row-add" aria-hidden="true"><sf-icon icon="add" data-sf-icon-scale="ladder" size="1/2"></sf-icon></span>
11
+ </button>
12
+ `}function o(e,t,a){const r=a.type===t.current;return s.html`
13
+ <button type="button" class=${["sf-mail-library-row",r?"is-selected":""].filter(Boolean).join(" ")}
14
+ data-variant=${a.type} data-family=${t.family} aria-pressed=${String(r)}
15
+ title=${`${a.title} — ${a.purpose??""}`}
16
+ @click=${()=>e.component.replace({family:t.family,type:a.type})}>
17
+ <sf-icon class="sf-mail-library-row-icon" icon=${a.icon||"widgets"} data-sf-icon-scale="ladder" size="1/2" aria-hidden="true"></sf-icon>
18
+ <span class="sf-mail-library-row-words">
19
+ <span class="sf-mail-library-row-title">${a.title}</span>
20
+ ${a.purpose?s.html`<span class="sf-mail-library-row-purpose">${a.purpose}</span>`:s.nothing}
21
+ <span class="sr-only">${r?e.currentLabel:`${e.changeVariantLabel} ${t.title}`}</span>
22
+ </span>
23
+ <span class="sf-mail-library-row-add" aria-hidden="true"><sf-icon icon=${r?"check":"swap_horiz"} data-sf-icon-scale="ladder" size="1/2"></sf-icon></span>
24
+ </button>
25
+ `}function c(e){return s.html`
26
+ <div class=${["sf-mail-library",e.rootClass].filter(Boolean).join(" ")}>
27
+ <sf-input class="sf-mail-library-search" input-type="search" size="1/2" label=${e.searchLabel}
28
+ value=${e.query}
29
+ @input=${t=>e.component.search({query:t.target?.value??t.detail?.value??""})}></sf-input>
30
+ ${e.chips.length?s.html`<div class="sf-mail-library-chips">
31
+ <sf-segmented size="1/2" aria-label=${e.categoryLabel}
32
+ .items=${e.chips.map(e=>({value:e.id,label:e.title}))} .value=${e.category}
33
+ @change=${t=>e.component.filter({category:t.detail?.value})}></sf-segmented>
34
+ </div>`:s.nothing}
35
+ <div class="sf-mail-library-groups">
36
+ ${e.groups.map(t=>s.html`
37
+ <div class="sf-mail-library-group" role="group" aria-label=${t.title} data-group=${t.id}>
38
+ <span class="sf-mail-library-group-title" aria-hidden="true">${t.title}</span>
39
+ ${t.items.map(t=>l(e,t))}
40
+ </div>
41
+ `)}
42
+ ${e.places.map(t=>s.html`
43
+ <div class="sf-mail-library-group" role="group" aria-label=${t.title} data-group=${`pinned-${t.family}`}>
44
+ <span class="sf-mail-library-group-title" aria-hidden="true">${t.title}</span>
45
+ ${t.items.map(a=>o(e,t,a))}
46
+ </div>
47
+ `)}
48
+ </div>
49
+ ${e.nothingFound?s.html`<sf-empty-state class="sf-mail-library-empty" kind="nothing-found" size="1/2" heading-level="3"
50
+ heading=${e.nothingFoundTitle} text=${e.nothingFoundText}></sf-empty-state>`:s.nothing}
51
+ </div>
52
+ `}r()}catch(p){r(p)}})},"5b7d7695b41b"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("element-manifest",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("element-manifest",1).then(e,t),{once:!0}))},"2a080a730149"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit",1).then(e,t),{once:!0}))},deb1a4d61565(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("smart-base",1).then(e,t),{once:!0}))},cb97c66065ab(e){e.exports=JSON.parse('{"id":"smart.mail-library","tag":"sf-mail-library","version":"1.0.8","kind":"leaf","settings":{"items":{"type":"list","default":[],"of":{"type":"id","title":"string","purpose":{"type":"string","optional":true},"icon":{"type":"icon","optional":true},"group":"id","sample":{"type":"string","optional":true}},"entries":{"key":"type","changes":"content"}},"groups":{"type":"list","default":[],"of":{"id":"id","title":"string"},"entries":{"key":"id","changes":"content"}},"places":{"type":"list","default":[],"of":{"family":"id","title":"string","current":{"type":"id","optional":true},"items":"list"},"entries":{"key":"family","changes":"content"}},"query":{"type":"string","default":""},"category":{"type":"string","default":"all"}},"values":{},"events":{"add":{"carries":{"type":"id"},"own-verb":true},"replace":{"carries":{"family":"id","type":"id"},"own-verb":true}},"actions":{"search":{"with":{"query":"string"}},"filter":{"with":{"category":"string"}},"add":{"with":{"type":"id"}},"replace":{"with":{"family":"id","type":"id"}}},"host-states":{},"css-variables":{}}')},"8046e44dd4c5"(e){e.exports=JSON.parse('{"title":"Email block library","runtime":{"add-text":"Add","all-text":"All","category-label":"Category","change-variant-text":"Change the variant:","current-text":"in the letter now","nothing-found-heading":"Nothing found","nothing-found-text":"Try another word: a block is found by its name and by what it is for","search-label":"Find a block"},"events":{"add":{"label":"Add a block"},"replace":{"label":"Change the variant"}}}')},ed7fcfb3221f(e){e.exports=JSON.parse('{"title":"Библиотека блоков письма","runtime":{"add-text":"Добавить","all-text":"Все","category-label":"Категория","change-variant-text":"Сменить вариант:","current-text":"сейчас в письме","nothing-found-heading":"Ничего не найдено","nothing-found-text":"Попробуйте другое слово: блок находится по названию и по тому, для чего он","search-label":"Найти блок"},"events":{"add":{"label":"Добавить блок"},"replace":{"label":"Сменить вариант"}}}')}};const t={};function a(r){const s=t[r];if(void 0!==s)return s.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,a),i.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",r=e?Symbol("webpack exports"):"__webpack_exports__",s=e?Symbol("webpack error"):"__webpack_error__",i=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};a.a=(e,a,n)=>{let l;n&&((l=[]).d=-1);const o=new Set,c=e.exports;let p,d,u;const h=new Promise((e,t)=>{u=t,d=e});h[r]=c,h[t]=e=>(l&&e(l),o.forEach(e),h.catch(e=>{})),e.exports=h;a(e=>{let a;p=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const a=[];a.d=0,e.then(e=>{n[r]=e,i(a)},e=>{n[s]=e,i(a)});const n={};return n[t]=e=>e(a),n}}const a={};return a[t]=e=>{},a[r]=e,a}))(e);const n=()=>p.map(e=>{if(e[s])throw e[s];return e[r]}),c=new Promise(e=>{a=()=>e(n),a.r=0;const r=e=>e!==l&&!o.has(e)&&(o.add(e),e&&!e.d&&(a.r++,e.push(a)));p.map(e=>e[t](r))});return a.r?c:n()},e=>(e?u(h[s]=e):d(c),i(l))),l?.d<0&&(l.d=0)}})(),a.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var s=t[r++],i=t[r++];a.o(e,s)?0===i&&r++:0===i?Object.defineProperty(e,s,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,s,{enumerable:!0,get:i})}else for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);a("574c265c1562")})();