@esposter/shared 2.35.0 → 2.37.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.
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var __copyProps$1 = (to, from, except, desc) => {
33
33
  }
34
34
  return to;
35
35
  };
36
- var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
36
+ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp$1.call(mod, "default") ? __defProp$1(target, "default", {
37
37
  value: mod,
38
38
  enumerable: true
39
39
  }) : target, mod));
@@ -109,6 +109,12 @@ var NotInitializedError = class extends Error {
109
109
  this.name = "NotInitializedError";
110
110
  }
111
111
  };
112
+ var WordFilteredError = class extends Error {
113
+ constructor(message) {
114
+ super(message);
115
+ this.name = "WordFilteredError";
116
+ }
117
+ };
112
118
  let MentionType = /* @__PURE__ */ function(MentionType) {
113
119
  MentionType["Role"] = "role";
114
120
  MentionType["User"] = "user";
@@ -116,6 +122,9 @@ let MentionType = /* @__PURE__ */ function(MentionType) {
116
122
  }({});
117
123
  const MAX_READ_LIMIT = 1e3;
118
124
  const SITE_NAME = "Esposter";
125
+ const KIBIBYTE = 1024;
126
+ const MEGABYTE = KIBIBYTE ** 2;
127
+ const GIBIBYTE = MEGABYTE * KIBIBYTE;
119
128
  const RoutePath = {
120
129
  About: "/about",
121
130
  Achievements: "/achievements",
@@ -139,11 +148,17 @@ const RoutePath = {
139
148
  PostCreate: "/post/create",
140
149
  PostUpdate: (id) => `/post/update/${id}`,
141
150
  PrivacyPolicy: "/privacy-policy",
142
- Resource: (id) => `/resources/${id}`,
143
- Resources: "/resources",
144
- ResourcesAll: "/resources/all",
145
- ResourcesCreate: "/resources/create",
146
- ResourcesCreateType: (type) => `/resources/create/${type}`,
151
+ Resource: (id) => `/resource-explorer/${id}`,
152
+ ResourceExplorer: "/resource-explorer",
153
+ ResourceExplorerAll: "/resource-explorer/all",
154
+ ResourceExplorerCreate: "/resource-explorer/create",
155
+ ResourceExplorerCreateType: (type) => `/resource-explorer/create/${type}`,
156
+ ResourceExplorerFavorites: "/resource-explorer/favorites",
157
+ ResourceExplorerRecents: "/resource-explorer/recents",
158
+ ResourceExplorerRecycleBin: "/resource-explorer/recycle-bin",
159
+ ResourceExplorerTags: "/resource-explorer/tags",
160
+ ResourceItems: (id) => `/resource-explorer/${id}/items`,
161
+ User: (id) => `/user/${id}`,
147
162
  UserSettings: "/user/settings",
148
163
  View: (type, id) => `/view/${type}/${id}`
149
164
  };
@@ -5536,10 +5551,10 @@ parse.NodeType = NodeType;
5536
5551
  const getMentions = (message) => parse(message).querySelectorAll(`span[${MENTION_TYPE_ATTRIBUTE}='${MENTION_TYPE}']`);
5537
5552
  const BROADCAST_MENTION_IDS = /* @__PURE__ */ new Set([MENTION_EVERYONE_ID, MENTION_HERE_ID]);
5538
5553
  const classifyMentions = (message) => {
5539
- const mentions = getMentions(message).map((m) => ({
5540
- id: m.getAttribute(MENTION_ID_ATTRIBUTE),
5541
- type: m.getAttribute(MENTION_ITEM_TYPE_ATTRIBUTE)
5542
- })).filter((m) => Boolean(m.id));
5554
+ const mentions = getMentions(message).map((mention) => ({
5555
+ id: mention.getAttribute(MENTION_ID_ATTRIBUTE),
5556
+ type: mention.getAttribute(MENTION_ITEM_TYPE_ATTRIBUTE)
5557
+ })).filter((mention) => Boolean(mention.id));
5543
5558
  return {
5544
5559
  broadcastIds: mentions.filter(({ id }) => BROADCAST_MENTION_IDS.has(id)).map(({ id }) => id),
5545
5560
  regularUserIds: mentions.filter(({ id, type }) => !BROADCAST_MENTION_IDS.has(id) && type !== "role").map(({ id }) => id),
@@ -6402,15 +6417,16 @@ var init_Tokenizer = __esmMin((() => {
6402
6417
  if (c === CharCodes.ExclamationMark) {
6403
6418
  this.state = State.BeforeDeclaration;
6404
6419
  this.sectionStart = this.index + 1;
6405
- } else if (c === CharCodes.Questionmark) if (this.xmlMode) {
6406
- this.state = State.InProcessingInstruction;
6407
- this.sequenceIndex = 0;
6408
- this.sectionStart = this.index + 1;
6409
- } else {
6410
- this.state = State.InSpecialComment;
6411
- this.sectionStart = this.index;
6412
- }
6413
- else if (this.isTagStartChar(c)) {
6420
+ } else if (c === CharCodes.Questionmark) {
6421
+ if (this.xmlMode) {
6422
+ this.state = State.InProcessingInstruction;
6423
+ this.sequenceIndex = 0;
6424
+ this.sectionStart = this.index + 1;
6425
+ } else {
6426
+ this.state = State.InSpecialComment;
6427
+ this.sectionStart = this.index;
6428
+ }
6429
+ } else if (this.isTagStartChar(c)) {
6414
6430
  this.sectionStart = this.index;
6415
6431
  const special = this.xmlMode || this.cbs.isInForeignContext?.() ? void 0 : specialStartSequences.get(c | 32);
6416
6432
  if (special === void 0) this.state = State.InTagName;
@@ -6435,11 +6451,12 @@ var init_Tokenizer = __esmMin((() => {
6435
6451
  }
6436
6452
  }
6437
6453
  stateBeforeClosingTagName(c) {
6438
- if (isWhitespace(c)) if (this.xmlMode) {} else {
6439
- this.state = State.InSpecialComment;
6440
- this.sectionStart = this.index;
6441
- }
6442
- else if (c === CharCodes.Gt) {
6454
+ if (isWhitespace(c)) {
6455
+ if (this.xmlMode) {} else {
6456
+ this.state = State.InSpecialComment;
6457
+ this.sectionStart = this.index;
6458
+ }
6459
+ } else if (c === CharCodes.Gt) {
6443
6460
  this.state = State.Text;
6444
6461
  if (!this.xmlMode) this.sectionStart = this.index + 1;
6445
6462
  } else {
@@ -6762,9 +6779,7 @@ var init_Tokenizer = __esmMin((() => {
6762
6779
  case State.InProcessingInstruction:
6763
6780
  this.stateInProcessingInstruction(c);
6764
6781
  break;
6765
- case State.InEntity:
6766
- this.stateInEntity();
6767
- break;
6782
+ case State.InEntity: this.stateInEntity();
6768
6783
  }
6769
6784
  this.index++;
6770
6785
  }
@@ -6780,13 +6795,14 @@ var init_Tokenizer = __esmMin((() => {
6780
6795
  }
6781
6796
  handleTrailingCommentLikeData(endIndex) {
6782
6797
  if (this.state !== State.InCommentLike) return false;
6783
- if (this.currentSequence === Sequences.CdataEnd) if (this.xmlMode) {
6784
- if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
6798
+ if (this.currentSequence === Sequences.CdataEnd) {
6799
+ if (this.xmlMode) {
6800
+ if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
6801
+ } else {
6802
+ const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
6803
+ this.cbs.oncomment(cdataStart, endIndex, 0);
6804
+ }
6785
6805
  } else {
6786
- const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
6787
- this.cbs.oncomment(cdataStart, endIndex, 0);
6788
- }
6789
- else {
6790
6806
  const offset = this.xmlMode ? 0 : Math.min(this.sequenceIndex, Sequences.CommentEnd.length - 1);
6791
6807
  this.cbs.oncomment(this.sectionStart, endIndex, offset);
6792
6808
  }
@@ -7833,7 +7849,8 @@ var init_dist$4 = __esmMin((() => {
7833
7849
  if (this.elementCB) this.elementCB(element);
7834
7850
  }
7835
7851
  onopentag(name, attribs) {
7836
- const element = new Element(name, attribs, void 0, this.options.xmlMode ? ElementType.Tag : void 0);
7852
+ const type = this.options.xmlMode ? ElementType.Tag : void 0;
7853
+ const element = new Element(name, attribs, void 0, type);
7837
7854
  this.addNode(element);
7838
7855
  this.tagStack.push(element);
7839
7856
  }
@@ -9133,39 +9150,43 @@ var require_parse_srcset = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
9133
9150
  state = "in descriptor";
9134
9151
  while (true) {
9135
9152
  c = input.charAt(pos);
9136
- if (state === "in descriptor") if (isSpace(c)) {
9137
- if (currentDescriptor) {
9153
+ if (state === "in descriptor") {
9154
+ if (isSpace(c)) {
9155
+ if (currentDescriptor) {
9156
+ descriptors.push(currentDescriptor);
9157
+ currentDescriptor = "";
9158
+ state = "after descriptor";
9159
+ }
9160
+ } else if (c === ",") {
9161
+ pos += 1;
9162
+ if (currentDescriptor) descriptors.push(currentDescriptor);
9163
+ parseDescriptors();
9164
+ return;
9165
+ } else if (c === "(") {
9166
+ currentDescriptor = currentDescriptor + c;
9167
+ state = "in parens";
9168
+ } else if (c === "") {
9169
+ if (currentDescriptor) descriptors.push(currentDescriptor);
9170
+ parseDescriptors();
9171
+ return;
9172
+ } else currentDescriptor = currentDescriptor + c;
9173
+ } else if (state === "in parens") {
9174
+ if (c === ")") {
9175
+ currentDescriptor = currentDescriptor + c;
9176
+ state = "in descriptor";
9177
+ } else if (c === "") {
9138
9178
  descriptors.push(currentDescriptor);
9139
- currentDescriptor = "";
9140
- state = "after descriptor";
9179
+ parseDescriptors();
9180
+ return;
9181
+ } else currentDescriptor = currentDescriptor + c;
9182
+ } else if (state === "after descriptor") {
9183
+ if (isSpace(c)) {} else if (c === "") {
9184
+ parseDescriptors();
9185
+ return;
9186
+ } else {
9187
+ state = "in descriptor";
9188
+ pos -= 1;
9141
9189
  }
9142
- } else if (c === ",") {
9143
- pos += 1;
9144
- if (currentDescriptor) descriptors.push(currentDescriptor);
9145
- parseDescriptors();
9146
- return;
9147
- } else if (c === "(") {
9148
- currentDescriptor = currentDescriptor + c;
9149
- state = "in parens";
9150
- } else if (c === "") {
9151
- if (currentDescriptor) descriptors.push(currentDescriptor);
9152
- parseDescriptors();
9153
- return;
9154
- } else currentDescriptor = currentDescriptor + c;
9155
- else if (state === "in parens") if (c === ")") {
9156
- currentDescriptor = currentDescriptor + c;
9157
- state = "in descriptor";
9158
- } else if (c === "") {
9159
- descriptors.push(currentDescriptor);
9160
- parseDescriptors();
9161
- return;
9162
- } else currentDescriptor = currentDescriptor + c;
9163
- else if (state === "after descriptor") if (isSpace(c)) {} else if (c === "") {
9164
- parseDescriptors();
9165
- return;
9166
- } else {
9167
- state = "in descriptor";
9168
- pos -= 1;
9169
9190
  }
9170
9191
  pos += 1;
9171
9192
  }
@@ -9270,14 +9291,16 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin$1(((exports, module
9270
9291
  if (file) this.file = file;
9271
9292
  if (source) this.source = source;
9272
9293
  if (plugin) this.plugin = plugin;
9273
- if (typeof line !== "undefined" && typeof column !== "undefined") if (typeof line === "number") {
9274
- this.line = line;
9275
- this.column = column;
9276
- } else {
9277
- this.line = line.line;
9278
- this.column = line.column;
9279
- this.endLine = column.line;
9280
- this.endColumn = column.column;
9294
+ if (typeof line !== "undefined" && typeof column !== "undefined") {
9295
+ if (typeof line === "number") {
9296
+ this.line = line;
9297
+ this.column = column;
9298
+ } else {
9299
+ this.line = line.line;
9300
+ this.column = line.column;
9301
+ this.endLine = column.line;
9302
+ this.endColumn = column.column;
9303
+ }
9281
9304
  }
9282
9305
  this.setMessage();
9283
9306
  if (Error.captureStackTrace) Error.captureStackTrace(this, CssSyntaxError);
@@ -9314,7 +9337,7 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin$1(((exports, module
9314
9337
  let subLineStart = Math.max(0, this.column - padding);
9315
9338
  let subLineEnd = Math.max(this.column + padding, this.endColumn + padding);
9316
9339
  let subLine = line.slice(subLineStart, subLineEnd);
9317
- let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
9340
+ let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, 19)).replace(/[^\t]/g, " ");
9318
9341
  return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing + mark("^");
9319
9342
  }
9320
9343
  let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
@@ -9335,6 +9358,7 @@ var require_css_syntax_error = /* @__PURE__ */ __commonJSMin$1(((exports, module
9335
9358
  var require_stringifier = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
9336
9359
  const STYLE_TAG = /(<)(\/?style\b)/gi;
9337
9360
  const COMMENT_OPEN = /(<)(!--)/g;
9361
+ const AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/;
9338
9362
  function escapeHTMLInCSS(str) {
9339
9363
  if (typeof str !== "string") return str;
9340
9364
  if (!str.includes("<")) return str;
@@ -9360,9 +9384,10 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
9360
9384
  function atruleStart(str, node) {
9361
9385
  let name = "@" + node.name;
9362
9386
  let params = node.params ? str.rawValue(node, "params") : "";
9363
- if (typeof node.raws.afterName !== "undefined") name += node.raws.afterName;
9364
- else if (params) name += " ";
9365
- return name + params;
9387
+ let afterName = node.raws.afterName;
9388
+ if (typeof afterName === "undefined") afterName = params ? " " : "";
9389
+ else if (afterName === "" && params && !AT_NAME_END.test(params[0])) afterName = " ";
9390
+ return name + afterName + params;
9366
9391
  }
9367
9392
  function pushBody(str, stack, node) {
9368
9393
  let nodes = node.nodes;
@@ -9373,11 +9398,16 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
9373
9398
  }
9374
9399
  let semicolon = str.raw(node, "semicolon");
9375
9400
  let isDocument = node.type === "document";
9376
- for (let i = nodes.length - 1; i >= 0; i--) stack.push({
9377
- document: isDocument,
9378
- node: nodes[i],
9379
- semicolon: last !== i || semicolon
9380
- });
9401
+ for (let i = nodes.length - 1; i >= 0; i--) {
9402
+ let child = nodes[i];
9403
+ let childSemicolon = last !== i || semicolon;
9404
+ if (!childSemicolon && i < nodes.length - 1 && (child.type === "atrule" && !child.nodes || child.type === "decl" && child.prop.startsWith("--"))) childSemicolon = true;
9405
+ stack.push({
9406
+ document: isDocument,
9407
+ node: child,
9408
+ semicolon: childSemicolon
9409
+ });
9410
+ }
9381
9411
  }
9382
9412
  function pushBlock(str, stack, node, start) {
9383
9413
  let between = str.raw(node, "between", "beforeOpen");
@@ -9622,6 +9652,7 @@ var require_stringifier = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
9622
9652
  return value;
9623
9653
  }
9624
9654
  root(node) {
9655
+ if (node.source && node.source.input.hasBOM) this.builder("", node, "start");
9625
9656
  this.body(node);
9626
9657
  if (node.raws.after) {
9627
9658
  let after = node.raws.after;
@@ -9804,7 +9835,9 @@ var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
9804
9835
  set(node, prop, value) {
9805
9836
  if (node[prop] === value) return true;
9806
9837
  node[prop] = value;
9807
- if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || prop === "text") node.markDirty();
9838
+ if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" ||
9839
+ /* c8 ignore next */
9840
+ prop === "text") node.markDirty();
9808
9841
  return true;
9809
9842
  }
9810
9843
  };
@@ -9957,21 +9990,23 @@ var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
9957
9990
  fixed[name] = fixedArray;
9958
9991
  for (let i = 0; i < value.length; i++) {
9959
9992
  let item = value[i];
9960
- if (typeof item === "object" && item.toJSON) if (item.toJSON === Node.prototype.toJSON) queue.push([
9961
- item,
9962
- fixedArray,
9963
- i
9964
- ]);
9965
- else fixedArray[i] = item.toJSON(null, inputs);
9966
- else fixedArray[i] = item;
9993
+ if (typeof item === "object" && item.toJSON) {
9994
+ if (item.toJSON === Node.prototype.toJSON) queue.push([
9995
+ item,
9996
+ fixedArray,
9997
+ i
9998
+ ]);
9999
+ else fixedArray[i] = item.toJSON(null, inputs);
10000
+ } else fixedArray[i] = item;
9967
10001
  }
9968
- } else if (typeof value === "object" && value.toJSON) if (value.toJSON === Node.prototype.toJSON) queue.push([
9969
- value,
9970
- fixed,
9971
- name
9972
- ]);
9973
- else fixed[name] = value.toJSON(null, inputs);
9974
- else if (name === "source") {
10002
+ } else if (typeof value === "object" && value.toJSON) {
10003
+ if (value.toJSON === Node.prototype.toJSON) queue.push([
10004
+ value,
10005
+ fixed,
10006
+ name
10007
+ ]);
10008
+ else fixed[name] = value.toJSON(null, inputs);
10009
+ } else if (name === "source") {
9975
10010
  if (value == null) continue;
9976
10011
  let inputId = inputs.get(value.input);
9977
10012
  if (inputId == null) {
@@ -10442,9 +10477,16 @@ var require_non_secure = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10442
10477
  }));
10443
10478
  var require_lib = /* @__PURE__ */ __commonJSMin$1((() => {}));
10444
10479
  var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10445
- let { existsSync, readFileSync } = require_lib();
10480
+ let { existsSync, readFileSync, realpathSync } = require_lib();
10446
10481
  let { dirname, isAbsolute, join, relative, sep } = require_lib();
10447
10482
  let { SourceMapConsumer, SourceMapGenerator } = require_lib();
10483
+ function realPath(path) {
10484
+ try {
10485
+ return realpathSync(path);
10486
+ } catch {
10487
+ return path;
10488
+ }
10489
+ }
10448
10490
  function fromBase64(str) {
10449
10491
  if (Buffer) return Buffer.from(str, "base64").toString();
10450
10492
  else
@@ -10494,11 +10536,10 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
10494
10536
  }
10495
10537
  loadFile(path, cssFile, trusted) {
10496
10538
  if (!trusted && !this.unsafeMap) {
10497
- if (!/\.map$/i.test(path)) return;
10498
- if (cssFile) {
10499
- let relativePath = relative(dirname(cssFile), path);
10500
- if (relativePath === ".." || relativePath.startsWith(".." + sep) || isAbsolute(relativePath)) return;
10501
- }
10539
+ if (!/\.map$/i.test(path)) return void 0;
10540
+ if (!cssFile) return void 0;
10541
+ let rel = relative(realPath(dirname(cssFile)), realPath(path));
10542
+ if (rel === ".." || rel.startsWith(".." + sep) || isAbsolute(rel)) return;
10502
10543
  }
10503
10544
  this.root = dirname(path);
10504
10545
  if (existsSync(path)) {
@@ -10508,19 +10549,20 @@ var require_previous_map = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
10508
10549
  }
10509
10550
  loadMap(file, prev) {
10510
10551
  if (prev === false) return false;
10511
- if (prev) if (typeof prev === "string") return prev;
10512
- else if (typeof prev === "function") {
10513
- let prevPath = prev(file);
10514
- if (prevPath) {
10515
- let map = this.loadFile(prevPath, file, true);
10516
- if (!map) throw new Error("Unable to load previous source map: " + prevPath.toString());
10517
- return map;
10518
- }
10519
- } else if (prev instanceof SourceMapConsumer) return SourceMapGenerator.fromSourceMap(prev).toString();
10520
- else if (prev instanceof SourceMapGenerator) return prev.toString();
10521
- else if (this.isMap(prev)) return JSON.stringify(prev);
10522
- else throw new Error("Unsupported previous source map format: " + prev.toString());
10523
- else if (this.inline) return this.decodeInline(this.annotation);
10552
+ if (prev) {
10553
+ if (typeof prev === "string") return prev;
10554
+ else if (typeof prev === "function") {
10555
+ let prevPath = prev(file);
10556
+ if (prevPath) {
10557
+ let map = this.loadFile(prevPath, file, true);
10558
+ if (!map) throw new Error("Unable to load previous source map: " + prevPath.toString());
10559
+ return map;
10560
+ }
10561
+ } else if (prev instanceof SourceMapConsumer) return SourceMapGenerator.fromSourceMap(prev).toString();
10562
+ else if (prev instanceof SourceMapGenerator) return prev.toString();
10563
+ else if (this.isMap(prev)) return JSON.stringify(prev);
10564
+ else throw new Error("Unsupported previous source map format: " + prev.toString());
10565
+ } else if (this.inline) return this.decodeInline(this.annotation);
10524
10566
  else if (this.annotation) {
10525
10567
  let map = this.annotation;
10526
10568
  if (file) map = join(dirname(file), map);
@@ -10581,8 +10623,10 @@ var require_input = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10581
10623
  } else this.hasBOM = false;
10582
10624
  this.document = this.css;
10583
10625
  if (opts.document) this.document = opts.document.toString();
10584
- if (opts.from) if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) this.file = opts.from;
10585
- else this.file = resolve(opts.from);
10626
+ if (opts.from) {
10627
+ if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) this.file = opts.from;
10628
+ else this.file = resolve(opts.from);
10629
+ }
10586
10630
  if (pathAvailable && sourceMapAvailable) {
10587
10631
  let map = new PreviousMap(this.css, opts);
10588
10632
  if (map.text) {
@@ -10711,10 +10755,12 @@ var require_input = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10711
10755
  line: from.line,
10712
10756
  url: fromUrl.toString()
10713
10757
  };
10714
- if (fromUrl.protocol === "file:") if (fileURLToPath) result.file = fileURLToPath(fromUrl);
10715
- else
10758
+ if (fromUrl.protocol === "file:") {
10759
+ if (fileURLToPath) result.file = fileURLToPath(fromUrl);
10760
+ else
10716
10761
  /* c8 ignore next 2 */
10717
- throw new Error(`file: protocol is not available in this PostCSS build`);
10762
+ throw new Error(`file: protocol is not available in this PostCSS build`);
10763
+ }
10718
10764
  let source = consumer.sourceContentFor(from.source);
10719
10765
  if (source) result.source = source;
10720
10766
  return result;
@@ -10753,9 +10799,10 @@ var require_root = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10753
10799
  for (let node of Array.isArray(child) ? child : [child]) if (node && typeof node === "object" && !node.parent && node.raws && typeof node.raws.before !== "undefined") keepBefore.add(node.raws);
10754
10800
  let nodes = super.normalize(child);
10755
10801
  if (sample) {
10756
- if (type === "prepend") if (this.nodes.length > 1) sample.raws.before = this.nodes[1].raws.before;
10757
- else delete sample.raws.before;
10758
- else if (this.first !== sample) {
10802
+ if (type === "prepend") {
10803
+ if (this.nodes.length > 1) sample.raws.before = this.nodes[1].raws.before;
10804
+ else delete sample.raws.before;
10805
+ } else if (this.first !== sample) {
10759
10806
  for (let node of nodes) if (!keepBefore.has(node.raws)) node.raws.before = sample.raws.before;
10760
10807
  }
10761
10808
  }
@@ -10793,6 +10840,7 @@ var require_list = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
10793
10840
  ]);
10794
10841
  },
10795
10842
  split(string, separators, last) {
10843
+ if (typeof string !== "string") return [];
10796
10844
  let array = [];
10797
10845
  let current = "";
10798
10846
  let split = false;
@@ -11073,20 +11121,22 @@ var require_map_generator = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
11073
11121
  } else column += str.length;
11074
11122
  if (node && type !== "start") {
11075
11123
  let p = node.parent || { raws: {} };
11076
- if (!(node.type === "decl" || node.type === "atrule" && !node.nodes) || node !== p.last || p.raws.semicolon) if (node.source && node.source.end) {
11077
- mapping.source = this.sourcePath(node);
11078
- mapping.original.line = node.source.end.line;
11079
- mapping.original.column = node.source.end.column - 1;
11080
- mapping.generated.line = line;
11081
- mapping.generated.column = column - 2;
11082
- this.map.addMapping(mapping);
11083
- } else {
11084
- mapping.source = noSource;
11085
- mapping.original.line = 1;
11086
- mapping.original.column = 0;
11087
- mapping.generated.line = line;
11088
- mapping.generated.column = column - 1;
11089
- this.map.addMapping(mapping);
11124
+ if (!(node.type === "decl" || node.type === "atrule" && !node.nodes) || node !== p.last || p.raws.semicolon) {
11125
+ if (node.source && node.source.end) {
11126
+ mapping.source = this.sourcePath(node);
11127
+ mapping.original.line = node.source.end.line;
11128
+ mapping.original.column = node.source.end.column - 1;
11129
+ mapping.generated.line = line;
11130
+ mapping.generated.column = column - 2;
11131
+ this.map.addMapping(mapping);
11132
+ } else {
11133
+ mapping.source = noSource;
11134
+ mapping.original.line = 1;
11135
+ mapping.original.column = 0;
11136
+ mapping.generated.line = line;
11137
+ mapping.generated.column = column - 1;
11138
+ this.map.addMapping(mapping);
11139
+ }
11090
11140
  }
11091
11141
  }
11092
11142
  });
@@ -11277,10 +11327,12 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11277
11327
  do {
11278
11328
  escaped = false;
11279
11329
  next = css.indexOf(")", next + 1);
11280
- if (next === -1) if (ignore || ignoreUnclosed) {
11281
- next = pos;
11282
- break;
11283
- } else unclosed("bracket");
11330
+ if (next === -1) {
11331
+ if (ignore || ignoreUnclosed) {
11332
+ next = pos;
11333
+ break;
11334
+ } else unclosed("bracket");
11335
+ }
11284
11336
  escapePos = next;
11285
11337
  while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
11286
11338
  escapePos -= 1;
@@ -11327,10 +11379,12 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11327
11379
  do {
11328
11380
  escaped = false;
11329
11381
  next = css.indexOf(quote, next + 1);
11330
- if (next === -1) if (ignore || ignoreUnclosed) {
11331
- next = pos + 1;
11332
- break;
11333
- } else unclosed("string");
11382
+ if (next === -1) {
11383
+ if (ignore || ignoreUnclosed) {
11384
+ next = pos + 1;
11385
+ break;
11386
+ } else unclosed("string");
11387
+ }
11334
11388
  escapePos = next;
11335
11389
  while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
11336
11390
  escapePos -= 1;
@@ -11381,33 +11435,33 @@ var require_tokenize = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11381
11435
  ];
11382
11436
  pos = next;
11383
11437
  break;
11384
- default:
11385
- if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
11386
- next = css.indexOf("*/", pos + 2) + 1;
11387
- if (next === 0) if (ignore || ignoreUnclosed) next = css.length;
11438
+ default: if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
11439
+ next = css.indexOf("*/", pos + 2) + 1;
11440
+ if (next === 0) {
11441
+ if (ignore || ignoreUnclosed) next = css.length;
11388
11442
  else unclosed("comment");
11389
- currentToken = [
11390
- "comment",
11391
- css.slice(pos, next + 1),
11392
- pos,
11393
- next
11394
- ];
11395
- pos = next;
11396
- } else {
11397
- RE_WORD_END.lastIndex = pos + 1;
11398
- RE_WORD_END.test(css);
11399
- if (RE_WORD_END.lastIndex === 0) next = css.length - 1;
11400
- else next = RE_WORD_END.lastIndex - 2;
11401
- currentToken = [
11402
- "word",
11403
- css.slice(pos, next + 1),
11404
- pos,
11405
- next
11406
- ];
11407
- buffer.push(currentToken);
11408
- pos = next;
11409
11443
  }
11410
- break;
11444
+ currentToken = [
11445
+ "comment",
11446
+ css.slice(pos, next + 1),
11447
+ pos,
11448
+ next
11449
+ ];
11450
+ pos = next;
11451
+ } else {
11452
+ RE_WORD_END.lastIndex = pos + 1;
11453
+ RE_WORD_END.test(css);
11454
+ if (RE_WORD_END.lastIndex === 0) next = css.length - 1;
11455
+ else next = RE_WORD_END.lastIndex - 2;
11456
+ currentToken = [
11457
+ "word",
11458
+ css.slice(pos, next + 1),
11459
+ pos,
11460
+ next
11461
+ ];
11462
+ buffer.push(currentToken);
11463
+ pos = next;
11464
+ }
11411
11465
  }
11412
11466
  pos++;
11413
11467
  return currentToken;
@@ -11481,28 +11535,29 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11481
11535
  if (type === "(" || type === "[") brackets.push(type === "(" ? ")" : "]");
11482
11536
  else if (type === "{" && brackets.length > 0) brackets.push("}");
11483
11537
  else if (type === brackets[brackets.length - 1]) brackets.pop();
11484
- if (brackets.length === 0) if (type === ";") {
11485
- node.source.end = this.getPosition(token[2]);
11486
- node.source.end.offset++;
11487
- this.semicolon = true;
11488
- break;
11489
- } else if (type === "{") {
11490
- open = true;
11491
- break;
11492
- } else if (type === "}") {
11493
- if (params.length > 0) {
11494
- shift = params.length - 1;
11495
- prev = params[shift];
11496
- while (prev && prev[0] === "space") prev = params[--shift];
11497
- if (prev) {
11498
- node.source.end = this.getPosition(prev[3] || prev[2]);
11499
- node.source.end.offset++;
11538
+ if (brackets.length === 0) {
11539
+ if (type === ";") {
11540
+ node.source.end = this.getPosition(token[2]);
11541
+ node.source.end.offset++;
11542
+ this.semicolon = true;
11543
+ break;
11544
+ } else if (type === "{") {
11545
+ open = true;
11546
+ break;
11547
+ } else if (type === "}") {
11548
+ if (params.length > 0) {
11549
+ shift = params.length - 1;
11550
+ prev = params[shift];
11551
+ while (prev && prev[0] === "space") prev = params[--shift];
11552
+ if (prev) {
11553
+ node.source.end = this.getPosition(prev[3] || prev[2]);
11554
+ node.source.end.offset++;
11555
+ }
11500
11556
  }
11501
- }
11502
- this.end(token);
11503
- break;
11557
+ this.end(token);
11558
+ break;
11559
+ } else params.push(token);
11504
11560
  } else params.push(token);
11505
- else params.push(token);
11506
11561
  if (this.tokenizer.endOfFile()) {
11507
11562
  last = true;
11508
11563
  break;
@@ -11550,9 +11605,11 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11550
11605
  type = token[0];
11551
11606
  if (type === "(") brackets += 1;
11552
11607
  if (type === ")") brackets -= 1;
11553
- if (brackets === 0 && type === ":") if (!prev) this.doubleColon(token);
11554
- else if (prev[0] === "word" && prev[1] === "progid") continue;
11555
- else return i;
11608
+ if (brackets === 0 && type === ":") {
11609
+ if (!prev) this.doubleColon(token);
11610
+ else if (prev[0] === "word" && prev[1] === "progid") continue;
11611
+ else return i;
11612
+ }
11556
11613
  prev = token;
11557
11614
  }
11558
11615
  return false;
@@ -11730,11 +11787,12 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11730
11787
  if (!bracket) bracket = token;
11731
11788
  brackets.push("}");
11732
11789
  } else if (brackets.length === 0) {
11733
- if (type === ";") if (colon) {
11734
- this.decl(tokens, customProperty);
11735
- return;
11736
- } else break;
11737
- else if (type === "{") {
11790
+ if (type === ";") {
11791
+ if (colon) {
11792
+ this.decl(tokens, customProperty);
11793
+ return;
11794
+ } else break;
11795
+ } else if (type === "{") {
11738
11796
  this.rule(tokens);
11739
11797
  return;
11740
11798
  } else if (type === "}") {
@@ -11782,9 +11840,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11782
11840
  case "{":
11783
11841
  this.emptyRule(token);
11784
11842
  break;
11785
- default:
11786
- this.other(token);
11787
- break;
11843
+ default: this.other(token);
11788
11844
  }
11789
11845
  }
11790
11846
  this.endFile();
@@ -11803,9 +11859,10 @@ var require_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11803
11859
  else if (type === "comment") {
11804
11860
  prev = tokens[i - 1] ? tokens[i - 1][0] : "empty";
11805
11861
  next = tokens[i + 1] ? tokens[i + 1][0] : "empty";
11806
- if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) if (value.slice(-1) === ",") clean = false;
11807
- else value += token[1];
11808
- else clean = false;
11862
+ if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
11863
+ if (value.slice(-1) === ",") clean = false;
11864
+ else value += token[1];
11865
+ } else clean = false;
11809
11866
  } else value += token[1];
11810
11867
  }
11811
11868
  if (!clean) {
@@ -11904,11 +11961,14 @@ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11904
11961
  Container.registerParse(parse);
11905
11962
  }));
11906
11963
  var require_warning = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
11964
+ let Container = require_container();
11965
+ let { my } = require_symbols();
11907
11966
  var Warning = class {
11908
11967
  constructor(text, opts = {}) {
11909
11968
  this.type = "warning";
11910
11969
  this.text = text;
11911
11970
  if (opts.node && opts.node.source) {
11971
+ if (!opts.node[my]) Container.rebuild(opts.node);
11912
11972
  let range = opts.node.rangeBy(opts);
11913
11973
  this.line = range.start.line;
11914
11974
  this.column = range.start.column;
@@ -12285,8 +12345,10 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
12285
12345
  root[isClean] = true;
12286
12346
  this.walkSync(root);
12287
12347
  }
12288
- if (this.listeners.OnceExit) if (root.type === "document") for (let subRoot of root.nodes) this.visitSync(this.listeners.OnceExit, subRoot);
12289
- else this.visitSync(this.listeners.OnceExit, root);
12348
+ if (this.listeners.OnceExit) {
12349
+ if (root.type === "document") for (let subRoot of root.nodes) this.visitSync(this.listeners.OnceExit, subRoot);
12350
+ else this.visitSync(this.listeners.OnceExit, root);
12351
+ }
12290
12352
  }
12291
12353
  return this.result;
12292
12354
  }
@@ -12333,14 +12395,19 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
12333
12395
  }
12334
12396
  if (visit.iterator !== 0) {
12335
12397
  let iterator = visit.iterator;
12398
+ if (visit.descending) {
12399
+ visit.descending = false;
12400
+ node.indexes[iterator] += 1;
12401
+ }
12336
12402
  let child;
12337
12403
  while (child = node.nodes[node.indexes[iterator]]) {
12338
- node.indexes[iterator] += 1;
12339
12404
  if (!child[isClean]) {
12340
12405
  child[isClean] = true;
12406
+ visit.descending = true;
12341
12407
  stack.push(toStack(child));
12342
12408
  return;
12343
12409
  }
12410
+ node.indexes[iterator] += 1;
12344
12411
  }
12345
12412
  visit.iterator = 0;
12346
12413
  delete node.indexes[iterator];
@@ -12375,12 +12442,16 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
12375
12442
  let visitNode = visit.node;
12376
12443
  if (visit.iterator !== 0) {
12377
12444
  let iterator = visit.iterator;
12445
+ if (visit.descending) {
12446
+ visit.descending = false;
12447
+ visitNode.indexes[iterator] += 1;
12448
+ }
12378
12449
  let child;
12379
12450
  let descended = false;
12380
12451
  while (child = visitNode.nodes[visitNode.indexes[iterator]]) {
12381
- visitNode.indexes[iterator] += 1;
12382
12452
  if (!child[isClean]) {
12383
12453
  child[isClean] = true;
12454
+ visit.descending = true;
12384
12455
  stack.push({
12385
12456
  eventIndex: 0,
12386
12457
  events: getEvents(child),
@@ -12390,6 +12461,7 @@ var require_lazy_result = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
12390
12461
  descended = true;
12391
12462
  break;
12392
12463
  }
12464
+ visitNode.indexes[iterator] += 1;
12393
12465
  }
12394
12466
  if (descended) continue;
12395
12467
  visit.iterator = 0;
@@ -12525,7 +12597,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
12525
12597
  let Root = require_root();
12526
12598
  var Processor = class {
12527
12599
  constructor(plugins = []) {
12528
- this.version = "8.5.19";
12600
+ this.version = "8.5.26";
12529
12601
  this.plugins = this.normalize(plugins);
12530
12602
  }
12531
12603
  normalize(plugins) {
@@ -12968,8 +13040,10 @@ var require_launder = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
12968
13040
  return tag.toLowerCase();
12969
13041
  };
12970
13042
  self.string = function(s, def) {
12971
- if (typeof s !== "string") if (typeof s === "number" || typeof s === "boolean") s += "";
12972
- else s = "";
13043
+ if (typeof s !== "string") {
13044
+ if (typeof s === "number" || typeof s === "boolean") s += "";
13045
+ else s = "";
13046
+ }
12973
13047
  s = s.trim();
12974
13048
  if (def !== void 0) {
12975
13049
  if (s === "") s = def;
@@ -13187,6 +13261,14 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13187
13261
  "embed"
13188
13262
  ];
13189
13263
  const vulnerableTags = ["script", "style"];
13264
+ const svgAnimationTags = [
13265
+ "animate",
13266
+ "animatecolor",
13267
+ "animatemotion",
13268
+ "animatetransform",
13269
+ "set"
13270
+ ];
13271
+ const alwaysUrlAttributes = ["href"];
13190
13272
  function each(obj, cb) {
13191
13273
  if (obj) Object.keys(obj).forEach(function(key) {
13192
13274
  cb(obj[key], key);
@@ -13335,7 +13417,7 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13335
13417
  transformMap[depth] = transformedTag.tagName;
13336
13418
  }
13337
13419
  }
13338
- if (!tagAllowed(name) || options.disallowedTagsMode === "recursiveEscape" && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
13420
+ if (!tagAllowed(name) || animatesUrlAttribute(name, attribs) || options.disallowedTagsMode === "recursiveEscape" && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
13339
13421
  skip = true;
13340
13422
  skipMap[depth] = true;
13341
13423
  if (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") {
@@ -13383,8 +13465,10 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13383
13465
  let newValue = "";
13384
13466
  if (o.multiple === true) {
13385
13467
  const splitStrArray = value.split(" ");
13386
- for (const s of splitStrArray) if (o.values.indexOf(s) !== -1) if (newValue === "") newValue = s;
13387
- else newValue += " " + s;
13468
+ for (const s of splitStrArray) if (o.values.indexOf(s) !== -1) {
13469
+ if (newValue === "") newValue = s;
13470
+ else newValue += " " + s;
13471
+ }
13388
13472
  } else if (o.values.indexOf(value) >= 0) newValue = value;
13389
13473
  value = newValue;
13390
13474
  }
@@ -13521,9 +13605,10 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13521
13605
  }
13522
13606
  if (options.disallowedTagsMode === "completelyDiscard" && !tagAllowed(tag)) text = "";
13523
13607
  else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "script" || tag === "style")) result += text;
13524
- else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "textarea" || tag === "xmp")) if (tag === "xmp") result += text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
13525
- else result += escapeHtml(text, false);
13526
- else if (!addedText) {
13608
+ else if (tag && tagAllowed(tag) && (options.disallowedTagsMode === "discard" || options.disallowedTagsMode === "completelyDiscard") && (tag === "textarea" || tag === "xmp")) {
13609
+ if (tag === "xmp") result += text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
13610
+ else result += escapeHtml(text, false);
13611
+ } else if (!addedText) {
13527
13612
  const escaped = escapeHtml(text, false);
13528
13613
  if (options.textFilter) result += options.textFilter(escaped, tag);
13529
13614
  else result += escaped;
@@ -13629,6 +13714,16 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
13629
13714
  allowProtocolRelative: options.allowProtocolRelative
13630
13715
  });
13631
13716
  }
13717
+ function animatesUrlAttribute(name, attribs) {
13718
+ if (svgAnimationTags.indexOf(name.toLowerCase()) === -1) return false;
13719
+ const schemeCheckedAttributes = options.allowedSchemesAppliedToAttributes || [];
13720
+ return Object.keys(attribs || {}).some(function(attributeName) {
13721
+ if (attributeName.toLowerCase() !== "attributename") return false;
13722
+ const target = (attribs[attributeName] || "").trim().toLowerCase();
13723
+ const localName = target.slice(target.lastIndexOf(":") + 1);
13724
+ return alwaysUrlAttributes.indexOf(localName) !== -1 || schemeCheckedAttributes.indexOf(target) !== -1 || schemeCheckedAttributes.indexOf(localName) !== -1;
13725
+ });
13726
+ }
13632
13727
  function parseUrl(value) {
13633
13728
  value = value.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/, "$1//");
13634
13729
  if (value.startsWith("relative:")) throw new Error("relative: exploit attempt");
@@ -14054,6 +14149,17 @@ var import_sanitize_html = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJS
14054
14149
  };
14055
14150
  };
14056
14151
  })))(), 1);
14152
+ const appendStyle = (style, declarations) => style ? `${style}; ${declarations}` : declarations;
14153
+ const transformCellAlign = (tagName, attribs) => {
14154
+ if (attribs.align) {
14155
+ attribs.style = appendStyle(attribs.style, `text-align:${attribs.align}`);
14156
+ delete attribs.align;
14157
+ }
14158
+ return {
14159
+ attribs,
14160
+ tagName
14161
+ };
14162
+ };
14057
14163
  const sanitizeHtml = (...[html, options]) => (0, import_sanitize_html.default)(html, {
14058
14164
  ...options,
14059
14165
  allowedAttributes: {
@@ -14067,30 +14173,12 @@ const sanitizeHtml = (...[html, options]) => (0, import_sanitize_html.default)(h
14067
14173
  table: (tagName, attribs) => ({
14068
14174
  attribs: {
14069
14175
  ...attribs,
14070
- style: `${attribs.style ? `${attribs.style}; ` : ""}width:100%; border-collapse: collapse;`
14176
+ style: appendStyle(attribs.style, "width:100%; border-collapse: collapse;")
14071
14177
  },
14072
14178
  tagName
14073
14179
  }),
14074
- td: (tagName, attribs) => {
14075
- if (attribs.align) {
14076
- attribs.style = `${attribs.style ? `${attribs.style}; ` : ""}text-align:${attribs.align}`;
14077
- delete attribs.align;
14078
- }
14079
- return {
14080
- attribs,
14081
- tagName
14082
- };
14083
- },
14084
- th: (tagName, attribs) => {
14085
- if (attribs.align) {
14086
- attribs.style = `${attribs.style ? `${attribs.style}; ` : ""}text-align:${attribs.align}`;
14087
- delete attribs.align;
14088
- }
14089
- return {
14090
- attribs,
14091
- tagName
14092
- };
14093
- }
14180
+ td: transformCellAlign,
14181
+ th: transformCellAlign
14094
14182
  }
14095
14183
  });
14096
14184
  const sanitizeTextHtml = (html) => sanitizeHtml(html, {
@@ -14130,11 +14218,36 @@ const applyItemMetadataMixin = (Base) => class ItemWithMetadata extends Base {
14130
14218
  deletedAt = null;
14131
14219
  updatedAt = /* @__PURE__ */ new Date();
14132
14220
  };
14221
+ const chunk = (array, size) => {
14222
+ const chunks = [];
14223
+ for (let index = 0; index < array.length; index += size) chunks.push(array.slice(index, index + size));
14224
+ return chunks;
14225
+ };
14226
+ const ARRAY_SERIALIZATION_BYTES = 1;
14227
+ const chunkBySerializedSize = (items, maxBytes, maxCount) => {
14228
+ const textEncoder = new TextEncoder();
14229
+ const chunks = [];
14230
+ let currentChunk = [];
14231
+ let currentBytes = ARRAY_SERIALIZATION_BYTES;
14232
+ for (const item of items) {
14233
+ const itemBytes = textEncoder.encode(JSON.stringify(item)).length + 1;
14234
+ if (currentChunk.length > 0 && (currentChunk.length === maxCount || currentBytes + itemBytes > maxBytes)) {
14235
+ chunks.push(currentChunk);
14236
+ currentChunk = [];
14237
+ currentBytes = ARRAY_SERIALIZATION_BYTES;
14238
+ }
14239
+ currentChunk.push(item);
14240
+ currentBytes += itemBytes;
14241
+ }
14242
+ if (currentChunk.length > 0) chunks.push(currentChunk);
14243
+ return chunks;
14244
+ };
14133
14245
  const takeOne = (values, index = 0) => {
14134
14246
  return values[index];
14135
14247
  };
14136
14248
  const getIsServer = () => typeof window === "undefined";
14137
14249
  const ID_SEPARATOR = "|";
14250
+ const UUID_LENGTH = 36;
14138
14251
  const getOrCreate = (map, key, create) => {
14139
14252
  if (map.has(key)) return map.get(key);
14140
14253
  const value = create();
@@ -14149,22 +14262,37 @@ const checkIsPlainObject = (data) => {
14149
14262
  const ISO_DATE_REGEX = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2}(?:\.{0,1}\d*))(?:Z|(?<sign>\+|-)(?<offset>[\d|:]*))?$/u;
14150
14263
  const MS_AJAX_DATE_REGEX = /^\/Date\((?<timestamp>-?\d+(?:[-+]\d+)?)\)[/\\]$/u;
14151
14264
  const jsonDateParse = (text) => JSON.parse(text, (_key, value) => {
14152
- let parsedValue = value;
14153
- if (typeof value === "string") {
14154
- let a = ISO_DATE_REGEX.exec(value);
14155
- if (a) parsedValue = new Date(value);
14156
- else {
14157
- a = MS_AJAX_DATE_REGEX.exec(value);
14158
- if (a) {
14159
- const b = takeOne(a, 1).split(/[-+,.]/u);
14160
- parsedValue = new Date(b[0] ? Number(b[0]) : 0 - Number(b[1]));
14161
- }
14162
- }
14163
- }
14164
- return parsedValue;
14265
+ if (typeof value !== "string") return value;
14266
+ else if (ISO_DATE_REGEX.test(value)) return new Date(value);
14267
+ const msAjaxDateMatch = MS_AJAX_DATE_REGEX.exec(value);
14268
+ if (!msAjaxDateMatch) return value;
14269
+ const timestampParts = takeOne(msAjaxDateMatch, 1).split(/[-+,.]/u);
14270
+ return new Date(timestampParts[0] ? Number(timestampParts[0]) : 0 - Number(timestampParts[1]));
14165
14271
  });
14166
14272
  const mergeObjectsStrict = (...objects) => Object.assign({}, ...objects);
14273
+ const settleAll = async (tasks, concurrencyLimit = tasks.length) => {
14274
+ if (tasks.length === 0) return [];
14275
+ const values = [];
14276
+ for (const tasksChunk of chunk(tasks, concurrencyLimit)) {
14277
+ const results = await Promise.allSettled(tasksChunk.map((task) => Promise.resolve().then(task)));
14278
+ const reasons = [];
14279
+ for (const result of results) if (result.status === "rejected") reasons.push(result.reason);
14280
+ else values.push(result.value);
14281
+ if (reasons.length === 1) throw takeOne(reasons);
14282
+ else if (reasons.length > 1) throw new AggregateError(reasons, toAppError(takeOne(reasons)).message);
14283
+ }
14284
+ return values;
14285
+ };
14167
14286
  const capitalize = (string) => `${string.charAt(0).toUpperCase()}${string.slice(1)}`;
14287
+ const EncodedSubDelimiterMap = {
14288
+ "!": "%21",
14289
+ "'": "%27",
14290
+ "(": "%28",
14291
+ ")": "%29",
14292
+ "*": "%2A"
14293
+ };
14294
+ const encodeUrlSubDelimiters = (value) => Object.entries(EncodedSubDelimiterMap).reduce((encoded, [subDelimiter, encodedSubDelimiter]) => encoded.replaceAll(subDelimiter, encodedSubDelimiter), value);
14295
+ const getDecodedUriComponent = (value, fallback) => getResult(() => decodeURIComponent(value)).unwrapOr(fallback);
14168
14296
  const normalizeString = (value) => value?.trim() ?? "";
14169
14297
  const createNormalizedStringSchema = (maxLength, schema = z.string()) => schema.transform(normalizeString).pipe(z.string().max(maxLength));
14170
14298
  const streamToText = async (readable) => {
@@ -14174,11 +14302,11 @@ const streamToText = async (readable) => {
14174
14302
  return data;
14175
14303
  };
14176
14304
  const toKebabCase = (string) => string.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/gu)?.map((x) => x.toLowerCase()).join("-") ?? "";
14177
- const SUFFIX = "...\"";
14305
+ const SUFFIX = "...";
14178
14306
  const truncate = (string, length) => {
14179
14307
  if (string.length <= length) return string;
14180
- if (length < 4) return string.slice(0, length);
14181
- return `${string.slice(0, length - 4)}${SUFFIX}`;
14308
+ if (length < 3) return string.slice(0, length);
14309
+ return `${string.slice(0, length - 3)}${SUFFIX}`;
14182
14310
  };
14183
14311
  const uncapitalize = (string) => `${string.charAt(0).toLowerCase()}${string.slice(1)}`;
14184
14312
  const hrtime = (previousHrTime) => {
@@ -14208,4 +14336,4 @@ const exhaustiveGuard = (value) => {
14208
14336
  const createUniqueArraySchema = (schema, key) => schema.array().refine((array) => new Set(key === void 0 ? array : array.map((item) => item[key])).size === array.length, "Array items must be unique");
14209
14337
  const UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/iu;
14210
14338
  const uuidValidateV4 = (uuid) => UUIDV4_REGEX.test(uuid);
14211
- export { AllSpecialValues, ForbiddenError, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, MAX_READ_LIMIT, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, applyItemMetadataMixin, capitalize, checkIsPlainObject, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, exhaustiveGuard, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };
14339
+ export { AllSpecialValues, ForbiddenError, GIBIBYTE, ID_SEPARATOR, InvalidOperationError, ItemEntityTypePropertyNames, ItemMetadata, ItemMetadataPropertyNames, KIBIBYTE, MAX_READ_LIMIT, MEGABYTE, MENTION_EVERYONE_ID, MENTION_HERE_ID, MENTION_ID_ATTRIBUTE, MENTION_ITEM_TYPE_ATTRIBUTE, MENTION_LABEL_ATTRIBUTE, MENTION_TYPE, MENTION_TYPE_ATTRIBUTE, MentionType, NotFoundError, NotInitializedError, Operation, RoutePath, SITE_NAME, Serializable, UUIDV4_REGEX, UUID_LENGTH, WordFilteredError, applyItemMetadataMixin, capitalize, checkIsPlainObject, chunk, chunkBySerializedSize, classifyMentions, createExponentialBackoff, createItemEntityTypeSchema, createNormalizedStringSchema, createUniqueArraySchema, css, encodeUrlSubDelimiters, exhaustiveGuard, getDecodedUriComponent, getIsServer, getMentions, getOrCreate, getPropertyNames, getRawData, getResult, getResultAsync, hrtime, html, itemMetadataSchema, jsonDateParse, mergeObjectsStrict, noop, normalizeString, now, sanitizeHtml, sanitizeTextHtml, settleAll, sleep, streamToText, takeOne, toAppError, toKebabCase, toRawDeep, truncate, uncapitalize, uuidValidateV4, withFinalizer, withFinalizerAsync };