@oktis-works/admin 0.1.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/bin/admin.js +19 -0
- package/dist/client/_astro/ContentEditor.A5N-aCxT.js +1 -0
- package/dist/client/_astro/PostTypesManager.w66_1tDh.js +1 -0
- package/dist/client/_astro/TaxonomiesManager.Dv_OOCEw.js +1 -0
- package/dist/client/_astro/api.GqKwASBH.js +1 -0
- package/dist/client/_astro/client.CCQ0X2AX.js +1 -0
- package/dist/client/_astro/edit.B4LyOiwH.css +1 -0
- package/dist/client/_astro/hoisted.SqllSTyr.js +1 -0
- package/dist/client/_astro/web.D5F0ytYW.js +1 -0
- package/dist/server/_empty-middleware.mjs +3 -0
- package/dist/server/chunks/astro/assets-service_BADPYD54.mjs +438 -0
- package/dist/server/chunks/astro_C5DJOQ1V.mjs +2038 -0
- package/dist/server/chunks/edit_CLlDPSWF.mjs +6 -0
- package/dist/server/chunks/index_By1s_hvq.mjs +6 -0
- package/dist/server/chunks/index_CAPo3ste.mjs +6 -0
- package/dist/server/chunks/login_GjNKFqRH.mjs +6 -0
- package/dist/server/chunks/node_CZILS-L9.mjs +6 -0
- package/dist/server/chunks/pages/edit_DSkfb6lH.mjs +2173 -0
- package/dist/server/chunks/pages/index_7XvpCth_.mjs +61 -0
- package/dist/server/chunks/pages/login_BKgn8hvS.mjs +12 -0
- package/dist/server/chunks/pages/node_CxUkTckt.mjs +268 -0
- package/dist/server/chunks/pages/post-types_BeBr92jW.mjs +246 -0
- package/dist/server/chunks/pages/taxonomies_B0jngTat.mjs +69 -0
- package/dist/server/chunks/post-types_CVELl9a2.mjs +6 -0
- package/dist/server/chunks/taxonomies_D8nuzf2R.mjs +6 -0
- package/dist/server/entry.mjs +9777 -0
- package/dist/server/manifest_BgSBppnI.mjs +455 -0
- package/dist/server/renderers.mjs +101 -0
- package/package.json +43 -0
|
@@ -0,0 +1,2173 @@
|
|
|
1
|
+
import { e as createComponent$1, k as renderComponent, r as renderTemplate, m as maybeRenderHead } from '../astro_C5DJOQ1V.mjs';
|
|
2
|
+
import { $ as $$DashboardLayout } from './index_7XvpCth_.mjs';
|
|
3
|
+
import { ssr, ssrHydrationKey, escape, createComponent, ssrAttribute, memo } from 'solid-js/web';
|
|
4
|
+
import { createSignal, createMemo, Show, For, onMount } from 'solid-js';
|
|
5
|
+
import { a as apiClient } from './post-types_BeBr92jW.mjs';
|
|
6
|
+
/* empty css */
|
|
7
|
+
|
|
8
|
+
function validateFieldClient(_field, _value) {
|
|
9
|
+
return { valid: true, errors: [] };
|
|
10
|
+
}
|
|
11
|
+
function expandCloneFields(fields) {
|
|
12
|
+
return fields;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var re$2 = {exports: {}};
|
|
16
|
+
|
|
17
|
+
// Note: this is the semver.org version of the spec that it implements
|
|
18
|
+
// Not necessarily the package version of this code.
|
|
19
|
+
const SEMVER_SPEC_VERSION = '2.0.0';
|
|
20
|
+
|
|
21
|
+
const MAX_LENGTH$1 = 256;
|
|
22
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
|
|
23
|
+
/* istanbul ignore next */ 9007199254740991;
|
|
24
|
+
|
|
25
|
+
// Max safe segment length for coercion.
|
|
26
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
27
|
+
|
|
28
|
+
// Max safe length for a build identifier. The max length minus 6 characters for
|
|
29
|
+
// the shortest version with a build 0.0.0+BUILD.
|
|
30
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
31
|
+
|
|
32
|
+
const RELEASE_TYPES = [
|
|
33
|
+
'major',
|
|
34
|
+
'premajor',
|
|
35
|
+
'minor',
|
|
36
|
+
'preminor',
|
|
37
|
+
'patch',
|
|
38
|
+
'prepatch',
|
|
39
|
+
'prerelease',
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
var constants$1 = {
|
|
43
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
|
44
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
45
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
46
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
47
|
+
RELEASE_TYPES,
|
|
48
|
+
SEMVER_SPEC_VERSION,
|
|
49
|
+
FLAG_INCLUDE_PRERELEASE: 0b001,
|
|
50
|
+
FLAG_LOOSE: 0b010,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const debug$1 = (
|
|
54
|
+
typeof process === 'object' &&
|
|
55
|
+
process.env &&
|
|
56
|
+
process.env.NODE_DEBUG &&
|
|
57
|
+
/\bsemver\b/i.test(process.env.NODE_DEBUG)
|
|
58
|
+
) ? (...args) => console.error('SEMVER', ...args)
|
|
59
|
+
: () => {};
|
|
60
|
+
|
|
61
|
+
var debug_1 = debug$1;
|
|
62
|
+
|
|
63
|
+
(function (module, exports) {
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
67
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
68
|
+
MAX_LENGTH,
|
|
69
|
+
} = constants$1;
|
|
70
|
+
const debug = debug_1;
|
|
71
|
+
exports = module.exports = {};
|
|
72
|
+
|
|
73
|
+
// The actual regexps go on exports.re
|
|
74
|
+
const re = exports.re = [];
|
|
75
|
+
const safeRe = exports.safeRe = [];
|
|
76
|
+
const src = exports.src = [];
|
|
77
|
+
const safeSrc = exports.safeSrc = [];
|
|
78
|
+
const t = exports.t = {};
|
|
79
|
+
let R = 0;
|
|
80
|
+
|
|
81
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
82
|
+
|
|
83
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
84
|
+
// used internally via the safeRe object since all inputs in this library get
|
|
85
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
|
86
|
+
// regexes are exported for userland consumption and lower level usage. A
|
|
87
|
+
// future breaking change could export the safer regex only with a note that
|
|
88
|
+
// all input should have extra whitespace removed.
|
|
89
|
+
const safeRegexReplacements = [
|
|
90
|
+
['\\s', 1],
|
|
91
|
+
['\\d', MAX_LENGTH],
|
|
92
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const makeSafeRegex = (value) => {
|
|
96
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
97
|
+
value = value
|
|
98
|
+
.split(`${token}*`).join(`${token}{0,${max}}`)
|
|
99
|
+
.split(`${token}+`).join(`${token}{1,${max}}`);
|
|
100
|
+
}
|
|
101
|
+
return value
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const createToken = (name, value, isGlobal) => {
|
|
105
|
+
const safe = makeSafeRegex(value);
|
|
106
|
+
const index = R++;
|
|
107
|
+
debug(name, index, value);
|
|
108
|
+
t[name] = index;
|
|
109
|
+
src[index] = value;
|
|
110
|
+
safeSrc[index] = safe;
|
|
111
|
+
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
112
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// The following Regular Expressions can be used for tokenizing,
|
|
116
|
+
// validating, and parsing SemVer version strings.
|
|
117
|
+
|
|
118
|
+
// ## Numeric Identifier
|
|
119
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
120
|
+
|
|
121
|
+
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
|
122
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
|
123
|
+
|
|
124
|
+
// ## Non-numeric Identifier
|
|
125
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
126
|
+
// more letters, digits, or hyphens.
|
|
127
|
+
|
|
128
|
+
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
129
|
+
|
|
130
|
+
// ## Main Version
|
|
131
|
+
// Three dot-separated numeric identifiers.
|
|
132
|
+
|
|
133
|
+
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
134
|
+
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
135
|
+
`(${src[t.NUMERICIDENTIFIER]})`);
|
|
136
|
+
|
|
137
|
+
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
138
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
139
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
140
|
+
|
|
141
|
+
// ## Pre-release Version Identifier
|
|
142
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
143
|
+
// Non-numeric identifiers include numeric identifiers but can be longer.
|
|
144
|
+
// Therefore non-numeric identifiers must go first.
|
|
145
|
+
|
|
146
|
+
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
147
|
+
}|${src[t.NUMERICIDENTIFIER]})`);
|
|
148
|
+
|
|
149
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
150
|
+
}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
151
|
+
|
|
152
|
+
// ## Pre-release Version
|
|
153
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
154
|
+
// identifiers.
|
|
155
|
+
|
|
156
|
+
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
|
157
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
158
|
+
|
|
159
|
+
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
|
160
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
161
|
+
|
|
162
|
+
// ## Build Metadata Identifier
|
|
163
|
+
// Any combination of digits, letters, or hyphens.
|
|
164
|
+
|
|
165
|
+
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
|
|
166
|
+
|
|
167
|
+
// ## Build Metadata
|
|
168
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
169
|
+
// identifiers.
|
|
170
|
+
|
|
171
|
+
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
|
172
|
+
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
173
|
+
|
|
174
|
+
// ## Full Version String
|
|
175
|
+
// A main version, followed optionally by a pre-release version and
|
|
176
|
+
// build metadata.
|
|
177
|
+
|
|
178
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
179
|
+
// the version string are capturing groups. The build metadata is not a
|
|
180
|
+
// capturing group, because it should not ever be used in version
|
|
181
|
+
// comparison.
|
|
182
|
+
|
|
183
|
+
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
|
184
|
+
}${src[t.PRERELEASE]}?${
|
|
185
|
+
src[t.BUILD]}?`);
|
|
186
|
+
|
|
187
|
+
createToken('FULL', `^${src[t.FULLPLAIN]}$`);
|
|
188
|
+
|
|
189
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
190
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
191
|
+
// common in the npm registry.
|
|
192
|
+
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
|
193
|
+
}${src[t.PRERELEASELOOSE]}?${
|
|
194
|
+
src[t.BUILD]}?`);
|
|
195
|
+
|
|
196
|
+
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
|
|
197
|
+
|
|
198
|
+
createToken('GTLT', '((?:<|>)?=?)');
|
|
199
|
+
|
|
200
|
+
// Something like "2.*" or "1.2.x".
|
|
201
|
+
// Note that "x.x" is a valid xRange identifier, meaning "any version"
|
|
202
|
+
// Only the first item is strictly required.
|
|
203
|
+
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
204
|
+
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
205
|
+
|
|
206
|
+
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
|
207
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
208
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
209
|
+
`(?:${src[t.PRERELEASE]})?${
|
|
210
|
+
src[t.BUILD]}?` +
|
|
211
|
+
`)?)?`);
|
|
212
|
+
|
|
213
|
+
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
214
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
215
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
216
|
+
`(?:${src[t.PRERELEASELOOSE]})?${
|
|
217
|
+
src[t.BUILD]}?` +
|
|
218
|
+
`)?)?`);
|
|
219
|
+
|
|
220
|
+
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
221
|
+
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
222
|
+
|
|
223
|
+
// Coercion.
|
|
224
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
225
|
+
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
|
226
|
+
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
227
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
228
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
229
|
+
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
230
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
|
231
|
+
`(?:${src[t.PRERELEASE]})?` +
|
|
232
|
+
`(?:${src[t.BUILD]})?` +
|
|
233
|
+
`(?:$|[^\\d])`);
|
|
234
|
+
createToken('COERCERTL', src[t.COERCE], true);
|
|
235
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
|
236
|
+
|
|
237
|
+
// Tilde ranges.
|
|
238
|
+
// Meaning is "reasonably at or greater than"
|
|
239
|
+
createToken('LONETILDE', '(?:~>?)');
|
|
240
|
+
|
|
241
|
+
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
242
|
+
exports.tildeTrimReplace = '$1~';
|
|
243
|
+
|
|
244
|
+
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
245
|
+
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
246
|
+
|
|
247
|
+
// Caret ranges.
|
|
248
|
+
// Meaning is "at least and backwards compatible with"
|
|
249
|
+
createToken('LONECARET', '(?:\\^)');
|
|
250
|
+
|
|
251
|
+
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
252
|
+
exports.caretTrimReplace = '$1^';
|
|
253
|
+
|
|
254
|
+
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
255
|
+
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
256
|
+
|
|
257
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
258
|
+
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
259
|
+
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
260
|
+
|
|
261
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
|
262
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
263
|
+
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
264
|
+
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
265
|
+
exports.comparatorTrimReplace = '$1$2$3';
|
|
266
|
+
|
|
267
|
+
// Something like `1.2.3 - 1.2.4`
|
|
268
|
+
// Note that these all use the loose form, because they'll be
|
|
269
|
+
// checked against either the strict or loose comparator form
|
|
270
|
+
// later.
|
|
271
|
+
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
|
272
|
+
`\\s+-\\s+` +
|
|
273
|
+
`(${src[t.XRANGEPLAIN]})` +
|
|
274
|
+
`\\s*$`);
|
|
275
|
+
|
|
276
|
+
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
277
|
+
`\\s+-\\s+` +
|
|
278
|
+
`(${src[t.XRANGEPLAINLOOSE]})` +
|
|
279
|
+
`\\s*$`);
|
|
280
|
+
|
|
281
|
+
// Star ranges basically just allow anything at all.
|
|
282
|
+
createToken('STAR', '(<|>)?=?\\s*\\*');
|
|
283
|
+
// >=0.0.0 is like a star
|
|
284
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
|
285
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
286
|
+
} (re$2, re$2.exports));
|
|
287
|
+
|
|
288
|
+
var reExports = re$2.exports;
|
|
289
|
+
|
|
290
|
+
// parse out just the options we care about
|
|
291
|
+
const looseOption = Object.freeze({ loose: true });
|
|
292
|
+
const emptyOpts = Object.freeze({ });
|
|
293
|
+
const parseOptions$1 = options => {
|
|
294
|
+
if (!options) {
|
|
295
|
+
return emptyOpts
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (typeof options !== 'object') {
|
|
299
|
+
return looseOption
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return options
|
|
303
|
+
};
|
|
304
|
+
var parseOptions_1 = parseOptions$1;
|
|
305
|
+
|
|
306
|
+
const numeric = /^[0-9]+$/;
|
|
307
|
+
const compareIdentifiers$1 = (a, b) => {
|
|
308
|
+
if (typeof a === 'number' && typeof b === 'number') {
|
|
309
|
+
return a === b ? 0 : a < b ? -1 : 1
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const anum = numeric.test(a);
|
|
313
|
+
const bnum = numeric.test(b);
|
|
314
|
+
|
|
315
|
+
if (anum && bnum) {
|
|
316
|
+
a = +a;
|
|
317
|
+
b = +b;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return a === b ? 0
|
|
321
|
+
: (anum && !bnum) ? -1
|
|
322
|
+
: (bnum && !anum) ? 1
|
|
323
|
+
: a < b ? -1
|
|
324
|
+
: 1
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
328
|
+
|
|
329
|
+
var identifiers$1 = {
|
|
330
|
+
compareIdentifiers: compareIdentifiers$1,
|
|
331
|
+
rcompareIdentifiers,
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const debug = debug_1;
|
|
335
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants$1;
|
|
336
|
+
const { safeRe: re$1, t: t$1 } = reExports;
|
|
337
|
+
|
|
338
|
+
const parseOptions = parseOptions_1;
|
|
339
|
+
const { compareIdentifiers } = identifiers$1;
|
|
340
|
+
|
|
341
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
342
|
+
const identifiers = identifier.split('.');
|
|
343
|
+
if (identifiers.length > prerelease.length) {
|
|
344
|
+
return false
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
for (let i = 0; i < identifiers.length; i++) {
|
|
348
|
+
if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
|
|
349
|
+
return false
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return true
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
let SemVer$1 = class SemVer {
|
|
357
|
+
constructor (version, options) {
|
|
358
|
+
options = parseOptions(options);
|
|
359
|
+
|
|
360
|
+
if (version instanceof SemVer) {
|
|
361
|
+
if (version.loose === !!options.loose &&
|
|
362
|
+
version.includePrerelease === !!options.includePrerelease) {
|
|
363
|
+
return version
|
|
364
|
+
} else {
|
|
365
|
+
version = version.version;
|
|
366
|
+
}
|
|
367
|
+
} else if (typeof version !== 'string') {
|
|
368
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (version.length > MAX_LENGTH) {
|
|
372
|
+
throw new TypeError(
|
|
373
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
debug('SemVer', version, options);
|
|
378
|
+
this.options = options;
|
|
379
|
+
this.loose = !!options.loose;
|
|
380
|
+
// this isn't actually relevant for versions, but keep it so that we
|
|
381
|
+
// don't run into trouble passing this.options around.
|
|
382
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
383
|
+
|
|
384
|
+
const m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]);
|
|
385
|
+
|
|
386
|
+
if (!m) {
|
|
387
|
+
throw new TypeError(`Invalid Version: ${version}`)
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
this.raw = version;
|
|
391
|
+
|
|
392
|
+
// these are actually numbers
|
|
393
|
+
this.major = +m[1];
|
|
394
|
+
this.minor = +m[2];
|
|
395
|
+
this.patch = +m[3];
|
|
396
|
+
|
|
397
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
398
|
+
throw new TypeError('Invalid major version')
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
402
|
+
throw new TypeError('Invalid minor version')
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
406
|
+
throw new TypeError('Invalid patch version')
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// numberify any prerelease numeric ids
|
|
410
|
+
if (!m[4]) {
|
|
411
|
+
this.prerelease = [];
|
|
412
|
+
} else {
|
|
413
|
+
this.prerelease = m[4].split('.').map((id) => {
|
|
414
|
+
if (/^[0-9]+$/.test(id)) {
|
|
415
|
+
const num = +id;
|
|
416
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
417
|
+
return num
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return id
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
this.build = m[5] ? m[5].split('.') : [];
|
|
425
|
+
this.format();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
format () {
|
|
429
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
430
|
+
if (this.prerelease.length) {
|
|
431
|
+
this.version += `-${this.prerelease.join('.')}`;
|
|
432
|
+
}
|
|
433
|
+
return this.version
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
toString () {
|
|
437
|
+
return this.version
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
compare (other) {
|
|
441
|
+
debug('SemVer.compare', this.version, this.options, other);
|
|
442
|
+
if (!(other instanceof SemVer)) {
|
|
443
|
+
if (typeof other === 'string' && other === this.version) {
|
|
444
|
+
return 0
|
|
445
|
+
}
|
|
446
|
+
other = new SemVer(other, this.options);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (other.version === this.version) {
|
|
450
|
+
return 0
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return this.compareMain(other) || this.comparePre(other)
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
compareMain (other) {
|
|
457
|
+
if (!(other instanceof SemVer)) {
|
|
458
|
+
other = new SemVer(other, this.options);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (this.major < other.major) {
|
|
462
|
+
return -1
|
|
463
|
+
}
|
|
464
|
+
if (this.major > other.major) {
|
|
465
|
+
return 1
|
|
466
|
+
}
|
|
467
|
+
if (this.minor < other.minor) {
|
|
468
|
+
return -1
|
|
469
|
+
}
|
|
470
|
+
if (this.minor > other.minor) {
|
|
471
|
+
return 1
|
|
472
|
+
}
|
|
473
|
+
if (this.patch < other.patch) {
|
|
474
|
+
return -1
|
|
475
|
+
}
|
|
476
|
+
if (this.patch > other.patch) {
|
|
477
|
+
return 1
|
|
478
|
+
}
|
|
479
|
+
return 0
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
comparePre (other) {
|
|
483
|
+
if (!(other instanceof SemVer)) {
|
|
484
|
+
other = new SemVer(other, this.options);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// NOT having a prerelease is > having one
|
|
488
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
489
|
+
return -1
|
|
490
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
491
|
+
return 1
|
|
492
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
493
|
+
return 0
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
let i = 0;
|
|
497
|
+
do {
|
|
498
|
+
const a = this.prerelease[i];
|
|
499
|
+
const b = other.prerelease[i];
|
|
500
|
+
debug('prerelease compare', i, a, b);
|
|
501
|
+
if (a === undefined && b === undefined) {
|
|
502
|
+
return 0
|
|
503
|
+
} else if (b === undefined) {
|
|
504
|
+
return 1
|
|
505
|
+
} else if (a === undefined) {
|
|
506
|
+
return -1
|
|
507
|
+
} else if (a === b) {
|
|
508
|
+
continue
|
|
509
|
+
} else {
|
|
510
|
+
return compareIdentifiers(a, b)
|
|
511
|
+
}
|
|
512
|
+
} while (++i)
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
compareBuild (other) {
|
|
516
|
+
if (!(other instanceof SemVer)) {
|
|
517
|
+
other = new SemVer(other, this.options);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
let i = 0;
|
|
521
|
+
do {
|
|
522
|
+
const a = this.build[i];
|
|
523
|
+
const b = other.build[i];
|
|
524
|
+
debug('build compare', i, a, b);
|
|
525
|
+
if (a === undefined && b === undefined) {
|
|
526
|
+
return 0
|
|
527
|
+
} else if (b === undefined) {
|
|
528
|
+
return 1
|
|
529
|
+
} else if (a === undefined) {
|
|
530
|
+
return -1
|
|
531
|
+
} else if (a === b) {
|
|
532
|
+
continue
|
|
533
|
+
} else {
|
|
534
|
+
return compareIdentifiers(a, b)
|
|
535
|
+
}
|
|
536
|
+
} while (++i)
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
540
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
541
|
+
inc (release, identifier, identifierBase) {
|
|
542
|
+
if (release.startsWith('pre')) {
|
|
543
|
+
if (!identifier && identifierBase === false) {
|
|
544
|
+
throw new Error('invalid increment argument: identifier is empty')
|
|
545
|
+
}
|
|
546
|
+
// Avoid an invalid semver results
|
|
547
|
+
if (identifier) {
|
|
548
|
+
const match = `-${identifier}`.match(this.options.loose ? re$1[t$1.PRERELEASELOOSE] : re$1[t$1.PRERELEASE]);
|
|
549
|
+
if (!match || match[1] !== identifier) {
|
|
550
|
+
throw new Error(`invalid identifier: ${identifier}`)
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
switch (release) {
|
|
556
|
+
case 'premajor':
|
|
557
|
+
this.prerelease.length = 0;
|
|
558
|
+
this.patch = 0;
|
|
559
|
+
this.minor = 0;
|
|
560
|
+
this.major++;
|
|
561
|
+
this.inc('pre', identifier, identifierBase);
|
|
562
|
+
break
|
|
563
|
+
case 'preminor':
|
|
564
|
+
this.prerelease.length = 0;
|
|
565
|
+
this.patch = 0;
|
|
566
|
+
this.minor++;
|
|
567
|
+
this.inc('pre', identifier, identifierBase);
|
|
568
|
+
break
|
|
569
|
+
case 'prepatch':
|
|
570
|
+
// If this is already a prerelease, it will bump to the next version
|
|
571
|
+
// drop any prereleases that might already exist, since they are not
|
|
572
|
+
// relevant at this point.
|
|
573
|
+
this.prerelease.length = 0;
|
|
574
|
+
this.inc('patch', identifier, identifierBase);
|
|
575
|
+
this.inc('pre', identifier, identifierBase);
|
|
576
|
+
break
|
|
577
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
578
|
+
// prepatch.
|
|
579
|
+
case 'prerelease':
|
|
580
|
+
if (this.prerelease.length === 0) {
|
|
581
|
+
this.inc('patch', identifier, identifierBase);
|
|
582
|
+
}
|
|
583
|
+
this.inc('pre', identifier, identifierBase);
|
|
584
|
+
break
|
|
585
|
+
case 'release':
|
|
586
|
+
if (this.prerelease.length === 0) {
|
|
587
|
+
throw new Error(`version ${this.raw} is not a prerelease`)
|
|
588
|
+
}
|
|
589
|
+
this.prerelease.length = 0;
|
|
590
|
+
break
|
|
591
|
+
|
|
592
|
+
case 'major':
|
|
593
|
+
// If this is a pre-major version, bump up to the same major version.
|
|
594
|
+
// Otherwise increment major.
|
|
595
|
+
// 1.0.0-5 bumps to 1.0.0
|
|
596
|
+
// 1.1.0 bumps to 2.0.0
|
|
597
|
+
if (
|
|
598
|
+
this.minor !== 0 ||
|
|
599
|
+
this.patch !== 0 ||
|
|
600
|
+
this.prerelease.length === 0
|
|
601
|
+
) {
|
|
602
|
+
this.major++;
|
|
603
|
+
}
|
|
604
|
+
this.minor = 0;
|
|
605
|
+
this.patch = 0;
|
|
606
|
+
this.prerelease = [];
|
|
607
|
+
break
|
|
608
|
+
case 'minor':
|
|
609
|
+
// If this is a pre-minor version, bump up to the same minor version.
|
|
610
|
+
// Otherwise increment minor.
|
|
611
|
+
// 1.2.0-5 bumps to 1.2.0
|
|
612
|
+
// 1.2.1 bumps to 1.3.0
|
|
613
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
614
|
+
this.minor++;
|
|
615
|
+
}
|
|
616
|
+
this.patch = 0;
|
|
617
|
+
this.prerelease = [];
|
|
618
|
+
break
|
|
619
|
+
case 'patch':
|
|
620
|
+
// If this is not a pre-release version, it will increment the patch.
|
|
621
|
+
// If it is a pre-release it will bump up to the same patch version.
|
|
622
|
+
// 1.2.0-5 patches to 1.2.0
|
|
623
|
+
// 1.2.0 patches to 1.2.1
|
|
624
|
+
if (this.prerelease.length === 0) {
|
|
625
|
+
this.patch++;
|
|
626
|
+
}
|
|
627
|
+
this.prerelease = [];
|
|
628
|
+
break
|
|
629
|
+
// This probably shouldn't be used publicly.
|
|
630
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
631
|
+
case 'pre': {
|
|
632
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
633
|
+
|
|
634
|
+
if (this.prerelease.length === 0) {
|
|
635
|
+
this.prerelease = [base];
|
|
636
|
+
} else {
|
|
637
|
+
let i = this.prerelease.length;
|
|
638
|
+
while (--i >= 0) {
|
|
639
|
+
if (typeof this.prerelease[i] === 'number') {
|
|
640
|
+
this.prerelease[i]++;
|
|
641
|
+
i = -2;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (i === -1) {
|
|
645
|
+
// didn't increment anything
|
|
646
|
+
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
|
647
|
+
throw new Error('invalid increment argument: identifier already exists')
|
|
648
|
+
}
|
|
649
|
+
this.prerelease.push(base);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (identifier) {
|
|
653
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
654
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
655
|
+
let prerelease = [identifier, base];
|
|
656
|
+
if (identifierBase === false) {
|
|
657
|
+
prerelease = [identifier];
|
|
658
|
+
}
|
|
659
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
660
|
+
const prereleaseBase = this.prerelease[identifier.split('.').length];
|
|
661
|
+
if (isNaN(prereleaseBase)) {
|
|
662
|
+
this.prerelease = prerelease;
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
this.prerelease = prerelease;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
break
|
|
669
|
+
}
|
|
670
|
+
default:
|
|
671
|
+
throw new Error(`invalid increment argument: ${release}`)
|
|
672
|
+
}
|
|
673
|
+
this.raw = this.format();
|
|
674
|
+
if (this.build.length) {
|
|
675
|
+
this.raw += `+${this.build.join('.')}`;
|
|
676
|
+
}
|
|
677
|
+
return this
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
var semver = SemVer$1;
|
|
682
|
+
|
|
683
|
+
const SemVer = semver;
|
|
684
|
+
const compare$6 = (a, b, loose) =>
|
|
685
|
+
new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
686
|
+
|
|
687
|
+
var compare_1 = compare$6;
|
|
688
|
+
|
|
689
|
+
const compare$5 = compare_1;
|
|
690
|
+
const gt$1 = (a, b, loose) => compare$5(a, b, loose) > 0;
|
|
691
|
+
var gt_1 = gt$1;
|
|
692
|
+
|
|
693
|
+
const compare$4 = compare_1;
|
|
694
|
+
const lt$1 = (a, b, loose) => compare$4(a, b, loose) < 0;
|
|
695
|
+
var lt_1 = lt$1;
|
|
696
|
+
|
|
697
|
+
const compare$3 = compare_1;
|
|
698
|
+
const eq$1 = (a, b, loose) => compare$3(a, b, loose) === 0;
|
|
699
|
+
var eq_1 = eq$1;
|
|
700
|
+
|
|
701
|
+
const compare$2 = compare_1;
|
|
702
|
+
const neq$1 = (a, b, loose) => compare$2(a, b, loose) !== 0;
|
|
703
|
+
var neq_1 = neq$1;
|
|
704
|
+
|
|
705
|
+
const compare$1 = compare_1;
|
|
706
|
+
const gte$1 = (a, b, loose) => compare$1(a, b, loose) >= 0;
|
|
707
|
+
var gte_1 = gte$1;
|
|
708
|
+
|
|
709
|
+
const compare = compare_1;
|
|
710
|
+
const lte$1 = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
711
|
+
var lte_1 = lte$1;
|
|
712
|
+
|
|
713
|
+
const eq = eq_1;
|
|
714
|
+
const neq = neq_1;
|
|
715
|
+
const gt = gt_1;
|
|
716
|
+
const gte = gte_1;
|
|
717
|
+
const lt = lt_1;
|
|
718
|
+
const lte = lte_1;
|
|
719
|
+
|
|
720
|
+
const cmp = (a, op, b, loose) => {
|
|
721
|
+
switch (op) {
|
|
722
|
+
case '===':
|
|
723
|
+
if (typeof a === 'object') {
|
|
724
|
+
a = a.version;
|
|
725
|
+
}
|
|
726
|
+
if (typeof b === 'object') {
|
|
727
|
+
b = b.version;
|
|
728
|
+
}
|
|
729
|
+
return a === b
|
|
730
|
+
|
|
731
|
+
case '!==':
|
|
732
|
+
if (typeof a === 'object') {
|
|
733
|
+
a = a.version;
|
|
734
|
+
}
|
|
735
|
+
if (typeof b === 'object') {
|
|
736
|
+
b = b.version;
|
|
737
|
+
}
|
|
738
|
+
return a !== b
|
|
739
|
+
|
|
740
|
+
case '':
|
|
741
|
+
case '=':
|
|
742
|
+
case '==':
|
|
743
|
+
return eq(a, b, loose)
|
|
744
|
+
|
|
745
|
+
case '!=':
|
|
746
|
+
return neq(a, b, loose)
|
|
747
|
+
|
|
748
|
+
case '>':
|
|
749
|
+
return gt(a, b, loose)
|
|
750
|
+
|
|
751
|
+
case '>=':
|
|
752
|
+
return gte(a, b, loose)
|
|
753
|
+
|
|
754
|
+
case '<':
|
|
755
|
+
return lt(a, b, loose)
|
|
756
|
+
|
|
757
|
+
case '<=':
|
|
758
|
+
return lte(a, b, loose)
|
|
759
|
+
|
|
760
|
+
default:
|
|
761
|
+
throw new TypeError(`Invalid operator: ${op}`)
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
var cmp_1 = cmp;
|
|
765
|
+
|
|
766
|
+
const { safeRe: re, t } = reExports;
|
|
767
|
+
|
|
768
|
+
class LRUCache {
|
|
769
|
+
constructor () {
|
|
770
|
+
this.max = 1000;
|
|
771
|
+
this.map = new Map();
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
get (key) {
|
|
775
|
+
const value = this.map.get(key);
|
|
776
|
+
if (value === undefined) {
|
|
777
|
+
return undefined
|
|
778
|
+
} else {
|
|
779
|
+
// Remove the key from the map and add it to the end
|
|
780
|
+
this.map.delete(key);
|
|
781
|
+
this.map.set(key, value);
|
|
782
|
+
return value
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
delete (key) {
|
|
787
|
+
return this.map.delete(key)
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
set (key, value) {
|
|
791
|
+
const deleted = this.delete(key);
|
|
792
|
+
|
|
793
|
+
if (!deleted && value !== undefined) {
|
|
794
|
+
// If cache is full, delete the least recently used item
|
|
795
|
+
if (this.map.size >= this.max) {
|
|
796
|
+
const firstKey = this.map.keys().next().value;
|
|
797
|
+
this.delete(firstKey);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
this.map.set(key, value);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
return this
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
var lrucache = LRUCache;
|
|
808
|
+
|
|
809
|
+
var range;
|
|
810
|
+
var hasRequiredRange;
|
|
811
|
+
|
|
812
|
+
function requireRange () {
|
|
813
|
+
if (hasRequiredRange) return range;
|
|
814
|
+
hasRequiredRange = 1;
|
|
815
|
+
|
|
816
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
817
|
+
|
|
818
|
+
// hoisted class for cyclic dependency
|
|
819
|
+
class Range {
|
|
820
|
+
constructor (range, options) {
|
|
821
|
+
options = parseOptions(options);
|
|
822
|
+
|
|
823
|
+
if (range instanceof Range) {
|
|
824
|
+
if (
|
|
825
|
+
range.loose === !!options.loose &&
|
|
826
|
+
range.includePrerelease === !!options.includePrerelease
|
|
827
|
+
) {
|
|
828
|
+
return range
|
|
829
|
+
} else {
|
|
830
|
+
return new Range(range.raw, options)
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (range instanceof Comparator) {
|
|
835
|
+
// just put it in the set and return
|
|
836
|
+
this.raw = range.value;
|
|
837
|
+
this.set = [[range]];
|
|
838
|
+
this.formatted = undefined;
|
|
839
|
+
return this
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
this.options = options;
|
|
843
|
+
this.loose = !!options.loose;
|
|
844
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
845
|
+
|
|
846
|
+
// First reduce all whitespace as much as possible so we do not have to rely
|
|
847
|
+
// on potentially slow regexes like \s*. This is then stored and used for
|
|
848
|
+
// future error messages as well.
|
|
849
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
|
|
850
|
+
|
|
851
|
+
// First, split on ||
|
|
852
|
+
this.set = this.raw
|
|
853
|
+
.split('||')
|
|
854
|
+
// map the range to a 2d array of comparators
|
|
855
|
+
.map(r => this.parseRange(r.trim()))
|
|
856
|
+
// throw out any comparator lists that are empty
|
|
857
|
+
// this generally means that it was not a valid range, which is allowed
|
|
858
|
+
// in loose mode, but will still throw if the WHOLE range is invalid.
|
|
859
|
+
.filter(c => c.length);
|
|
860
|
+
|
|
861
|
+
if (!this.set.length) {
|
|
862
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// if we have any that are not the null set, throw out null sets.
|
|
866
|
+
if (this.set.length > 1) {
|
|
867
|
+
// keep the first one, in case they're all null sets
|
|
868
|
+
const first = this.set[0];
|
|
869
|
+
this.set = this.set.filter(c => !isNullSet(c[0]));
|
|
870
|
+
if (this.set.length === 0) {
|
|
871
|
+
this.set = [first];
|
|
872
|
+
} else if (this.set.length > 1) {
|
|
873
|
+
// if we have any that are *, then the range is just *
|
|
874
|
+
for (const c of this.set) {
|
|
875
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
876
|
+
this.set = [c];
|
|
877
|
+
break
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
this.formatted = undefined;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
get range () {
|
|
887
|
+
if (this.formatted === undefined) {
|
|
888
|
+
this.formatted = '';
|
|
889
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
890
|
+
if (i > 0) {
|
|
891
|
+
this.formatted += '||';
|
|
892
|
+
}
|
|
893
|
+
const comps = this.set[i];
|
|
894
|
+
for (let k = 0; k < comps.length; k++) {
|
|
895
|
+
if (k > 0) {
|
|
896
|
+
this.formatted += ' ';
|
|
897
|
+
}
|
|
898
|
+
this.formatted += comps[k].toString().trim();
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
return this.formatted
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
format () {
|
|
906
|
+
return this.range
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
toString () {
|
|
910
|
+
return this.range
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
parseRange (range) {
|
|
914
|
+
// strip build metadata so it can't bleed into the version
|
|
915
|
+
range = range.replace(BUILDSTRIPRE, '');
|
|
916
|
+
|
|
917
|
+
// memoize range parsing for performance.
|
|
918
|
+
// this is a very hot path, and fully deterministic.
|
|
919
|
+
const memoOpts =
|
|
920
|
+
(this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
|
|
921
|
+
(this.options.loose && FLAG_LOOSE);
|
|
922
|
+
const memoKey = memoOpts + ':' + range;
|
|
923
|
+
const cached = cache.get(memoKey);
|
|
924
|
+
if (cached) {
|
|
925
|
+
return cached
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
const loose = this.options.loose;
|
|
929
|
+
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
930
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
931
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
932
|
+
debug('hyphen replace', range);
|
|
933
|
+
|
|
934
|
+
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
935
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
936
|
+
debug('comparator trim', range);
|
|
937
|
+
|
|
938
|
+
// `~ 1.2.3` => `~1.2.3`
|
|
939
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
940
|
+
debug('tilde trim', range);
|
|
941
|
+
|
|
942
|
+
// `^ 1.2.3` => `^1.2.3`
|
|
943
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
944
|
+
debug('caret trim', range);
|
|
945
|
+
|
|
946
|
+
// At this point, the range is completely trimmed and
|
|
947
|
+
// ready to be split into comparators.
|
|
948
|
+
|
|
949
|
+
let rangeList = range
|
|
950
|
+
.split(' ')
|
|
951
|
+
.map(comp => parseComparator(comp, this.options))
|
|
952
|
+
.join(' ')
|
|
953
|
+
.split(/\s+/)
|
|
954
|
+
// >=0.0.0 is equivalent to *
|
|
955
|
+
.map(comp => replaceGTE0(comp, this.options));
|
|
956
|
+
|
|
957
|
+
if (loose) {
|
|
958
|
+
// in loose mode, throw out any that are not valid comparators
|
|
959
|
+
rangeList = rangeList.filter(comp => {
|
|
960
|
+
debug('loose invalid filter', comp, this.options);
|
|
961
|
+
return !!comp.match(re[t.COMPARATORLOOSE])
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
debug('range list', rangeList);
|
|
965
|
+
|
|
966
|
+
// if any comparators are the null set, then replace with JUST null set
|
|
967
|
+
// if more than one comparator, remove any * comparators
|
|
968
|
+
// also, don't include the same comparator more than once
|
|
969
|
+
const rangeMap = new Map();
|
|
970
|
+
const comparators = rangeList.map(comp => new Comparator(comp, this.options));
|
|
971
|
+
for (const comp of comparators) {
|
|
972
|
+
if (isNullSet(comp)) {
|
|
973
|
+
return [comp]
|
|
974
|
+
}
|
|
975
|
+
rangeMap.set(comp.value, comp);
|
|
976
|
+
}
|
|
977
|
+
if (rangeMap.size > 1 && rangeMap.has('')) {
|
|
978
|
+
rangeMap.delete('');
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const result = [...rangeMap.values()];
|
|
982
|
+
cache.set(memoKey, result);
|
|
983
|
+
return result
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
intersects (range, options) {
|
|
987
|
+
if (!(range instanceof Range)) {
|
|
988
|
+
throw new TypeError('a Range is required')
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return this.set.some((thisComparators) => {
|
|
992
|
+
return (
|
|
993
|
+
isSatisfiable(thisComparators, options) &&
|
|
994
|
+
range.set.some((rangeComparators) => {
|
|
995
|
+
return (
|
|
996
|
+
isSatisfiable(rangeComparators, options) &&
|
|
997
|
+
thisComparators.every((thisComparator) => {
|
|
998
|
+
return rangeComparators.every((rangeComparator) => {
|
|
999
|
+
return thisComparator.intersects(rangeComparator, options)
|
|
1000
|
+
})
|
|
1001
|
+
})
|
|
1002
|
+
)
|
|
1003
|
+
})
|
|
1004
|
+
)
|
|
1005
|
+
})
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
1009
|
+
test (version) {
|
|
1010
|
+
if (!version) {
|
|
1011
|
+
return false
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
if (typeof version === 'string') {
|
|
1015
|
+
try {
|
|
1016
|
+
version = new SemVer(version, this.options);
|
|
1017
|
+
} catch (er) {
|
|
1018
|
+
return false
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1023
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
1024
|
+
return true
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return false
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
range = Range;
|
|
1032
|
+
|
|
1033
|
+
const LRU = lrucache;
|
|
1034
|
+
const cache = new LRU();
|
|
1035
|
+
|
|
1036
|
+
const parseOptions = parseOptions_1;
|
|
1037
|
+
const Comparator = requireComparator();
|
|
1038
|
+
const debug = debug_1;
|
|
1039
|
+
const SemVer = semver;
|
|
1040
|
+
const {
|
|
1041
|
+
safeRe: re,
|
|
1042
|
+
src,
|
|
1043
|
+
t,
|
|
1044
|
+
comparatorTrimReplace,
|
|
1045
|
+
tildeTrimReplace,
|
|
1046
|
+
caretTrimReplace,
|
|
1047
|
+
} = reExports;
|
|
1048
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = constants$1;
|
|
1049
|
+
|
|
1050
|
+
// unbounded global build-metadata stripper used by parseRange
|
|
1051
|
+
const BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g');
|
|
1052
|
+
|
|
1053
|
+
const isNullSet = c => c.value === '<0.0.0-0';
|
|
1054
|
+
const isAny = c => c.value === '';
|
|
1055
|
+
|
|
1056
|
+
// take a set of comparators and determine whether there
|
|
1057
|
+
// exists a version which can satisfy it
|
|
1058
|
+
const isSatisfiable = (comparators, options) => {
|
|
1059
|
+
let result = true;
|
|
1060
|
+
const remainingComparators = comparators.slice();
|
|
1061
|
+
let testComparator = remainingComparators.pop();
|
|
1062
|
+
|
|
1063
|
+
while (result && remainingComparators.length) {
|
|
1064
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1065
|
+
return testComparator.intersects(otherComparator, options)
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
testComparator = remainingComparators.pop();
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
return result
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
1075
|
+
// already replaced the hyphen ranges
|
|
1076
|
+
// turn into a set of JUST comparators.
|
|
1077
|
+
const parseComparator = (comp, options) => {
|
|
1078
|
+
comp = comp.replace(re[t.BUILD], '');
|
|
1079
|
+
debug('comp', comp, options);
|
|
1080
|
+
comp = replaceCarets(comp, options);
|
|
1081
|
+
debug('caret', comp);
|
|
1082
|
+
comp = replaceTildes(comp, options);
|
|
1083
|
+
debug('tildes', comp);
|
|
1084
|
+
comp = replaceXRanges(comp, options);
|
|
1085
|
+
debug('xrange', comp);
|
|
1086
|
+
comp = replaceStars(comp, options);
|
|
1087
|
+
debug('stars', comp);
|
|
1088
|
+
return comp
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
|
|
1092
|
+
|
|
1093
|
+
const invalidXRangeOrder = (M, m, p) => (
|
|
1094
|
+
(isX(M) && !isX(m)) ||
|
|
1095
|
+
(isX(m) && p && !isX(p))
|
|
1096
|
+
);
|
|
1097
|
+
|
|
1098
|
+
// ~, ~> --> * (any, kinda silly)
|
|
1099
|
+
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
|
1100
|
+
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
|
1101
|
+
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
|
1102
|
+
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
|
1103
|
+
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
|
1104
|
+
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
|
1105
|
+
const replaceTildes = (comp, options) => {
|
|
1106
|
+
return comp
|
|
1107
|
+
.trim()
|
|
1108
|
+
.split(/\s+/)
|
|
1109
|
+
.map((c) => replaceTilde(c, options))
|
|
1110
|
+
.join(' ')
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
const replaceTilde = (comp, options) => {
|
|
1114
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1115
|
+
// if we're including prereleases in the match, then the lower bound is
|
|
1116
|
+
// -0, the lowest possible prerelease value, just like x-ranges and carets.
|
|
1117
|
+
// this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.
|
|
1118
|
+
const z = options.includePrerelease ? '-0' : '';
|
|
1119
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1120
|
+
debug('tilde', comp, _, M, m, p, pr);
|
|
1121
|
+
let ret;
|
|
1122
|
+
|
|
1123
|
+
if (isX(M)) {
|
|
1124
|
+
ret = '';
|
|
1125
|
+
} else if (isX(m)) {
|
|
1126
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1127
|
+
} else if (isX(p)) {
|
|
1128
|
+
// ~1.2 == >=1.2.0 <1.3.0-0
|
|
1129
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1130
|
+
} else if (pr) {
|
|
1131
|
+
debug('replaceTilde pr', pr);
|
|
1132
|
+
ret = `>=${M}.${m}.${p}-${pr
|
|
1133
|
+
} <${M}.${+m + 1}.0-0`;
|
|
1134
|
+
} else {
|
|
1135
|
+
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
|
1136
|
+
ret = `>=${M}.${m}.${p
|
|
1137
|
+
} <${M}.${+m + 1}.0-0`;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
debug('tilde return', ret);
|
|
1141
|
+
return ret
|
|
1142
|
+
})
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
// ^ --> * (any, kinda silly)
|
|
1146
|
+
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
|
1147
|
+
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
|
1148
|
+
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
|
1149
|
+
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
1150
|
+
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
1151
|
+
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
|
1152
|
+
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
|
1153
|
+
const replaceCarets = (comp, options) => {
|
|
1154
|
+
return comp
|
|
1155
|
+
.trim()
|
|
1156
|
+
.split(/\s+/)
|
|
1157
|
+
.map((c) => replaceCaret(c, options))
|
|
1158
|
+
.join(' ')
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
const replaceCaret = (comp, options) => {
|
|
1162
|
+
debug('caret', comp, options);
|
|
1163
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1164
|
+
const z = options.includePrerelease ? '-0' : '';
|
|
1165
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1166
|
+
debug('caret', comp, _, M, m, p, pr);
|
|
1167
|
+
let ret;
|
|
1168
|
+
|
|
1169
|
+
if (isX(M)) {
|
|
1170
|
+
ret = '';
|
|
1171
|
+
} else if (isX(m)) {
|
|
1172
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1173
|
+
} else if (isX(p)) {
|
|
1174
|
+
if (M === '0') {
|
|
1175
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1176
|
+
} else {
|
|
1177
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1178
|
+
}
|
|
1179
|
+
} else if (pr) {
|
|
1180
|
+
debug('replaceCaret pr', pr);
|
|
1181
|
+
if (M === '0') {
|
|
1182
|
+
if (m === '0') {
|
|
1183
|
+
ret = `>=${M}.${m}.${p}-${pr
|
|
1184
|
+
} <${M}.${m}.${+p + 1}-0`;
|
|
1185
|
+
} else {
|
|
1186
|
+
ret = `>=${M}.${m}.${p}-${pr
|
|
1187
|
+
} <${M}.${+m + 1}.0-0`;
|
|
1188
|
+
}
|
|
1189
|
+
} else {
|
|
1190
|
+
ret = `>=${M}.${m}.${p}-${pr
|
|
1191
|
+
} <${+M + 1}.0.0-0`;
|
|
1192
|
+
}
|
|
1193
|
+
} else {
|
|
1194
|
+
debug('no pr');
|
|
1195
|
+
if (M === '0') {
|
|
1196
|
+
if (m === '0') {
|
|
1197
|
+
ret = `>=${M}.${m}.${p
|
|
1198
|
+
} <${M}.${m}.${+p + 1}-0`;
|
|
1199
|
+
} else {
|
|
1200
|
+
ret = `>=${M}.${m}.${p
|
|
1201
|
+
} <${M}.${+m + 1}.0-0`;
|
|
1202
|
+
}
|
|
1203
|
+
} else {
|
|
1204
|
+
ret = `>=${M}.${m}.${p
|
|
1205
|
+
} <${+M + 1}.0.0-0`;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
debug('caret return', ret);
|
|
1210
|
+
return ret
|
|
1211
|
+
})
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
const replaceXRanges = (comp, options) => {
|
|
1215
|
+
debug('replaceXRanges', comp, options);
|
|
1216
|
+
return comp
|
|
1217
|
+
.split(/\s+/)
|
|
1218
|
+
.map((c) => replaceXRange(c, options))
|
|
1219
|
+
.join(' ')
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
const replaceXRange = (comp, options) => {
|
|
1223
|
+
comp = comp.trim();
|
|
1224
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1225
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1226
|
+
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
1227
|
+
if (invalidXRangeOrder(M, m, p)) {
|
|
1228
|
+
return comp
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
const xM = isX(M);
|
|
1232
|
+
const xm = xM || isX(m);
|
|
1233
|
+
const xp = xm || isX(p);
|
|
1234
|
+
const anyX = xp;
|
|
1235
|
+
|
|
1236
|
+
if (gtlt === '=' && anyX) {
|
|
1237
|
+
gtlt = '';
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
// if we're including prereleases in the match, then we need
|
|
1241
|
+
// to fix this to -0, the lowest possible prerelease value
|
|
1242
|
+
pr = options.includePrerelease ? '-0' : '';
|
|
1243
|
+
|
|
1244
|
+
if (xM) {
|
|
1245
|
+
if (gtlt === '>' || gtlt === '<') {
|
|
1246
|
+
// nothing is allowed
|
|
1247
|
+
ret = '<0.0.0-0';
|
|
1248
|
+
} else {
|
|
1249
|
+
// nothing is forbidden
|
|
1250
|
+
ret = '*';
|
|
1251
|
+
}
|
|
1252
|
+
} else if (gtlt && anyX) {
|
|
1253
|
+
// we know patch is an x, because we have any x at all.
|
|
1254
|
+
// replace X with 0
|
|
1255
|
+
if (xm) {
|
|
1256
|
+
m = 0;
|
|
1257
|
+
}
|
|
1258
|
+
p = 0;
|
|
1259
|
+
|
|
1260
|
+
if (gtlt === '>') {
|
|
1261
|
+
// >1 => >=2.0.0
|
|
1262
|
+
// >1.2 => >=1.3.0
|
|
1263
|
+
gtlt = '>=';
|
|
1264
|
+
if (xm) {
|
|
1265
|
+
M = +M + 1;
|
|
1266
|
+
m = 0;
|
|
1267
|
+
p = 0;
|
|
1268
|
+
} else {
|
|
1269
|
+
m = +m + 1;
|
|
1270
|
+
p = 0;
|
|
1271
|
+
}
|
|
1272
|
+
} else if (gtlt === '<=') {
|
|
1273
|
+
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
1274
|
+
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
1275
|
+
gtlt = '<';
|
|
1276
|
+
if (xm) {
|
|
1277
|
+
M = +M + 1;
|
|
1278
|
+
} else {
|
|
1279
|
+
m = +m + 1;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
if (gtlt === '<') {
|
|
1284
|
+
pr = '-0';
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1288
|
+
} else if (xm) {
|
|
1289
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1290
|
+
} else if (xp) {
|
|
1291
|
+
ret = `>=${M}.${m}.0${pr
|
|
1292
|
+
} <${M}.${+m + 1}.0-0`;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
debug('xRange return', ret);
|
|
1296
|
+
|
|
1297
|
+
return ret
|
|
1298
|
+
})
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
// Because * is AND-ed with everything else in the comparator,
|
|
1302
|
+
// and '' means "any version", just remove the *s entirely.
|
|
1303
|
+
const replaceStars = (comp, options) => {
|
|
1304
|
+
debug('replaceStars', comp, options);
|
|
1305
|
+
// Looseness is ignored here. star is always as loose as it gets!
|
|
1306
|
+
return comp
|
|
1307
|
+
.trim()
|
|
1308
|
+
.replace(re[t.STAR], '')
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
const replaceGTE0 = (comp, options) => {
|
|
1312
|
+
debug('replaceGTE0', comp, options);
|
|
1313
|
+
return comp
|
|
1314
|
+
.trim()
|
|
1315
|
+
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
1319
|
+
// M, m, patch, prerelease, build
|
|
1320
|
+
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
1321
|
+
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
|
1322
|
+
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
|
1323
|
+
// TODO build?
|
|
1324
|
+
const hyphenReplace = incPr => ($0,
|
|
1325
|
+
from, fM, fm, fp, fpr, fb,
|
|
1326
|
+
to, tM, tm, tp, tpr) => {
|
|
1327
|
+
if (isX(fM)) {
|
|
1328
|
+
from = '';
|
|
1329
|
+
} else if (isX(fm)) {
|
|
1330
|
+
from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
|
|
1331
|
+
} else if (isX(fp)) {
|
|
1332
|
+
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
|
|
1333
|
+
} else if (fpr) {
|
|
1334
|
+
from = `>=${from}`;
|
|
1335
|
+
} else {
|
|
1336
|
+
from = `>=${from}${incPr ? '-0' : ''}`;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
if (isX(tM)) {
|
|
1340
|
+
to = '';
|
|
1341
|
+
} else if (isX(tm)) {
|
|
1342
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
1343
|
+
} else if (isX(tp)) {
|
|
1344
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1345
|
+
} else if (tpr) {
|
|
1346
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1347
|
+
} else if (incPr) {
|
|
1348
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1349
|
+
} else {
|
|
1350
|
+
to = `<=${to}`;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
return `${from} ${to}`.trim()
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
const testSet = (set, version, options) => {
|
|
1357
|
+
for (let i = 0; i < set.length; i++) {
|
|
1358
|
+
if (!set[i].test(version)) {
|
|
1359
|
+
return false
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1364
|
+
// Find the set of versions that are allowed to have prereleases
|
|
1365
|
+
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
1366
|
+
// That should allow `1.2.3-pr.2` to pass.
|
|
1367
|
+
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
1368
|
+
// even though it's within the range set by the comparators.
|
|
1369
|
+
for (let i = 0; i < set.length; i++) {
|
|
1370
|
+
debug(set[i].semver);
|
|
1371
|
+
if (set[i].semver === Comparator.ANY) {
|
|
1372
|
+
continue
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1376
|
+
const allowed = set[i].semver;
|
|
1377
|
+
if (allowed.major === version.major &&
|
|
1378
|
+
allowed.minor === version.minor &&
|
|
1379
|
+
allowed.patch === version.patch) {
|
|
1380
|
+
return true
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
// Version has a -pre, but it's not one of the ones we like.
|
|
1386
|
+
return false
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
return true
|
|
1390
|
+
};
|
|
1391
|
+
return range;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
var comparator;
|
|
1395
|
+
var hasRequiredComparator;
|
|
1396
|
+
|
|
1397
|
+
function requireComparator () {
|
|
1398
|
+
if (hasRequiredComparator) return comparator;
|
|
1399
|
+
hasRequiredComparator = 1;
|
|
1400
|
+
|
|
1401
|
+
const ANY = Symbol('SemVer ANY');
|
|
1402
|
+
// hoisted class for cyclic dependency
|
|
1403
|
+
class Comparator {
|
|
1404
|
+
static get ANY () {
|
|
1405
|
+
return ANY
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
constructor (comp, options) {
|
|
1409
|
+
options = parseOptions(options);
|
|
1410
|
+
|
|
1411
|
+
if (comp instanceof Comparator) {
|
|
1412
|
+
if (comp.loose === !!options.loose) {
|
|
1413
|
+
return comp
|
|
1414
|
+
} else {
|
|
1415
|
+
comp = comp.value;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
comp = comp.trim().split(/\s+/).join(' ');
|
|
1420
|
+
debug('comparator', comp, options);
|
|
1421
|
+
this.options = options;
|
|
1422
|
+
this.loose = !!options.loose;
|
|
1423
|
+
this.parse(comp);
|
|
1424
|
+
|
|
1425
|
+
if (this.semver === ANY) {
|
|
1426
|
+
this.value = '';
|
|
1427
|
+
} else {
|
|
1428
|
+
this.value = this.operator + this.semver.version;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
debug('comp', this);
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
parse (comp) {
|
|
1435
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1436
|
+
const m = comp.match(r);
|
|
1437
|
+
|
|
1438
|
+
if (!m) {
|
|
1439
|
+
throw new TypeError(`Invalid comparator: ${comp}`)
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
this.operator = m[1] !== undefined ? m[1] : '';
|
|
1443
|
+
if (this.operator === '=') {
|
|
1444
|
+
this.operator = '';
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// if it literally is just '>' or '' then allow anything.
|
|
1448
|
+
if (!m[2]) {
|
|
1449
|
+
this.semver = ANY;
|
|
1450
|
+
} else {
|
|
1451
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
toString () {
|
|
1456
|
+
return this.value
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
test (version) {
|
|
1460
|
+
debug('Comparator.test', version, this.options.loose);
|
|
1461
|
+
|
|
1462
|
+
if (this.semver === ANY || version === ANY) {
|
|
1463
|
+
return true
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
if (typeof version === 'string') {
|
|
1467
|
+
try {
|
|
1468
|
+
version = new SemVer(version, this.options);
|
|
1469
|
+
} catch (er) {
|
|
1470
|
+
return false
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
return cmp(version, this.operator, this.semver, this.options)
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
intersects (comp, options) {
|
|
1478
|
+
if (!(comp instanceof Comparator)) {
|
|
1479
|
+
throw new TypeError('a Comparator is required')
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
if (this.operator === '') {
|
|
1483
|
+
if (this.value === '') {
|
|
1484
|
+
return true
|
|
1485
|
+
}
|
|
1486
|
+
return new Range(comp.value, options).test(this.value)
|
|
1487
|
+
} else if (comp.operator === '') {
|
|
1488
|
+
if (comp.value === '') {
|
|
1489
|
+
return true
|
|
1490
|
+
}
|
|
1491
|
+
return new Range(this.value, options).test(comp.semver)
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
options = parseOptions(options);
|
|
1495
|
+
|
|
1496
|
+
// Special cases where nothing can possibly be lower
|
|
1497
|
+
if (options.includePrerelease &&
|
|
1498
|
+
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
1499
|
+
return false
|
|
1500
|
+
}
|
|
1501
|
+
if (!options.includePrerelease &&
|
|
1502
|
+
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
1503
|
+
return false
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
// Same direction increasing (> or >=)
|
|
1507
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
1508
|
+
return true
|
|
1509
|
+
}
|
|
1510
|
+
// Same direction decreasing (< or <=)
|
|
1511
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
1512
|
+
return true
|
|
1513
|
+
}
|
|
1514
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
|
1515
|
+
if (
|
|
1516
|
+
(this.semver.version === comp.semver.version) &&
|
|
1517
|
+
this.operator.includes('=') && comp.operator.includes('=')) {
|
|
1518
|
+
return true
|
|
1519
|
+
}
|
|
1520
|
+
// opposite directions less than
|
|
1521
|
+
if (cmp(this.semver, '<', comp.semver, options) &&
|
|
1522
|
+
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
1523
|
+
return true
|
|
1524
|
+
}
|
|
1525
|
+
// opposite directions greater than
|
|
1526
|
+
if (cmp(this.semver, '>', comp.semver, options) &&
|
|
1527
|
+
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
1528
|
+
return true
|
|
1529
|
+
}
|
|
1530
|
+
return false
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
comparator = Comparator;
|
|
1535
|
+
|
|
1536
|
+
const parseOptions = parseOptions_1;
|
|
1537
|
+
const { safeRe: re, t } = reExports;
|
|
1538
|
+
const cmp = cmp_1;
|
|
1539
|
+
const debug = debug_1;
|
|
1540
|
+
const SemVer = semver;
|
|
1541
|
+
const Range = requireRange();
|
|
1542
|
+
return comparator;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
requireRange();
|
|
1546
|
+
|
|
1547
|
+
requireRange();
|
|
1548
|
+
|
|
1549
|
+
requireRange();
|
|
1550
|
+
|
|
1551
|
+
requireRange();
|
|
1552
|
+
|
|
1553
|
+
requireRange();
|
|
1554
|
+
|
|
1555
|
+
requireRange();
|
|
1556
|
+
|
|
1557
|
+
const Comparator$1 = requireComparator();
|
|
1558
|
+
const { ANY: ANY$1 } = Comparator$1;
|
|
1559
|
+
requireRange();
|
|
1560
|
+
|
|
1561
|
+
requireRange();
|
|
1562
|
+
|
|
1563
|
+
requireRange();
|
|
1564
|
+
const Comparator = requireComparator();
|
|
1565
|
+
const { ANY } = Comparator;
|
|
1566
|
+
|
|
1567
|
+
[new Comparator('>=0.0.0-0')];
|
|
1568
|
+
[new Comparator('>=0.0.0')];
|
|
1569
|
+
|
|
1570
|
+
// just pre-load all the stuff that index.js lazily exports
|
|
1571
|
+
const internalRe = reExports;
|
|
1572
|
+
const constants = constants$1;
|
|
1573
|
+
const identifiers = identifiers$1;
|
|
1574
|
+
requireComparator();
|
|
1575
|
+
requireRange();
|
|
1576
|
+
({
|
|
1577
|
+
re: internalRe.re,
|
|
1578
|
+
src: internalRe.src,
|
|
1579
|
+
tokens: internalRe.t,
|
|
1580
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1581
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1582
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1583
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
|
1584
|
+
});
|
|
1585
|
+
|
|
1586
|
+
var _tmpl$$3 = ["<ul", ' class="relationship-picker__selection">', "</ul>"], _tmpl$2$3 = ["<li", ' class="relationship-picker__empty">Buscando...</li>'], _tmpl$3$3 = ["<li", ' class="relationship-picker__empty">Nenhum resultado</li>'], _tmpl$4$3 = ["<ul", ' class="relationship-picker__results"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></ul>"], _tmpl$5$3 = ["<div", ' class="relationship-picker"><!--$-->', '<!--/--><input type="search" class="input"', "><!--$-->", "<!--/--></div>"], _tmpl$6$2 = ["<li", "><!--$-->", '<!--/--><button type="button" aria-label="Remover">×</button></li>'], _tmpl$7$2 = ["<li", '><button type="button"><!--$-->', '<!--/--><span class="relationship-picker__type">', "</span></button></li>"];
|
|
1587
|
+
function RelationshipPicker(props) {
|
|
1588
|
+
const [query, setQuery] = createSignal("");
|
|
1589
|
+
const [results, setResults] = createSignal([]);
|
|
1590
|
+
const [selected, setSelected] = createSignal([]);
|
|
1591
|
+
const [loading, setLoading] = createSignal(false);
|
|
1592
|
+
const [open, setOpen] = createSignal(false);
|
|
1593
|
+
const selectedIds = createMemo(() => {
|
|
1594
|
+
const value = props.value;
|
|
1595
|
+
if (Array.isArray(value)) return value.map(String);
|
|
1596
|
+
return value ? [String(value)] : [];
|
|
1597
|
+
});
|
|
1598
|
+
return ssr(_tmpl$5$3, ssrHydrationKey(), escape(createComponent(Show, {
|
|
1599
|
+
get when() {
|
|
1600
|
+
return selected().length > 0 || selectedIds().length > 0;
|
|
1601
|
+
},
|
|
1602
|
+
get children() {
|
|
1603
|
+
return ssr(_tmpl$$3, ssrHydrationKey(), escape(createComponent(For, {
|
|
1604
|
+
get each() {
|
|
1605
|
+
return selected();
|
|
1606
|
+
},
|
|
1607
|
+
children: (entry) => ssr(_tmpl$6$2, ssrHydrationKey(), escape(entry.title))
|
|
1608
|
+
})));
|
|
1609
|
+
}
|
|
1610
|
+
})), ssrAttribute("placeholder", escape(props.placeholder ?? "Buscar conteúdo...", true), false) + ssrAttribute("value", escape(query(), true), false), escape(createComponent(Show, {
|
|
1611
|
+
get when() {
|
|
1612
|
+
return memo(() => !!open())() && (loading() || results().length > 0);
|
|
1613
|
+
},
|
|
1614
|
+
get children() {
|
|
1615
|
+
return ssr(_tmpl$4$3, ssrHydrationKey(), escape(createComponent(Show, {
|
|
1616
|
+
get when() {
|
|
1617
|
+
return loading();
|
|
1618
|
+
},
|
|
1619
|
+
get children() {
|
|
1620
|
+
return ssr(_tmpl$2$3, ssrHydrationKey());
|
|
1621
|
+
}
|
|
1622
|
+
})), escape(createComponent(For, {
|
|
1623
|
+
get each() {
|
|
1624
|
+
return results();
|
|
1625
|
+
},
|
|
1626
|
+
children: (option) => ssr(_tmpl$7$2, ssrHydrationKey(), escape(option.title), escape(option.type))
|
|
1627
|
+
})), escape(createComponent(Show, {
|
|
1628
|
+
get when() {
|
|
1629
|
+
return memo(() => !!!loading())() && results().length === 0;
|
|
1630
|
+
},
|
|
1631
|
+
get children() {
|
|
1632
|
+
return ssr(_tmpl$3$3, ssrHydrationKey());
|
|
1633
|
+
}
|
|
1634
|
+
})));
|
|
1635
|
+
}
|
|
1636
|
+
})));
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
var _tmpl$$2 = ["<span", ' class="field-renderer__required">*</span>'], _tmpl$2$2 = ["<p", ' class="field-renderer__instructions">', "</p>"], _tmpl$3$2 = ["<p", ' class="field-renderer__error" role="alert">', "</p>"], _tmpl$4$2 = ["<div", ' class="field-renderer"', '><label class="field-renderer__label"><!--$-->', "<!--/--><!--$-->", "<!--/--></label><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"], _tmpl$5$2 = ["<input", ' type="text" class="input"', ">"], _tmpl$6$1 = ["<textarea", ' class="input" rows="4"', "></textarea>"], _tmpl$7$1 = ["<textarea", ' class="input wysiwyg" rows="8"></textarea>'], _tmpl$8$1 = ["<input", ' type="number" class="input"', ">"], _tmpl$9$1 = ["<input", ' type="email" class="input">'], _tmpl$0 = ["<input", ' type="url" class="input" placeholder="https://">'], _tmpl$1 = ["<input", ' type="password" class="input">'], _tmpl$10 = ["<input", ' type="checkbox"', ">"], _tmpl$11 = ["<select", ' class="input"', ">", "</select>"], _tmpl$12 = ["<option", ">", "</option>"], _tmpl$13 = ["<div", ' class="field-renderer__choices">', "</div>"], _tmpl$14 = ["<label", '><input type="radio"', "", "> <!--$-->", "<!--/--></label>"], _tmpl$15 = ["<label", '><input type="checkbox"', "> <!--$-->", "<!--/--></label>"], _tmpl$16 = ["<input", ' type="date" class="input">'], _tmpl$17 = ["<input", ' type="datetime-local" class="input">'], _tmpl$18 = ["<input", ' type="time" class="input">'], _tmpl$19 = ["<input", ' type="color">'], _tmpl$20 = ["<div", ' class="field-renderer__map"><input type="text" class="input" placeholder="Endereço"><input type="number" class="input" placeholder="Latitude (-90 a 90)" step="any" min="-90" max="90"><input type="number" class="input" placeholder="Longitude (-180 a 180)" step="any" min="-180" max="180"></div>'], _tmpl$21 = ["<div", ' class="field-renderer__link"><input type="url" class="input" placeholder="https:// ou /caminho"><select class="input"><option value="_self">Mesma janela</option><option value="_blank">Nova janela</option></select></div>'], _tmpl$22 = ["<div", ' class="field-renderer__rows"><!--$-->', '<!--/--><button type="button" class="btn">+ Adicionar linha</button></div>'], _tmpl$23 = ["<div", ' class="field-renderer__rows"><!--$-->', '<!--/--><select class="input" value><option value>+ Adicionar layout...</option><!--$-->', "<!--/--></select></div>"], _tmpl$24 = ["<div", ' class="field-renderer__row"><div class="field-renderer__row-header"><span><!--$-->', "<!--/--> <!--$-->", '<!--/--></span><button type="button" class="btn"', '>↑</button><button type="button" class="btn"', '>↓</button><button type="button" class="btn btn-danger">Remover</button></div><!--$-->', "<!--/--></div>"], _tmpl$25 = ["<p", ' class="field-renderer__instructions">Layout "<!--$-->', '<!--/-->" não encontrado.</p>'], _tmpl$26 = ["<fieldset", ' class="field-renderer__group">', "</fieldset>"], _tmpl$27 = ["<input", ' type="text" class="input">'], _tmpl$28 = ["<div", ' class="field-renderer__row"><div class="field-renderer__row-header"><span>Linha <!--$-->', '<!--/--></span><button type="button" class="btn btn-danger">Remover</button></div><!--$-->', "<!--/--></div>"], _tmpl$29 = ["<input", ' type="file" class="input"', ">"], _tmpl$30 = ["<option", "", ">", "</option>"];
|
|
1640
|
+
function isEmpty(value) {
|
|
1641
|
+
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "boolean" && !value;
|
|
1642
|
+
}
|
|
1643
|
+
function looseEquals(a, b) {
|
|
1644
|
+
if (typeof b === "boolean") return Boolean(a) === b;
|
|
1645
|
+
const na = Number(a);
|
|
1646
|
+
const nb = Number(b);
|
|
1647
|
+
return a === b || !Number.isNaN(na) && !Number.isNaN(nb) && na === nb;
|
|
1648
|
+
}
|
|
1649
|
+
function isFieldVisible(field, values) {
|
|
1650
|
+
const logic = field.conditionalLogic;
|
|
1651
|
+
if (!logic?.groups || logic.groups.length === 0) return true;
|
|
1652
|
+
const evaluateGroup = (group) => {
|
|
1653
|
+
const rules = group.rules ?? [];
|
|
1654
|
+
if (rules.length === 0) return true;
|
|
1655
|
+
const results = rules.map((rule) => {
|
|
1656
|
+
const target = values[rule.field];
|
|
1657
|
+
switch (rule.operator) {
|
|
1658
|
+
case "eq":
|
|
1659
|
+
return looseEquals(target, rule.value);
|
|
1660
|
+
case "neq":
|
|
1661
|
+
return !looseEquals(target, rule.value);
|
|
1662
|
+
case "gt":
|
|
1663
|
+
return Number(target) > Number(rule.value);
|
|
1664
|
+
case "lt":
|
|
1665
|
+
return Number(target) < Number(rule.value);
|
|
1666
|
+
case "contains":
|
|
1667
|
+
return Array.isArray(target) ? target.includes(rule.value) : String(target ?? "").includes(String(rule.value));
|
|
1668
|
+
case "pattern_matches":
|
|
1669
|
+
try {
|
|
1670
|
+
return new RegExp(String(rule.value)).test(String(target ?? ""));
|
|
1671
|
+
} catch {
|
|
1672
|
+
return false;
|
|
1673
|
+
}
|
|
1674
|
+
case "has_any_value":
|
|
1675
|
+
return !isEmpty(target);
|
|
1676
|
+
case "has_no_value":
|
|
1677
|
+
return isEmpty(target);
|
|
1678
|
+
default:
|
|
1679
|
+
return false;
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
return group.match === "ANY" ? results.some(Boolean) : results.every(Boolean);
|
|
1683
|
+
};
|
|
1684
|
+
return logic.groups.map(evaluateGroup).some(Boolean);
|
|
1685
|
+
}
|
|
1686
|
+
const LAYOUT_ONLY = /* @__PURE__ */ new Set(["message", "tab", "accordion"]);
|
|
1687
|
+
function FieldRenderer(props) {
|
|
1688
|
+
const visible = () => isFieldVisible(props.field, props.values);
|
|
1689
|
+
const [dirty, setDirty] = createSignal(false);
|
|
1690
|
+
const valueFor = () => props.values[props.field.name];
|
|
1691
|
+
const validationError = createMemo(() => {
|
|
1692
|
+
if (!dirty()) return null;
|
|
1693
|
+
return validateFieldClient(props.field, props.values[props.field.name]);
|
|
1694
|
+
});
|
|
1695
|
+
const setValue = (value) => {
|
|
1696
|
+
setDirty(true);
|
|
1697
|
+
props.onChange(props.field.name, value);
|
|
1698
|
+
};
|
|
1699
|
+
return createComponent(Show, {
|
|
1700
|
+
get when() {
|
|
1701
|
+
return memo(() => !!visible())() && !LAYOUT_ONLY.has(props.field.type);
|
|
1702
|
+
},
|
|
1703
|
+
get children() {
|
|
1704
|
+
return ssr(_tmpl$4$2, ssrHydrationKey(), ssrAttribute("data-field-type", escape(props.field.type, true), false), escape(props.field.label), escape(createComponent(Show, {
|
|
1705
|
+
get when() {
|
|
1706
|
+
return props.field.required;
|
|
1707
|
+
},
|
|
1708
|
+
get children() {
|
|
1709
|
+
return ssr(_tmpl$$2, ssrHydrationKey());
|
|
1710
|
+
}
|
|
1711
|
+
})), escape(createComponent(Show, {
|
|
1712
|
+
get when() {
|
|
1713
|
+
return props.field.instructions;
|
|
1714
|
+
},
|
|
1715
|
+
get children() {
|
|
1716
|
+
return ssr(_tmpl$2$2, ssrHydrationKey(), escape(props.field.instructions));
|
|
1717
|
+
}
|
|
1718
|
+
})), escape(createComponent(FieldControl, {
|
|
1719
|
+
get field() {
|
|
1720
|
+
return props.field;
|
|
1721
|
+
},
|
|
1722
|
+
get value() {
|
|
1723
|
+
return valueFor();
|
|
1724
|
+
},
|
|
1725
|
+
onChange: setValue,
|
|
1726
|
+
get values() {
|
|
1727
|
+
return props.values;
|
|
1728
|
+
}
|
|
1729
|
+
})), escape(createComponent(Show, {
|
|
1730
|
+
get when() {
|
|
1731
|
+
return memo(() => !!validationError())() && !validationError()?.valid;
|
|
1732
|
+
},
|
|
1733
|
+
get children() {
|
|
1734
|
+
return ssr(_tmpl$3$2, ssrHydrationKey(), escape(validationError()?.errors.join(", ")));
|
|
1735
|
+
}
|
|
1736
|
+
})));
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
function FieldControl(props) {
|
|
1741
|
+
const config = () => props.field.config ?? {};
|
|
1742
|
+
switch (props.field.type) {
|
|
1743
|
+
case "text":
|
|
1744
|
+
return ssr(_tmpl$5$2, ssrHydrationKey(), ssrAttribute("maxlength", escape(config()["characterLimit"], true), false));
|
|
1745
|
+
case "textarea":
|
|
1746
|
+
return ssr(_tmpl$6$1, ssrHydrationKey(), ssrAttribute("maxlength", escape(config()["characterLimit"], true), false));
|
|
1747
|
+
case "wysiwyg":
|
|
1748
|
+
return ssr(_tmpl$7$1, ssrHydrationKey());
|
|
1749
|
+
case "number":
|
|
1750
|
+
case "range":
|
|
1751
|
+
return ssr(_tmpl$8$1, ssrHydrationKey(), ssrAttribute("min", escape(config()["minValue"], true), false) + ssrAttribute("max", escape(config()["maxValue"], true), false) + ssrAttribute("step", escape(config()["step"], true), false));
|
|
1752
|
+
case "email":
|
|
1753
|
+
return ssr(_tmpl$9$1, ssrHydrationKey());
|
|
1754
|
+
case "url":
|
|
1755
|
+
return ssr(_tmpl$0, ssrHydrationKey());
|
|
1756
|
+
case "password":
|
|
1757
|
+
return ssr(_tmpl$1, ssrHydrationKey());
|
|
1758
|
+
case "true_false":
|
|
1759
|
+
return ssr(_tmpl$10, ssrHydrationKey(), ssrAttribute("checked", Boolean(props.value), true));
|
|
1760
|
+
case "select":
|
|
1761
|
+
return ssr(_tmpl$11, ssrHydrationKey(), ssrAttribute("multiple", config()["multiple"] === true, true), escape(createComponent(For, {
|
|
1762
|
+
get each() {
|
|
1763
|
+
return config()["choices"] ?? [];
|
|
1764
|
+
},
|
|
1765
|
+
children: (choice) => ssr(_tmpl$12, ssrHydrationKey() + ssrAttribute("value", escape(choice.value, true), false), escape(choice.label))
|
|
1766
|
+
})));
|
|
1767
|
+
case "radio":
|
|
1768
|
+
return ssr(_tmpl$13, ssrHydrationKey(), escape(createComponent(For, {
|
|
1769
|
+
get each() {
|
|
1770
|
+
return config()["choices"] ?? [];
|
|
1771
|
+
},
|
|
1772
|
+
children: (choice) => ssr(_tmpl$14, ssrHydrationKey(), ssrAttribute("name", escape(props.field.name, true), false), ssrAttribute("checked", props.value === choice.value, true), escape(choice.label))
|
|
1773
|
+
})));
|
|
1774
|
+
case "checkbox":
|
|
1775
|
+
return ssr(_tmpl$13, ssrHydrationKey(), escape(createComponent(For, {
|
|
1776
|
+
get each() {
|
|
1777
|
+
return config()["choices"] ?? [];
|
|
1778
|
+
},
|
|
1779
|
+
children: (choice) => {
|
|
1780
|
+
const checked = () => Array.isArray(props.value) && props.value.includes(choice.value);
|
|
1781
|
+
return ssr(_tmpl$15, ssrHydrationKey(), ssrAttribute("checked", checked(), true), escape(choice.label));
|
|
1782
|
+
}
|
|
1783
|
+
})));
|
|
1784
|
+
case "date_picker":
|
|
1785
|
+
return ssr(_tmpl$16, ssrHydrationKey());
|
|
1786
|
+
case "date_time_picker":
|
|
1787
|
+
return ssr(_tmpl$17, ssrHydrationKey());
|
|
1788
|
+
case "time_picker":
|
|
1789
|
+
return ssr(_tmpl$18, ssrHydrationKey());
|
|
1790
|
+
case "color_picker":
|
|
1791
|
+
return ssr(_tmpl$19, ssrHydrationKey());
|
|
1792
|
+
case "image":
|
|
1793
|
+
case "file":
|
|
1794
|
+
return createComponent(MediaPickerInput, {
|
|
1795
|
+
multiple: false,
|
|
1796
|
+
get onChange() {
|
|
1797
|
+
return props.onChange;
|
|
1798
|
+
},
|
|
1799
|
+
get accept() {
|
|
1800
|
+
return props.field.type === "image" ? "image/*" : void 0;
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
case "gallery":
|
|
1804
|
+
return createComponent(MediaPickerInput, {
|
|
1805
|
+
multiple: true,
|
|
1806
|
+
get onChange() {
|
|
1807
|
+
return props.onChange;
|
|
1808
|
+
},
|
|
1809
|
+
accept: "image/*"
|
|
1810
|
+
});
|
|
1811
|
+
case "google_map":
|
|
1812
|
+
return ssr(_tmpl$20, ssrHydrationKey());
|
|
1813
|
+
case "link":
|
|
1814
|
+
return ssr(_tmpl$21, ssrHydrationKey());
|
|
1815
|
+
case "relationship":
|
|
1816
|
+
case "post_object":
|
|
1817
|
+
return createComponent(RelationshipPicker, {
|
|
1818
|
+
get postType() {
|
|
1819
|
+
return config()["postType"];
|
|
1820
|
+
},
|
|
1821
|
+
get multiple() {
|
|
1822
|
+
return config()["multiple"] !== false;
|
|
1823
|
+
},
|
|
1824
|
+
get value() {
|
|
1825
|
+
return props.value;
|
|
1826
|
+
},
|
|
1827
|
+
get onChange() {
|
|
1828
|
+
return props.onChange;
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
case "taxonomy":
|
|
1832
|
+
case "user":
|
|
1833
|
+
return createComponent(RelationshipSelector, {
|
|
1834
|
+
get field() {
|
|
1835
|
+
return props.field;
|
|
1836
|
+
},
|
|
1837
|
+
get value() {
|
|
1838
|
+
return props.value;
|
|
1839
|
+
},
|
|
1840
|
+
get onChange() {
|
|
1841
|
+
return props.onChange;
|
|
1842
|
+
},
|
|
1843
|
+
get multiple() {
|
|
1844
|
+
return config()["multiple"] !== false;
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
case "repeater": {
|
|
1848
|
+
const rows = () => Array.isArray(props.value) ? props.value : [];
|
|
1849
|
+
return ssr(_tmpl$22, ssrHydrationKey(), escape(createComponent(For, {
|
|
1850
|
+
get each() {
|
|
1851
|
+
return rows();
|
|
1852
|
+
},
|
|
1853
|
+
children: (row, index) => createComponent(RepeaterRow, {
|
|
1854
|
+
get field() {
|
|
1855
|
+
return props.field;
|
|
1856
|
+
},
|
|
1857
|
+
row,
|
|
1858
|
+
get index() {
|
|
1859
|
+
return index();
|
|
1860
|
+
},
|
|
1861
|
+
onUpdate: (updated) => {
|
|
1862
|
+
const next = [...rows()];
|
|
1863
|
+
next[index()] = updated;
|
|
1864
|
+
props.onChange(next);
|
|
1865
|
+
},
|
|
1866
|
+
onRemove: () => {
|
|
1867
|
+
props.onChange(rows().filter((_, i) => i !== index()));
|
|
1868
|
+
}
|
|
1869
|
+
})
|
|
1870
|
+
})));
|
|
1871
|
+
}
|
|
1872
|
+
case "flexible_content": {
|
|
1873
|
+
const layouts = () => config()["layouts"] ?? [];
|
|
1874
|
+
const rows = () => {
|
|
1875
|
+
const raw = Array.isArray(props.value) ? props.value : [];
|
|
1876
|
+
return raw.map((row) => ({
|
|
1877
|
+
acf_fc_layout: String(row["acf_fc_layout"] ?? ""),
|
|
1878
|
+
data: row
|
|
1879
|
+
}));
|
|
1880
|
+
};
|
|
1881
|
+
return ssr(_tmpl$23, ssrHydrationKey(), escape(createComponent(For, {
|
|
1882
|
+
get each() {
|
|
1883
|
+
return rows();
|
|
1884
|
+
},
|
|
1885
|
+
children: (row, index) => {
|
|
1886
|
+
const layout = () => layouts().find((entry) => entry.name === row.acf_fc_layout);
|
|
1887
|
+
const rowData = () => {
|
|
1888
|
+
const {
|
|
1889
|
+
acf_fc_layout: _layout,
|
|
1890
|
+
...data
|
|
1891
|
+
} = row.data;
|
|
1892
|
+
return data;
|
|
1893
|
+
};
|
|
1894
|
+
return ssr(_tmpl$24, ssrHydrationKey(), escape(layout()?.label || row.acf_fc_layout || "Linha"), escape(index()) + 1, ssrAttribute("disabled", index() === 0, true), ssrAttribute("disabled", index() === rows().length - 1, true), escape(createComponent(Show, {
|
|
1895
|
+
get when() {
|
|
1896
|
+
return layout();
|
|
1897
|
+
},
|
|
1898
|
+
get fallback() {
|
|
1899
|
+
return ssr(_tmpl$25, ssrHydrationKey(), escape(row.acf_fc_layout));
|
|
1900
|
+
},
|
|
1901
|
+
get children() {
|
|
1902
|
+
return createComponent(For, {
|
|
1903
|
+
get each() {
|
|
1904
|
+
return layout().subFields ?? [];
|
|
1905
|
+
},
|
|
1906
|
+
children: (sub) => createComponent(FieldRenderer, {
|
|
1907
|
+
field: sub,
|
|
1908
|
+
get values() {
|
|
1909
|
+
return rowData();
|
|
1910
|
+
},
|
|
1911
|
+
onChange: (name, value) => {
|
|
1912
|
+
const current = [...Array.isArray(props.value) ? props.value : []];
|
|
1913
|
+
current[index()] = {
|
|
1914
|
+
...current[index()],
|
|
1915
|
+
[name]: value
|
|
1916
|
+
};
|
|
1917
|
+
props.onChange(current);
|
|
1918
|
+
}
|
|
1919
|
+
})
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
})));
|
|
1923
|
+
}
|
|
1924
|
+
})), escape(createComponent(For, {
|
|
1925
|
+
get each() {
|
|
1926
|
+
return layouts();
|
|
1927
|
+
},
|
|
1928
|
+
children: (layout) => ssr(_tmpl$12, ssrHydrationKey() + ssrAttribute("value", escape(layout.name, true), false), escape(layout.label ?? layout.name))
|
|
1929
|
+
})));
|
|
1930
|
+
}
|
|
1931
|
+
case "group":
|
|
1932
|
+
return ssr(_tmpl$26, ssrHydrationKey(), escape(createComponent(For, {
|
|
1933
|
+
get each() {
|
|
1934
|
+
return props.field.subFields ?? [];
|
|
1935
|
+
},
|
|
1936
|
+
children: (sub) => createComponent(FieldRenderer, {
|
|
1937
|
+
field: sub,
|
|
1938
|
+
get values() {
|
|
1939
|
+
return props.value ?? {};
|
|
1940
|
+
},
|
|
1941
|
+
onChange: (name, val) => props.onChange({
|
|
1942
|
+
...props.value ?? {},
|
|
1943
|
+
[name]: val
|
|
1944
|
+
})
|
|
1945
|
+
})
|
|
1946
|
+
})));
|
|
1947
|
+
default:
|
|
1948
|
+
return ssr(_tmpl$27, ssrHydrationKey());
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
function RepeaterRow(props) {
|
|
1952
|
+
return ssr(_tmpl$28, ssrHydrationKey(), escape(props.index) + 1, escape(createComponent(For, {
|
|
1953
|
+
get each() {
|
|
1954
|
+
return props.field.subFields ?? [];
|
|
1955
|
+
},
|
|
1956
|
+
children: (sub) => createComponent(FieldRenderer, {
|
|
1957
|
+
field: sub,
|
|
1958
|
+
get values() {
|
|
1959
|
+
return props.row;
|
|
1960
|
+
},
|
|
1961
|
+
onChange: (name, value) => props.onUpdate({
|
|
1962
|
+
...props.row,
|
|
1963
|
+
[name]: value
|
|
1964
|
+
})
|
|
1965
|
+
})
|
|
1966
|
+
})));
|
|
1967
|
+
}
|
|
1968
|
+
function MediaPickerInput(props) {
|
|
1969
|
+
return ssr(_tmpl$29, ssrHydrationKey(), ssrAttribute("multiple", props.multiple, true) + ssrAttribute("accept", escape(props.accept, true), false));
|
|
1970
|
+
}
|
|
1971
|
+
function RelationshipSelector(props) {
|
|
1972
|
+
const selectedIds = () => Array.isArray(props.value) ? props.value : props.value ? [props.value] : [];
|
|
1973
|
+
return ssr(_tmpl$11, ssrHydrationKey(), ssrAttribute("multiple", props.multiple, true) + ssrAttribute("size", escape(Math.min(6, Math.max(3, (props.field.config?.["choices"] ?? []).length || 3)), true), false), escape(createComponent(For, {
|
|
1974
|
+
get each() {
|
|
1975
|
+
return props.field.config?.["choices"] ?? [];
|
|
1976
|
+
},
|
|
1977
|
+
children: (choice) => ssr(_tmpl$30, ssrHydrationKey() + ssrAttribute("value", escape(choice.value, true), false), ssrAttribute("selected", selectedIds().includes(choice.value), true), escape(choice.label))
|
|
1978
|
+
})));
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
var _tmpl$$1 = ["<div", ' class="field-type-picker__panel" role="listbox"><input type="search" class="field-type-picker__search" placeholder="Buscar tipo de campo..."', "><!--$-->", "<!--/--></div>"], _tmpl$2$1 = ["<div", ' class="field-type-picker"><button type="button" class="field-type-picker__trigger"', "><span><!--$-->", "<!--/--> <!--$-->", '<!--/--></span><span aria-hidden="true">', "</span></button><!--$-->", "<!--/--></div>"], _tmpl$3$1 = ["<div", ' class="field-type-picker__group"><div class="field-type-picker__group-label"><!--$-->', "<!--/--> <!--$-->", "<!--/--></div><!--$-->", "<!--/--></div>"], _tmpl$4$1 = ["<span", ' class="field-type-picker__hint">sem lógica condicional</span>'], _tmpl$5$1 = ["<button", ' type="button" role="option"', ' class="', '"><span>', "</span><span>", "</span><!--$-->", "<!--/--></button>"];
|
|
1982
|
+
function FieldTypePicker(props) {
|
|
1983
|
+
const [open, setOpen] = createSignal(false);
|
|
1984
|
+
const [query, setQuery] = createSignal("");
|
|
1985
|
+
const selected = () => props.types.find((type) => type.type === props.value);
|
|
1986
|
+
const filteredTypes = () => {
|
|
1987
|
+
const q = query().toLowerCase();
|
|
1988
|
+
return q ? props.types.filter((type) => type.label.toLowerCase().includes(q) || type.type.includes(q)) : props.types;
|
|
1989
|
+
};
|
|
1990
|
+
return ssr(_tmpl$2$1, ssrHydrationKey(), ssrAttribute("aria-expanded", escape(open(), true), false), escape(selected()?.icon ?? " "), escape(selected()?.label ?? "Selecione o tipo"), open() ? "▴" : "▾", escape(createComponent(Show, {
|
|
1991
|
+
get when() {
|
|
1992
|
+
return open();
|
|
1993
|
+
},
|
|
1994
|
+
get children() {
|
|
1995
|
+
return ssr(_tmpl$$1, ssrHydrationKey(), ssrAttribute("value", escape(query(), true), false), escape(createComponent(For, {
|
|
1996
|
+
get each() {
|
|
1997
|
+
return props.categories;
|
|
1998
|
+
},
|
|
1999
|
+
children: (category) => {
|
|
2000
|
+
const categoryTypes = filteredTypes().filter((type) => type.category === category.id);
|
|
2001
|
+
return createComponent(Show, {
|
|
2002
|
+
get when() {
|
|
2003
|
+
return categoryTypes.length > 0;
|
|
2004
|
+
},
|
|
2005
|
+
get children() {
|
|
2006
|
+
return ssr(_tmpl$3$1, ssrHydrationKey(), escape(category.icon), escape(category.label), escape(createComponent(For, {
|
|
2007
|
+
each: categoryTypes,
|
|
2008
|
+
children: (type) => ssr(_tmpl$5$1, ssrHydrationKey(), ssrAttribute("aria-selected", escape(props.value, true) === escape(type.type, true), false), `field-type-picker__option ${props.value === type.type ? "is-selected" : ""}`, escape(type.icon), escape(type.label), escape(createComponent(Show, {
|
|
2009
|
+
get when() {
|
|
2010
|
+
return !type.supportsConditions;
|
|
2011
|
+
},
|
|
2012
|
+
get children() {
|
|
2013
|
+
return ssr(_tmpl$4$1, ssrHydrationKey());
|
|
2014
|
+
}
|
|
2015
|
+
})))
|
|
2016
|
+
})));
|
|
2017
|
+
}
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
})));
|
|
2021
|
+
}
|
|
2022
|
+
})));
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
var _tmpl$ = ["<div", ' class="notice notice--success">', "</div>"], _tmpl$2 = ["<label", '>Título<input class="input" required', "></label>"], _tmpl$3 = ["<label", '>Resumo<textarea class="input" rows="3"', "></textarea></label>"], _tmpl$4 = ["<label", '>Imagem destacada (media ID)<input class="input"', "></label>"], _tmpl$5 = ["<label", '>Layout<select class="input"', "><option value>Automático (hierarquia do tema)</option><!--$-->", "<!--/--></select></label>"], _tmpl$6 = ["<div", ' class="card custom-fields"><h3>Campos personalizados</h3><!--$-->', "<!--/--><details><summary>Inspecionar tipos disponíveis</summary><!--$-->", "<!--/--></details></div>"], _tmpl$7 = ["<form", ' class="content-editor"><!--$-->', "<!--/--><!--$-->", '<!--/--><div class="card"><label>Tipo<select class="input"', ">", "</select></label><!--$-->", '<!--/--><label>Slug<input class="input"', "></label><!--$-->", "<!--/--><!--$-->", '<!--/--><label>Status<select class="input"', '><option value="DRAFT">Rascunho</option><option value="PUBLISHED">Publicado</option><option value="ARCHIVED">Arquivado</option></select></label><!--$-->', "<!--/--></div><!--$-->", '<!--/--><button type="submit" class="btn btn-primary"', ">Salvar</button></form>"], _tmpl$8 = ["<div", ' class="notice notice--error">', "</div>"], _tmpl$9 = ["<option", ">", "</option>"];
|
|
2026
|
+
function ContentEditor() {
|
|
2027
|
+
const [types, setTypes] = createSignal([]);
|
|
2028
|
+
const [fieldTypes, setFieldTypes] = createSignal([]);
|
|
2029
|
+
const [categories, setCategories] = createSignal([]);
|
|
2030
|
+
const [groups, setGroups] = createSignal([]);
|
|
2031
|
+
const [themes, setThemes] = createSignal([]);
|
|
2032
|
+
const [data, setData] = createSignal({});
|
|
2033
|
+
const [errors, setErrors] = createSignal([]);
|
|
2034
|
+
const [saving, setSaving] = createSignal(false);
|
|
2035
|
+
const [message, setMessage] = createSignal("");
|
|
2036
|
+
const [draft, setDraft] = createSignal({
|
|
2037
|
+
type: "post",
|
|
2038
|
+
title: "",
|
|
2039
|
+
status: "DRAFT"
|
|
2040
|
+
});
|
|
2041
|
+
const supports = () => new Set(types().find((t) => t.slug === draft().type)?.supports ?? ["title", "editor"]);
|
|
2042
|
+
const hasSupport = (support) => supports().has(support);
|
|
2043
|
+
onMount(async () => {
|
|
2044
|
+
try {
|
|
2045
|
+
const [typeList, fieldTypeCatalog, themeList] = await Promise.all([apiClient.getContentTypes(), apiClient.getFieldTypes(), apiClient.getThemes().catch(() => [])]);
|
|
2046
|
+
setTypes(typeList);
|
|
2047
|
+
setFieldTypes(fieldTypeCatalog.types);
|
|
2048
|
+
setCategories(fieldTypeCatalog.categories);
|
|
2049
|
+
setThemes(themeList);
|
|
2050
|
+
} catch (err) {
|
|
2051
|
+
setErrors([err instanceof Error ? err.message : String(err)]);
|
|
2052
|
+
}
|
|
2053
|
+
await loadGroups(draft().type);
|
|
2054
|
+
});
|
|
2055
|
+
const availableLayouts = () => {
|
|
2056
|
+
const layouts = /* @__PURE__ */ new Set();
|
|
2057
|
+
for (const theme of themes()) {
|
|
2058
|
+
for (const layout of theme.manifest?.provides?.layouts ?? []) layouts.add(layout);
|
|
2059
|
+
}
|
|
2060
|
+
return [...layouts].sort();
|
|
2061
|
+
};
|
|
2062
|
+
const loadGroups = async (type) => {
|
|
2063
|
+
try {
|
|
2064
|
+
const all = await apiClient.getFieldGroups(type ? {
|
|
2065
|
+
type
|
|
2066
|
+
} : void 0);
|
|
2067
|
+
const resolved = await Promise.all(all.filter((group) => group.active).map(async (group) => {
|
|
2068
|
+
const full = await apiClient.getFieldGroup(group.id);
|
|
2069
|
+
return full.fields ?? [];
|
|
2070
|
+
}));
|
|
2071
|
+
setGroups(expandCloneFields(resolved.flat()));
|
|
2072
|
+
} catch (err) {
|
|
2073
|
+
setErrors([err instanceof Error ? err.message : String(err)]);
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
return ssr(_tmpl$7, ssrHydrationKey(), escape(createComponent(Show, {
|
|
2077
|
+
get when() {
|
|
2078
|
+
return errors().length > 0;
|
|
2079
|
+
},
|
|
2080
|
+
get children() {
|
|
2081
|
+
return createComponent(For, {
|
|
2082
|
+
get each() {
|
|
2083
|
+
return errors();
|
|
2084
|
+
},
|
|
2085
|
+
children: (err) => ssr(_tmpl$8, ssrHydrationKey(), escape(err))
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
})), escape(createComponent(Show, {
|
|
2089
|
+
get when() {
|
|
2090
|
+
return message();
|
|
2091
|
+
},
|
|
2092
|
+
get children() {
|
|
2093
|
+
return ssr(_tmpl$, ssrHydrationKey(), escape(message()));
|
|
2094
|
+
}
|
|
2095
|
+
})), ssrAttribute("value", escape(draft().type, true), false), escape(createComponent(For, {
|
|
2096
|
+
get each() {
|
|
2097
|
+
return types();
|
|
2098
|
+
},
|
|
2099
|
+
children: (type) => ssr(_tmpl$9, ssrHydrationKey() + ssrAttribute("value", escape(type.slug, true), false), escape(type.pluralLabel))
|
|
2100
|
+
})), escape(createComponent(Show, {
|
|
2101
|
+
get when() {
|
|
2102
|
+
return hasSupport("title");
|
|
2103
|
+
},
|
|
2104
|
+
get children() {
|
|
2105
|
+
return ssr(_tmpl$2, ssrHydrationKey(), ssrAttribute("value", escape(draft().title, true), false));
|
|
2106
|
+
}
|
|
2107
|
+
})), ssrAttribute("value", escape(draft().slug ?? "", true), false), escape(createComponent(Show, {
|
|
2108
|
+
get when() {
|
|
2109
|
+
return hasSupport("excerpt");
|
|
2110
|
+
},
|
|
2111
|
+
get children() {
|
|
2112
|
+
return ssr(_tmpl$3, ssrHydrationKey(), ssrAttribute("value", escape(draft().excerpt ?? "", true), false));
|
|
2113
|
+
}
|
|
2114
|
+
})), escape(createComponent(Show, {
|
|
2115
|
+
get when() {
|
|
2116
|
+
return hasSupport("thumbnail");
|
|
2117
|
+
},
|
|
2118
|
+
get children() {
|
|
2119
|
+
return ssr(_tmpl$4, ssrHydrationKey(), ssrAttribute("value", escape(draft().featuredImageId ?? "", true), false));
|
|
2120
|
+
}
|
|
2121
|
+
})), ssrAttribute("value", escape(draft().status, true), false), escape(createComponent(Show, {
|
|
2122
|
+
get when() {
|
|
2123
|
+
return availableLayouts().length > 0;
|
|
2124
|
+
},
|
|
2125
|
+
get children() {
|
|
2126
|
+
return ssr(_tmpl$5, ssrHydrationKey(), ssrAttribute("value", escape(draft().layout ?? "", true), false), escape(createComponent(For, {
|
|
2127
|
+
get each() {
|
|
2128
|
+
return availableLayouts();
|
|
2129
|
+
},
|
|
2130
|
+
children: (layout) => ssr(_tmpl$9, ssrHydrationKey() + ssrAttribute("value", escape(layout, true), false), escape(layout))
|
|
2131
|
+
})));
|
|
2132
|
+
}
|
|
2133
|
+
})), escape(createComponent(Show, {
|
|
2134
|
+
get when() {
|
|
2135
|
+
return groups().length > 0 || fieldTypes().length > 0;
|
|
2136
|
+
},
|
|
2137
|
+
get children() {
|
|
2138
|
+
return ssr(_tmpl$6, ssrHydrationKey(), escape(createComponent(For, {
|
|
2139
|
+
get each() {
|
|
2140
|
+
return groups();
|
|
2141
|
+
},
|
|
2142
|
+
children: (field) => createComponent(FieldRenderer, {
|
|
2143
|
+
field,
|
|
2144
|
+
get values() {
|
|
2145
|
+
return data();
|
|
2146
|
+
},
|
|
2147
|
+
onChange: (name, value) => setData({
|
|
2148
|
+
...data(),
|
|
2149
|
+
[name]: value
|
|
2150
|
+
})
|
|
2151
|
+
})
|
|
2152
|
+
})), escape(createComponent(FieldTypePicker, {
|
|
2153
|
+
get categories() {
|
|
2154
|
+
return categories();
|
|
2155
|
+
},
|
|
2156
|
+
get types() {
|
|
2157
|
+
return fieldTypes();
|
|
2158
|
+
},
|
|
2159
|
+
value: "",
|
|
2160
|
+
onChange: () => void 0
|
|
2161
|
+
})));
|
|
2162
|
+
}
|
|
2163
|
+
})), ssrAttribute("disabled", saving(), true));
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
const $$Edit = createComponent$1(($$result, $$props, $$slots) => {
|
|
2167
|
+
return renderTemplate`${renderComponent($$result, "DashboardLayout", $$DashboardLayout, { "title": "Editor de Conte\xFAdo", "data-astro-cid-yrprbkbh": true }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="editor-page" data-astro-cid-yrprbkbh> ${renderComponent($$result2, "ContentEditor", ContentEditor, { "client:load": true, "client:component-hydration": "load", "client:component-path": "/home/judah/projetos/blacklotuscms-v2/apps/admin/src/components/content/ContentEditor", "client:component-export": "ContentEditor", "data-astro-cid-yrprbkbh": true })} </div> ` })} `;
|
|
2168
|
+
}, "/home/judah/projetos/blacklotuscms-v2/apps/admin/src/pages/content/edit.astro", void 0);
|
|
2169
|
+
|
|
2170
|
+
const $$file = "/home/judah/projetos/blacklotuscms-v2/apps/admin/src/pages/content/edit.astro";
|
|
2171
|
+
const $$url = "/content/edit";
|
|
2172
|
+
|
|
2173
|
+
export { $$Edit as default, $$file as file, $$url as url };
|