@drghaliasri/butex 7.0.0 → 7.0.3

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.
@@ -9288,6 +9288,52 @@ function updateDocument2Meta(document2, patch) {
9288
9288
  return next;
9289
9289
  }
9290
9290
 
9291
+ // src/document2/keys.ts
9292
+ var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
9293
+ function normalizeDocument2Key(key) {
9294
+ return key.normalize("NFC").trim();
9295
+ }
9296
+ function isValidDocument2Key(key) {
9297
+ const normalized = normalizeDocument2Key(key);
9298
+ return normalized.length > 0 && DOCUMENT2_KEY_PATTERN.test(normalized);
9299
+ }
9300
+ function isDuplicateDocument2Key(key, namespace) {
9301
+ const normalized = normalizeDocument2Key(key);
9302
+ if (normalized.length === 0) {
9303
+ return false;
9304
+ }
9305
+ for (const reference of namespace.references ?? []) {
9306
+ if (namespace.excludeReferenceId && reference.id === namespace.excludeReferenceId) {
9307
+ continue;
9308
+ }
9309
+ if (normalizeDocument2Key(reference.key) === normalized) {
9310
+ return true;
9311
+ }
9312
+ }
9313
+ for (const label of namespace.labels ?? []) {
9314
+ if (namespace.excludeOwnerId && label.ownerId === namespace.excludeOwnerId) {
9315
+ continue;
9316
+ }
9317
+ if (normalizeDocument2Key(label.key) === normalized) {
9318
+ return true;
9319
+ }
9320
+ }
9321
+ return false;
9322
+ }
9323
+ function document2KeyError(key, namespace = {}) {
9324
+ const normalized = normalizeDocument2Key(key);
9325
+ if (normalized.length === 0) {
9326
+ return "empty";
9327
+ }
9328
+ if (!DOCUMENT2_KEY_PATTERN.test(normalized)) {
9329
+ return "invalid";
9330
+ }
9331
+ if (isDuplicateDocument2Key(normalized, namespace)) {
9332
+ return "duplicate";
9333
+ }
9334
+ return null;
9335
+ }
9336
+
9291
9337
  // src/document2/exportJson.ts
9292
9338
  function serializeField(field) {
9293
9339
  let value = "";
@@ -9459,52 +9505,6 @@ function toDocumentJson2(document2) {
9459
9505
  };
9460
9506
  }
9461
9507
 
9462
- // src/document2/keys.ts
9463
- var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
9464
- function normalizeDocument2Key(key) {
9465
- return key.normalize("NFC").trim();
9466
- }
9467
- function isValidDocument2Key(key) {
9468
- const normalized = normalizeDocument2Key(key);
9469
- return normalized.length > 0 && DOCUMENT2_KEY_PATTERN.test(normalized);
9470
- }
9471
- function isDuplicateDocument2Key(key, namespace) {
9472
- const normalized = normalizeDocument2Key(key);
9473
- if (normalized.length === 0) {
9474
- return false;
9475
- }
9476
- for (const reference of namespace.references ?? []) {
9477
- if (namespace.excludeReferenceId && reference.id === namespace.excludeReferenceId) {
9478
- continue;
9479
- }
9480
- if (normalizeDocument2Key(reference.key) === normalized) {
9481
- return true;
9482
- }
9483
- }
9484
- for (const label of namespace.labels ?? []) {
9485
- if (namespace.excludeOwnerId && label.ownerId === namespace.excludeOwnerId) {
9486
- continue;
9487
- }
9488
- if (normalizeDocument2Key(label.key) === normalized) {
9489
- return true;
9490
- }
9491
- }
9492
- return false;
9493
- }
9494
- function document2KeyError(key, namespace = {}) {
9495
- const normalized = normalizeDocument2Key(key);
9496
- if (normalized.length === 0) {
9497
- return "empty";
9498
- }
9499
- if (!DOCUMENT2_KEY_PATTERN.test(normalized)) {
9500
- return "invalid";
9501
- }
9502
- if (isDuplicateDocument2Key(normalized, namespace)) {
9503
- return "duplicate";
9504
- }
9505
- return null;
9506
- }
9507
-
9508
9508
  // src/document2/arabicPreamble.ts
9509
9509
  function fontOptions(digitsMapping, includeScript = true) {
9510
9510
  const parts = [];