@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.
@@ -9253,6 +9253,52 @@ function updateDocument2Meta(document2, patch) {
9253
9253
  return next;
9254
9254
  }
9255
9255
 
9256
+ // src/document2/keys.ts
9257
+ var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
9258
+ function normalizeDocument2Key(key) {
9259
+ return key.normalize("NFC").trim();
9260
+ }
9261
+ function isValidDocument2Key(key) {
9262
+ const normalized = normalizeDocument2Key(key);
9263
+ return normalized.length > 0 && DOCUMENT2_KEY_PATTERN.test(normalized);
9264
+ }
9265
+ function isDuplicateDocument2Key(key, namespace) {
9266
+ const normalized = normalizeDocument2Key(key);
9267
+ if (normalized.length === 0) {
9268
+ return false;
9269
+ }
9270
+ for (const reference of namespace.references ?? []) {
9271
+ if (namespace.excludeReferenceId && reference.id === namespace.excludeReferenceId) {
9272
+ continue;
9273
+ }
9274
+ if (normalizeDocument2Key(reference.key) === normalized) {
9275
+ return true;
9276
+ }
9277
+ }
9278
+ for (const label of namespace.labels ?? []) {
9279
+ if (namespace.excludeOwnerId && label.ownerId === namespace.excludeOwnerId) {
9280
+ continue;
9281
+ }
9282
+ if (normalizeDocument2Key(label.key) === normalized) {
9283
+ return true;
9284
+ }
9285
+ }
9286
+ return false;
9287
+ }
9288
+ function document2KeyError(key, namespace = {}) {
9289
+ const normalized = normalizeDocument2Key(key);
9290
+ if (normalized.length === 0) {
9291
+ return "empty";
9292
+ }
9293
+ if (!DOCUMENT2_KEY_PATTERN.test(normalized)) {
9294
+ return "invalid";
9295
+ }
9296
+ if (isDuplicateDocument2Key(normalized, namespace)) {
9297
+ return "duplicate";
9298
+ }
9299
+ return null;
9300
+ }
9301
+
9256
9302
  // src/document2/exportJson.ts
9257
9303
  function serializeField(field) {
9258
9304
  let value = "";
@@ -9424,52 +9470,6 @@ function toDocumentJson2(document2) {
9424
9470
  };
9425
9471
  }
9426
9472
 
9427
- // src/document2/keys.ts
9428
- var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
9429
- function normalizeDocument2Key(key) {
9430
- return key.normalize("NFC").trim();
9431
- }
9432
- function isValidDocument2Key(key) {
9433
- const normalized = normalizeDocument2Key(key);
9434
- return normalized.length > 0 && DOCUMENT2_KEY_PATTERN.test(normalized);
9435
- }
9436
- function isDuplicateDocument2Key(key, namespace) {
9437
- const normalized = normalizeDocument2Key(key);
9438
- if (normalized.length === 0) {
9439
- return false;
9440
- }
9441
- for (const reference of namespace.references ?? []) {
9442
- if (namespace.excludeReferenceId && reference.id === namespace.excludeReferenceId) {
9443
- continue;
9444
- }
9445
- if (normalizeDocument2Key(reference.key) === normalized) {
9446
- return true;
9447
- }
9448
- }
9449
- for (const label of namespace.labels ?? []) {
9450
- if (namespace.excludeOwnerId && label.ownerId === namespace.excludeOwnerId) {
9451
- continue;
9452
- }
9453
- if (normalizeDocument2Key(label.key) === normalized) {
9454
- return true;
9455
- }
9456
- }
9457
- return false;
9458
- }
9459
- function document2KeyError(key, namespace = {}) {
9460
- const normalized = normalizeDocument2Key(key);
9461
- if (normalized.length === 0) {
9462
- return "empty";
9463
- }
9464
- if (!DOCUMENT2_KEY_PATTERN.test(normalized)) {
9465
- return "invalid";
9466
- }
9467
- if (isDuplicateDocument2Key(normalized, namespace)) {
9468
- return "duplicate";
9469
- }
9470
- return null;
9471
- }
9472
-
9473
9473
  // src/document2/arabicPreamble.ts
9474
9474
  function fontOptions(digitsMapping, includeScript = true) {
9475
9475
  const parts = [];