@wix/bookings 1.0.1750 → 1.0.1751
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/_sdk-exports/context-booking-checkout/runtime.js +2 -0
- package/_sdk-exports/context-categories/runtime.js +1 -0
- package/_sdk-exports/context-locations/runtime.js +1 -0
- package/_sdk-exports/{context-service-context → context-service}/runtime.d.ts +1 -1
- package/_sdk-exports/{context-service-context → context-service}/runtime.js +2 -2
- package/_sdk-exports/context-service-addons/runtime.js +1 -0
- package/_sdk-exports/context-services/runtime.js +2 -0
- package/_sdk-exports/context-time-slots/runtime.js +2 -0
- package/build/cjs/{context-booking-checkout-context.js → context-booking-checkout.js} +909 -925
- package/build/cjs/context-booking-checkout.js.map +1 -0
- package/build/cjs/{context-categories-context.js → context-categories.js} +287 -293
- package/build/cjs/context-categories.js.map +1 -0
- package/build/cjs/{context-locations-context.js → context-locations.js} +362 -368
- package/build/cjs/context-locations.js.map +1 -0
- package/build/cjs/{context-service-addons-context.js → context-service-addons.js} +424 -430
- package/build/cjs/context-service-addons.js.map +1 -0
- package/build/cjs/{context-service-context.d.ts → context-service.d.ts} +1 -1
- package/build/cjs/{context-service-context.js → context-service.js} +964 -977
- package/build/cjs/context-service.js.map +1 -0
- package/build/cjs/{context-services-context.js → context-services.js} +600 -611
- package/build/cjs/context-services.js.map +1 -0
- package/build/cjs/{context-time-slots-context.js → context-time-slots.js} +1187 -1195
- package/build/cjs/context-time-slots.js.map +1 -0
- package/build/es/{context-booking-checkout-context.mjs → context-booking-checkout.mjs} +906 -922
- package/build/es/context-booking-checkout.mjs.map +1 -0
- package/build/es/{context-categories-context.mjs → context-categories.mjs} +283 -289
- package/build/es/context-categories.mjs.map +1 -0
- package/build/es/{context-locations-context.mjs → context-locations.mjs} +358 -364
- package/build/es/context-locations.mjs.map +1 -0
- package/build/es/{context-service-addons-context.mjs → context-service-addons.mjs} +417 -423
- package/build/es/context-service-addons.mjs.map +1 -0
- package/build/{internal/cjs/context-service-context.d.ts → es/context-service.d.mts} +1 -1
- package/build/es/{context-service-context.mjs → context-service.mjs} +960 -973
- package/build/es/context-service.mjs.map +1 -0
- package/build/es/{context-services-context.mjs → context-services.mjs} +596 -607
- package/build/es/context-services.mjs.map +1 -0
- package/build/es/{context-time-slots-context.mjs → context-time-slots.mjs} +1181 -1189
- package/build/es/context-time-slots.mjs.map +1 -0
- package/build/internal/{es/context-service-context.d.mts → cjs/context-service.d.ts} +1 -1
- package/build/{es/context-service-context.d.mts → internal/es/context-service.d.mts} +1 -1
- package/context/booking-checkout/package.json +3 -0
- package/context/categories/package.json +3 -0
- package/context/locations/package.json +3 -0
- package/context/service/package.json +3 -0
- package/context/service-addons/package.json +3 -0
- package/context/services/package.json +3 -0
- package/context/time-slots/package.json +3 -0
- package/package.json +37 -37
- package/_sdk-exports/context-booking-checkout-context/runtime.js +0 -2
- package/_sdk-exports/context-categories-context/runtime.js +0 -1
- package/_sdk-exports/context-locations-context/runtime.js +0 -1
- package/_sdk-exports/context-service-addons-context/runtime.js +0 -1
- package/_sdk-exports/context-services-context/runtime.js +0 -2
- package/_sdk-exports/context-time-slots-context/runtime.js +0 -2
- package/build/cjs/context-booking-checkout-context.js.map +0 -1
- package/build/cjs/context-categories-context.js.map +0 -1
- package/build/cjs/context-locations-context.js.map +0 -1
- package/build/cjs/context-service-addons-context.js.map +0 -1
- package/build/cjs/context-service-context.js.map +0 -1
- package/build/cjs/context-services-context.js.map +0 -1
- package/build/cjs/context-time-slots-context.js.map +0 -1
- package/build/es/context-booking-checkout-context.mjs.map +0 -1
- package/build/es/context-categories-context.mjs.map +0 -1
- package/build/es/context-locations-context.mjs.map +0 -1
- package/build/es/context-service-addons-context.mjs.map +0 -1
- package/build/es/context-service-context.mjs.map +0 -1
- package/build/es/context-services-context.mjs.map +0 -1
- package/build/es/context-time-slots-context.mjs.map +0 -1
- package/context/booking-checkout-context/package.json +0 -3
- package/context/categories-context/package.json +0 -3
- package/context/locations-context/package.json +0 -3
- package/context/service-addons-context/package.json +0 -3
- package/context/service-context/package.json +0 -3
- package/context/services-context/package.json +0 -3
- package/context/time-slots-context/package.json +0 -3
- /package/_sdk-exports/{context-booking-checkout-context → context-booking-checkout}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-categories-context → context-categories}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-locations-context → context-locations}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-service-addons-context → context-service-addons}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-services-context → context-services}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-time-slots-context → context-time-slots}/runtime.d.ts +0 -0
- /package/build/cjs/{context-booking-checkout-context.d.ts → context-booking-checkout.d.ts} +0 -0
- /package/build/cjs/{context-categories-context.d.ts → context-categories.d.ts} +0 -0
- /package/build/cjs/{context-locations-context.d.ts → context-locations.d.ts} +0 -0
- /package/build/cjs/{context-service-addons-context.d.ts → context-service-addons.d.ts} +0 -0
- /package/build/cjs/{context-services-context.d.ts → context-services.d.ts} +0 -0
- /package/build/cjs/{context-time-slots-context.d.ts → context-time-slots.d.ts} +0 -0
- /package/build/es/{context-booking-checkout-context.d.mts → context-booking-checkout.d.mts} +0 -0
- /package/build/es/{context-categories-context.d.mts → context-categories.d.mts} +0 -0
- /package/build/es/{context-locations-context.d.mts → context-locations.d.mts} +0 -0
- /package/build/es/{context-service-addons-context.d.mts → context-service-addons.d.mts} +0 -0
- /package/build/es/{context-services-context.d.mts → context-services.d.mts} +0 -0
- /package/build/es/{context-time-slots-context.d.mts → context-time-slots.d.mts} +0 -0
- /package/build/internal/cjs/{context-booking-checkout-context.d.ts → context-booking-checkout.d.ts} +0 -0
- /package/build/internal/cjs/{context-categories-context.d.ts → context-categories.d.ts} +0 -0
- /package/build/internal/cjs/{context-locations-context.d.ts → context-locations.d.ts} +0 -0
- /package/build/internal/cjs/{context-service-addons-context.d.ts → context-service-addons.d.ts} +0 -0
- /package/build/internal/cjs/{context-services-context.d.ts → context-services.d.ts} +0 -0
- /package/build/internal/cjs/{context-time-slots-context.d.ts → context-time-slots.d.ts} +0 -0
- /package/build/internal/es/{context-booking-checkout-context.d.mts → context-booking-checkout.d.mts} +0 -0
- /package/build/internal/es/{context-categories-context.d.mts → context-categories.d.mts} +0 -0
- /package/build/internal/es/{context-locations-context.d.mts → context-locations.d.mts} +0 -0
- /package/build/internal/es/{context-service-addons-context.d.mts → context-service-addons.d.mts} +0 -0
- /package/build/internal/es/{context-services-context.d.mts → context-services.d.mts} +0 -0
- /package/build/internal/es/{context-time-slots-context.d.mts → context-time-slots.d.mts} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
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??{}),N=e=>`applicationError`in(e.response?.data?.details??{}),oe=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function P(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(ae(e))return se(e,t,n);if(N(e))return le(e);if(oe(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 ce(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return ue(e)}var se=(e,t,n)=>{let r=e.response?.data,i=e.requestId,{fieldViolations:a}=r.details.validationError,o=de(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 ce(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},ce=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),le=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 ce(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},ue=e=>ce(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}}}),de=({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:fe(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,fe(t,i))}}return n?{...e,field:`${i[0]}.${e.field}`}:e})},fe=(e,t)=>{let n=F(e);return n==null?e:e.replace(`$[${n}]`,t[n])},F=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function pe(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=he(s.status,e?.message??s.statusText,e?.details,{requestId:s.headers.get(`X-Wix-Request-Id`),details:e}),n=P(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 me=class extends Error{response;requestId;constructor(e){super(),this.response=e.response,this.requestId=e.requestId}},he=(e,t,n,r)=>new me({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:r}},...n},message:t},status:e},requestId:r?.requestId}),I=`.`;function ge(e,t,n){if(e==null)throw Error(`Cannot set value on null or undefined`);let r=_e(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 _e(e){return Array.isArray(e)?e:e.split(I).map(e=>ve(e)?Number(e):e)}function ve(e){return/^\d+$/.test(e)}function ye(e){let t={};for(let[n,r]of Object.entries(e))be(n)||ge(t,_e(n),r);return t}function be(e){return e===`__proto__`||e===`constructor`||e===`prototype`}var xe=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])),ye(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=Te(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 Se(e,t){let n=e?.modifiedFields;if(!n)return null;let r=Ce(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=we(s,a);return c===null?null:(o.modifiedFields=c,o)}function Ce(e){if(typeof e==`object`&&e&&!Array.isArray(e))try{let t=new xe(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function we(e,t){if(typeof e==`object`&&e&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function Te(e){return e.replace(/[-_\s]+(.)?/g,(e,t)=>t?t.toUpperCase():``).replace(/^./,e=>e.toLowerCase())}function Ee(){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 De=e=>e.__type===`event-definition`;function Oe(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=Se(s,a);if(e)return t(e)}}return t(a(o))}function ke(e){let t=new Map,n=Ee();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})=>Oe(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})=>Oe(t,n,e.payload,{instanceId:e.instanceId,identity:e.identity})))},apps:{AppInstalled:h(`AppInstalled`)(),AppRemoved:h(`AppRemoved`)()}}}}var Ae=e=>e.__type===`service-plugin-definition`;function je(e){let t=new Map,n=Ee();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 Me=`X-Wix-Consistent`;function Ne(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`]?{[Me]:t[Me]}:{}},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=Pe(e);return a&&(t[Me]=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=Pe(e);return a&&(t[Me]=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}=je(i),{client:u,initModule:d}=ke(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`]?{[Me]:t[Me]}:{}}}),u=Pe(l);return u&&(t[Me]=u),l},p=(t,n)=>{if(De(t))return d(t);if(Ae(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 pe(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 Pe(e){return e.headers?.get(`X-Wix-Consistent`)??e.headers?.get(`x-wix-consistent`)}var Fe={_id:`id`,_createdDate:`createdDate`,_updatedDate:`updatedDate`},Ie={id:`_id`,createdDate:`_createdDate`,updatedDate:`_updatedDate`};function Le(e,t){return e?.split(`.`).map(e=>t?.[e]??e).join(`.`)}var Re=`sort.fieldName`;function ze(e,t,n){return(e===Re||e.endsWith(`.${Re}`))&&typeof t==`string`?Le(t,n):t}function Be(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=L(e,t);s!==e&&!(s in a)&&(a[s]=a[e],delete a[e]),a[s]=ze(o,a[s],t),i(a[s],o)})}};return i(e,``),e}function L(e,t){let n;return n=e.includes(`.`)?e.split(`.`).map(e=>t[e]??e).join(`.`):t[e]??e,n}function Ve(e,t=[]){return Be(e,Fe,t)}function R(e,t=[]){return Be(e,Ie,t)}function He(e){return e?.toISOString()}function Ue(e){return e?new Date(e):void 0}var We=new WeakMap;function Ge(){return{leaves:void 0,fields:void 0,mapFields:void 0,anyField:void 0}}function Ke(e,t){let n=e.get(t);return n||(n=Ge(),e.set(t,n)),n}function qe(e,t){return t===`*`?(e.anyField??=Ge(),e.anyField):t.endsWith(`{}`)?(e.mapFields??=new Map,Ke(e.mapFields,t.slice(0,-2))):(e.fields??=new Map,Ke(e.fields,t))}function Je(e){let t=Ge();for(let n of e){let e=n.path.split(`.`).reduce(qe,t);e.leaves??=[],e.leaves.push(n)}return t}function z(e){let t=We.get(e);return t||(t=Je(e),We.set(e,t)),t}function Ye(e){return typeof e==`object`&&!!e}function Xe(e,{isRepeated:t,isMap:n},r){return t?Array.isArray(e)?e.map(r):e:n?Ye(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,r(t)])):e:r(e)}function Ze(e,t,n){Ye(e)&&et(e,t,n)}function Qe(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]=Xe(e[r],t,n);let t=e[r];Array.isArray(t)?t.forEach(e=>Ze(e,i,n)):Ze(t,i,n)}}function $e(e,t,n){for(let[r,i]of t){let t=e[r];Ye(t)&&Object.values(t).forEach(e=>Ze(e,i,n))}}function et(e,{fields:t,mapFields:n,anyField:r},i){t&&Qe(e,t,i),n&&$e(e,n,i),r&&Object.values(e).forEach(e=>Ze(e,r,i))}function tt(e,t){if(!Ye(e))return e;for(let{paths:n,transformFn:r}of t)et(e,z(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??{}),lt=e=>`applicationError`in(e.response?.data?.details??{}),ut=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function dt(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},n=[]){if(typeof e!=`object`||!e)throw e;if(ct(e))return ft(e,t,n);if(lt(e))return mt(e);if(ut(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 pt(e,{message:JSON.stringify({message:r,details:i},null,2),extraProperties:{details:i,status:t}})}return B(e)}var ft=(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 pt(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:i}})},pt=(e,{message:t,extraProperties:n})=>Object.assign(e,{...n,message:t}),mt=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 pt(e,{message:JSON.stringify({message:s,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},B=e=>pt(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 V(e,t=!1){return bt(e,t)}function xt(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 St(e){let t=H(It(e.host),e.domainToMappings);return Kt(Ut(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 H(e,t){let n=t[e];if(n)return n;let r=Rt(e,t)??zt(e,t);if(!r){if(Vt(e)){let e=t[Ht];if(e)return e}let n=t[Dt];if(n)return n}return r??[]}function Rt(e,t){return Object.entries(t).find(([t])=>{let[,...n]=e.split(`.`);return n.join(`.`)===t})?.[1]}function zt(e,t){let[n]=Object.entries(t).filter(([t])=>Bt(e,t)).sort(([e],[t])=>t.length-e.length);if(!n)return;let[,r]=n;return r}function Bt(e,t){if(!t.startsWith(Ot))return!1;let n=t.slice(1);return e.length>n.length&&e.endsWith(n)}function Vt(e){return!!e.match(/\._base_domain_$/)}var Ht=`www._base_domain_`;function Ut(e,t){return e.split(`/`).map(e=>Wt(e,t)).join(`/`)}function Wt(e,t){let n=e.match(Nt)||[],r=n[1];return r?Gt(t,r,e,e.replace(n[0],``)):e}function Gt(e,t,n,r){let i=e;for(let e of t.split(`.`)){if(!i)return n;i=i[e]}return`${i}${r}`}function Kt(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`,U=()=>{let e=Qt(`language`),t=Qt(`locale`);if(e)return{[Jt]:[e,t||e,Xt,Yt].join(`|`)}};function Zt(){let e=null,t=null;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var Qt=e=>typeof window<`u`?window.commonConfig?.[e]:void 0,$t=({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=tn();return{...a,apiBaseUrl:o,getMonitoringClient:i?.getMonitoringClientFunction?.(n,r),essentials:{language:Qt(`language`),locale:Qt(`locale`),get passThroughHeaders(){return U()}}}},auth:e=>{let t=typeof window<`u`?window.wixEmbedsAPI:void 0;!e&&en()&&(e=t?.getAccessTokenFunction?.());let n=!1,{resolve:r,promise:i}=Zt();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 en(){return typeof document<`u`&&document.currentScript?.tagName===`SCRIPT`}function tn(){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 nn=({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:()=>{}})}),rn=$t({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:nn({clientSdk:t,applicationId:n}),close:()=>{}}}}),an=((e,t)=>{let n=rn.host({applicationId:e,componentId:t}),r=rn.auth();return Ne({auth:r,host:n}).enableContext(`module`),r.getAccessTokenInjector()})(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`),on=[`ANY_FEMALE`,`ANY_MALE`],sn=`3.7.8`,cn=sn,ln=typeof Buffer==`function`,un=typeof TextDecoder==`function`?new TextDecoder:void 0,dn=typeof TextEncoder==`function`?new TextEncoder:void 0,fn=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),pn=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(fn),mn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,W=String.fromCharCode.bind(String),hn=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),gn=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),_n=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),vn=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+=fn[t>>18&63]+fn[t>>12&63]+fn[t>>6&63]+fn[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},yn=typeof btoa==`function`?e=>btoa(e):ln?e=>Buffer.from(e,`binary`).toString(`base64`):vn,bn=ln?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 yn(n.join(``))},xn=(e,t=!1)=>t?gn(bn(e)):bn(e),Sn=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)},Cn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,G=e=>e.replace(Cn,Sn),wn=ln?e=>Buffer.from(e,`utf8`).toString(`base64`):dn?e=>bn(dn.encode(e)):e=>yn(G(e)),Tn=(e,t=!1)=>t?gn(wn(e)):wn(e),En=e=>Tn(e,!0),Dn=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,On=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))}},kn=e=>e.replace(Dn,On),An=e=>{if(e=e.replace(/\s+/g,``),!mn.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=pn[e.charAt(a++)]<<18|pn[e.charAt(a++)]<<12|(n=pn[e.charAt(a++)])<<6|(r=pn[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(``)},jn=typeof atob==`function`?e=>atob(_n(e)):ln?e=>Buffer.from(e,`base64`).toString(`binary`):An,Mn=ln?e=>hn(Buffer.from(e,`base64`)):e=>hn(jn(e).split(``).map(e=>e.charCodeAt(0))),Nn=e=>Mn(Fn(e)),Pn=ln?e=>Buffer.from(e,`base64`).toString(`utf8`):un?e=>un.decode(Mn(e)):e=>kn(jn(e)),Fn=e=>_n(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),In=e=>Pn(Fn(e)),Ln=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)},Rn=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),zn=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,Rn(t));e(`fromBase64`,function(){return In(this)}),e(`toBase64`,function(e){return Tn(this,e)}),e(`toBase64URI`,function(){return Tn(this,!0)}),e(`toBase64URL`,function(){return Tn(this,!0)}),e(`toUint8Array`,function(){return Nn(this)})},Bn=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Rn(t));e(`toBase64`,function(e){return xn(this,e)}),e(`toBase64URI`,function(){return xn(this,!0)}),e(`toBase64URL`,function(){return xn(this,!0)})},Vn={version:sn,VERSION:cn,atob:jn,atobPolyfill:An,btoa:yn,btoaPolyfill:vn,fromBase64:In,toBase64:Tn,encode:Tn,encodeURI:En,encodeURL:En,utob:G,btou:kn,decode:In,isValid:Ln,fromUint8Array:xn,toUint8Array:Nn,extendString:zn,extendUint8Array:Bn,extendBuiltins:()=>{zn(),Bn()}},K=Uint8Array,Hn=Uint16Array,Un=Int32Array,Wn=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]),Gn=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]),Kn=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qn=function(e,t){for(var n=new Hn(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Un(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}},Jn=qn(Wn,2),Yn=Jn.b,Xn=Jn.r;Yn[28]=258,Xn[258]=28;var Zn=qn(Gn,0),Qn=Zn.b;Zn.r;for(var $n=new Hn(32768),q=0;q<32768;++q){var er=(q&43690)>>1|(q&21845)<<1;er=(er&52428)>>2|(er&13107)<<2,er=(er&61680)>>4|(er&3855)<<4,$n[q]=((er&65280)>>8|(er&255)<<8)>>1}for(var tr=(function(e,t,n){for(var r=e.length,i=0,a=new Hn(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Hn(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Hn(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[$n[d]>>c]=l}else for(s=new Hn(r),i=0;i<r;++i)e[i]&&(s[i]=$n[o[e[i]-1]++]>>15-e[i]);return s}),nr=new K(288),q=0;q<144;++q)nr[q]=8;for(var q=144;q<256;++q)nr[q]=9;for(var q=256;q<280;++q)nr[q]=7;for(var q=280;q<288;++q)nr[q]=8;for(var rr=new K(32),q=0;q<32;++q)rr[q]=5;var ir=tr(nr,9,1),ar=tr(rr,5,1),or=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},J=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},sr=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},cr=function(e){return(e+7)/8|0},lr=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))},ur=[`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`],Y=function(e,t,n){var r=Error(t||ur[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Y),!n)throw r;return r},dr=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=J(e,d,1);var v=J(e,d+1,3);if(d+=3,!v){var y=cr(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Y(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=ir,m=ar,h=9,g=5;else if(v==2){var S=J(e,d,31)+257,C=J(e,d+10,15)+4,w=S+J(e,d+5,31)+1;d+=14;for(var T=new K(w),ee=new K(19),E=0;E<C;++E)ee[Kn[E]]=J(e,d+E*3,7);d+=C*3;for(var D=or(ee),O=(1<<D)-1,te=tr(ee,D,1),E=0;E<w;){var k=te[J(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+J(e,d,3),d+=2,A=T[E-1]):y==17?(ne=3+J(e,d,7),d+=3):y==18&&(ne=11+J(e,d,127),d+=7);ne--;)T[E++]=A}}var re=T.subarray(0,S),j=T.subarray(S);h=or(re),g=or(j),p=tr(re,h,1),m=tr(j,g,1)}else Y(1);if(d>_){c&&Y(0);break}}s&&l(f+131072);for(var ie=(1<<h)-1,M=(1<<g)-1,ae=d;;ae=d){var A=p[sr(e,d)&ie],N=A>>4;if(d+=A&15,d>_){c&&Y(0);break}if(A||Y(2),N<256)n[f++]=N;else if(N==256){ae=d,p=null;break}else{var oe=N-254;if(N>264){var E=N-257,P=Wn[E];oe=J(e,d,(1<<P)-1)+Yn[E],d+=P}var se=m[sr(e,d)&M],ce=se>>4;se||Y(3),d+=se&15;var j=Qn[ce];if(ce>3){var P=Gn[ce];j+=sr(e,d)&(1<<P)-1,d+=P}if(d>_){c&&Y(0);break}s&&l(f+131072);var le=f+oe;if(f<j){var ue=a-j,de=Math.min(j,le);for(ue+f<0&&Y(3);f<de;++f)n[f]=r[ue+f]}for(;f<le;++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?lr(n,0,f):n.subarray(0,f)},fr=new K(0),pr=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&Y(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)},mr=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0};function hr(e,t){var n=pr(e);return n+8>e.length&&Y(6,`invalid gzip data`),dr(e.subarray(n,-8),{i:2},t&&t.out||new K(mr(e)),t&&t.dictionary)}var gr=typeof TextDecoder<`u`&&new TextDecoder;try{gr.decode(fr,{stream:!0})}catch{}var _r=new Set([`APPOINTMENT`,`CLASS`,`COURSE`]),vr=new Set(on);function X(e){return typeof e==`string`?e:void 0}function yr(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function br(e){return typeof e==`boolean`?e:void 0}function xr(e){if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}function Sr(e){return typeof e==`object`&&!!e}function Cr(e){if(!Sr(e))return null;let t=X(e.t);if(t===void 0)return null;let n={type:t,ids:xr(e.d)??[]},r=br(e.n);return r!==void 0&&(n.anyResource=r),n}function wr(e){if(!Sr(e))return null;let t=yr(e.p),n=xr(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 Tr(e){if(!Sr(e))return null;let t=X(e.i),n=yr(e.q);return t===void 0||n===void 0?null:{id:t,quantity:n}}function Er(e,t){if(!Array.isArray(e))return;let n=e.map(t).filter(e=>e!==null);return n.length?n:void 0}function Dr(e){if(!Sr(e))return null;let t=X(e.i);if(t===void 0)return null;let n={serviceId:t},r=X(e.g);r!==void 0&&(n.slug=r);let i=function(e){let t=X(e);if(t!==void 0&&_r.has(t))return t}(e.y);i!==void 0&&(n.serviceType=i);let a=X(e.t0);a!==void 0&&(n.slotStart=a);let o=X(e.t1);o!==void 0&&(n.slotEnd=o);let s=X(e.e);s!==void 0&&(n.eventId=s);let c=X(e.c);c!==void 0&&(n.scheduleId=c);let l=X(e.k);l!==void 0&&(n.sessionId=l);let u=X(e.l);u!==void 0&&(n.locationId=u);let d=X(e.lt);d!==`BUSINESS`&&d!==`CUSTOM`&&d!==`CUSTOMER`||(n.locationType=d);let f=Er(e.r,Cr);f&&(n.resources=f);let p=Er(e.x,wr);p&&(n.selectedVariants=p);let m=Er(e.a,Tr);m&&(n.addOns=m);let h=X(e.dc);h&&(n.durationChoiceId=h);let g=yr(e.dm);g!==void 0&&Number.isInteger(g)&&g>0&&(n.durationInMinutes=g);let _=X(e.rg);return _!==void 0&&vr.has(_)&&(n.requestedGender=_),n}function Or(e){if(!Sr(e))return null;let t=X(e.m);if(t!==`single`&&t!==`multi`||!Array.isArray(e.s))return null;let n={mode:t,services:e.s.map(Dr).filter(e=>e!==null)},r=X(e.z);return r!==void 0&&(n.timezone=r),!0===br(e.cp)&&(n.wantsPromoCode=!0),n}new TextEncoder;var kr=new TextDecoder;function Ar(e){if(!e||e.length<2)return null;try{let t=e[0],n=Vn.toUint8Array(e.slice(1)),r;if(t===`1`)r=n;else{if(t!==`2`)return null;r=hr(n)}return Or(JSON.parse(kr.decode(r)))}catch{return null}}function jr(e){return e}var Mr=jr(`@wix/site-service-editor-context`),Nr=jr(`@wix/site-service-pages`),Pr=jr(`@wix/site-service-router`),Fr=jr(`@wix/site-service-url`),Ir=jr(`@wix/site-service-renderer-configuration`),Lr=`13d21c63-b5ec-5912-8397-c3a5ddb27a97`,Rr=`shopping_cart`,zr=`thank_you_page`,Br=`1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`,Vr=function(e){return e.BOOK_ONLINE=`bookingsBookOnline`,e.SERVICE_PAGE=`bookingsServicePage`,e.CALENDAR_PAGE=`bookingsCalendar`,e.FORM_PAGE=`bookingsForm`,e}({}),Hr=`{{(.*?)}}`,Ur=`[{{}}]`,Wr=`([^/]+)`,Gr;(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`})(Gr||={});var Z;(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`})(Z||={});var Kr={},qr=(Kr[Z.PRODUCT_PAGE]={variables:[`slug`],required:[`slug`]},Kr),Jr=`{{main-mapping}}`,Yr={},Xr,Zr=(Yr[Z.BLOG_POST]={variables:[`slug`],required:[`slug`],subMappings:(Xr={},Xr[Z.BLOG_POST_EDIT]={defaultMapping:`${Jr}/edit`},Xr[Z.BLOG_POST_PREVIEW]={required:[`instance`],defaultMapping:`${Jr}/preview/{{instance}}`},Xr)},Yr),Qr={},$r=(Qr[Z.BLOG_CATEGORY]={variables:[`slug`],required:[`slug`],defaultPrefix:`categories`},Qr),ei={},ti,ni,ri=(ei[Z.FORUM_POST]={variables:[`categorySlug`,`postSlug`],required:[`categorySlug`,`postSlug`],subMappings:(ti={},ti[Z.FORUM_POST_EDIT]={defaultMapping:`${Jr}/edit`},ti[Z.FORUM_POST_PAGINATION]={required:[`page`],defaultMapping:`${Jr}/p-{{page}}`},ti[Z.FORUM_POST_DEEP_LINK_DATA]={required:[`deepLinkData`],defaultMapping:`${Jr}/dl-{{deepLinkData}}`},ti[Z.FORUM_POST_PAGINATION_AND_DEEP_LINK_DATA]={required:[`page`,`deepLinkData`],defaultMapping:`${Jr}/p-{{page}}/dl-{{deepLinkData}}`},ti)},ei[Z.FORUM_CATEGORY]={variables:[`slug`],required:[`slug`],subMappings:(ni={},ni[Z.FORUM_CATEGORY_CREATE_POST]={defaultMapping:`${Jr}/create-post`},ni[Z.FORUM_CATEGORY_CREATE_QUESTION]={defaultMapping:`${Jr}/create-question`},ni[Z.FORUM_CATEGORY_PAGINATION]={required:[`page`],defaultMapping:`${Jr}/p-{{page}}`},ni)},ei),ii={},ai=(ii[Z.GROUP]={variables:[`groupId`,`tabName`],required:[`groupId`,`tabName`]},ii[Z.GROUP_POST]={variables:[`groupId`,`tabName`,`postId`],required:[`groupId`,`tabName`,`postId`]},ii),oi={},si=(oi[Z.BOOKINGS_SERVICE]={variables:[`slug`],required:[`slug`],defaultPrefix:`service-page`},oi),ci={},li=(ci[Z.CHALLENGES_PAGE]={variables:[`slug`],required:[`slug`],defaultPrefix:`challenge-page`},ci),ui={},di=(ui[Gr.product_page]=qr,ui[Gr.post]=Zr,ui[Gr.blog]=$r,ui[Gr.forum]=ri,ui[Gr.group]=ai,ui[Gr.bookings]=si,ui[Gr.challenges]=li,ui),fi=function(){return fi=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},fi.apply(this,arguments)};function pi(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 Q(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 mi(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 hi=function(e){return Object.values(gi()).some(function(t){return!!t?.subMappings?.[e]})},gi=function(){return Object.values(di).reduce(function(e,t){return fi(fi({},e),t)},{})||{}},_i=function(e){var t=gi()[e];return!t&&hi(e)&&console.warn(`You cannot get variables schema for subMappings key (${e}).`),t},vi=function(e){return Object.entries(di).filter(function(t){var n=Q(t,2)[1];return Object.keys(n).includes(e)}).map(function(e){return Q(e,1)[0]})[0]},yi=function(e){return Object.entries(gi()).find(function(t){var n=Q(t,2);return n[0],!!n[1]?.subMappings?.[e]})},bi=function(e){var t=[];if(hi(e)){var n=Q(yi(e),2);n[0];var r=n[1];t.push.apply(t,mi(mi([],Q(r?.required||[]),!1),Q(r?.subMappings?.[e]?.required||[]),!1))}else t.push.apply(t,mi([],Q(_i(e)?.required||[]),!1));return t},xi=function(e,t){var n;return t===void 0&&(t=``),((n=e?.main)?.find)?.call(n,function(e){return e.key===t})},Si=function(e,t){return Error(`Url Mappings Error - [${e}]: ${t}`)},Ci=Object.values(Z),wi=Si(`key`,`must be one of: ${Ci.toString()}`),Ti=function(e){if(typeof e!=`string`||!Ci.includes(e))return wi},Ei=Si(`itemData`,`must be on object with string as value, for example: { "slug": "shoes" }`),Di=function(e){if(typeof e!=`object`||!e||!Object.values(e).every(function(e){return typeof e==`string`})||Array.isArray(e))return Ei},Oi=Si(`itemData`,`must have required variables, for example: { "slug": "shoes" }`),ki=function(e,t){try{var n=bi(e);if(!n.every(function(e){return!!t[e]})||!n.length)throw Error()}catch{return Oi}},Ai=function(e){var t=e.key,n=e.itemData;return[Ti(t),Di(n),ki(t,n)].find(Boolean)},ji=function(e){return function(t){var n=new RegExp(Ur,`g`),r=t.replace(n,``);return e?.[r]}},Mi=function(e,t,n,r){e===void 0&&(e={main:[]}),r===void 0&&(r={});var i=Ai({key:t,itemData:n});if(i)throw i;var a=(xi(e,t)||{}).mapping,o=(r||{}).baseUrl;if(o??=``,o=o.endsWith(`/`)?o?.slice(0,-1):o,a&&typeof a==`string`){var s=new RegExp(Hr,`g`),c=a.replace(s,ji(n));return o.concat(`/${c}`)}},Ni=/[.*+?^$()|]/g,Pi=function(e){var t=e.replace(Ni,`\\$&`).replace(new RegExp(Hr,`g`),Wr);return RegExp(`^${t}\$`)},Fi=function(e,t){return e===void 0&&(e=[]),e.find(function(e){return Pi(e).test(t)})};Si(`url`,`Url must be a string`);var Ii=function(e){return[` `,` `,`
|
|
2
|
+
`].every(function(t){return!(e?.includes)?.call(e,t)})},Li=function(e){return e?.length<=Yi.MAX_URL_MAPPING_LENGTH},Ri=function(e){return e?.split(`/`).every(Boolean)},zi=function(e,t){var n=t.urlMappingKey;return bi(n)?.every(function(t){return e?.includes(`{{${t}}}`)})},Bi=function(e){return(e.match(new RegExp(Hr,`g`))?.length||0)<=1},Vi=function(e){return e?.split(`/`).every(Bi)},Hi=function(e){return[e.publishedPrefix,e.savedPrefix].filter(Boolean)},Ui=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=Q(r.split(`/`),1)[0],s=Q(i,1)[0];return t.includes(s)?!0:e.every(function(e){return e===o||e!==s})}},Wi=function(e,t){var n=t.pathPrefixes;return Ui(Object.values(n).map(function(e){return e.publishedPrefix}).filter(Boolean),Hi(t.pathPrefix))(e,t.defaultMapping.defaultPublished)},Gi=function(e,t){var n=t.urlMappingKey,r=t.urlMappings;return!Fi(r.main?.filter(function(e){return n!==e.key}).map(function(e){return e.mapping}),e)},Ki=function(e){e=e.replace(new RegExp(Hr,`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},qi=function(e){var t=Q(e,1)[0],n=e.slice(-1);return t!==`/`&&n!==`/`},Ji=function(e,t){var n=t.pathPrefixes;return Ui(Object.values(n).map(function(e){return e.savedPrefix}).filter(Boolean),Hi(t.pathPrefix))(e,t.defaultMapping.defaultSaved)},$;(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`})($||={});var Yi=function(){function e(e){var t=e.urlMappingKey,n=e.pathPrefixes,r=e.urlMappings,i=this;this.initValidators=function(){i.validators=[[Li,$.MAX_LENGTH_ERROR],[Ii,$.NO_SPACES_ERROR],[qi,$.NO_STARTING_OR_ENDING_SLASH_ERROR],[Ri,$.NO_EMPTY_SEGMENT_ERROR],[Ki,$.NO_INVALID_CHARACTERS_ERROR],[zi,$.CONTAIN_MAIN_VARIABLE_ERROR],[Vi,$.ONLY_ONE_VARIABLE_PER_SEGMENT_ERROR],[Wi,$.ONLY_UNIQUE_PUBLISHED_URL_ERROR],[Ji,$.ONLY_UNIQUE_SAVED_URL_ERROR],[Gi,$.ONLY_UNIQUE_MAPPING_ERROR]]},this.urlMappings=r,this.pathPrefixes=n,this.urlMappingKey=t,this.pathPrefix=this.getPathPrefix(),this.defaultMapping=Xi(t,this.pathPrefix),this.initValidators()}return e.prototype.getPathPrefix=function(){var t=vi(this.urlMappingKey);if(!t)throw hi(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=pi(this.validators),i=r.next();!i.done;i=r.next()){var a=Q(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($),e.MAX_URL_MAPPING_LENGTH=1e3,e.FALLBACK_PATH_PREFIX=`unknown`,e}(),Xi=function(e,t){var n=gi()[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=Yi.FALLBACK_PATH_PREFIX,a.publishedPrefix=Yi.FALLBACK_PATH_PREFIX),{defaultSaved:mi([a.savedPrefix,i],Q(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`),defaultPublished:mi([a.publishedPrefix,i],Q(r?.map(function(e){return`{{${e}}}`})),!1).filter(Boolean).join(`/`)}};function Zi(e,t){return t?Mi(e,Z.BOOKINGS_SERVICE,{slug:t},{baseUrl:``}):void 0}var Qi=[{path:`bookingPolicyViolations.earliestBookingDate`}],$i=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ea(e){return St(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 ta=`@wix/auto_sdk_bookings_availability-time-slots`;function na(e){function t({host:t}){let n=tt(e,[{transformFn:He,paths:Qi}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots`,packageName:ta,migrationOptions:{optInTransformResponse:!0},url:ea({protoPath:`/v2/time-slots`,data:n,host:t}),data:n,transformResponse:e=>tt(e,[{transformFn:Ue,paths:$i}])}}return t}async function ra(e){let{httpClient:t,sideEffects:n}=arguments[1],r=na(Ve({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),R(e.data)}catch(e){let t=dt(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 ia(e){return t=>ra(t,{httpClient:e})}var aa=V(ia),oa=[{path:`bookingPolicyViolations.earliestBookingDate`}],sa=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`},{path:`schedulesInfo.firstSessionStart`},{path:`schedulesInfo.lastSessionEnd`},{path:`schedulesInfo.enrollmentViolations.earliestBookingDate`}];function ca(e){return St(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 la=`@wix/auto_sdk_bookings_event-time-slots`;function ua(e){function t({host:t}){let n=tt(e,[{transformFn:He,paths:oa}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.EventTimeSlots.ListEventTimeSlots`,packageName:la,migrationOptions:{optInTransformResponse:!0},url:ca({protoPath:`/v2/time-slots/event`,data:n,host:t}),data:n,transformResponse:e=>tt(e,[{transformFn:Ue,paths:sa}])}}return t}async function da(e){let{httpClient:t,sideEffects:n}=arguments[1],r=ua(Ve({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),R(e.data)}catch(e){let t=dt(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 fa(e){return t=>da(t,{httpClient:e})}var pa=V(fa),ma=[{path:`bookingPolicyViolations.earliestBookingDate`}],ha=[{path:`timeSlots.bookingPolicyViolations.earliestBookingDate`}];function ga(e){return St(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 _a=`@wix/auto_sdk_bookings_multi-service-availability-time-slots`;function va(e){function t({host:t}){let n=tt(e,[{transformFn:He,paths:ma}]);return{entityFqdn:`wix.bookings.availability.v2.time_slot`,method:`POST`,methodFqn:`com.wixpress.bookings.availability.v2.MultiServiceAvailabilityTimeSlots.ListMultiServiceAvailabilityTimeSlots`,packageName:_a,migrationOptions:{optInTransformResponse:!0},url:ga({protoPath:`/v2/multi-service-time-slots`,data:n,host:t}),data:n,transformResponse:e=>tt(e,[{transformFn:Ue,paths:ha}])}}return t}async function ya(e){let{httpClient:t,sideEffects:n}=arguments[1],r=va(Ve({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),R(e.data)}catch(e){let t=dt(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 ba(e){return t=>ya(t,{httpClient:e})}var xa=V(ba),Sa=(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))(Sa||{}),Ca=(e=>(e.APPOINTMENT=`APPOINTMENT`,e.CLASS=`CLASS`,e.COURSE=`COURSE`,e))(Ca||{}),wa=(e=>(e.CUSTOM=`CUSTOM`,e.BUSINESS=`BUSINESS`,e.CUSTOMER=`CUSTOMER`,e))(wa||{}),Ta=[{path:`timeSlotsConfiguration.createdDate`},{path:`timeSlotsConfiguration.updatedDate`}];function Ea(e){return St(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 Da=`@wix/auto_sdk_bookings_time-slots-configuration`;function Oa(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:Da,migrationOptions:{optInTransformResponse:!0},url:Ea({protoPath:`/v1/time-slots-configurations/app/{appId}`,data:e,host:t}),params:xt(e),transformResponse:e=>tt(e,[{transformFn:Ue,paths:Ta}])}}return t}async function ka(e){let{httpClient:t,sideEffects:n}=arguments[1],r=Oa(Ve({appId:e}));n?.onSiteCall?.();try{let e=await t.request(r);return n?.onSuccess?.(e),R(e.data)}catch(e){let t=dt(e,{spreadPathsToArguments:{},explicitPathsToArguments:{appId:`$[0]`},singleArgumentUnchanged:!1},[`appId`]);throw n?.onError?.(e),t}}function Aa(e){return t=>ka(t,{httpClient:e})}var ja=V(Aa),Ma=[{path:`bookingsSettings.createdDate`},{path:`bookingsSettings.updatedDate`}],Na=[{path:`bookingsSettings.siteProperties.address.coordinates.latitude`},{path:`bookingsSettings.siteProperties.address.coordinates.longitude`}];function Pa(e){return St(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 Fa=`@wix/auto_sdk_bookings_bookings-settings`;function Ia(e){function t({host:t}){return{entityFqdn:`wix.bookings.v2.bookings_settings`,method:`GET`,methodFqn:`wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`,packageName:Fa,migrationOptions:{optInTransformResponse:!0},url:Pa({protoPath:`/v2/settings`,data:e,host:t}),params:xt(e),transformResponse:e=>tt(e,[{transformFn:Ue,paths:Ma},{transformFn:qt,paths:Na}]),fallback:[{method:`GET`,url:Pa({protoPath:`/v2/settings`,data:e,host:t}),params:xt(e)}]}}return t}var La=(e=>(e.BUSINESS_TIME_ZONE=`BUSINESS_TIME_ZONE`,e.CUSTOMER_TIME_ZONE=`CUSTOMER_TIME_ZONE`,e))(La||{});async function Ra(){let{httpClient:e,sideEffects:t}=arguments[0],n=Ia(Ve({}));t?.onSiteCall?.();try{let r=await e.request(n);return t?.onSuccess?.(r),R(r.data)?.bookingsSettings}catch(e){let n=dt(e,{spreadPathsToArguments:{},explicitPathsToArguments:{},singleArgumentUnchanged:!1},[]);throw t?.onError?.(e),n}}function za(e){return()=>Ra({httpClient:e})}var Ba=V(za);function Va(e){return e.business?._id??null}function Ha(e){return e.business?.name??null}function Ua(e){return(e?.locations??[]).filter(e=>e.type===wa.BUSINESS).map(e=>({id:Va(e)??``,label:Ha(e)??``})).filter(e=>e.id!==``).sort((e,t)=>e.label.localeCompare(t.label))}var Wa=e=>e===Ca.APPOINTMENT,Ga=e=>e===Ca.CLASS,Ka=e=>e===Ca.COURSE,qa={category:`category`,location:`location`,page:`page`,blob:`b`,resource:`resource`,referral:`referral`,timezone:`timezone`,bookingId:`bookingId`,token:`token`,rescheduleRedirectUrl:`rescheduleRedirectUrl`};function Ja(e){if(!e)return null;let t=eo(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 Ya(e){return(e?.services.length??0)>1}var Xa=e=>({valid:!1,reason:e});function Za(e){let t=e?.services??[];if(!Ya(e)||t.some(e=>!e.serviceId))return Xa(`too-few-services`);if(t.some(e=>e.serviceType&&e.serviceType!==`APPOINTMENT`))return Xa(`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 Xa(`location-mixed`);if(r&&n!==`BUSINESS`)return Xa(`location-id-not-business`);let i=t.map(e=>({serviceId:e.serviceId,staff:$a(e),customerChoices:Ja(e)}));return{valid:!0,locationId:r,locationType:n,services:i,requestKey:JSON.stringify([n,r,i])}}var Qa=`staff`;function $a(e){let t=e.resources?.find(e=>e.type===Qa);if(!t)return null;let n=t.ids[0];return n?{anyResource:!1,staffMemberId:n}:t.anyResource?{anyResource:!0}:null}function eo(e){return e.addOns??[]}function to(e,t){let n=e(t);return n?n.replace(/\/$/,``)||`/`:null}function no(e,t,n){let r=e(t);return!r||!n?null:`${r.replace(/\/$/,``)}/${n}`}function ro(e,t){switch(e){case`servicePage`:return(t.slug?t.buildCustomServiceUrl(t.slug):void 0)??no(t.appSectionUrl,Vr.SERVICE_PAGE,t.slug);case`bookingCalendar`:return t.isMultiService?to(t.appSectionUrl,Vr.CALENDAR_PAGE):no(t.appSectionUrl,Vr.CALENDAR_PAGE,t.slug);case`bookingForm`:return t.serviceId?no(t.appSectionUrl,Vr.FORM_PAGE,t.slug):null;default:return null}}var io=e=>e.target===`_blank`,ao=(e,t)=>t===`/`?e:new URL(`.${t}`,`${e}/`).href,oo=(e,t,n)=>n?`.${t}`:so(e,t),so=(e,t)=>e?ao(e,t):t,co=()=>{let{previewMode:e}=f(Mr),t=f(Fr),n=t.siteUrl.replace(/\/$/,``),{navigateTo:i}=f(Pr),a=f(Ir),o=d(),s=r(async t=>{let r=oo(n,t,e);await i({href:r})},[e,n,i]),c=r(async e=>{await i(io(e)?{href:e.href,type:`ExternalLink`,target:`_blank`}:{href:e.href})},[i]),l=r(e=>so(n,e),[n]),u=r(e=>t.appSectionRelativeUrl(Lr,e),[t]),p=r(e=>Zi(a.urlMappings,e),[a]),m=r((e,t)=>ro(e,{...t,appSectionUrl:u,buildCustomServiceUrl:p}),[u,p]),h=r((e,t)=>{let r=m(e,t);return r&&n?ao(n,r):null},[m,n]),g=r((e,t)=>{let n=m(e,t);n&&s(n)},[m,s]),_=r(()=>u(Vr.FORM_PAGE)||void 0,[u]),v=r(e=>Object.values(o(Nr).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(Rr),[v]),getThankYouPagePath:r(e=>{let t=v(zr);return t?`${t}/${e}?origin=bookings`:void 0},[v])}};function lo(e){return e?.details?.applicationError?.code}function uo(){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 fo(()=>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 fo(()=>n.use(e))}if(!t)throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);return fo(()=>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 fo(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 po(e,t){return{...e,...Object.fromEntries(t.map(t=>[t,(...n)=>{let r=uo();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 mo(e){return po({__type:`host`,create:t=>Object.entries(e).reduce((e,[n,r])=>({...e,[n]:r(t)}),{})},Object.keys(e))}var ho=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)}}},go=e=>new ho(e),_o=mo({getMonitoringClient:e=>()=>e.getMonitoringClient?e.getMonitoringClient():go(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`)}),vo={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 yo(e){try{let t=_o.getMonitoringClient?.();return t&&typeof t[e]==`function`?t:null}catch{return null}}function bo(e,{feature:t,action:n,level:r=`error`,contexts:i}){let a=yo(`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}:{}})}var xo=e=>{let t=e=>e<10?`0${e}`:`${e}`;return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},So=e=>new Date(`${e}T00:00:00`),Co=(e,t)=>new Intl.DateTimeFormat(`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,...t?{timeZone:t}:{}}).format(e),wo=e=>`${xo(e)}T00:00:00`,To=e=>`${xo(e)}T23:59:59`;function Eo(e,t){return`${Co(e,t)}T${new Intl.DateTimeFormat(`en-GB`,{timeZone:t,hourCycle:`h23`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e)}`}function Do(e,t){let n=Eo(new Date(Date.now()),t);return n.slice(0,10)===e?n:`${e}T00:00:00`}var Oo=/^\d{4}-\d{2}-\d{2}$/,ko=864e5;function Ao(e){if(typeof e!=`string`||!Oo.test(e))return!1;let t=So(e);return!Number.isNaN(t.getTime())&&xo(t)===e}function jo(e){if(!e||typeof e!=`object`)return!1;let{startDate:t,endDate:n}=e;return Ao(t)&&Ao(n)&&t<=n}function Mo(e,t){let n=So(e);return n.setDate(n.getDate()+t),xo(n)}function No({startDate:e,endDate:t}){let n=So(t).getTime()-So(e).getTime();return Math.round(n/ko)+1}function Po(e){let t=So(e),n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return{startDate:xo(n),endDate:xo(r)}}function Fo(e){let t=Po(e.startDate);return t.startDate===e.startDate&&t.endDate===e.endDate}function Io(e,t){if(Fo(e)){let n=So(e.startDate);return Po(xo(new Date(n.getFullYear(),n.getMonth()+t,1)))}let n=t*No(e);return{startDate:Mo(e.startDate,n),endDate:Mo(e.endDate,n)}}function Lo(e,t){return e>=t.startDate&&e<=t.endDate}function Ro(e){let t=So(e),n=new Date(t.getFullYear(),t.getMonth()+2,0).getDate(),r=Math.min(t.getDate(),n);return xo(new Date(t.getFullYear(),t.getMonth()+1,r))}function zo(e){let t=[],n=e.startDate;for(;n<=e.endDate;){let r=Mo(Ro(n),-1),i=r<e.endDate?r:e.endDate;t.push({startDate:n,endDate:i}),n=Mo(i,1)}return t}function Bo({allowGenderSelection:e,staffSelectionStrategy:t}){return e&&t!==`CUSTOMER_CANNOT_CHOOSE`}async function Vo(){let e=await ja(Lr);return{businessTimeZone:e.timeSlotsConfiguration?.displayTimeZone?.timeZone||null,staffSelectionStrategy:e.timeSlotsConfiguration?.staffSelection?.strategy??null,allowGenderSelection:e.timeSlotsConfiguration?.staffSelection?.allowGenderSelection??!1}}function Ho(e){let t=e.location?._id||(e.location?.locationType?`${e.location.locationType}:${e.location.formattedAddress??``}`:``);return`${e.localStartDate??``}|${e.localEndDate??``}|${t}`}function Uo(e){return e.availableResources?.[0]?.resources?.[0]?._id??null}function Wo(e){return`${Ho(e)}|${Uo(e)??``}`}function Go(e){let t=new Map;for(let n of e){let e=Ho(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 Ko(e){return e?{locations:[{_id:e,locationType:`BUSINESS`}]}:{}}function qo(e){return e?{resourceTypes:[{resourceTypeId:Br,resourceIds:[e]}]}:{}}function Jo(e){let{requestedGender:t,...n}=e;return Object.keys(n).length?n:void 0}function Yo(e,t){if(!e)return{};let n=t?Jo(e):e;return n?{customerChoices:n}:{}}var Xo=`REQUESTED_GENDER_NOT_ALLOWED`;function Zo(e){return lo(e)===Xo}var Qo=!1,$o=new Set;function es(){return Qo}function ts(e){return $o.add(e),()=>$o.delete(e)}function ns(){Qo||(Qo=!0,$o.forEach(e=>e()))}async function rs(e){let{customerChoices:t,...n}=e,r=e=>{let t=Jo(e);return aa({...n,...t?{customerChoices:t}:{}})};if(Qo&&t?.requestedGender)return r(t);try{return await aa(e)}catch(e){if(!t?.requestedGender||!Zo(e))throw e;return bo(e,{feature:vo.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ns(),r(t)}}function is(e,t,n){return{...e?{"location.id":e}:{},...t?{"resources.id":{$hasSome:[t]}}:{},...n?{remainingCapacity:{$gte:n}}:{}}}async function as(e){let t=await pa(e);return{timeSlots:t.timeSlots??[],timeZone:t.timeZone??null,nextCursor:t.pagingMetadata?.cursors?.next||null}}function os({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 Wa(t)?ss({serviceId:e,fromLocalDate:n,toLocalDate:r,timeZone:i,locationId:a,staffId:o,onlyAvailableSlots:s,customerChoices:c,timeSlotsPerDay:u,limit:d,cursor:f}):as({serviceIds:[e],fromLocalDate:n,...r?{toLocalDate:r}:{},...i?{timeZone:i}:{},includeNonBookable:!s,eventFilter:{type:t,...is(a,o,l)},cursorPaging:{limit:d,...f?{cursor:f}:{}}})}async function ss({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 rs({serviceId:e,fromLocalDate:t,...n?{toLocalDate:n}:{},...r?{timeZone:r}:{},...o?{bookable:!0}:{},...Ko(i),...qo(a),...Yo(s,a),includeResourceTypeIds:[Br],...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 cs=6,ls=864e5;function us(e){let t=e?So(e):new Date(Date.now()),n=new Date(t.getFullYear(),t.getMonth()+cs+1,1),r=new Date(n.getTime()-ls);return{fromLocalDate:wo(t),toLocalDate:To(r)}}async function ds({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}=us(a);if(Ga(t)||Ka(t)){let a={...Ka(t)?{type:`COURSE`}:{},...is(o,s,l)},c=await as({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 rs({serviceId:e,fromLocalDate:u,toLocalDate:d,...n?{timeZone:n}:{},...i?{bookable:!0}:{},...Ko(o),...qo(s),...Yo(c,s),includeResourceTypeIds:[Br],...r==null?{}:{cursorPaging:{limit:r}}});return{timeSlots:f.timeSlots??[],timeZone:f.timeZone??null}}var fs=1e3;async function ps({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=Ka(t)?`COURSE`:Ga(t)?`CLASS`:`APPOINTMENT`,m=[],h=null,g;do{let t=await os({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:fs,cursor:g});m.push(...t.timeSlots),h=t.timeZone??h,g=t.nextCursor??void 0}while(g);return{timeSlots:m,timeZone:h}}function ms(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 hs(e){return e?.options?.values?.[0]?.type===Sa.STAFF_MEMBER}function gs(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 _s(e){let t=Promise.resolve(e);return t.__state={status:`fulfilled`,value:e},t}var vs=jr(`@wix/site-service-warmup-data`);function ys(){try{return d()}catch{return null}}function bs(e){try{return e?e(vs):null}catch{return null}}function xs(){let e=bs(ys()),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 bo(e,{feature:vo.warmup,action:`read`,level:`warning`,contexts:{warmup:{key:n}}}),null}},set:(n,r)=>{if(t&&e)try{e.set(n,r)}catch{}}}}var Ss=`bookings-uou`;function Cs(){return`${Ss}:bookings-settings`}function ws(){return`${Ss}:time-slots-configuration`}var Ts=5e3,Es=100,Ds=`wix-warmup-data`,Os=null;function ks(e){if(typeof document<`u`)try{let t=document.getElementById(Ds)?.textContent;return t?(Os?.text!==t&&(Os={text:t,data:JSON.parse(t).builderComponentsWarmupData??{}}),Os.data[e]??void 0):void 0}catch{return}}var As=()=>({promises:new Map,invalidatedWarmup:new Set}),js=As(),Ms=new WeakMap,Ns=new WeakMap;function Ps(e){if(!e)return js;let t=Ms.get(e);return t||(t=As(),Ms.set(e,t)),t}function Fs({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=Ns.get(i);a||(a=new Map,Ns.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=Ps(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=_s(t);return i.promises.set(e,{promise:n,expiresAt:a+Ts}),n}}let c=(async()=>{if(s){let n=await t.get(e);if(n!=null)return n}return n()})();i.promises.size>=Es&&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()+Ts},()=>{i.promises.get(e)===l&&i.promises.delete(e)}),c}var Is={displayTimeZonePolicy:{basedOn:La.BUSINESS_TIME_ZONE,customerCanChange:!1},multiServiceAppointmentsEnabled:!1};async function Ls(){try{let e=await Ba();return{displayTimeZonePolicy:{basedOn:e.displayTimeZone?.basedOn??La.BUSINESS_TIME_ZONE,customerCanChange:e.displayTimeZone?.customerCanChange??!1},multiServiceAppointmentsEnabled:e.multiServiceAppointments?.enabled??!1}}catch(e){return bo(e,{feature:vo.bookingsSettings,action:`fetch-bookings-settings`,level:`warning`}),Is}}var Rs={isLoading:!0},zs=n(null),Bs=`useBookingsSettingsContext must be used within BookingsSettingsProvider`;function Vs(){let e=i(zs);if(!e)throw Error(Bs);return e}function Hs(e){return e.basedOn===La.CUSTOMER_TIME_ZONE?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0}function Us(){let e=Vs();return e.isLoading?void 0:Hs(e.displayTimeZonePolicy)}function Ws({settingsPromise:e,children:t}){let n=gs(e),r=o(()=>({isLoading:!1,...n}),[n]);return p(zs.Provider,{value:r,children:t})}function Gs({bookingsSettings:e,children:n}){let r=xs(),[i]=c(()=>e?null:Fs({key:Cs(),warmupData:r,fetchData:Ls}));return e?p(zs.Provider,{value:{isLoading:!1,...e},children:n}):p(t,{fallback:p(zs.Provider,{value:Rs,children:n}),children:p(Ws,{settingsPromise:i,children:n})})}var Ks=1e3,qs=class extends e{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){bo(e,{feature:this.props.feature??`service`,action:`render`,contexts:{react:{componentStack:t.componentStack}}})}render(){return this.state.hasError?this.props.fallback:this.props.children}},Js=`appSectionParams`;function Ys(e){let t=e.searchParams.get(Js);if(t===null)return e;let n=new URL(e);n.searchParams.delete(Js);for(let[e,r]of Object.entries(Xs(t)))typeof r==`string`&&!n.searchParams.has(e)&&n.searchParams.set(e,r);return n}function Xs(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}var Zs=`bookings-uou:url-change`,Qs=e=>{let t=new URL(e);return t.searchParams.sort(),t.href};function $s(e,{disableScrollToTop:t,skipHistory:n}={}){let r=globalThis.window;if(!r?.history)return;let i=new URL(r.location.href);if(Qs(i)===Qs(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(Zs))}function ec(e){let t=globalThis.window;return t?(t.addEventListener(Zs,e),t.addEventListener(`popstate`,e),()=>{t.removeEventListener(Zs,e),t.removeEventListener(`popstate`,e)}):()=>{}}var tc=e=>{try{return decodeURIComponent(e)}catch{return e}};function nc(e,t){let n=t?new URL(t).pathname:`/`;return`./${tc(new URL(e).pathname.replace(n,``).replace(/^\/|\/$/g,``))}`}function rc(){let e=f(Fr),t=r(()=>e.currentUrl,[e]),n=l(ec,t,t),i=o(()=>Ys(new URL(n)),[n]),a=e.siteUrl.replace(/\/$/,``);return{pathname:i.pathname,search:i.search,searchParams:i.searchParams,href:i.href,getParsedUrl:()=>Ys(new URL(e.currentUrl)),getRelativeUrl:()=>nc(e.currentUrl,a),getExternalBaseUrl:()=>a,pushUrl:$s}}var ic=jr(`@wix/site-service-business-logger`);function ac(e){return{evid:32,src:16,endpoint:``,params:e}}function oc(e){return{evid:33,src:16,endpoint:``,params:e}}function sc(e){return{evid:34,src:16,endpoint:``,params:e}}var cc={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`};Vr.BOOK_ONLINE;var lc=`new_bookings_server`,uc={TIMEZONE_PICKER:`timezone_picker`,TIME_PICKER:`time_picker`,BOOKING_DETAILS:`booking_details`,RESCHEDULE_DIALOG:`reschedule_dialog`},dc={DROPDOWN:`dropdown`,TIME_SLOT:`time_slot`,EXPAND:`expand`,COLLAPSE:`collapse`},fc=e=>{let{reportBi:t}=f(ic);return r(n=>{t({widget_name:e,bookingsPlatform:lc,is_over_editor:!1,...n.params,src:n.src,evid:n.evid},{endpoint:n.endpoint})},[t,e])},pc=(e,t=!0)=>{let n=fc(e),{getParsedUrl:r}=rc(),i=s(!1);a(()=>{t&&!i.current&&(i.current=!0,n(ac({referralInfo:r().searchParams.get(qa.referral)??void 0})))},[t,n,r])};function mc(e){return{evid:596,src:16,endpoint:`wixboost-ugc`,params:e}}function hc(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 gc(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-hc(l,t);return new Date(l-hc(e,t))}catch{return null}}function _c({start:e,end:t,timeZone:n,...r}){let i=e=>e&&n?gc(e,n)?.getTime():void 0;return sc({bookingsServiceId:r.serviceId,serviceType:r.serviceType,startTime:i(e),endTime:i(t),isEligibleForFlowCompletion:r.isEligibleForFlowCompletion})}function vc({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(vl.Provider,{value:a,children:r})}function yc({nextAvailableSlotsCount:e,children:t}){return p(vc,{nextAvailableSlotsCount:e,isLoading:!0,hasError:!1,children:t})}function bc({nextAvailableSlotsCount:e,children:t}){return p(vc,{nextAvailableSlotsCount:e,isLoading:!1,hasError:!0,children:t})}var xc=1e3;function Sc(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=No(e);for(let t=0;t<i;t+=1){let i=Mo(e.startDate,t);r.push({date:i,availability:n.get(i)??`none`})}return r}function Cc(e,t){return{fromLocalDate:Do(e.startDate,t),toLocalDate:To(So(e.endDate))}}async function wc(e,t,n,r,i,a){return(await rs({serviceId:e,...Cc(n,t),timeZone:t,...Ko(r),...qo(i),...Yo(a,i),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(No(n),xc)}})).timeSlots??[]}async function Tc(e,t,n,r,i,a){return(await as({serviceIds:[e],...Cc(n,t),timeZone:t,includeNonBookable:!0,eventFilter:{type:`CLASS`,...is(r,i,a)},maxSlotsPerDay:1,cursorPaging:{limit:Math.min(No(n),xc)}})).timeSlots}async function Ec({serviceId:e,serviceType:t,range:n,fromDate:r,timeZone:i,locationId:a,staffId:o,customerChoices:s,minRemainingCapacity:c}){if(Ka(t)||n.endDate<r)return Sc(n,[]);let l={startDate:n.startDate<r?r:n.startDate,endDate:n.endDate},u=Ga(t)?zo(l):[l];return Sc(n,(await Promise.all(u.map(n=>Ga(t)?Tc(e,i,n,a,o,c):wc(e,i,n,a,o,s)))).flat())}function Dc({serviceId:e,staff:t,customerChoices:n}){let r=t&&!t.anyResource?t.staffMemberId:void 0;return{serviceId:e,...Yo(n,r),...t?.anyResource?{}:{includeResourceTypeIds:[Br]},...r?{resourceTypes:[{resourceTypeId:Br,resourceIds:[r]}]}:{}}}function Oc({services:e,locationId:t,locationType:n,timeZone:r}){return{services:e.map(Dc),timeZone:r,location:{...t?{_id:t}:{},locationType:n}}}function kc(e){let{customerChoices:t,...n}=e,r=t?Jo(t):void 0;return r?{...n,customerChoices:r}:n}async function Ac(e){let t=e.services??[],n=()=>xa({...e,services:t.map(kc)}),r=t.some(e=>e.customerChoices?.requestedGender);if(r&&es())return n();try{return await xa(e)}catch(e){if(!r||!Zo(e))throw e;return bo(e,{feature:vo.timeSlots,action:`requested-gender-rejected`,level:`warning`}),ns(),n()}}var jc=1e3;async function Mc({range:e,fromDate:t,...n}){if(e.endDate<t)return Sc(e,[]);let r={startDate:e.startDate<t?t:e.startDate,endDate:e.endDate};return Sc(e,(await Ac({...Oc(n),fromLocalDate:Do(r.startDate,n.timeZone),toLocalDate:To(So(r.endDate)),timeSlotsPerDay:1,cursorPaging:{limit:Math.min(No(r),jc)}})).timeSlots??[])}async function Nc({date:e,onlyAvailableSlots:t,fromLocalDate:n,...r}){let i=`${e}T00:00:00`,a=[],o=null,s;do{let c=await Ac({...Oc(r),fromLocalDate:n&&n>i?n:i,toLocalDate:`${e}T23:59:59`,...t?{bookable:!0}:{},cursorPaging:{limit:jc,...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 Pc({fromDate:e,...t}){let n=await Ac({...Oc(t),...us(e),bookable:!0,cursorPaging:{limit:1}});return{timeSlots:n.timeSlots??[],timeZone:n.timeZone??null}}var Fc=[];function Ic({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(Fc),[C,w]=c(!1),[T,ee]=c(!1),E=s(0);a(()=>{_===null&&u&&v(Po(u))},[_,u]),a(()=>{if(!y||!e||!(t||i)||!l||!u||!_||!i&&Ka(n))return;let r=++E.current;return w(!0),(i?Mc({...i,range:_,fromDate:u,timeZone:l}):Ec({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&&(bo(e,{feature:vo.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=>{jo(e)&&(v(e),b(!0))},[]),O=r(async()=>{v(e=>e&&Io(e,1)),b(!0)},[]),te=r(async()=>{v(e=>e&&Io(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 Lc({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&&Ka(n)){_(null);return}let r=Eo(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?Nc({...i,date:g.date,timeZone:o,onlyAvailableSlots:m,fromLocalDate:s}):ps({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&&(bo(e,{feature:vo.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&&Ka(n)||!Ao(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&&Ka(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 Pc({...i,timeZone:o,fromDate:e}):await ds({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()?(bo(e,{feature:vo.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}}function Rc(e,t){return t===void 0?!1:!e||new Date(e).getTime()<=t}function zc({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:Eo(new Date(i),r)};return Ga(t)?{...d,serviceType:`CLASS`,minRemainingCapacity:u}:Ka(t)?!n||Rc(n,i)?void 0:{...d,serviceType:`COURSE`,toLocalDate:Eo(new Date(n),r)}:{...d,serviceType:`APPOINTMENT`,toLocalDate:us().toLocalDate,timeSlotsPerDay:c+1,customerChoices:l}}function Bc({isAppointment:e,staffOnSlotCount:t,hasStaffFilter:n,hasRequestedGender:r,hasStaffPricedVariants:i,staffSelectionStrategy:a}){return e&&t>1&&!n&&!i&&(a!==`CUSTOMER_MUST_CHOOSE`||r)}function Vc(e,t){return e.length?e.length===1?{anyResource:!1,staffMemberId:e[0]}:t?{anyResource:!0}:null:null}function Hc(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 Uc={staff:null,requestedGender:null,locationId:null};function Wc({entry:e,appointmentLike:t,staffChoiceHidden:n,staffPriced:r,staffSelectionStrategy:i,genderAllowed:a,staffMemberIds:o,locationIds:s}){if(!e)return Uc;let c=e.locationId&&s.includes(e.locationId)?e.locationId:null,l=t&&!n?$a(e):null;if(!l)return{...Uc,locationId:c};if(!l.anyResource)return o.includes(l.staffMemberId)?{staff:l,requestedGender:null,locationId:c}:{...Uc,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}:{...Uc,locationId:c}}var Gc=[];function Kc({sessions:e,dayQuery:t,daySlots:n,staffFilter:r,appointmentLike:i,limitPerDay:a,expandedDates:o}){let s=tl(nl(e,r)),c=n?nl(i?Go(n):n,r):Gc;return{rows:t?c:rl(s,a,o),slotIdOf:t?Ho:Wo,daysWithMore:el(s,a,o)}}function qc({rows:e,slotIdOf:t},n){return[...e.filter(e=>t(e)===n)].sort((e,t)=>$c(t)-$c(e))[0]??null}function Jc(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:Qc(e,t),isAllDay:e.allDay??!1,staff:r?[]:Yc(e)}}function Yc(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 Xc(e){let t=Yc(e);if(t.length)return t.length===1?t[0].staffMemberId:null}function Zc(e){return Yc(e).map(e=>e.staffMemberId)}function Qc(e,t){if(!e.localStartDate||!e.localEndDate)return null;let n=e.allDay?`UTC`:t??`UTC`,r=gc(e.localStartDate,n),i=gc(e.localEndDate,n);return!r||!i||i<r?null:Math.round((i.getTime()-r.getTime())/6e4)}function $c(e){let t=e.bookableCapacity??e.remainingCapacity;return(e.eventInfo?.waitingList?.remainingCapacity??0)>0&&(t??0)<=0?1:e.bookable?2:0}function el(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 tl(e){return e.flatMap(e=>{let t=e.availableResources?.find(e=>e.resourceTypeId===Br),n=t?.resources??[];return n.length<=1?[e]:n.map(n=>({...e,availableResources:[{...t,resources:[n]}]}))})}function nl(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 rl(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 il(){try{return await Vo()}catch(e){return bo(e,{feature:vo.timeSlots,action:`fetch-business-time-zone`,level:`warning`}),{businessTimeZone:null,staffSelectionStrategy:void 0,allowGenderSelection:!1}}}function al(e){return Fs({key:ws(),warmupData:e,fetchData:il})}function ol(e){return(e.localStartDate??``).slice(0,10)}var sl=[];function cl(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 os({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;bo(e,{feature:vo.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 ps({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=>ol(t)===e),h=Math.max(0,s.findIndex(t=>t.some(t=>ol(t)===e)));s=s.map((t,n)=>{let r=t.filter(t=>ol(t)!==e);return n===h?[...r,...c]:r}),_(s),O(t=>new Set([...t,e]))}catch(e){if(t)return;bo(e,{feature:vo.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]??sl].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 N(){M&&!S&&A.current?.(b-1)}async function oe(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:N,expandedDates:D,loadingDate:te,loadAllSessionsForDay:oe}}var ll=e=>e?.onlineBooking?.enabled===!0;function ul(e){return!!e?._id}function dl(e,t){return e?e.anyResource?t??``:e.staffMemberId:null}var fl=[],pl=[],ml=on.map(e=>({id:e,gender:e})),hl={isSelectionValidated:!1},gl=()=>{},_l=async()=>{},vl=n(null);function yl(){let e=i(vl);if(!e)throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);return e}function bl(e,t,n){e?t():n()}var xl={loginRequired:`rescheduleLoginRequired`,notFound:`rescheduleNotFound`,accessDenied:`rescheduleAccessDenied`,failed:`rescheduleNotFound`,wrongService:`rescheduleNotFound`,notReschedulable:`rescheduleNotReschedulable`};function Sl(e=3){return Math.min(Math.max(e,1),Ks)}function Cl(e){let{isLoading:n,bookingsSettingsLoading:r}=u();pc(cc.TIME_SLOTS,!n&&!r);let i=xs(),[a]=c(()=>al(i));return p(Gs,{children:p(t,{fallback:p(yc,{nextAvailableSlotsCount:Sl(e.nextAvailableSlotsCount),children:e.children}),children:p(Tl,{...e,configurationPromise:a})})})}function wl(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 Tl({onlyAvailableSlots:e=!0,nextAvailableSlotsCount:t=3,loadDaysAvailabilityInitially:n=!1,timeSlotLimitPerDay:r=100,configurationPromise:i,children:o}){let s=Vs().isLoading,{searchParams:d}=rc(),{reschedule:f}=u(),[m]=c(()=>({locationId:d.get(qa.location),staffId:d.get(qa.resource),timeZone:(f?void 0:Ar(d.get(qa.blob))?.timezone)??d.get(qa.timezone)})),[h,g]=c(m.timeZone),_=Sl(t),[v,y]=c(!1);a(()=>y(!0),[]);let b=v&&!s,x=gs(i),S=l(ts,es,()=>!1),{serviceId:C}=u(),w=wl(C),T=Number.isFinite(r)?Math.max(1,Math.floor(r)):100;return p(qs,{fallback:p(bc,{nextAvailableSlotsCount:_,children:o}),feature:vo.timeSlots,children:p(El,{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 El({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:N=pl,reschedule:oe}=u(),P=oe!=null,se=P&&oe.status!==`ready`,ce=P&&oe.status===`loading`,le=P?xl[oe.status]:void 0,ue=se?null:oe?.booking??null,de=ue?oe.validUntil:null,fe=ul(x)&&!ll(x),F=fe||se?null:S,pe=rc(),me=P?null:pe.searchParams.get(qa.blob),he=o(()=>Za(Ar(me)),[me]),I=!S&&!M&&!ae&&(he.valid||he.reason!==`too-few-services`),ge=I&&he.valid&&N.some(e=>!ll(e)&&he.services.some(t=>t.serviceId===e._id)),_e=fe||ge,ve=I&&he.valid&&!ge?he.requestKey:null,ye=o(()=>ve&&he.valid?{services:he.services,locationId:he.locationId,locationType:he.locationType}:null,[ve]),be=!!F||ye!==null,xe=F||ve,Se=i&&!M&&!ae&&!be&&!ce,Ce=Us(),we=Vs(),{navigate:Te,resolvePath:Ee}=co(),[De,Oe]=c(null),[ke,Ae]=c(!1),je=s([]),Me=s(!1),Ne=r(()=>(Ae(!0),Me.current?Promise.resolve():new Promise(e=>{je.current.push(e)})),[]),Pe=i?Intl.DateTimeFormat().resolvedOptions().timeZone:null,Fe=Ua(x),Ie=s(null),Le=$a(te),Re=s(Le);Re.current=Le;let ze=Le&&!Le.anyResource?Le.staffMemberId:null,Be=te.requestedGender??null,L=!Ga(C)&&!Ka(C),Ve=L&&!I&&hs(ie),R=I||L&&_===`CUSTOMER_CANNOT_CHOOSE`,He=_!==void 0,Ue=Bo({allowGenderSelection:v,staffSelectionStrategy:_??null})&&L&&!I&&!Ve,We=Ue&&!y,Ge=o(()=>F?Ar(me)?.services.find(e=>e.serviceId===F)??null:null,[me,F]),Ke=(j??[]).map(e=>e.staffMemberId).join(`,`),qe=Fe.map(e=>e.id).join(`,`),Je=o(()=>Wc({entry:Ge,appointmentLike:L,staffChoiceHidden:R,staffPriced:Ve,staffSelectionStrategy:_,genderAllowed:We,staffMemberIds:Ke.split(`,`),locationIds:qe.split(`,`)}),[Ge,L,R,Ve,_,We,Ke,qe]),z=Je.staff,Ye=Je.locationId,Xe=R||z!==null,[Ze,Qe]=c(null),[$e,et]=c(m!==null||P),tt=e=>!!e&&Fe.some(t=>t.id===e),nt=ue?.locationId??null,rt=Ze??($e?tt(nt)?nt:m:null),it=Ye??(tt(rt)?rt:null),at=o(()=>Ye?[]:Fe.map(e=>({id:e.id,name:e.label})),[x,Ye]),ot=o(()=>Xe?[]:(j??[]).filter(e=>e.name).map(e=>({id:e.staffMemberId,name:e.name??``,gender:null})),[j,Xe]),st=L&&!He?fl:ot,ct=We&&st.length>1,lt=o(()=>ct?[...ml,...st]:st,[ct,st]),[ut,dt]=c(null),[ft,pt]=c(h!==null),mt=ut??(ft?h:null),B=z?z.anyResource?null:z.staffMemberId:mt!==null&&ot.some(e=>e.id===mt)?mt:null,ht=Le?.anyResource?Be:null,[gt,_t]=c(ht),[vt,yt]=c(ht);!y&&Le?.anyResource&&Be!==vt&&(yt(Be),_t(Be));let bt=z?Je.requestedGender:Ue&&st.length>1&&B===null?gt:null,V=y?null:bt,xt=r(e=>{Re.current=e,e?e.anyResource?A(V??void 0):k(e.staffMemberId):ne()},[ne,A,k,V]),St=r(e=>xt(e?{anyResource:!1,staffMemberId:e}:{anyResource:!0}),[xt]),Ct=(ue?.addOnIds??[]).filter(e=>x?.addOnGroups?.some(t=>t.addOnIds?.includes(e))),wt=ue&&Ga(C)?ue.participants:null,Tt=L?Ja(te):null,{addOnIds:Et,...Dt}=Tt??{},Ot=L&&ue?Ct.length?{...Dt,addOnIds:Ct}:Dt:Tt,kt=Ot?Jo(Ot):void 0,At=JSON.stringify(bt?{...kt,requestedGender:{gender:bt}}:kt??null),jt=o(()=>JSON.parse(At),[At]),Mt=z?.anyResource===!0,Nt=r(e=>Mt||_!==void 0&&Bc({isAppointment:L,staffOnSlotCount:e,hasStaffFilter:B!==null,hasRequestedGender:V!==null,hasStaffPricedVariants:Ve,staffSelectionStrategy:_}),[Mt,L,_,B,V,Ve]),Pt=r(e=>z??(R?null:e),[z,R]),Ft=r(e=>{let t=e===null?null:lt.find(t=>t.id===e);t!==void 0&&(pt(!1),dt(t&&!t.gender?t.id:null),_t(t?.gender??null))},[lt]),It=r(e=>{(e===null||Fe.some(t=>t.id===e))&&(et(!1),Qe(e))},[x]),Lt=!!(i&&!we.isLoading&&we.displayTimeZonePolicy.customerCanChange&&g&&Pe&&g!==Pe),H=i?Lt&&t&&(t===g||t===Pe)?t:Ce??g??Pe:null,Rt=r(e=>{Lt&&(e===g||e===Pe)&&n(e)},[Lt,g,Pe,n]),zt=o(()=>i&&!M&&be?Date.now():void 0,[i,M,F,ye,H]),Bt=zt!==void 0&&H?Co(new Date(zt),H):null,{range:Vt,daysAvailability:Ht,isLoading:Ut,hasError:Wt,setRange:Gt,nextRange:Kt,previousRange:qt}=Ic({enabled:i,serviceId:F,serviceType:C,multiServiceRequest:ye,timeZone:H,today:Bt,locationId:it,staffId:B,customerChoices:jt,minRemainingCapacity:wt,loadInitially:d,onlyAvailableSlots:e}),Jt=de?.slice(0,10)??null,Yt=o(()=>Jt?Ht.map(e=>e.date>Jt?{...e,availability:`none`}:e):Ht,[Ht,Jt]),Xt=de&&H?Eo(new Date(de),H):null,{query:U,selectedDate:Zt,timeSlots:Qt,isLoading:$t,error:en,selectDate:tn,findNextAvailableDate:nn}=Lc({enabled:i,serviceId:F,serviceType:C,multiServiceRequest:ye,timeZone:H,today:Bt,locationId:it,staffId:B,customerChoices:jt,minRemainingCapacity:wt,onlyAvailableSlots:e,serviceLoading:M}),rn=s(!0),an=s(null);a(()=>{if(rn.current){rn.current=!1;return}Oe(null),Ie.current&&bl(F,T,E),Ie.current=null,an.current=null},[U,ye,H,it,B,jt,wt,e,l,f,D]);let on=r(async()=>{let e=await nn();return e.outcome===`found`?Jt&&e.date>Jt?`none`:(await Promise.all([tn(e.date),Vt&&Lo(e.date,Vt)?Promise.resolve():Gt(Po(e.date))]),`found`):e.outcome},[nn,Jt,tn,Vt,Gt]),sn=!!(i&&!M&&be&&H&&Bt),cn=i&&!M&&!be,[ln,un]=c(!1),[dn,fn]=c(0),pn=s(!1),mn=s([]),W=s(0),hn=r(()=>{un(!1);let e=mn.current;return mn.current=[],e},[]),gn=r(()=>{W.current+=1,hn().forEach(e=>e(`cancelled`))},[hn]),_n=r(e=>(gn(),tn(e)),[gn,tn]),vn=r(e=>{let t=W.current;pn.current=!0,on().then(n=>{pn.current=!1,n===`cancelled`&&t===W.current?(mn.current.unshift(...e),un(!0)):e.forEach(e=>e(n)),fn(e=>e+1)})},[on]),yn=r(()=>cn?Promise.resolve(`none`):new Promise(e=>{if(sn&&!pn.current){vn([...hn(),e]);return}mn.current.push(e),un(!0)}),[cn,sn,vn,hn]);a(()=>{if(ln&&!pn.current){if(cn){hn().forEach(e=>e(`none`));return}sn&&vn(hn())}},[ln,dn,sn,cn,vn,hn]);let bn=x?.schedule?.lastSessionEnd,xn=L||Ga(C)||Ka(C)&&!Rc(bn,zt),Sn=!!(ke&&i&&!M&&F&&H&&zt!==void 0),Cn=Sn&&F&&H&&zt!==void 0?zc({serviceId:F,serviceType:C,lastSessionEnd:bn,timeZone:H,now:zt,onlyAvailableSlots:e,locationId:it,staffId:B,timeSlotLimitPerDay:f,customerChoices:jt,minRemainingCapacity:wt}):void 0,G=cl(l,Cn),wn=ke&&F&&xn&&!(ke&&F&&xn&&(!i||M))&&!H,Tn=_e?`onlineBookingOff`:le??(G.error===null?wn?`timeZoneMissing`:null:`upcomingSlotsLoadFailed`),En=U!==null,Dn=o(()=>Kc({sessions:G.sessions,dayQuery:En,daySlots:Qt,staffFilter:B,appointmentLike:L,limitPerDay:f,expandedDates:G.expandedDates}),[G.sessions,En,Qt,B,L,f,G.expandedDates]),{slotIdOf:On}=Dn,kn=ke&&(Cn?G.firstPageSettled:Sn||i&&!M&&!F||wn);Me.current=kn,a(()=>{if(!kn)return;let e=je.current;je.current=[],e.forEach(e=>e())},[kn]);let An=ke&&!kn||G.isLoadingPage,jn=Tn!==null,Mn=U?$t:An||$t||!i||be&&!H||ln||ce,Nn=U?en:en??Tn,Pn=U?en!==null:jn||en!==null,Fn=fc(cc.TIME_SLOTS),In=s(!1),Ln=r((e,t)=>{if(!t.bookable){an.current=null;return}if(e===an.current)return;an.current=e;let n=F??t.serviceId??t.nestedTimeSlots?.[0]?.serviceId??void 0,r=C??N.find(e=>e._id===n)?.type??void 0;!In.current&&!P&&Fn(oc({bookingsServiceId:n,serviceType:r,isEligibleForFlowCompletion:!0})),In.current=!0,Fn(mc({component:uc.TIME_PICKER,element:dc.TIME_SLOT,properties:JSON.stringify({selectedTime:t.localStartDate})}))},[Fn,F,C,N,P]),Rn=r(e=>{if(e===null){let e=Ie.current!==null;Ie.current=null,an.current=null,Oe(null),e&&bl(F,T,E);return}let t=qc(Dn,e);if(!t)return;if(I){if(!ee(t.nestedTimeSlots??[],H??void 0))return;Ie.current=t,Oe(t),Ln(e,t);return}Ie.current=t,Oe(t),Ln(e,t);let n=Zc(t);if(w(ms(t),{staffId:L?void 0:Xc(t),timezone:H??void 0,bookable:t.bookable,staffChoiceRequired:L&&He&&!R&&n.length>1&&!Nt(n.length),rescheduleStaffId:L&&(_!==`CUSTOMER_MAY_CHOOSE`||!Nt(n.length))?n[0]:void 0}),!L)return;let r=Re.current,i;i=z||(B&&n.includes(B)?{anyResource:!1,staffMemberId:B}:V!==null&&Nt(n.length)?{anyResource:!0}:Vc(n,He&&Nt(n.length))),dl(i,V)!==dl(r,Be)&&xt(i)},[I,F,T,E,ee,w,Dn,Ln,H,L,He,_,Nt,z,B,V,Be,xt]),zn=r(()=>{let e=Ie.current;if(!e||P)return;if(I){O(Fn);return}if(!F)return;let t;if(L){let n=Zc(e),r=Hc(n,Pt(Re.current),Nt(n.length));t=(r.isComplete?r.resourceId:n[0])??(n.length?null:void 0)}let n=Ee(`bookingForm`,{slug:x?.mainSlug?.name??null,serviceId:F});e.bookable&&Fn(_c({serviceId:F,serviceType:C??void 0,start:e.localStartDate,end:e.localEndDate,timeZone:H??void 0,isEligibleForFlowCompletion:!!n})),n&&Te(re(n,{handoff:!0,staffId:t}))},[Fn,I,O,H,F,C,x,L,Pt,Nt,Te,Ee,re,P]),Bn=De?Zc(De):null,Vn=Bn?I||!L||Hc(Bn,Pt(Le),Nt(Bn.length)).isComplete:!1,K=Bn?Nt(Bn.length):!1,Hn=o(()=>!De||Xe?[]:Yc(De).map(e=>({staffMemberId:e.staffMemberId,name:e.name||null,image:null,isSelected:e.staffMemberId===ze})),[De,Xe,ze]),Un=o(()=>({...hl,isMultiService:I,hasValidSchedulingInput:be,availabilityRequestKey:xe,needsServiceChoice:Se,isRescheduling:P,rescheduleValidUntil:Xt,businessTimeZone:g,canChangeTimeZone:Lt,setTimeZone:Rt,locationFilterOptions:at,selectedLocationFilter:it,setLocationFilter:It,staffFilterOptions:lt,selectedStaffFilter:B,setStaffFilter:Ft,requestedGender:V,genderSelectionAllowed:We,currentTimeSlotsPage:U?1:G.currentPage,hasNextTimeSlotsPage:!U&&G.hasNextPage,hasPreviousTimeSlotsPage:!U&&G.hasPreviousPage,nextTimeSlotsPage:U?_l:G.nextPage,loadUpcomingTimeSlots:Ne,upcomingTimeSlotsRequested:ke,previousTimeSlotsPage:U?gl:G.previousPage,timeSlots:Dn.rows.map(e=>Jc(e,H,On,R)),isLoading:Mn,hasError:Pn,errorCode:Nn,selectedDate:Zt,daysAvailabilityRange:Vt,daysAvailability:Yt,daysAvailabilityLoading:Ut,daysAvailabilityHasError:Wt,timeSlotsLoading:Mn,timeSlotsErrorCode:Nn,selectDate:_n,setDaysAvailabilityRange:Gt,nextDaysAvailabilityRange:Kt,previousDaysAvailabilityRange:qt,goToNextAvailableDate:yn,nextAvailableSlotsCount:l,timeZone:H,staffFromSlots:Hn,selectedResourceId:ze,setSelectedResource:St,canAutoAssignStaff:K,isComplete:Vn,selectedTimeSlot:De?Jc(De,H,On,R):null,selectTimeSlot:Rn,navigateToBookingForm:zn,timeSlotLimitPerDay:f,expandedDates:G.expandedDates,daysWithMore:Dn.daysWithMore,loadingDate:G.loadingDate,loadAllTimeSlotsForDay:G.loadAllSessionsForDay}),[I,be,xe,Se,P,Xt,g,H,Lt,Rt,G,Ne,ke,at,it,It,lt,B,Ft,V,We,U,Mn,Nn,Pn,Dn,Zt,Vt,Yt,Ut,Wt,_n,Gt,Kt,qt,yn,l,Hn,ze,St,K,Vn,De,Rn,zn,f,On,R]);return p(vl.Provider,{value:Un,children:b})}var Dl=an;export{Cl as default,Dl as injectAccessTokenGetter,vl as timeSlotsContext,yl as useTimeSlotsContext};
|