@kashi-ui/elements 2.24.1 → 2.26.0

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 (73) hide show
  1. package/README.md +3 -3
  2. package/dist/base.d.ts +110 -0
  3. package/dist/capture.d.ts +75 -0
  4. package/dist/capture.js +456 -0
  5. package/dist/cdn/{appointment-DOXBUwIU.js → appointment-BaEWfjSX.js} +1 -1
  6. package/dist/cdn/base-BqFAMlwG.js +1 -0
  7. package/dist/cdn/{basic-DuY4RslZ.js → basic-BBvsRt91.js} +1 -1
  8. package/dist/cdn/{buttons-BaK6bx3w.js → buttons-BmP5wikN.js} +1 -1
  9. package/dist/cdn/{calendar-BulPeVAJ.js → calendar-CwKogl-G.js} +1 -1
  10. package/dist/cdn/capture-B48H5hmR.js +24 -0
  11. package/dist/cdn/{card-BKiwJF34.js → card-C0nariT-.js} +1 -1
  12. package/dist/cdn/{cards-DKarXHsC.js → cards-D9-wNDK8.js} +1 -1
  13. package/dist/cdn/{charts-ETYOAJyB.js → charts-Cct32znI.js} +1 -1
  14. package/dist/cdn/{chat-D5ZIMnNp.js → chat-Dg5CEN6Y.js} +1 -1
  15. package/dist/cdn/{choice-DBvC2Puo.js → choice-cDqbHUTC.js} +1 -1
  16. package/dist/cdn/combobox-Drm8K9Zk.js +1 -0
  17. package/dist/cdn/commerce-JkDctt2h.js +1 -0
  18. package/dist/cdn/{content-DN3eXLg-.js → content-CqUXcDCi.js} +1 -1
  19. package/dist/cdn/{controls--OMZkJYe.js → controls-CquzGwtr.js} +1 -1
  20. package/dist/cdn/{display-BfYWAjNu.js → display-DW5JEQXT.js} +1 -1
  21. package/dist/cdn/{fields-B-jTUQiI.js → fields-C-ytjZil.js} +1 -1
  22. package/dist/cdn/forms-CurTYl2V.js +1 -0
  23. package/dist/cdn/gantt-QfHFG7O8.js +14 -0
  24. package/dist/cdn/{holidays-Cu6IfbTL.js → holidays-DgmHlqJX.js} +1 -1
  25. package/dist/cdn/{hours-CeiVqPKD.js → hours-CmICISQO.js} +1 -1
  26. package/dist/cdn/inputs-DWLKbi57.js +1 -0
  27. package/dist/cdn/invoice-BUMyjBVi.js +10 -0
  28. package/dist/cdn/kashi-elements.js +1 -1
  29. package/dist/cdn/{legal-id-Mt8FX0fV.js → legal-id-B_0kbcQT.js} +1 -1
  30. package/dist/cdn/lists-D0dao20N.js +1 -0
  31. package/dist/cdn/{map-TfSt3CjL.js → map-BxlzfCbM.js} +1 -1
  32. package/dist/cdn/{media-BRBINvzU.js → media-QVgCYQSu.js} +1 -1
  33. package/dist/cdn/{menu-DTNVFXrb.js → menu-DcFyTTHv.js} +1 -1
  34. package/dist/cdn/{money-CjGI2VIQ.js → money-BFEbgLJn.js} +1 -1
  35. package/dist/cdn/{nav-CT5RVOzy.js → nav-Cm8mAT09.js} +1 -1
  36. package/dist/cdn/{overlay-CS8piW6X.js → overlay-C1nbLv6h.js} +1 -1
  37. package/dist/cdn/pickers-DQgK1WAX.js +1 -0
  38. package/dist/cdn/{relative-OC1fV3Xh.js → relative-BoBZPiB7.js} +1 -1
  39. package/dist/cdn/{rich-text-CS6xEim6.js → rich-text-9IAZ_T8A.js} +1 -1
  40. package/dist/cdn/search-BvShDz2X.js +1 -0
  41. package/dist/cdn/{sheets-CVbD98PY.js → sheets-CNF5lSVn.js} +1 -1
  42. package/dist/cdn/table-D1xiHZCM.js +2 -0
  43. package/dist/cdn/{text-C6fzEBBh.js → text-DFyW6cuq.js} +1 -1
  44. package/dist/cdn/{time-CkqqUKJv.js → time-CYZzyy_3.js} +1 -1
  45. package/dist/cdn/{time-CwOYrtK-.js → time-oyKIQ2bk.js} +1 -1
  46. package/dist/cdn/{validate-Dr2f6i6s.js → validate-CRU7rfNs.js} +1 -1
  47. package/dist/cdn/{work-DoNAKgVU.js → work-DS2MbtGM.js} +1 -1
  48. package/dist/cdn.js +5 -1
  49. package/dist/combobox.js +4 -4
  50. package/dist/commerce.js +2 -2
  51. package/dist/gantt.d.ts +41 -0
  52. package/dist/gantt.js +179 -0
  53. package/dist/index.d.ts +18 -3
  54. package/dist/index.js +8 -3
  55. package/dist/inputs.d.ts +16 -0
  56. package/dist/inputs.js +62 -2
  57. package/dist/invoice.d.ts +52 -0
  58. package/dist/invoice.js +75 -0
  59. package/dist/lists.d.ts +57 -0
  60. package/dist/lists.js +306 -0
  61. package/dist/manifest.json +168 -3
  62. package/dist/pickers.d.ts +4 -0
  63. package/dist/pickers.js +34 -6
  64. package/dist/table.d.ts +15 -1
  65. package/dist/table.js +184 -5
  66. package/package.json +4 -4
  67. package/dist/cdn/base-D4tCOysh.js +0 -1
  68. package/dist/cdn/combobox-BGuPAAt3.js +0 -1
  69. package/dist/cdn/commerce-SzWdpWJG.js +0 -1
  70. package/dist/cdn/forms-DgRiYmdV.js +0 -1
  71. package/dist/cdn/inputs-BkJ70Xkc.js +0 -1
  72. package/dist/cdn/pickers-BwDRsDRo.js +0 -1
  73. package/dist/cdn/table-tgB4iwcM.js +0 -1
@@ -0,0 +1,456 @@
1
+ // امضا و برش تصویر: کادر امضا با ماوس، قلم و لمس، و برش عکس پروفایل با کشیدن، چرخ ماوس، دو انگشت و کیبورد.
2
+ import { bool, define, emit, esc, HTMLBase, msg, num, syncHidden, uid } from "./base.js";
3
+ import { numAttr } from "./parts.js";
4
+ /**
5
+ * کادر امضا: خط‌های نرم با پهنای وابسته به فشار و سرعت، برگرداندن آخرین خط، پاک کردن و حالت «تایپ امضا».
6
+ * ویژگی‌ها: label، hint، error، name (data URL در فرم)، required، disabled، allow-typed (پیش‌فرض true)، pen-width، export-color.
7
+ * رویداد kashi-change با { value } (data URL یا null). متدها: clear()، undo()، toDataURL()، isEmpty().
8
+ */
9
+ export class KashiSignaturePad extends HTMLBase {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.strokes = [];
13
+ this.current = null;
14
+ this.mode = "draw";
15
+ this.typed = "";
16
+ this.key = uid("kashi-sign");
17
+ this.canvas = null;
18
+ this.ro = null;
19
+ this.built = false;
20
+ }
21
+ connectedCallback() {
22
+ if (!this.built)
23
+ this.build();
24
+ }
25
+ disconnectedCallback() {
26
+ this.ro?.disconnect();
27
+ }
28
+ attributeChangedCallback(_n, old, next) {
29
+ if (this.built && old !== next)
30
+ this.build();
31
+ }
32
+ get locked() {
33
+ return this.hasAttribute("disabled") || this.hasAttribute("readonly");
34
+ }
35
+ get penWidth() {
36
+ return numAttr(this, "pen-width", 2.5);
37
+ }
38
+ build() {
39
+ const S = msg().signature;
40
+ const label = this.getAttribute("label");
41
+ const err = this.getAttribute("error");
42
+ const hint = this.getAttribute("hint") ?? (this.locked ? null : S.hint);
43
+ const typed = bool(this, "allow-typed", true) && !this.locked;
44
+ this.innerHTML = `<div class="k-field k-signature"${this.hasAttribute("disabled") ? " data-disabled" : ""}${err ? " data-invalid" : ""}>
45
+ ${label ? `<span class="k-label">${esc(label)}${this.hasAttribute("required") ? '<span class="k-label__required" aria-hidden="true">*</span>' : ""}</span>` : ""}
46
+ ${typed ? `<div class="k-signature__modes" role="radiogroup" aria-label="${esc(label ?? S.label)}">${["draw", "type"].map((m) => `<button type="button" role="radio" class="k-signature__mode" data-mode="${m}" aria-checked="${this.mode === m}">${esc(S[m])}</button>`).join("")}</div>` : ""}
47
+ <div class="k-signature__pad">
48
+ ${this.mode === "draw"
49
+ ? `<canvas class="k-signature__canvas" role="img" aria-describedby="${this.key}-hint"></canvas>`
50
+ : `<label class="k-signature__typed"><span class="k-sr-only">${esc(S.typedLabel)}</span><input class="k-signature__typed-input" placeholder="${esc(S.typedLabel)}" autocomplete="name" value="${esc(this.typed)}"></label>`}
51
+ <span class="k-signature__line" aria-hidden="true">×</span>
52
+ ${this.locked ? "" : `<div class="k-signature__tools">${this.mode === "draw" ? `<button type="button" class="k-signature__tool" data-undo aria-label="${esc(S.undo)}" title="${esc(S.undo)}"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="M7.5 5 4 8.5 7.5 12M4.5 8.5h7a4 4 0 0 1 0 8H9" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>` : ""}<button type="button" class="k-signature__tool" data-clear>${esc(S.clear)}</button></div>`}
53
+ </div>
54
+ ${err ? `<p class="k-hint k-hint--error" role="alert">${esc(err)}</p>` : hint ? `<p class="k-hint" id="${this.key}-hint">${esc(hint)}</p>` : ""}
55
+ <span class="k-sr-only" aria-live="polite"></span>
56
+ </div>`;
57
+ this.built = true;
58
+ const root = this.firstElementChild;
59
+ root.querySelectorAll("[data-mode]").forEach((b) => b.addEventListener("click", () => {
60
+ this.mode = b.dataset.mode;
61
+ this.build();
62
+ this.querySelector(".k-signature__typed-input")?.focus();
63
+ this.commit();
64
+ }));
65
+ root.querySelector("[data-undo]")?.addEventListener("click", () => this.undo());
66
+ root.querySelector("[data-clear]")?.addEventListener("click", () => this.clear());
67
+ const input = root.querySelector(".k-signature__typed-input");
68
+ input?.addEventListener("input", () => { this.typed = input.value; this.commit(); });
69
+ this.canvas = root.querySelector("canvas");
70
+ if (this.canvas)
71
+ this.wireCanvas(this.canvas);
72
+ this.ro?.disconnect();
73
+ if (this.canvas && typeof ResizeObserver !== "undefined") {
74
+ this.ro = new ResizeObserver(() => this.redraw());
75
+ this.ro.observe(this.canvas);
76
+ }
77
+ this.redraw();
78
+ this.paintState();
79
+ }
80
+ wireCanvas(c) {
81
+ const at = (e) => {
82
+ const r = c.getBoundingClientRect();
83
+ return [(e.clientX - r.left) / r.width, (e.clientY - r.top) / r.height, e.pointerType === "pen" && e.pressure > 0 ? e.pressure : 0.5];
84
+ };
85
+ c.addEventListener("pointerdown", (e) => {
86
+ if (this.locked || (e.pointerType === "mouse" && e.button !== 0))
87
+ return;
88
+ c.setPointerCapture(e.pointerId);
89
+ this.current = [at(e)];
90
+ this.redraw();
91
+ });
92
+ c.addEventListener("pointermove", (e) => {
93
+ const s = this.current;
94
+ if (!s)
95
+ return;
96
+ const r = c.getBoundingClientRect();
97
+ const coalesced = e.getCoalescedEvents?.();
98
+ for (const ev of coalesced && coalesced.length ? coalesced : [e]) {
99
+ const p = at(ev);
100
+ const last = s[s.length - 1];
101
+ const d = Math.hypot(p[0] - last[0], p[1] - last[1]) * r.width;
102
+ if (d < 1.2)
103
+ continue;
104
+ if (ev.pointerType !== "pen")
105
+ p[2] = Math.max(0.15, Math.min(0.75, 0.75 - d / 60));
106
+ s.push(p);
107
+ }
108
+ this.redraw();
109
+ });
110
+ const up = () => {
111
+ if (!this.current)
112
+ return;
113
+ this.strokes.push(this.current);
114
+ this.current = null;
115
+ this.commit(this.strokes.length === 1 ? msg().signature.signed : undefined);
116
+ };
117
+ c.addEventListener("pointerup", up);
118
+ c.addEventListener("pointercancel", () => { this.current = null; this.redraw(); });
119
+ }
120
+ paint(ctx, w, h, list, color, scale) {
121
+ ctx.clearRect(0, 0, w, h);
122
+ ctx.strokeStyle = ctx.fillStyle = color;
123
+ ctx.lineCap = ctx.lineJoin = "round";
124
+ const pw = this.penWidth;
125
+ for (const s of list) {
126
+ if (s.length === 1) {
127
+ ctx.beginPath();
128
+ ctx.arc(s[0][0] * w, s[0][1] * h, (pw * scale * (0.6 + s[0][2])) / 2, 0, Math.PI * 2);
129
+ ctx.fill();
130
+ continue;
131
+ }
132
+ for (let i = 1; i < s.length; i++) {
133
+ const p0 = s[i - 1], p1 = s[i];
134
+ const m0 = i > 1 ? [(s[i - 2][0] + p0[0]) / 2, (s[i - 2][1] + p0[1]) / 2] : p0;
135
+ const m1 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
136
+ ctx.lineWidth = pw * scale * (0.6 + (p0[2] + p1[2]) / 2);
137
+ ctx.beginPath();
138
+ ctx.moveTo(m0[0] * w, m0[1] * h);
139
+ ctx.quadraticCurveTo(p0[0] * w, p0[1] * h, m1[0] * w, m1[1] * h);
140
+ if (i === s.length - 1)
141
+ ctx.lineTo(p1[0] * w, p1[1] * h);
142
+ ctx.stroke();
143
+ }
144
+ }
145
+ }
146
+ redraw() {
147
+ const c = this.canvas;
148
+ if (!c)
149
+ return;
150
+ const r = c.getBoundingClientRect();
151
+ const dpr = (typeof devicePixelRatio === "number" && devicePixelRatio) || 1;
152
+ c.width = Math.max(1, Math.round(r.width * dpr));
153
+ c.height = Math.max(1, Math.round(r.height * dpr));
154
+ const ctx = c.getContext("2d");
155
+ if (ctx)
156
+ this.paint(ctx, c.width, c.height, this.current ? [...this.strokes, this.current] : this.strokes, getComputedStyle(c).color, dpr);
157
+ }
158
+ /** آیا امضا خالی است */
159
+ isEmpty() {
160
+ return this.mode === "type" ? !this.typed.trim() : this.strokes.length === 0;
161
+ }
162
+ /** تصویر PNG امضا با پس‌زمینهٔ شفاف و جوهر export-color */
163
+ toDataURL(type = "image/png") {
164
+ if (this.isEmpty())
165
+ return null;
166
+ const c = this.canvas;
167
+ const w = c?.width || 600, h = c?.height || 200;
168
+ const out = document.createElement("canvas");
169
+ out.width = w;
170
+ out.height = h;
171
+ const ctx = out.getContext("2d");
172
+ if (!ctx)
173
+ return null;
174
+ const color = this.getAttribute("export-color") ?? "#0b0c0f";
175
+ if (this.mode === "type") {
176
+ ctx.fillStyle = color;
177
+ ctx.textAlign = "center";
178
+ ctx.textBaseline = "middle";
179
+ ctx.direction = "rtl";
180
+ ctx.font = `700 ${Math.round(h * 0.34)}px ${getComputedStyle(this).getPropertyValue("--k-font-display") || "sans-serif"}`;
181
+ ctx.fillText(this.typed.trim(), w / 2, h / 2, w * 0.9);
182
+ }
183
+ else
184
+ this.paint(ctx, w, h, this.strokes, color, w / (c?.getBoundingClientRect().width || w));
185
+ return out.toDataURL(type);
186
+ }
187
+ undo() {
188
+ this.strokes.pop();
189
+ this.redraw();
190
+ this.commit();
191
+ }
192
+ clear() {
193
+ this.strokes = [];
194
+ this.typed = "";
195
+ const input = this.querySelector(".k-signature__typed-input");
196
+ if (input)
197
+ input.value = "";
198
+ this.redraw();
199
+ this.commit(msg().signature.cleared);
200
+ }
201
+ paintState() {
202
+ const root = this.firstElementChild;
203
+ if (!root)
204
+ return;
205
+ const empty = this.isEmpty();
206
+ root.toggleAttribute("data-empty", empty);
207
+ const S = msg().signature;
208
+ this.canvas?.setAttribute("aria-label", `${S.area}${empty ? `${msg().common.comma}${S.empty}` : ""}`);
209
+ const undo = root.querySelector("[data-undo]");
210
+ if (undo)
211
+ undo.disabled = this.strokes.length === 0;
212
+ const clear = root.querySelector("[data-clear]");
213
+ if (clear)
214
+ clear.disabled = empty;
215
+ }
216
+ commit(announce) {
217
+ const url = this.toDataURL();
218
+ this.paintState();
219
+ syncHidden(this, this.getAttribute("name"), url ?? "");
220
+ if (announce)
221
+ this.querySelector(".k-signature [aria-live]").textContent = announce;
222
+ emit(this, "kashi-change", { value: url });
223
+ }
224
+ }
225
+ KashiSignaturePad.observedAttributes = ["label", "hint", "error", "disabled", "readonly", "allow-typed"];
226
+ /**
227
+ * برش تصویر: تصویر زیر کادر ثابت جابه‌جا و بزرگ می‌شود و همیشه کادر را پر نگه می‌دارد.
228
+ * ویژگی‌ها: src، alt، aspect (مثل 1 یا 16/9)، shape="circle"، max-zoom، rotatable (پیش‌فرض true)، label.
229
+ * رویداد kashi-change با { area, zoom, rotation } (ناحیه به پیکسل تصویر). متد crop({ width, type }) ← Promise<Blob>.
230
+ */
231
+ export class KashiImageCropper extends HTMLBase {
232
+ constructor() {
233
+ super(...arguments);
234
+ this.s = { x: 0, y: 0, zoom: 1, rotation: 0 };
235
+ this.nat = null;
236
+ this.stage = null;
237
+ this.img = null;
238
+ this.ro = null;
239
+ this.pointers = new Map();
240
+ this.drag = null;
241
+ this.pinch = null;
242
+ }
243
+ connectedCallback() {
244
+ if (!this.stage)
245
+ this.build();
246
+ }
247
+ disconnectedCallback() {
248
+ this.ro?.disconnect();
249
+ }
250
+ attributeChangedCallback(n, old, next) {
251
+ if (!this.stage || old === next)
252
+ return;
253
+ if (n === "src") {
254
+ this.nat = null;
255
+ this.s = { x: 0, y: 0, zoom: 1, rotation: 0 };
256
+ this.img.src = next ?? "";
257
+ }
258
+ else if (n === "shape" || n === "aspect") {
259
+ this.querySelector(".k-cropper").setAttribute("data-shape", this.getAttribute("shape") ?? "rect");
260
+ this.layout();
261
+ }
262
+ else
263
+ this.build();
264
+ }
265
+ get aspect() {
266
+ const a = this.getAttribute("aspect");
267
+ if (!a)
268
+ return 1;
269
+ const [p, q] = a.split("/").map(Number);
270
+ return q ? p / q : p || 1;
271
+ }
272
+ get maxZoom() {
273
+ return numAttr(this, "max-zoom", 4);
274
+ }
275
+ build() {
276
+ const C = msg().cropper;
277
+ const label = this.getAttribute("label");
278
+ const btn = (attr, aria, path) => `<button type="button" class="k-cropper__btn" ${attr} aria-label="${esc(aria)}"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="${path}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>`;
279
+ this.innerHTML = `<div class="k-cropper" data-shape="${esc(this.getAttribute("shape") ?? "rect")}">
280
+ ${label ? `<span class="k-label">${esc(label)}</span>` : ""}
281
+ <div class="k-cropper__stage" dir="ltr" tabindex="0" role="application" aria-roledescription="${esc(C.label)}" aria-label="${esc(C.area)}">
282
+ <img class="k-cropper__img" alt="${esc(this.getAttribute("alt") ?? "")}" draggable="false" style="opacity:0">
283
+ <div class="k-cropper__frame" aria-hidden="true"><span class="k-cropper__grid"></span></div>
284
+ </div>
285
+ <div class="k-cropper__controls">
286
+ ${btn('data-zoom="out"', `${C.zoom} −`, "M5 10h10")}
287
+ <input type="range" class="k-slider k-cropper__zoom" min="1" max="${this.maxZoom}" step="0.01" value="1" aria-label="${esc(C.zoom)}">
288
+ ${btn('data-zoom="in"', `${C.zoom} +`, "M5 10h10M10 5v10")}
289
+ ${bool(this, "rotatable", true) ? btn("data-rotate", C.rotate, "M15.5 9A5.5 5.5 0 1 0 14 13.3M15.5 4.5V9H11") : ""}
290
+ </div>
291
+ <span class="k-sr-only" aria-live="polite"></span>
292
+ </div>`;
293
+ this.stage = this.querySelector(".k-cropper__stage");
294
+ this.img = this.querySelector(".k-cropper__img");
295
+ this.img.addEventListener("load", () => { this.nat = { w: this.img.naturalWidth, h: this.img.naturalHeight }; this.move(this.s); });
296
+ this.img.src = this.getAttribute("src") ?? "";
297
+ const st = this.stage;
298
+ st.addEventListener("pointerdown", (e) => {
299
+ st.setPointerCapture(e.pointerId);
300
+ this.pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
301
+ if (this.pointers.size === 2) {
302
+ const [a, b] = [...this.pointers.values()];
303
+ this.pinch = { d: Math.hypot(a.x - b.x, a.y - b.y), zoom: this.s.zoom };
304
+ this.drag = null;
305
+ }
306
+ else
307
+ this.drag = { id: e.pointerId, x: e.clientX, y: e.clientY, sx: this.s.x, sy: this.s.y };
308
+ });
309
+ st.addEventListener("pointermove", (e) => {
310
+ if (!this.pointers.has(e.pointerId))
311
+ return;
312
+ this.pointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
313
+ const g = this.geom();
314
+ if (this.pinch && this.pointers.size === 2) {
315
+ const [a, b] = [...this.pointers.values()];
316
+ this.move({ ...this.s, zoom: (this.pinch.zoom * Math.hypot(a.x - b.x, a.y - b.y)) / this.pinch.d });
317
+ }
318
+ else if (this.drag?.id === e.pointerId) {
319
+ this.move({ ...this.s, x: this.drag.sx + (e.clientX - this.drag.x) / g.fw, y: this.drag.sy + (e.clientY - this.drag.y) / g.fh });
320
+ }
321
+ });
322
+ const end = (e) => {
323
+ this.pointers.delete(e.pointerId);
324
+ if (this.pointers.size < 2)
325
+ this.pinch = null;
326
+ if (this.drag?.id === e.pointerId)
327
+ this.drag = null;
328
+ };
329
+ st.addEventListener("pointerup", end);
330
+ st.addEventListener("pointercancel", end);
331
+ st.addEventListener("wheel", (e) => {
332
+ if (!e.ctrlKey && Math.abs(e.deltaY) < 1)
333
+ return;
334
+ e.preventDefault();
335
+ this.move({ ...this.s, zoom: this.s.zoom * Math.exp(-e.deltaY / 400) });
336
+ }, { passive: false });
337
+ st.addEventListener("keydown", (e) => {
338
+ const step = e.shiftKey ? 0.1 : 0.02;
339
+ const moves = { ArrowLeft: [step, 0], ArrowRight: [-step, 0], ArrowUp: [0, step], ArrowDown: [0, -step] };
340
+ if (moves[e.key]) {
341
+ e.preventDefault();
342
+ this.move({ ...this.s, x: this.s.x + moves[e.key][0], y: this.s.y + moves[e.key][1] });
343
+ this.say(C.moved(num(this, Math.round((0.5 - this.s.x) * 100)), num(this, Math.round((0.5 - this.s.y) * 100))));
344
+ }
345
+ else if (e.key === "+" || e.key === "=") {
346
+ e.preventDefault();
347
+ this.zoomBy(1.1);
348
+ }
349
+ else if (e.key === "-" || e.key === "_") {
350
+ e.preventDefault();
351
+ this.zoomBy(1 / 1.1);
352
+ }
353
+ else if (e.key === "0") {
354
+ e.preventDefault();
355
+ this.move({ x: 0, y: 0, zoom: 1, rotation: 0 });
356
+ this.say(C.reset);
357
+ }
358
+ });
359
+ const range = this.querySelector(".k-cropper__zoom");
360
+ range.addEventListener("input", () => this.move({ ...this.s, zoom: Number(range.value) }));
361
+ this.querySelector('[data-zoom="in"]').addEventListener("click", () => this.zoomBy(1.2));
362
+ this.querySelector('[data-zoom="out"]').addEventListener("click", () => this.zoomBy(1 / 1.2));
363
+ this.querySelector("[data-rotate]")?.addEventListener("click", () => this.move({ ...this.s, x: 0, y: 0, rotation: (this.s.rotation + 90) % 360 }));
364
+ this.ro?.disconnect();
365
+ if (typeof ResizeObserver !== "undefined") {
366
+ this.ro = new ResizeObserver(() => this.move(this.s, false));
367
+ this.ro.observe(st);
368
+ }
369
+ this.layout();
370
+ }
371
+ say(text) {
372
+ this.querySelector(".k-cropper [aria-live]").textContent = text;
373
+ }
374
+ zoomBy(f) {
375
+ this.move({ ...this.s, zoom: this.s.zoom * f });
376
+ this.say(msg().cropper.zoomed(num(this, Math.round(this.s.zoom * 100))));
377
+ }
378
+ geom() {
379
+ const st = this.stage;
380
+ const W = st.clientWidth, H = st.clientHeight, pad = 16, a = this.aspect;
381
+ const fw = Math.max(1, Math.min(W - pad * 2, (H - pad * 2) * a));
382
+ const fh = fw / a;
383
+ const side = this.s.rotation % 180 !== 0;
384
+ const iw = this.nat ? (side ? this.nat.h : this.nat.w) : 1;
385
+ const ih = this.nat ? (side ? this.nat.w : this.nat.h) : 1;
386
+ return { W, H, fw, fh, iw, ih, side, base: Math.max(fw / iw, fh / ih) };
387
+ }
388
+ /** ناحیهٔ برش فعلی به پیکسل تصویر (بعد از چرخش) */
389
+ get area() {
390
+ const g = this.geom();
391
+ const sc = g.base * this.s.zoom;
392
+ return { x: Math.max(0, (g.iw * sc) / 2 - this.s.x * g.fw - g.fw / 2) / sc, y: Math.max(0, (g.ih * sc) / 2 - this.s.y * g.fh - g.fh / 2) / sc, width: g.fw / sc, height: g.fh / sc };
393
+ }
394
+ move(next, fire = true) {
395
+ const zoom = Math.min(this.maxZoom, Math.max(1, next.zoom));
396
+ this.s = { ...next, zoom };
397
+ const g = this.geom();
398
+ const sc = g.base * zoom;
399
+ const mx = Math.max(0, (g.iw * sc - g.fw) / 2) / g.fw, my = Math.max(0, (g.ih * sc - g.fh) / 2) / g.fh;
400
+ this.s.x = Math.min(mx, Math.max(-mx, this.s.x));
401
+ this.s.y = Math.min(my, Math.max(-my, this.s.y));
402
+ this.layout();
403
+ if (fire && this.nat)
404
+ emit(this, "kashi-change", { area: this.area, zoom: this.s.zoom, rotation: this.s.rotation });
405
+ }
406
+ layout() {
407
+ if (!this.stage || !this.img)
408
+ return;
409
+ const g = this.geom();
410
+ const frame = this.querySelector(".k-cropper__frame");
411
+ frame.style.inlineSize = `${g.fw}px`;
412
+ frame.style.blockSize = `${g.fh}px`;
413
+ const range = this.querySelector(".k-cropper__zoom");
414
+ range.value = String(this.s.zoom);
415
+ range.setAttribute("aria-valuetext", msg().common.percent(num(this, Math.round(this.s.zoom * 100))));
416
+ this.querySelector('[data-zoom="out"]').disabled = this.s.zoom <= 1;
417
+ this.querySelector('[data-zoom="in"]').disabled = this.s.zoom >= this.maxZoom;
418
+ if (!this.nat)
419
+ return;
420
+ const sc = g.base * this.s.zoom;
421
+ const w = (g.side ? g.ih : g.iw) * sc, h = (g.side ? g.iw : g.ih) * sc;
422
+ const tx = g.W / 2 + this.s.x * g.fw - (g.iw * sc) / 2 + (g.side ? (g.iw * sc - g.ih * sc) / 2 : 0);
423
+ const ty = g.H / 2 + this.s.y * g.fh - (g.ih * sc) / 2 + (g.side ? (g.ih * sc - g.iw * sc) / 2 : 0);
424
+ Object.assign(this.img.style, { opacity: "1", inlineSize: `${w}px`, blockSize: `${h}px`, transform: `translate(${tx}px, ${ty}px) rotate(${this.s.rotation}deg)` });
425
+ }
426
+ /** تصویر بریده‌شده (پیش‌فرض WebP) */
427
+ async crop({ width, type = "image/webp", quality = 0.92 } = {}) {
428
+ const img = new Image();
429
+ img.crossOrigin = "anonymous";
430
+ img.src = this.getAttribute("src") ?? "";
431
+ await img.decode();
432
+ const a = this.area, rot = this.s.rotation, side = rot % 180 !== 0;
433
+ const rw = side ? img.naturalHeight : img.naturalWidth, rh = side ? img.naturalWidth : img.naturalHeight;
434
+ const outW = Math.round(width ?? a.width), outH = Math.round((outW * a.height) / a.width);
435
+ const c = document.createElement("canvas");
436
+ c.width = outW;
437
+ c.height = outH;
438
+ const ctx = c.getContext("2d");
439
+ if (!ctx)
440
+ return null;
441
+ if (this.getAttribute("shape") === "circle") {
442
+ ctx.beginPath();
443
+ ctx.ellipse(outW / 2, outH / 2, outW / 2, outH / 2, 0, 0, Math.PI * 2);
444
+ ctx.clip();
445
+ }
446
+ const k = outW / a.width;
447
+ ctx.scale(k, k);
448
+ ctx.translate(-a.x + rw / 2, -a.y + rh / 2);
449
+ ctx.rotate((rot * Math.PI) / 180);
450
+ ctx.drawImage(img, -img.naturalWidth / 2, -img.naturalHeight / 2);
451
+ return new Promise((done) => c.toBlob((b) => done(b), type, quality));
452
+ }
453
+ }
454
+ KashiImageCropper.observedAttributes = ["src", "alt", "aspect", "shape", "max-zoom", "rotatable", "label"];
455
+ define("kashi-signature-pad", KashiSignaturePad, "block");
456
+ define("kashi-image-cropper", KashiImageCropper, "block");
@@ -1 +1 @@
1
- import{A as e,C as t,P as n,a as r,c as i,d as a,k as o,l as s,o as c,p as l,s as u,t as d,w as f,y as p}from"./base-D4tCOysh.js";import{n as m,t as h}from"./time-CwOYrtK-.js";import{t as g}from"./holidays-Cu6IfbTL.js";const _=[[`morning`,12],[`afternoon`,17],[`evening`,24]],v=(e,t=0)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),y=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),b=e=>{let t=m(e);return t?t.hours*60+t.minutes:0};var x=class extends d{constructor(){super(...arguments),this.selected=null,this.active=-1,this.valueSet=!1,this.rendered=!1,this.key=p(`kashi-appt`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.selected=this.parse(this.getAttribute(`value`))),this.render(),clearInterval(this.timer),this.timer=setInterval(()=>!this.contains(document.activeElement)&&this.render(),6e4)}disconnectedCallback(){clearInterval(this.timer)}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`&&(this.selected=this.parse(n)),this.render())}parse(e){let t=(e??``).trim().match(/^(\d{4}-\d{2}-\d{2})[ T](\d{1,2}:\d{2})$/),n=t?f(t[1]):null;return n&&t?{date:n,time:h(m(t[2]))}:null}get value(){return this.selected?{...this.selected}:null}set value(e){this.valueSet=!0,this.selected=e?{date:v(e.date),time:e.time}:null,this.rendered&&this.render()}list(){let e=/* @__PURE__ */ new Date,t=f(this.getAttribute(`start`)??``)??e,n=Math.max(1,Number(this.getAttribute(`days`))||7),r={};try{r=JSON.parse(this.getAttribute(`booked`)??`{}`)}catch{}let i=this.getAttribute(`from`)??`09:00`,s=this.getAttribute(`to`)??`17:00`,c=Number(this.getAttribute(`step`))||30,l=this.getAttribute(`closed`)!==`false`;return Array.from({length:n},(n,u)=>{let d=v(t,u),f=this.isClosed?this.isClosed(d):l&&!!g(d,{locale:a()}),p=[];if(!f){if(this.getSlots)p=this.getSlots(d).map(e=>typeof e==`string`?{time:e,available:!0}:{time:e.time,available:e.available??!0});else{let e=new Set(r[o(d)]??[]);for(let t=b(i);t+c<=b(s);t+=c){let n=h({hours:Math.floor(t/60),minutes:t%60});p.push({time:n,available:!e.has(n)})}}if(y(d,e)){let t=e.getHours()*60+e.getMinutes();p=p.map(e=>b(e.time)<=t?{...e,available:!1}:e)}}return{date:d,closed:f,slots:p,free:p.filter(e=>e.available).length}})}render(c=null){let d=/* @__PURE__ */ new Date,f=u(this)===`fa`,p=e=>f?n(String(e)):String(e),m=f?`fa`:`latin`,h=this.list();if(this.active<0||this.active>=h.length){let e=this.selected?h.findIndex(e=>y(e.date,this.selected.date)):-1;this.active=e>=0?e:Math.max(0,h.findIndex(e=>e.free>0))}let g=h[this.active],x=l(),S=x.appointment,{months:C,weekdays:w}=r(),T=a(),E=this.getAttribute(`label`)??S.label,D=e=>y(e,d)?x.common.today:y(e,v(d,1))?x.common.tomorrow:w[(e.getDay()+1)%7],O=h.map((n,r)=>{let{jm:i,jd:a}=e(n.date),o=n.closed?S.closed:n.free?S.freeLong(p(n.free)):S.none;return`<button type="button" role="radio" data-i="${r}" class="k-appt__day" aria-checked="${r===this.active}" tabindex="${r===this.active?0:-1}"${n.closed?` disabled`:``} aria-label="${s(`${t(n.date,{style:`full`,digits:m,locale:T})}${x.common.list}${o}`)}"><span class="k-appt__weekday" aria-hidden="true">${D(n.date)}</span><span class="k-appt__date" aria-hidden="true">${p(a)}</span><span class="k-appt__month" aria-hidden="true">${C[i-1]}</span><span class="k-appt__free" aria-hidden="true">${n.closed?S.closed:n.free?S.free(p(n.free)):S.full}</span></button>`}).join(``),k=!!this.selected&&y(this.selected.date,g.date),A=k?this.selected.time:g.slots.find(e=>e.available)?.time,j=g.closed||!g.free?`<p class="k-appt__empty">${g.closed?S.closedDay:S.noSlots}</p>`:_.map(([e,t],n)=>{let r=g.slots.filter(e=>b(e.time)/60<t&&b(e.time)/60>=(n?_[n-1][1]:0));if(!r.length)return``;let i=`${this.key}-p${n}`;return`<div class="k-appt__group"><p class="k-appt__period" id="${i}">${S[e]}</p><div class="k-appt__times" role="radiogroup" aria-labelledby="${i}">${r.map(e=>`<button type="button" role="radio" class="k-appt__time" data-time="${e.time}" aria-checked="${k&&this.selected.time===e.time}" tabindex="${e.time===A?0:-1}"${e.available?``:` disabled`} aria-label="${s(S.time(p(e.time)))}${e.available?``:s(S.booked)}">${p(e.time)}</button>`).join(``)}</div></div>`}).join(``),M=this.getAttribute(`name`),N=this.selected;this.innerHTML=`<div class="k-appt" role="group" aria-labelledby="${this.key}-label"><p class="k-label" id="${this.key}-label" style="margin: 0">${s(E)}</p><div class="k-appt__days" role="radiogroup" aria-label="${s(S.day)}">${O}</div><div class="k-appt__slots">${j}</div><p class="k-appt__summary" aria-live="polite">${N?`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10" cy="10" r="7"/><path d="M10 6v4l2.5 2"/></svg><span>${s(S.yours)} <strong>${s(S.at(t(N.date,{style:`full`,digits:m,locale:T}),p(N.time)))}</strong></span>`:``}</p>${M?`<input type="hidden" name="${s(`${M}_date`)}" value="${N?o(N.date):``}"><input type="hidden" name="${s(`${M}_time`)}" value="${N?.time??``}">`:``}</div>`,this.rendered=!0;let P=this.querySelector(`.k-appt__days`),F=this.querySelector(`.k-appt__slots`);P.addEventListener(`click`,e=>{let t=e.target.closest(`.k-appt__day`);t&&!t.disabled&&(this.active=Number(t.dataset.i),this.render(`day`))}),F.addEventListener(`click`,e=>{let t=e.target.closest(`.k-appt__time`);t&&!t.disabled&&(this.selected={date:g.date,time:t.dataset.time},this.render(`time`),i(this,`kashi-change`,{date:o(g.date),time:this.selected.time,value:this.value}))}),P.addEventListener(`keydown`,e=>this.roving(e,P,e=>{this.active=Number(e.dataset.i),this.render(`day`)})),F.addEventListener(`keydown`,e=>this.roving(e,F)),c===`day`&&P.querySelector(`[tabindex="0"]`)?.focus(),c===`time`&&F.querySelector(`[aria-checked="true"]`)?.focus(),c===`day`&&P.querySelector(`[tabindex="0"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})}roving(e,t,n){let r=[...t.querySelectorAll(`[role="radio"]:not(:disabled)`)],i=r.indexOf(document.activeElement);if(i<0)return;let a=getComputedStyle(t).direction===`rtl`,o={ArrowLeft:a?1:-1,ArrowRight:a?-1:1,ArrowDown:1,ArrowUp:-1}[e.key],s=o?(i+o+r.length)%r.length:e.key===`Home`?0:e.key===`End`?r.length-1:-1;s<0||(e.preventDefault(),n?n(r[s]):r[s].focus())}};x.observedAttributes=[`start`,`days`,`from`,`to`,`step`,`booked`,`closed`,`label`,`name`,`digits`,`value`],c(`kashi-appointment-picker`,x,`block`);export{x as KashiAppointmentPicker};
1
+ import{A as e,C as t,P as n,a as r,c as i,d as a,k as o,l as s,o as c,p as l,s as u,t as d,w as f,y as p}from"./base-BqFAMlwG.js";import{n as m,t as h}from"./time-oyKIQ2bk.js";import{t as g}from"./holidays-DgmHlqJX.js";const _=[[`morning`,12],[`afternoon`,17],[`evening`,24]],v=(e,t=0)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),y=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),b=e=>{let t=m(e);return t?t.hours*60+t.minutes:0};var x=class extends d{constructor(){super(...arguments),this.selected=null,this.active=-1,this.valueSet=!1,this.rendered=!1,this.key=p(`kashi-appt`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.selected=this.parse(this.getAttribute(`value`))),this.render(),clearInterval(this.timer),this.timer=setInterval(()=>!this.contains(document.activeElement)&&this.render(),6e4)}disconnectedCallback(){clearInterval(this.timer)}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`&&(this.selected=this.parse(n)),this.render())}parse(e){let t=(e??``).trim().match(/^(\d{4}-\d{2}-\d{2})[ T](\d{1,2}:\d{2})$/),n=t?f(t[1]):null;return n&&t?{date:n,time:h(m(t[2]))}:null}get value(){return this.selected?{...this.selected}:null}set value(e){this.valueSet=!0,this.selected=e?{date:v(e.date),time:e.time}:null,this.rendered&&this.render()}list(){let e=/* @__PURE__ */ new Date,t=f(this.getAttribute(`start`)??``)??e,n=Math.max(1,Number(this.getAttribute(`days`))||7),r={};try{r=JSON.parse(this.getAttribute(`booked`)??`{}`)}catch{}let i=this.getAttribute(`from`)??`09:00`,s=this.getAttribute(`to`)??`17:00`,c=Number(this.getAttribute(`step`))||30,l=this.getAttribute(`closed`)!==`false`;return Array.from({length:n},(n,u)=>{let d=v(t,u),f=this.isClosed?this.isClosed(d):l&&!!g(d,{locale:a()}),p=[];if(!f){if(this.getSlots)p=this.getSlots(d).map(e=>typeof e==`string`?{time:e,available:!0}:{time:e.time,available:e.available??!0});else{let e=new Set(r[o(d)]??[]);for(let t=b(i);t+c<=b(s);t+=c){let n=h({hours:Math.floor(t/60),minutes:t%60});p.push({time:n,available:!e.has(n)})}}if(y(d,e)){let t=e.getHours()*60+e.getMinutes();p=p.map(e=>b(e.time)<=t?{...e,available:!1}:e)}}return{date:d,closed:f,slots:p,free:p.filter(e=>e.available).length}})}render(c=null){let d=/* @__PURE__ */ new Date,f=u(this)===`fa`,p=e=>f?n(String(e)):String(e),m=f?`fa`:`latin`,h=this.list();if(this.active<0||this.active>=h.length){let e=this.selected?h.findIndex(e=>y(e.date,this.selected.date)):-1;this.active=e>=0?e:Math.max(0,h.findIndex(e=>e.free>0))}let g=h[this.active],x=l(),S=x.appointment,{months:C,weekdays:w}=r(),T=a(),E=this.getAttribute(`label`)??S.label,D=e=>y(e,d)?x.common.today:y(e,v(d,1))?x.common.tomorrow:w[(e.getDay()+1)%7],O=h.map((n,r)=>{let{jm:i,jd:a}=e(n.date),o=n.closed?S.closed:n.free?S.freeLong(p(n.free)):S.none;return`<button type="button" role="radio" data-i="${r}" class="k-appt__day" aria-checked="${r===this.active}" tabindex="${r===this.active?0:-1}"${n.closed?` disabled`:``} aria-label="${s(`${t(n.date,{style:`full`,digits:m,locale:T})}${x.common.list}${o}`)}"><span class="k-appt__weekday" aria-hidden="true">${D(n.date)}</span><span class="k-appt__date" aria-hidden="true">${p(a)}</span><span class="k-appt__month" aria-hidden="true">${C[i-1]}</span><span class="k-appt__free" aria-hidden="true">${n.closed?S.closed:n.free?S.free(p(n.free)):S.full}</span></button>`}).join(``),k=!!this.selected&&y(this.selected.date,g.date),A=k?this.selected.time:g.slots.find(e=>e.available)?.time,j=g.closed||!g.free?`<p class="k-appt__empty">${g.closed?S.closedDay:S.noSlots}</p>`:_.map(([e,t],n)=>{let r=g.slots.filter(e=>b(e.time)/60<t&&b(e.time)/60>=(n?_[n-1][1]:0));if(!r.length)return``;let i=`${this.key}-p${n}`;return`<div class="k-appt__group"><p class="k-appt__period" id="${i}">${S[e]}</p><div class="k-appt__times" role="radiogroup" aria-labelledby="${i}">${r.map(e=>`<button type="button" role="radio" class="k-appt__time" data-time="${e.time}" aria-checked="${k&&this.selected.time===e.time}" tabindex="${e.time===A?0:-1}"${e.available?``:` disabled`} aria-label="${s(S.time(p(e.time)))}${e.available?``:s(S.booked)}">${p(e.time)}</button>`).join(``)}</div></div>`}).join(``),M=this.getAttribute(`name`),N=this.selected;this.innerHTML=`<div class="k-appt" role="group" aria-labelledby="${this.key}-label"><p class="k-label" id="${this.key}-label" style="margin: 0">${s(E)}</p><div class="k-appt__days" role="radiogroup" aria-label="${s(S.day)}">${O}</div><div class="k-appt__slots">${j}</div><p class="k-appt__summary" aria-live="polite">${N?`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10" cy="10" r="7"/><path d="M10 6v4l2.5 2"/></svg><span>${s(S.yours)} <strong>${s(S.at(t(N.date,{style:`full`,digits:m,locale:T}),p(N.time)))}</strong></span>`:``}</p>${M?`<input type="hidden" name="${s(`${M}_date`)}" value="${N?o(N.date):``}"><input type="hidden" name="${s(`${M}_time`)}" value="${N?.time??``}">`:``}</div>`,this.rendered=!0;let P=this.querySelector(`.k-appt__days`),F=this.querySelector(`.k-appt__slots`);P.addEventListener(`click`,e=>{let t=e.target.closest(`.k-appt__day`);t&&!t.disabled&&(this.active=Number(t.dataset.i),this.render(`day`))}),F.addEventListener(`click`,e=>{let t=e.target.closest(`.k-appt__time`);t&&!t.disabled&&(this.selected={date:g.date,time:t.dataset.time},this.render(`time`),i(this,`kashi-change`,{date:o(g.date),time:this.selected.time,value:this.value}))}),P.addEventListener(`keydown`,e=>this.roving(e,P,e=>{this.active=Number(e.dataset.i),this.render(`day`)})),F.addEventListener(`keydown`,e=>this.roving(e,F)),c===`day`&&P.querySelector(`[tabindex="0"]`)?.focus(),c===`time`&&F.querySelector(`[aria-checked="true"]`)?.focus(),c===`day`&&P.querySelector(`[tabindex="0"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})}roving(e,t,n){let r=[...t.querySelectorAll(`[role="radio"]:not(:disabled)`)],i=r.indexOf(document.activeElement);if(i<0)return;let a=getComputedStyle(t).direction===`rtl`,o={ArrowLeft:a?1:-1,ArrowRight:a?-1:1,ArrowDown:1,ArrowUp:-1}[e.key],s=o?(i+o+r.length)%r.length:e.key===`Home`?0:e.key===`End`?r.length-1:-1;s<0||(e.preventDefault(),n?n(r[s]):r[s].focus())}};x.observedAttributes=[`start`,`days`,`from`,`to`,`step`,`booked`,`closed`,`label`,`name`,`digits`,`value`],c(`kashi-appointment-picker`,x,`block`);export{x as KashiAppointmentPicker};
@@ -0,0 +1 @@
1
+ const e=`۰۱۲۳۴۵۶۷۸۹`;function t(t){return String(t).replace(/\d/g,t=>e[Number(t)])}function n(t){return t.replace(/[۰-۹٠-٩]/g,t=>{let n=e.indexOf(t);return String(n>=0?n:`٠١٢٣٤٥٦٧٨٩`.indexOf(t))})}function r(e){return n(e).replace(/\D/g,``)}function i(e,{digits:n=`fa`}={}){let i=typeof e==`number`?e:Number(r(e));if(!Number.isFinite(i))return``;let a=new Intl.NumberFormat(`en-US`).format(i);return n===`fa`?t(a).replace(/,/g,`٬`):a}const a=[`فروردین`,`اردیبهشت`,`خرداد`,`تیر`,`مرداد`,`شهریور`,`مهر`,`آبان`,`آذر`,`دی`,`بهمن`,`اسفند`],o=[`شنبه`,`یکشنبه`,`دوشنبه`,`سه‌شنبه`,`چهارشنبه`,`پنجشنبه`,`جمعه`],s=[`ش`,`ی`,`د`,`س`,`چ`,`پ`,`ج`],c=[`Farvardin`,`Ordibehesht`,`Khordad`,`Tir`,`Mordad`,`Shahrivar`,`Mehr`,`Aban`,`Azar`,`Dey`,`Bahman`,`Esfand`],l=[`Saturday`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`],u=[`Sa`,`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`],d=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],f=(e,t)=>~~(e/t),p=(e,t)=>e-~~(e/t)*t;function m(e){let t=e+621,n=-14,r=d[0],i=0;if(e<r||e>=d[d.length-1])throw RangeError(`سال شمسی خارج از محدوده: ${e}`);for(let t=1;t<d.length;t++){let a=d[t];if(i=a-r,e<a)break;n+=f(i,33)*8+f(p(i,33),4),r=a}let a=e-r;n+=f(a,33)*8+f(p(a,33)+3,4),p(i,33)===4&&i-a===4&&(n+=1);let o=f(t,4)-f((f(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+f(i+4,33)*33);let c=p(p(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function h(e,t,n){let r=f((e+f(t-8,6)+100100)*1461,4)+f(153*p(t+9,12)+2,5)+n-34840408;return r=r-f(f(e+100100+f(t-8,6),100)*3,4)+752,r}function g(e){let t=4*e+0x84e7d5f;t=t+f(f(4*e+0xaeb3908,146097)*3,4)*4-3908;let n=f(p(t,1461),4)*5+308,r=f(p(n,153),5)+1,i=p(f(n,153),12)+1;return{gy:f(t,1461)-100100+f(8-i,6),gm:i,gd:r}}function _(e,t,n){let r=m(e);return h(r.gy,3,r.march)+(t-1)*31-f(t,7)*(t-7)+n-1}function v(e){let{gy:t}=g(e),n=t-621,r=m(n),i=e-h(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+f(i,31),jd:p(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+f(i,30),jd:p(i,30)+1}}function ee(e){return m(e).leap===0}function y(e,t){return t<=6?31:t<=11||ee(e)?30:29}function b(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)&&Number.isInteger(n)&&e>=-61&&e<=3177&&t>=1&&t<=12&&n>=1&&n<=y(e,t)}function x(e){return v(h(e.getFullYear(),e.getMonth()+1,e.getDate()))}function S(e,t,n){let{gy:r,gm:i,gd:a}=g(_(e,t,n));return new Date(r,i-1,a)}function C(e){return(e.getDay()+1)%7}function w(e,{style:n=`numeric`,locale:r=`fa`,digits:i=r===`en`?`latin`:`fa`}={}){let{jy:s,jm:u,jd:d}=x(e),f=e=>String(e).padStart(2,`0`),p=r===`en`,m;return n===`numeric`?m=`${s}/${f(u)}/${f(d)}`:(m=`${d} ${(p?c:a)[u-1]} ${s}`,n===`full`&&(m=p?`${l[C(e)]}, ${m}`:`${o[C(e)]} ${m}`)),i===`fa`?t(m):m}function T(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function E(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return null;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return n.getMonth()===Number(t[2])-1?n:null}function D(e){let t=n(e.trim()).match(/^(\d{4})\s*[/\-.\s]\s*(\d{1,2})\s*[/\-.\s]\s*(\d{1,2})$/);if(!t)return null;let[r,i,a]=[Number(t[1]),Number(t[2]),Number(t[3])];return b(r,i,a)?S(r,i,a):null}const O={common:{close:`بستن`,loading:`در حال بارگذاری`,optional:`اختیاری`,remove:e=>`حذف ${e}`,removeShort:`حذف`,clear:`پاک کردن`,clearAll:`پاک کردن همه`,cancel:`انصراف`,confirm:`تأیید`,save:`ثبت`,edit:`ویرایش`,prev:`قبلی`,next:`بعدی`,today:`امروز`,tomorrow:`فردا`,noResults:`نتیجه‌ای پیدا نشد.`,noOptions:`گزینه‌ای برای انتخاب نیست.`,noData:`داده‌ای برای نمایش نیست.`,searching:`در حال جستجو…`,results:e=>`${e} نتیجه`,added:e=>`${e} اضافه شد`,removed:e=>`${e} حذف شد`,selected:e=>`${e} انتخاب شد`,max:e=>`حداکثر ${e} مورد`,total:`جمع`,other:`سایر`,of:(e,t)=>`${e} از ${t}`,and:` و `,list:`، `,range:` تا `,percent:e=>`${e}٪`,comma:`، `,decimal:`٫`},money:{toman:`تومان`,rial:`ریال`,positive:`مثبت `},alert:{close:`بستن`},banner:{label:`اطلاعیه`,close:`بستن اطلاعیه`},avatar:{online:`آنلاین`,offline:`آفلاین`,busy:`مشغول`,away:`غایب`,more:e=>`${e} نفر دیگر`},bankCard:{card:`کارت بانکی`,cardOf:e=>`کارت ${e}`,bank:`بانکی`,endingIn:e=>`مختوم به ${e}`,expiry:`انقضا`},breadcrumb:{label:`مسیر`,expand:`نمایش مسیر کامل`},calendar:{label:`تقویم`,prevMonth:`ماه قبل`,nextMonth:`ماه بعد`,month:`ماه`,year:`سال`,holiday:`تعطیل`},carousel:{slider:`اسلایدر`,slide:`اسلاید`,slideOf:(e,t)=>`${e} از ${t}`,slides:e=>`اسلایدهای ${e}`,play:`پخش خودکار اسلایدها`,pause:`توقف پخش خودکار`,expand:`نمایش بزرگ`,lightbox:e=>`${e}، نمای بزرگ`,thumbnails:e=>`تصویرهای کوچک ${e}`},chart:{period:`دوره`,value:`مقدار`,share:`سهم از کل`,count:`تعداد`,keyboard:e=>`${e}. با کلیدهای جهت بین نقطه‌ها حرکت کنید.`,thousand:` هزار`,million:` م`,billion:` میلیارد`},city:{label:`شهر`,outside:`خارج از فهرست`,custom:`شهر دیگر؛ همین نام ثبت شود`,search:`جستجوی شهر`,hint:`نام شهر، مثلاً کاشان`},province:{label:`استان`,search:`جستجوی استان یا شهر`,capital:e=>`مرکز: ${e}`},colorPicker:{label:`رنگ`,custom:`انتخاب رنگ دلخواه`,area:`اشباع و روشنایی`,areaValue:(e,t)=>`اشباع ${e}، روشنایی ${t}`,eyedropper:`برداشتن رنگ از صفحه`,hue:`رنگ‌مایه`,degrees:e=>`${e} درجه`,red:`قرمز`,green:`سبز`,blue:`آبی`,invalid:`کد رنگ معتبر نیست؛ مثل ‎#0fa89b‎ وارد کنید.`,swatches:`رنگ‌های پیشنهادی`,sample:`متن نمونه`,contrast:(e,t,n)=>`کنتراست با متن ${e===`white`?`سفید`:`مشکی`}: ${t} به ۱ ${n?`(AA)`:`(کمتر از AA)`}`,names:{firoozeh:`فیروزه‌ای`,lajvard:`لاجوردی`,violet:`بنفش`,anar:`اناری`,zafaran:`زعفرانی`,peste:`پسته‌ای`,shab:`شب`}},combobox:{toggle:`نمایش گزینه‌ها`,more:e=>`${e} گزینهٔ دیگر؛ برای پیدا کردن تایپ کنید.`},otp:{label:`کد تأیید`},command:{placeholder:`جستجوی دستور یا صفحه…`,empty:`دستوری پیدا نشد.`,title:`پالت فرمان`,navigate:`حرکت`,select:`انتخاب`},contextMenu:{label:`گزینه‌ها`,hint:`برای دیدن گزینه‌ها، دکمهٔ راست ماوس را بزنید، انگشت را روی آن نگه دارید یا ‎Shift+F10‎ را بزنید.`},copy:{copy:`کپی`,copied:`کپی شد`,failed:`کپی نشد`},countdown:{days:`روز`,hours:`ساعت`,minutes:`دقیقه`,seconds:`ثانیه`,left:`مانده`},table:{pinned:`ستون ثابت`,edit:(e,t)=>`ویرایش ${e} در ${t}`,editHint:`برای ویرایش Enter یا دوبار کلیک کنید؛ Esc برای انصراف.`,saved:`ذخیره شد.`,exportExcel:`خروجی اکسل`,selectAll:`انتخاب همهٔ ردیف‌ها`,selectRow:`انتخاب ردیف`,selectNamed:e=>`انتخاب ${e}`,empty:`داده‌ای وجود ندارد.`,sort:e=>`مرتب‌سازی بر اساس ${e}`,search:`جستجو در جدول`,rows:e=>`${e} ردیف`},datePicker:{label:`تاریخ`,invalid:`این تاریخ معتبر نیست؛ آن را به شکل ۱۴۰۳/۰۵/۱۲ وارد کنید.`,open:`انتخاب تاریخ از تقویم`},dateRange:{label:`بازهٔ تاریخ`,placeholder:`انتخاب بازهٔ تاریخ`,presets:`میان‌برها`,pickEnd:`حالا تاریخ پایان را انتخاب کنید.`,last7:e=>`${e} روز اخیر`,last30:e=>`${e} روز اخیر`,thisMonth:`این ماه`,lastMonth:`ماه قبل`,today:`امروز`,thisSeason:`فصل جاری`,lastSeason:`فصل قبل`,fiscalYear:e=>`سال مالی ${e}`},monthPicker:{label:`انتخاب ماه`,prevYear:`سال قبل`,nextYear:`سال بعد`},timePicker:{clock:`انتخاب ساعت`,open:`انتخاب ساعت از روی ساعت`,hour:`ساعت`,minute:`دقیقه`,now:`اکنون`},fileUpload:{units:[`بایت`,`کیلوبایت`,`مگابایت`,`گیگابایت`],browse:`انتخاب فایل`,drop:`یا فایل را اینجا رها کنید`,tooBig:e=>`حجم فایل بیشتر از ${e} است.`,wrongType:`این نوع فایل پذیرفته نیست.`,tooMany:e=>`حداکثر ${e} فایل.`,done:`بارگذاری شد`,uploading:`در حال بارگذاری`,uploadingFile:e=>`در حال بارگذاری ${e}`,error:`خطا در بارگذاری`,preview:e=>`پیش‌نمایش ${e}`,resized:(e,t)=>`برای بارگذاری سریع‌تر به ${e}×${t} پیکسل کوچک شد.`},input:{clear:`پاک کردن`,show:`نمایش رمز`,hide:`پنهان کردن رمز`,checking:`در حال بررسی`},invalid:{card:`شماره کارت معتبر نیست.`,iban:`شماره شبا معتبر نیست.`,nationalId:`کد ملی معتبر نیست.`,legalId:`شناسهٔ ملی معتبر نیست.`,sayad:`شناسهٔ صیادی باید ۱۶ رقم باشد.`,economicCode:`کد اقتصادی معتبر نیست؛ کد ملی، شناسهٔ ملی یا کد ۱۲ رقمی قدیمی را وارد کنید.`,taxId:`شمارهٔ مالیاتی فاکتور باید ۲۲ نویسه از ارقام و حروف لاتین باشد.`,billId:`شناسهٔ قبض معتبر نیست؛ آن را از روی قبض دوباره بخوانید.`,paymentId:`شناسهٔ پرداخت با این شناسهٔ قبض جور نیست.`,mobile:`شماره موبایل معتبر نیست.`,landline:`شمارهٔ تلفن ثابت معتبر نیست.`,postal:`کد پستی معتبر نیست.`,plate:`پلاک خودرو معتبر نیست.`,time:`ساعت معتبر نیست؛ آن را به شکل ۰۹:۳۰ وارد کنید.`,timeRange:(e,t)=>`ساعت باید بین ${e} و ${t} باشد.`,priceMin:e=>`مبلغ باید حداقل ${e} باشد.`,priceMax:e=>`مبلغ باید حداکثر ${e} باشد.`,priceRange:(e,t)=>`مبلغ باید حداقل ${e} و حداکثر ${t} باشد.`},sheet:{expand:`باز کردن کامل برگه`,collapse:`کوچک کردن برگه`},navbar:{label:`ناوبری اصلی`,menu:`باز کردن منو`,menuTitle:`منو`},empty:{noData:[`هنوز چیزی اینجا نیست`,`اولین مورد را بسازید.`],noResults:[`نتیجه‌ای پیدا نشد`,`عبارت یا فیلتر دیگری را امتحان کنید.`],error:[`بارگذاری انجام نشد`,`دوباره امتحان کنید.`],offline:[`اتصال اینترنت قطع است`,`پس از اتصال، داده‌ها به‌روز می‌شوند.`],noAccess:[`به این بخش دسترسی ندارید`,`از مدیر تیم دسترسی بخواهید.`],done:[`همه‌چیز انجام شده`,``]},form:{required:`این بخش را پر کنید.`,email:`نشانی ایمیل درست نیست؛ مثلاً name@example.com.`,minLength:e=>`دست‌کم ${e} نویسه بنویسید.`,maxLength:e=>`حداکثر ${e} نویسه مجاز است.`,min:e=>`مقدار باید دست‌کم ${e} باشد.`,max:e=>`مقدار باید حداکثر ${e} باشد.`,pattern:`قالب این مقدار درست نیست.`,match:`این دو مقدار یکسان نیستند.`,summary:e=>`${e} مورد را اصلاح کنید.`},inlineEdit:{empty:`خالی`,failed:`ذخیره نشد؛ دوباره امتحان کنید.`},iranMap:{label:`نقشهٔ استان‌های ایران`,tableNote:`؛ جدول داده در ادامه`,onMap:e=>`${e} روی نقشه`},keyboardFix:{before:`منظورتان`,after:`بود؟`},meter:{ok:`در محدودهٔ مجاز`,warning:`نزدیک به سقف`,critical:`سقف تقریباً پر شده`},multiSelect:{label:`انتخاب`,selected:e=>`${e} مورد انتخاب شده`,clearedAll:`همه حذف شد`},numberInput:{label:`تعداد`,increment:`افزایش`,decrement:`کاهش`},pagination:{nav:`صفحه‌بندی`,page:e=>`صفحهٔ ${e}`,perPage:`در هر صفحه`,jump:`برو به صفحه`,jumpRange:(e,t,n)=>`${e}، از ${t} تا ${n}`},password:{title:`قدرت رمز`,strength:e=>`قدرت رمز: ${e}`,levels:[`ضعیف`,`متوسط`,`خوب`,`قوی`],persian:`رمز حروف فارسی دارد؛ شاید صفحه‌کلید روی فارسی مانده است.`,length:e=>`حداقل ${e} نویسه`,cases:`حروف بزرگ و کوچک انگلیسی`,digit:`دست‌کم یک عدد`,symbol:`دست‌کم یک نماد، مثل ! یا @`,met:`، رعایت شده`,unmet:`، رعایت نشده`},receipt:{success:`پرداخت موفق`,failed:`پرداخت ناموفق`,pending:`در انتظار تأیید بانک`,merchant:`پذیرنده`,tracking:`کد پیگیری`,copyTracking:`کپی کد پیگیری`,reference:`شمارهٔ مرجع`,card:`کارت`,date:`تاریخ`,at:e=>`ساعت ${e}`},persianInput:{text:`متن`,"national-id":`کد ملی`,"legal-id":`شناسهٔ ملی شرکت`,mobile:`شمارهٔ موبایل`,landline:`تلفن ثابت`,card:`شمارهٔ کارت`,iban:`شمارهٔ شبا`,price:`مبلغ`,postal:`کد پستی`,time:`ساعت`,plate:`پلاک خودرو`,sayad:`شناسهٔ صیادی چک`,"economic-code":`کد اقتصادی`,"tax-id":`شمارهٔ مالیاتی فاکتور`,"bill-id":`شناسهٔ قبض`,"payment-id":`شناسهٔ پرداخت`},taxCode:{person:`شخص حقیقی`,company:`شخص حقوقی`,legacy:`کد قدیمی`},textFix:{fix:`اصلاح نگارش`,clean:`نگارش متن درست است.`,count:(e,t)=>`${e} مورد قابل اصلاح: ${t}`,arabic:`حرف عربی`,zwnj:`نیم‌فاصله`,punctuation:`علامت`,digits:`رقم`,spacing:`فاصله`},plate:{label:`پلاک خودرو`,first:`دو رقم اول پلاک`,letter:`حرف پلاک`,middle:`سه رقم پلاک`,region:`کد استان`,iran:`ایران`},rating:{label:`امتیاز`},sideNav:{label:`اصلی`},priceRange:{from:`از`,to:`تا`,min:`ارزان‌ترین`,max:`گران‌ترین`,range:`بازهٔ قیمت`},searchSuggest:{label:`جستجو`,recent:`جستجوهای اخیر`,popular:`جستجوهای پرطرفدار`,clear:`پاک کردن`,remove:e=>`حذف «${e}» از جستجوهای اخیر`,suggestions:`پیشنهادها`},swatch:{selected:`انتخاب شده`},slider:{from:`حداقل`,to:`حداکثر`},splitter:{label:`تغییر اندازهٔ پنل‌ها`},stat:{up:`افزایش`,down:`کاهش`,flat:`بدون تغییر`},stepper:{label:`مراحل`,complete:`انجام شده`,current:`مرحلهٔ فعلی`},tagInput:{label:`برچسب‌ها`,duplicate:`این مورد قبلاً اضافه شده است.`},toast:{region:`اعلان‌ها`,close:`بستن اعلان`},tour:{done:`تمام`,skip:`رد کردن`,step:(e,t)=>`مرحلهٔ ${e} از ${t}`},heatmap:{unit:`فعالیت`,weekdays:[`ش`,``,`د`,``,`چ`,``,`ج`],inYear:(e,t)=>`${e} در سال ${t}`,total:(e,t,n)=>`${e} ${t} در ${n}`,less:`کمتر`,more:`بیشتر`,byMonth:e=>`${e}، به تفکیک ماه`},appointment:{label:`انتخاب نوبت`,day:`روز`,morning:`صبح`,afternoon:`بعدازظهر`,evening:`عصر`,closed:`تعطیل`,full:`پر`,free:e=>`${e} نوبت`,freeLong:e=>`${e} نوبت خالی`,none:`نوبت خالی ندارد`,closedDay:`این روز تعطیل است.`,noSlots:`نوبت خالی برای این روز نمانده است؛ روز دیگری را انتخاب کنید.`,time:e=>`ساعت ${e}`,booked:`، پر`,yours:`نوبت شما:`,at:(e,t)=>`${e}، ساعت ${t}`},address:{legend:`نشانی`,province:`استان`,city:`شهر`,street:`نشانی`,plaque:`پلاک`,unit:`واحد`,postalCode:`کد پستی`,provinceSearch:`جستجوی استان`,streetHint:`خیابان، کوچه، نام ساختمان`},businessHours:{label:`ساعت کاری`,weekdays:`روزهای کاری`,open:`باز`,closed:`تعطیل`,from:`از`,to:`تا`,addRange:`افزودن بازهٔ دیگر`,removeRange:`حذف این بازه`,copyAll:`همین ساعت برای همهٔ روزهای باز`,invalid:`ساعت پایان باید بعد از شروع باشد و بازه‌ها روی هم نیفتند.`,openNow:`الان باز است`,closedNow:`الان بسته است`,rangeOf:(e,t)=>`بازهٔ ${t} ${e}`},chat:{thread:`گفتگو`,you:`شما`,assistant:`دستیار`,typing:e=>`${e} در حال نوشتن است`,typingShort:`در حال نوشتن`,copy:`کپی پیام`,copied:`کپی شد`,retry:`تلاش دوباره`,like:`پاسخ خوب بود`,dislike:`پاسخ خوب نبود`,actions:`کارهای پیام`,sending:`در حال ارسال`,sent:`ارسال شد`,delivered:`رسید`,read:`خوانده شد`,failed:`ارسال نشد`,edited:`ویرایش‌شده`,scrollDown:`رفتن به آخرین پیام`,newMessages:e=>`${e} پیام تازه`},composer:{label:`پیام`,placeholder:`پیامتان را بنویسید…`,send:`ارسال`,stop:`توقف پاسخ`,attach:`پیوست فایل`,attachments:`پیوست‌ها`,removeAttachment:e=>`حذف ${e}`,hint:`Enter برای ارسال، Shift+Enter برای خط تازه`,tooMany:e=>`حداکثر ${e} پیوست.`,tooLarge:(e,t)=>`${e} بیشتر از ${t} است.`},streaming:{writing:`در حال نوشتن پاسخ`,done:`پاسخ کامل شد`},codeBlock:{copy:`کپی کد`,copied:`کپی شد`,code:e=>`کد ${e}`,wrap:`شکستن خط‌های بلند`,lines:e=>`${e} خط`},sortable:{handle:e=>`جابه‌جا کردن ${e}`,instructions:`برای جابه‌جایی فاصله را بزنید؛ با کلیدهای جهت حرکت دهید، دوباره فاصله برای رها کردن و Escape برای لغو.`,grabbed:(e,t,n)=>`${e} برداشته شد؛ جای ${t} از ${n}.`,moved:(e,t,n)=>`${e}، جای ${t} از ${n}`,dropped:(e,t,n)=>`${e} در جای ${t} از ${n} گذاشته شد.`,cancelled:e=>`جابه‌جایی ${e} لغو شد.`},kanban:{label:`تابلو`,add:`افزودن کارت`,count:e=>`${e} کارت`,empty:`کارتی در این ستون نیست؛ کارتی را اینجا بکشید.`,instructions:`برای جابه‌جایی کارت فاصله را بزنید؛ بالا و پایین داخل ستون، چپ و راست بین ستون‌ها، دوباره فاصله برای رها کردن و Escape برای لغو.`,grabbed:(e,t)=>`${e} از ستون ${t} برداشته شد.`,moved:(e,t,n)=>`${e}، ستون ${t}، جای ${n}`,dropped:(e,t,n)=>`${e} در ستون ${t}، جای ${n} گذاشته شد.`,cancelled:e=>`جابه‌جایی ${e} لغو شد.`},lightbox:{gallery:`گالری تصاویر`,label:`نمایش تصویر`,open:e=>`بزرگ کردن ${e}`,close:`بستن`,prev:`تصویر قبلی`,next:`تصویر بعدی`,counter:(e,t)=>`${e} از ${t}`,zoomIn:`بزرگ‌نمایی`,zoomOut:`اندازهٔ عادی`},richText:{label:`ویرایشگر متن`,toolbar:`قالب‌بندی`,bold:`پررنگ`,italic:`کج`,underline:`زیرخط`,strike:`خط‌خورده`,heading:`عنوان`,quote:`نقل‌قول`,bullet:`فهرست نقطه‌ای`,ordered:`فهرست شماره‌دار`,link:`پیوند`,linkUrl:`نشانی پیوند`,apply:`ثبت`,unlink:`حذف پیوند`,rtl:`راست‌به‌چپ`,ltr:`چپ‌به‌راست`,undo:`واگرد`,redo:`ازنو`,clear:`پاک کردن قالب`,placeholder:`بنویسید…`,zwnj:`Shift+Space نیم‌فاصله می‌گذارد`,words:e=>`${e} کلمه`,chars:e=>`${e} نویسه`},notifications:{label:`اعلان‌ها`,button:e=>`اعلان‌ها، ${e} خوانده‌نشده`,all:`همه`,unread:`خوانده‌نشده`,markAll:`خواندن همه`,markRead:`علامت خوانده‌شده`,empty:`اعلانی ندارید.`,emptyUnread:`همهٔ اعلان‌ها را خوانده‌اید.`,today:`امروز`,yesterday:`دیروز`,earlier:`قبل‌تر`,settings:`تنظیمات اعلان‌ها`,viewAll:`دیدن همهٔ اعلان‌ها`,unreadDot:`خوانده‌نشده`},qr:{label:e=>`کد QR برای ${e}`,tooLong:`این متن برای کد QR خیلی طولانی است.`,download:`دانلود کد QR`},scheduler:{label:`برنامهٔ زمانی`,week:`هفته`,day:`روز`,prevWeek:`هفتهٔ قبل`,nextWeek:`هفتهٔ بعد`,prevDay:`روز قبل`,nextDay:`روز بعد`,now:`اکنون`,view:`نما`,events:e=>`${e} رویداد`,noEvents:`بدون رویداد`,slot:(e,t)=>`${e} ساعت ${t}، افزودن رویداد`},bill:{service:{water:`آب`,electricity:`برق`,gas:`گاز`,landline:`تلفن ثابت`,mobile:`تلفن همراه`,municipality:`عوارض شهرداری`,tax:`مالیات`,fine:`جریمهٔ رانندگی`},amount:`مبلغ`,period:(e,t)=>`دورهٔ ${t}، سال …${e}`,needBill:`اول شناسهٔ قبض را وارد کنید.`},invoice:{official:`صورتحساب فروش کالا و خدمات`,proforma:`پیش‌فاکتور`,number:`شماره`,date:`تاریخ`,validUntil:`اعتبار تا`,seller:`مشخصات فروشنده`,buyer:`مشخصات خریدار`,name:`نام`,economicCode:`کد اقتصادی`,nationalId:`شناسهٔ ملی / کد ملی`,postal:`کد پستی`,phone:`تلفن`,address:`نشانی`,taxId:`شمارهٔ مالیاتی`,row:`ردیف`,description:`شرح کالا یا خدمت`,quantity:`تعداد`,unit:`واحد`,unitPrice:`مبلغ واحد`,discount:`تخفیف`,lineTotal:`مبلغ کل`,subtotal:`جمع کل`,totalDiscount:`جمع تخفیف`,vat:e=>`مالیات و عوارض ارزش افزوده (${e}٪)`,payable:`مبلغ قابل پرداخت`,inWords:(e,t)=>`${e} ${t}`,rial:`ریال`,toman:`تومان`,notes:`توضیحات`,sellerSign:`مهر و امضای فروشنده`,buyerSign:`امضای خریدار`,print:`چاپ یا ذخیرهٔ PDF`},signature:{label:`امضا`,clear:`پاک کردن`,undo:`برگرداندن آخرین خط`,draw:`رسم امضا`,type:`تایپ امضا`,hint:`با ماوس، قلم یا انگشت داخل کادر امضا کنید.`,typedLabel:`نام خود را برای امضا تایپ کنید`,empty:`امضا خالی است.`,signed:`امضا ثبت شد.`,cleared:`امضا پاک شد.`,area:`کادر امضا`},cropper:{label:`برش تصویر`,zoom:`بزرگ‌نمایی`,rotate:`چرخش ۹۰ درجه`,reset:`بازنشانی`,apply:`برش`,area:`کادر برش؛ با کلیدهای جهت جابه‌جا کنید و با + و − بزرگ و کوچک کنید.`,moved:(e,t)=>`کادر در ${e}٪ و ${t}٪`,zoomed:e=>`بزرگ‌نمایی ${e}٪`},gantt:{label:`نمودار گانت`,task:`کار`,start:`شروع`,end:`پایان`,today:`امروز`,days:e=>`${e} روز`,progress:e=>`${e}٪ انجام‌شده`,bar:(e,t,n,r)=>`${e}، از ${t} تا ${n}، ${r}٪ انجام‌شده`,moved:(e,t,n)=>`${e} به ${t} تا ${n} منتقل شد.`,dependsOn:e=>`وابسته به ${e}`,hint:`با کلیدهای جهت جابه‌جا کنید و با Shift طول را تغییر دهید.`},infinite:{loading:`در حال بارگذاری موارد بیشتر`,end:`همهٔ موارد نمایش داده شد.`,error:`موارد بیشتر بارگذاری نشد.`,retry:`تلاش دوباره`,loadMore:`نمایش موارد بیشتر`,loaded:e=>`${e} مورد دیگر بارگذاری شد.`},virtualList:{label:e=>`فهرست ${e} موردی`}},k={common:{close:`Close`,loading:`Loading`,optional:`Optional`,remove:e=>`Remove ${e}`,removeShort:`Remove`,clear:`Clear`,clearAll:`Clear all`,cancel:`Cancel`,confirm:`Apply`,save:`Save`,edit:`Edit`,prev:`Previous`,next:`Next`,today:`Today`,tomorrow:`Tomorrow`,noResults:`No results found.`,noOptions:`No options to choose from.`,noData:`No data to show.`,searching:`Searching…`,results:e=>`${e} ${e===`1`?`result`:`results`}`,added:e=>`${e} added`,removed:e=>`${e} removed`,selected:e=>`${e} selected`,max:e=>`Up to ${e} items`,total:`Total`,other:`Other`,of:(e,t)=>`${e} of ${t}`,and:` and `,list:`, `,range:` – `,percent:e=>`${e}%`,comma:`, `,decimal:`.`},money:{toman:`Toman`,rial:`Rial`,positive:`plus `},alert:{close:`Close`},banner:{label:`Announcement`,close:`Dismiss announcement`},avatar:{online:`Online`,offline:`Offline`,busy:`Busy`,away:`Away`,more:e=>`${e} more`},bankCard:{card:`Bank card`,cardOf:e=>`${e} card`,bank:`Bank`,endingIn:e=>`ending in ${e}`,expiry:`Expires`},breadcrumb:{label:`Breadcrumb`,expand:`Show full path`},calendar:{label:`Calendar`,prevMonth:`Previous month`,nextMonth:`Next month`,month:`Month`,year:`Year`,holiday:`Holiday`},carousel:{slider:`carousel`,slide:`slide`,slideOf:(e,t)=>`${e} of ${t}`,slides:e=>`${e} slides`,play:`Play slideshow`,pause:`Pause slideshow`,expand:`View larger`,lightbox:e=>`${e}, larger view`,thumbnails:e=>`${e} thumbnails`},chart:{period:`Period`,value:`Value`,share:`Share of total`,count:`Count`,keyboard:e=>`${e}. Use the arrow keys to move between points.`,thousand:`K`,million:`M`,billion:`B`},city:{label:`City`,outside:`Not in the list`,custom:`Other city; use this name`,search:`Search cities`,hint:`City name, e.g. Kashan`},province:{label:`Province`,search:`Search provinces or cities`,capital:e=>`Capital: ${e}`},colorPicker:{label:`Color`,custom:`Pick a custom color`,area:`Saturation and brightness`,areaValue:(e,t)=>`Saturation ${e}, brightness ${t}`,eyedropper:`Pick a color from the screen`,hue:`Hue`,degrees:e=>`${e} degrees`,red:`Red`,green:`Green`,blue:`Blue`,invalid:`Invalid color code; enter one like #0fa89b.`,swatches:`Suggested colors`,sample:`Sample text`,contrast:(e,t,n)=>`Contrast with ${e} text: ${t}:1 ${n?`(AA)`:`(below AA)`}`,names:{firoozeh:`Turquoise`,lajvard:`Lapis`,violet:`Violet`,anar:`Pomegranate`,zafaran:`Saffron`,peste:`Pistachio`,shab:`Night`}},combobox:{toggle:`Show options`,more:e=>`${e} more; type to find them.`},otp:{label:`Verification code`},command:{placeholder:`Search commands or pages…`,empty:`No commands found.`,title:`Command palette`,navigate:`Navigate`,select:`Select`},contextMenu:{label:`Options`,hint:`Right-click, long-press or press Shift+F10 for options.`},copy:{copy:`Copy`,copied:`Copied`,failed:`Copy failed`},countdown:{days:`days`,hours:`hours`,minutes:`minutes`,seconds:`seconds`,left:`left`},table:{pinned:`Pinned column`,edit:(e,t)=>`Edit ${e} in ${t}`,editHint:`Press Enter or double-click to edit; Esc to cancel.`,saved:`Saved.`,exportExcel:`Export to Excel`,selectAll:`Select all rows`,selectRow:`Select row`,selectNamed:e=>`Select ${e}`,empty:`No data.`,sort:e=>`Sort by ${e}`,search:`Search the table`,rows:e=>`${e} ${e===`1`?`row`:`rows`}`},datePicker:{label:`Date`,invalid:`Invalid date; enter it like 1403/05/12.`,open:`Choose a date from the calendar`},dateRange:{label:`Date range`,placeholder:`Select a date range`,presets:`Shortcuts`,pickEnd:`Now choose the end date.`,last7:e=>`Last ${e} days`,last30:e=>`Last ${e} days`,thisMonth:`This month`,lastMonth:`Last month`,today:`Today`,thisSeason:`This season`,lastSeason:`Last season`,fiscalYear:e=>`Fiscal year ${e}`},monthPicker:{label:`Choose a month`,prevYear:`Previous year`,nextYear:`Next year`},timePicker:{clock:`Choose a time`,open:`Choose a time from the clock`,hour:`Hour`,minute:`Minute`,now:`Now`},fileUpload:{units:[`B`,`KB`,`MB`,`GB`],browse:`Choose file`,drop:`or drop a file here`,tooBig:e=>`File is larger than ${e}.`,wrongType:`This file type isn't accepted.`,tooMany:e=>`Up to ${e} files.`,done:`Uploaded`,uploading:`Uploading`,uploadingFile:e=>`Uploading ${e}`,error:`Upload failed`,preview:e=>`Preview of ${e}`,resized:(e,t)=>`Resized to ${e}×${t} px for a faster upload.`},input:{clear:`Clear`,show:`Show password`,hide:`Hide password`,checking:`Checking`},invalid:{card:`Invalid card number.`,iban:`Invalid IBAN.`,nationalId:`Invalid national ID.`,legalId:`Invalid company ID.`,sayad:`A Sayad ID has 16 digits.`,economicCode:`Invalid economic code; enter a national ID, company ID or the old 12-digit code.`,taxId:`An invoice tax ID has 22 Latin letters and digits.`,billId:`Invalid bill ID; read it from the bill again.`,paymentId:`This payment ID doesn't match the bill ID.`,mobile:`Invalid mobile number.`,landline:`Invalid phone number.`,postal:`Invalid postal code.`,plate:`Invalid license plate.`,time:`Invalid time; enter it like 09:30.`,timeRange:(e,t)=>`Time must be between ${e} and ${t}.`,priceMin:e=>`Amount must be at least ${e}.`,priceMax:e=>`Amount must be at most ${e}.`,priceRange:(e,t)=>`Amount must be between ${e} and ${t}.`},sheet:{expand:`Expand sheet`,collapse:`Collapse sheet`},navbar:{label:`Main navigation`,menu:`Open menu`,menuTitle:`Menu`},empty:{noData:[`Nothing here yet`,`Create the first item.`],noResults:[`No results found`,`Try a different search or filter.`],error:[`Couldn't load this`,`Try again.`],offline:[`You're offline`,`Data refreshes once you reconnect.`],noAccess:[`You don't have access`,`Ask your team admin for access.`],done:[`All done`,``]},form:{required:`Fill in this field.`,email:`Enter a valid email, like name@example.com.`,minLength:e=>`Use at least ${e} characters.`,maxLength:e=>`Use ${e} characters or fewer.`,min:e=>`Must be at least ${e}.`,max:e=>`Must be at most ${e}.`,pattern:`This doesn't match the expected format.`,match:`These values don't match.`,summary:e=>`Fix ${e} fields.`},inlineEdit:{empty:`Empty`,failed:`Couldn't save; try again.`},iranMap:{label:`Map of Iran's provinces`,tableNote:`; data table follows`,onMap:e=>`${e} on the map`},keyboardFix:{before:`Did you mean`,after:`?`},meter:{ok:`Within limit`,warning:`Close to the limit`,critical:`Almost full`},multiSelect:{label:`Select`,selected:e=>`${e} selected`,clearedAll:`All removed`},numberInput:{label:`Quantity`,increment:`Increase`,decrement:`Decrease`},pagination:{nav:`Pagination`,page:e=>`Page ${e}`,perPage:`Per page`,jump:`Go to page`,jumpRange:(e,t,n)=>`${e}, ${t} to ${n}`},password:{title:`Password strength`,strength:e=>`Password strength: ${e}`,levels:[`Weak`,`Fair`,`Good`,`Strong`],persian:`Your password has Persian letters; the keyboard may still be on Persian.`,length:e=>`At least ${e} characters`,cases:`Upper and lower case letters`,digit:`At least one number`,symbol:`At least one symbol, like ! or @`,met:`, met`,unmet:`, not met`},receipt:{success:`Payment successful`,failed:`Payment failed`,pending:`Awaiting bank confirmation`,merchant:`Merchant`,tracking:`Tracking code`,copyTracking:`Copy tracking code`,reference:`Reference number`,card:`Card`,date:`Date`,at:e=>`at ${e}`},persianInput:{text:`Text`,"national-id":`National ID`,"legal-id":`Company ID`,mobile:`Mobile number`,landline:`Phone number`,card:`Card number`,iban:`IBAN`,price:`Amount`,postal:`Postal code`,time:`Time`,plate:`License plate`,sayad:`Cheque Sayad ID`,"economic-code":`Economic code`,"tax-id":`Invoice tax ID`,"bill-id":`Bill ID`,"payment-id":`Payment ID`},taxCode:{person:`Individual`,company:`Company`,legacy:`Old code`},textFix:{fix:`Fix writing`,clean:`The text looks right.`,count:(e,t)=>`${e} fixable: ${t}`,arabic:`Arabic letters`,zwnj:`half-spaces`,punctuation:`punctuation`,digits:`digits`,spacing:`spacing`},plate:{label:`License plate`,first:`First two digits`,letter:`Plate letter`,middle:`Three digits`,region:`Region code`,iran:`ایران`},rating:{label:`Rating`},sideNav:{label:`Main`},priceRange:{from:`From`,to:`To`,min:`Lowest`,max:`Highest`,range:`Price range`},searchSuggest:{label:`Search`,recent:`Recent searches`,popular:`Popular searches`,clear:`Clear`,remove:e=>`Remove “${e}” from recent searches`,suggestions:`Suggestions`},swatch:{selected:`selected`},slider:{from:`Minimum`,to:`Maximum`},splitter:{label:`Resize panels`},stat:{up:`Up`,down:`Down`,flat:`No change`},stepper:{label:`Steps`,complete:`completed`,current:`current step`},tagInput:{label:`Tags`,duplicate:`This item has already been added.`},toast:{region:`Notifications`,close:`Dismiss notification`},tour:{done:`Done`,skip:`Skip`,step:(e,t)=>`Step ${e} of ${t}`},heatmap:{unit:`activities`,weekdays:[`Sa`,``,`Mo`,``,`We`,``,`Fr`],inYear:(e,t)=>`${e} in ${t}`,total:(e,t,n)=>`${e} ${t} in ${n}`,less:`Less`,more:`More`,byMonth:e=>`${e}, by month`},appointment:{label:`Book an appointment`,day:`Day`,morning:`Morning`,afternoon:`Afternoon`,evening:`Evening`,closed:`Closed`,full:`Full`,free:e=>`${e} open`,freeLong:e=>`${e} open slots`,none:`No open slots`,closedDay:`Closed on this day.`,noSlots:`No open slots left for this day; choose another day.`,time:e=>`${e}`,booked:`, booked`,yours:`Your appointment:`,at:(e,t)=>`${e} at ${t}`},address:{legend:`Address`,province:`Province`,city:`City`,street:`Street address`,plaque:`No.`,unit:`Unit`,postalCode:`Postal code`,provinceSearch:`Search provinces`,streetHint:`Street, alley, building name`},businessHours:{label:`Business hours`,weekdays:`Working days`,open:`Open`,closed:`Closed`,from:`From`,to:`To`,addRange:`Add another range`,removeRange:`Remove this range`,copyAll:`Use these hours for all open days`,invalid:`End time must be after the start time and ranges can't overlap.`,openNow:`Open now`,closedNow:`Closed now`,rangeOf:(e,t)=>`${e}, range ${t}`},chat:{thread:`Conversation`,you:`You`,assistant:`Assistant`,typing:e=>`${e} is typing`,typingShort:`Typing`,copy:`Copy message`,copied:`Copied`,retry:`Try again`,like:`Good response`,dislike:`Bad response`,actions:`Message actions`,sending:`Sending`,sent:`Sent`,delivered:`Delivered`,read:`Read`,failed:`Not sent`,edited:`edited`,scrollDown:`Jump to latest message`,newMessages:e=>`${e} new messages`},composer:{label:`Message`,placeholder:`Write a message…`,send:`Send`,stop:`Stop response`,attach:`Attach file`,attachments:`Attachments`,removeAttachment:e=>`Remove ${e}`,hint:`Enter to send, Shift+Enter for a new line`,tooMany:e=>`Up to ${e} attachments.`,tooLarge:(e,t)=>`${e} is larger than ${t}.`},streaming:{writing:`Writing a response`,done:`Response complete`},codeBlock:{copy:`Copy code`,copied:`Copied`,code:e=>`${e} code`,wrap:`Wrap long lines`,lines:e=>`${e} lines`},sortable:{handle:e=>`Move ${e}`,instructions:`Press Space to pick up; use arrow keys to move, Space again to drop and Escape to cancel.`,grabbed:(e,t,n)=>`Picked up ${e}; position ${t} of ${n}.`,moved:(e,t,n)=>`${e}, position ${t} of ${n}`,dropped:(e,t,n)=>`Dropped ${e} at position ${t} of ${n}.`,cancelled:e=>`Move of ${e} cancelled.`},kanban:{label:`Board`,add:`Add card`,count:e=>`${e} cards`,empty:`No cards here; drag one in.`,instructions:`Press Space to pick up a card; up and down within a column, left and right between columns, Space again to drop and Escape to cancel.`,grabbed:(e,t)=>`Picked up ${e} from ${t}.`,moved:(e,t,n)=>`${e}, ${t}, position ${n}`,dropped:(e,t,n)=>`Dropped ${e} in ${t}, position ${n}.`,cancelled:e=>`Move of ${e} cancelled.`},lightbox:{gallery:`Image gallery`,label:`Image viewer`,open:e=>`Enlarge ${e}`,close:`Close`,prev:`Previous image`,next:`Next image`,counter:(e,t)=>`${e} of ${t}`,zoomIn:`Zoom in`,zoomOut:`Actual size`},richText:{label:`Text editor`,toolbar:`Formatting`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strike:`Strikethrough`,heading:`Heading`,quote:`Quote`,bullet:`Bulleted list`,ordered:`Numbered list`,link:`Link`,linkUrl:`Link URL`,apply:`Apply`,unlink:`Remove link`,rtl:`Right to left`,ltr:`Left to right`,undo:`Undo`,redo:`Redo`,clear:`Clear formatting`,placeholder:`Write…`,zwnj:`Shift+Space inserts a zero-width non-joiner`,words:e=>`${e} words`,chars:e=>`${e} characters`},notifications:{label:`Notifications`,button:e=>`Notifications, ${e} unread`,all:`All`,unread:`Unread`,markAll:`Mark all as read`,markRead:`Mark as read`,empty:`You have no notifications.`,emptyUnread:`You're all caught up.`,today:`Today`,yesterday:`Yesterday`,earlier:`Earlier`,settings:`Notification settings`,viewAll:`View all notifications`,unreadDot:`Unread`},qr:{label:e=>`QR code for ${e}`,tooLong:`This text is too long for a QR code.`,download:`Download QR code`},scheduler:{label:`Schedule`,week:`Week`,day:`Day`,prevWeek:`Previous week`,nextWeek:`Next week`,prevDay:`Previous day`,nextDay:`Next day`,now:`Now`,view:`View`,events:e=>`${e} events`,noEvents:`No events`,slot:(e,t)=>`${e} at ${t}, add event`},bill:{service:{water:`Water`,electricity:`Electricity`,gas:`Gas`,landline:`Landline`,mobile:`Mobile`,municipality:`Municipality`,tax:`Tax`,fine:`Traffic fine`},amount:`Amount`,period:(e,t)=>`Period ${t}, year …${e}`,needBill:`Enter the bill ID first.`},invoice:{official:`Sales invoice`,proforma:`Proforma invoice`,number:`No.`,date:`Date`,validUntil:`Valid until`,seller:`Seller`,buyer:`Buyer`,name:`Name`,economicCode:`Economic code`,nationalId:`Company or national ID`,postal:`Postal code`,phone:`Phone`,address:`Address`,taxId:`Tax ID`,row:`#`,description:`Item or service`,quantity:`Qty`,unit:`Unit`,unitPrice:`Unit price`,discount:`Discount`,lineTotal:`Total`,subtotal:`Subtotal`,totalDiscount:`Total discount`,vat:e=>`VAT (${e}%)`,payable:`Amount due`,inWords:(e,t)=>`${e} ${t}`,rial:`rials`,toman:`tomans`,notes:`Notes`,sellerSign:`Seller's stamp and signature`,buyerSign:`Buyer's signature`,print:`Print or save as PDF`},signature:{label:`Signature`,clear:`Clear`,undo:`Undo last stroke`,draw:`Draw`,type:`Type`,hint:`Sign inside the box with a mouse, pen or finger.`,typedLabel:`Type your name to sign`,empty:`The signature is empty.`,signed:`Signature added.`,cleared:`Signature cleared.`,area:`Signature area`},cropper:{label:`Crop image`,zoom:`Zoom`,rotate:`Rotate 90°`,reset:`Reset`,apply:`Crop`,area:`Crop area; move it with the arrow keys and zoom with + and −.`,moved:(e,t)=>`Crop at ${e}% and ${t}%`,zoomed:e=>`Zoom ${e}%`},gantt:{label:`Gantt chart`,task:`Task`,start:`Start`,end:`End`,today:`Today`,days:e=>`${e} ${e===`1`?`day`:`days`}`,progress:e=>`${e}% done`,bar:(e,t,n,r)=>`${e}, ${t} to ${n}, ${r}% done`,moved:(e,t,n)=>`${e} moved to ${t} – ${n}.`,dependsOn:e=>`Depends on ${e}`,hint:`Move with the arrow keys; hold Shift to change the length.`},infinite:{loading:`Loading more items`,end:`You've reached the end.`,error:`Couldn't load more items.`,retry:`Try again`,loadMore:`Show more`,loaded:e=>`${e} more ${e===`1`?`item`:`items`} loaded.`},virtualList:{label:e=>`List of ${e} items`}};function A(e=`fa`,t){let n=e===`en`?k:O;return t?M(n,t):n}const j=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function M(e,t){let n={...e};for(let[r,i]of Object.entries(t))i!==void 0&&(n[r]=j(i)&&j(e[r])?M(e[r],i):i);return n}const N=typeof HTMLElement>`u`?class{}:HTMLElement,P=[],F=[],I=[];let L=null;function R(e,t,n=`inline`){if(typeof customElements>`u`||customElements.get(e)||(I.push(e),n===`block`&&P.push(e),n===`contents`&&F.push(e),z(t),customElements.define(e,t),typeof document>`u`))return;L||(L=document.createElement(`style`),L.dataset.kashiElements=``,document.head.prepend(L));let r=[P.length&&`:where(${P.join(`,`)}) { display: block; }`,F.length&&`:where(${F.join(`,`)}) { display: contents; }`,`:where(${[...P,...F].join(`,`)})[hidden] { display: none; }`,`:where(${I.join(`,`)}) [hidden]:not([hidden="until-found"]) { display: none !important; }`].filter(Boolean);L.textContent=`@layer kashi.elements { ${r.join(` `)} }`}function z(e){let t=/* @__PURE__ */ new Set;for(let n=e.prototype;n&&n!==N.prototype;n=Object.getPrototypeOf(n))for(let[e,r]of Object.entries(Object.getOwnPropertyDescriptors(n)))r.set&&t.add(e);let n=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){for(let e of t){if(!Object.prototype.hasOwnProperty.call(this,e))continue;let t=this[e];delete this[e],this[e]=t}n?.call(this)}}function B(e){typeof document<`u`&&document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e,{once:!0}):e()}const V={locale:`fa`,messages:O,digits:`fa`};function H(e,{messages:t,digits:n}={}){V.locale=e,V.messages=A(e,t),V.digits=n??(e===`en`?`latin`:`fa`)}const U=()=>V.digits,W=()=>V.messages,G=()=>V.locale,K=e=>{let t=e.getAttribute(`digits`);return t===`latin`||t===`fa`?t:V.digits},q=(e,n)=>K(e)===`fa`?t(String(n)):String(n),J=()=>{let e=V.locale===`en`;return{months:e?c:a,weekdays:e?l:o,weekdaysShort:e?u:s,friday:e?`Friday`:`جمعه`}};let Y=0;const X=e=>`${e}-${(++Y).toString(36)}`,Z={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Q=e=>String(e??``).replace(/[&<>"']/g,e=>Z[e]),te=(e,t,n=!1)=>{let r=e.getAttribute(t);return r===null?n:r!==`false`};function ne(e,t,n){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}const $=(e,t=1.7,n=!1)=>`<svg${n?` data-k-mirror=""`:``} viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="${t}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,re={close:$(`<path d="m5 5 10 10M15 5 5 15"/>`),info:$(`<circle cx="10" cy="10" r="7.5"/><path d="M10 13.5V9.5M10 6.5h.01"/>`),success:$(`<circle cx="10" cy="10" r="7.5"/><path d="m6.75 10 2.25 2.25 4.25-4.5"/>`),warning:$(`<path d="M8.6 3.4 2.4 14a1.6 1.6 0 0 0 1.4 2.4h12.4a1.6 1.6 0 0 0 1.4-2.4L11.4 3.4a1.6 1.6 0 0 0-2.8 0Z"/><path d="M10 7.5v3.25M10 13.5h.01"/>`),error:$(`<circle cx="10" cy="10" r="7.5"/><path d="M10 6.5v4M10 13.5h.01"/>`),copy:$(`<rect x="7" y="7" width="10" height="10" rx="2"/><path d="M13 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"/>`),check:$(`<path d="m5 10.5 3.2 3L15 7"/>`,2),calendar:$(`<rect x="3" y="4.5" width="14" height="12.5" rx="2"/><path d="M3 8.5h14M7 3v3M13 3v3"/>`),prev:$(`<path d="m12 5-5 5 5 5"/>`,1.7,!0),next:$(`<path d="m8 5 5 5-5 5"/>`,1.7,!0)};function ie({id:e,label:t,required:n,optional:r,control:i}){return`<div class="k-field">${t?`<div class="k-field__label-row"><label class="k-label" for="${e}">${Q(t)}${n?`<span class="k-label__required" aria-hidden="true">*</span>`:``}${r?`<span class="k-label__optional">${Q(r)}</span>`:``}</label></div>`:``}${i}</div>`}function ae(e,t,n,r,i,a){if(e.querySelector(`:scope > .k-field__hint-row`)?.remove(),r?e.setAttribute(`data-invalid`,``):e.removeAttribute(`data-invalid`),r||i){let t=document.createElement(`div`);t.className=`k-field__hint-row`,t.innerHTML=`<div class="k-field__hints">${r?`<p class="k-hint k-hint--error" id="${n}-error">${Q(r)}</p>`:``}${i?`<p class="k-hint" id="${n}-hint">${Q(i)}</p>`:``}</div>`,e.append(t)}let o=[a,r?`${n}-error`:null,i?`${n}-hint`:null].filter(Boolean).join(` `);o?t.setAttribute(`aria-describedby`,o):t.removeAttribute(`aria-describedby`),r?t.setAttribute(`aria-invalid`,`true`):t.removeAttribute(`aria-invalid`);let s=t.closest(`.k-input, .k-select, .k-otp`);s?.classList.contains(`k-input`)&&(r?s.setAttribute(`data-state`,`invalid`):s.getAttribute(`data-state`)===`invalid`&&s.removeAttribute(`data-state`))}function oe(e,t,n){let r=e.querySelector(`:scope > input[type=hidden][data-kashi-value]`);t?(r||(r=document.createElement(`input`),r.type=`hidden`,r.dataset.kashiValue=``,e.append(r)),r.name=t,r.value=n):r?.remove()}function se(e,t,n=`top`){let r=t;t.setAttribute(`data-placed`,``);try{r.showPopover&&!t.matches(`:popover-open`)&&r.showPopover()}catch{}let i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=getComputedStyle(e).direction===`rtl`,s=document.documentElement.clientWidth||innerWidth,c=innerHeight,l=n===`top`||n===`bottom`?n:n===`start`===o?`right`:`left`,u={top:i.top-8-8,bottom:c-i.bottom-8-8,left:i.left-8-8,right:s-i.right-8-8},d={top:`bottom`,bottom:`top`,left:`right`,right:`left`},f=l===`top`||l===`bottom`?a.height:a.width;u[l]<f&&u[d[l]]>u[l]&&(l=d[l]);let p,m;l===`top`||l===`bottom`?(p=Math.min(Math.max(i.left+i.width/2-a.width/2,8),s-a.width-8),m=l===`top`?i.top-8-a.height:i.bottom+8):(m=Math.min(Math.max(i.top+i.height/2-a.height/2,8),c-a.height-8),p=l===`left`?i.left-8-a.width:i.right+8),t.dataset.side=l;let h=e=>`${Math.round(e)}px`;t.style.setProperty(`--_x`,h(p)),t.style.setProperty(`--_y`,h(m)),t.style.setProperty(`--_ax`,h(Math.min(Math.max(i.left+i.width/2-p,10),a.width-10))),t.style.setProperty(`--_ay`,h(Math.min(Math.max(i.top+i.height/2-m,10),a.height-10)))}function ce(e){let t=e;try{t.hidePopover&&e.matches(`:popover-open`)&&t.hidePopover()}catch{}}export{x as A,w as C,D,C as E,r as M,n as N,S as O,t as P,l as S,y as T,ae as _,J as a,ce as b,ne as c,G as d,U as f,H as g,se as h,te as i,i as j,T as k,Q as l,q as m,re as n,R as o,W as p,B as r,K as s,N as t,ie as u,oe as v,E as w,o as x,X as y};
@@ -1 +1 @@
1
- import{_ as e,c as t,i as n,l as r,m as i,n as a,o,p as s,r as c,t as l,u,y as d}from"./base-D4tCOysh.js";const f=e=>`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 10S4.8 4.5 10 4.5 18.2 10 18.2 10 15.2 15.5 10 15.5 1.8 10 1.8 10Z"/><circle cx="10" cy="10" r="2.5"/>${e?`<path d="m3 3 14 14"/>`:``}</svg>`,p=[`name`,`placeholder`,`autocomplete`,`inputmode`,`maxlength`,`minlength`,`pattern`,`min`,`max`,`step`,`dir`,`spellcheck`];var m=class extends l{constructor(){super(...arguments),this.multiline=!1,this.key=d(`kashi-input`),this.text=``,this.revealed=!1,this.rendered=!1,this.valueSet=!1}connectedCallback(){!this.rendered&&!this.valueSet&&(this.text=this.getAttribute(`value`)??``),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n??``:(this.text=this.control.value,this.render()))}get value(){return this.rendered?this.control.value:this.text}set value(e){this.valueSet=!0,this.text=String(e??``),this.rendered&&(this.control.value=this.text,this.paint())}focus(e){this.control?.focus(e)}render(){let e=this.key,i=this.getAttribute(`aria-label`),a=this.getAttribute(`label`),o=this.getAttribute(`type`)??`text`,c=this.getAttribute(`size`),l=this.hasAttribute(`disabled`),d=!this.multiline&&this.getAttribute(`variant`)===`code`,f=p.map(e=>this.hasAttribute(e)?` ${e}="${r(this.getAttribute(e))}"`:``).join(``),m=`${this.hasAttribute(`required`)?` required`:``}${l?` disabled`:``}${this.hasAttribute(`readonly`)?` readonly`:``}${!a&&i?` aria-label="${r(i)}"`:``}`,h=this.multiline?`<textarea id="${e}" class="k-input__control" rows="${Number(this.getAttribute(`rows`))||4}"${f}${m}></textarea>`:`<input id="${e}" class="k-input__control" type="${r(o===`password`&&this.revealed?`text`:o)}"${f}${m}${d&&!this.hasAttribute(`spellcheck`)?` spellcheck="false" autocapitalize="off" autocorrect="off"`:``}${d&&!this.hasAttribute(`autocomplete`)?` autocomplete="off"`:``}>`,g=`<div class="k-input${d?` k-input--code`:``}${this.multiline?` k-input--textarea`:``}${n(this,`autoresize`)?` k-input--autoresize`:``}${c===`sm`||c===`lg`?` k-input--${c}`:``}" data-size="${c??`md`}"${l?` data-state="disabled"`:``}>${h}<span class="k-input__end"></span></div>`,_=this.getAttribute(`optional`);this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,u({id:e,label:a,required:this.hasAttribute(`required`),optional:_===null?null:_||s().common.optional,control:g})),this.control=this.querySelector(`.k-input__control`),this.control.value=this.text,this.control.addEventListener(`input`,()=>{this.paint(),t(this,`kashi-change`,{value:this.control.value})}),this.querySelector(`.k-input__end`).addEventListener(`click`,e=>{let n=e.target.closest(`button`);n&&(n.dataset.act===`clear`?(this.control.value=``,this.control.dispatchEvent(new Event(`input`,{bubbles:!0})),this.control.focus(),t(this,`kashi-clear`,{})):n.dataset.act===`reveal`&&(this.revealed=!this.revealed,this.control.type=this.revealed?`text`:`password`,this.paint(),n.focus()))}),this.rendered=!0,this.paint()}paint(){let t=this.control,a=t.value.length,o=this.hasAttribute(`disabled`)||this.hasAttribute(`readonly`),c=this.querySelector(`.k-input__end`),l=!this.multiline&&this.getAttribute(`type`)===`password`&&this.getAttribute(`revealable`)!==`false`;c.innerHTML=[n(this,`loading`)?'<span class="k-input__addon"><span class="k-spinner k-spinner--sm" role="status" aria-label="${esc(msg().input.checking)}"></span></span>':``,n(this,`clearable`)&&a>0&&!o?`<button type="button" class="k-input__action" data-act="clear" aria-label="${r(s().input.clear)}"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m6 6 8 8M14 6l-8 8"/></svg></button>`:``,l?`<button type="button" class="k-input__action" data-act="reveal" aria-label="${r(this.revealed?s().input.hide:s().input.show)}" aria-pressed="${this.revealed}">${f(this.revealed)}</button>`:``].join(``),c.style.display=c.innerHTML?`contents`:`none`;let u=this.querySelector(`:scope > .k-field`),d=`${this.key}-count`;if(e(u,t,this.key,this.getAttribute(`error`),this.getAttribute(`hint`),n(this,`show-count`)?d:null),n(this,`show-count`)){let e=Number(this.getAttribute(`maxlength`))||0,t=u.querySelector(`:scope > .k-field__hint-row`);t||(t=document.createElement(`div`),t.className=`k-field__hint-row`,t.innerHTML=`<div class="k-field__hints"></div>`,u.append(t)),t.insertAdjacentHTML(`beforeend`,`<span class="k-counter" id="${d}"${e&&a>e?` data-over=""`:``}>${e?`${i(this,a)} / ${i(this,e)}`:i(this,a)}</span>`)}}};m.observedAttributes=[`label`,`hint`,`error`,`type`,`required`,`disabled`,`readonly`,`clearable`,`revealable`,`show-count`,`loading`,`size`,`optional`,`aria-label`,`value`,`variant`,...p];var h=class extends m{constructor(){super(...arguments),this.multiline=!0}};h.observedAttributes=[...m.observedAttributes,`rows`,`autoresize`];var g=class extends l{constructor(){super(...arguments),this.box=null}connectedCallback(){c(()=>{if(!this.isConnected||this.box)return;let e=this.getAttribute(`remember`);e&&this.read(e)?this.hidden=!0:this.build()})}attributeChangedCallback(){this.box&&this.decorate()}read(e){try{return localStorage.getItem(`kashi-banner:${e}`)===`closed`}catch{return!1}}build(){let e=this.querySelector(`:scope > [slot='icon']`),t=[...this.querySelectorAll(`:scope > [slot='actions']`)],n=[...this.childNodes].filter(n=>n!==e&&!t.includes(n)),r=document.createElement(`div`);if(r.setAttribute(`role`,`region`),e){e.removeAttribute(`slot`);let t=document.createElement(`span`);t.className=`k-banner__icon`,t.setAttribute(`aria-hidden`,`true`),t.append(e),r.append(t)}let i=document.createElement(`p`);if(i.className=`k-banner__text`,i.append(...n),r.append(i),t.length){let e=document.createElement(`div`);e.className=`k-banner__actions`;for(let n of t)n.removeAttribute(`slot`),e.append(n);r.append(e)}this.replaceChildren(r),this.box=r,this.decorate()}decorate(){let e=this.box,t=this.getAttribute(`tone`);e.className=`k-banner${t&&t!==`neutral`?` k-banner--${t}`:``}${n(this,`flush`)?` k-banner--flush`:``}`,e.setAttribute(`aria-label`,this.getAttribute(`label`)??s().banner.label),e.querySelector(`.k-banner__close`)?.remove(),n(this,`dismissible`)&&(e.insertAdjacentHTML(`beforeend`,`<button type="button" class="k-btn k-btn--tertiary k-btn--icon k-btn--sm k-banner__close" aria-label="${r(this.getAttribute(`close-label`)??s().banner.close)}">${a.close}</button>`),e.querySelector(`.k-banner__close`).addEventListener(`click`,()=>this.close()))}close(){let e=new CustomEvent(`kashi-close`,{bubbles:!0,cancelable:!0,detail:{}});if(!this.dispatchEvent(e))return;this.hidden=!0;let t=this.getAttribute(`remember`);if(t)try{localStorage.setItem(`kashi-banner:${t}`,`closed`)}catch{}}};g.observedAttributes=[`tone`,`flush`,`label`,`dismissible`,`close-label`],o(`kashi-input`,m,`block`),o(`kashi-textarea`,h,`block`),o(`kashi-banner`,g,`block`);export{g as KashiBanner,m as KashiInput,h as KashiTextarea};
1
+ import{_ as e,c as t,i as n,l as r,m as i,n as a,o,p as s,r as c,t as l,u,y as d}from"./base-BqFAMlwG.js";const f=e=>`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 10S4.8 4.5 10 4.5 18.2 10 18.2 10 15.2 15.5 10 15.5 1.8 10 1.8 10Z"/><circle cx="10" cy="10" r="2.5"/>${e?`<path d="m3 3 14 14"/>`:``}</svg>`,p=[`name`,`placeholder`,`autocomplete`,`inputmode`,`maxlength`,`minlength`,`pattern`,`min`,`max`,`step`,`dir`,`spellcheck`];var m=class extends l{constructor(){super(...arguments),this.multiline=!1,this.key=d(`kashi-input`),this.text=``,this.revealed=!1,this.rendered=!1,this.valueSet=!1}connectedCallback(){!this.rendered&&!this.valueSet&&(this.text=this.getAttribute(`value`)??``),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n??``:(this.text=this.control.value,this.render()))}get value(){return this.rendered?this.control.value:this.text}set value(e){this.valueSet=!0,this.text=String(e??``),this.rendered&&(this.control.value=this.text,this.paint())}focus(e){this.control?.focus(e)}render(){let e=this.key,i=this.getAttribute(`aria-label`),a=this.getAttribute(`label`),o=this.getAttribute(`type`)??`text`,c=this.getAttribute(`size`),l=this.hasAttribute(`disabled`),d=!this.multiline&&this.getAttribute(`variant`)===`code`,f=p.map(e=>this.hasAttribute(e)?` ${e}="${r(this.getAttribute(e))}"`:``).join(``),m=`${this.hasAttribute(`required`)?` required`:``}${l?` disabled`:``}${this.hasAttribute(`readonly`)?` readonly`:``}${!a&&i?` aria-label="${r(i)}"`:``}`,h=this.multiline?`<textarea id="${e}" class="k-input__control" rows="${Number(this.getAttribute(`rows`))||4}"${f}${m}></textarea>`:`<input id="${e}" class="k-input__control" type="${r(o===`password`&&this.revealed?`text`:o)}"${f}${m}${d&&!this.hasAttribute(`spellcheck`)?` spellcheck="false" autocapitalize="off" autocorrect="off"`:``}${d&&!this.hasAttribute(`autocomplete`)?` autocomplete="off"`:``}>`,g=`<div class="k-input${d?` k-input--code`:``}${this.multiline?` k-input--textarea`:``}${n(this,`autoresize`)?` k-input--autoresize`:``}${c===`sm`||c===`lg`?` k-input--${c}`:``}" data-size="${c??`md`}"${l?` data-state="disabled"`:``}>${h}<span class="k-input__end"></span></div>`,_=this.getAttribute(`optional`);this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,u({id:e,label:a,required:this.hasAttribute(`required`),optional:_===null?null:_||s().common.optional,control:g})),this.control=this.querySelector(`.k-input__control`),this.control.value=this.text,this.control.addEventListener(`input`,()=>{this.paint(),t(this,`kashi-change`,{value:this.control.value})}),this.querySelector(`.k-input__end`).addEventListener(`click`,e=>{let n=e.target.closest(`button`);n&&(n.dataset.act===`clear`?(this.control.value=``,this.control.dispatchEvent(new Event(`input`,{bubbles:!0})),this.control.focus(),t(this,`kashi-clear`,{})):n.dataset.act===`reveal`&&(this.revealed=!this.revealed,this.control.type=this.revealed?`text`:`password`,this.paint(),n.focus()))}),this.rendered=!0,this.paint()}paint(){let t=this.control,a=t.value.length,o=this.hasAttribute(`disabled`)||this.hasAttribute(`readonly`),c=this.querySelector(`.k-input__end`),l=!this.multiline&&this.getAttribute(`type`)===`password`&&this.getAttribute(`revealable`)!==`false`;c.innerHTML=[n(this,`loading`)?'<span class="k-input__addon"><span class="k-spinner k-spinner--sm" role="status" aria-label="${esc(msg().input.checking)}"></span></span>':``,n(this,`clearable`)&&a>0&&!o?`<button type="button" class="k-input__action" data-act="clear" aria-label="${r(s().input.clear)}"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m6 6 8 8M14 6l-8 8"/></svg></button>`:``,l?`<button type="button" class="k-input__action" data-act="reveal" aria-label="${r(this.revealed?s().input.hide:s().input.show)}" aria-pressed="${this.revealed}">${f(this.revealed)}</button>`:``].join(``),c.style.display=c.innerHTML?`contents`:`none`;let u=this.querySelector(`:scope > .k-field`),d=`${this.key}-count`;if(e(u,t,this.key,this.getAttribute(`error`),this.getAttribute(`hint`),n(this,`show-count`)?d:null),n(this,`show-count`)){let e=Number(this.getAttribute(`maxlength`))||0,t=u.querySelector(`:scope > .k-field__hint-row`);t||(t=document.createElement(`div`),t.className=`k-field__hint-row`,t.innerHTML=`<div class="k-field__hints"></div>`,u.append(t)),t.insertAdjacentHTML(`beforeend`,`<span class="k-counter" id="${d}"${e&&a>e?` data-over=""`:``}>${e?`${i(this,a)} / ${i(this,e)}`:i(this,a)}</span>`)}}};m.observedAttributes=[`label`,`hint`,`error`,`type`,`required`,`disabled`,`readonly`,`clearable`,`revealable`,`show-count`,`loading`,`size`,`optional`,`aria-label`,`value`,`variant`,...p];var h=class extends m{constructor(){super(...arguments),this.multiline=!0}};h.observedAttributes=[...m.observedAttributes,`rows`,`autoresize`];var g=class extends l{constructor(){super(...arguments),this.box=null}connectedCallback(){c(()=>{if(!this.isConnected||this.box)return;let e=this.getAttribute(`remember`);e&&this.read(e)?this.hidden=!0:this.build()})}attributeChangedCallback(){this.box&&this.decorate()}read(e){try{return localStorage.getItem(`kashi-banner:${e}`)===`closed`}catch{return!1}}build(){let e=this.querySelector(`:scope > [slot='icon']`),t=[...this.querySelectorAll(`:scope > [slot='actions']`)],n=[...this.childNodes].filter(n=>n!==e&&!t.includes(n)),r=document.createElement(`div`);if(r.setAttribute(`role`,`region`),e){e.removeAttribute(`slot`);let t=document.createElement(`span`);t.className=`k-banner__icon`,t.setAttribute(`aria-hidden`,`true`),t.append(e),r.append(t)}let i=document.createElement(`p`);if(i.className=`k-banner__text`,i.append(...n),r.append(i),t.length){let e=document.createElement(`div`);e.className=`k-banner__actions`;for(let n of t)n.removeAttribute(`slot`),e.append(n);r.append(e)}this.replaceChildren(r),this.box=r,this.decorate()}decorate(){let e=this.box,t=this.getAttribute(`tone`);e.className=`k-banner${t&&t!==`neutral`?` k-banner--${t}`:``}${n(this,`flush`)?` k-banner--flush`:``}`,e.setAttribute(`aria-label`,this.getAttribute(`label`)??s().banner.label),e.querySelector(`.k-banner__close`)?.remove(),n(this,`dismissible`)&&(e.insertAdjacentHTML(`beforeend`,`<button type="button" class="k-btn k-btn--tertiary k-btn--icon k-btn--sm k-banner__close" aria-label="${r(this.getAttribute(`close-label`)??s().banner.close)}">${a.close}</button>`),e.querySelector(`.k-banner__close`).addEventListener(`click`,()=>this.close()))}close(){let e=new CustomEvent(`kashi-close`,{bubbles:!0,cancelable:!0,detail:{}});if(!this.dispatchEvent(e))return;this.hidden=!0;let t=this.getAttribute(`remember`);if(t)try{localStorage.setItem(`kashi-banner:${t}`,`closed`)}catch{}}};g.observedAttributes=[`tone`,`flush`,`label`,`dismissible`,`close-label`],o(`kashi-input`,m,`block`),o(`kashi-textarea`,h,`block`),o(`kashi-banner`,g,`block`);export{g as KashiBanner,m as KashiInput,h as KashiTextarea};