@wix/bookings 1.0.1777 → 1.0.1779
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/build/cjs/context-booking-checkout.d.ts +243 -108
- package/build/cjs/context-booking-checkout.js +176 -182
- package/build/cjs/context-booking-checkout.js.map +1 -1
- package/build/cjs/context-categories.d.ts +16 -143
- package/build/cjs/context-categories.js +411 -411
- package/build/cjs/context-categories.js.map +1 -1
- package/build/cjs/context-locations.d.ts +16 -287
- package/build/cjs/context-locations.js +335 -335
- package/build/cjs/context-locations.js.map +1 -1
- package/build/cjs/context-service-addons.d.ts +2 -2
- package/build/cjs/context-service.d.ts +71 -33
- package/build/cjs/context-service.js +97 -95
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-time-slots.d.ts +10 -0
- package/build/cjs/context-time-slots.js +1 -1
- package/build/cjs/context-time-slots.js.map +1 -1
- package/build/es/context-booking-checkout.d.mts +243 -108
- package/build/es/context-booking-checkout.mjs +176 -179
- package/build/es/context-booking-checkout.mjs.map +1 -1
- package/build/es/context-categories.d.mts +16 -143
- package/build/es/context-categories.mjs +411 -411
- package/build/es/context-categories.mjs.map +1 -1
- package/build/es/context-locations.d.mts +16 -287
- package/build/es/context-locations.mjs +335 -335
- package/build/es/context-locations.mjs.map +1 -1
- package/build/es/context-service-addons.d.mts +2 -2
- package/build/es/context-service.d.mts +71 -33
- package/build/es/context-service.mjs +97 -95
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-time-slots.d.mts +10 -0
- package/build/es/context-time-slots.mjs +1 -1
- package/build/es/context-time-slots.mjs.map +1 -1
- package/build/internal/cjs/context-booking-checkout.d.ts +243 -108
- package/build/internal/cjs/context-categories.d.ts +16 -143
- package/build/internal/cjs/context-locations.d.ts +16 -287
- package/build/internal/cjs/context-service-addons.d.ts +2 -2
- package/build/internal/cjs/context-service.d.ts +71 -33
- package/build/internal/cjs/context-time-slots.d.ts +10 -0
- package/build/internal/es/context-booking-checkout.d.mts +243 -108
- package/build/internal/es/context-categories.d.mts +16 -143
- package/build/internal/es/context-locations.d.mts +16 -287
- package/build/internal/es/context-service-addons.d.mts +2 -2
- package/build/internal/es/context-service.d.mts +71 -33
- package/build/internal/es/context-time-slots.d.mts +10 -0
- package/context-runtime/context-booking-checkout/runtime.d.ts +243 -108
- package/context-runtime/context-booking-checkout/runtime.js +3 -3
- package/context-runtime/context-categories/runtime.d.ts +16 -143
- package/context-runtime/context-categories/runtime.js +2 -2
- package/context-runtime/context-locations/runtime.d.ts +16 -287
- package/context-runtime/context-locations/runtime.js +2 -2
- package/context-runtime/context-service/runtime.d.ts +71 -33
- package/context-runtime/context-service/runtime.js +3 -3
- package/context-runtime/context-service-addons/runtime.d.ts +2 -2
- package/context-runtime/context-time-slots/runtime.d.ts +10 -0
- package/context-runtime/context-time-slots/runtime.js +2 -2
- package/package.json +7 -7
|
@@ -201,9 +201,9 @@ interface AddOnGroupDetail {
|
|
|
201
201
|
}
|
|
202
202
|
//#endregion
|
|
203
203
|
//#region ../bookings-flow-data/dist/types.d.ts
|
|
204
|
-
/**
|
|
204
|
+
/** An add-on the visitor chose, with its quantity. */
|
|
205
205
|
type AddOn$1 = {
|
|
206
|
-
id: NonNullable<BookedAddOn['_id']>;
|
|
206
|
+
/** ID of the add-on. */id: NonNullable<BookedAddOn['_id']>; /** Number of the add-on to book. */
|
|
207
207
|
quantity: NonNullable<BookedAddOn['quantity']>;
|
|
208
208
|
};
|
|
209
209
|
//#endregion
|
|
@@ -481,6 +481,16 @@ interface TimeSlotItem {
|
|
|
481
481
|
readonly slotEndTime: string | null;
|
|
482
482
|
/** Whether the visitor can book the time slot. */
|
|
483
483
|
readonly bookable: boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Whether booking for the time slot hasn't opened yet, under the business's booking policy
|
|
486
|
+
* (it books too far ahead).
|
|
487
|
+
*/
|
|
488
|
+
readonly tooEarlyToBook: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Whether booking for the time slot has closed, under the business's booking policy (it starts
|
|
491
|
+
* too soon).
|
|
492
|
+
*/
|
|
493
|
+
readonly tooLateToBook: boolean;
|
|
484
494
|
/** Total number of spots in the time slot. `null` when it's unknown. */
|
|
485
495
|
readonly totalCapacity: number | null;
|
|
486
496
|
/** Number of spots left in the time slot. `null` when it's unknown. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{Component as e,Suspense as t,createContext as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c,useSyncExternalStore as l}from"react";import{useServiceContext as u}from"@wix/bookings/context/service";import{useGetService as d,useService as f}from"@wix/services-manager-react";import{jsx as p}from"react/jsx-runtime";var m={};function h(e,t=!1,n=e=>e){return()=>({__type:`event-definition`,type:e,isDomainEvent:t,transformations:n})}var g=e=>{switch(e){case`get`:case`GET`:return`GET`;case`post`:case`POST`:return`POST`;case`put`:case`PUT`:return`PUT`;case`delete`:case`DELETE`:return`DELETE`;case`patch`:case`PATCH`:return`PATCH`;case`head`:case`HEAD`:return`HEAD`;case`options`:case`OPTIONS`:return`OPTIONS`;default:throw Error(`Unknown method: ${e}`)}},_=e=>t=>async n=>{let r,i=t=>{if(r=e(n)(t),r.url===void 0)throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);let{method:i,url:a,params:o}=r;return{...r,method:g(i),url:a,data:r.data,params:o}};try{let e=await t.request(i);if(r===void 0)throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);let n=Array.isArray(r.transformResponse)?r.transformResponse:[r.transformResponse],a=e.data;return n.forEach(t=>{t&&(a=t(e.data,e.headers))}),a}catch(e){throw typeof e==`object`&&e&&`response`in e&&typeof e.response==`object`&&e.response!==null&&`data`in e.response?e.response.data:e}},v=e=>e.__isAmbassador?!0:!!e().__isAmbassador,y=`__metadata`,b=`edge.wixapis.com`,x=class extends Error{message;response;constructor(e,t){super(e),this.message=e,this.response=t}async details(){let e=await this.response.json();return S(this.response.status,e?.message,e?.details,{requestId:this.response.headers.get(`X-Wix-Request-Id`),details:e})}},S=(e,t,n,r)=>({details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t,requestId:r?.requestId}),C=e=>e?.method&&[`post`,`put`,`patch`].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":`application/json`}:{},w=e=>e&&typeof e==`object`&&!Array.isArray(e),T=e=>e.__type===`host`;function ee(e,t){return e.create(t)}var E=`x-wix-bi-gateway`;function D(e,t,n){return{[E]:O({environment:`js-sdk${n?`-${n}`:``}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function O(e){return Object.entries(e).filter(([e,t])=>!!t).map(([e,t])=>`${e}=${t}`).join(`,`)}function te(e){let t=globalThis.__wix_context__,n={client:m.client,elevatedClient:m.elevatedClient},r;globalThis.__wix_context__=void 0,m.client=void 0,m.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,m.client=n.client,m.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}var k={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`};function A(e){return M(e).map(e=>e.toLocaleUpperCase()).join(`_`)}var ne=/([\p{Ll}\d])(\p{Lu})/gu,re=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,j=`$1\0$2`,ie=/[^\p{L}\d]+/giu;function M(e){let t=e.trim();t=t.replace(ne,j).replace(re,j),t=t.replace(ie,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}var ae=e=>`validationError`in(e.response?.data?.details??{}),oe=e=>`applicationError`in(e.response?.data?.details??{}),se=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function N(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(ae(e))return ce(e,t,n);if(oe(e))return ue(e);if(se(e)){let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i={applicationError:{description:n,code:A(n),data:{}},requestId:e.requestId};return le(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return de(e)}var ce=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=fe(t,a,n)?.sort((e,t)=>e.field<t.field?-1:1),s=`INVALID_ARGUMENT: ${o?.map(({field:e,description:t})=>`"${e}" ${t}`)?.join(`, `)}`,c={validationError:{fieldViolations:o},requestId:i};return le(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},le=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),ue=e=>{let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i=e.response?.data?.details?.applicationError?.description??n,a=e.response?.data?.details?.applicationError?.code??A(n),o=e.response?.data?.details?.applicationError?.data??{},s=r===i?r:`${r}: ${i}`,c={applicationError:{description:i,code:a,data:o},requestId:e.requestId};return le(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},de=e=>le(e,{message:e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`,extraProperties:{requestId:e.requestId,status:e.response?.status,code:A(e.response?.statusText??`UNKNOWN`),...!e.response&&{runtimeError:e}}}),fe=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:n},r,i)=>{let a={...e,...t},o=Object.keys(a);return r?.filter(e=>!r.some(t=>t.field.length>e.field.length&&t.field.startsWith(e.field)&&o.includes(t.field))).map(e=>{let r=t[e.field];if(r)return{...e,field:pe(r,i)};let s=o?.sort((e,t)=>t.length-e.length)?.find(t=>e.field.startsWith(t));if(s){let t=a[s];if(t)return{...e,field:e.field.replace(s,pe(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},pe=(e,t)=>{let n=P(e);return n==null?e:e.replace(`$[${n}]`,t[n])},P=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function me(e,t,n,r,i,a,o,s,c,l,u){return te(()=>e({request:async e=>{let i=e({host:s?.HTTPHost||`www.wixapis.com`}),a=i;a.method===`GET`&&a.fallback?.length&&(a.params?.toString().length??0)>4e3&&(a=i.fallback[0]);let o=s?.HTTPHost??`www.wixapis.com`,u=`https://${l?b:o}${a.url}`;a.params&&a.params.toString()&&(u+=`?${a.params.toString()}`);try{let e=D(i,t,c),o={method:a.method,...a.data&&{body:JSON.stringify(a.data)},headers:{...e}},s=await n(u,o);if(s.status!==200){let e=null;try{e=await s.json()}catch{}let t=ge(s.status,e?.message??s.statusText,e?.details,{requestId:s.headers.get(`X-Wix-Request-Id`),details:e}),n=N(t);throw r?.handleError(n,{requestOptions:{url:a.url,method:a.method,entityFqdn:i.entityFqdn,methodFqn:i.methodFqn}}),t}let l=await s.json();return{data:a.migrationOptions?.optInTransformResponse&&a.transformResponse?Array.isArray(a.transformResponse)?a.transformResponse[0](l):a.transformResponse(l):l,headers:s.headers,status:s.status,statusText:s.statusText}}catch(e){throw e.message?.includes(`fetch is not defined`)&&console.error(`Node.js v18+ is required`),e}},fetchWithAuth:n,wixAPIFetch:i,getActiveToken:a,getAuthHeaders:o},{validateRequestSchema:u}))}var he=class extends Error{response;requestId;constructor(e){super(),this.response=e.response,this.requestId=e.requestId}},ge=(e,t,n,r)=>new he({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t},status:e},requestId:r?.requestId}),F=`.`;function _e(e,t,n){if(e==null)throw Error(`Cannot set value on null or undefined`);let r=ve(t),i=e;for(let e=0;e<r.length;e++){let t=r[e];if(e===r.length-1){i[t]=n;break}let a=r[e+1];(!(t in i)||i[t]==null||typeof i[t]!=`object`||i[t]===null)&&(i[t]=typeof a==`number`?[]:{}),i=i[t]}return e}function ve(e){return Array.isArray(e)?e:e.split(F).map(e=>ye(e)?Number(e):e)}function ye(e){return/^\d+$/.test(e)}function be(e){let t={};for(let[n,r]of Object.entries(e))xe(n)||_e(t,ve(n),r);return t}function xe(e){return e===`__proto__`||e===`constructor`||e===`prototype`}var Se=class{BRACKET_PATTERN=/\[(\d+)\]/g;NUMERIC_PATTERN=/^\d+$/;ESCAPED_DOT_PATTERN=/\\\./g;ESCAPED_LEFT_BRACKET_PATTERN=/\\\[/g;ESCAPED_RIGHT_BRACKET_PATTERN=/\\\]/g;SPLIT_PATTERN=/\.|\[(\d+)\]/g;DOT_BEFORE_BRACKET_PATTERN=/\.\[/g;ESCAPED_DOT_PLACEHOLDER=`__DOT__`;ESCAPED_RIGHT_BRACKET_PLACEHOLDER=`__RB__`;ESCAPED_LEFT_BRACKET_PLACEHOLDER=`__LB__`;modifiedFields;cleanedModifiedFields;constructor(e){this.modifiedFields=e}replaceEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(e){return e.replace(this.ESCAPED_DOT_PLACEHOLDER,`\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,`\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,`\\[`)}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([e,t])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(e)),t])),be(this.cleanedModifiedFields)}flatten(e){let t={};for(let n of Object.keys(this.cleanedModifiedFields)){let r=this.splitPath(n),i=this.navigatePath(e,r);t={...t,...i}}return Object.fromEntries(Object.entries(t).map(([e,t])=>[this.restoreEscapedCharacters(e),t]))}splitPath(e){let t=[],n=0,r=Array.from(e.matchAll(this.SPLIT_PATTERN));for(let i of r)i.index>n&&t.push(e.substring(n,i.index)),i[1]&&t.push(i[1]),n=i.index+i[0].length;return n<e.length&&t.push(e.substring(n)),t}navigatePath(e,t){let n=e,r=[],i=e=>{if(!Array.isArray(n))throw Error(`Expected array at path ${this.buildPathString(r)}, but got ${typeof n}`);r.push(`[${e}]`),n=n[parseInt(e,10)]},a=(e,t)=>{let i=e in k?k[e]:void 0;if(i&&i in t){r.push(i),n=t[i];return}let a=Ee(e);if(a&&a in t){r.push(a),n=t[a];return}throw Error(`Cannot find key '${e}' or its transformations at path ${this.buildPathString(r)}`)},o=(e,t)=>{r.push(e),n=t[e]};for(let e of t){if(this.NUMERIC_PATTERN.test(e)){i(e);continue}if(typeof n!=`object`||!n)throw Error(`Cannot access property '${e}' on ${typeof n} at path ${this.buildPathString(r)}`);let t=n;if(e in n){o(e,t);continue}a(e,t)}return{[this.buildPathString(r)]:n}}buildPathString(e){return e.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN,`[`)}bracketToDotNotation(e){return e.replace(this.BRACKET_PATTERN,(t,n,r)=>r>0&&e[r-1]===`\\`?t:`.`+n)}};function Ce(e,t){let n=e?.modifiedFields;if(!n)return null;let r=we(n);if(!r)return null;let{unflattenedModifiedFields:i,modifiedFieldsManipulator:a}=r;e={...e,modifiedFields:i};let o=t(e),s=o?.modifiedFields;if(!s)return null;let c=Te(s,a);return c===null?null:(o.modifiedFields=c,o)}function we(e){if(typeof e==`object`&&e&&!Array.isArray(e))try{let t=new Se(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function Te(e,t){if(typeof e==`object`&&e&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function Ee(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^./,e=>e.toLowerCase())}function De(){return{emit(e,...t){for(let n=0,r=this.events[e]||[],i=r.length;n<i;n++)r[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(e=>t!==e)}}}}var Oe=e=>e.__type===`event-definition`;function ke(e,t,n,r){let i;if(e.isDomainEvent){let{deletedEvent:e,actionEvent:t,createdEvent:a,updatedEvent:o,...s}=n,c={...r,...s};i=e?e?.deletedEntity?{entity:e?.deletedEntity,metadata:c}:{metadata:c}:t?{data:t.body,metadata:c}:o?{entity:o.currentEntity,metadata:c,...o.modifiedFields?{modifiedFields:o.modifiedFields}:{}}:{entity:a?.entity,metadata:c}}else i={data:n,metadata:r};let a=e.transformations??(e=>e),o=i,s=i;if(s.modifiedFields){let e=s.modifiedFields;if(typeof e==`object`&&e&&!Array.isArray(e)){o=structuredClone(i);let e=Ce(s,a);if(e)return t(e)}}return t(a(o))}function Ae(e){let t=new Map,n=De();return{initModule(e){return r=>{let i=t.get(e.type)??[];i.push({eventDefinition:e,handler:r}),t.set(e.type,i),n.emit(`registered`,e)}},client:{...n,getRegisteredEvents:()=>t,async process(e,n={expectedEvents:[]}){let{eventType:r,identity:i,instanceId:a,payload:o,accountInfo:s}=await this.parseJWT(e),c=[...n.expectedEvents,...Array.from(t.keys()).map(e=>({type:e}))];if(c.length>0&&!c.some(({type:e})=>e===r))throw Error(`Unexpected event type: ${r}. Expected one of: ${c.map(e=>e.type).join(`, `)}`);let l=t.get(r)??[];return await Promise.all(l.map(({eventDefinition:e,handler:t})=>ke(e,t,o,{instanceId:a,identity:i,accountInfo:s}))),{instanceId:a,eventType:r,payload:o,identity:i,accountInfo:s}},async processRequest(e,t){let n=await e.text();return this.process(n,t)},async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`string`)throw Error(`Unexpected type of JWT data: expected string, got ${typeof r.data}`);let a=JSON.parse(r.data),o=a.eventType,s=a.accountInfo,c=a.instanceId,l=a.identity?JSON.parse(a.identity):void 0;return{instanceId:c,eventType:o,payload:JSON.parse(a.data),identity:l,accountInfo:s}},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async executeHandlers(e){let n=Array.from(t.keys()).map(e=>({type:e}));if(n.length>0&&!n.some(({type:t})=>t===e.eventType))throw Error(`Unexpected event type: ${e.eventType}. Expected one of: ${n.map(e=>e.type).join(`, `)}`);let r=t.get(e.eventType)??[];await Promise.all(r.map(({eventDefinition:t,handler:n})=>ke(t,n,e.payload,{instanceId:e.instanceId,identity:e.identity})))},apps:{AppInstalled:h(`AppInstalled`)(),AppRemoved:h(`AppRemoved`)()}}}}var je=e=>e.__type===`service-plugin-definition`;function Me(e){let t=new Map,n=De();return{initModule(e){return r=>{let i=t.get(e.componentType.toLowerCase())??[];i.push({servicePluginDefinition:e,implementation:r}),t.set(e.componentType.toLowerCase(),i),n.emit(`registered`,e)}},client:{...n,getRegisteredServicePlugins:()=>t,async parseJWT(t){let n=e();if(!n.decodeJWT)throw Error(`decodeJWT is not supported by the authentication strategy`);let{decoded:r,valid:i}=await n.decodeJWT(t,!0);if(!i)throw Error(`JWT is not valid`);if(typeof r.data!=`object`||r.data===null||!(`metadata`in r.data)||typeof r.data.metadata!=`object`||r.data.metadata===null||!(`appExtensionType`in r.data.metadata)||typeof r.data.metadata.appExtensionType!=`string`)throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);return r.data},async process(e){let t=await this.parseJWT(e.body);return this.executeHandler(t,e.url)},async parseRequest(e){let t=await e.text();return this.parseJWT(t)},async processRequest(e){let t=await this.parseRequest(e);return this.processParsedRequest(t,e.url)},async processParsedRequest(e,t){try{let n=await this.executeHandler(e,t);return Response.json(n)}catch(e){if(e.errorType===`SPI`&&e.applicationCode&&e.httpCode)return Response.json({applicationError:{code:e.applicationCode,data:e.data}},{status:e.httpCode});throw e}},async executeHandler(e,n){let r=e.metadata.appExtensionType.toLowerCase(),i=t.get(r)??[];if(i.length===0)throw Error(`No service plugin implementations found for component type ${r}`);if(i.length>1)throw Error(`Multiple service plugin implementations found for component type ${r}. This is currently not supported`);let{implementation:a,servicePluginDefinition:o}=i[0],s=o.methods.find(e=>n.endsWith(e.primaryHttpMappingPath));if(!s)throw Error(`Unexpect request: request url did not match any method: `+n);let c=a[s.name];if(!c)throw Error(`Got request for service plugin method ${s.name} but no implementation was provided. Available methods: ${Object.keys(a).join(`, `)}`);return s.transformations.toREST(await c(s.transformations.fromREST(e)))}}}}var Ne=`X-Wix-Consistent`;function Pe(e){let t=e.headers||{Authorization:``},n={getAuthHeaders:e=>Promise.resolve({headers:{}})},r=e.auth,i=typeof r==`function`?r:()=>r??n,a=()=>i().getAuthHeaders(e.host),o=()=>e.fetch??fetch,s=async(n,r)=>{let i=o(),s=await a(),c={...r?.headers??{},...s.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[Ne]:t[Ne]}:{}},l=e.host?.getErrorHandler?.();try{if(typeof n==`string`||n instanceof URL){let e=await i(n,{...r,headers:c});l?.handleError(e,{requestOptions:{url:n.toString(),method:r?.method}});let a=Fe(e);return a&&(t[Ne]=a),e}{for(let[e,t]of Object.entries(c))typeof t==`string`&&n.headers.set(e,t);let e=await i(n,r);l?.handleError(e,{requestOptions:{url:n.url,method:r?.method}});let a=Fe(e);return a&&(t[Ne]=a),e}}catch(e){throw l?.handleError(e,{requestOptions:{url:typeof n==`string`||n instanceof URL?n.toString():n.url,method:r?.method}}),e}},{client:c,initModule:l}=Me(i),{client:u,initModule:d}=Ae(i),f=async(n,r)=>{let i=o(),s=await a(),c=C(r),l=await i(n,{...r,headers:{...c,...t,...s?.headers,...r?.headers,...e.host?.essentials?.passThroughHeaders,...t[`X-Wix-Consistent`]?{[Ne]:t[Ne]}:{}}}),u=Fe(l);return u&&(t[Ne]=u),l},p=(t,n)=>{if(Oe(t))return d(t);if(je(t))return l(t);if(T(t)&&e.host)return ee(t,e.host);if(typeof t==`function`){if(`__type`in t&&t.__type===`wix_spi_error`)return t;let r=e.host?.apiBaseUrl??`www.wixapis.com`,o=e.useCDN===void 0?i().shouldUseCDN:e.useCDN;return me(te(()=>v(t))?_(t):t,n??{},f,e.host?.getErrorHandler?.(),(e,t)=>{let n=new URL(e,`https://${r}`);return n.host=r,n.protocol=`https`,f(n.toString(),t)},i().getActiveToken,async()=>a(),{HTTPHost:r},e.host?.name,o,e.validateRequestSchema)}return w(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,p(n,t[y])])):t},h=e=>{for(let n in e)t[n]=e[n]};return{...e.modules?p(e.modules):{},get auth(){let t=i();return t.getAuthHeaders=t.getAuthHeaders.bind(void 0,e.host),t},setHeaders:h,use:p,enableContext(e,t={elevated:!1}){e===`global`?globalThis.__wix_context__==null?t.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:t.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:t.elevated?m.elevatedClient=this:m.client=this},fetch:(t,n)=>{let r=e.host?.apiBaseUrl??`www.wixapis.com`,i=new URL(t,`https://${r}`);return i.host=r,i.protocol=`https`,f(i.toString(),n)},fetchWithAuth:s,async graphql(t,n,r={apiVersion:`alpha`}){let i=e?.host?.apiBaseUrl??`www.wixapis.com`,a=await f(`https://${i}/graphql/${r.apiVersion}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:t,variables:n})});if(a.status!==200)throw new x(`GraphQL request failed with status ${a.status}`,a);let{data:o,errors:s}=await a.json();return{data:o??{},errors:s}},webhooks:u,servicePlugins:c}}function Fe(e){return e.headers?.get(`X-Wix-Consistent`)??e.headers?.get(`x-wix-consistent`)}var Ie={_id:`id`,_createdDate:`createdDate`,_updatedDate:`updatedDate`},Le={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`};function Re(e,t){return e?.split(`.`).map(e=>t?.[e]??e).join(`.`)}var ze=`sort.fieldName`;function Be(e,t,n){return(e===ze||e.endsWith(`.${ze}`))&&typeof t==`string`?Re(t,n):t}function Ve(e,t,n){let r=e=>n.includes(e),i=(e,n)=>{if(Array.isArray(e))e.forEach(e=>{i(e,n)});else if(typeof e==`object`&&e){let a=e;Object.keys(a).forEach(e=>{let o=n===``?e:`${n}.${e}`;if(r(o))return;let s=I(e,t);s!==e&&!(s in a)&&(a[s]=a[e],delete a[e]),a[s]=Be(o,a[s],t),i(a[s],o)})}};return i(e,``),e}function I(e,t){let n;return n=e.includes(`.`)?e.split(`.`).map(e=>t[e]??e).join(`.`):t[e]??e,n}function He(e,t=[]){return Ve(e,Ie,t)}function L(e,t=[]){return Ve(e,Le,t)}function Ue(e){return e?.toISOString()}function We(e){return e?new Date(e):void 0}var Ge=new WeakMap;function Ke(){return{leaves:void 0,fields:void 0,mapFields:void 0,anyField:void 0}}function qe(e,t){let n=e.get(t);return n||(n=Ke(),e.set(t,n)),n}function Je(e,t){return t===`*`?(e.anyField??=Ke(),e.anyField):t.endsWith(`{}`)?(e.mapFields??=new Map,qe(e.mapFields,t.slice(0,-2))):(e.fields??=new Map,qe(e.fields,t))}function Ye(e){let t=Ke();for(let n of e){let e=n.path.split(`.`).reduce(Je,t);e.leaves??=[],e.leaves.push(n)}return t}function R(e){let t=Ge.get(e);return t||(t=Ye(e),Ge.set(e,t)),t}function Xe(e){return typeof e==`object`&&!!e}function Ze(e,{isRepeated:t,isMap:n},r){return t?Array.isArray(e)?e.map(r):e:n?Xe(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,r(t)])):e:r(e)}function Qe(e,t,n){Xe(e)&&tt(e,t,n)}function $e(e,t,n){for(let[r,i]of t){if(!(r in e))continue;if(i.leaves)for(let t of i.leaves)e[r]=Ze(e[r],t,n);let t=e[r];Array.isArray(t)?t.forEach(e=>Qe(e,i,n)):Qe(t,i,n)}}function et(e,t,n){for(let[r,i]of t){let t=e[r];Xe(t)&&Object.values(t).forEach(e=>Qe(e,i,n))}}function tt(e,{fields:t,mapFields:n,anyField:r},i){t&&$e(e,t,i),n&&et(e,n,i),r&&Object.values(e).forEach(e=>Qe(e,r,i))}function z(e,t){if(!Xe(e))return e;for(let{paths:n,transformFn:r}of t)tt(e,R(n),r);return e}function nt(e){return st(e).map(e=>e.toLocaleUpperCase()).join(`_`)}var rt=/([\p{Ll}\d])(\p{Lu})/gu,it=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,at=`$1\0$2`,ot=/[^\p{L}\d]+/giu;function st(e){let t=e.trim();t=t.replace(rt,at).replace(it,at),t=t.replace(ot,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}var ct=e=>`validationError`in(e.response?.data?.details??{}),B=e=>`applicationError`in(e.response?.data?.details??{}),lt=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function ut(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(ct(e))return dt(e,t,n);if(B(e))return pt(e);if(lt(e)){let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i={applicationError:{description:n,code:nt(n),data:{}},requestId:e.requestId};return ft(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return mt(e)}var dt=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=ht(t,a,n)?.sort((e,t)=>e.field<t.field?-1:1),s=`INVALID_ARGUMENT: ${o?.map(({field:e,description:t})=>`"${e}" ${t}`)?.join(`, `)}`,c={validationError:{fieldViolations:o},requestId:i};return ft(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},ft=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),pt=e=>{let t=e.response?.status,n=e.response?.statusText??`UNKNOWN`,r=e.response?.data?.message??n,i=e.response?.data?.details?.applicationError?.description??n,a=e.response?.data?.details?.applicationError?.code??nt(n),o=e.response?.data?.details?.applicationError?.data??{},s=r===i?r:`${r}: ${i}`,c={applicationError:{description:i,code:a,data:o},requestId:e.requestId};return ft(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},mt=e=>ft(e,{message:e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`,extraProperties:{requestId:e.requestId,status:e.response?.status,code:nt(e.response?.statusText??`UNKNOWN`),...!e.response&&{runtimeError:e}}}),ht=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:n},r,i)=>{let a={...e,...t},o=Object.keys(a);return r?.filter(e=>!r.some(t=>t.field.length>e.field.length&&t.field.startsWith(e.field)&&o.includes(t.field))).map(e=>{let r=t[e.field];if(r)return{...e,field:gt(r,i)};let s=o?.sort((e,t)=>t.length-e.length)?.find(t=>e.field.startsWith(t));if(s){let t=a[s];if(t)return{...e,field:e.field.replace(s,gt(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},gt=(e,t)=>{let n=_t(e);return n==null?e:e.replace(`$[${n}]`,t[n])},_t=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function vt(){let e=typeof $wixContext<`u`&&$wixContext.initWixModules?$wixContext.initWixModules:globalThis.__wix_context__!==void 0&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(t,n){return yt(()=>e(t,n))},fetchWithAuth(){throw Error(`fetchWithAuth is not available in this context`)},graphql(){throw Error(`graphql is not available in this context`)}};let t=typeof $wixContext<`u`?$wixContext.client:m.client===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.client:m.client,n=typeof $wixContext<`u`?$wixContext.elevatedClient:m.elevatedClient===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.elevatedClient:m.elevatedClient;if(t||n)return{initWixModules(e,r){if(r){if(!n)throw 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`);return yt(()=>n.use(e))}if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return yt(()=>t.use(e))},fetchWithAuth:(e,n)=>{if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.fetchWithAuth(e,n)},getAuth(){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.auth},async graphql(e,n,r){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.graphql(e,n,r)}}}function yt(e){let t=globalThis.__wix_context__,n={client:m.client,elevatedClient:m.elevatedClient},r;globalThis.__wix_context__=void 0,m.client=void 0,m.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,m.client=n.client,m.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function bt(e,t){return((...n)=>{let r=vt();return r?r.initWixModules(e,t).apply(void 0,n):e.apply(void 0,n)})}function xt(e,t=!1){return bt(e,t)}function St(e,t){let n=Ct(e),r=Object.entries(n).some(([e,t])=>e.includes(`.`)||Array.isArray(t)&&t.some(e=>typeof e==`object`));return t&&r?new URLSearchParams({".r":Tt(JSON.stringify(e))}):Object.entries(n).reduce((e,[t,n])=>((Array.isArray(n)?n:[n]).forEach(r=>{r==null||Array.isArray(n)&&typeof r==`object`||e.append(t,r)}),e),new URLSearchParams)}function V(e){let t=Rt(It(e.host),e.domainToMappings);return H(Wt(e.protoPath,e.data||{}),t)}function Ct(e,t=``){let n={};return Object.entries(e).forEach(([e,r])=>{let i=typeof r==`object`&&!!r&&!Array.isArray(r),a=wt(t,e);if(i){let e=Ct(r,a);Object.assign(n,e)}else n[a]=r}),n}function wt(e,t){return`${e}${e?`.`:``}${t}`}var Tt=e=>{let t=new TextEncoder().encode(e);return(typeof btoa<`u`?btoa(String.fromCodePoint(...t)):Buffer.from(e,`utf-8`).toString(`base64`)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)},Et=[`wix.com`,`editorx.com`],Dt=`_`,Ot=`*.`,kt=RegExp(`\\.(${Et.join(`|`)})$`),At=[`42.wixprod.net`,`uw2-edt-1.wixprod.net`,`virginia-edt.wixprod.net`],jt={"payments.base44.com":`manage.wix.com`,"create.editorx.com":`editor.editorx.com`},Mt=`dev.wix-code.com`,Nt=/{(.*)}/,Pt=RegExp(`\\.(${At.join(`|`)})$`),Ft=RegExp(`.*\\.${Mt}$`);function It(e){return Lt(e).replace(kt,`._base_domain_`).replace(Pt,`._api_base_domain_`).replace(Ft,`*.dev.wix-code.com`)}function Lt(e){return jt[e]??e}function Rt(e,t){let n=t[e];if(n)return n;let r=zt(e,t)??Bt(e,t);if(!r){if(Ht(e)){let e=t[Ut];if(e)return e}let n=t[Dt];if(n)return n}return r??[]}function zt(e,t){return Object.entries(t).find(([t])=>{let[,...n]=e.split(`.`);return n.join(`.`)===t})?.[1]}function Bt(e,t){let[n]=Object.entries(t).filter(([t])=>Vt(e,t)).sort(([e],[t])=>t.length-e.length);if(!n)return;let[,r]=n;return r}function Vt(e,t){if(!t.startsWith(Ot))return!1;let n=t.slice(1);return e.length>n.length&&e.endsWith(n)}function Ht(e){return!!e.match(/\._base_domain_$/)}var Ut=`www._base_domain_`;function Wt(e,t){return e.split(`/`).map(e=>Gt(e,t)).join(`/`)}function Gt(e,t){let n=e.match(Nt)||[],r=n[1];return r?Kt(t,r,e,e.replace(n[0],``)):e}function Kt(e,t,n,r){let i=e;for(let e of t.split(`.`)){if(!i)return n;i=i[e]}return`${i}${r}`}function H(e,t){let n=t?.find(t=>e.startsWith(t.destPath));return n?n.srcPath+e.slice(n.destPath.length):e}function qt(e){return e===`NaN`?NaN:e===`Infinity`?1/0:e===`-Infinity`?-1/0:e}var Jt=`x-wix-linguist`,Yt=`00000000-0000-0000-0000-000000000000`,Xt=`false`,Zt=()=>{let e=en(`language`),t=en(`locale`);if(e)return{[Jt]:[e,t||e,Xt,Yt].join(`|`)}};function Qt(){let e=null,t=null;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var $t=()=>(typeof window<`u`?window.commonConfig:void 0)??globalThis.commonConfig,en=e=>$t()?.[e],tn=({createHost:e})=>({__type:`host`,create:e=>({}),host:t=>{let{applicationId:n,componentId:r}=t??{},i=typeof window<`u`?window.wixEmbedsAPI:void 0,a=e(t),o=rn();return{...a,apiBaseUrl:o,getMonitoringClient:i?.getMonitoringClientFunction?.(n,r),essentials:{language:en(`language`),locale:en(`locale`),get passThroughHeaders(){return Zt()}}}},auth:e=>{let t=typeof window<`u`?window.wixEmbedsAPI:void 0;!e&&nn()&&(e=t?.getAccessTokenFunction?.());let n=!1,{resolve:r,promise:i}=Qt();return{getAuthHeaders:async()=>{if(!e&&n&&(e=await i),!e)throw Error(`Failed to resolve auth token`);return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(n=!0,e=>{r(e)})}}});function nn(){return typeof document<`u`&&document.currentScript?.tagName===`SCRIPT`}function rn(){let e=(typeof window<`u`?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!==`/`?`${t.hostname}${t.pathname}`:t.hostname}var an=({clientSdk:e,applicationId:t})=>({invoke:async({namespace:n,method:r,args:i})=>{if(!e)throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);return e.invoke({namespace:n,method:r,args:i,applicationId:t,accessToken:`accessToken`})},getAccessToken:()=>{throw Error(`Not implemented`)},observeState:()=>({disconnect:()=>{}})}),on=tn({createHost:function(e){let t=(typeof $wixContext<`u`?$wixContext.clientSdk:void 0)??e?.clientSdk??(typeof window<`u`?window?.clientSdk:void 0),{applicationId:n}=e||{};if(!n)throw Error(`"createHost" was called without a required field "applicationId"`);return{channel:an({clientSdk:t,applicationId:n}),close:()=>{}}}}),U=(e,t)=>{let n=on.host({applicationId:e,componentId:t}),r=on.auth();return Pe({auth:r,host:n}).enableContext(`module`),r.getAccessTokenInjector()},sn=e=>U(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`,e),cn=[`ANY_FEMALE`,`ANY_MALE`],ln=`3.7.8`,un=ln,dn=typeof Buffer==`function`,fn=typeof TextDecoder==`function`?new TextDecoder:void 0,pn=typeof TextEncoder==`function`?new TextEncoder:void 0,mn=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),hn=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(mn),gn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,W=String.fromCharCode.bind(String),_n=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),vn=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),yn=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),bn=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=mn[t>>18&63]+mn[t>>12&63]+mn[t>>6&63]+mn[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},xn=typeof btoa==`function`?e=>btoa(e):dn?e=>Buffer.from(e,`binary`).toString(`base64`):bn,Sn=dn?e=>Buffer.from(e).toString(`base64`):e=>{let t=4096,n=[];for(let r=0,i=e.length;r<i;r+=t)n.push(W.apply(null,e.subarray(r,r+t)));return xn(n.join(``))},Cn=(e,t=!1)=>t?vn(Sn(e)):Sn(e),wn=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?W(192|t>>>6)+W(128|t&63):W(224|t>>>12&15)+W(128|t>>>6&63)+W(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return W(240|t>>>18&7)+W(128|t>>>12&63)+W(128|t>>>6&63)+W(128|t&63)},Tn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,En=e=>e.replace(Tn,wn),Dn=dn?e=>Buffer.from(e,`utf8`).toString(`base64`):pn?e=>Sn(pn.encode(e)):e=>xn(En(e)),On=(e,t=!1)=>t?vn(Dn(e)):Dn(e),kn=e=>On(e,!0),An=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,jn=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return W((t>>>10)+55296)+W((t&1023)+56320);case 3:return W((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return W((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Mn=e=>e.replace(An,jn),G=e=>{if(e=e.replace(/\s+/g,``),!gn.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=hn[e.charAt(a++)]<<18|hn[e.charAt(a++)]<<12|(n=hn[e.charAt(a++)])<<6|(r=hn[e.charAt(a++)]),n===64?i.push(W(t>>16&255)):r===64?i.push(W(t>>16&255,t>>8&255)):i.push(W(t>>16&255,t>>8&255,t&255));return i.join(``)},Nn=typeof atob==`function`?e=>atob(yn(e)):dn?e=>Buffer.from(e,`base64`).toString(`binary`):G,Pn=dn?e=>_n(Buffer.from(e,`base64`)):e=>_n(Nn(e).split(``).map(e=>e.charCodeAt(0))),Fn=e=>Pn(Ln(e)),In=dn?e=>Buffer.from(e,`base64`).toString(`utf8`):fn?e=>fn.decode(Pn(e)):e=>Mn(Nn(e)),Ln=e=>yn(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),Rn=e=>In(Ln(e)),zn=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},Bn=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),Vn=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,Bn(t));e(`fromBase64`,function(){return Rn(this)}),e(`toBase64`,function(e){return On(this,e)}),e(`toBase64URI`,function(){return On(this,!0)}),e(`toBase64URL`,function(){return On(this,!0)}),e(`toUint8Array`,function(){return Fn(this)})},Hn=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Bn(t));e(`toBase64`,function(e){return Cn(this,e)}),e(`toBase64URI`,function(){return Cn(this,!0)}),e(`toBase64URL`,function(){return Cn(this,!0)})},Un={version:ln,VERSION:un,atob:Nn,atobPolyfill:G,btoa:xn,btoaPolyfill:bn,fromBase64:Rn,toBase64:On,encode:On,encodeURI:kn,encodeURL:kn,utob:En,btou:Mn,decode:Rn,isValid:zn,fromUint8Array:Cn,toUint8Array:Fn,extendString:Vn,extendUint8Array:Hn,extendBuiltins:()=>{Vn(),Hn()}},K=Uint8Array,Wn=Uint16Array,Gn=Int32Array,Kn=new K([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),qn=new K([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Jn=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yn=function(e,t){for(var n=new Wn(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Gn(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Xn=Yn(Kn,2),Zn=Xn.b,Qn=Xn.r;Zn[28]=258,Qn[258]=28;var $n=Yn(qn,0),er=$n.b;$n.r;for(var tr=new Wn(32768),q=0;q<32768;++q){var nr=(q&43690)>>1|(q&21845)<<1;nr=(nr&52428)>>2|(nr&13107)<<2,nr=(nr&61680)>>4|(nr&3855)<<4,tr[q]=((nr&65280)>>8|(nr&255)<<8)>>1}for(var rr=(function(e,t,n){for(var r=e.length,i=0,a=new Wn(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Wn(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Wn(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[tr[d]>>c]=l}else for(s=new Wn(r),i=0;i<r;++i)e[i]&&(s[i]=tr[o[e[i]-1]++]>>15-e[i]);return s}),ir=new K(288),q=0;q<144;++q)ir[q]=8;for(var q=144;q<256;++q)ir[q]=9;for(var q=256;q<280;++q)ir[q]=7;for(var q=280;q<288;++q)ir[q]=8;for(var ar=new K(32),q=0;q<32;++q)ar[q]=5;var or=rr(ir,9,1),sr=rr(ar,5,1),cr=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},lr=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ur=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},dr=function(e){return(e+7)/8|0},fr=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new K(e.subarray(t,n))},pr=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],mr=function(e,t,n){var r=Error(t||pr[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,mr),!n)throw r;return r},hr=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new K(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new K(i*3));var l=function(e){var t=n.length;if(e>t){var r=new K(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=lr(e,d,1);var v=lr(e,d+1,3);if(d+=3,!v){var y=dr(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&mr(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=or,m=sr,h=9,g=5;else if(v==2){var S=lr(e,d,31)+257,C=lr(e,d+10,15)+4,w=S+lr(e,d+5,31)+1;d+=14;for(var T=new K(w),ee=new K(19),E=0;E<C;++E)ee[Jn[E]]=lr(e,d+E*3,7);d+=C*3;for(var D=cr(ee),O=(1<<D)-1,te=rr(ee,D,1),E=0;E<w;){var k=te[lr(e,d,O)];d+=k&15;var y=k>>4;if(y<16)T[E++]=y;else{var A=0,ne=0;for(y==16?(ne=3+lr(e,d,3),d+=2,A=T[E-1]):y==17?(ne=3+lr(e,d,7),d+=3):y==18&&(ne=11+lr(e,d,127),d+=7);ne--;)T[E++]=A}}var re=T.subarray(0,S),j=T.subarray(S);h=cr(re),g=cr(j),p=rr(re,h,1),m=rr(j,g,1)}else mr(1);if(d>_){c&&mr(0);break}}s&&l(f+131072);for(var ie=(1<<h)-1,M=(1<<g)-1,ae=d;;ae=d){var A=p[ur(e,d)&ie],oe=A>>4;if(d+=A&15,d>_){c&&mr(0);break}if(A||mr(2),oe<256)n[f++]=oe;else if(oe==256){ae=d,p=null;break}else{var se=oe-254;if(oe>264){var E=oe-257,N=Kn[E];se=lr(e,d,(1<<N)-1)+Zn[E],d+=N}var ce=m[ur(e,d)&M],le=ce>>4;ce||mr(3),d+=ce&15;var j=er[le];if(le>3){var N=qn[le];j+=ur(e,d)&(1<<N)-1,d+=N}if(d>_){c&&mr(0);break}s&&l(f+131072);var ue=f+se;if(f<j){var de=a-j,fe=Math.min(j,ue);for(de+f<0&&mr(3);f<fe;++f)n[f]=r[de+f]}for(;f<ue;++f)n[f]=n[f-j]}}t.l=p,t.p=ae,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?fr(n,0,f):n.subarray(0,f)},gr=new K(0),_r=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&mr(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},vr=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0};function yr(e,t){var n=_r(e);return n+8>e.length&&mr(6,`invalid gzip data`),hr(e.subarray(n,-8),{i:2},t&&t.out||new K(vr(e)),t&&t.dictionary)}var br=typeof TextDecoder<`u`&&new TextDecoder;try{br.decode(gr,{stream:!0})}catch{}var xr=new Set([`APPOINTMENT`,`CLASS`,`COURSE`]),Sr=new Set(cn);function J(e){return typeof e==`string`?e:void 0}function Cr(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function wr(e){return typeof e==`boolean`?e:void 0}function Tr(e){if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}function Er(e){return typeof e==`object`&&!!e}function Dr(e){if(!Er(e))return null;let t=J(e.t);if(t===void 0)return null;let n={type:t,ids:Tr(e.d)??[]},r=wr(e.n);return r!==void 0&&(n.anyResource=r),n}function Or(e){if(!Er(e))return null;let t=Cr(e.p),n=Tr(e.h);if(t===void 0&&n===void 0)return null;let r={};return t!==void 0&&(r.numberOfParticipants=t),n!==void 0&&(r.choices=n),r}function kr(e){if(!Er(e))return null;let t=J(e.i),n=Cr(e.q);return t===void 0||n===void 0?null:{id:t,quantity:n}}function Ar(e,t){if(!Array.isArray(e))return;let n=e.map(t).filter(e=>e!==null);return n.length?n:void 0}function jr(e){if(!Er(e))return null;let t=J(e.i);if(t===void 0)return null;let n={serviceId:t},r=J(e.g);r!==void 0&&(n.slug=r);let i=function(e){let t=J(e);if(t!==void 0&&xr.has(t))return t}(e.y);i!==void 0&&(n.serviceType=i);let a=J(e.t0);a!==void 0&&(n.slotStart=a);let o=J(e.t1);o!==void 0&&(n.slotEnd=o);let s=J(e.e);s!==void 0&&(n.eventId=s);let c=J(e.c);c!==void 0&&(n.scheduleId=c);let l=J(e.k);l!==void 0&&(n.sessionId=l);let u=J(e.l);u!==void 0&&(n.locationId=u);let d=J(e.lt);d!==`BUSINESS`&&d!==`CUSTOM`&&d!==`CUSTOMER`||(n.locationType=d);let f=Ar(e.r,Dr);f&&(n.resources=f);let p=Ar(e.x,Or);p&&(n.selectedVariants=p);let m=Ar(e.a,kr);m&&(n.addOns=m);let h=J(e.dc);h&&(n.durationChoiceId=h);let g=Cr(e.dm);g!==void 0&&Number.isInteger(g)&&g>0&&(n.durationInMinutes=g);let _=J(e.rg);return _!==void 0&&Sr.has(_)&&(n.requestedGender=_),n}function Mr(e){if(!Er(e))return null;let t=J(e.m);if(t!==`single`&&t!==`multi`||!Array.isArray(e.s))return null;let n={mode:t,services:e.s.map(jr).filter(e=>e!==null)},r=J(e.z);return r!==void 0&&(n.timezone=r),!0===wr(e.cp)&&(n.wantsPromoCode=!0),n}new TextEncoder;var Nr=new TextDecoder;function Pr(e){if(!e||e.length<2)return null;try{let t=e[0],n=Un.toUint8Array(e.slice(1)),r;if(t===`1`)r=n;else{if(t!==`2`)return null;r=yr(n)}return Mr(JSON.parse(Nr.decode(r)))}catch{return null}}function Fr(e){return e}var Ir=Fr(`@wix/site-service-editor-context`),Lr=Fr(`@wix/site-service-pages`),Rr=Fr(`@wix/site-service-router`),zr=Fr(`@wix/site-service-url`),Br=Fr(`@wix/site-service-renderer-configuration`),Vr=`13d21c63-b5ec-5912-8397-c3a5ddb27a97`,Hr=`shopping_cart`,Ur=`thank_you_page`,Wr=`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`,Gr=function(e){return e.BOOK_ONLINE=`bookingsBookOnline`,e.SERVICE_PAGE=`bookingsServicePage`,e.CALENDAR_PAGE=`bookingsCalendar`,e.FORM_PAGE=`bookingsForm`,e}({}),Kr=`{{(.*?)}}`,qr=`[{{}}]`,Jr=`([^/]+)`,Yr;(function(e){e.product_page=`product_page`,e.blog=`blog`,e.post=`post`,e.forum=`forum`,e.group=`group`,e.bookings=`Booking Service Page`,e.challenges=`challenge_page`})(Yr||={});var Y;(function(e){e.PRODUCT_PAGE=`wix.stores.sub_pages.product`,e.BLOG_POST=`wix.blog.sub_pages.post`,e.BLOG_POST_EDIT=`wix.blog.sub_pages.post.edit`,e.BLOG_POST_PREVIEW=`wix.blog.sub_pages.post.preview`,e.BLOG_CATEGORY=`wix.blog.sub_pages.category`,e.FORUM_CATEGORY=`wix.forum.sub_pages.category`,e.FORUM_CATEGORY_PAGINATION=`wix.forum.sub_pages.category.pagination`,e.FORUM_CATEGORY_CREATE_POST=`wix.forum.sub_pages.category.create-post`,e.FORUM_CATEGORY_CREATE_QUESTION=`wix.forum.sub_pages.category.create-question`,e.FORUM_POST=`wix.forum.sub_pages.post`,e.FORUM_POST_EDIT=`wix.forum.sub_pages.post.edit`,e.FORUM_POST_PAGINATION=`wix.forum.sub_pages.post.pagination`,e.FORUM_POST_DEEP_LINK_DATA=`wix.forum.sub_pages.post.deep-link-data`,e.FORUM_POST_PAGINATION_AND_DEEP_LINK_DATA=`wix.forum.sub_pages.post.pagination-and-deep-link-data`,e.GROUP=`wix.groups.sub_pages.group`,e.GROUP_POST=`wix.groups.sub_pages.post`,e.BOOKINGS_SERVICE=`wix.bookings.sub_pages.service_page`,e.CHALLENGES_PAGE=`wix.online_programs.sub_pages.online_program`})(Y||={});var Xr={},Zr=(Xr[Y.PRODUCT_PAGE]={variables:[`slug`],required:[`slug`]},Xr),Qr=`{{main-mapping}}`,$r={},ei,ti=($r[Y.BLOG_POST]={variables:[`slug`],required:[`slug`],subMappings:(ei={},ei[Y.BLOG_POST_EDIT]={defaultMapping:`${Qr}/edit`},ei[Y.BLOG_POST_PREVIEW]={required:[`instance`],defaultMapping:`${Qr}/preview/{{instance}}`},ei)},$r),ni={},ri=(ni[Y.BLOG_CATEGORY]={variables:[`slug`],required:[`slug`],defaultPrefix:`categories`},ni),ii={},ai,oi,si=(ii[Y.FORUM_POST]={variables:[`categorySlug`,`postSlug`],required:[`categorySlug`,`postSlug`],subMappings:(ai={},ai[Y.FORUM_POST_EDIT]={defaultMapping:`${Qr}/edit`},ai[Y.FORUM_POST_PAGINATION]={required:[`page`],defaultMapping:`${Qr}/p-{{page}}`},ai[Y.FORUM_POST_DEEP_LINK_DATA]={required:[`deepLinkData`],defaultMapping:`${Qr}/dl-{{deepLinkData}}`},ai[Y.FORUM_POST_PAGINATION_AND_DEEP_LINK_DATA]={required:[`page`,`deepLinkData`],defaultMapping:`${Qr}/p-{{page}}/dl-{{deepLinkData}}`},ai)},ii[Y.FORUM_CATEGORY]={variables:[`slug`],required:[`slug`],subMappings:(oi={},oi[Y.FORUM_CATEGORY_CREATE_POST]={defaultMapping:`${Qr}/create-post`},oi[Y.FORUM_CATEGORY_CREATE_QUESTION]={defaultMapping:`${Qr}/create-question`},oi[Y.FORUM_CATEGORY_PAGINATION]={required:[`page`],defaultMapping:`${Qr}/p-{{page}}`},oi)},ii),ci={},li=(ci[Y.GROUP]={variables:[`groupId`,`tabName`],required:[`groupId`,`tabName`]},ci[Y.GROUP_POST]={variables:[`groupId`,`tabName`,`postId`],required:[`groupId`,`tabName`,`postId`]},ci),ui={},di=(ui[Y.BOOKINGS_SERVICE]={variables:[`slug`],required:[`slug`],defaultPrefix:`service-page`},ui),fi={},pi=(fi[Y.CHALLENGES_PAGE]={variables:[`slug`],required:[`slug`],defaultPrefix:`challenge-page`},fi),mi={},hi=(mi[Yr.product_page]=Zr,mi[Yr.post]=ti,mi[Yr.blog]=ri,mi[Yr.forum]=si,mi[Yr.group]=li,mi[Yr.bookings]=di,mi[Yr.challenges]=pi,mi),gi=function(){return gi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gi.apply(this,arguments)};function _i(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function X(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function vi(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var yi=function(e){return Object.values(bi()).some(function(t){return!!t?.subMappings?.[e]})},bi=function(){return Object.values(hi).reduce(function(e,t){return gi(gi({},e),t)},{})||{}},xi=function(e){var t=bi()[e];return!t&&yi(e)&&console.warn(`You cannot get variables schema for subMappings key (${e}).`),t},Si=function(e){return Object.entries(hi).filter(function(t){var n=X(t,2)[1];return Object.keys(n).includes(e)}).map(function(e){return X(e,1)[0]})[0]},Ci=function(e){return Object.entries(bi()).find(function(t){var n=X(t,2);return n[0],!!n[1]?.subMappings?.[e]})},wi=function(e){var t=[];if(yi(e)){var n=X(Ci(e),2);n[0];var r=n[1];t.push.apply(t,vi(vi([],X(r?.required||[]),!1),X(r?.subMappings?.[e]?.required||[]),!1))}else t.push.apply(t,vi([],X(xi(e)?.required||[]),!1));return t},Ti=function(e,t){var n;return t===void 0&&(t=``),((n=e?.main)?.find)?.call(n,function(e){return e.key===t})},Ei=function(e,t){return Error(`Url Mappings Error - [${e}]: ${t}`)},Di=Object.values(Y),Oi=Ei(`key`,`must be one of: ${Di.toString()}`),ki=function(e){if(typeof e!=`string`||!Di.includes(e))return Oi},Ai=Ei(`itemData`,`must be on object with string as value, for example: { "slug": "shoes" }`),ji=function(e){if(typeof e!=`object`||!e||!Object.values(e).every(function(e){return typeof e==`string`})||Array.isArray(e))return Ai},Mi=Ei(`itemData`,`must have required variables, for example: { "slug": "shoes" }`),Ni=function(e,t){try{var n=wi(e);if(!n.every(function(e){return!!t[e]})||!n.length)throw Error()}catch{return Mi}},Pi=function(e){var t=e.key,n=e.itemData;return[ki(t),ji(n),Ni(t,n)].find(Boolean)},Fi=function(e){return function(t){var n=new RegExp(qr,`g`),r=t.replace(n,``);return e?.[r]}},Ii=function(e,t,n,r){e===void 0&&(e={main:[]}),r===void 0&&(r={});var i=Pi({key:t,itemData:n});if(i)throw i;var a=(Ti(e,t)||{}).mapping,o=(r||{}).baseUrl;if(o??=``,o=o.endsWith(`/`)?o?.slice(0,-1):o,a&&typeof a==`string`){var s=new RegExp(Kr,`g`),c=a.replace(s,Fi(n));return o.concat(`/${c}`)}},Li=/[.*+?^$()|]/g,Ri=function(e){var t=e.replace(Li,`\\$&`).replace(new RegExp(Kr,`g`),Jr);return RegExp(`^${t}\$`)},zi=function(e,t){return e===void 0&&(e=[]),e.find(function(e){return Ri(e).test(t)})};Ei(`url`,`Url must be a string`);var Bi=function(e){return[` `,` `,`
|
|
2
|
-
`].every(function(t){return!(e?.includes)?.call(e,t)})},Vi=function(e){return e?.length<=$i.MAX_URL_MAPPING_LENGTH},Hi=function(e){return e?.split(`/`).every(Boolean)},Ui=function(e,t){var n=t.urlMappingKey;return wi(n)?.every(function(t){return e?.includes(`{{${t}}}`)})},Wi=function(e){return(e.match(new RegExp(Kr,`g`))?.length||0)<=1},Gi=function(e){return e?.split(`/`).every(Wi)},Ki=function(e){return[e.publishedPrefix,e.savedPrefix].filter(Boolean)},qi=function(e,t){return t===void 0&&(t=[]),function(n,r){var i=n.split(`/`),a=n===r;if(i.length<1||a)return!0;var o=X(r.split(`/`),1)[0],s=X(i,1)[0];return t.includes(s)?!0:e.every(function(e){return e===o||e!==s})}},Ji=function(e,t){var n=t.pathPrefixes;return qi(Object.values(n).map(function(e){return e.publishedPrefix}).filter(Boolean),Ki(t.pathPrefix))(e,t.defaultMapping.defaultPublished)},Yi=function(e,t){var n=t.urlMappingKey,r=t.urlMappings;return!zi(r.main?.filter(function(e){return n!==e.key}).map(function(e){return e.mapping}),e)},Xi=function(e){e=e.replace(new RegExp(Kr,`ig`),``);var t=new RegExp(/[^\]_.~!*'();:@&=+$,<>\\#^%?`"]/,`g`),n=!/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g.test(e),r=!e.replace(t,``);return n&&r},Zi=function(e){var t=X(e,1)[0],n=e.slice(-1);return t!==`/`&&n!==`/`},Qi=function(e,t){var n=t.pathPrefixes;return qi(Object.values(n).map(function(e){return e.savedPrefix}).filter(Boolean),Ki(t.pathPrefix))(e,t.defaultMapping.defaultSaved)},Z;(function(e){e.MAX_LENGTH_ERROR=`MAX_LENGTH_ERROR`,e.NO_SPACES_ERROR=`NO_SPACES_ERROR`,e.NO_EMPTY_SEGMENT_ERROR=`NO_EMPTY_SEGMENT_ERROR`,e.CONTAIN_MAIN_VARIABLE_ERROR=`CONTAIN_MAIN_VARIABLE_ERROR`,e.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR=`ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR`,e.ONLY_UNIQUE_PUBLISHED_URL_ERROR=`ONLY_UNIQUE_PUBLISHED_URL_ERROR`,e.ONLY_UNIQUE_SAVED_URL_ERROR=`ONLY_UNIQUE_SAVED_URL_ERROR`,e.ONLY_UNIQUE_MAPPING_ERROR=`ONLY_UNIQUE_MAPPING_ERROR`,e.NO_INVALID_CHARACTERS_ERROR=`NO_INVALID_CHARACTERS_ERROR`,e.NO_STARTING_OR_ENDING_SLASH_ERROR=`NO_STARTING_OR_ENDING_SLASH_ERROR`})(Z||={});var $i=function(){function e(e){var t=e.urlMappingKey,n=e.pathPrefixes,r=e.urlMappings,i=this;this.initValidators=function(){i.validators=[[Vi,Z.MAX_LENGTH_ERROR],[Bi,Z.NO_SPACES_ERROR],[Zi,Z.NO_STARTING_OR_ENDING_SLASH_ERROR],[Hi,Z.NO_EMPTY_SEGMENT_ERROR],[Xi,Z.NO_INVALID_CHARACTERS_ERROR],[Ui,Z.CONTAIN_MAIN_VARIABLE_ERROR],[Gi,Z.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR],[Ji,Z.ONLY_UNIQUE_PUBLISHED_URL_ERROR],[Qi,Z.ONLY_UNIQUE_SAVED_URL_ERROR],[Yi,Z.ONLY_UNIQUE_MAPPING_ERROR]]},this.urlMappings=r,this.pathPrefixes=n,this.urlMappingKey=t,this.pathPrefix=this.getPathPrefix(),this.defaultMapping=ea(t,this.pathPrefix),this.initValidators()}return e.prototype.getPathPrefix=function(){var t=Si(this.urlMappingKey);if(!t)throw yi(this.urlMappingKey)?Error(`Url Mapper Validator Error: Validator does not support sub mapping, please use the main url mapping key`):Error(`Url Mapper Validator Error: Url mapping key is not supported (${this.urlMappingKey})`);return this.pathPrefixes[t]||e.FALLBACK_PATH_PREFIX},Object.defineProperty(e.prototype,"validatorProps",{get:function(){var e=this;return{urlMappingKey:e.urlMappingKey,urlMappings:e.urlMappings,pathPrefix:e.pathPrefix,pathPrefixes:e.pathPrefixes,defaultMapping:e.defaultMapping}},enumerable:!1,configurable:!0}),e.prototype.validate=function(e){var t,n;try{for(var r=_i(this.validators),i=r.next();!i.done;i=r.next()){var a=X(i.value,2),o=a[0],s=a[1],c=!!o(e,this.validatorProps);if(!c)return{isValid:c,error:s}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{isValid:!0}},e.errorArray=Object.values(Z),e.MAX_URL_MAPPING_LENGTH=1e3,e.FALLBACK_PATH_PREFIX=`unknown`,e}(),ea=function(e,t){var n=bi()[e]||{required:[`slug`]},r=n.required,i=n.defaultPrefix,a={};return t&&typeof t==`object`?(a.savedPrefix=t.savedPrefix??``,a.publishedPrefix=t.publishedPrefix??``):(a.savedPrefix=$i.FALLBACK_PATH_PREFIX,a.publishedPrefix=$i.FALLBACK_PATH_PREFIX),{defaultSaved:vi([a.savedPrefix,i],X(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`),defaultPublished:vi([a.publishedPrefix,i],X(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`)}};function ta(e,t){return t?Ii(e,Y.BOOKINGS_SERVICE,{slug:t},{baseUrl:``}):void 0}var na=[{path:`bookingPolicyViolations.earliestBookingDate`}],ra=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ia(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var aa=`@wix/auto_sdk_bookings_availability-time-slots`;function oa(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:na}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots`,packageName:aa,migrationOptions:{optInTransformResponse:!0},url:ia({protoPath:`/v2/time-slots`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:ra}])}}return t}async function sa(e){let{httpClient:t,sideEffects:n}=arguments[1],r=oa(He({serviceId:e?.serviceId,fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,locations:e?.locations,includeResourceTypeIds:e?.includeResourceTypeIds,bookable:e?.bookable,bookingPolicyViolations:e?.bookingPolicyViolations,timeSlotsPerDay:e?.timeSlotsPerDay,cursorPaging:e?.cursorPaging,customerChoices:e?.customerChoices,resourceTypes:e?.resourceTypes}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{serviceId:`$[0].serviceId`,fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,locations:`$[0].locations`,includeResourceTypeIds:`$[0].includeResourceTypeIds`,bookable:`$[0].bookable`,bookingPolicyViolations:`$[0].bookingPolicyViolations`,timeSlotsPerDay:`$[0].timeSlotsPerDay`,cursorPaging:`$[0].cursorPaging`,customerChoices:`$[0].customerChoices`,resourceTypes:`$[0].resourceTypes`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function ca(e){return t=>sa(t,{httpClient:e})}var la=xt(ca),ua=[{path:`bookingPolicyViolations.earliestBookingDate`}],da=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`},{path:`schedulesInfo.firstSessionStart`},{path:`schedulesInfo.lastSessionEnd`},{path:`schedulesInfo.enrollmentViolations.earliestBookingDate`}];function fa(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var pa=`@wix/auto_sdk_bookings_event-time-slots`;function ma(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:ua}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.EventTimeSlots.ListEventTimeSlots`,packageName:pa,migrationOptions:{optInTransformResponse:!0},url:fa({protoPath:`/v2/time-slots/event`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:da}])}}return t}async function ha(e){let{httpClient:t,sideEffects:n}=arguments[1],r=ma(He({fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,serviceIds:e?.serviceIds,includeNonBookable:e?.includeNonBookable,minBookableCapacity:e?.minBookableCapacity,eventFilter:e?.eventFilter,maxSlotsPerDay:e?.maxSlotsPerDay,cursorPaging:e?.cursorPaging,bookingPolicyViolations:e?.bookingPolicyViolations}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,serviceIds:`$[0].serviceIds`,includeNonBookable:`$[0].includeNonBookable`,minBookableCapacity:`$[0].minBookableCapacity`,eventFilter:`$[0].eventFilter`,maxSlotsPerDay:`$[0].maxSlotsPerDay`,cursorPaging:`$[0].cursorPaging`,bookingPolicyViolations:`$[0].bookingPolicyViolations`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function ga(e){return t=>ha(t,{httpClient:e})}var _a=xt(ga),va=[{path:`bookingPolicyViolations.earliestBookingDate`}],ya=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ba(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var xa=`@wix/auto_sdk_bookings_multi-service-availability-time-slots`;function Sa(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:va}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.MultiServiceAvailabilityTimeSlots.ListMultiServiceAvailabilityTimeSlots`,packageName:xa,migrationOptions:{optInTransformResponse:!0},url:ba({protoPath:`/v2/multi-service-time-slots`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:ya}])}}return t}async function Ca(e){let{httpClient:t,sideEffects:n}=arguments[1],r=Sa(He({services:e?.services,fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,location:e?.location,bookable:e?.bookable,bookingPolicyViolations:e?.bookingPolicyViolations,timeSlotsPerDay:e?.timeSlotsPerDay,cursorPaging:e?.cursorPaging}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{services:`$[0].services`,fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,location:`$[0].location`,bookable:`$[0].bookable`,bookingPolicyViolations:`$[0].bookingPolicyViolations`,timeSlotsPerDay:`$[0].timeSlotsPerDay`,cursorPaging:`$[0].cursorPaging`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function wa(e){return t=>Ca(t,{httpClient:e})}var Ta=xt(wa),Ea=(e=>(e.UNKNOWN=`UNKNOWN`,e.CUSTOM=`CUSTOM`,e.STAFF_MEMBER=`STAFF_MEMBER`,e.DURATION=`DURATION`,e.DATE_TIME=`DATE_TIME`,e.NUMBER_OF_PARTICIPANTS=`NUMBER_OF_PARTICIPANTS`,e.LOCATION=`LOCATION`,e.DURATION_RANGE=`DURATION_RANGE`,e))(Ea||{}),Da=(e=>(e.APPOINTMENT=`APPOINTMENT`,e.CLASS=`CLASS`,e.COURSE=`COURSE`,e))(Da||{}),Oa=(e=>(e.FIXED=`FIXED`,e.CUSTOM=`CUSTOM`,e.VARIED=`VARIED`,e.NO_FEE=`NO_FEE`,e.SUBSCRIPTION=`SUBSCRIPTION`,e))(Oa||{}),ka=(e=>(e.CUSTOM=`CUSTOM`,e.BUSINESS=`BUSINESS`,e.CUSTOMER=`CUSTOMER`,e))(ka||{}),Aa=[{path:`timeSlotsConfiguration.createdDate`},{path:`timeSlotsConfiguration.updatedDate`}];function ja(e){return V(Object.assign(e,{domainToMappings:{_:[{srcPath:`/_api/time-slots-config`,destPath:``}],"manage._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"editor._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"blocks._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"create.editorx":[{srcPath:`/_api/time-slots-config`,destPath:``}],"apps._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"*.dev.wix-code.com":[{srcPath:`/_api/time-slots-config`,destPath:``}],"www.wixapis.com":[{srcPath:`/_api/time-slots-config`,destPath:``}]}}))}var Ma=`@wix/auto_sdk_bookings_time-slots-configuration`;function Na(e){function t({host:t}){return{entityFqdn:`wix.bookings.timeslots_configuration.v1.time_slots_configuration`,method:`GET`,methodFqn:`wix.bookings.timeslots.configuration.v1.TimeSlotsConfigurationService.GetTimeSlotsConfigurationByAppId`,packageName:Ma,migrationOptions:{optInTransformResponse:!0},url:ja({protoPath:`/v1/time-slots-configurations/app/{appId}`,data:e,host:t}),params:St(e),transformResponse:e=>z(e,[{transformFn:We,paths:Aa}])}}return t}async function Pa(e){let{httpClient:t,sideEffects:n}=arguments[1],r=Na(He({appId:e}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{appId:`$[0]`},singleArgumentUnchanged:!1},[`appId`]);throw n?.onError?.(e),t}}function Fa(e){return t=>Pa(t,{httpClient:e})}var Ia=xt(Fa),La=[{path:`bookingsSettings.createdDate`},{path:`bookingsSettings.updatedDate`}],Ra=[{path:`bookingsSettings.siteProperties.address.coordinates.latitude`},{path:`bookingsSettings.siteProperties.address.coordinates.longitude`}];function za(e){return V(Object.assign(e,{domainToMappings:{"manage._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"dev._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"*.dev.wix-code.com":[{srcPath:`/_api/bookings-settings`,destPath:``}],"www.wixapis.com":[{srcPath:`/_api/bookings-settings`,destPath:``}],_:[{srcPath:`/_api/bookings-settings`,destPath:``}],"api._api_base_domain_":[{srcPath:`/bookings-settings`,destPath:``}],"editor._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"blocks._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"create.editorx":[{srcPath:`/_api/bookings-settings`,destPath:``}],"editor.wixapps.net":[{srcPath:`/_api/bookings-settings`,destPath:``}],"www._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}]}}))}var Ba=`@wix/auto_sdk_bookings_bookings-settings`;function Va(e){function t({host:t}){return{entityFqdn:`wix.bookings.v2.bookings_settings`,method:`GET`,methodFqn:`wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`,packageName:Ba,migrationOptions:{optInTransformResponse:!0},url:za({protoPath:`/v2/settings`,data:e,host:t}),params:St(e),transformResponse:e=>z(e,[{transformFn:We,paths:La},{transformFn:qt,paths:Ra}]),fallback:[{method:`GET`,url:za({protoPath:`/v2/settings`,data:e,host:t}),params:St(e)}]}}return t}var Ha=(e=>(e.BUSINESS_TIME_ZONE=`BUSINESS_TIME_ZONE`,e.CUSTOMER_TIME_ZONE=`CUSTOMER_TIME_ZONE`,e))(Ha||{});async function Ua(){let{httpClient:e,sideEffects:t}=arguments[0],n=Va(He({}));t?.onSiteCall?.();try{let r=await e.request(n);return t?.onSuccess?.(r),L(r.data)?.bookingsSettings}catch(e){let n=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{},singleArgumentUnchanged:!1},[]);throw t?.onError?.(e),n}}function Wa(e){return()=>Ua({httpClient:e})}var Ga=xt(Wa);function Ka(e){return e.business?._id??null}function qa(e){return e.business?.name??null}function Ja(e){return(e?.locations??[]).filter(e=>e.type===ka.BUSINESS).map(e=>({id:Ka(e)??``,label:qa(e)??``})).filter(e=>e.id!==``).sort((e,t)=>e.label.localeCompare(t.label))}var Ya=e=>e===Da.APPOINTMENT,Xa=e=>e===Da.CLASS,Za=e=>e===Da.COURSE,Qa=e=>e.payment?.rateType===Oa.VARIED,$a=e=>!!e.addOnGroups?.some(e=>e.addOnIds?.length),eo={category:`category`,location:`location`,page:`page`,blob:`b`,resource:`resource`,referral:`referral`,timezone:`timezone`,bookingId:`bookingId`,token:`token`,rescheduleRedirectUrl:`rescheduleRedirectUrl`};function to(e){if(!e)return null;let t=so(e).map(e=>e.id),n={...e.durationChoiceId?{durationChoiceId:e.durationChoiceId}:{},...e.durationInMinutes?{durationInMinutes:e.durationInMinutes}:{},...t.length?{addOnIds:t}:{},...e.requestedGender?{requestedGender:{gender:e.requestedGender}}:{}};return Object.keys(n).length?n:null}function no(e){return(e?.services.length??0)>1}var ro=e=>({valid:!1,reason:e});function io(e){let t=e?.services??[];if(!no(e)||t.some(e=>!e.serviceId))return ro(`too-few-services`);if(t.some(e=>e.serviceType&&e.serviceType!==`APPOINTMENT`))return ro(`not-appointment`);let n=t[0].locationType??`BUSINESS`,r=t[0].locationId??null;if(t.some(e=>(e.locationType??`BUSINESS`)!==n||(e.locationId??null)!==r))return ro(`location-mixed`);if(r&&n!==`BUSINESS`)return ro(`location-id-not-business`);let i=t.map(e=>({serviceId:e.serviceId,staff:oo(e),customerChoices:to(e)}));return{valid:!0,locationId:r,locationType:n,services:i,requestKey:JSON.stringify([n,r,i])}}var ao=`staff`;function oo(e){let t=e.resources?.find(e=>e.type===ao);if(!t)return null;let n=t.ids[0];return n?{anyResource:!1,staffMemberId:n}:t.anyResource?{anyResource:!0}:null}function so(e){return e.addOns??[]}function co(e,t){let n=e(t);return n?n.replace(/\/$/,``)||`/`:null}function lo(e,t,n){let r=e(t);return!r||!n?null:`${r.replace(/\/$/,``)}/${n}`}function uo(e,t){switch(e){case`servicePage`:return(t.slug?t.buildCustomServiceUrl(t.slug):void 0)??lo(t.appSectionUrl,Gr.SERVICE_PAGE,t.slug);case`bookingCalendar`:return t.isMultiService?co(t.appSectionUrl,Gr.CALENDAR_PAGE):lo(t.appSectionUrl,Gr.CALENDAR_PAGE,t.slug);case`bookingForm`:return t.serviceId?lo(t.appSectionUrl,Gr.FORM_PAGE,t.slug):null;default:return null}}var fo=e=>e.target===`_blank`,po=(e,t)=>t===`/`?e:new URL(`.${t}`,`${e}/`).href,mo=(e,t,n)=>n?`.${t}`:ho(e,t),ho=(e,t)=>e?po(e,t):t,go=()=>{let{previewMode:e}=f(Ir),t=f(zr),n=t.siteUrl.replace(/\/$/,``),{navigateTo:i}=f(Rr),a=f(Br),o=d(),s=r(async t=>{let r=mo(n,t,e);await i({href:r})},[e,n,i]),c=r(async e=>{await i(fo(e)?{href:e.href,type:`ExternalLink`,target:`_blank`}:{href:e.href})},[i]),l=r(e=>ho(n,e),[n]),u=r(e=>t.appSectionRelativeUrl(Vr,e),[t]),p=r(e=>ta(a.urlMappings,e),[a]),m=r((e,t)=>uo(e,{...t,appSectionUrl:u,buildCustomServiceUrl:p}),[u,p]),h=r((e,t)=>{let r=m(e,t);return r&&n?po(n,r):null},[m,n]),g=r((e,t)=>{let n=m(e,t);n&&s(n)},[m,s]),_=r(()=>u(Gr.FORM_PAGE)||void 0,[u]),v=r(e=>Object.values(o(Lr).pages).some(t=>t.appPageId===e&&(!t.appDefinitionId||t.appDefinitionId===`1380b703-ce81-ff05-f115-39571d94dfcd`))&&t.appSectionRelativeUrl(`1380b703-ce81-ff05-f115-39571d94dfcd`,e)||void 0,[t,o]);return{navigate:s,navigateToHref:c,resolvePath:m,toHref:l,resolveAbsoluteUrl:h,navigateTo:g,getBookingFormPath:_,getCartPagePath:r(()=>v(Hr),[v]),getThankYouPagePath:r(e=>{let t=v(Ur);return t?`${t}/${e}?origin=bookings`:void 0},[v])}};function _o(e){return e?.details?.applicationError?.code}function vo(){let e=typeof $wixContext<`u`&&$wixContext.initWixModules?$wixContext.initWixModules:globalThis.__wix_context__!==void 0&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(t,n){return yo(()=>e(t,n))},fetchWithAuth(){throw Error(`fetchWithAuth is not available in this context`)},graphql(){throw Error(`graphql is not available in this context`)}};let t=typeof $wixContext<`u`?$wixContext.client:m.client===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.client:m.client,n=typeof $wixContext<`u`?$wixContext.elevatedClient:m.elevatedClient===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.elevatedClient:m.elevatedClient;if(t||n)return{initWixModules(e,r){if(r){if(!n)throw 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`);return yo(()=>n.use(e))}if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return yo(()=>t.use(e))},fetchWithAuth:(e,n)=>{if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.fetchWithAuth(e,n)},getAuth(){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.auth},async graphql(e,n,r){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.graphql(e,n,r)}}}function yo(e){let t=globalThis.__wix_context__,n={client:m.client,elevatedClient:m.elevatedClient},r;globalThis.__wix_context__=void 0,m.client=void 0,m.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,m.client=n.client,m.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function bo(e,t){return{...e,...Object.fromEntries(t.map(t=>[t,(...n)=>{let r=vo();if(!r)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return r.initWixModules(e)[t].apply(void 0,n)}]))}}function xo(e){return bo({__type:`host`,create:t=>Object.entries(e).reduce((e,[n,r])=>({...e,[n]:r(t)}),{})},Object.keys(e))}var So=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(e,t)=>(console.error(this.message),t(void 0)),this.startSpanManual=()=>(console.error(this.message),{end:()=>{},fail:()=>{}}),this.endSpanManual=()=>{console.error(this.message)},this.addBreadcrumb=()=>{console.error(this.message)}}},Co=e=>new So(e),wo=xo({getMonitoringClient:e=>()=>e.getMonitoringClient?e.getMonitoringClient():Co(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`)}),Q={service:`service`,services:`services`,categories:`categories`,locations:`locations`,sessions:`sessions`,timeSlots:`time-slots`,serviceAddOns:`service-addons`,bookingsSettings:`bookings-settings`,serviceCta:`service-cta`,preferences:`preferences`,bookingSummary:`booking-summary`,bookingCheckout:`booking-checkout`,formValues:`form-values`,paymentOptions:`payment-options`,seo:`seo`,warmup:`warmup`,reschedule:`reschedule`};function To(e){try{let t=wo.getMonitoringClient?.();return t&&typeof t[e]==`function`?t:null}catch{return null}}function $(e,{feature:t,action:n,level:r=`error`,contexts:i}){let a=To(`captureException`);if(!a)return;let o=e instanceof Error?e:Error(String(e));a.captureException(o,{level:r,tags:{feature:t,action:n},...i?{contexts:i}:{}})}function Eo(e,{feature:t,action:n,level:r=`info`,tags:i}){let a=To(`captureMessage`);a&&a.captureMessage(e,{level:r,tags:{feature:t,action:n,...i}})}function Do({message:e,category:t,feature:n,data:r}){let i=To(`addBreadcrumb`);i&&i.addBreadcrumb({message:e,category:t,level:`info`,data:{feature:n,...r}})}var Oo=e=>{let t=e=>e<10?`0${e}`:`${e}`;return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},ko=e=>new Date(`${e}T00:00:00`),Ao=(e,t)=>new Intl.DateTimeFormat(`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,...t?{timeZone:t}:{}}).format(e),jo=e=>`${Oo(e)}T00:00:00`,Mo=e=>`${Oo(e)}T23:59:59`;function No(e,t){return`${Ao(e,t)}T${new Intl.DateTimeFormat(`en-GB`,{timeZone:t,hourCycle:`h23`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e)}`}function Po(e,t){let n=No(new Date(Date.now()),t);return n.slice(0,10)===e?n:`${e}T00:00:00`}var Fo=/^\d{4}-\d{2}-\d{2}$/,Io=864e5;function Lo(e){if(typeof e!=`string`||!Fo.test(e))return!1;let t=ko(e);return!Number.isNaN(t.getTime())&&Oo(t)===e}function Ro(e){if(!e||typeof e!=`object`)return!1;let{startDate:t,endDate:n}=e;return Lo(t)&&Lo(n)&&t<=n}function zo(e,t){let n=ko(e);return n.setDate(n.getDate()+t),Oo(n)}function Bo({startDate:e,endDate:t}){let n=ko(t).getTime()-ko(e).getTime();return Math.round(n/Io)+1}function Vo(e){let t=ko(e),n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return{startDate:Oo(n),endDate:Oo(r)}}function Ho(e){let t=Vo(e.startDate);return t.startDate===e.startDate&&t.endDate===e.endDate}function Uo(e,t){if(Ho(e)){let n=ko(e.startDate);return Vo(Oo(new Date(n.getFullYear(),n.getMonth()+t,1)))}let n=t*Bo(e);return{startDate:zo(e.startDate,n),endDate:zo(e.endDate,n)}}function Wo(e,t){return e>=t.startDate&&e<=t.endDate}function Go(e){let t=ko(e),n=new Date(t.getFullYear(),t.getMonth()+2,0).getDate(),r=Math.min(t.getDate(),n);return Oo(new Date(t.getFullYear(),t.getMonth()+1,r))}function Ko(e){let t=[],n=e.startDate;for(;n<=e.endDate;){let r=zo(Go(n),-1),i=r<e.endDate?r:e.endDate;t.push({startDate:n,endDate:i}),n=zo(i,1)}return t}function qo({allowGenderSelection:e,staffSelectionStrategy:t}){return e&&t!==`CUSTOMER_CANNOT_CHOOSE`}async function Jo(){let e=await Ia(Vr);return{businessTimeZone:e.timeSlotsConfiguration?.displayTimeZone?.timeZone||null,staffSelectionStrategy:e.timeSlotsConfiguration?.staffSelection?.strategy??null,allowGenderSelection:e.timeSlotsConfiguration?.staffSelection?.allowGenderSelection??!1}}function Yo(e){let t=e.location?._id||(e.location?.locationType?`${e.location.locationType}:${e.location.formattedAddress??``}`:``);return`${e.localStartDate??``}|${e.localEndDate??``}|${t}`}function Xo(e){return e.availableResources?.[0]?.resources?.[0]?._id??null}function Zo(e){return`${Yo(e)}|${Xo(e)??``}`}function Qo(e){let t=new Map;for(let n of e){let e=Yo(n),r=t.get(e);r?r.push(n):t.set(e,[n])}return[...t.values()].map(e=>{if(e.length===1)return e[0];let t=e.filter(e=>e.bookable),n=t.length?t:e;return{...n[0],availableResources:n.flatMap(e=>e.availableResources??[])}})}function $o(e){return e?{locations:[{_id:e,locationType:`BUSINESS`}]}:{}}function es(e){return e?{resourceTypes:[{resourceTypeId:Wr,resourceIds:[e]}]}:{}}function ts(e){let{requestedGender:t,...n}=e;return Object.keys(n).length?n:void 0}function ns(e,t){if(!e)return{};let n=t?ts(e):e;return n?{customerChoices:n}:{}}var rs=`REQUESTED_GENDER_NOT_ALLOWED`;function is(e){return _o(e)===rs}var as=!1,os=new Set;function ss(){return as}function cs(e){return os.add(e),()=>os.delete(e)}function ls(){as||(as=!0,os.forEach(e=>e()))}async function us(e){let{customerChoices:t,...n}=e,r=e=>{let t=ts(e);return la({...n,...t?{customerChoices:t}:{}})};if(as&&t?.requestedGender)return r(t);try{return await la(e)}catch(e){if(!t?.requestedGender||!is(e))throw e;return $(e,{feature:Q.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ls(),r(t)}}function ds(e,t,n){return{...e?{"location.id":e}:{},...t?{"resources.id":{$hasSome:[t]}}:{},...n?{remainingCapacity:{$gte:n}}:{}}}async function fs(e){let t=await _a(e);return{timeSlots:t.timeSlots??[],timeZone:t.timeZone??null,nextCursor:t.pagingMetadata?.cursors?.next||null}}function ps({serviceId:e,serviceType:t,fromLocalDate:n,toLocalDate:r,timeZone:i,locationId:a,staffId:o,onlyAvailableSlots:s=!1,customerChoices:c,minRemainingCapacity:l,timeSlotsPerDay:u,limit:d,cursor:f}){return Ya(t)?ms({serviceId:e,fromLocalDate:n,toLocalDate:r,timeZone:i,locationId:a,staffId:o,onlyAvailableSlots:s,customerChoices:c,timeSlotsPerDay:u,limit:d,cursor:f}):fs({serviceIds:[e],fromLocalDate:n,...r?{toLocalDate:r}:{},...i?{timeZone:i}:{},includeNonBookable:!s,eventFilter:{type:t,...ds(a,o,l)},cursorPaging:{limit:d,...f?{cursor:f}:{}}})}async function ms({serviceId:e,fromLocalDate:t,toLocalDate:n,timeZone:r,locationId:i,staffId:a,onlyAvailableSlots:o,customerChoices:s,timeSlotsPerDay:c,limit:l,cursor:u}){let d=await us({serviceId:e,fromLocalDate:t,...n?{toLocalDate:n}:{},...r?{timeZone:r}:{},...o?{bookable:!0}:{},...$o(i),...es(a),...ns(s,a),includeResourceTypeIds:[Wr],...c==null?{}:{timeSlotsPerDay:c},cursorPaging:{limit:l,...u?{cursor:u}:{}}});return{timeSlots:d.timeSlots??[],timeZone:d.timeZone??null,nextCursor:d.cursorPagingMetadata?.cursors?.next||null}}var hs=6,gs=864e5;function _s(e){let t=e?ko(e):new Date(Date.now()),n=new Date(t.getFullYear(),t.getMonth()+hs+1,1),r=new Date(n.getTime()-gs);return{fromLocalDate:jo(t),toLocalDate:Mo(r)}}async function vs({serviceId:e,serviceType:t,timeZone:n,limit:r,onlyAvailableSlots:i=!0,fromDate:a,locationId:o,staffId:s,customerChoices:c,minRemainingCapacity:l}){let{fromLocalDate:u,toLocalDate:d}=_s(a);if(Xa(t)||Za(t)){let a={...Za(t)?{type:`COURSE`}:{},...ds(o,s,l)},c=await fs({serviceIds:[e],fromLocalDate:u,toLocalDate:d,...n?{timeZone:n}:{},includeNonBookable:!i,...Object.keys(a).length?{eventFilter:a}:{},...r==null?{}:{cursorPaging:{limit:r}}});return{timeSlots:c.timeSlots,timeZone:c.timeZone}}let f=await us({serviceId:e,fromLocalDate:u,toLocalDate:d,...n?{timeZone:n}:{},...i?{bookable:!0}:{},...$o(o),...es(s),...ns(c,s),includeResourceTypeIds:[Wr],...r==null?{}:{cursorPaging:{limit:r}}});return{timeSlots:f.timeSlots??[],timeZone:f.timeZone??null}}var ys=1e3;async function bs({serviceId:e,serviceType:t,date:n,timeZone:r,onlyAvailableSlots:i,locationId:a,staffId:o,customerChoices:s,minRemainingCapacity:c,fromLocalDate:l,toLocalDate:u}){let d=`${n}T00:00:00`,f=`${n}T23:59:59`,p=Za(t)?`COURSE`:Xa(t)?`CLASS`:`APPOINTMENT`,m=[],h=null,g;do{let t=await ps({serviceId:e,serviceType:p,fromLocalDate:l&&l>d?l:d,toLocalDate:u&&u<f?u:f,timeZone:r,locationId:a,staffId:o,onlyAvailableSlots:i,customerChoices:s,minRemainingCapacity:c,limit:ys,cursor:g});m.push(...t.timeSlots),h=t.timeZone??h,g=t.nextCursor??void 0}while(g);return{timeSlots:m,timeZone:h}}function xs(e){return{slotStart:e.localStartDate,slotEnd:e.localEndDate,eventId:e.eventInfo?.eventId,scheduleId:e.scheduleId??void 0,locationId:e.location?._id??void 0,locationType:e.location?.locationType??void 0}}function Ss(e){return e?.options?.values?.[0]?.type===Ea.STAFF_MEMBER}function Cs(e){return e.staffMemberDetails?.staffMembers??[]}function ws(e,t){let n=e.workingHoursLocationCoverage;return{staffMemberId:e.staffMemberId??``,name:e.name??null,image:null,isSelected:t===e.staffMemberId,...n?{locationCoverage:{availableAtAllLocations:n.availableAtAllLocations??!1,locationIds:n.locationIds??[]}}:{}}}function Ts(e,t){let n=e.locationCoverage;return!n||n.availableAtAllLocations||n.locationIds.includes(t)}function Es(e,t){return t?e.filter(e=>Ts(e,t)):e}function Ds(e,t){let n=new Map(t.map(e=>[e.staffMemberId,e.locationCoverage]));return e.choices.map(e=>e.choiceId).filter(e=>e!=null).map(e=>({staffMemberId:e,locationCoverage:n.get(e)}))}function Os(e,t,n){if(e?.type!==`STAFF_MEMBER`||!n)return;let r=Es(Ds(e,t),n);return r.length===1?r[0].staffMemberId:void 0}function ks(e,t){if(t.length===0)return e;let n=e.filter(e=>Es(t,e.id).length>0);return n.length>0?n:e}function As(e){return Cs(e).map(e=>ws(e,null))}function js(e,t,n=!1){let r=Ms(e),i=r.length===1?r[0].id:void 0,a=n||!i||r.some(e=>e.id===t);return t&&a?t:i}function Ms(e){return ks(Ja(e),As(e))}function Ns(e){let t=e;if(t.__state||(t.__state={status:`pending`},t.then(e=>{t.__state={status:`fulfilled`,value:e}},e=>{t.__state={status:`rejected`,reason:e}})),t.__state.status===`fulfilled`)return t.__state.value;throw t.__state.status===`rejected`?t.__state.reason:t}function Ps(e){let t=Promise.resolve(e);return t.__state={status:`fulfilled`,value:e},t}var Fs=Fr(`@wix/site-service-warmup-data`);function Is(){try{return d()}catch{return null}}function Ls(e){try{return e?e(Fs):null}catch{return null}}function Rs(){let e=Ls(Is()),t=typeof window>`u`;return{scope:e??void 0,get:async n=>{if(t||!e)return null;try{return await e.get(n)}catch(e){return $(e,{feature:Q.warmup,action:`read`,level:`warning`,contexts:{warmup:{key:n}}}),null}},set:(n,r)=>{if(t&&e)try{e.set(n,r)}catch{}}}}var zs=`bookings-uou`;function Bs(){return`${zs}:bookings-settings`}function Vs(){return`${zs}:time-slots-configuration`}var Hs=5e3,Us=100,Ws=`wix-warmup-data`,Gs=null;function Ks(e){if(typeof document<`u`)try{let t=document.getElementById(Ws)?.textContent;return t?(Gs?.text!==t&&(Gs={text:t,data:JSON.parse(t).builderComponentsWarmupData??{}}),Gs.data[e]??void 0):void 0}catch{return}}var qs=()=>({promises:new Map,invalidatedWarmup:new Set}),Js=qs(),Ys=new WeakMap,Xs=new WeakMap;function Zs(e){if(!e)return Js;let t=Ys.get(e);return t||(t=qs(),Ys.set(e,t)),t}function Qs({key:e,warmupData:t,fetchData:n,refresh:r=!1}){if(e===null)return n();if(typeof window>`u`){let r=()=>n().then(n=>(t.set(e,n),n)),{scope:i}=t;if(!i)return r();let a=Xs.get(i);a||(a=new Map,Xs.set(i,a));let o=a.get(e);if(o)return o;let s=r();return a.set(e,s),s.catch(()=>a.delete(e)),s}let i=Zs(t.scope),a=Date.now();for(let[e,t]of i.promises)t.expiresAt<=a&&i.promises.delete(e);let o=i.promises.get(e);if(o&&!r)return o.promise;r&&i.invalidatedWarmup.add(e);let s=!i.invalidatedWarmup.has(e);if(s){let t=Ks(e);if(t!==void 0){let n=Ps(t);return i.promises.set(e,{promise:n,expiresAt:a+Hs}),n}}let c=(async()=>{if(s){let n=await t.get(e);if(n!=null)return n}return n()})();i.promises.size>=Us&&i.promises.delete(i.promises.keys().next().value);let l={promise:c,expiresAt:1/0};return i.promises.set(e,l),c.then(()=>{l.expiresAt=Date.now()+Hs},()=>{i.promises.get(e)===l&&i.promises.delete(e)}),c}var $s={displayTimeZonePolicy:{basedOn:Ha.BUSINESS_TIME_ZONE,customerCanChange:!1},multiServiceAppointmentsEnabled:!1};async function ec(){try{let e=await Ga();return{displayTimeZonePolicy:{basedOn:e.displayTimeZone?.basedOn??Ha.BUSINESS_TIME_ZONE,customerCanChange:e.displayTimeZone?.customerCanChange??!1},multiServiceAppointmentsEnabled:e.multiServiceAppointments?.enabled??!1}}catch(e){return $(e,{feature:Q.bookingsSettings,action:`fetch-bookings-settings`,level:`warning`}),$s}}var tc={isLoading:!0},nc=n(null),rc=`useBookingsSettingsContext must be used within BookingsSettingsProvider`;function ic(){let e=i(nc);if(!e)throw Error(rc);return e}function ac(e){return e.basedOn===Ha.CUSTOMER_TIME_ZONE?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0}function oc(){let e=ic();return e.isLoading?void 0:ac(e.displayTimeZonePolicy)}function sc({settingsPromise:e,children:t}){let n=Ns(e),r=o(()=>({isLoading:!1,...n}),[n]);return p(nc.Provider,{value:r,children:t})}function cc({bookingsSettings:e,children:n}){let r=Rs(),[i]=c(()=>e?null:Qs({key:Bs(),warmupData:r,fetchData:ec}));return e?p(nc.Provider,{value:{isLoading:!1,...e},children:n}):p(t,{fallback:p(nc.Provider,{value:tc,children:n}),children:p(sc,{settingsPromise:i,children:n})})}var lc=1e3,uc=class extends e{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){$(e,{feature:this.props.feature??`service`,action:`render`,contexts:{react:{componentStack:t.componentStack}}})}render(){return this.state.hasError?this.props.fallback:this.props.children}},dc=`appSectionParams`;function fc(e){let t=e.searchParams.get(dc);if(t===null)return e;let n=new URL(e);n.searchParams.delete(dc);for(let[e,r]of Object.entries(pc(t)))typeof r==`string`&&!n.searchParams.has(e)&&n.searchParams.set(e,r);return n}function pc(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}var mc=`bookings-uou:url-change`,hc=e=>{let t=new URL(e);return t.searchParams.sort(),t.href};function gc(e,{disableScrollToTop:t,skipHistory:n}={}){let r=globalThis.window;if(!r?.history)return;let i=new URL(r.location.href);if(hc(i)===hc(e))return;let a={scrollY:r.scrollY};if(n)r.history.replaceState(a,``,e.href);else{r.history.replaceState(a,``,i.href);try{r.history.pushState(t?a:null,``,e.href)}catch{return}}r.dispatchEvent(new Event(mc))}function _c(e){let t=globalThis.window;return t?(t.addEventListener(mc,e),t.addEventListener(`popstate`,e),()=>{t.removeEventListener(mc,e),t.removeEventListener(`popstate`,e)}):()=>{}}var vc=e=>{try{return decodeURIComponent(e)}catch{return e}};function yc(e,t){let n=t?new URL(t).pathname:`/`;return`./${vc(new URL(e).pathname.replace(n,``).replace(/^\/|\/$/g,``))}`}function bc(){let e=f(zr),t=r(()=>e.currentUrl,[e]),n=l(_c,t,t),i=o(()=>fc(new URL(n)),[n]),a=e.siteUrl.replace(/\/$/,``);return{pathname:i.pathname,search:i.search,searchParams:i.searchParams,href:i.href,getParsedUrl:()=>fc(new URL(e.currentUrl)),getRelativeUrl:()=>yc(e.currentUrl,a),getExternalBaseUrl:()=>a,pushUrl:gc}}var xc=Fr(`@wix/site-service-business-logger`);function Sc(e){return{evid:32,src:16,endpoint:``,params:e}}function Cc(e){return{evid:33,src:16,endpoint:``,params:e}}function wc(e){return{evid:34,src:16,endpoint:``,params:e}}var Tc={SERVICES:`services_context`,SERVICE:`service_context`,TIME_SLOTS:`time_slots_context`,BOOKING_CHECKOUT:`booking_checkout_context`,CATEGORIES:`categories_context`,LOCATIONS:`locations_context`,SERVICE_ADD_ONS:`service_addons_context`,PREFERENCES:`preferences_context`};Gr.BOOK_ONLINE;var Ec=`new_bookings_server`,Dc={LOAD:`load`,LOCATION_CHOSEN:`location chosen`,STAFF_CHOSEN:`staff chosen`,VARIANT_SELECTED:`variant selected`,ADD_ON_SELECTED:`add on selected`,ADD_ON_UNSELECTED:`add on unselected`,BACK:`back`,CLOSE:`close`,STAY:`stay`,ADD_SERVICE:`add service`,EDIT_BASKET_ITEM:`edit basket item`,EDIT_BASKET_ITEM_FROM_CALENDAR:`edit basket item from calendar`,CHANGE_STAFF_MEMBER:`change staff member`,REMOVE_BASKET_ITEM:`remove basket item`,SELECT_SERVICE:`select service`,SEARCH:`search`,CLEAR_SEARCH:`clear search`},Oc={TIMEZONE_PICKER:`timezone_picker`,TIME_PICKER:`time_picker`,BOOKING_DETAILS:`booking_details`,RESCHEDULE_DIALOG:`reschedule_dialog`},kc={DROPDOWN:`dropdown`,TIME_SLOT:`time_slot`,EXPAND:`expand`,COLLAPSE:`collapse`},Ac=e=>{let{reportBi:t}=f(xc);return r(n=>{t({widget_name:e,bookingsPlatform:Ec,is_over_editor:!1,...n.params,src:n.src,evid:n.evid},{endpoint:n.endpoint})},[t,e])},jc=(e,t=!0)=>{let n=Ac(e),{getParsedUrl:r}=bc(),i=s(!1);a(()=>{t&&!i.current&&(i.current=!0,n(Sc({referralInfo:r().searchParams.get(eo.referral)??void 0})))},[t,n,r])};function Mc(e){return{evid:1177,src:16,endpoint:`wixboost-ugc`,params:e}}function Nc(e){return{evid:596,src:16,endpoint:`wixboost-ugc`,params:e}}function Pc(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).formatToParts(new Date(e)),r={};for(let e of n)e.type!==`literal`&&(r[e.type]=Number(e.value));return Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)-e}function Fc(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);if(!n)return null;let[,r,i,a,o,s,c]=n,l=Date.UTC(Number(r),Number(i)-1,Number(a),Number(o),Number(s),c?Number(c):0);if(Number.isNaN(l))return null;try{let e=l-Pc(l,t);return new Date(l-Pc(e,t))}catch{return null}}function Ic({start:e,end:t,timeZone:n,...r}){let i=e=>e&&n?Fc(e,n)?.getTime():void 0;return wc({bookingsServiceId:r.serviceId,serviceType:r.serviceType,startTime:i(e),endTime:i(t),isEligibleForFlowCompletion:r.isEligibleForFlowCompletion})}function Lc({nextAvailableSlotsCount:e,isLoading:t,hasError:n,children:r}){let i=n?`loadFailed`:null,a={selectedDate:null,daysAvailabilityRange:null,daysAvailability:[],daysAvailabilityLoading:!1,daysAvailabilityHasError:!1,timeSlotsLoading:t,timeSlotsErrorCode:i,selectDate:async()=>{},setDaysAvailabilityRange:async()=>{},nextDaysAvailabilityRange:async()=>{},previousDaysAvailabilityRange:async()=>{},goToNextAvailableDate:async()=>`cancelled`,canChangeTimeZone:!1,isMultiService:!1,hasValidSchedulingInput:!1,availabilityRequestKey:null,needsServiceChoice:!1,isRescheduling:u(!0)?.reschedule!=null,rescheduleValidUntil:null,staffFilterOptions:[],locationFilterOptions:[],selectedStaffFilter:null,requestedGender:null,genderSelectionAllowed:!1,selectedLocationFilter:null,setStaffFilter:()=>{},setLocationFilter:()=>{},isComplete:!1,isSelectionValidated:!1,timeSlots:[],isLoading:t,hasError:n,errorCode:i,businessTimeZone:null,setTimeZone:()=>{},currentTimeSlotsPage:1,hasNextTimeSlotsPage:!1,hasPreviousTimeSlotsPage:!1,nextTimeSlotsPage:async()=>{},loadUpcomingTimeSlots:async()=>{},upcomingTimeSlotsRequested:!1,previousTimeSlotsPage:()=>{},nextAvailableSlotsCount:e,timeZone:null,staffFromSlots:[],selectedResourceId:null,setSelectedResource:()=>{},canAutoAssignStaff:!1,selectedTimeSlot:null,selectTimeSlot:()=>{},navigateToBookingForm:()=>{},timeSlotLimitPerDay:null,expandedDates:new Set,daysWithMore:new Set,loadingDate:null,loadAllTimeSlotsForDay:async()=>{}};return p(Gl.Provider,{value:a,children:r})}function Rc({nextAvailableSlotsCount:e,children:t}){return p(Lc,{nextAvailableSlotsCount:e,isLoading:!0,hasError:!1,children:t})}function zc({nextAvailableSlotsCount:e,children:t}){return p(Lc,{nextAvailableSlotsCount:e,isLoading:!1,hasError:!0,children:t})}var Bc=1e3;function Vc(e,t){let n=new Map;for(let e of t){let t=e.localStartDate?.slice(0,10);t&&(e.bookable?n.set(t,`available`):n.has(t)||n.set(t,`unavailable`))}let r=[],i=Bo(e);for(let t=0;t<i;t+=1){let i=zo(e.startDate,t);r.push({date:i,availability:n.get(i)??`none`})}return r}function Hc(e,t){return{fromLocalDate:Po(e.startDate,t),toLocalDate:Mo(ko(e.endDate))}}async function Uc(e,t,n,r,i,a){return(await us({serviceId:e,...Hc(n,t),timeZone:t,...$o(r),...es(i),...ns(a,i),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(n),Bc)}})).timeSlots??[]}async function Wc(e,t,n,r,i,a){return(await fs({serviceIds:[e],...Hc(n,t),timeZone:t,includeNonBookable:!0,eventFilter:{type:`CLASS`,...ds(r,i,a)},maxSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(n),Bc)}})).timeSlots}async function Gc({serviceId:e,serviceType:t,range:n,fromDate:r,timeZone:i,locationId:a,staffId:o,customerChoices:s,minRemainingCapacity:c}){if(Za(t)||n.endDate<r)return Vc(n,[]);let l={startDate:n.startDate<r?r:n.startDate,endDate:n.endDate},u=Xa(t)?Ko(l):[l];return Vc(n,(await Promise.all(u.map(n=>Xa(t)?Wc(e,i,n,a,o,c):Uc(e,i,n,a,o,s)))).flat())}function Kc({serviceId:e,staff:t,customerChoices:n}){let r=t&&!t.anyResource?t.staffMemberId:void 0;return{serviceId:e,...ns(n,r),...t?.anyResource?{}:{includeResourceTypeIds:[Wr]},...r?{resourceTypes:[{resourceTypeId:Wr,resourceIds:[r]}]}:{}}}function qc({services:e,locationId:t,locationType:n,timeZone:r}){return{services:e.map(Kc),timeZone:r,location:{...t?{_id:t}:{},locationType:n}}}function Jc(e){let{customerChoices:t,...n}=e,r=t?ts(t):void 0;return r?{...n,customerChoices:r}:n}async function Yc(e){let t=e.services??[],n=()=>Ta({...e,services:t.map(Jc)}),r=t.some(e=>e.customerChoices?.requestedGender);if(r&&ss())return n();try{return await Ta(e)}catch(e){if(!r||!is(e))throw e;return $(e,{feature:Q.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ls(),n()}}var Xc=1e3;async function Zc({range:e,fromDate:t,...n}){if(e.endDate<t)return Vc(e,[]);let r={startDate:e.startDate<t?t:e.startDate,endDate:e.endDate};return Vc(e,(await Yc({...qc(n),fromLocalDate:Po(r.startDate,n.timeZone),toLocalDate:Mo(ko(r.endDate)),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(r),Xc)}})).timeSlots??[])}async function Qc({date:e,onlyAvailableSlots:t,fromLocalDate:n,...r}){let i=`${e}T00:00:00`,a=[],o=null,s;do{let c=await Yc({...qc(r),fromLocalDate:n&&n>i?n:i,toLocalDate:`${e}T23:59:59`,...t?{bookable:!0}:{},cursorPaging:{limit:Xc,...s?{cursor:s}:{}}});a.push(...c.timeSlots??[]),o=c.timeZone??o,s=c.cursorPagingMetadata?.cursors?.next||void 0}while(s);return{timeSlots:a,timeZone:o}}async function $c({fromDate:e,...t}){let n=await Yc({...qc(t),..._s(e),bookable:!0,cursorPaging:{limit:1}});return{timeSlots:n.timeSlots??[],timeZone:n.timeZone??null}}var el=[];function tl({enabled:e,serviceId:t,serviceType:n,multiServiceRequest:i,timeZone:l,today:u,locationId:d,staffId:f,loadInitially:p,customerChoices:m,minRemainingCapacity:h,onlyAvailableSlots:g}){let[_,v]=c(null),[y,b]=c(p),[x,S]=c(el),[C,w]=c(!1),[T,ee]=c(!1),E=s(0);a(()=>{_===null&&u&&v(Vo(u))},[_,u]),a(()=>{if(!y||!e||!(t||i)||!l||!u||!_||!i&&Za(n))return;let r=++E.current;return w(!0),(i?Zc({...i,range:_,fromDate:u,timeZone:l}):Gc({serviceId:t,serviceType:n,range:_,fromDate:u,timeZone:l,locationId:d??void 0,staffId:f??void 0,customerChoices:m,minRemainingCapacity:h})).then(e=>{r===E.current&&(S(e),ee(!1),w(!1))}).catch(e=>{r===E.current&&($(e,{feature:Q.timeSlots,action:`fetch-days-availability`,level:`warning`}),ee(!0),w(!1))}),()=>{r===E.current&&(E.current+=1)}},[y,e,t,n,i,l,u,_,d,f,m,h]);let D=r(async e=>{Ro(e)&&(v(e),b(!0))},[]),O=r(async()=>{v(e=>e&&Uo(e,1)),b(!0)},[]),te=r(async()=>{v(e=>e&&Uo(e,-1)),b(!0)},[]);return{range:_,daysAvailability:o(()=>g?x.map(e=>e.availability===`unavailable`?{...e,availability:`none`}:e):x,[x,g]),isLoading:C,hasError:T,setRange:D,nextRange:O,previousRange:te}}function nl({enabled:e,serviceId:t,serviceType:n,multiServiceRequest:i,timeZone:o,today:l,locationId:u,staffId:d,customerChoices:f,minRemainingCapacity:p,onlyAvailableSlots:m,serviceLoading:h}){let[g,_]=c(null),[v,y]=c(0),[b,x]=c(null),[S,C]=c(null),[w,T]=c(null),[ee,E]=c(!1),D=s(0),O=s(0),te=s(0),k=r(()=>{O.current+=1,E(!1)},[]);a(()=>{k()},[e,t,n,i,o,u,d,f,p,k]);let A=e&&!h&&!t&&!i;a(()=>{A&&(C(null),T(null))},[A]),a(()=>{if(!g)return;if(A){_(null);return}if(!e||!(t||i)||!o)return;if(l&&g.date<l){_(null);return}if(!i&&Za(n)){_(null);return}let r=No(new Date(Date.now()),o),a=++D.current;x(null),C(null),T(null);let s=r.slice(0,10)===g.date?r:void 0;return(i?Qc({...i,date:g.date,timeZone:o,onlyAvailableSlots:m,fromLocalDate:s}):bs({serviceId:t,serviceType:n,date:g.date,timeZone:o,onlyAvailableSlots:m,locationId:u??void 0,staffId:d??void 0,customerChoices:f,minRemainingCapacity:p,fromLocalDate:s})).then(e=>{a===D.current&&x({timeSlots:e.timeSlots,timeZone:e.timeZone??o})}).catch(e=>{a===D.current&&($(e,{feature:Q.timeSlots,action:`fetch-day-time-slots`,level:`warning`}),C(`timeSlotsLoadFailed`))}),()=>{a===D.current&&(D.current+=1)}},[g,v,e,t,h,n,i,o,l,u,d,f,p,m]);let ne=r(async e=>{!i&&Za(n)||!Lo(e)||l&&e<l||(k(),y(e=>e+1),_({kind:`day`,date:e}))},[n,i,l,k]),re=g?.date??null,j=r(async()=>{let r=!!(t||i);if(!i&&Za(n)||!e||!r||!o)return{outcome:`none`};let a=D.current,s=++O.current,c=++te.current,m=()=>a===D.current&&s===O.current;E(!0),T(null);try{let e=re??l??void 0,r=i?await $c({...i,timeZone:o,fromDate:e}):await vs({serviceId:t,serviceType:n,timeZone:o,limit:1,onlyAvailableSlots:!0,fromDate:e,locationId:u??void 0,staffId:d??void 0,customerChoices:f,minRemainingCapacity:p});if(!m())return{outcome:`cancelled`};let a=r.timeSlots[0]?.localStartDate?.slice(0,10)??null;return a?{outcome:`found`,date:a}:{outcome:`none`}}catch(e){return m()?($(e,{feature:Q.timeSlots,action:`find-next-available-date`,level:`warning`}),T(`timeSlotsLoadFailed`),{outcome:`error`}):{outcome:`cancelled`}}finally{c===te.current&&E(!1)}},[e,t,n,i,o,l,u,d,f,p,re]),ie=w??S;return{query:g,selectedDate:re,timeSlots:b?.timeSlots??null,timeZone:b?.timeZone??null,isLoading:ee||g!==null&&b===null&&S===null,error:ie,selectDate:ne,findNextAvailableDate:j}}var rl=e=>e?.type===`DATE_TIME`;function il(e){let t=e.schedule?.availabilityConstraints?.durations;if(!Ya(e.type)||!Array.isArray(t))return!1;let n=t.map(e=>typeof e==`number`?e:e?.minutes);return new Set(n).size>1}function al({service:e,multiServiceAppointmentsEnabled:t,variants:n,locationId:r}){if(!Ya(e.type))return!1;if(t||il(e)||$a(e))return!0;if(!Qa(e)||rl(n))return!1;let i=js(e,r);return r&&i!==r?!0:!Os(n,As(e),i)}function ol(e,t){return!!Pr(e)?.services.some(e=>e.serviceId===t)}function sl({blobParam:e,...t}){return!t.service._id||ol(e,t.service._id)?!1:al({...t,multiServiceAppointmentsEnabled:!1})}function cl(e){return!!e?._id}function ll(){try{return d()}catch{return null}}function ul(){let e=ll();return r(t=>{if(!e)return!1;try{let n=e(Lr).currentPage;return!n.popup&&(!n.appDefinitionId||n.appDefinitionId===`13d21c63-b5ec-5912-8397-c3a5ddb27a97`)&&n.appPageId===t}catch{return!1}},[e])}function dl(e){let{service:t,isLoading:n,hasError:r,bookingsSettingsLoading:i,isLoadingServiceOptionsAndVariants:o,pricingOption:c,multiServiceAppointmentsEnabled:l,isMultiServiceAppointment:d,reschedule:f,selection:p,openPreferences:m,editingSurface:h}=u(),{searchParams:g}=bc(),_=ul(),v=Ac(Tc.PREFERENCES),y=s(!1),b=e&&!h&&!n&&!r&&!i&&!o&&f==null&&!d&&cl(t),x=p.locationId??void 0,S=g.get(eo.blob);a(()=>{!y.current&&b&&(y.current=!0,_(Gr.CALENDAR_PAGE)&&sl({service:t,multiServiceAppointmentsEnabled:l,variants:c,locationId:x,blobParam:S})&&(Do({message:`Calendar opens the preferences modal`,category:`navigation`,feature:Q.timeSlots,data:{serviceId:t._id??null,serviceType:t.type??null}}),v(Mc({action:Dc.EDIT_BASKET_ITEM_FROM_CALENDAR,numberOfServices:1,isMultiFlow:l})),m().then(()=>Eo(`Preferences modal opened`,{feature:Q.timeSlots,action:`auto-open-preferences`,tags:{serviceType:t.type??`unknown`}}),e=>$(e,{feature:Q.timeSlots,action:`open-preferences-lightbox`}))))},[b,t,l,c,x,S,_,v,m])}function fl(e,t){return t===void 0?!1:!e||new Date(e).getTime()<=t}function pl({serviceId:e,serviceType:t,lastSessionEnd:n,timeZone:r,now:i,onlyAvailableSlots:a,locationId:o,staffId:s,timeSlotLimitPerDay:c,customerChoices:l,minRemainingCapacity:u}){let d={serviceId:e,onlyAvailableSlots:a,locationId:o??void 0,staffId:s??void 0,timeZone:r,fromLocalDate:No(new Date(i),r)};return Xa(t)?{...d,serviceType:`CLASS`,minRemainingCapacity:u}:Za(t)?!n||fl(n,i)?void 0:{...d,serviceType:`COURSE`,toLocalDate:No(new Date(n),r)}:{...d,serviceType:`APPOINTMENT`,toLocalDate:_s().toLocalDate,timeSlotsPerDay:c+1,customerChoices:l}}function ml({isAppointment:e,staffOnSlotCount:t,hasStaffFilter:n,hasRequestedGender:r,hasStaffPricedVariants:i,staffSelectionStrategy:a}){return e&&t>1&&!n&&!i&&(a!==`CUSTOMER_MUST_CHOOSE`||r)}function hl(e,t){return e.length?e.length===1?{anyResource:!1,staffMemberId:e[0]}:t?{anyResource:!0}:null:null}function gl(e,t,n){return t&&!t.anyResource&&e.includes(t.staffMemberId)?{isComplete:!0,resourceId:t.staffMemberId}:t?.anyResource&&n?{isComplete:!0,resourceId:void 0}:e.length<=1?{isComplete:!0,resourceId:e[0]}:{isComplete:n,resourceId:void 0}}var _l={staff:null,requestedGender:null,locationId:null};function vl({entry:e,appointmentLike:t,staffChoiceHidden:n,staffPriced:r,staffSelectionStrategy:i,genderAllowed:a,staffMemberIds:o,locationIds:s}){if(!e)return _l;let c=e.locationId&&s.includes(e.locationId)?e.locationId:null,l=t&&!n?oo(e):null;if(!l)return{..._l,locationId:c};if(!l.anyResource)return o.includes(l.staffMemberId)?{staff:l,requestedGender:null,locationId:c}:{..._l,locationId:c};let u=a?e.requestedGender??null:null;return o.length>1&&!r&&(i!==`CUSTOMER_MUST_CHOOSE`||u!==null)?{staff:l,requestedGender:u,locationId:c}:{..._l,locationId:c}}var yl=[];function bl({sessions:e,dayQuery:t,daySlots:n,staffFilter:r,appointmentLike:i,limitPerDay:a,expandedDates:o}){let s=kl(Al(e,r)),c=n?Al(i?Qo(n):n,r):yl;return{rows:t?c:jl(s,a,o),slotIdOf:t?Yo:Zo,daysWithMore:Ol(s,a,o)}}function xl({rows:e,slotIdOf:t},n){return[...e.filter(e=>t(e)===n)].sort((e,t)=>Dl(t)-Dl(e))[0]??null}function Sl(e,t,n,r){return{slotId:n(e),slotStartTime:e.localStartDate??null,slotEndTime:e.localEndDate??null,bookable:e.bookable??!1,totalCapacity:e.totalCapacity??null,remainingCapacity:e.remainingCapacity??null,bookableCapacity:e.bookableCapacity??null,eventId:e.eventInfo?.eventId??null,eventTitle:e.eventInfo?.eventTitle??null,waitlistCapacity:e.eventInfo?.waitingList?.remainingCapacity??null,locationId:e.location?._id??null,locationName:e.location?.name||e.location?.formattedAddress||null,durationMinutes:El(e,t),isAllDay:e.allDay??!1,staff:r?[]:Cl(e)}}function Cl(e){let t=new Map;for(let n of e.availableResources??[])if(n.resourceTypeId===`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`)for(let e of n.resources??[])e._id&&!t.has(e._id)&&t.set(e._id,e.name??``);return[...t].map(([e,t])=>({staffMemberId:e,name:t}))}function wl(e){let t=Cl(e);if(t.length)return t.length===1?t[0].staffMemberId:null}function Tl(e){return Cl(e).map(e=>e.staffMemberId)}function El(e,t){if(!e.localStartDate||!e.localEndDate)return null;let n=e.allDay?`UTC`:t??`UTC`,r=Fc(e.localStartDate,n),i=Fc(e.localEndDate,n);return!r||!i||i<r?null:Math.round((i.getTime()-r.getTime())/6e4)}function Dl(e){let t=e.bookableCapacity??e.remainingCapacity;return(e.eventInfo?.waitingList?.remainingCapacity??0)>0&&(t??0)<=0?1:e.bookable?2:0}function Ol(e,t,n){let r=new Map;for(let t of e){let e=(t.localStartDate??``).slice(0,10);r.set(e,(r.get(e)??0)+1)}return new Set([...r].filter(([e,r])=>r>t&&!n.has(e)).map(([e])=>e))}function kl(e){return e.flatMap(e=>{let t=e.availableResources?.find(e=>e.resourceTypeId===Wr),n=t?.resources??[];return n.length<=1?[e]:n.map(n=>({...e,availableResources:[{...t,resources:[n]}]}))})}function Al(e,t){return t?e.map(e=>({...e,availableResources:e.availableResources?.map(e=>e.resourceTypeId===`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`?{...e,resources:e.resources?.filter(e=>e._id===t)}:e)})):e}function jl(e,t,n){let r=new Map;return e.filter(e=>{let i=(e.localStartDate??``).slice(0,10);if(n.has(i))return!0;let a=r.get(i)??0;return r.set(i,a+1),a<t})}async function Ml(){try{return await Jo()}catch(e){return $(e,{feature:Q.timeSlots,action:`fetch-business-time-zone`,level:`warning`}),{businessTimeZone:null,staffSelectionStrategy:void 0,allowGenderSelection:!1}}}function Nl(e){return Qs({key:Vs(),warmupData:e,fetchData:Ml})}function Pl(e){return(e.localStartDate??``).slice(0,10)}var Fl=[];function Il(e,t){let{serviceId:n=``,serviceType:r=`CLASS`,fromLocalDate:i=``,toLocalDate:o,timeZone:l,locationId:u,staffId:d,onlyAvailableSlots:f=!1,customerChoices:p,minRemainingCapacity:m,timeSlotsPerDay:h}=t??{},[g,_]=c([]),[v,y]=c([]),[b,x]=c(1),[S,C]=c(!!n),[w,T]=c(null),[ee,E]=c(null),[D,O]=c(new Set),[te,k]=c(null),A=s(null),ne=s(null);a(()=>{if(_([]),y([]),x(1),E(null),T(null),O(new Set),k(null),C(!!n),!n)return;let t=!1,a=!1,s=[],c=[];async function g(g){if(t||a)return;if(s[g-1]){T(null),x(g);return}let v=g===1?void 0:c[g-2];if(g===1||v){a=!0,T(null),C(!0);try{let a=[],b=null,S=v??void 0,C=new Set;do{S&&C.add(S);let s=await ps({serviceId:n,serviceType:r,fromLocalDate:i,toLocalDate:o,timeZone:l,locationId:u,staffId:d,onlyAvailableSlots:f,customerChoices:p,minRemainingCapacity:m,timeSlotsPerDay:h,limit:e,cursor:S});if(t)return;if(a.push(...s.timeSlots),b=s.nextCursor,b&&C.has(b))throw Error(`The session API repeated a page cursor`);S=b??void 0,E(s.timeZone??l??null)}while(a.length===0&&b!==null);s=[...s,a],c=[...c,b],_(s),y(c),(g===1||a.length>0)&&x(g)}catch(e){if(t)return;$(e,{feature:Q.sessions,action:`fetch-page`}),T(e instanceof Error?e.message:`Failed to load sessions`)}finally{a=!1,t||C(!1)}}}async function v(e){if(!(t||a)){if(h==null){O(t=>new Set([...t,e]));return}a=!0,k(e),T(null);try{let a=await bs({serviceId:n,serviceType:r,date:e,timeZone:l,onlyAvailableSlots:f,locationId:u,staffId:d,customerChoices:p,minRemainingCapacity:m,fromLocalDate:i,toLocalDate:o});if(t)return;let c=a.timeSlots.filter(t=>Pl(t)===e),h=Math.max(0,s.findIndex(t=>t.some(t=>Pl(t)===e)));s=s.map((t,n)=>{let r=t.filter(t=>Pl(t)!==e);return n===h?[...r,...c]:r}),_(s),O(t=>new Set([...t,e]))}catch(e){if(t)return;$(e,{feature:Q.sessions,action:`fetch-day`}),T(e instanceof Error?e.message:`Failed to load sessions`)}finally{a=!1,t||k(null)}}}return A.current=g,ne.current=v,g(1),()=>{t=!0,A.current=null,ne.current=null}},[n,r,i,o,l,u,d,f,p,m,h,e]);let re=[...g[b-1]??Fl].sort((e,t)=>(e.localStartDate??``).localeCompare(t.localStartDate??``)),j=g[b],ie=j?j.length>0:v[b-1]!=null,M=b>1;async function ae(){ie&&!S&&await A.current?.(b+1)}function oe(){M&&!S&&A.current?.(b-1)}async function se(e){S||te!==null||D.has(e)||await ne.current?.(e)}return{isLoadingPage:S,firstPageSettled:g.length>0||w!==null,error:w,timeZone:ee,sessions:re,pageSize:e,currentPage:b,hasNextPage:ie,hasPreviousPage:M,nextPage:ae,previousPage:oe,expandedDates:D,loadingDate:te,loadAllSessionsForDay:se}}var Ll=e=>e?.onlineBooking?.enabled===!0;function Rl(e,t){return e?e.anyResource?t??``:e.staffMemberId:null}var zl=[],Bl=[],Vl=cn.map(e=>({id:e,gender:e})),Hl={isSelectionValidated:!1},Ul=()=>{},Wl=async()=>{},Gl=n(null);function Kl(){let e=i(Gl);if(!e)throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);return e}function ql(e,t,n){e?t():n()}var Jl={loginRequired:`rescheduleLoginRequired`,notFound:`rescheduleNotFound`,accessDenied:`rescheduleAccessDenied`,failed:`rescheduleNotFound`,wrongService:`rescheduleNotFound`,notReschedulable:`rescheduleNotReschedulable`};function Yl(e=3){return Math.min(Math.max(e,1),lc)}function Xl(e){let{isLoading:n,bookingsSettingsLoading:r}=u();jc(Tc.TIME_SLOTS,!n&&!r);let i=Rs(),[a]=c(()=>Nl(i));return p(cc,{children:p(t,{fallback:p(Rc,{nextAvailableSlotsCount:Yl(e.nextAvailableSlotsCount),children:e.children}),children:p(Ql,{...e,configurationPromise:a})})})}function Zl(e){let[t,n]=c({serviceId:e,key:0});return e!==t.serviceId&&n({serviceId:e,key:t.serviceId?t.key+1:t.key}),t.key}function Ql({onlyAvailableSlots:e=!0,nextAvailableSlotsCount:t=3,loadDaysAvailabilityInitially:n=!1,timeSlotLimitPerDay:r=100,configurationPromise:i,children:o}){let s=ic().isLoading,{searchParams:d}=bc(),{reschedule:f}=u(),[m]=c(()=>({locationId:d.get(eo.location),staffId:d.get(eo.resource),timeZone:(f?void 0:Pr(d.get(eo.blob))?.timezone)??d.get(eo.timezone)})),[h,g]=c(m.timeZone),_=Yl(t),[v,y]=c(!1);a(()=>y(!0),[]);let b=v&&!s;dl(b);let x=Ns(i),S=l(cs,ss,()=>!1),{serviceId:C}=u(),w=Zl(C),T=Number.isFinite(r)?Math.max(1,Math.floor(r)):100;return p(uc,{fallback:p(zc,{nextAvailableSlotsCount:_,children:o}),feature:Q.timeSlots,children:p($l,{onlyAvailableSlots:e,selectedTimeZone:h,setSelectedTimeZone:g,enabled:b,nextAvailableSlotsCount:_,loadDaysAvailabilityInitially:n,timeSlotLimitPerDay:T,landingLocationId:m.locationId,landingStaffId:m.staffId,businessTimeZone:x.businessTimeZone,staffSelectionStrategy:x.staffSelectionStrategy,allowGenderSelection:x.allowGenderSelection,requestedGenderRejected:S,children:o})},w)}function $l({onlyAvailableSlots:e,selectedTimeZone:t,setSelectedTimeZone:n,enabled:i,nextAvailableSlotsCount:l,loadDaysAvailabilityInitially:d,timeSlotLimitPerDay:f,landingLocationId:m,landingStaffId:h,businessTimeZone:g,staffSelectionStrategy:_,allowGenderSelection:v,requestedGenderRejected:y,children:b}){let{service:x,serviceId:S,serviceType:C,setSlot:w,clearSlot:T,setMultiServiceSlot:ee,clearMultiServiceSlot:E,draftRevision:D,navigateToMultiServiceForm:O,selection:te,selectStaffMember:k,clearSelection:A,clearStaffMember:ne,withSelectionParam:re,staffMembers:j,serviceOptionsAndVariants:ie,isLoading:M,hasError:ae,multiServiceAppointmentServices:oe=Bl,reschedule:se}=u(),N=se!=null,ce=N&&se.status!==`ready`,le=N&&se.status===`loading`,ue=N?Jl[se.status]:void 0,de=ce?null:se?.booking??null,fe=de?se.validUntil:null,pe=cl(x)&&!Ll(x),P=pe||ce?null:S,me=bc(),he=N?null:me.searchParams.get(eo.blob),ge=o(()=>io(Pr(he)),[he]),F=!S&&!M&&!ae&&(ge.valid||ge.reason!==`too-few-services`),_e=F&&ge.valid&&oe.some(e=>!Ll(e)&&ge.services.some(t=>t.serviceId===e._id)),ve=pe||_e,ye=F&&ge.valid&&!_e?ge.requestKey:null,be=o(()=>ye&&ge.valid?{services:ge.services,locationId:ge.locationId,locationType:ge.locationType}:null,[ye]),xe=!!P||be!==null,Se=P||ye,Ce=i&&!M&&!ae&&!xe&&!le,we=oc(),Te=ic(),{navigate:Ee,resolvePath:De}=go(),[Oe,ke]=c(null),[Ae,je]=c(!1),Me=s([]),Ne=s(!1),Pe=r(()=>(je(!0),Ne.current?Promise.resolve():new Promise(e=>{Me.current.push(e)})),[]),Fe=i?Intl.DateTimeFormat().resolvedOptions().timeZone:null,Ie=Ja(x),Le=s(null),Re=oo(te),ze=s(Re);ze.current=Re;let Be=Re&&!Re.anyResource?Re.staffMemberId:null,Ve=te.requestedGender??null,I=!Xa(C)&&!Za(C),He=I&&!F&&Ss(ie),L=F||I&&_===`CUSTOMER_CANNOT_CHOOSE`,Ue=_!==void 0,We=qo({allowGenderSelection:v,staffSelectionStrategy:_??null})&&I&&!F&&!He,Ge=We&&!y,Ke=o(()=>P?Pr(he)?.services.find(e=>e.serviceId===P)??null:null,[he,P]),qe=(j??[]).map(e=>e.staffMemberId).join(`,`),Je=Ie.map(e=>e.id).join(`,`),Ye=o(()=>vl({entry:Ke,appointmentLike:I,staffChoiceHidden:L,staffPriced:He,staffSelectionStrategy:_,genderAllowed:Ge,staffMemberIds:qe.split(`,`),locationIds:Je.split(`,`)}),[Ke,I,L,He,_,Ge,qe,Je]),R=Ye.staff,Xe=Ye.locationId,Ze=L||R!==null,[Qe,$e]=c(null),[et,tt]=c(m!==null||N),z=o(()=>x?As(x):[],[x]),nt=R&&!R.anyResource?R.staffMemberId:null,rt=o(()=>{if(!nt)return z;let e=z.find(e=>e.staffMemberId===nt);return e?[e]:z},[z,nt]),it=de?.locationId??null,at=o(()=>{let e=ks(Ie,rt);return!it||e.some(e=>e.id===it)?e:Ie.filter(t=>t.id===it||e.some(e=>e.id===t.id))},[x,rt,it]),ot=e=>!!e&&at.some(t=>t.id===e),st=Qe??(et?ot(it)?it:m:null),ct=Ie.length>1&&at.length===1?at[0].id:null,B=Xe??(ot(st)?st:ct),lt=o(()=>Xe?[]:at.map(e=>({id:e.id,name:e.label})),[at,Xe]),ut=o(()=>new Map(z.map(e=>[e.staffMemberId,e.locationCoverage])),[z]),dt=r((e,t)=>Es([{staffMemberId:e,locationCoverage:ut.get(e)}],t).length===1,[ut]),ft=o(()=>Ze?[]:(j??[]).filter(e=>e.name).map(e=>({id:e.staffMemberId,name:e.name??``,gender:null})),[j,Ze]),pt=o(()=>B?ft.filter(e=>dt(e.id,B)):ft,[ft,B,dt]),mt=I&&!Ue?zl:pt,ht=I&&!Ue?0:ft.length,gt=Ge&&ht>1,_t=o(()=>gt?[...Vl,...mt]:mt,[gt,mt]),[vt,yt]=c(null),[bt,xt]=c(h!==null);bt&&h!==null&&B!==null&&!dt(h,B)&&xt(!1);let St=vt??(bt?h:null),V=R?R.anyResource?null:R.staffMemberId:St!==null&&pt.some(e=>e.id===St)?St:null,Ct=Re?.anyResource?Ve:null,[wt,Tt]=c(Ct),[Et,Dt]=c(Ct);!y&&Re?.anyResource&&Ve!==Et&&(Dt(Ve),Tt(Ve));let Ot=R?Ye.requestedGender:We&&ht>1&&V===null?wt:null,kt=y?null:Ot,At=r(e=>{ze.current=e,e?e.anyResource?A(kt??void 0):k(e.staffMemberId):ne()},[ne,A,k,kt]),jt=r(e=>At(e?{anyResource:!1,staffMemberId:e}:{anyResource:!0}),[At]),Mt=(de?.addOnIds??[]).filter(e=>x?.addOnGroups?.some(t=>t.addOnIds?.includes(e))),Nt=de&&Xa(C)?de.participants:null,Pt=I?to(te):null,{addOnIds:Ft,...It}=Pt??{},Lt=I&&de?Mt.length?{...It,addOnIds:Mt}:It:Pt,Rt=Lt?ts(Lt):void 0,zt=JSON.stringify(Ot?{...Rt,requestedGender:{gender:Ot}}:Rt??null),Bt=o(()=>JSON.parse(zt),[zt]),Vt=R?.anyResource===!0,Ht=r(e=>Vt||_!==void 0&&ml({isAppointment:I,staffOnSlotCount:e,hasStaffFilter:V!==null,hasRequestedGender:kt!==null,hasStaffPricedVariants:He,staffSelectionStrategy:_}),[Vt,I,_,V,kt,He]),Ut=r(e=>R??(L?null:e),[R,L]),Wt=r(e=>{let t=e===null?null:_t.find(t=>t.id===e);t!==void 0&&(xt(!1),yt(t&&!t.gender?t.id:null),Tt(t?.gender??null))},[_t]),Gt=r(e=>{(e===null||at.some(t=>t.id===e))&&(tt(!1),$e(e),St!==null&&e!==null&&!dt(St,e)&&(yt(null),xt(!1)))},[at,St,dt]),Kt=!!(i&&!Te.isLoading&&Te.displayTimeZonePolicy.customerCanChange&&g&&Fe&&g!==Fe),H=i?Kt&&t&&(t===g||t===Fe)?t:we??g??Fe:null,qt=r(e=>{Kt&&(e===g||e===Fe)&&n(e)},[Kt,g,Fe,n]),Jt=o(()=>i&&!M&&xe?Date.now():void 0,[i,M,P,be,H]),Yt=Jt!==void 0&&H?Ao(new Date(Jt),H):null,{range:Xt,daysAvailability:Zt,isLoading:Qt,hasError:$t,setRange:en,nextRange:tn,previousRange:nn}=tl({enabled:i,serviceId:P,serviceType:C,multiServiceRequest:be,timeZone:H,today:Yt,locationId:B,staffId:V,customerChoices:Bt,minRemainingCapacity:Nt,loadInitially:d,onlyAvailableSlots:e}),rn=fe?.slice(0,10)??null,an=o(()=>rn?Zt.map(e=>e.date>rn?{...e,availability:`none`}:e):Zt,[Zt,rn]),on=fe&&H?No(new Date(fe),H):null,{query:U,selectedDate:sn,timeSlots:cn,isLoading:ln,error:un,selectDate:dn,findNextAvailableDate:fn}=nl({enabled:i,serviceId:P,serviceType:C,multiServiceRequest:be,timeZone:H,today:Yt,locationId:B,staffId:V,customerChoices:Bt,minRemainingCapacity:Nt,onlyAvailableSlots:e,serviceLoading:M}),pn=s(!0),mn=s(null);a(()=>{if(pn.current){pn.current=!1;return}ke(null),Le.current&&ql(P,T,E),Le.current=null,mn.current=null},[U,be,H,B,V,Bt,Nt,e,l,f,D]);let hn=r(async()=>{let e=await fn();return e.outcome===`found`?rn&&e.date>rn?`none`:(await Promise.all([dn(e.date),Xt&&Wo(e.date,Xt)?Promise.resolve():en(Vo(e.date))]),`found`):e.outcome},[fn,rn,dn,Xt,en]),gn=!!(i&&!M&&xe&&H&&Yt),W=i&&!M&&!xe,[_n,vn]=c(!1),[yn,bn]=c(0),xn=s(!1),Sn=s([]),Cn=s(0),wn=r(()=>{vn(!1);let e=Sn.current;return Sn.current=[],e},[]),Tn=r(()=>{Cn.current+=1,wn().forEach(e=>e(`cancelled`))},[wn]),En=r(e=>(Tn(),dn(e)),[Tn,dn]),Dn=r(e=>{let t=Cn.current;xn.current=!0,hn().then(n=>{xn.current=!1,n===`cancelled`&&t===Cn.current?(Sn.current.unshift(...e),vn(!0)):e.forEach(e=>e(n)),bn(e=>e+1)})},[hn]),On=r(()=>W?Promise.resolve(`none`):new Promise(e=>{if(gn&&!xn.current){Dn([...wn(),e]);return}Sn.current.push(e),vn(!0)}),[W,gn,Dn,wn]);a(()=>{if(_n&&!xn.current){if(W){wn().forEach(e=>e(`none`));return}gn&&Dn(wn())}},[_n,yn,gn,W,Dn,wn]);let kn=x?.schedule?.lastSessionEnd,An=I||Xa(C)||Za(C)&&!fl(kn,Jt),jn=!!(Ae&&i&&!M&&P&&H&&Jt!==void 0),Mn=jn&&P&&H&&Jt!==void 0?pl({serviceId:P,serviceType:C,lastSessionEnd:kn,timeZone:H,now:Jt,onlyAvailableSlots:e,locationId:B,staffId:V,timeSlotLimitPerDay:f,customerChoices:Bt,minRemainingCapacity:Nt}):void 0,G=Il(l,Mn),Nn=Ae&&P&&An&&!(Ae&&P&&An&&(!i||M))&&!H,Pn=ve?`onlineBookingOff`:ue??(G.error===null?Nn?`timeZoneMissing`:null:`upcomingSlotsLoadFailed`),Fn=U!==null,In=o(()=>bl({sessions:G.sessions,dayQuery:Fn,daySlots:cn,staffFilter:V,appointmentLike:I,limitPerDay:f,expandedDates:G.expandedDates}),[G.sessions,Fn,cn,V,I,f,G.expandedDates]),{slotIdOf:Ln}=In,Rn=Ae&&(Mn?G.firstPageSettled:jn||i&&!M&&!P||Nn);Ne.current=Rn,a(()=>{if(!Rn)return;let e=Me.current;Me.current=[],e.forEach(e=>e())},[Rn]);let zn=Ae&&!Rn||G.isLoadingPage,Bn=Pn!==null,Vn=U?ln:zn||ln||!i||xe&&!H||_n||le,Hn=U?un:un??Pn,Un=U?un!==null:Bn||un!==null,K=Ac(Tc.TIME_SLOTS),Wn=s(!1),Gn=r((e,t)=>{if(!t.bookable){mn.current=null;return}if(e===mn.current)return;mn.current=e;let n=P??t.serviceId??t.nestedTimeSlots?.[0]?.serviceId??void 0,r=C??oe.find(e=>e._id===n)?.type??void 0;!Wn.current&&!N&&K(Cc({bookingsServiceId:n,serviceType:r,isEligibleForFlowCompletion:!0})),Wn.current=!0,K(Nc({component:Oc.TIME_PICKER,element:kc.TIME_SLOT,properties:JSON.stringify({selectedTime:t.localStartDate})}))},[K,P,C,oe,N]),Kn=r(e=>{if(e===null){let e=Le.current!==null;Le.current=null,mn.current=null,ke(null),e&&ql(P,T,E);return}let t=xl(In,e);if(!t)return;if(F){if(!ee(t.nestedTimeSlots??[],H??void 0))return;Le.current=t,ke(t),Gn(e,t);return}Le.current=t,ke(t),Gn(e,t);let n=Tl(t);if(w(xs(t),{staffId:I?void 0:wl(t),timezone:H??void 0,bookable:t.bookable,staffChoiceRequired:I&&Ue&&!L&&n.length>1&&!Ht(n.length),rescheduleStaffId:I&&(_!==`CUSTOMER_MAY_CHOOSE`||!Ht(n.length))?n[0]:void 0}),!I)return;let r=ze.current,i;i=R||(V&&n.includes(V)?{anyResource:!1,staffMemberId:V}:kt!==null&&Ht(n.length)?{anyResource:!0}:hl(n,Ue&&Ht(n.length))),Rl(i,kt)!==Rl(r,Ve)&&At(i)},[F,P,T,E,ee,w,In,Gn,H,I,Ue,_,Ht,R,V,kt,Ve,At]),qn=r(()=>{let e=Le.current;if(!e||N)return;if(F){O(K);return}if(!P)return;let t;if(I){let n=Tl(e),r=gl(n,Ut(ze.current),Ht(n.length));t=(r.isComplete?r.resourceId:n[0])??(n.length?null:void 0)}let n=De(`bookingForm`,{slug:x?.mainSlug?.name??null,serviceId:P});e.bookable&&K(Ic({serviceId:P,serviceType:C??void 0,start:e.localStartDate,end:e.localEndDate,timeZone:H??void 0,isEligibleForFlowCompletion:!!n})),n&&Ee(re(n,{handoff:!0,staffId:t}))},[K,F,O,H,P,C,x,I,Ut,Ht,Ee,De,re,N]),Jn=Oe?Tl(Oe):null,Yn=Jn?F||!I||gl(Jn,Ut(Re),Ht(Jn.length)).isComplete:!1,Xn=Jn?Ht(Jn.length):!1,Zn=o(()=>!Oe||Ze?[]:Cl(Oe).map(e=>({staffMemberId:e.staffMemberId,name:e.name||null,image:null,isSelected:e.staffMemberId===Be})),[Oe,Ze,Be]),Qn=o(()=>({...Hl,isMultiService:F,hasValidSchedulingInput:xe,availabilityRequestKey:Se,needsServiceChoice:Ce,isRescheduling:N,rescheduleValidUntil:on,businessTimeZone:g,canChangeTimeZone:Kt,setTimeZone:qt,locationFilterOptions:lt,selectedLocationFilter:B,setLocationFilter:Gt,staffFilterOptions:_t,selectedStaffFilter:V,setStaffFilter:Wt,requestedGender:kt,genderSelectionAllowed:Ge,currentTimeSlotsPage:U?1:G.currentPage,hasNextTimeSlotsPage:!U&&G.hasNextPage,hasPreviousTimeSlotsPage:!U&&G.hasPreviousPage,nextTimeSlotsPage:U?Wl:G.nextPage,loadUpcomingTimeSlots:Pe,upcomingTimeSlotsRequested:Ae,previousTimeSlotsPage:U?Ul:G.previousPage,timeSlots:In.rows.map(e=>Sl(e,H,Ln,L)),isLoading:Vn,hasError:Un,errorCode:Hn,selectedDate:sn,daysAvailabilityRange:Xt,daysAvailability:an,daysAvailabilityLoading:Qt,daysAvailabilityHasError:$t,timeSlotsLoading:Vn,timeSlotsErrorCode:Hn,selectDate:En,setDaysAvailabilityRange:en,nextDaysAvailabilityRange:tn,previousDaysAvailabilityRange:nn,goToNextAvailableDate:On,nextAvailableSlotsCount:l,timeZone:H,staffFromSlots:Zn,selectedResourceId:Be,setSelectedResource:jt,canAutoAssignStaff:Xn,isComplete:Yn,selectedTimeSlot:Oe?Sl(Oe,H,Ln,L):null,selectTimeSlot:Kn,navigateToBookingForm:qn,timeSlotLimitPerDay:f,expandedDates:G.expandedDates,daysWithMore:In.daysWithMore,loadingDate:G.loadingDate,loadAllTimeSlotsForDay:G.loadAllSessionsForDay}),[F,xe,Se,Ce,N,on,g,H,Kt,qt,G,Pe,Ae,lt,B,Gt,_t,V,Wt,kt,Ge,U,Vn,Hn,Un,In,sn,Xt,an,Qt,$t,En,en,tn,nn,On,l,Zn,Be,jt,Xn,Yn,Oe,Kn,qn,f,Ln,L]);return p(Gl.Provider,{value:Qn,children:b})}var eu=sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);export{Xl as default,eu as injectAccessTokenGetter,Gl as timeSlotsContext,Kl as useTimeSlotsContext};
|
|
3
|
-
//# sourceMappingURL=context-provider-4936242d-905c-48bf-80ce-5f56d075de4f-
|
|
2
|
+
`].every(function(t){return!(e?.includes)?.call(e,t)})},Vi=function(e){return e?.length<=$i.MAX_URL_MAPPING_LENGTH},Hi=function(e){return e?.split(`/`).every(Boolean)},Ui=function(e,t){var n=t.urlMappingKey;return wi(n)?.every(function(t){return e?.includes(`{{${t}}}`)})},Wi=function(e){return(e.match(new RegExp(Kr,`g`))?.length||0)<=1},Gi=function(e){return e?.split(`/`).every(Wi)},Ki=function(e){return[e.publishedPrefix,e.savedPrefix].filter(Boolean)},qi=function(e,t){return t===void 0&&(t=[]),function(n,r){var i=n.split(`/`),a=n===r;if(i.length<1||a)return!0;var o=X(r.split(`/`),1)[0],s=X(i,1)[0];return t.includes(s)?!0:e.every(function(e){return e===o||e!==s})}},Ji=function(e,t){var n=t.pathPrefixes;return qi(Object.values(n).map(function(e){return e.publishedPrefix}).filter(Boolean),Ki(t.pathPrefix))(e,t.defaultMapping.defaultPublished)},Yi=function(e,t){var n=t.urlMappingKey,r=t.urlMappings;return!zi(r.main?.filter(function(e){return n!==e.key}).map(function(e){return e.mapping}),e)},Xi=function(e){e=e.replace(new RegExp(Kr,`ig`),``);var t=new RegExp(/[^\]_.~!*'();:@&=+$,<>\\#^%?`"]/,`g`),n=!/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g.test(e),r=!e.replace(t,``);return n&&r},Zi=function(e){var t=X(e,1)[0],n=e.slice(-1);return t!==`/`&&n!==`/`},Qi=function(e,t){var n=t.pathPrefixes;return qi(Object.values(n).map(function(e){return e.savedPrefix}).filter(Boolean),Ki(t.pathPrefix))(e,t.defaultMapping.defaultSaved)},Z;(function(e){e.MAX_LENGTH_ERROR=`MAX_LENGTH_ERROR`,e.NO_SPACES_ERROR=`NO_SPACES_ERROR`,e.NO_EMPTY_SEGMENT_ERROR=`NO_EMPTY_SEGMENT_ERROR`,e.CONTAIN_MAIN_VARIABLE_ERROR=`CONTAIN_MAIN_VARIABLE_ERROR`,e.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR=`ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR`,e.ONLY_UNIQUE_PUBLISHED_URL_ERROR=`ONLY_UNIQUE_PUBLISHED_URL_ERROR`,e.ONLY_UNIQUE_SAVED_URL_ERROR=`ONLY_UNIQUE_SAVED_URL_ERROR`,e.ONLY_UNIQUE_MAPPING_ERROR=`ONLY_UNIQUE_MAPPING_ERROR`,e.NO_INVALID_CHARACTERS_ERROR=`NO_INVALID_CHARACTERS_ERROR`,e.NO_STARTING_OR_ENDING_SLASH_ERROR=`NO_STARTING_OR_ENDING_SLASH_ERROR`})(Z||={});var $i=function(){function e(e){var t=e.urlMappingKey,n=e.pathPrefixes,r=e.urlMappings,i=this;this.initValidators=function(){i.validators=[[Vi,Z.MAX_LENGTH_ERROR],[Bi,Z.NO_SPACES_ERROR],[Zi,Z.NO_STARTING_OR_ENDING_SLASH_ERROR],[Hi,Z.NO_EMPTY_SEGMENT_ERROR],[Xi,Z.NO_INVALID_CHARACTERS_ERROR],[Ui,Z.CONTAIN_MAIN_VARIABLE_ERROR],[Gi,Z.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR],[Ji,Z.ONLY_UNIQUE_PUBLISHED_URL_ERROR],[Qi,Z.ONLY_UNIQUE_SAVED_URL_ERROR],[Yi,Z.ONLY_UNIQUE_MAPPING_ERROR]]},this.urlMappings=r,this.pathPrefixes=n,this.urlMappingKey=t,this.pathPrefix=this.getPathPrefix(),this.defaultMapping=ea(t,this.pathPrefix),this.initValidators()}return e.prototype.getPathPrefix=function(){var t=Si(this.urlMappingKey);if(!t)throw yi(this.urlMappingKey)?Error(`Url Mapper Validator Error: Validator does not support sub mapping, please use the main url mapping key`):Error(`Url Mapper Validator Error: Url mapping key is not supported (${this.urlMappingKey})`);return this.pathPrefixes[t]||e.FALLBACK_PATH_PREFIX},Object.defineProperty(e.prototype,"validatorProps",{get:function(){var e=this;return{urlMappingKey:e.urlMappingKey,urlMappings:e.urlMappings,pathPrefix:e.pathPrefix,pathPrefixes:e.pathPrefixes,defaultMapping:e.defaultMapping}},enumerable:!1,configurable:!0}),e.prototype.validate=function(e){var t,n;try{for(var r=_i(this.validators),i=r.next();!i.done;i=r.next()){var a=X(i.value,2),o=a[0],s=a[1],c=!!o(e,this.validatorProps);if(!c)return{isValid:c,error:s}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{isValid:!0}},e.errorArray=Object.values(Z),e.MAX_URL_MAPPING_LENGTH=1e3,e.FALLBACK_PATH_PREFIX=`unknown`,e}(),ea=function(e,t){var n=bi()[e]||{required:[`slug`]},r=n.required,i=n.defaultPrefix,a={};return t&&typeof t==`object`?(a.savedPrefix=t.savedPrefix??``,a.publishedPrefix=t.publishedPrefix??``):(a.savedPrefix=$i.FALLBACK_PATH_PREFIX,a.publishedPrefix=$i.FALLBACK_PATH_PREFIX),{defaultSaved:vi([a.savedPrefix,i],X(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`),defaultPublished:vi([a.publishedPrefix,i],X(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`)}};function ta(e,t){return t?Ii(e,Y.BOOKINGS_SERVICE,{slug:t},{baseUrl:``}):void 0}var na=[{path:`bookingPolicyViolations.earliestBookingDate`}],ra=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ia(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var aa=`@wix/auto_sdk_bookings_availability-time-slots`;function oa(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:na}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots`,packageName:aa,migrationOptions:{optInTransformResponse:!0},url:ia({protoPath:`/v2/time-slots`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:ra}])}}return t}async function sa(e){let{httpClient:t,sideEffects:n}=arguments[1],r=oa(He({serviceId:e?.serviceId,fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,locations:e?.locations,includeResourceTypeIds:e?.includeResourceTypeIds,bookable:e?.bookable,bookingPolicyViolations:e?.bookingPolicyViolations,timeSlotsPerDay:e?.timeSlotsPerDay,cursorPaging:e?.cursorPaging,customerChoices:e?.customerChoices,resourceTypes:e?.resourceTypes}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{serviceId:`$[0].serviceId`,fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,locations:`$[0].locations`,includeResourceTypeIds:`$[0].includeResourceTypeIds`,bookable:`$[0].bookable`,bookingPolicyViolations:`$[0].bookingPolicyViolations`,timeSlotsPerDay:`$[0].timeSlotsPerDay`,cursorPaging:`$[0].cursorPaging`,customerChoices:`$[0].customerChoices`,resourceTypes:`$[0].resourceTypes`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function ca(e){return t=>sa(t,{httpClient:e})}var la=xt(ca),ua=[{path:`bookingPolicyViolations.earliestBookingDate`}],da=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`},{path:`schedulesInfo.firstSessionStart`},{path:`schedulesInfo.lastSessionEnd`},{path:`schedulesInfo.enrollmentViolations.earliestBookingDate`}];function fa(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var pa=`@wix/auto_sdk_bookings_event-time-slots`;function ma(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:ua}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.EventTimeSlots.ListEventTimeSlots`,packageName:pa,migrationOptions:{optInTransformResponse:!0},url:fa({protoPath:`/v2/time-slots/event`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:da}])}}return t}async function ha(e){let{httpClient:t,sideEffects:n}=arguments[1],r=ma(He({fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,serviceIds:e?.serviceIds,includeNonBookable:e?.includeNonBookable,minBookableCapacity:e?.minBookableCapacity,eventFilter:e?.eventFilter,maxSlotsPerDay:e?.maxSlotsPerDay,cursorPaging:e?.cursorPaging,bookingPolicyViolations:e?.bookingPolicyViolations}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,serviceIds:`$[0].serviceIds`,includeNonBookable:`$[0].includeNonBookable`,minBookableCapacity:`$[0].minBookableCapacity`,eventFilter:`$[0].eventFilter`,maxSlotsPerDay:`$[0].maxSlotsPerDay`,cursorPaging:`$[0].cursorPaging`,bookingPolicyViolations:`$[0].bookingPolicyViolations`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function ga(e){return t=>ha(t,{httpClient:e})}var _a=xt(ga),va=[{path:`bookingPolicyViolations.earliestBookingDate`}],ya=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ba(e){return V(Object.assign(e,{domainToMappings:{"www.wixapis.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"*.dev.wix-code.com":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],"manage._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/service-availability/v2/time-slots`,destPath:`/v2/time-slots`}],"www._base_domain_":[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`}],_:[{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"blocks._base_domain_":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"create.editorx":[{srcPath:`/_api/service-availability/v2/multi-service-time-slots`,destPath:`/v2/multi-service-time-slots`},{srcPath:`/_api/service-availability/v2/time-slots`,destPath:`/v2/time-slots`},{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}],"editor.wixapps.net":[{srcPath:`/_api/service-availability/v2/time-slots/event`,destPath:`/v2/time-slots/event`}]}}))}var xa=`@wix/auto_sdk_bookings_multi-service-availability-time-slots`;function Sa(e){function t({host:t}){let n=z(e,[{transformFn:Ue,paths:va}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.MultiServiceAvailabilityTimeSlots.ListMultiServiceAvailabilityTimeSlots`,packageName:xa,migrationOptions:{optInTransformResponse:!0},url:ba({protoPath:`/v2/multi-service-time-slots`,data:n,host:t}),data:n,transformResponse:e=>z(e,[{transformFn:We,paths:ya}])}}return t}async function Ca(e){let{httpClient:t,sideEffects:n}=arguments[1],r=Sa(He({services:e?.services,fromLocalDate:e?.fromLocalDate,toLocalDate:e?.toLocalDate,timeZone:e?.timeZone,location:e?.location,bookable:e?.bookable,bookingPolicyViolations:e?.bookingPolicyViolations,timeSlotsPerDay:e?.timeSlotsPerDay,cursorPaging:e?.cursorPaging}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{services:`$[0].services`,fromLocalDate:`$[0].fromLocalDate`,toLocalDate:`$[0].toLocalDate`,timeZone:`$[0].timeZone`,location:`$[0].location`,bookable:`$[0].bookable`,bookingPolicyViolations:`$[0].bookingPolicyViolations`,timeSlotsPerDay:`$[0].timeSlotsPerDay`,cursorPaging:`$[0].cursorPaging`},singleArgumentUnchanged:!1},[`options`]);throw n?.onError?.(e),t}}function wa(e){return t=>Ca(t,{httpClient:e})}var Ta=xt(wa),Ea=(e=>(e.UNKNOWN=`UNKNOWN`,e.CUSTOM=`CUSTOM`,e.STAFF_MEMBER=`STAFF_MEMBER`,e.DURATION=`DURATION`,e.DATE_TIME=`DATE_TIME`,e.NUMBER_OF_PARTICIPANTS=`NUMBER_OF_PARTICIPANTS`,e.LOCATION=`LOCATION`,e.DURATION_RANGE=`DURATION_RANGE`,e))(Ea||{}),Da=(e=>(e.APPOINTMENT=`APPOINTMENT`,e.CLASS=`CLASS`,e.COURSE=`COURSE`,e))(Da||{}),Oa=(e=>(e.FIXED=`FIXED`,e.CUSTOM=`CUSTOM`,e.VARIED=`VARIED`,e.NO_FEE=`NO_FEE`,e.SUBSCRIPTION=`SUBSCRIPTION`,e))(Oa||{}),ka=(e=>(e.CUSTOM=`CUSTOM`,e.BUSINESS=`BUSINESS`,e.CUSTOMER=`CUSTOMER`,e))(ka||{}),Aa=[{path:`timeSlotsConfiguration.createdDate`},{path:`timeSlotsConfiguration.updatedDate`}];function ja(e){return V(Object.assign(e,{domainToMappings:{_:[{srcPath:`/_api/time-slots-config`,destPath:``}],"manage._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"editor._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"blocks._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"create.editorx":[{srcPath:`/_api/time-slots-config`,destPath:``}],"apps._base_domain_":[{srcPath:`/_api/time-slots-config`,destPath:``}],"*.dev.wix-code.com":[{srcPath:`/_api/time-slots-config`,destPath:``}],"www.wixapis.com":[{srcPath:`/_api/time-slots-config`,destPath:``}]}}))}var Ma=`@wix/auto_sdk_bookings_time-slots-configuration`;function Na(e){function t({host:t}){return{entityFqdn:`wix.bookings.timeslots_configuration.v1.time_slots_configuration`,method:`GET`,methodFqn:`wix.bookings.timeslots.configuration.v1.TimeSlotsConfigurationService.GetTimeSlotsConfigurationByAppId`,packageName:Ma,migrationOptions:{optInTransformResponse:!0},url:ja({protoPath:`/v1/time-slots-configurations/app/{appId}`,data:e,host:t}),params:St(e),transformResponse:e=>z(e,[{transformFn:We,paths:Aa}])}}return t}async function Pa(e){let{httpClient:t,sideEffects:n}=arguments[1],r=Na(He({appId:e}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),L(e.data)}catch(e){let t=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{appId:`$[0]`},singleArgumentUnchanged:!1},[`appId`]);throw n?.onError?.(e),t}}function Fa(e){return t=>Pa(t,{httpClient:e})}var Ia=xt(Fa),La=[{path:`bookingsSettings.createdDate`},{path:`bookingsSettings.updatedDate`}],Ra=[{path:`bookingsSettings.siteProperties.address.coordinates.latitude`},{path:`bookingsSettings.siteProperties.address.coordinates.longitude`}];function za(e){return V(Object.assign(e,{domainToMappings:{"manage._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"dev._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"*.dev.wix-code.com":[{srcPath:`/_api/bookings-settings`,destPath:``}],"www.wixapis.com":[{srcPath:`/_api/bookings-settings`,destPath:``}],_:[{srcPath:`/_api/bookings-settings`,destPath:``}],"api._api_base_domain_":[{srcPath:`/bookings-settings`,destPath:``}],"editor._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"blocks._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}],"create.editorx":[{srcPath:`/_api/bookings-settings`,destPath:``}],"editor.wixapps.net":[{srcPath:`/_api/bookings-settings`,destPath:``}],"www._base_domain_":[{srcPath:`/_api/bookings-settings`,destPath:``}]}}))}var Ba=`@wix/auto_sdk_bookings_bookings-settings`;function Va(e){function t({host:t}){return{entityFqdn:`wix.bookings.v2.bookings_settings`,method:`GET`,methodFqn:`wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`,packageName:Ba,migrationOptions:{optInTransformResponse:!0},url:za({protoPath:`/v2/settings`,data:e,host:t}),params:St(e),transformResponse:e=>z(e,[{transformFn:We,paths:La},{transformFn:qt,paths:Ra}]),fallback:[{method:`GET`,url:za({protoPath:`/v2/settings`,data:e,host:t}),params:St(e)}]}}return t}var Ha=(e=>(e.BUSINESS_TIME_ZONE=`BUSINESS_TIME_ZONE`,e.CUSTOMER_TIME_ZONE=`CUSTOMER_TIME_ZONE`,e))(Ha||{});async function Ua(){let{httpClient:e,sideEffects:t}=arguments[0],n=Va(He({}));t?.onSiteCall?.();try{let r=await e.request(n);return t?.onSuccess?.(r),L(r.data)?.bookingsSettings}catch(e){let n=ut(e,{spreadPathsToArguments:{},explicitPathsToArguments:{},singleArgumentUnchanged:!1},[]);throw t?.onError?.(e),n}}function Wa(e){return()=>Ua({httpClient:e})}var Ga=xt(Wa);function Ka(e){return e.business?._id??null}function qa(e){return e.business?.name??null}function Ja(e){return(e?.locations??[]).filter(e=>e.type===ka.BUSINESS).map(e=>({id:Ka(e)??``,label:qa(e)??``})).filter(e=>e.id!==``).sort((e,t)=>e.label.localeCompare(t.label))}var Ya=e=>e===Da.APPOINTMENT,Xa=e=>e===Da.CLASS,Za=e=>e===Da.COURSE,Qa=e=>e.payment?.rateType===Oa.VARIED,$a=e=>!!e.addOnGroups?.some(e=>e.addOnIds?.length),eo={category:`category`,location:`location`,page:`page`,blob:`b`,resource:`resource`,referral:`referral`,timezone:`timezone`,bookingId:`bookingId`,token:`token`,rescheduleRedirectUrl:`rescheduleRedirectUrl`};function to(e){if(!e)return null;let t=so(e).map(e=>e.id),n={...e.durationChoiceId?{durationChoiceId:e.durationChoiceId}:{},...e.durationInMinutes?{durationInMinutes:e.durationInMinutes}:{},...t.length?{addOnIds:t}:{},...e.requestedGender?{requestedGender:{gender:e.requestedGender}}:{}};return Object.keys(n).length?n:null}function no(e){return(e?.services.length??0)>1}var ro=e=>({valid:!1,reason:e});function io(e){let t=e?.services??[];if(!no(e)||t.some(e=>!e.serviceId))return ro(`too-few-services`);if(t.some(e=>e.serviceType&&e.serviceType!==`APPOINTMENT`))return ro(`not-appointment`);let n=t[0].locationType??`BUSINESS`,r=t[0].locationId??null;if(t.some(e=>(e.locationType??`BUSINESS`)!==n||(e.locationId??null)!==r))return ro(`location-mixed`);if(r&&n!==`BUSINESS`)return ro(`location-id-not-business`);let i=t.map(e=>({serviceId:e.serviceId,staff:oo(e),customerChoices:to(e)}));return{valid:!0,locationId:r,locationType:n,services:i,requestKey:JSON.stringify([n,r,i])}}var ao=`staff`;function oo(e){let t=e.resources?.find(e=>e.type===ao);if(!t)return null;let n=t.ids[0];return n?{anyResource:!1,staffMemberId:n}:t.anyResource?{anyResource:!0}:null}function so(e){return e.addOns??[]}function co(e,t){let n=e(t);return n?n.replace(/\/$/,``)||`/`:null}function lo(e,t,n){let r=e(t);return!r||!n?null:`${r.replace(/\/$/,``)}/${n}`}function uo(e,t){switch(e){case`servicePage`:return(t.slug?t.buildCustomServiceUrl(t.slug):void 0)??lo(t.appSectionUrl,Gr.SERVICE_PAGE,t.slug);case`bookingCalendar`:return t.isMultiService?co(t.appSectionUrl,Gr.CALENDAR_PAGE):lo(t.appSectionUrl,Gr.CALENDAR_PAGE,t.slug);case`bookingForm`:return t.serviceId?lo(t.appSectionUrl,Gr.FORM_PAGE,t.slug):null;default:return null}}var fo=e=>e.target===`_blank`,po=(e,t)=>t===`/`?e:new URL(`.${t}`,`${e}/`).href,mo=(e,t,n)=>n?`.${t}`:ho(e,t),ho=(e,t)=>e?po(e,t):t,go=()=>{let{previewMode:e}=f(Ir),t=f(zr),n=t.siteUrl.replace(/\/$/,``),{navigateTo:i}=f(Rr),a=f(Br),o=d(),s=r(async t=>{let r=mo(n,t,e);await i({href:r})},[e,n,i]),c=r(async e=>{await i(fo(e)?{href:e.href,type:`ExternalLink`,target:`_blank`}:{href:e.href})},[i]),l=r(e=>ho(n,e),[n]),u=r(e=>t.appSectionRelativeUrl(Vr,e),[t]),p=r(e=>ta(a.urlMappings,e),[a]),m=r((e,t)=>uo(e,{...t,appSectionUrl:u,buildCustomServiceUrl:p}),[u,p]),h=r((e,t)=>{let r=m(e,t);return r&&n?po(n,r):null},[m,n]),g=r((e,t)=>{let n=m(e,t);n&&s(n)},[m,s]),_=r(()=>u(Gr.FORM_PAGE)||void 0,[u]),v=r(e=>Object.values(o(Lr).pages).some(t=>t.appPageId===e&&(!t.appDefinitionId||t.appDefinitionId===`1380b703-ce81-ff05-f115-39571d94dfcd`))&&t.appSectionRelativeUrl(`1380b703-ce81-ff05-f115-39571d94dfcd`,e)||void 0,[t,o]);return{navigate:s,navigateToHref:c,resolvePath:m,toHref:l,resolveAbsoluteUrl:h,navigateTo:g,getBookingFormPath:_,getCartPagePath:r(()=>v(Hr),[v]),getThankYouPagePath:r(e=>{let t=v(Ur);return t?`${t}/${e}?origin=bookings`:void 0},[v])}};function _o(e){return e?.details?.applicationError?.code}function vo(){let e=typeof $wixContext<`u`&&$wixContext.initWixModules?$wixContext.initWixModules:globalThis.__wix_context__!==void 0&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(t,n){return yo(()=>e(t,n))},fetchWithAuth(){throw Error(`fetchWithAuth is not available in this context`)},graphql(){throw Error(`graphql is not available in this context`)}};let t=typeof $wixContext<`u`?$wixContext.client:m.client===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.client:m.client,n=typeof $wixContext<`u`?$wixContext.elevatedClient:m.elevatedClient===void 0?globalThis.__wix_context__===void 0?void 0:globalThis.__wix_context__.elevatedClient:m.elevatedClient;if(t||n)return{initWixModules(e,r){if(r){if(!n)throw 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`);return yo(()=>n.use(e))}if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return yo(()=>t.use(e))},fetchWithAuth:(e,n)=>{if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.fetchWithAuth(e,n)},getAuth(){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.auth},async graphql(e,n,r){if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return t.graphql(e,n,r)}}}function yo(e){let t=globalThis.__wix_context__,n={client:m.client,elevatedClient:m.elevatedClient},r;globalThis.__wix_context__=void 0,m.client=void 0,m.elevatedClient=void 0,typeof $wixContext<`u`&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,m.client=n.client,m.elevatedClient=n.elevatedClient,typeof $wixContext<`u`&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function bo(e,t){return{...e,...Object.fromEntries(t.map(t=>[t,(...n)=>{let r=vo();if(!r)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return r.initWixModules(e)[t].apply(void 0,n)}]))}}function xo(e){return bo({__type:`host`,create:t=>Object.entries(e).reduce((e,[n,r])=>({...e,[n]:r(t)}),{})},Object.keys(e))}var So=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(e,t)=>(console.error(this.message),t(void 0)),this.startSpanManual=()=>(console.error(this.message),{end:()=>{},fail:()=>{}}),this.endSpanManual=()=>{console.error(this.message)},this.addBreadcrumb=()=>{console.error(this.message)}}},Co=e=>new So(e),wo=xo({getMonitoringClient:e=>()=>e.getMonitoringClient?e.getMonitoringClient():Co(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`)}),Q={service:`service`,services:`services`,categories:`categories`,locations:`locations`,sessions:`sessions`,timeSlots:`time-slots`,serviceAddOns:`service-addons`,bookingsSettings:`bookings-settings`,serviceCta:`service-cta`,preferences:`preferences`,bookingSummary:`booking-summary`,bookingCheckout:`booking-checkout`,formValues:`form-values`,paymentOptions:`payment-options`,seo:`seo`,warmup:`warmup`,reschedule:`reschedule`};function To(e){try{let t=wo.getMonitoringClient?.();return t&&typeof t[e]==`function`?t:null}catch{return null}}function $(e,{feature:t,action:n,level:r=`error`,contexts:i}){let a=To(`captureException`);if(!a)return;let o=e instanceof Error?e:Error(String(e));a.captureException(o,{level:r,tags:{feature:t,action:n},...i?{contexts:i}:{}})}function Eo(e,{feature:t,action:n,level:r=`info`,tags:i}){let a=To(`captureMessage`);a&&a.captureMessage(e,{level:r,tags:{feature:t,action:n,...i}})}function Do({message:e,category:t,feature:n,data:r}){let i=To(`addBreadcrumb`);i&&i.addBreadcrumb({message:e,category:t,level:`info`,data:{feature:n,...r}})}var Oo=e=>{let t=e=>e<10?`0${e}`:`${e}`;return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},ko=e=>new Date(`${e}T00:00:00`),Ao=(e,t)=>new Intl.DateTimeFormat(`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,...t?{timeZone:t}:{}}).format(e),jo=e=>`${Oo(e)}T00:00:00`,Mo=e=>`${Oo(e)}T23:59:59`;function No(e,t){return`${Ao(e,t)}T${new Intl.DateTimeFormat(`en-GB`,{timeZone:t,hourCycle:`h23`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e)}`}function Po(e,t){let n=No(new Date(Date.now()),t);return n.slice(0,10)===e?n:`${e}T00:00:00`}var Fo=/^\d{4}-\d{2}-\d{2}$/,Io=864e5;function Lo(e){if(typeof e!=`string`||!Fo.test(e))return!1;let t=ko(e);return!Number.isNaN(t.getTime())&&Oo(t)===e}function Ro(e){if(!e||typeof e!=`object`)return!1;let{startDate:t,endDate:n}=e;return Lo(t)&&Lo(n)&&t<=n}function zo(e,t){let n=ko(e);return n.setDate(n.getDate()+t),Oo(n)}function Bo({startDate:e,endDate:t}){let n=ko(t).getTime()-ko(e).getTime();return Math.round(n/Io)+1}function Vo(e){let t=ko(e),n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return{startDate:Oo(n),endDate:Oo(r)}}function Ho(e){let t=Vo(e.startDate);return t.startDate===e.startDate&&t.endDate===e.endDate}function Uo(e,t){if(Ho(e)){let n=ko(e.startDate);return Vo(Oo(new Date(n.getFullYear(),n.getMonth()+t,1)))}let n=t*Bo(e);return{startDate:zo(e.startDate,n),endDate:zo(e.endDate,n)}}function Wo(e,t){return e>=t.startDate&&e<=t.endDate}function Go(e){let t=ko(e),n=new Date(t.getFullYear(),t.getMonth()+2,0).getDate(),r=Math.min(t.getDate(),n);return Oo(new Date(t.getFullYear(),t.getMonth()+1,r))}function Ko(e){let t=[],n=e.startDate;for(;n<=e.endDate;){let r=zo(Go(n),-1),i=r<e.endDate?r:e.endDate;t.push({startDate:n,endDate:i}),n=zo(i,1)}return t}function qo({allowGenderSelection:e,staffSelectionStrategy:t}){return e&&t!==`CUSTOMER_CANNOT_CHOOSE`}async function Jo(){let e=await Ia(Vr);return{businessTimeZone:e.timeSlotsConfiguration?.displayTimeZone?.timeZone||null,staffSelectionStrategy:e.timeSlotsConfiguration?.staffSelection?.strategy??null,allowGenderSelection:e.timeSlotsConfiguration?.staffSelection?.allowGenderSelection??!1}}function Yo(e){let t=e.location?._id||(e.location?.locationType?`${e.location.locationType}:${e.location.formattedAddress??``}`:``);return`${e.localStartDate??``}|${e.localEndDate??``}|${t}`}function Xo(e){return e.availableResources?.[0]?.resources?.[0]?._id??null}function Zo(e){return`${Yo(e)}|${Xo(e)??``}`}function Qo(e){let t=new Map;for(let n of e){let e=Yo(n),r=t.get(e);r?r.push(n):t.set(e,[n])}return[...t.values()].map(e=>{if(e.length===1)return e[0];let t=e.filter(e=>e.bookable),n=t.length?t:e;return{...n[0],availableResources:n.flatMap(e=>e.availableResources??[])}})}function $o(e){return e?{locations:[{_id:e,locationType:`BUSINESS`}]}:{}}function es(e){return e?{resourceTypes:[{resourceTypeId:Wr,resourceIds:[e]}]}:{}}function ts(e){let{requestedGender:t,...n}=e;return Object.keys(n).length?n:void 0}function ns(e,t){if(!e)return{};let n=t?ts(e):e;return n?{customerChoices:n}:{}}var rs=`REQUESTED_GENDER_NOT_ALLOWED`;function is(e){return _o(e)===rs}var as=!1,os=new Set;function ss(){return as}function cs(e){return os.add(e),()=>os.delete(e)}function ls(){as||(as=!0,os.forEach(e=>e()))}async function us(e){let{customerChoices:t,...n}=e,r=e=>{let t=ts(e);return la({...n,...t?{customerChoices:t}:{}})};if(as&&t?.requestedGender)return r(t);try{return await la(e)}catch(e){if(!t?.requestedGender||!is(e))throw e;return $(e,{feature:Q.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ls(),r(t)}}function ds(e,t,n){return{...e?{"location.id":e}:{},...t?{"resources.id":{$hasSome:[t]}}:{},...n?{remainingCapacity:{$gte:n}}:{}}}async function fs(e){let t=await _a(e);return{timeSlots:t.timeSlots??[],timeZone:t.timeZone??null,nextCursor:t.pagingMetadata?.cursors?.next||null}}function ps({serviceId:e,serviceType:t,fromLocalDate:n,toLocalDate:r,timeZone:i,locationId:a,staffId:o,onlyAvailableSlots:s=!1,customerChoices:c,minRemainingCapacity:l,timeSlotsPerDay:u,limit:d,cursor:f}){return Ya(t)?ms({serviceId:e,fromLocalDate:n,toLocalDate:r,timeZone:i,locationId:a,staffId:o,onlyAvailableSlots:s,customerChoices:c,timeSlotsPerDay:u,limit:d,cursor:f}):fs({serviceIds:[e],fromLocalDate:n,...r?{toLocalDate:r}:{},...i?{timeZone:i}:{},includeNonBookable:!s,eventFilter:{type:t,...ds(a,o,l)},cursorPaging:{limit:d,...f?{cursor:f}:{}}})}async function ms({serviceId:e,fromLocalDate:t,toLocalDate:n,timeZone:r,locationId:i,staffId:a,onlyAvailableSlots:o,customerChoices:s,timeSlotsPerDay:c,limit:l,cursor:u}){let d=await us({serviceId:e,fromLocalDate:t,...n?{toLocalDate:n}:{},...r?{timeZone:r}:{},...o?{bookable:!0}:{},...$o(i),...es(a),...ns(s,a),includeResourceTypeIds:[Wr],...c==null?{}:{timeSlotsPerDay:c},cursorPaging:{limit:l,...u?{cursor:u}:{}}});return{timeSlots:d.timeSlots??[],timeZone:d.timeZone??null,nextCursor:d.cursorPagingMetadata?.cursors?.next||null}}var hs=6,gs=864e5;function _s(e){let t=e?ko(e):new Date(Date.now()),n=new Date(t.getFullYear(),t.getMonth()+hs+1,1),r=new Date(n.getTime()-gs);return{fromLocalDate:jo(t),toLocalDate:Mo(r)}}async function vs({serviceId:e,serviceType:t,timeZone:n,limit:r,onlyAvailableSlots:i=!0,fromDate:a,locationId:o,staffId:s,customerChoices:c,minRemainingCapacity:l}){let{fromLocalDate:u,toLocalDate:d}=_s(a);if(Xa(t)||Za(t)){let a={...Za(t)?{type:`COURSE`}:{},...ds(o,s,l)},c=await fs({serviceIds:[e],fromLocalDate:u,toLocalDate:d,...n?{timeZone:n}:{},includeNonBookable:!i,...Object.keys(a).length?{eventFilter:a}:{},...r==null?{}:{cursorPaging:{limit:r}}});return{timeSlots:c.timeSlots,timeZone:c.timeZone}}let f=await us({serviceId:e,fromLocalDate:u,toLocalDate:d,...n?{timeZone:n}:{},...i?{bookable:!0}:{},...$o(o),...es(s),...ns(c,s),includeResourceTypeIds:[Wr],...r==null?{}:{cursorPaging:{limit:r}}});return{timeSlots:f.timeSlots??[],timeZone:f.timeZone??null}}var ys=1e3;async function bs({serviceId:e,serviceType:t,date:n,timeZone:r,onlyAvailableSlots:i,locationId:a,staffId:o,customerChoices:s,minRemainingCapacity:c,fromLocalDate:l,toLocalDate:u}){let d=`${n}T00:00:00`,f=`${n}T23:59:59`,p=Za(t)?`COURSE`:Xa(t)?`CLASS`:`APPOINTMENT`,m=[],h=null,g;do{let t=await ps({serviceId:e,serviceType:p,fromLocalDate:l&&l>d?l:d,toLocalDate:u&&u<f?u:f,timeZone:r,locationId:a,staffId:o,onlyAvailableSlots:i,customerChoices:s,minRemainingCapacity:c,limit:ys,cursor:g});m.push(...t.timeSlots),h=t.timeZone??h,g=t.nextCursor??void 0}while(g);return{timeSlots:m,timeZone:h}}function xs(e){return{slotStart:e.localStartDate,slotEnd:e.localEndDate,eventId:e.eventInfo?.eventId,scheduleId:e.scheduleId??void 0,locationId:e.location?._id??void 0,locationType:e.location?.locationType??void 0}}function Ss(e){return e?.options?.values?.[0]?.type===Ea.STAFF_MEMBER}function Cs(e){return e.staffMemberDetails?.staffMembers??[]}function ws(e,t){let n=e.workingHoursLocationCoverage;return{staffMemberId:e.staffMemberId??``,name:e.name??null,image:null,isSelected:t===e.staffMemberId,...n?{locationCoverage:{availableAtAllLocations:n.availableAtAllLocations??!1,locationIds:n.locationIds??[]}}:{}}}function Ts(e,t){let n=e.locationCoverage;return!n||n.availableAtAllLocations||n.locationIds.includes(t)}function Es(e,t){return t?e.filter(e=>Ts(e,t)):e}function Ds(e,t){let n=new Map(t.map(e=>[e.staffMemberId,e.locationCoverage]));return e.choices.map(e=>e.choiceId).filter(e=>e!=null).map(e=>({staffMemberId:e,locationCoverage:n.get(e)}))}function Os(e,t,n){if(e?.type!==`STAFF_MEMBER`||!n)return;let r=Es(Ds(e,t),n);return r.length===1?r[0].staffMemberId:void 0}function ks(e,t){if(t.length===0)return e;let n=e.filter(e=>Es(t,e.id).length>0);return n.length>0?n:e}function As(e){return Cs(e).map(e=>ws(e,null))}function js(e,t,n=!1){let r=Ms(e),i=r.length===1?r[0].id:void 0,a=n||!i||r.some(e=>e.id===t);return t&&a?t:i}function Ms(e){return ks(Ja(e),As(e))}function Ns(e){let t=e;if(t.__state||(t.__state={status:`pending`},t.then(e=>{t.__state={status:`fulfilled`,value:e}},e=>{t.__state={status:`rejected`,reason:e}})),t.__state.status===`fulfilled`)return t.__state.value;throw t.__state.status===`rejected`?t.__state.reason:t}function Ps(e){let t=Promise.resolve(e);return t.__state={status:`fulfilled`,value:e},t}var Fs=Fr(`@wix/site-service-warmup-data`);function Is(){try{return d()}catch{return null}}function Ls(e){try{return e?e(Fs):null}catch{return null}}function Rs(){let e=Ls(Is()),t=typeof window>`u`;return{scope:e??void 0,get:async n=>{if(t||!e)return null;try{return await e.get(n)}catch(e){return $(e,{feature:Q.warmup,action:`read`,level:`warning`,contexts:{warmup:{key:n}}}),null}},set:(n,r)=>{if(t&&e)try{e.set(n,r)}catch{}}}}var zs=`bookings-uou`;function Bs(){return`${zs}:bookings-settings`}function Vs(){return`${zs}:time-slots-configuration`}var Hs=5e3,Us=100,Ws=`wix-warmup-data`,Gs=null;function Ks(e){if(typeof document<`u`)try{let t=document.getElementById(Ws)?.textContent;return t?(Gs?.text!==t&&(Gs={text:t,data:JSON.parse(t).builderComponentsWarmupData??{}}),Gs.data[e]??void 0):void 0}catch{return}}var qs=()=>({promises:new Map,invalidatedWarmup:new Set}),Js=qs(),Ys=new WeakMap,Xs=new WeakMap;function Zs(e){if(!e)return Js;let t=Ys.get(e);return t||(t=qs(),Ys.set(e,t)),t}function Qs({key:e,warmupData:t,fetchData:n,refresh:r=!1}){if(e===null)return n();if(typeof window>`u`){let r=()=>n().then(n=>(t.set(e,n),n)),{scope:i}=t;if(!i)return r();let a=Xs.get(i);a||(a=new Map,Xs.set(i,a));let o=a.get(e);if(o)return o;let s=r();return a.set(e,s),s.catch(()=>a.delete(e)),s}let i=Zs(t.scope),a=Date.now();for(let[e,t]of i.promises)t.expiresAt<=a&&i.promises.delete(e);let o=i.promises.get(e);if(o&&!r)return o.promise;r&&i.invalidatedWarmup.add(e);let s=!i.invalidatedWarmup.has(e);if(s){let t=Ks(e);if(t!==void 0){let n=Ps(t);return i.promises.set(e,{promise:n,expiresAt:a+Hs}),n}}let c=(async()=>{if(s){let n=await t.get(e);if(n!=null)return n}return n()})();i.promises.size>=Us&&i.promises.delete(i.promises.keys().next().value);let l={promise:c,expiresAt:1/0};return i.promises.set(e,l),c.then(()=>{l.expiresAt=Date.now()+Hs},()=>{i.promises.get(e)===l&&i.promises.delete(e)}),c}var $s={displayTimeZonePolicy:{basedOn:Ha.BUSINESS_TIME_ZONE,customerCanChange:!1},multiServiceAppointmentsEnabled:!1};async function ec(){try{let e=await Ga();return{displayTimeZonePolicy:{basedOn:e.displayTimeZone?.basedOn??Ha.BUSINESS_TIME_ZONE,customerCanChange:e.displayTimeZone?.customerCanChange??!1},multiServiceAppointmentsEnabled:e.multiServiceAppointments?.enabled??!1}}catch(e){return $(e,{feature:Q.bookingsSettings,action:`fetch-bookings-settings`,level:`warning`}),$s}}var tc={isLoading:!0},nc=n(null),rc=`useBookingsSettingsContext must be used within BookingsSettingsProvider`;function ic(){let e=i(nc);if(!e)throw Error(rc);return e}function ac(e){return e.basedOn===Ha.CUSTOMER_TIME_ZONE?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0}function oc(){let e=ic();return e.isLoading?void 0:ac(e.displayTimeZonePolicy)}function sc({settingsPromise:e,children:t}){let n=Ns(e),r=o(()=>({isLoading:!1,...n}),[n]);return p(nc.Provider,{value:r,children:t})}function cc({bookingsSettings:e,children:n}){let r=Rs(),[i]=c(()=>e?null:Qs({key:Bs(),warmupData:r,fetchData:ec}));return e?p(nc.Provider,{value:{isLoading:!1,...e},children:n}):p(t,{fallback:p(nc.Provider,{value:tc,children:n}),children:p(sc,{settingsPromise:i,children:n})})}var lc=1e3,uc=class extends e{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){$(e,{feature:this.props.feature??`service`,action:`render`,contexts:{react:{componentStack:t.componentStack}}})}render(){return this.state.hasError?this.props.fallback:this.props.children}},dc=`appSectionParams`;function fc(e){let t=e.searchParams.get(dc);if(t===null)return e;let n=new URL(e);n.searchParams.delete(dc);for(let[e,r]of Object.entries(pc(t)))typeof r==`string`&&!n.searchParams.has(e)&&n.searchParams.set(e,r);return n}function pc(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}var mc=`bookings-uou:url-change`,hc=e=>{let t=new URL(e);return t.searchParams.sort(),t.href};function gc(e,{disableScrollToTop:t,skipHistory:n}={}){let r=globalThis.window;if(!r?.history)return;let i=new URL(r.location.href);if(hc(i)===hc(e))return;let a={scrollY:r.scrollY};if(n)r.history.replaceState(a,``,e.href);else{r.history.replaceState(a,``,i.href);try{r.history.pushState(t?a:null,``,e.href)}catch{return}}r.dispatchEvent(new Event(mc))}function _c(e){let t=globalThis.window;return t?(t.addEventListener(mc,e),t.addEventListener(`popstate`,e),()=>{t.removeEventListener(mc,e),t.removeEventListener(`popstate`,e)}):()=>{}}var vc=e=>{try{return decodeURIComponent(e)}catch{return e}};function yc(e,t){let n=t?new URL(t).pathname:`/`;return`./${vc(new URL(e).pathname.replace(n,``).replace(/^\/|\/$/g,``))}`}function bc(){let e=f(zr),t=r(()=>e.currentUrl,[e]),n=l(_c,t,t),i=o(()=>fc(new URL(n)),[n]),a=e.siteUrl.replace(/\/$/,``);return{pathname:i.pathname,search:i.search,searchParams:i.searchParams,href:i.href,getParsedUrl:()=>fc(new URL(e.currentUrl)),getRelativeUrl:()=>yc(e.currentUrl,a),getExternalBaseUrl:()=>a,pushUrl:gc}}var xc=Fr(`@wix/site-service-business-logger`);function Sc(e){return{evid:32,src:16,endpoint:``,params:e}}function Cc(e){return{evid:33,src:16,endpoint:``,params:e}}function wc(e){return{evid:34,src:16,endpoint:``,params:e}}var Tc={SERVICES:`services_context`,SERVICE:`service_context`,TIME_SLOTS:`time_slots_context`,BOOKING_CHECKOUT:`booking_checkout_context`,CATEGORIES:`categories_context`,LOCATIONS:`locations_context`,SERVICE_ADD_ONS:`service_addons_context`,PREFERENCES:`preferences_context`};Gr.BOOK_ONLINE;var Ec=`new_bookings_server`,Dc={LOAD:`load`,LOCATION_CHOSEN:`location chosen`,STAFF_CHOSEN:`staff chosen`,VARIANT_SELECTED:`variant selected`,ADD_ON_SELECTED:`add on selected`,ADD_ON_UNSELECTED:`add on unselected`,BACK:`back`,CLOSE:`close`,STAY:`stay`,ADD_SERVICE:`add service`,EDIT_BASKET_ITEM:`edit basket item`,EDIT_BASKET_ITEM_FROM_CALENDAR:`edit basket item from calendar`,CHANGE_STAFF_MEMBER:`change staff member`,REMOVE_BASKET_ITEM:`remove basket item`,SELECT_SERVICE:`select service`,SEARCH:`search`,CLEAR_SEARCH:`clear search`},Oc={TIMEZONE_PICKER:`timezone_picker`,TIME_PICKER:`time_picker`,BOOKING_DETAILS:`booking_details`,RESCHEDULE_DIALOG:`reschedule_dialog`},kc={DROPDOWN:`dropdown`,TIME_SLOT:`time_slot`,EXPAND:`expand`,COLLAPSE:`collapse`},Ac=e=>{let{reportBi:t}=f(xc);return r(n=>{t({widget_name:e,bookingsPlatform:Ec,is_over_editor:!1,...n.params,src:n.src,evid:n.evid},{endpoint:n.endpoint})},[t,e])},jc=(e,t=!0)=>{let n=Ac(e),{getParsedUrl:r}=bc(),i=s(!1);a(()=>{t&&!i.current&&(i.current=!0,n(Sc({referralInfo:r().searchParams.get(eo.referral)??void 0})))},[t,n,r])};function Mc(e){return{evid:1177,src:16,endpoint:`wixboost-ugc`,params:e}}function Nc(e){return{evid:596,src:16,endpoint:`wixboost-ugc`,params:e}}function Pc(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).formatToParts(new Date(e)),r={};for(let e of n)e.type!==`literal`&&(r[e.type]=Number(e.value));return Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)-e}function Fc(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);if(!n)return null;let[,r,i,a,o,s,c]=n,l=Date.UTC(Number(r),Number(i)-1,Number(a),Number(o),Number(s),c?Number(c):0);if(Number.isNaN(l))return null;try{let e=l-Pc(l,t);return new Date(l-Pc(e,t))}catch{return null}}function Ic({start:e,end:t,timeZone:n,...r}){let i=e=>e&&n?Fc(e,n)?.getTime():void 0;return wc({bookingsServiceId:r.serviceId,serviceType:r.serviceType,startTime:i(e),endTime:i(t),isEligibleForFlowCompletion:r.isEligibleForFlowCompletion})}function Lc({nextAvailableSlotsCount:e,isLoading:t,hasError:n,children:r}){let i=n?`loadFailed`:null,a={selectedDate:null,daysAvailabilityRange:null,daysAvailability:[],daysAvailabilityLoading:!1,daysAvailabilityHasError:!1,timeSlotsLoading:t,timeSlotsErrorCode:i,selectDate:async()=>{},setDaysAvailabilityRange:async()=>{},nextDaysAvailabilityRange:async()=>{},previousDaysAvailabilityRange:async()=>{},goToNextAvailableDate:async()=>`cancelled`,canChangeTimeZone:!1,isMultiService:!1,hasValidSchedulingInput:!1,availabilityRequestKey:null,needsServiceChoice:!1,isRescheduling:u(!0)?.reschedule!=null,rescheduleValidUntil:null,staffFilterOptions:[],locationFilterOptions:[],selectedStaffFilter:null,requestedGender:null,genderSelectionAllowed:!1,selectedLocationFilter:null,setStaffFilter:()=>{},setLocationFilter:()=>{},isComplete:!1,isSelectionValidated:!1,timeSlots:[],isLoading:t,hasError:n,errorCode:i,businessTimeZone:null,setTimeZone:()=>{},currentTimeSlotsPage:1,hasNextTimeSlotsPage:!1,hasPreviousTimeSlotsPage:!1,nextTimeSlotsPage:async()=>{},loadUpcomingTimeSlots:async()=>{},upcomingTimeSlotsRequested:!1,previousTimeSlotsPage:()=>{},nextAvailableSlotsCount:e,timeZone:null,staffFromSlots:[],selectedResourceId:null,setSelectedResource:()=>{},canAutoAssignStaff:!1,selectedTimeSlot:null,selectTimeSlot:()=>{},navigateToBookingForm:()=>{},timeSlotLimitPerDay:null,expandedDates:new Set,daysWithMore:new Set,loadingDate:null,loadAllTimeSlotsForDay:async()=>{}};return p(Gl.Provider,{value:a,children:r})}function Rc({nextAvailableSlotsCount:e,children:t}){return p(Lc,{nextAvailableSlotsCount:e,isLoading:!0,hasError:!1,children:t})}function zc({nextAvailableSlotsCount:e,children:t}){return p(Lc,{nextAvailableSlotsCount:e,isLoading:!1,hasError:!0,children:t})}var Bc=1e3;function Vc(e,t){let n=new Map;for(let e of t){let t=e.localStartDate?.slice(0,10);t&&(e.bookable?n.set(t,`available`):n.has(t)||n.set(t,`unavailable`))}let r=[],i=Bo(e);for(let t=0;t<i;t+=1){let i=zo(e.startDate,t);r.push({date:i,availability:n.get(i)??`none`})}return r}function Hc(e,t){return{fromLocalDate:Po(e.startDate,t),toLocalDate:Mo(ko(e.endDate))}}async function Uc(e,t,n,r,i,a){return(await us({serviceId:e,...Hc(n,t),timeZone:t,...$o(r),...es(i),...ns(a,i),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(n),Bc)}})).timeSlots??[]}async function Wc(e,t,n,r,i,a){return(await fs({serviceIds:[e],...Hc(n,t),timeZone:t,includeNonBookable:!0,eventFilter:{type:`CLASS`,...ds(r,i,a)},maxSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(n),Bc)}})).timeSlots}async function Gc({serviceId:e,serviceType:t,range:n,fromDate:r,timeZone:i,locationId:a,staffId:o,customerChoices:s,minRemainingCapacity:c}){if(Za(t)||n.endDate<r)return Vc(n,[]);let l={startDate:n.startDate<r?r:n.startDate,endDate:n.endDate},u=Xa(t)?Ko(l):[l];return Vc(n,(await Promise.all(u.map(n=>Xa(t)?Wc(e,i,n,a,o,c):Uc(e,i,n,a,o,s)))).flat())}function Kc({serviceId:e,staff:t,customerChoices:n}){let r=t&&!t.anyResource?t.staffMemberId:void 0;return{serviceId:e,...ns(n,r),...t?.anyResource?{}:{includeResourceTypeIds:[Wr]},...r?{resourceTypes:[{resourceTypeId:Wr,resourceIds:[r]}]}:{}}}function qc({services:e,locationId:t,locationType:n,timeZone:r}){return{services:e.map(Kc),timeZone:r,location:{...t?{_id:t}:{},locationType:n}}}function Jc(e){let{customerChoices:t,...n}=e,r=t?ts(t):void 0;return r?{...n,customerChoices:r}:n}async function Yc(e){let t=e.services??[],n=()=>Ta({...e,services:t.map(Jc)}),r=t.some(e=>e.customerChoices?.requestedGender);if(r&&ss())return n();try{return await Ta(e)}catch(e){if(!r||!is(e))throw e;return $(e,{feature:Q.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ls(),n()}}var Xc=1e3;async function Zc({range:e,fromDate:t,...n}){if(e.endDate<t)return Vc(e,[]);let r={startDate:e.startDate<t?t:e.startDate,endDate:e.endDate};return Vc(e,(await Yc({...qc(n),fromLocalDate:Po(r.startDate,n.timeZone),toLocalDate:Mo(ko(r.endDate)),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(Bo(r),Xc)}})).timeSlots??[])}async function Qc({date:e,onlyAvailableSlots:t,fromLocalDate:n,...r}){let i=`${e}T00:00:00`,a=[],o=null,s;do{let c=await Yc({...qc(r),fromLocalDate:n&&n>i?n:i,toLocalDate:`${e}T23:59:59`,...t?{bookable:!0}:{},cursorPaging:{limit:Xc,...s?{cursor:s}:{}}});a.push(...c.timeSlots??[]),o=c.timeZone??o,s=c.cursorPagingMetadata?.cursors?.next||void 0}while(s);return{timeSlots:a,timeZone:o}}async function $c({fromDate:e,...t}){let n=await Yc({...qc(t),..._s(e),bookable:!0,cursorPaging:{limit:1}});return{timeSlots:n.timeSlots??[],timeZone:n.timeZone??null}}var el=[];function tl({enabled:e,serviceId:t,serviceType:n,multiServiceRequest:i,timeZone:l,today:u,locationId:d,staffId:f,loadInitially:p,customerChoices:m,minRemainingCapacity:h,onlyAvailableSlots:g}){let[_,v]=c(null),[y,b]=c(p),[x,S]=c(el),[C,w]=c(!1),[T,ee]=c(!1),E=s(0);a(()=>{_===null&&u&&v(Vo(u))},[_,u]),a(()=>{if(!y||!e||!(t||i)||!l||!u||!_||!i&&Za(n))return;let r=++E.current;return w(!0),(i?Zc({...i,range:_,fromDate:u,timeZone:l}):Gc({serviceId:t,serviceType:n,range:_,fromDate:u,timeZone:l,locationId:d??void 0,staffId:f??void 0,customerChoices:m,minRemainingCapacity:h})).then(e=>{r===E.current&&(S(e),ee(!1),w(!1))}).catch(e=>{r===E.current&&($(e,{feature:Q.timeSlots,action:`fetch-days-availability`,level:`warning`}),ee(!0),w(!1))}),()=>{r===E.current&&(E.current+=1)}},[y,e,t,n,i,l,u,_,d,f,m,h]);let D=r(async e=>{Ro(e)&&(v(e),b(!0))},[]),O=r(async()=>{v(e=>e&&Uo(e,1)),b(!0)},[]),te=r(async()=>{v(e=>e&&Uo(e,-1)),b(!0)},[]);return{range:_,daysAvailability:o(()=>g?x.map(e=>e.availability===`unavailable`?{...e,availability:`none`}:e):x,[x,g]),isLoading:C,hasError:T,setRange:D,nextRange:O,previousRange:te}}function nl({enabled:e,serviceId:t,serviceType:n,multiServiceRequest:i,timeZone:o,today:l,locationId:u,staffId:d,customerChoices:f,minRemainingCapacity:p,onlyAvailableSlots:m,serviceLoading:h}){let[g,_]=c(null),[v,y]=c(0),[b,x]=c(null),[S,C]=c(null),[w,T]=c(null),[ee,E]=c(!1),D=s(0),O=s(0),te=s(0),k=r(()=>{O.current+=1,E(!1)},[]);a(()=>{k()},[e,t,n,i,o,u,d,f,p,k]);let A=e&&!h&&!t&&!i;a(()=>{A&&(C(null),T(null))},[A]),a(()=>{if(!g)return;if(A){_(null);return}if(!e||!(t||i)||!o)return;if(l&&g.date<l){_(null);return}if(!i&&Za(n)){_(null);return}let r=No(new Date(Date.now()),o),a=++D.current;x(null),C(null),T(null);let s=r.slice(0,10)===g.date?r:void 0;return(i?Qc({...i,date:g.date,timeZone:o,onlyAvailableSlots:m,fromLocalDate:s}):bs({serviceId:t,serviceType:n,date:g.date,timeZone:o,onlyAvailableSlots:m,locationId:u??void 0,staffId:d??void 0,customerChoices:f,minRemainingCapacity:p,fromLocalDate:s})).then(e=>{a===D.current&&x({timeSlots:e.timeSlots,timeZone:e.timeZone??o})}).catch(e=>{a===D.current&&($(e,{feature:Q.timeSlots,action:`fetch-day-time-slots`,level:`warning`}),C(`timeSlotsLoadFailed`))}),()=>{a===D.current&&(D.current+=1)}},[g,v,e,t,h,n,i,o,l,u,d,f,p,m]);let ne=r(async e=>{!i&&Za(n)||!Lo(e)||l&&e<l||(k(),y(e=>e+1),_({kind:`day`,date:e}))},[n,i,l,k]),re=g?.date??null,j=r(async()=>{let r=!!(t||i);if(!i&&Za(n)||!e||!r||!o)return{outcome:`none`};let a=D.current,s=++O.current,c=++te.current,m=()=>a===D.current&&s===O.current;E(!0),T(null);try{let e=re??l??void 0,r=i?await $c({...i,timeZone:o,fromDate:e}):await vs({serviceId:t,serviceType:n,timeZone:o,limit:1,onlyAvailableSlots:!0,fromDate:e,locationId:u??void 0,staffId:d??void 0,customerChoices:f,minRemainingCapacity:p});if(!m())return{outcome:`cancelled`};let a=r.timeSlots[0]?.localStartDate?.slice(0,10)??null;return a?{outcome:`found`,date:a}:{outcome:`none`}}catch(e){return m()?($(e,{feature:Q.timeSlots,action:`find-next-available-date`,level:`warning`}),T(`timeSlotsLoadFailed`),{outcome:`error`}):{outcome:`cancelled`}}finally{c===te.current&&E(!1)}},[e,t,n,i,o,l,u,d,f,p,re]),ie=w??S;return{query:g,selectedDate:re,timeSlots:b?.timeSlots??null,timeZone:b?.timeZone??null,isLoading:ee||g!==null&&b===null&&S===null,error:ie,selectDate:ne,findNextAvailableDate:j}}var rl=e=>e?.type===`DATE_TIME`;function il(e){let t=e.schedule?.availabilityConstraints?.durations;if(!Ya(e.type)||!Array.isArray(t))return!1;let n=t.map(e=>typeof e==`number`?e:e?.minutes);return new Set(n).size>1}function al({service:e,multiServiceAppointmentsEnabled:t,variants:n,locationId:r}){if(!Ya(e.type))return!1;if(t||il(e)||$a(e))return!0;if(!Qa(e)||rl(n))return!1;let i=js(e,r);return r&&i!==r?!0:!Os(n,As(e),i)}function ol(e,t){return!!Pr(e)?.services.some(e=>e.serviceId===t)}function sl({blobParam:e,...t}){return!t.service._id||ol(e,t.service._id)?!1:al({...t,multiServiceAppointmentsEnabled:!1})}function cl(e){return!!e?._id}function ll(){try{return d()}catch{return null}}function ul(){let e=ll();return r(t=>{if(!e)return!1;try{let n=e(Lr).currentPage;return!n.popup&&(!n.appDefinitionId||n.appDefinitionId===`13d21c63-b5ec-5912-8397-c3a5ddb27a97`)&&n.appPageId===t}catch{return!1}},[e])}function dl(e){let{service:t,isLoading:n,hasError:r,bookingsSettingsLoading:i,isLoadingServiceOptionsAndVariants:o,pricingOption:c,multiServiceAppointmentsEnabled:l,isMultiServiceAppointment:d,reschedule:f,selection:p,openPreferences:m,editingSurface:h}=u(),{searchParams:g}=bc(),_=ul(),v=Ac(Tc.PREFERENCES),y=s(!1),b=e&&!h&&!n&&!r&&!i&&!o&&f==null&&!d&&cl(t),x=p.locationId??void 0,S=g.get(eo.blob);a(()=>{!y.current&&b&&(y.current=!0,_(Gr.CALENDAR_PAGE)&&sl({service:t,multiServiceAppointmentsEnabled:l,variants:c,locationId:x,blobParam:S})&&(Do({message:`Calendar opens the preferences modal`,category:`navigation`,feature:Q.timeSlots,data:{serviceId:t._id??null,serviceType:t.type??null}}),v(Mc({action:Dc.EDIT_BASKET_ITEM_FROM_CALENDAR,numberOfServices:1,isMultiFlow:l})),m().then(()=>Eo(`Preferences modal opened`,{feature:Q.timeSlots,action:`auto-open-preferences`,tags:{serviceType:t.type??`unknown`}}),e=>$(e,{feature:Q.timeSlots,action:`open-preferences-lightbox`}))))},[b,t,l,c,x,S,_,v,m])}function fl(e,t){return t===void 0?!1:!e||new Date(e).getTime()<=t}function pl({serviceId:e,serviceType:t,lastSessionEnd:n,timeZone:r,now:i,onlyAvailableSlots:a,locationId:o,staffId:s,timeSlotLimitPerDay:c,customerChoices:l,minRemainingCapacity:u}){let d={serviceId:e,onlyAvailableSlots:a,locationId:o??void 0,staffId:s??void 0,timeZone:r,fromLocalDate:No(new Date(i),r)};return Xa(t)?{...d,serviceType:`CLASS`,minRemainingCapacity:u}:Za(t)?!n||fl(n,i)?void 0:{...d,serviceType:`COURSE`,toLocalDate:No(new Date(n),r)}:{...d,serviceType:`APPOINTMENT`,toLocalDate:_s().toLocalDate,timeSlotsPerDay:c+1,customerChoices:l}}function ml({isAppointment:e,staffOnSlotCount:t,hasStaffFilter:n,hasRequestedGender:r,hasStaffPricedVariants:i,staffSelectionStrategy:a}){return e&&t>1&&!n&&!i&&(a!==`CUSTOMER_MUST_CHOOSE`||r)}function hl(e,t){return e.length?e.length===1?{anyResource:!1,staffMemberId:e[0]}:t?{anyResource:!0}:null:null}function gl(e,t,n){return t&&!t.anyResource&&e.includes(t.staffMemberId)?{isComplete:!0,resourceId:t.staffMemberId}:t?.anyResource&&n?{isComplete:!0,resourceId:void 0}:e.length<=1?{isComplete:!0,resourceId:e[0]}:{isComplete:n,resourceId:void 0}}var _l={staff:null,requestedGender:null,locationId:null};function vl({entry:e,appointmentLike:t,staffChoiceHidden:n,staffPriced:r,staffSelectionStrategy:i,genderAllowed:a,staffMemberIds:o,locationIds:s}){if(!e)return _l;let c=e.locationId&&s.includes(e.locationId)?e.locationId:null,l=t&&!n?oo(e):null;if(!l)return{..._l,locationId:c};if(!l.anyResource)return o.includes(l.staffMemberId)?{staff:l,requestedGender:null,locationId:c}:{..._l,locationId:c};let u=a?e.requestedGender??null:null;return o.length>1&&!r&&(i!==`CUSTOMER_MUST_CHOOSE`||u!==null)?{staff:l,requestedGender:u,locationId:c}:{..._l,locationId:c}}var yl=[];function bl({sessions:e,dayQuery:t,daySlots:n,staffFilter:r,appointmentLike:i,limitPerDay:a,expandedDates:o}){let s=kl(Al(e,r)),c=n?Al(i?Qo(n):n,r):yl;return{rows:t?c:jl(s,a,o),slotIdOf:t?Yo:Zo,daysWithMore:Ol(s,a,o)}}function xl({rows:e,slotIdOf:t},n){return[...e.filter(e=>t(e)===n)].sort((e,t)=>Dl(t)-Dl(e))[0]??null}function Sl(e,t,n,r){return{slotId:n(e),slotStartTime:e.localStartDate??null,slotEndTime:e.localEndDate??null,bookable:e.bookable??!1,tooEarlyToBook:e.bookingPolicyViolations?.tooEarlyToBook??!1,tooLateToBook:e.bookingPolicyViolations?.tooLateToBook??!1,totalCapacity:e.totalCapacity??null,remainingCapacity:e.remainingCapacity??null,bookableCapacity:e.bookableCapacity??null,eventId:e.eventInfo?.eventId??null,eventTitle:e.eventInfo?.eventTitle??null,waitlistCapacity:e.eventInfo?.waitingList?.remainingCapacity??null,locationId:e.location?._id??null,locationName:e.location?.name||e.location?.formattedAddress||null,durationMinutes:El(e,t),isAllDay:e.allDay??!1,staff:r?[]:Cl(e)}}function Cl(e){let t=new Map;for(let n of e.availableResources??[])if(n.resourceTypeId===`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`)for(let e of n.resources??[])e._id&&!t.has(e._id)&&t.set(e._id,e.name??``);return[...t].map(([e,t])=>({staffMemberId:e,name:t}))}function wl(e){let t=Cl(e);if(t.length)return t.length===1?t[0].staffMemberId:null}function Tl(e){return Cl(e).map(e=>e.staffMemberId)}function El(e,t){if(!e.localStartDate||!e.localEndDate)return null;let n=e.allDay?`UTC`:t??`UTC`,r=Fc(e.localStartDate,n),i=Fc(e.localEndDate,n);return!r||!i||i<r?null:Math.round((i.getTime()-r.getTime())/6e4)}function Dl(e){let t=e.bookableCapacity??e.remainingCapacity;return(e.eventInfo?.waitingList?.remainingCapacity??0)>0&&(t??0)<=0?1:e.bookable?2:0}function Ol(e,t,n){let r=new Map;for(let t of e){let e=(t.localStartDate??``).slice(0,10);r.set(e,(r.get(e)??0)+1)}return new Set([...r].filter(([e,r])=>r>t&&!n.has(e)).map(([e])=>e))}function kl(e){return e.flatMap(e=>{let t=e.availableResources?.find(e=>e.resourceTypeId===Wr),n=t?.resources??[];return n.length<=1?[e]:n.map(n=>({...e,availableResources:[{...t,resources:[n]}]}))})}function Al(e,t){return t?e.map(e=>({...e,availableResources:e.availableResources?.map(e=>e.resourceTypeId===`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`?{...e,resources:e.resources?.filter(e=>e._id===t)}:e)})):e}function jl(e,t,n){let r=new Map;return e.filter(e=>{let i=(e.localStartDate??``).slice(0,10);if(n.has(i))return!0;let a=r.get(i)??0;return r.set(i,a+1),a<t})}async function Ml(){try{return await Jo()}catch(e){return $(e,{feature:Q.timeSlots,action:`fetch-business-time-zone`,level:`warning`}),{businessTimeZone:null,staffSelectionStrategy:void 0,allowGenderSelection:!1}}}function Nl(e){return Qs({key:Vs(),warmupData:e,fetchData:Ml})}function Pl(e){return(e.localStartDate??``).slice(0,10)}var Fl=[];function Il(e,t){let{serviceId:n=``,serviceType:r=`CLASS`,fromLocalDate:i=``,toLocalDate:o,timeZone:l,locationId:u,staffId:d,onlyAvailableSlots:f=!1,customerChoices:p,minRemainingCapacity:m,timeSlotsPerDay:h}=t??{},[g,_]=c([]),[v,y]=c([]),[b,x]=c(1),[S,C]=c(!!n),[w,T]=c(null),[ee,E]=c(null),[D,O]=c(new Set),[te,k]=c(null),A=s(null),ne=s(null);a(()=>{if(_([]),y([]),x(1),E(null),T(null),O(new Set),k(null),C(!!n),!n)return;let t=!1,a=!1,s=[],c=[];async function g(g){if(t||a)return;if(s[g-1]){T(null),x(g);return}let v=g===1?void 0:c[g-2];if(g===1||v){a=!0,T(null),C(!0);try{let a=[],b=null,S=v??void 0,C=new Set;do{S&&C.add(S);let s=await ps({serviceId:n,serviceType:r,fromLocalDate:i,toLocalDate:o,timeZone:l,locationId:u,staffId:d,onlyAvailableSlots:f,customerChoices:p,minRemainingCapacity:m,timeSlotsPerDay:h,limit:e,cursor:S});if(t)return;if(a.push(...s.timeSlots),b=s.nextCursor,b&&C.has(b))throw Error(`The session API repeated a page cursor`);S=b??void 0,E(s.timeZone??l??null)}while(a.length===0&&b!==null);s=[...s,a],c=[...c,b],_(s),y(c),(g===1||a.length>0)&&x(g)}catch(e){if(t)return;$(e,{feature:Q.sessions,action:`fetch-page`}),T(e instanceof Error?e.message:`Failed to load sessions`)}finally{a=!1,t||C(!1)}}}async function v(e){if(!(t||a)){if(h==null){O(t=>new Set([...t,e]));return}a=!0,k(e),T(null);try{let a=await bs({serviceId:n,serviceType:r,date:e,timeZone:l,onlyAvailableSlots:f,locationId:u,staffId:d,customerChoices:p,minRemainingCapacity:m,fromLocalDate:i,toLocalDate:o});if(t)return;let c=a.timeSlots.filter(t=>Pl(t)===e),h=Math.max(0,s.findIndex(t=>t.some(t=>Pl(t)===e)));s=s.map((t,n)=>{let r=t.filter(t=>Pl(t)!==e);return n===h?[...r,...c]:r}),_(s),O(t=>new Set([...t,e]))}catch(e){if(t)return;$(e,{feature:Q.sessions,action:`fetch-day`}),T(e instanceof Error?e.message:`Failed to load sessions`)}finally{a=!1,t||k(null)}}}return A.current=g,ne.current=v,g(1),()=>{t=!0,A.current=null,ne.current=null}},[n,r,i,o,l,u,d,f,p,m,h,e]);let re=[...g[b-1]??Fl].sort((e,t)=>(e.localStartDate??``).localeCompare(t.localStartDate??``)),j=g[b],ie=j?j.length>0:v[b-1]!=null,M=b>1;async function ae(){ie&&!S&&await A.current?.(b+1)}function oe(){M&&!S&&A.current?.(b-1)}async function se(e){S||te!==null||D.has(e)||await ne.current?.(e)}return{isLoadingPage:S,firstPageSettled:g.length>0||w!==null,error:w,timeZone:ee,sessions:re,pageSize:e,currentPage:b,hasNextPage:ie,hasPreviousPage:M,nextPage:ae,previousPage:oe,expandedDates:D,loadingDate:te,loadAllSessionsForDay:se}}var Ll=e=>e?.onlineBooking?.enabled===!0;function Rl(e,t){return e?e.anyResource?t??``:e.staffMemberId:null}var zl=[],Bl=[],Vl=cn.map(e=>({id:e,gender:e})),Hl={isSelectionValidated:!1},Ul=()=>{},Wl=async()=>{},Gl=n(null);function Kl(){let e=i(Gl);if(!e)throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);return e}function ql(e,t,n){e?t():n()}var Jl={loginRequired:`rescheduleLoginRequired`,notFound:`rescheduleNotFound`,accessDenied:`rescheduleAccessDenied`,failed:`rescheduleNotFound`,wrongService:`rescheduleNotFound`,notReschedulable:`rescheduleNotReschedulable`};function Yl(e=3){return Math.min(Math.max(e,1),lc)}function Xl(e){let{isLoading:n,bookingsSettingsLoading:r}=u();jc(Tc.TIME_SLOTS,!n&&!r);let i=Rs(),[a]=c(()=>Nl(i));return p(cc,{children:p(t,{fallback:p(Rc,{nextAvailableSlotsCount:Yl(e.nextAvailableSlotsCount),children:e.children}),children:p(Ql,{...e,configurationPromise:a})})})}function Zl(e){let[t,n]=c({serviceId:e,key:0});return e!==t.serviceId&&n({serviceId:e,key:t.serviceId?t.key+1:t.key}),t.key}function Ql({onlyAvailableSlots:e=!0,nextAvailableSlotsCount:t=3,loadDaysAvailabilityInitially:n=!1,timeSlotLimitPerDay:r=100,configurationPromise:i,children:o}){let s=ic().isLoading,{searchParams:d}=bc(),{reschedule:f}=u(),[m]=c(()=>({locationId:d.get(eo.location),staffId:d.get(eo.resource),timeZone:(f?void 0:Pr(d.get(eo.blob))?.timezone)??d.get(eo.timezone)})),[h,g]=c(m.timeZone),_=Yl(t),[v,y]=c(!1);a(()=>y(!0),[]);let b=v&&!s;dl(b);let x=Ns(i),S=l(cs,ss,()=>!1),{serviceId:C}=u(),w=Zl(C),T=Number.isFinite(r)?Math.max(1,Math.floor(r)):100;return p(uc,{fallback:p(zc,{nextAvailableSlotsCount:_,children:o}),feature:Q.timeSlots,children:p($l,{onlyAvailableSlots:e,selectedTimeZone:h,setSelectedTimeZone:g,enabled:b,nextAvailableSlotsCount:_,loadDaysAvailabilityInitially:n,timeSlotLimitPerDay:T,landingLocationId:m.locationId,landingStaffId:m.staffId,businessTimeZone:x.businessTimeZone,staffSelectionStrategy:x.staffSelectionStrategy,allowGenderSelection:x.allowGenderSelection,requestedGenderRejected:S,children:o})},w)}function $l({onlyAvailableSlots:e,selectedTimeZone:t,setSelectedTimeZone:n,enabled:i,nextAvailableSlotsCount:l,loadDaysAvailabilityInitially:d,timeSlotLimitPerDay:f,landingLocationId:m,landingStaffId:h,businessTimeZone:g,staffSelectionStrategy:_,allowGenderSelection:v,requestedGenderRejected:y,children:b}){let{service:x,serviceId:S,serviceType:C,setSlot:w,clearSlot:T,setMultiServiceSlot:ee,clearMultiServiceSlot:E,draftRevision:D,navigateToMultiServiceForm:O,selection:te,selectStaffMember:k,clearSelection:A,clearStaffMember:ne,withSelectionParam:re,staffMembers:j,serviceOptionsAndVariants:ie,isLoading:M,hasError:ae,multiServiceAppointmentServices:oe=Bl,reschedule:se}=u(),N=se!=null,ce=N&&se.status!==`ready`,le=N&&se.status===`loading`,ue=N?Jl[se.status]:void 0,de=ce?null:se?.booking??null,fe=de?se.validUntil:null,pe=cl(x)&&!Ll(x),P=pe||ce?null:S,me=bc(),he=N?null:me.searchParams.get(eo.blob),ge=o(()=>io(Pr(he)),[he]),F=!S&&!M&&!ae&&(ge.valid||ge.reason!==`too-few-services`),_e=F&&ge.valid&&oe.some(e=>!Ll(e)&&ge.services.some(t=>t.serviceId===e._id)),ve=pe||_e,ye=F&&ge.valid&&!_e?ge.requestKey:null,be=o(()=>ye&&ge.valid?{services:ge.services,locationId:ge.locationId,locationType:ge.locationType}:null,[ye]),xe=!!P||be!==null,Se=P||ye,Ce=i&&!M&&!ae&&!xe&&!le,we=oc(),Te=ic(),{navigate:Ee,resolvePath:De}=go(),[Oe,ke]=c(null),[Ae,je]=c(!1),Me=s([]),Ne=s(!1),Pe=r(()=>(je(!0),Ne.current?Promise.resolve():new Promise(e=>{Me.current.push(e)})),[]),Fe=i?Intl.DateTimeFormat().resolvedOptions().timeZone:null,Ie=Ja(x),Le=s(null),Re=oo(te),ze=s(Re);ze.current=Re;let Be=Re&&!Re.anyResource?Re.staffMemberId:null,Ve=te.requestedGender??null,I=!Xa(C)&&!Za(C),He=I&&!F&&Ss(ie),L=F||I&&_===`CUSTOMER_CANNOT_CHOOSE`,Ue=_!==void 0,We=qo({allowGenderSelection:v,staffSelectionStrategy:_??null})&&I&&!F&&!He,Ge=We&&!y,Ke=o(()=>P?Pr(he)?.services.find(e=>e.serviceId===P)??null:null,[he,P]),qe=(j??[]).map(e=>e.staffMemberId).join(`,`),Je=Ie.map(e=>e.id).join(`,`),Ye=o(()=>vl({entry:Ke,appointmentLike:I,staffChoiceHidden:L,staffPriced:He,staffSelectionStrategy:_,genderAllowed:Ge,staffMemberIds:qe.split(`,`),locationIds:Je.split(`,`)}),[Ke,I,L,He,_,Ge,qe,Je]),R=Ye.staff,Xe=Ye.locationId,Ze=L||R!==null,[Qe,$e]=c(null),[et,tt]=c(m!==null||N),z=o(()=>x?As(x):[],[x]),nt=R&&!R.anyResource?R.staffMemberId:null,rt=o(()=>{if(!nt)return z;let e=z.find(e=>e.staffMemberId===nt);return e?[e]:z},[z,nt]),it=de?.locationId??null,at=o(()=>{let e=ks(Ie,rt);return!it||e.some(e=>e.id===it)?e:Ie.filter(t=>t.id===it||e.some(e=>e.id===t.id))},[x,rt,it]),ot=e=>!!e&&at.some(t=>t.id===e),st=Qe??(et?ot(it)?it:m:null),ct=Ie.length>1&&at.length===1?at[0].id:null,B=Xe??(ot(st)?st:ct),lt=o(()=>Xe?[]:at.map(e=>({id:e.id,name:e.label})),[at,Xe]),ut=o(()=>new Map(z.map(e=>[e.staffMemberId,e.locationCoverage])),[z]),dt=r((e,t)=>Es([{staffMemberId:e,locationCoverage:ut.get(e)}],t).length===1,[ut]),ft=o(()=>Ze?[]:(j??[]).filter(e=>e.name).map(e=>({id:e.staffMemberId,name:e.name??``,gender:null})),[j,Ze]),pt=o(()=>B?ft.filter(e=>dt(e.id,B)):ft,[ft,B,dt]),mt=I&&!Ue?zl:pt,ht=I&&!Ue?0:ft.length,gt=Ge&&ht>1,_t=o(()=>gt?[...Vl,...mt]:mt,[gt,mt]),[vt,yt]=c(null),[bt,xt]=c(h!==null);bt&&h!==null&&B!==null&&!dt(h,B)&&xt(!1);let St=vt??(bt?h:null),V=R?R.anyResource?null:R.staffMemberId:St!==null&&pt.some(e=>e.id===St)?St:null,Ct=Re?.anyResource?Ve:null,[wt,Tt]=c(Ct),[Et,Dt]=c(Ct);!y&&Re?.anyResource&&Ve!==Et&&(Dt(Ve),Tt(Ve));let Ot=R?Ye.requestedGender:We&&ht>1&&V===null?wt:null,kt=y?null:Ot,At=r(e=>{ze.current=e,e?e.anyResource?A(kt??void 0):k(e.staffMemberId):ne()},[ne,A,k,kt]),jt=r(e=>At(e?{anyResource:!1,staffMemberId:e}:{anyResource:!0}),[At]),Mt=(de?.addOnIds??[]).filter(e=>x?.addOnGroups?.some(t=>t.addOnIds?.includes(e))),Nt=de&&Xa(C)?de.participants:null,Pt=I?to(te):null,{addOnIds:Ft,...It}=Pt??{},Lt=I&&de?Mt.length?{...It,addOnIds:Mt}:It:Pt,Rt=Lt?ts(Lt):void 0,zt=JSON.stringify(Ot?{...Rt,requestedGender:{gender:Ot}}:Rt??null),Bt=o(()=>JSON.parse(zt),[zt]),Vt=R?.anyResource===!0,Ht=r(e=>Vt||_!==void 0&&ml({isAppointment:I,staffOnSlotCount:e,hasStaffFilter:V!==null,hasRequestedGender:kt!==null,hasStaffPricedVariants:He,staffSelectionStrategy:_}),[Vt,I,_,V,kt,He]),Ut=r(e=>R??(L?null:e),[R,L]),Wt=r(e=>{let t=e===null?null:_t.find(t=>t.id===e);t!==void 0&&(xt(!1),yt(t&&!t.gender?t.id:null),Tt(t?.gender??null))},[_t]),Gt=r(e=>{(e===null||at.some(t=>t.id===e))&&(tt(!1),$e(e),St!==null&&e!==null&&!dt(St,e)&&(yt(null),xt(!1)))},[at,St,dt]),Kt=!!(i&&!Te.isLoading&&Te.displayTimeZonePolicy.customerCanChange&&g&&Fe&&g!==Fe),H=i?Kt&&t&&(t===g||t===Fe)?t:we??g??Fe:null,qt=r(e=>{Kt&&(e===g||e===Fe)&&n(e)},[Kt,g,Fe,n]),Jt=o(()=>i&&!M&&xe?Date.now():void 0,[i,M,P,be,H]),Yt=Jt!==void 0&&H?Ao(new Date(Jt),H):null,{range:Xt,daysAvailability:Zt,isLoading:Qt,hasError:$t,setRange:en,nextRange:tn,previousRange:nn}=tl({enabled:i,serviceId:P,serviceType:C,multiServiceRequest:be,timeZone:H,today:Yt,locationId:B,staffId:V,customerChoices:Bt,minRemainingCapacity:Nt,loadInitially:d,onlyAvailableSlots:e}),rn=fe?.slice(0,10)??null,an=o(()=>rn?Zt.map(e=>e.date>rn?{...e,availability:`none`}:e):Zt,[Zt,rn]),on=fe&&H?No(new Date(fe),H):null,{query:U,selectedDate:sn,timeSlots:cn,isLoading:ln,error:un,selectDate:dn,findNextAvailableDate:fn}=nl({enabled:i,serviceId:P,serviceType:C,multiServiceRequest:be,timeZone:H,today:Yt,locationId:B,staffId:V,customerChoices:Bt,minRemainingCapacity:Nt,onlyAvailableSlots:e,serviceLoading:M}),pn=s(!0),mn=s(null);a(()=>{if(pn.current){pn.current=!1;return}ke(null),Le.current&&ql(P,T,E),Le.current=null,mn.current=null},[U,be,H,B,V,Bt,Nt,e,l,f,D]);let hn=r(async()=>{let e=await fn();return e.outcome===`found`?rn&&e.date>rn?`none`:(await Promise.all([dn(e.date),Xt&&Wo(e.date,Xt)?Promise.resolve():en(Vo(e.date))]),`found`):e.outcome},[fn,rn,dn,Xt,en]),gn=!!(i&&!M&&xe&&H&&Yt),W=i&&!M&&!xe,[_n,vn]=c(!1),[yn,bn]=c(0),xn=s(!1),Sn=s([]),Cn=s(0),wn=r(()=>{vn(!1);let e=Sn.current;return Sn.current=[],e},[]),Tn=r(()=>{Cn.current+=1,wn().forEach(e=>e(`cancelled`))},[wn]),En=r(e=>(Tn(),dn(e)),[Tn,dn]),Dn=r(e=>{let t=Cn.current;xn.current=!0,hn().then(n=>{xn.current=!1,n===`cancelled`&&t===Cn.current?(Sn.current.unshift(...e),vn(!0)):e.forEach(e=>e(n)),bn(e=>e+1)})},[hn]),On=r(()=>W?Promise.resolve(`none`):new Promise(e=>{if(gn&&!xn.current){Dn([...wn(),e]);return}Sn.current.push(e),vn(!0)}),[W,gn,Dn,wn]);a(()=>{if(_n&&!xn.current){if(W){wn().forEach(e=>e(`none`));return}gn&&Dn(wn())}},[_n,yn,gn,W,Dn,wn]);let kn=x?.schedule?.lastSessionEnd,An=I||Xa(C)||Za(C)&&!fl(kn,Jt),jn=!!(Ae&&i&&!M&&P&&H&&Jt!==void 0),Mn=jn&&P&&H&&Jt!==void 0?pl({serviceId:P,serviceType:C,lastSessionEnd:kn,timeZone:H,now:Jt,onlyAvailableSlots:e,locationId:B,staffId:V,timeSlotLimitPerDay:f,customerChoices:Bt,minRemainingCapacity:Nt}):void 0,G=Il(l,Mn),Nn=Ae&&P&&An&&!(Ae&&P&&An&&(!i||M))&&!H,Pn=ve?`onlineBookingOff`:ue??(G.error===null?Nn?`timeZoneMissing`:null:`upcomingSlotsLoadFailed`),Fn=U!==null,In=o(()=>bl({sessions:G.sessions,dayQuery:Fn,daySlots:cn,staffFilter:V,appointmentLike:I,limitPerDay:f,expandedDates:G.expandedDates}),[G.sessions,Fn,cn,V,I,f,G.expandedDates]),{slotIdOf:Ln}=In,Rn=Ae&&(Mn?G.firstPageSettled:jn||i&&!M&&!P||Nn);Ne.current=Rn,a(()=>{if(!Rn)return;let e=Me.current;Me.current=[],e.forEach(e=>e())},[Rn]);let zn=Ae&&!Rn||G.isLoadingPage,Bn=Pn!==null,Vn=U?ln:zn||ln||!i||xe&&!H||_n||le,Hn=U?un:un??Pn,Un=U?un!==null:Bn||un!==null,K=Ac(Tc.TIME_SLOTS),Wn=s(!1),Gn=r((e,t)=>{if(!t.bookable){mn.current=null;return}if(e===mn.current)return;mn.current=e;let n=P??t.serviceId??t.nestedTimeSlots?.[0]?.serviceId??void 0,r=C??oe.find(e=>e._id===n)?.type??void 0;!Wn.current&&!N&&K(Cc({bookingsServiceId:n,serviceType:r,isEligibleForFlowCompletion:!0})),Wn.current=!0,K(Nc({component:Oc.TIME_PICKER,element:kc.TIME_SLOT,properties:JSON.stringify({selectedTime:t.localStartDate})}))},[K,P,C,oe,N]),Kn=r(e=>{if(e===null){let e=Le.current!==null;Le.current=null,mn.current=null,ke(null),e&&ql(P,T,E);return}let t=xl(In,e);if(!t)return;if(F){if(!ee(t.nestedTimeSlots??[],H??void 0))return;Le.current=t,ke(t),Gn(e,t);return}Le.current=t,ke(t),Gn(e,t);let n=Tl(t);if(w(xs(t),{staffId:I?void 0:wl(t),timezone:H??void 0,bookable:t.bookable,staffChoiceRequired:I&&Ue&&!L&&n.length>1&&!Ht(n.length),rescheduleStaffId:I&&(_!==`CUSTOMER_MAY_CHOOSE`||!Ht(n.length))?n[0]:void 0}),!I)return;let r=ze.current,i;i=R||(V&&n.includes(V)?{anyResource:!1,staffMemberId:V}:kt!==null&&Ht(n.length)?{anyResource:!0}:hl(n,Ue&&Ht(n.length))),Rl(i,kt)!==Rl(r,Ve)&&At(i)},[F,P,T,E,ee,w,In,Gn,H,I,Ue,_,Ht,R,V,kt,Ve,At]),qn=r(()=>{let e=Le.current;if(!e||N)return;if(F){O(K);return}if(!P)return;let t;if(I){let n=Tl(e),r=gl(n,Ut(ze.current),Ht(n.length));t=(r.isComplete?r.resourceId:n[0])??(n.length?null:void 0)}let n=De(`bookingForm`,{slug:x?.mainSlug?.name??null,serviceId:P});e.bookable&&K(Ic({serviceId:P,serviceType:C??void 0,start:e.localStartDate,end:e.localEndDate,timeZone:H??void 0,isEligibleForFlowCompletion:!!n})),n&&Ee(re(n,{handoff:!0,staffId:t}))},[K,F,O,H,P,C,x,I,Ut,Ht,Ee,De,re,N]),Jn=Oe?Tl(Oe):null,Yn=Jn?F||!I||gl(Jn,Ut(Re),Ht(Jn.length)).isComplete:!1,Xn=Jn?Ht(Jn.length):!1,Zn=o(()=>!Oe||Ze?[]:Cl(Oe).map(e=>({staffMemberId:e.staffMemberId,name:e.name||null,image:null,isSelected:e.staffMemberId===Be})),[Oe,Ze,Be]),Qn=o(()=>({...Hl,isMultiService:F,hasValidSchedulingInput:xe,availabilityRequestKey:Se,needsServiceChoice:Ce,isRescheduling:N,rescheduleValidUntil:on,businessTimeZone:g,canChangeTimeZone:Kt,setTimeZone:qt,locationFilterOptions:lt,selectedLocationFilter:B,setLocationFilter:Gt,staffFilterOptions:_t,selectedStaffFilter:V,setStaffFilter:Wt,requestedGender:kt,genderSelectionAllowed:Ge,currentTimeSlotsPage:U?1:G.currentPage,hasNextTimeSlotsPage:!U&&G.hasNextPage,hasPreviousTimeSlotsPage:!U&&G.hasPreviousPage,nextTimeSlotsPage:U?Wl:G.nextPage,loadUpcomingTimeSlots:Pe,upcomingTimeSlotsRequested:Ae,previousTimeSlotsPage:U?Ul:G.previousPage,timeSlots:In.rows.map(e=>Sl(e,H,Ln,L)),isLoading:Vn,hasError:Un,errorCode:Hn,selectedDate:sn,daysAvailabilityRange:Xt,daysAvailability:an,daysAvailabilityLoading:Qt,daysAvailabilityHasError:$t,timeSlotsLoading:Vn,timeSlotsErrorCode:Hn,selectDate:En,setDaysAvailabilityRange:en,nextDaysAvailabilityRange:tn,previousDaysAvailabilityRange:nn,goToNextAvailableDate:On,nextAvailableSlotsCount:l,timeZone:H,staffFromSlots:Zn,selectedResourceId:Be,setSelectedResource:jt,canAutoAssignStaff:Xn,isComplete:Yn,selectedTimeSlot:Oe?Sl(Oe,H,Ln,L):null,selectTimeSlot:Kn,navigateToBookingForm:qn,timeSlotLimitPerDay:f,expandedDates:G.expandedDates,daysWithMore:In.daysWithMore,loadingDate:G.loadingDate,loadAllTimeSlotsForDay:G.loadAllSessionsForDay}),[F,xe,Se,Ce,N,on,g,H,Kt,qt,G,Pe,Ae,lt,B,Gt,_t,V,Wt,kt,Ge,U,Vn,Hn,Un,In,sn,Xt,an,Qt,$t,En,en,tn,nn,On,l,Zn,Be,jt,Xn,Yn,Oe,Kn,qn,f,Ln,L]);return p(Gl.Provider,{value:Qn,children:b})}var eu=sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);export{Xl as default,eu as injectAccessTokenGetter,Gl as timeSlotsContext,Kl as useTimeSlotsContext};
|
|
3
|
+
//# sourceMappingURL=context-provider-4936242d-905c-48bf-80ce-5f56d075de4f-CAY8iI7G.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/bookings",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1779",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -113,21 +113,21 @@
|
|
|
113
113
|
"@wix/auto_sdk_bookings_attribute-value": "1.0.17",
|
|
114
114
|
"@wix/auto_sdk_bookings_availability-calendar": "1.0.204",
|
|
115
115
|
"@wix/auto_sdk_bookings_availability-time-slots": "1.0.291",
|
|
116
|
-
"@wix/auto_sdk_bookings_availability-time-slots-configuration": "1.0.
|
|
116
|
+
"@wix/auto_sdk_bookings_availability-time-slots-configuration": "1.0.18",
|
|
117
117
|
"@wix/auto_sdk_bookings_booking-fees": "1.0.62",
|
|
118
118
|
"@wix/auto_sdk_bookings_booking-policies": "1.0.159",
|
|
119
119
|
"@wix/auto_sdk_bookings_booking-policy": "1.0.8",
|
|
120
120
|
"@wix/auto_sdk_bookings_booking-policy-snapshots": "1.0.60",
|
|
121
|
-
"@wix/auto_sdk_bookings_bookings": "1.0.
|
|
121
|
+
"@wix/auto_sdk_bookings_bookings": "1.0.262",
|
|
122
122
|
"@wix/auto_sdk_bookings_bookings-provisioner": "1.0.9",
|
|
123
123
|
"@wix/auto_sdk_bookings_bookings-settings": "1.0.14",
|
|
124
124
|
"@wix/auto_sdk_bookings_bookings-validation": "1.0.26",
|
|
125
|
-
"@wix/auto_sdk_bookings_catalog-search": "1.0.
|
|
125
|
+
"@wix/auto_sdk_bookings_catalog-search": "1.0.47",
|
|
126
126
|
"@wix/auto_sdk_bookings_categories": "1.0.64",
|
|
127
127
|
"@wix/auto_sdk_bookings_categories-v-2": "1.0.63",
|
|
128
128
|
"@wix/auto_sdk_bookings_display-settings": "1.0.15",
|
|
129
129
|
"@wix/auto_sdk_bookings_event-time-slots": "1.0.158",
|
|
130
|
-
"@wix/auto_sdk_bookings_extended-bookings": "1.0.
|
|
130
|
+
"@wix/auto_sdk_bookings_extended-bookings": "1.0.142",
|
|
131
131
|
"@wix/auto_sdk_bookings_external-calendars": "1.0.68",
|
|
132
132
|
"@wix/auto_sdk_bookings_multi-service-availability-time-slots": "1.0.285",
|
|
133
133
|
"@wix/auto_sdk_bookings_pricing": "1.0.117",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@wix/auto_sdk_bookings_resource-types": "1.0.89",
|
|
137
137
|
"@wix/auto_sdk_bookings_resources": "1.0.95",
|
|
138
138
|
"@wix/auto_sdk_bookings_service-options-and-variants": "1.0.99",
|
|
139
|
-
"@wix/auto_sdk_bookings_services": "1.0.
|
|
139
|
+
"@wix/auto_sdk_bookings_services": "1.0.313",
|
|
140
140
|
"@wix/auto_sdk_bookings_staff-member-settings": "1.0.28",
|
|
141
141
|
"@wix/auto_sdk_bookings_staff-members": "1.0.139",
|
|
142
142
|
"@wix/auto_sdk_bookings_staff-sorting": "1.0.12",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
"optional": true
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
|
-
"falconPackageHash": "
|
|
183
|
+
"falconPackageHash": "a8148b3987c585b3b5a81d779ee4b76e6f98a9b004321cc13830f2e5"
|
|
184
184
|
}
|