@nice2dev/licensing 1.2.0 → 1.2.2

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,1462 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const SEGMENT_LENGTH = 4;
4
+ const NUM_SEGMENTS = 5;
5
+ const KEY_CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
6
+ const TIER_CODES = {
7
+ trial: 1,
8
+ personal: 2,
9
+ team: 3,
10
+ enterprise: 4,
11
+ site: 5,
12
+ oem: 6
13
+ };
14
+ const CODE_TO_TIER = /* @__PURE__ */ Object.entries(TIER_CODES).reduce(
15
+ (acc, [tier, code]) => ({ ...acc, [code]: tier }),
16
+ {}
17
+ );
18
+ function secureRandom(length) {
19
+ const array = new Uint8Array(length);
20
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
21
+ crypto.getRandomValues(array);
22
+ } else {
23
+ for (let i = 0; i < length; i++) {
24
+ array[i] = Math.floor(Math.random() * 256);
25
+ }
26
+ }
27
+ return Array.from(array).map((b) => KEY_CHARS[b % KEY_CHARS.length]).join("");
28
+ }
29
+ function calculateChecksum(data) {
30
+ let hash = 0;
31
+ for (let i = 0; i < data.length; i++) {
32
+ const char = data.charCodeAt(i);
33
+ hash = (hash << 5) - hash + char | 0;
34
+ }
35
+ const positive = Math.abs(hash);
36
+ let checksum = "";
37
+ let remaining = positive;
38
+ for (let i = 0; i < SEGMENT_LENGTH; i++) {
39
+ checksum += KEY_CHARS[remaining % KEY_CHARS.length];
40
+ remaining = Math.floor(remaining / KEY_CHARS.length);
41
+ }
42
+ return checksum;
43
+ }
44
+ function encodeMetadata(tier, year, month) {
45
+ const tierCode = TIER_CODES[tier];
46
+ const yearOffset = year - 2024;
47
+ const encoded = tierCode * 1e3 + yearOffset * 12 + month;
48
+ let segment = "";
49
+ let remaining = encoded;
50
+ for (let i = 0; i < SEGMENT_LENGTH; i++) {
51
+ segment += KEY_CHARS[remaining % KEY_CHARS.length];
52
+ remaining = Math.floor(remaining / KEY_CHARS.length);
53
+ }
54
+ return segment;
55
+ }
56
+ function decodeMetadata(segment) {
57
+ let decoded = 0;
58
+ for (let i = segment.length - 1; i >= 0; i--) {
59
+ const idx = KEY_CHARS.indexOf(segment[i]);
60
+ if (idx === -1) {
61
+ return null;
62
+ }
63
+ decoded = decoded * KEY_CHARS.length + idx;
64
+ }
65
+ const tierCode = Math.floor(decoded / 1e3);
66
+ const remainder = decoded % 1e3;
67
+ const yearOffset = Math.floor(remainder / 12);
68
+ const month = remainder % 12;
69
+ const tier = CODE_TO_TIER[tierCode];
70
+ if (!tier) {
71
+ return null;
72
+ }
73
+ return {
74
+ tier,
75
+ year: 2024 + yearOffset,
76
+ month
77
+ };
78
+ }
79
+ function generateLicenseKey(tier = "personal") {
80
+ const now = /* @__PURE__ */ new Date();
81
+ const metadataSegment = encodeMetadata(tier, now.getFullYear(), now.getMonth());
82
+ const randomSegments = [
83
+ secureRandom(SEGMENT_LENGTH),
84
+ secureRandom(SEGMENT_LENGTH),
85
+ secureRandom(SEGMENT_LENGTH)
86
+ ];
87
+ const dataWithoutChecksum = [metadataSegment, ...randomSegments].join("-");
88
+ const checksumSegment = calculateChecksum(dataWithoutChecksum);
89
+ return `${dataWithoutChecksum}-${checksumSegment}`;
90
+ }
91
+ function validateKeyFormat(key) {
92
+ const pattern = new RegExp(
93
+ `^[${KEY_CHARS}]{${SEGMENT_LENGTH}}(-[${KEY_CHARS}]{${SEGMENT_LENGTH}}){${NUM_SEGMENTS - 1}}$`
94
+ );
95
+ if (!pattern.test(key)) {
96
+ return false;
97
+ }
98
+ const segments = key.split("-");
99
+ const dataSegments = segments.slice(0, -1).join("-");
100
+ const providedChecksum = segments[segments.length - 1];
101
+ const calculatedChecksum = calculateChecksum(dataSegments);
102
+ return providedChecksum === calculatedChecksum;
103
+ }
104
+ function extractKeyMetadata(key) {
105
+ if (!validateKeyFormat(key)) {
106
+ return null;
107
+ }
108
+ const segments = key.split("-");
109
+ return decodeMetadata(segments[0]);
110
+ }
111
+ function generateLicenseInfo(options) {
112
+ const key = generateLicenseKey(options.tier);
113
+ const now = /* @__PURE__ */ new Date();
114
+ const issuedAt = now.toISOString();
115
+ let expiresAt = null;
116
+ let graceUntil;
117
+ if (options.durationDays !== null) {
118
+ const expiry = new Date(now);
119
+ expiry.setDate(expiry.getDate() + options.durationDays);
120
+ expiresAt = expiry.toISOString();
121
+ if (options.graceDays) {
122
+ const grace = new Date(expiry);
123
+ grace.setDate(grace.getDate() + options.graceDays);
124
+ graceUntil = grace.toISOString();
125
+ }
126
+ }
127
+ return {
128
+ key,
129
+ tier: options.tier,
130
+ status: "valid",
131
+ licensee: options.licensee,
132
+ email: options.email,
133
+ issuedAt,
134
+ expiresAt,
135
+ graceUntil,
136
+ features: options.features ?? getDefaultFeatures(options.tier),
137
+ maxSeats: options.maxSeats ?? getDefaultSeats(options.tier),
138
+ activeSeats: 0,
139
+ boundMachines: [],
140
+ maxMachines: options.maxMachines ?? getDefaultMachines(options.tier),
141
+ floatingSeats: options.floatingSeats,
142
+ metadata: options.metadata
143
+ };
144
+ }
145
+ function getDefaultFeatures(tier) {
146
+ const features = ["core", "basic-components"];
147
+ if (tier === "trial") {
148
+ features.push("trial-watermark");
149
+ }
150
+ if (["personal", "team", "enterprise", "site", "oem"].includes(tier)) {
151
+ features.push("advanced-components", "theming", "i18n");
152
+ }
153
+ if (["team", "enterprise", "site", "oem"].includes(tier)) {
154
+ features.push("collaboration", "analytics", "priority-support");
155
+ }
156
+ if (["enterprise", "site", "oem"].includes(tier)) {
157
+ features.push("white-label", "sso", "audit-log", "custom-branding", "api-access");
158
+ }
159
+ if (["site", "oem"].includes(tier)) {
160
+ features.push("unlimited-seats", "source-code-access", "dedicated-support");
161
+ }
162
+ if (tier === "oem") {
163
+ features.push("redistribution", "custom-licensing");
164
+ }
165
+ return features;
166
+ }
167
+ function getDefaultSeats(tier) {
168
+ switch (tier) {
169
+ case "trial":
170
+ return 1;
171
+ case "personal":
172
+ return 1;
173
+ case "team":
174
+ return 10;
175
+ case "enterprise":
176
+ return 50;
177
+ case "site":
178
+ return null;
179
+ // unlimited
180
+ case "oem":
181
+ return null;
182
+ default:
183
+ return 1;
184
+ }
185
+ }
186
+ function getDefaultMachines(tier) {
187
+ switch (tier) {
188
+ case "trial":
189
+ return 1;
190
+ case "personal":
191
+ return 2;
192
+ case "team":
193
+ return 20;
194
+ case "enterprise":
195
+ return 100;
196
+ case "site":
197
+ return 1e3;
198
+ case "oem":
199
+ return 1e4;
200
+ default:
201
+ return 1;
202
+ }
203
+ }
204
+ function compareTiers(a, b) {
205
+ return TIER_CODES[a] - TIER_CODES[b];
206
+ }
207
+ function tierMeetsRequirement(userTier, requiredTier) {
208
+ return compareTiers(userTier, requiredTier) >= 0;
209
+ }
210
+ function maskLicenseKey(key) {
211
+ const segments = key.split("-");
212
+ if (segments.length !== NUM_SEGMENTS) {
213
+ return "****-****-****-****-****";
214
+ }
215
+ return `${segments[0]}-****-****-****-${segments[segments.length - 1]}`;
216
+ }
217
+ function normalizeLicenseKey(input) {
218
+ const cleaned = input.replace(/\s/g, "").toUpperCase();
219
+ if (cleaned.includes("-")) {
220
+ return validateKeyFormat(cleaned) ? cleaned : null;
221
+ }
222
+ if (cleaned.length === SEGMENT_LENGTH * NUM_SEGMENTS) {
223
+ const segments = [];
224
+ for (let i = 0; i < NUM_SEGMENTS; i++) {
225
+ segments.push(cleaned.substring(i * SEGMENT_LENGTH, (i + 1) * SEGMENT_LENGTH));
226
+ }
227
+ const formatted = segments.join("-");
228
+ return validateKeyFormat(formatted) ? formatted : null;
229
+ }
230
+ return null;
231
+ }
232
+ function fnv1aHash(str) {
233
+ let hash = 2166136261;
234
+ for (let i = 0; i < str.length; i++) {
235
+ hash ^= str.charCodeAt(i);
236
+ hash = Math.imul(hash, 16777619);
237
+ }
238
+ return hash >>> 0;
239
+ }
240
+ function hashToHex(hash) {
241
+ return hash.toString(16).padStart(8, "0");
242
+ }
243
+ function strongHash(input) {
244
+ const h1 = fnv1aHash(input);
245
+ const h2 = fnv1aHash(input + h1.toString());
246
+ const h3 = fnv1aHash(h2.toString() + input);
247
+ return hashToHex(h1) + hashToHex(h2) + hashToHex(h3);
248
+ }
249
+ function getWebGLFingerprint() {
250
+ if (typeof document === "undefined") {
251
+ return void 0;
252
+ }
253
+ try {
254
+ const canvas = document.createElement("canvas");
255
+ const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
256
+ if (!gl) {
257
+ return void 0;
258
+ }
259
+ const glAny = gl;
260
+ const debugInfo = glAny.getExtension("WEBGL_debug_renderer_info");
261
+ if (!debugInfo) {
262
+ return void 0;
263
+ }
264
+ const vendor = glAny.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
265
+ const renderer = glAny.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
266
+ return strongHash(`${vendor}|${renderer}`);
267
+ } catch {
268
+ return void 0;
269
+ }
270
+ }
271
+ function getCanvasFingerprint() {
272
+ if (typeof document === "undefined") {
273
+ return void 0;
274
+ }
275
+ try {
276
+ const canvas = document.createElement("canvas");
277
+ canvas.width = 200;
278
+ canvas.height = 50;
279
+ const ctx = canvas.getContext("2d");
280
+ if (!ctx) {
281
+ return void 0;
282
+ }
283
+ ctx.textBaseline = "top";
284
+ ctx.font = "14px Arial";
285
+ ctx.fillStyle = "#f60";
286
+ ctx.fillRect(125, 1, 62, 20);
287
+ ctx.fillStyle = "#069";
288
+ ctx.fillText("Nice2Dev Licensing", 2, 15);
289
+ ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
290
+ ctx.fillText("Nice2Dev Licensing", 4, 17);
291
+ return strongHash(canvas.toDataURL());
292
+ } catch {
293
+ return void 0;
294
+ }
295
+ }
296
+ function getAudioFingerprint() {
297
+ if (typeof window === "undefined" || !window.AudioContext) {
298
+ return Promise.resolve(void 0);
299
+ }
300
+ return new Promise((resolve) => {
301
+ try {
302
+ const audioContext = new AudioContext();
303
+ const oscillator = audioContext.createOscillator();
304
+ const analyser = audioContext.createAnalyser();
305
+ const gainNode = audioContext.createGain();
306
+ const scriptProcessor = audioContext.createScriptProcessor(4096, 1, 1);
307
+ gainNode.gain.value = 0;
308
+ oscillator.type = "triangle";
309
+ oscillator.frequency.value = 1e4;
310
+ oscillator.connect(analyser);
311
+ analyser.connect(scriptProcessor);
312
+ scriptProcessor.connect(gainNode);
313
+ gainNode.connect(audioContext.destination);
314
+ let fingerprint = "";
315
+ scriptProcessor.onaudioprocess = (e) => {
316
+ const buffer = e.inputBuffer.getChannelData(0);
317
+ fingerprint = strongHash(buffer.slice(0, 100).join(","));
318
+ scriptProcessor.disconnect();
319
+ oscillator.disconnect();
320
+ analyser.disconnect();
321
+ gainNode.disconnect();
322
+ audioContext.close();
323
+ resolve(fingerprint);
324
+ };
325
+ oscillator.start(0);
326
+ setTimeout(() => {
327
+ if (!fingerprint) {
328
+ resolve(void 0);
329
+ }
330
+ }, 1e3);
331
+ } catch {
332
+ resolve(void 0);
333
+ }
334
+ });
335
+ }
336
+ function getUserAgentHash() {
337
+ if (typeof navigator === "undefined") {
338
+ return void 0;
339
+ }
340
+ return strongHash(navigator.userAgent);
341
+ }
342
+ function getTimezoneInfo() {
343
+ try {
344
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
345
+ } catch {
346
+ return "unknown";
347
+ }
348
+ }
349
+ function getScreenInfo() {
350
+ if (typeof screen === "undefined") {
351
+ return void 0;
352
+ }
353
+ return `${screen.width}x${screen.height}x${screen.colorDepth}`;
354
+ }
355
+ function getLanguageInfo() {
356
+ if (typeof navigator === "undefined") {
357
+ return void 0;
358
+ }
359
+ return navigator.language || navigator.userLanguage || "unknown";
360
+ }
361
+ function getPlatformInfo() {
362
+ if (typeof navigator === "undefined") {
363
+ return void 0;
364
+ }
365
+ return navigator.platform;
366
+ }
367
+ function getHardwareConcurrency() {
368
+ if (typeof navigator === "undefined") {
369
+ return void 0;
370
+ }
371
+ return navigator.hardwareConcurrency;
372
+ }
373
+ function getDeviceMemory() {
374
+ if (typeof navigator === "undefined") {
375
+ return void 0;
376
+ }
377
+ return navigator.deviceMemory;
378
+ }
379
+ async function collectFingerprintData() {
380
+ var _a, _b;
381
+ const audioFingerprint = await getAudioFingerprint();
382
+ return {
383
+ webglHash: getWebGLFingerprint(),
384
+ canvasFingerprint: getCanvasFingerprint(),
385
+ audioFingerprint,
386
+ userAgentHash: getUserAgentHash(),
387
+ browserFingerprint: strongHash(
388
+ [
389
+ getTimezoneInfo(),
390
+ getScreenInfo(),
391
+ getLanguageInfo(),
392
+ getPlatformInfo(),
393
+ (_a = getHardwareConcurrency()) == null ? void 0 : _a.toString(),
394
+ (_b = getDeviceMemory()) == null ? void 0 : _b.toString()
395
+ ].filter(Boolean).join("|")
396
+ )
397
+ };
398
+ }
399
+ async function generateFingerprint() {
400
+ const data = await collectFingerprintData();
401
+ const components = [
402
+ data.webglHash,
403
+ data.canvasFingerprint,
404
+ data.audioFingerprint,
405
+ data.userAgentHash,
406
+ data.browserFingerprint
407
+ ].filter(Boolean);
408
+ if (components.length === 0) {
409
+ const fallback = Date.now().toString() + Math.random().toString(36);
410
+ return strongHash(fallback);
411
+ }
412
+ return strongHash(components.join(":"));
413
+ }
414
+ async function generateMachineId() {
415
+ const fingerprint = await generateFingerprint();
416
+ return fingerprint.substring(0, 16).toUpperCase();
417
+ }
418
+ function compareFingerprintsData(fp1, fp2) {
419
+ const fields = [
420
+ "webglHash",
421
+ "canvasFingerprint",
422
+ "audioFingerprint",
423
+ "userAgentHash",
424
+ "browserFingerprint"
425
+ ];
426
+ let matches = 0;
427
+ let total = 0;
428
+ for (const field of fields) {
429
+ const v1 = fp1[field];
430
+ const v2 = fp2[field];
431
+ if (v1 !== void 0 || v2 !== void 0) {
432
+ total++;
433
+ if (v1 === v2) {
434
+ matches++;
435
+ }
436
+ }
437
+ }
438
+ return total > 0 ? matches / total : 0;
439
+ }
440
+ function storeFingerprint(fingerprint) {
441
+ if (typeof localStorage === "undefined") {
442
+ return;
443
+ }
444
+ try {
445
+ localStorage.setItem("nice2dev_fp", fingerprint);
446
+ } catch {
447
+ }
448
+ }
449
+ function getStoredFingerprint() {
450
+ if (typeof localStorage === "undefined") {
451
+ return null;
452
+ }
453
+ try {
454
+ return localStorage.getItem("nice2dev_fp");
455
+ } catch {
456
+ return null;
457
+ }
458
+ }
459
+ async function getOrGenerateFingerprint() {
460
+ const stored = getStoredFingerprint();
461
+ if (stored) {
462
+ return stored;
463
+ }
464
+ const fingerprint = await generateFingerprint();
465
+ storeFingerprint(fingerprint);
466
+ return fingerprint;
467
+ }
468
+ const DEFAULT_CONFIG = {
469
+ serverUrl: "https://license.nice2dev.com/api/v1",
470
+ timeout: 1e4,
471
+ retries: 3,
472
+ cacheTtl: 3600,
473
+ // 1 hour
474
+ offlineMode: false,
475
+ telemetryEnabled: false
476
+ };
477
+ const CACHE_PREFIX = "nice2dev_license_";
478
+ class LicenseValidator {
479
+ constructor(config = {}) {
480
+ this.cache = /* @__PURE__ */ new Map();
481
+ this.config = { ...DEFAULT_CONFIG, ...config };
482
+ this.loadCacheFromStorage();
483
+ }
484
+ /**
485
+ * Validate a license key
486
+ */
487
+ async validate(key, fingerprint) {
488
+ const now = (/* @__PURE__ */ new Date()).toISOString();
489
+ if (!validateKeyFormat(key)) {
490
+ return {
491
+ valid: false,
492
+ errorCode: "INVALID_KEY",
493
+ errorMessage: "Invalid license key format",
494
+ validatedAt: now
495
+ };
496
+ }
497
+ const cached = this.getFromCache(key);
498
+ if (cached) {
499
+ return cached;
500
+ }
501
+ const machineFingerprint = fingerprint || await generateMachineId();
502
+ if (!this.config.offlineMode) {
503
+ try {
504
+ const result = await this.validateOnline(key, machineFingerprint);
505
+ this.setCache(key, result);
506
+ return result;
507
+ } catch (error) {
508
+ console.warn("Online validation failed, trying offline:", error);
509
+ }
510
+ }
511
+ return this.validateOffline(key, machineFingerprint);
512
+ }
513
+ /**
514
+ * Online license validation
515
+ */
516
+ async validateOnline(key, fingerprint) {
517
+ const url = `${this.config.serverUrl}/validate`;
518
+ const now = (/* @__PURE__ */ new Date()).toISOString();
519
+ let lastError = null;
520
+ for (let attempt = 0; attempt < (this.config.retries || 1); attempt++) {
521
+ try {
522
+ const controller = new AbortController();
523
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
524
+ const response = await fetch(url, {
525
+ method: "POST",
526
+ headers: {
527
+ "Content-Type": "application/json",
528
+ ...this.config.apiKey ? { "X-API-Key": this.config.apiKey } : {}
529
+ },
530
+ body: JSON.stringify({
531
+ licenseKey: key,
532
+ machineFingerprint: fingerprint,
533
+ timestamp: now
534
+ }),
535
+ signal: controller.signal
536
+ });
537
+ clearTimeout(timeoutId);
538
+ if (!response.ok) {
539
+ if (response.status === 404) {
540
+ return {
541
+ valid: false,
542
+ errorCode: "INVALID_KEY",
543
+ errorMessage: "License key not found",
544
+ validatedAt: now
545
+ };
546
+ }
547
+ throw new Error(`Server error: ${response.status}`);
548
+ }
549
+ const data = await response.json();
550
+ return this.parseServerResponse(data, now);
551
+ } catch (error) {
552
+ lastError = error;
553
+ if (attempt < (this.config.retries || 1) - 1) {
554
+ await new Promise((r) => setTimeout(r, Math.pow(2, attempt) * 1e3));
555
+ }
556
+ }
557
+ }
558
+ throw lastError || new Error("Validation failed");
559
+ }
560
+ /**
561
+ * Parse server validation response
562
+ */
563
+ parseServerResponse(data, validatedAt) {
564
+ if (data.valid === false) {
565
+ return {
566
+ valid: false,
567
+ errorCode: data.errorCode,
568
+ errorMessage: data.errorMessage,
569
+ validatedAt
570
+ };
571
+ }
572
+ const license = data.license;
573
+ const now = /* @__PURE__ */ new Date();
574
+ let daysRemaining;
575
+ let inGracePeriod = false;
576
+ if (license.expiresAt) {
577
+ const expiry = new Date(license.expiresAt);
578
+ const diffMs = expiry.getTime() - now.getTime();
579
+ daysRemaining = Math.ceil(diffMs / (1e3 * 60 * 60 * 24));
580
+ if (daysRemaining < 0 && license.graceUntil) {
581
+ const graceEnd = new Date(license.graceUntil);
582
+ if (now < graceEnd) {
583
+ inGracePeriod = true;
584
+ }
585
+ }
586
+ }
587
+ return {
588
+ valid: true,
589
+ license,
590
+ daysRemaining,
591
+ inGracePeriod,
592
+ availableFeatures: license.features,
593
+ validatedAt
594
+ };
595
+ }
596
+ /**
597
+ * Offline license validation
598
+ */
599
+ validateOffline(key, fingerprint) {
600
+ const now = (/* @__PURE__ */ new Date()).toISOString();
601
+ const metadata = extractKeyMetadata(key);
602
+ if (!metadata) {
603
+ return {
604
+ valid: false,
605
+ errorCode: "INVALID_KEY",
606
+ errorMessage: "Cannot decode license key",
607
+ validatedAt: now
608
+ };
609
+ }
610
+ const storedLicense = this.getStoredLicense(key);
611
+ if (storedLicense) {
612
+ if (!storedLicense.boundMachines.some((m) => m.startsWith(fingerprint.substring(0, 8)))) {
613
+ return {
614
+ valid: false,
615
+ errorCode: "MACHINE_LIMIT",
616
+ errorMessage: "This machine is not authorized for this license",
617
+ validatedAt: now
618
+ };
619
+ }
620
+ if (storedLicense.expiresAt) {
621
+ const expiry = new Date(storedLicense.expiresAt);
622
+ const nowDate = /* @__PURE__ */ new Date();
623
+ if (nowDate > expiry) {
624
+ if (storedLicense.graceUntil) {
625
+ const graceEnd = new Date(storedLicense.graceUntil);
626
+ if (nowDate > graceEnd) {
627
+ return {
628
+ valid: false,
629
+ errorCode: "EXPIRED",
630
+ errorMessage: "License has expired",
631
+ validatedAt: now
632
+ };
633
+ }
634
+ return {
635
+ valid: true,
636
+ license: storedLicense,
637
+ inGracePeriod: true,
638
+ daysRemaining: 0,
639
+ availableFeatures: storedLicense.features,
640
+ validatedAt: now
641
+ };
642
+ }
643
+ return {
644
+ valid: false,
645
+ errorCode: "EXPIRED",
646
+ errorMessage: "License has expired",
647
+ validatedAt: now
648
+ };
649
+ }
650
+ const diffMs = expiry.getTime() - nowDate.getTime();
651
+ const daysRemaining = Math.ceil(diffMs / (1e3 * 60 * 60 * 24));
652
+ return {
653
+ valid: true,
654
+ license: storedLicense,
655
+ daysRemaining,
656
+ inGracePeriod: false,
657
+ availableFeatures: storedLicense.features,
658
+ validatedAt: now
659
+ };
660
+ }
661
+ return {
662
+ valid: true,
663
+ license: storedLicense,
664
+ availableFeatures: storedLicense.features,
665
+ validatedAt: now
666
+ };
667
+ }
668
+ return {
669
+ valid: true,
670
+ // Trust the key format
671
+ license: {
672
+ key,
673
+ tier: metadata.tier,
674
+ status: "pending",
675
+ // Needs online verification
676
+ licensee: "Unknown (offline)",
677
+ email: "",
678
+ issuedAt: `${metadata.year}-${String(metadata.month + 1).padStart(2, "0")}-01T00:00:00Z`,
679
+ expiresAt: null,
680
+ features: [],
681
+ // Limited features offline
682
+ maxSeats: null,
683
+ activeSeats: 0,
684
+ boundMachines: [fingerprint],
685
+ maxMachines: 1
686
+ },
687
+ availableFeatures: ["core"],
688
+ // Only core features offline
689
+ validatedAt: now
690
+ };
691
+ }
692
+ /**
693
+ * Generate offline activation challenge
694
+ */
695
+ async generateChallenge(key) {
696
+ const fingerprint = await generateMachineId();
697
+ const challengeId = crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).substring(2) + Date.now().toString(36);
698
+ const challengeData = JSON.stringify({
699
+ key,
700
+ fingerprint,
701
+ timestamp: Date.now()
702
+ });
703
+ const challengeCode = typeof btoa !== "undefined" ? btoa(challengeData) : Buffer.from(challengeData).toString("base64");
704
+ const expiresAt = /* @__PURE__ */ new Date();
705
+ expiresAt.setHours(expiresAt.getHours() + 24);
706
+ return {
707
+ challengeId,
708
+ challengeCode,
709
+ fingerprint,
710
+ expiresAt: expiresAt.toISOString()
711
+ };
712
+ }
713
+ /**
714
+ * Apply offline activation response
715
+ */
716
+ applyOfflineResponse(response) {
717
+ const now = (/* @__PURE__ */ new Date()).toISOString();
718
+ try {
719
+ const licenseDataJson = typeof atob !== "undefined" ? atob(response.licenseData) : Buffer.from(response.licenseData, "base64").toString("utf-8");
720
+ const license = JSON.parse(licenseDataJson);
721
+ this.storeLicense(license);
722
+ return {
723
+ valid: true,
724
+ license,
725
+ availableFeatures: license.features,
726
+ validatedAt: now
727
+ };
728
+ } catch {
729
+ return {
730
+ valid: false,
731
+ errorCode: "TAMPERED",
732
+ errorMessage: "Invalid offline activation response",
733
+ validatedAt: now
734
+ };
735
+ }
736
+ }
737
+ /**
738
+ * Check if feature is available
739
+ */
740
+ async hasFeature(key, feature) {
741
+ var _a;
742
+ const result = await this.validate(key);
743
+ if (!result.valid) {
744
+ return false;
745
+ }
746
+ return ((_a = result.availableFeatures) == null ? void 0 : _a.includes(feature)) ?? false;
747
+ }
748
+ /**
749
+ * Activate machine for license
750
+ */
751
+ async activateMachine(key) {
752
+ const fingerprint = await generateMachineId();
753
+ const url = `${this.config.serverUrl}/activate`;
754
+ const now = (/* @__PURE__ */ new Date()).toISOString();
755
+ try {
756
+ const response = await fetch(url, {
757
+ method: "POST",
758
+ headers: {
759
+ "Content-Type": "application/json",
760
+ ...this.config.apiKey ? { "X-API-Key": this.config.apiKey } : {}
761
+ },
762
+ body: JSON.stringify({
763
+ licenseKey: key,
764
+ machineFingerprint: fingerprint,
765
+ machineName: this.getMachineName(),
766
+ timestamp: now
767
+ })
768
+ });
769
+ if (!response.ok) {
770
+ const data2 = await response.json();
771
+ return {
772
+ valid: false,
773
+ errorCode: data2.errorCode || "SERVER_ERROR",
774
+ errorMessage: data2.errorMessage || "Activation failed",
775
+ validatedAt: now
776
+ };
777
+ }
778
+ const data = await response.json();
779
+ const license = data.license;
780
+ this.storeLicense(license);
781
+ this.clearCache(key);
782
+ return {
783
+ valid: true,
784
+ license,
785
+ availableFeatures: license.features,
786
+ validatedAt: now
787
+ };
788
+ } catch {
789
+ return {
790
+ valid: false,
791
+ errorCode: "NETWORK_ERROR",
792
+ errorMessage: "Cannot connect to license server",
793
+ validatedAt: now
794
+ };
795
+ }
796
+ }
797
+ /**
798
+ * Deactivate machine from license
799
+ */
800
+ async deactivateMachine(key) {
801
+ const fingerprint = await generateMachineId();
802
+ const url = `${this.config.serverUrl}/deactivate`;
803
+ try {
804
+ const response = await fetch(url, {
805
+ method: "POST",
806
+ headers: {
807
+ "Content-Type": "application/json",
808
+ ...this.config.apiKey ? { "X-API-Key": this.config.apiKey } : {}
809
+ },
810
+ body: JSON.stringify({
811
+ licenseKey: key,
812
+ machineFingerprint: fingerprint
813
+ })
814
+ });
815
+ if (response.ok) {
816
+ this.clearStoredLicense(key);
817
+ this.clearCache(key);
818
+ return true;
819
+ }
820
+ return false;
821
+ } catch {
822
+ return false;
823
+ }
824
+ }
825
+ // ─── Cache Management ─────────────────────────────────────────
826
+ getFromCache(key) {
827
+ const cached = this.cache.get(key);
828
+ if (!cached) {
829
+ return null;
830
+ }
831
+ if (Date.now() > cached.expiresAt) {
832
+ this.cache.delete(key);
833
+ return null;
834
+ }
835
+ return cached.result;
836
+ }
837
+ setCache(key, result) {
838
+ const now = Date.now();
839
+ const ttl = (this.config.cacheTtl || 3600) * 1e3;
840
+ this.cache.set(key, {
841
+ result,
842
+ cachedAt: now,
843
+ expiresAt: now + ttl
844
+ });
845
+ this.saveCacheToStorage();
846
+ }
847
+ clearCache(key) {
848
+ this.cache.delete(key);
849
+ this.saveCacheToStorage();
850
+ }
851
+ // ─── Storage Management ───────────────────────────────────────
852
+ getStoredLicense(key) {
853
+ if (typeof localStorage === "undefined") {
854
+ return null;
855
+ }
856
+ try {
857
+ const data = localStorage.getItem(`${CACHE_PREFIX}info_${key}`);
858
+ return data ? JSON.parse(data) : null;
859
+ } catch {
860
+ return null;
861
+ }
862
+ }
863
+ storeLicense(license) {
864
+ if (typeof localStorage === "undefined") {
865
+ return;
866
+ }
867
+ try {
868
+ localStorage.setItem(`${CACHE_PREFIX}info_${license.key}`, JSON.stringify(license));
869
+ } catch {
870
+ }
871
+ }
872
+ clearStoredLicense(key) {
873
+ if (typeof localStorage === "undefined") {
874
+ return;
875
+ }
876
+ try {
877
+ localStorage.removeItem(`${CACHE_PREFIX}info_${key}`);
878
+ } catch {
879
+ }
880
+ }
881
+ loadCacheFromStorage() {
882
+ if (typeof localStorage === "undefined") {
883
+ return;
884
+ }
885
+ try {
886
+ const data = localStorage.getItem(`${CACHE_PREFIX}cache`);
887
+ if (data) {
888
+ const parsed = JSON.parse(data);
889
+ for (const [key, value] of Object.entries(parsed)) {
890
+ this.cache.set(key, value);
891
+ }
892
+ }
893
+ } catch {
894
+ }
895
+ }
896
+ saveCacheToStorage() {
897
+ if (typeof localStorage === "undefined") {
898
+ return;
899
+ }
900
+ try {
901
+ const obj = {};
902
+ for (const [key, value] of this.cache.entries()) {
903
+ obj[key] = value;
904
+ }
905
+ localStorage.setItem(`${CACHE_PREFIX}cache`, JSON.stringify(obj));
906
+ } catch {
907
+ }
908
+ }
909
+ getMachineName() {
910
+ if (typeof navigator !== "undefined") {
911
+ return navigator.userAgent.split(/[()]/)[1] || "Unknown Device";
912
+ }
913
+ return "Server";
914
+ }
915
+ }
916
+ let globalValidator = null;
917
+ function getValidator(config) {
918
+ if (!globalValidator || config) {
919
+ globalValidator = new LicenseValidator(config);
920
+ }
921
+ return globalValidator;
922
+ }
923
+ async function validateLicense(key) {
924
+ return getValidator().validate(key);
925
+ }
926
+ async function isFeatureLicensed(key, feature) {
927
+ return getValidator().hasFeature(key, feature);
928
+ }
929
+ const featureRegistry = /* @__PURE__ */ new Map();
930
+ const planRegistry = /* @__PURE__ */ new Map();
931
+ function registerFeature(feature) {
932
+ featureRegistry.set(feature.id, feature);
933
+ }
934
+ function registerFeatures(features) {
935
+ features.forEach(registerFeature);
936
+ }
937
+ function getFeature(id) {
938
+ return featureRegistry.get(id);
939
+ }
940
+ function getAllFeatures() {
941
+ return Array.from(featureRegistry.values());
942
+ }
943
+ function getFeaturesByCategory(category) {
944
+ return getAllFeatures().filter((f) => f.category === category);
945
+ }
946
+ function registerPlan(plan) {
947
+ planRegistry.set(plan.id, plan);
948
+ }
949
+ function registerPlans(plans) {
950
+ plans.forEach(registerPlan);
951
+ }
952
+ function getPlan(tier) {
953
+ return planRegistry.get(tier);
954
+ }
955
+ function getAllPlans() {
956
+ return Array.from(planRegistry.values());
957
+ }
958
+ function hasFeature(license, featureId) {
959
+ if (!license) {
960
+ return false;
961
+ }
962
+ if (license.features.includes(featureId)) {
963
+ return true;
964
+ }
965
+ const feature = getFeature(featureId);
966
+ if (feature) {
967
+ return tierMeetsRequirement(license.tier, feature.requiredTier);
968
+ }
969
+ return false;
970
+ }
971
+ function hasTier(license, requiredTier) {
972
+ if (!license) {
973
+ return false;
974
+ }
975
+ return tierMeetsRequirement(license.tier, requiredTier);
976
+ }
977
+ function getAvailableFeatures(license) {
978
+ if (!license) {
979
+ return [];
980
+ }
981
+ const available = new Set(license.features);
982
+ for (const feature of getAllFeatures()) {
983
+ if (tierMeetsRequirement(license.tier, feature.requiredTier)) {
984
+ available.add(feature.id);
985
+ }
986
+ }
987
+ return Array.from(available);
988
+ }
989
+ function getMissingFeatures(license, targetTier) {
990
+ const currentFeatures = new Set(license ? getAvailableFeatures(license) : []);
991
+ const targetFeatures = getDefaultFeatures(targetTier);
992
+ return getAllFeatures().filter(
993
+ (f) => targetFeatures.includes(f.id) && !currentFeatures.has(f.id)
994
+ );
995
+ }
996
+ function checkFeatureAccess(license, featureId) {
997
+ if (!license) {
998
+ return {
999
+ allowed: false,
1000
+ reason: "no-license",
1001
+ requiredTier: "personal"
1002
+ };
1003
+ }
1004
+ if (license.status === "expired") {
1005
+ return {
1006
+ allowed: false,
1007
+ reason: "expired"
1008
+ };
1009
+ }
1010
+ const feature = getFeature(featureId);
1011
+ if (!feature) {
1012
+ return {
1013
+ allowed: license.features.includes(featureId),
1014
+ reason: license.features.includes(featureId) ? void 0 : "feature-not-included"
1015
+ };
1016
+ }
1017
+ if (!tierMeetsRequirement(license.tier, feature.requiredTier)) {
1018
+ return {
1019
+ allowed: false,
1020
+ reason: "tier-insufficient",
1021
+ requiredTier: feature.requiredTier,
1022
+ upgradeTarget: feature.requiredTier
1023
+ };
1024
+ }
1025
+ if (feature.dependencies) {
1026
+ for (const dep of feature.dependencies) {
1027
+ const depResult = checkFeatureAccess(license, dep);
1028
+ if (!depResult.allowed) {
1029
+ return depResult;
1030
+ }
1031
+ }
1032
+ }
1033
+ return { allowed: true };
1034
+ }
1035
+ const DEFAULT_FEATURES = [
1036
+ // Core features
1037
+ {
1038
+ id: "core",
1039
+ name: "Core Components",
1040
+ description: "Basic UI components",
1041
+ requiredTier: "trial",
1042
+ category: "core"
1043
+ },
1044
+ {
1045
+ id: "basic-components",
1046
+ name: "Basic Components",
1047
+ description: "Buttons, inputs, cards",
1048
+ requiredTier: "trial",
1049
+ category: "core"
1050
+ },
1051
+ // Personal tier
1052
+ {
1053
+ id: "advanced-components",
1054
+ name: "Advanced Components",
1055
+ description: "Data grids, charts, editors",
1056
+ requiredTier: "personal",
1057
+ category: "components"
1058
+ },
1059
+ {
1060
+ id: "theming",
1061
+ name: "Custom Theming",
1062
+ description: "Theme customization",
1063
+ requiredTier: "personal",
1064
+ category: "customization"
1065
+ },
1066
+ {
1067
+ id: "i18n",
1068
+ name: "Internationalization",
1069
+ description: "Multi-language support",
1070
+ requiredTier: "personal",
1071
+ category: "customization"
1072
+ },
1073
+ // Team tier
1074
+ {
1075
+ id: "collaboration",
1076
+ name: "Collaboration",
1077
+ description: "Real-time collaboration features",
1078
+ requiredTier: "team",
1079
+ category: "team"
1080
+ },
1081
+ {
1082
+ id: "analytics",
1083
+ name: "Analytics",
1084
+ description: "Usage analytics dashboard",
1085
+ requiredTier: "team",
1086
+ category: "team"
1087
+ },
1088
+ {
1089
+ id: "priority-support",
1090
+ name: "Priority Support",
1091
+ description: "24-hour response time",
1092
+ requiredTier: "team",
1093
+ category: "support"
1094
+ },
1095
+ // Enterprise tier
1096
+ {
1097
+ id: "white-label",
1098
+ name: "White Labeling",
1099
+ description: "Remove Nice2Dev branding",
1100
+ requiredTier: "enterprise",
1101
+ category: "enterprise"
1102
+ },
1103
+ {
1104
+ id: "sso",
1105
+ name: "Single Sign-On",
1106
+ description: "SAML/OIDC integration",
1107
+ requiredTier: "enterprise",
1108
+ category: "enterprise"
1109
+ },
1110
+ {
1111
+ id: "audit-log",
1112
+ name: "Audit Log",
1113
+ description: "Detailed activity logging",
1114
+ requiredTier: "enterprise",
1115
+ category: "enterprise"
1116
+ },
1117
+ {
1118
+ id: "custom-branding",
1119
+ name: "Custom Branding",
1120
+ description: "Full brand customization",
1121
+ requiredTier: "enterprise",
1122
+ category: "enterprise"
1123
+ },
1124
+ {
1125
+ id: "api-access",
1126
+ name: "API Access",
1127
+ description: "Full REST API access",
1128
+ requiredTier: "enterprise",
1129
+ category: "enterprise"
1130
+ },
1131
+ // Site tier
1132
+ {
1133
+ id: "unlimited-seats",
1134
+ name: "Unlimited Seats",
1135
+ description: "No user limits",
1136
+ requiredTier: "site",
1137
+ category: "site"
1138
+ },
1139
+ {
1140
+ id: "source-code-access",
1141
+ name: "Source Code Access",
1142
+ description: "Access to source code",
1143
+ requiredTier: "site",
1144
+ category: "site"
1145
+ },
1146
+ {
1147
+ id: "dedicated-support",
1148
+ name: "Dedicated Support",
1149
+ description: "Dedicated support engineer",
1150
+ requiredTier: "site",
1151
+ category: "support"
1152
+ },
1153
+ // OEM tier
1154
+ {
1155
+ id: "redistribution",
1156
+ name: "Redistribution Rights",
1157
+ description: "Include in your products",
1158
+ requiredTier: "oem",
1159
+ category: "oem"
1160
+ },
1161
+ {
1162
+ id: "custom-licensing",
1163
+ name: "Custom Licensing",
1164
+ description: "Your own license terms",
1165
+ requiredTier: "oem",
1166
+ category: "oem"
1167
+ },
1168
+ // Trial marker
1169
+ {
1170
+ id: "trial-watermark",
1171
+ name: "Trial Watermark",
1172
+ description: "Watermark for trial versions",
1173
+ requiredTier: "trial",
1174
+ category: "trial"
1175
+ },
1176
+ // Game Engine features
1177
+ {
1178
+ id: "game-editor",
1179
+ name: "Game Editor",
1180
+ description: "Visual game editor",
1181
+ requiredTier: "personal",
1182
+ category: "game-engine"
1183
+ },
1184
+ {
1185
+ id: "game-export",
1186
+ name: "Game Export",
1187
+ description: "Export to various platforms",
1188
+ requiredTier: "team",
1189
+ category: "game-engine"
1190
+ },
1191
+ {
1192
+ id: "game-multiplayer",
1193
+ name: "Multiplayer",
1194
+ description: "Online multiplayer support",
1195
+ requiredTier: "team",
1196
+ category: "game-engine"
1197
+ },
1198
+ {
1199
+ id: "game-build-cloud",
1200
+ name: "Build Cloud",
1201
+ description: "Cloud compilation for games",
1202
+ requiredTier: "enterprise",
1203
+ category: "game-engine"
1204
+ },
1205
+ // Spatial features
1206
+ {
1207
+ id: "spatial-editor",
1208
+ name: "Spatial Editor",
1209
+ description: "Floor plan editor",
1210
+ requiredTier: "personal",
1211
+ category: "spatial"
1212
+ },
1213
+ {
1214
+ id: "spatial-3d",
1215
+ name: "3D Visualization",
1216
+ description: "3D building visualization",
1217
+ requiredTier: "team",
1218
+ category: "spatial"
1219
+ },
1220
+ {
1221
+ id: "spatial-bim",
1222
+ name: "BIM Integration",
1223
+ description: "IFC/BIM file support",
1224
+ requiredTier: "enterprise",
1225
+ category: "spatial"
1226
+ }
1227
+ ];
1228
+ const DEFAULT_PLANS = [
1229
+ {
1230
+ id: "trial",
1231
+ name: "Trial",
1232
+ description: "14-day free trial with all features",
1233
+ priceMonthly: 0,
1234
+ priceYearly: 0,
1235
+ features: ["core", "basic-components", "trial-watermark"],
1236
+ maxSeats: 1,
1237
+ maxMachines: 1,
1238
+ highlights: ["All features for 14 days", "No credit card required"]
1239
+ },
1240
+ {
1241
+ id: "personal",
1242
+ name: "Personal",
1243
+ description: "For individual developers",
1244
+ priceMonthly: 1900,
1245
+ // $19
1246
+ priceYearly: 15900,
1247
+ // $159 (2 months free)
1248
+ features: ["core", "basic-components", "advanced-components", "theming", "i18n"],
1249
+ maxSeats: 1,
1250
+ maxMachines: 2,
1251
+ highlights: ["All UI components", "Custom theming", "Email support"]
1252
+ },
1253
+ {
1254
+ id: "team",
1255
+ name: "Team",
1256
+ description: "For small to medium teams",
1257
+ priceMonthly: 4900,
1258
+ // $49/seat
1259
+ priceYearly: 41900,
1260
+ // $419/seat
1261
+ features: [
1262
+ "core",
1263
+ "basic-components",
1264
+ "advanced-components",
1265
+ "theming",
1266
+ "i18n",
1267
+ "collaboration",
1268
+ "analytics",
1269
+ "priority-support"
1270
+ ],
1271
+ maxSeats: 10,
1272
+ maxMachines: 20,
1273
+ highlights: ["Up to 10 seats", "Collaboration tools", "Priority support"],
1274
+ recommended: true
1275
+ },
1276
+ {
1277
+ id: "enterprise",
1278
+ name: "Enterprise",
1279
+ description: "For large organizations",
1280
+ priceMonthly: 19900,
1281
+ // $199/month base
1282
+ priceYearly: 199900,
1283
+ // $1999/year
1284
+ features: [
1285
+ "core",
1286
+ "basic-components",
1287
+ "advanced-components",
1288
+ "theming",
1289
+ "i18n",
1290
+ "collaboration",
1291
+ "analytics",
1292
+ "priority-support",
1293
+ "white-label",
1294
+ "sso",
1295
+ "audit-log",
1296
+ "custom-branding",
1297
+ "api-access"
1298
+ ],
1299
+ maxSeats: 50,
1300
+ maxMachines: 100,
1301
+ highlights: ["Up to 50 seats", "SSO & SAML", "White labeling", "API access"]
1302
+ },
1303
+ {
1304
+ id: "site",
1305
+ name: "Site License",
1306
+ description: "Unlimited usage for your organization",
1307
+ priceMonthly: 0,
1308
+ // Contact sales
1309
+ priceYearly: 0,
1310
+ features: [
1311
+ "core",
1312
+ "basic-components",
1313
+ "advanced-components",
1314
+ "theming",
1315
+ "i18n",
1316
+ "collaboration",
1317
+ "analytics",
1318
+ "priority-support",
1319
+ "white-label",
1320
+ "sso",
1321
+ "audit-log",
1322
+ "custom-branding",
1323
+ "api-access",
1324
+ "unlimited-seats",
1325
+ "source-code-access",
1326
+ "dedicated-support"
1327
+ ],
1328
+ maxSeats: null,
1329
+ maxMachines: 1e3,
1330
+ highlights: ["Unlimited seats", "Source code access", "Dedicated support engineer"]
1331
+ },
1332
+ {
1333
+ id: "oem",
1334
+ name: "OEM",
1335
+ description: "Embed in your products",
1336
+ priceMonthly: 0,
1337
+ // Contact sales
1338
+ priceYearly: 0,
1339
+ features: [
1340
+ "core",
1341
+ "basic-components",
1342
+ "advanced-components",
1343
+ "theming",
1344
+ "i18n",
1345
+ "collaboration",
1346
+ "analytics",
1347
+ "priority-support",
1348
+ "white-label",
1349
+ "sso",
1350
+ "audit-log",
1351
+ "custom-branding",
1352
+ "api-access",
1353
+ "unlimited-seats",
1354
+ "source-code-access",
1355
+ "dedicated-support",
1356
+ "redistribution",
1357
+ "custom-licensing"
1358
+ ],
1359
+ maxSeats: null,
1360
+ maxMachines: 1e4,
1361
+ highlights: ["Redistribution rights", "Custom licensing", "Full support"]
1362
+ }
1363
+ ];
1364
+ function initializeDefaults() {
1365
+ registerFeatures(DEFAULT_FEATURES);
1366
+ registerPlans(DEFAULT_PLANS);
1367
+ }
1368
+ initializeDefaults();
1369
+ const CheckMark = ({ style }) => /* @__PURE__ */ jsxRuntime.jsx(
1370
+ "span",
1371
+ {
1372
+ "aria-hidden": "true",
1373
+ style: {
1374
+ display: "inline-block",
1375
+ width: "0.3em",
1376
+ height: "0.6em",
1377
+ margin: "0 0.35em 0.15em 0.1em",
1378
+ borderRight: "0.12em solid currentColor",
1379
+ borderBottom: "0.12em solid currentColor",
1380
+ transform: "rotate(45deg)",
1381
+ ...style
1382
+ }
1383
+ }
1384
+ );
1385
+ const RefreshMark = ({ style }) => /* @__PURE__ */ jsxRuntime.jsx(
1386
+ "span",
1387
+ {
1388
+ "aria-hidden": "true",
1389
+ style: {
1390
+ display: "inline-block",
1391
+ width: "0.85em",
1392
+ height: "0.85em",
1393
+ borderRadius: "50%",
1394
+ border: "0.12em solid currentColor",
1395
+ borderTopColor: "transparent",
1396
+ transform: "rotate(-45deg)",
1397
+ ...style
1398
+ }
1399
+ }
1400
+ );
1401
+ const CHEVRON = {
1402
+ down: { transform: "rotate(45deg)", margin: "0 0 0.2em" },
1403
+ up: { transform: "rotate(-135deg)", margin: "0.2em 0 0" },
1404
+ left: { transform: "rotate(135deg)", margin: "0 0 0 0.2em" },
1405
+ right: { transform: "rotate(-45deg)", margin: "0 0.2em 0 0" }
1406
+ };
1407
+ const ChevronMark = ({ direction, style }) => /* @__PURE__ */ jsxRuntime.jsx(
1408
+ "span",
1409
+ {
1410
+ "aria-hidden": "true",
1411
+ style: {
1412
+ display: "inline-block",
1413
+ width: "0.45em",
1414
+ height: "0.45em",
1415
+ margin: CHEVRON[direction].margin,
1416
+ borderRight: "0.12em solid currentColor",
1417
+ borderBottom: "0.12em solid currentColor",
1418
+ transform: CHEVRON[direction].transform,
1419
+ ...style
1420
+ }
1421
+ }
1422
+ );
1423
+ exports.CheckMark = CheckMark;
1424
+ exports.ChevronMark = ChevronMark;
1425
+ exports.LicenseValidator = LicenseValidator;
1426
+ exports.RefreshMark = RefreshMark;
1427
+ exports.checkFeatureAccess = checkFeatureAccess;
1428
+ exports.collectFingerprintData = collectFingerprintData;
1429
+ exports.compareFingerprintsData = compareFingerprintsData;
1430
+ exports.compareTiers = compareTiers;
1431
+ exports.extractKeyMetadata = extractKeyMetadata;
1432
+ exports.generateFingerprint = generateFingerprint;
1433
+ exports.generateLicenseInfo = generateLicenseInfo;
1434
+ exports.generateLicenseKey = generateLicenseKey;
1435
+ exports.generateMachineId = generateMachineId;
1436
+ exports.getAllFeatures = getAllFeatures;
1437
+ exports.getAllPlans = getAllPlans;
1438
+ exports.getAvailableFeatures = getAvailableFeatures;
1439
+ exports.getDefaultFeatures = getDefaultFeatures;
1440
+ exports.getDefaultMachines = getDefaultMachines;
1441
+ exports.getDefaultSeats = getDefaultSeats;
1442
+ exports.getFeature = getFeature;
1443
+ exports.getFeaturesByCategory = getFeaturesByCategory;
1444
+ exports.getMissingFeatures = getMissingFeatures;
1445
+ exports.getOrGenerateFingerprint = getOrGenerateFingerprint;
1446
+ exports.getPlan = getPlan;
1447
+ exports.getStoredFingerprint = getStoredFingerprint;
1448
+ exports.getValidator = getValidator;
1449
+ exports.hasFeature = hasFeature;
1450
+ exports.hasTier = hasTier;
1451
+ exports.initializeDefaults = initializeDefaults;
1452
+ exports.isFeatureLicensed = isFeatureLicensed;
1453
+ exports.maskLicenseKey = maskLicenseKey;
1454
+ exports.normalizeLicenseKey = normalizeLicenseKey;
1455
+ exports.registerFeature = registerFeature;
1456
+ exports.registerFeatures = registerFeatures;
1457
+ exports.registerPlan = registerPlan;
1458
+ exports.registerPlans = registerPlans;
1459
+ exports.storeFingerprint = storeFingerprint;
1460
+ exports.tierMeetsRequirement = tierMeetsRequirement;
1461
+ exports.validateKeyFormat = validateKeyFormat;
1462
+ exports.validateLicense = validateLicense;