@drfed/web 0.0.0-stage → 0.1.0-dev.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.
Files changed (128) hide show
  1. package/.output/nitro.json +17 -0
  2. package/.output/public/.vite/manifest.json +493 -0
  3. package/.output/public/_build/assets/ActorDetailQuery.graphql-D96mwq1k.js +60 -0
  4. package/.output/public/_build/assets/ActorDetailQuery.graphql-DrxSNh1X.js +60 -0
  5. package/.output/public/_build/assets/CompleteLoginChallenge.graphql-C5Zq3wNh.js +10 -0
  6. package/.output/public/_build/assets/CopyButton-B2l484wE.js +1 -0
  7. package/.output/public/_build/assets/CopyButton-Bi-ZR8x9.css +1 -0
  8. package/.output/public/_build/assets/CreateInstanceMutation.graphql-B4CRy6cl.js +19 -0
  9. package/.output/public/_build/assets/CreateObjectMutation.graphql-B4A01dgV.js +23 -0
  10. package/.output/public/_build/assets/GenerateActorsMutation.graphql-mlHJNIbe.js +23 -0
  11. package/.output/public/_build/assets/GetHostQuery.graphql-CuzDdOdW.js +17 -0
  12. package/.output/public/_build/assets/GetHostQuery.graphql-o9K0Qkg0.js +17 -0
  13. package/.output/public/_build/assets/HomeViewerQuery.graphql-B903WWKs.js +8 -0
  14. package/.output/public/_build/assets/HttpStatusCode-bgaVzuLy.js +1 -0
  15. package/.output/public/_build/assets/InstanceActorListQuery.graphql-DmNwiEhM.js +24 -0
  16. package/.output/public/_build/assets/InstanceActorListQuery.graphql-paa7teUO.js +24 -0
  17. package/.output/public/_build/assets/InstanceDetailQuery.graphql-B52nR132.js +66 -0
  18. package/.output/public/_build/assets/InstanceDetailQuery.graphql-DSA2BcAV.js +66 -0
  19. package/.output/public/_build/assets/InstanceSummary_instance.graphql-BoQAa5Od.js +1 -0
  20. package/.output/public/_build/assets/JNCCF6MP-CNMywyiC.js +1 -0
  21. package/.output/public/_build/assets/LP6E37CW-Cwv6G3n1.js +1 -0
  22. package/.output/public/_build/assets/SignInMutation.graphql-BalZYNFu.js +9 -0
  23. package/.output/public/_build/assets/TSB6MOZK-CpiH97G1.js +1 -0
  24. package/.output/public/_build/assets/Toast-3-eXCAKc.css +1 -0
  25. package/.output/public/_build/assets/Toast-C1zr9crB.js +1 -0
  26. package/.output/public/_build/assets/WorkspaceQuery.graphql-UoI7QDs4.js +23 -0
  27. package/.output/public/_build/assets/_...404_-WZ8kAljY.js +1 -0
  28. package/.output/public/_build/assets/_challengeId_-BgL-Berz.js +1 -0
  29. package/.output/public/_build/assets/_id_-YcZZShAv.css +1 -0
  30. package/.output/public/_build/assets/_id_-bpxdclBj.js +1 -0
  31. package/.output/public/_build/assets/_slug_-CyTA2aW7.css +1 -0
  32. package/.output/public/_build/assets/_slug_-DXfRknzJ.js +200 -0
  33. package/.output/public/_build/assets/about-DIrbzRsi.js +1 -0
  34. package/.output/public/_build/assets/actors-HfZh_afh.js +24 -0
  35. package/.output/public/_build/assets/client-CGFoRcqH.js +3 -0
  36. package/.output/public/_build/assets/components-5MVu7IcD.js +1 -0
  37. package/.output/public/_build/assets/dist-BrJ_B8nU.js +1 -0
  38. package/.output/public/_build/assets/dist-DVo0HS5G.js +1 -0
  39. package/.output/public/_build/assets/dist-WrlGlK67.js +1 -0
  40. package/.output/public/_build/assets/entry-client-BurSTYr9.css +1 -0
  41. package/.output/public/_build/assets/entry-client-RIC5nXxX.js +8 -0
  42. package/.output/public/_build/assets/form-BxigYd7J.css +1 -0
  43. package/.output/public/_build/assets/form.module-BecmEfV_.js +1 -0
  44. package/.output/public/_build/assets/index-BHn6sAgH.js +23 -0
  45. package/.output/public/_build/assets/index-BSLqnqN7.js +8 -0
  46. package/.output/public/_build/assets/index-B_xLBDOo.css +1 -0
  47. package/.output/public/_build/assets/instance-tpMrvJNZ.js +35 -0
  48. package/.output/public/_build/assets/label-Mv8GZ4jc.js +1 -0
  49. package/.output/public/_build/assets/objects-DPb8DI8A.css +1 -0
  50. package/.output/public/_build/assets/objects-DR9TfL-V.js +25 -0
  51. package/.output/public/_build/assets/relay-runtime-BX3uubtA.js +7 -0
  52. package/.output/public/_build/assets/routing-DMN2NHu6.js +1 -0
  53. package/.output/public/_build/assets/sign-in-B67sv7z8.js +10 -0
  54. package/.output/public/_build/assets/web-DB_Nkq2D.js +1 -0
  55. package/.output/public/apple-touch-icon.png +0 -0
  56. package/.output/public/favicon.ico +0 -0
  57. package/.output/public/icon-192.png +0 -0
  58. package/.output/public/icon-512.png +0 -0
  59. package/.output/public/icon-mask.png +0 -0
  60. package/.output/public/icon.svg +395 -0
  61. package/.output/public/manifest.webmanifest +13 -0
  62. package/.output/server/_...404_-DDEH5apf.mjs +16 -0
  63. package/.output/server/_challengeId_-C7BBdG0r.mjs +100 -0
  64. package/.output/server/_chunks/ssr-renderer.mjs +26 -0
  65. package/.output/server/_id_-DqytvZEf.mjs +505 -0
  66. package/.output/server/_libs/@shikijs/core+[...].mjs +7173 -0
  67. package/.output/server/_libs/@shikijs/engine-javascript+[...].mjs +3110 -0
  68. package/.output/server/_libs/babel__runtime.mjs +243 -0
  69. package/.output/server/_libs/dequal.mjs +25 -0
  70. package/.output/server/_libs/faker-js__faker.mjs +13150 -0
  71. package/.output/server/_libs/fbjs.mjs +115 -0
  72. package/.output/server/_libs/h3+rou3+srvx.mjs +650 -0
  73. package/.output/server/_libs/hookable.mjs +41 -0
  74. package/.output/server/_libs/invariant.mjs +36 -0
  75. package/.output/server/_libs/relay-runtime.mjs +9704 -0
  76. package/.output/server/_libs/seroval-plugins.mjs +563 -0
  77. package/.output/server/_libs/seroval.mjs +2956 -0
  78. package/.output/server/_libs/shikijs__langs.mjs +3 -0
  79. package/.output/server/_libs/shikijs__themes.mjs +7 -0
  80. package/.output/server/_libs/solid-js.mjs +1248 -0
  81. package/.output/server/_libs/solid-relay+tiny-invariant.mjs +1029 -0
  82. package/.output/server/_libs/ufo.mjs +64 -0
  83. package/.output/server/_libs/valibot.mjs +711 -0
  84. package/.output/server/_runtime.mjs +33 -0
  85. package/.output/server/_slug_-CBOaSqoF.mjs +978 -0
  86. package/.output/server/_ssr/ActorDetailQuery.graphql-C1mWRP1B.mjs +283 -0
  87. package/.output/server/_ssr/CompleteLoginChallenge.graphql-CM7o_Md1.mjs +78 -0
  88. package/.output/server/_ssr/CopyButton-CQNR5D1y.mjs +43 -0
  89. package/.output/server/_ssr/CreateInstanceMutation.graphql-C-h2lGxz.mjs +116 -0
  90. package/.output/server/_ssr/CreateObjectMutation.graphql-C393Hp7q.mjs +166 -0
  91. package/.output/server/_ssr/GenerateActorsMutation.graphql-D2ADtn1j.mjs +163 -0
  92. package/.output/server/_ssr/GetHostQuery.graphql-C45XQo1i.mjs +127 -0
  93. package/.output/server/_ssr/HomeViewerQuery.graphql-Dote4Pkz.mjs +81 -0
  94. package/.output/server/_ssr/InstanceActorListQuery.graphql-DgItgN5t.mjs +167 -0
  95. package/.output/server/_ssr/InstanceDetailQuery.graphql-DP5wWWjX.mjs +367 -0
  96. package/.output/server/_ssr/InstanceSummary_instance.graphql-10tilF-Z.mjs +34 -0
  97. package/.output/server/_ssr/JNCCF6MP-BAZlBnvx.mjs +419 -0
  98. package/.output/server/_ssr/LP6E37CW-D2Ih_b_K.mjs +163 -0
  99. package/.output/server/_ssr/SignInMutation.graphql-BBXmiay6.mjs +72 -0
  100. package/.output/server/_ssr/TSB6MOZK-D06WZb6o.mjs +166 -0
  101. package/.output/server/_ssr/Toast-Bb1gcxED.mjs +947 -0
  102. package/.output/server/_ssr/WorkspaceQuery.graphql-DnCO8t-4.mjs +153 -0
  103. package/.output/server/_ssr/about-CD3QIgf_.mjs +14 -0
  104. package/.output/server/_ssr/actors-CMWf-xQU.mjs +1160 -0
  105. package/.output/server/_ssr/dist-D6rgyh-L.mjs +81 -0
  106. package/.output/server/_ssr/dist-I7KRMRbA.mjs +432 -0
  107. package/.output/server/_ssr/form.module-CTvIl1lm.mjs +192 -0
  108. package/.output/server/_ssr/index-C4crD6q-.mjs +347 -0
  109. package/.output/server/_ssr/index-yuhuc6-X.mjs +111 -0
  110. package/.output/server/_ssr/instance-ZYWGeWd3.mjs +280 -0
  111. package/.output/server/_ssr/label-DAXzanI9.mjs +9 -0
  112. package/.output/server/_ssr/objects-D5MVukzB.mjs +4316 -0
  113. package/.output/server/_ssr/routing-DKTLkkbY.mjs +620 -0
  114. package/.output/server/_ssr/sign-in-CNHZb_zL.mjs +264 -0
  115. package/.output/server/_ssr/ssr.mjs +6138 -0
  116. package/.output/server/index.mjs +691 -0
  117. package/LICENSE +661 -0
  118. package/README.md +143 -2
  119. package/dist/bridge.d.mts +39 -0
  120. package/dist/bridge.mjs +104 -0
  121. package/dist/bridge.mjs.map +1 -0
  122. package/dist/request-policy.d.mts +8 -0
  123. package/dist/request-policy.mjs +94 -0
  124. package/dist/request-policy.mjs.map +1 -0
  125. package/dist/runtime.d.mts +14 -0
  126. package/dist/runtime.mjs +44 -0
  127. package/dist/runtime.mjs.map +1 -0
  128. package/package.json +111 -3
@@ -0,0 +1,1160 @@
1
+ import { r as __toESM } from "../_runtime.mjs";
2
+ import { n as require_relay_runtime } from "../_libs/relay-runtime.mjs";
3
+ import { $ as splitProps, A as batch, D as Show, F as createContext, H as createUniqueId, I as createEffect, K as mergeProps, L as createMemo, N as createComponent, V as createSignal, _ as ssrElement, g as ssrAttribute, h as ssr, nt as useContext, q as on, u as escape, v as ssrHydrationKey, y as ssrStyle } from "../_libs/solid-js.mjs";
4
+ import { n as Title } from "./dist-D6rgyh-L.mjs";
5
+ import { i as combineStyle, s as navigateWithToast } from "./Toast-Bb1gcxED.mjs";
6
+ import { D as mergeDefaultProps, M as visuallyHiddenStyles, _ as getPrecision, a as __export, i as Polymorphic, j as snapValueToStep, l as createGenerateId, n as ButtonRoot, o as callHandler, s as composeEventHandlers, t as Button } from "./JNCCF6MP-BAZlBnvx.mjs";
7
+ import { a as integer, c as minValue, d as object, h as pipe, u as number } from "../_libs/valibot.mjs";
8
+ import { i as createMutation, o as createPreloadedQuery } from "../_libs/solid-relay+tiny-invariant.mjs";
9
+ import { s as node$3 } from "./ssr.mjs";
10
+ import { n as Form, r as createForm, t as Field } from "./dist-I7KRMRbA.mjs";
11
+ import { a as FormControlErrorMessage, d as createFormControl, f as createFormControlField, g as useFormControlContext, i as FormControlDescription, m as form_module_default, n as FORM_CONTROL_PROP_NAMES, o as FormControlLabel, p as createFormResetListener, r as FormControlContext, s as access, t as FORM_CONTROL_FIELD_PROP_NAMES, u as createControllableSignal } from "./form.module-CTvIl1lm.mjs";
12
+ import { a as useLocale, n as announce, r as clearAnnouncer } from "./LP6E37CW-D2Ih_b_K.mjs";
13
+ //#region node_modules/.nitro/vite/services/ssr/_build/assets/actors-CMWf-xQU.js
14
+ var import_relay_runtime = /* @__PURE__ */ __toESM(require_relay_runtime());
15
+ /**
16
+ * @generated SignedSource<<a0adbd723962824209886a67c97e521e>>
17
+ * @lightSyntaxTransform
18
+ */
19
+ var { ConcreteRequest } = import_relay_runtime?.default?.default?.__esModule ? import_relay_runtime.default.default : import_relay_runtime?.default?.__esModule ? import_relay_runtime.default : import_relay_runtime;
20
+ var node = function() {
21
+ var v0 = [{
22
+ "defaultValue": null,
23
+ "kind": "LocalArgument",
24
+ "name": "instance"
25
+ }, {
26
+ "defaultValue": null,
27
+ "kind": "LocalArgument",
28
+ "name": "size"
29
+ }], v1 = [{
30
+ "kind": "Variable",
31
+ "name": "instance",
32
+ "variableName": "instance"
33
+ }, {
34
+ "kind": "Variable",
35
+ "name": "size",
36
+ "variableName": "size"
37
+ }], v2 = {
38
+ "alias": "resultType",
39
+ "args": null,
40
+ "kind": "ScalarField",
41
+ "name": "__typename",
42
+ "storageKey": null
43
+ }, v3 = {
44
+ "kind": "InlineFragment",
45
+ "selections": [{
46
+ "alias": null,
47
+ "args": null,
48
+ "concreteType": "Actor",
49
+ "kind": "LinkedField",
50
+ "name": "actors",
51
+ "plural": true,
52
+ "selections": [
53
+ {
54
+ "alias": null,
55
+ "args": null,
56
+ "kind": "ScalarField",
57
+ "name": "id",
58
+ "storageKey": null
59
+ },
60
+ {
61
+ "alias": null,
62
+ "args": null,
63
+ "kind": "ScalarField",
64
+ "name": "uuid",
65
+ "storageKey": null
66
+ },
67
+ {
68
+ "alias": null,
69
+ "args": null,
70
+ "kind": "ScalarField",
71
+ "name": "username",
72
+ "storageKey": null
73
+ },
74
+ {
75
+ "alias": null,
76
+ "args": null,
77
+ "kind": "ScalarField",
78
+ "name": "handle",
79
+ "storageKey": null
80
+ },
81
+ {
82
+ "alias": null,
83
+ "args": null,
84
+ "kind": "ScalarField",
85
+ "name": "iri",
86
+ "storageKey": null
87
+ }
88
+ ],
89
+ "storageKey": null
90
+ }],
91
+ "type": "CreateActorsSuccess",
92
+ "abstractKey": null
93
+ }, v4 = {
94
+ "kind": "InlineFragment",
95
+ "selections": [{
96
+ "alias": null,
97
+ "args": null,
98
+ "kind": "ScalarField",
99
+ "name": "type",
100
+ "storageKey": null
101
+ }, {
102
+ "alias": null,
103
+ "args": null,
104
+ "kind": "ScalarField",
105
+ "name": "message",
106
+ "storageKey": null
107
+ }],
108
+ "type": "CreateActorsError",
109
+ "abstractKey": null
110
+ };
111
+ return {
112
+ "fragment": {
113
+ "argumentDefinitions": v0,
114
+ "kind": "Fragment",
115
+ "metadata": null,
116
+ "name": "GenerateActorsMutation",
117
+ "selections": [{
118
+ "alias": null,
119
+ "args": v1,
120
+ "concreteType": null,
121
+ "kind": "LinkedField",
122
+ "name": "generateActors",
123
+ "plural": false,
124
+ "selections": [
125
+ v2,
126
+ v3,
127
+ v4
128
+ ],
129
+ "storageKey": null
130
+ }],
131
+ "type": "Mutation",
132
+ "abstractKey": null
133
+ },
134
+ "kind": "Request",
135
+ "operation": {
136
+ "argumentDefinitions": v0,
137
+ "kind": "Operation",
138
+ "name": "GenerateActorsMutation",
139
+ "selections": [{
140
+ "alias": null,
141
+ "args": v1,
142
+ "concreteType": null,
143
+ "kind": "LinkedField",
144
+ "name": "generateActors",
145
+ "plural": false,
146
+ "selections": [
147
+ {
148
+ "alias": null,
149
+ "args": null,
150
+ "kind": "ScalarField",
151
+ "name": "__typename",
152
+ "storageKey": null
153
+ },
154
+ v2,
155
+ v3,
156
+ v4
157
+ ],
158
+ "storageKey": null
159
+ }]
160
+ },
161
+ "params": {
162
+ "cacheID": "655241cbf60ac070f89be8c87cabe9d4",
163
+ "id": null,
164
+ "metadata": {},
165
+ "name": "GenerateActorsMutation",
166
+ "operationKind": "mutation",
167
+ "text": "mutation GenerateActorsMutation(\n $instance: ID!\n $size: Int!\n) {\n generateActors(instance: $instance, size: $size) {\n __typename\n resultType: __typename\n ... on CreateActorsSuccess {\n actors {\n id\n uuid\n username\n handle\n iri\n }\n }\n ... on CreateActorsError {\n type\n message\n }\n }\n}\n"
168
+ }
169
+ };
170
+ }();
171
+ node.hash = "c9e9c50790753aeefacb0eb60b5e6adf";
172
+ var SPIN_BUTTON_INTL_TRANSLATIONS = { empty: "Empty" };
173
+ function SpinButtonRoot(props) {
174
+ const [local, others] = splitProps(mergeDefaultProps({ translations: SPIN_BUTTON_INTL_TRANSLATIONS }, props), [
175
+ "style",
176
+ "translations",
177
+ "value",
178
+ "textValue",
179
+ "minValue",
180
+ "maxValue",
181
+ "validationState",
182
+ "onIncrement",
183
+ "onIncrementPage",
184
+ "onDecrement",
185
+ "onDecrementPage",
186
+ "onDecrementToMin",
187
+ "onIncrementToMax",
188
+ "onKeyDown",
189
+ "onFocus",
190
+ "onBlur"
191
+ ]);
192
+ let isFocused = false;
193
+ const textValue = createMemo(() => {
194
+ if (local.textValue === "") return local.translations?.empty;
195
+ return (local.textValue || `${local.value}`).replace("-", "−");
196
+ });
197
+ const onKeyDown = (e) => {
198
+ callHandler(e, local.onKeyDown);
199
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || props.readOnly) return;
200
+ switch (e.key) {
201
+ case "PageUp": if (local.onIncrementPage) {
202
+ e.preventDefault();
203
+ local.onIncrementPage();
204
+ break;
205
+ }
206
+ case "ArrowUp":
207
+ case "Up":
208
+ if (local.onIncrement) {
209
+ e.preventDefault();
210
+ local.onIncrement();
211
+ }
212
+ break;
213
+ case "PageDown": if (local.onDecrementPage) {
214
+ e.preventDefault();
215
+ local.onDecrementPage();
216
+ break;
217
+ }
218
+ case "ArrowDown":
219
+ case "Down":
220
+ if (local.onDecrement) {
221
+ e.preventDefault();
222
+ local.onDecrement();
223
+ }
224
+ break;
225
+ case "Home":
226
+ if (local.onDecrementToMin) {
227
+ e.preventDefault();
228
+ local.onDecrementToMin();
229
+ }
230
+ break;
231
+ case "End":
232
+ if (local.onIncrementToMax) {
233
+ e.preventDefault();
234
+ local.onIncrementToMax();
235
+ }
236
+ break;
237
+ }
238
+ };
239
+ const onFocus = (e) => {
240
+ callHandler(e, local.onFocus);
241
+ isFocused = true;
242
+ };
243
+ const onBlur = (e) => {
244
+ callHandler(e, local.onBlur);
245
+ isFocused = false;
246
+ };
247
+ createEffect(on(textValue, (textValue2) => {
248
+ if (isFocused) {
249
+ clearAnnouncer("assertive");
250
+ announce(textValue2 ?? "", "assertive");
251
+ }
252
+ }));
253
+ return createComponent(Polymorphic, mergeProps({
254
+ as: "div",
255
+ role: "spinbutton",
256
+ get style() {
257
+ return combineStyle({ "touch-action": "none" }, local.style);
258
+ },
259
+ get ["aria-valuenow"]() {
260
+ return local.value != null && !Number.isNaN(local.value) ? local.value : void 0;
261
+ },
262
+ get ["aria-valuetext"]() {
263
+ return textValue();
264
+ },
265
+ get ["aria-valuemin"]() {
266
+ return local.minValue;
267
+ },
268
+ get ["aria-valuemax"]() {
269
+ return local.maxValue;
270
+ },
271
+ get ["aria-required"]() {
272
+ return props.required || void 0;
273
+ },
274
+ get ["aria-disabled"]() {
275
+ return props.disabled || void 0;
276
+ },
277
+ get ["aria-readonly"]() {
278
+ return props.readOnly || void 0;
279
+ },
280
+ get ["aria-invalid"]() {
281
+ return local.validationState === "invalid" || void 0;
282
+ },
283
+ onKeyDown,
284
+ onFocus,
285
+ onBlur
286
+ }, others));
287
+ }
288
+ var $1dfb119a85e764e5$var$formatterCache = /* @__PURE__ */ new Map();
289
+ var $1dfb119a85e764e5$var$supportsSignDisplay = false;
290
+ try {
291
+ $1dfb119a85e764e5$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", { signDisplay: "exceptZero" }).resolvedOptions().signDisplay === "exceptZero";
292
+ } catch {}
293
+ var $1dfb119a85e764e5$var$supportsUnit = false;
294
+ try {
295
+ $1dfb119a85e764e5$var$supportsUnit = new Intl.NumberFormat("de-DE", {
296
+ style: "unit",
297
+ unit: "degree"
298
+ }).resolvedOptions().style === "unit";
299
+ } catch {}
300
+ var $1dfb119a85e764e5$var$UNITS = { degree: { narrow: {
301
+ default: "°",
302
+ "ja-JP": " 度",
303
+ "zh-TW": "度",
304
+ "sl-SI": " °"
305
+ } } };
306
+ var $1dfb119a85e764e5$export$cc77c4ff7e8673c5 = class {
307
+ constructor(locale, options = {}) {
308
+ this.numberFormatter = $1dfb119a85e764e5$var$getCachedNumberFormatter(locale, options);
309
+ this.options = options;
310
+ }
311
+ /**
312
+ * Formats a number value as a string, according to the locale and options provided to the
313
+ * constructor.
314
+ */
315
+ format(value) {
316
+ let res = "";
317
+ if (!$1dfb119a85e764e5$var$supportsSignDisplay && this.options.signDisplay != null) res = $1dfb119a85e764e5$export$711b50b3c525e0f2(this.numberFormatter, this.options.signDisplay, value);
318
+ else res = this.numberFormatter.format(value);
319
+ if (this.options.style === "unit" && !$1dfb119a85e764e5$var$supportsUnit) {
320
+ let { unit, unitDisplay = "short", locale } = this.resolvedOptions();
321
+ if (!unit) return res;
322
+ let values = $1dfb119a85e764e5$var$UNITS[unit]?.[unitDisplay];
323
+ res += values[locale] || values.default;
324
+ }
325
+ return res;
326
+ }
327
+ /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
328
+ formatToParts(value) {
329
+ return this.numberFormatter.formatToParts(value);
330
+ }
331
+ /** Formats a number range as a string. */
332
+ formatRange(start, end) {
333
+ if (typeof this.numberFormatter.formatRange === "function") return this.numberFormatter.formatRange(start, end);
334
+ if (end < start) throw new RangeError("End date must be >= start date");
335
+ return `${this.format(start)} \u{2013} ${this.format(end)}`;
336
+ }
337
+ /** Formats a number range as an array of parts. */
338
+ formatRangeToParts(start, end) {
339
+ if (typeof this.numberFormatter.formatRangeToParts === "function") return this.numberFormatter.formatRangeToParts(start, end);
340
+ if (end < start) throw new RangeError("End date must be >= start date");
341
+ let startParts = this.numberFormatter.formatToParts(start);
342
+ let endParts = this.numberFormatter.formatToParts(end);
343
+ return [
344
+ ...startParts.map((p) => ({
345
+ ...p,
346
+ source: "startRange"
347
+ })),
348
+ {
349
+ type: "literal",
350
+ value: " – ",
351
+ source: "shared"
352
+ },
353
+ ...endParts.map((p) => ({
354
+ ...p,
355
+ source: "endRange"
356
+ }))
357
+ ];
358
+ }
359
+ /** Returns the resolved formatting options based on the values passed to the constructor. */
360
+ resolvedOptions() {
361
+ let options = this.numberFormatter.resolvedOptions();
362
+ if (!$1dfb119a85e764e5$var$supportsSignDisplay && this.options.signDisplay != null) options = {
363
+ ...options,
364
+ signDisplay: this.options.signDisplay
365
+ };
366
+ if (!$1dfb119a85e764e5$var$supportsUnit && this.options.style === "unit") options = {
367
+ ...options,
368
+ style: "unit",
369
+ unit: this.options.unit,
370
+ unitDisplay: this.options.unitDisplay
371
+ };
372
+ return options;
373
+ }
374
+ };
375
+ function $1dfb119a85e764e5$var$getCachedNumberFormatter(locale, options = {}) {
376
+ let { numberingSystem } = options;
377
+ if (numberingSystem && locale.includes("-nu-")) {
378
+ if (!locale.includes("-u-")) locale += "-u-";
379
+ locale += `-nu-${numberingSystem}`;
380
+ }
381
+ if (options.style === "unit" && !$1dfb119a85e764e5$var$supportsUnit) {
382
+ let { unit, unitDisplay = "short" } = options;
383
+ if (!unit) throw new Error("unit option must be provided with style: \"unit\"");
384
+ if (!$1dfb119a85e764e5$var$UNITS[unit]?.[unitDisplay]) throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);
385
+ options = {
386
+ ...options,
387
+ style: "decimal"
388
+ };
389
+ }
390
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
391
+ if ($1dfb119a85e764e5$var$formatterCache.has(cacheKey)) return $1dfb119a85e764e5$var$formatterCache.get(cacheKey);
392
+ let numberFormatter = new Intl.NumberFormat(locale, options);
393
+ $1dfb119a85e764e5$var$formatterCache.set(cacheKey, numberFormatter);
394
+ return numberFormatter;
395
+ }
396
+ function $1dfb119a85e764e5$export$711b50b3c525e0f2(numberFormat, signDisplay, num) {
397
+ if (signDisplay === "auto") return numberFormat.format(num);
398
+ else if (signDisplay === "never") return numberFormat.format(Math.abs(num));
399
+ else {
400
+ let needsPositiveSign = false;
401
+ if (signDisplay === "always") needsPositiveSign = num > 0 || Object.is(num, 0);
402
+ else if (signDisplay === "exceptZero") if (Object.is(num, -0) || Object.is(num, 0)) num = Math.abs(num);
403
+ else needsPositiveSign = num > 0;
404
+ if (needsPositiveSign) {
405
+ let negative = numberFormat.format(-num);
406
+ let noSign = numberFormat.format(num);
407
+ let minus = negative.replace(noSign, "").replace(/\u200e|\u061C/, "");
408
+ if ([...minus].length !== 1) console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case");
409
+ return negative.replace(noSign, "!!!").replace(minus, "+").replace("!!!", noSign);
410
+ } else return numberFormat.format(num);
411
+ }
412
+ }
413
+ var $eb76cf4feb040f77$var$CURRENCY_SIGN_REGEX = /* @__PURE__ */ new RegExp("^.*\\(.*\\).*$");
414
+ var $eb76cf4feb040f77$var$NUMBERING_SYSTEMS = [
415
+ "latn",
416
+ "arab",
417
+ "hanidec",
418
+ "deva",
419
+ "beng",
420
+ "fullwide"
421
+ ];
422
+ var $eb76cf4feb040f77$export$cd11ab140839f11d = class {
423
+ constructor(locale, options = {}) {
424
+ this.locale = locale;
425
+ this.options = options;
426
+ }
427
+ /**
428
+ * Parses the given string to a number. Returns NaN if a valid number could not be parsed.
429
+ */
430
+ parse(value) {
431
+ return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).parse(value);
432
+ }
433
+ /**
434
+ * Returns whether the given string could potentially be a valid number. This should be used to
435
+ * validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
436
+ * of the minus/plus sign characters can be checked.
437
+ */
438
+ isValidPartialNumber(value, minValue, maxValue) {
439
+ return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).isValidPartialNumber(value, minValue, maxValue);
440
+ }
441
+ /**
442
+ * Returns a numbering system for which the given string is valid in the current locale.
443
+ * If no numbering system could be detected, the default numbering system for the current
444
+ * locale is returned.
445
+ */
446
+ getNumberingSystem(value) {
447
+ return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).options.numberingSystem;
448
+ }
449
+ };
450
+ var $eb76cf4feb040f77$var$numberParserCache = /* @__PURE__ */ new Map();
451
+ function $eb76cf4feb040f77$var$getNumberParserImpl(locale, options, value) {
452
+ let defaultParser = $eb76cf4feb040f77$var$getCachedNumberParser(locale, options);
453
+ if (!locale.includes("-nu-") && !defaultParser.isValidPartialNumber(value)) {
454
+ for (let numberingSystem of $eb76cf4feb040f77$var$NUMBERING_SYSTEMS) if (numberingSystem !== defaultParser.options.numberingSystem) {
455
+ let parser = $eb76cf4feb040f77$var$getCachedNumberParser(locale + (locale.includes("-u-") ? "-nu-" : "-u-nu-") + numberingSystem, options);
456
+ if (parser.isValidPartialNumber(value)) return parser;
457
+ }
458
+ }
459
+ return defaultParser;
460
+ }
461
+ function $eb76cf4feb040f77$var$getCachedNumberParser(locale, options) {
462
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
463
+ let parser = $eb76cf4feb040f77$var$numberParserCache.get(cacheKey);
464
+ if (!parser) {
465
+ parser = new $eb76cf4feb040f77$var$NumberParserImpl(locale, options);
466
+ $eb76cf4feb040f77$var$numberParserCache.set(cacheKey, parser);
467
+ }
468
+ return parser;
469
+ }
470
+ var $eb76cf4feb040f77$var$NumberParserImpl = class {
471
+ constructor(locale, options = {}) {
472
+ this.locale = locale;
473
+ if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {
474
+ if (options.maximumFractionDigits == null && options.minimumFractionDigits == null) {
475
+ options.maximumFractionDigits = 0;
476
+ options.minimumFractionDigits = 0;
477
+ } else if (options.maximumFractionDigits == null) options.maximumFractionDigits = options.minimumFractionDigits;
478
+ else if (options.minimumFractionDigits == null) options.minimumFractionDigits = options.maximumFractionDigits;
479
+ }
480
+ this.formatter = new Intl.NumberFormat(locale, options);
481
+ this.options = this.formatter.resolvedOptions();
482
+ this.symbols = $eb76cf4feb040f77$var$getSymbols(locale, this.formatter, this.options, options);
483
+ if (this.options.style === "percent" && ((this.options.minimumFractionDigits ?? 0) > 18 || (this.options.maximumFractionDigits ?? 0) > 18)) console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
484
+ }
485
+ parse(value) {
486
+ let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
487
+ let fullySanitizedValue = this.sanitize(value);
488
+ if (!isGroupSymbolAllowed && this.symbols.group && fullySanitizedValue.includes(this.symbols.group)) return NaN;
489
+ else if (this.symbols.group) fullySanitizedValue = fullySanitizedValue.replaceAll(this.symbols.group, "");
490
+ if (this.symbols.decimal) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.decimal, ".");
491
+ if (this.symbols.minusSign) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
492
+ fullySanitizedValue = fullySanitizedValue.replace(this.symbols.numeral, this.symbols.index);
493
+ if (this.options.style === "percent") {
494
+ let isNegative = fullySanitizedValue.indexOf("-");
495
+ fullySanitizedValue = fullySanitizedValue.replace("-", "");
496
+ fullySanitizedValue = fullySanitizedValue.replace("+", "");
497
+ let index = fullySanitizedValue.indexOf(".");
498
+ if (index === -1) index = fullySanitizedValue.length;
499
+ fullySanitizedValue = fullySanitizedValue.replace(".", "");
500
+ if (index - 2 === 0) fullySanitizedValue = `0.${fullySanitizedValue}`;
501
+ else if (index - 2 === -1) fullySanitizedValue = `0.0${fullySanitizedValue}`;
502
+ else if (index - 2 === -2) fullySanitizedValue = "0.00";
503
+ else fullySanitizedValue = `${fullySanitizedValue.slice(0, index - 2)}.${fullySanitizedValue.slice(index - 2)}`;
504
+ if (isNegative > -1) fullySanitizedValue = `-${fullySanitizedValue}`;
505
+ }
506
+ let newValue = fullySanitizedValue ? +fullySanitizedValue : NaN;
507
+ if (isNaN(newValue)) return NaN;
508
+ if (this.options.style === "percent") {
509
+ let options = {
510
+ ...this.options,
511
+ style: "decimal",
512
+ minimumFractionDigits: Math.min((this.options.minimumFractionDigits ?? 0) + 2, 20),
513
+ maximumFractionDigits: Math.min((this.options.maximumFractionDigits ?? 0) + 2, 20)
514
+ };
515
+ return new $eb76cf4feb040f77$export$cd11ab140839f11d(this.locale, options).parse(new $1dfb119a85e764e5$export$cc77c4ff7e8673c5(this.locale, options).format(newValue));
516
+ }
517
+ if (this.options.currencySign === "accounting" && $eb76cf4feb040f77$var$CURRENCY_SIGN_REGEX.test(value)) newValue = -1 * newValue;
518
+ return newValue;
519
+ }
520
+ sanitize(value) {
521
+ let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
522
+ if (this.symbols.noNumeralUnits.length > 0 && this.symbols.noNumeralUnits.find((obj) => obj.unit === value)) return this.symbols.noNumeralUnits.find((obj) => obj.unit === value).value.toString();
523
+ value = value.replace(this.symbols.literals, "");
524
+ if (this.symbols.minusSign) value = value.replace("-", this.symbols.minusSign);
525
+ if (this.options.numberingSystem === "arab") {
526
+ if (this.symbols.decimal) {
527
+ value = $eb76cf4feb040f77$var$replaceAll(value, ",", this.symbols.decimal);
528
+ value = $eb76cf4feb040f77$var$replaceAll(value, String.fromCharCode(1548), this.symbols.decimal);
529
+ }
530
+ if (this.symbols.group && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, ".", this.symbols.group);
531
+ }
532
+ if (this.symbols.group === "’" && value.includes("'") && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, "'", this.symbols.group);
533
+ if (this.symbols.group === "'" && value.includes("’") && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, "’", this.symbols.group);
534
+ if (this.options.locale === "fr-FR" && this.symbols.group && isGroupSymbolAllowed) {
535
+ value = $eb76cf4feb040f77$var$replaceAll(value, " ", this.symbols.group);
536
+ value = $eb76cf4feb040f77$var$replaceAll(value, /\u00A0/g, this.symbols.group);
537
+ }
538
+ return value;
539
+ }
540
+ isValidPartialNumber(value, minValue = -Infinity, maxValue = Infinity) {
541
+ let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
542
+ value = this.sanitize(value);
543
+ if (this.symbols.minusSign && value.startsWith(this.symbols.minusSign) && minValue < 0) value = value.slice(this.symbols.minusSign.length);
544
+ else if (this.symbols.plusSign && value.startsWith(this.symbols.plusSign) && maxValue > 0) value = value.slice(this.symbols.plusSign.length);
545
+ if (this.symbols.decimal && value.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0) return false;
546
+ if (this.symbols.group && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, this.symbols.group, "");
547
+ value = value.replace(this.symbols.numeral, "");
548
+ if (this.symbols.decimal) value = value.replace(this.symbols.decimal, "");
549
+ return value.length === 0;
550
+ }
551
+ };
552
+ var $eb76cf4feb040f77$var$nonLiteralParts = /* @__PURE__ */ new Set([
553
+ "decimal",
554
+ "fraction",
555
+ "integer",
556
+ "minusSign",
557
+ "plusSign",
558
+ "group"
559
+ ]);
560
+ var $eb76cf4feb040f77$var$pluralNumbers = [
561
+ 0,
562
+ 4,
563
+ 2,
564
+ 1,
565
+ 11,
566
+ 20,
567
+ 3,
568
+ 7,
569
+ 100,
570
+ 21,
571
+ .1,
572
+ 1.1
573
+ ];
574
+ function $eb76cf4feb040f77$var$getSymbols(locale, formatter, intlOptions, originalOptions) {
575
+ let symbolFormatter = new Intl.NumberFormat(locale, {
576
+ ...intlOptions,
577
+ minimumSignificantDigits: 1,
578
+ maximumSignificantDigits: 21,
579
+ roundingIncrement: 1,
580
+ roundingPriority: "auto",
581
+ roundingMode: "halfExpand",
582
+ useGrouping: true
583
+ });
584
+ let allParts = symbolFormatter.formatToParts(-10000.111);
585
+ let posAllParts = symbolFormatter.formatToParts(10000.111);
586
+ let pluralParts = $eb76cf4feb040f77$var$pluralNumbers.map((n) => symbolFormatter.formatToParts(n));
587
+ let noNumeralUnits = pluralParts.map((p, i) => {
588
+ let unit = p.find((p) => p.type === "unit");
589
+ if (unit && !p.some((p) => p.type === "integer" || p.type === "fraction")) return {
590
+ unit: unit.value,
591
+ value: $eb76cf4feb040f77$var$pluralNumbers[i]
592
+ };
593
+ return null;
594
+ }).filter((p) => !!p);
595
+ let minusSign = allParts.find((p) => p.type === "minusSign")?.value ?? "-";
596
+ let plusSign = posAllParts.find((p) => p.type === "plusSign")?.value;
597
+ if (!plusSign && (originalOptions?.signDisplay === "exceptZero" || originalOptions?.signDisplay === "always")) plusSign = "+";
598
+ let decimal = new Intl.NumberFormat(locale, {
599
+ ...intlOptions,
600
+ minimumFractionDigits: 2,
601
+ maximumFractionDigits: 2
602
+ }).formatToParts(.001).find((p) => p.type === "decimal")?.value;
603
+ let group = allParts.find((p) => p.type === "group")?.value;
604
+ let allPartsLiterals = allParts.filter((p) => !$eb76cf4feb040f77$var$nonLiteralParts.has(p.type)).map((p) => $eb76cf4feb040f77$var$escapeRegex(p.value));
605
+ let pluralPartsLiterals = pluralParts.flatMap((p) => p.filter((p) => !$eb76cf4feb040f77$var$nonLiteralParts.has(p.type)).map((p) => $eb76cf4feb040f77$var$escapeRegex(p.value)));
606
+ let sortedLiterals = [.../* @__PURE__ */ new Set([...allPartsLiterals, ...pluralPartsLiterals])].sort((a, b) => b.length - a.length);
607
+ let literals = sortedLiterals.length === 0 ? /* @__PURE__ */ new RegExp("\\p{White_Space}|\\p{Cf}", "gu") : new RegExp(`${sortedLiterals.join("|")}|\\p{White_Space}|\\p{Cf}`, "gu");
608
+ let numerals = [...new Intl.NumberFormat(intlOptions.locale, { useGrouping: false }).format(9876543210)].reverse();
609
+ let indexes = new Map(numerals.map((d, i) => [d, i]));
610
+ let numeral = new RegExp(`[${numerals.join("")}]`, "g");
611
+ let index = (d) => String(indexes.get(d));
612
+ return {
613
+ minusSign,
614
+ plusSign,
615
+ decimal,
616
+ group,
617
+ literals,
618
+ numeral,
619
+ numerals,
620
+ index,
621
+ noNumeralUnits
622
+ };
623
+ }
624
+ function $eb76cf4feb040f77$var$replaceAll(str, find, replace) {
625
+ if (str.replaceAll) return str.replaceAll(find, replace);
626
+ return str.split(find).join(replace);
627
+ }
628
+ function $eb76cf4feb040f77$var$escapeRegex(string) {
629
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
630
+ }
631
+ var _tmpl$$1 = [
632
+ "<div",
633
+ " style=\"",
634
+ "\" aria-hidden=\"true\">",
635
+ "</div>"
636
+ ];
637
+ __export({}, {
638
+ DecrementTrigger: () => NumberFieldDecrementTrigger,
639
+ Description: () => FormControlDescription,
640
+ ErrorMessage: () => FormControlErrorMessage,
641
+ HiddenInput: () => NumberFieldHiddenInput,
642
+ IncrementTrigger: () => NumberFieldIncrementTrigger,
643
+ Input: () => NumberFieldInput,
644
+ Label: () => FormControlLabel,
645
+ NumberField: () => NumberField,
646
+ Root: () => NumberFieldRoot,
647
+ useNumberFieldContext: () => useNumberFieldContext
648
+ });
649
+ var NumberFieldContext = createContext();
650
+ function useNumberFieldContext() {
651
+ const context = useContext(NumberFieldContext);
652
+ if (context === void 0) throw new Error("[kobalte]: `useNumberFieldContext` must be used within a `NumberField` component");
653
+ return context;
654
+ }
655
+ function NumberFieldVaryTrigger(props) {
656
+ const formControlContext = useFormControlContext();
657
+ const context = useNumberFieldContext();
658
+ const [local, others] = splitProps(props, ["numberFieldVaryType", "onClick"]);
659
+ return createComponent(ButtonRoot, mergeProps({
660
+ tabIndex: -1,
661
+ get disabled() {
662
+ return formControlContext.isDisabled() || context.rawValue() === (local.numberFieldVaryType === "increment" ? context.maxValue() : context.minValue());
663
+ },
664
+ get ["aria-controls"]() {
665
+ return formControlContext.fieldId();
666
+ },
667
+ onClick: (e) => {
668
+ callHandler(e, local.onClick);
669
+ context.varyValue(context.step() * (local.numberFieldVaryType === "increment" ? 1 : -1));
670
+ context.inputRef()?.focus({ preventScroll: true });
671
+ }
672
+ }, others));
673
+ }
674
+ function NumberFieldDecrementTrigger(props) {
675
+ return createComponent(NumberFieldVaryTrigger, mergeProps({ numberFieldVaryType: "decrement" }, props));
676
+ }
677
+ function NumberFieldHiddenInput(props) {
678
+ const context = useNumberFieldContext();
679
+ const [local, others] = splitProps(props, ["ref", "onChange"]);
680
+ const formControlContext = useFormControlContext();
681
+ return ssr(_tmpl$$1, ssrHydrationKey(), ssrStyle(visuallyHiddenStyles), ssrElement("input", mergeProps({
682
+ type: "text",
683
+ tabIndex: -1,
684
+ style: { "font-size": "16px" },
685
+ get name() {
686
+ return formControlContext.name();
687
+ },
688
+ get value() {
689
+ return Number.isNaN(context.rawValue()) ? "" : context.rawValue();
690
+ },
691
+ get required() {
692
+ return formControlContext.isRequired();
693
+ },
694
+ get disabled() {
695
+ return formControlContext.isDisabled();
696
+ },
697
+ get readOnly() {
698
+ return formControlContext.isReadOnly();
699
+ }
700
+ }, others), void 0, false));
701
+ }
702
+ function NumberFieldIncrementTrigger(props) {
703
+ return createComponent(NumberFieldVaryTrigger, mergeProps({ numberFieldVaryType: "increment" }, props));
704
+ }
705
+ function NumberFieldInput(props) {
706
+ const formControlContext = useFormControlContext();
707
+ const context = useNumberFieldContext();
708
+ const [local, formControlFieldProps, others] = splitProps(mergeDefaultProps({
709
+ id: context.generateId("input"),
710
+ inputMode: "decimal",
711
+ autocomplete: "off",
712
+ autocorrect: "off",
713
+ spellcheck: false
714
+ }, props), [
715
+ "ref",
716
+ "onInput",
717
+ "onChange",
718
+ "onWheel",
719
+ "as"
720
+ ], FORM_CONTROL_FIELD_PROP_NAMES);
721
+ const { fieldProps } = createFormControlField(formControlFieldProps);
722
+ return createComponent(SpinButtonRoot, mergeProps({
723
+ type: "text",
724
+ get id() {
725
+ return fieldProps.id();
726
+ },
727
+ get value() {
728
+ return context.value();
729
+ },
730
+ get validationState() {
731
+ return formControlContext.validationState();
732
+ },
733
+ get required() {
734
+ return formControlContext.isRequired();
735
+ },
736
+ get disabled() {
737
+ return formControlContext.isDisabled();
738
+ },
739
+ get readOnly() {
740
+ return formControlContext.isReadOnly();
741
+ },
742
+ get textValue() {
743
+ return context.textValue();
744
+ },
745
+ get minValue() {
746
+ return context.minValue();
747
+ },
748
+ get maxValue() {
749
+ return context.maxValue();
750
+ },
751
+ onIncrement: () => {
752
+ context.varyValue(context.step());
753
+ },
754
+ onIncrementPage: () => {
755
+ context.varyValue(context.largeStep());
756
+ },
757
+ onIncrementToMax: () => {
758
+ context.setValue(context.maxValue());
759
+ context.format();
760
+ },
761
+ onDecrement: () => {
762
+ context.varyValue(-context.step());
763
+ },
764
+ onDecrementPage: () => {
765
+ context.varyValue(-context.largeStep());
766
+ },
767
+ onDecrementToMin: () => {
768
+ context.setValue(context.minValue());
769
+ context.format();
770
+ },
771
+ get translations() {
772
+ return context.translations();
773
+ },
774
+ onChange: (e) => {
775
+ callHandler(e, local.onChange);
776
+ context.format();
777
+ },
778
+ onWheel: (e) => {
779
+ callHandler(e, local.onWheel);
780
+ if (!context.changeOnWheel() || document.activeElement !== context.inputRef()) return;
781
+ e.preventDefault();
782
+ if (e.deltaY < 0) context.varyValue(context.step());
783
+ else context.varyValue(-context.step());
784
+ },
785
+ get onInput() {
786
+ return composeEventHandlers([local.onInput, context.onInput]);
787
+ },
788
+ get ["aria-label"]() {
789
+ return fieldProps.ariaLabel();
790
+ },
791
+ get ["aria-labelledby"]() {
792
+ return fieldProps.ariaLabelledBy();
793
+ },
794
+ get ["aria-describedby"]() {
795
+ return fieldProps.ariaDescribedBy();
796
+ }
797
+ }, () => formControlContext.dataset(), { as: (props2) => createComponent(Polymorphic, mergeProps({
798
+ get as() {
799
+ return local.as || "input";
800
+ },
801
+ get value() {
802
+ return Number.isNaN(context.rawValue()) || context.value() === void 0 ? "" : context.formatNumber(context.rawValue());
803
+ },
804
+ get required() {
805
+ return formControlContext.isRequired();
806
+ },
807
+ get disabled() {
808
+ return formControlContext.isDisabled();
809
+ },
810
+ get readOnly() {
811
+ return formControlContext.isReadOnly();
812
+ }
813
+ }, props2, others)) }));
814
+ }
815
+ function NumberFieldRoot(props) {
816
+ let ref;
817
+ const mergedProps = mergeDefaultProps({
818
+ id: `NumberField-${createUniqueId()}`,
819
+ format: true,
820
+ minValue: Number.MIN_SAFE_INTEGER,
821
+ maxValue: Number.MAX_SAFE_INTEGER,
822
+ step: 1,
823
+ changeOnWheel: true
824
+ }, props);
825
+ const [local, formControlProps, others] = splitProps(mergedProps, [
826
+ "ref",
827
+ "value",
828
+ "defaultValue",
829
+ "onChange",
830
+ "rawValue",
831
+ "onRawValueChange",
832
+ "translations",
833
+ "format",
834
+ "formatOptions",
835
+ "textValue",
836
+ "minValue",
837
+ "maxValue",
838
+ "step",
839
+ "largeStep",
840
+ "changeOnWheel",
841
+ "translations",
842
+ "allowedInput"
843
+ ], FORM_CONTROL_PROP_NAMES);
844
+ const { locale } = useLocale();
845
+ const numberParser = createMemo(() => {
846
+ return new $eb76cf4feb040f77$export$cd11ab140839f11d(locale(), local.formatOptions);
847
+ });
848
+ const numberFormatter = createMemo(() => {
849
+ return new $1dfb119a85e764e5$export$cc77c4ff7e8673c5(locale(), local.formatOptions);
850
+ });
851
+ const formatNumber = (number) => local.format ? numberFormatter().format(number) : number.toString();
852
+ const parseRawValue = (value2) => local.format && typeof value2 !== "number" ? numberParser().parse(value2 ?? "") : Number(value2 ?? "");
853
+ const isValidPartialValue = (value2) => local.format && typeof value2 !== "number" ? numberParser().isValidPartialNumber(value2 ?? "", mergedProps.minValue, mergedProps.maxValue) : !Number.isNaN(Number(value2));
854
+ const [value, setValue] = createControllableSignal({
855
+ value: () => local.value,
856
+ defaultValue: () => local.defaultValue ?? local.rawValue,
857
+ onChange: (value2) => {
858
+ local.onChange?.(typeof value2 === "number" ? formatNumber(value2) : value2);
859
+ local.onRawValueChange?.(parseRawValue(value2));
860
+ }
861
+ });
862
+ if (value() !== void 0) local.onRawValueChange?.(parseRawValue(value()));
863
+ function isAllowedInput(char) {
864
+ if (local.allowedInput !== void 0) return local.allowedInput.test(char);
865
+ return true;
866
+ }
867
+ const { formControlContext } = createFormControl(formControlProps);
868
+ createFormResetListener(() => ref, () => {
869
+ setValue(local.defaultValue ?? "");
870
+ });
871
+ const [inputRef, setInputRef] = createSignal();
872
+ const [hiddenInputRef, setHiddenInputRef] = createSignal();
873
+ const onInput = (e) => {
874
+ if (formControlContext.isReadOnly() || formControlContext.isDisabled()) return;
875
+ const target = e.target;
876
+ let cursorPosition = target.selectionStart;
877
+ if (isValidPartialValue(target.value)) {
878
+ if (e.inputType !== "insertText" || isAllowedInput(e.data || "")) setValue(target.value);
879
+ } else if (e.inputType === "deleteContentBackward") {
880
+ if (cursorPosition !== null) cursorPosition += 1;
881
+ }
882
+ const v = value();
883
+ if (v !== target.value) {
884
+ target.value = String(v ?? "");
885
+ if (cursorPosition !== null) {
886
+ target.selectionStart = cursorPosition;
887
+ target.selectionEnd = cursorPosition;
888
+ }
889
+ }
890
+ };
891
+ const context = {
892
+ value,
893
+ setValue,
894
+ rawValue: () => parseRawValue(value()),
895
+ generateId: createGenerateId(() => access(formControlProps.id)),
896
+ formatNumber,
897
+ format: () => {
898
+ if (!local.format) return;
899
+ let rawValue = context.rawValue();
900
+ if (Number.isNaN(rawValue)) {
901
+ if (hiddenInputRef()) hiddenInputRef().value = "";
902
+ local.onRawValueChange?.(rawValue);
903
+ return;
904
+ }
905
+ if (context.minValue()) rawValue = Math.max(rawValue, context.minValue());
906
+ if (context.maxValue()) rawValue = Math.min(rawValue, context.maxValue());
907
+ const formattedValue = context.formatNumber(rawValue);
908
+ if (value() != formattedValue) setValue(formattedValue);
909
+ if (inputRef()) inputRef().value = formattedValue;
910
+ if (hiddenInputRef()) hiddenInputRef().value = String(rawValue);
911
+ },
912
+ onInput,
913
+ textValue: () => local.textValue,
914
+ minValue: () => local.minValue,
915
+ maxValue: () => local.maxValue,
916
+ step: () => local.step,
917
+ largeStep: () => local.largeStep ?? local.step * 10,
918
+ changeOnWheel: () => local.changeOnWheel,
919
+ translations: () => local.translations,
920
+ inputRef,
921
+ setInputRef,
922
+ hiddenInputRef,
923
+ setHiddenInputRef,
924
+ varyValue: (offset) => {
925
+ let rawValue = context.rawValue() ?? 0;
926
+ if (Number.isNaN(rawValue)) rawValue = 0;
927
+ batch(() => {
928
+ let newValue = rawValue;
929
+ const operation = offset > 0 ? "+" : "-";
930
+ const localStep = Math.abs(offset);
931
+ const min = props.minValue === void 0 ? NaN : context.minValue();
932
+ const max = props.maxValue === void 0 ? NaN : context.maxValue();
933
+ newValue = snapValueToStep(rawValue, min, max, localStep);
934
+ if (!(operation === "+" && newValue > rawValue || operation === "-" && newValue < rawValue)) newValue = snapValueToStep(handleDecimalOperation(operation, rawValue, localStep), min, max, localStep);
935
+ context.setValue(newValue);
936
+ context.format();
937
+ });
938
+ }
939
+ };
940
+ createEffect(on(() => local.rawValue, (rawValue) => {
941
+ if (rawValue !== context.rawValue()) {
942
+ if (Number.isNaN(rawValue)) return;
943
+ batch(() => {
944
+ setValue(rawValue ?? "");
945
+ context.format();
946
+ });
947
+ }
948
+ }, { defer: true }));
949
+ return createComponent(FormControlContext.Provider, {
950
+ value: formControlContext,
951
+ get children() {
952
+ return createComponent(NumberFieldContext.Provider, {
953
+ value: context,
954
+ get children() {
955
+ return createComponent(Polymorphic, mergeProps({
956
+ as: "div",
957
+ role: "group",
958
+ get id() {
959
+ return access(formControlProps.id);
960
+ }
961
+ }, () => formControlContext.dataset(), others));
962
+ }
963
+ });
964
+ }
965
+ });
966
+ }
967
+ function handleDecimalOperation(operator, value1, value2) {
968
+ let result = operator === "+" ? value1 + value2 : value1 - value2;
969
+ if (Number.isFinite(value1) && Number.isFinite(value2) && (value2 % 1 !== 0 || value1 % 1 !== 0)) {
970
+ const offsetPrecision = getPrecision(value2);
971
+ const valuePrecision = getPrecision(value1);
972
+ const multiplier = 10 ** Math.max(offsetPrecision, valuePrecision);
973
+ const multipliedOffset = Math.round(value2 * multiplier);
974
+ const multipliedValue = Math.round(value1 * multiplier);
975
+ result = (operator === "+" ? multipliedValue + multipliedOffset : multipliedValue - multipliedOffset) / multiplier;
976
+ }
977
+ return result;
978
+ }
979
+ var NumberField = Object.assign(NumberFieldRoot, {
980
+ Description: FormControlDescription,
981
+ ErrorMessage: FormControlErrorMessage,
982
+ HiddenInput: NumberFieldHiddenInput,
983
+ Input: NumberFieldInput,
984
+ IncrementTrigger: NumberFieldIncrementTrigger,
985
+ DecrementTrigger: NumberFieldDecrementTrigger,
986
+ Label: FormControlLabel
987
+ });
988
+ var { graphql } = import_relay_runtime?.default?.default?.__esModule ? import_relay_runtime.default.default : import_relay_runtime?.default?.__esModule ? import_relay_runtime.default : import_relay_runtime;
989
+ var _tmpl$ = [
990
+ "<p",
991
+ " class=\"",
992
+ "\" role=\"alert\">",
993
+ "</p>"
994
+ ];
995
+ var _tmpl$2 = [
996
+ "<main",
997
+ "><!--$-->",
998
+ "<!--/--><section",
999
+ " aria-labelledby=\"create-actors-title\"><header",
1000
+ "><h1 id=\"create-actors-title\">Create Actors</h1><p>Selected Instance: <!--$-->",
1001
+ "<!--/--></p></header><!--$-->",
1002
+ "<!--/--><!--$-->",
1003
+ "<!--/--></section></main>"
1004
+ ];
1005
+ var _tmpl$3 = [
1006
+ "<span",
1007
+ " class=\"",
1008
+ "\" role=\"alert\">",
1009
+ "</span>"
1010
+ ];
1011
+ var id$$ = "src/routes/workspace/create/[instance_id]/actors.tsx?pick=default&pick=$css&lang.tsx";
1012
+ var getHostQuery = node$3;
1013
+ var generateActorsMutation = node;
1014
+ var generateActorsSchema = object({ size: pipe(number("Enter the number of actors."), integer("The number of actors must be a whole number."), minValue(1, "Create at least one actor.")) });
1015
+ function CreateActorsPage(props) {
1016
+ const [errorMessage, setErrorMessage] = createSignal();
1017
+ const [commitGenerateActors, isGeneratingActors] = createMutation(generateActorsMutation);
1018
+ const data = createPreloadedQuery(getHostQuery, () => props.data);
1019
+ const generateActorsForm = createForm({
1020
+ schema: generateActorsSchema,
1021
+ initialInput: { size: 1 }
1022
+ });
1023
+ const submit = ({ size }) => {
1024
+ const { id: instance, host, localInstance } = data()?.instance ?? {};
1025
+ const slug = localInstance?.slug;
1026
+ if (instance === void 0 || slug === void 0) {
1027
+ setErrorMessage("Instance not found.");
1028
+ return;
1029
+ }
1030
+ setErrorMessage(void 0);
1031
+ commitGenerateActors({
1032
+ variables: {
1033
+ instance,
1034
+ size
1035
+ },
1036
+ onCompleted: (response, errors) => {
1037
+ const graphQLErrors = errors ?? [];
1038
+ if (graphQLErrors.length > 0) {
1039
+ setErrorMessage(graphQLErrors.map((error) => error.message).join("\n"));
1040
+ return;
1041
+ }
1042
+ const result = response.generateActors;
1043
+ switch (result.resultType) {
1044
+ case "CreateActorsSuccess":
1045
+ navigateWithToast(`/instance/${encodeURIComponent(slug)}`, `Successfully created actors on ${host}.`, "success");
1046
+ return;
1047
+ case "CreateActorsError": switch (result.type) {
1048
+ case "InvalidSize":
1049
+ setErrorMessage("Enter at least one actor.");
1050
+ return;
1051
+ case "InstanceNotFound":
1052
+ setErrorMessage("The selected instance could not be found or is no longer available.");
1053
+ return;
1054
+ case "InvalidInstanceHost":
1055
+ case "TooManyActors":
1056
+ setErrorMessage(result.message);
1057
+ return;
1058
+ case "%future added value":
1059
+ setErrorMessage("The server returned an unsupported actor-generation error.");
1060
+ return;
1061
+ default:
1062
+ setErrorMessage("Unable to generate actors.");
1063
+ return;
1064
+ }
1065
+ case "%other":
1066
+ setErrorMessage("Unable to generate actors.");
1067
+ return;
1068
+ default: setErrorMessage("Unable to generate actors.");
1069
+ }
1070
+ },
1071
+ onError: (error) => {
1072
+ setErrorMessage(error.message);
1073
+ }
1074
+ });
1075
+ };
1076
+ return ssr(_tmpl$2, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.page, true), false), escape(createComponent(Title, { children: "Create Actors" })), ssrAttribute("class", escape(form_module_default.panel, true), false), ssrAttribute("class", escape(form_module_default.header, true), false), escape(data()?.instance?.host), escape(createComponent(Form, {
1077
+ get ["class"]() {
1078
+ return form_module_default.form;
1079
+ },
1080
+ of: generateActorsForm,
1081
+ onSubmit: submit,
1082
+ get children() {
1083
+ return [createComponent(Field, {
1084
+ of: generateActorsForm,
1085
+ path: ["size"],
1086
+ children: (field) => createComponent(NumberField, {
1087
+ get ["class"]() {
1088
+ return form_module_default.field;
1089
+ },
1090
+ get name() {
1091
+ return field.props.name;
1092
+ },
1093
+ get value() {
1094
+ return Number.isNaN(field.input) ? "" : field.input ?? "";
1095
+ },
1096
+ minValue: 1,
1097
+ onRawValueChange: (value) => {
1098
+ field.onInput(Number.isNaN(value) ? void 0 : value);
1099
+ },
1100
+ get children() {
1101
+ return [
1102
+ createComponent(NumberField.Label, {
1103
+ get ["class"]() {
1104
+ return form_module_default.field;
1105
+ },
1106
+ children: "Size"
1107
+ }),
1108
+ createComponent(NumberField.Input, {
1109
+ get onFocus() {
1110
+ return field.props.onFocus;
1111
+ },
1112
+ get onBlur() {
1113
+ return field.props.onBlur;
1114
+ },
1115
+ get ["class"]() {
1116
+ return form_module_default.input;
1117
+ },
1118
+ get ["aria-invalid"]() {
1119
+ return Boolean(field.errors);
1120
+ }
1121
+ }),
1122
+ createComponent(NumberField.Description, {
1123
+ get ["class"]() {
1124
+ return form_module_default.hint;
1125
+ },
1126
+ get children() {
1127
+ return ["DrFed generates actors in ", data()?.instance?.host];
1128
+ }
1129
+ }),
1130
+ createComponent(Show, {
1131
+ get when() {
1132
+ return field.errors;
1133
+ },
1134
+ children: (errors) => ssr(_tmpl$3, ssrHydrationKey(), `${escape(form_module_default.notice, true)} ${escape(form_module_default.error, true)}`, escape(errors()[0]))
1135
+ })
1136
+ ];
1137
+ }
1138
+ })
1139
+ }), createComponent(Button, {
1140
+ get ["class"]() {
1141
+ return form_module_default.button;
1142
+ },
1143
+ type: "submit",
1144
+ get disabled() {
1145
+ return isGeneratingActors() || data()?.instance?.localInstance?.slug === void 0;
1146
+ },
1147
+ children: "Create Actors"
1148
+ })];
1149
+ }
1150
+ })), escape(createComponent(Show, {
1151
+ get when() {
1152
+ return errorMessage();
1153
+ },
1154
+ get children() {
1155
+ return ssr(_tmpl$, ssrHydrationKey(), `${escape(form_module_default.notice, true)} ${escape(form_module_default.error, true)}`, escape(errorMessage()));
1156
+ }
1157
+ })));
1158
+ }
1159
+ //#endregion
1160
+ export { CreateActorsPage as default, id$$ };