@wix/form-public 0.221.0 → 0.223.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5110,446 +5110,9 @@ var init_browser = __esm({
5110
5110
  }
5111
5111
  });
5112
5112
 
5113
- // ../../node_modules/@wix/sdk-runtime/build/context-v2.js
5114
- function contextualizeRESTModuleV2(restModule, elevated) {
5115
- return ((...args) => {
5116
- const context = resolveContext();
5117
- if (!context) {
5118
- return restModule.apply(void 0, args);
5119
- }
5120
- return context.initWixModules(restModule, elevated).apply(void 0, args);
5121
- });
5122
- }
5123
- var init_context_v2 = __esm({
5124
- "../../node_modules/@wix/sdk-runtime/build/context-v2.js"() {
5125
- init_context();
5126
- }
5127
- });
5128
-
5129
- // ../../node_modules/@wix/sdk-runtime/build/context.js
5130
- function resolveContext() {
5131
- const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
5132
- if (oldContext) {
5133
- return {
5134
- // @ts-expect-error
5135
- initWixModules(modules, elevated) {
5136
- return runWithoutContext(() => oldContext(modules, elevated));
5137
- },
5138
- fetchWithAuth() {
5139
- throw new Error("fetchWithAuth is not available in this context");
5140
- },
5141
- graphql() {
5142
- throw new Error("graphql is not available in this context");
5143
- }
5144
- };
5145
- }
5146
- const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
5147
- const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
5148
- if (!contextualClient && !elevatedClient) {
5149
- return;
5150
- }
5151
- return {
5152
- initWixModules(wixModules, elevated) {
5153
- if (elevated) {
5154
- if (!elevatedClient) {
5155
- throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
5156
- }
5157
- return runWithoutContext(() => elevatedClient.use(wixModules));
5158
- }
5159
- if (!contextualClient) {
5160
- throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
5161
- }
5162
- return runWithoutContext(() => contextualClient.use(wixModules));
5163
- },
5164
- fetchWithAuth: (urlOrRequest, requestInit) => {
5165
- if (!contextualClient) {
5166
- throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
5167
- }
5168
- return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
5169
- },
5170
- getAuth() {
5171
- if (!contextualClient) {
5172
- throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
5173
- }
5174
- return contextualClient.auth;
5175
- },
5176
- async graphql(query, variables, opts) {
5177
- if (!contextualClient) {
5178
- throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
5179
- }
5180
- return contextualClient.graphql(query, variables, opts);
5181
- }
5182
- };
5183
- }
5184
- function runWithoutContext(fn) {
5185
- const globalContext = globalThis.__wix_context__;
5186
- const moduleContext = {
5187
- client: wixContext.client,
5188
- elevatedClient: wixContext.elevatedClient
5189
- };
5190
- let closureContext;
5191
- globalThis.__wix_context__ = void 0;
5192
- wixContext.client = void 0;
5193
- wixContext.elevatedClient = void 0;
5194
- if (typeof $wixContext !== "undefined") {
5195
- closureContext = {
5196
- client: $wixContext?.client,
5197
- elevatedClient: $wixContext?.elevatedClient
5198
- };
5199
- delete $wixContext.client;
5200
- delete $wixContext.elevatedClient;
5201
- }
5202
- try {
5203
- return fn();
5204
- } finally {
5205
- globalThis.__wix_context__ = globalContext;
5206
- wixContext.client = moduleContext.client;
5207
- wixContext.elevatedClient = moduleContext.elevatedClient;
5208
- if (typeof $wixContext !== "undefined") {
5209
- $wixContext.client = closureContext.client;
5210
- $wixContext.elevatedClient = closureContext.elevatedClient;
5211
- }
5212
- }
5213
- }
5214
- var init_context = __esm({
5215
- "../../node_modules/@wix/sdk-runtime/build/context.js"() {
5216
- init_browser();
5217
- init_context_v2();
5218
- }
5219
- });
5220
-
5221
- // ../../node_modules/@wix/sdk-runtime/build/constants.js
5222
- var SDKRequestToRESTRequestRenameMap, RESTResponseToSDKResponseRenameMap;
5223
- var init_constants = __esm({
5224
- "../../node_modules/@wix/sdk-runtime/build/constants.js"() {
5225
- SDKRequestToRESTRequestRenameMap = {
5226
- _id: "id",
5227
- _createdDate: "createdDate",
5228
- _updatedDate: "updatedDate"
5229
- };
5230
- RESTResponseToSDKResponseRenameMap = {
5231
- id: "_id",
5232
- createdDate: "_createdDate",
5233
- updatedDate: "_updatedDate"
5234
- };
5235
- }
5236
- });
5237
-
5238
- // ../../node_modules/@wix/sdk-runtime/build/utils.js
5239
- function removeUndefinedKeys(obj) {
5240
- return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
5241
- }
5242
- function constantCase(input) {
5243
- return split(input).map((part) => part.toLocaleUpperCase()).join("_");
5244
- }
5245
- function split(value) {
5246
- let result2 = value.trim();
5247
- result2 = result2.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
5248
- result2 = result2.replace(DEFAULT_STRIP_REGEXP, "\0");
5249
- let start = 0;
5250
- let end = result2.length;
5251
- while (result2.charAt(start) === "\0") {
5252
- start++;
5253
- }
5254
- if (start === end) {
5255
- return [];
5256
- }
5257
- while (result2.charAt(end - 1) === "\0") {
5258
- end--;
5259
- }
5260
- return result2.slice(start, end).split(/\0/g);
5261
- }
5262
- var SPLIT_LOWER_UPPER_RE, SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE, DEFAULT_STRIP_REGEXP;
5263
- var init_utils2 = __esm({
5264
- "../../node_modules/@wix/sdk-runtime/build/utils.js"() {
5265
- SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
5266
- SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
5267
- SPLIT_REPLACE_VALUE = "$1\0$2";
5268
- DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
5269
- }
5270
- });
5271
-
5272
- // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
5273
- function transformError(httpClientError, pathsToArguments = {
5274
- explicitPathsToArguments: {},
5275
- spreadPathsToArguments: {},
5276
- singleArgumentUnchanged: false
5277
- }, argumentNames = []) {
5278
- if (typeof httpClientError !== "object" || httpClientError === null) {
5279
- throw httpClientError;
5280
- }
5281
- if (isValidationError(httpClientError)) {
5282
- return buildValidationError(httpClientError, pathsToArguments, argumentNames);
5283
- }
5284
- if (isApplicationError(httpClientError)) {
5285
- return buildApplicationError(httpClientError);
5286
- }
5287
- if (isClientError(httpClientError)) {
5288
- const status = httpClientError.response?.status;
5289
- const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
5290
- const message = httpClientError.response?.data?.message ?? statusText;
5291
- const details = {
5292
- applicationError: {
5293
- description: statusText,
5294
- code: constantCase(statusText),
5295
- data: {}
5296
- },
5297
- requestId: httpClientError.requestId
5298
- };
5299
- return wrapError(httpClientError, {
5300
- message: JSON.stringify({
5301
- message,
5302
- details
5303
- }, null, 2),
5304
- extraProperties: {
5305
- details,
5306
- status
5307
- }
5308
- });
5309
- }
5310
- return buildSystemError(httpClientError);
5311
- }
5312
- var isValidationError, isApplicationError, isClientError, buildValidationError, wrapError, buildApplicationError, buildSystemError, violationsWithRenamedFields, withRenamedArgument, getArgumentIndex;
5313
- var init_transform_error = __esm({
5314
- "../../node_modules/@wix/sdk-runtime/build/transform-error.js"() {
5315
- init_utils2();
5316
- isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
5317
- isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
5318
- isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
5319
- buildValidationError = (httpClientError, pathsToArguments, argumentNames) => {
5320
- const validationErrorResponse = httpClientError.response?.data;
5321
- const requestId = httpClientError.requestId;
5322
- const { fieldViolations } = validationErrorResponse.details.validationError;
5323
- const transformedFieldViolations = violationsWithRenamedFields(pathsToArguments, fieldViolations, argumentNames)?.sort((a, b) => a.field < b.field ? -1 : 1);
5324
- const message = `INVALID_ARGUMENT: ${transformedFieldViolations?.map(({ field, description }) => `"${field}" ${description}`)?.join(", ")}`;
5325
- const details = {
5326
- validationError: { fieldViolations: transformedFieldViolations },
5327
- requestId
5328
- };
5329
- return wrapError(httpClientError, {
5330
- message: JSON.stringify({ message, details }, null, 2),
5331
- extraProperties: {
5332
- details,
5333
- status: httpClientError.response?.status,
5334
- requestId
5335
- }
5336
- });
5337
- };
5338
- wrapError = (baseError, { message, extraProperties }) => {
5339
- return Object.assign(baseError, {
5340
- ...extraProperties,
5341
- message
5342
- });
5343
- };
5344
- buildApplicationError = (httpClientError) => {
5345
- const status = httpClientError.response?.status;
5346
- const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
5347
- const message = httpClientError.response?.data?.message ?? statusText;
5348
- const description = httpClientError.response?.data?.details?.applicationError?.description ?? statusText;
5349
- const code = httpClientError.response?.data?.details?.applicationError?.code ?? constantCase(statusText);
5350
- const data = httpClientError.response?.data?.details?.applicationError?.data ?? {};
5351
- const combinedMessage = message === description ? message : `${message}: ${description}`;
5352
- const details = {
5353
- applicationError: {
5354
- description,
5355
- code,
5356
- data
5357
- },
5358
- requestId: httpClientError.requestId
5359
- };
5360
- return wrapError(httpClientError, {
5361
- message: JSON.stringify({ message: combinedMessage, details }, null, 2),
5362
- extraProperties: {
5363
- details,
5364
- status,
5365
- requestId: httpClientError.requestId
5366
- }
5367
- });
5368
- };
5369
- buildSystemError = (httpClientError) => {
5370
- const message = httpClientError.requestId ? `System error occurred, request-id: ${httpClientError.requestId}` : `System error occurred: ${JSON.stringify(httpClientError)}`;
5371
- return wrapError(httpClientError, {
5372
- message,
5373
- extraProperties: {
5374
- requestId: httpClientError.requestId,
5375
- status: httpClientError.response?.status,
5376
- code: constantCase(httpClientError.response?.statusText ?? "UNKNOWN"),
5377
- ...!httpClientError.response && {
5378
- runtimeError: httpClientError
5379
- }
5380
- }
5381
- });
5382
- };
5383
- violationsWithRenamedFields = ({ spreadPathsToArguments, explicitPathsToArguments, singleArgumentUnchanged }, fieldViolations, argumentNames) => {
5384
- const allPathsToArguments = {
5385
- ...spreadPathsToArguments,
5386
- ...explicitPathsToArguments
5387
- };
5388
- const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);
5389
- return fieldViolations?.filter((fieldViolation) => {
5390
- const containedInAMoreSpecificViolationField = fieldViolations.some((anotherViolation) => anotherViolation.field.length > fieldViolation.field.length && anotherViolation.field.startsWith(fieldViolation.field) && allPathsToArgumentsKeys.includes(anotherViolation.field));
5391
- return !containedInAMoreSpecificViolationField;
5392
- }).map((fieldViolation) => {
5393
- const exactMatchArgumentExpression = explicitPathsToArguments[fieldViolation.field];
5394
- if (exactMatchArgumentExpression) {
5395
- return {
5396
- ...fieldViolation,
5397
- field: withRenamedArgument(exactMatchArgumentExpression, argumentNames)
5398
- };
5399
- }
5400
- const longestPartialPathMatch = allPathsToArgumentsKeys?.sort((a, b) => b.length - a.length)?.find((path) => fieldViolation.field.startsWith(path));
5401
- if (longestPartialPathMatch) {
5402
- const partialMatchArgumentExpression = allPathsToArguments[longestPartialPathMatch];
5403
- if (partialMatchArgumentExpression) {
5404
- return {
5405
- ...fieldViolation,
5406
- field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames))
5407
- };
5408
- }
5409
- }
5410
- if (singleArgumentUnchanged) {
5411
- return {
5412
- ...fieldViolation,
5413
- field: `${argumentNames[0]}.${fieldViolation.field}`
5414
- };
5415
- }
5416
- return fieldViolation;
5417
- });
5418
- };
5419
- withRenamedArgument = (fieldValue, argumentNames) => {
5420
- const argIndex = getArgumentIndex(fieldValue);
5421
- if (argIndex !== null && typeof argIndex !== "undefined") {
5422
- return fieldValue.replace(`$[${argIndex}]`, argumentNames[argIndex]);
5423
- }
5424
- return fieldValue;
5425
- };
5426
- getArgumentIndex = (s) => {
5427
- const match = s.match(/\$\[(?<argIndex>\d+)\]/);
5428
- return match && match.groups && Number(match.groups.argIndex);
5429
- };
5430
- }
5431
- });
5432
-
5433
- // ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
5434
- function createRESTModule(descriptor, elevated = false) {
5435
- return contextualizeRESTModuleV2(descriptor, elevated);
5436
- }
5437
- function toURLSearchParams(params, isComplexRequest) {
5438
- const flatten = flattenParams(params);
5439
- Object.entries(flatten).some(([key, value]) => key.includes(".") || Array.isArray(value) && value.some((v) => typeof v === "object"));
5440
- {
5441
- return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {
5442
- const keyParams = Array.isArray(value) ? value : [value];
5443
- keyParams.forEach((param) => {
5444
- if (param === void 0 || param === null || Array.isArray(value) && typeof param === "object") {
5445
- return;
5446
- }
5447
- urlSearchParams.append(key, param);
5448
- });
5449
- return urlSearchParams;
5450
- }, new URLSearchParams());
5451
- }
5452
- }
5453
- function resolveUrl(opts) {
5454
- const domain = resolveDomain(opts.host);
5455
- const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);
5456
- const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});
5457
- return resolvePathFromMappings(path, mappings);
5458
- }
5459
- function flattenParams(data, path = "") {
5460
- const params = {};
5461
- Object.entries(data).forEach(([key, value]) => {
5462
- const isObject5 = value !== null && typeof value === "object" && !Array.isArray(value);
5463
- const fieldPath = resolvePath(path, key);
5464
- if (isObject5) {
5465
- const serializedObject = flattenParams(value, fieldPath);
5466
- Object.assign(params, serializedObject);
5467
- } else {
5468
- params[fieldPath] = value;
5469
- }
5470
- });
5471
- return params;
5472
- }
5473
- function resolvePath(path, key) {
5474
- return `${path}${path ? "." : ""}${key}`;
5475
- }
5476
- function resolveDomain(host) {
5477
- const resolvedHost = fixHostExceptions(host);
5478
- return resolvedHost.replace(REGEX_CAPTURE_DOMAINS, "._base_domain_").replace(REGEX_CAPTURE_API_DOMAINS, "._api_base_domain_").replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, "*.dev.wix-code.com");
5479
- }
5480
- function fixHostExceptions(host) {
5481
- return host.replace("create.editorx.com", "editor.editorx.com");
5482
- }
5483
- function resolveMappingsByDomain(domain, domainToMappings) {
5484
- const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];
5485
- if (mappings) {
5486
- return mappings;
5487
- }
5488
- const rootDomainMappings = resolveRootDomain(domain, domainToMappings);
5489
- if (!rootDomainMappings) {
5490
- if (isBaseDomain(domain)) {
5491
- return domainToMappings[wwwBaseDomain];
5492
- }
5493
- }
5494
- return rootDomainMappings ?? [];
5495
- }
5496
- function resolveRootDomain(domain, domainToMappings) {
5497
- return Object.entries(domainToMappings).find(([entryDomain]) => {
5498
- const [, ...rooDomainSegments] = domain.split(".");
5499
- return rooDomainSegments.join(".") === entryDomain;
5500
- })?.[1];
5501
- }
5502
- function isBaseDomain(domain) {
5503
- return !!domain.match(/\._base_domain_$/);
5504
- }
5505
- function injectDataIntoProtoPath(protoPath, data) {
5506
- return protoPath.split("/").map((path) => maybeProtoPathToData(path, data)).join("/");
5507
- }
5508
- function maybeProtoPathToData(protoPath, data) {
5509
- const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];
5510
- const field = protoRegExpMatch[1];
5511
- if (field) {
5512
- const suffix = protoPath.replace(protoRegExpMatch[0], "");
5513
- return findByPath(data, field, protoPath, suffix);
5514
- }
5515
- return protoPath;
5516
- }
5517
- function findByPath(obj, path, defaultValue, suffix) {
5518
- let result2 = obj;
5519
- for (const field of path.split(".")) {
5520
- if (!result2) {
5521
- return defaultValue;
5522
- }
5523
- result2 = result2[field];
5524
- }
5525
- return `${result2}${suffix}`;
5526
- }
5527
- function resolvePathFromMappings(protoPath, mappings) {
5528
- const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));
5529
- if (!mapping) {
5530
- return protoPath;
5531
- }
5532
- return mapping.srcPath + protoPath.slice(mapping.destPath.length);
5533
- }
5534
- var DOMAINS, USER_DOMAIN, REGEX_CAPTURE_DOMAINS, WIX_API_DOMAINS, DEV_WIX_CODE_DOMAIN, REGEX_CAPTURE_PROTO_FIELD, REGEX_CAPTURE_API_DOMAINS, REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, wwwBaseDomain;
5535
- var init_rest_modules = __esm({
5536
- "../../node_modules/@wix/sdk-runtime/build/rest-modules.js"() {
5537
- init_context_v2();
5538
- DOMAINS = ["wix.com", "editorx.com"];
5539
- USER_DOMAIN = "_";
5540
- REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
5541
- WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
5542
- DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
5543
- REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;
5544
- REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
5545
- REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\.${DEV_WIX_CODE_DOMAIN}$`);
5546
- wwwBaseDomain = "www._base_domain_";
5547
- }
5548
- });
5549
-
5550
5113
  // ../form-multiline-address/dist/esm/lib/constants.js
5551
5114
  var ADDRESS_FORM_ID_BY_COUNTRY, DEFAULT_COUNTRY;
5552
- var init_constants2 = __esm({
5115
+ var init_constants = __esm({
5553
5116
  "../form-multiline-address/dist/esm/lib/constants.js"() {
5554
5117
  ADDRESS_FORM_ID_BY_COUNTRY = {
5555
5118
  COMMON: "0d5dcb6d-1403-4b80-b73e-6d90a2245561",
@@ -6293,7 +5856,7 @@ var init_multiline_address_toolkit = __esm({
6293
5856
  init_defineProperty();
6294
5857
  init_types_impl();
6295
5858
  import_locale_dataset_javascript = __toESM(require_index_bundle());
6296
- init_constants2();
5859
+ init_constants();
6297
5860
  init_apply_validation_properties();
6298
5861
  init_apply_view_properties();
6299
5862
  init_get_country_field();
@@ -6503,7 +6066,7 @@ __export(esm_exports, {
6503
6066
  });
6504
6067
  var init_esm2 = __esm({
6505
6068
  "../form-multiline-address/dist/esm/index.js"() {
6506
- init_constants2();
6069
+ init_constants();
6507
6070
  init_multiline_address_toolkit();
6508
6071
  init_get_country_field();
6509
6072
  init_country_codes();
@@ -7314,7 +6877,7 @@ var init_getPossibleCountriesForNumber = __esm({
7314
6877
 
7315
6878
  // ../../node_modules/libphonenumber-js/es6/constants.js
7316
6879
  var MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN, MAX_LENGTH_COUNTRY_CODE, VALID_DIGITS, DASHES, SLASHES, DOTS, WHITESPACE, BRACKETS, TILDES, VALID_PUNCTUATION, PLUS_CHARS;
7317
- var init_constants3 = __esm({
6880
+ var init_constants2 = __esm({
7318
6881
  "../../node_modules/libphonenumber-js/es6/constants.js"() {
7319
6882
  MIN_LENGTH_FOR_NSN = 2;
7320
6883
  MAX_LENGTH_FOR_NSN = 17;
@@ -7355,7 +6918,7 @@ var CAPTURING_DIGIT_PATTERN;
7355
6918
  var init_stripIddPrefix = __esm({
7356
6919
  "../../node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js"() {
7357
6920
  init_metadata();
7358
- init_constants3();
6921
+ init_constants2();
7359
6922
  CAPTURING_DIGIT_PATTERN = new RegExp("([" + VALID_DIGITS + "])");
7360
6923
  }
7361
6924
  });
@@ -7628,7 +7191,7 @@ var init_extractCountryCallingCode = __esm({
7628
7191
  init_stripIddPrefix();
7629
7192
  init_extractCountryCallingCodeFromInternationalNumberWithoutPlusSign();
7630
7193
  init_metadata();
7631
- init_constants3();
7194
+ init_constants2();
7632
7195
  }
7633
7196
  });
7634
7197
 
@@ -7638,7 +7201,7 @@ function applyInternationalSeparatorStyle(formattedNumber) {
7638
7201
  }
7639
7202
  var init_applyInternationalSeparatorStyle = __esm({
7640
7203
  "../../node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js"() {
7641
- init_constants3();
7204
+ init_constants2();
7642
7205
  }
7643
7206
  });
7644
7207
 
@@ -7718,7 +7281,7 @@ function createExtensionPattern(purpose) {
7718
7281
  var RFC3966_EXTN_PREFIX, getExtensionDigitsPattern;
7719
7282
  var init_createExtensionPattern = __esm({
7720
7283
  "../../node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js"() {
7721
- init_constants3();
7284
+ init_constants2();
7722
7285
  RFC3966_EXTN_PREFIX = ";ext=";
7723
7286
  getExtensionDigitsPattern = function getExtensionDigitsPattern2(maxLength) {
7724
7287
  return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
@@ -7736,7 +7299,7 @@ function isViablePhoneNumberStart(number) {
7736
7299
  var MIN_LENGTH_PHONE_NUMBER_PATTERN, VALID_PHONE_NUMBER, VALID_PHONE_NUMBER_START_REG_EXP, VALID_PHONE_NUMBER_WITH_EXTENSION, VALID_PHONE_NUMBER_PATTERN;
7737
7300
  var init_isViablePhoneNumber = __esm({
7738
7301
  "../../node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js"() {
7739
- init_constants3();
7302
+ init_constants2();
7740
7303
  init_createExtensionPattern();
7741
7304
  MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{" + MIN_LENGTH_FOR_NSN + "}";
7742
7305
  VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
@@ -8448,7 +8011,7 @@ function isPhoneContextValid(phoneContext) {
8448
8011
  var PLUS_SIGN, RFC3966_VISUAL_SEPARATOR_, RFC3966_PHONE_DIGIT_, RFC3966_GLOBAL_NUMBER_DIGITS_, RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_, ALPHANUM_, RFC3966_DOMAINLABEL_, VALID_ALPHA_, RFC3966_TOPLABEL_, RFC3966_DOMAINNAME_, RFC3966_DOMAINNAME_PATTERN_, RFC3966_PREFIX_, RFC3966_PHONE_CONTEXT_, RFC3966_ISDN_SUBADDRESS_;
8449
8012
  var init_extractPhoneContext = __esm({
8450
8013
  "../../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js"() {
8451
- init_constants3();
8014
+ init_constants2();
8452
8015
  PLUS_SIGN = "+";
8453
8016
  RFC3966_VISUAL_SEPARATOR_ = "[\\-\\.\\(\\)]?";
8454
8017
  RFC3966_PHONE_DIGIT_ = "([" + VALID_DIGITS + "]|" + RFC3966_VISUAL_SEPARATOR_ + ")";
@@ -8673,7 +8236,7 @@ function parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCo
8673
8236
  var MAX_INPUT_STRING_LENGTH, PHONE_NUMBER_START_PATTERN, AFTER_PHONE_NUMBER_END_PATTERN, USE_NON_GEOGRAPHIC_COUNTRY_CODE3;
8674
8237
  var init_parse = __esm({
8675
8238
  "../../node_modules/libphonenumber-js/es6/parse.js"() {
8676
- init_constants3();
8239
+ init_constants2();
8677
8240
  init_ParseError();
8678
8241
  init_metadata();
8679
8242
  init_isViablePhoneNumber();
@@ -9824,7 +9387,7 @@ var init_AsYouTypeFormatter = __esm({
9824
9387
  init_parseDigits();
9825
9388
  init_AsYouTypeFormatter_util();
9826
9389
  init_formatNationalNumberUsingFormat();
9827
- init_constants3();
9390
+ init_constants2();
9828
9391
  init_applyInternationalSeparatorStyle();
9829
9392
  DUMMY_DIGIT = "9";
9830
9393
  LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15;
@@ -10268,7 +9831,7 @@ var init_AsYouTypeParser = __esm({
10268
9831
  init_extractNationalNumberFromPossiblyIncompleteNumber();
10269
9832
  init_stripIddPrefix();
10270
9833
  init_parseDigits();
10271
- init_constants3();
9834
+ init_constants2();
10272
9835
  VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = "[" + VALID_PUNCTUATION + VALID_DIGITS + "]+";
10273
9836
  VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp("^" + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + "$", "i");
10274
9837
  VALID_FORMATTED_PHONE_NUMBER_PART = "(?:[" + PLUS_CHARS + "][" + VALID_PUNCTUATION + VALID_DIGITS + "]*|[" + VALID_PUNCTUATION + VALID_DIGITS + "]+)";
@@ -24757,7 +24320,7 @@ function isCI() {
24757
24320
  function isNode() {
24758
24321
  return typeof process !== "undefined" && process.versions?.node != null;
24759
24322
  }
24760
- var init_utils3 = __esm({
24323
+ var init_utils2 = __esm({
24761
24324
  "../../node_modules/@wix/headers/dist/esm/utils.js"() {
24762
24325
  }
24763
24326
  });
@@ -24771,7 +24334,7 @@ function artifactId(override) {
24771
24334
  }
24772
24335
  var init_artifact_id = __esm({
24773
24336
  "../../node_modules/@wix/headers/dist/esm/headers/artifact-id.js"() {
24774
- init_utils3();
24337
+ init_utils2();
24775
24338
  }
24776
24339
  });
24777
24340
 
@@ -26018,9 +25581,6 @@ var EVENTS_FIELD_TYPES = {
26018
25581
  EVENTS_RSVP: "EVENTS_RSVP",
26019
25582
  EVENTS_REPEATER: "EVENTS_REPEATER"
26020
25583
  };
26021
- var ENTITY_PICKER_FIELD_TYPES = {
26022
- PIKACHU: "PIKACHU"
26023
- };
26024
25584
  var INPUT_FIELD_TYPES = {
26025
25585
  ...CONTACTS_FIELD_TYPES,
26026
25586
  ...QUIZ_FIELD_TYPES,
@@ -26030,8 +25590,7 @@ var INPUT_FIELD_TYPES = {
26030
25590
  ...BOOKINGS_FIELD_TYPES,
26031
25591
  ...PAYMENTS_FIELD_TYPES,
26032
25592
  ...COMMON_FIELD_TYPES,
26033
- ...EVENTS_FIELD_TYPES,
26034
- ...ENTITY_PICKER_FIELD_TYPES
25593
+ ...EVENTS_FIELD_TYPES
26035
25594
  };
26036
25595
 
26037
25596
  // ../form-fields/dist/esm/constants/readonly-field-types.js
@@ -26109,547 +25668,951 @@ var FormStatusProvider = (_ref) => {
26109
25668
  function useFormStatus() {
26110
25669
  const context = React42.useContext(FormStatusContext);
26111
25670
  if (context === void 0) {
26112
- throw new Error("useFormStatus must be used within a Form Status provider");
25671
+ throw new Error("useFormStatus must be used within a Form Status provider");
25672
+ }
25673
+ return context;
25674
+ }
25675
+ var WixRicosViewerContext = /* @__PURE__ */ React42.createContext(void 0);
25676
+
25677
+ // ../../node_modules/@wix/ricos/dist/es/index.js
25678
+ init_v1();
25679
+ var DEFAULT_CONFIG = {
25680
+ language: "en",
25681
+ accountLanguage: "en",
25682
+ regionalFormat: "en"
25683
+ };
25684
+ var ConfigContext = /* @__PURE__ */ React42.createContext(null);
25685
+ function ConfigContextProvider(_ref) {
25686
+ let {
25687
+ value: configInput,
25688
+ children
25689
+ } = _ref;
25690
+ const config = {
25691
+ ...configInput,
25692
+ language: configInput.language ?? DEFAULT_CONFIG.language,
25693
+ accountLanguage: configInput.accountLanguage ?? DEFAULT_CONFIG.accountLanguage,
25694
+ regionalFormat: configInput.regionalFormat ?? DEFAULT_CONFIG.regionalFormat
25695
+ };
25696
+ return /* @__PURE__ */ React42__namespace.default.createElement(ConfigContext.Provider, {
25697
+ value: config
25698
+ }, children);
25699
+ }
25700
+ function useConfig() {
25701
+ const context = React42.useContext(ConfigContext);
25702
+ if (context === void 0) {
25703
+ throw new Error("useConfig must be used within a ConfigContext.Provider");
25704
+ }
25705
+ return context || DEFAULT_CONFIG;
25706
+ }
25707
+ var htmlAttributesPlugin = (_) => ({
25708
+ config: {},
25709
+ type: "",
25710
+ nodeViewDecorators: [htmlAttributesDecorator],
25711
+ nodeViewRenderers: {
25712
+ [Node_Type.EXTERNAL]: (__) => /* @__PURE__ */ React42__namespace.default.createElement(React42__namespace.default.Fragment, null)
25713
+ }
25714
+ });
25715
+ var htmlAttributesDecorator = {
25716
+ rule: (node) => node.type === Node_Type.EXTERNAL,
25717
+ decorate: (_ref) => {
25718
+ var _node$textData, _node$externalData, _node$textData2;
25719
+ let {
25720
+ node
25721
+ } = _ref;
25722
+ if (((_node$textData = node.textData) == null ? void 0 : _node$textData.text) == null) {
25723
+ return /* @__PURE__ */ React42__namespace.default.createElement(React42__namespace.default.Fragment, null);
25724
+ }
25725
+ const props = Object.fromEntries(Object.entries(((_node$externalData = node.externalData) == null ? void 0 : _node$externalData.fields) ?? []).map((_ref2) => {
25726
+ let [k, v] = _ref2;
25727
+ return [k, v.stringValue];
25728
+ }));
25729
+ return /* @__PURE__ */ React42__namespace.default.createElement("span", props, (_node$textData2 = node.textData) == null ? void 0 : _node$textData2.text);
25730
+ }
25731
+ };
25732
+ var UniqueFieldSuffixContext = /* @__PURE__ */ React42.createContext(void 0);
25733
+ var UniqueFieldSuffixContextProvider = (_ref) => {
25734
+ let {
25735
+ parentId = "id",
25736
+ children
25737
+ } = _ref;
25738
+ const {
25739
+ compId = "comp"
25740
+ } = useConfig();
25741
+ const uniqueId = `${compId}-${parentId.split("-").at(0)}`;
25742
+ return /* @__PURE__ */ React42__namespace.default.createElement(UniqueFieldSuffixContext.Provider, {
25743
+ value: uniqueId
25744
+ }, children);
25745
+ };
25746
+ function useUniqueFieldSuffix() {
25747
+ const context = React42.useContext(UniqueFieldSuffixContext);
25748
+ if (context === void 0) {
25749
+ throw new Error("useUniqueFieldSuffix must be used within a UniqueFieldSuffixContextProvider");
25750
+ }
25751
+ return context;
25752
+ }
25753
+ var FocusedFieldContext = /* @__PURE__ */ React42.createContext(void 0);
25754
+ var FocusedFieldProvider = (_ref) => {
25755
+ let {
25756
+ children
25757
+ } = _ref;
25758
+ const [focusedFieldId, setFocusedFieldId] = React42__namespace.default.useState(void 0);
25759
+ const contextValue = React42.useMemo(() => {
25760
+ return {
25761
+ focusedFieldId,
25762
+ setFocusedFieldId
25763
+ };
25764
+ }, [focusedFieldId, setFocusedFieldId]);
25765
+ return /* @__PURE__ */ React42__namespace.default.createElement(FocusedFieldContext.Provider, {
25766
+ value: contextValue
25767
+ }, children);
25768
+ };
25769
+ function useFocusedField() {
25770
+ const context = React42.useContext(FocusedFieldContext);
25771
+ if (context === void 0) {
25772
+ throw new Error("useFocusedField must be used within a FocusedFieldProvider");
25773
+ }
25774
+ return context;
25775
+ }
25776
+
25777
+ // ../form-fields/dist/esm/contexts/events-context.js
25778
+ var EventsContext = /* @__PURE__ */ React42.createContext(void 0);
25779
+ var EventsProvider = (_ref) => {
25780
+ let {
25781
+ children
25782
+ } = _ref;
25783
+ const [submitSuccessCounter, setSubmitSuccessCounter] = React42.useState(0);
25784
+ const [submittedValues, setSubmittedValues] = React42.useState({});
25785
+ const value = React42.useMemo(() => ({
25786
+ submitSuccessCounter,
25787
+ submittedValues,
25788
+ fireSubmitSuccess: (values) => {
25789
+ setSubmitSuccessCounter((previous) => previous + 1);
25790
+ setSubmittedValues(values || {});
25791
+ }
25792
+ }), [submitSuccessCounter, submittedValues]);
25793
+ return /* @__PURE__ */ React42__namespace.default.createElement(EventsContext.Provider, {
25794
+ value
25795
+ }, children);
25796
+ };
25797
+ var useEvents = () => {
25798
+ const context = React42.useContext(EventsContext);
25799
+ if (context === void 0) {
25800
+ throw new Error("useEvents must be used within a EventsProvider");
25801
+ }
25802
+ return context;
25803
+ };
25804
+ var useSubmitSuccessTrigger = () => {
25805
+ const {
25806
+ fireSubmitSuccess
25807
+ } = useEvents();
25808
+ return fireSubmitSuccess;
25809
+ };
25810
+ var useSubmitSuccessEvent = (onSubmitSuccess) => {
25811
+ const {
25812
+ submitSuccessCounter,
25813
+ submittedValues = {}
25814
+ } = useEvents();
25815
+ const previousCounter = React42.useRef(submitSuccessCounter);
25816
+ React42.useEffect(() => {
25817
+ if (previousCounter.current !== submitSuccessCounter) {
25818
+ previousCounter.current = submitSuccessCounter;
25819
+ onSubmitSuccess(submittedValues);
25820
+ }
25821
+ }, [submitSuccessCounter, onSubmitSuccess, submittedValues]);
25822
+ };
25823
+ var useFocusGroupFieldEvent = (groupFieldId, getFocusedChildFieldId) => {
25824
+ const {
25825
+ focusedFieldId,
25826
+ setFocusedFieldId
25827
+ } = useFocusedField();
25828
+ React42.useEffect(() => {
25829
+ if (groupFieldId && focusedFieldId === groupFieldId) {
25830
+ const fieldId = getFocusedChildFieldId();
25831
+ if (fieldId) {
25832
+ setFocusedFieldId(fieldId);
25833
+ }
25834
+ }
25835
+ }, [groupFieldId, focusedFieldId, setFocusedFieldId]);
25836
+ };
25837
+ var useFocusFieldEvent = (onFocusField, fieldId) => {
25838
+ const {
25839
+ focusedFieldId,
25840
+ setFocusedFieldId
25841
+ } = useFocusedField();
25842
+ React42.useEffect(() => {
25843
+ if (fieldId && focusedFieldId && focusedFieldId === fieldId) {
25844
+ onFocusField();
25845
+ setFocusedFieldId(void 0);
25846
+ }
25847
+ }, [fieldId, focusedFieldId, setFocusedFieldId]);
25848
+ };
25849
+ var ScrollContext = /* @__PURE__ */ React42.createContext(void 0);
25850
+ var ScrollProvider = (_ref) => {
25851
+ let {
25852
+ children
25853
+ } = _ref;
25854
+ const scrollViewRef = React42.useRef(null);
25855
+ const value = React42.useMemo(() => ({
25856
+ scrollTo: (element) => {
25857
+ if (element && scrollViewRef.current) {
25858
+ const {
25859
+ top
25860
+ } = element.getBoundingClientRect();
25861
+ if (top < 0 || top > window.innerHeight) {
25862
+ const headerHeight = getSiteHeaderHeight(scrollViewRef.current);
25863
+ const wixAdHeight = getWixAdHeight();
25864
+ const newTop = top + window.scrollY - 20 - headerHeight - wixAdHeight;
25865
+ window.scrollTo({
25866
+ top: newTop,
25867
+ behavior: "smooth"
25868
+ });
25869
+ }
25870
+ }
25871
+ }
25872
+ }), []);
25873
+ return /* @__PURE__ */ React42__namespace.default.createElement("div", {
25874
+ ref: scrollViewRef
25875
+ }, /* @__PURE__ */ React42__namespace.default.createElement(ScrollContext.Provider, {
25876
+ value
25877
+ }, children));
25878
+ };
25879
+ function useScroll() {
25880
+ const context = React42.useContext(ScrollContext);
25881
+ if (context === void 0) {
25882
+ throw new Error("useScroll must be used within a ScrollProvider");
26113
25883
  }
26114
25884
  return context;
26115
25885
  }
26116
- var WixRicosViewerContext = /* @__PURE__ */ React42.createContext(void 0);
26117
-
26118
- // ../../node_modules/@wix/ricos/dist/es/index.js
26119
- init_v1();
26120
- var DEFAULT_CONFIG = {
26121
- language: "en",
26122
- accountLanguage: "en",
26123
- regionalFormat: "en"
26124
- };
26125
- var ConfigContext = /* @__PURE__ */ React42.createContext(null);
26126
- function ConfigContextProvider(_ref) {
26127
- let {
26128
- value: configInput,
26129
- children
26130
- } = _ref;
26131
- const config = {
26132
- ...configInput,
26133
- language: configInput.language ?? DEFAULT_CONFIG.language,
26134
- accountLanguage: configInput.accountLanguage ?? DEFAULT_CONFIG.accountLanguage,
26135
- regionalFormat: configInput.regionalFormat ?? DEFAULT_CONFIG.regionalFormat
26136
- };
26137
- return /* @__PURE__ */ React42__namespace.default.createElement(ConfigContext.Provider, {
26138
- value: config
26139
- }, children);
25886
+ function getSiteHeaderHeight(formElement) {
25887
+ var _formElement$closest;
25888
+ const classicHeader = document.querySelector("#SITE_HEADER");
25889
+ const potentialHeader = (_formElement$closest = formElement.closest("main")) == null ? void 0 : _formElement$closest.previousElementSibling;
25890
+ const studioHeader = (potentialHeader == null ? void 0 : potentialHeader.tagName) === "HEADER" ? potentialHeader : void 0;
25891
+ const header = classicHeader || studioHeader;
25892
+ const headerPosition = header && window.getComputedStyle(header).position;
25893
+ return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
26140
25894
  }
26141
- function useConfig() {
26142
- const context = React42.useContext(ConfigContext);
25895
+ function getWixAdHeight() {
25896
+ const ad = document.querySelector("#WIX_ADS");
25897
+ return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
25898
+ }
25899
+ var TranslationContext = /* @__PURE__ */ React42.createContext(void 0);
25900
+ function useTranslation() {
25901
+ const context = React42.useContext(TranslationContext);
26143
25902
  if (context === void 0) {
26144
- throw new Error("useConfig must be used within a ConfigContext.Provider");
25903
+ throw new Error("useTranslation must be used within a TranslationProvider");
26145
25904
  }
26146
- return context || DEFAULT_CONFIG;
25905
+ return context;
26147
25906
  }
26148
- var htmlAttributesPlugin = (_) => ({
26149
- config: {},
26150
- type: "",
26151
- nodeViewDecorators: [htmlAttributesDecorator],
26152
- nodeViewRenderers: {
26153
- [Node_Type.EXTERNAL]: (__) => /* @__PURE__ */ React42__namespace.default.createElement(React42__namespace.default.Fragment, null)
26154
- }
26155
- });
26156
- var htmlAttributesDecorator = {
26157
- rule: (node) => node.type === Node_Type.EXTERNAL,
26158
- decorate: (_ref) => {
26159
- var _node$textData, _node$externalData, _node$textData2;
26160
- let {
26161
- node
26162
- } = _ref;
26163
- if (((_node$textData = node.textData) == null ? void 0 : _node$textData.text) == null) {
26164
- return /* @__PURE__ */ React42__namespace.default.createElement(React42__namespace.default.Fragment, null);
25907
+ var ExperimentsContext = /* @__PURE__ */ React42.createContext(void 0);
25908
+ var useExperiments = () => {
25909
+ const experiments = React42.useContext(ExperimentsContext) || {};
25910
+ return {
25911
+ experiments,
25912
+ isExperimentEnabled: (spec) => experiments[spec] === true || experiments[spec] === "true" || false
25913
+ };
25914
+ };
25915
+
25916
+ // ../form-schema/dist/esm/services/generate-uuid.js
25917
+ function generateUUID() {
25918
+ let uuid = "";
25919
+ const hexValues = "0123456789abcdef";
25920
+ for (let i = 0; i < 36; i++) {
25921
+ if (i === 8 || i === 13 || i === 18 || i === 23) {
25922
+ uuid += "-";
25923
+ } else if (i === 14) {
25924
+ uuid += "4";
25925
+ } else {
25926
+ uuid += hexValues.charAt(Math.floor(Math.random() * hexValues.length));
26165
25927
  }
26166
- const props = Object.fromEntries(Object.entries(((_node$externalData = node.externalData) == null ? void 0 : _node$externalData.fields) ?? []).map((_ref2) => {
26167
- let [k, v] = _ref2;
26168
- return [k, v.stringValue];
26169
- }));
26170
- return /* @__PURE__ */ React42__namespace.default.createElement("span", props, (_node$textData2 = node.textData) == null ? void 0 : _node$textData2.text);
26171
25928
  }
25929
+ return uuid;
25930
+ }
25931
+
25932
+ // ../form-schema/dist/esm/services/add-field-to-schema.js
25933
+ var addFieldToSchema = (form, field, layout) => {
25934
+ var _form$steps, _newSteps$0$layout;
25935
+ const newSteps = (_form$steps = form.steps) == null ? void 0 : _form$steps.map((step) => {
25936
+ var _step$layout, _step$layout2, _step$layout3;
25937
+ return {
25938
+ ...step,
25939
+ layout: {
25940
+ ...step.layout,
25941
+ large: {
25942
+ ...((_step$layout = step.layout) == null ? void 0 : _step$layout.large) || {},
25943
+ items: ((_step$layout2 = step.layout) == null || (_step$layout2 = _step$layout2.large) == null || (_step$layout2 = _step$layout2.items) == null ? void 0 : _step$layout2.map((item) => {
25944
+ return {
25945
+ ...item,
25946
+ row: layout.row <= item.row ? (item.row || 0) + 1 : item.row
25947
+ };
25948
+ })) || ((_step$layout3 = step.layout) == null || (_step$layout3 = _step$layout3.large) == null ? void 0 : _step$layout3.items)
25949
+ }
25950
+ }
25951
+ };
25952
+ });
25953
+ newSteps == null || (_newSteps$0$layout = newSteps[0].layout) == null || (_newSteps$0$layout = _newSteps$0$layout.large) == null || (_newSteps$0$layout = _newSteps$0$layout.items) == null || _newSteps$0$layout.unshift(layout);
25954
+ return {
25955
+ ...form,
25956
+ fields: [field, ...form.fields || []],
25957
+ steps: newSteps || form.steps
25958
+ };
26172
25959
  };
26173
- var UniqueFieldSuffixContext = /* @__PURE__ */ React42.createContext(void 0);
26174
- var UniqueFieldSuffixContextProvider = (_ref) => {
26175
- let {
26176
- parentId = "id",
26177
- children
26178
- } = _ref;
26179
- const {
26180
- compId = "comp"
26181
- } = useConfig();
26182
- const uniqueId = `${compId}-${parentId.split("-").at(0)}`;
26183
- return /* @__PURE__ */ React42__namespace.default.createElement(UniqueFieldSuffixContext.Provider, {
26184
- value: uniqueId
26185
- }, children);
26186
- };
26187
- function useUniqueFieldSuffix() {
26188
- const context = React42.useContext(UniqueFieldSuffixContext);
25960
+ var BiContext = /* @__PURE__ */ React42.createContext(void 0);
25961
+ function useBi() {
25962
+ const context = React42.useContext(BiContext);
26189
25963
  if (context === void 0) {
26190
- throw new Error("useUniqueFieldSuffix must be used within a UniqueFieldSuffixContextProvider");
25964
+ throw new Error("useBi must be used within a BiProvider");
26191
25965
  }
26192
25966
  return context;
26193
25967
  }
26194
- var FocusedFieldContext = /* @__PURE__ */ React42.createContext(void 0);
26195
- var FocusedFieldProvider = (_ref) => {
26196
- let {
26197
- children
26198
- } = _ref;
26199
- const [focusedFieldId, setFocusedFieldId] = React42__namespace.default.useState(void 0);
26200
- const contextValue = React42.useMemo(() => {
25968
+
25969
+ // ../form-fields/dist/esm/ui/shared/numeric-input-utils.js
25970
+ var getPattern = (multipleOf) => {
25971
+ const decimals = getNumberOfDecimals(multipleOf);
25972
+ const regex = `^-?\\d*(\\.\\d{0,${decimals}})?$`;
25973
+ return regex;
25974
+ };
25975
+ var getNumberOfDecimals = (multipleOf) => {
25976
+ var _String$split;
25977
+ return ((_String$split = String(multipleOf).split(".")) == null || (_String$split = _String$split[1]) == null ? void 0 : _String$split.length) || 0;
25978
+ };
25979
+ var getValidNumberInput = (input, multipleOf, previousValidValue, locale) => {
25980
+ if (input.trim() === "") {
26201
25981
  return {
26202
- focusedFieldId,
26203
- setFocusedFieldId
25982
+ validInput: "",
25983
+ validNumber: void 0
26204
25984
  };
26205
- }, [focusedFieldId, setFocusedFieldId]);
26206
- return /* @__PURE__ */ React42__namespace.default.createElement(FocusedFieldContext.Provider, {
26207
- value: contextValue
26208
- }, children);
25985
+ }
25986
+ const inputNumber = inputToNumber(input);
25987
+ if (isNumberInputValid(inputNumber, multipleOf) && inputNumber < Number.MAX_SAFE_INTEGER) {
25988
+ return {
25989
+ validInput: localizeNumberInput(input, locale),
25990
+ validNumber: inputNumber
25991
+ };
25992
+ }
25993
+ return previousValidValue ? {
25994
+ validInput: previousValidValue,
25995
+ validNumber: inputToNumber(previousValidValue)
25996
+ } : {
25997
+ validInput: "",
25998
+ validNumber: void 0
25999
+ };
26209
26000
  };
26210
- function useFocusedField() {
26211
- const context = React42.useContext(FocusedFieldContext);
26212
- if (context === void 0) {
26213
- throw new Error("useFocusedField must be used within a FocusedFieldProvider");
26001
+ var inputToNumber = (input) => Number(normalizeDecimalSeparator(input));
26002
+ var localizeNumberInput = (input, locale) => {
26003
+ var _Intl$NumberFormat$fo;
26004
+ const decimalSeparator = locale ? (_Intl$NumberFormat$fo = Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _Intl$NumberFormat$fo.value : void 0;
26005
+ return decimalSeparator ? input.replace(/[.,]/, decimalSeparator) : input;
26006
+ };
26007
+ var isNumberInputValid = (value, multipleOf) => {
26008
+ const multipleOfRegex = getPattern(multipleOf);
26009
+ const validator = new RegExp(multipleOfRegex);
26010
+ return validator.test(`${value}`);
26011
+ };
26012
+ var normalizeDecimalSeparator = function(value) {
26013
+ if (value === void 0) {
26014
+ value = "";
26015
+ }
26016
+ return value.replace(",", ".");
26017
+ };
26018
+
26019
+ // ../form-fields/dist/esm/date-localization/local-date.js
26020
+ function startOfDay(date) {
26021
+ const result2 = new Date(date);
26022
+ result2.setHours(0, 0, 0, 0);
26023
+ return result2;
26024
+ }
26025
+
26026
+ // ../form-fields/dist/esm/date-localization/get-first-day-of-the-week.js
26027
+ var DEFAULT_FIRST_DAY = 1;
26028
+ function getFirstDayOfTheWeek(locale) {
26029
+ try {
26030
+ const intlLocale = new Intl.Locale(locale);
26031
+ if (intlLocale.getWeekInfo) {
26032
+ const weekInfo = intlLocale.getWeekInfo();
26033
+ const firstDay = weekInfo.firstDay;
26034
+ if (firstDay !== void 0) {
26035
+ return firstDay === 7 ? 0 : firstDay;
26036
+ }
26037
+ }
26038
+ return getFirstDayManual(locale);
26039
+ } catch {
26040
+ return getFirstDayManual(locale);
26041
+ }
26042
+ }
26043
+ var REGIONS_STARTING_SATURDAY = ["AF", "BH", "DJ", "DZ", "EG", "IQ", "IR", "JO", "KW", "LY", "OM", "QA", "SD", "SY"];
26044
+ var REGIONS_STARTING_SUNDAY = ["AG", "AS", "BD", "BR", "BS", "BT", "BW", "BZ", "CA", "CO", "DM", "DO", "ET", "GT", "GU", "HK", "HN", "ID", "IL", "IN", "IS", "JM", "JP", "KE", "KH", "KR", "LA", "MH", "MM", "MO", "MT", "MX", "MZ", "NI", "NP", "PA", "PE", "PH", "PK", "PR", "PT", "PY", "SA", "SG", "SV", "TH", "TT", "TW", "UM", "US", "VE", "VI", "WS", "YE", "ZA", "ZW"];
26045
+ var LANGUAGES_STARTING_SATURDAY = ["ar"];
26046
+ var LANGUAGES_STARTING_SUNDAY = ["en", "he", "hi", "id", "ja", "ko", "pt", "tl", "th"];
26047
+ function getFirstDayManual(locale) {
26048
+ try {
26049
+ var _intlLocale$language, _intlLocale$region;
26050
+ const intlLocale = new Intl.Locale(locale);
26051
+ const language = (_intlLocale$language = intlLocale.language) == null ? void 0 : _intlLocale$language.toLowerCase();
26052
+ const region = (_intlLocale$region = intlLocale.region) == null ? void 0 : _intlLocale$region.toUpperCase();
26053
+ if (region) {
26054
+ if (REGIONS_STARTING_SUNDAY.includes(region)) {
26055
+ return 0;
26056
+ }
26057
+ if (REGIONS_STARTING_SATURDAY.includes(region)) {
26058
+ return 6;
26059
+ }
26060
+ return DEFAULT_FIRST_DAY;
26061
+ }
26062
+ if (language) {
26063
+ if (LANGUAGES_STARTING_SUNDAY.includes(language)) {
26064
+ return 0;
26065
+ }
26066
+ if (LANGUAGES_STARTING_SATURDAY.includes(language)) {
26067
+ return 6;
26068
+ }
26069
+ }
26070
+ return DEFAULT_FIRST_DAY;
26071
+ } catch {
26072
+ return DEFAULT_FIRST_DAY;
26214
26073
  }
26215
- return context;
26216
26074
  }
26217
26075
 
26218
- // ../form-fields/dist/esm/contexts/events-context.js
26219
- var EventsContext = /* @__PURE__ */ React42.createContext(void 0);
26220
- var EventsProvider = (_ref) => {
26221
- let {
26222
- children
26223
- } = _ref;
26224
- const [submitSuccessCounter, setSubmitSuccessCounter] = React42.useState(0);
26225
- const [submittedValues, setSubmittedValues] = React42.useState({});
26226
- const value = React42.useMemo(() => ({
26227
- submitSuccessCounter,
26228
- submittedValues,
26229
- fireSubmitSuccess: (values) => {
26230
- setSubmitSuccessCounter((previous) => previous + 1);
26231
- setSubmittedValues(values || {});
26232
- }
26233
- }), [submitSuccessCounter, submittedValues]);
26234
- return /* @__PURE__ */ React42__namespace.default.createElement(EventsContext.Provider, {
26235
- value
26236
- }, children);
26237
- };
26238
- var useEvents = () => {
26239
- const context = React42.useContext(EventsContext);
26240
- if (context === void 0) {
26241
- throw new Error("useEvents must be used within a EventsProvider");
26242
- }
26243
- return context;
26076
+ // ../form-fields/dist/esm/field-settings/settings-shared/availability/availability.js
26077
+ init_types_impl();
26078
+ var ALL_DAYS = [DayOfWeek.SUNDAY, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY];
26079
+ var DEFAULT_AVAILABILITY = {
26080
+ availableDays: ALL_DAYS
26244
26081
  };
26245
- var useSubmitSuccessTrigger = () => {
26246
- const {
26247
- fireSubmitSuccess
26248
- } = useEvents();
26249
- return fireSubmitSuccess;
26082
+ var NUMERIC_DAY_TO_STRING = {
26083
+ 0: DayOfWeek.SUNDAY,
26084
+ 1: DayOfWeek.MONDAY,
26085
+ 2: DayOfWeek.TUESDAY,
26086
+ 3: DayOfWeek.WEDNESDAY,
26087
+ 4: DayOfWeek.THURSDAY,
26088
+ 5: DayOfWeek.FRIDAY,
26089
+ 6: DayOfWeek.SATURDAY
26250
26090
  };
26251
- var useSubmitSuccessEvent = (onSubmitSuccess) => {
26252
- const {
26253
- submitSuccessCounter,
26254
- submittedValues = {}
26255
- } = useEvents();
26256
- const previousCounter = React42.useRef(submitSuccessCounter);
26257
- React42.useEffect(() => {
26258
- if (previousCounter.current !== submitSuccessCounter) {
26259
- previousCounter.current = submitSuccessCounter;
26260
- onSubmitSuccess(submittedValues);
26091
+ function isDateAvailable(date, availability) {
26092
+ const d = date instanceof Date ? date : new Date(date);
26093
+ if (availability.availableDays) {
26094
+ const dayOfWeek = NUMERIC_DAY_TO_STRING[d.getDay()];
26095
+ if (!availability.availableDays.includes(dayOfWeek)) {
26096
+ return false;
26261
26097
  }
26262
- }, [submitSuccessCounter, onSubmitSuccess, submittedValues]);
26263
- };
26264
- var useFocusGroupFieldEvent = (groupFieldId, getFocusedChildFieldId) => {
26265
- const {
26266
- focusedFieldId,
26267
- setFocusedFieldId
26268
- } = useFocusedField();
26269
- React42.useEffect(() => {
26270
- if (groupFieldId && focusedFieldId === groupFieldId) {
26271
- const fieldId = getFocusedChildFieldId();
26272
- if (fieldId) {
26273
- setFocusedFieldId(fieldId);
26274
- }
26098
+ }
26099
+ if (availability.availableDates && availability.availableDates.length > 0) {
26100
+ const isInAvailableRange = availability.availableDates.some((range) => isDateInRange(d, range));
26101
+ if (!isInAvailableRange) {
26102
+ return false;
26275
26103
  }
26276
- }, [groupFieldId, focusedFieldId, setFocusedFieldId]);
26277
- };
26278
- var useFocusFieldEvent = (onFocusField, fieldId) => {
26279
- const {
26280
- focusedFieldId,
26281
- setFocusedFieldId
26282
- } = useFocusedField();
26283
- React42.useEffect(() => {
26284
- if (fieldId && focusedFieldId && focusedFieldId === fieldId) {
26285
- onFocusField();
26286
- setFocusedFieldId(void 0);
26104
+ }
26105
+ if (availability.unavailableDates && availability.unavailableDates.length > 0) {
26106
+ const isInUnavailableRange = availability.unavailableDates.some((range) => isDateInRange(d, range));
26107
+ if (isInUnavailableRange) {
26108
+ return false;
26287
26109
  }
26288
- }, [fieldId, focusedFieldId, setFocusedFieldId]);
26289
- };
26290
- var ScrollContext = /* @__PURE__ */ React42.createContext(void 0);
26291
- var ScrollProvider = (_ref) => {
26110
+ }
26111
+ return true;
26112
+ }
26113
+ function isDateInRange(date, range) {
26114
+ if (!range.start || !range.end) {
26115
+ return true;
26116
+ }
26117
+ const checkDate = startOfDay(date);
26118
+ const startDate = startOfDay(new Date(range.start));
26119
+ const endDate = startOfDay(new Date(range.end));
26120
+ return checkDate >= startDate && checkDate <= endDate;
26121
+ }
26122
+
26123
+ // ../form-fields/dist/esm/services/get-image-url.js
26124
+ init_max();
26125
+ function getImageURL(_ref, targetWidth, targetHeight, fit) {
26292
26126
  let {
26293
- children
26127
+ id,
26128
+ width,
26129
+ height
26294
26130
  } = _ref;
26295
- const scrollViewRef = React42.useRef(null);
26296
- const value = React42.useMemo(() => ({
26297
- scrollTo: (element) => {
26298
- if (element && scrollViewRef.current) {
26299
- const {
26300
- top
26301
- } = element.getBoundingClientRect();
26302
- if (top < 0 || top > window.innerHeight) {
26303
- const headerHeight = getSiteHeaderHeight(scrollViewRef.current);
26304
- const wixAdHeight = getWixAdHeight();
26305
- const newTop = top + window.scrollY - 20 - headerHeight - wixAdHeight;
26306
- window.scrollTo({
26307
- top: newTop,
26308
- behavior: "smooth"
26309
- });
26131
+ if (fit === void 0) {
26132
+ fit = "fill";
26133
+ }
26134
+ const urlFunction = fit === "fit" ? sdk.getScaleToFitImageURL : sdk.getScaleToFillImageURL;
26135
+ return urlFunction(id, width, height, targetWidth , targetHeight );
26136
+ }
26137
+
26138
+ // ../../node_modules/@wix/sdk-runtime/build/constants.js
26139
+ var SDKRequestToRESTRequestRenameMap = {
26140
+ _id: "id",
26141
+ _createdDate: "createdDate",
26142
+ _updatedDate: "updatedDate"
26143
+ };
26144
+ var RESTResponseToSDKResponseRenameMap = {
26145
+ id: "_id",
26146
+ createdDate: "_createdDate",
26147
+ updatedDate: "_updatedDate"
26148
+ };
26149
+
26150
+ // ../../node_modules/@wix/sdk-runtime/build/rename-all-nested-keys.js
26151
+ function renameAllNestedKeys(payload, renameMap, ignorePaths) {
26152
+ const isIgnored = (path) => ignorePaths.includes(path);
26153
+ const traverse = (obj, path) => {
26154
+ if (Array.isArray(obj)) {
26155
+ obj.forEach((item) => {
26156
+ traverse(item, path);
26157
+ });
26158
+ } else if (typeof obj === "object" && obj !== null) {
26159
+ const objAsRecord = obj;
26160
+ Object.keys(objAsRecord).forEach((key) => {
26161
+ const newPath = path === "" ? key : `${path}.${key}`;
26162
+ if (isIgnored(newPath)) {
26163
+ return;
26310
26164
  }
26311
- }
26165
+ const transformedKey = renameKey(key, renameMap);
26166
+ if (transformedKey !== key && !(transformedKey in objAsRecord)) {
26167
+ objAsRecord[transformedKey] = objAsRecord[key];
26168
+ delete objAsRecord[key];
26169
+ }
26170
+ traverse(objAsRecord[transformedKey], newPath);
26171
+ });
26312
26172
  }
26313
- }), []);
26314
- return /* @__PURE__ */ React42__namespace.default.createElement("div", {
26315
- ref: scrollViewRef
26316
- }, /* @__PURE__ */ React42__namespace.default.createElement(ScrollContext.Provider, {
26317
- value
26318
- }, children));
26319
- };
26320
- function useScroll() {
26321
- const context = React42.useContext(ScrollContext);
26322
- if (context === void 0) {
26323
- throw new Error("useScroll must be used within a ScrollProvider");
26324
- }
26325
- return context;
26173
+ };
26174
+ traverse(payload, "");
26175
+ return payload;
26326
26176
  }
26327
- function getSiteHeaderHeight(formElement) {
26328
- var _formElement$closest;
26329
- const classicHeader = document.querySelector("#SITE_HEADER");
26330
- const potentialHeader = (_formElement$closest = formElement.closest("main")) == null ? void 0 : _formElement$closest.previousElementSibling;
26331
- const studioHeader = (potentialHeader == null ? void 0 : potentialHeader.tagName) === "HEADER" ? potentialHeader : void 0;
26332
- const header = classicHeader || studioHeader;
26333
- const headerPosition = header && window.getComputedStyle(header).position;
26334
- return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
26177
+ function renameKey(key, renameMap) {
26178
+ let transformedKey;
26179
+ if (key.includes(".")) {
26180
+ const parts = key.split(".");
26181
+ const transformedParts = parts.map((part) => renameMap[part] ?? part);
26182
+ transformedKey = transformedParts.join(".");
26183
+ } else {
26184
+ transformedKey = renameMap[key] ?? key;
26185
+ }
26186
+ return transformedKey;
26335
26187
  }
26336
- function getWixAdHeight() {
26337
- const ad = document.querySelector("#WIX_ADS");
26338
- return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
26188
+ function renameKeysFromSDKRequestToRESTRequest(payload, ignorePaths = []) {
26189
+ return renameAllNestedKeys(payload, SDKRequestToRESTRequestRenameMap, ignorePaths);
26339
26190
  }
26340
- var TranslationContext = /* @__PURE__ */ React42.createContext(void 0);
26341
- function useTranslation() {
26342
- const context = React42.useContext(TranslationContext);
26343
- if (context === void 0) {
26344
- throw new Error("useTranslation must be used within a TranslationProvider");
26345
- }
26346
- return context;
26191
+ function renameKeysFromRESTResponseToSDKResponse(payload, ignorePaths = []) {
26192
+ return renameAllNestedKeys(payload, RESTResponseToSDKResponseRenameMap, ignorePaths);
26347
26193
  }
26348
- var ExperimentsContext = /* @__PURE__ */ React42.createContext(void 0);
26349
- var useExperiments = () => {
26350
- const experiments = React42.useContext(ExperimentsContext) || {};
26351
- return {
26352
- experiments,
26353
- isExperimentEnabled: (spec) => experiments[spec] === true || experiments[spec] === "true" || false
26354
- };
26355
- };
26356
26194
 
26357
- // ../form-schema/dist/esm/services/generate-uuid.js
26358
- function generateUUID() {
26359
- let uuid = "";
26360
- const hexValues = "0123456789abcdef";
26361
- for (let i = 0; i < 36; i++) {
26362
- if (i === 8 || i === 13 || i === 18 || i === 23) {
26363
- uuid += "-";
26364
- } else if (i === 14) {
26365
- uuid += "4";
26366
- } else {
26367
- uuid += hexValues.charAt(Math.floor(Math.random() * hexValues.length));
26368
- }
26195
+ // ../../node_modules/@wix/sdk-runtime/build/transformations/transform-paths.js
26196
+ function transformPath(obj, { path, isRepeated, isMap }, transformFn) {
26197
+ const pathParts = path.split(".");
26198
+ if (pathParts.length === 1 && path in obj) {
26199
+ obj[path] = isRepeated ? obj[path].map(transformFn) : isMap ? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)])) : transformFn(obj[path]);
26200
+ return obj;
26201
+ }
26202
+ const [first, ...rest] = pathParts;
26203
+ if (first.endsWith("{}")) {
26204
+ const cleanPath = first.slice(0, -2);
26205
+ obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
26206
+ key,
26207
+ transformPath(value, { path: rest.join("."), isRepeated, isMap }, transformFn)
26208
+ ]));
26209
+ } else if (Array.isArray(obj[first])) {
26210
+ obj[first] = obj[first].map((item) => transformPath(item, { path: rest.join("."), isRepeated, isMap }, transformFn));
26211
+ } else if (first in obj && typeof obj[first] === "object" && obj[first] !== null) {
26212
+ obj[first] = transformPath(obj[first], { path: rest.join("."), isRepeated, isMap }, transformFn);
26213
+ } else if (first === "*") {
26214
+ Object.keys(obj).reduce((acc, curr) => {
26215
+ acc[curr] = transformPath(obj[curr], { path: rest.join("."), isRepeated, isMap }, transformFn);
26216
+ return acc;
26217
+ }, obj);
26369
26218
  }
26370
- return uuid;
26219
+ return obj;
26220
+ }
26221
+ function transformPaths(obj, transformations) {
26222
+ return transformations.reduce((acc, { paths, transformFn }) => paths.reduce((transformerAcc, path) => transformPath(transformerAcc, path, transformFn), acc), obj);
26371
26223
  }
26372
26224
 
26373
- // ../form-schema/dist/esm/services/add-field-to-schema.js
26374
- var addFieldToSchema = (form, field, layout) => {
26375
- var _form$steps, _newSteps$0$layout;
26376
- const newSteps = (_form$steps = form.steps) == null ? void 0 : _form$steps.map((step) => {
26377
- var _step$layout, _step$layout2, _step$layout3;
26378
- return {
26379
- ...step,
26380
- layout: {
26381
- ...step.layout,
26382
- large: {
26383
- ...((_step$layout = step.layout) == null ? void 0 : _step$layout.large) || {},
26384
- items: ((_step$layout2 = step.layout) == null || (_step$layout2 = _step$layout2.large) == null || (_step$layout2 = _step$layout2.items) == null ? void 0 : _step$layout2.map((item) => {
26385
- return {
26386
- ...item,
26387
- row: layout.row <= item.row ? (item.row || 0) + 1 : item.row
26388
- };
26389
- })) || ((_step$layout3 = step.layout) == null || (_step$layout3 = _step$layout3.large) == null ? void 0 : _step$layout3.items)
26390
- }
26391
- }
26392
- };
26393
- });
26394
- newSteps == null || (_newSteps$0$layout = newSteps[0].layout) == null || (_newSteps$0$layout = _newSteps$0$layout.large) == null || (_newSteps$0$layout = _newSteps$0$layout.items) == null || _newSteps$0$layout.unshift(layout);
26395
- return {
26396
- ...form,
26397
- fields: [field, ...form.fields || []],
26398
- steps: newSteps || form.steps
26399
- };
26400
- };
26401
- var BiContext = /* @__PURE__ */ React42.createContext(void 0);
26402
- function useBi() {
26403
- const context = React42.useContext(BiContext);
26404
- if (context === void 0) {
26405
- throw new Error("useBi must be used within a BiProvider");
26225
+ // ../../node_modules/@wix/sdk-runtime/build/utils.js
26226
+ function removeUndefinedKeys(obj) {
26227
+ return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
26228
+ }
26229
+ function constantCase(input) {
26230
+ return split(input).map((part) => part.toLocaleUpperCase()).join("_");
26231
+ }
26232
+ var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
26233
+ var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
26234
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
26235
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
26236
+ function split(value) {
26237
+ let result2 = value.trim();
26238
+ result2 = result2.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
26239
+ result2 = result2.replace(DEFAULT_STRIP_REGEXP, "\0");
26240
+ let start = 0;
26241
+ let end = result2.length;
26242
+ while (result2.charAt(start) === "\0") {
26243
+ start++;
26406
26244
  }
26407
- return context;
26245
+ if (start === end) {
26246
+ return [];
26247
+ }
26248
+ while (result2.charAt(end - 1) === "\0") {
26249
+ end--;
26250
+ }
26251
+ return result2.slice(start, end).split(/\0/g);
26408
26252
  }
26409
26253
 
26410
- // ../form-fields/dist/esm/ui/shared/numeric-input-utils.js
26411
- var getPattern = (multipleOf) => {
26412
- const decimals = getNumberOfDecimals(multipleOf);
26413
- const regex = `^-?\\d*(\\.\\d{0,${decimals}})?$`;
26414
- return regex;
26415
- };
26416
- var getNumberOfDecimals = (multipleOf) => {
26417
- var _String$split;
26418
- return ((_String$split = String(multipleOf).split(".")) == null || (_String$split = _String$split[1]) == null ? void 0 : _String$split.length) || 0;
26419
- };
26420
- var getValidNumberInput = (input, multipleOf, previousValidValue, locale) => {
26421
- if (input.trim() === "") {
26422
- return {
26423
- validInput: "",
26424
- validNumber: void 0
26425
- };
26254
+ // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
26255
+ var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
26256
+ var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
26257
+ var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
26258
+ function transformError(httpClientError, pathsToArguments = {
26259
+ explicitPathsToArguments: {},
26260
+ spreadPathsToArguments: {},
26261
+ singleArgumentUnchanged: false
26262
+ }, argumentNames = []) {
26263
+ if (typeof httpClientError !== "object" || httpClientError === null) {
26264
+ throw httpClientError;
26426
26265
  }
26427
- const inputNumber = inputToNumber(input);
26428
- if (isNumberInputValid(inputNumber, multipleOf) && inputNumber < Number.MAX_SAFE_INTEGER) {
26429
- return {
26430
- validInput: localizeNumberInput(input, locale),
26431
- validNumber: inputNumber
26266
+ if (isValidationError(httpClientError)) {
26267
+ return buildValidationError(httpClientError, pathsToArguments, argumentNames);
26268
+ }
26269
+ if (isApplicationError(httpClientError)) {
26270
+ return buildApplicationError(httpClientError);
26271
+ }
26272
+ if (isClientError(httpClientError)) {
26273
+ const status = httpClientError.response?.status;
26274
+ const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
26275
+ const message = httpClientError.response?.data?.message ?? statusText;
26276
+ const details = {
26277
+ applicationError: {
26278
+ description: statusText,
26279
+ code: constantCase(statusText),
26280
+ data: {}
26281
+ },
26282
+ requestId: httpClientError.requestId
26432
26283
  };
26284
+ return wrapError(httpClientError, {
26285
+ message: JSON.stringify({
26286
+ message,
26287
+ details
26288
+ }, null, 2),
26289
+ extraProperties: {
26290
+ details,
26291
+ status
26292
+ }
26293
+ });
26433
26294
  }
26434
- return previousValidValue ? {
26435
- validInput: previousValidValue,
26436
- validNumber: inputToNumber(previousValidValue)
26437
- } : {
26438
- validInput: "",
26439
- validNumber: void 0
26295
+ return buildSystemError(httpClientError);
26296
+ }
26297
+ var buildValidationError = (httpClientError, pathsToArguments, argumentNames) => {
26298
+ const validationErrorResponse = httpClientError.response?.data;
26299
+ const requestId = httpClientError.requestId;
26300
+ const { fieldViolations } = validationErrorResponse.details.validationError;
26301
+ const transformedFieldViolations = violationsWithRenamedFields(pathsToArguments, fieldViolations, argumentNames)?.sort((a, b) => a.field < b.field ? -1 : 1);
26302
+ const message = `INVALID_ARGUMENT: ${transformedFieldViolations?.map(({ field, description }) => `"${field}" ${description}`)?.join(", ")}`;
26303
+ const details = {
26304
+ validationError: { fieldViolations: transformedFieldViolations },
26305
+ requestId
26440
26306
  };
26307
+ return wrapError(httpClientError, {
26308
+ message: JSON.stringify({ message, details }, null, 2),
26309
+ extraProperties: {
26310
+ details,
26311
+ status: httpClientError.response?.status,
26312
+ requestId
26313
+ }
26314
+ });
26441
26315
  };
26442
- var inputToNumber = (input) => Number(normalizeDecimalSeparator(input));
26443
- var localizeNumberInput = (input, locale) => {
26444
- var _Intl$NumberFormat$fo;
26445
- const decimalSeparator = locale ? (_Intl$NumberFormat$fo = Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _Intl$NumberFormat$fo.value : void 0;
26446
- return decimalSeparator ? input.replace(/[.,]/, decimalSeparator) : input;
26316
+ var wrapError = (baseError, { message, extraProperties }) => {
26317
+ return Object.assign(baseError, {
26318
+ ...extraProperties,
26319
+ message
26320
+ });
26447
26321
  };
26448
- var isNumberInputValid = (value, multipleOf) => {
26449
- const multipleOfRegex = getPattern(multipleOf);
26450
- const validator = new RegExp(multipleOfRegex);
26451
- return validator.test(`${value}`);
26322
+ var buildApplicationError = (httpClientError) => {
26323
+ const status = httpClientError.response?.status;
26324
+ const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
26325
+ const message = httpClientError.response?.data?.message ?? statusText;
26326
+ const description = httpClientError.response?.data?.details?.applicationError?.description ?? statusText;
26327
+ const code = httpClientError.response?.data?.details?.applicationError?.code ?? constantCase(statusText);
26328
+ const data = httpClientError.response?.data?.details?.applicationError?.data ?? {};
26329
+ const combinedMessage = message === description ? message : `${message}: ${description}`;
26330
+ const details = {
26331
+ applicationError: {
26332
+ description,
26333
+ code,
26334
+ data
26335
+ },
26336
+ requestId: httpClientError.requestId
26337
+ };
26338
+ return wrapError(httpClientError, {
26339
+ message: JSON.stringify({ message: combinedMessage, details }, null, 2),
26340
+ extraProperties: {
26341
+ details,
26342
+ status,
26343
+ requestId: httpClientError.requestId
26344
+ }
26345
+ });
26452
26346
  };
26453
- var normalizeDecimalSeparator = function(value) {
26454
- if (value === void 0) {
26455
- value = "";
26347
+ var buildSystemError = (httpClientError) => {
26348
+ const message = httpClientError.requestId ? `System error occurred, request-id: ${httpClientError.requestId}` : `System error occurred: ${JSON.stringify(httpClientError)}`;
26349
+ return wrapError(httpClientError, {
26350
+ message,
26351
+ extraProperties: {
26352
+ requestId: httpClientError.requestId,
26353
+ status: httpClientError.response?.status,
26354
+ code: constantCase(httpClientError.response?.statusText ?? "UNKNOWN"),
26355
+ ...!httpClientError.response && {
26356
+ runtimeError: httpClientError
26357
+ }
26358
+ }
26359
+ });
26360
+ };
26361
+ var violationsWithRenamedFields = ({ spreadPathsToArguments, explicitPathsToArguments, singleArgumentUnchanged }, fieldViolations, argumentNames) => {
26362
+ const allPathsToArguments = {
26363
+ ...spreadPathsToArguments,
26364
+ ...explicitPathsToArguments
26365
+ };
26366
+ const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);
26367
+ return fieldViolations?.filter((fieldViolation) => {
26368
+ const containedInAMoreSpecificViolationField = fieldViolations.some((anotherViolation) => anotherViolation.field.length > fieldViolation.field.length && anotherViolation.field.startsWith(fieldViolation.field) && allPathsToArgumentsKeys.includes(anotherViolation.field));
26369
+ return !containedInAMoreSpecificViolationField;
26370
+ }).map((fieldViolation) => {
26371
+ const exactMatchArgumentExpression = explicitPathsToArguments[fieldViolation.field];
26372
+ if (exactMatchArgumentExpression) {
26373
+ return {
26374
+ ...fieldViolation,
26375
+ field: withRenamedArgument(exactMatchArgumentExpression, argumentNames)
26376
+ };
26377
+ }
26378
+ const longestPartialPathMatch = allPathsToArgumentsKeys?.sort((a, b) => b.length - a.length)?.find((path) => fieldViolation.field.startsWith(path));
26379
+ if (longestPartialPathMatch) {
26380
+ const partialMatchArgumentExpression = allPathsToArguments[longestPartialPathMatch];
26381
+ if (partialMatchArgumentExpression) {
26382
+ return {
26383
+ ...fieldViolation,
26384
+ field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames))
26385
+ };
26386
+ }
26387
+ }
26388
+ if (singleArgumentUnchanged) {
26389
+ return {
26390
+ ...fieldViolation,
26391
+ field: `${argumentNames[0]}.${fieldViolation.field}`
26392
+ };
26393
+ }
26394
+ return fieldViolation;
26395
+ });
26396
+ };
26397
+ var withRenamedArgument = (fieldValue, argumentNames) => {
26398
+ const argIndex = getArgumentIndex(fieldValue);
26399
+ if (argIndex !== null && typeof argIndex !== "undefined") {
26400
+ return fieldValue.replace(`$[${argIndex}]`, argumentNames[argIndex]);
26456
26401
  }
26457
- return value.replace(",", ".");
26402
+ return fieldValue;
26403
+ };
26404
+ var getArgumentIndex = (s) => {
26405
+ const match = s.match(/\$\[(?<argIndex>\d+)\]/);
26406
+ return match && match.groups && Number(match.groups.argIndex);
26458
26407
  };
26459
26408
 
26460
- // ../form-fields/dist/esm/date-localization/local-date.js
26461
- function startOfDay(date) {
26462
- const result2 = new Date(date);
26463
- result2.setHours(0, 0, 0, 0);
26464
- return result2;
26465
- }
26466
-
26467
- // ../form-fields/dist/esm/date-localization/get-first-day-of-the-week.js
26468
- var DEFAULT_FIRST_DAY = 1;
26469
- function getFirstDayOfTheWeek(locale) {
26470
- try {
26471
- const intlLocale = new Intl.Locale(locale);
26472
- if (intlLocale.getWeekInfo) {
26473
- const weekInfo = intlLocale.getWeekInfo();
26474
- const firstDay = weekInfo.firstDay;
26475
- if (firstDay !== void 0) {
26476
- return firstDay === 7 ? 0 : firstDay;
26409
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
26410
+ init_browser();
26411
+ function resolveContext() {
26412
+ const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
26413
+ if (oldContext) {
26414
+ return {
26415
+ // @ts-expect-error
26416
+ initWixModules(modules, elevated) {
26417
+ return runWithoutContext(() => oldContext(modules, elevated));
26418
+ },
26419
+ fetchWithAuth() {
26420
+ throw new Error("fetchWithAuth is not available in this context");
26421
+ },
26422
+ graphql() {
26423
+ throw new Error("graphql is not available in this context");
26477
26424
  }
26478
- }
26479
- return getFirstDayManual(locale);
26480
- } catch {
26481
- return getFirstDayManual(locale);
26425
+ };
26482
26426
  }
26483
- }
26484
- var REGIONS_STARTING_SATURDAY = ["AF", "BH", "DJ", "DZ", "EG", "IQ", "IR", "JO", "KW", "LY", "OM", "QA", "SD", "SY"];
26485
- var REGIONS_STARTING_SUNDAY = ["AG", "AS", "BD", "BR", "BS", "BT", "BW", "BZ", "CA", "CO", "DM", "DO", "ET", "GT", "GU", "HK", "HN", "ID", "IL", "IN", "IS", "JM", "JP", "KE", "KH", "KR", "LA", "MH", "MM", "MO", "MT", "MX", "MZ", "NI", "NP", "PA", "PE", "PH", "PK", "PR", "PT", "PY", "SA", "SG", "SV", "TH", "TT", "TW", "UM", "US", "VE", "VI", "WS", "YE", "ZA", "ZW"];
26486
- var LANGUAGES_STARTING_SATURDAY = ["ar"];
26487
- var LANGUAGES_STARTING_SUNDAY = ["en", "he", "hi", "id", "ja", "ko", "pt", "tl", "th"];
26488
- function getFirstDayManual(locale) {
26489
- try {
26490
- var _intlLocale$language, _intlLocale$region;
26491
- const intlLocale = new Intl.Locale(locale);
26492
- const language = (_intlLocale$language = intlLocale.language) == null ? void 0 : _intlLocale$language.toLowerCase();
26493
- const region = (_intlLocale$region = intlLocale.region) == null ? void 0 : _intlLocale$region.toUpperCase();
26494
- if (region) {
26495
- if (REGIONS_STARTING_SUNDAY.includes(region)) {
26496
- return 0;
26427
+ const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
26428
+ const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
26429
+ if (!contextualClient && !elevatedClient) {
26430
+ return;
26431
+ }
26432
+ return {
26433
+ initWixModules(wixModules, elevated) {
26434
+ if (elevated) {
26435
+ if (!elevatedClient) {
26436
+ throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
26437
+ }
26438
+ return runWithoutContext(() => elevatedClient.use(wixModules));
26497
26439
  }
26498
- if (REGIONS_STARTING_SATURDAY.includes(region)) {
26499
- return 6;
26440
+ if (!contextualClient) {
26441
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
26500
26442
  }
26501
- return DEFAULT_FIRST_DAY;
26502
- }
26503
- if (language) {
26504
- if (LANGUAGES_STARTING_SUNDAY.includes(language)) {
26505
- return 0;
26443
+ return runWithoutContext(() => contextualClient.use(wixModules));
26444
+ },
26445
+ fetchWithAuth: (urlOrRequest, requestInit) => {
26446
+ if (!contextualClient) {
26447
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
26506
26448
  }
26507
- if (LANGUAGES_STARTING_SATURDAY.includes(language)) {
26508
- return 6;
26449
+ return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
26450
+ },
26451
+ getAuth() {
26452
+ if (!contextualClient) {
26453
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
26454
+ }
26455
+ return contextualClient.auth;
26456
+ },
26457
+ async graphql(query, variables, opts) {
26458
+ if (!contextualClient) {
26459
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
26509
26460
  }
26461
+ return contextualClient.graphql(query, variables, opts);
26510
26462
  }
26511
- return DEFAULT_FIRST_DAY;
26512
- } catch {
26513
- return DEFAULT_FIRST_DAY;
26514
- }
26463
+ };
26515
26464
  }
26516
-
26517
- // ../form-fields/dist/esm/field-settings/settings-shared/availability/availability.js
26518
- init_types_impl();
26519
- var ALL_DAYS = [DayOfWeek.SUNDAY, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY];
26520
- var DEFAULT_AVAILABILITY = {
26521
- availableDays: ALL_DAYS
26522
- };
26523
- var NUMERIC_DAY_TO_STRING = {
26524
- 0: DayOfWeek.SUNDAY,
26525
- 1: DayOfWeek.MONDAY,
26526
- 2: DayOfWeek.TUESDAY,
26527
- 3: DayOfWeek.WEDNESDAY,
26528
- 4: DayOfWeek.THURSDAY,
26529
- 5: DayOfWeek.FRIDAY,
26530
- 6: DayOfWeek.SATURDAY
26531
- };
26532
- function isDateAvailable(date, availability) {
26533
- const d = date instanceof Date ? date : new Date(date);
26534
- if (availability.availableDays) {
26535
- const dayOfWeek = NUMERIC_DAY_TO_STRING[d.getDay()];
26536
- if (!availability.availableDays.includes(dayOfWeek)) {
26537
- return false;
26538
- }
26539
- }
26540
- if (availability.availableDates && availability.availableDates.length > 0) {
26541
- const isInAvailableRange = availability.availableDates.some((range) => isDateInRange(d, range));
26542
- if (!isInAvailableRange) {
26543
- return false;
26544
- }
26465
+ function runWithoutContext(fn) {
26466
+ const globalContext = globalThis.__wix_context__;
26467
+ const moduleContext = {
26468
+ client: wixContext.client,
26469
+ elevatedClient: wixContext.elevatedClient
26470
+ };
26471
+ let closureContext;
26472
+ globalThis.__wix_context__ = void 0;
26473
+ wixContext.client = void 0;
26474
+ wixContext.elevatedClient = void 0;
26475
+ if (typeof $wixContext !== "undefined") {
26476
+ closureContext = {
26477
+ client: $wixContext?.client,
26478
+ elevatedClient: $wixContext?.elevatedClient
26479
+ };
26480
+ delete $wixContext.client;
26481
+ delete $wixContext.elevatedClient;
26545
26482
  }
26546
- if (availability.unavailableDates && availability.unavailableDates.length > 0) {
26547
- const isInUnavailableRange = availability.unavailableDates.some((range) => isDateInRange(d, range));
26548
- if (isInUnavailableRange) {
26549
- return false;
26483
+ try {
26484
+ return fn();
26485
+ } finally {
26486
+ globalThis.__wix_context__ = globalContext;
26487
+ wixContext.client = moduleContext.client;
26488
+ wixContext.elevatedClient = moduleContext.elevatedClient;
26489
+ if (typeof $wixContext !== "undefined") {
26490
+ $wixContext.client = closureContext.client;
26491
+ $wixContext.elevatedClient = closureContext.elevatedClient;
26550
26492
  }
26551
26493
  }
26552
- return true;
26553
- }
26554
- function isDateInRange(date, range) {
26555
- if (!range.start || !range.end) {
26556
- return true;
26557
- }
26558
- const checkDate = startOfDay(date);
26559
- const startDate = startOfDay(new Date(range.start));
26560
- const endDate = startOfDay(new Date(range.end));
26561
- return checkDate >= startDate && checkDate <= endDate;
26562
26494
  }
26563
26495
 
26564
- // ../form-fields/dist/esm/services/get-image-url.js
26565
- init_max();
26566
- function getImageURL(_ref, targetWidth, targetHeight, fit) {
26567
- let {
26568
- id,
26569
- width,
26570
- height
26571
- } = _ref;
26572
- if (fit === void 0) {
26573
- fit = "fill";
26574
- }
26575
- const urlFunction = fit === "fit" ? sdk.getScaleToFitImageURL : sdk.getScaleToFillImageURL;
26576
- return urlFunction(id, width, height, targetWidth , targetHeight );
26496
+ // ../../node_modules/@wix/sdk-runtime/build/context-v2.js
26497
+ function contextualizeRESTModuleV2(restModule, elevated) {
26498
+ return ((...args) => {
26499
+ const context = resolveContext();
26500
+ if (!context) {
26501
+ return restModule.apply(void 0, args);
26502
+ }
26503
+ return context.initWixModules(restModule, elevated).apply(void 0, args);
26504
+ });
26577
26505
  }
26578
26506
 
26579
- // ../../node_modules/@wix/sdk-runtime/build/rename-all-nested-keys.js
26580
- init_constants();
26581
- function renameAllNestedKeys(payload, renameMap, ignorePaths) {
26582
- const isIgnored = (path) => ignorePaths.includes(path);
26583
- const traverse = (obj, path) => {
26584
- if (Array.isArray(obj)) {
26585
- obj.forEach((item) => {
26586
- traverse(item, path);
26587
- });
26588
- } else if (typeof obj === "object" && obj !== null) {
26589
- const objAsRecord = obj;
26590
- Object.keys(objAsRecord).forEach((key) => {
26591
- const newPath = path === "" ? key : `${path}.${key}`;
26592
- if (isIgnored(newPath)) {
26507
+ // ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
26508
+ function createRESTModule(descriptor, elevated = false) {
26509
+ return contextualizeRESTModuleV2(descriptor, elevated);
26510
+ }
26511
+ function toURLSearchParams(params, isComplexRequest) {
26512
+ const flatten = flattenParams(params);
26513
+ Object.entries(flatten).some(([key, value]) => key.includes(".") || Array.isArray(value) && value.some((v) => typeof v === "object"));
26514
+ {
26515
+ return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {
26516
+ const keyParams = Array.isArray(value) ? value : [value];
26517
+ keyParams.forEach((param) => {
26518
+ if (param === void 0 || param === null || Array.isArray(value) && typeof param === "object") {
26593
26519
  return;
26594
26520
  }
26595
- const transformedKey = renameKey(key, renameMap);
26596
- if (transformedKey !== key && !(transformedKey in objAsRecord)) {
26597
- objAsRecord[transformedKey] = objAsRecord[key];
26598
- delete objAsRecord[key];
26599
- }
26600
- traverse(objAsRecord[transformedKey], newPath);
26521
+ urlSearchParams.append(key, param);
26601
26522
  });
26523
+ return urlSearchParams;
26524
+ }, new URLSearchParams());
26525
+ }
26526
+ }
26527
+ function resolveUrl(opts) {
26528
+ const domain = resolveDomain(opts.host);
26529
+ const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);
26530
+ const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});
26531
+ return resolvePathFromMappings(path, mappings);
26532
+ }
26533
+ function flattenParams(data, path = "") {
26534
+ const params = {};
26535
+ Object.entries(data).forEach(([key, value]) => {
26536
+ const isObject5 = value !== null && typeof value === "object" && !Array.isArray(value);
26537
+ const fieldPath = resolvePath(path, key);
26538
+ if (isObject5) {
26539
+ const serializedObject = flattenParams(value, fieldPath);
26540
+ Object.assign(params, serializedObject);
26541
+ } else {
26542
+ params[fieldPath] = value;
26602
26543
  }
26603
- };
26604
- traverse(payload, "");
26605
- return payload;
26544
+ });
26545
+ return params;
26606
26546
  }
26607
- function renameKey(key, renameMap) {
26608
- let transformedKey;
26609
- if (key.includes(".")) {
26610
- const parts = key.split(".");
26611
- const transformedParts = parts.map((part) => renameMap[part] ?? part);
26612
- transformedKey = transformedParts.join(".");
26613
- } else {
26614
- transformedKey = renameMap[key] ?? key;
26547
+ function resolvePath(path, key) {
26548
+ return `${path}${path ? "." : ""}${key}`;
26549
+ }
26550
+ var DOMAINS = ["wix.com", "editorx.com"];
26551
+ var USER_DOMAIN = "_";
26552
+ var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
26553
+ var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
26554
+ var DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
26555
+ var REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;
26556
+ var REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
26557
+ var REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\.${DEV_WIX_CODE_DOMAIN}$`);
26558
+ function resolveDomain(host) {
26559
+ const resolvedHost = fixHostExceptions(host);
26560
+ return resolvedHost.replace(REGEX_CAPTURE_DOMAINS, "._base_domain_").replace(REGEX_CAPTURE_API_DOMAINS, "._api_base_domain_").replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, "*.dev.wix-code.com");
26561
+ }
26562
+ function fixHostExceptions(host) {
26563
+ return host.replace("create.editorx.com", "editor.editorx.com");
26564
+ }
26565
+ function resolveMappingsByDomain(domain, domainToMappings) {
26566
+ const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];
26567
+ if (mappings) {
26568
+ return mappings;
26615
26569
  }
26616
- return transformedKey;
26570
+ const rootDomainMappings = resolveRootDomain(domain, domainToMappings);
26571
+ if (!rootDomainMappings) {
26572
+ if (isBaseDomain(domain)) {
26573
+ return domainToMappings[wwwBaseDomain];
26574
+ }
26575
+ }
26576
+ return rootDomainMappings ?? [];
26617
26577
  }
26618
- function renameKeysFromSDKRequestToRESTRequest(payload, ignorePaths = []) {
26619
- return renameAllNestedKeys(payload, SDKRequestToRESTRequestRenameMap, ignorePaths);
26578
+ function resolveRootDomain(domain, domainToMappings) {
26579
+ return Object.entries(domainToMappings).find(([entryDomain]) => {
26580
+ const [, ...rooDomainSegments] = domain.split(".");
26581
+ return rooDomainSegments.join(".") === entryDomain;
26582
+ })?.[1];
26620
26583
  }
26621
- function renameKeysFromRESTResponseToSDKResponse(payload, ignorePaths = []) {
26622
- return renameAllNestedKeys(payload, RESTResponseToSDKResponseRenameMap, ignorePaths);
26584
+ function isBaseDomain(domain) {
26585
+ return !!domain.match(/\._base_domain_$/);
26623
26586
  }
26624
-
26625
- // ../../node_modules/@wix/sdk-runtime/build/transformations/transform-paths.js
26626
- function transformPath(obj, { path, isRepeated, isMap }, transformFn) {
26627
- const pathParts = path.split(".");
26628
- if (pathParts.length === 1 && path in obj) {
26629
- obj[path] = isRepeated ? obj[path].map(transformFn) : isMap ? Object.fromEntries(Object.entries(obj[path]).map(([key, value]) => [key, transformFn(value)])) : transformFn(obj[path]);
26630
- return obj;
26587
+ var wwwBaseDomain = "www._base_domain_";
26588
+ function injectDataIntoProtoPath(protoPath, data) {
26589
+ return protoPath.split("/").map((path) => maybeProtoPathToData(path, data)).join("/");
26590
+ }
26591
+ function maybeProtoPathToData(protoPath, data) {
26592
+ const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];
26593
+ const field = protoRegExpMatch[1];
26594
+ if (field) {
26595
+ const suffix = protoPath.replace(protoRegExpMatch[0], "");
26596
+ return findByPath(data, field, protoPath, suffix);
26631
26597
  }
26632
- const [first, ...rest] = pathParts;
26633
- if (first.endsWith("{}")) {
26634
- const cleanPath = first.slice(0, -2);
26635
- obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
26636
- key,
26637
- transformPath(value, { path: rest.join("."), isRepeated, isMap }, transformFn)
26638
- ]));
26639
- } else if (Array.isArray(obj[first])) {
26640
- obj[first] = obj[first].map((item) => transformPath(item, { path: rest.join("."), isRepeated, isMap }, transformFn));
26641
- } else if (first in obj && typeof obj[first] === "object" && obj[first] !== null) {
26642
- obj[first] = transformPath(obj[first], { path: rest.join("."), isRepeated, isMap }, transformFn);
26643
- } else if (first === "*") {
26644
- Object.keys(obj).reduce((acc, curr) => {
26645
- acc[curr] = transformPath(obj[curr], { path: rest.join("."), isRepeated, isMap }, transformFn);
26646
- return acc;
26647
- }, obj);
26598
+ return protoPath;
26599
+ }
26600
+ function findByPath(obj, path, defaultValue, suffix) {
26601
+ let result2 = obj;
26602
+ for (const field of path.split(".")) {
26603
+ if (!result2) {
26604
+ return defaultValue;
26605
+ }
26606
+ result2 = result2[field];
26648
26607
  }
26649
- return obj;
26608
+ return `${result2}${suffix}`;
26650
26609
  }
26651
- function transformPaths(obj, transformations) {
26652
- return transformations.reduce((acc, { paths, transformFn }) => paths.reduce((transformerAcc, path) => transformPath(transformerAcc, path, transformFn), acc), obj);
26610
+ function resolvePathFromMappings(protoPath, mappings) {
26611
+ const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));
26612
+ if (!mapping) {
26613
+ return protoPath;
26614
+ }
26615
+ return mapping.srcPath + protoPath.slice(mapping.destPath.length);
26653
26616
  }
26654
26617
  var HttpClientContext = /* @__PURE__ */ React42.createContext(void 0);
26655
26618
 
@@ -27467,7 +27430,6 @@ var FIELD_PROPS_MAPPERS = {
27467
27430
  DONATION: DonationMapper,
27468
27431
  EVENTS_RSVP: RadioGroupMapper,
27469
27432
  EVENTS_REPEATER: TextMapper,
27470
- PIKACHU: DefaultMapper,
27471
27433
  FILE_UPLOAD: FileUploadMapper,
27472
27434
  SIGNATURE: SignatureMapper,
27473
27435
  RATING_INPUT: RatingInputMapper,
@@ -31094,7 +31056,6 @@ var DEFAULT_VALUE = {
31094
31056
  [FIELD_TYPES.SERVICES_MULTI_CHOICE]: resolveDefaultValue,
31095
31057
  [FIELD_TYPES.EVENTS_RSVP]: resolveDefaultValue,
31096
31058
  [FIELD_TYPES.EVENTS_REPEATER]: resolveDefaultValue,
31097
- [FIELD_TYPES.PIKACHU]: resolveDefaultValue,
31098
31059
  [FIELD_TYPES.PHONE]: resolveDefaultValue
31099
31060
  };
31100
31061
  function resolveDefaultValue(field) {
@@ -31295,7 +31256,6 @@ var ADDITIONAL_FIELD_VALIDATION = {
31295
31256
  [FIELD_TYPES.SERVICES_MULTI_CHOICE]: null,
31296
31257
  [FIELD_TYPES.EVENTS_RSVP]: null,
31297
31258
  [FIELD_TYPES.EVENTS_REPEATER]: null,
31298
- [FIELD_TYPES.PIKACHU]: null,
31299
31259
  [FIELD_TYPES.IMAGE_CHOICE]: null,
31300
31260
  [FIELD_TYPES.PHONE]: null
31301
31261
  };
@@ -32848,19 +32808,12 @@ var NORMALIZED_VALUE = {
32848
32808
  [FIELD_TYPES.SERVICES_MULTI_CHOICE]: removeInvalidOptions,
32849
32809
  [FIELD_TYPES.EVENTS_RSVP]: acceptOnlyValidOptionByValue,
32850
32810
  [FIELD_TYPES.EVENTS_REPEATER]: normalizeRepeater,
32851
- [FIELD_TYPES.PIKACHU]: acceptObjectArrayValue,
32852
32811
  [FIELD_TYPES.IMAGE_CHOICE]: removeInvalidOptions,
32853
32812
  [FIELD_TYPES.PHONE]: acceptPhoneValue
32854
32813
  };
32855
32814
  function keepValueUnchanged({ fieldValue }) {
32856
32815
  return fieldValue;
32857
32816
  }
32858
- function acceptObjectArrayValue({ fieldValue }) {
32859
- if (fieldValue === EMPTY_VALUE) {
32860
- return fieldValue;
32861
- }
32862
- return Array.isArray(fieldValue) ? fieldValue : EMPTY_VALUE;
32863
- }
32864
32817
  function acceptPhoneValue({ fieldValue }) {
32865
32818
  const isEmptyValue = fieldValue === EMPTY_VALUE;
32866
32819
  if (isEmptyValue) {
@@ -33760,8 +33713,6 @@ var FIELD_TYPE_MAP = {
33760
33713
  SUBMIT_BUTTON: "SUBMIT_BUTTON",
33761
33714
  SERVICES_MULTI_CHOICE: "CHECKBOX_GROUP",
33762
33715
  IMAGE_CHOICE: "IMAGE_CHOICE",
33763
- // ENTITY_PICKER_FIELD_TYPES
33764
- PIKACHU: "TEXT_INPUT",
33765
33716
  // fields that have not been implemented
33766
33717
  NESTED_FORM: "TEXT_INPUT",
33767
33718
  PASSWORD: "TEXT_INPUT",
@@ -37774,8 +37725,6 @@ __export(es_exports, {
37774
37725
  SubdivisionType: () => SubdivisionType,
37775
37726
  getPlace: () => getPlace4
37776
37727
  });
37777
- init_transform_error();
37778
- init_rest_modules();
37779
37728
 
37780
37729
  // ../../node_modules/@wix/sdk-runtime/build/transformations/float.js
37781
37730
  function transformSDKFloatToRESTFloat(val) {
@@ -37794,11 +37743,7 @@ function transformRESTFloatToSDKFloat(val) {
37794
37743
  return val;
37795
37744
  }
37796
37745
 
37797
- // ../../node_modules/@wix/auto_sdk_atlas_places/build/es/index.mjs
37798
- init_rest_modules();
37799
-
37800
37746
  // ../../node_modules/@wix/sdk-runtime/build/transformations/address.js
37801
- init_utils2();
37802
37747
  function transformRESTAddressToSDKAddress(payload) {
37803
37748
  return payload && removeUndefinedKeys({
37804
37749
  formatted: payload.formattedAddress,
@@ -37822,7 +37767,6 @@ function transformRESTAddressToSDKAddress(payload) {
37822
37767
  }
37823
37768
 
37824
37769
  // ../../node_modules/@wix/auto_sdk_atlas_places/build/es/index.mjs
37825
- init_rest_modules();
37826
37770
  function resolveComWixpressViAtlasServiceV2PlacesServiceV2Url(opts) {
37827
37771
  const domainToMappings = {
37828
37772
  "api._api_base_domain_": [
@@ -38033,9 +37977,6 @@ __export(es_exports2, {
38033
37977
  FilterType: () => FilterType2,
38034
37978
  predict: () => predict4
38035
37979
  });
38036
- init_transform_error();
38037
- init_rest_modules();
38038
- init_rest_modules();
38039
37980
  function resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(opts) {
38040
37981
  const domainToMappings = {
38041
37982
  "api._api_base_domain_": [