@rubenpazch/image-viewer 0.0.0-stage → 1.1.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.
@@ -0,0 +1,811 @@
1
+ import require$$0, { useState, useRef, useCallback, useEffect } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+
4
+ var jsxRuntime = {exports: {}};
5
+
6
+ var reactJsxRuntime_production = {};
7
+
8
+ /**
9
+ * @license React
10
+ * react-jsx-runtime.production.js
11
+ *
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+
18
+ var hasRequiredReactJsxRuntime_production;
19
+
20
+ function requireReactJsxRuntime_production () {
21
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
22
+ hasRequiredReactJsxRuntime_production = 1;
23
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
24
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
25
+ function jsxProd(type, config, maybeKey) {
26
+ var key = null;
27
+ void 0 !== maybeKey && (key = "" + maybeKey);
28
+ void 0 !== config.key && (key = "" + config.key);
29
+ if ("key" in config) {
30
+ maybeKey = {};
31
+ for (var propName in config)
32
+ "key" !== propName && (maybeKey[propName] = config[propName]);
33
+ } else maybeKey = config;
34
+ config = maybeKey.ref;
35
+ return {
36
+ $$typeof: REACT_ELEMENT_TYPE,
37
+ type: type,
38
+ key: key,
39
+ ref: void 0 !== config ? config : null,
40
+ props: maybeKey
41
+ };
42
+ }
43
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
44
+ reactJsxRuntime_production.jsx = jsxProd;
45
+ reactJsxRuntime_production.jsxs = jsxProd;
46
+ return reactJsxRuntime_production;
47
+ }
48
+
49
+ var reactJsxRuntime_development = {};
50
+
51
+ /**
52
+ * @license React
53
+ * react-jsx-runtime.development.js
54
+ *
55
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
56
+ *
57
+ * This source code is licensed under the MIT license found in the
58
+ * LICENSE file in the root directory of this source tree.
59
+ */
60
+
61
+ var hasRequiredReactJsxRuntime_development;
62
+
63
+ function requireReactJsxRuntime_development () {
64
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
65
+ hasRequiredReactJsxRuntime_development = 1;
66
+ "production" !== process.env.NODE_ENV &&
67
+ (function () {
68
+ function getComponentNameFromType(type) {
69
+ if (null == type) return null;
70
+ if ("function" === typeof type)
71
+ return type.$$typeof === REACT_CLIENT_REFERENCE
72
+ ? null
73
+ : type.displayName || type.name || null;
74
+ if ("string" === typeof type) return type;
75
+ switch (type) {
76
+ case REACT_FRAGMENT_TYPE:
77
+ return "Fragment";
78
+ case REACT_PROFILER_TYPE:
79
+ return "Profiler";
80
+ case REACT_STRICT_MODE_TYPE:
81
+ return "StrictMode";
82
+ case REACT_SUSPENSE_TYPE:
83
+ return "Suspense";
84
+ case REACT_SUSPENSE_LIST_TYPE:
85
+ return "SuspenseList";
86
+ case REACT_ACTIVITY_TYPE:
87
+ return "Activity";
88
+ }
89
+ if ("object" === typeof type)
90
+ switch (
91
+ ("number" === typeof type.tag &&
92
+ console.error(
93
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
94
+ ),
95
+ type.$$typeof)
96
+ ) {
97
+ case REACT_PORTAL_TYPE:
98
+ return "Portal";
99
+ case REACT_CONTEXT_TYPE:
100
+ return type.displayName || "Context";
101
+ case REACT_CONSUMER_TYPE:
102
+ return (type._context.displayName || "Context") + ".Consumer";
103
+ case REACT_FORWARD_REF_TYPE:
104
+ var innerType = type.render;
105
+ type = type.displayName;
106
+ type ||
107
+ ((type = innerType.displayName || innerType.name || ""),
108
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
109
+ return type;
110
+ case REACT_MEMO_TYPE:
111
+ return (
112
+ (innerType = type.displayName || null),
113
+ null !== innerType
114
+ ? innerType
115
+ : getComponentNameFromType(type.type) || "Memo"
116
+ );
117
+ case REACT_LAZY_TYPE:
118
+ innerType = type._payload;
119
+ type = type._init;
120
+ try {
121
+ return getComponentNameFromType(type(innerType));
122
+ } catch (x) {}
123
+ }
124
+ return null;
125
+ }
126
+ function testStringCoercion(value) {
127
+ return "" + value;
128
+ }
129
+ function checkKeyStringCoercion(value) {
130
+ try {
131
+ testStringCoercion(value);
132
+ var JSCompiler_inline_result = !1;
133
+ } catch (e) {
134
+ JSCompiler_inline_result = true;
135
+ }
136
+ if (JSCompiler_inline_result) {
137
+ JSCompiler_inline_result = console;
138
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
139
+ var JSCompiler_inline_result$jscomp$0 =
140
+ ("function" === typeof Symbol &&
141
+ Symbol.toStringTag &&
142
+ value[Symbol.toStringTag]) ||
143
+ value.constructor.name ||
144
+ "Object";
145
+ JSCompiler_temp_const.call(
146
+ JSCompiler_inline_result,
147
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
148
+ JSCompiler_inline_result$jscomp$0
149
+ );
150
+ return testStringCoercion(value);
151
+ }
152
+ }
153
+ function getTaskName(type) {
154
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
155
+ if (
156
+ "object" === typeof type &&
157
+ null !== type &&
158
+ type.$$typeof === REACT_LAZY_TYPE
159
+ )
160
+ return "<...>";
161
+ try {
162
+ var name = getComponentNameFromType(type);
163
+ return name ? "<" + name + ">" : "<...>";
164
+ } catch (x) {
165
+ return "<...>";
166
+ }
167
+ }
168
+ function getOwner() {
169
+ var dispatcher = ReactSharedInternals.A;
170
+ return null === dispatcher ? null : dispatcher.getOwner();
171
+ }
172
+ function UnknownOwner() {
173
+ return Error("react-stack-top-frame");
174
+ }
175
+ function hasValidKey(config) {
176
+ if (hasOwnProperty.call(config, "key")) {
177
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
178
+ if (getter && getter.isReactWarning) return false;
179
+ }
180
+ return void 0 !== config.key;
181
+ }
182
+ function defineKeyPropWarningGetter(props, displayName) {
183
+ function warnAboutAccessingKey() {
184
+ specialPropKeyWarningShown ||
185
+ ((specialPropKeyWarningShown = true),
186
+ console.error(
187
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
188
+ displayName
189
+ ));
190
+ }
191
+ warnAboutAccessingKey.isReactWarning = true;
192
+ Object.defineProperty(props, "key", {
193
+ get: warnAboutAccessingKey,
194
+ configurable: true
195
+ });
196
+ }
197
+ function elementRefGetterWithDeprecationWarning() {
198
+ var componentName = getComponentNameFromType(this.type);
199
+ didWarnAboutElementRef[componentName] ||
200
+ ((didWarnAboutElementRef[componentName] = true),
201
+ console.error(
202
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
203
+ ));
204
+ componentName = this.props.ref;
205
+ return void 0 !== componentName ? componentName : null;
206
+ }
207
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
208
+ var refProp = props.ref;
209
+ type = {
210
+ $$typeof: REACT_ELEMENT_TYPE,
211
+ type: type,
212
+ key: key,
213
+ props: props,
214
+ _owner: owner
215
+ };
216
+ null !== (void 0 !== refProp ? refProp : null)
217
+ ? Object.defineProperty(type, "ref", {
218
+ enumerable: false,
219
+ get: elementRefGetterWithDeprecationWarning
220
+ })
221
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
222
+ type._store = {};
223
+ Object.defineProperty(type._store, "validated", {
224
+ configurable: false,
225
+ enumerable: false,
226
+ writable: true,
227
+ value: 0
228
+ });
229
+ Object.defineProperty(type, "_debugInfo", {
230
+ configurable: false,
231
+ enumerable: false,
232
+ writable: true,
233
+ value: null
234
+ });
235
+ Object.defineProperty(type, "_debugStack", {
236
+ configurable: false,
237
+ enumerable: false,
238
+ writable: true,
239
+ value: debugStack
240
+ });
241
+ Object.defineProperty(type, "_debugTask", {
242
+ configurable: false,
243
+ enumerable: false,
244
+ writable: true,
245
+ value: debugTask
246
+ });
247
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
248
+ return type;
249
+ }
250
+ function jsxDEVImpl(
251
+ type,
252
+ config,
253
+ maybeKey,
254
+ isStaticChildren,
255
+ debugStack,
256
+ debugTask
257
+ ) {
258
+ var children = config.children;
259
+ if (void 0 !== children)
260
+ if (isStaticChildren)
261
+ if (isArrayImpl(children)) {
262
+ for (
263
+ isStaticChildren = 0;
264
+ isStaticChildren < children.length;
265
+ isStaticChildren++
266
+ )
267
+ validateChildKeys(children[isStaticChildren]);
268
+ Object.freeze && Object.freeze(children);
269
+ } else
270
+ console.error(
271
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
272
+ );
273
+ else validateChildKeys(children);
274
+ if (hasOwnProperty.call(config, "key")) {
275
+ children = getComponentNameFromType(type);
276
+ var keys = Object.keys(config).filter(function (k) {
277
+ return "key" !== k;
278
+ });
279
+ isStaticChildren =
280
+ 0 < keys.length
281
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
282
+ : "{key: someKey}";
283
+ didWarnAboutKeySpread[children + isStaticChildren] ||
284
+ ((keys =
285
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
286
+ console.error(
287
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
288
+ isStaticChildren,
289
+ children,
290
+ keys,
291
+ children
292
+ ),
293
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
294
+ }
295
+ children = null;
296
+ void 0 !== maybeKey &&
297
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
298
+ hasValidKey(config) &&
299
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
300
+ if ("key" in config) {
301
+ maybeKey = {};
302
+ for (var propName in config)
303
+ "key" !== propName && (maybeKey[propName] = config[propName]);
304
+ } else maybeKey = config;
305
+ children &&
306
+ defineKeyPropWarningGetter(
307
+ maybeKey,
308
+ "function" === typeof type
309
+ ? type.displayName || type.name || "Unknown"
310
+ : type
311
+ );
312
+ return ReactElement(
313
+ type,
314
+ children,
315
+ maybeKey,
316
+ getOwner(),
317
+ debugStack,
318
+ debugTask
319
+ );
320
+ }
321
+ function validateChildKeys(node) {
322
+ isValidElement(node)
323
+ ? node._store && (node._store.validated = 1)
324
+ : "object" === typeof node &&
325
+ null !== node &&
326
+ node.$$typeof === REACT_LAZY_TYPE &&
327
+ ("fulfilled" === node._payload.status
328
+ ? isValidElement(node._payload.value) &&
329
+ node._payload.value._store &&
330
+ (node._payload.value._store.validated = 1)
331
+ : node._store && (node._store.validated = 1));
332
+ }
333
+ function isValidElement(object) {
334
+ return (
335
+ "object" === typeof object &&
336
+ null !== object &&
337
+ object.$$typeof === REACT_ELEMENT_TYPE
338
+ );
339
+ }
340
+ var React = require$$0,
341
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
342
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
343
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
344
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
345
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
346
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
347
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
348
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
349
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
350
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
351
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
352
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
353
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
354
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
355
+ ReactSharedInternals =
356
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
357
+ hasOwnProperty = Object.prototype.hasOwnProperty,
358
+ isArrayImpl = Array.isArray,
359
+ createTask = console.createTask
360
+ ? console.createTask
361
+ : function () {
362
+ return null;
363
+ };
364
+ React = {
365
+ react_stack_bottom_frame: function (callStackForError) {
366
+ return callStackForError();
367
+ }
368
+ };
369
+ var specialPropKeyWarningShown;
370
+ var didWarnAboutElementRef = {};
371
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
372
+ React,
373
+ UnknownOwner
374
+ )();
375
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
376
+ var didWarnAboutKeySpread = {};
377
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
378
+ reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
379
+ var trackActualOwner =
380
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
381
+ return jsxDEVImpl(
382
+ type,
383
+ config,
384
+ maybeKey,
385
+ false,
386
+ trackActualOwner
387
+ ? Error("react-stack-top-frame")
388
+ : unknownOwnerDebugStack,
389
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
390
+ );
391
+ };
392
+ reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
393
+ var trackActualOwner =
394
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
395
+ return jsxDEVImpl(
396
+ type,
397
+ config,
398
+ maybeKey,
399
+ true,
400
+ trackActualOwner
401
+ ? Error("react-stack-top-frame")
402
+ : unknownOwnerDebugStack,
403
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
404
+ );
405
+ };
406
+ })();
407
+ return reactJsxRuntime_development;
408
+ }
409
+
410
+ var hasRequiredJsxRuntime;
411
+
412
+ function requireJsxRuntime () {
413
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
414
+ hasRequiredJsxRuntime = 1;
415
+
416
+ if (process.env.NODE_ENV === 'production') {
417
+ jsxRuntime.exports = requireReactJsxRuntime_production();
418
+ } else {
419
+ jsxRuntime.exports = requireReactJsxRuntime_development();
420
+ }
421
+ return jsxRuntime.exports;
422
+ }
423
+
424
+ var jsxRuntimeExports = requireJsxRuntime();
425
+
426
+ var e$6={exports:{}};
427
+
428
+ var r$2={};
429
+
430
+ /**
431
+ * @license React
432
+ * react-jsx-runtime.production.js
433
+ *
434
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
435
+ *
436
+ * This source code is licensed under the MIT license found in the
437
+ * LICENSE file in the root directory of this source tree.
438
+ */var e$5;function t$2(){if(e$5)return r$2;e$5=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(r,e,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==e.key&&(n=""+e.key),"key"in e)for(var i in o={},e)"key"!==i&&(o[i]=e[i]);else o=e;return e=o.ref,{$$typeof:t,type:r,key:n,ref:void 0!==e?e:null,props:o}}return r$2.Fragment=o,r$2.jsx=n,r$2.jsxs=n,r$2}
439
+
440
+ var r$1={};
441
+
442
+ /**
443
+ * @license React
444
+ * react-jsx-runtime.development.js
445
+ *
446
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
447
+ *
448
+ * This source code is licensed under the MIT license found in the
449
+ * LICENSE file in the root directory of this source tree.
450
+ */var t$1;function n(){return t$1||(t$1=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return "Fragment";case _:return "Profiler";case b:return "StrictMode";case S:return "Suspense";case j:return "SuspenseList";case w:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return "Portal";case g:return e.displayName||"Context";case v:return (e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return (e=e.displayName)||(e=""!==(e=r.displayName||r.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case h:return null!==(r=e.displayName||null)?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch(e){}}return null}function n(e){return ""+e}function o(e){try{n(e);var r=!1;}catch(e){r=true;}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function a(e){if(e===d)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return "<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return P[e]||(P[e]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function c(e,r,n,a,l,c){var u,y=r.children;if(void 0!==y)if(a)if(x(y)){for(a=0;a<y.length;a++)s(y[a]);Object.freeze&&Object.freeze(y);}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(y);if(T.call(r,"key")){y=t(e);var m=Object.keys(r).filter(function(e){return "key"!==e});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",C[y+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',a,y,m,y),C[y+a]=true);}if(y=null,void 0!==n&&(o(n),y=""+n),function(e){if(T.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),y=""+r.key),"key"in r)for(var d in n={},r)"key"!==d&&(n[d]=r[d]);else n=r;return y&&function(e,r){function t(){f||(f=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(n,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,t,n,o,a){var l=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:n},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:false,get:i}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,y,n,null===(u=R.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function u(e){return "object"==typeof e&&null!==e&&e.$$typeof===p}var f,y=require$$0,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),R=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,x=Array.isArray,E=console.createTask?console.createTask:function(){return null},P={},$=(y={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(y,l)(),A=E(a(l)),C={};r$1.Fragment=d,r$1.jsx=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,false,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)},r$1.jsxs=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,true,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)};}()),r$1}
451
+
452
+ var t;function s(){return t||(t=1,"production"===process.env.NODE_ENV?e$6.exports=t$2():e$6.exports=n()),e$6.exports}
453
+
454
+ var r=s();
455
+
456
+ const o=({className:o="",size:e="md",color:r$1="currentColor",direction:s="down"})=>{const i={sm:16,md:20,lg:24};return r.jsx("svg",{width:i[e],height:i[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} ${{up:"rotate-180",down:"",left:"rotate-90",right:"-rotate-90"}[s]} ${o}`,fill:"none",stroke:r$1,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M6 9l6 6 6-6"})})};
457
+
458
+ function e$4({className:e="",size:o="md",color:r$1="currentColor"}){const t={sm:16,md:20,lg:24};return r.jsx("svg",{width:t[o],height:t[o],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[o]} ${e}`,fill:"none",stroke:r$1,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}
459
+
460
+ const e$3=({className:e="",size:o="md",color:r$1="currentColor"})=>{const t={sm:16,md:20,lg:24};return r.jsx("svg",{width:t[o],height:t[o],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[o]} ${e}`,fill:"none",stroke:r$1,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})};
461
+
462
+ const e$2=({className:e="",size:r$1="md",color:i="currentColor"})=>{const o={sm:16,md:20,lg:24};return r.jsxs("svg",{width:o[r$1],height:o[r$1],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r$1]} ${e}`,fill:"none",stroke:i,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("path",{d:"M21 21l-4.35-4.35"}),r.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),r.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})};
463
+
464
+ const e$1=({className:e="",size:r$1="md",color:o="currentColor"})=>{const t={sm:16,md:20,lg:24};return r.jsxs("svg",{width:t[r$1],height:t[r$1],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r$1]} ${e}`,fill:"none",stroke:o,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("path",{d:"M21 21l-4.35-4.35"}),r.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})};
465
+
466
+ const e={sm:16,md:20,lg:24};function i({size:i="md",title:s,...o}){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:e[i],height:e[i],fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",role:s?"img":void 0,"aria-hidden":!s||void 0,focusable:"false",...o,children:[s&&r.jsx("title",{children:s}),r.jsx("path",{d:"M15 3h6v6"}),r.jsx("path",{d:"M10 14 21 3"}),r.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}
467
+
468
+ function styleInject(css, ref) {
469
+ if ( ref === void 0 ) ref = {};
470
+ var insertAt = ref.insertAt;
471
+
472
+ if (typeof document === 'undefined') { return; }
473
+
474
+ var head = document.head || document.getElementsByTagName('head')[0];
475
+ var style = document.createElement('style');
476
+ style.type = 'text/css';
477
+
478
+ if (insertAt === 'top') {
479
+ if (head.firstChild) {
480
+ head.insertBefore(style, head.firstChild);
481
+ } else {
482
+ head.appendChild(style);
483
+ }
484
+ } else {
485
+ head.appendChild(style);
486
+ }
487
+
488
+ if (style.styleSheet) {
489
+ style.styleSheet.cssText = css;
490
+ } else {
491
+ style.appendChild(document.createTextNode(css));
492
+ }
493
+ }
494
+
495
+ var css_248z = "/* Visor a pantalla completa, siempre oscuro (como cualquier visor de fotos) */\n.ImageViewer-module_viewer__v3SKG {\n --iv-fg: var(--lb-color-neutral-50);\n --iv-bg: var(--lb-color-neutral-900);\n --iv-soft: color-mix(in srgb, var(--iv-fg) 12%, transparent);\n --iv-hover: color-mix(in srgb, var(--iv-fg) 20%, transparent);\n --iv-muted: color-mix(in srgb, var(--iv-fg) 70%, transparent);\n\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n flex-direction: column;\n background: var(--iv-bg);\n color: var(--iv-fg);\n font-family: var(--lb-font-sans);\n}\n\n.ImageViewer-module_topBar__4-SPt {\n display: flex;\n align-items: center;\n gap: var(--lb-space-2);\n padding: var(--lb-space-2);\n}\n\n.ImageViewer-module_titleBlock__SjK5s {\n flex: 1;\n min-width: 0;\n}\n\n.ImageViewer-module_caption__PGC81 {\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--lb-font-size-sm);\n font-weight: var(--lb-font-weight-medium);\n}\n\n.ImageViewer-module_counter__876EK {\n margin: 0;\n font-size: var(--lb-font-size-xs);\n color: var(--iv-muted);\n}\n\n/* Botones de 44 px: cómodos para el dedo */\n.ImageViewer-module_toolButton__I3tsO,\n.ImageViewer-module_textButton__X4vCS,\n.ImageViewer-module_zoomLevel__WMnO8,\n.ImageViewer-module_navButton__GjdVy {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--lb-space-1);\n min-width: 2.75rem;\n height: 2.75rem;\n padding: 0 var(--lb-space-2);\n border: 0;\n border-radius: var(--lb-radius-full);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--lb-font-size-sm);\n cursor: pointer;\n}\n\n.ImageViewer-module_toolButton__I3tsO:hover:not(:disabled),\n.ImageViewer-module_textButton__X4vCS:hover,\n.ImageViewer-module_zoomLevel__WMnO8:hover {\n background: var(--iv-hover);\n}\n\n.ImageViewer-module_toolButton__I3tsO:focus-visible,\n.ImageViewer-module_textButton__X4vCS:focus-visible,\n.ImageViewer-module_zoomLevel__WMnO8:focus-visible,\n.ImageViewer-module_navButton__GjdVy:focus-visible {\n outline: 2px solid var(--iv-fg);\n outline-offset: 2px;\n}\n\n.ImageViewer-module_toolButton__I3tsO:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.ImageViewer-module_textButton__X4vCS {\n display: none;\n padding: 0 var(--lb-space-3);\n}\n\n.ImageViewer-module_stage__FSXpq {\n position: relative;\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: zoom-in;\n}\n\n.ImageViewer-module_stageZoomed__MKYnY {\n cursor: grab;\n}\n\n.ImageViewer-module_stageZoomed__MKYnY:active {\n cursor: grabbing;\n}\n\n.ImageViewer-module_image__N9r-N {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n will-change: transform;\n transition: transform 120ms ease-out;\n}\n\n.ImageViewer-module_message__9cqSZ {\n margin: 0;\n padding: 0 var(--lb-space-6);\n text-align: center;\n font-size: var(--lb-font-size-sm);\n color: var(--iv-muted);\n}\n\n.ImageViewer-module_spinner__UnShS {\n width: 2.5rem;\n height: 2.5rem;\n border: 2px solid var(--iv-fg);\n border-top-color: transparent;\n border-radius: var(--lb-radius-full);\n animation: ImageViewer-module_ivSpin__bmC5x 0.8s linear infinite;\n}\n\n@keyframes ImageViewer-module_ivSpin__bmC5x {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ImageViewer-module_navButton__GjdVy {\n position: absolute;\n top: 50%;\n width: 3rem;\n height: 3rem;\n transform: translateY(-50%);\n background: color-mix(in srgb, var(--iv-bg) 55%, transparent);\n}\n\n.ImageViewer-module_navButton__GjdVy:hover {\n background: color-mix(in srgb, var(--iv-bg) 80%, transparent);\n}\n\n.ImageViewer-module_navPrevious__HoaU- {\n left: var(--lb-space-2);\n}\n\n.ImageViewer-module_navNext__MTxYT {\n right: var(--lb-space-2);\n}\n\n.ImageViewer-module_bottomBar__4YMQv {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--lb-space-1);\n padding: var(--lb-space-2) var(--lb-space-2)\n max(var(--lb-space-3), env(safe-area-inset-bottom));\n}\n\n.ImageViewer-module_zoomGroup__7o0RD {\n display: flex;\n align-items: center;\n gap: var(--lb-space-1);\n padding: 0 var(--lb-space-1);\n border-radius: var(--lb-radius-full);\n background: var(--iv-soft);\n}\n\n.ImageViewer-module_zoomLevel__WMnO8 {\n min-width: 4rem;\n font-variant-numeric: tabular-nums;\n}\n\n.ImageViewer-module_hint__DkWO1 {\n margin: 0;\n text-align: center;\n font-size: var(--lb-font-size-xs);\n color: var(--iv-muted);\n}\n\n@media (min-width: 640px) {\n .ImageViewer-module_topBar__4-SPt {\n padding: var(--lb-space-2) var(--lb-space-4);\n }\n\n .ImageViewer-module_textButton__X4vCS {\n display: inline-flex;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ImageViewer-module_image__N9r-N {\n transition: none;\n }\n\n .ImageViewer-module_spinner__UnShS {\n animation-duration: 2s;\n }\n}\n";
496
+ var styles = {"viewer":"ImageViewer-module_viewer__v3SKG","topBar":"ImageViewer-module_topBar__4-SPt","titleBlock":"ImageViewer-module_titleBlock__SjK5s","caption":"ImageViewer-module_caption__PGC81","counter":"ImageViewer-module_counter__876EK","toolButton":"ImageViewer-module_toolButton__I3tsO","textButton":"ImageViewer-module_textButton__X4vCS","zoomLevel":"ImageViewer-module_zoomLevel__WMnO8","navButton":"ImageViewer-module_navButton__GjdVy","stage":"ImageViewer-module_stage__FSXpq","stageZoomed":"ImageViewer-module_stageZoomed__MKYnY","image":"ImageViewer-module_image__N9r-N","message":"ImageViewer-module_message__9cqSZ","spinner":"ImageViewer-module_spinner__UnShS","navPrevious":"ImageViewer-module_navPrevious__HoaU-","navNext":"ImageViewer-module_navNext__MTxYT","bottomBar":"ImageViewer-module_bottomBar__4YMQv","zoomGroup":"ImageViewer-module_zoomGroup__7o0RD","hint":"ImageViewer-module_hint__DkWO1"};
497
+ styleInject(css_248z);
498
+
499
+ const DEFAULT_IMAGE_VIEWER_LABELS = {
500
+ title: "Vista previa de {name}",
501
+ counter: "{current} de {total}",
502
+ close: "Cerrar",
503
+ download: "Descargar",
504
+ openInNewTab: "Abrir en una pestaña nueva",
505
+ zoomIn: "Acercar",
506
+ zoomOut: "Alejar",
507
+ reset: "Restablecer zoom",
508
+ previous: "Imagen anterior",
509
+ next: "Imagen siguiente",
510
+ loading: "Cargando imagen…",
511
+ loadFailed: "No se pudo cargar la imagen.",
512
+ hintTouch: "Pellizca o haz doble toque para hacer zoom. Arrastra para moverte.",
513
+ hintMouse: "Usa la rueda del mouse, doble clic o los botones para hacer zoom. Arrastra para moverte.",
514
+ };
515
+ const MIN_SCALE = 1;
516
+ const MAX_SCALE = 5;
517
+ const BUTTON_STEP = 1.5;
518
+ const DOUBLE_TAP_SCALE = 2.5;
519
+ const DOUBLE_TAP_MS = 300;
520
+ const TAP_SLOP_PX = 10;
521
+ const SWIPE_PX = 60;
522
+ const SNAP_TO_FIT = 1.05;
523
+ const IDENTITY = { scale: 1, x: 0, y: 0 };
524
+ const interpolate = (template, values) => template.replace(/\{(\w+)\}/g, (_, key) => String(values[key] ?? ""));
525
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
526
+ // Celulares y tablets reciben instrucciones de pellizco; las computadoras, de mouse
527
+ const isTouchDevice = () => typeof window !== "undefined" &&
528
+ !!window.matchMedia?.("(pointer: coarse)").matches;
529
+ /**
530
+ * Mantiene la imagen ampliada cubriendo el área visible: no se puede arrastrar
531
+ * fuera de la vista. `image` es el tamaño mostrado al 100 %, `stage` el área.
532
+ */
533
+ const clampView = (view, image, stage) => {
534
+ const scale = clamp(view.scale, MIN_SCALE, MAX_SCALE);
535
+ // Cerca del 100 % (tras la rueda o un pellizco) vuelve al 100 %
536
+ if (scale <= MIN_SCALE * SNAP_TO_FIT)
537
+ return IDENTITY;
538
+ const maxX = Math.max(0, (image.width * scale - stage.width) / 2);
539
+ const maxY = Math.max(0, (image.height * scale - stage.height) / 2);
540
+ return {
541
+ scale,
542
+ x: clamp(view.x, -maxX, maxX),
543
+ y: clamp(view.y, -maxY, maxY),
544
+ };
545
+ };
546
+ /**
547
+ * Amplía a `scale` manteniendo fijo el punto bajo `anchor` (relativo al centro
548
+ * del área), así el zoom sigue al cursor o a los dedos.
549
+ */
550
+ const zoomAround = (from, scale, anchor) => {
551
+ const next = clamp(scale, MIN_SCALE, MAX_SCALE);
552
+ const ratio = next / from.scale;
553
+ return {
554
+ scale: next,
555
+ x: anchor.x - (anchor.x - from.x) * ratio,
556
+ y: anchor.y - (anchor.y - from.y) * ratio,
557
+ };
558
+ };
559
+ const distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
560
+ const midpoint = (a, b) => ({
561
+ x: (a.x + b.x) / 2,
562
+ y: (a.y + b.y) / 2,
563
+ });
564
+ /**
565
+ * Visor de imágenes a pantalla completa con zoom, para mouse y pantalla táctil:
566
+ * botones (+, −, 100 %), rueda del mouse, pellizco con dos dedos, doble clic o
567
+ * doble toque, arrastrar para moverse cuando está ampliada y deslizar para
568
+ * cambiar de imagen. Teclado: ← → cambian de imagen, + − hacen zoom, 0
569
+ * restablece y Escape cierra (sin llegar a lo que está debajo, como un Drawer).
570
+ */
571
+ const ImageViewer = ({ images, initialIndex = 0, index: controlledIndex, onIndexChange, onClose, onDownload, onOpenInNewTab, labels: labelsProp, }) => {
572
+ const labels = { ...DEFAULT_IMAGE_VIEWER_LABELS, ...labelsProp };
573
+ const last = Math.max(0, images.length - 1);
574
+ const [ownIndex, setOwnIndex] = useState(() => clamp(initialIndex, 0, last));
575
+ const index = clamp(controlledIndex ?? ownIndex, 0, last);
576
+ // La vista (zoom y posición) guarda a qué imagen pertenece: al cambiar de
577
+ // imagen vuelve sola al 100 %, sin efectos que reinicien el estado.
578
+ const [stored, setStored] = useState({
579
+ index,
580
+ view: IDENTITY,
581
+ });
582
+ const view = stored.index === index ? stored.view : IDENTITY;
583
+ const viewRef = useRef(stored);
584
+ // Mientras hay un gesto, el zoom sigue al dedo sin animación
585
+ const [dragging, setDragging] = useState(false);
586
+ const stageRef = useRef(null);
587
+ const imageRef = useRef(null);
588
+ const closeRef = useRef(null);
589
+ const pointers = useRef(new Map());
590
+ const gesture = useRef(null);
591
+ const lastTap = useRef(null);
592
+ const lastPointerType = useRef("mouse");
593
+ const [failedSrc, setFailedSrc] = useState(null);
594
+ const image = images[index];
595
+ const hasMany = images.length > 1;
596
+ const failed = image?.status === "error" || (!!image?.src && failedSrc === image.src);
597
+ const src = image?.status === "loading" ? undefined : image?.src;
598
+ const stageCenter = () => {
599
+ const rect = stageRef.current?.getBoundingClientRect();
600
+ return rect
601
+ ? { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 }
602
+ : { x: 0, y: 0 };
603
+ };
604
+ // Coordenadas de pantalla → relativas al centro del área
605
+ const toStage = (point) => {
606
+ const center = stageCenter();
607
+ return { x: point.x - center.x, y: point.y - center.y };
608
+ };
609
+ const currentView = useCallback(() => (viewRef.current.index === index ? viewRef.current.view : IDENTITY), [index]);
610
+ const setView = useCallback((next) => {
611
+ const stage = stageRef.current;
612
+ const img = imageRef.current;
613
+ const clamped = stage && img && img.offsetWidth
614
+ ? clampView(next, { width: img.offsetWidth, height: img.offsetHeight }, { width: stage.clientWidth, height: stage.clientHeight })
615
+ : next.scale <= MIN_SCALE
616
+ ? IDENTITY
617
+ : { ...next, scale: clamp(next.scale, MIN_SCALE, MAX_SCALE) };
618
+ viewRef.current = { index, view: clamped };
619
+ setStored({ index, view: clamped });
620
+ }, [index]);
621
+ const zoomBy = useCallback((factor, anchor = { x: 0, y: 0 }) => setView(zoomAround(currentView(), currentView().scale * factor, anchor)), [setView, currentView]);
622
+ const reset = useCallback(() => setView(IDENTITY), [setView]);
623
+ const go = useCallback((step) => {
624
+ if (!hasMany)
625
+ return;
626
+ const next = (index + step + images.length) % images.length;
627
+ if (controlledIndex === undefined)
628
+ setOwnIndex(next);
629
+ onIndexChange?.(next);
630
+ }, [hasMany, index, images.length, controlledIndex, onIndexChange]);
631
+ // Teclado, foco y bloqueo del desplazamiento de la página mientras está abierto
632
+ useEffect(() => {
633
+ const previousOverflow = document.body.style.overflow;
634
+ const previousFocus = document.activeElement;
635
+ document.body.style.overflow = "hidden";
636
+ closeRef.current?.focus();
637
+ const actions = {
638
+ Escape: onClose,
639
+ ArrowRight: () => go(1),
640
+ ArrowLeft: () => go(-1),
641
+ "+": () => zoomBy(BUTTON_STEP),
642
+ "=": () => zoomBy(BUTTON_STEP),
643
+ "-": () => zoomBy(1 / BUTTON_STEP),
644
+ "0": reset,
645
+ };
646
+ const onKey = (event) => {
647
+ const action = actions[event.key];
648
+ if (!action)
649
+ return;
650
+ // El visor atiende la tecla y no llega a lo que está debajo
651
+ // (Escape también cerraría un Drawer desde el que se abrió)
652
+ event.stopPropagation();
653
+ action();
654
+ };
655
+ // Fase de captura en window: corre antes que los oyentes de document
656
+ window.addEventListener("keydown", onKey, true);
657
+ return () => {
658
+ window.removeEventListener("keydown", onKey, true);
659
+ document.body.style.overflow = previousOverflow;
660
+ previousFocus?.focus?.();
661
+ };
662
+ }, [go, onClose, reset, zoomBy]);
663
+ // Zoom con la rueda hacia el cursor (no pasivo: la página no se mueve)
664
+ useEffect(() => {
665
+ const stage = stageRef.current;
666
+ if (!stage)
667
+ return;
668
+ const onWheel = (event) => {
669
+ event.preventDefault();
670
+ zoomBy(Math.exp(-event.deltaY * 0.002), toStage({ x: event.clientX, y: event.clientY }));
671
+ };
672
+ stage.addEventListener("wheel", onWheel, { passive: false });
673
+ return () => stage.removeEventListener("wheel", onWheel);
674
+ // eslint-disable-next-line react-hooks/exhaustive-deps
675
+ }, [zoomBy]);
676
+ const startPan = (point, pointerType, afterPinch = false) => {
677
+ gesture.current = {
678
+ type: "pan",
679
+ start: point,
680
+ origin: currentView(),
681
+ moved: false,
682
+ pointerType,
683
+ afterPinch,
684
+ };
685
+ };
686
+ const toggleZoomAt = (client) => {
687
+ if (currentView().scale > MIN_SCALE)
688
+ reset();
689
+ else
690
+ setView(zoomAround(currentView(), DOUBLE_TAP_SCALE, toStage(client)));
691
+ };
692
+ const handlePointerDown = (event) => {
693
+ if (event.pointerType === "mouse" && event.button !== 0)
694
+ return;
695
+ lastPointerType.current = event.pointerType;
696
+ event.currentTarget.setPointerCapture?.(event.pointerId);
697
+ const point = { x: event.clientX, y: event.clientY };
698
+ pointers.current.set(event.pointerId, point);
699
+ setDragging(true);
700
+ if (pointers.current.size === 1) {
701
+ startPan(point, event.pointerType);
702
+ }
703
+ else if (pointers.current.size === 2) {
704
+ const [a, b] = Array.from(pointers.current.values());
705
+ gesture.current = {
706
+ type: "pinch",
707
+ startDistance: Math.max(1, distance(a, b)),
708
+ startMid: toStage(midpoint(a, b)),
709
+ origin: currentView(),
710
+ };
711
+ }
712
+ };
713
+ const handlePointerMove = (event) => {
714
+ if (!pointers.current.has(event.pointerId))
715
+ return;
716
+ const point = { x: event.clientX, y: event.clientY };
717
+ pointers.current.set(event.pointerId, point);
718
+ const current = gesture.current;
719
+ if (!current)
720
+ return;
721
+ if (current.type === "pinch" && pointers.current.size >= 2) {
722
+ const [a, b] = Array.from(pointers.current.values());
723
+ const scale = current.origin.scale * (distance(a, b) / current.startDistance);
724
+ const mid = toStage(midpoint(a, b));
725
+ // Zoom alrededor de donde empezaron los dedos, luego los sigue
726
+ const zoomed = zoomAround(current.origin, scale, current.startMid);
727
+ setView({
728
+ ...zoomed,
729
+ x: zoomed.x + (mid.x - current.startMid.x),
730
+ y: zoomed.y + (mid.y - current.startMid.y),
731
+ });
732
+ return;
733
+ }
734
+ if (current.type === "pan") {
735
+ const dx = point.x - current.start.x;
736
+ const dy = point.y - current.start.y;
737
+ if (Math.hypot(dx, dy) > TAP_SLOP_PX)
738
+ current.moved = true;
739
+ if (currentView().scale > MIN_SCALE) {
740
+ setView({
741
+ ...current.origin,
742
+ x: current.origin.x + dx,
743
+ y: current.origin.y + dy,
744
+ });
745
+ }
746
+ }
747
+ };
748
+ const handlePointerEnd = (event) => {
749
+ const point = { x: event.clientX, y: event.clientY };
750
+ const current = gesture.current;
751
+ pointers.current.delete(event.pointerId);
752
+ if (current?.type === "pinch") {
753
+ // El dedo que queda sigue moviendo desde donde está
754
+ const remaining = Array.from(pointers.current.values())[0];
755
+ if (remaining)
756
+ startPan(remaining, "touch", true);
757
+ else {
758
+ gesture.current = null;
759
+ setDragging(false);
760
+ }
761
+ return;
762
+ }
763
+ gesture.current = null;
764
+ setDragging(false);
765
+ if (current?.type !== "pan" ||
766
+ current.afterPinch ||
767
+ event.type === "pointercancel")
768
+ return;
769
+ const dx = point.x - current.start.x;
770
+ const dy = point.y - current.start.y;
771
+ // Deslizar cambia de imagen (solo al 100 %; ampliada, arrastrar la mueve)
772
+ if (current.origin.scale <= MIN_SCALE &&
773
+ Math.abs(dx) > SWIPE_PX &&
774
+ Math.abs(dx) > Math.abs(dy)) {
775
+ go(dx < 0 ? 1 : -1);
776
+ return;
777
+ }
778
+ // Doble toque (táctil o lápiz; el mouse usa onDoubleClick)
779
+ if (current.pointerType !== "mouse" && !current.moved) {
780
+ const now = Date.now();
781
+ const previous = lastTap.current;
782
+ if (previous &&
783
+ now - previous.time < DOUBLE_TAP_MS &&
784
+ distance(previous.point, point) < TAP_SLOP_PX * 3) {
785
+ lastTap.current = null;
786
+ toggleZoomAt(point);
787
+ }
788
+ else {
789
+ lastTap.current = { time: now, point };
790
+ }
791
+ }
792
+ };
793
+ if (!image || typeof document === "undefined")
794
+ return null;
795
+ const percent = `${Math.round(view.scale * 100)} %`;
796
+ const zoomed = view.scale > MIN_SCALE;
797
+ return createPortal(jsxRuntimeExports.jsxs("div", { role: "dialog", "aria-modal": "true", "aria-label": interpolate(labels.title, { name: image.caption }), className: styles.viewer, "data-testid": "image-viewer", children: [jsxRuntimeExports.jsxs("div", { className: styles.topBar, children: [jsxRuntimeExports.jsxs("div", { className: styles.titleBlock, children: [jsxRuntimeExports.jsx("p", { className: styles.caption, title: image.caption, children: image.caption }), hasMany && (jsxRuntimeExports.jsx("p", { className: styles.counter, "data-testid": "image-viewer-counter", children: interpolate(labels.counter, {
798
+ current: index + 1,
799
+ total: images.length,
800
+ }) }))] }), onDownload && (jsxRuntimeExports.jsx("button", { type: "button", className: styles.toolButton, onClick: () => onDownload(image, index), "aria-label": labels.download, title: labels.download, children: jsxRuntimeExports.jsx(e$3, { size: "md" }) })), onOpenInNewTab && (jsxRuntimeExports.jsxs("button", { type: "button", className: styles.textButton, onClick: () => onOpenInNewTab(image, index), children: [jsxRuntimeExports.jsx(i, { size: "sm" }), labels.openInNewTab] })), jsxRuntimeExports.jsx("button", { ref: closeRef, type: "button", className: styles.toolButton, onClick: onClose, "aria-label": labels.close, title: labels.close, "data-testid": "image-viewer-close", children: jsxRuntimeExports.jsx(e$4, { size: "md" }) })] }), jsxRuntimeExports.jsxs("div", { ref: stageRef, className: `${styles.stage} ${zoomed ? styles.stageZoomed : ""}`, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerEnd, onPointerCancel: handlePointerEnd, onDoubleClick: (event) => {
801
+ // Los celulares también disparan dblclick tras el doble toque
802
+ if (lastPointerType.current !== "mouse")
803
+ return;
804
+ toggleZoomAt({ x: event.clientX, y: event.clientY });
805
+ }, "data-testid": "image-viewer-stage", children: [failed ? (jsxRuntimeExports.jsx("p", { className: styles.message, children: labels.loadFailed })) : src ? (jsxRuntimeExports.jsx("img", { ref: imageRef, src: src, alt: image.caption, draggable: false, className: styles.image, onError: () => setFailedSrc(src), style: {
806
+ transform: `translate3d(${view.x}px, ${view.y}px, 0) scale(${view.scale})`,
807
+ transition: dragging ? "none" : undefined,
808
+ } }, image.id ?? index)) : (jsxRuntimeExports.jsx("span", { role: "status", "aria-label": labels.loading, className: styles.spinner })), hasMany && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("button", { type: "button", className: `${styles.navButton} ${styles.navPrevious}`, onClick: () => go(-1), onPointerDown: (event) => event.stopPropagation(), "aria-label": labels.previous, children: jsxRuntimeExports.jsx(o, { size: "md", direction: "left" }) }), jsxRuntimeExports.jsx("button", { type: "button", className: `${styles.navButton} ${styles.navNext}`, onClick: () => go(1), onPointerDown: (event) => event.stopPropagation(), "aria-label": labels.next, children: jsxRuntimeExports.jsx(o, { size: "md", direction: "right" }) })] }))] }), jsxRuntimeExports.jsxs("div", { className: styles.bottomBar, children: [jsxRuntimeExports.jsxs("div", { className: styles.zoomGroup, children: [jsxRuntimeExports.jsx("button", { type: "button", className: styles.toolButton, onClick: () => zoomBy(1 / BUTTON_STEP), disabled: view.scale <= MIN_SCALE, "aria-label": labels.zoomOut, title: labels.zoomOut, children: jsxRuntimeExports.jsx(e$1, { size: "md" }) }), jsxRuntimeExports.jsx("button", { type: "button", className: styles.zoomLevel, onClick: reset, "aria-label": labels.reset, title: labels.reset, "data-testid": "image-viewer-zoom-level", children: percent }), jsxRuntimeExports.jsx("button", { type: "button", className: styles.toolButton, onClick: () => zoomBy(BUTTON_STEP), disabled: view.scale >= MAX_SCALE, "aria-label": labels.zoomIn, title: labels.zoomIn, children: jsxRuntimeExports.jsx(e$2, { size: "md" }) })] }), jsxRuntimeExports.jsx("p", { className: styles.hint, children: isTouchDevice() ? labels.hintTouch : labels.hintMouse })] })] }), document.body);
809
+ };
810
+
811
+ export { DEFAULT_IMAGE_VIEWER_LABELS, ImageViewer as default };