@adhese/sdk 0.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,1786 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require$$0 = require("react");
4
+ const require$$0$1 = require("react-dom");
5
+ const clsx = require("clsx");
6
+ const tailwindMerge = require("tailwind-merge");
7
+ const classVarianceAuthority = require("class-variance-authority");
8
+ const reactSlot = require("@radix-ui/react-slot");
9
+ const SheetPrimitive = require("@radix-ui/react-dialog");
10
+ const reactIcons = require("@radix-ui/react-icons");
11
+ const TabsPrimitive = require("@radix-ui/react-tabs");
12
+ const lodashEs = require("lodash-es");
13
+ const SwitchPrimitives = require("@radix-ui/react-switch");
14
+ const LabelPrimitive = require("@radix-ui/react-label");
15
+ function _interopNamespaceDefault(e) {
16
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
17
+ if (e) {
18
+ for (const k in e) {
19
+ if (k !== "default") {
20
+ const d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: () => e[k]
24
+ });
25
+ }
26
+ }
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+ const SheetPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SheetPrimitive);
32
+ const TabsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TabsPrimitive);
33
+ const SwitchPrimitives__namespace = /* @__PURE__ */ _interopNamespaceDefault(SwitchPrimitives);
34
+ const LabelPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(LabelPrimitive);
35
+ var jsxRuntime = { exports: {} };
36
+ var reactJsxRuntime_production_min = {};
37
+ /**
38
+ * @license React
39
+ * react-jsx-runtime.production.min.js
40
+ *
41
+ * Copyright (c) Facebook, Inc. and its affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */
46
+ var hasRequiredReactJsxRuntime_production_min;
47
+ function requireReactJsxRuntime_production_min() {
48
+ if (hasRequiredReactJsxRuntime_production_min)
49
+ return reactJsxRuntime_production_min;
50
+ hasRequiredReactJsxRuntime_production_min = 1;
51
+ var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m2 = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
52
+ function q(c, a, g) {
53
+ var b, d = {}, e = null, h = null;
54
+ void 0 !== g && (e = "" + g);
55
+ void 0 !== a.key && (e = "" + a.key);
56
+ void 0 !== a.ref && (h = a.ref);
57
+ for (b in a)
58
+ m2.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
59
+ if (c && c.defaultProps)
60
+ for (b in a = c.defaultProps, a)
61
+ void 0 === d[b] && (d[b] = a[b]);
62
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
63
+ }
64
+ reactJsxRuntime_production_min.Fragment = l;
65
+ reactJsxRuntime_production_min.jsx = q;
66
+ reactJsxRuntime_production_min.jsxs = q;
67
+ return reactJsxRuntime_production_min;
68
+ }
69
+ var reactJsxRuntime_development = {};
70
+ /**
71
+ * @license React
72
+ * react-jsx-runtime.development.js
73
+ *
74
+ * Copyright (c) Facebook, Inc. and its affiliates.
75
+ *
76
+ * This source code is licensed under the MIT license found in the
77
+ * LICENSE file in the root directory of this source tree.
78
+ */
79
+ var hasRequiredReactJsxRuntime_development;
80
+ function requireReactJsxRuntime_development() {
81
+ if (hasRequiredReactJsxRuntime_development)
82
+ return reactJsxRuntime_development;
83
+ hasRequiredReactJsxRuntime_development = 1;
84
+ if (process.env.NODE_ENV !== "production") {
85
+ (function() {
86
+ var React = require$$0;
87
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
88
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
89
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
90
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
91
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
92
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
93
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
94
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
95
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
96
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
97
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
98
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
99
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
100
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
101
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
102
+ function getIteratorFn(maybeIterable) {
103
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
104
+ return null;
105
+ }
106
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
107
+ if (typeof maybeIterator === "function") {
108
+ return maybeIterator;
109
+ }
110
+ return null;
111
+ }
112
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
113
+ function error(format) {
114
+ {
115
+ {
116
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
117
+ args[_key2 - 1] = arguments[_key2];
118
+ }
119
+ printWarning("error", format, args);
120
+ }
121
+ }
122
+ }
123
+ function printWarning(level, format, args) {
124
+ {
125
+ var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
126
+ var stack = ReactDebugCurrentFrame2.getStackAddendum();
127
+ if (stack !== "") {
128
+ format += "%s";
129
+ args = args.concat([stack]);
130
+ }
131
+ var argsWithFormat = args.map(function(item) {
132
+ return String(item);
133
+ });
134
+ argsWithFormat.unshift("Warning: " + format);
135
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
136
+ }
137
+ }
138
+ var enableScopeAPI = false;
139
+ var enableCacheElement = false;
140
+ var enableTransitionTracing = false;
141
+ var enableLegacyHidden = false;
142
+ var enableDebugTracing = false;
143
+ var REACT_MODULE_REFERENCE;
144
+ {
145
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
146
+ }
147
+ function isValidElementType(type) {
148
+ if (typeof type === "string" || typeof type === "function") {
149
+ return true;
150
+ }
151
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
152
+ return true;
153
+ }
154
+ if (typeof type === "object" && type !== null) {
155
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
156
+ // types supported by any Flight configuration anywhere since
157
+ // we don't know which Flight build this will end up being used
158
+ // with.
159
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
160
+ return true;
161
+ }
162
+ }
163
+ return false;
164
+ }
165
+ function getWrappedName(outerType, innerType, wrapperName) {
166
+ var displayName = outerType.displayName;
167
+ if (displayName) {
168
+ return displayName;
169
+ }
170
+ var functionName = innerType.displayName || innerType.name || "";
171
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
172
+ }
173
+ function getContextName(type) {
174
+ return type.displayName || "Context";
175
+ }
176
+ function getComponentNameFromType(type) {
177
+ if (type == null) {
178
+ return null;
179
+ }
180
+ {
181
+ if (typeof type.tag === "number") {
182
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
183
+ }
184
+ }
185
+ if (typeof type === "function") {
186
+ return type.displayName || type.name || null;
187
+ }
188
+ if (typeof type === "string") {
189
+ return type;
190
+ }
191
+ switch (type) {
192
+ case REACT_FRAGMENT_TYPE:
193
+ return "Fragment";
194
+ case REACT_PORTAL_TYPE:
195
+ return "Portal";
196
+ case REACT_PROFILER_TYPE:
197
+ return "Profiler";
198
+ case REACT_STRICT_MODE_TYPE:
199
+ return "StrictMode";
200
+ case REACT_SUSPENSE_TYPE:
201
+ return "Suspense";
202
+ case REACT_SUSPENSE_LIST_TYPE:
203
+ return "SuspenseList";
204
+ }
205
+ if (typeof type === "object") {
206
+ switch (type.$$typeof) {
207
+ case REACT_CONTEXT_TYPE:
208
+ var context = type;
209
+ return getContextName(context) + ".Consumer";
210
+ case REACT_PROVIDER_TYPE:
211
+ var provider = type;
212
+ return getContextName(provider._context) + ".Provider";
213
+ case REACT_FORWARD_REF_TYPE:
214
+ return getWrappedName(type, type.render, "ForwardRef");
215
+ case REACT_MEMO_TYPE:
216
+ var outerName = type.displayName || null;
217
+ if (outerName !== null) {
218
+ return outerName;
219
+ }
220
+ return getComponentNameFromType(type.type) || "Memo";
221
+ case REACT_LAZY_TYPE: {
222
+ var lazyComponent = type;
223
+ var payload = lazyComponent._payload;
224
+ var init = lazyComponent._init;
225
+ try {
226
+ return getComponentNameFromType(init(payload));
227
+ } catch (x) {
228
+ return null;
229
+ }
230
+ }
231
+ }
232
+ }
233
+ return null;
234
+ }
235
+ var assign = Object.assign;
236
+ var disabledDepth = 0;
237
+ var prevLog;
238
+ var prevInfo;
239
+ var prevWarn;
240
+ var prevError;
241
+ var prevGroup;
242
+ var prevGroupCollapsed;
243
+ var prevGroupEnd;
244
+ function disabledLog() {
245
+ }
246
+ disabledLog.__reactDisabledLog = true;
247
+ function disableLogs() {
248
+ {
249
+ if (disabledDepth === 0) {
250
+ prevLog = console.log;
251
+ prevInfo = console.info;
252
+ prevWarn = console.warn;
253
+ prevError = console.error;
254
+ prevGroup = console.group;
255
+ prevGroupCollapsed = console.groupCollapsed;
256
+ prevGroupEnd = console.groupEnd;
257
+ var props = {
258
+ configurable: true,
259
+ enumerable: true,
260
+ value: disabledLog,
261
+ writable: true
262
+ };
263
+ Object.defineProperties(console, {
264
+ info: props,
265
+ log: props,
266
+ warn: props,
267
+ error: props,
268
+ group: props,
269
+ groupCollapsed: props,
270
+ groupEnd: props
271
+ });
272
+ }
273
+ disabledDepth++;
274
+ }
275
+ }
276
+ function reenableLogs() {
277
+ {
278
+ disabledDepth--;
279
+ if (disabledDepth === 0) {
280
+ var props = {
281
+ configurable: true,
282
+ enumerable: true,
283
+ writable: true
284
+ };
285
+ Object.defineProperties(console, {
286
+ log: assign({}, props, {
287
+ value: prevLog
288
+ }),
289
+ info: assign({}, props, {
290
+ value: prevInfo
291
+ }),
292
+ warn: assign({}, props, {
293
+ value: prevWarn
294
+ }),
295
+ error: assign({}, props, {
296
+ value: prevError
297
+ }),
298
+ group: assign({}, props, {
299
+ value: prevGroup
300
+ }),
301
+ groupCollapsed: assign({}, props, {
302
+ value: prevGroupCollapsed
303
+ }),
304
+ groupEnd: assign({}, props, {
305
+ value: prevGroupEnd
306
+ })
307
+ });
308
+ }
309
+ if (disabledDepth < 0) {
310
+ error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
311
+ }
312
+ }
313
+ }
314
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
315
+ var prefix;
316
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
317
+ {
318
+ if (prefix === void 0) {
319
+ try {
320
+ throw Error();
321
+ } catch (x) {
322
+ var match = x.stack.trim().match(/\n( *(at )?)/);
323
+ prefix = match && match[1] || "";
324
+ }
325
+ }
326
+ return "\n" + prefix + name;
327
+ }
328
+ }
329
+ var reentry = false;
330
+ var componentFrameCache;
331
+ {
332
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
333
+ componentFrameCache = new PossiblyWeakMap();
334
+ }
335
+ function describeNativeComponentFrame(fn, construct) {
336
+ if (!fn || reentry) {
337
+ return "";
338
+ }
339
+ {
340
+ var frame = componentFrameCache.get(fn);
341
+ if (frame !== void 0) {
342
+ return frame;
343
+ }
344
+ }
345
+ var control;
346
+ reentry = true;
347
+ var previousPrepareStackTrace = Error.prepareStackTrace;
348
+ Error.prepareStackTrace = void 0;
349
+ var previousDispatcher;
350
+ {
351
+ previousDispatcher = ReactCurrentDispatcher.current;
352
+ ReactCurrentDispatcher.current = null;
353
+ disableLogs();
354
+ }
355
+ try {
356
+ if (construct) {
357
+ var Fake = function() {
358
+ throw Error();
359
+ };
360
+ Object.defineProperty(Fake.prototype, "props", {
361
+ set: function() {
362
+ throw Error();
363
+ }
364
+ });
365
+ if (typeof Reflect === "object" && Reflect.construct) {
366
+ try {
367
+ Reflect.construct(Fake, []);
368
+ } catch (x) {
369
+ control = x;
370
+ }
371
+ Reflect.construct(fn, [], Fake);
372
+ } else {
373
+ try {
374
+ Fake.call();
375
+ } catch (x) {
376
+ control = x;
377
+ }
378
+ fn.call(Fake.prototype);
379
+ }
380
+ } else {
381
+ try {
382
+ throw Error();
383
+ } catch (x) {
384
+ control = x;
385
+ }
386
+ fn();
387
+ }
388
+ } catch (sample) {
389
+ if (sample && control && typeof sample.stack === "string") {
390
+ var sampleLines = sample.stack.split("\n");
391
+ var controlLines = control.stack.split("\n");
392
+ var s = sampleLines.length - 1;
393
+ var c = controlLines.length - 1;
394
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
395
+ c--;
396
+ }
397
+ for (; s >= 1 && c >= 0; s--, c--) {
398
+ if (sampleLines[s] !== controlLines[c]) {
399
+ if (s !== 1 || c !== 1) {
400
+ do {
401
+ s--;
402
+ c--;
403
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
404
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
405
+ if (fn.displayName && _frame.includes("<anonymous>")) {
406
+ _frame = _frame.replace("<anonymous>", fn.displayName);
407
+ }
408
+ {
409
+ if (typeof fn === "function") {
410
+ componentFrameCache.set(fn, _frame);
411
+ }
412
+ }
413
+ return _frame;
414
+ }
415
+ } while (s >= 1 && c >= 0);
416
+ }
417
+ break;
418
+ }
419
+ }
420
+ }
421
+ } finally {
422
+ reentry = false;
423
+ {
424
+ ReactCurrentDispatcher.current = previousDispatcher;
425
+ reenableLogs();
426
+ }
427
+ Error.prepareStackTrace = previousPrepareStackTrace;
428
+ }
429
+ var name = fn ? fn.displayName || fn.name : "";
430
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
431
+ {
432
+ if (typeof fn === "function") {
433
+ componentFrameCache.set(fn, syntheticFrame);
434
+ }
435
+ }
436
+ return syntheticFrame;
437
+ }
438
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
439
+ {
440
+ return describeNativeComponentFrame(fn, false);
441
+ }
442
+ }
443
+ function shouldConstruct(Component) {
444
+ var prototype = Component.prototype;
445
+ return !!(prototype && prototype.isReactComponent);
446
+ }
447
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
448
+ if (type == null) {
449
+ return "";
450
+ }
451
+ if (typeof type === "function") {
452
+ {
453
+ return describeNativeComponentFrame(type, shouldConstruct(type));
454
+ }
455
+ }
456
+ if (typeof type === "string") {
457
+ return describeBuiltInComponentFrame(type);
458
+ }
459
+ switch (type) {
460
+ case REACT_SUSPENSE_TYPE:
461
+ return describeBuiltInComponentFrame("Suspense");
462
+ case REACT_SUSPENSE_LIST_TYPE:
463
+ return describeBuiltInComponentFrame("SuspenseList");
464
+ }
465
+ if (typeof type === "object") {
466
+ switch (type.$$typeof) {
467
+ case REACT_FORWARD_REF_TYPE:
468
+ return describeFunctionComponentFrame(type.render);
469
+ case REACT_MEMO_TYPE:
470
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
471
+ case REACT_LAZY_TYPE: {
472
+ var lazyComponent = type;
473
+ var payload = lazyComponent._payload;
474
+ var init = lazyComponent._init;
475
+ try {
476
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
477
+ } catch (x) {
478
+ }
479
+ }
480
+ }
481
+ }
482
+ return "";
483
+ }
484
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
485
+ var loggedTypeFailures = {};
486
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
487
+ function setCurrentlyValidatingElement(element) {
488
+ {
489
+ if (element) {
490
+ var owner = element._owner;
491
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
492
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
493
+ } else {
494
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
495
+ }
496
+ }
497
+ }
498
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
499
+ {
500
+ var has = Function.call.bind(hasOwnProperty);
501
+ for (var typeSpecName in typeSpecs) {
502
+ if (has(typeSpecs, typeSpecName)) {
503
+ var error$1 = void 0;
504
+ try {
505
+ if (typeof typeSpecs[typeSpecName] !== "function") {
506
+ var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
507
+ err.name = "Invariant Violation";
508
+ throw err;
509
+ }
510
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
511
+ } catch (ex) {
512
+ error$1 = ex;
513
+ }
514
+ if (error$1 && !(error$1 instanceof Error)) {
515
+ setCurrentlyValidatingElement(element);
516
+ error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
517
+ setCurrentlyValidatingElement(null);
518
+ }
519
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
520
+ loggedTypeFailures[error$1.message] = true;
521
+ setCurrentlyValidatingElement(element);
522
+ error("Failed %s type: %s", location, error$1.message);
523
+ setCurrentlyValidatingElement(null);
524
+ }
525
+ }
526
+ }
527
+ }
528
+ }
529
+ var isArrayImpl = Array.isArray;
530
+ function isArray(a) {
531
+ return isArrayImpl(a);
532
+ }
533
+ function typeName(value) {
534
+ {
535
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
536
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
537
+ return type;
538
+ }
539
+ }
540
+ function willCoercionThrow(value) {
541
+ {
542
+ try {
543
+ testStringCoercion(value);
544
+ return false;
545
+ } catch (e) {
546
+ return true;
547
+ }
548
+ }
549
+ }
550
+ function testStringCoercion(value) {
551
+ return "" + value;
552
+ }
553
+ function checkKeyStringCoercion(value) {
554
+ {
555
+ if (willCoercionThrow(value)) {
556
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
557
+ return testStringCoercion(value);
558
+ }
559
+ }
560
+ }
561
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
562
+ var RESERVED_PROPS = {
563
+ key: true,
564
+ ref: true,
565
+ __self: true,
566
+ __source: true
567
+ };
568
+ var specialPropKeyWarningShown;
569
+ var specialPropRefWarningShown;
570
+ var didWarnAboutStringRefs;
571
+ {
572
+ didWarnAboutStringRefs = {};
573
+ }
574
+ function hasValidRef(config) {
575
+ {
576
+ if (hasOwnProperty.call(config, "ref")) {
577
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
578
+ if (getter && getter.isReactWarning) {
579
+ return false;
580
+ }
581
+ }
582
+ }
583
+ return config.ref !== void 0;
584
+ }
585
+ function hasValidKey(config) {
586
+ {
587
+ if (hasOwnProperty.call(config, "key")) {
588
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
589
+ if (getter && getter.isReactWarning) {
590
+ return false;
591
+ }
592
+ }
593
+ }
594
+ return config.key !== void 0;
595
+ }
596
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
597
+ {
598
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
599
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
600
+ if (!didWarnAboutStringRefs[componentName]) {
601
+ error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
602
+ didWarnAboutStringRefs[componentName] = true;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ function defineKeyPropWarningGetter(props, displayName) {
608
+ {
609
+ var warnAboutAccessingKey = function() {
610
+ if (!specialPropKeyWarningShown) {
611
+ specialPropKeyWarningShown = true;
612
+ 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://reactjs.org/link/special-props)", displayName);
613
+ }
614
+ };
615
+ warnAboutAccessingKey.isReactWarning = true;
616
+ Object.defineProperty(props, "key", {
617
+ get: warnAboutAccessingKey,
618
+ configurable: true
619
+ });
620
+ }
621
+ }
622
+ function defineRefPropWarningGetter(props, displayName) {
623
+ {
624
+ var warnAboutAccessingRef = function() {
625
+ if (!specialPropRefWarningShown) {
626
+ specialPropRefWarningShown = true;
627
+ error("%s: `ref` 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://reactjs.org/link/special-props)", displayName);
628
+ }
629
+ };
630
+ warnAboutAccessingRef.isReactWarning = true;
631
+ Object.defineProperty(props, "ref", {
632
+ get: warnAboutAccessingRef,
633
+ configurable: true
634
+ });
635
+ }
636
+ }
637
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
638
+ var element = {
639
+ // This tag allows us to uniquely identify this as a React Element
640
+ $$typeof: REACT_ELEMENT_TYPE,
641
+ // Built-in properties that belong on the element
642
+ type,
643
+ key,
644
+ ref,
645
+ props,
646
+ // Record the component responsible for creating this element.
647
+ _owner: owner
648
+ };
649
+ {
650
+ element._store = {};
651
+ Object.defineProperty(element._store, "validated", {
652
+ configurable: false,
653
+ enumerable: false,
654
+ writable: true,
655
+ value: false
656
+ });
657
+ Object.defineProperty(element, "_self", {
658
+ configurable: false,
659
+ enumerable: false,
660
+ writable: false,
661
+ value: self
662
+ });
663
+ Object.defineProperty(element, "_source", {
664
+ configurable: false,
665
+ enumerable: false,
666
+ writable: false,
667
+ value: source
668
+ });
669
+ if (Object.freeze) {
670
+ Object.freeze(element.props);
671
+ Object.freeze(element);
672
+ }
673
+ }
674
+ return element;
675
+ };
676
+ function jsxDEV(type, config, maybeKey, source, self) {
677
+ {
678
+ var propName;
679
+ var props = {};
680
+ var key = null;
681
+ var ref = null;
682
+ if (maybeKey !== void 0) {
683
+ {
684
+ checkKeyStringCoercion(maybeKey);
685
+ }
686
+ key = "" + maybeKey;
687
+ }
688
+ if (hasValidKey(config)) {
689
+ {
690
+ checkKeyStringCoercion(config.key);
691
+ }
692
+ key = "" + config.key;
693
+ }
694
+ if (hasValidRef(config)) {
695
+ ref = config.ref;
696
+ warnIfStringRefCannotBeAutoConverted(config, self);
697
+ }
698
+ for (propName in config) {
699
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
700
+ props[propName] = config[propName];
701
+ }
702
+ }
703
+ if (type && type.defaultProps) {
704
+ var defaultProps = type.defaultProps;
705
+ for (propName in defaultProps) {
706
+ if (props[propName] === void 0) {
707
+ props[propName] = defaultProps[propName];
708
+ }
709
+ }
710
+ }
711
+ if (key || ref) {
712
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
713
+ if (key) {
714
+ defineKeyPropWarningGetter(props, displayName);
715
+ }
716
+ if (ref) {
717
+ defineRefPropWarningGetter(props, displayName);
718
+ }
719
+ }
720
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
721
+ }
722
+ }
723
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
724
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
725
+ function setCurrentlyValidatingElement$1(element) {
726
+ {
727
+ if (element) {
728
+ var owner = element._owner;
729
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
730
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
731
+ } else {
732
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
733
+ }
734
+ }
735
+ }
736
+ var propTypesMisspellWarningShown;
737
+ {
738
+ propTypesMisspellWarningShown = false;
739
+ }
740
+ function isValidElement(object) {
741
+ {
742
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
743
+ }
744
+ }
745
+ function getDeclarationErrorAddendum() {
746
+ {
747
+ if (ReactCurrentOwner$1.current) {
748
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
749
+ if (name) {
750
+ return "\n\nCheck the render method of `" + name + "`.";
751
+ }
752
+ }
753
+ return "";
754
+ }
755
+ }
756
+ function getSourceInfoErrorAddendum(source) {
757
+ {
758
+ if (source !== void 0) {
759
+ var fileName = source.fileName.replace(/^.*[\\\/]/, "");
760
+ var lineNumber = source.lineNumber;
761
+ return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
762
+ }
763
+ return "";
764
+ }
765
+ }
766
+ var ownerHasKeyUseWarning = {};
767
+ function getCurrentComponentErrorInfo(parentType) {
768
+ {
769
+ var info = getDeclarationErrorAddendum();
770
+ if (!info) {
771
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
772
+ if (parentName) {
773
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
774
+ }
775
+ }
776
+ return info;
777
+ }
778
+ }
779
+ function validateExplicitKey(element, parentType) {
780
+ {
781
+ if (!element._store || element._store.validated || element.key != null) {
782
+ return;
783
+ }
784
+ element._store.validated = true;
785
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
786
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
787
+ return;
788
+ }
789
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
790
+ var childOwner = "";
791
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
792
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
793
+ }
794
+ setCurrentlyValidatingElement$1(element);
795
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
796
+ setCurrentlyValidatingElement$1(null);
797
+ }
798
+ }
799
+ function validateChildKeys(node, parentType) {
800
+ {
801
+ if (typeof node !== "object") {
802
+ return;
803
+ }
804
+ if (isArray(node)) {
805
+ for (var i = 0; i < node.length; i++) {
806
+ var child = node[i];
807
+ if (isValidElement(child)) {
808
+ validateExplicitKey(child, parentType);
809
+ }
810
+ }
811
+ } else if (isValidElement(node)) {
812
+ if (node._store) {
813
+ node._store.validated = true;
814
+ }
815
+ } else if (node) {
816
+ var iteratorFn = getIteratorFn(node);
817
+ if (typeof iteratorFn === "function") {
818
+ if (iteratorFn !== node.entries) {
819
+ var iterator = iteratorFn.call(node);
820
+ var step;
821
+ while (!(step = iterator.next()).done) {
822
+ if (isValidElement(step.value)) {
823
+ validateExplicitKey(step.value, parentType);
824
+ }
825
+ }
826
+ }
827
+ }
828
+ }
829
+ }
830
+ }
831
+ function validatePropTypes(element) {
832
+ {
833
+ var type = element.type;
834
+ if (type === null || type === void 0 || typeof type === "string") {
835
+ return;
836
+ }
837
+ var propTypes;
838
+ if (typeof type === "function") {
839
+ propTypes = type.propTypes;
840
+ } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
841
+ // Inner props are checked in the reconciler.
842
+ type.$$typeof === REACT_MEMO_TYPE)) {
843
+ propTypes = type.propTypes;
844
+ } else {
845
+ return;
846
+ }
847
+ if (propTypes) {
848
+ var name = getComponentNameFromType(type);
849
+ checkPropTypes(propTypes, element.props, "prop", name, element);
850
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
851
+ propTypesMisspellWarningShown = true;
852
+ var _name = getComponentNameFromType(type);
853
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
854
+ }
855
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
856
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
857
+ }
858
+ }
859
+ }
860
+ function validateFragmentProps(fragment) {
861
+ {
862
+ var keys = Object.keys(fragment.props);
863
+ for (var i = 0; i < keys.length; i++) {
864
+ var key = keys[i];
865
+ if (key !== "children" && key !== "key") {
866
+ setCurrentlyValidatingElement$1(fragment);
867
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
868
+ setCurrentlyValidatingElement$1(null);
869
+ break;
870
+ }
871
+ }
872
+ if (fragment.ref !== null) {
873
+ setCurrentlyValidatingElement$1(fragment);
874
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
875
+ setCurrentlyValidatingElement$1(null);
876
+ }
877
+ }
878
+ }
879
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
880
+ {
881
+ var validType = isValidElementType(type);
882
+ if (!validType) {
883
+ var info = "";
884
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
885
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
886
+ }
887
+ var sourceInfo = getSourceInfoErrorAddendum(source);
888
+ if (sourceInfo) {
889
+ info += sourceInfo;
890
+ } else {
891
+ info += getDeclarationErrorAddendum();
892
+ }
893
+ var typeString;
894
+ if (type === null) {
895
+ typeString = "null";
896
+ } else if (isArray(type)) {
897
+ typeString = "array";
898
+ } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
899
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
900
+ info = " Did you accidentally export a JSX literal instead of a component?";
901
+ } else {
902
+ typeString = typeof type;
903
+ }
904
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
905
+ }
906
+ var element = jsxDEV(type, props, key, source, self);
907
+ if (element == null) {
908
+ return element;
909
+ }
910
+ if (validType) {
911
+ var children = props.children;
912
+ if (children !== void 0) {
913
+ if (isStaticChildren) {
914
+ if (isArray(children)) {
915
+ for (var i = 0; i < children.length; i++) {
916
+ validateChildKeys(children[i], type);
917
+ }
918
+ if (Object.freeze) {
919
+ Object.freeze(children);
920
+ }
921
+ } else {
922
+ 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.");
923
+ }
924
+ } else {
925
+ validateChildKeys(children, type);
926
+ }
927
+ }
928
+ }
929
+ if (type === REACT_FRAGMENT_TYPE) {
930
+ validateFragmentProps(element);
931
+ } else {
932
+ validatePropTypes(element);
933
+ }
934
+ return element;
935
+ }
936
+ }
937
+ function jsxWithValidationStatic(type, props, key) {
938
+ {
939
+ return jsxWithValidation(type, props, key, true);
940
+ }
941
+ }
942
+ function jsxWithValidationDynamic(type, props, key) {
943
+ {
944
+ return jsxWithValidation(type, props, key, false);
945
+ }
946
+ }
947
+ var jsx = jsxWithValidationDynamic;
948
+ var jsxs = jsxWithValidationStatic;
949
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
950
+ reactJsxRuntime_development.jsx = jsx;
951
+ reactJsxRuntime_development.jsxs = jsxs;
952
+ })();
953
+ }
954
+ return reactJsxRuntime_development;
955
+ }
956
+ if (process.env.NODE_ENV === "production") {
957
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
958
+ } else {
959
+ jsxRuntime.exports = requireReactJsxRuntime_development();
960
+ }
961
+ var jsxRuntimeExports = jsxRuntime.exports;
962
+ var createRoot;
963
+ var m = require$$0$1;
964
+ if (process.env.NODE_ENV === "production") {
965
+ createRoot = m.createRoot;
966
+ m.hydrateRoot;
967
+ } else {
968
+ var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
969
+ createRoot = function(c, o) {
970
+ i.usingClientEntryPoint = true;
971
+ try {
972
+ return m.createRoot(c, o);
973
+ } finally {
974
+ i.usingClientEntryPoint = false;
975
+ }
976
+ };
977
+ }
978
+ function cn(...inputs) {
979
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
980
+ }
981
+ function setCooke({
982
+ key,
983
+ value,
984
+ expires,
985
+ path,
986
+ samesite,
987
+ secure
988
+ }) {
989
+ document.cookie = `${key}=${value}; ${expires ? `expires=${expires.toString()};` : ""} ${path ? `path=${path};` : ""} ${samesite ? `samesite=${samesite};` : ""} ${secure ? `secure=${secure};` : ""}`;
990
+ }
991
+ function deleteCookie(key) {
992
+ document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
993
+ }
994
+ function getCookie(key) {
995
+ const cookies = document.cookie.split(";");
996
+ for (const cookie of cookies) {
997
+ const [cookieKey2, cookieValue] = cookie.split("=");
998
+ if (cookieKey2.trim() === key)
999
+ return cookieValue;
1000
+ }
1001
+ return "";
1002
+ }
1003
+ function hasCookie(key) {
1004
+ return document.cookie.includes(`${key}=`);
1005
+ }
1006
+ const Table = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1007
+ "table",
1008
+ {
1009
+ ref,
1010
+ className: cn("w-full caption-bottom text-sm", className),
1011
+ ...props
1012
+ }
1013
+ ) }));
1014
+ Table.displayName = "Table";
1015
+ const TableHeader = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
1016
+ TableHeader.displayName = "TableHeader";
1017
+ const TableBody = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1018
+ "tbody",
1019
+ {
1020
+ ref,
1021
+ className: cn("[&_tr:last-child]:border-0", className),
1022
+ ...props
1023
+ }
1024
+ ));
1025
+ TableBody.displayName = "TableBody";
1026
+ const TableFooter = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1027
+ "tfoot",
1028
+ {
1029
+ ref,
1030
+ className: cn(
1031
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
1032
+ className
1033
+ ),
1034
+ ...props
1035
+ }
1036
+ ));
1037
+ TableFooter.displayName = "TableFooter";
1038
+ const TableRow = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1039
+ "tr",
1040
+ {
1041
+ ref,
1042
+ className: cn(
1043
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
1044
+ className
1045
+ ),
1046
+ ...props
1047
+ }
1048
+ ));
1049
+ TableRow.displayName = "TableRow";
1050
+ const TableHead = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1051
+ "th",
1052
+ {
1053
+ ref,
1054
+ className: cn(
1055
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1056
+ className
1057
+ ),
1058
+ ...props
1059
+ }
1060
+ ));
1061
+ TableHead.displayName = "TableHead";
1062
+ const TableCell = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1063
+ "td",
1064
+ {
1065
+ ref,
1066
+ className: cn(
1067
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1068
+ className
1069
+ ),
1070
+ ...props
1071
+ }
1072
+ ));
1073
+ TableCell.displayName = "TableCell";
1074
+ const TableCaption = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1075
+ "caption",
1076
+ {
1077
+ ref,
1078
+ className: cn("mt-4 text-sm text-muted-foreground", className),
1079
+ ...props
1080
+ }
1081
+ ));
1082
+ TableCaption.displayName = "TableCaption";
1083
+ const badgeVariants = classVarianceAuthority.cva(
1084
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1085
+ {
1086
+ variants: {
1087
+ variant: {
1088
+ default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
1089
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1090
+ destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
1091
+ outline: "text-foreground"
1092
+ }
1093
+ },
1094
+ defaultVariants: {
1095
+ variant: "default"
1096
+ }
1097
+ }
1098
+ );
1099
+ function Badge({ className, variant, ...props }) {
1100
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
1101
+ }
1102
+ const buttonVariants = classVarianceAuthority.cva(
1103
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
1104
+ {
1105
+ variants: {
1106
+ variant: {
1107
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
1108
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
1109
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
1110
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
1111
+ ghost: "hover:bg-accent hover:text-accent-foreground",
1112
+ link: "text-primary underline-offset-4 hover:underline"
1113
+ },
1114
+ size: {
1115
+ default: "h-9 px-4 py-2",
1116
+ sm: "h-6 rounded-md px-3 text-xs",
1117
+ lg: "h-10 rounded-md px-8",
1118
+ icon: "h-9 w-9"
1119
+ }
1120
+ },
1121
+ defaultVariants: {
1122
+ variant: "default",
1123
+ size: "default"
1124
+ }
1125
+ }
1126
+ );
1127
+ const Button = require$$0.forwardRef(
1128
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
1129
+ const Component = asChild ? reactSlot.Slot : "button";
1130
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1131
+ Component,
1132
+ {
1133
+ className: cn(buttonVariants({ variant, size, className })),
1134
+ ref,
1135
+ ...props
1136
+ }
1137
+ );
1138
+ }
1139
+ );
1140
+ Button.displayName = "Button";
1141
+ const Sheet = SheetPrimitive__namespace.Root;
1142
+ const SheetTrigger = SheetPrimitive__namespace.Trigger;
1143
+ const SheetPortal = SheetPrimitive__namespace.Portal;
1144
+ const SheetOverlay = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1145
+ SheetPrimitive__namespace.Overlay,
1146
+ {
1147
+ className: cn(
1148
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1149
+ className
1150
+ ),
1151
+ ...props,
1152
+ ref
1153
+ }
1154
+ ));
1155
+ SheetOverlay.displayName = SheetPrimitive__namespace.Overlay.displayName;
1156
+ const sheetVariants = classVarianceAuthority.cva(
1157
+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
1158
+ {
1159
+ variants: {
1160
+ side: {
1161
+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1162
+ bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1163
+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1164
+ right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-[calc(100vw-16rem)]"
1165
+ }
1166
+ },
1167
+ defaultVariants: {
1168
+ side: "right"
1169
+ }
1170
+ }
1171
+ );
1172
+ const SheetContent = require$$0.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPortal, { children: [
1173
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetOverlay, {}),
1174
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
1175
+ SheetPrimitive__namespace.Content,
1176
+ {
1177
+ ref,
1178
+ className: cn(sheetVariants({ side }), className),
1179
+ ...props,
1180
+ children: [
1181
+ children,
1182
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
1183
+ /* @__PURE__ */ jsxRuntimeExports.jsx(reactIcons.Cross2Icon, { className: "h-4 w-4" }),
1184
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Close" })
1185
+ ] })
1186
+ ]
1187
+ }
1188
+ )
1189
+ ] }));
1190
+ SheetContent.displayName = SheetPrimitive__namespace.Content.displayName;
1191
+ function SheetHeader({
1192
+ className,
1193
+ ...props
1194
+ }) {
1195
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1196
+ "div",
1197
+ {
1198
+ className: cn(
1199
+ "flex flex-col space-y-2 text-center sm:text-left",
1200
+ className
1201
+ ),
1202
+ ...props
1203
+ }
1204
+ );
1205
+ }
1206
+ SheetHeader.displayName = "SheetHeader";
1207
+ const SheetTitle = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1208
+ SheetPrimitive__namespace.Title,
1209
+ {
1210
+ ref,
1211
+ className: cn("text-lg font-semibold text-foreground", className),
1212
+ ...props
1213
+ }
1214
+ ));
1215
+ SheetTitle.displayName = SheetPrimitive__namespace.Title.displayName;
1216
+ const SheetDescription = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1217
+ SheetPrimitive__namespace.Description,
1218
+ {
1219
+ ref,
1220
+ className: cn("text-sm text-muted-foreground", className),
1221
+ ...props
1222
+ }
1223
+ ));
1224
+ SheetDescription.displayName = SheetPrimitive__namespace.Description.displayName;
1225
+ const slotStatus = {
1226
+ unloaded: "Waiting to load",
1227
+ loaded: "Ready to render",
1228
+ rendered: "Rendered"
1229
+ };
1230
+ const slotIndexBadgeClasses = [
1231
+ "bg-blue-500 hover:bg-blue-500",
1232
+ "bg-amber-500 hover:bg-amber-500",
1233
+ "bg-green-500 hover:bg-green-500",
1234
+ "bg-red-500 hover:bg-red-500",
1235
+ "bg-purple-500 hover:bg-purple-500",
1236
+ "bg-cyan-500 hover:bg-cyan-500",
1237
+ "bg-pink-500 hover:bg-pink-500"
1238
+ ];
1239
+ function SlotsTable({ adheseContext }) {
1240
+ const [slots, setSlots] = require$$0.useState([]);
1241
+ require$$0.useEffect(() => {
1242
+ var _a, _b;
1243
+ function onSlotsChange(newSlots) {
1244
+ setSlots(newSlots);
1245
+ }
1246
+ (_a = adheseContext.events) == null ? void 0 : _a.changeSlots.addListener(onSlotsChange);
1247
+ onSlotsChange(((_b = adheseContext.getAll) == null ? void 0 : _b.call(adheseContext)) ?? []);
1248
+ return () => {
1249
+ var _a2;
1250
+ (_a2 = adheseContext.events) == null ? void 0 : _a2.changeSlots.removeListener(onSlotsChange);
1251
+ };
1252
+ }, []);
1253
+ const formattedSlots = require$$0.useMemo(() => slots.map((slot) => {
1254
+ const ad = slot.getAd();
1255
+ const iframe = slot.getElement();
1256
+ let status = "unloaded";
1257
+ if (iframe)
1258
+ status = "rendered";
1259
+ else if (ad)
1260
+ status = "loaded";
1261
+ return {
1262
+ ...slot,
1263
+ name: slot.getName(),
1264
+ ad,
1265
+ status,
1266
+ format: slot.getFormat(),
1267
+ iframe,
1268
+ parameters: Array.from(slot.parameters.entries())
1269
+ };
1270
+ }), [slots]);
1271
+ const slotParametersExist = formattedSlots.some((formattedSlot) => formattedSlot.parameters.length > 0);
1272
+ const previewExist = formattedSlots.some((formattedSlot) => {
1273
+ var _a;
1274
+ return (_a = formattedSlot.ad) == null ? void 0 : _a.preview;
1275
+ });
1276
+ return formattedSlots.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, { children: [
1277
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1278
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Name" }),
1279
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Format" }),
1280
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Location" }),
1281
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Render Status" }),
1282
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Campaign ID" }),
1283
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Booking ID" }),
1284
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Creative ID" }),
1285
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Traffic ID" }),
1286
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Creative type" }),
1287
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Viewability tracked" }),
1288
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Impression tracked" }),
1289
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Element" }),
1290
+ slotParametersExist && /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Parameters" }),
1291
+ previewExist && /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Preview" })
1292
+ ] }) }),
1293
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { children: formattedSlots.map(({
1294
+ ad,
1295
+ name,
1296
+ format,
1297
+ location,
1298
+ status,
1299
+ isViewabilityTracked,
1300
+ isImpressionTracked,
1301
+ iframe,
1302
+ parameters
1303
+ }, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(require$$0.Fragment, { children: [
1304
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { id: name, children: [
1305
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { className: "font-medium", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: cn(slotIndexBadgeClasses[index % slotIndexBadgeClasses.length], "text-white"), children: name }) }),
1306
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: !(ad == null ? void 0 : ad.adFormat) || (ad == null ? void 0 : ad.adFormat) === format ? format : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1307
+ /* @__PURE__ */ jsxRuntimeExports.jsx("del", { className: "text-red-300 italic", children: format }),
1308
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ins", { className: "no-underline text-green-700", children: ad == null ? void 0 : ad.adFormat })
1309
+ ] }) }),
1310
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: location }),
1311
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1312
+ Badge,
1313
+ {
1314
+ className: cn({
1315
+ unloaded: "bg-secondary text-secondary-foreground hover:bg-secondary",
1316
+ loaded: "bg-blue-100 text-blue-900 hover:bg-blue-100",
1317
+ rendered: "bg-green-100 text-green-900 hover:bg-green-100"
1318
+ }[status]),
1319
+ children: slotStatus[status]
1320
+ }
1321
+ ) }),
1322
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.orderId) && (ad == null ? void 0 : ad.orderId) !== "0" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1323
+ "a",
1324
+ {
1325
+ href: `https://${adheseContext.options.account}.adhese.org/campaigns.html#campaignDetail/editCampaign/${ad.orderId}`,
1326
+ target: "_blank",
1327
+ referrerPolicy: "no-referrer",
1328
+ className: cn(buttonVariants({
1329
+ variant: "ghost",
1330
+ size: "sm"
1331
+ })),
1332
+ children: ad.orderId
1333
+ }
1334
+ ) : "-" }),
1335
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.adspaceId) && (ad == null ? void 0 : ad.adspaceId) !== "0" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1336
+ "a",
1337
+ {
1338
+ href: `https://${adheseContext.options.account}.adhese.org/campaigns.html#campaignDetail/bookingDetail/${ad.adspaceId}/${ad.orderId}`,
1339
+ target: "_blank",
1340
+ referrerPolicy: "no-referrer",
1341
+ className: cn(buttonVariants({
1342
+ variant: "ghost",
1343
+ size: "sm"
1344
+ })),
1345
+ children: ad.adspaceId
1346
+ }
1347
+ ) : "-" }),
1348
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.libId) && (ad == null ? void 0 : ad.orderId) !== "0" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1349
+ "a",
1350
+ {
1351
+ href: `https://${adheseContext.options.account}.adhese.org/campaigns.html#campaignDetail/creativeDetail/${ad.libId}/${ad.orderId}`,
1352
+ target: "_blank",
1353
+ referrerPolicy: "no-referrer",
1354
+ className: cn(buttonVariants({
1355
+ variant: "ghost",
1356
+ size: "sm"
1357
+ })),
1358
+ children: ad.libId
1359
+ }
1360
+ ) : "-" }),
1361
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.id) ?? "-" }),
1362
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.ext) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: ad.ext }) : "-" }),
1363
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: isViewabilityTracked() ? /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: "bg-green-100 text-green-900 hover:bg-green-100", children: "Yes" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", children: "No" }) }),
1364
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: isImpressionTracked() ? /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: "bg-green-100 text-green-900 hover:bg-green-100", children: "Yes" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", children: "No" }) }),
1365
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1366
+ Button,
1367
+ {
1368
+ variant: "secondary",
1369
+ size: "sm",
1370
+ disabled: !iframe,
1371
+ onClick: () => {
1372
+ if (iframe) {
1373
+ iframe.scrollIntoView();
1374
+ iframe.style.outline = "solid 5px red";
1375
+ setTimeout(() => {
1376
+ iframe.style.outline = "";
1377
+ }, 1e3);
1378
+ }
1379
+ },
1380
+ children: "Go to element"
1381
+ }
1382
+ ) }),
1383
+ slotParametersExist && /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: parameters.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Sheet, { children: [
1384
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1385
+ SheetTrigger,
1386
+ {
1387
+ className: buttonVariants({
1388
+ variant: "secondary",
1389
+ size: "sm"
1390
+ }),
1391
+ children: "Show"
1392
+ }
1393
+ ),
1394
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetContent, { className: "bg-white flex flex-col gap-4", children: [
1395
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SheetTitle, { children: "Parameters" }) }),
1396
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, { children: [
1397
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1398
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Key" }),
1399
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Value" })
1400
+ ] }) }),
1401
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { children: parameters.map(([parameterName, value]) => /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1402
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: parameterName }) }),
1403
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: Array.isArray(value) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "flex gap-1", children: value.map((item, paramIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: item }) }, paramIndex)) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: value }) })
1404
+ ] }, parameterName)) })
1405
+ ] })
1406
+ ] })
1407
+ ] }) }),
1408
+ previewExist && /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: (ad == null ? void 0 : ad.preview) && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: "bg-amber-400 text-amber-950 hover:bg-amber-400", children: "PREVIEW" }) })
1409
+ ] }),
1410
+ (iframe == null ? void 0 : iframe.parentElement) && require$$0$1.createPortal(
1411
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute inset-1 flex gap-2 items-start", children: [
1412
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: cn(slotIndexBadgeClasses[index % slotIndexBadgeClasses.length], "text-white"), children: name }),
1413
+ (ad == null ? void 0 : ad.preview) && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: "bg-amber-400 text-amber-950 hover:bg-amber-400", children: "PREVIEW" })
1414
+ ] }),
1415
+ iframe.parentElement
1416
+ )
1417
+ ] }, name)) })
1418
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "No slots available" });
1419
+ }
1420
+ const Tabs = TabsPrimitive__namespace.Root;
1421
+ const TabsList = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1422
+ TabsPrimitive__namespace.List,
1423
+ {
1424
+ ref,
1425
+ className: cn(
1426
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
1427
+ className
1428
+ ),
1429
+ ...props
1430
+ }
1431
+ ));
1432
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
1433
+ const TabsTrigger = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1434
+ TabsPrimitive__namespace.Trigger,
1435
+ {
1436
+ ref,
1437
+ className: cn(
1438
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
1439
+ className
1440
+ ),
1441
+ ...props
1442
+ }
1443
+ ));
1444
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
1445
+ const TabsContent = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1446
+ TabsPrimitive__namespace.Content,
1447
+ {
1448
+ ref,
1449
+ className: cn(
1450
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1451
+ className
1452
+ ),
1453
+ ...props
1454
+ }
1455
+ ));
1456
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1457
+ const dateFormatter = new Intl.DateTimeFormat("en-US", {
1458
+ hour: "numeric",
1459
+ minute: "numeric",
1460
+ second: "numeric",
1461
+ fractionalSecondDigits: 3,
1462
+ hour12: false
1463
+ });
1464
+ const logTableRowClasses = {
1465
+ error: "bg-red-100 text-red-900",
1466
+ warn: "bg-amber-100 text-amber-900"
1467
+ };
1468
+ const logBadgeClasses = {
1469
+ error: "bg-red-500 text-white",
1470
+ warn: "bg-amber-500 text-white",
1471
+ info: "bg-blue-500 text-white"
1472
+ };
1473
+ function LogTable({
1474
+ adheseContext
1475
+ }) {
1476
+ const [logs, setLogs] = require$$0.useState([]);
1477
+ require$$0.useEffect(() => {
1478
+ function onLogsChange() {
1479
+ setLogs(
1480
+ adheseContext.logger.getLogs().toSorted(
1481
+ (a, b) => b.timestamp - a.timestamp
1482
+ )
1483
+ );
1484
+ }
1485
+ adheseContext.logger.events.log.addListener(onLogsChange);
1486
+ onLogsChange();
1487
+ return () => {
1488
+ adheseContext.logger.events.log.removeListener(onLogsChange);
1489
+ };
1490
+ }, []);
1491
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, { children: [
1492
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1493
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Time" }),
1494
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Scope" }),
1495
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Level" }),
1496
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Message" }),
1497
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Attributes" })
1498
+ ] }) }),
1499
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { children: logs.map((log) => /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { className: logTableRowClasses[log.level] ?? "", children: [
1500
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: dateFormatter.format(new Date(log.timestamp)) }),
1501
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: log.scope }),
1502
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1503
+ Badge,
1504
+ {
1505
+ variant: "secondary",
1506
+ className: logBadgeClasses[log.level] ?? "",
1507
+ children: lodashEs.upperFirst(log.level)
1508
+ }
1509
+ ) }),
1510
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: log.message }),
1511
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: Boolean(log.attributes) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Sheet, { children: [
1512
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1513
+ SheetTrigger,
1514
+ {
1515
+ className: buttonVariants({
1516
+ variant: "secondary",
1517
+ size: "sm"
1518
+ }),
1519
+ children: "Show"
1520
+ }
1521
+ ),
1522
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetContent, { className: "bg-white flex flex-col gap-4", children: [
1523
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SheetHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SheetTitle, { children: "Attributes" }) }),
1524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "p-4 bg-accent overflow-auto max-h-full text-sm rounded-md", children: JSON.stringify(log.attributes, null, 2) })
1525
+ ] })
1526
+ ] }) })
1527
+ ] }, log.id)) })
1528
+ ] });
1529
+ }
1530
+ function ParametersTable({
1531
+ adheseContext
1532
+ }) {
1533
+ const [parameters, setParameters] = require$$0.useState([]);
1534
+ require$$0.useEffect(() => {
1535
+ var _a;
1536
+ function onParametersChange() {
1537
+ var _a2;
1538
+ setParameters(Array.from(((_a2 = adheseContext.parameters) == null ? void 0 : _a2.entries()) ?? []).map(([name, value]) => ({
1539
+ name,
1540
+ value
1541
+ })).toSorted((a, b) => a.name.localeCompare(b.name)));
1542
+ }
1543
+ (_a = adheseContext.events) == null ? void 0 : _a.parametersChange.addListener(onParametersChange);
1544
+ onParametersChange();
1545
+ return () => {
1546
+ var _a2;
1547
+ (_a2 = adheseContext.events) == null ? void 0 : _a2.parametersChange.removeListener(onParametersChange);
1548
+ };
1549
+ }, []);
1550
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Table, { children: [
1551
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1552
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Parameter" }),
1553
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableHead, { children: "Value" })
1554
+ ] }) }),
1555
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableBody, { children: parameters.map((parameter) => /* @__PURE__ */ jsxRuntimeExports.jsxs(TableRow, { children: [
1556
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: parameter.name }) }),
1557
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TableCell, { children: Array.isArray(parameter.value) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "flex gap-1", children: parameter.value.map((item, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: item }) }, index)) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", children: parameter.value }) })
1558
+ ] }, parameter.name)) })
1559
+ ] });
1560
+ }
1561
+ const Switch = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1562
+ SwitchPrimitives__namespace.Root,
1563
+ {
1564
+ className: cn(
1565
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
1566
+ className
1567
+ ),
1568
+ ...props,
1569
+ ref,
1570
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1571
+ SwitchPrimitives__namespace.Thumb,
1572
+ {
1573
+ className: cn(
1574
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
1575
+ )
1576
+ }
1577
+ )
1578
+ }
1579
+ ));
1580
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
1581
+ const labelVariants = classVarianceAuthority.cva(
1582
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1583
+ );
1584
+ const Label = require$$0.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1585
+ LabelPrimitive__namespace.Root,
1586
+ {
1587
+ ref,
1588
+ className: cn(labelVariants(), className),
1589
+ ...props
1590
+ }
1591
+ ));
1592
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
1593
+ const Input = require$$0.forwardRef(
1594
+ ({ className, type, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1595
+ "input",
1596
+ {
1597
+ type,
1598
+ className: cn(
1599
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
1600
+ className
1601
+ ),
1602
+ ref,
1603
+ ...props
1604
+ }
1605
+ )
1606
+ );
1607
+ Input.displayName = "Input";
1608
+ const cookieKey = "debugKey";
1609
+ function setDebugCookie(value) {
1610
+ setCooke({
1611
+ key: cookieKey,
1612
+ value,
1613
+ expires: new Date(Date.now() + 24 * 60 * 60 * 1e3)
1614
+ });
1615
+ }
1616
+ function simpleStringify(value) {
1617
+ if (typeof value === "object")
1618
+ return Object.values(value).map((nestedValue) => `${simpleStringify(nestedValue)}`).join("");
1619
+ if (typeof value === "boolean")
1620
+ return value ? "1" : "0";
1621
+ return String(value);
1622
+ }
1623
+ function FronttailSettings({
1624
+ adheseContext,
1625
+ className,
1626
+ "aria-labelledby": ariaLabelledBy,
1627
+ ...props
1628
+ }) {
1629
+ const autoGeneratedKey = require$$0.useMemo(() => `adhese-${adheseContext.options.account}-${btoa(simpleStringify(adheseContext.options)).slice(0, 20)}`, [adheseContext.options]);
1630
+ const [fronttailDebugKey, setFronttailDebugKey] = require$$0.useState(hasCookie(cookieKey) ? getCookie(cookieKey) : autoGeneratedKey);
1631
+ const [isFronttailEnabled, setIsFronttailEnabled] = require$$0.useState(hasCookie(cookieKey));
1632
+ const onFronttailDebugKeyChange = require$$0.useCallback((event) => {
1633
+ const { value } = event.target;
1634
+ setFronttailDebugKey(value);
1635
+ if (isFronttailEnabled && value.length > 4)
1636
+ setDebugCookie(value);
1637
+ }, [setDebugCookie, isFronttailEnabled]);
1638
+ const onFrontailEnabledChange = require$$0.useCallback(() => {
1639
+ setIsFronttailEnabled((value) => {
1640
+ if (value)
1641
+ deleteCookie(cookieKey);
1642
+ else
1643
+ setDebugCookie(fronttailDebugKey);
1644
+ return !value;
1645
+ });
1646
+ }, [setDebugCookie, fronttailDebugKey]);
1647
+ const id = require$$0.useId();
1648
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: cn("flex flex-col gap-6", className), "aria-labelledby": ariaLabelledBy ?? `fronttailHeading${id}`, ...props, children: [
1649
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-lg font-semibold", id: `fronttailHeading${id}`, children: "Fronttail settings" }),
1650
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
1651
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { checked: isFronttailEnabled, onCheckedChange: onFrontailEnabledChange, id: `fronttailSwitch${id}` }),
1652
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { htmlFor: `fronttailSwitch${id}`, children: [
1653
+ "Enable Fronttail debugging",
1654
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-gray-400 font-normal", children: " – Cookie will expire automatically in 1 day" })
1655
+ ] })
1656
+ ] }),
1657
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
1658
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: `fronttailDebugKey${id}`, children: "Debug key" }),
1659
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
1660
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1661
+ Input,
1662
+ {
1663
+ id: `fronttailDebugKey${id}`,
1664
+ value: fronttailDebugKey,
1665
+ onChange: onFronttailDebugKeyChange,
1666
+ className: cn(
1667
+ "max-w-60",
1668
+ {
1669
+ // eslint-disable-next-line ts/naming-convention
1670
+ "border-destructive": fronttailDebugKey.length < 4
1671
+ }
1672
+ )
1673
+ }
1674
+ ),
1675
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1676
+ Button,
1677
+ {
1678
+ variant: "outline",
1679
+ onClick: () => {
1680
+ setFronttailDebugKey(autoGeneratedKey);
1681
+ if (isFronttailEnabled)
1682
+ setDebugCookie(autoGeneratedKey);
1683
+ },
1684
+ children: "Auto generate key"
1685
+ }
1686
+ )
1687
+ ] }),
1688
+ fronttailDebugKey.length < 4 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-destructive", children: "Debug key must contain at least 4 characters" })
1689
+ ] })
1690
+ ] });
1691
+ }
1692
+ const settingClasses = "border-solid border-b-2 border-accent pb-8 mb-8 last:mb-0 last:pb-0 last:border-0";
1693
+ function Settings({
1694
+ adheseContext
1695
+ }) {
1696
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(FronttailSettings, { adheseContext, className: settingClasses }) });
1697
+ }
1698
+ function PreviewButton() {
1699
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: window.location.search.includes("adhesePreviewCreativeId") && /* @__PURE__ */ jsxRuntimeExports.jsx(
1700
+ Button,
1701
+ {
1702
+ onClick: () => {
1703
+ const currentUrl = new URL(window.location.href);
1704
+ window.location.replace(`${currentUrl.origin}${currentUrl.pathname === "/" ? "" : currentUrl.pathname}`);
1705
+ },
1706
+ variant: "secondary",
1707
+ children: "Disable preview mode"
1708
+ }
1709
+ ) });
1710
+ }
1711
+ function App({ adheseContext }) {
1712
+ const [spacing, setSpacing] = require$$0.useState(0);
1713
+ const appRef = require$$0.useRef(null);
1714
+ const [isOpen, setIsOpen] = require$$0.useState(false);
1715
+ require$$0.useEffect(() => {
1716
+ let resizeObserver;
1717
+ if (isOpen) {
1718
+ resizeObserver = new ResizeObserver(
1719
+ ([entry]) => {
1720
+ setSpacing(entry.target.getBoundingClientRect().height);
1721
+ }
1722
+ );
1723
+ if (appRef.current)
1724
+ resizeObserver.observe(appRef.current);
1725
+ }
1726
+ return () => {
1727
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
1728
+ };
1729
+ }, [isOpen]);
1730
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "adhese-devtools", children: isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1731
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1732
+ "section",
1733
+ {
1734
+ className: "fixed bottom-0 w-full border-t-2 border-t-accent bg-background shadow-lg overflow-auto",
1735
+ ref: appRef,
1736
+ "aria-label": "Adhese Devtools",
1737
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "slots", children: [
1738
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between p-4", children: [
1739
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { children: [
1740
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "slots", children: "Slots" }),
1741
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "logs", children: "Logs" }),
1742
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "parameters", children: "Parameters" }),
1743
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "settings", children: "Settings" })
1744
+ ] }),
1745
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
1746
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PreviewButton, {}),
1747
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1748
+ Button,
1749
+ {
1750
+ onClick: setIsOpen.bind(null, false),
1751
+ children: "Close"
1752
+ }
1753
+ )
1754
+ ] })
1755
+ ] }),
1756
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-auto max-h-96 border-t-2 border-t-accent p-4", children: [
1757
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "slots", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SlotsTable, { adheseContext }) }),
1758
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "logs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LogTable, { adheseContext }) }),
1759
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "parameters", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ParametersTable, { adheseContext }) }),
1760
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { adheseContext }) })
1761
+ ] })
1762
+ ] })
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1766
+ "div",
1767
+ {
1768
+ style: {
1769
+ height: spacing
1770
+ }
1771
+ }
1772
+ )
1773
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed bottom-4 right-4 flex flex-col gap-2", children: [
1774
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: setIsOpen.bind(null, true), children: "Open Adhese Devtools" }),
1775
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PreviewButton, {})
1776
+ ] }) });
1777
+ }
1778
+ function createAdheseDevtools(element, context) {
1779
+ const root = createRoot(element);
1780
+ root.render(/* @__PURE__ */ jsxRuntimeExports.jsx(App, { adheseContext: context }));
1781
+ return () => {
1782
+ root.unmount();
1783
+ };
1784
+ }
1785
+ exports.createAdheseDevtools = createAdheseDevtools;
1786
+ //# sourceMappingURL=devtools.js.map