@nextcloud/files 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -15,11 +15,10 @@ export { Node, NodeStatus, type INode } from './files/node';
15
15
  export * from './utils/filename-validation';
16
16
  export { getUniqueName } from './utils/filename';
17
17
  export { formatFileSize, parseFileSize } from './utils/fileSize';
18
- export { orderBy } from './utils/sorting';
18
+ export { orderBy, type SortingOrder } from './utils/sorting';
19
19
  export { sortNodes, FilesSortingMode, type FilesSortingOptions } from './utils/fileSorting';
20
- export * from './navigation/navigation';
21
- export * from './navigation/column';
22
- export * from './navigation/view';
20
+ export * from './navigation/index';
21
+ export * from './fileListFilters';
23
22
  /**
24
23
  * Add a new menu entry to the upload manager menu
25
24
  *
package/dist/index.mjs CHANGED
@@ -869,7 +869,8 @@ const davResultToNode = function(node, filesRoot = davRootPath, remoteURL = davR
869
869
  source: `${remoteURL}${node.filename}`,
870
870
  mtime: new Date(Date.parse(node.lastmod)),
871
871
  mime: node.mime || "application/octet-stream",
872
- displayname: props.displayname,
872
+ // Manually cast to work around for https://github.com/perry-mitchell/webdav-client/pull/380
873
+ displayname: props.displayname !== void 0 ? String(props.displayname) : void 0,
873
874
  size: props?.size || Number.parseInt(props.getcontentlength || "0"),
874
875
  // The fileid is set to -1 for failed requests
875
876
  status: id < 0 ? NodeStatus.FAILED : void 0,
@@ -1026,10 +1027,10 @@ function stringify(value) {
1026
1027
  }
1027
1028
  return String(value);
1028
1029
  }
1029
- function orderBy(collection, identifiers, orders) {
1030
- identifiers = identifiers ?? [(value) => value];
1030
+ function orderBy(collection, identifiers2, orders) {
1031
+ identifiers2 = identifiers2 ?? [(value) => value];
1031
1032
  orders = orders ?? [];
1032
- const sorting = identifiers.map((_, index) => (orders[index] ?? "asc") === "asc" ? 1 : -1);
1033
+ const sorting = identifiers2.map((_, index) => (orders[index] ?? "asc") === "asc" ? 1 : -1);
1033
1034
  const collator = Intl.Collator(
1034
1035
  [getLanguage(), getCanonicalLocale()],
1035
1036
  {
@@ -1039,7 +1040,7 @@ function orderBy(collection, identifiers, orders) {
1039
1040
  }
1040
1041
  );
1041
1042
  return [...collection].sort((a, b) => {
1042
- for (const [index, identifier] of identifiers.entries()) {
1043
+ for (const [index, identifier] of identifiers2.entries()) {
1043
1044
  const value = collator.compare(stringify(identifier(a)), stringify(identifier(b)));
1044
1045
  if (value !== 0) {
1045
1046
  return value * sorting[index];
@@ -1063,14 +1064,14 @@ function sortNodes(nodes, options = {}) {
1063
1064
  ...options
1064
1065
  };
1065
1066
  const basename2 = (name) => name.lastIndexOf(".") > 0 ? name.slice(0, name.lastIndexOf(".")) : name;
1066
- const identifiers = [
1067
+ const identifiers2 = [
1067
1068
  // 1: Sort favorites first if enabled
1068
1069
  ...sortingOptions.sortFavoritesFirst ? [(v) => v.attributes?.favorite !== 1] : [],
1069
1070
  // 2: Sort folders first if sorting by name
1070
1071
  ...sortingOptions.sortFoldersFirst ? [(v) => v.type !== "folder"] : [],
1071
- // 3: Use sorting mode if NOT basename (to be able to use displayname too)
1072
+ // 3: Use sorting mode if NOT basename (to be able to use display name too)
1072
1073
  ...sortingOptions.sortingMode !== "basename" ? [(v) => v[sortingOptions.sortingMode]] : [],
1073
- // 4: Use displayname if available, fallback to name
1074
+ // 4: Use display name if available, fallback to name
1074
1075
  (v) => basename2(v.attributes?.displayname || v.basename),
1075
1076
  // 5: Finally, use basename if all previous sorting methods failed
1076
1077
  (v) => v.basename
@@ -1089,7 +1090,7 @@ function sortNodes(nodes, options = {}) {
1089
1090
  // for 5: use configured sorting direction
1090
1091
  sortingOptions.sortingOrder
1091
1092
  ];
1092
- return orderBy(nodes, identifiers, orders);
1093
+ return orderBy(nodes, identifiers2, orders);
1093
1094
  }
1094
1095
  class Navigation extends TypedEventTarget {
1095
1096
  _views = [];
@@ -1187,6 +1188,9 @@ const isValidColumn = function(column) {
1187
1188
  }
1188
1189
  return true;
1189
1190
  };
1191
+ function getDefaultExportFromCjs(x) {
1192
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1193
+ }
1190
1194
  var validator$2 = {};
1191
1195
  var util$3 = {};
1192
1196
  (function(exports) {
@@ -1380,7 +1384,7 @@ validator$2.validate = function(xmlData, options) {
1380
1384
  } else if (tags.length == 1) {
1381
1385
  return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
1382
1386
  } else if (tags.length > 0) {
1383
- return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
1387
+ return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t2) => t2.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
1384
1388
  }
1385
1389
  return true;
1386
1390
  };
@@ -1490,15 +1494,15 @@ function validateAttributeString(attrStr, options) {
1490
1494
  return true;
1491
1495
  }
1492
1496
  function validateNumberAmpersand(xmlData, i) {
1493
- let re = /\d/;
1497
+ let re2 = /\d/;
1494
1498
  if (xmlData[i] === "x") {
1495
1499
  i++;
1496
- re = /[\da-fA-F]/;
1500
+ re2 = /[\da-fA-F]/;
1497
1501
  }
1498
1502
  for (; i < xmlData.length; i++) {
1499
1503
  if (xmlData[i] === ";")
1500
1504
  return i;
1501
- if (!xmlData[i].match(re))
1505
+ if (!xmlData[i].match(re2))
1502
1506
  break;
1503
1507
  }
1504
1508
  return -1;
@@ -2880,6 +2884,534 @@ const isValidView = function(view) {
2880
2884
  }
2881
2885
  return true;
2882
2886
  };
2887
+ const debug$1 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
2888
+ };
2889
+ var debug_1 = debug$1;
2890
+ const SEMVER_SPEC_VERSION = "2.0.0";
2891
+ const MAX_LENGTH$1 = 256;
2892
+ const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
2893
+ 9007199254740991;
2894
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
2895
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
2896
+ const RELEASE_TYPES = [
2897
+ "major",
2898
+ "premajor",
2899
+ "minor",
2900
+ "preminor",
2901
+ "patch",
2902
+ "prepatch",
2903
+ "prerelease"
2904
+ ];
2905
+ var constants = {
2906
+ MAX_LENGTH: MAX_LENGTH$1,
2907
+ MAX_SAFE_COMPONENT_LENGTH,
2908
+ MAX_SAFE_BUILD_LENGTH,
2909
+ MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
2910
+ RELEASE_TYPES,
2911
+ SEMVER_SPEC_VERSION,
2912
+ FLAG_INCLUDE_PRERELEASE: 1,
2913
+ FLAG_LOOSE: 2
2914
+ };
2915
+ var re$1 = { exports: {} };
2916
+ (function(module, exports) {
2917
+ const {
2918
+ MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH2,
2919
+ MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH2,
2920
+ MAX_LENGTH: MAX_LENGTH2
2921
+ } = constants;
2922
+ const debug2 = debug_1;
2923
+ exports = module.exports = {};
2924
+ const re2 = exports.re = [];
2925
+ const safeRe = exports.safeRe = [];
2926
+ const src = exports.src = [];
2927
+ const t2 = exports.t = {};
2928
+ let R = 0;
2929
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
2930
+ const safeRegexReplacements = [
2931
+ ["\\s", 1],
2932
+ ["\\d", MAX_LENGTH2],
2933
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH2]
2934
+ ];
2935
+ const makeSafeRegex = (value) => {
2936
+ for (const [token, max] of safeRegexReplacements) {
2937
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
2938
+ }
2939
+ return value;
2940
+ };
2941
+ const createToken = (name, value, isGlobal) => {
2942
+ const safe = makeSafeRegex(value);
2943
+ const index = R++;
2944
+ debug2(name, index, value);
2945
+ t2[name] = index;
2946
+ src[index] = value;
2947
+ re2[index] = new RegExp(value, isGlobal ? "g" : void 0);
2948
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
2949
+ };
2950
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
2951
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
2952
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
2953
+ createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
2954
+ createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
2955
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
2956
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
2957
+ createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
2958
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
2959
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
2960
+ createToken("BUILD", `(?:\\+(${src[t2.BUILDIDENTIFIER]}(?:\\.${src[t2.BUILDIDENTIFIER]})*))`);
2961
+ createToken("FULLPLAIN", `v?${src[t2.MAINVERSION]}${src[t2.PRERELEASE]}?${src[t2.BUILD]}?`);
2962
+ createToken("FULL", `^${src[t2.FULLPLAIN]}$`);
2963
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t2.MAINVERSIONLOOSE]}${src[t2.PRERELEASELOOSE]}?${src[t2.BUILD]}?`);
2964
+ createToken("LOOSE", `^${src[t2.LOOSEPLAIN]}$`);
2965
+ createToken("GTLT", "((?:<|>)?=?)");
2966
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t2.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
2967
+ createToken("XRANGEIDENTIFIER", `${src[t2.NUMERICIDENTIFIER]}|x|X|\\*`);
2968
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:\\.(${src[t2.XRANGEIDENTIFIER]})(?:${src[t2.PRERELEASE]})?${src[t2.BUILD]}?)?)?`);
2969
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
2970
+ createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
2971
+ createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
2972
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
2973
+ createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
2974
+ createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
2975
+ createToken("COERCERTL", src[t2.COERCE], true);
2976
+ createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
2977
+ createToken("LONETILDE", "(?:~>?)");
2978
+ createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
2979
+ exports.tildeTrimReplace = "$1~";
2980
+ createToken("TILDE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAIN]}$`);
2981
+ createToken("TILDELOOSE", `^${src[t2.LONETILDE]}${src[t2.XRANGEPLAINLOOSE]}$`);
2982
+ createToken("LONECARET", "(?:\\^)");
2983
+ createToken("CARETTRIM", `(\\s*)${src[t2.LONECARET]}\\s+`, true);
2984
+ exports.caretTrimReplace = "$1^";
2985
+ createToken("CARET", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAIN]}$`);
2986
+ createToken("CARETLOOSE", `^${src[t2.LONECARET]}${src[t2.XRANGEPLAINLOOSE]}$`);
2987
+ createToken("COMPARATORLOOSE", `^${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]})$|^$`);
2988
+ createToken("COMPARATOR", `^${src[t2.GTLT]}\\s*(${src[t2.FULLPLAIN]})$|^$`);
2989
+ createToken("COMPARATORTRIM", `(\\s*)${src[t2.GTLT]}\\s*(${src[t2.LOOSEPLAIN]}|${src[t2.XRANGEPLAIN]})`, true);
2990
+ exports.comparatorTrimReplace = "$1$2$3";
2991
+ createToken("HYPHENRANGE", `^\\s*(${src[t2.XRANGEPLAIN]})\\s+-\\s+(${src[t2.XRANGEPLAIN]})\\s*$`);
2992
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t2.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t2.XRANGEPLAINLOOSE]})\\s*$`);
2993
+ createToken("STAR", "(<|>)?=?\\s*\\*");
2994
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
2995
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
2996
+ })(re$1, re$1.exports);
2997
+ var reExports = re$1.exports;
2998
+ const looseOption = Object.freeze({ loose: true });
2999
+ const emptyOpts = Object.freeze({});
3000
+ const parseOptions$1 = (options) => {
3001
+ if (!options) {
3002
+ return emptyOpts;
3003
+ }
3004
+ if (typeof options !== "object") {
3005
+ return looseOption;
3006
+ }
3007
+ return options;
3008
+ };
3009
+ var parseOptions_1 = parseOptions$1;
3010
+ const numeric = /^[0-9]+$/;
3011
+ const compareIdentifiers$1 = (a, b) => {
3012
+ const anum = numeric.test(a);
3013
+ const bnum = numeric.test(b);
3014
+ if (anum && bnum) {
3015
+ a = +a;
3016
+ b = +b;
3017
+ }
3018
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
3019
+ };
3020
+ const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
3021
+ var identifiers = {
3022
+ compareIdentifiers: compareIdentifiers$1,
3023
+ rcompareIdentifiers
3024
+ };
3025
+ const debug = debug_1;
3026
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants;
3027
+ const { safeRe: re, t } = reExports;
3028
+ const parseOptions = parseOptions_1;
3029
+ const { compareIdentifiers } = identifiers;
3030
+ let SemVer$2 = class SemVer {
3031
+ constructor(version, options) {
3032
+ options = parseOptions(options);
3033
+ if (version instanceof SemVer) {
3034
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
3035
+ return version;
3036
+ } else {
3037
+ version = version.version;
3038
+ }
3039
+ } else if (typeof version !== "string") {
3040
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
3041
+ }
3042
+ if (version.length > MAX_LENGTH) {
3043
+ throw new TypeError(
3044
+ `version is longer than ${MAX_LENGTH} characters`
3045
+ );
3046
+ }
3047
+ debug("SemVer", version, options);
3048
+ this.options = options;
3049
+ this.loose = !!options.loose;
3050
+ this.includePrerelease = !!options.includePrerelease;
3051
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
3052
+ if (!m) {
3053
+ throw new TypeError(`Invalid Version: ${version}`);
3054
+ }
3055
+ this.raw = version;
3056
+ this.major = +m[1];
3057
+ this.minor = +m[2];
3058
+ this.patch = +m[3];
3059
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
3060
+ throw new TypeError("Invalid major version");
3061
+ }
3062
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
3063
+ throw new TypeError("Invalid minor version");
3064
+ }
3065
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
3066
+ throw new TypeError("Invalid patch version");
3067
+ }
3068
+ if (!m[4]) {
3069
+ this.prerelease = [];
3070
+ } else {
3071
+ this.prerelease = m[4].split(".").map((id) => {
3072
+ if (/^[0-9]+$/.test(id)) {
3073
+ const num = +id;
3074
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
3075
+ return num;
3076
+ }
3077
+ }
3078
+ return id;
3079
+ });
3080
+ }
3081
+ this.build = m[5] ? m[5].split(".") : [];
3082
+ this.format();
3083
+ }
3084
+ format() {
3085
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
3086
+ if (this.prerelease.length) {
3087
+ this.version += `-${this.prerelease.join(".")}`;
3088
+ }
3089
+ return this.version;
3090
+ }
3091
+ toString() {
3092
+ return this.version;
3093
+ }
3094
+ compare(other) {
3095
+ debug("SemVer.compare", this.version, this.options, other);
3096
+ if (!(other instanceof SemVer)) {
3097
+ if (typeof other === "string" && other === this.version) {
3098
+ return 0;
3099
+ }
3100
+ other = new SemVer(other, this.options);
3101
+ }
3102
+ if (other.version === this.version) {
3103
+ return 0;
3104
+ }
3105
+ return this.compareMain(other) || this.comparePre(other);
3106
+ }
3107
+ compareMain(other) {
3108
+ if (!(other instanceof SemVer)) {
3109
+ other = new SemVer(other, this.options);
3110
+ }
3111
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
3112
+ }
3113
+ comparePre(other) {
3114
+ if (!(other instanceof SemVer)) {
3115
+ other = new SemVer(other, this.options);
3116
+ }
3117
+ if (this.prerelease.length && !other.prerelease.length) {
3118
+ return -1;
3119
+ } else if (!this.prerelease.length && other.prerelease.length) {
3120
+ return 1;
3121
+ } else if (!this.prerelease.length && !other.prerelease.length) {
3122
+ return 0;
3123
+ }
3124
+ let i = 0;
3125
+ do {
3126
+ const a = this.prerelease[i];
3127
+ const b = other.prerelease[i];
3128
+ debug("prerelease compare", i, a, b);
3129
+ if (a === void 0 && b === void 0) {
3130
+ return 0;
3131
+ } else if (b === void 0) {
3132
+ return 1;
3133
+ } else if (a === void 0) {
3134
+ return -1;
3135
+ } else if (a === b) {
3136
+ continue;
3137
+ } else {
3138
+ return compareIdentifiers(a, b);
3139
+ }
3140
+ } while (++i);
3141
+ }
3142
+ compareBuild(other) {
3143
+ if (!(other instanceof SemVer)) {
3144
+ other = new SemVer(other, this.options);
3145
+ }
3146
+ let i = 0;
3147
+ do {
3148
+ const a = this.build[i];
3149
+ const b = other.build[i];
3150
+ debug("build compare", i, a, b);
3151
+ if (a === void 0 && b === void 0) {
3152
+ return 0;
3153
+ } else if (b === void 0) {
3154
+ return 1;
3155
+ } else if (a === void 0) {
3156
+ return -1;
3157
+ } else if (a === b) {
3158
+ continue;
3159
+ } else {
3160
+ return compareIdentifiers(a, b);
3161
+ }
3162
+ } while (++i);
3163
+ }
3164
+ // preminor will bump the version up to the next minor release, and immediately
3165
+ // down to pre-release. premajor and prepatch work the same way.
3166
+ inc(release, identifier, identifierBase) {
3167
+ switch (release) {
3168
+ case "premajor":
3169
+ this.prerelease.length = 0;
3170
+ this.patch = 0;
3171
+ this.minor = 0;
3172
+ this.major++;
3173
+ this.inc("pre", identifier, identifierBase);
3174
+ break;
3175
+ case "preminor":
3176
+ this.prerelease.length = 0;
3177
+ this.patch = 0;
3178
+ this.minor++;
3179
+ this.inc("pre", identifier, identifierBase);
3180
+ break;
3181
+ case "prepatch":
3182
+ this.prerelease.length = 0;
3183
+ this.inc("patch", identifier, identifierBase);
3184
+ this.inc("pre", identifier, identifierBase);
3185
+ break;
3186
+ case "prerelease":
3187
+ if (this.prerelease.length === 0) {
3188
+ this.inc("patch", identifier, identifierBase);
3189
+ }
3190
+ this.inc("pre", identifier, identifierBase);
3191
+ break;
3192
+ case "major":
3193
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
3194
+ this.major++;
3195
+ }
3196
+ this.minor = 0;
3197
+ this.patch = 0;
3198
+ this.prerelease = [];
3199
+ break;
3200
+ case "minor":
3201
+ if (this.patch !== 0 || this.prerelease.length === 0) {
3202
+ this.minor++;
3203
+ }
3204
+ this.patch = 0;
3205
+ this.prerelease = [];
3206
+ break;
3207
+ case "patch":
3208
+ if (this.prerelease.length === 0) {
3209
+ this.patch++;
3210
+ }
3211
+ this.prerelease = [];
3212
+ break;
3213
+ case "pre": {
3214
+ const base = Number(identifierBase) ? 1 : 0;
3215
+ if (!identifier && identifierBase === false) {
3216
+ throw new Error("invalid increment argument: identifier is empty");
3217
+ }
3218
+ if (this.prerelease.length === 0) {
3219
+ this.prerelease = [base];
3220
+ } else {
3221
+ let i = this.prerelease.length;
3222
+ while (--i >= 0) {
3223
+ if (typeof this.prerelease[i] === "number") {
3224
+ this.prerelease[i]++;
3225
+ i = -2;
3226
+ }
3227
+ }
3228
+ if (i === -1) {
3229
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
3230
+ throw new Error("invalid increment argument: identifier already exists");
3231
+ }
3232
+ this.prerelease.push(base);
3233
+ }
3234
+ }
3235
+ if (identifier) {
3236
+ let prerelease = [identifier, base];
3237
+ if (identifierBase === false) {
3238
+ prerelease = [identifier];
3239
+ }
3240
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
3241
+ if (isNaN(this.prerelease[1])) {
3242
+ this.prerelease = prerelease;
3243
+ }
3244
+ } else {
3245
+ this.prerelease = prerelease;
3246
+ }
3247
+ }
3248
+ break;
3249
+ }
3250
+ default:
3251
+ throw new Error(`invalid increment argument: ${release}`);
3252
+ }
3253
+ this.raw = this.format();
3254
+ if (this.build.length) {
3255
+ this.raw += `+${this.build.join(".")}`;
3256
+ }
3257
+ return this;
3258
+ }
3259
+ };
3260
+ var semver = SemVer$2;
3261
+ const SemVer$1 = semver;
3262
+ const parse$1 = (version, options, throwErrors = false) => {
3263
+ if (version instanceof SemVer$1) {
3264
+ return version;
3265
+ }
3266
+ try {
3267
+ return new SemVer$1(version, options);
3268
+ } catch (er) {
3269
+ if (!throwErrors) {
3270
+ return null;
3271
+ }
3272
+ throw er;
3273
+ }
3274
+ };
3275
+ var parse_1 = parse$1;
3276
+ const parse = parse_1;
3277
+ const valid = (version, options) => {
3278
+ const v = parse(version, options);
3279
+ return v ? v.version : null;
3280
+ };
3281
+ var valid_1 = valid;
3282
+ const valid$1 = /* @__PURE__ */ getDefaultExportFromCjs(valid_1);
3283
+ const SemVer2 = semver;
3284
+ const major = (a, loose) => new SemVer2(a, loose).major;
3285
+ var major_1 = major;
3286
+ const major$1 = /* @__PURE__ */ getDefaultExportFromCjs(major_1);
3287
+ class ProxyBus {
3288
+ bus;
3289
+ constructor(bus2) {
3290
+ if (typeof bus2.getVersion !== "function" || !valid$1(bus2.getVersion())) {
3291
+ console.warn("Proxying an event bus with an unknown or invalid version");
3292
+ } else if (major$1(bus2.getVersion()) !== major$1(this.getVersion())) {
3293
+ console.warn(
3294
+ "Proxying an event bus of version " + bus2.getVersion() + " with " + this.getVersion()
3295
+ );
3296
+ }
3297
+ this.bus = bus2;
3298
+ }
3299
+ getVersion() {
3300
+ return "3.3.1";
3301
+ }
3302
+ subscribe(name, handler) {
3303
+ this.bus.subscribe(name, handler);
3304
+ }
3305
+ unsubscribe(name, handler) {
3306
+ this.bus.unsubscribe(name, handler);
3307
+ }
3308
+ emit(name, event) {
3309
+ this.bus.emit(name, event);
3310
+ }
3311
+ }
3312
+ class SimpleBus {
3313
+ handlers = /* @__PURE__ */ new Map();
3314
+ getVersion() {
3315
+ return "3.3.1";
3316
+ }
3317
+ subscribe(name, handler) {
3318
+ this.handlers.set(
3319
+ name,
3320
+ (this.handlers.get(name) || []).concat(
3321
+ handler
3322
+ )
3323
+ );
3324
+ }
3325
+ unsubscribe(name, handler) {
3326
+ this.handlers.set(
3327
+ name,
3328
+ (this.handlers.get(name) || []).filter((h) => h !== handler)
3329
+ );
3330
+ }
3331
+ emit(name, event) {
3332
+ (this.handlers.get(name) || []).forEach((h) => {
3333
+ try {
3334
+ h(event);
3335
+ } catch (e) {
3336
+ console.error("could not invoke event listener", e);
3337
+ }
3338
+ });
3339
+ }
3340
+ }
3341
+ let bus = null;
3342
+ function getBus() {
3343
+ if (bus !== null) {
3344
+ return bus;
3345
+ }
3346
+ if (typeof window === "undefined") {
3347
+ return new Proxy({}, {
3348
+ get: () => {
3349
+ return () => console.error(
3350
+ "Window not available, EventBus can not be established!"
3351
+ );
3352
+ }
3353
+ });
3354
+ }
3355
+ if (window.OC?._eventBus && typeof window._nc_event_bus === "undefined") {
3356
+ console.warn(
3357
+ "found old event bus instance at OC._eventBus. Update your version!"
3358
+ );
3359
+ window._nc_event_bus = window.OC._eventBus;
3360
+ }
3361
+ if (typeof window?._nc_event_bus !== "undefined") {
3362
+ bus = new ProxyBus(window._nc_event_bus);
3363
+ } else {
3364
+ bus = window._nc_event_bus = new SimpleBus();
3365
+ }
3366
+ return bus;
3367
+ }
3368
+ function emit(name, event) {
3369
+ getBus().emit(name, event);
3370
+ }
3371
+ /*!
3372
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
3373
+ * SPDX-License-Identifier: AGPL-3.0-or-later
3374
+ */
3375
+ class FileListFilter extends TypedEventTarget {
3376
+ id;
3377
+ order;
3378
+ constructor(id, order = 100) {
3379
+ super();
3380
+ this.id = id;
3381
+ this.order = order;
3382
+ }
3383
+ filter(nodes) {
3384
+ throw new Error("Not implemented");
3385
+ }
3386
+ updateChips(chips) {
3387
+ this.dispatchTypedEvent("update:chips", new CustomEvent("update:chips", { detail: chips }));
3388
+ }
3389
+ filterUpdated() {
3390
+ this.dispatchTypedEvent("update:filter", new CustomEvent("update:filter"));
3391
+ }
3392
+ }
3393
+ function registerFileListFilter(filter) {
3394
+ if (!window._nc_filelist_filters) {
3395
+ window._nc_filelist_filters = /* @__PURE__ */ new Map();
3396
+ }
3397
+ if (window._nc_filelist_filters.has(filter.id)) {
3398
+ throw new Error(`File list filter "${filter.id}" already registered`);
3399
+ }
3400
+ window._nc_filelist_filters.set(filter.id, filter);
3401
+ emit("files:filter:added", filter);
3402
+ }
3403
+ function unregisterFileListFilter(filterId) {
3404
+ if (window._nc_filelist_filters && window._nc_filelist_filters.has(filterId)) {
3405
+ window._nc_filelist_filters.delete(filterId);
3406
+ emit("files:filter:removed", filterId);
3407
+ }
3408
+ }
3409
+ function getFileListFilters() {
3410
+ if (!window._nc_filelist_filters) {
3411
+ return [];
3412
+ }
3413
+ return [...window._nc_filelist_filters.values()];
3414
+ }
2883
3415
  const addNewFileMenuEntry = function(entry) {
2884
3416
  const newFileMenu = getNewFileMenu();
2885
3417
  return newFileMenu.registerEntry(entry);
@@ -2902,6 +3434,7 @@ export {
2902
3434
  DefaultType,
2903
3435
  File,
2904
3436
  FileAction,
3437
+ FileListFilter,
2905
3438
  FileType,
2906
3439
  FilesSortingMode,
2907
3440
  Folder,
@@ -2932,6 +3465,7 @@ export {
2932
3465
  getDavProperties,
2933
3466
  getFavoriteNodes,
2934
3467
  getFileActions,
3468
+ getFileListFilters,
2935
3469
  getFileListHeaders,
2936
3470
  getNavigation,
2937
3471
  getNewFileMenuEntries,
@@ -2941,8 +3475,10 @@ export {
2941
3475
  parseFileSize,
2942
3476
  registerDavProperty,
2943
3477
  registerFileAction,
3478
+ registerFileListFilter,
2944
3479
  registerFileListHeaders,
2945
3480
  removeNewFileMenuEntry,
2946
3481
  sortNodes,
3482
+ unregisterFileListFilter,
2947
3483
  validateFilename
2948
3484
  };