@sfxcode/formkit-primevue 0.5.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.
@@ -0,0 +1,3131 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { defineComponent, getCurrentInstance, watch, watchEffect, reactive, h, ref, inject, computed, provide, toRef, onUnmounted, isRef, isReactive, toRaw, markRaw, createTextVNode, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, createCommentVNode, createVNode, createBlock, Fragment, toDisplayString } from "vue";
33
+ function token() {
34
+ return Math.random().toString(36).substring(2, 15);
35
+ }
36
+ function dedupe(arr1, arr2) {
37
+ const original = arr1 instanceof Set ? arr1 : new Set(arr1);
38
+ if (arr2)
39
+ arr2.forEach((item) => original.add(item));
40
+ return [...original];
41
+ }
42
+ function has(obj, property) {
43
+ return Object.prototype.hasOwnProperty.call(obj, property);
44
+ }
45
+ function eq(valA, valB, deep = true, explicit = ["__key"]) {
46
+ if (valA === valB)
47
+ return true;
48
+ if (typeof valB === "object" && typeof valA === "object") {
49
+ if (valA instanceof Map)
50
+ return false;
51
+ if (valA instanceof Set)
52
+ return false;
53
+ if (valA instanceof Date)
54
+ return false;
55
+ if (valA === null || valB === null)
56
+ return false;
57
+ if (Object.keys(valA).length !== Object.keys(valB).length)
58
+ return false;
59
+ for (const k of explicit) {
60
+ if ((k in valA || k in valB) && valA[k] !== valB[k])
61
+ return false;
62
+ }
63
+ for (const key in valA) {
64
+ if (!(key in valB))
65
+ return false;
66
+ if (valA[key] !== valB[key] && !deep)
67
+ return false;
68
+ if (deep && !eq(valA[key], valB[key], deep, explicit))
69
+ return false;
70
+ }
71
+ return true;
72
+ }
73
+ return false;
74
+ }
75
+ function isRecord(o) {
76
+ return Object.prototype.toString.call(o) === "[object Object]";
77
+ }
78
+ function isObject(o) {
79
+ return isRecord(o) || Array.isArray(o);
80
+ }
81
+ function isPojo(o) {
82
+ if (isRecord(o) === false)
83
+ return false;
84
+ if (o.__FKNode__ || o.__POJO__ === false)
85
+ return false;
86
+ const ctor = o.constructor;
87
+ if (ctor === void 0)
88
+ return true;
89
+ const prot = ctor.prototype;
90
+ if (isRecord(prot) === false)
91
+ return false;
92
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
93
+ return false;
94
+ }
95
+ return true;
96
+ }
97
+ function extend(original, additional, extendArrays = false, ignoreUndefined = false) {
98
+ if (additional === null)
99
+ return null;
100
+ const merged = {};
101
+ if (typeof additional === "string")
102
+ return additional;
103
+ for (const key in original) {
104
+ if (has(additional, key) && (additional[key] !== void 0 || !ignoreUndefined)) {
105
+ if (extendArrays && Array.isArray(original[key]) && Array.isArray(additional[key])) {
106
+ merged[key] = original[key].concat(additional[key]);
107
+ continue;
108
+ }
109
+ if (additional[key] === void 0) {
110
+ continue;
111
+ }
112
+ if (isPojo(original[key]) && isPojo(additional[key])) {
113
+ merged[key] = extend(original[key], additional[key], extendArrays, ignoreUndefined);
114
+ } else {
115
+ merged[key] = additional[key];
116
+ }
117
+ } else {
118
+ merged[key] = original[key];
119
+ }
120
+ }
121
+ for (const key in additional) {
122
+ if (!has(merged, key) && additional[key] !== void 0) {
123
+ merged[key] = additional[key];
124
+ }
125
+ }
126
+ return merged;
127
+ }
128
+ function isQuotedString(str) {
129
+ if (str[0] !== '"' && str[0] !== "'")
130
+ return false;
131
+ if (str[0] !== str[str.length - 1])
132
+ return false;
133
+ const quoteType = str[0];
134
+ for (let p = 1; p < str.length; p++) {
135
+ if (str[p] === quoteType && (p === 1 || str[p - 1] !== "\\") && p !== str.length - 1) {
136
+ return false;
137
+ }
138
+ }
139
+ return true;
140
+ }
141
+ function rmEscapes(str) {
142
+ if (!str.length)
143
+ return "";
144
+ let clean = "";
145
+ let lastChar = "";
146
+ for (let p = 0; p < str.length; p++) {
147
+ const char = str.charAt(p);
148
+ if (char !== "\\" || lastChar === "\\") {
149
+ clean += char;
150
+ }
151
+ lastChar = char;
152
+ }
153
+ return clean;
154
+ }
155
+ function nodeProps(...sets) {
156
+ return sets.reduce((valid, props2) => {
157
+ const _a = props2, { value, name, modelValue, config, plugins } = _a, validProps = __objRest(_a, ["value", "name", "modelValue", "config", "plugins"]);
158
+ return Object.assign(valid, validProps);
159
+ }, {});
160
+ }
161
+ function parseArgs(str) {
162
+ const args = [];
163
+ let arg = "";
164
+ let depth = 0;
165
+ let quote = "";
166
+ let lastChar = "";
167
+ for (let p = 0; p < str.length; p++) {
168
+ const char = str.charAt(p);
169
+ if (char === quote && lastChar !== "\\") {
170
+ quote = "";
171
+ } else if ((char === "'" || char === '"') && !quote && lastChar !== "\\") {
172
+ quote = char;
173
+ } else if (char === "(" && !quote) {
174
+ depth++;
175
+ } else if (char === ")" && !quote) {
176
+ depth--;
177
+ }
178
+ if (char === "," && !quote && depth === 0) {
179
+ args.push(arg);
180
+ arg = "";
181
+ } else if (char !== " " || quote) {
182
+ arg += char;
183
+ }
184
+ lastChar = char;
185
+ }
186
+ if (arg) {
187
+ args.push(arg);
188
+ }
189
+ return args;
190
+ }
191
+ function except(obj, toRemove) {
192
+ const clean = {};
193
+ const exps = toRemove.filter((n) => n instanceof RegExp);
194
+ const keysToRemove = new Set(toRemove);
195
+ for (const key in obj) {
196
+ if (!keysToRemove.has(key) && !exps.some((exp) => exp.test(key))) {
197
+ clean[key] = obj[key];
198
+ }
199
+ }
200
+ return clean;
201
+ }
202
+ function only(obj, include) {
203
+ const clean = {};
204
+ const exps = include.filter((n) => n instanceof RegExp);
205
+ include.forEach((key) => {
206
+ if (!(key instanceof RegExp)) {
207
+ clean[key] = obj[key];
208
+ }
209
+ });
210
+ Object.keys(obj).forEach((key) => {
211
+ if (exps.some((exp) => exp.test(key))) {
212
+ clean[key] = obj[key];
213
+ }
214
+ });
215
+ return clean;
216
+ }
217
+ function camel(str) {
218
+ return str.replace(/-([a-z0-9])/gi, (_s, g) => g.toUpperCase());
219
+ }
220
+ function kebab(str) {
221
+ return str.replace(/([a-z0-9])([A-Z])/g, (_s, trail, cap) => trail + "-" + cap.toLowerCase()).replace(" ", "-").toLowerCase();
222
+ }
223
+ function clone(obj, explicit = ["__key", "__init"]) {
224
+ if (obj === null || obj instanceof RegExp || obj instanceof Date || obj instanceof Map || obj instanceof Set || typeof File === "function" && obj instanceof File)
225
+ return obj;
226
+ let returnObject;
227
+ if (Array.isArray(obj)) {
228
+ returnObject = obj.map((value) => {
229
+ if (typeof value === "object")
230
+ return clone(value, explicit);
231
+ return value;
232
+ });
233
+ } else {
234
+ returnObject = Object.keys(obj).reduce((newObj, key) => {
235
+ newObj[key] = typeof obj[key] === "object" ? clone(obj[key], explicit) : obj[key];
236
+ return newObj;
237
+ }, {});
238
+ }
239
+ for (const key of explicit) {
240
+ if (key in obj) {
241
+ Object.defineProperty(returnObject, key, {
242
+ enumerable: false,
243
+ value: obj[key]
244
+ });
245
+ }
246
+ }
247
+ return returnObject;
248
+ }
249
+ function cloneAny(obj) {
250
+ return typeof obj === "object" ? clone(obj) : obj;
251
+ }
252
+ function getAt(obj, addr) {
253
+ if (!obj || typeof obj !== "object")
254
+ return null;
255
+ const segments = addr.split(".");
256
+ let o = obj;
257
+ for (const i2 in segments) {
258
+ const segment = segments[i2];
259
+ if (has(o, segment)) {
260
+ o = o[segment];
261
+ }
262
+ if (+i2 === segments.length - 1)
263
+ return o;
264
+ if (!o || typeof o !== "object")
265
+ return null;
266
+ }
267
+ return null;
268
+ }
269
+ function undefine(value) {
270
+ return value !== void 0 && value !== "false" && value !== false ? true : void 0;
271
+ }
272
+ function init(obj) {
273
+ return !Object.isFrozen(obj) ? Object.defineProperty(obj, "__init", {
274
+ enumerable: false,
275
+ value: true
276
+ }) : obj;
277
+ }
278
+ function slugify(str) {
279
+ return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]/g, " ").trim().replace(/\s+/g, "-");
280
+ }
281
+ function createDispatcher$1() {
282
+ const middleware = [];
283
+ let currentIndex = 0;
284
+ const use2 = (dispatchable) => middleware.push(dispatchable);
285
+ const dispatch = (payload) => {
286
+ const current = middleware[currentIndex];
287
+ if (typeof current === "function") {
288
+ return current(payload, (explicitPayload) => {
289
+ currentIndex++;
290
+ return dispatch(explicitPayload === void 0 ? payload : explicitPayload);
291
+ });
292
+ }
293
+ currentIndex = 0;
294
+ return payload;
295
+ };
296
+ use2.dispatch = dispatch;
297
+ use2.unshift = (dispatchable) => middleware.unshift(dispatchable);
298
+ use2.remove = (dispatchable) => {
299
+ const index = middleware.indexOf(dispatchable);
300
+ if (index > -1)
301
+ middleware.splice(index, 1);
302
+ };
303
+ return use2;
304
+ }
305
+ function createEmitter() {
306
+ const listeners = /* @__PURE__ */ new Map();
307
+ const receipts2 = /* @__PURE__ */ new Map();
308
+ let buffer = void 0;
309
+ const emitter = (node, event) => {
310
+ if (buffer) {
311
+ buffer.set(event.name, [node, event]);
312
+ return;
313
+ }
314
+ if (listeners.has(event.name)) {
315
+ listeners.get(event.name).forEach((wrapper) => {
316
+ if (event.origin === node || wrapper.modifiers.includes("deep")) {
317
+ wrapper.listener(event);
318
+ }
319
+ });
320
+ }
321
+ if (event.bubble) {
322
+ node.bubble(event);
323
+ }
324
+ };
325
+ emitter.on = (eventName, listener) => {
326
+ const [event, ...modifiers] = eventName.split(".");
327
+ const receipt = listener.receipt || token();
328
+ const wrapper = {
329
+ modifiers,
330
+ event,
331
+ listener,
332
+ receipt
333
+ };
334
+ listeners.has(event) ? listeners.get(event).push(wrapper) : listeners.set(event, [wrapper]);
335
+ receipts2.has(receipt) ? receipts2.get(receipt).push(event) : receipts2.set(receipt, [event]);
336
+ return receipt;
337
+ };
338
+ emitter.off = (receipt) => {
339
+ var _a;
340
+ if (receipts2.has(receipt)) {
341
+ (_a = receipts2.get(receipt)) === null || _a === void 0 ? void 0 : _a.forEach((event) => {
342
+ const eventListeners = listeners.get(event);
343
+ if (Array.isArray(eventListeners)) {
344
+ listeners.set(event, eventListeners.filter((wrapper) => wrapper.receipt !== receipt));
345
+ }
346
+ });
347
+ receipts2.delete(receipt);
348
+ }
349
+ };
350
+ emitter.pause = (node) => {
351
+ if (!buffer)
352
+ buffer = /* @__PURE__ */ new Map();
353
+ if (node) {
354
+ node.walk((child) => child._e.pause());
355
+ }
356
+ };
357
+ emitter.play = (node) => {
358
+ if (!buffer)
359
+ return;
360
+ const events = buffer;
361
+ buffer = void 0;
362
+ events.forEach(([node2, event]) => emitter(node2, event));
363
+ if (node) {
364
+ node.walk((child) => child._e.play());
365
+ }
366
+ };
367
+ return emitter;
368
+ }
369
+ function emit$1(node, context, name, payload, bubble2 = true) {
370
+ context._e(node, {
371
+ payload,
372
+ name,
373
+ bubble: bubble2,
374
+ origin: node
375
+ });
376
+ return node;
377
+ }
378
+ function bubble(node, _context, event) {
379
+ if (isNode(node.parent)) {
380
+ node.parent._e(node.parent, event);
381
+ }
382
+ return node;
383
+ }
384
+ function on(_node, context, name, listener) {
385
+ return context._e.on(name, listener);
386
+ }
387
+ function off(node, context, receipt) {
388
+ context._e.off(receipt);
389
+ return node;
390
+ }
391
+ const errorHandler = createDispatcher$1();
392
+ errorHandler((error2, next) => {
393
+ if (!error2.message)
394
+ error2.message = String(`E${error2.code}`);
395
+ return next(error2);
396
+ });
397
+ const warningHandler = createDispatcher$1();
398
+ warningHandler((warning, next) => {
399
+ if (!warning.message)
400
+ warning.message = String(`W${warning.code}`);
401
+ const result = next(warning);
402
+ if (console && typeof console.warn === "function")
403
+ console.warn(result.message);
404
+ return result;
405
+ });
406
+ function warn(code, data = {}) {
407
+ warningHandler.dispatch({ code, data });
408
+ }
409
+ function error(code, data = {}) {
410
+ throw Error(errorHandler.dispatch({ code, data }).message);
411
+ }
412
+ function createMessage(conf, node) {
413
+ const m = __spreadValues({
414
+ blocking: false,
415
+ key: token(),
416
+ meta: {},
417
+ type: "state",
418
+ visible: true
419
+ }, conf);
420
+ if (node && m.value && m.meta.localize !== false) {
421
+ m.value = node.t(m);
422
+ m.meta.locale = node.config.locale;
423
+ }
424
+ return m;
425
+ }
426
+ const storeTraps = {
427
+ apply: applyMessages,
428
+ set: setMessage,
429
+ remove: removeMessage,
430
+ filter: filterMessages,
431
+ reduce: reduceMessages,
432
+ release: releaseBuffer,
433
+ touch: touchMessages
434
+ };
435
+ function createStore(_buffer = false) {
436
+ const messages2 = {};
437
+ let node;
438
+ let buffer = _buffer;
439
+ let _b = [];
440
+ const _m = /* @__PURE__ */ new Map();
441
+ let _r = void 0;
442
+ const store = new Proxy(messages2, {
443
+ get(...args) {
444
+ const [_target, property] = args;
445
+ if (property === "buffer")
446
+ return buffer;
447
+ if (property === "_b")
448
+ return _b;
449
+ if (property === "_m")
450
+ return _m;
451
+ if (property === "_r")
452
+ return _r;
453
+ if (has(storeTraps, property)) {
454
+ return storeTraps[property].bind(null, messages2, store, node);
455
+ }
456
+ return Reflect.get(...args);
457
+ },
458
+ set(_t, prop, value) {
459
+ if (prop === "_n") {
460
+ node = value;
461
+ if (_r === "__n")
462
+ releaseMissed(node, store);
463
+ return true;
464
+ } else if (prop === "_b") {
465
+ _b = value;
466
+ return true;
467
+ } else if (prop === "buffer") {
468
+ buffer = value;
469
+ return true;
470
+ } else if (prop === "_r") {
471
+ _r = value;
472
+ return true;
473
+ }
474
+ error(101, node);
475
+ return false;
476
+ }
477
+ });
478
+ return store;
479
+ }
480
+ function setMessage(messageStore, store, node, message2) {
481
+ if (store.buffer) {
482
+ store._b.push([[message2]]);
483
+ return store;
484
+ }
485
+ if (messageStore[message2.key] !== message2) {
486
+ if (typeof message2.value === "string" && message2.meta.localize !== false) {
487
+ const previous = message2.value;
488
+ message2.value = node.t(message2);
489
+ if (message2.value !== previous) {
490
+ message2.meta.locale = node.props.locale;
491
+ }
492
+ }
493
+ const e = `message-${has(messageStore, message2.key) ? "updated" : "added"}`;
494
+ messageStore[message2.key] = Object.freeze(node.hook.message.dispatch(message2));
495
+ node.emit(e, message2);
496
+ }
497
+ return store;
498
+ }
499
+ function touchMessages(messageStore, store) {
500
+ for (const key in messageStore) {
501
+ const message2 = __spreadValues({}, messageStore[key]);
502
+ store.set(message2);
503
+ }
504
+ }
505
+ function removeMessage(messageStore, store, node, key) {
506
+ if (has(messageStore, key)) {
507
+ const message2 = messageStore[key];
508
+ delete messageStore[key];
509
+ node.emit("message-removed", message2);
510
+ }
511
+ if (store.buffer === true) {
512
+ store._b = store._b.filter((buffered) => {
513
+ buffered[0] = buffered[0].filter((m) => m.key !== key);
514
+ return buffered[1] || buffered[0].length;
515
+ });
516
+ }
517
+ return store;
518
+ }
519
+ function filterMessages(messageStore, store, node, callback, type) {
520
+ for (const key in messageStore) {
521
+ const message2 = messageStore[key];
522
+ if ((!type || message2.type === type) && !callback(message2)) {
523
+ removeMessage(messageStore, store, node, key);
524
+ }
525
+ }
526
+ }
527
+ function reduceMessages(messageStore, _store, _node, reducer, accumulator) {
528
+ for (const key in messageStore) {
529
+ const message2 = messageStore[key];
530
+ accumulator = reducer(accumulator, message2);
531
+ }
532
+ return accumulator;
533
+ }
534
+ function applyMessages(_messageStore, store, node, messages2, clear) {
535
+ if (Array.isArray(messages2)) {
536
+ if (store.buffer) {
537
+ store._b.push([messages2, clear]);
538
+ return;
539
+ }
540
+ const applied = new Set(messages2.map((message2) => {
541
+ store.set(message2);
542
+ return message2.key;
543
+ }));
544
+ if (typeof clear === "string") {
545
+ store.filter((message2) => message2.type !== clear || applied.has(message2.key));
546
+ } else if (typeof clear === "function") {
547
+ store.filter((message2) => !clear(message2) || applied.has(message2.key));
548
+ }
549
+ } else {
550
+ for (const address in messages2) {
551
+ const child = node.at(address);
552
+ if (child) {
553
+ child.store.apply(messages2[address], clear);
554
+ } else {
555
+ missed(node, store, address, messages2[address], clear);
556
+ }
557
+ }
558
+ }
559
+ }
560
+ function createMessages(node, ...errors2) {
561
+ const sourceKey = `${node.name}-set`;
562
+ const make = (error2) => createMessage({
563
+ key: slugify(error2),
564
+ type: "error",
565
+ value: error2,
566
+ meta: { source: sourceKey, autoClear: true }
567
+ });
568
+ return errors2.filter((m) => !!m).map((errorSet) => {
569
+ if (typeof errorSet === "string")
570
+ errorSet = [errorSet];
571
+ if (Array.isArray(errorSet)) {
572
+ return errorSet.map((error2) => make(error2));
573
+ } else {
574
+ const errors3 = {};
575
+ for (const key in errorSet) {
576
+ if (Array.isArray(errorSet[key])) {
577
+ errors3[key] = errorSet[key].map((error2) => make(error2));
578
+ } else {
579
+ errors3[key] = [make(errorSet[key])];
580
+ }
581
+ }
582
+ return errors3;
583
+ }
584
+ });
585
+ }
586
+ function missed(node, store, address, messages2, clear) {
587
+ var _a;
588
+ const misses = store._m;
589
+ if (!misses.has(address))
590
+ misses.set(address, []);
591
+ if (!store._r)
592
+ store._r = releaseMissed(node, store);
593
+ (_a = misses.get(address)) === null || _a === void 0 ? void 0 : _a.push([messages2, clear]);
594
+ }
595
+ function releaseMissed(node, store) {
596
+ return node.on("child.deep", ({ payload: child }) => {
597
+ store._m.forEach((misses, address) => {
598
+ if (node.at(address) === child) {
599
+ misses.forEach(([messages2, clear]) => {
600
+ child.store.apply(messages2, clear);
601
+ });
602
+ store._m.delete(address);
603
+ }
604
+ });
605
+ if (store._m.size === 0 && store._r) {
606
+ node.off(store._r);
607
+ store._r = void 0;
608
+ }
609
+ });
610
+ }
611
+ function releaseBuffer(_messageStore, store) {
612
+ store.buffer = false;
613
+ store._b.forEach(([messages2, clear]) => store.apply(messages2, clear));
614
+ store._b = [];
615
+ }
616
+ function createLedger() {
617
+ const ledger = {};
618
+ let n;
619
+ return {
620
+ count: (...args) => createCounter(n, ledger, ...args),
621
+ init(node) {
622
+ n = node;
623
+ node.on("message-added.deep", add(ledger, 1));
624
+ node.on("message-removed.deep", add(ledger, -1));
625
+ },
626
+ merge: (child) => merge(n, ledger, child),
627
+ settled(counterName) {
628
+ return has(ledger, counterName) ? ledger[counterName].promise : Promise.resolve();
629
+ },
630
+ unmerge: (child) => merge(n, ledger, child, true),
631
+ value(counterName) {
632
+ return has(ledger, counterName) ? ledger[counterName].count : 0;
633
+ }
634
+ };
635
+ }
636
+ function createCounter(node, ledger, counterName, condition, increment = 0) {
637
+ condition = parseCondition(condition || counterName);
638
+ if (!has(ledger, counterName)) {
639
+ const counter = {
640
+ condition,
641
+ count: 0,
642
+ name: counterName,
643
+ node,
644
+ promise: Promise.resolve(),
645
+ resolve: () => {
646
+ }
647
+ };
648
+ ledger[counterName] = counter;
649
+ increment = node.store.reduce((sum, m) => sum + counter.condition(m) * 1, increment);
650
+ node.each((child) => {
651
+ child.ledger.count(counter.name, counter.condition);
652
+ increment += child.ledger.value(counter.name);
653
+ });
654
+ }
655
+ return count(ledger[counterName], increment).promise;
656
+ }
657
+ function parseCondition(condition) {
658
+ if (typeof condition === "function") {
659
+ return condition;
660
+ }
661
+ return (m) => m.type === condition;
662
+ }
663
+ function count(counter, increment) {
664
+ const initial = counter.count;
665
+ const post = counter.count + increment;
666
+ counter.count = post;
667
+ if (initial === 0 && post !== 0) {
668
+ counter.node.emit(`unsettled:${counter.name}`, counter.count, false);
669
+ counter.promise = new Promise((r) => counter.resolve = r);
670
+ } else if (initial !== 0 && post === 0) {
671
+ counter.node.emit(`settled:${counter.name}`, counter.count, false);
672
+ counter.resolve();
673
+ }
674
+ counter.node.emit(`count:${counter.name}`, counter.count, false);
675
+ return counter;
676
+ }
677
+ function add(ledger, delta) {
678
+ return (e) => {
679
+ for (const name in ledger) {
680
+ const counter = ledger[name];
681
+ if (counter.condition(e.payload)) {
682
+ count(counter, delta);
683
+ }
684
+ }
685
+ };
686
+ }
687
+ function merge(parent, ledger, child, remove = false) {
688
+ for (const key in ledger) {
689
+ const condition = ledger[key].condition;
690
+ if (!remove)
691
+ child.ledger.count(key, condition);
692
+ const increment = child.ledger.value(key) * (remove ? -1 : 1);
693
+ if (!parent)
694
+ continue;
695
+ do {
696
+ parent.ledger.count(key, condition, increment);
697
+ parent = parent.parent;
698
+ } while (parent);
699
+ }
700
+ }
701
+ const registry = /* @__PURE__ */ new Map();
702
+ const reflected = /* @__PURE__ */ new Map();
703
+ const emit = createEmitter();
704
+ const receipts = [];
705
+ function register(node) {
706
+ if (node.props.id) {
707
+ registry.set(node.props.id, node);
708
+ reflected.set(node, node.props.id);
709
+ emit(node, {
710
+ payload: node,
711
+ name: node.props.id,
712
+ bubble: false,
713
+ origin: node
714
+ });
715
+ }
716
+ }
717
+ function deregister(node) {
718
+ if (reflected.has(node)) {
719
+ const id = reflected.get(node);
720
+ reflected.delete(node);
721
+ registry.delete(id);
722
+ emit(node, {
723
+ payload: null,
724
+ name: id,
725
+ bubble: false,
726
+ origin: node
727
+ });
728
+ }
729
+ }
730
+ function getNode$1(id) {
731
+ return registry.get(id);
732
+ }
733
+ function watchRegistry(id, callback) {
734
+ receipts.push(emit.on(id, callback));
735
+ }
736
+ function configChange(node, prop, value) {
737
+ let usingFallback = true;
738
+ !(prop in node.config._t) ? node.emit(`config:${prop}`, value, false) : usingFallback = false;
739
+ if (!(prop in node.props)) {
740
+ node.emit("prop", { prop, value });
741
+ node.emit(`prop:${prop}`, value);
742
+ }
743
+ return usingFallback;
744
+ }
745
+ function submitForm(id) {
746
+ const formElement = document.getElementById(id);
747
+ if (formElement instanceof HTMLFormElement) {
748
+ const event = new Event("submit", { cancelable: true, bubbles: true });
749
+ formElement.dispatchEvent(event);
750
+ return;
751
+ }
752
+ warn(151, id);
753
+ }
754
+ function clearState(node) {
755
+ const clear = (n) => {
756
+ for (const key in n.store) {
757
+ const message2 = n.store[key];
758
+ if (message2.type === "error" || message2.type === "ui" && key === "incomplete") {
759
+ n.store.remove(key);
760
+ } else if (message2.type === "state") {
761
+ n.store.set(__spreadProps(__spreadValues({}, message2), { value: false }));
762
+ }
763
+ }
764
+ };
765
+ clear(node);
766
+ node.walk(clear);
767
+ }
768
+ function reset(id, resetTo) {
769
+ const node = typeof id === "string" ? getNode$1(id) : id;
770
+ if (node) {
771
+ const initial = (n) => cloneAny(n.props.initial) || (n.type === "group" ? {} : n.type === "list" ? [] : void 0);
772
+ node._e.pause(node);
773
+ node.input(cloneAny(resetTo) || initial(node), false);
774
+ node.walk((child) => child.input(initial(child), false));
775
+ const finalInit = initial(node);
776
+ node.input(typeof finalInit === "object" ? cloneAny(resetTo) || init(finalInit) : finalInit, false);
777
+ node._e.play(node);
778
+ clearState(node);
779
+ node.emit("reset", node);
780
+ return node;
781
+ }
782
+ warn(152, id);
783
+ return;
784
+ }
785
+ const defaultConfig = {
786
+ delimiter: ".",
787
+ delay: 0,
788
+ locale: "en",
789
+ rootClasses: (key) => ({ [`formkit-${kebab(key)}`]: true })
790
+ };
791
+ const useIndex = Symbol("index");
792
+ const valueRemoved = Symbol("removed");
793
+ const valueMoved = Symbol("moved");
794
+ const valueInserted = Symbol("inserted");
795
+ function isList(arg) {
796
+ return arg.type === "list" && Array.isArray(arg._value);
797
+ }
798
+ function isNode(node) {
799
+ return node && typeof node === "object" && node.__FKNode__ === true;
800
+ }
801
+ const invalidSetter = (node, _context, property) => {
802
+ error(102, [node, property]);
803
+ };
804
+ const traps = {
805
+ _c: trap(getContext, invalidSetter, false),
806
+ add: trap(addChild),
807
+ addProps: trap(addProps),
808
+ address: trap(getAddress, invalidSetter, false),
809
+ at: trap(getNode),
810
+ bubble: trap(bubble),
811
+ clearErrors: trap(clearErrors$1),
812
+ calm: trap(calm),
813
+ config: trap(false),
814
+ define: trap(define),
815
+ disturb: trap(disturb),
816
+ destroy: trap(destroy),
817
+ hydrate: trap(hydrate),
818
+ index: trap(getIndex, setIndex, false),
819
+ input: trap(input),
820
+ each: trap(eachChild),
821
+ emit: trap(emit$1),
822
+ find: trap(find),
823
+ on: trap(on),
824
+ off: trap(off),
825
+ parent: trap(false, setParent),
826
+ plugins: trap(false),
827
+ remove: trap(removeChild),
828
+ root: trap(getRoot, invalidSetter, false),
829
+ reset: trap(resetValue),
830
+ resetConfig: trap(resetConfig),
831
+ setErrors: trap(setErrors$1),
832
+ submit: trap(submit),
833
+ t: trap(text),
834
+ use: trap(use),
835
+ name: trap(getName, false, false),
836
+ walk: trap(walkTree)
837
+ };
838
+ function createTraps() {
839
+ return new Map(Object.entries(traps));
840
+ }
841
+ function trap(getter, setter, curryGetter = true) {
842
+ return {
843
+ get: getter ? (node, context) => curryGetter ? (...args) => getter(node, context, ...args) : getter(node, context) : false,
844
+ set: setter !== void 0 ? setter : invalidSetter.bind(null)
845
+ };
846
+ }
847
+ function createHooks() {
848
+ const hooks = /* @__PURE__ */ new Map();
849
+ return new Proxy(hooks, {
850
+ get(_, property) {
851
+ if (!hooks.has(property)) {
852
+ hooks.set(property, createDispatcher$1());
853
+ }
854
+ return hooks.get(property);
855
+ }
856
+ });
857
+ }
858
+ let nameCount = 0;
859
+ let idCount = 0;
860
+ function createName(options) {
861
+ var _a, _b;
862
+ if (((_a = options.parent) === null || _a === void 0 ? void 0 : _a.type) === "list")
863
+ return useIndex;
864
+ return options.name || `${((_b = options.props) === null || _b === void 0 ? void 0 : _b.type) || "input"}_${++nameCount}`;
865
+ }
866
+ function createValue(options) {
867
+ if (options.type === "group") {
868
+ return init(options.value && typeof options.value === "object" && !Array.isArray(options.value) ? options.value : {});
869
+ } else if (options.type === "list") {
870
+ return init(Array.isArray(options.value) ? options.value : []);
871
+ }
872
+ return options.value === null ? "" : options.value;
873
+ }
874
+ function input(node, context, value, async = true) {
875
+ context._value = validateInput(node, node.hook.input.dispatch(value));
876
+ node.emit("input", context._value);
877
+ if (context.isSettled)
878
+ node.disturb();
879
+ if (async) {
880
+ if (context._tmo)
881
+ clearTimeout(context._tmo);
882
+ context._tmo = setTimeout(commit, node.props.delay, node, context);
883
+ } else {
884
+ commit(node, context);
885
+ }
886
+ return context.settled;
887
+ }
888
+ function validateInput(node, value) {
889
+ switch (node.type) {
890
+ case "input":
891
+ break;
892
+ case "group":
893
+ if (!value || typeof value !== "object")
894
+ error(107, [node, value]);
895
+ break;
896
+ case "list":
897
+ if (!Array.isArray(value))
898
+ error(108, [node, value]);
899
+ break;
900
+ }
901
+ return value;
902
+ }
903
+ function commit(node, context, calm2 = true, hydrate2 = true) {
904
+ context._value = context.value = node.hook.commit.dispatch(context._value);
905
+ if (node.type !== "input" && hydrate2)
906
+ node.hydrate();
907
+ node.emit("commit", context.value);
908
+ if (calm2)
909
+ node.calm();
910
+ }
911
+ function partial(context, { name, value, from }) {
912
+ if (Object.isFrozen(context._value))
913
+ return;
914
+ if (isList(context)) {
915
+ const insert = value === valueRemoved ? [] : value === valueMoved && typeof from === "number" ? context._value.splice(from, 1) : [value];
916
+ context._value.splice(name, value === valueMoved || from === valueInserted ? 0 : 1, ...insert);
917
+ return;
918
+ }
919
+ if (value !== valueRemoved) {
920
+ context._value[name] = value;
921
+ } else {
922
+ delete context._value[name];
923
+ }
924
+ }
925
+ function hydrate(node, context) {
926
+ const _value = context._value;
927
+ context.children.forEach((child) => {
928
+ if (typeof _value !== "object")
929
+ return;
930
+ if (child.name in _value) {
931
+ const childValue = child.type !== "input" || _value[child.name] && typeof _value[child.name] === "object" ? init(_value[child.name]) : _value[child.name];
932
+ child.input(childValue, false);
933
+ } else {
934
+ if (node.type !== "list" || typeof child.name === "number") {
935
+ partial(context, { name: child.name, value: child.value });
936
+ }
937
+ if (!_value.__init) {
938
+ if (child.type === "group")
939
+ child.input({}, false);
940
+ else if (child.type === "list")
941
+ child.input([], false);
942
+ else
943
+ child.input(void 0, false);
944
+ }
945
+ }
946
+ });
947
+ return node;
948
+ }
949
+ function disturb(node, context) {
950
+ var _a;
951
+ if (context._d <= 0) {
952
+ context.isSettled = false;
953
+ node.emit("settled", false, false);
954
+ context.settled = new Promise((resolve) => {
955
+ context._resolve = resolve;
956
+ });
957
+ if (node.parent)
958
+ (_a = node.parent) === null || _a === void 0 ? void 0 : _a.disturb();
959
+ }
960
+ context._d++;
961
+ return node;
962
+ }
963
+ function calm(node, context, value) {
964
+ var _a;
965
+ if (value !== void 0 && node.type !== "input") {
966
+ partial(context, value);
967
+ return commit(node, context, true, false);
968
+ }
969
+ if (context._d > 0)
970
+ context._d--;
971
+ if (context._d === 0) {
972
+ context.isSettled = true;
973
+ node.emit("settled", true, false);
974
+ if (node.parent)
975
+ (_a = node.parent) === null || _a === void 0 ? void 0 : _a.calm({ name: node.name, value: context.value });
976
+ if (context._resolve)
977
+ context._resolve(context.value);
978
+ }
979
+ }
980
+ function destroy(node, context) {
981
+ node.emit("destroying", node);
982
+ node.store.filter(() => false);
983
+ if (node.parent) {
984
+ node.parent.remove(node);
985
+ }
986
+ deregister(node);
987
+ context._value = context.value = void 0;
988
+ node.emit("destroyed", node);
989
+ }
990
+ function define(node, context, definition) {
991
+ context.type = definition.type;
992
+ context.props.definition = clone(definition);
993
+ context.value = context._value = createValue({
994
+ type: node.type,
995
+ value: context.value
996
+ });
997
+ if (definition.features) {
998
+ definition.features.forEach((feature) => feature(node));
999
+ }
1000
+ if (definition.props) {
1001
+ node.addProps(definition.props);
1002
+ }
1003
+ node.emit("defined", definition);
1004
+ }
1005
+ function addProps(node, context, props2) {
1006
+ var _a;
1007
+ if (node.props.attrs) {
1008
+ const attrs = __spreadValues({}, node.props.attrs);
1009
+ node.props._emit = false;
1010
+ for (const attr in attrs) {
1011
+ const camelName = camel(attr);
1012
+ if (props2.includes(camelName)) {
1013
+ node.props[camelName] = attrs[attr];
1014
+ delete attrs[attr];
1015
+ }
1016
+ }
1017
+ const initial = cloneAny(context._value);
1018
+ node.props.initial = node.type !== "input" ? init(initial) : initial;
1019
+ node.props._emit = true;
1020
+ node.props.attrs = attrs;
1021
+ if (node.props.definition) {
1022
+ node.props.definition.props = [
1023
+ ...((_a = node.props.definition) === null || _a === void 0 ? void 0 : _a.props) || [],
1024
+ ...props2
1025
+ ];
1026
+ }
1027
+ }
1028
+ node.emit("added-props", props2);
1029
+ return node;
1030
+ }
1031
+ function addChild(parent, parentContext, child, listIndex) {
1032
+ if (parent.type === "input")
1033
+ error(100, parent);
1034
+ if (child.parent && child.parent !== parent) {
1035
+ child.parent.remove(child);
1036
+ }
1037
+ if (!parentContext.children.includes(child)) {
1038
+ if (listIndex !== void 0 && parent.type === "list") {
1039
+ parentContext.children.splice(listIndex, 0, child);
1040
+ if (Array.isArray(parent.value) && parent.value.length < parentContext.children.length) {
1041
+ parent.disturb().calm({
1042
+ name: listIndex,
1043
+ value: child.value,
1044
+ from: valueInserted
1045
+ });
1046
+ }
1047
+ } else {
1048
+ parentContext.children.push(child);
1049
+ }
1050
+ if (!child.isSettled)
1051
+ parent.disturb();
1052
+ }
1053
+ if (child.parent !== parent) {
1054
+ child.parent = parent;
1055
+ if (child.parent !== parent) {
1056
+ parent.remove(child);
1057
+ child.parent.add(child);
1058
+ return parent;
1059
+ }
1060
+ } else {
1061
+ child.use(parent.plugins);
1062
+ }
1063
+ commit(parent, parentContext, false);
1064
+ parent.ledger.merge(child);
1065
+ parent.emit("child", child);
1066
+ return parent;
1067
+ }
1068
+ function setParent(child, context, _property, parent) {
1069
+ if (isNode(parent)) {
1070
+ if (child.parent && child.parent !== parent) {
1071
+ child.parent.remove(child);
1072
+ }
1073
+ context.parent = parent;
1074
+ child.resetConfig();
1075
+ !parent.children.includes(child) ? parent.add(child) : child.use(parent.plugins);
1076
+ return true;
1077
+ }
1078
+ if (parent === null) {
1079
+ context.parent = null;
1080
+ return true;
1081
+ }
1082
+ return false;
1083
+ }
1084
+ function removeChild(node, context, child) {
1085
+ const childIndex = context.children.indexOf(child);
1086
+ if (childIndex !== -1) {
1087
+ if (child.isSettled)
1088
+ node.disturb();
1089
+ context.children.splice(childIndex, 1);
1090
+ let preserve = undefine(child.props.preserve);
1091
+ let parent = child.parent;
1092
+ while (preserve === void 0 && parent) {
1093
+ preserve = undefine(parent.props.preserve);
1094
+ parent = parent.parent;
1095
+ }
1096
+ if (!preserve) {
1097
+ node.calm({
1098
+ name: node.type === "list" ? childIndex : child.name,
1099
+ value: valueRemoved
1100
+ });
1101
+ } else {
1102
+ node.calm();
1103
+ }
1104
+ child.parent = null;
1105
+ child.config._rmn = child;
1106
+ }
1107
+ node.ledger.unmerge(child);
1108
+ return node;
1109
+ }
1110
+ function eachChild(_node, context, callback) {
1111
+ context.children.forEach((child) => callback(child));
1112
+ }
1113
+ function walkTree(_node, context, callback, stopIfFalse = false) {
1114
+ context.children.forEach((child) => {
1115
+ if (callback(child) !== false || !stopIfFalse) {
1116
+ child.walk(callback);
1117
+ }
1118
+ });
1119
+ }
1120
+ function resetConfig(node, context) {
1121
+ const parent = node.parent || void 0;
1122
+ context.config = createConfig(node.config._t, parent);
1123
+ node.walk((n) => n.resetConfig());
1124
+ }
1125
+ function use(node, context, plugin, run = true, library = true) {
1126
+ if (Array.isArray(plugin) || plugin instanceof Set) {
1127
+ plugin.forEach((p) => use(node, context, p));
1128
+ return node;
1129
+ }
1130
+ if (!context.plugins.has(plugin)) {
1131
+ if (library && typeof plugin.library === "function")
1132
+ plugin.library(node);
1133
+ if (run && plugin(node) !== false) {
1134
+ context.plugins.add(plugin);
1135
+ node.children.forEach((child) => child.use(plugin));
1136
+ }
1137
+ }
1138
+ return node;
1139
+ }
1140
+ function setIndex(node, _context, _property, setIndex2) {
1141
+ if (isNode(node.parent)) {
1142
+ const children = node.parent.children;
1143
+ const index = setIndex2 >= children.length ? children.length - 1 : setIndex2 < 0 ? 0 : setIndex2;
1144
+ const oldIndex = children.indexOf(node);
1145
+ if (oldIndex === -1)
1146
+ return false;
1147
+ children.splice(oldIndex, 1);
1148
+ children.splice(index, 0, node);
1149
+ node.parent.children = children;
1150
+ if (node.parent.type === "list")
1151
+ node.parent.disturb().calm({ name: index, value: valueMoved, from: oldIndex });
1152
+ return true;
1153
+ }
1154
+ return false;
1155
+ }
1156
+ function getIndex(node) {
1157
+ if (node.parent) {
1158
+ const index = [...node.parent.children].indexOf(node);
1159
+ return index === -1 ? node.parent.children.length : index;
1160
+ }
1161
+ return -1;
1162
+ }
1163
+ function getContext(_node, context) {
1164
+ return context;
1165
+ }
1166
+ function getName(node, context) {
1167
+ var _a;
1168
+ if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === "list")
1169
+ return node.index;
1170
+ return context.name !== useIndex ? context.name : node.index;
1171
+ }
1172
+ function getAddress(node, context) {
1173
+ return context.parent ? context.parent.address.concat([node.name]) : [node.name];
1174
+ }
1175
+ function getNode(node, _context, locator) {
1176
+ const address = typeof locator === "string" ? locator.split(node.config.delimiter) : locator;
1177
+ if (!address.length)
1178
+ return void 0;
1179
+ const first = address[0];
1180
+ let pointer = node.parent;
1181
+ if (!pointer) {
1182
+ if (String(address[0]) === String(node.name))
1183
+ address.shift();
1184
+ pointer = node;
1185
+ }
1186
+ if (first === "$parent")
1187
+ address.shift();
1188
+ while (pointer && address.length) {
1189
+ const name = address.shift();
1190
+ switch (name) {
1191
+ case "$root":
1192
+ pointer = node.root;
1193
+ break;
1194
+ case "$parent":
1195
+ pointer = pointer.parent;
1196
+ break;
1197
+ case "$self":
1198
+ pointer = node;
1199
+ break;
1200
+ default:
1201
+ pointer = pointer.children.find((c) => String(c.name) === String(name)) || select(pointer, name);
1202
+ }
1203
+ }
1204
+ return pointer || void 0;
1205
+ }
1206
+ function select(node, selector) {
1207
+ const matches = String(selector).match(/^(find)\((.*)\)$/);
1208
+ if (matches) {
1209
+ const [, action, argStr] = matches;
1210
+ const args = argStr.split(",").map((arg) => arg.trim());
1211
+ switch (action) {
1212
+ case "find":
1213
+ return node.find(args[0], args[1]);
1214
+ default:
1215
+ return void 0;
1216
+ }
1217
+ }
1218
+ return void 0;
1219
+ }
1220
+ function find(node, _context, searchTerm, searcher) {
1221
+ return bfs(node, searchTerm, searcher);
1222
+ }
1223
+ function bfs(tree, searchValue, searchGoal = "name") {
1224
+ const search = typeof searchGoal === "string" ? (n) => n[searchGoal] == searchValue : searchGoal;
1225
+ const stack = [tree];
1226
+ while (stack.length) {
1227
+ const node = stack.shift();
1228
+ if (search(node, searchValue))
1229
+ return node;
1230
+ stack.push(...node.children);
1231
+ }
1232
+ return void 0;
1233
+ }
1234
+ function getRoot(n) {
1235
+ let node = n;
1236
+ while (node.parent) {
1237
+ node = node.parent;
1238
+ }
1239
+ return node;
1240
+ }
1241
+ function createConfig(target = {}, parent) {
1242
+ let node = void 0;
1243
+ return new Proxy(target, {
1244
+ get(...args) {
1245
+ const prop = args[1];
1246
+ if (prop === "_t")
1247
+ return target;
1248
+ const localValue = Reflect.get(...args);
1249
+ if (localValue !== void 0)
1250
+ return localValue;
1251
+ if (parent) {
1252
+ const parentVal = parent.config[prop];
1253
+ if (parentVal !== void 0)
1254
+ return parentVal;
1255
+ }
1256
+ if (target.rootConfig && typeof prop === "string") {
1257
+ const rootValue = target.rootConfig[prop];
1258
+ if (rootValue !== void 0)
1259
+ return rootValue;
1260
+ }
1261
+ if (prop === "delay" && (node === null || node === void 0 ? void 0 : node.type) === "input")
1262
+ return 20;
1263
+ return defaultConfig[prop];
1264
+ },
1265
+ set(...args) {
1266
+ const prop = args[1];
1267
+ const value = args[2];
1268
+ if (prop === "_n") {
1269
+ node = value;
1270
+ if (target.rootConfig)
1271
+ target.rootConfig._add(node);
1272
+ return true;
1273
+ }
1274
+ if (prop === "_rmn") {
1275
+ if (target.rootConfig)
1276
+ target.rootConfig._rm(node);
1277
+ node = void 0;
1278
+ return true;
1279
+ }
1280
+ if (!eq(target[prop], value, false)) {
1281
+ const didSet = Reflect.set(...args);
1282
+ if (node) {
1283
+ node.emit(`config:${prop}`, value, false);
1284
+ configChange(node, prop, value);
1285
+ node.walk((n) => configChange(n, prop, value), true);
1286
+ }
1287
+ return didSet;
1288
+ }
1289
+ return true;
1290
+ }
1291
+ });
1292
+ }
1293
+ function text(node, _context, key, type = "ui") {
1294
+ const fragment = typeof key === "string" ? { key, value: key, type } : key;
1295
+ const value = node.hook.text.dispatch(fragment);
1296
+ node.emit("text", value, false);
1297
+ return value.value;
1298
+ }
1299
+ function submit(node) {
1300
+ const name = node.name;
1301
+ do {
1302
+ if (node.props.isForm === true)
1303
+ break;
1304
+ if (!node.parent)
1305
+ error(106, name);
1306
+ node = node.parent;
1307
+ } while (node);
1308
+ if (node.props.id) {
1309
+ submitForm(node.props.id);
1310
+ }
1311
+ }
1312
+ function resetValue(node, _context, value) {
1313
+ return reset(node, value);
1314
+ }
1315
+ function setErrors$1(node, _context, localErrors, childErrors) {
1316
+ const sourceKey = `${node.name}-set`;
1317
+ createMessages(node, localErrors, childErrors).forEach((errors2) => {
1318
+ node.store.apply(errors2, (message2) => message2.meta.source === sourceKey);
1319
+ });
1320
+ return node;
1321
+ }
1322
+ function clearErrors$1(node, context, clearChildErrors = true) {
1323
+ setErrors$1(node, context, []);
1324
+ if (clearChildErrors) {
1325
+ const sourceKey = `${node.name}-set`;
1326
+ node.walk((child) => {
1327
+ child.store.filter((message2) => {
1328
+ return !(message2.type === "error" && message2.meta && message2.meta.source === sourceKey);
1329
+ });
1330
+ });
1331
+ }
1332
+ return node;
1333
+ }
1334
+ function defaultProps(node) {
1335
+ if (!has(node.props, "id"))
1336
+ node.props.id = `input_${idCount++}`;
1337
+ return node;
1338
+ }
1339
+ function createProps(initial) {
1340
+ const props2 = {
1341
+ initial: typeof initial === "object" ? cloneAny(initial) : initial
1342
+ };
1343
+ let node;
1344
+ let isEmitting = true;
1345
+ return new Proxy(props2, {
1346
+ get(...args) {
1347
+ const [_t, prop] = args;
1348
+ if (has(props2, prop))
1349
+ return Reflect.get(...args);
1350
+ if (node && typeof prop === "string" && node.config[prop] !== void 0)
1351
+ return node.config[prop];
1352
+ return void 0;
1353
+ },
1354
+ set(target, property, originalValue, receiver) {
1355
+ if (property === "_n") {
1356
+ node = originalValue;
1357
+ return true;
1358
+ }
1359
+ if (property === "_emit") {
1360
+ isEmitting = originalValue;
1361
+ return true;
1362
+ }
1363
+ const { prop, value } = node.hook.prop.dispatch({
1364
+ prop: property,
1365
+ value: originalValue
1366
+ });
1367
+ if (!eq(props2[prop], value, false) || typeof value === "object") {
1368
+ const didSet = Reflect.set(target, prop, value, receiver);
1369
+ if (isEmitting) {
1370
+ node.emit("prop", { prop, value });
1371
+ if (typeof prop === "string")
1372
+ node.emit(`prop:${prop}`, value);
1373
+ }
1374
+ return didSet;
1375
+ }
1376
+ return true;
1377
+ }
1378
+ });
1379
+ }
1380
+ function findDefinition(node, plugins) {
1381
+ if (node.props.definition)
1382
+ return node.define(node.props.definition);
1383
+ for (const plugin of plugins) {
1384
+ if (node.props.definition)
1385
+ return;
1386
+ if (typeof plugin.library === "function") {
1387
+ plugin.library(node);
1388
+ }
1389
+ }
1390
+ }
1391
+ function createContext(options) {
1392
+ const value = createValue(options);
1393
+ const config = createConfig(options.config || {}, options.parent);
1394
+ return {
1395
+ _d: 0,
1396
+ _e: createEmitter(),
1397
+ _resolve: false,
1398
+ _tmo: false,
1399
+ _value: value,
1400
+ children: dedupe(options.children || []),
1401
+ config,
1402
+ hook: createHooks(),
1403
+ isCreated: false,
1404
+ isSettled: true,
1405
+ ledger: createLedger(),
1406
+ name: createName(options),
1407
+ parent: options.parent || null,
1408
+ plugins: /* @__PURE__ */ new Set(),
1409
+ props: createProps(value),
1410
+ settled: Promise.resolve(value),
1411
+ store: createStore(true),
1412
+ traps: createTraps(),
1413
+ type: options.type || "input",
1414
+ value
1415
+ };
1416
+ }
1417
+ function nodeInit(node, options) {
1418
+ var _a;
1419
+ node.ledger.init(node.store._n = node.props._n = node.config._n = node);
1420
+ node.props._emit = false;
1421
+ if (options.props)
1422
+ Object.assign(node.props, options.props);
1423
+ node.props._emit = true;
1424
+ findDefinition(node, /* @__PURE__ */ new Set([
1425
+ ...options.plugins || [],
1426
+ ...node.parent ? node.parent.plugins : []
1427
+ ]));
1428
+ if (options.plugins) {
1429
+ for (const plugin of options.plugins) {
1430
+ use(node, node._c, plugin, true, false);
1431
+ }
1432
+ }
1433
+ defaultProps(node);
1434
+ node.each((child) => node.add(child));
1435
+ if (node.parent)
1436
+ node.parent.add(node, options.index);
1437
+ if (node.type === "input" && node.children.length)
1438
+ error(100, node);
1439
+ input(node, node._c, node._value, false);
1440
+ node.store.release();
1441
+ if ((_a = options.props) === null || _a === void 0 ? void 0 : _a.id)
1442
+ register(node);
1443
+ node.emit("created", node);
1444
+ node.isCreated = true;
1445
+ return node;
1446
+ }
1447
+ function createNode(options) {
1448
+ const ops = options || {};
1449
+ const context = createContext(ops);
1450
+ const node = new Proxy(context, {
1451
+ get(...args) {
1452
+ const [, property] = args;
1453
+ if (property === "__FKNode__")
1454
+ return true;
1455
+ const trap2 = context.traps.get(property);
1456
+ if (trap2 && trap2.get)
1457
+ return trap2.get(node, context);
1458
+ return Reflect.get(...args);
1459
+ },
1460
+ set(...args) {
1461
+ const [, property, value] = args;
1462
+ const trap2 = context.traps.get(property);
1463
+ if (trap2 && trap2.set)
1464
+ return trap2.set(node, context, property, value);
1465
+ return Reflect.set(...args);
1466
+ }
1467
+ });
1468
+ return nodeInit(node, ops);
1469
+ }
1470
+ function isDOM(node) {
1471
+ return typeof node !== "string" && has(node, "$el");
1472
+ }
1473
+ function isComponent$1(node) {
1474
+ return typeof node !== "string" && has(node, "$cmp");
1475
+ }
1476
+ function isConditional(node) {
1477
+ if (!node || typeof node === "string")
1478
+ return false;
1479
+ return has(node, "if") && has(node, "then");
1480
+ }
1481
+ function isSugar(node) {
1482
+ return typeof node !== "string" && "$formkit" in node;
1483
+ }
1484
+ function sugar(node) {
1485
+ if (typeof node === "string") {
1486
+ return {
1487
+ $el: "text",
1488
+ children: node
1489
+ };
1490
+ }
1491
+ if (isSugar(node)) {
1492
+ const _a = node, { $formkit: type, for: iterator, if: condition, children, key, bind } = _a, props2 = __objRest(_a, ["$formkit", "for", "if", "children", "key", "bind"]);
1493
+ return Object.assign({
1494
+ $cmp: "FormKit",
1495
+ props: __spreadProps(__spreadValues({}, props2), { type })
1496
+ }, condition ? { if: condition } : {}, iterator ? { for: iterator } : {}, children ? { children } : {}, key ? { key } : {}, bind ? { bind } : {});
1497
+ }
1498
+ return node;
1499
+ }
1500
+ function compile(expr) {
1501
+ let provideTokens;
1502
+ const requirements = /* @__PURE__ */ new Set();
1503
+ const x = function expand(operand, tokens) {
1504
+ return typeof operand === "function" ? operand(tokens) : operand;
1505
+ };
1506
+ const operatorRegistry = [
1507
+ {
1508
+ "&&": (l, r, t) => x(l, t) && x(r, t),
1509
+ "||": (l, r, t) => x(l, t) || x(r, t)
1510
+ },
1511
+ {
1512
+ "===": (l, r, t) => !!(x(l, t) === x(r, t)),
1513
+ "!==": (l, r, t) => !!(x(l, t) !== x(r, t)),
1514
+ "==": (l, r, t) => !!(x(l, t) == x(r, t)),
1515
+ "!=": (l, r, t) => !!(x(l, t) != x(r, t)),
1516
+ ">=": (l, r, t) => !!(x(l, t) >= x(r, t)),
1517
+ "<=": (l, r, t) => !!(x(l, t) <= x(r, t)),
1518
+ ">": (l, r, t) => !!(x(l, t) > x(r, t)),
1519
+ "<": (l, r, t) => !!(x(l, t) < x(r, t))
1520
+ },
1521
+ {
1522
+ "+": (l, r, t) => x(l, t) + x(r, t),
1523
+ "-": (l, r, t) => x(l, t) - x(r, t)
1524
+ },
1525
+ {
1526
+ "*": (l, r, t) => x(l, t) * x(r, t),
1527
+ "/": (l, r, t) => x(l, t) / x(r, t),
1528
+ "%": (l, r, t) => x(l, t) % x(r, t)
1529
+ }
1530
+ ];
1531
+ const operatorSymbols = operatorRegistry.reduce((s, g) => {
1532
+ return s.concat(Object.keys(g));
1533
+ }, []);
1534
+ const operatorChars = new Set(operatorSymbols.map((key) => key.charAt(0)));
1535
+ function getOp(symbols, char, p, expression) {
1536
+ const candidates = symbols.filter((s) => s.startsWith(char));
1537
+ if (!candidates.length)
1538
+ return false;
1539
+ return candidates.find((symbol) => {
1540
+ if (expression.length >= p + symbol.length) {
1541
+ const nextChars = expression.substring(p, p + symbol.length);
1542
+ if (nextChars === symbol)
1543
+ return symbol;
1544
+ }
1545
+ return false;
1546
+ });
1547
+ }
1548
+ function getStep(p, expression, direction = 1) {
1549
+ let next = direction ? expression.substring(p + 1).trim() : expression.substring(0, p).trim();
1550
+ if (!next.length)
1551
+ return -1;
1552
+ if (!direction) {
1553
+ const reversed = next.split("").reverse();
1554
+ const start = reversed.findIndex((char2) => operatorChars.has(char2));
1555
+ next = reversed.slice(start).join("");
1556
+ }
1557
+ const char = next[0];
1558
+ return operatorRegistry.findIndex((operators) => {
1559
+ const symbols = Object.keys(operators);
1560
+ return !!getOp(symbols, char, 0, next);
1561
+ });
1562
+ }
1563
+ function getTail(pos, expression) {
1564
+ let tail = "";
1565
+ const length = expression.length;
1566
+ let depth = 0;
1567
+ for (let p = pos; p < length; p++) {
1568
+ const char = expression.charAt(p);
1569
+ if (char === "(") {
1570
+ depth++;
1571
+ } else if (char === ")") {
1572
+ depth--;
1573
+ } else if (depth === 0 && char === " ") {
1574
+ continue;
1575
+ }
1576
+ if (depth === 0 && getOp(operatorSymbols, char, p, expression)) {
1577
+ return [tail, p - 1];
1578
+ } else {
1579
+ tail += char;
1580
+ }
1581
+ }
1582
+ return [tail, expression.length - 1];
1583
+ }
1584
+ function parseLogicals(expression, step = 0) {
1585
+ const operators = operatorRegistry[step];
1586
+ const length = expression.length;
1587
+ const symbols = Object.keys(operators);
1588
+ let depth = 0;
1589
+ let quote = false;
1590
+ let op = null;
1591
+ let operand = "";
1592
+ let left = null;
1593
+ let operation;
1594
+ let lastChar = "";
1595
+ let char = "";
1596
+ let parenthetical = "";
1597
+ let parenQuote = "";
1598
+ let startP = 0;
1599
+ const addTo = (depth2, char2) => {
1600
+ depth2 ? parenthetical += char2 : operand += char2;
1601
+ };
1602
+ for (let p = 0; p < length; p++) {
1603
+ lastChar = char;
1604
+ char = expression.charAt(p);
1605
+ if ((char === "'" || char === '"') && lastChar !== "\\" && (depth === 0 && !quote || depth && !parenQuote)) {
1606
+ if (depth) {
1607
+ parenQuote = char;
1608
+ } else {
1609
+ quote = char;
1610
+ }
1611
+ addTo(depth, char);
1612
+ continue;
1613
+ } else if (quote && (char !== quote || lastChar === "\\") || parenQuote && (char !== parenQuote || lastChar === "\\")) {
1614
+ addTo(depth, char);
1615
+ continue;
1616
+ } else if (quote === char) {
1617
+ quote = false;
1618
+ addTo(depth, char);
1619
+ continue;
1620
+ } else if (parenQuote === char) {
1621
+ parenQuote = false;
1622
+ addTo(depth, char);
1623
+ continue;
1624
+ } else if (char === " ") {
1625
+ continue;
1626
+ } else if (char === "(") {
1627
+ if (depth === 0) {
1628
+ startP = p;
1629
+ } else {
1630
+ parenthetical += char;
1631
+ }
1632
+ depth++;
1633
+ } else if (char === ")") {
1634
+ depth--;
1635
+ if (depth === 0) {
1636
+ const fn = typeof operand === "string" && operand.startsWith("$") ? operand : void 0;
1637
+ const hasTail = fn && expression.charAt(p + 1) === ".";
1638
+ let tail = "";
1639
+ if (hasTail) {
1640
+ [tail, p] = getTail(p + 2, expression);
1641
+ }
1642
+ const lStep = op ? step : getStep(startP, expression, 0);
1643
+ const rStep = getStep(p, expression);
1644
+ if (lStep === -1 && rStep === -1) {
1645
+ operand = evaluate(parenthetical, -1, fn, tail);
1646
+ } else if (op && (lStep >= rStep || rStep === -1) && step === lStep) {
1647
+ left = op.bind(null, evaluate(parenthetical, -1, fn, tail));
1648
+ op = null;
1649
+ operand = "";
1650
+ } else if (rStep > lStep && step === rStep) {
1651
+ operand = evaluate(parenthetical, -1, fn, tail);
1652
+ } else {
1653
+ operand += `(${parenthetical})${hasTail ? `.${tail}` : ""}`;
1654
+ }
1655
+ parenthetical = "";
1656
+ } else {
1657
+ parenthetical += char;
1658
+ }
1659
+ } else if (depth === 0 && (operation = getOp(symbols, char, p, expression))) {
1660
+ if (p === 0) {
1661
+ error(103, [operation, expression]);
1662
+ }
1663
+ p += operation.length - 1;
1664
+ if (p === expression.length - 1) {
1665
+ error(104, [operation, expression]);
1666
+ }
1667
+ if (!op) {
1668
+ if (left) {
1669
+ op = operators[operation].bind(null, evaluate(left, step));
1670
+ left = null;
1671
+ } else {
1672
+ op = operators[operation].bind(null, evaluate(operand, step));
1673
+ operand = "";
1674
+ }
1675
+ } else if (operand) {
1676
+ left = op.bind(null, evaluate(operand, step));
1677
+ op = operators[operation].bind(null, left);
1678
+ operand = "";
1679
+ }
1680
+ continue;
1681
+ } else {
1682
+ addTo(depth, char);
1683
+ }
1684
+ }
1685
+ if (operand && op) {
1686
+ op = op.bind(null, evaluate(operand, step));
1687
+ }
1688
+ op = !op && left ? left : op;
1689
+ if (!op && operand) {
1690
+ op = (v, t) => {
1691
+ return typeof v === "function" ? v(t) : v;
1692
+ };
1693
+ op = op.bind(null, evaluate(operand, step));
1694
+ }
1695
+ if (!op && !operand) {
1696
+ error(105, expression);
1697
+ }
1698
+ return op;
1699
+ }
1700
+ function evaluate(operand, step, fnToken, tail) {
1701
+ if (fnToken) {
1702
+ const fn = evaluate(fnToken, operatorRegistry.length);
1703
+ let userFuncReturn;
1704
+ let tailCall = tail ? compile(`$${tail}`) : false;
1705
+ if (typeof fn === "function") {
1706
+ const args = parseArgs(String(operand)).map((arg) => evaluate(arg, -1));
1707
+ return (tokens) => {
1708
+ const userFunc = fn(tokens);
1709
+ if (typeof userFunc !== "function") {
1710
+ warn(150, fnToken);
1711
+ return userFunc;
1712
+ }
1713
+ userFuncReturn = userFunc(...args.map((arg) => typeof arg === "function" ? arg(tokens) : arg));
1714
+ if (tailCall) {
1715
+ tailCall = tailCall.provide((subTokens) => {
1716
+ const rootTokens = provideTokens(subTokens);
1717
+ const t = subTokens.reduce((tokenSet, token2) => {
1718
+ const isTail = token2 === tail || (tail === null || tail === void 0 ? void 0 : tail.startsWith(`${token2}(`));
1719
+ if (isTail) {
1720
+ const value = getAt(userFuncReturn, token2);
1721
+ tokenSet[token2] = () => value;
1722
+ } else {
1723
+ tokenSet[token2] = rootTokens[token2];
1724
+ }
1725
+ return tokenSet;
1726
+ }, {});
1727
+ return t;
1728
+ });
1729
+ }
1730
+ return tailCall ? tailCall() : userFuncReturn;
1731
+ };
1732
+ }
1733
+ } else if (typeof operand === "string") {
1734
+ if (operand === "true")
1735
+ return true;
1736
+ if (operand === "false")
1737
+ return false;
1738
+ if (operand === "undefined")
1739
+ return void 0;
1740
+ if (isQuotedString(operand))
1741
+ return rmEscapes(operand.substring(1, operand.length - 1));
1742
+ if (!isNaN(+operand))
1743
+ return Number(operand);
1744
+ if (step < operatorRegistry.length - 1) {
1745
+ return parseLogicals(operand, step + 1);
1746
+ } else {
1747
+ if (operand.startsWith("$")) {
1748
+ const cleaned = operand.substring(1);
1749
+ requirements.add(cleaned);
1750
+ return function getToken(tokens) {
1751
+ return cleaned in tokens ? tokens[cleaned]() : void 0;
1752
+ };
1753
+ }
1754
+ return operand;
1755
+ }
1756
+ }
1757
+ return operand;
1758
+ }
1759
+ const compiled = parseLogicals(expr.startsWith("$:") ? expr.substring(2) : expr);
1760
+ const reqs = Array.from(requirements);
1761
+ function provide2(callback) {
1762
+ provideTokens = callback;
1763
+ return Object.assign(compiled.bind(null, callback(reqs)), {
1764
+ provide: provide2
1765
+ });
1766
+ }
1767
+ return Object.assign(compiled, {
1768
+ provide: provide2
1769
+ });
1770
+ }
1771
+ const outer = composable("outer", () => ({
1772
+ $el: "div",
1773
+ attrs: {
1774
+ class: "$classes.outer",
1775
+ "data-type": "$type",
1776
+ "data-multiple": "$attrs.multiple",
1777
+ "data-disabled": "$disabled || undefined",
1778
+ "data-complete": "$state.complete || undefined",
1779
+ "data-invalid": "$state.valid === false && $state.validationVisible || undefined",
1780
+ "data-errors": "$state.errors || undefined",
1781
+ "data-submitted": "$state.submitted || undefined"
1782
+ }
1783
+ }));
1784
+ const wrapper$2 = composable("wrapper", () => ({
1785
+ $el: "div",
1786
+ attrs: {
1787
+ class: "$classes.wrapper"
1788
+ }
1789
+ }));
1790
+ const inner = composable("inner", () => ({
1791
+ $el: "div",
1792
+ attrs: {
1793
+ class: "$classes.inner"
1794
+ }
1795
+ }));
1796
+ const help = (schema = {}, children = [], target = "help", cond = "$help") => ({
1797
+ if: `$slots.${target}`,
1798
+ then: `$slots.${target}`,
1799
+ else: extend({
1800
+ $el: "div",
1801
+ attrs: {
1802
+ id: `$: "help-" + ${target == "optionHelp" ? "$option.attrs.id" : "$id"}`,
1803
+ class: `$classes.${target}`
1804
+ },
1805
+ if: cond,
1806
+ children
1807
+ }, schema)
1808
+ });
1809
+ const messages = composable("messages", () => ({
1810
+ $el: "ul",
1811
+ if: "$fns.length($messages)",
1812
+ attrs: {
1813
+ class: "$classes.messages",
1814
+ "aria-live": '$type === "form" && "assertive" || "polite"'
1815
+ }
1816
+ }));
1817
+ const message = composable("message", () => ({
1818
+ $el: "li",
1819
+ for: ["message", "$messages"],
1820
+ attrs: {
1821
+ key: "$message.key",
1822
+ class: "$classes.message",
1823
+ id: `$id + '-' + $message.key`,
1824
+ "data-message-type": "$message.type"
1825
+ }
1826
+ }));
1827
+ const prefix = composable("prefix", () => ({ $el: null }));
1828
+ const suffix = composable("suffix", () => ({ $el: null }));
1829
+ function isSchemaObject(schema) {
1830
+ return typeof schema === "object" && ("$el" in schema || "$cmp" in schema || "$formkit" in schema);
1831
+ }
1832
+ function extendSchema(schema, extension = {}) {
1833
+ if (typeof schema === "string") {
1834
+ return isSchemaObject(extension) || typeof extension === "string" ? extension : schema;
1835
+ } else if (Array.isArray(schema)) {
1836
+ return isSchemaObject(extension) ? extension : schema;
1837
+ }
1838
+ return extend(schema, extension);
1839
+ }
1840
+ function composable(key, schema) {
1841
+ return (extendWith = {}, children = void 0) => {
1842
+ const root = typeof schema === "function" ? schema(children) : typeof schema === "object" ? clone(schema) : schema;
1843
+ const isObj = isSchemaObject(root);
1844
+ if (isObj && !("children" in root) && children) {
1845
+ if (Array.isArray(children)) {
1846
+ if (children.length) {
1847
+ root.children = children;
1848
+ }
1849
+ } else {
1850
+ root.children = [children];
1851
+ }
1852
+ }
1853
+ const extended = extendSchema(root, extendWith);
1854
+ return {
1855
+ if: `$slots.${key}`,
1856
+ then: `$slots.${key}`,
1857
+ else: Array.isArray(extended) ? extended : [extended]
1858
+ };
1859
+ };
1860
+ }
1861
+ function useSchema(inputSchema) {
1862
+ return (extensions = {}) => {
1863
+ const input2 = composable("input", inputSchema)(extensions.input);
1864
+ return [
1865
+ outer(extensions.outer, [
1866
+ wrapper$2(extensions.wrapper, [
1867
+ label(extensions.label, "$label"),
1868
+ inner(extensions.inner, [
1869
+ prefix(extensions.prefix),
1870
+ ...Array.isArray(input2) ? input2 : [input2],
1871
+ suffix(extensions.suffix)
1872
+ ])
1873
+ ]),
1874
+ help(extensions.help, "$help"),
1875
+ messages(extensions.messages, [
1876
+ message(extensions.message, "$message.value")
1877
+ ])
1878
+ ])
1879
+ ];
1880
+ };
1881
+ }
1882
+ const label = composable("label", () => ({
1883
+ $el: "label",
1884
+ if: "$label",
1885
+ attrs: {
1886
+ for: "$id",
1887
+ class: "$classes.label"
1888
+ }
1889
+ }));
1890
+ createMessage({
1891
+ type: "state",
1892
+ blocking: true,
1893
+ visible: false,
1894
+ value: true,
1895
+ key: "validating"
1896
+ });
1897
+ let registered = false;
1898
+ const errors = {
1899
+ 100: ({ data: node }) => `Only groups, lists, and forms can have children (${node.name}).`,
1900
+ 101: ({ data: node }) => `You cannot directly modify the store (${node.name}). See: https://formkit.com/advanced/core#message-store`,
1901
+ 102: ({ data: [node, property] }) => `You cannot directly assign node.${property} (${node.name})`,
1902
+ 103: ({ data: [operator] }) => `Schema expressions cannot start with an operator (${operator})`,
1903
+ 104: ({ data: [operator, expression] }) => `Schema expressions cannot end with an operator (${operator} in "${expression}")`,
1904
+ 105: ({ data: expression }) => `Invalid schema expression: ${expression}`,
1905
+ 106: ({ data: name }) => `Cannot submit because (${name}) is not in a form.`,
1906
+ 107: ({ data: [node, value] }) => `Cannot set ${node.name} to non object value: ${value}`,
1907
+ 108: ({ data: [node, value] }) => `Cannot set ${node.name} to non array value: ${value}`,
1908
+ 600: ({ data: node }) => `Unknown input type${typeof node.props.type === "string" ? ' "' + node.props.type + '"' : ""} ("${node.name}")`,
1909
+ 601: ({ data: node }) => `Input definition${typeof node.props.type === "string" ? ' "' + node.props.type + '"' : ""} is missing a schema or component property (${node.name}).`
1910
+ };
1911
+ const warnings = {
1912
+ 150: ({ data: fn }) => `Schema function "${fn}()" is not a valid function.`,
1913
+ 151: ({ data: id }) => `No form element with id: ${id}`,
1914
+ 152: ({ data: id }) => `No input element with id: ${id}`,
1915
+ 350: ({ data: node }) => `Invalid options prop for radio input (${node.name}). See https://formkit.com/inputs/radio`,
1916
+ 650: 'Schema "$get()" must use the id of an input to access.',
1917
+ 651: ({ data: id }) => `Cannot setErrors() on "${id}" because no such id exists.`,
1918
+ 652: ({ data: id }) => `Cannot clearErrors() on "${id}" because no such id exists.`
1919
+ };
1920
+ const decodeErrors = (error2, next) => {
1921
+ if (error2.code in errors) {
1922
+ const err = errors[error2.code];
1923
+ error2.message = typeof err === "function" ? err(error2) : err;
1924
+ }
1925
+ return next(error2);
1926
+ };
1927
+ if (!registered)
1928
+ errorHandler(decodeErrors);
1929
+ const decodeWarnings = (warning, next) => {
1930
+ if (warning.code in warnings) {
1931
+ const warn2 = warnings[warning.code];
1932
+ warning.message = typeof warn2 === "function" ? warn2(warning) : warn2;
1933
+ }
1934
+ return next(warning);
1935
+ };
1936
+ if (!registered)
1937
+ warningHandler(decodeWarnings);
1938
+ registered = true;
1939
+ const memo = {};
1940
+ let instanceKey;
1941
+ const instanceScopes = /* @__PURE__ */ new Map();
1942
+ const raw = "__raw__";
1943
+ const isClassProp = /[a-zA-Z0-9\-][cC]lass$/;
1944
+ function getRef(token2, data) {
1945
+ const value = ref(null);
1946
+ if (token2 === "get") {
1947
+ const nodeRefs = {};
1948
+ value.value = get$1.bind(null, nodeRefs);
1949
+ return value;
1950
+ }
1951
+ const path = token2.split(".");
1952
+ watchEffect(() => value.value = getValue(data, path));
1953
+ return value;
1954
+ }
1955
+ function getValue(set, path) {
1956
+ if (Array.isArray(set)) {
1957
+ for (const subset of set) {
1958
+ const value = subset !== false && getValue(subset, path);
1959
+ if (value !== void 0)
1960
+ return value;
1961
+ }
1962
+ return void 0;
1963
+ }
1964
+ let foundValue = void 0;
1965
+ path.reduce((obj, segment, i2, arr) => {
1966
+ if (typeof obj !== "object") {
1967
+ foundValue = void 0;
1968
+ return arr.splice(1);
1969
+ }
1970
+ const currentValue = obj[segment];
1971
+ if (i2 === path.length - 1 && currentValue !== void 0) {
1972
+ foundValue = currentValue;
1973
+ }
1974
+ return obj[segment];
1975
+ }, set);
1976
+ return foundValue;
1977
+ }
1978
+ function get$1(nodeRefs, id) {
1979
+ if (typeof id !== "string")
1980
+ return warn(650);
1981
+ if (!(id in nodeRefs))
1982
+ nodeRefs[id] = ref(void 0);
1983
+ if (nodeRefs[id].value === void 0) {
1984
+ nodeRefs[id].value = null;
1985
+ const root = getNode$1(id);
1986
+ if (root)
1987
+ nodeRefs[id].value = root.context;
1988
+ watchRegistry(id, ({ payload: node }) => {
1989
+ nodeRefs[id].value = isNode(node) ? node.context : node;
1990
+ });
1991
+ }
1992
+ return nodeRefs[id].value;
1993
+ }
1994
+ function parseSchema(library, schema) {
1995
+ function parseCondition2(library2, node) {
1996
+ const condition = provider(compile(node.if), { if: true });
1997
+ const children = createElements(library2, node.then);
1998
+ const alternate = node.else ? createElements(library2, node.else) : null;
1999
+ return [condition, children, alternate];
2000
+ }
2001
+ function parseConditionAttr(attr, _default) {
2002
+ var _a, _b;
2003
+ const condition = provider(compile(attr.if));
2004
+ let b = () => _default;
2005
+ let a = () => _default;
2006
+ if (typeof attr.then === "object") {
2007
+ a = parseAttrs(attr.then, void 0);
2008
+ } else if (typeof attr.then === "string" && ((_a = attr.then) === null || _a === void 0 ? void 0 : _a.startsWith("$"))) {
2009
+ a = provider(compile(attr.then));
2010
+ } else {
2011
+ a = () => attr.then;
2012
+ }
2013
+ if (has(attr, "else")) {
2014
+ if (typeof attr.else === "object") {
2015
+ b = parseAttrs(attr.else);
2016
+ } else if (typeof attr.else === "string" && ((_b = attr.else) === null || _b === void 0 ? void 0 : _b.startsWith("$"))) {
2017
+ b = provider(compile(attr.else));
2018
+ } else {
2019
+ b = () => attr.else;
2020
+ }
2021
+ }
2022
+ return () => condition() ? a() : b();
2023
+ }
2024
+ function parseAttrs(unparsedAttrs, bindExp, _default = {}) {
2025
+ const explicitAttrs = new Set(Object.keys(unparsedAttrs || {}));
2026
+ const boundAttrs = bindExp ? provider(compile(bindExp)) : () => ({});
2027
+ const setters = [
2028
+ (attrs) => {
2029
+ const bound = boundAttrs();
2030
+ for (const attr in bound) {
2031
+ if (!explicitAttrs.has(attr)) {
2032
+ attrs[attr] = bound[attr];
2033
+ }
2034
+ }
2035
+ }
2036
+ ];
2037
+ if (unparsedAttrs) {
2038
+ if (isConditional(unparsedAttrs)) {
2039
+ const condition = parseConditionAttr(unparsedAttrs, _default);
2040
+ return condition;
2041
+ }
2042
+ for (let attr in unparsedAttrs) {
2043
+ const value = unparsedAttrs[attr];
2044
+ let getValue2;
2045
+ const isStr = typeof value === "string";
2046
+ if (attr.startsWith(raw)) {
2047
+ attr = attr.substring(7);
2048
+ getValue2 = () => value;
2049
+ } else if (isStr && value.startsWith("$") && value.length > 1 && !(value.startsWith("$reset") && isClassProp.test(attr))) {
2050
+ getValue2 = provider(compile(value));
2051
+ } else if (typeof value === "object" && isConditional(value)) {
2052
+ getValue2 = parseConditionAttr(value, void 0);
2053
+ } else if (typeof value === "object" && isPojo(value)) {
2054
+ getValue2 = parseAttrs(value);
2055
+ } else {
2056
+ getValue2 = () => value;
2057
+ }
2058
+ setters.push((attrs) => {
2059
+ attrs[attr] = getValue2();
2060
+ });
2061
+ }
2062
+ }
2063
+ return () => {
2064
+ const attrs = {};
2065
+ setters.forEach((setter) => setter(attrs));
2066
+ return attrs;
2067
+ };
2068
+ }
2069
+ function parseNode(library2, _node) {
2070
+ let element = null;
2071
+ let attrs = () => null;
2072
+ let condition = false;
2073
+ let children = null;
2074
+ let alternate = null;
2075
+ let iterator = null;
2076
+ let resolve = false;
2077
+ const node = sugar(_node);
2078
+ if (isDOM(node)) {
2079
+ element = node.$el;
2080
+ attrs = node.$el !== "text" ? parseAttrs(node.attrs, node.bind) : () => null;
2081
+ } else if (isComponent$1(node)) {
2082
+ if (typeof node.$cmp === "string") {
2083
+ if (has(library2, node.$cmp)) {
2084
+ element = library2[node.$cmp];
2085
+ } else {
2086
+ element = node.$cmp;
2087
+ resolve = true;
2088
+ }
2089
+ } else {
2090
+ element = node.$cmp;
2091
+ }
2092
+ attrs = parseAttrs(node.props, node.bind);
2093
+ } else if (isConditional(node)) {
2094
+ [condition, children, alternate] = parseCondition2(library2, node);
2095
+ }
2096
+ if (!isConditional(node) && "if" in node) {
2097
+ condition = provider(compile(node.if));
2098
+ } else if (!isConditional(node) && element === null) {
2099
+ condition = () => true;
2100
+ }
2101
+ if ("children" in node && node.children) {
2102
+ if (typeof node.children === "string") {
2103
+ if (node.children.startsWith("$slots.")) {
2104
+ element = element === "text" ? "slot" : element;
2105
+ children = provider(compile(node.children));
2106
+ } else if (node.children.startsWith("$") && node.children.length > 1) {
2107
+ const value = provider(compile(node.children));
2108
+ children = () => String(value());
2109
+ } else {
2110
+ children = () => String(node.children);
2111
+ }
2112
+ } else if (Array.isArray(node.children)) {
2113
+ children = createElements(library2, node.children);
2114
+ } else {
2115
+ const [childCondition, c, a] = parseCondition2(library2, node.children);
2116
+ children = (iterationData) => childCondition && childCondition() ? c && c(iterationData) : a && a(iterationData);
2117
+ }
2118
+ }
2119
+ if (isComponent$1(node)) {
2120
+ if (children) {
2121
+ const produceChildren = children;
2122
+ children = (iterationData) => {
2123
+ return {
2124
+ default(slotData2, key) {
2125
+ var _a, _b, _c, _d;
2126
+ const currentKey = instanceKey;
2127
+ if (key)
2128
+ instanceKey = key;
2129
+ if (slotData2)
2130
+ (_a = instanceScopes.get(instanceKey)) === null || _a === void 0 ? void 0 : _a.unshift(slotData2);
2131
+ if (iterationData)
2132
+ (_b = instanceScopes.get(instanceKey)) === null || _b === void 0 ? void 0 : _b.unshift(iterationData);
2133
+ const c = produceChildren(iterationData);
2134
+ if (slotData2)
2135
+ (_c = instanceScopes.get(instanceKey)) === null || _c === void 0 ? void 0 : _c.shift();
2136
+ if (iterationData)
2137
+ (_d = instanceScopes.get(instanceKey)) === null || _d === void 0 ? void 0 : _d.shift();
2138
+ instanceKey = currentKey;
2139
+ return c;
2140
+ }
2141
+ };
2142
+ };
2143
+ children.slot = true;
2144
+ } else {
2145
+ children = () => ({});
2146
+ }
2147
+ }
2148
+ if ("for" in node && node.for) {
2149
+ const values = node.for.length === 3 ? node.for[2] : node.for[1];
2150
+ const getValues = typeof values === "string" && values.startsWith("$") ? provider(compile(values)) : () => values;
2151
+ iterator = [
2152
+ getValues,
2153
+ node.for[0],
2154
+ node.for.length === 3 ? String(node.for[1]) : null
2155
+ ];
2156
+ }
2157
+ return [condition, element, attrs, children, alternate, iterator, resolve];
2158
+ }
2159
+ function createSlots(children, iterationData) {
2160
+ const slots = children(iterationData);
2161
+ const currentKey = instanceKey;
2162
+ return Object.keys(slots).reduce((allSlots, slotName) => {
2163
+ const slotFn = slots && slots[slotName];
2164
+ allSlots[slotName] = (data) => {
2165
+ return slotFn && slotFn(data, currentKey) || null;
2166
+ };
2167
+ return allSlots;
2168
+ }, {});
2169
+ }
2170
+ function createElement(library2, node) {
2171
+ const [condition, element, attrs, children, alternate, iterator, resolve] = parseNode(library2, node);
2172
+ let createNodes = (iterationData) => {
2173
+ if (condition && element === null && children) {
2174
+ return condition() ? children(iterationData) : alternate && alternate(iterationData);
2175
+ }
2176
+ if (element && (!condition || condition())) {
2177
+ if (element === "text" && children) {
2178
+ return createTextVNode(String(children()));
2179
+ }
2180
+ if (element === "slot" && children)
2181
+ return children(iterationData);
2182
+ const el = resolve ? resolveComponent(element) : element;
2183
+ const slots = (children === null || children === void 0 ? void 0 : children.slot) ? createSlots(children, iterationData) : null;
2184
+ return h(el, attrs(), slots || (children ? children(iterationData) : []));
2185
+ }
2186
+ return typeof alternate === "function" ? alternate(iterationData) : alternate;
2187
+ };
2188
+ if (iterator) {
2189
+ const repeatedNode = createNodes;
2190
+ const [getValues, valueName, keyName] = iterator;
2191
+ createNodes = () => {
2192
+ const _v = getValues();
2193
+ const values = !isNaN(_v) ? Array(Number(_v)).fill(0).map((_, i2) => i2) : _v;
2194
+ const fragment = [];
2195
+ if (typeof values !== "object")
2196
+ return null;
2197
+ const instanceScope = instanceScopes.get(instanceKey) || [];
2198
+ for (const key in values) {
2199
+ const iterationData = Object.defineProperty(__spreadValues(__spreadProps(__spreadValues({}, instanceScope.reduce((previousIterationData, scopedData) => {
2200
+ if (previousIterationData.__idata) {
2201
+ return __spreadValues(__spreadValues({}, previousIterationData), scopedData);
2202
+ }
2203
+ return scopedData;
2204
+ }, {})), {
2205
+ [valueName]: values[key]
2206
+ }), keyName !== null ? { [keyName]: key } : {}), "__idata", { enumerable: false, value: true });
2207
+ instanceScope.unshift(iterationData);
2208
+ fragment.push(repeatedNode.bind(null, iterationData)());
2209
+ instanceScope.shift();
2210
+ }
2211
+ return fragment;
2212
+ };
2213
+ }
2214
+ return createNodes;
2215
+ }
2216
+ function createElements(library2, schema2) {
2217
+ if (Array.isArray(schema2)) {
2218
+ const els = schema2.map(createElement.bind(null, library2));
2219
+ return (iterationData) => els.map((element2) => element2(iterationData));
2220
+ }
2221
+ const element = createElement(library2, schema2);
2222
+ return (iterationData) => element(iterationData);
2223
+ }
2224
+ const providers = [];
2225
+ function provider(compiled, hints = {}) {
2226
+ const compiledFns = {};
2227
+ providers.push((callback, key) => {
2228
+ compiledFns[key] = compiled.provide((tokens) => callback(tokens, hints));
2229
+ });
2230
+ return () => compiledFns[instanceKey]();
2231
+ }
2232
+ return function createInstance(providerCallback, key) {
2233
+ const memoKey = JSON.stringify(schema);
2234
+ const [render, compiledProviders] = has(memo, memoKey) ? memo[memoKey] : [createElements(library, schema), providers];
2235
+ memo[memoKey] = [render, compiledProviders];
2236
+ compiledProviders.forEach((compiledProvider) => {
2237
+ compiledProvider(providerCallback, key);
2238
+ });
2239
+ return () => {
2240
+ instanceKey = key;
2241
+ return render();
2242
+ };
2243
+ };
2244
+ }
2245
+ function useScope(token2, defaultValue) {
2246
+ const scopedData = instanceScopes.get(instanceKey) || [];
2247
+ let scopedValue = void 0;
2248
+ if (scopedData.length) {
2249
+ scopedValue = getValue(scopedData, token2.split("."));
2250
+ }
2251
+ return scopedValue === void 0 ? defaultValue : scopedValue;
2252
+ }
2253
+ function slotData(data, key) {
2254
+ return new Proxy(data, {
2255
+ get(...args) {
2256
+ let data2 = void 0;
2257
+ const property = args[1];
2258
+ if (typeof property === "string") {
2259
+ const prevKey = instanceKey;
2260
+ instanceKey = key;
2261
+ data2 = useScope(property, void 0);
2262
+ instanceKey = prevKey;
2263
+ }
2264
+ return data2 !== void 0 ? data2 : Reflect.get(...args);
2265
+ }
2266
+ });
2267
+ }
2268
+ function createRenderFn(instanceCreator, data, instanceKey2) {
2269
+ return instanceCreator((requirements, hints = {}) => {
2270
+ return requirements.reduce((tokens, token2) => {
2271
+ if (token2.startsWith("slots.")) {
2272
+ const slot = token2.substring(6);
2273
+ const hasSlot = data.slots && has(data.slots, slot);
2274
+ if (hints.if) {
2275
+ tokens[token2] = () => hasSlot;
2276
+ } else if (data.slots && hasSlot) {
2277
+ const scopedData = slotData(data, instanceKey2);
2278
+ tokens[token2] = () => data.slots[slot](scopedData);
2279
+ return tokens;
2280
+ }
2281
+ }
2282
+ const value = getRef(token2, data);
2283
+ tokens[token2] = () => useScope(token2, value.value);
2284
+ return tokens;
2285
+ }, {});
2286
+ }, instanceKey2);
2287
+ }
2288
+ let i = 0;
2289
+ const FormKitSchema = defineComponent({
2290
+ name: "FormKitSchema",
2291
+ props: {
2292
+ schema: {
2293
+ type: [Array, Object],
2294
+ required: true
2295
+ },
2296
+ data: {
2297
+ type: Object,
2298
+ default: () => ({})
2299
+ },
2300
+ library: {
2301
+ type: Object,
2302
+ default: () => ({})
2303
+ }
2304
+ },
2305
+ setup(props2, context) {
2306
+ const instance = getCurrentInstance();
2307
+ let instanceKey2 = Symbol(String(i++));
2308
+ instanceScopes.set(instanceKey2, []);
2309
+ let provider = parseSchema(props2.library, props2.schema);
2310
+ let render;
2311
+ let data;
2312
+ watch(() => props2.schema, (newSchema, oldSchema) => {
2313
+ var _a;
2314
+ instanceKey2 = Symbol(String(i++));
2315
+ provider = parseSchema(props2.library, props2.schema);
2316
+ render = createRenderFn(provider, data, instanceKey2);
2317
+ if (newSchema === oldSchema) {
2318
+ ((_a = instance === null || instance === void 0 ? void 0 : instance.proxy) === null || _a === void 0 ? void 0 : _a.$forceUpdate)();
2319
+ }
2320
+ }, { deep: true });
2321
+ watchEffect(() => {
2322
+ data = Object.assign(reactive(props2.data), {
2323
+ slots: context.slots
2324
+ });
2325
+ render = createRenderFn(provider, data, instanceKey2);
2326
+ });
2327
+ return () => render();
2328
+ }
2329
+ });
2330
+ const nativeProps = {
2331
+ config: {
2332
+ type: Object,
2333
+ default: {}
2334
+ },
2335
+ classes: {
2336
+ type: Object,
2337
+ required: false
2338
+ },
2339
+ delay: {
2340
+ type: Number,
2341
+ required: false
2342
+ },
2343
+ errors: {
2344
+ type: Array,
2345
+ default: []
2346
+ },
2347
+ inputErrors: {
2348
+ type: Object,
2349
+ default: () => ({})
2350
+ },
2351
+ index: {
2352
+ type: Number,
2353
+ required: false
2354
+ },
2355
+ id: {
2356
+ type: String,
2357
+ required: false
2358
+ },
2359
+ modelValue: {
2360
+ required: false
2361
+ },
2362
+ name: {
2363
+ type: String,
2364
+ required: false
2365
+ },
2366
+ parent: {
2367
+ type: Object,
2368
+ required: false
2369
+ },
2370
+ plugins: {
2371
+ type: Array,
2372
+ default: []
2373
+ },
2374
+ sectionsSchema: {
2375
+ type: Object,
2376
+ default: {}
2377
+ },
2378
+ type: {
2379
+ type: [String, Object],
2380
+ default: "text"
2381
+ },
2382
+ validation: {
2383
+ type: [String, Array],
2384
+ required: false
2385
+ },
2386
+ validationMessages: {
2387
+ type: Object,
2388
+ required: false
2389
+ },
2390
+ validationRules: {
2391
+ type: Object,
2392
+ required: false
2393
+ },
2394
+ validationLabel: {
2395
+ type: [String, Function],
2396
+ required: false
2397
+ }
2398
+ };
2399
+ const props = nativeProps;
2400
+ const parentSymbol = Symbol("FormKitParent");
2401
+ defineComponent({
2402
+ props,
2403
+ emits: {
2404
+ input: (_value, _node) => true,
2405
+ inputRaw: (_value, _node) => true,
2406
+ "update:modelValue": (_value) => true,
2407
+ node: (node) => !!node,
2408
+ submit: (_data, _node) => true,
2409
+ submitRaw: (_event, _node) => true
2410
+ },
2411
+ inheritAttrs: false,
2412
+ setup(props2, context) {
2413
+ const node = useInput(props2, context);
2414
+ if (!node.props.definition)
2415
+ error(600, node);
2416
+ if (node.props.definition.component) {
2417
+ return () => {
2418
+ var _a;
2419
+ return h((_a = node.props.definition) === null || _a === void 0 ? void 0 : _a.component, {
2420
+ context: node.context
2421
+ }, __spreadValues({}, context.slots));
2422
+ };
2423
+ }
2424
+ const schema = ref([]);
2425
+ const generateSchema = () => {
2426
+ var _a, _b;
2427
+ const schemaDefinition = (_b = (_a = node.props) === null || _a === void 0 ? void 0 : _a.definition) === null || _b === void 0 ? void 0 : _b.schema;
2428
+ if (!schemaDefinition)
2429
+ error(601, node);
2430
+ schema.value = typeof schemaDefinition === "function" ? schemaDefinition(__spreadValues({}, props2.sectionsSchema)) : schemaDefinition;
2431
+ };
2432
+ generateSchema();
2433
+ node.on("schema", generateSchema);
2434
+ context.emit("node", node);
2435
+ const library = node.props.definition.library;
2436
+ context.expose({ node });
2437
+ return () => h(FormKitSchema, { schema: schema.value, data: node.context, library }, __spreadValues({}, context.slots));
2438
+ }
2439
+ });
2440
+ const optionsSymbol = Symbol.for("FormKitOptions");
2441
+ const invalidGet = Symbol();
2442
+ function watchVerbose(obj, callback) {
2443
+ const watchers = {};
2444
+ const applyWatch = (paths) => {
2445
+ for (const path of paths) {
2446
+ if (path.__str in watchers)
2447
+ watchers[path.__str]();
2448
+ watchers[path.__str] = watch(touch.bind(null, obj, path), dispatcher.bind(null, path), { deep: false });
2449
+ }
2450
+ };
2451
+ const clearWatch = (path) => {
2452
+ if (!path.length)
2453
+ return;
2454
+ for (const key in watchers) {
2455
+ if (`${key}`.startsWith(`${path.__str}.`)) {
2456
+ watchers[key]();
2457
+ delete watchers[key];
2458
+ }
2459
+ }
2460
+ };
2461
+ const dispatcher = createDispatcher(obj, callback, applyWatch, clearWatch);
2462
+ applyWatch(getPaths(obj));
2463
+ }
2464
+ function createDispatcher(obj, callback, applyWatch, clearChildWatches) {
2465
+ return (path) => {
2466
+ const value = get(obj, path);
2467
+ if (value === invalidGet)
2468
+ return;
2469
+ if (path.__deep)
2470
+ clearChildWatches(path);
2471
+ if (typeof value === "object")
2472
+ applyWatch(getPaths(value, [path], ...path));
2473
+ callback(path, value, obj);
2474
+ };
2475
+ }
2476
+ function touch(obj, path) {
2477
+ const value = get(obj, path);
2478
+ return value && typeof value === "object" ? Object.keys(value) : value;
2479
+ }
2480
+ function get(obj, path) {
2481
+ if (isRef(obj)) {
2482
+ if (path.length === 0)
2483
+ return obj.value;
2484
+ obj = obj.value;
2485
+ }
2486
+ return path.reduce((value, segment) => {
2487
+ if (value === invalidGet)
2488
+ return value;
2489
+ if (value === null || typeof value !== "object") {
2490
+ return invalidGet;
2491
+ }
2492
+ return value[segment];
2493
+ }, obj);
2494
+ }
2495
+ function getPaths(obj, paths = [], ...parents) {
2496
+ if (obj === null)
2497
+ return paths;
2498
+ if (!parents.length) {
2499
+ const path = Object.defineProperty([], "__str", {
2500
+ value: ""
2501
+ });
2502
+ obj = isRef(obj) ? obj.value : obj;
2503
+ if (obj && typeof obj === "object") {
2504
+ Object.defineProperty(path, "__deep", { value: true });
2505
+ paths.push(path);
2506
+ } else {
2507
+ return [path];
2508
+ }
2509
+ }
2510
+ if (obj === null || typeof obj !== "object")
2511
+ return paths;
2512
+ for (const key in obj) {
2513
+ const path = parents.concat(key);
2514
+ Object.defineProperty(path, "__str", { value: path.join(".") });
2515
+ const value = obj[key];
2516
+ if (isPojo(value) || Array.isArray(value)) {
2517
+ paths.push(Object.defineProperty(path, "__deep", { value: true }));
2518
+ paths = paths.concat(getPaths(value, [], ...path));
2519
+ } else {
2520
+ paths.push(path);
2521
+ }
2522
+ }
2523
+ return paths;
2524
+ }
2525
+ function useRaw(obj) {
2526
+ if (obj === null || typeof obj !== "object")
2527
+ return obj;
2528
+ if (isReactive(obj)) {
2529
+ obj = toRaw(obj);
2530
+ } else if (isRef(obj)) {
2531
+ obj = isReactive(obj.value) ? useRaw(obj.value) : obj.value;
2532
+ }
2533
+ return obj;
2534
+ }
2535
+ const pseudoProps = [
2536
+ "help",
2537
+ "label",
2538
+ "ignore",
2539
+ "disabled",
2540
+ "preserve",
2541
+ /^preserve(-e|E)rrors/,
2542
+ /^[a-z]+(?:-visibility|Visibility)$/,
2543
+ /^[a-zA-Z-]+(?:-class|Class)$/
2544
+ ];
2545
+ function classesToNodeProps(node, props2) {
2546
+ if (props2.classes) {
2547
+ Object.keys(props2.classes).forEach((key) => {
2548
+ if (typeof key === "string") {
2549
+ node.props[`_${key}Class`] = props2.classes[key];
2550
+ if (isObject(props2.classes[key]) && key === "inner")
2551
+ Object.values(props2.classes[key]);
2552
+ }
2553
+ });
2554
+ }
2555
+ }
2556
+ function onlyListeners(props2) {
2557
+ if (!props2)
2558
+ return {};
2559
+ const knownListeners = ["Submit", "SubmitRaw"].reduce((listeners, listener) => {
2560
+ const name = `on${listener}`;
2561
+ if (name in props2) {
2562
+ if (typeof props2[name] === "function") {
2563
+ listeners[name] = props2[name];
2564
+ }
2565
+ }
2566
+ return listeners;
2567
+ }, {});
2568
+ return knownListeners;
2569
+ }
2570
+ function useInput(props2, context, options = {}) {
2571
+ const config = Object.assign({}, inject(optionsSymbol) || {}, options);
2572
+ const instance = getCurrentInstance();
2573
+ const listeners = onlyListeners(instance === null || instance === void 0 ? void 0 : instance.vnode.props);
2574
+ const isVModeled = props2.modelValue !== void 0;
2575
+ const value = props2.modelValue !== void 0 ? props2.modelValue : cloneAny(context.attrs.value);
2576
+ function createInitialProps() {
2577
+ const initialProps2 = __spreadValues(__spreadValues({}, nodeProps(props2)), listeners);
2578
+ const attrs = except(nodeProps(context.attrs), pseudoProps);
2579
+ initialProps2.attrs = attrs;
2580
+ const propValues = only(nodeProps(context.attrs), pseudoProps);
2581
+ for (const propName in propValues) {
2582
+ initialProps2[camel(propName)] = propValues[propName];
2583
+ }
2584
+ const classesProps = { props: {} };
2585
+ classesToNodeProps(classesProps, props2);
2586
+ Object.assign(initialProps2, classesProps.props);
2587
+ if (typeof initialProps2.type !== "string") {
2588
+ initialProps2.definition = initialProps2.type;
2589
+ delete initialProps2.type;
2590
+ }
2591
+ return initialProps2;
2592
+ }
2593
+ const initialProps = createInitialProps();
2594
+ const parent = initialProps.ignore ? null : props2.parent || inject(parentSymbol, null);
2595
+ const node = createNode(extend(config || {}, {
2596
+ name: props2.name || void 0,
2597
+ value,
2598
+ parent,
2599
+ plugins: (config.plugins || []).concat(props2.plugins),
2600
+ config: props2.config,
2601
+ props: initialProps,
2602
+ index: props2.index
2603
+ }, false, true));
2604
+ if (!node.props.definition)
2605
+ error(600, node);
2606
+ const lateBoundProps = ref(new Set(node.props.definition.props || []));
2607
+ node.on("added-props", ({ payload: lateProps }) => {
2608
+ if (Array.isArray(lateProps))
2609
+ lateProps.forEach((newProp) => lateBoundProps.value.add(newProp));
2610
+ });
2611
+ const pseudoPropNames = computed(() => pseudoProps.concat([...lateBoundProps.value]).reduce((names, prop) => {
2612
+ if (typeof prop === "string") {
2613
+ names.push(camel(prop));
2614
+ names.push(kebab(prop));
2615
+ } else {
2616
+ names.push(prop);
2617
+ }
2618
+ return names;
2619
+ }, []));
2620
+ watchEffect(() => classesToNodeProps(node, props2));
2621
+ const passThrough = nodeProps(props2);
2622
+ for (const prop in passThrough) {
2623
+ watch(() => props2[prop], () => {
2624
+ if (props2[prop] !== void 0) {
2625
+ node.props[prop] = props2[prop];
2626
+ }
2627
+ });
2628
+ }
2629
+ const attributeWatchers = /* @__PURE__ */ new Set();
2630
+ const possibleProps = nodeProps(context.attrs);
2631
+ watchEffect(() => {
2632
+ watchAttributes(only(possibleProps, pseudoPropNames.value));
2633
+ });
2634
+ function watchAttributes(attrProps) {
2635
+ attributeWatchers.forEach((stop) => {
2636
+ stop();
2637
+ attributeWatchers.delete(stop);
2638
+ });
2639
+ for (const prop in attrProps) {
2640
+ const camelName = camel(prop);
2641
+ attributeWatchers.add(watch(() => context.attrs[prop], () => {
2642
+ node.props[camelName] = context.attrs[prop];
2643
+ }));
2644
+ }
2645
+ }
2646
+ watchEffect(() => {
2647
+ const attrs = except(nodeProps(context.attrs), pseudoPropNames.value);
2648
+ node.props.attrs = Object.assign({}, node.props.attrs || {}, attrs);
2649
+ });
2650
+ watchEffect(() => {
2651
+ const messages2 = props2.errors.map((error2) => createMessage({
2652
+ key: slugify(error2),
2653
+ type: "error",
2654
+ value: error2,
2655
+ meta: { source: "prop" }
2656
+ }));
2657
+ node.store.apply(messages2, (message2) => message2.type === "error" && message2.meta.source === "prop");
2658
+ });
2659
+ if (node.type !== "input") {
2660
+ const sourceKey = `${node.name}-prop`;
2661
+ watchEffect(() => {
2662
+ const keys = Object.keys(props2.inputErrors);
2663
+ const messages2 = keys.reduce((messages3, key) => {
2664
+ let value2 = props2.inputErrors[key];
2665
+ if (typeof value2 === "string")
2666
+ value2 = [value2];
2667
+ if (Array.isArray(value2)) {
2668
+ messages3[key] = value2.map((error2) => createMessage({
2669
+ key: error2,
2670
+ type: "error",
2671
+ value: error2,
2672
+ meta: { source: sourceKey }
2673
+ }));
2674
+ }
2675
+ return messages3;
2676
+ }, {});
2677
+ node.store.apply(messages2, (message2) => message2.type === "error" && message2.meta.source === sourceKey);
2678
+ });
2679
+ }
2680
+ watchEffect(() => Object.assign(node.config, props2.config));
2681
+ if (node.type !== "input") {
2682
+ provide(parentSymbol, node);
2683
+ }
2684
+ let inputTimeout;
2685
+ const mutex = /* @__PURE__ */ new WeakSet();
2686
+ node.on("modelUpdated", () => {
2687
+ var _a, _b;
2688
+ context.emit("inputRaw", (_a = node.context) === null || _a === void 0 ? void 0 : _a.value, node);
2689
+ clearTimeout(inputTimeout);
2690
+ inputTimeout = setTimeout(context.emit, 20, "input", (_b = node.context) === null || _b === void 0 ? void 0 : _b.value, node);
2691
+ if (isVModeled && node.context) {
2692
+ const newValue = useRaw(node.context.value);
2693
+ if (isObject(newValue) && useRaw(props2.modelValue) !== newValue) {
2694
+ mutex.add(newValue);
2695
+ }
2696
+ context.emit("update:modelValue", newValue);
2697
+ }
2698
+ });
2699
+ if (isVModeled) {
2700
+ watchVerbose(toRef(props2, "modelValue"), (path, value2) => {
2701
+ var _a;
2702
+ const rawValue = useRaw(value2);
2703
+ if (isObject(rawValue) && mutex.has(rawValue)) {
2704
+ return mutex.delete(rawValue);
2705
+ }
2706
+ if (!path.length)
2707
+ node.input(value2, false);
2708
+ else
2709
+ (_a = node.at(path)) === null || _a === void 0 ? void 0 : _a.input(value2, false);
2710
+ });
2711
+ }
2712
+ onUnmounted(() => node.destroy());
2713
+ return node;
2714
+ }
2715
+ let totalCreated = 1;
2716
+ function isComponent(obj) {
2717
+ return typeof obj === "function" && obj.length === 2 || typeof obj === "object" && !Array.isArray(obj) && !("$el" in obj) && !("$cmp" in obj) && !("if" in obj);
2718
+ }
2719
+ function createInput(schemaOrComponent, definitionOptions = {}) {
2720
+ const definition = __spreadValues({
2721
+ type: "input"
2722
+ }, definitionOptions);
2723
+ let schema = void 0;
2724
+ if (isComponent(schemaOrComponent)) {
2725
+ const cmpName = `SchemaComponent${totalCreated++}`;
2726
+ schema = () => ({
2727
+ $cmp: cmpName,
2728
+ props: {
2729
+ context: "$node.context"
2730
+ }
2731
+ });
2732
+ definition.library = { [cmpName]: markRaw(schemaOrComponent) };
2733
+ } else {
2734
+ schema = schemaOrComponent;
2735
+ }
2736
+ definition.schema = useSchema(schema || "Schema undefined");
2737
+ return definition;
2738
+ }
2739
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2740
+ name: "PrimeInputText",
2741
+ props: {
2742
+ context: Object
2743
+ },
2744
+ setup(__props) {
2745
+ const props2 = __props;
2746
+ const context = props2.context;
2747
+ const hasLeftIcon = () => {
2748
+ return (context == null ? void 0 : context.iconLeft) && (context == null ? void 0 : context.iconLeft.length) > 0;
2749
+ };
2750
+ const hasRightIcon = () => {
2751
+ return (context == null ? void 0 : context.iconRight) && (context == null ? void 0 : context.iconRight.length) > 0;
2752
+ };
2753
+ const spanClass = () => {
2754
+ let result = "";
2755
+ if (hasLeftIcon())
2756
+ result = `${result}p-input-icon-left `;
2757
+ if (hasRightIcon())
2758
+ result = `${result}p-input-icon-right `;
2759
+ return result;
2760
+ };
2761
+ function handleInput(e) {
2762
+ context == null ? void 0 : context.node.input(e.target.value);
2763
+ }
2764
+ return (_ctx, _cache) => {
2765
+ const _component_InputText = resolveComponent("InputText");
2766
+ return openBlock(), createElementBlock("span", {
2767
+ class: normalizeClass(spanClass())
2768
+ }, [
2769
+ hasLeftIcon() ? (openBlock(), createElementBlock("i", {
2770
+ key: 0,
2771
+ class: normalizeClass(unref(context).iconLeft)
2772
+ }, null, 2)) : createCommentVNode("", true),
2773
+ createVNode(_component_InputText, {
2774
+ id: unref(context).id,
2775
+ modelValue: unref(context)._value,
2776
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2777
+ placeholder: unref(context).attrs.placeholder,
2778
+ class: normalizeClass(unref(context).attrs.class),
2779
+ onInput: handleInput
2780
+ }, null, 8, ["id", "modelValue", "placeholder", "class"]),
2781
+ hasRightIcon ? (openBlock(), createElementBlock("i", {
2782
+ key: 1,
2783
+ class: normalizeClass(unref(context).iconRight)
2784
+ }, null, 2)) : createCommentVNode("", true)
2785
+ ], 2);
2786
+ };
2787
+ }
2788
+ });
2789
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2790
+ name: "PrimeInputNumber",
2791
+ props: {
2792
+ context: Object
2793
+ },
2794
+ setup(__props) {
2795
+ const props2 = __props;
2796
+ const context = props2.context;
2797
+ function handleInput(e) {
2798
+ context == null ? void 0 : context.node.input(e.target.value);
2799
+ }
2800
+ return (_ctx, _cache) => {
2801
+ var _a;
2802
+ const _component_InputNumber = resolveComponent("InputNumber");
2803
+ return openBlock(), createBlock(_component_InputNumber, {
2804
+ id: unref(context).id,
2805
+ modelValue: unref(context)._value,
2806
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2807
+ rows: (_a = unref(context).rows) != null ? _a : 3,
2808
+ placeholder: unref(context).attrs.placeholder,
2809
+ class: normalizeClass(unref(context).attrs.class),
2810
+ onInput: handleInput
2811
+ }, null, 8, ["id", "modelValue", "rows", "placeholder", "class"]);
2812
+ };
2813
+ }
2814
+ });
2815
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2816
+ name: "PrimePassword",
2817
+ props: {
2818
+ context: Object
2819
+ },
2820
+ setup(__props) {
2821
+ const props2 = __props;
2822
+ const context = props2.context;
2823
+ function handleInput(e) {
2824
+ context == null ? void 0 : context.node.input(e.target.value);
2825
+ }
2826
+ return (_ctx, _cache) => {
2827
+ var _a, _b, _c, _d;
2828
+ const _component_Password = resolveComponent("Password");
2829
+ return openBlock(), createBlock(_component_Password, {
2830
+ id: unref(context).id,
2831
+ modelValue: unref(context)._value,
2832
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2833
+ placeholder: unref(context).attrs.placeholder,
2834
+ feedback: (_b = (_a = unref(context)) == null ? void 0 : _a.feedback) != null ? _b : true,
2835
+ "toggle-mask": (_d = (_c = unref(context)) == null ? void 0 : _c.toggleMask) != null ? _d : false,
2836
+ class: normalizeClass(unref(context).attrs.class),
2837
+ onInput: handleInput
2838
+ }, null, 8, ["id", "modelValue", "placeholder", "feedback", "toggle-mask", "class"]);
2839
+ };
2840
+ }
2841
+ });
2842
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2843
+ name: "PrimeInputTextArea",
2844
+ props: {
2845
+ context: Object
2846
+ },
2847
+ setup(__props) {
2848
+ const props2 = __props;
2849
+ const context = props2.context;
2850
+ function handleInput(e) {
2851
+ context == null ? void 0 : context.node.input(e.target.value);
2852
+ }
2853
+ return (_ctx, _cache) => {
2854
+ var _a;
2855
+ const _component_Textarea = resolveComponent("Textarea");
2856
+ return openBlock(), createBlock(_component_Textarea, {
2857
+ id: unref(context).id,
2858
+ modelValue: unref(context)._value,
2859
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2860
+ rows: (_a = unref(context).rows) != null ? _a : 3,
2861
+ placeholder: unref(context).attrs.placeholder,
2862
+ class: normalizeClass(unref(context).attrs.class),
2863
+ onInput: handleInput
2864
+ }, null, 8, ["id", "modelValue", "rows", "placeholder", "class"]);
2865
+ };
2866
+ }
2867
+ });
2868
+ const _hoisted_1$1 = {
2869
+ key: 0,
2870
+ class: "formkit-prime-left"
2871
+ };
2872
+ const _hoisted_2$1 = {
2873
+ key: 1,
2874
+ class: "formkit-prime-right"
2875
+ };
2876
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2877
+ name: "PrimeCheckBox",
2878
+ props: {
2879
+ context: Object
2880
+ },
2881
+ setup(__props) {
2882
+ const props2 = __props;
2883
+ const context = props2.context;
2884
+ function handleInput(e) {
2885
+ context == null ? void 0 : context.node.input(e);
2886
+ }
2887
+ return (_ctx, _cache) => {
2888
+ const _component_Checkbox = resolveComponent("Checkbox");
2889
+ return openBlock(), createElementBlock(Fragment, null, [
2890
+ unref(context).attrs.labelLeft ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(unref(context).attrs.labelLeft), 1)) : createCommentVNode("", true),
2891
+ createVNode(_component_Checkbox, {
2892
+ id: unref(context).id,
2893
+ modelValue: unref(context)._value,
2894
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2895
+ placeholder: unref(context).attrs.placeholder,
2896
+ binary: true,
2897
+ class: normalizeClass(unref(context).attrs.class),
2898
+ onInput: handleInput
2899
+ }, null, 8, ["id", "modelValue", "placeholder", "class"]),
2900
+ unref(context).attrs.labelRight ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(unref(context).attrs.labelRight), 1)) : createCommentVNode("", true)
2901
+ ], 64);
2902
+ };
2903
+ }
2904
+ });
2905
+ const _hoisted_1 = {
2906
+ key: 0,
2907
+ class: "formkit-prime-left"
2908
+ };
2909
+ const _hoisted_2 = {
2910
+ key: 1,
2911
+ class: "formkit-prime-right"
2912
+ };
2913
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2914
+ name: "PrimeInputSwitch",
2915
+ props: {
2916
+ context: Object
2917
+ },
2918
+ setup(__props) {
2919
+ const props2 = __props;
2920
+ const context = props2.context;
2921
+ function handleInput(e) {
2922
+ var _a;
2923
+ context == null ? void 0 : context.node.input((_a = props2.context) == null ? void 0 : _a._value);
2924
+ }
2925
+ return (_ctx, _cache) => {
2926
+ var _a, _b;
2927
+ const _component_InputSwitch = resolveComponent("InputSwitch");
2928
+ return openBlock(), createElementBlock(Fragment, null, [
2929
+ unref(context).attrs.labelLeft ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(context).attrs.labelLeft), 1)) : createCommentVNode("", true),
2930
+ createVNode(_component_InputSwitch, {
2931
+ id: unref(context).id,
2932
+ modelValue: unref(context)._value,
2933
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2934
+ "true-value": (_a = unref(context).attrs.trueValue) != null ? _a : void 0,
2935
+ "false-value": (_b = unref(context).attrs.falseValue) != null ? _b : void 0,
2936
+ class: normalizeClass(unref(context).attrs.class),
2937
+ onInput: handleInput
2938
+ }, null, 8, ["id", "modelValue", "true-value", "false-value", "class"]),
2939
+ unref(context).attrs.labelRight ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref(context).attrs.labelRight), 1)) : createCommentVNode("", true)
2940
+ ], 64);
2941
+ };
2942
+ }
2943
+ });
2944
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2945
+ name: "PrimeEditor",
2946
+ props: {
2947
+ context: Object
2948
+ },
2949
+ setup(__props) {
2950
+ const props2 = __props;
2951
+ const context = props2.context;
2952
+ function handleInput(e) {
2953
+ context == null ? void 0 : context.node.input(e.htmlValue);
2954
+ }
2955
+ return (_ctx, _cache) => {
2956
+ const _component_Editor = resolveComponent("Editor");
2957
+ return openBlock(), createBlock(_component_Editor, {
2958
+ id: unref(context).id,
2959
+ modelValue: unref(context)._value,
2960
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2961
+ placeholder: unref(context).attrs.placeholder,
2962
+ onTextChange: handleInput
2963
+ }, null, 8, ["id", "modelValue", "placeholder"]);
2964
+ };
2965
+ }
2966
+ });
2967
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2968
+ name: "PrimeDropdown",
2969
+ props: {
2970
+ context: Object
2971
+ },
2972
+ setup(__props) {
2973
+ const props2 = __props;
2974
+ const context = props2.context;
2975
+ function handleInput(e) {
2976
+ context == null ? void 0 : context.node.input(e.value);
2977
+ }
2978
+ return (_ctx, _cache) => {
2979
+ var _a, _b, _c, _d;
2980
+ const _component_Dropdown = resolveComponent("Dropdown");
2981
+ return openBlock(), createBlock(_component_Dropdown, {
2982
+ id: unref(context).id,
2983
+ modelValue: unref(context)._value,
2984
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
2985
+ options: (_b = (_a = unref(context)) == null ? void 0 : _a.attrs) == null ? void 0 : _b.options,
2986
+ "option-label": "label",
2987
+ "option-value": "value",
2988
+ placeholder: unref(context).attrs.placeholder,
2989
+ filter: (_c = unref(context).attrs.filter) != null ? _c : false,
2990
+ "show-clear": (_d = unref(context).attrs.showClear) != null ? _d : false,
2991
+ class: normalizeClass(unref(context).attrs.class),
2992
+ onChange: handleInput
2993
+ }, null, 8, ["id", "modelValue", "options", "placeholder", "filter", "show-clear", "class"]);
2994
+ };
2995
+ }
2996
+ });
2997
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2998
+ name: "PrimeMultiSelect",
2999
+ props: {
3000
+ context: Object
3001
+ },
3002
+ setup(__props) {
3003
+ const props2 = __props;
3004
+ const context = props2.context;
3005
+ function handleInput(e) {
3006
+ var _a;
3007
+ context == null ? void 0 : context.node.input((_a = props2.context) == null ? void 0 : _a._value);
3008
+ }
3009
+ return (_ctx, _cache) => {
3010
+ var _a, _b, _c;
3011
+ const _component_MultiSelect = resolveComponent("MultiSelect");
3012
+ return openBlock(), createBlock(_component_MultiSelect, {
3013
+ id: unref(context).id,
3014
+ modelValue: unref(context)._value,
3015
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
3016
+ options: (_b = (_a = unref(context)) == null ? void 0 : _a.attrs) == null ? void 0 : _b.options,
3017
+ "option-label": "label",
3018
+ "option-value": "value",
3019
+ placeholder: unref(context).attrs.placeholder,
3020
+ filter: (_c = unref(context).attrs.filter) != null ? _c : false,
3021
+ class: normalizeClass(unref(context).attrs.class),
3022
+ onChange: handleInput
3023
+ }, null, 8, ["id", "modelValue", "options", "placeholder", "filter", "class"]);
3024
+ };
3025
+ }
3026
+ });
3027
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3028
+ name: "PrimeCalendar",
3029
+ props: {
3030
+ context: Object
3031
+ },
3032
+ setup(__props) {
3033
+ const props2 = __props;
3034
+ const context = props2.context;
3035
+ function handleInput(e) {
3036
+ context == null ? void 0 : context.node.input(context == null ? void 0 : context._value);
3037
+ }
3038
+ function handleSelect(e) {
3039
+ context == null ? void 0 : context.node.input(e);
3040
+ }
3041
+ return (_ctx, _cache) => {
3042
+ const _component_Calendar = resolveComponent("Calendar");
3043
+ return openBlock(), createBlock(_component_Calendar, {
3044
+ id: props2.context.id,
3045
+ modelValue: unref(context)._value,
3046
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
3047
+ class: normalizeClass(unref(context).attrs.class),
3048
+ "date-format": unref(context).attrs.dateFormat,
3049
+ "show-icon": unref(context).attrs.showIcon,
3050
+ icon: unref(context).attrs.icon,
3051
+ onDateSelect: handleSelect,
3052
+ onInput: handleInput
3053
+ }, null, 8, ["id", "modelValue", "class", "date-format", "show-icon", "icon"]);
3054
+ };
3055
+ }
3056
+ });
3057
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3058
+ name: "PrimeSlider",
3059
+ props: {
3060
+ context: Object
3061
+ },
3062
+ setup(__props) {
3063
+ const props2 = __props;
3064
+ const context = props2.context;
3065
+ function handleInput(e) {
3066
+ var _a;
3067
+ context == null ? void 0 : context.node.input((_a = props2.context) == null ? void 0 : _a._value);
3068
+ }
3069
+ return (_ctx, _cache) => {
3070
+ var _a, _b, _c, _d;
3071
+ const _component_Slider = resolveComponent("Slider");
3072
+ return openBlock(), createBlock(_component_Slider, {
3073
+ id: unref(context).id,
3074
+ modelValue: unref(context)._value,
3075
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(context)._value = $event),
3076
+ min: (_a = unref(context).attrs.min) != null ? _a : 0,
3077
+ max: (_b = unref(context).attrs.max) != null ? _b : 100,
3078
+ step: (_c = unref(context).attrs.step) != null ? _c : void 0,
3079
+ range: (_d = unref(context).attrs.range) != null ? _d : false,
3080
+ onChange: handleInput
3081
+ }, null, 8, ["id", "modelValue", "min", "max", "step", "range"]);
3082
+ };
3083
+ }
3084
+ });
3085
+ const primeInputTextDefinition = createInput(_sfc_main$a, {
3086
+ props: ["iconRight", "iconLeft"]
3087
+ });
3088
+ const primeInputNumberDefinition = createInput(_sfc_main$9, {
3089
+ props: ["iconRight", "iconLeft"]
3090
+ });
3091
+ const primePasswordDefinition = createInput(_sfc_main$8, {
3092
+ props: ["feedback", "toggleMask"]
3093
+ });
3094
+ const primeInputTextAreaDefinition = createInput(_sfc_main$7, {
3095
+ props: ["rows"]
3096
+ });
3097
+ const primeCheckBoxDefinition = createInput(_sfc_main$6, {
3098
+ props: []
3099
+ });
3100
+ const primeInputSwitchDefinition = createInput(_sfc_main$5, {
3101
+ props: []
3102
+ });
3103
+ const primeEditorDefinition = createInput(_sfc_main$4, {
3104
+ props: []
3105
+ });
3106
+ const primeDropdownDefinition = createInput(_sfc_main$3, {
3107
+ props: []
3108
+ });
3109
+ const primeMultiSelectDefinition = createInput(_sfc_main$2, {
3110
+ props: []
3111
+ });
3112
+ const primeCalendarDefinition = createInput(_sfc_main$1, {
3113
+ props: []
3114
+ });
3115
+ const primeSliderDefinition = createInput(_sfc_main, {
3116
+ props: []
3117
+ });
3118
+ const primeInputs = {
3119
+ primeInputText: primeInputTextDefinition,
3120
+ primeInputNumber: primeInputNumberDefinition,
3121
+ primePassword: primePasswordDefinition,
3122
+ primeCheckBox: primeCheckBoxDefinition,
3123
+ primeInputSwitch: primeInputSwitchDefinition,
3124
+ primeInputTextArea: primeInputTextAreaDefinition,
3125
+ primeEditor: primeEditorDefinition,
3126
+ primeDropdown: primeDropdownDefinition,
3127
+ primeMultiSelect: primeMultiSelectDefinition,
3128
+ primeCalendar: primeCalendarDefinition,
3129
+ primeSlider: primeSliderDefinition
3130
+ };
3131
+ export { primeCalendarDefinition, primeCheckBoxDefinition, primeDropdownDefinition, primeEditorDefinition, primeInputNumberDefinition, primeInputSwitchDefinition, primeInputTextAreaDefinition, primeInputTextDefinition, primeInputs, primeMultiSelectDefinition, primePasswordDefinition, primeSliderDefinition };