@wix/bookings 1.0.1750 → 1.0.1752

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