@getmicdrop/venue-calendar 4.3.7 → 4.3.9

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 (99) hide show
  1. package/dist/{ArrowLeftIcon-DvOokN4u.js → ArrowLeftIcon-B6RmtBIh.js} +1 -1
  2. package/dist/{Badge-Gg5PWs7f.js → Badge-DsuBHDo4.js} +1 -2
  3. package/dist/{BlockPlaceholder-C2PUGPNA.js → BlockPlaceholder-BvArmbbO.js} +2 -2
  4. package/dist/{Button-Cm6xkipe.js → Button-CxQO7vwF.js} +88 -63
  5. package/dist/{Calendar-BnqBcrZv.js → Calendar-Dei3Ahdk.js} +113 -105
  6. package/dist/{CalendarFoundryView-L97Allfg.js → CalendarFoundryView-Df10CTZS.js} +5398 -5389
  7. package/dist/{CalendarIcon-DvhQ-GaL.js → CalendarIcon-DJh5V_U9.js} +1 -1
  8. package/dist/CartView-DPzvlZwV.js +2245 -0
  9. package/dist/Checkout-CZGmzTDh.js +983 -0
  10. package/dist/{Checkout-DQWeMchu.js → Checkout-CaamQTXi.js} +368 -368
  11. package/dist/{CheckoutTimer-8tVmatUn.js → CheckoutTimer-BubF7ziC.js} +15 -15
  12. package/dist/{ChevronDownIcon-DyNmV5XZ.js → ChevronDownIcon-MTzda9yz.js} +1 -1
  13. package/dist/{ClockIcon-dOWVO61o.js → ClockIcon-Dit8R1GZ.js} +1 -1
  14. package/dist/{CloseIcon-a3S2RgbP.js → CloseIcon-XqvbBmiA.js} +1 -1
  15. package/dist/{CollectionView-CAMsmrmW.js → CollectionView-B_rrXaQH.js} +17 -17
  16. package/dist/CropImage-mVbYhD9Y.js +527 -0
  17. package/dist/{Event-BQgaaFkh.js → Event-WtVZMQfA.js} +585 -585
  18. package/dist/EventPage-B14U0-Hm.js +1147 -0
  19. package/dist/{Heading-cKAx0Ogl.js → Heading-PKl9dm72.js} +3 -4
  20. package/dist/{Image-CNZLcePz.js → Image-BWo4QBld.js} +12 -13
  21. package/dist/{Input-D1FpSX5Q.js → Input-Bl1wqeUH.js} +2 -2
  22. package/dist/{MailIcon-CR_eGi6n.js → MailIcon-DQTusrr4.js} +1 -1
  23. package/dist/{Modal-LkN8lh_m.js → Modal-CDIhIlu-.js} +2 -2
  24. package/dist/ModalFooter-DwkZn9ls.js +471 -0
  25. package/dist/ModalHeader-BSsyLaXY.js +18 -0
  26. package/dist/{PasswordInput-Bt6tvpzi.js → PasswordInput-CnjRiZJ7.js} +2 -2
  27. package/dist/{ScarcityBadge-g0dRh6K7.js → ScarcityBadge-B4e3Z_Oz.js} +24 -24
  28. package/dist/{SeriesPage-CNRwP2W0.js → SeriesPage-DszQMCy9.js} +5 -5
  29. package/dist/{Spinner-LroI7eOC.js → Spinner-BRgBJYJn.js} +2 -2
  30. package/dist/{Success--2NRdG0V.js → Success-BYVtvNeO.js} +106 -106
  31. package/dist/{TagIcon-BhLrURo_.js → TagIcon-BAZxGlbC.js} +1 -1
  32. package/dist/{ViewTicketsEmbed-CvuMdTA7.js → ViewTicketsEmbed-BHDAkYuv.js} +97 -97
  33. package/dist/{WarningCircleIcon-BxBY0OMQ.js → WarningCircleIcon-SBK0lpqR.js} +1 -1
  34. package/dist/{WarningTriIcon-QVzQiEM4.js → WarningTriIcon-Bj3xpe3S.js} +1 -1
  35. package/dist/{__SKIP_PATHS__-B0_APtpt.js → __SKIP_PATHS__-B3-kZeYN.js} +1 -1
  36. package/dist/api/api.cjs +1 -1
  37. package/dist/api/api.mjs +239 -237
  38. package/dist/{colors-BsP3TRan.js → api-CTiZ6rza.js} +243 -244
  39. package/dist/{browser-viCaCwoW.js → browser-CziWLQ0z.js} +1 -1
  40. package/dist/{constants-PBNG9ikv.js → constants-rFRS1lF-.js} +1 -1
  41. package/dist/{copyToClipboard-B2F5d6Cj.js → copyToClipboard-C5D-wCS_.js} +1 -1
  42. package/dist/{defaultLabels-BigaGqKj.js → defaultLabels-CpurXn7c.js} +337 -361
  43. package/dist/{event-rtg4-kWS.js → event-d06xVg2P.js} +1 -1
  44. package/dist/{event-transform-J7U1JmeK.js → event-transform-BjPTqPq1.js} +31 -31
  45. package/dist/{eventStatusStream-CJVT_9Gu.js → eventStatusStream-BhQUTdOZ.js} +2 -2
  46. package/dist/{href-Dx7B6ZiQ.js → href-DMLDnIDe.js} +3 -3
  47. package/dist/{i18n-sO8wTASy.js → i18n--3wPB7-n.js} +2 -2
  48. package/dist/{i18n-C0aOwSpF.js → i18n-CASpRf85.js} +135 -135
  49. package/dist/imageOptimizer-D8g9XVns.js +141 -0
  50. package/dist/{labels-BBFJnXep.js → labels-IV_I9087.js} +14 -14
  51. package/dist/modalManager.svelte-Cz_6x1Qd.js +37 -0
  52. package/dist/{order-totals-DR-oXumr.js → order-totals-Buq9HeZa.js} +33 -33
  53. package/dist/{orders-CFF0Hb2x.js → orders-BK47iONR.js} +2 -2
  54. package/dist/{phoneUtils-C2GGZYvA.js → phoneUtils-YjT5IJ25.js} +1 -1
  55. package/dist/{pixels-M4FTi1Of.js → pixels-DjK-0XYz.js} +3 -3
  56. package/dist/{promo--p3GbP64.js → promo-DkM9sLly.js} +1 -1
  57. package/dist/{serverTotals-Dbi69SIr.js → serverTotals-CvJBYArq.js} +1 -1
  58. package/dist/{shareCopyFeedback.svelte-Cb2Mdn0z.js → shareCopyFeedback.svelte-oxKGmiOe.js} +65 -65
  59. package/dist/{showcase-state-options-BZGCm4wo.js → showcase-state-options-x_9iSBsd.js} +1 -1
  60. package/dist/{to-event-card-props-dIhKdERf.js → to-event-card-props-9y7sVBi_.js} +49 -49
  61. package/dist/types/index.d.ts +39 -0
  62. package/dist/{utils-CbacksjX.js → utils-D80jLqKH.js} +3 -3
  63. package/dist/venue-calendar.css +1 -1
  64. package/dist/venue-calendar.es.js +1515 -1506
  65. package/dist/venue-calendar.iife.js +54 -54
  66. package/dist/venue-calendar.umd.js +54 -54
  67. package/package.json +2 -2
  68. package/dist/CartView-D57bwixz.js +0 -2245
  69. package/dist/Checkout-wUH2YI1N.js +0 -980
  70. package/dist/CropImage-CxLcNArr.js +0 -445
  71. package/dist/EventPage-B9shaVEP.js +0 -1146
  72. package/dist/ModalFooter-B_8f1Z5p.js +0 -301
  73. package/dist/imageOptimizer-BwLwBMI6.js +0 -112
  74. package/dist/modalManager.svelte-B9mhX1cG.js +0 -53
  75. package/dist/portal-DqxEuE-7.js +0 -166
  76. /package/dist/locales/{4.3.7 → 4.3.9}/flow/de.js +0 -0
  77. /package/dist/locales/{4.3.7 → 4.3.9}/flow/es.js +0 -0
  78. /package/dist/locales/{4.3.7 → 4.3.9}/flow/fr.js +0 -0
  79. /package/dist/locales/{4.3.7 → 4.3.9}/flow/id.js +0 -0
  80. /package/dist/locales/{4.3.7 → 4.3.9}/flow/it.js +0 -0
  81. /package/dist/locales/{4.3.7 → 4.3.9}/flow/ja.js +0 -0
  82. /package/dist/locales/{4.3.7 → 4.3.9}/flow/ko.js +0 -0
  83. /package/dist/locales/{4.3.7 → 4.3.9}/flow/nl.js +0 -0
  84. /package/dist/locales/{4.3.7 → 4.3.9}/flow/pl.js +0 -0
  85. /package/dist/locales/{4.3.7 → 4.3.9}/flow/pt-br.js +0 -0
  86. /package/dist/locales/{4.3.7 → 4.3.9}/flow/tr.js +0 -0
  87. /package/dist/locales/{4.3.7 → 4.3.9}/flow/zh.js +0 -0
  88. /package/dist/locales/{4.3.7 → 4.3.9}/main/de.js +0 -0
  89. /package/dist/locales/{4.3.7 → 4.3.9}/main/es.js +0 -0
  90. /package/dist/locales/{4.3.7 → 4.3.9}/main/fr.js +0 -0
  91. /package/dist/locales/{4.3.7 → 4.3.9}/main/id.js +0 -0
  92. /package/dist/locales/{4.3.7 → 4.3.9}/main/it.js +0 -0
  93. /package/dist/locales/{4.3.7 → 4.3.9}/main/ja.js +0 -0
  94. /package/dist/locales/{4.3.7 → 4.3.9}/main/ko.js +0 -0
  95. /package/dist/locales/{4.3.7 → 4.3.9}/main/nl.js +0 -0
  96. /package/dist/locales/{4.3.7 → 4.3.9}/main/pl.js +0 -0
  97. /package/dist/locales/{4.3.7 → 4.3.9}/main/pt-br.js +0 -0
  98. /package/dist/locales/{4.3.7 → 4.3.9}/main/tr.js +0 -0
  99. /package/dist/locales/{4.3.7 → 4.3.9}/main/zh.js +0 -0
@@ -1,445 +0,0 @@
1
- import { C as e, b as t, t as n, v as r } from "./Button-Cm6xkipe.js";
2
- import { t as i } from "./CloseOutline-qpVa62mu.js";
3
- import { a, i as o, r as s, t as c } from "./imageOptimizer-BwLwBMI6.js";
4
- import { t as l } from "./z-index-BgKs9X9U.js";
5
- import { n as u } from "./keyboard-fiZFqeNA.js";
6
- import "svelte/internal/disclose-version";
7
- import * as d from "svelte/internal/client";
8
- import { MediaQuery as f } from "svelte/reactivity";
9
- import { onDestroy as p, onMount as m } from "svelte";
10
- //#region node_modules/@getmicdrop/svelte-components/dist/primitives/Icons/MinusOutline.svelte
11
- var h = d.from_svg("<svg aria-hidden=\"true\" fill=\"none\" stroke-width=\"2\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M19.5 12h-15\"></path></svg>");
12
- function g(e, t) {
13
- let n = d.prop(t, "size", 3, "24"), r = d.prop(t, "color", 3, "currentColor"), i = d.prop(t, "class", 3, "");
14
- var a = h();
15
- d.template_effect(() => {
16
- d.set_class(a, 0, d.clsx(i())), d.set_attribute(a, "width", n()), d.set_attribute(a, "height", n()), d.set_attribute(a, "stroke", r());
17
- }), d.append(e, a);
18
- }
19
- //#endregion
20
- //#region node_modules/svelte-easy-crop/dist/helpers.js
21
- function _(e, t, n) {
22
- return e >= t * n ? {
23
- width: t * n,
24
- height: t
25
- } : {
26
- width: e,
27
- height: e / n
28
- };
29
- }
30
- function v(e, t, n, r) {
31
- return {
32
- x: y(e.x, t.width, n.width, r),
33
- y: y(e.y, t.height, n.height, r)
34
- };
35
- }
36
- function y(e, t, n, r) {
37
- let i = Math.abs(t * r / 2 - n / 2);
38
- return Math.min(i, Math.max(e, -i));
39
- }
40
- function b(e, t) {
41
- return Math.sqrt((e.y - t.y) ** 2 + (e.x - t.x) ** 2);
42
- }
43
- function x(e, t, n, r, i, a = !0) {
44
- let o = a ? S : C, s = {
45
- x: o(100, ((t.width - n.width / i) / 2 - e.x / i) / t.width * 100),
46
- y: o(100, ((t.height - n.height / i) / 2 - e.y / i) / t.height * 100),
47
- width: o(100, n.width / t.width * 100 / i),
48
- height: o(100, n.height / t.height * 100 / i)
49
- }, c = o(t.naturalWidth, s.width * t.naturalWidth / 100, !0), l = o(t.naturalHeight, s.height * t.naturalHeight / 100, !0), u = t.naturalWidth >= t.naturalHeight * r ? {
50
- width: Math.round(l * r),
51
- height: l
52
- } : {
53
- width: c,
54
- height: Math.round(c / r)
55
- };
56
- return {
57
- croppedAreaPercentages: s,
58
- croppedAreaPixels: {
59
- ...u,
60
- x: o(t.naturalWidth - u.width, s.x * t.naturalWidth / 100, !0),
61
- y: o(t.naturalHeight - u.height, s.y * t.naturalHeight / 100, !0)
62
- }
63
- };
64
- }
65
- function S(e, t, n = !1) {
66
- return Math.min(e, Math.max(0, n ? Math.round(t) : t));
67
- }
68
- function C(e, t) {
69
- return t;
70
- }
71
- function w(e, t) {
72
- return {
73
- x: (t.x + e.x) / 2,
74
- y: (t.y + e.y) / 2
75
- };
76
- }
77
- //#endregion
78
- //#region node_modules/svelte-easy-crop/dist/Cropper.svelte
79
- var T = d.from_html("<div data-testid=\"cropper\"></div>"), E = d.from_html("<div class=\"svelte-easy-crop-container svelte-1yetlj5\" role=\"button\" data-testid=\"container\"><img class=\"svelte-easy-crop-image svelte-1yetlj5\" alt=\"\"/> <!></div>");
80
- function D(e, t) {
81
- d.push(t, !0);
82
- let n = d.prop(t, "crop", 31, () => d.proxy({
83
- x: 0,
84
- y: 0
85
- })), r = d.prop(t, "zoom", 15, 1), i = d.prop(t, "minZoom", 11, 1), a = d.prop(t, "maxZoom", 11, 3), o = d.prop(t, "aspect", 3, 4 / 3), s = d.prop(t, "cropSize", 3, null), c = d.prop(t, "cropShape", 3, "rect"), l = d.prop(t, "showGrid", 3, !0), u = d.prop(t, "zoomSpeed", 3, 1), f = d.prop(t, "crossOrigin", 3, null), h = d.prop(t, "restrictPosition", 3, !0), g = d.prop(t, "tabindex", 3, void 0), y = d.state(null), S = d.state(d.proxy({
86
- width: 0,
87
- height: 0,
88
- naturalWidth: 0,
89
- naturalHeight: 0
90
- })), C = d.state(null), D = d.state(null), O = d.state(null), k = d.state(d.proxy({
91
- x: 0,
92
- y: 0
93
- })), A = d.state(d.proxy({
94
- x: 0,
95
- y: 0
96
- })), j = d.state(0), M = d.state(null), N = d.state(null);
97
- m(() => {
98
- d.get(O) && d.get(O).complete && I(), d.get(C) && (d.get(C).addEventListener("gesturestart", P), d.get(C).addEventListener("gesturechange", P));
99
- }), p(() => {
100
- d.get(C) && (d.get(C).removeEventListener("gesturestart", P), d.get(C).removeEventListener("gesturechange", P)), F();
101
- });
102
- let P = (e) => e.preventDefault(), F = () => {
103
- typeof document < "u" && (document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", q), document.removeEventListener("touchmove", W), document.removeEventListener("touchend", q));
104
- }, I = () => {
105
- R(), Z();
106
- }, L = () => s() ? s().width / s().height : o(), R = () => {
107
- d.get(O) && (d.set(S, {
108
- width: d.get(O).width,
109
- height: d.get(O).height,
110
- naturalWidth: d.get(O).naturalWidth,
111
- naturalHeight: d.get(O).naturalHeight
112
- }, !0), d.set(y, s() ? s() : _(d.get(O).width, d.get(O).height, o()), !0)), d.get(C) && d.set(D, d.get(C).getBoundingClientRect(), !0);
113
- }, z = (e) => ({
114
- x: Number(e.clientX),
115
- y: Number(e.clientY)
116
- }), B = (e) => ({
117
- x: Number(e.clientX),
118
- y: Number(e.clientY)
119
- }), V = (e) => {
120
- e.preventDefault(), document.addEventListener("mousemove", H), document.addEventListener("mouseup", q), G(z(e));
121
- }, H = (e) => K(z(e)), U = (e) => {
122
- e.preventDefault(), document.addEventListener("touchmove", W, { passive: !1 }), document.addEventListener("touchend", q), e.touches.length === 2 ? J(e) : e.touches.length === 1 && G(B(e.touches[0]));
123
- }, W = (e) => {
124
- e.preventDefault(), e.touches.length === 2 ? ee(e) : e.touches.length === 1 && K(B(e.touches[0]));
125
- }, G = ({ x: e, y: t }) => {
126
- d.set(k, {
127
- x: e,
128
- y: t
129
- }, !0), d.set(A, {
130
- x: n().x,
131
- y: n().y
132
- }, !0);
133
- }, K = ({ x: e, y: t }) => {
134
- d.get(M) && window.cancelAnimationFrame(d.get(M)), d.set(M, window.requestAnimationFrame(() => {
135
- if (e === void 0 || t === void 0 || !d.get(y)) return;
136
- let i = e - d.get(k).x, a = t - d.get(k).y, o = {
137
- x: d.get(A).x + i,
138
- y: d.get(A).y + a
139
- };
140
- n(h() ? v(o, d.get(S), d.get(y), r()) : o);
141
- }), !0);
142
- }, q = () => {
143
- F(), Z();
144
- }, J = (e) => {
145
- let t = B(e.touches[0]), n = B(e.touches[1]);
146
- d.set(j, b(t, n), !0), G(w(t, n));
147
- }, ee = (e) => {
148
- let t = B(e.touches[0]), n = B(e.touches[1]), i = w(t, n);
149
- K(i), d.get(N) && window.cancelAnimationFrame(d.get(N)), d.set(N, window.requestAnimationFrame(() => {
150
- let e = b(t, n), a = r() * (e / d.get(j));
151
- X(a, i), d.set(j, e, !0);
152
- }), !0);
153
- }, Y = (e) => {
154
- e.preventDefault();
155
- let t = z(e), n = r() - e.deltaY * u() / 200;
156
- X(n, t);
157
- }, te = ({ x: e, y: t }) => {
158
- if (!d.get(D)) throw Error("The Cropper is not mounted");
159
- return {
160
- x: d.get(D).width / 2 - (e - d.get(D).left),
161
- y: d.get(D).height / 2 - (t - d.get(D).top)
162
- };
163
- }, ne = ({ x: e, y: t }) => ({
164
- x: (e + n().x) / r(),
165
- y: (t + n().y) / r()
166
- }), X = (e, t) => {
167
- if (!d.get(y)) return;
168
- let o = te(t), s = ne(o);
169
- r(Math.min(a(), Math.max(e, i())));
170
- let c = {
171
- x: s.x * r() - o.x,
172
- y: s.y * r() - o.y
173
- };
174
- n(h() ? v(c, d.get(S), d.get(y), r()) : c);
175
- }, Z = () => {
176
- if (!d.get(y) || d.get(y).width === 0) return;
177
- let { croppedAreaPercentages: e, croppedAreaPixels: i } = x(h() ? v(n(), d.get(S), d.get(y), r()) : n(), d.get(S), d.get(y), L(), r(), h());
178
- t.oncropcomplete?.({
179
- percent: e,
180
- pixels: i
181
- });
182
- };
183
- d.user_effect(() => {
184
- d.get(O) && d.set(y, s() ? s() : _(d.get(O).width, d.get(O).height, o()), !0);
185
- }), d.user_effect(() => {
186
- r() && Z();
187
- });
188
- let re = (e) => {
189
- d.user_effect(() => (e.addEventListener("touchstart", U), e.addEventListener("mousedown", V), e.addEventListener("wheel", Y, { passive: !1 }), () => {
190
- e.removeEventListener("touchstart", U), e.removeEventListener("mousedown", V), e.removeEventListener("wheel", Y);
191
- }));
192
- };
193
- var Q = E();
194
- d.event("resize", d.window, R);
195
- var $ = d.child(Q);
196
- d.bind_this($, (e) => d.set(O, e), () => d.get(O));
197
- var ie = d.sibling($, 2), ae = (e) => {
198
- var t = T();
199
- let n;
200
- d.template_effect(() => {
201
- n = d.set_class(t, 1, "svelte-easy-crop-area svelte-1yetlj5", null, n, {
202
- "svelte-easy-crop-round": c() === "round",
203
- "svelte-easy-crop-grid": l()
204
- }), d.set_style(t, `width: ${d.get(y).width ?? ""}px; height: ${d.get(y).height ?? ""}px;`);
205
- }), d.append(e, t);
206
- };
207
- d.if(ie, (e) => {
208
- d.get(y) && e(ae);
209
- }), d.reset(Q), d.bind_this(Q, (e) => d.set(C, e), () => d.get(C)), d.action(Q, (e) => re?.(e)), d.template_effect(() => {
210
- d.set_attribute(Q, "tabindex", g()), d.set_attribute($, "src", t.image), d.set_style($, `transform: translate(${n().x ?? ""}px, ${n().y ?? ""}px) scale(${r() ?? ""});`), d.set_attribute($, "crossorigin", f());
211
- }), d.event("load", $, I), d.replay_events($), d.append(e, Q), d.pop();
212
- }
213
- //#endregion
214
- //#region node_modules/svelte-easy-crop/dist/index.js
215
- var O = D, k = d.from_html("<div class=\"absolute inset-0 flex items-center justify-center bg-bg-tertiary z-sticky\"><span> </span></div>"), A = d.from_html("<div><!> <!></div> <div class=\"flex-1 space-y-4\"><p> </p> <div class=\"flex items-center justify-center gap-3 max-w-xs mx-auto\"><!> <input type=\"range\" min=\"1\" max=\"3\" step=\"0.1\" class=\"flex-1 w-full h-2 bg-bg-tertiary rounded-lg appearance-none cursor-pointer accent-primary\" data-purpose=\"ui-only\"/> <!></div></div>", 1), j = d.from_html("<!> <!>", 1), M = d.from_html("<div class=\"flex gap-3\"><!></div>"), N = d.from_html("<div class=\"flex flex-col gap-4 landscape:flex-row landscape:items-center landscape:gap-6\"><!></div>"), P = d.from_html("<div class=\"fixed inset-0 flex items-center justify-center overflow-y-auto overflow-x-hidden bg-bg-primary/50 p-4\" role=\"presentation\"><div class=\"relative w-full max-w-lg max-h-full\" data-escape-layer=\"\"><div class=\"relative bg-card rounded-lg shadow-xl\"><div class=\"flex items-center justify-between p-4 border-b border-border rounded-t-lg\"><h3> </h3> <!></div> <div class=\"p-4 md:p-6 space-y-4\"><!></div> <div class=\"flex items-center justify-end gap-3 p-4 border-t border-border rounded-b-lg\"><!></div></div></div></div>");
216
- function F(p, m) {
217
- d.push(m, !0);
218
- let h = (e, t = d.noop) => {
219
- var i = A(), o = d.first_child(i), s = d.child(o), c = (e) => {
220
- var t = k(), n = d.child(t), i = d.child(n, !0);
221
- d.reset(n), d.reset(t), d.template_effect(() => {
222
- d.set_class(n, 1, d.clsx(r.smMuted)), d.set_text(i, d.get(D).loading);
223
- }), d.append(e, t);
224
- };
225
- d.if(s, (e) => {
226
- d.get(R) && e(c);
227
- }), O(d.sibling(s, 2), {
228
- get image() {
229
- return S();
230
- },
231
- aspect: 1,
232
- minZoom: 1,
233
- maxZoom: 3,
234
- showGrid: !0,
235
- oncropcomplete: B,
236
- get crop() {
237
- return d.get(F);
238
- },
239
- set crop(e) {
240
- d.set(F, e, !0);
241
- },
242
- get zoom() {
243
- return d.get(I);
244
- },
245
- set zoom(e) {
246
- d.set(I, e, !0);
247
- }
248
- }), d.reset(o);
249
- var l = d.sibling(o, 2), u = d.child(l), f = d.child(u, !0);
250
- d.reset(u);
251
- var p = d.sibling(u, 2), m = d.child(p);
252
- n(m, {
253
- variant: "outline",
254
- size: "sm",
255
- class: "rounded-full! w-9! h-9! p-0! shrink-0",
256
- onclick: () => d.set(I, Math.max(1, d.get(I) - .2), !0),
257
- get "aria-label"() {
258
- return d.get(D).zoomOut;
259
- },
260
- children: (e, t) => {
261
- g(e, { class: "w-4 h-4" });
262
- },
263
- $$slots: { default: !0 }
264
- });
265
- var h = d.sibling(m, 2);
266
- d.remove_input_defaults(h);
267
- var _ = d.sibling(h, 2);
268
- n(_, {
269
- variant: "outline",
270
- size: "sm",
271
- class: "rounded-full! w-9! h-9! p-0! shrink-0",
272
- onclick: () => d.set(I, Math.min(3, d.get(I) + .2), !0),
273
- get "aria-label"() {
274
- return d.get(D).zoomIn;
275
- },
276
- children: (e, t) => {
277
- a(e, { class: "w-4 h-4" });
278
- },
279
- $$slots: { default: !0 }
280
- }), d.reset(p), d.reset(l), d.template_effect(() => {
281
- d.set_class(o, 1, d.clsx(t())), d.set_class(u, 1, `${r.smMuted} text-center`), d.set_text(f, d.get(D).dragToPosition), d.set_attribute(h, "aria-label", d.get(D).zoomLevel);
282
- }), d.bind_value(h, () => d.get(I), (e) => d.set(I, e)), d.append(e, i);
283
- }, _ = (e, t = d.noop) => {
284
- var r = j(), i = d.first_child(r);
285
- {
286
- let e = d.derived(() => d.get(z) || C());
287
- n(i, {
288
- type: "button",
289
- variant: "alternative",
290
- size: "md",
291
- get class() {
292
- return t();
293
- },
294
- onclick: H,
295
- get disabled() {
296
- return d.get(e);
297
- },
298
- children: (e, t) => {
299
- d.next();
300
- var n = d.text();
301
- d.template_effect(() => d.set_text(n, d.get(D).cancel)), d.append(e, n);
302
- },
303
- $$slots: { default: !0 }
304
- });
305
- }
306
- var a = d.sibling(i, 2);
307
- {
308
- let e = d.derived(() => d.get(R) || d.get(z) || C());
309
- n(a, {
310
- type: "button",
311
- size: "md",
312
- get class() {
313
- return t();
314
- },
315
- onclick: V,
316
- get disabled() {
317
- return d.get(e);
318
- },
319
- children: (e, t) => {
320
- var n = d.comment(), r = d.first_child(n), i = (e) => {
321
- var t = d.text();
322
- d.template_effect(() => d.set_text(t, d.get(D).uploading)), d.append(e, t);
323
- }, a = (e) => {
324
- var t = d.text();
325
- d.template_effect(() => d.set_text(t, d.get(D).save)), d.append(e, t);
326
- };
327
- d.if(r, (e) => {
328
- d.get(z) || C() ? e(i) : e(a, -1);
329
- }), d.append(e, n);
330
- },
331
- $$slots: { default: !0 }
332
- });
333
- }
334
- d.append(e, r);
335
- }, v = d.state(void 0), y = new f("(max-width: 767px), (max-height: 500px)", !1), b = {
336
- cropImageTitle: "Crop image",
337
- loading: "Loading...",
338
- dragToPosition: "Drag to position. Pinch or use slider to zoom.",
339
- cancel: "Cancel",
340
- uploading: "Uploading...",
341
- save: "Save",
342
- closeModal: "Close modal",
343
- zoomOut: "Zoom out",
344
- zoomIn: "Zoom in",
345
- zoomLevel: "Zoom level"
346
- }, x = d.prop(m, "showModal", 15, !1), S = d.prop(m, "imageSrc", 15, ""), C = d.prop(m, "isUploadingImage", 3, !1), w = d.prop(m, "labels", 19, () => ({}));
347
- m.onSave && !m.onsave && t("CropImage: prop \"onSave\" is deprecated. Use \"onsave\" instead."), m.onCancel && !m.oncancel && t("CropImage: prop \"onCancel\" is deprecated. Use \"oncancel\" instead.");
348
- let T = d.derived(() => m.onsave ?? m.onSave ?? (() => {})), E = d.derived(() => m.oncancel ?? m.onCancel ?? (() => {})), D = d.derived(() => e(b, w())), F = d.state(d.proxy({
349
- x: 0,
350
- y: 0
351
- })), I = d.state(1), L = d.state(null), R = d.state(!0), z = d.state(!1);
352
- d.user_effect(() => {
353
- x() && S() && (d.set(F, {
354
- x: 0,
355
- y: 0
356
- }, !0), d.set(I, 1), d.set(L, null), d.set(R, !0), d.set(z, !1));
357
- });
358
- function B(e) {
359
- d.set(L, e.pixels, !0), d.set(R, !1);
360
- }
361
- async function V() {
362
- if (!d.get(L) || d.get(z)) return;
363
- d.set(z, !0);
364
- let e = await U(S(), d.get(L));
365
- d.get(T)(e);
366
- }
367
- function H() {
368
- x(!1), S(""), d.set(F, {
369
- x: 0,
370
- y: 0
371
- }, !0), d.set(I, 1), d.set(L, null), d.set(z, !1), d.get(E)();
372
- }
373
- async function U(e, t) {
374
- let n = await c(e), r = document.createElement("canvas"), i = r.getContext("2d"), a = 1e3;
375
- r.width = a, r.height = a, i.imageSmoothingEnabled = !0, i.imageSmoothingQuality = "high", i.drawImage(n, t.x, t.y, t.width, t.height, 0, 0, a, a);
376
- let o = s(), l = o ? "image/webp" : "image/jpeg", u = o ? .8 : .85, d = o ? "webp" : "jpg";
377
- return new Promise((e) => {
378
- r.toBlob((t) => {
379
- e(new File([t], `cropped-image.${d}`, { type: l }));
380
- }, l, u);
381
- });
382
- }
383
- var W = d.comment();
384
- d.event("keydown", d.window, (e) => {
385
- x() && !y.current && u(e, d.get(v)) && (e.preventDefault(), H());
386
- });
387
- var G = d.first_child(W), K = (e) => {
388
- o(e, {
389
- get open() {
390
- return x();
391
- },
392
- get title() {
393
- return d.get(D).cropImageTitle;
394
- },
395
- alwaysSheet: !0,
396
- onclose: () => {
397
- !d.get(z) && !C() && H();
398
- },
399
- actions: (e) => {
400
- var t = M(), n = d.child(t);
401
- _(n, () => "flex-1"), d.reset(t), d.append(e, t);
402
- },
403
- children: (e, t) => {
404
- var n = N(), r = d.child(n);
405
- h(r, () => "relative w-full max-w-[50dvh] landscape:max-w-[35dvh] shrink-0 mx-auto aspect-square bg-bg-secondary rounded-lg overflow-hidden"), d.reset(n), d.append(e, n);
406
- },
407
- $$slots: {
408
- actions: !0,
409
- default: !0
410
- }
411
- });
412
- }, q = (e) => {
413
- var t = P();
414
- let a;
415
- var o = d.child(t), s = d.child(o), c = d.child(s), u = d.child(c), f = d.child(u, !0);
416
- d.reset(u);
417
- var p = d.sibling(u, 2);
418
- n(p, {
419
- variant: "icon",
420
- size: "sm",
421
- onclick: H,
422
- get "aria-label"() {
423
- return d.get(D).closeModal;
424
- },
425
- children: (e, t) => {
426
- i(e, { class: "w-3 h-3" });
427
- },
428
- $$slots: { default: !0 }
429
- }), d.reset(c);
430
- var m = d.sibling(c, 2), g = d.child(m);
431
- h(g, () => "relative w-full aspect-square sm:aspect-[4/3] max-h-80 sm:max-h-96 bg-bg-secondary rounded-lg overflow-hidden"), d.reset(m);
432
- var y = d.sibling(m, 2), b = d.child(y);
433
- _(b, () => ""), d.reset(y), d.reset(s), d.reset(o), d.bind_this(o, (e) => d.set(v, e), () => d.get(v)), d.reset(t), d.template_effect(() => {
434
- a = d.set_style(t, "", a, { "z-index": l.modal }), d.set_class(u, 1, d.clsx(r.h2)), d.set_text(f, d.get(D).cropImageTitle);
435
- }), d.delegated("click", t, (e) => {
436
- e.target === e.currentTarget && H();
437
- }), d.append(e, t);
438
- };
439
- d.if(G, (e) => {
440
- y.current ? e(K) : x() && e(q, 1);
441
- }), d.append(p, W), d.pop();
442
- }
443
- d.delegate(["click"]);
444
- //#endregion
445
- export { F as default };