diff --git a/bg1.js b/bg1.js index fb3bfc6..b14cd18 100644 --- a/bg1.js +++ b/bg1.js @@ -1,10 +1,10 @@ -var Ri=Object.defineProperty;var $i=e=>{throw TypeError(e)};var Oi=(e,t,n)=>t in e?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var N=(e,t,n)=>Oi(e,typeof t!="symbol"?t+"":t,n);var Pt=(e,t,n)=>t.has(e)?$i("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var we,T,wn,se,Dt,kn,Xe,dt,Ze,et,In,ve={},En=[],Gi=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Me=Array.isArray;function Z(e,t){for(var n in t)e[n]=t[n];return e}function Nn(e){var t=e.parentNode;t&&t.removeChild(e)}function be(e,t,n){var r,a,s,c={};for(s in t)s=="key"?r=t[s]:s=="ref"?a=t[s]:c[s]=t[s];if(arguments.length>2&&(c.children=arguments.length>3?we.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)c[s]===void 0&&(c[s]=e.defaultProps[s]);return ye(e,c,r,a,null)}function ye(e,t,n,r,a){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:a??++wn,__i:-1,__u:0};return a==null&&T.vnode!=null&&T.vnode(s),s}function w(e){return e.children}function ee(e,t){this.props=e,this.context=t}function ae(e,t){if(t==null)return e.__?ae(e.__,e.__i+1):null;for(var n;tt&&se.sort(Xe));$e.__r=0}function Sn(e,t,n,r,a,s,c,o,l,d,h){var u,p,f,b,k,x=r&&r.__k||En,v=t.length;for(n.__d=l,Mi(n,t,x),l=n.__d,u=0;u0?ye(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a)!=null?(a.__=e,a.__b=e.__b+1,o=Bi(a,n,c,h),a.__i=o,s=null,o!==-1&&(h--,(s=n[o])&&(s.__u|=131072)),s==null||s.__v===null?(o==-1&&u--,typeof a.type!="function"&&(a.__u|=65536)):o!==c&&(o==c-1?u=o-c:o==c+1?u++:o>c?h>l-c?u+=o-c:u--:o(l!=null&&!(131072&l.__u)?1:0))for(;c>=0||o=0){if((l=t[c])&&!(131072&l.__u)&&a==l.key&&s===l.type)return c;c--}if(o2&&(o.children=arguments.length>3?we.call(arguments,2):n),ye(e.type,o,r||e.key,a||e.ref,null)}function Q(e,t){var n={__c:t="__cC"+In++,__:e,Consumer:function(r,a){return r.children(a)},Provider:function(r){var a,s;return this.getChildContext||(a=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(c){this.props.value!==c.value&&a.some(function(o){o.__e=!0,tt(o)})},this.sub=function(c){a.push(c);var o=c.componentWillUnmount;c.componentWillUnmount=function(){a&&a.splice(a.indexOf(c),1),o&&o.call(c)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}we=En.slice,T={__e:function(e,t,n,r){for(var a,s,c;t=t.__;)if((a=t.__c)&&!a.__)try{if((s=a.constructor)&&s.getDerivedStateFromError!=null&&(a.setState(s.getDerivedStateFromError(e)),c=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),c=a.__d),c)return a.__E=a}catch(o){e=o}throw e}},wn=0,ee.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tt(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),tt(this))},ee.prototype.render=w,se=[],kn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xe=function(e,t){return e.__v.__b-t.__v.__b},$e.__r=0,dt=0,Ze=Lt(!1),et=Lt(!0),In=0;var oe,D,ze,Rt,xe=0,An=[],$=T,$t=$.__b,Ot=$.__r,Gt=$.diffed,Mt=$.__c,Bt=$.unmount,Ut=$.__;function ke(e,t){$.__h&&$.__h(D,e,xe||t),xe=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return xe=1,zi(Ln,e)}function zi(e,t,n){var r=ke(oe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ln(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],d=r.t(l,o);l!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.u)){var a=function(o,l,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!s||s.call(this,o,l,d);var u=!1;return h.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!s||s.call(this,o,l,d))};D.u=!0;var s=D.shouldComponentUpdate,c=D.componentWillUpdate;D.componentWillUpdate=function(o,l,d){if(this.__e){var h=s;s=void 0,a(o,l,d),s=h}c&&c.call(this,o,l,d)},D.shouldComponentUpdate=a}return r.__N||r.__}function C(e,t){var n=ke(oe++,3);!$.__s&&ft(n.__H,t)&&(n.__=e,n.i=t,D.__H.__h.push(n))}function mt(e,t){var n=ke(oe++,4);!$.__s&&ft(n.__H,t)&&(n.__=e,n.i=t,D.__h.push(n))}function ne(e){return xe=5,pt(function(){return{current:e}},[])}function pt(e,t){var n=ke(oe++,7);return ft(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function q(e,t){return xe=8,pt(function(){return e},t)}function J(e){var t=D.context[e.__c],n=ke(oe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(D)),t.props.value):e.__}function ji(){for(var e;e=An.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Re),e.__H.__h.forEach(it),e.__H.__h=[]}catch(t){e.__H.__h=[],$.__e(t,e.__v)}}$.__b=function(e){D=null,$t&&$t(e)},$.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ut&&Ut(e,t)},$.__r=function(e){Ot&&Ot(e),oe=0;var t=(D=e.__c).__H;t&&(ze===D?(t.__h=[],D.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Re),t.__h.forEach(it),t.__h=[],oe=0)),ze=D},$.diffed=function(e){Gt&&Gt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(An.push(t)!==1&&Rt===$.requestAnimationFrame||((Rt=$.requestAnimationFrame)||Wi)(ji)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),ze=D=null},$.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Re),n.__h=n.__h.filter(function(r){return!r.__||it(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],$.__e(r,n.__v)}}),Mt&&Mt(e,t)},$.unmount=function(e){Bt&&Bt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Re(r)}catch(a){t=a}}),n.__H=void 0,t&&$.__e(t,n.__v))};var Ft=typeof requestAnimationFrame=="function";function Wi(e){var t,n=function(){clearTimeout(r),Ft&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ft&&(t=requestAnimationFrame(n))}function Re(e){var t=D,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),D=t}function it(e){var t=D;e.__c=e.__(),D=t}function ft(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ln(e,t){return typeof t=="function"?t(e):t}function Vi(e,t){for(var n in t)e[n]=t[n];return e}function rt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Ht(e,t){this.props=e,this.context=t}function _t(e,t){function n(a){var s=this.props.ref,c=s==a.ref;return!c&&s&&(s.call?s(null):s.current=null),t?!t(this.props,a)||!c:rt(this.props,a)}function r(a){return this.shouldComponentUpdate=n,be(e,a)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Ht.prototype=new ee).isPureReactComponent=!0,Ht.prototype.shouldComponentUpdate=function(e,t){return rt(this.props,e)||rt(this.state,t)};var zt=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),zt&&zt(e)};var jt=function(e,t){return e==null?null:te(te(e).map(t))},Yi={map:jt,forEach:jt,count:function(e){return e?te(e).length:0},only:function(e){var t=te(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:te},qi=T.__e;T.__e=function(e,t,n,r){if(e.then){for(var a,s=t;s=s.__;)if((a=s.__c)&&a.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}qi(e,t,n,r)};var Wt=T.unmount;function Rn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Vi({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Rn(r,t,n)})),e}function $n(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return $n(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function je(){this.__u=0,this.t=null,this.__b=null}function On(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Se(){this.u=null,this.o=null}T.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Wt&&Wt(e)},(je.prototype=new ee).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var a=On(r.__v),s=!1,c=function(){s||(s=!0,n.__R=null,a?a(o):o())};n.__R=c;var o=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=$n(l,l.__c.__P,l.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.t.pop();)d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(c,c)},je.prototype.componentWillUnmount=function(){this.t=[]},je.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Rn(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&be(w,null,e.fallback);return a&&(a.__u&=-33),[be(w,null,t.__a?null:e.children),a]};var Vt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]t[r.type]=r.value),{date:`${t.year}-${t.month}-${t.day}`,time:`${t.hour}:${t.minute}:${t.second}`}}function H(e){if(e??(e=R()),(e.time??"1")>"03:00:00")return e.date??R().date;const t=new Date(`${e.date}T00:00:00`);return t.setDate(t.getDate()-1),R(t).date}function dr(e,t){const n=new Date(e+"T00:00:00"),r=n.toLocaleString("en-US",{month:"long",day:"numeric"});if(t==="short")return r;const a=H();if(e===a)return`Today, ${r}`;const s=new Date(a);s.setDate(s.getDate()+1);const c=s.toISOString().split("T")[0];return e===c?`Tomorrow, ${r}`:`${n.toLocaleString("en-US",{weekday:"long"})}, ${r}`}function z(e){const t=e.split(":").slice(0,2).map(Number),n=t[0]>=12?"PM":"AM";return t[0]=t[0]%12||12,t.map(r=>String(r).padStart(2,"0")).join(":").replace(/^0/,"")+" "+n}function X(e){const[t,n]=e.slice(0,19).split("T");return{date:t,time:n}}function pe(e){const[t,n]=e.split(":").map(Number);return(t+17)%24*60+n}function he(e){if(!Array.isArray(e))return[];const t=R().time.slice(0,5),n=e.findIndex(r=>r>=t);return n>=0?e.slice(n):[]}const We=e=>Array.isArray(e)?e.join("."):e,O={get(e){const t=localStorage.getItem(We(e));try{return JSON.parse(t??"")}catch{return}},set(e,t){localStorage.setItem(We(e),JSON.stringify(t))},delete(e){localStorage.removeItem(We(e))},clear(){localStorage.clear()}},Ve=["bg1","auth"];class Un extends Error{constructor(){super("Auth data missing or expired");N(this,"name","ReauthNeeded")}}class ur{constructor(){N(this,"onUnauthorized",()=>{})}getData(){try{const t=O.get(Ve);if(t){const{swid:n,accessToken:r,expires:a}=t,s=R(a),c=R();if(s.date>c.date||s.date===c.date&&s.time>c.time&&s.time>="17")return{swid:n,accessToken:r}}}catch(t){console.error(t)}throw this.deleteData(),new Un}setData(t){O.set(Ve,t)}deleteData(){O.delete(Ve),setTimeout(this.onUnauthorized)}}const K=new ur,hr=8e3;async function Fn(e,t={}){const{params:n,data:r,timeout:a=hr,...s}=t;t=s,t.referrer||(t.referrer=""),t.credentials||(t.credentials="omit"),t.cache||(t.cache="no-store"),t.headers={...t.headers||{}},n&&Object.keys(n).length>0&&(e+=(e.includes("?")?"&":"?")+Object.entries(n).filter(([,d])=>d!=="").map(d=>d.map(encodeURIComponent).join("=")).join("&")),r&&(t.method||(t.method="POST"),t.headers={...t.headers,"Content-Type":"application/json"},t.body=JSON.stringify(r)),t.method||(t.method="GET");const c=new AbortController;t.signal=c.signal;const o=setTimeout(()=>c.abort(),a);let l;try{l=await fetch(e,t)}catch(d){return console.error(d),{ok:!1,status:0,data:null}}finally{clearTimeout(o)}return{ok:l.ok,status:l.status,data:(l.headers.get("Content-Type")||"").startsWith("application/json")?await l.json():{}}}class Hn extends Error{constructor(){super(...arguments);N(this,"name","InvalidOrigin")}}class ue extends Error{constructor(n,r="Request failed"){super(`${r}: ${JSON.stringify(n)}`);N(this,"name","RequestError");this.response=n}}class Be{constructor(t){N(this,"resort");N(this,"origin");this.resort=t,this.origin=this.constructor.origins[this.resort.id]}static originToResortId(t){var a;const r=(a=Object.entries(this.origins).find(([,s])=>s===t))==null?void 0:a[0];if(r)return r;throw new Hn(t)}async request(t){const{swid:n,accessToken:r}=K.getData(),a=this.origin+t.path,s=await Fn(a,{method:t.method,params:t.params,data:t.data,headers:{"Accept-Language":"en-US",Authorization:`BEARER ${r}`,"x-user-id":n}});if(s.status===401&&!t.ignoreUnauth)setTimeout(()=>K.deleteData());else{const{key:c}=t;if(s.ok&&(!c||s.data[c]))return{...s,data:c?s.data[c]:s.data}}throw new ue(s)}}N(Be,"origins",{WDW:"https://disneyworld.disney.go.com",DLR:"https://disneyland.disney.go.com"});const mr="modulepreload",pr=function(e){return"/bg1/"+e},Jt={},Oe=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=Promise.all(n.map(o=>{if(o=pr(o),o in Jt)return;Jt[o]=!0;const l=o.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${d}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":mr,l||(h.as="script",h.crossOrigin=""),h.href=o,c&&h.setAttribute("nonce",c),document.head.appendChild(h),l)return new Promise((u,p)=>{h.addEventListener("load",u),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${o}`)))})}))}return a.then(()=>t()).catch(s=>{const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s})},fr={48199:"Mr-Incredible",48200:"Mrs-Incredible",261227:"Nemo",339625:"Russell",339626:"Carl",364907:"Jack-Skellington",431014:"Princess-Tiana",431065:"Darth_Vader",15549505:"Rapunzel",15655408:"Default_SignedIn",15675686:"Crush",15831168:"Wall-E",16453979:"Merida",16726412:"Stormtrooper",16818199:"Violet",16869301:"Jack-Jack",17345357:"R2-D2",17345359:"C-3PO",17532220:"Bruce",17532224:"Green-Alien",17532227:"Kermit",17532228:"Sorcerer-Mickey",17577168:"Elsa",17577169:"Anna",17813977:"Olaf",17888784:"Yoda",18101167:"Captain-Mickey",18368743:"-Nick",18368747:"-Judy",18393706:"-Flash",18403761:"kion",18405224:"-Moana",18405236:"-Elena",19633995:"50th_Mickey",19633996:"50th_Minnie",90003819:"Alice",90003846:"Ariel",90003898:"Belle",90003967:"Buzz",90003976:"Captain-Hook",90004004:"Chesire-Cat",90004017:"Cinderella",90004068:"Daisy",90004076:"Dash",90004104:"Donald",90004228:"Goofy",90004260:"Hamm",90004328:"Princess-Jasmine",90004340:"Jiminy",90004395:"Lady",90004482:"Mickey-Mouse",90004486:"Minnie",90004537:"Mulan",90004605:"Peter-Pan",90004625:"Pluto",90004626:"Pocahontas",90004642:"Princess-Aurora",90004682:"Rex",90004772:"Snow-White",90004778:"Sparky",90004846:"TinkerBell",90004860:"Tramp",90004939:"Zero"},gt="https://cdn1.parksmedia.wdprapps.disney.com/resize/mwImage/1/90/90/75/dam/",_r=gt+"wdpro-assets/avatars/180x180/RetAvatar_180x180_",gr=gt+"wdpro-assets/avatars/180x180/RetAvatar-180x180",yr=gt+"disney-world/50th-anniversary/avatars/RetAvatar_180x180_",vr={"-":gr,5:yr};function Ge(e){const t=fr[e||""];if(t)return(vr[t[0]]||_r)+t+".png"}const br=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((a,s)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},de=(e,t)=>`/das-vas/api/v${t}/${e}`;function Xt(e){return{id:e.id,name:e.name.replace(/ \(Me\)$/,""),avatarImageUrl:Ge(e.characterId)}}function Zt(e,t){return{primaryGuestId:e.id,guestIds:t.map(n=>n.id).join(",")}}class zn extends Error{constructor(n){super();N(this,"name","ConflictsError");this.conflicts=n}}class xr extends Error{constructor(){super(...arguments);N(this,"name","ExperienceUnavailable")}}var lt;class wr extends Be{constructor(){super(...arguments);N(this,"bookingGuestId");Pt(this,lt)}async experiences(n){const r=encodeURIComponent(n.id),{data:a}=await this.request({path:de(`availability/parks/${r}/experiences`,2),key:"experiences"});return a.filter(s=>s.available&&!!s.nextAvailableStartDateTime).map(s=>{const{time:c}=X(s.nextAvailableStartDateTime);try{return{...s,...this.resort.experience(s.id),time:c}}catch{return{...s,time:c}}}).sort((s,c)=>s.name.localeCompare(c.name))}async parties(){const{swid:n}=K.getData(),{data:{bookingGuestId:r,parties:a}}=await this.request({path:de(`users/${encodeURIComponent(n)}/parties`,1)});return this.bookingGuestId=r,a.map(s=>({primaryGuest:Xt(s.primaryGuest),linkedGuests:s.linkedGuests.map(Xt),selectionLimit:s.selectionLimit}))}async book({park:n,experience:r,primaryGuest:a,guests:s}){var h;const c=await this.eligibility({park:n,experience:r,primaryGuest:a,guests:s}),o=new Set((h=c.find(({type:u})=>u==="ELIGIBLE"))==null?void 0:h.guestIds);if(!s.every(u=>o.has(u.id)))throw new zn(Object.fromEntries(c.filter(u=>u.type!=="ELIGIBLE").flatMap(u=>u.guestIds.map(p=>[p,u.type]))));const l=new Map(s.map(u=>[u.id,u])),{data:d}=await this.request({path:de("bookings",2),key:"booking",data:{bookingGuestId:this.bookingGuestId,primaryGuestId:a.id,guestIds:s.map(u=>u.id),experienceId:r.id,...await this.availability({experience:r,primaryGuest:a,guests:s})}});return{type:"DAS",subtype:"IN_PARK",id:r.id,name:r.name,park:n,guests:d.entitlements.map(u=>{const p=l.get(u.guestId);return{id:u.guestId,name:(p==null?void 0:p.name)??"",avatarImageUrl:p==null?void 0:p.avatarImageUrl,entitlementId:u.id}}),start:X(d.startDateTime),end:{},bookingId:d.id}}async cancelBooking(n){const a=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:de(`entitlements/${a}`,1),method:"DELETE"})}async eligibility({park:n,experience:r,primaryGuest:a,guests:s}){const{data:c}=await this.request({path:de("eligibility",1),params:{experienceId:r.id,parkId:n.id,...Zt(a,s)},key:"eligibility"});return c}async availability({experience:n,primaryGuest:r,guests:a}){const s=encodeURIComponent(n.id),{data:{startDateTime:c,endDateTime:o}}=await this.request({path:de(`availability/experiences/${s}`,3),params:Zt(r,a)});if(!c||!o)throw new xr;return{startDateTime:c,endDateTime:o}}}lt=new WeakMap;class kr{constructor(t){N(this,"cachedShowtimes",{});this.resort=t}async shows(t){Object.keys(this.cachedShowtimes).length===0&&(this.cachedShowtimes=(await this.request("showtimes")).data);const n=this.cachedShowtimes[t.id]??{},{time:r}=R();return Object.fromEntries(Object.entries(n).flatMap(([a,s])=>{const c=s.filter(u=>u>=r),o=c[0],l=c.slice(1),d=o!==void 0,h=d?void 0:"NO_MORE_SHOWS";try{return[[a,{type:"ENTERTAINMENT",...this.resort.experience(a),park:t,standby:{available:d,unavailableReason:h,nextShowTime:o},additionalShowTimes:l}]]}catch(u){if(u instanceof re)return[];throw u}}))}async request(t){const n=await Fn(`https://bg1.joelface.com/livedata/${this.resort.id.toLowerCase()}/${t}.json`);if(!n.ok)throw new Error("Fetch failed");return n}}const Ir=e=>e.sort((t,n)=>+n.primary-+t.primary||+n.preselected-+t.preselected||t.name.localeCompare(n.name)),Er=e=>`/application/v1/guest/${e}`;class yt extends Be{async getQueues(){var n;const t=await this.post({resource:"getQueues"});if(!Array.isArray((n=t.data)==null?void 0:n.queues))throw new ue(t);return t.data.queues.filter(r=>!!r.categoryContentId).map(({queueId:r,tabContentId:a="",...s})=>{const c={...s,id:r};try{c.park=this.resort.park(a.split(";")[0])}catch(o){if(!(o instanceof re))throw o}return c})}async getQueue(t){const n=(await this.getQueues()).find(r=>r.id===t.id);if(n)return n;throw new Error("Queue not Found")}async getLinkedGuests(t){const{data:n}=await this.post({resource:"getLinkedGuests",data:{queueId:t.id,requestType:"REVIEW"}});return Ir(n.guests.map(({guestId:r,firstName:a="",lastName:s="",isPrimaryGuest:c,isPreselected:o,avatarImageUrl:l})=>({id:r,name:`${a} ${s}`.trim(),primary:!!c,preselected:!!o,avatarImageUrl:l})))}async joinQueue(t,n){const r=n.map(c=>c.id),a=await this.post({resource:"joinQueue",data:{queueId:t.id,guestIds:r}}),{data:s}=a;if(s.responseStatus==="OK"){const c=s.positions.find(o=>o.queueId===t.id&&o.guestIds.length>0&&r.some(l=>o.guestIds.includes(l)));if(!c)throw new ue(a);return{boardingGroup:c.boardingGroup,conflicts:{},closed:!1}}else if(s.responseStatus==="INVALID_GUEST"||s.responseStatus==="CLOSED_QUEUE"){const c=s.responseStatus==="CLOSED_QUEUE",o=new Set,l={};for(const u of s.conflicts)for(const p of u.guestIds){const f=n.find(b=>b.id===p);f&&(l[f.id]=u.conflictType,o.add(p))}const d=n.filter(u=>!o.has(u.id));if(c||d.length===0)return{boardingGroup:null,conflicts:l,closed:c};const h=await this.joinQueue(t,d);return h.conflicts={...l,...h.conflicts},h}else throw new ue(a)}async post(t){try{return await this.request({...t,method:"data"in t?"POST":"GET",path:Er(t.resource)})}catch(n){if(n instanceof ue){const r=n.response,{ok:a,status:s}=r;if(!a&&s<500&&s!==401)return r}throw n}}}N(yt,"origins",{WDW:"https://vqguest-svc-wdw.wdprapps.disney.com",DLR:"https://vqguest-svc.wdprapps.disney.com"});class re extends Error{constructor(n){super(`Invalid ID: ${n}`);N(this,"name","InvalidId")}}class jn{constructor(t,n){N(this,"parks");N(this,"genie");N(this,"vq");N(this,"das");N(this,"liveData");N(this,"parksById");N(this,"expsById");N(this,"dropExpsByPark");var r,a,s;this.id=t,this.parks=n.parks,this.parksById=Object.fromEntries(this.parks.map(c=>[c.id,c])),this.expsById=n.experiences,this.dropExpsByPark=new Map(this.parks.map(c=>[c,[]]));for(const[c,o]of Object.entries(this.expsById))o&&(o.id=c,o.park=o.land.park),o!=null&&o.dropTimes&&((r=this.dropExpsByPark.get(o.land.park))==null||r.push(o));for(const c of this.parks)c.dropTimes=[...new Set((a=this.dropExpsByPark.get(c))==null?void 0:a.flatMap(o=>o.dropTimes??[]))].sort(),(s=this.dropExpsByPark.get(c))==null||s.sort((o,l)=>o.name.localeCompare(l.name));this.genie=t==="WDW"?new Dr(this):new Ar(this),this.vq=new yt(this),this.das=new wr(this),this.liveData=new kr(this)}experience(t){const n=this.expsById[t];if(n)return n;throw n!==null&&console.warn(`Missing experience: ${t}`),new re(t)}park(t){const n=this.parksById[t];if(n)return n;throw new re(t)}dropExperiences(t){return this.dropExpsByPark.get(t)??[]}}async function Nr(e){const t=await br(Object.assign({"./data/dlr.ts":()=>Oe(()=>import("./dlr.js"),[]),"./data/wdw.ts":()=>Oe(()=>import("./wdw.js"),[])}),`./data/${e.toLowerCase()}.ts`,3);return new jn(e,t)}const Tr={WDW:"wdw-itinerary-api",DLR:"dlr-itinerary-web-api"},Sr={WDW:{id:"80010110",park:{id:"80007944"}},DLR:{id:"353295",park:{id:"330339"}}},Cr=new Set(["ACTIVITY","DINING"]),Ce=e=>e.split(";")[0];function Wn(e){const t=R();return e.modifiable&&H(e.start)===H(t)}class Pr extends Error{constructor(){super(...arguments);N(this,"name","ModifyNotAllowed")}}function Vn(e){if(e&&!Wn(e))throw new Pr}function Ye(e,t,n){return+(e.ineligibleReason===n)-+(t.ineligibleReason===n)}class vt extends Be{constructor(n,r){super(n);N(this,"allowsCrossParkModify",!1);N(this,"allowsTimeSelect",!1);N(this,"maxPartySize",12);N(this,"nextBookTime");N(this,"onUnauthorized",()=>{});N(this,"partyIds",new Set);N(this,"guestCache",new Map);N(this,"tracker");N(this,"primaryGuestId","");N(this,"convertGuest",n=>{const{id:r,firstName:a,lastName:s,characterId:c,...o}=n,l=`${a} ${s}`.trim();if(!this.guestCache.has(r))switch(n.ineligibleReason){case"INVALID_PARK_ADMISSION":case"PARK_RESERVATION_NEEDED":case"GENIE_PLUS_NEEDED":n.primary&&this.cacheGuest(r,l,c);break;default:this.cacheGuest(r,l,c)}const d=Ge(c);return this.partyIds.size>0&&!this.partyIds.has(r)&&(o.ineligibleReason="NOT_IN_PARTY",delete o.eligibleAfter),{...o,id:r,name:l,avatarImageUrl:d}});this.tracker=r??new Lr}setPartyIds(n){this.partyIds=new Set(n)}async experiences(n){return this.requestExperiences(n,{path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0})}async requestExperiences(n,r){var s,c,o,l;await this.primeGuestCache();const{data:a}=await this.request(r);return this.nextBookTime=(l=(((o=(c=(s=a.eligibility)==null?void 0:s.geniePlusEligibility)==null?void 0:c[H()])==null?void 0:o.flexEligibilityWindows)||[]).sort((d,h)=>d.time.time.localeCompare(h.time.time))[0])==null?void 0:l.time.time,a.availableExperiences.flatMap(d=>{try{return[{...d,...this.resort.experience(d.id),park:n,experienced:this.tracker.experienced(d)}]}catch(h){if(h instanceof re)return[];throw h}})}async cancelBooking(n){const a=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:`/ea-vas/api/v1/entitlements/${a}`,method:"DELETE"})}async bookings(){const{swid:n}=K.getData(),r=R().date,a=H(),s=Tr[this.resort.id],{data:{items:c=[],assets:o={},profiles:l={}}}=await this.request({path:`/plan/${s}/api/v1/itinerary-items/${n}?item-types=FASTPASS&item-types=DINING&item-types=ACTIVITY&item-types=VIRTUAL_QUEUE_POSITION`,params:{destination:this.resort.id,fields:"items,profiles,assets","guest-locators":n+";type=swid","guest-locator-groups":"MY_FAMILY","start-date":r,"show-friends":"false"},ignoreUnauth:!0}),d=m=>{const{name:g,avatarId:_,type:y}=l[m.id];return{id:Ce(m.id),name:`${g.firstName} ${g.lastName}`.trim(),avatarImageUrl:Ge(_),...y==="transactional"&&{transactional:!0}}},h=m=>{const g=o[m.asset],y=o[g.facility].location??"",S=this.getPark(y);S.name===""&&y&&(S.name=o[y].name);const A=new Date(m.startDateTime);return{type:"RES",subtype:m.type,id:Ce(m.asset),park:S,name:g.name,start:R(A),guests:m.guests.map(d).sort((B,U)=>+(U.id===this.primaryGuestId)-+(B.id===this.primaryGuestId)||+!U.transactional-+!B.transactional||B.name.localeCompare(U.name)),bookingId:m.id}},u=m=>{const g=o[m.facility],_=new Set;return{...this.getBookingExperienceData(m.facility,g.location,g.name),start:(m.displayStartDate??r)_.has(y.id)||y.redemptionsRemaining===0?!1:(_.add(y.id),!0)).map(y=>({...d(y),entitlementId:y.entitlementId,bookingId:y.bookingId,...y.redemptionsRemaining!==void 0&&{redemptions:Math.min(y.redemptionsRemaining,y.redemptionsAllowed??1)}})),bookingId:m.id}},p=m=>{const g={FLEX:"G+",STANDARD:"ILL",OTHER:"OTHER"},_=m.multipleExperiences?"MEP":g[m.kind];if(!_)return;const y=_==="G+";let S={type:"LL",subtype:_,...u(m),cancellable:m.cancellable&&y,modifiable:m.modifiable&&y,bookingId:m.id};if(S.modifiable=Wn(S),m.multipleExperiences){const A=m.assets.find(I=>I.original);S={...S,...A?this.getBookingExperienceData(A.content,o[A.content].location):{id:"",name:""}},S.choices=m.assets.filter(I=>!I.excluded&&!I.original).map(({content:I})=>{const{name:B,location:U}=o[I];return this.getBookingExperienceData(I,U,B)}).sort((I,B)=>I.name.localeCompare(B.name))}return S},f=m=>{const _={DAS:"IN_PARK",FDS:"ADVANCE"}[m.kind],y=_==="IN_PARK";return{type:"DAS",subtype:_,cancellable:m.cancellable&&y,...u(m)}},b=m=>{const g=o[m.asset],_=o[g.facility],y=this.getBookingExperienceData(g.facility,_.location,g.name);return y.park.name===""&&(y.park.name=_.name),{...y,type:"BG",boardingGroup:m.boardingGroup.id,status:m.status,start:R(new Date(m.startDateTime)),guests:m.guests.map(d),bookingId:m.id}},x={PARK_PASS:m=>{const g=this.getPark(o[m.facility].location);if(g)return{type:"APR",id:g.id,name:g.name,park:g,start:{date:m.displayStartDate,time:"06:00:00"},guests:m.guests.map(d),bookingId:m.id}},DAS:f,FDS:f},v=c.map(m=>{try{if(m.type==="FASTPASS")return(x[m.kind]??p)(m);if(m.type==="VIRTUAL_QUEUE_POSITION")return b(m);if(m.type&&Cr.has(m.type))return h(m)}catch(g){console.error(g)}}).filter(m=>!!m);return this.tracker.update(v,this),v}getPark(n){n=Ce(n);try{return this.resort.park(n)}catch(r){if(r instanceof re)return{id:n,name:"",icon:"",geo:{n:0,s:0,e:0,w:0},theme:{bg:"bg-blue-500",text:"text-blue-500"},dropTimes:[]};throw r}}getBookingExperienceData(n,r,a="Experience"){n=Ce(n);try{const s=this.resort.experience(n);return{id:n,name:s.name,park:s.park}}catch(s){if(s instanceof re&&r)return{id:n,name:a,park:this.getPark(r)};throw s}}async primeGuestCache(){this.primaryGuestId===""&&(await this.guests(),this.primaryGuestId||(this.primaryGuestId="."))}cacheGuest(n,r,a){this.guestCache.set(n,{name:r,characterId:a})}async request(n){if(n.userId){const{swid:r}=K.getData();n={...n},n.params={...n.params,userId:r}}return super.request(n)}parseGuests(n){var o;const{guests:r,ineligibleGuests:a}=n;this.primaryGuestId=((o=[...r,...a].find(l=>!!l.primary))==null?void 0:o.id)??this.primaryGuestId;const s=r.map(this.convertGuest),c=a.map(this.convertGuest);return c.sort((l,d)=>{const h=+!l.primary-+!d.primary||l.name.localeCompare(d.name);return l.eligibleAfter||d.eligibleAfter?(l.eligibleAfter||"99").localeCompare(d.eligibleAfter||"99")||h:l.ineligibleReason===d.ineligibleReason?h:Ye(l,d,"NOT_IN_PARTY")||Ye(l,d,"MULTI_PASS_NEEDED")||Ye(d,l,"EXPERIENCE_LIMIT_REACHED")||h}),{eligible:s,ineligible:c}}fallbackExperience(n){return n?this.resort.experience(n.id):Sr[this.resort.id]}}class Dr extends vt{constructor(){super(...arguments);N(this,"allowsCrossParkModify",!0);N(this,"allowsTimeSelect",!0)}async experiences(n,r){return this.requestExperiences(n,!r||R().date===r?{path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0}:{path:""})}async guests(n){const r=this.fallbackExperience(n),{data:{guests:a,ineligibleGuests:s}}=await this.request({path:"/ea-vas/planning/api/v1/experiences/guest/guests",data:{date:R().date,facilityId:r.id,parkId:r.park.id}});return this.parseGuests({guests:a,ineligibleGuests:s.map(c=>c.ineligibleReason?{...c,ineligibleReason:c.ineligibleReason.ineligibleReason}:c)})}async offer(n,r,a){Vn(a);const{date:s,time:c}=R(),{nextAvailableTime:o}=n.flex,{data:l}=await this.request({path:`/ea-vas/planning/api/v1/experiences${a?"/mod":""}/offerset/generate`,data:{date:a?a.start.date:s,parkId:n.park.id,guestIds:r.map(m=>m.id),targetedTime:o??c,ignoredBookedExperienceIds:null,...a?{experienceId:n.id,originalExperienceId:a==null?void 0:a.id,originalEntitlementIds:a==null?void 0:a.guests.map(m=>m.entitlementId)}:{experienceIds:[n.id]}}}),d=l.itinerary.items.find(m=>m.type==="OFFER_ITEM"),{guests:h,ineligibleGuests:u}=l.party;if(!d)throw new ue({ok:!1,status:410,data:l});const{offerSetId:p,offerId:f,startDateTime:b,endDateTime:k}=d,x=Object.fromEntries(r.map(m=>[m.id,m]));let v={offerSetId:p,id:f,start:X(b),end:X(k),experience:n,guests:{eligible:(h||[]).map(m=>({...x[m.id],...this.convertGuest(m)})),ineligible:(u||[]).map(this.convertGuest)},active:!0,changed:d.conflict==="ALTERNATIVE_TIME_FOUND",modifying:a};if(v.changed&&o&&pe(v.start.time)-pe(o)>15)try{v=await this.changeOfferTime(v,{startTime:"00:00:00",endTime:"00:00:00"}),v.changed=v.start.time!==o}catch(m){console.error(m)}return v}async times(n){const{data:r}=await this.request({path:`/ea-vas/planning/api/v1/experiences${n.modifying?"/mod":""}/offerset/times`,data:{experienceId:n.experience.id,parkId:n.experience.park.id,date:n.start.date,offerId:n.id,offerSetIds:[n.offerSetId],guestIds:n.guests.eligible.map(a=>a.id),offerType:"FLEX",experienceIdsToIgnore:[],originalOrderItemId:null}});return r.hourSegmentGroups.map(a=>({hour:Number(a.hourSegmentWindow.startTime.split(":")[0]),slots:a.inventorySlotsAvailability.map(({startTime:s,endTime:c})=>({startTime:s,endTime:c}))}))}async changeOfferTime(n,r){const{data:{updatedPlanningOfferDisplayItem:a}}=await this.request({path:`/ea-vas/planning/api/v1/experiences${n.modifying?"/mod":""}/offerset/times/fulfill`,data:{parkId:n.experience.park.id,date:n.start.date,offerId:n.id,...n.modifying?{offerSetId:n.offerSetId}:{offerSetIds:[n.offerSetId]},offerType:"FLEX",guestIds:n.guests.eligible.map(s=>s.id),targetSlot:r,experienceIdsToIgnore:[]}});return{...n,id:a.offerId,offerSetId:a.offerSetId,start:X(a.startDateTime),end:X(a.endDateTime),changed:a.conflict==="ALTERNATIVE_TIME_FOUND"}}async book(n,r){if(n.modifying)return this.modify(n,r);const{data:a}=await this.request({path:"/ea-vas/planning/api/v1/experiences/entitlements/book",data:{offerSetId:n.offerSetId,orderGuestDetails:n.guests.eligible.filter(s=>!!s.orderDetails).map(({id:s,orderDetails:{externalIdentifier:c,...o}})=>({guestDetails:[{guestId:s,externalIdentifier:c}],...o}))}});return this.createLLFromResponse(a)}async modify(n,r){const{offerSetId:a,guests:{eligible:s}}=n,c=new Set((r??n.guests.eligible).map(d=>d.id)),o=Object.fromEntries(n.modifying.guests.map(d=>[d.id,d.entitlementId])),{data:l}=await this.request({path:"/ea-vas/planning/api/v1/experiences/mod/entitlements/book",data:{offerSetId:a,eligibleGuestsEntitlements:s.filter(d=>c.has(d.id)).map(d=>({guestId:d.id,entitlementId:o[d.id],...d.orderDetails}))}});return this.createLLFromResponse({entitlementExperiences:[l.booking],party:l.party})}createLLFromResponse(n){var s;const r=n.entitlementExperiences[0],a=Object.fromEntries(r.guests.map(c=>[c.guestId,c.entitlementId]));return{type:"LL",subtype:"G+",...this.getBookingExperienceData(r.experienceId),bookingId:(s=r.guests[0])==null?void 0:s.entitlementId,start:X(r.startDateTime),end:X(r.endDateTime),cancellable:!0,modifiable:!1,guests:n.party.guests.map(c=>({...this.convertGuest(c),entitlementId:a[c.id]}))}}}class Ar extends vt{async guests(t){const n=this.fallbackExperience(t),{data:r}=await this.request({path:"/ea-vas/api/v1/guests",params:{productType:"FLEX",experienceId:n.id,parkId:n.park.id},userId:!0});return this.parseGuests(r)}async offer(t,n,r){Vn(r);const{data:{offer:{id:a,date:s,startTime:c,endTime:o,status:l,changeStatus:d},eligibleGuests:h,ineligibleGuests:u}}=await this.request({path:r?"/ea-vas/api/v1/products/modifications/flex/offers":"/ea-vas/api/v2/products/flex/offers",method:"POST",data:{guestIds:((r==null?void 0:r.guests)??n).map(p=>p.id),ineligibleGuests:[],primaryGuestId:n.map(p=>p.id).sort((p,f)=>p.localeCompare(f))[0],parkId:t.park.id,experienceId:t.id,selectedTime:t.flex.nextAvailableTime,...r?{date:R().date,modificationType:t.id===r.id?"TIME":"EXPERIENCE"}:{}}});return Oe(()=>import("./diu.js"),[]),{id:a,start:{date:s,time:c},end:{date:s,time:o},active:l==="ACTIVE",changed:d!=="NONE",modifying:r,guests:{eligible:(h||[]).map(this.convertGuest),ineligible:(u||[]).map(this.convertGuest)},experience:t}}async times(){return[]}async changeOfferTime(t){return t}async book(t,n){var u;const r=(await Oe(async()=>{const{default:p}=await import("./diu.js");return{default:p}},[])).default,a=new Set((n??t.guests.eligible).map(p=>p.id)),{data:s}=await this.request({path:t.modifying?"/ea-vas/api/v2/products/modifications/flex/bookings":"/ea-vas/api/v2/products/flex/bookings",method:"POST",data:{offerId:t.id,...await r(t.id),...t.modifying?{date:R().date,modificationType:t.modifying.id===t.experience.id?"TIME":"EXPERIENCE",existingEntitlements:t.modifying.guests.filter(p=>a.has(p.id)).map(p=>({entitlementId:p.entitlementId,entitlementBookingId:p.bookingId})),guestIdsToExclude:t.modifying.guests.filter(p=>!a.has(p.id)).map(p=>p.id)}:{}},key:"booking"}),{singleExperienceDetails:{experienceId:c,parkId:o},entitlements:l,startDateTime:d,endDateTime:h}=s;return{type:"LL",subtype:"G+",...this.getBookingExperienceData(c,o),bookingId:(u=l[0])==null?void 0:u.id,start:X(d),end:X(h),cancellable:!0,modifiable:!1,guests:l.map(p=>{const f=this.guestCache.get(p.guestId);return{id:p.guestId,name:(f==null?void 0:f.name)||"",avatarImageUrl:Ge(f==null?void 0:f.characterId),entitlementId:p.id}})}}}const en=["bg1","genie","bookings"];class Lr{constructor(){N(this,"date");N(this,"expIds",new Set);N(this,"experiencedExpIds",new Set);const{date:t=H(),expIds:n=[],experiencedExpIds:r=[]}=O.get(en)??{};this.date=t,this.expIds=new Set(n),this.experiencedExpIds=new Set(r),this.checkDate()}experienced(t){return this.experiencedExpIds.has(t.id)}async update(t,n){this.checkDate();const r=H(),a=t.filter(c=>c.type==="LL"&&!!c.cancellable&&H(c.start)===r);for(const c of a)this.experiencedExpIds[c.modifiable?"delete":"add"](c.id);const s=this.expIds;this.expIds=new Set(a.map(c=>c.id));for(const c of s){if(this.expIds.has(c))continue;const{ineligible:o}=await n.guests({id:c}),l=o.some(d=>d.ineligibleReason==="EXPERIENCE_LIMIT_REACHED");this.experiencedExpIds[l?"add":"delete"](c)}O.set(en,{date:this.date,expIds:[...this.expIds],experiencedExpIds:[...this.experiencedExpIds]})}checkDate(){const t=H();this.date!==t&&(this.date=t,this.expIds=new Set,this.experiencedExpIds=new Set)}}const Yn=Q(new jn("WDW",{experiences:{},parks:[]})),Rr=Yn.Provider,L=()=>J(Yn),qn=Q({goTo:()=>{},goBack:async()=>{}}),$r=qn.Provider,G=()=>J(qn),Kn=Q({current:i("div",{})}),Or=Kn.Provider,Qn=()=>J(Kn);let Gr=0;const tn=()=>++Gr,Pe=()=>Number(location.hash.slice(1))||0;let qe=()=>{};function Jn({children:e}){const[t,n]=E({current:e}),r=ne([{elem:e,key:0}]),a=ne({goTo(c,o){let l=Pe(),d;o!=null&&o.replace?(d=r.current[l].key??tn(),n(h=>({...h,current:c}))):(r.current=r.current.slice(0,++l),location.hash=`#${l}`,d=tn()),r.current[l]={elem:c,key:d}},goBack({screen:c,props:o}={}){if(c){const l=Pe();for(let d=l-1;d>=0;--d)if(r.current[d].elem.type===c){if(history.go(d-l),o){const h={...r.current[d].elem.props,...o};r.current[d].elem=i(c,{...h})}break}}else history.back();return new Promise(l=>{qe=()=>{l(),qe=()=>{}}})}});C(()=>{function c(){var d,h;qe();const l=Pe();l>=r.current.length?history.back():n({current:((d=r.current[l])==null?void 0:d.elem)??i("div",{}),prev:(h=r.current[l-1])==null?void 0:h.elem})}function o(l){l.preventDefault()}return location.replace("#0"),addEventListener("hashchange",c),addEventListener("beforeunload",o),()=>{removeEventListener("hashchange",c),removeEventListener("beforeunload",o)}},[]);const s=Math.min(Pe(),r.current.length-1);return i($r,{value:a.current,children:i(Or,{value:t,children:r.current.slice(0,s+1).map(({elem:c,key:o},l)=>i("article",{hidden:l!==s,children:c},o))})})}const bt={bg:"bg-blue-500",text:"text-blue-500"},Xn=Q(bt),Zn=Xn.Provider,W=()=>J(Xn),Mr={normal:"py-1",small:"py-1.5 text-xs uppercase tracking-wide",full:"w-full py-3"};function P(e){const{goBack:t}=G(),{type:n,back:r,onClick:a,className:s,...c}=e;let o=`${Mr[n||"normal"]} ${s||""}`;const{bg:l}=W();return o.includes(" bg-")||(o+=` ${l} text-white`),i("button",{onClick:async()=>{a&&await a(),r&&(r===!0?t():t(r))},className:`${o} inline-flex items-center justify-center min-w-[36px] rounded-lg px-2 font-semibold disabled:opacity-50`,...c})}function V(e){return i("div",{className:"mb-20",children:i("div",{className:"fixed bottom-0 left-0 w-full px-5 pb-5 text-center",children:i(P,{...e,className:"max-w-2xl mx-auto shadow-[0px_4px_8px_-1px_#0005]",type:"full"})})})}function j({children:e,className:t,title:n}){return t||(t=""),t.match(/\bw-\S+\s*/)||(t+=" w-4"),t.match(/\bh-\S+\s*/)||(t+=" h-auto"),i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",className:`mx-auto ${t}`,role:"img",children:[n&&i("title",{children:n}),e]})}/** +var Ri=Object.defineProperty;var $i=e=>{throw TypeError(e)};var Oi=(e,t,n)=>t in e?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var N=(e,t,n)=>Oi(e,typeof t!="symbol"?t+"":t,n);var Pt=(e,t,n)=>t.has(e)?$i("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var we,T,wn,se,Dt,kn,Xe,dt,Ze,et,In,ve={},En=[],Gi=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Me=Array.isArray;function Z(e,t){for(var n in t)e[n]=t[n];return e}function Nn(e){var t=e.parentNode;t&&t.removeChild(e)}function be(e,t,n){var r,a,s,c={};for(s in t)s=="key"?r=t[s]:s=="ref"?a=t[s]:c[s]=t[s];if(arguments.length>2&&(c.children=arguments.length>3?we.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)c[s]===void 0&&(c[s]=e.defaultProps[s]);return ye(e,c,r,a,null)}function ye(e,t,n,r,a){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:a??++wn,__i:-1,__u:0};return a==null&&T.vnode!=null&&T.vnode(s),s}function w(e){return e.children}function ee(e,t){this.props=e,this.context=t}function ae(e,t){if(t==null)return e.__?ae(e.__,e.__i+1):null;for(var n;tt&&se.sort(Xe));$e.__r=0}function Sn(e,t,n,r,a,s,c,o,l,d,h){var u,p,f,b,k,x=r&&r.__k||En,v=t.length;for(n.__d=l,Mi(n,t,x),l=n.__d,u=0;u0?ye(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a)!=null?(a.__=e,a.__b=e.__b+1,o=Bi(a,n,c,h),a.__i=o,s=null,o!==-1&&(h--,(s=n[o])&&(s.__u|=131072)),s==null||s.__v===null?(o==-1&&u--,typeof a.type!="function"&&(a.__u|=65536)):o!==c&&(o==c-1?u=o-c:o==c+1?u++:o>c?h>l-c?u+=o-c:u--:o(l!=null&&!(131072&l.__u)?1:0))for(;c>=0||o=0){if((l=t[c])&&!(131072&l.__u)&&a==l.key&&s===l.type)return c;c--}if(o2&&(o.children=arguments.length>3?we.call(arguments,2):n),ye(e.type,o,r||e.key,a||e.ref,null)}function Q(e,t){var n={__c:t="__cC"+In++,__:e,Consumer:function(r,a){return r.children(a)},Provider:function(r){var a,s;return this.getChildContext||(a=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(c){this.props.value!==c.value&&a.some(function(o){o.__e=!0,tt(o)})},this.sub=function(c){a.push(c);var o=c.componentWillUnmount;c.componentWillUnmount=function(){a&&a.splice(a.indexOf(c),1),o&&o.call(c)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}we=En.slice,T={__e:function(e,t,n,r){for(var a,s,c;t=t.__;)if((a=t.__c)&&!a.__)try{if((s=a.constructor)&&s.getDerivedStateFromError!=null&&(a.setState(s.getDerivedStateFromError(e)),c=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),c=a.__d),c)return a.__E=a}catch(o){e=o}throw e}},wn=0,ee.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tt(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),tt(this))},ee.prototype.render=w,se=[],kn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xe=function(e,t){return e.__v.__b-t.__v.__b},$e.__r=0,dt=0,Ze=Lt(!1),et=Lt(!0),In=0;var oe,D,He,Rt,xe=0,An=[],$=T,$t=$.__b,Ot=$.__r,Gt=$.diffed,Mt=$.__c,Bt=$.unmount,Ut=$.__;function ke(e,t){$.__h&&$.__h(D,e,xe||t),xe=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return xe=1,Hi(Ln,e)}function Hi(e,t,n){var r=ke(oe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ln(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],d=r.t(l,o);l!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.u)){var a=function(o,l,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!s||s.call(this,o,l,d);var u=!1;return h.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!s||s.call(this,o,l,d))};D.u=!0;var s=D.shouldComponentUpdate,c=D.componentWillUpdate;D.componentWillUpdate=function(o,l,d){if(this.__e){var h=s;s=void 0,a(o,l,d),s=h}c&&c.call(this,o,l,d)},D.shouldComponentUpdate=a}return r.__N||r.__}function C(e,t){var n=ke(oe++,3);!$.__s&&ft(n.__H,t)&&(n.__=e,n.i=t,D.__H.__h.push(n))}function mt(e,t){var n=ke(oe++,4);!$.__s&&ft(n.__H,t)&&(n.__=e,n.i=t,D.__h.push(n))}function ne(e){return xe=5,pt(function(){return{current:e}},[])}function pt(e,t){var n=ke(oe++,7);return ft(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function q(e,t){return xe=8,pt(function(){return e},t)}function J(e){var t=D.context[e.__c],n=ke(oe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(D)),t.props.value):e.__}function ji(){for(var e;e=An.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Re),e.__H.__h.forEach(it),e.__H.__h=[]}catch(t){e.__H.__h=[],$.__e(t,e.__v)}}$.__b=function(e){D=null,$t&&$t(e)},$.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ut&&Ut(e,t)},$.__r=function(e){Ot&&Ot(e),oe=0;var t=(D=e.__c).__H;t&&(He===D?(t.__h=[],D.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Re),t.__h.forEach(it),t.__h=[],oe=0)),He=D},$.diffed=function(e){Gt&&Gt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(An.push(t)!==1&&Rt===$.requestAnimationFrame||((Rt=$.requestAnimationFrame)||Wi)(ji)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),He=D=null},$.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Re),n.__h=n.__h.filter(function(r){return!r.__||it(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],$.__e(r,n.__v)}}),Mt&&Mt(e,t)},$.unmount=function(e){Bt&&Bt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Re(r)}catch(a){t=a}}),n.__H=void 0,t&&$.__e(t,n.__v))};var Ft=typeof requestAnimationFrame=="function";function Wi(e){var t,n=function(){clearTimeout(r),Ft&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ft&&(t=requestAnimationFrame(n))}function Re(e){var t=D,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),D=t}function it(e){var t=D;e.__c=e.__(),D=t}function ft(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ln(e,t){return typeof t=="function"?t(e):t}function Vi(e,t){for(var n in t)e[n]=t[n];return e}function rt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function zt(e,t){this.props=e,this.context=t}function _t(e,t){function n(a){var s=this.props.ref,c=s==a.ref;return!c&&s&&(s.call?s(null):s.current=null),t?!t(this.props,a)||!c:rt(this.props,a)}function r(a){return this.shouldComponentUpdate=n,be(e,a)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(zt.prototype=new ee).isPureReactComponent=!0,zt.prototype.shouldComponentUpdate=function(e,t){return rt(this.props,e)||rt(this.state,t)};var Ht=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ht&&Ht(e)};var jt=function(e,t){return e==null?null:te(te(e).map(t))},Yi={map:jt,forEach:jt,count:function(e){return e?te(e).length:0},only:function(e){var t=te(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:te},qi=T.__e;T.__e=function(e,t,n,r){if(e.then){for(var a,s=t;s=s.__;)if((a=s.__c)&&a.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}qi(e,t,n,r)};var Wt=T.unmount;function Rn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Vi({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Rn(r,t,n)})),e}function $n(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return $n(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function je(){this.__u=0,this.t=null,this.__b=null}function On(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Se(){this.u=null,this.o=null}T.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Wt&&Wt(e)},(je.prototype=new ee).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var a=On(r.__v),s=!1,c=function(){s||(s=!0,n.__R=null,a?a(o):o())};n.__R=c;var o=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=$n(l,l.__c.__P,l.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.t.pop();)d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(c,c)},je.prototype.componentWillUnmount=function(){this.t=[]},je.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Rn(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&be(w,null,e.fallback);return a&&(a.__u&=-33),[be(w,null,t.__a?null:e.children),a]};var Vt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]t[r.type]=r.value),{date:`${t.year}-${t.month}-${t.day}`,time:`${t.hour}:${t.minute}:${t.second}`}}function z(e){if(e??(e=R()),(e.time??"1")>"03:00:00")return e.date??R().date;const t=new Date(`${e.date}T00:00:00`);return t.setDate(t.getDate()-1),R(t).date}function dr(e,t){const n=new Date(e+"T00:00:00"),r=n.toLocaleString("en-US",{month:"long",day:"numeric"});if(t==="short")return r;const a=z();if(e===a)return`Today, ${r}`;const s=new Date(a);s.setDate(s.getDate()+1);const c=s.toISOString().split("T")[0];return e===c?`Tomorrow, ${r}`:`${n.toLocaleString("en-US",{weekday:"long"})}, ${r}`}function H(e){const t=e.split(":").slice(0,2).map(Number),n=t[0]>=12?"PM":"AM";return t[0]=t[0]%12||12,t.map(r=>String(r).padStart(2,"0")).join(":").replace(/^0/,"")+" "+n}function X(e){const[t,n]=e.slice(0,19).split("T");return{date:t,time:n}}function pe(e){const[t,n]=e.split(":").map(Number);return(t+17)%24*60+n}function he(e){if(!Array.isArray(e))return[];const t=R().time.slice(0,5),n=e.findIndex(r=>r>=t);return n>=0?e.slice(n):[]}const We=e=>Array.isArray(e)?e.join("."):e,O={get(e){const t=localStorage.getItem(We(e));try{return JSON.parse(t??"")}catch{return}},set(e,t){localStorage.setItem(We(e),JSON.stringify(t))},delete(e){localStorage.removeItem(We(e))},clear(){localStorage.clear()}},Ve=["bg1","auth"];class Un extends Error{constructor(){super("Auth data missing or expired");N(this,"name","ReauthNeeded")}}class ur{constructor(){N(this,"onUnauthorized",()=>{})}getData(){try{const t=O.get(Ve);if(t){const{swid:n,accessToken:r,expires:a}=t,s=R(a),c=R();if(s.date>c.date||s.date===c.date&&s.time>c.time&&s.time>="17")return{swid:n,accessToken:r}}}catch(t){console.error(t)}throw this.deleteData(),new Un}setData(t){O.set(Ve,t)}deleteData(){O.delete(Ve),setTimeout(this.onUnauthorized)}}const K=new ur,hr=8e3;async function Fn(e,t={}){const{params:n,data:r,timeout:a=hr,...s}=t;t=s,t.referrer||(t.referrer=""),t.credentials||(t.credentials="omit"),t.cache||(t.cache="no-store"),t.headers={...t.headers||{}},n&&Object.keys(n).length>0&&(e+=(e.includes("?")?"&":"?")+Object.entries(n).filter(([,d])=>d!=="").map(d=>d.map(encodeURIComponent).join("=")).join("&")),r&&(t.method||(t.method="POST"),t.headers={...t.headers,"Content-Type":"application/json"},t.body=JSON.stringify(r)),t.method||(t.method="GET");const c=new AbortController;t.signal=c.signal;const o=setTimeout(()=>c.abort(),a);let l;try{l=await fetch(e,t)}catch(d){return console.error(d),{ok:!1,status:0,data:null}}finally{clearTimeout(o)}return{ok:l.ok,status:l.status,data:(l.headers.get("Content-Type")||"").startsWith("application/json")?await l.json():{}}}class zn extends Error{constructor(){super(...arguments);N(this,"name","InvalidOrigin")}}class ue extends Error{constructor(n,r="Request failed"){super(`${r}: ${JSON.stringify(n)}`);N(this,"name","RequestError");this.response=n}}class Be{constructor(t){N(this,"resort");N(this,"origin");this.resort=t,this.origin=this.constructor.origins[this.resort.id]}static originToResortId(t){var a;const r=(a=Object.entries(this.origins).find(([,s])=>s===t))==null?void 0:a[0];if(r)return r;throw new zn(t)}async request(t){const{swid:n,accessToken:r}=K.getData(),a=this.origin+t.path,s=await Fn(a,{method:t.method,params:t.params,data:t.data,headers:{"Accept-Language":"en-US",Authorization:`BEARER ${r}`,"x-user-id":n}});if(s.status===401&&!t.ignoreUnauth)setTimeout(()=>K.deleteData());else{const{key:c}=t;if(s.ok&&(!c||s.data[c]))return{...s,data:c?s.data[c]:s.data}}throw new ue(s)}}N(Be,"origins",{WDW:"https://disneyworld.disney.go.com",DLR:"https://disneyland.disney.go.com"});const mr="modulepreload",pr=function(e){return"/bg1/"+e},Jt={},Oe=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=Promise.all(n.map(o=>{if(o=pr(o),o in Jt)return;Jt[o]=!0;const l=o.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${d}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":mr,l||(h.as="script",h.crossOrigin=""),h.href=o,c&&h.setAttribute("nonce",c),document.head.appendChild(h),l)return new Promise((u,p)=>{h.addEventListener("load",u),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${o}`)))})}))}return a.then(()=>t()).catch(s=>{const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s})},fr={48199:"Mr-Incredible",48200:"Mrs-Incredible",261227:"Nemo",339625:"Russell",339626:"Carl",364907:"Jack-Skellington",431014:"Princess-Tiana",431065:"Darth_Vader",15549505:"Rapunzel",15655408:"Default_SignedIn",15675686:"Crush",15831168:"Wall-E",16453979:"Merida",16726412:"Stormtrooper",16818199:"Violet",16869301:"Jack-Jack",17345357:"R2-D2",17345359:"C-3PO",17532220:"Bruce",17532224:"Green-Alien",17532227:"Kermit",17532228:"Sorcerer-Mickey",17577168:"Elsa",17577169:"Anna",17813977:"Olaf",17888784:"Yoda",18101167:"Captain-Mickey",18368743:"-Nick",18368747:"-Judy",18393706:"-Flash",18403761:"kion",18405224:"-Moana",18405236:"-Elena",19633995:"50th_Mickey",19633996:"50th_Minnie",90003819:"Alice",90003846:"Ariel",90003898:"Belle",90003967:"Buzz",90003976:"Captain-Hook",90004004:"Chesire-Cat",90004017:"Cinderella",90004068:"Daisy",90004076:"Dash",90004104:"Donald",90004228:"Goofy",90004260:"Hamm",90004328:"Princess-Jasmine",90004340:"Jiminy",90004395:"Lady",90004482:"Mickey-Mouse",90004486:"Minnie",90004537:"Mulan",90004605:"Peter-Pan",90004625:"Pluto",90004626:"Pocahontas",90004642:"Princess-Aurora",90004682:"Rex",90004772:"Snow-White",90004778:"Sparky",90004846:"TinkerBell",90004860:"Tramp",90004939:"Zero"},gt="https://cdn1.parksmedia.wdprapps.disney.com/resize/mwImage/1/90/90/75/dam/",_r=gt+"wdpro-assets/avatars/180x180/RetAvatar_180x180_",gr=gt+"wdpro-assets/avatars/180x180/RetAvatar-180x180",yr=gt+"disney-world/50th-anniversary/avatars/RetAvatar_180x180_",vr={"-":gr,5:yr};function Ge(e){const t=fr[e||""];if(t)return(vr[t[0]]||_r)+t+".png"}const br=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((a,s)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},de=(e,t)=>`/das-vas/api/v${t}/${e}`;function Xt(e){return{id:e.id,name:e.name.replace(/ \(Me\)$/,""),avatarImageUrl:Ge(e.characterId)}}function Zt(e,t){return{primaryGuestId:e.id,guestIds:t.map(n=>n.id).join(",")}}class Hn extends Error{constructor(n){super();N(this,"name","ConflictsError");this.conflicts=n}}class xr extends Error{constructor(){super(...arguments);N(this,"name","ExperienceUnavailable")}}var lt;class wr extends Be{constructor(){super(...arguments);N(this,"bookingGuestId");Pt(this,lt)}async experiences(n){const r=encodeURIComponent(n.id),{data:a}=await this.request({path:de(`availability/parks/${r}/experiences`,2),key:"experiences"});return a.filter(s=>s.available&&!!s.nextAvailableStartDateTime).map(s=>{const{time:c}=X(s.nextAvailableStartDateTime);try{return{...s,...this.resort.experience(s.id),time:c}}catch{return{...s,time:c}}}).sort((s,c)=>s.name.localeCompare(c.name))}async parties(){const{swid:n}=K.getData(),{data:{bookingGuestId:r,parties:a}}=await this.request({path:de(`users/${encodeURIComponent(n)}/parties`,1)});return this.bookingGuestId=r,a.map(s=>({primaryGuest:Xt(s.primaryGuest),linkedGuests:s.linkedGuests.map(Xt),selectionLimit:s.selectionLimit}))}async book({park:n,experience:r,primaryGuest:a,guests:s}){var h;const c=await this.eligibility({park:n,experience:r,primaryGuest:a,guests:s}),o=new Set((h=c.find(({type:u})=>u==="ELIGIBLE"))==null?void 0:h.guestIds);if(!s.every(u=>o.has(u.id)))throw new Hn(Object.fromEntries(c.filter(u=>u.type!=="ELIGIBLE").flatMap(u=>u.guestIds.map(p=>[p,u.type]))));const l=new Map(s.map(u=>[u.id,u])),{data:d}=await this.request({path:de("bookings",2),key:"booking",data:{bookingGuestId:this.bookingGuestId,primaryGuestId:a.id,guestIds:s.map(u=>u.id),experienceId:r.id,...await this.availability({experience:r,primaryGuest:a,guests:s})}});return{type:"DAS",subtype:"IN_PARK",id:r.id,name:r.name,park:n,guests:d.entitlements.map(u=>{const p=l.get(u.guestId);return{id:u.guestId,name:(p==null?void 0:p.name)??"",avatarImageUrl:p==null?void 0:p.avatarImageUrl,entitlementId:u.id}}),start:X(d.startDateTime),end:{},bookingId:d.id}}async cancelBooking(n){const a=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:de(`entitlements/${a}`,1),method:"DELETE"})}async eligibility({park:n,experience:r,primaryGuest:a,guests:s}){const{data:c}=await this.request({path:de("eligibility",1),params:{experienceId:r.id,parkId:n.id,...Zt(a,s)},key:"eligibility"});return c}async availability({experience:n,primaryGuest:r,guests:a}){const s=encodeURIComponent(n.id),{data:{startDateTime:c,endDateTime:o}}=await this.request({path:de(`availability/experiences/${s}`,3),params:Zt(r,a)});if(!c||!o)throw new xr;return{startDateTime:c,endDateTime:o}}}lt=new WeakMap;class kr{constructor(t){N(this,"cachedShowtimes",{});this.resort=t}async shows(t){Object.keys(this.cachedShowtimes).length===0&&(this.cachedShowtimes=(await this.request("showtimes")).data);const n=this.cachedShowtimes[t.id]??{},{time:r}=R();return Object.fromEntries(Object.entries(n).flatMap(([a,s])=>{const c=s.filter(u=>u>=r),o=c[0],l=c.slice(1),d=o!==void 0,h=d?void 0:"NO_MORE_SHOWS";try{return[[a,{type:"ENTERTAINMENT",...this.resort.experience(a),park:t,standby:{available:d,unavailableReason:h,nextShowTime:o},additionalShowTimes:l}]]}catch(u){if(u instanceof re)return[];throw u}}))}async request(t){const n=await Fn(`https://bg1.joelface.com/livedata/${this.resort.id.toLowerCase()}/${t}.json`);if(!n.ok)throw new Error("Fetch failed");return n}}const Ir=e=>e.sort((t,n)=>+n.primary-+t.primary||+n.preselected-+t.preselected||t.name.localeCompare(n.name)),Er=e=>`/application/v1/guest/${e}`;class yt extends Be{async getQueues(){var n;const t=await this.post({resource:"getQueues"});if(!Array.isArray((n=t.data)==null?void 0:n.queues))throw new ue(t);return t.data.queues.filter(r=>!!r.categoryContentId).map(({queueId:r,tabContentId:a="",...s})=>{const c={...s,id:r};try{c.park=this.resort.park(a.split(";")[0])}catch(o){if(!(o instanceof re))throw o}return c})}async getQueue(t){const n=(await this.getQueues()).find(r=>r.id===t.id);if(n)return n;throw new Error("Queue not Found")}async getLinkedGuests(t){const{data:n}=await this.post({resource:"getLinkedGuests",data:{queueId:t.id,requestType:"REVIEW"}});return Ir(n.guests.map(({guestId:r,firstName:a="",lastName:s="",isPrimaryGuest:c,isPreselected:o,avatarImageUrl:l})=>({id:r,name:`${a} ${s}`.trim(),primary:!!c,preselected:!!o,avatarImageUrl:l})))}async joinQueue(t,n){const r=n.map(c=>c.id),a=await this.post({resource:"joinQueue",data:{queueId:t.id,guestIds:r}}),{data:s}=a;if(s.responseStatus==="OK"){const c=s.positions.find(o=>o.queueId===t.id&&o.guestIds.length>0&&r.some(l=>o.guestIds.includes(l)));if(!c)throw new ue(a);return{boardingGroup:c.boardingGroup,conflicts:{},closed:!1}}else if(s.responseStatus==="INVALID_GUEST"||s.responseStatus==="CLOSED_QUEUE"){const c=s.responseStatus==="CLOSED_QUEUE",o=new Set,l={};for(const u of s.conflicts)for(const p of u.guestIds){const f=n.find(b=>b.id===p);f&&(l[f.id]=u.conflictType,o.add(p))}const d=n.filter(u=>!o.has(u.id));if(c||d.length===0)return{boardingGroup:null,conflicts:l,closed:c};const h=await this.joinQueue(t,d);return h.conflicts={...l,...h.conflicts},h}else throw new ue(a)}async post(t){try{return await this.request({...t,method:"data"in t?"POST":"GET",path:Er(t.resource)})}catch(n){if(n instanceof ue){const r=n.response,{ok:a,status:s}=r;if(!a&&s<500&&s!==401)return r}throw n}}}N(yt,"origins",{WDW:"https://vqguest-svc-wdw.wdprapps.disney.com",DLR:"https://vqguest-svc.wdprapps.disney.com"});class re extends Error{constructor(n){super(`Invalid ID: ${n}`);N(this,"name","InvalidId")}}class jn{constructor(t,n){N(this,"parks");N(this,"genie");N(this,"vq");N(this,"das");N(this,"liveData");N(this,"parksById");N(this,"expsById");N(this,"dropExpsByPark");var r,a,s;this.id=t,this.parks=n.parks,this.parksById=Object.fromEntries(this.parks.map(c=>[c.id,c])),this.expsById=n.experiences,this.dropExpsByPark=new Map(this.parks.map(c=>[c,[]]));for(const[c,o]of Object.entries(this.expsById))o&&(o.id=c,o.park=o.land.park),o!=null&&o.dropTimes&&((r=this.dropExpsByPark.get(o.land.park))==null||r.push(o));for(const c of this.parks)c.dropTimes=[...new Set((a=this.dropExpsByPark.get(c))==null?void 0:a.flatMap(o=>o.dropTimes??[]))].sort(),(s=this.dropExpsByPark.get(c))==null||s.sort((o,l)=>o.name.localeCompare(l.name));this.genie=t==="WDW"?new Dr(this):new Ar(this),this.vq=new yt(this),this.das=new wr(this),this.liveData=new kr(this)}experience(t){const n=this.expsById[t];if(n)return n;throw n!==null&&console.warn(`Missing experience: ${t}`),new re(t)}park(t){const n=this.parksById[t];if(n)return n;throw new re(t)}dropExperiences(t){return this.dropExpsByPark.get(t)??[]}}async function Nr(e){const t=await br(Object.assign({"./data/dlr.ts":()=>Oe(()=>import("./dlr.js"),[]),"./data/wdw.ts":()=>Oe(()=>import("./wdw.js"),[])}),`./data/${e.toLowerCase()}.ts`,3);return new jn(e,t)}const Tr={WDW:"wdw-itinerary-api",DLR:"dlr-itinerary-web-api"},Sr={WDW:{id:"80010110",park:{id:"80007944"}},DLR:{id:"353295",park:{id:"330339"}}},Cr=new Set(["ACTIVITY","DINING"]),Ce=e=>e.split(";")[0];function Wn(e){const t=R();return e.modifiable&&z(e.start)===z(t)}class Pr extends Error{constructor(){super(...arguments);N(this,"name","ModifyNotAllowed")}}function Vn(e){if(e&&!Wn(e))throw new Pr}function Ye(e,t,n){return+(e.ineligibleReason===n)-+(t.ineligibleReason===n)}class vt extends Be{constructor(n,r){super(n);N(this,"allowsCrossParkModify",!1);N(this,"allowsTimeSelect",!1);N(this,"maxPartySize",12);N(this,"nextBookTime");N(this,"onUnauthorized",()=>{});N(this,"partyIds",new Set);N(this,"guestCache",new Map);N(this,"tracker");N(this,"primaryGuestId","");N(this,"convertGuest",n=>{const{id:r,firstName:a,lastName:s,characterId:c,...o}=n,l=`${a} ${s}`.trim();if(!this.guestCache.has(r))switch(n.ineligibleReason){case"INVALID_PARK_ADMISSION":case"PARK_RESERVATION_NEEDED":case"GENIE_PLUS_NEEDED":n.primary&&this.cacheGuest(r,l,c);break;default:this.cacheGuest(r,l,c)}const d=Ge(c);return this.partyIds.size>0&&!this.partyIds.has(r)&&(o.ineligibleReason="NOT_IN_PARTY",delete o.eligibleAfter),{...o,id:r,name:l,avatarImageUrl:d}});this.tracker=r??new Lr}setPartyIds(n){this.partyIds=new Set(n)}async experiences(n){return this.requestExperiences(n,{path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0})}async requestExperiences(n,r){var s,c,o,l;await this.primeGuestCache();const{data:a}=await this.request(r);return this.nextBookTime=(l=(((o=(c=(s=a.eligibility)==null?void 0:s.geniePlusEligibility)==null?void 0:c[z()])==null?void 0:o.flexEligibilityWindows)||[]).sort((d,h)=>d.time.time.localeCompare(h.time.time))[0])==null?void 0:l.time.time,a.availableExperiences.flatMap(d=>{try{return[{...d,...this.resort.experience(d.id),park:n,experienced:this.tracker.experienced(d)}]}catch(h){if(h instanceof re)return[];throw h}})}async cancelBooking(n){const a=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:`/ea-vas/api/v1/entitlements/${a}`,method:"DELETE"})}async bookings(){const{swid:n}=K.getData(),r=R().date,a=z(),s=Tr[this.resort.id],{data:{items:c=[],assets:o={},profiles:l={}}}=await this.request({path:`/plan/${s}/api/v1/itinerary-items/${n}?item-types=FASTPASS&item-types=DINING&item-types=ACTIVITY&item-types=VIRTUAL_QUEUE_POSITION`,params:{destination:this.resort.id,fields:"items,profiles,assets","guest-locators":n+";type=swid","guest-locator-groups":"MY_FAMILY","start-date":r,"show-friends":"false"},ignoreUnauth:!0}),d=m=>{const{name:g,avatarId:_,type:y}=l[m.id];return{id:Ce(m.id),name:`${g.firstName} ${g.lastName}`.trim(),avatarImageUrl:Ge(_),...y==="transactional"&&{transactional:!0}}},h=m=>{const g=o[m.asset],y=o[g.facility].location??"",S=this.getPark(y);S.name===""&&y&&(S.name=o[y].name);const A=new Date(m.startDateTime);return{type:"RES",subtype:m.type,id:Ce(m.asset),park:S,name:g.name,start:R(A),guests:m.guests.map(d).sort((B,U)=>+(U.id===this.primaryGuestId)-+(B.id===this.primaryGuestId)||+!U.transactional-+!B.transactional||B.name.localeCompare(U.name)),bookingId:m.id}},u=m=>{const g=o[m.facility],_=new Set;return{...this.getBookingExperienceData(m.facility,g.location,g.name),start:(m.displayStartDate??r)_.has(y.id)||y.redemptionsRemaining===0?!1:(_.add(y.id),!0)).map(y=>({...d(y),entitlementId:y.entitlementId,bookingId:y.bookingId,...y.redemptionsRemaining!==void 0&&{redemptions:Math.min(y.redemptionsRemaining,y.redemptionsAllowed??1)}})),bookingId:m.id}},p=m=>{const g={FLEX:"G+",STANDARD:"ILL",OTHER:"OTHER"},_=m.multipleExperiences?"MEP":g[m.kind];if(!_)return;const y=_==="G+";let S={type:"LL",subtype:_,...u(m),cancellable:m.cancellable&&y,modifiable:m.modifiable&&y,bookingId:m.id};if(S.modifiable=Wn(S),m.multipleExperiences){const A=m.assets.find(I=>I.original);S={...S,...A?this.getBookingExperienceData(A.content,o[A.content].location):{id:"",name:""}},S.choices=m.assets.filter(I=>!I.excluded&&!I.original).map(({content:I})=>{const{name:B,location:U}=o[I];return this.getBookingExperienceData(I,U,B)}).sort((I,B)=>I.name.localeCompare(B.name))}return S},f=m=>{const _={DAS:"IN_PARK",FDS:"ADVANCE"}[m.kind],y=_==="IN_PARK";return{type:"DAS",subtype:_,cancellable:m.cancellable&&y,...u(m)}},b=m=>{const g=o[m.asset],_=o[g.facility],y=this.getBookingExperienceData(g.facility,_.location,g.name);return y.park.name===""&&(y.park.name=_.name),{...y,type:"BG",boardingGroup:m.boardingGroup.id,status:m.status,start:R(new Date(m.startDateTime)),guests:m.guests.map(d),bookingId:m.id}},x={PARK_PASS:m=>{const g=this.getPark(o[m.facility].location);if(g)return{type:"APR",id:g.id,name:g.name,park:g,start:{date:m.displayStartDate,time:"06:00:00"},guests:m.guests.map(d),bookingId:m.id}},DAS:f,FDS:f},v=c.map(m=>{try{if(m.type==="FASTPASS")return(x[m.kind]??p)(m);if(m.type==="VIRTUAL_QUEUE_POSITION")return b(m);if(m.type&&Cr.has(m.type))return h(m)}catch(g){console.error(g)}}).filter(m=>!!m);return this.tracker.update(v,this),v}getPark(n){n=Ce(n);try{return this.resort.park(n)}catch(r){if(r instanceof re)return{id:n,name:"",icon:"",geo:{n:0,s:0,e:0,w:0},theme:{bg:"bg-blue-500",text:"text-blue-500"},dropTimes:[]};throw r}}getBookingExperienceData(n,r,a="Experience"){n=Ce(n);try{const s=this.resort.experience(n);return{id:n,name:s.name,park:s.park}}catch(s){if(s instanceof re&&r)return{id:n,name:a,park:this.getPark(r)};throw s}}async primeGuestCache(){this.primaryGuestId===""&&(await this.guests(),this.primaryGuestId||(this.primaryGuestId="."))}cacheGuest(n,r,a){this.guestCache.set(n,{name:r,characterId:a})}async request(n){if(n.userId){const{swid:r}=K.getData();n={...n},n.params={...n.params,userId:r}}return super.request(n)}parseGuests(n){var o;const{guests:r,ineligibleGuests:a}=n;this.primaryGuestId=((o=[...r,...a].find(l=>!!l.primary))==null?void 0:o.id)??this.primaryGuestId;const s=r.map(this.convertGuest),c=a.map(this.convertGuest);return c.sort((l,d)=>{const h=+!l.primary-+!d.primary||l.name.localeCompare(d.name);return l.eligibleAfter||d.eligibleAfter?(l.eligibleAfter||"99").localeCompare(d.eligibleAfter||"99")||h:l.ineligibleReason===d.ineligibleReason?h:Ye(l,d,"NOT_IN_PARTY")||Ye(l,d,"MULTI_PASS_NEEDED")||Ye(d,l,"EXPERIENCE_LIMIT_REACHED")||h}),{eligible:s,ineligible:c}}fallbackExperience(n){return n?this.resort.experience(n.id):Sr[this.resort.id]}}class Dr extends vt{constructor(){super(...arguments);N(this,"allowsCrossParkModify",!0);N(this,"allowsTimeSelect",!0);N(this,"maxPartySize",20)}async experiences(n,r){return this.requestExperiences(n,!r||R().date===r?{path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0}:{path:""})}async guests(n){const r=this.fallbackExperience(n),{data:{guests:a,ineligibleGuests:s}}=await this.request({path:"/ea-vas/planning/api/v1/experiences/guest/guests",data:{date:R().date,facilityId:r.id,parkId:r.park.id}});return this.parseGuests({guests:a,ineligibleGuests:s.map(c=>c.ineligibleReason?{...c,ineligibleReason:c.ineligibleReason.ineligibleReason}:c)})}async offer(n,r,a){Vn(a);const{date:s,time:c}=R(),{nextAvailableTime:o}=n.flex,{data:l}=await this.request({path:`/ea-vas/planning/api/v1/experiences${a?"/mod":""}/offerset/generate`,data:{date:a?a.start.date:s,parkId:n.park.id,guestIds:r.map(m=>m.id),targetedTime:o??c,ignoredBookedExperienceIds:null,...a?{experienceId:n.id,originalExperienceId:a==null?void 0:a.id,originalEntitlementIds:a==null?void 0:a.guests.map(m=>m.entitlementId)}:{experienceIds:[n.id]}}}),d=l.itinerary.items.find(m=>m.type==="OFFER_ITEM"),{guests:h,ineligibleGuests:u}=l.party;if(!d)throw new ue({ok:!1,status:410,data:l});const{offerSetId:p,offerId:f,startDateTime:b,endDateTime:k}=d,x=Object.fromEntries(r.map(m=>[m.id,m]));let v={offerSetId:p,id:f,start:X(b),end:X(k),experience:n,guests:{eligible:(h||[]).map(m=>({...x[m.id],...this.convertGuest(m)})),ineligible:(u||[]).map(this.convertGuest)},active:!0,changed:d.conflict==="ALTERNATIVE_TIME_FOUND",modifying:a};if(v.changed&&o&&pe(v.start.time)-pe(o)>15)try{v=await this.changeOfferTime(v,{startTime:"00:00:00",endTime:"00:00:00"}),v.changed=v.start.time!==o}catch(m){console.error(m)}return v}async times(n){const{data:r}=await this.request({path:`/ea-vas/planning/api/v1/experiences${n.modifying?"/mod":""}/offerset/times`,data:{experienceId:n.experience.id,parkId:n.experience.park.id,date:n.start.date,offerId:n.id,offerSetIds:[n.offerSetId],guestIds:n.guests.eligible.map(a=>a.id),offerType:"FLEX",experienceIdsToIgnore:[],originalOrderItemId:null}});return r.hourSegmentGroups.map(a=>({hour:Number(a.hourSegmentWindow.startTime.split(":")[0]),slots:a.inventorySlotsAvailability.map(({startTime:s,endTime:c})=>({startTime:s,endTime:c}))}))}async changeOfferTime(n,r){const{data:{updatedPlanningOfferDisplayItem:a}}=await this.request({path:`/ea-vas/planning/api/v1/experiences${n.modifying?"/mod":""}/offerset/times/fulfill`,data:{parkId:n.experience.park.id,date:n.start.date,offerId:n.id,...n.modifying?{offerSetId:n.offerSetId}:{offerSetIds:[n.offerSetId]},offerType:"FLEX",guestIds:n.guests.eligible.map(s=>s.id),targetSlot:r,experienceIdsToIgnore:[]}});return{...n,id:a.offerId,offerSetId:a.offerSetId,start:X(a.startDateTime),end:X(a.endDateTime),changed:a.conflict==="ALTERNATIVE_TIME_FOUND"}}async book(n,r){if(n.modifying)return this.modify(n,r);const{data:a}=await this.request({path:"/ea-vas/planning/api/v1/experiences/entitlements/book",data:{offerSetId:n.offerSetId,orderGuestDetails:n.guests.eligible.filter(s=>!!s.orderDetails).map(({id:s,orderDetails:{externalIdentifier:c,...o}})=>({guestDetails:[{guestId:s,externalIdentifier:c}],...o}))}});return this.createLLFromResponse(a)}async modify(n,r){const{offerSetId:a,guests:{eligible:s}}=n,c=new Set((r??n.guests.eligible).map(d=>d.id)),o=Object.fromEntries(n.modifying.guests.map(d=>[d.id,d.entitlementId])),{data:l}=await this.request({path:"/ea-vas/planning/api/v1/experiences/mod/entitlements/book",data:{offerSetId:a,eligibleGuestsEntitlements:s.filter(d=>c.has(d.id)).map(d=>({guestId:d.id,entitlementId:o[d.id],...d.orderDetails}))}});return this.createLLFromResponse({entitlementExperiences:[l.booking],party:l.party})}createLLFromResponse(n){var s;const r=n.entitlementExperiences[0],a=Object.fromEntries(r.guests.map(c=>[c.guestId,c.entitlementId]));return{type:"LL",subtype:"G+",...this.getBookingExperienceData(r.experienceId),bookingId:(s=r.guests[0])==null?void 0:s.entitlementId,start:X(r.startDateTime),end:X(r.endDateTime),cancellable:!0,modifiable:!1,guests:n.party.guests.map(c=>({...this.convertGuest(c),entitlementId:a[c.id]}))}}}class Ar extends vt{async guests(t){const n=this.fallbackExperience(t),{data:r}=await this.request({path:"/ea-vas/api/v1/guests",params:{productType:"FLEX",experienceId:n.id,parkId:n.park.id},userId:!0});return this.parseGuests(r)}async offer(t,n,r){Vn(r);const{data:{offer:{id:a,date:s,startTime:c,endTime:o,status:l,changeStatus:d},eligibleGuests:h,ineligibleGuests:u}}=await this.request({path:r?"/ea-vas/api/v1/products/modifications/flex/offers":"/ea-vas/api/v2/products/flex/offers",method:"POST",data:{guestIds:((r==null?void 0:r.guests)??n).map(p=>p.id),ineligibleGuests:[],primaryGuestId:n.map(p=>p.id).sort((p,f)=>p.localeCompare(f))[0],parkId:t.park.id,experienceId:t.id,selectedTime:t.flex.nextAvailableTime,...r?{date:R().date,modificationType:t.id===r.id?"TIME":"EXPERIENCE"}:{}}});return Oe(()=>import("./diu.js"),[]),{id:a,start:{date:s,time:c},end:{date:s,time:o},active:l==="ACTIVE",changed:d!=="NONE",modifying:r,guests:{eligible:(h||[]).map(this.convertGuest),ineligible:(u||[]).map(this.convertGuest)},experience:t}}async times(){return[]}async changeOfferTime(t){return t}async book(t,n){var u;const r=(await Oe(async()=>{const{default:p}=await import("./diu.js");return{default:p}},[])).default,a=new Set((n??t.guests.eligible).map(p=>p.id)),{data:s}=await this.request({path:t.modifying?"/ea-vas/api/v2/products/modifications/flex/bookings":"/ea-vas/api/v2/products/flex/bookings",method:"POST",data:{offerId:t.id,...await r(t.id),...t.modifying?{date:R().date,modificationType:t.modifying.id===t.experience.id?"TIME":"EXPERIENCE",existingEntitlements:t.modifying.guests.filter(p=>a.has(p.id)).map(p=>({entitlementId:p.entitlementId,entitlementBookingId:p.bookingId})),guestIdsToExclude:t.modifying.guests.filter(p=>!a.has(p.id)).map(p=>p.id)}:{}},key:"booking"}),{singleExperienceDetails:{experienceId:c,parkId:o},entitlements:l,startDateTime:d,endDateTime:h}=s;return{type:"LL",subtype:"G+",...this.getBookingExperienceData(c,o),bookingId:(u=l[0])==null?void 0:u.id,start:X(d),end:X(h),cancellable:!0,modifiable:!1,guests:l.map(p=>{const f=this.guestCache.get(p.guestId);return{id:p.guestId,name:(f==null?void 0:f.name)||"",avatarImageUrl:Ge(f==null?void 0:f.characterId),entitlementId:p.id}})}}}const en=["bg1","genie","bookings"];class Lr{constructor(){N(this,"date");N(this,"expIds",new Set);N(this,"experiencedExpIds",new Set);const{date:t=z(),expIds:n=[],experiencedExpIds:r=[]}=O.get(en)??{};this.date=t,this.expIds=new Set(n),this.experiencedExpIds=new Set(r),this.checkDate()}experienced(t){return this.experiencedExpIds.has(t.id)}async update(t,n){this.checkDate();const r=z(),a=t.filter(c=>c.type==="LL"&&!!c.cancellable&&z(c.start)===r);for(const c of a)this.experiencedExpIds[c.modifiable?"delete":"add"](c.id);const s=this.expIds;this.expIds=new Set(a.map(c=>c.id));for(const c of s){if(this.expIds.has(c))continue;const{ineligible:o}=await n.guests({id:c}),l=o.some(d=>d.ineligibleReason==="EXPERIENCE_LIMIT_REACHED");this.experiencedExpIds[l?"add":"delete"](c)}O.set(en,{date:this.date,expIds:[...this.expIds],experiencedExpIds:[...this.experiencedExpIds]})}checkDate(){const t=z();this.date!==t&&(this.date=t,this.expIds=new Set,this.experiencedExpIds=new Set)}}const Yn=Q(new jn("WDW",{experiences:{},parks:[]})),Rr=Yn.Provider,L=()=>J(Yn),qn=Q({goTo:()=>{},goBack:async()=>{}}),$r=qn.Provider,G=()=>J(qn),Kn=Q({current:i("div",{})}),Or=Kn.Provider,Qn=()=>J(Kn);let Gr=0;const tn=()=>++Gr,Pe=()=>Number(location.hash.slice(1))||0;let qe=()=>{};function Jn({children:e}){const[t,n]=E({current:e}),r=ne([{elem:e,key:0}]),a=ne({goTo(c,o){let l=Pe(),d;o!=null&&o.replace?(d=r.current[l].key??tn(),n(h=>({...h,current:c}))):(r.current=r.current.slice(0,++l),location.hash=`#${l}`,d=tn()),r.current[l]={elem:c,key:d}},goBack({screen:c,props:o}={}){if(c){const l=Pe();for(let d=l-1;d>=0;--d)if(r.current[d].elem.type===c){if(history.go(d-l),o){const h={...r.current[d].elem.props,...o};r.current[d].elem=i(c,{...h})}break}}else history.back();return new Promise(l=>{qe=()=>{l(),qe=()=>{}}})}});C(()=>{function c(){var d,h;qe();const l=Pe();l>=r.current.length?history.back():n({current:((d=r.current[l])==null?void 0:d.elem)??i("div",{}),prev:(h=r.current[l-1])==null?void 0:h.elem})}function o(l){l.preventDefault()}return location.replace("#0"),addEventListener("hashchange",c),addEventListener("beforeunload",o),()=>{removeEventListener("hashchange",c),removeEventListener("beforeunload",o)}},[]);const s=Math.min(Pe(),r.current.length-1);return i($r,{value:a.current,children:i(Or,{value:t,children:r.current.slice(0,s+1).map(({elem:c,key:o},l)=>i("article",{hidden:l!==s,children:c},o))})})}const bt={bg:"bg-blue-500",text:"text-blue-500"},Xn=Q(bt),Zn=Xn.Provider,W=()=>J(Xn),Mr={normal:"py-1",small:"py-1.5 text-xs uppercase tracking-wide",full:"w-full py-3"};function P(e){const{goBack:t}=G(),{type:n,back:r,onClick:a,className:s,...c}=e;let o=`${Mr[n||"normal"]} ${s||""}`;const{bg:l}=W();return o.includes(" bg-")||(o+=` ${l} text-white`),i("button",{onClick:async()=>{a&&await a(),r&&(r===!0?t():t(r))},className:`${o} inline-flex items-center justify-center min-w-[36px] rounded-lg px-2 font-semibold disabled:opacity-50`,...c})}function V(e){return i("div",{className:"mb-20",children:i("div",{className:"fixed bottom-0 left-0 w-full px-5 pb-5 text-center",children:i(P,{...e,className:"max-w-2xl mx-auto shadow-[0px_4px_8px_-1px_#0005]",type:"full"})})})}function j({children:e,className:t,title:n}){return t||(t=""),t.match(/\bw-\S+\s*/)||(t+=" w-4"),t.match(/\bh-\S+\s*/)||(t+=" h-auto"),i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",className:`mx-auto ${t}`,role:"img",children:[n&&i("title",{children:n}),e]})}/** * Modified arrow-left2 icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function Br(e){return i(j,{...e,children:i("path",{d:"M0.293,7.337L7.333,0.297C7.723,-0.093 8.357,-0.093 8.747,0.297C9.137,0.687 9.137,1.321 8.747,1.711L3.414,7.044L15,7.044C15.552,7.044 16,7.492 16,8.044C16,8.596 15.552,9.044 15,9.044L3.414,9.044L8.747,14.377C9.137,14.767 9.137,15.401 8.747,15.791C8.357,16.181 7.723,16.181 7.333,15.791L0.293,8.751C0.102,8.561 0,8.307 0,8.044C0,7.781 0.102,7.527 0.293,7.337Z"})})}function Ur({title:e,subhead:t,children:n}){const{prev:r}=Qn(),{bg:a,text:s}=W();function c(o){return!Mn(o)||typeof o.type=="string"?o:o.type===w?Yi.map(o.props.children,c):sr(o,{className:`bg-white bg-opacity-90 ${s} ${o.props.className||""}`})}return i("div",{className:`px-3 ext-lg text-white ${a}`,children:[i("div",{className:"flex justify-end gap-x-2 gap-y-1 min-h-[36px] py-2",children:[!!r&&i(P,{back:!0,className:"-my-2 -ml-3",title:"Go Back",children:i(Br,{})}),i("h1",{className:"flex-1 self-center py-1 text-xl font-semibold overflow-hidden whitespace-nowrap",children:e}),c(n)]}),t&&i("div",{className:`flex flex-col gap-y-1 pb-1 ${a} text-white text-sm font-semibold uppercase text-center`,children:t})]})}function M({title:e,buttons:t,subhead:n,footer:r,theme:a,children:s,contentRef:c}){const o=W();return a??(a=o),i(Zn,{value:a,children:i("div",{className:"fixed inset-0 flex flex-col",children:[i(Ur,{title:e,subhead:n,children:t}),i("div",{ref:c,className:"relative flex-1 overflow-auto px-3 pb-3",children:s}),r&&i("div",{className:`relative ${a.bg} text-white font-semibold`,children:r})]})})}const nn=["bg1","disclaimer","accepted"],Fr={bg:"bg-red-600",text:"text-red-600"};function Hr(){const[e,t]=E(!!O.get(nn));return e?null:i(zr,{onAccept:()=>{O.set(nn,1),t(!0)}})}function zr({onAccept:e}){return i(M,{title:"Warning!",theme:Fr,children:[i("p",{children:'Use at your own risk. BG1 is highly experimental, for demonstration purposes only, and provided "as is" without warranty of any kind. It is in no way endorsed by or associated with the Walt Disney Company and could stop working at any time for any reason. To ensure the intended experience, always use the official Disney app.'}),i(V,{onClick:e,children:"Accept"})]})}function ei(){return i(M,{title:"BG1 News",children:i("iframe",{src:"https://joelface.github.io/bg1/news.html",className:"absolute inset-0 w-full h-full"})})}const rn=["bg1","news","version"];function jr(e){const[t,n]=E(()=>{const r=Number(O.get(rn));return Number.isInteger(r)?r:0});return t{O.set(rn,e),n(e)},children:"Close"})]}):null}function xt(e){const t=()=>{document.hidden||e()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}const Wr="https://cdn.registerdisney.go.com/v4/OneID.js",Ke="oneid-script",Vr="oneid-wrapper",Yr="oneid-secure-responder";function qr({resort:e,onLogin:t}){return C(()=>{const n=navigator.userAgent.includes("Android")?"AND":"IOS",r=`TPR-${e.id}-LBSDK.${n}`,a=()=>localStorage.removeItem(r+"-PROD.guest");let s=0;async function c(){if(!window.OneID){s=self.setTimeout(c,100);return}a();const o=window.OneID.get({clientId:r,responderPage:"https://joelface.github.io/bg1/responder.html"});o.on("login",({token:l})=>{a(),t({swid:l.swid,accessToken:l.access_token,expires:new Date(l.exp).getTime()})}),o.on("close",()=>{o.launchLogin()}),await o.init(),o.launchLogin()}if(!document.getElementById(Ke)){const o=document.createElement("script");o.id=Ke,o.src=Wr,document.head.appendChild(o)}return c(),()=>{var o;s&&clearTimeout(s);for(const l of[Vr,Yr,Ke]){const d=document.getElementById(l);(o=d==null?void 0:d.parentNode)==null||o.removeChild(d)}}},[e,t]),i("div",{className:"fixed top-0 left-0 w-full h-full border-0"})}const ti=Q([]),ni=()=>J(ti);function Kr({children:e}){const{das:t}=L(),[n,r]=E([]);return C(()=>{t.parties().then(r)},[t]),i(ti.Provider,{value:n,children:e})}/** + */function Br(e){return i(j,{...e,children:i("path",{d:"M0.293,7.337L7.333,0.297C7.723,-0.093 8.357,-0.093 8.747,0.297C9.137,0.687 9.137,1.321 8.747,1.711L3.414,7.044L15,7.044C15.552,7.044 16,7.492 16,8.044C16,8.596 15.552,9.044 15,9.044L3.414,9.044L8.747,14.377C9.137,14.767 9.137,15.401 8.747,15.791C8.357,16.181 7.723,16.181 7.333,15.791L0.293,8.751C0.102,8.561 0,8.307 0,8.044C0,7.781 0.102,7.527 0.293,7.337Z"})})}function Ur({title:e,subhead:t,children:n}){const{prev:r}=Qn(),{bg:a,text:s}=W();function c(o){return!Mn(o)||typeof o.type=="string"?o:o.type===w?Yi.map(o.props.children,c):sr(o,{className:`bg-white bg-opacity-90 ${s} ${o.props.className||""}`})}return i("div",{className:`px-3 ext-lg text-white ${a}`,children:[i("div",{className:"flex justify-end gap-x-2 gap-y-1 min-h-[36px] py-2",children:[!!r&&i(P,{back:!0,className:"-my-2 -ml-3",title:"Go Back",children:i(Br,{})}),i("h1",{className:"flex-1 self-center py-1 text-xl font-semibold overflow-hidden whitespace-nowrap",children:e}),c(n)]}),t&&i("div",{className:`flex flex-col gap-y-1 pb-1 ${a} text-white text-sm font-semibold uppercase text-center`,children:t})]})}function M({title:e,buttons:t,subhead:n,footer:r,theme:a,children:s,contentRef:c}){const o=W();return a??(a=o),i(Zn,{value:a,children:i("div",{className:"fixed inset-0 flex flex-col",children:[i(Ur,{title:e,subhead:n,children:t}),i("div",{ref:c,className:"relative flex-1 overflow-auto px-3 pb-3",children:s}),r&&i("div",{className:`relative ${a.bg} text-white font-semibold`,children:r})]})})}const nn=["bg1","disclaimer","accepted"],Fr={bg:"bg-red-600",text:"text-red-600"};function zr(){const[e,t]=E(!!O.get(nn));return e?null:i(Hr,{onAccept:()=>{O.set(nn,1),t(!0)}})}function Hr({onAccept:e}){return i(M,{title:"Warning!",theme:Fr,children:[i("p",{children:'Use at your own risk. BG1 is highly experimental, for demonstration purposes only, and provided "as is" without warranty of any kind. It is in no way endorsed by or associated with the Walt Disney Company and could stop working at any time for any reason. To ensure the intended experience, always use the official Disney app.'}),i(V,{onClick:e,children:"Accept"})]})}function ei(){return i(M,{title:"BG1 News",children:i("iframe",{src:"https://joelface.github.io/bg1/news.html",className:"absolute inset-0 w-full h-full"})})}const rn=["bg1","news","version"];function jr(e){const[t,n]=E(()=>{const r=Number(O.get(rn));return Number.isInteger(r)?r:0});return t{O.set(rn,e),n(e)},children:"Close"})]}):null}function xt(e){const t=()=>{document.hidden||e()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}const Wr="https://cdn.registerdisney.go.com/v4/OneID.js",Ke="oneid-script",Vr="oneid-wrapper",Yr="oneid-secure-responder";function qr({resort:e,onLogin:t}){return C(()=>{const n=navigator.userAgent.includes("Android")?"AND":"IOS",r=`TPR-${e.id}-LBSDK.${n}`,a=()=>localStorage.removeItem(r+"-PROD.guest");let s=0;async function c(){if(!window.OneID){s=self.setTimeout(c,100);return}a();const o=window.OneID.get({clientId:r,responderPage:"https://joelface.github.io/bg1/responder.html"});o.on("login",({token:l})=>{a(),t({swid:l.swid,accessToken:l.access_token,expires:new Date(l.exp).getTime()})}),o.on("close",()=>{o.launchLogin()}),await o.init(),o.launchLogin()}if(!document.getElementById(Ke)){const o=document.createElement("script");o.id=Ke,o.src=Wr,document.head.appendChild(o)}return c(),()=>{var o;s&&clearTimeout(s);for(const l of[Vr,Yr,Ke]){const d=document.getElementById(l);(o=d==null?void 0:d.parentNode)==null||o.removeChild(d)}}},[e,t]),i("div",{className:"fixed top-0 left-0 w-full h-full border-0"})}const ti=Q([]),ni=()=>J(ti);function Kr({children:e}){const{das:t}=L(),[n,r]=E([]);return C(()=>{t.parties().then(r)},[t]),i(ti.Provider,{value:n,children:e})}/** * Refresh icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function wt({className:e}){return i(j,{className:e,children:i("path",{d:"M16 6h-6l2.243-2.243c-1.133-1.133-2.64-1.757-4.243-1.757s-3.109 0.624-4.243 1.757c-1.133 1.133-1.757 2.64-1.757 4.243s0.624 3.109 1.757 4.243c1.133 1.133 2.64 1.757 4.243 1.757s3.109-0.624 4.243-1.757c0.095-0.095 0.185-0.192 0.273-0.292l1.505 1.317c-1.466 1.674-3.62 2.732-6.020 2.732-4.418 0-8-3.582-8-8s3.582-8 8-8c2.209 0 4.209 0.896 5.656 2.344l2.343-2.344v6z"})})}function kt(e){const{children:t,color:n="bg-black",className:r="",...a}=e;return i("div",{className:`fixed inset-0 z-10 flex items-center justify-center p-2 ${n} bg-opacity-75 ${r}`,...a,children:t})}function Qr(){const{bg:e}=W();return i(kt,{color:"bg-white",children:i("div",{className:"w-[50px] mx-auto",children:i("div",{"aria-label":"Loading\u2026",className:`rounded-full p-[20%] ${e}`,children:i(wt,{className:"animate-spin w-full text-white"})})})})}const Jr=3e3,Xr={alert:"bg-yellow-200",error:"bg-red-200"};function ii(){const[,e]=E(0),[t,n]=E(""),[r,a]=E("alert"),s=q((o,l)=>{n(o),a(l||"alert"),e(d=>(clearTimeout(d),o?self.setTimeout(()=>{n("")},Jr):d))},[]);return[t?i(Zr,{message:t,type:r}):null,s]}function Zr({message:e,type:t}){return e?i("div",{role:"alert",className:`fixed bottom-20 left-0 w-full p-2 font-semibold text-center ${Xr[t]} text-gray-800`,children:e}):null}async function es(e){return new Promise(t=>{setTimeout(t,e)})}const ts=500;function Y(){const[e,t]=E(0),[n,r]=ii(),a=q(async(c,o={})=>{var b;const{messages:l={},minLoadTime:d=ts}=o,h={error:"Unknown error occurred",request:"Network request failed",...l};r("");let u=[""];function p(...k){u=k}t(k=>k+1);const f=es(d);try{await c(p)}catch(k){const x=(b=k==null?void 0:k.response)==null?void 0:b.status;k instanceof Error&&h[k.name]?p(h[k.name],"error"):Number.isInteger(x)?p(x in h?h[x]:h.request,"error"):(console.error(k),p(h.error,"error"))}await f,t(k=>k-1),r(...u)},[r]),s=e>0||n?i(w,{children:[e>0&&i(Qr,{}),n]}):null;return{loadData:a,loaderElem:s,flash:r}}function ri(e){const[,t]=E(0);return q((n=0)=>{t(r=>Date.now()-r{}}),Ue=()=>J(si);function ns({children:e}){const t=L(),[n,r]=E(()=>{const a=t.parks[0],{id:s=a.id,date:c=""}=O.get(sn)??{};try{return c===H()?t.park(s):a}catch(o){return o instanceof re||console.error(o),a}});return C(()=>{O.set(sn,{id:n.id,date:H()})},[n]),i(si.Provider,{value:{park:n,setPark:r},children:e})}const ai=Q({experiences:[],refreshExperiences:()=>{},park:{},setPark:()=>null,loaderElem:null}),_e=()=>J(ai);function is({children:e}){const{genie:t,liveData:n}=L(),{park:r,setPark:a}=Ue(),{loadData:s,loaderElem:c}=Y(),[o,l]=E([]),d=ri(q(()=>{s(async()=>{const h=n.shows(r);let u={...Object.fromEntries((await t.experiences(r)).map(p=>[p.id,p]))};try{u={...await h,...u}}catch(p){console.error(p)}l(Object.values(u))})},[r,t,n,s]));return C(d,[d]),i(ai.Provider,{value:{experiences:o,park:r,refreshExperiences:d,loaderElem:c,setPark:h=>{a(h),l([])}},children:e})}const oi=Q({plans:[],refreshPlans:()=>{},loaderElem:null}),le=()=>J(oi);function rs({children:e}){const{genie:t}=L(),{loadData:n,loaderElem:r}=Y(),[a,s]=E([]),c=ri(q(()=>{n(async()=>{s(await t.bookings())})},[t,n]));return C(c,[c]),i(oi.Provider,{value:{plans:a,refreshPlans:c,loaderElem:r},children:e})}const ci=Q({current:void 0,begin:()=>{},end:()=>{}}),ge=()=>J(ci);function li({children:e,current:t}){const[n,r]=E({current:t,begin:a=>{r({...n,current:a})},end:()=>{r(a=>a.current?{...a,current:void 0}:a)}});return i(ci.Provider,{value:n,children:e})}const di=Q({tabs:[],active:{name:"",icon:i("div",{}),component:()=>null},changeTab:()=>{},scrollPos:{get:()=>0,set:()=>{}}}),ui=()=>J(di);function ss({name:e,icon:t}){const n=W(),{active:r,changeTab:a}=ui();if(!a)return null;const c=(r==null?void 0:r.name)===e?`bg-white bg-opacity-90 ${n.text}`:`${n.bg} text-white`;return i("button",{className:"px-4 py-2",onClick:()=>a(e),children:[i("div",{className:`min-w-[3rem] rounded-full py-1.5 ${c}`,children:t}),i("div",{className:"mt-0.5 text-sm",children:e})]})}function It({title:e,buttons:t,subhead:n,children:r,contentRef:a}){const{tabs:s,scrollPos:c,footer:o}=ui();let l=ne(null);return a&&(l=a),mt(()=>{const d=l.current;if(!d)return;d.scroll(0,c.get());const h=()=>c.set(d.scrollTop);return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)},[c]),i(M,{title:e,buttons:t,subhead:n,footer:i(w,{children:[i("div",{className:"flex items-center justify-center",children:s.map(d=>be(ss,{...d,key:d.name}))}),o]}),contentRef:l,children:r})}function as({tabs:e,footer:t},n){return function r({tabName:a}){const{goTo:s}=G(),c=q(d=>{d!==a&&s(i(r,{tabName:d}),{replace:!0})},[a,s]),o=ne(Object.fromEntries(e.map(d=>[d.name,0]))),l=e.find(({name:d})=>d===a)??e[0];return l?i(di.Provider,{value:{tabs:e,active:l,changeTab:c,scrollPos:{get:()=>o.current[l.name],set:d=>{o.current[l.name]=d}},footer:t},children:i(n,{tab:l})}):null}}/** + */function wt({className:e}){return i(j,{className:e,children:i("path",{d:"M16 6h-6l2.243-2.243c-1.133-1.133-2.64-1.757-4.243-1.757s-3.109 0.624-4.243 1.757c-1.133 1.133-1.757 2.64-1.757 4.243s0.624 3.109 1.757 4.243c1.133 1.133 2.64 1.757 4.243 1.757s3.109-0.624 4.243-1.757c0.095-0.095 0.185-0.192 0.273-0.292l1.505 1.317c-1.466 1.674-3.62 2.732-6.020 2.732-4.418 0-8-3.582-8-8s3.582-8 8-8c2.209 0 4.209 0.896 5.656 2.344l2.343-2.344v6z"})})}function kt(e){const{children:t,color:n="bg-black",className:r="",...a}=e;return i("div",{className:`fixed inset-0 z-10 flex items-center justify-center p-2 ${n} bg-opacity-75 ${r}`,...a,children:t})}function Qr(){const{bg:e}=W();return i(kt,{color:"bg-white",children:i("div",{className:"w-[50px] mx-auto",children:i("div",{"aria-label":"Loading\u2026",className:`rounded-full p-[20%] ${e}`,children:i(wt,{className:"animate-spin w-full text-white"})})})})}const Jr=3e3,Xr={alert:"bg-yellow-200",error:"bg-red-200"};function ii(){const[,e]=E(0),[t,n]=E(""),[r,a]=E("alert"),s=q((o,l)=>{n(o),a(l||"alert"),e(d=>(clearTimeout(d),o?self.setTimeout(()=>{n("")},Jr):d))},[]);return[t?i(Zr,{message:t,type:r}):null,s]}function Zr({message:e,type:t}){return e?i("div",{role:"alert",className:`fixed bottom-20 left-0 w-full p-2 font-semibold text-center ${Xr[t]} text-gray-800`,children:e}):null}async function es(e){return new Promise(t=>{setTimeout(t,e)})}const ts=500;function Y(){const[e,t]=E(0),[n,r]=ii(),a=q(async(c,o={})=>{var b;const{messages:l={},minLoadTime:d=ts}=o,h={error:"Unknown error occurred",request:"Network request failed",...l};r("");let u=[""];function p(...k){u=k}t(k=>k+1);const f=es(d);try{await c(p)}catch(k){const x=(b=k==null?void 0:k.response)==null?void 0:b.status;k instanceof Error&&h[k.name]?p(h[k.name],"error"):Number.isInteger(x)?p(x in h?h[x]:h.request,"error"):(console.error(k),p(h.error,"error"))}await f,t(k=>k-1),r(...u)},[r]),s=e>0||n?i(w,{children:[e>0&&i(Qr,{}),n]}):null;return{loadData:a,loaderElem:s,flash:r}}function ri(e){const[,t]=E(0);return q((n=0)=>{t(r=>Date.now()-r{}}),Ue=()=>J(si);function ns({children:e}){const t=L(),[n,r]=E(()=>{const a=t.parks[0],{id:s=a.id,date:c=""}=O.get(sn)??{};try{return c===z()?t.park(s):a}catch(o){return o instanceof re||console.error(o),a}});return C(()=>{O.set(sn,{id:n.id,date:z()})},[n]),i(si.Provider,{value:{park:n,setPark:r},children:e})}const ai=Q({experiences:[],refreshExperiences:()=>{},park:{},setPark:()=>null,loaderElem:null}),_e=()=>J(ai);function is({children:e}){const{genie:t,liveData:n}=L(),{park:r,setPark:a}=Ue(),{loadData:s,loaderElem:c}=Y(),[o,l]=E([]),d=ri(q(()=>{s(async()=>{const h=n.shows(r);let u={...Object.fromEntries((await t.experiences(r)).map(p=>[p.id,p]))};try{u={...await h,...u}}catch(p){console.error(p)}l(Object.values(u))})},[r,t,n,s]));return C(d,[d]),i(ai.Provider,{value:{experiences:o,park:r,refreshExperiences:d,loaderElem:c,setPark:h=>{a(h),l([])}},children:e})}const oi=Q({plans:[],refreshPlans:()=>{},loaderElem:null}),le=()=>J(oi);function rs({children:e}){const{genie:t}=L(),{loadData:n,loaderElem:r}=Y(),[a,s]=E([]),c=ri(q(()=>{n(async()=>{s(await t.bookings())})},[t,n]));return C(c,[c]),i(oi.Provider,{value:{plans:a,refreshPlans:c,loaderElem:r},children:e})}const ci=Q({current:void 0,begin:()=>{},end:()=>{}}),ge=()=>J(ci);function li({children:e,current:t}){const[n,r]=E({current:t,begin:a=>{r({...n,current:a})},end:()=>{r(a=>a.current?{...a,current:void 0}:a)}});return i(ci.Provider,{value:n,children:e})}const di=Q({tabs:[],active:{name:"",icon:i("div",{}),component:()=>null},changeTab:()=>{},scrollPos:{get:()=>0,set:()=>{}}}),ui=()=>J(di);function ss({name:e,icon:t}){const n=W(),{active:r,changeTab:a}=ui();if(!a)return null;const c=(r==null?void 0:r.name)===e?`bg-white bg-opacity-90 ${n.text}`:`${n.bg} text-white`;return i("button",{className:"px-4 py-2",onClick:()=>a(e),children:[i("div",{className:`min-w-[3rem] rounded-full py-1.5 ${c}`,children:t}),i("div",{className:"mt-0.5 text-sm",children:e})]})}function It({title:e,buttons:t,subhead:n,children:r,contentRef:a}){const{tabs:s,scrollPos:c,footer:o}=ui();let l=ne(null);return a&&(l=a),mt(()=>{const d=l.current;if(!d)return;d.scroll(0,c.get());const h=()=>c.set(d.scrollTop);return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)},[c]),i(M,{title:e,buttons:t,subhead:n,footer:i(w,{children:[i("div",{className:"flex items-center justify-center",children:s.map(d=>be(ss,{...d,key:d.name}))}),o]}),contentRef:l,children:r})}function as({tabs:e,footer:t},n){return function r({tabName:a}){const{goTo:s}=G(),c=q(d=>{d!==a&&s(i(r,{tabName:d}),{replace:!0})},[a,s]),o=ne(Object.fromEntries(e.map(d=>[d.name,0]))),l=e.find(({name:d})=>d===a)??e[0];return l?i(di.Provider,{value:{tabs:e,active:l,changeTab:c,scrollPos:{get:()=>o.current[l.name],set:d=>{o.current[l.name]=d}},footer:t},children:i(n,{tab:l})}):null}}/** * Calendar icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 */function hi({className:e}){return i(j,{className:e,children:i("path",{d:"M5 6h2v2h-2zM8 6h2v2h-2zM11 6h2v2h-2zM2 12h2v2h-2zM5 12h2v2h-2zM8 12h2v2h-2zM5 9h2v2h-2zM8 9h2v2h-2zM11 9h2v2h-2zM2 9h2v2h-2zM13 0v1h-2v-1h-7v1h-2v-1h-2v16h15v-16h-2zM14 15h-13v-11h13v11z"})})}/** @@ -22,7 +22,7 @@ var Ri=Object.defineProperty;var $i=e=>{throw TypeError(e)};var Oi=(e,t,n)=>t in */function on(e){return i(j,{...e,children:i("path",{d:"M8 15.5l7.5-7.5h-4.5v-8h-6v8h-4.5z"})})}/** * Star icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function cs(e){return i(j,{...e,children:i("path",{d:"M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z"})})}function ie({date:e,time:t,type:n,...r}){return i("time",{...r,dateTime:e||t,children:e?dr(e,n):t?z(t):""})}function mi({start:e,end:t}){const n=H(e),r=H(t);return t?i(w,{children:[e.time?i(ie,{time:e.time}):i("span",{children:"Park Open"})," \u2013"," ",r>n?i(ie,{date:r,type:"short"}):t.time?i(ie,{time:t.time}):i("span",{children:"Park Close"})]}):i(ie,{time:e.time})}const cn=i("span",{"aria-hidden":!0,children:"\u2022"});function pi({booking:e,button:t}){const n=W();return i("div",{className:"flex items-center gap-x-3",children:[i("div",{className:"flex-1 min-w-0",children:[i("div",{className:"flex items-center gap-x-2 text-gray-500 text-sm font-semibold uppercase whitespace-nowrap",children:[e.type==="DAS"&&i(w,{children:[i("span",{children:"DAS"}),cn]}),e.type==="BG"?i(w,{children:[i("span",{children:["BG ",e.boardingGroup]}),e.status==="SUMMONED"&&i(w,{children:[cn,i("span",{className:`${n.text} font-bold`,children:"Board Now"})]})]}):i(mi,{...e})]}),i("div",{className:"text-lg font-semibold leading-snug truncate",children:e.choices?"Multiple Experiences":e.name})]}),t&&i("div",{children:t})]})}function Fe(){const e=ge();return e.current?i("div",{children:i("div",{className:"-mx-3",children:[i("div",{className:"pb-1",children:"Modifying Reservation"}),i("div",{className:"px-3 py-2 bg-white text-black text-base font-normal normal-case text-left",children:i(pi,{booking:e.current,button:i(P,{type:"small",back:{screen:ce},onClick:e.end,children:"Keep"})})})]})}):null}function F({guests:e,selectable:t,conflicts:n}){const[r,a]=ii();if(e.length===0)return null;const s=new Set(t?e.filter(t==null?void 0:t.isSelected):[]),c=s.size>=((t==null?void 0:t.limit)??1/0);return i(w,{children:[i("ul",{className:"mt-2",children:e.map(o=>{var h;const l=s.has(o),d=c&&!l;return i("li",{className:"px-3 py-1",onClick:()=>a(d?"Selection limit reached":""),children:i("label",{className:"flex items-center",children:[t&&i("input",{type:"checkbox",checked:l,disabled:d,onChange:()=>t.onToggle(o),className:"mr-3"}),i("span",{className:"w-[48px] h-[48px] leading-[48px] mr-3 rounded-full text-3xl font-bold text-center bg-gray-400 text-white",children:o.avatarImageUrl?i("img",{src:o.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):i("span",{"aria-hidden":"true",children:o.name[0]})}),i("span",{className:"leading-tight",children:[o.name,(n==null?void 0:n[o.id])&&i("span",{className:"block text-xs font-semibold text-red-700 uppercase",children:(h=n[o.id])==null?void 0:h.replace(/_/g," ")})]})]})},o.id)})}),r]})}const fi=["bg1","genie","partyIds"];function _i(){const e=O.get(fi)??[];return Array.isArray(e)?e:[]}function ls(){const{genie:e}=L();C(()=>e.setPartyIds(_i()),[e])}function ds(){const{genie:e}=L(),{loadData:t,loaderElem:n}=Y(),[r,a]=E(!0),[s,c]=E(),[o,l]=E(()=>{const f=new Set(_i());return a(f.size===0),f});function d(){const f=[...o];O.set(fi,f),e.setPartyIds(f)}C(()=>{t(async()=>{const f=await e.guests();c([...f.eligible,...f.ineligible].sort((b,k)=>+!b.primary-+!k.primary||b.name.localeCompare(k.name)))})},[e,t]),C(()=>{r&&l(new Set)},[r]);const h=s==null?void 0:s.filter(f=>o.has(f.id)),u=s==null?void 0:s.filter(f=>!o.has(f.id)),p=f=>i("li",{children:i("label",{className:"flex items-center mt-2",children:[i("input",{type:"radio",name:"auto",onChange:()=>a(f.auto),checked:r===f.auto,className:"mr-2"})," ",f.children]})});return i(M,{title:"Party Selection",children:[i("p",{children:"By default, all eligible guests (up to a maximum of 12) are automatically selected when you book a Lightning Lane. If you would like to limit who you book for, you can manually select your party here."}),i("ul",{children:[i(p,{auto:!0,children:"Book for all eligible guests"}),i(p,{auto:!1,children:"Only book for selected guests"})]}),r?null:(s==null?void 0:s.length)===0?i("p",{className:"text-red-700",children:"No guests to select"}):h&&u?i(w,{children:[h.length>0&&i(w,{children:[i("h3",{children:"Your Party"}),i(F,{guests:h,selectable:{isSelected:()=>!0,onToggle:f=>{const b=new Set(o);b.delete(f.id),l(b)}}})]}),u.length>0&&i(w,{children:[i("h3",{children:"Add to Your Party"}),i(F,{guests:u,selectable:{isSelected:()=>!1,onToggle:f=>{const b=new Set(o);b.add(f.id),l(b)}}})]})]}):null,n,i(V,{back:!0,disabled:!r&&o.size===0,onClick:d,children:"Save"})]})}function Ie({name:e,onClick:t,...n}){return i(P,{...n,title:`Refresh ${e}`,onClick:t,children:i(wt,{})})}const gi=Q({eligible:[],ineligible:[],selected:[],setSelected:()=>null,experience:{name:"",park:{name:"",theme:{bg:"",text:""}}}}),yi=gi.Provider,vi=()=>J(gi),us="https://bg1.joelface.com/ping";async function Et(e,t){const{date:n}=R(),r=["bg1","ping",e.id,t];if(O.get(r)===n)return;const{ok:s}=await fetch(us,{method:"POST",body:new URLSearchParams({resort:e.id,service:t})});s&&O.set(r,n)}function hs(e){return i(j,{...e,children:i("path",{d:"M 5.5253906 0.9296875 L 3.4042969 3.0507812 L 8.3535156 8 L 3.4042969 12.949219 L 5.5253906 15.070312 L 10.474609 10.121094 L 12.595703 8 L 10.474609 5.8789062 L 5.5253906 0.9296875 z"})})}function bi(e){return i("div",{className:`mt-4 border-2 rounded border-green-600 p-1 font-semibold text-center text-green-600 bg-green-100 ${e.className}`,children:e.children})}function ms({bg:e,experiences:t,heading:n}){return i("div",{className:`mt-4 rounded ${e}`,children:[i("h3",{className:"mt-0 p-1 text-white text-center",children:n}),i("ul",{className:"list-disc py-2 pl-8 bg-white bg-opacity-90",children:t.map(r=>i("li",{children:r.name},r.id))})]})}function Ee({start:e,end:t,button:n}){return i("div",{className:"mt-4 text-lg",children:i("div",{className:"flex items-center gap-x-3",children:[i("div",{children:[t?"Arrive by":"Reservation at",":"," ",i("span",{className:"pl-1 font-semibold",children:i(mi,{start:e,end:t})})]}),n]})})}function Nt({offer:e,onOfferChange:t,booking:n}){var h;const{goBack:r}=G(),{genie:a}=L(),{loadData:s,loaderElem:c}=Y(),[o,l]=E(),d=q(()=>{function u(p){const f=e.start.time;if(!n||f===n.start.time)return p;const b={startTime:f,endTime:e.end.time},k=Number(f.split(":")[0]),x=p.findIndex(({hour:g})=>g>=k),{hour:v,slots:m}=p[x]??{};return x===-1?p.push({hour:k,slots:[b]}):v>k?p.splice(x,0,{hour:k,slots:[b]}):f{l(u(await a.times(e)))})},[e,n,a,s]);return C(d,[d]),i(M,{title:"Select Return Time",buttons:i(w,{children:[i(wi,{}),i(Ie,{name:"Times",onClick:d})]}),subhead:i(Fe,{}),theme:e.experience.park.theme,children:[i("h2",{children:(h=e.experience)==null?void 0:h.name}),i("div",{children:e.experience.park.name}),e&&i(Ee,{...n??e,button:i(P,{type:"small",onClick:r,children:"Keep"})}),o?o.length>0?i(w,{children:[i("h3",{children:"More Available Times"}),i("table",{className:"whitespace-nowrap",children:o.map(({hour:u,slots:p})=>i("tr",{children:[i("th",{className:"pt-3 pr-2 text-gray-500 text-sm font-semibold text-right uppercase",children:`${u>12?u-12:u} ${u<12?"AM":"PM"}`}),p.map(f=>i("td",{className:"pt-3 pr-3 text-center",children:i(P,{onClick:()=>{s(async()=>{const b=f.startTime===e.start.time?e:await a.changeOfferTime(e,f);await r(),t(b)})},children:z(f.startTime)})},f.startTime))]},u))})]}):i("p",{children:"No other times available"}):null,c]})}function ps({offer:e}){var h;const{goTo:t,goBack:n}=G(),{genie:r}=L(),{loadData:a,loaderElem:s}=Y(),{refreshPlans:c}=le(),[o,l]=E(e);function d(){a(async()=>{const u=await r.book(o);c(),await n({screen:ce}),t(i(fe,{booking:u,isNew:!0}))})}return i(M,{title:"Lightning Lane",subhead:i(li,{current:o.modifying,children:i(Fe,{})}),theme:o.experience.park.theme,children:[i("h2",{children:(h=o.experience)==null?void 0:h.name}),i("div",{children:o.experience.park.name}),i(Ee,{...o,button:i(P,{type:"small",onClick:()=>t(i(Nt,{offer:o,onOfferChange:l})),children:"Change"})}),i("h3",{children:"Your Party"}),i(F,{guests:o.guests.eligible}),s,i(V,{onClick:d,children:"Modify Lightning Lane"})]})}function fs({booking:e,onCancel:t,dasGuest:n}){const{genie:r,das:a}=L(),s=e.type==="DAS"?a:r,{refreshPlans:c}=le(),[o,l]=E(new Set),{loadData:d,loaderElem:h}=Y(),{name:u,park:p,guests:f}=e,b=o.size===0,k=o.size===f.length;async function x(){b||(await d(async()=>{await s.cancelBooking([...o]),c()}),t(f.filter(v=>!o.has(v))))}return i(M,{title:"Cancel Guests",theme:p.theme,children:[i("h2",{children:u}),i("div",{children:p.name}),i(Ee,{...e}),i("div",{className:"ml-3",children:i("label",{className:"flex items-center py-4",children:[i("input",{type:"checkbox",checked:k,onChange:()=>l(new Set(k?[]:f))}),i("span",{className:"ml-3",children:"Select All"})]})}),!b&&i("div",{className:"mb-4",children:[i("h3",{children:"Cancel These Guests"}),i(F,{guests:f.filter(v=>o.has(v)),selectable:{isSelected:()=>!0,onToggle:v=>{if(n&&v!==n&&o.has(n))l(new Set);else{const m=new Set(o);m.delete(v),l(m)}}}})]}),!k&&i("div",{children:[i("h3",{children:"Select Guests to Cancel"}),i(F,{guests:f.filter(v=>!o.has(v)),selectable:{isSelected:()=>!1,onToggle:v=>{l(new Set(v===n?f:o).add(v))}}})]}),i(V,{back:!0,disabled:b,onClick:x,children:"Cancel "+(k?"Reservation":"Guests")}),h]})}function fe({booking:e,isNew:t}){var A;const{goTo:n,goBack:r}=G(),{loadData:a,loaderElem:s}=Y(),{setPark:c}=Ue(),o=L(),l=ni(),{name:d,park:h,choices:u,type:p,subtype:f,start:b}=e,k=p==="DAS"&&f==="IN_PARK"?e.guests.find(I=>l.find(B=>B.primaryGuest.id===I.id)):void 0,x=ge(),[v,m]=E(e.cancellable&&(p!=="DAS"||k)?e.guests:void 0),g=new Map([[h,[]],...o.parks.map(I=>[I,[]])]);for(const I of u||[])(A=g.get(I.park))==null||A.push(I);const _=[...g].filter(([,I])=>I.length>0).map(([I])=>I),y=(u?_.length===1?_[0]:{}:h).theme??bt;return i(M,{title:"Your "+{LL:"Lightning Lane",DAS:"DAS Selection",BG:"Boarding Group",APR:"Park Pass",RES:"Reservation"}[p],theme:y,buttons:e.modifiable&&i(P,{onClick:()=>{x.begin(e),c(e.park),r({screen:ce,props:{tabName:"LL"}})},children:"Modify"}),subhead:i(ie,{date:H(b)}),children:[u?i("h2",{children:"Multiple Experiences"}):i(w,{children:[i("h2",{children:d}),h.name&&i("div",{children:h.name})]}),p==="BG"?i(w,{children:[e.status==="SUMMONED"&&i(bi,{children:"Your boarding group has been called"}),i("h3",{children:["Boarding Group:"," ",i("span",{className:"ml-1 font-semibold",children:e.boardingGroup})]}),i("p",{children:"Check the official Disney app for return time and other virtual queue information."})]}):i(Ee,{...e,button:o.genie.allowsTimeSelect&&e.modifiable&&i(P,{type:"small",onClick:()=>{a(async()=>{n(i(Nt,{booking:e,offer:await o.genie.offer({...e,flex:{}},e.guests,e),onOfferChange:I=>{n(i(ps,{offer:I}))}}))},{messages:{410:"No reservations available"}})},children:"Change"})}),u&&i(w,{children:[i("p",{children:[d&&i(w,{children:[i("b",{children:d})," was temporarily unavailable during your return time."," "]}),"You may redeem this Lightning Lane at one of these replacement experiences:"]}),[...g].filter(([,I])=>I.length>0).map(([I,B])=>i(ms,{heading:I.name,experiences:B,bg:I.theme.bg},I.id))]}),i("div",{className:"flex mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),e.cancellable&&v&&i(P,{type:"small",onClick:()=>{n(i(fs,{booking:{...e,guests:v},dasGuest:k,onCancel:I=>{I.length>0?m(I):r()}}))},className:"ml-3",children:"Cancel"})]}),i(F,{guests:v||e.guests,conflicts:Object.fromEntries(e.type==="LL"?e.guests.filter(I=>(I.redemptions??1)!==1).map(I=>[I.id,`Redemptions left: ${I.redemptions}`]):[])}),t&&i(V,{onClick:()=>r({screen:ce,props:{tabName:"Plans"}}),children:"Show Plans"}),s]})}function xi({...e}){const{plans:t,refreshPlans:n,loaderElem:r}=le();return i(It,{title:"Your Plans",buttons:i(Ie,{name:"Plans",onClick:n}),theme:bt,...e,children:[i(_s,{plans:t}),r]})}const _s=_t(function({plans:t}){var l,d;const{goTo:n}=G(),r=W();function a(h){n(i(fe,{booking:h}))}const s=new Map,c=new Map;for(const h of t){const u=H(h.start);s.has(u)||s.set(u,[]),h.type!=="APR"&&((l=s.get(u))==null||l.push(h)),c.has(u)||c.set(u,new Set),(h.type!=="LL"||h.subtype!=="MEP")&&h.park.icon&&((d=c.get(u))==null||d.add(h.park))}const o=i("p",{className:"font-semibold text-center uppercase text-gray-500",children:"No existing plans"});return i("ul",{children:t.length>0?[...s].map(([h,u])=>i("li",{children:[i("div",{className:"sticky top-0 -mx-3 pt-1 bg-white",children:i("div",{className:"flex items-center",children:[i("h2",{className:`flex-1 mt-0 rounded-r-full px-3 py-1 ${r.bg} text-white text-sm uppercase`,children:i(ie,{date:h})}),i("ul",{className:"px-3 pl-2 text-lg text-right",children:[...c.get(h)??[]].map(p=>i("li",{className:"inline ml-1 first:ml-0","aria-label":p.name,children:p.icon},p.id))})]})}),u.length>0?i("ul",{className:u.length===0?"mt-3":"",children:u.map(p=>i("li",{className:"py-2.5 first:border-0 border-t-4 border-gray-300",onClick:()=>a(p),children:i(pi,{booking:p,button:i("div",{className:r.text,title:"More Info",children:i(hs,{})})})},p.bookingId))}):o]},h)):o})});function wi({...e}){const{goTo:t}=G();return i(w,{children:i(P,{...e,onClick:()=>t(i(xi,{})),title:"Plans",children:i(hi,{})})})}function Tt(){const{ineligible:e}=vi();return i(F,{guests:e,conflicts:Object.fromEntries(e.map(t=>[t.id,t.eligibleAfter?`TOO EARLY (${z(t.eligibleAfter)})`:t.ineligibleReason||"ELIGIBLE FOR NEW BOOKING"]))})}function gs(){const{genie:e}=L(),t=ge();return i(w,{children:[t.current?i(w,{children:[i("h3",{children:"Unable to Modify"}),i("p",{children:"Your current reservation cannot be modified to this experience due to the following conflicts:"})]}):i(w,{children:[e.nextBookTime&&e.nextBookTime.slice(0,5)>R().time.slice(0,5)&&i(bi,{children:["Eligible at ",i(ie,{time:e.nextBookTime})]}),i("h3",{children:"No Eligible Guests"}),i("p",{children:"No one in your party is currently eligible for this Lightning Lane."})]}),i(Tt,{})]})}function ys({onRefresh:e}){return i(w,{children:[i("h3",{children:"No Guests Found"}),i("p",{children:"Your party could not be loaded. This is probably just a temporary network error. Wait a few seconds and try again."}),i(V,{onClick:e,children:"Try Again"})]})}function vs(e){return i("div",{className:`mt-4 border-2 rounded border-red-600 p-1 font-semibold text-center text-red-600 bg-red-100 ${e.className}`,children:e.children})}function bs({party:e}){const{eligible:t,ineligible:n,selected:r,setSelected:a,experience:s}=e,[c,o]=E(new Set(r)),{maxPartySize:l}=L().genie;function d(h){c[c.has(h)?"delete":"add"](h),o(new Set(c))}return i(yi,{value:e,children:i(M,{title:"Modify Party",theme:s.park.theme,children:[i("h2",{children:s.name}),i("div",{children:s.park.name}),i("h3",{children:"Your Party"}),i(F,{guests:t,selectable:{isSelected:h=>c.has(h),onToggle:d,limit:l}}),n.length>0&&i(w,{children:[i("h3",{children:"Ineligible Guests"}),i(Tt,{})]}),i(V,{back:!0,disabled:c.size===0,onClick:()=>{a(t.filter(h=>c.has(h)))},children:"Confirm Party"})]})})}function ki(){const{goTo:e}=G(),t=vi(),{eligible:n,selected:r}=t,{maxPartySize:a}=L().genie;return i(w,{children:[n.length>a&&r.length===a&&i(vs,{children:"Party size restricted"}),r.length>0?i(w,{children:[i("div",{className:"mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),i(P,{type:"small",onClick:()=>e(i(bs,{party:t})),className:"ml-3",children:"Modify"})]}),i(F,{guests:r})]}):i(w,{children:[i("h3",{children:"Ineligible Guests"}),i(Tt,{})]})]})}function xs(){return i(w,{children:[i("h3",{children:"No Reservations Available"}),i("p",{children:"There aren't enough reservation slots available for your entire party. If only part of your group wishes to go on this attraction, edit your party to check again. Otherwise, go back to the attraction list and select another attraction."}),i(ki,{})]})}function ws({offer:e,onOfferChange:t}){const{goTo:n}=G(),{genie:r}=L();return i(w,{children:[i("div",{className:"flex items-center",children:i(Ee,{...e,button:r.allowsTimeSelect&&i(P,{type:"small",onClick:()=>n(i(Nt,{offer:e,onOfferChange:t})),children:"Change"})})}),e.changed&&i("div",{className:"text-sm",children:[i("strong",{children:"Note:"})," Return time has been changed"]}),i(ki,{})]})}function ks({experience:e}){const{goTo:t}=G(),n=L(),{genie:r}=n,{refreshExperiences:a}=_e(),{refreshPlans:s}=le(),c=ge(),[o,l]=E(),[d,h]=E(),{loadData:u,loaderElem:p}=Y();async function f(){!d||!o||u(async()=>{const m=await r.book(d,o.selected);c.end();const g=new Set(o.selected.map(y=>y.id)),_=m.guests.filter(y=>!g.has(y.id));_.length>0&&(await r.cancelBooking(_),m.guests=m.guests.filter(y=>g.has(y.id))),m&&t(i(fe,{booking:m,isNew:!0}),{replace:!0}),s(),a(),Et(n,"G")},{messages:{410:"Offer expired"}})}const b=q(()=>{u(async()=>{const m=c.current?{eligible:c.current.guests,ineligible:[]}:await r.guests(e);l({...m,selected:m.eligible.slice(0,r.maxPartySize),setSelected:g=>l(_=>{if(!_)return _;const y=new Set(_.selected);return h(S=>S===null||g.some(A=>!y.has(A))?void 0:S),{..._,selected:g}}),experience:e})})},[r,e,c,u]);C(()=>{o||b()},[o,b]);const k=q(m=>{!o||o.selected.length===0||u(async()=>{try{const g=await r.offer(e,o.selected,c.current),{ineligible:_}=g.guests;if(_.length>0){const y=new Set(_.map(A=>A.id)),S=A=>!y.has(A.id);l({...o,eligible:o.eligible.filter(S),ineligible:[..._,...o.ineligible],selected:o.selected.filter(S)})}g.active?(d&&(g.changed=!1),h(g)):h(y=>y??null)}catch(g){throw m||h(null),g}},{messages:{410:d?"No reservations available":""}})},[r,e,o,d,c,u]);C(()=>{d===void 0&&k()},[d,k]);const x=(o==null?void 0:o.eligible.length)===0,v=x&&(o==null?void 0:o.ineligible.length)===0;return i(M,{title:"Lightning Lane",theme:e.park.theme,buttons:i(w,{children:[i(wi,{}),i(Ie,{onClick:()=>{x?b():k()},name:x?"Party":"Offer"})]}),subhead:i(Fe,{}),children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),o&&i(yi,{value:o,children:v?i(ys,{onRefresh:b}):x?i(gs,{}):!o||d===void 0?i("div",{}):d===null?i(xs,{}):i(w,{children:[i(ws,{offer:d,onOfferChange:h}),i(V,{onClick:f,children:`${c.current?"Modify":"Book"} Lightning Lane`})]})}),p]})}function He({label:e,children:t}){return i("div",{className:"flex items-center flex-1 whitespace-nowrap",children:[i("span",{className:"mr-2 text-xs font-semibold uppercase text-gray-500",children:e})," ",t]})}function Is({experience:e}){const{goTo:t}=G(),{flex:n}=e;return i(He,{label:"LL",children:i("span",{children:i(P,{onClick:()=>t(i(ks,{experience:e})),children:n.nextAvailableTime?z(n.nextAvailableTime):"none"})})})}function Ii({children:e}){return i("div",{className:"mt-8 flex justify-center",children:i("div",{children:[i("h2",{className:"mt-0 pl-1 text-gray-500 text-sm leading-tight uppercase",children:"Symbols"}),i("div",{className:"border-2 border-gray-500 rounded px-2 py-0.5 bg-gray-100",children:i("table",{children:i("tbody",{children:e})})})]})})}function me({sym:e,def:t,onInfo:n}){return i("tr",{children:[i("th",{className:"py-0.5 text-center font-bold",children:e}),i("td",{className:"pl-3 py-0.5",children:t}),n&&i("td",{className:"pl-3 py-0.5",children:i(P,{type:"small",onClick:n,children:"Info"})})]})}const Es="_SELECT_RADIO_BUTTON_";function Ei(e){const{options:t,selected:n,title:r,onChange:a,disabled:s,...c}=e,{bg:o}=W(),[l,d]=E(!1),[h,u]=E(0),p=ne(null),f=ne(null);mt(()=>{var I;if((I=t.values().next().value)!=null&&I.icon)return;const _=p.current,y=_==null?void 0:_.firstChild;if(!y)return;const S=y.nodeValue;if(!S)return;let A=0;for(const B of t.values())y.nodeValue=B.text,A=Math.max(_.offsetWidth,A);y.nodeValue=S,u(A)},[t]);const b=()=>{var _;return(_=f.current)==null?void 0:_.querySelector("input:checked")};C(()=>{var S;if(!l)return;const _=b();(S=_==null?void 0:_.closest("li"))==null||S.scrollIntoView(),_==null||_.focus();const y=A=>{var I;(I=f.current)!=null&&I.contains(A.target)||d(!1)};return addEventListener("focusin",y),()=>removeEventListener("focusin",y)},[l]);const k=()=>{const _=b();if(_){const y=_.value,S=t.get(y);S&&a(S.value??y)}d(!1)},x=n?t.get(n):r!==void 0?{text:r}:void 0;if(!x)return null;const{icon:v,text:m}=x;let g=!1;return i(w,{children:[i(P,{...c,title:v?`${r}: ${m}`:r,disabled:s||t.size===0,onClick:()=>d(!0),children:[v||i("span",{className:"flex-1 truncate",style:{minWidth:`${h}px`},ref:p,children:m}),i(j,{className:"w-2.5 ml-2 shrink-0",children:i("path",{d:"m6.8273 12.401-5.6333-7.7812a1.0212 1.0212 117.05 0 1 0.82716-1.62l11.958-2e-7a1.0212 1.0212 62.952 0 1 0.82714 1.62l-1.6438 2.2705a79984 79984 125.9 0 0-2.3456 3.2401l-1.6437 2.2706a1.4479 1.4479 180 0 1-2.3456 4.4e-5z"})})]}),l&&i(kt,{onChange:()=>{g||k(),g=!1},onClick:_=>{var y;g||(!((y=f.current)!=null&&y.contains(_.target))||n&&_.target.value===n)&&(d(!1),_.preventDefault())},onKeyDown:({key:_})=>{["Enter"," "].includes(_)?k():_.startsWith("Arrow")&&(g=!0)},"data-testid":"shade",children:i("div",{className:"flex flex-col min-w-[50%] max-h-[90%] rounded-lg bg-white text-black",children:[r&&i("h3",{className:`mt-0 rounded-t-lg px-5 py-1 ${o} text-white font-semibold text-center`,children:r}),i("ul",{className:"overflow-auto",ref:f,children:[...t].map(([_,y])=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("label",{className:"flex flex-row items-center gap-x-2.5 px-4 py-3",children:[i("input",{type:"radio",name:Es,value:_,defaultChecked:_===n,className:"w-4 h-4 shrink-0"})," ",y.icon&&i("span",{"aria-hidden":"true",children:y.icon})," ",y.text]})},y.text))})]})})]})}function Ni(e){const{parks:t,genie:n}=L(),{park:r,setPark:a}=_e(),s=ge(),c=pt(()=>new Map(t.map(o=>[o.id,{value:o,icon:o.icon,text:o.name}])),[t]);return i(Ei,{...e,options:c,selected:r.id,onChange:a,disabled:!!s.current&&!n.allowsCrossParkModify,title:"Park","data-testid":"park-select"})}function Ns({experience:{type:e,standby:t,virtualQueue:n}}){return t.nextShowTime||e==="ENTERTAINMENT"&&!t.waitTime?i(Ss,{standby:t}):n?i(Cs,{virtualQueue:n}):i(Ts,{standby:t})}const Ts=({standby:e})=>i(He,{label:"Standby",children:e.available?i(St,{time:e.waitTime!==void 0?e.waitTime+" min":"now"}):i(Si,{text:"down"})}),Ss=({standby:e})=>i(He,{label:i(w,{children:["Next ",i("span",{className:"hidden xs:inline",children:"Show"})]}),children:e.nextShowTime?i(St,{time:z(e.nextShowTime)}):i(Si,{text:"none"})}),Cs=({virtualQueue:e})=>i(He,{label:i("abbr",{title:"Virtual Queue",children:"VQ"}),children:i(St,{time:e.nextAvailableTime?z(e.nextAvailableTime):"closed"})}),Ti="inline-block border-2 rounded px-1.5 py-0.5 font-semibold",St=({time:e})=>i("span",{className:`${Ti} border-gray-500 text-gray-500 bg-gray-100`,children:e}),Si=({text:e})=>i("span",{className:`${Ti} border-red-600 text-red-600 bg-red-100`,children:e});function Ps({bookTime:e,dropTime:t}){const n=W();return!e&&!t?null:i("div",{className:`flex justify-center gap-x-10 ${n.bg}`,children:[i(ln,{label:"Book",time:e}),i(ln,{label:"Drop",time:t})]})}function ln({label:e,time:t}){if(!t)return null;t=t.slice(0,5);const n=R().time.slice(0,5);return i("div",{children:[e,":"," ",i("time",{dateTime:t,className:"whitespace-nowrap",children:t>n?z(t):"now"})]})}async function Ds(e={}){return new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(r=>{t(r)},r=>{n(r)},e)})}const As={maximumAge:15e3,timeout:2e3};function Ls(){const[e,t]=E(),n=q(async()=>{try{const{coords:r}=await Ds(As);t(a=>a&&r.latitude===a[0]&&r.longitude===a[1]?a:[r.latitude,r.longitude])}catch{t(void 0)}},[]);return[e,n]}const dn=["bg1","genie","sort"],Rs=(e,t)=>(e.priority||1/0)-(t.priority||1/0),Qe=(e,t)=>(t.standby.waitTime||-1)-(e.standby.waitTime||-1),$s=(e,t)=>{var n,r;return pe(((n=e==null?void 0:e.flex)==null?void 0:n.nextAvailableTime)||"00:00")-pe(((r=t==null?void 0:t.flex)==null?void 0:r.nextAvailableTime)||"00:00")},Os=(e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()),un=(e,t)=>Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)),Gs=(e,t,n)=>e.geo===t.geo?0:e.geo?t.geo?n?un(e.geo,n)-un(t.geo,n):0:-1:1,Ms={priority:(e,t)=>Rs(e,t)||Qe(e,t),standby:(e,t)=>Qe(e,t),soonest:(e,t)=>$s(e,t)||Qe(e,t),nearby:(e,t,n)=>Gs(e,t,n),aToZ:()=>0},hn=new Map([["priority",{text:"Priority"}],["nearby",{text:"Nearby"}],["standby",{text:"Standby"}],["soonest",{text:"Soonest"}],["aToZ",{text:"A to Z"}]]);function Bs(e,t){const{n,s:r,e:a,w:s}=e.geo,[c,o]=t;return cr&&os}function Us(){const{experiences:e,park:t}=_e(),[n,r]=Ls(),[a,s]=E(()=>{const l=O.get(dn);return l&&hn.has(l)?l:"priority"});C(()=>{a==="nearby"&&r()},[e,a,r]);const c=q((l,d)=>{var h,u;return Number((h=d==null?void 0:d.flex)==null?void 0:h.available)-Number((u=l==null?void 0:l.flex)==null?void 0:u.available)||Ms[a==="nearby"&&!(n&&Bs(t,n))?"priority":a](l,d,n)||Os(l,d)},[n,t,a]);return{sortType:a,sorter:c,SortSelect:l=>i(Ei,{...l,options:hn,selected:a,onChange:d=>{s(d),O.set(dn,d)},title:"Sort By"})}}const Fs=30,Hs=60,mn=["bg1","genie","tipBoard","starred"],at="Lightning Pick",ot="Upcoming Drop",ct="Booked",pn=e=>e.experienced&&!e.starred;function zs({contentRef:e}){ls();const{genie:t}=L(),{experiences:n,refreshExperiences:r,park:a,loaderElem:s}=_e(),{sortType:c,sorter:o,SortSelect:l}=Us(),d=ne(!0);C(()=>{var u;d.current||(u=e.current)==null||u.scroll(0,0)},[c,e]),C(()=>{d.current=!1},[]);const h=he(a.dropTimes)[0];return i(It,{title:i(w,{children:"Availability"}),buttons:i(w,{children:[i(l,{}),i(Ni,{}),i(Ie,{name:"Experiences",onClick:r})]}),subhead:i(w,{children:[i(Fe,{}),i(Ps,{bookTime:t.nextBookTime,dropTime:h})]}),contentRef:e,children:[i(js,{experiences:n,park:a,sorter:o}),s]})}const js=_t(function({experiences:t,park:n,sorter:r}){const{goTo:a}=G(),s=W(),[c,o]=E(()=>{const m=O.get(mn)??[];return new Set(Array.isArray(m)?m:[])}),l=he(n.dropTimes)[0],d=pe(R().time);function h({id:m}){o(g=>(g=new Set(g),g.has(m)?g.delete(m):g.add(m),O.set(mn,[...g]),g))}const u=()=>a(i(Vs,{})),p=m=>a(i(Ys,{park:n,experience:m})),f=()=>a(i(qs,{})),b=({experiences:m,type:g})=>i("ul",{"data-testid":g,children:m.map(_=>{const[y]=he(_.dropTimes??[]);return i("li",{className:"pb-3 first:border-0 border-t-4 border-gray-300",children:[i("div",{className:"flex items-center gap-x-2 mt-2",children:[i(Ws,{experience:_,toggleStar:h}),i("h3",{className:"flex-1 mt-0 text-lg font-semibold leading-tight truncate",children:_.name}),_.lp?i(Je,{name:at,icon:st,onClick:u}):y?i(Je,{name:ot,icon:on,onClick:()=>p(_),className:y!==l?"opacity-50":""}):null,_.flex.preexistingPlan&&i(Je,{name:ct,icon:an,onClick:f})]}),i("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[i(Ns,{experience:_}),i(Is,{experience:_})]})]},_.id+(_.starred?"*":""))})}),k=t.filter(m=>!!m.flex).map(m=>{var S;const g=m.standby.waitTime||0,_=(S=m==null?void 0:m.flex)==null?void 0:S.nextAvailableTime,y=Math.trunc(m.priority||4);return{...m,lp:!!_&&g>=Fs&&y<3&&pe(_)-d<=Math.min(Hs,(4-y)/3*g),starred:c.has(m.id)}}).sort((m,g)=>+!m.starred-+!g.starred||+!m.lp-+!g.lp||r(m,g)),x=k.filter(m=>!pn(m)),v=k.filter(pn).sort((m,g)=>m.name.localeCompare(g.name));return i(w,{children:[i(b,{experiences:x,type:"unexperienced"}),v.length>0&&i(w,{children:[i("h2",{className:`-mx-3 px-3 py-1 text-sm uppercase text-center ${s.bg} text-white`,children:"Previously Experienced"}),i(b,{experiences:v,type:"experienced"})]}),(x.length>0||v.length>0)&&i(Ii,{children:[i(me,{sym:i(st,{className:s.text}),def:at,onInfo:u}),n.dropTimes.length>0&&i(me,{sym:i(on,{className:s.text}),def:ot,onInfo:p}),i(me,{sym:i(an,{className:s.text}),def:ct,onInfo:f})]})]})});function Je({name:e,icon:t,onClick:n,className:r}){const a=W();return i("button",{title:`${e} (more info)`,className:`-mx-2 px-2 ${a.text} ${r}`,onClick:n,children:i(t,{})})}function Ws({experience:e,toggleStar:t}){const n=W();return i("button",{title:`${e.starred?"Remove from":"Add to"} Favorites`,className:"-m-2 p-2",onClick:()=>t(e),children:i(cs,{className:e.starred?n.text:"text-gray-300"})})}function Vs(){return i(M,{title:at,children:i("p",{children:"When an attraction with a long standby wait has a Lightning Lane return time in the near future, it's highlighted as a Lightning Pick. Book these quick before they're gone!"})})}function Ys({park:e,experience:t}){const n=L(),r=he((t==null?void 0:t.dropTimes)??[])[0],a=n.parks.filter(s=>s.dropTimes.length>0).sort((s,c)=>s===e?-1:c===e?1:0);return i(M,{title:ot,children:[i("p",{children:[t?i("b",{children:t.name}):"This attraction"," may be part of"," ",r?i(w,{children:["the"," ",i("time",{dateTime:r,className:"font-semibold",children:z(r)})]}):i(w,{children:"an upcoming"})," ","drop of additional Lightning Lane inventory, with earlier return times than what's currently being offered. Availability varies but is always limited, so be sure you're ready to book when the drop time arrives!"]}),a.map(s=>{const[c]=he(s.dropTimes);return i("div",{className:`mt-5 rounded overflow-hidden ${s.theme.bg}`,children:[i("h2",{className:`mt-0 py-1 ${s.theme.bg} text-white text-base text-center`,children:s.name}),i("div",{className:"flex flex-col px-2 pb-3 bg-white bg-opacity-90",children:n.dropExperiences(s).map((o,l)=>{var u;const d=l===1&&s.name==="Hollywood Studios",h=new Set(he(o.dropTimes??[]));return i("div",{children:[i("h3",{className:`mt-3 text-base ${d?`${s.theme.text}font-bold`:""}`,children:o.name}),i("ul",{className:"flex flex-wrap gap-y-2 mt-1 leading-tight",children:(u=o.dropTimes)==null?void 0:u.map(p=>{const f=p===c;return i("li",{className:"min-w-[6em] text-center",children:[i("div",{className:`${f?`${s.theme.text} font-bold`:h.has(p)?"font-semibold":"text-gray-500"}`,children:i("time",{dateTime:p,children:z(p)})}),f?i("div",{className:`rounded-sm ${s.theme.bg} text-white text-opacity-90 text-xs font-semibold text-center uppercase`,children:"next"}):null]},p)})})]},o.id)})})]},s.id)})]})}function qs(){return i(M,{title:ct,children:i("p",{children:"You currently have a Lightning Lane reservation for this attraction."})})}/** + */function cs(e){return i(j,{...e,children:i("path",{d:"M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z"})})}function ie({date:e,time:t,type:n,...r}){return i("time",{...r,dateTime:e||t,children:e?dr(e,n):t?H(t):""})}function mi({start:e,end:t}){const n=z(e),r=z(t);return t?i(w,{children:[e.time?i(ie,{time:e.time}):i("span",{children:"Park Open"})," \u2013"," ",r>n?i(ie,{date:r,type:"short"}):t.time?i(ie,{time:t.time}):i("span",{children:"Park Close"})]}):i(ie,{time:e.time})}const cn=i("span",{"aria-hidden":!0,children:"\u2022"});function pi({booking:e,button:t}){const n=W();return i("div",{className:"flex items-center gap-x-3",children:[i("div",{className:"flex-1 min-w-0",children:[i("div",{className:"flex items-center gap-x-2 text-gray-500 text-sm font-semibold uppercase whitespace-nowrap",children:[e.type==="DAS"&&i(w,{children:[i("span",{children:"DAS"}),cn]}),e.type==="BG"?i(w,{children:[i("span",{children:["BG ",e.boardingGroup]}),e.status==="SUMMONED"&&i(w,{children:[cn,i("span",{className:`${n.text} font-bold`,children:"Board Now"})]})]}):i(mi,{...e})]}),i("div",{className:"text-lg font-semibold leading-snug truncate",children:e.choices?"Multiple Experiences":e.name})]}),t&&i("div",{children:t})]})}function Fe(){const e=ge();return e.current?i("div",{children:i("div",{className:"-mx-3",children:[i("div",{className:"pb-1",children:"Modifying Reservation"}),i("div",{className:"px-3 py-2 bg-white text-black text-base font-normal normal-case text-left",children:i(pi,{booking:e.current,button:i(P,{type:"small",back:{screen:ce},onClick:e.end,children:"Keep"})})})]})}):null}function F({guests:e,selectable:t,conflicts:n}){const[r,a]=ii();if(e.length===0)return null;const s=new Set(t?e.filter(t==null?void 0:t.isSelected):[]),c=s.size>=((t==null?void 0:t.limit)??1/0);return i(w,{children:[i("ul",{className:"mt-2",children:e.map(o=>{var h;const l=s.has(o),d=c&&!l;return i("li",{className:"px-3 py-1",onClick:()=>a(d?"Selection limit reached":""),children:i("label",{className:"flex items-center",children:[t&&i("input",{type:"checkbox",checked:l,disabled:d,onChange:()=>t.onToggle(o),className:"mr-3"}),i("span",{className:"w-[48px] h-[48px] leading-[48px] mr-3 rounded-full text-3xl font-bold text-center bg-gray-400 text-white",children:o.avatarImageUrl?i("img",{src:o.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):i("span",{"aria-hidden":"true",children:o.name[0]})}),i("span",{className:"leading-tight",children:[o.name,(n==null?void 0:n[o.id])&&i("span",{className:"block text-xs font-semibold text-red-700 uppercase",children:(h=n[o.id])==null?void 0:h.replace(/_/g," ")})]})]})},o.id)})}),r]})}const fi=["bg1","genie","partyIds"];function _i(){const e=O.get(fi)??[];return Array.isArray(e)?e:[]}function ls(){const{genie:e}=L();C(()=>e.setPartyIds(_i()),[e])}function ds(){const{genie:e}=L(),{loadData:t,loaderElem:n}=Y(),[r,a]=E(!0),[s,c]=E(),[o,l]=E(()=>{const f=new Set(_i());return a(f.size===0),f});function d(){const f=[...o];O.set(fi,f),e.setPartyIds(f)}C(()=>{t(async()=>{const f=await e.guests();c([...f.eligible,...f.ineligible].sort((b,k)=>+!b.primary-+!k.primary||b.name.localeCompare(k.name)))})},[e,t]),C(()=>{r&&l(new Set)},[r]);const h=s==null?void 0:s.filter(f=>o.has(f.id)),u=s==null?void 0:s.filter(f=>!o.has(f.id)),p=f=>i("li",{children:i("label",{className:"flex items-center mt-2",children:[i("input",{type:"radio",name:"auto",onChange:()=>a(f.auto),checked:r===f.auto,className:"mr-2"})," ",f.children]})});return i(M,{title:"Party Selection",children:[i("p",{children:"By default, all eligible guests (up to a maximum of 12) are automatically selected when you book a Lightning Lane. If you would like to limit who you book for, you can manually select your party here."}),i("ul",{children:[i(p,{auto:!0,children:"Book for all eligible guests"}),i(p,{auto:!1,children:"Only book for selected guests"})]}),r?null:(s==null?void 0:s.length)===0?i("p",{className:"text-red-700",children:"No guests to select"}):h&&u?i(w,{children:[h.length>0&&i(w,{children:[i("h3",{children:"Your Party"}),i(F,{guests:h,selectable:{isSelected:()=>!0,onToggle:f=>{const b=new Set(o);b.delete(f.id),l(b)}}})]}),u.length>0&&i(w,{children:[i("h3",{children:"Add to Your Party"}),i(F,{guests:u,selectable:{isSelected:()=>!1,onToggle:f=>{const b=new Set(o);b.add(f.id),l(b)}}})]})]}):null,n,i(V,{back:!0,disabled:!r&&o.size===0,onClick:d,children:"Save"})]})}function Ie({name:e,onClick:t,...n}){return i(P,{...n,title:`Refresh ${e}`,onClick:t,children:i(wt,{})})}const gi=Q({eligible:[],ineligible:[],selected:[],setSelected:()=>null,experience:{name:"",park:{name:"",theme:{bg:"",text:""}}}}),yi=gi.Provider,vi=()=>J(gi),us="https://bg1.joelface.com/ping";async function Et(e,t){const{date:n}=R(),r=["bg1","ping",e.id,t];if(O.get(r)===n)return;const{ok:s}=await fetch(us,{method:"POST",body:new URLSearchParams({resort:e.id,service:t})});s&&O.set(r,n)}function hs(e){return i(j,{...e,children:i("path",{d:"M 5.5253906 0.9296875 L 3.4042969 3.0507812 L 8.3535156 8 L 3.4042969 12.949219 L 5.5253906 15.070312 L 10.474609 10.121094 L 12.595703 8 L 10.474609 5.8789062 L 5.5253906 0.9296875 z"})})}function bi(e){return i("div",{className:`mt-4 border-2 rounded border-green-600 p-1 font-semibold text-center text-green-600 bg-green-100 ${e.className}`,children:e.children})}function ms({bg:e,experiences:t,heading:n}){return i("div",{className:`mt-4 rounded ${e}`,children:[i("h3",{className:"mt-0 p-1 text-white text-center",children:n}),i("ul",{className:"list-disc py-2 pl-8 bg-white bg-opacity-90",children:t.map(r=>i("li",{children:r.name},r.id))})]})}function Ee({start:e,end:t,button:n}){return i("div",{className:"mt-4 text-lg",children:i("div",{className:"flex items-center gap-x-3",children:[i("div",{children:[t?"Arrive by":"Reservation at",":"," ",i("span",{className:"pl-1 font-semibold",children:i(mi,{start:e,end:t})})]}),n]})})}function Nt({offer:e,onOfferChange:t,booking:n}){var h;const{goBack:r}=G(),{genie:a}=L(),{loadData:s,loaderElem:c}=Y(),[o,l]=E(),d=q(()=>{function u(p){const f=e.start.time;if(!n||f===n.start.time)return p;const b={startTime:f,endTime:e.end.time},k=Number(f.split(":")[0]),x=p.findIndex(({hour:g})=>g>=k),{hour:v,slots:m}=p[x]??{};return x===-1?p.push({hour:k,slots:[b]}):v>k?p.splice(x,0,{hour:k,slots:[b]}):f{l(u(await a.times(e)))})},[e,n,a,s]);return C(d,[d]),i(M,{title:"Select Return Time",buttons:i(w,{children:[i(wi,{}),i(Ie,{name:"Times",onClick:d})]}),subhead:i(Fe,{}),theme:e.experience.park.theme,children:[i("h2",{children:(h=e.experience)==null?void 0:h.name}),i("div",{children:e.experience.park.name}),e&&i(Ee,{...n??e,button:i(P,{type:"small",onClick:r,children:"Keep"})}),o?o.length>0?i(w,{children:[i("h3",{children:"More Available Times"}),i("table",{className:"whitespace-nowrap",children:o.map(({hour:u,slots:p})=>i("tr",{children:[i("th",{className:"pt-3 pr-2 text-gray-500 text-sm font-semibold text-right uppercase",children:`${u>12?u-12:u} ${u<12?"AM":"PM"}`}),p.map(f=>i("td",{className:"pt-3 pr-3 text-center",children:i(P,{onClick:()=>{s(async()=>{const b=f.startTime===e.start.time?e:await a.changeOfferTime(e,f);await r(),t(b)})},children:H(f.startTime)})},f.startTime))]},u))})]}):i("p",{children:"No other times available"}):null,c]})}function ps({offer:e}){var h;const{goTo:t,goBack:n}=G(),{genie:r}=L(),{loadData:a,loaderElem:s}=Y(),{refreshPlans:c}=le(),[o,l]=E(e);function d(){a(async()=>{const u=await r.book(o);c(),await n({screen:ce}),t(i(fe,{booking:u,isNew:!0}))})}return i(M,{title:"Lightning Lane",subhead:i(li,{current:o.modifying,children:i(Fe,{})}),theme:o.experience.park.theme,children:[i("h2",{children:(h=o.experience)==null?void 0:h.name}),i("div",{children:o.experience.park.name}),i(Ee,{...o,button:i(P,{type:"small",onClick:()=>t(i(Nt,{offer:o,onOfferChange:l})),children:"Change"})}),i("h3",{children:"Your Party"}),i(F,{guests:o.guests.eligible}),s,i(V,{onClick:d,children:"Modify Lightning Lane"})]})}function fs({booking:e,onCancel:t,dasGuest:n}){const{genie:r,das:a}=L(),s=e.type==="DAS"?a:r,{refreshPlans:c}=le(),[o,l]=E(new Set),{loadData:d,loaderElem:h}=Y(),{name:u,park:p,guests:f}=e,b=o.size===0,k=o.size===f.length;async function x(){b||(await d(async()=>{await s.cancelBooking([...o]),c()}),t(f.filter(v=>!o.has(v))))}return i(M,{title:"Cancel Guests",theme:p.theme,children:[i("h2",{children:u}),i("div",{children:p.name}),i(Ee,{...e}),i("div",{className:"ml-3",children:i("label",{className:"flex items-center py-4",children:[i("input",{type:"checkbox",checked:k,onChange:()=>l(new Set(k?[]:f))}),i("span",{className:"ml-3",children:"Select All"})]})}),!b&&i("div",{className:"mb-4",children:[i("h3",{children:"Cancel These Guests"}),i(F,{guests:f.filter(v=>o.has(v)),selectable:{isSelected:()=>!0,onToggle:v=>{if(n&&v!==n&&o.has(n))l(new Set);else{const m=new Set(o);m.delete(v),l(m)}}}})]}),!k&&i("div",{children:[i("h3",{children:"Select Guests to Cancel"}),i(F,{guests:f.filter(v=>!o.has(v)),selectable:{isSelected:()=>!1,onToggle:v=>{l(new Set(v===n?f:o).add(v))}}})]}),i(V,{back:!0,disabled:b,onClick:x,children:"Cancel "+(k?"Reservation":"Guests")}),h]})}function fe({booking:e,isNew:t}){var A;const{goTo:n,goBack:r}=G(),{loadData:a,loaderElem:s}=Y(),{setPark:c}=Ue(),o=L(),l=ni(),{name:d,park:h,choices:u,type:p,subtype:f,start:b}=e,k=p==="DAS"&&f==="IN_PARK"?e.guests.find(I=>l.find(B=>B.primaryGuest.id===I.id)):void 0,x=ge(),[v,m]=E(e.cancellable&&(p!=="DAS"||k)?e.guests:void 0),g=new Map([[h,[]],...o.parks.map(I=>[I,[]])]);for(const I of u||[])(A=g.get(I.park))==null||A.push(I);const _=[...g].filter(([,I])=>I.length>0).map(([I])=>I),y=(u?_.length===1?_[0]:{}:h).theme??bt;return i(M,{title:"Your "+{LL:"Lightning Lane",DAS:"DAS Selection",BG:"Boarding Group",APR:"Park Pass",RES:"Reservation"}[p],theme:y,buttons:e.modifiable&&i(P,{onClick:()=>{x.begin(e),c(e.park),r({screen:ce,props:{tabName:"LL"}})},children:"Modify"}),subhead:i(ie,{date:z(b)}),children:[u?i("h2",{children:"Multiple Experiences"}):i(w,{children:[i("h2",{children:d}),h.name&&i("div",{children:h.name})]}),p==="BG"?i(w,{children:[e.status==="SUMMONED"&&i(bi,{children:"Your boarding group has been called"}),i("h3",{children:["Boarding Group:"," ",i("span",{className:"ml-1 font-semibold",children:e.boardingGroup})]}),i("p",{children:"Check the official Disney app for return time and other virtual queue information."})]}):i(Ee,{...e,button:o.genie.allowsTimeSelect&&e.modifiable&&i(P,{type:"small",onClick:()=>{a(async()=>{n(i(Nt,{booking:e,offer:await o.genie.offer({...e,flex:{}},e.guests,e),onOfferChange:I=>{n(i(ps,{offer:I}))}}))},{messages:{410:"No reservations available"}})},children:"Change"})}),u&&i(w,{children:[i("p",{children:[d&&i(w,{children:[i("b",{children:d})," was temporarily unavailable during your return time."," "]}),"You may redeem this Lightning Lane at one of these replacement experiences:"]}),[...g].filter(([,I])=>I.length>0).map(([I,B])=>i(ms,{heading:I.name,experiences:B,bg:I.theme.bg},I.id))]}),i("div",{className:"flex mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),e.cancellable&&v&&i(P,{type:"small",onClick:()=>{n(i(fs,{booking:{...e,guests:v},dasGuest:k,onCancel:I=>{I.length>0?m(I):r()}}))},className:"ml-3",children:"Cancel"})]}),i(F,{guests:v||e.guests,conflicts:Object.fromEntries(e.type==="LL"?e.guests.filter(I=>(I.redemptions??1)!==1).map(I=>[I.id,`Redemptions left: ${I.redemptions}`]):[])}),t&&i(V,{onClick:()=>r({screen:ce,props:{tabName:"Plans"}}),children:"Show Plans"}),s]})}function xi({...e}){const{plans:t,refreshPlans:n,loaderElem:r}=le();return i(It,{title:"Your Plans",buttons:i(Ie,{name:"Plans",onClick:n}),theme:bt,...e,children:[i(_s,{plans:t}),r]})}const _s=_t(function({plans:t}){var l,d;const{goTo:n}=G(),r=W();function a(h){n(i(fe,{booking:h}))}const s=new Map,c=new Map;for(const h of t){const u=z(h.start);s.has(u)||s.set(u,[]),h.type!=="APR"&&((l=s.get(u))==null||l.push(h)),c.has(u)||c.set(u,new Set),(h.type!=="LL"||h.subtype!=="MEP")&&h.park.icon&&((d=c.get(u))==null||d.add(h.park))}const o=i("p",{className:"font-semibold text-center uppercase text-gray-500",children:"No existing plans"});return i("ul",{children:t.length>0?[...s].map(([h,u])=>i("li",{children:[i("div",{className:"sticky top-0 -mx-3 pt-1 bg-white",children:i("div",{className:"flex items-center",children:[i("h2",{className:`flex-1 mt-0 rounded-r-full px-3 py-1 ${r.bg} text-white text-sm uppercase`,children:i(ie,{date:h})}),i("ul",{className:"px-3 pl-2 text-lg text-right",children:[...c.get(h)??[]].map(p=>i("li",{className:"inline ml-1 first:ml-0","aria-label":p.name,children:p.icon},p.id))})]})}),u.length>0?i("ul",{className:u.length===0?"mt-3":"",children:u.map(p=>i("li",{className:"py-2.5 first:border-0 border-t-4 border-gray-300",onClick:()=>a(p),children:i(pi,{booking:p,button:i("div",{className:r.text,title:"More Info",children:i(hs,{})})})},p.bookingId))}):o]},h)):o})});function wi({...e}){const{goTo:t}=G();return i(w,{children:i(P,{...e,onClick:()=>t(i(xi,{})),title:"Plans",children:i(hi,{})})})}function Tt(){const{ineligible:e}=vi();return i(F,{guests:e,conflicts:Object.fromEntries(e.map(t=>[t.id,t.eligibleAfter?`TOO EARLY (${H(t.eligibleAfter)})`:t.ineligibleReason||"ELIGIBLE FOR NEW BOOKING"]))})}function gs(){const{genie:e}=L(),t=ge();return i(w,{children:[t.current?i(w,{children:[i("h3",{children:"Unable to Modify"}),i("p",{children:"Your current reservation cannot be modified to this experience due to the following conflicts:"})]}):i(w,{children:[e.nextBookTime&&e.nextBookTime.slice(0,5)>R().time.slice(0,5)&&i(bi,{children:["Eligible at ",i(ie,{time:e.nextBookTime})]}),i("h3",{children:"No Eligible Guests"}),i("p",{children:"No one in your party is currently eligible for this Lightning Lane."})]}),i(Tt,{})]})}function ys({onRefresh:e}){return i(w,{children:[i("h3",{children:"No Guests Found"}),i("p",{children:"Your party could not be loaded. This is probably just a temporary network error. Wait a few seconds and try again."}),i(V,{onClick:e,children:"Try Again"})]})}function vs(e){return i("div",{className:`mt-4 border-2 rounded border-red-600 p-1 font-semibold text-center text-red-600 bg-red-100 ${e.className}`,children:e.children})}function bs({party:e}){const{eligible:t,ineligible:n,selected:r,setSelected:a,experience:s}=e,[c,o]=E(new Set(r)),{maxPartySize:l}=L().genie;function d(h){c[c.has(h)?"delete":"add"](h),o(new Set(c))}return i(yi,{value:e,children:i(M,{title:"Modify Party",theme:s.park.theme,children:[i("h2",{children:s.name}),i("div",{children:s.park.name}),i("h3",{children:"Your Party"}),i(F,{guests:t,selectable:{isSelected:h=>c.has(h),onToggle:d,limit:l}}),n.length>0&&i(w,{children:[i("h3",{children:"Ineligible Guests"}),i(Tt,{})]}),i(V,{back:!0,disabled:c.size===0,onClick:()=>{a(t.filter(h=>c.has(h)))},children:"Confirm Party"})]})})}function ki(){const{goTo:e}=G(),t=vi(),{eligible:n,selected:r}=t,{maxPartySize:a}=L().genie;return i(w,{children:[n.length>a&&r.length===a&&i(vs,{children:"Party size restricted"}),r.length>0?i(w,{children:[i("div",{className:"mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),i(P,{type:"small",onClick:()=>e(i(bs,{party:t})),className:"ml-3",children:"Modify"})]}),i(F,{guests:r})]}):i(w,{children:[i("h3",{children:"Ineligible Guests"}),i(Tt,{})]})]})}function xs(){return i(w,{children:[i("h3",{children:"No Reservations Available"}),i("p",{children:"There aren't enough reservation slots available for your entire party. If only part of your group wishes to go on this attraction, edit your party to check again. Otherwise, go back to the attraction list and select another attraction."}),i(ki,{})]})}function ws({offer:e,onOfferChange:t}){const{goTo:n}=G(),{genie:r}=L();return i(w,{children:[i("div",{className:"flex items-center",children:i(Ee,{...e,button:r.allowsTimeSelect&&i(P,{type:"small",onClick:()=>n(i(Nt,{offer:e,onOfferChange:t})),children:"Change"})})}),e.changed&&i("div",{className:"text-sm",children:[i("strong",{children:"Note:"})," Return time has been changed"]}),i(ki,{})]})}function ks({experience:e}){const{goTo:t}=G(),n=L(),{genie:r}=n,{refreshExperiences:a}=_e(),{refreshPlans:s}=le(),c=ge(),[o,l]=E(),[d,h]=E(),{loadData:u,loaderElem:p}=Y();async function f(){!d||!o||u(async()=>{const m=await r.book(d,o.selected);c.end();const g=new Set(o.selected.map(y=>y.id)),_=m.guests.filter(y=>!g.has(y.id));_.length>0&&(await r.cancelBooking(_),m.guests=m.guests.filter(y=>g.has(y.id))),m&&t(i(fe,{booking:m,isNew:!0}),{replace:!0}),s(),a(),Et(n,"G")},{messages:{410:"Offer expired"}})}const b=q(()=>{u(async()=>{const m=c.current?{eligible:c.current.guests,ineligible:[]}:await r.guests(e);l({...m,selected:m.eligible.slice(0,r.maxPartySize),setSelected:g=>l(_=>{if(!_)return _;const y=new Set(_.selected);return h(S=>S===null||g.some(A=>!y.has(A))?void 0:S),{..._,selected:g}}),experience:e})})},[r,e,c,u]);C(()=>{o||b()},[o,b]);const k=q(m=>{!o||o.selected.length===0||u(async()=>{try{const g=await r.offer(e,o.selected,c.current),{ineligible:_}=g.guests;if(_.length>0){const y=new Set(_.map(A=>A.id)),S=A=>!y.has(A.id);l({...o,eligible:o.eligible.filter(S),ineligible:[..._,...o.ineligible],selected:o.selected.filter(S)})}g.active?(d&&(g.changed=!1),h(g)):h(y=>y??null)}catch(g){throw m||h(null),g}},{messages:{410:d?"No reservations available":""}})},[r,e,o,d,c,u]);C(()=>{d===void 0&&k()},[d,k]);const x=(o==null?void 0:o.eligible.length)===0,v=x&&(o==null?void 0:o.ineligible.length)===0;return i(M,{title:"Lightning Lane",theme:e.park.theme,buttons:i(w,{children:[i(wi,{}),i(Ie,{onClick:()=>{x?b():k()},name:x?"Party":"Offer"})]}),subhead:i(Fe,{}),children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),o&&i(yi,{value:o,children:v?i(ys,{onRefresh:b}):x?i(gs,{}):!o||d===void 0?i("div",{}):d===null?i(xs,{}):i(w,{children:[i(ws,{offer:d,onOfferChange:h}),i(V,{onClick:f,children:`${c.current?"Modify":"Book"} Lightning Lane`})]})}),p]})}function ze({label:e,children:t}){return i("div",{className:"flex items-center flex-1 whitespace-nowrap",children:[i("span",{className:"mr-2 text-xs font-semibold uppercase text-gray-500",children:e})," ",t]})}function Is({experience:e}){const{goTo:t}=G(),{flex:n}=e;return i(ze,{label:"LL",children:i("span",{children:i(P,{onClick:()=>t(i(ks,{experience:e})),children:n.nextAvailableTime?H(n.nextAvailableTime):"none"})})})}function Ii({children:e}){return i("div",{className:"mt-8 flex justify-center",children:i("div",{children:[i("h2",{className:"mt-0 pl-1 text-gray-500 text-sm leading-tight uppercase",children:"Symbols"}),i("div",{className:"border-2 border-gray-500 rounded px-2 py-0.5 bg-gray-100",children:i("table",{children:i("tbody",{children:e})})})]})})}function me({sym:e,def:t,onInfo:n}){return i("tr",{children:[i("th",{className:"py-0.5 text-center font-bold",children:e}),i("td",{className:"pl-3 py-0.5",children:t}),n&&i("td",{className:"pl-3 py-0.5",children:i(P,{type:"small",onClick:n,children:"Info"})})]})}const Es="_SELECT_RADIO_BUTTON_";function Ei(e){const{options:t,selected:n,title:r,onChange:a,disabled:s,...c}=e,{bg:o}=W(),[l,d]=E(!1),[h,u]=E(0),p=ne(null),f=ne(null);mt(()=>{var I;if((I=t.values().next().value)!=null&&I.icon)return;const _=p.current,y=_==null?void 0:_.firstChild;if(!y)return;const S=y.nodeValue;if(!S)return;let A=0;for(const B of t.values())y.nodeValue=B.text,A=Math.max(_.offsetWidth,A);y.nodeValue=S,u(A)},[t]);const b=()=>{var _;return(_=f.current)==null?void 0:_.querySelector("input:checked")};C(()=>{var S;if(!l)return;const _=b();(S=_==null?void 0:_.closest("li"))==null||S.scrollIntoView(),_==null||_.focus();const y=A=>{var I;(I=f.current)!=null&&I.contains(A.target)||d(!1)};return addEventListener("focusin",y),()=>removeEventListener("focusin",y)},[l]);const k=()=>{const _=b();if(_){const y=_.value,S=t.get(y);S&&a(S.value??y)}d(!1)},x=n?t.get(n):r!==void 0?{text:r}:void 0;if(!x)return null;const{icon:v,text:m}=x;let g=!1;return i(w,{children:[i(P,{...c,title:v?`${r}: ${m}`:r,disabled:s||t.size===0,onClick:()=>d(!0),children:[v||i("span",{className:"flex-1 truncate",style:{minWidth:`${h}px`},ref:p,children:m}),i(j,{className:"w-2.5 ml-2 shrink-0",children:i("path",{d:"m6.8273 12.401-5.6333-7.7812a1.0212 1.0212 117.05 0 1 0.82716-1.62l11.958-2e-7a1.0212 1.0212 62.952 0 1 0.82714 1.62l-1.6438 2.2705a79984 79984 125.9 0 0-2.3456 3.2401l-1.6437 2.2706a1.4479 1.4479 180 0 1-2.3456 4.4e-5z"})})]}),l&&i(kt,{onChange:()=>{g||k(),g=!1},onClick:_=>{var y;g||(!((y=f.current)!=null&&y.contains(_.target))||n&&_.target.value===n)&&(d(!1),_.preventDefault())},onKeyDown:({key:_})=>{["Enter"," "].includes(_)?k():_.startsWith("Arrow")&&(g=!0)},"data-testid":"shade",children:i("div",{className:"flex flex-col min-w-[50%] max-h-[90%] rounded-lg bg-white text-black",children:[r&&i("h3",{className:`mt-0 rounded-t-lg px-5 py-1 ${o} text-white font-semibold text-center`,children:r}),i("ul",{className:"overflow-auto",ref:f,children:[...t].map(([_,y])=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("label",{className:"flex flex-row items-center gap-x-2.5 px-4 py-3",children:[i("input",{type:"radio",name:Es,value:_,defaultChecked:_===n,className:"w-4 h-4 shrink-0"})," ",y.icon&&i("span",{"aria-hidden":"true",children:y.icon})," ",y.text]})},y.text))})]})})]})}function Ni(e){const{parks:t,genie:n}=L(),{park:r,setPark:a}=_e(),s=ge(),c=pt(()=>new Map(t.map(o=>[o.id,{value:o,icon:o.icon,text:o.name}])),[t]);return i(Ei,{...e,options:c,selected:r.id,onChange:a,disabled:!!s.current&&!n.allowsCrossParkModify,title:"Park","data-testid":"park-select"})}function Ns({experience:{type:e,standby:t,virtualQueue:n}}){return t.nextShowTime||e==="ENTERTAINMENT"&&!t.waitTime?i(Ss,{standby:t}):n?i(Cs,{virtualQueue:n}):i(Ts,{standby:t})}const Ts=({standby:e})=>i(ze,{label:"Standby",children:e.available?i(St,{time:e.waitTime!==void 0?e.waitTime+" min":"now"}):i(Si,{text:"down"})}),Ss=({standby:e})=>i(ze,{label:i(w,{children:["Next ",i("span",{className:"hidden xs:inline",children:"Show"})]}),children:e.nextShowTime?i(St,{time:H(e.nextShowTime)}):i(Si,{text:"none"})}),Cs=({virtualQueue:e})=>i(ze,{label:i("abbr",{title:"Virtual Queue",children:"VQ"}),children:i(St,{time:e.nextAvailableTime?H(e.nextAvailableTime):"closed"})}),Ti="inline-block border-2 rounded px-1.5 py-0.5 font-semibold",St=({time:e})=>i("span",{className:`${Ti} border-gray-500 text-gray-500 bg-gray-100`,children:e}),Si=({text:e})=>i("span",{className:`${Ti} border-red-600 text-red-600 bg-red-100`,children:e});function Ps({bookTime:e,dropTime:t}){const n=W();return!e&&!t?null:i("div",{className:`flex justify-center gap-x-10 ${n.bg}`,children:[i(ln,{label:"Book",time:e}),i(ln,{label:"Drop",time:t})]})}function ln({label:e,time:t}){if(!t)return null;t=t.slice(0,5);const n=R().time.slice(0,5);return i("div",{children:[e,":"," ",i("time",{dateTime:t,className:"whitespace-nowrap",children:t>n?H(t):"now"})]})}async function Ds(e={}){return new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(r=>{t(r)},r=>{n(r)},e)})}const As={maximumAge:15e3,timeout:2e3};function Ls(){const[e,t]=E(),n=q(async()=>{try{const{coords:r}=await Ds(As);t(a=>a&&r.latitude===a[0]&&r.longitude===a[1]?a:[r.latitude,r.longitude])}catch{t(void 0)}},[]);return[e,n]}const dn=["bg1","genie","sort"],Rs=(e,t)=>(e.priority||1/0)-(t.priority||1/0),Qe=(e,t)=>(t.standby.waitTime||-1)-(e.standby.waitTime||-1),$s=(e,t)=>{var n,r;return pe(((n=e==null?void 0:e.flex)==null?void 0:n.nextAvailableTime)||"00:00")-pe(((r=t==null?void 0:t.flex)==null?void 0:r.nextAvailableTime)||"00:00")},Os=(e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()),un=(e,t)=>Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)),Gs=(e,t,n)=>e.geo===t.geo?0:e.geo?t.geo?n?un(e.geo,n)-un(t.geo,n):0:-1:1,Ms={priority:(e,t)=>Rs(e,t)||Qe(e,t),standby:(e,t)=>Qe(e,t),soonest:(e,t)=>$s(e,t)||Qe(e,t),nearby:(e,t,n)=>Gs(e,t,n),aToZ:()=>0},hn=new Map([["priority",{text:"Priority"}],["nearby",{text:"Nearby"}],["standby",{text:"Standby"}],["soonest",{text:"Soonest"}],["aToZ",{text:"A to Z"}]]);function Bs(e,t){const{n,s:r,e:a,w:s}=e.geo,[c,o]=t;return cr&&os}function Us(){const{experiences:e,park:t}=_e(),[n,r]=Ls(),[a,s]=E(()=>{const l=O.get(dn);return l&&hn.has(l)?l:"priority"});C(()=>{a==="nearby"&&r()},[e,a,r]);const c=q((l,d)=>{var h,u;return Number((h=d==null?void 0:d.flex)==null?void 0:h.available)-Number((u=l==null?void 0:l.flex)==null?void 0:u.available)||Ms[a==="nearby"&&!(n&&Bs(t,n))?"priority":a](l,d,n)||Os(l,d)},[n,t,a]);return{sortType:a,sorter:c,SortSelect:l=>i(Ei,{...l,options:hn,selected:a,onChange:d=>{s(d),O.set(dn,d)},title:"Sort By"})}}const Fs=30,zs=60,mn=["bg1","genie","tipBoard","starred"],at="Lightning Pick",ot="Upcoming Drop",ct="Booked",pn=e=>e.experienced&&!e.starred;function Hs({contentRef:e}){ls();const{genie:t}=L(),{experiences:n,refreshExperiences:r,park:a,loaderElem:s}=_e(),{sortType:c,sorter:o,SortSelect:l}=Us(),d=ne(!0);C(()=>{var u;d.current||(u=e.current)==null||u.scroll(0,0)},[c,e]),C(()=>{d.current=!1},[]);const h=he(a.dropTimes)[0];return i(It,{title:i(w,{children:"Availability"}),buttons:i(w,{children:[i(l,{}),i(Ni,{}),i(Ie,{name:"Experiences",onClick:r})]}),subhead:i(w,{children:[i(Fe,{}),i(Ps,{bookTime:t.nextBookTime,dropTime:h})]}),contentRef:e,children:[i(js,{experiences:n,park:a,sorter:o}),s]})}const js=_t(function({experiences:t,park:n,sorter:r}){const{goTo:a}=G(),s=W(),[c,o]=E(()=>{const m=O.get(mn)??[];return new Set(Array.isArray(m)?m:[])}),l=he(n.dropTimes)[0],d=pe(R().time);function h({id:m}){o(g=>(g=new Set(g),g.has(m)?g.delete(m):g.add(m),O.set(mn,[...g]),g))}const u=()=>a(i(Vs,{})),p=m=>a(i(Ys,{park:n,experience:m})),f=()=>a(i(qs,{})),b=({experiences:m,type:g})=>i("ul",{"data-testid":g,children:m.map(_=>{const[y]=he(_.dropTimes??[]);return i("li",{className:"pb-3 first:border-0 border-t-4 border-gray-300",children:[i("div",{className:"flex items-center gap-x-2 mt-2",children:[i(Ws,{experience:_,toggleStar:h}),i("h3",{className:"flex-1 mt-0 text-lg font-semibold leading-tight truncate",children:_.name}),_.lp?i(Je,{name:at,icon:st,onClick:u}):y?i(Je,{name:ot,icon:on,onClick:()=>p(_),className:y!==l?"opacity-50":""}):null,_.flex.preexistingPlan&&i(Je,{name:ct,icon:an,onClick:f})]}),i("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[i(Ns,{experience:_}),i(Is,{experience:_})]})]},_.id+(_.starred?"*":""))})}),k=t.filter(m=>!!m.flex).map(m=>{var S;const g=m.standby.waitTime||0,_=(S=m==null?void 0:m.flex)==null?void 0:S.nextAvailableTime,y=Math.trunc(m.priority||4);return{...m,lp:!!_&&g>=Fs&&y<3&&pe(_)-d<=Math.min(zs,(4-y)/3*g),starred:c.has(m.id)}}).sort((m,g)=>+!m.starred-+!g.starred||+!m.lp-+!g.lp||r(m,g)),x=k.filter(m=>!pn(m)),v=k.filter(pn).sort((m,g)=>m.name.localeCompare(g.name));return i(w,{children:[i(b,{experiences:x,type:"unexperienced"}),v.length>0&&i(w,{children:[i("h2",{className:`-mx-3 px-3 py-1 text-sm uppercase text-center ${s.bg} text-white`,children:"Previously Experienced"}),i(b,{experiences:v,type:"experienced"})]}),(x.length>0||v.length>0)&&i(Ii,{children:[i(me,{sym:i(st,{className:s.text}),def:at,onInfo:u}),n.dropTimes.length>0&&i(me,{sym:i(on,{className:s.text}),def:ot,onInfo:p}),i(me,{sym:i(an,{className:s.text}),def:ct,onInfo:f})]})]})});function Je({name:e,icon:t,onClick:n,className:r}){const a=W();return i("button",{title:`${e} (more info)`,className:`-mx-2 px-2 ${a.text} ${r}`,onClick:n,children:i(t,{})})}function Ws({experience:e,toggleStar:t}){const n=W();return i("button",{title:`${e.starred?"Remove from":"Add to"} Favorites`,className:"-m-2 p-2",onClick:()=>t(e),children:i(cs,{className:e.starred?n.text:"text-gray-300"})})}function Vs(){return i(M,{title:at,children:i("p",{children:"When an attraction with a long standby wait has a Lightning Lane return time in the near future, it's highlighted as a Lightning Pick. Book these quick before they're gone!"})})}function Ys({park:e,experience:t}){const n=L(),r=he((t==null?void 0:t.dropTimes)??[])[0],a=n.parks.filter(s=>s.dropTimes.length>0).sort((s,c)=>s===e?-1:c===e?1:0);return i(M,{title:ot,children:[i("p",{children:[t?i("b",{children:t.name}):"This attraction"," may be part of"," ",r?i(w,{children:["the"," ",i("time",{dateTime:r,className:"font-semibold",children:H(r)})]}):i(w,{children:"an upcoming"})," ","drop of additional Lightning Lane inventory, with earlier return times than what's currently being offered. Availability varies but is always limited, so be sure you're ready to book when the drop time arrives!"]}),a.map(s=>{const[c]=he(s.dropTimes);return i("div",{className:`mt-5 rounded overflow-hidden ${s.theme.bg}`,children:[i("h2",{className:`mt-0 py-1 ${s.theme.bg} text-white text-base text-center`,children:s.name}),i("div",{className:"flex flex-col px-2 pb-3 bg-white bg-opacity-90",children:n.dropExperiences(s).map((o,l)=>{var u;const d=l===1&&s.name==="Hollywood Studios",h=new Set(he(o.dropTimes??[]));return i("div",{children:[i("h3",{className:`mt-3 text-base ${d?`${s.theme.text}font-bold`:""}`,children:o.name}),i("ul",{className:"flex flex-wrap gap-y-2 mt-1 leading-tight",children:(u=o.dropTimes)==null?void 0:u.map(p=>{const f=p===c;return i("li",{className:"min-w-[6em] text-center",children:[i("div",{className:`${f?`${s.theme.text} font-bold`:h.has(p)?"font-semibold":"text-gray-500"}`,children:i("time",{dateTime:p,children:H(p)})}),f?i("div",{className:`rounded-sm ${s.theme.bg} text-white text-opacity-90 text-xs font-semibold text-center uppercase`,children:"next"}):null]},p)})})]},o.id)})})]},s.id)})]})}function qs(){return i(M,{title:ct,children:i("p",{children:"You currently have a Lightning Lane reservation for this attraction."})})}/** * Exit icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 */function Ks(e){return i(j,{...e,children:i("path",{d:"M12 10v-2h-5v-2h5v-2l3 3zM11 9v4h-5v3l-6-3v-13h11v5h-1v-4h-8l4 2v9h4v-3z"})})}/** @@ -34,6 +34,6 @@ var Ri=Object.defineProperty;var $i=e=>{throw TypeError(e)};var Oi=(e,t,n)=>t in */function Js(e){return i(j,{...e,children:i("path",{d:"M14.59 9.535c-0.839-1.454-0.335-3.317 1.127-4.164l-1.572-2.723c-0.449 0.263-0.972 0.414-1.529 0.414-1.68 0-3.042-1.371-3.042-3.062h-3.145c0.004 0.522-0.126 1.051-0.406 1.535-0.839 1.454-2.706 1.948-4.17 1.106l-1.572 2.723c0.453 0.257 0.845 0.634 1.123 1.117 0.838 1.452 0.336 3.311-1.12 4.16l1.572 2.723c0.448-0.261 0.967-0.41 1.522-0.41 1.675 0 3.033 1.362 3.042 3.046h3.145c-0.001-0.517 0.129-1.040 0.406-1.519 0.838-1.452 2.7-1.947 4.163-1.11l1.572-2.723c-0.45-0.257-0.839-0.633-1.116-1.113zM8 11.24c-1.789 0-3.24-1.45-3.24-3.24s1.45-3.24 3.24-3.24c1.789 0 3.24 1.45 3.24 3.24s-1.45 3.24-3.24 3.24z"})})}/** * User icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function Xs(e){return i(j,{...e,children:i("path",{d:"M9 11.041v-0.825c1.102-0.621 2-2.168 2-3.716 0-2.485 0-4.5-3-4.5s-3 2.015-3 4.5c0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h14c0-2.015-2.608-3.682-6-3.959z"})})}function Zs(){const{goTo:e}=G(),[t]=E([{text:"Party Selection",icon:i(Xs,{}),action:()=>e(i(ds,{}))},{text:"Log Out",icon:i(Ks,{}),action:()=>K.deleteData()},{text:"BG1 News",icon:i(Qs,{}),action:()=>e(i(ei,{}))}]),[n,r]=E(!1),a=ne(null);return i(w,{children:[i("button",{className:"absolute top-0 right-0 h-full px-4",onClick:()=>r(!0),title:"Settings Menu",children:i(Js,{})}),n&&i(kt,{onClick:s=>{var c;(c=a.current)!=null&&c.contains(s.target)||r(!1)},"data-testid":"shade",children:i("ul",{className:"overflow-auto min-w-[50%] max-h-[90%] rounded-lg bg-white text-black text-lg font-normal",ref:a,children:t.map(s=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("button",{className:"flex flex-row items-center w-full px-4 py-3",onClick:()=>{r(!1),setTimeout(s.action,50)},children:[i("span",{className:"mr-2.5 text-gray-700","aria-hidden":!0,children:s.icon}),s.text]})},s.text))})})]})}function Ci(e){const[t,n]=e.split(":").map(Number);return t*60+n}const ea=(e,t)=>Ci(e)-t;function fn({park:e,onSelect:t}){const{das:n}=L(),{loadData:r,loaderElem:a}=Y(),[s,c]=E();C(()=>{r(async()=>{const l=await n.experiences(e);c(l.filter(d=>d.available&&!!d.time).sort((d,h)=>d.name.localeCompare(h.name)))})},[e,n,r]);const o=[{heading:"Attractions",type:"ATTRACTION"},{heading:"Characters",type:"CHARACTER"},{heading:"Entertainment",type:"ENTERTAINMENT"}];return i(M,{title:"Select Experience",theme:e.theme,children:[s?s.length>0?i(w,{children:o.map(l=>i(ta,{park:e,experiences:s.filter(d=>d.type===l.type),heading:l.heading,onSelect:t},l.type))}):i("p",{children:"No DAS experiences available"}):null,a]})}function ta({park:e,experiences:t,heading:n,onSelect:r}){if(t.length===0)return null;const a=Ci(R().time);return i("div",{className:`mt-4 rounded overflow-hidden ${e.theme.bg}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:n}),i("ul",{className:"bg-white bg-opacity-90 leading-snug",children:t.map(s=>i("li",{className:"flex items-center pt-3 last:pb-3",children:[i("div",{className:"flex-1 px-2",children:s.name}),i("div",{className:"px-2",children:i(P,{onClick:()=>r(s),children:i("span",{className:"min-w-[4rem]",children:[ea(s.time,a)," ",i("abbr",{title:"minutes",children:"min."})]})})})]},s.id))})]})}function _n({park:e,party:t}){const{goTo:n,goBack:r}=G(),a=L(),{das:s}=a,{refreshPlans:c}=le(),[o,l]=E(),[d,h]=E(new Set([t.primaryGuest,...t.linkedGuests].slice(0,t.selectionLimit))),[u,p]=E({}),{loadData:f,loaderElem:b}=Y();async function k(){o&&f(async()=>{try{const x=await s.book({park:e,experience:o,primaryGuest:t.primaryGuest,guests:[...d]});c(),Et(a,"D"),await r({screen:ce}),n(i(fe,{booking:x,isNew:!0}))}catch(x){throw x instanceof zn&&p(x.conflicts),x}},{messages:{ConflictsError:"Some guests not eligible",ExperienceUnavailable:"Experience currently unavailable"}})}return i(M,{title:"DAS Selection",theme:e.theme,children:[i("h3",{children:"Experience"}),o?i("div",{className:"flex items-center mt-3",children:[i("div",{className:"text-lg font-semibold truncate",children:o.name}),i("div",{className:"ml-3",children:i(P,{type:"small",onClick:()=>n(i(fn,{park:e,onSelect:x=>{l(x),r()}})),children:"Change"})})]}):i("div",{className:"mt-3 text-center",children:i(P,{onClick:()=>n(i(fn,{park:e,onSelect:x=>{l(x),r()}})),children:"Select Experience"})}),i("h3",{children:"DAS Guest"}),i(F,{guests:[t.primaryGuest],conflicts:u}),t.linkedGuests.length>0&&i(w,{children:[i("h3",{children:"Additional Guests"}),i(F,{guests:t.linkedGuests,selectable:{isSelected:x=>d.has(x),onToggle:x=>{d[d.has(x)?"delete":"add"](x),h(new Set(d))},limit:t.selectionLimit-1},conflicts:u})]}),i(V,{disabled:!t||!o,onClick:k,children:"Request Return Time"}),b]})}function na({parties:e}){const{goTo:t}=G(),{park:n}=Ue(),{plans:r,refreshPlans:a,loaderElem:s}=le();mt(a,[a]);const c=new Set(e.map(u=>u.primaryGuest.id)),o=r.filter(u=>u.type==="DAS"&&u.subtype==="IN_PARK"),l=new Map(o.filter(u=>u.type==="DAS"&&u.subtype==="IN_PARK").map(u=>{var p;return[((p=u.guests.find(f=>c.has(f.id)))==null?void 0:p.id)??"",u]}));if(!s&&e.length===1){const u=e[0],p=l.get(u.primaryGuest.id);return p?i(fe,{booking:p}):i(_n,{park:n,party:u})}const d=e.filter(u=>!(l!=null&&l.has(u.primaryGuest.id))),h=e.filter(u=>l==null?void 0:l.has(u.primaryGuest.id));return i(M,{title:`DAS ${e.length===1?"Selection":"Parties"}`,theme:n.theme,children:s||(e.length>0?i(w,{children:[d.length>0&&i(w,{children:[i("h3",{children:"Select Next Experience"}),i("ul",{className:"mt-2",children:d.map(u=>i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:u.primaryGuest.avatarImageUrl?i("img",{src:u.primaryGuest.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):u.primaryGuest.name[0]}),i("span",{className:"flex-1 leading-tight",children:u.primaryGuest.name}),i(P,{type:"small",onClick:()=>t(i(_n,{park:n,party:u})),children:"Select"})]},u.primaryGuest.id))})]}),h.length>0&&i(w,{children:[i("h3",{children:"Current Selection"}),i("ul",{className:"mt-2",children:h.map(u=>{const p=l.get(u.primaryGuest.id);return i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:u.primaryGuest.avatarImageUrl?i("img",{src:u.primaryGuest.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):u.primaryGuest.name[0]}),i("div",{className:"flex-1",children:[i("div",{children:u.primaryGuest.name}),p&&i("div",{className:"text-gray-500 text-xs font-semibold uppercase",children:[p.name," @"," ",i(ie,{time:p.start.time})]})]}),i(P,{type:"small",onClick:()=>{p&&t(i(fe,{booking:p}))},children:"Details"})]},u.primaryGuest.id)})})]})]}):i("div",{}))})}function ia({contentRef:e}){const{goTo:t}=G(),{experiences:n,refreshExperiences:r,loaderElem:a}=_e(),s=ni();return i(It,{title:"Times Guide",buttons:i(w,{children:[s.length>0&&i(P,{title:"Disability Access Service",onClick:()=>t(i(na,{parties:s})),children:"DAS"}),i(Ni,{}),i(Ie,{name:"Times",onClick:r})]}),contentRef:e,children:[i(ra,{experiences:n}),a]})}const ra=_t(function({experiences:t}){const{goTo:n}=G(),r=s=>n(i(sa,{exp:s})),a=new Map;return t.filter(s=>{var c;return s.standby.available||s.standby.unavailableReason==="TEMPORARILY_DOWN"||((c=s.individual)==null?void 0:c.available)||s.virtualQueue}).sort((s,c)=>s.land.sort-c.land.sort||s.name.localeCompare(c.name)).forEach(s=>{var c,o;a.has(s.land)||a.set(s.land,{ATTRACTION:[],ENTERTAINMENT:[],CHARACTER:[],HOLIDAY:[]}),(o=(c=a.get(s.land))==null?void 0:c[s.type])==null||o.push(s)}),i(w,{children:[[...a].map(([s,c])=>i("div",{children:[i("h2",{className:`pr-1 ${s.theme.text} text-sm font-semibold text-right uppercase`,children:s.name}),i("div",{className:"rounded overflow-hidden",children:[i(De,{title:"Attractions",land:s,experiences:c.ATTRACTION,onInfoClick:r}),i(De,{title:"Entertainment",land:s,experiences:c.ENTERTAINMENT,onInfoClick:r}),i(De,{title:"Holiday Entertainment",land:s,experiences:c.HOLIDAY,onInfoClick:r}),i(De,{title:"Characters",land:s,experiences:c.CHARACTER,onInfoClick:r})]})]},s.name)),t.length>0&&i(Ii,{children:[i(me,{sym:"*",def:"No posted wait/show time"}),i(me,{sym:"\u274C",def:"Temporarily down"}),i(me,{sym:"VQ",def:"Virtual queue"})]})]})});function De({title:e,land:t,experiences:n,onInfoClick:r}){return n.length===0?null:i("div",{className:`${t.theme.bg}`,"data-testid":`${t.name}-${e}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:e}),i("table",{className:"w-full leading-snug",children:i("tbody",{children:n.map(a=>{var s;return i("tr",{className:"group",children:[i("td",{className:`${a.standby.nextShowTime?"min-w-[5.625rem]":"min-w-[2.75rem]"} px-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-80 font-bold text-center uppercase whitespace-nowrap`,children:a.standby.nextShowTime?(((s=a.additionalShowTimes)==null?void 0:s.length)??0)>0?i("button",{onClick:()=>r(a),className:"underline",children:z(a.standby.nextShowTime)}):z(a.standby.nextShowTime):a.standby.available?a.standby.waitTime??"*":a.virtualQueue&&a.standby.unavailableReason==="NOT_STANDBY_ENABLED"?"VQ":"\u274C"}),i("td",{className:"w-full px-1 pl-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-90",children:i("div",{className:"flex items-center gap-x-2",children:[i("div",{className:`flex-1 ${a.type==="ATTRACTION"&&!a.virtualQueue&&(a.priority??4)<4?`font-bold ${t.theme.text}`:""}`,children:a.name}),(a==null?void 0:a.individual)&&i("div",{className:`${t.theme.text} text-xs leading-tight font-semibold text-center uppercase`,children:[i("div",{children:[i("abbr",{title:"Individual Lightning Lane",children:"ILL"}),": "+a.individual.displayPrice]}),a.individual.nextAvailableTime&&i("div",{children:z(a.individual.nextAvailableTime)})]})]})})]},a.id)})})})]})}const sa=({exp:e})=>{var t;return i(M,{title:"Experience Info",children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),i("h3",{children:["Upcoming ",e.type==="CHARACTER"?"Appearances":"Shows"]}),i("ul",{className:"list-disc mt-2 pl-6",children:[!!e.standby.nextShowTime&&i("li",{children:z(e.standby.nextShowTime)}),(t=e.additionalShowTimes)==null?void 0:t.map(n=>i("li",{children:z(n)},n))]})]})},gn=6e4,Pi=["bg1","genie","merlock","tab"],aa=()=>O.get(Pi)??"LL",oa=[{name:"LL",icon:i(st,{}),component:zs},{name:"Times",icon:i(os,{}),component:ia},{name:"Plans",icon:i(hi,{}),component:xi}],ca=i(Zs,{}),ce=as({tabs:oa,footer:ca},({tab:e})=>{const{current:t}=Qn(),n=ge(),{park:r}=Ue(),{refreshExperiences:a}=_e(),{refreshPlans:s}=le(),c=ne(null);return C(()=>{O.set(Pi,e.name)},[e]),C(()=>xt(()=>{t.type===ce&&(a(gn),s(gn))}),[t,a,s]),C(()=>{var o;n.current&&((o=c.current)==null||o.scroll(0,0))},[n]),i(Zn,{value:r.theme,children:i(e.component,{contentRef:c})})});function la(){return i(Kr,{children:i(rs,{children:i(li,{children:i(ns,{children:i(is,{children:i(Jn,{children:i(ce,{tabName:aa()})})})})})})})}const da=500,yn=100,ua=5,ha=5*6e4;let Di=0,Ae=0;const vn=()=>Date.now()+Di;class ma extends Error{constructor(){super(...arguments);N(this,"name","SyncFailed")}}async function pa(){if(Date.now()-Aea-s);for(const[a,s]of n.slice(0,-1).entries()){const c=n[a+1],o=Math.abs(s-c);oda)return NaN;const a=parseFloat(String(t==null?void 0:t.get("T")))*1e3;return Math.round(a-(e+n)/2)}const _a=50;function ga({onSync:e}){const[t,n]=E(vn());return C(()=>{const r=setInterval(()=>n(vn()),_a);return()=>clearInterval(r)},[]),C(()=>{pa().then(()=>e(!0)).catch(()=>e(!1))},[e]),i("time",{children:R(t).time})}function ya({time:e,label:t}){const[n,r]=E(!0);return i("table",{className:"mt-4 mx-auto text-gray-500",children:i("tbody",{children:[i(bn,{heading:t,time:i("time",{children:e||"--:--:--"})}),i(bn,{heading:"Current time",time:i(w,{children:[i(ga,{onSync:r}),!n&&i("span",{className:"text-sm font-sans font-semibold text-red-600",children:[" ","(unsynced)"]})]})})]})})}function bn({heading:e,time:t}){return i("tr",{children:[i("th",{scope:"row",className:"pr-3 text-right text-xs font-semibold uppercase",children:[e,":"]}),i("td",{className:"text-xl font-mono leading-tight",children:["\uFEFF",t]})]})}function Ct({queue:e,title:t,children:n}){var r;return i(M,{title:t,theme:(r=e.park)==null?void 0:r.theme,children:[i("h2",{children:e.name}),n]})}const va=5e3;function ba({queue:e,guests:t,result:n}){const{boardingGroup:r,conflicts:a}=n,s=r!==null,c=t.filter(u=>!(u.id in a)),o=t.filter(u=>u.id in a),{goBack:l}=G(),[d,h]=E(!1);return C(()=>{s&&setTimeout(()=>h(!0),va)},[s]),i(Ct,{queue:e,title:"Boarding Group",children:s?i(w,{children:[i("h3",{children:"Congratulations! \u{1F389}"}),i("p",{children:"You joined the virtual queue!"}),i("p",{className:"text-lg font-semibold",children:["Boarding Group: ",r]}),i(F,{guests:c}),Object.keys(a).length>0&&i(w,{children:[i("p",{className:"font-semibold",children:"These guests could not join:"}),i(F,{guests:o,conflicts:a})]}),i("p",{children:"Refer to the My Disney Experience app for return time and other information."}),d&&i(V,{onClick:()=>l({screen:Ai}),children:"Done"})]}):i(w,{children:[i("h3",{children:"Sorry!"}),i("p",{children:"A boarding group could not be obtained. Go back and try again."}),i(F,{guests:o,conflicts:a})]})})}function xa({queue:e,guests:t}){const{goTo:n}=G(),r=L(),{vq:a}=r,{loadData:s,loaderElem:c}=Y();async function o(){await s(async l=>{const d=await a.getQueue(e);if(!d.isAcceptingJoins)return l(d.isAcceptingPartyCreation?"Queue not open yet":"No boarding groups available");const h=await a.joinQueue(e,t);n(i(ba,{queue:e,guests:t,result:h}),{replace:!0}),h.boardingGroup!==null&&Et(r,"V")},{minLoadTime:999})}return i(Ct,{queue:e,title:"Virtual Queue",children:[!e.isAcceptingJoins&&i(ya,{time:e.nextScheduledOpenTime,label:"Next queue opening"}),!e.isAcceptingJoins&&e.nextScheduledOpenTime!==null&&i("p",{children:["Tap the ",i("b",{children:"Join Virtual Queue"})," button when the clock reads"," ",i("time",{className:"font-semibold",children:e.nextScheduledOpenTime}),". The queue can fill up almost instantly, so be quick!"]}),i("h3",{children:"Your Party"}),i(F,{guests:t}),i(V,{onClick:o,children:"Join Virtual Queue"}),c]})}function wa({queue:e}){const{goTo:t}=G(),{vq:n}=L(),{loadData:r,loaderElem:a}=Y(),[s,c]=E([]),[o,l]=E(new Set);C(()=>{r(async()=>{const h=await n.getLinkedGuests(e);c(h),l(new Set(h.filter(u=>u.preselected)))})},[e,n,r]);function d(h){o[o.has(h)?"delete":"add"](h),l(new Set(o))}return i(Ct,{queue:e,title:"Choose Your Party",children:[e.howToEnterMessage.split(` + */function Xs(e){return i(j,{...e,children:i("path",{d:"M9 11.041v-0.825c1.102-0.621 2-2.168 2-3.716 0-2.485 0-4.5-3-4.5s-3 2.015-3 4.5c0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h14c0-2.015-2.608-3.682-6-3.959z"})})}function Zs(){const{goTo:e}=G(),[t]=E([{text:"Party Selection",icon:i(Xs,{}),action:()=>e(i(ds,{}))},{text:"Log Out",icon:i(Ks,{}),action:()=>K.deleteData()},{text:"BG1 News",icon:i(Qs,{}),action:()=>e(i(ei,{}))}]),[n,r]=E(!1),a=ne(null);return i(w,{children:[i("button",{className:"absolute top-0 right-0 h-full px-4",onClick:()=>r(!0),title:"Settings Menu",children:i(Js,{})}),n&&i(kt,{onClick:s=>{var c;(c=a.current)!=null&&c.contains(s.target)||r(!1)},"data-testid":"shade",children:i("ul",{className:"overflow-auto min-w-[50%] max-h-[90%] rounded-lg bg-white text-black text-lg font-normal",ref:a,children:t.map(s=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("button",{className:"flex flex-row items-center w-full px-4 py-3",onClick:()=>{r(!1),setTimeout(s.action,50)},children:[i("span",{className:"mr-2.5 text-gray-700","aria-hidden":!0,children:s.icon}),s.text]})},s.text))})})]})}function Ci(e){const[t,n]=e.split(":").map(Number);return t*60+n}const ea=(e,t)=>Ci(e)-t;function fn({park:e,onSelect:t}){const{das:n}=L(),{loadData:r,loaderElem:a}=Y(),[s,c]=E();C(()=>{r(async()=>{const l=await n.experiences(e);c(l.filter(d=>d.available&&!!d.time).sort((d,h)=>d.name.localeCompare(h.name)))})},[e,n,r]);const o=[{heading:"Attractions",type:"ATTRACTION"},{heading:"Characters",type:"CHARACTER"},{heading:"Entertainment",type:"ENTERTAINMENT"}];return i(M,{title:"Select Experience",theme:e.theme,children:[s?s.length>0?i(w,{children:o.map(l=>i(ta,{park:e,experiences:s.filter(d=>d.type===l.type),heading:l.heading,onSelect:t},l.type))}):i("p",{children:"No DAS experiences available"}):null,a]})}function ta({park:e,experiences:t,heading:n,onSelect:r}){if(t.length===0)return null;const a=Ci(R().time);return i("div",{className:`mt-4 rounded overflow-hidden ${e.theme.bg}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:n}),i("ul",{className:"bg-white bg-opacity-90 leading-snug",children:t.map(s=>i("li",{className:"flex items-center pt-3 last:pb-3",children:[i("div",{className:"flex-1 px-2",children:s.name}),i("div",{className:"px-2",children:i(P,{onClick:()=>r(s),children:i("span",{className:"min-w-[4rem]",children:[ea(s.time,a)," ",i("abbr",{title:"minutes",children:"min."})]})})})]},s.id))})]})}function _n({park:e,party:t}){const{goTo:n,goBack:r}=G(),a=L(),{das:s}=a,{refreshPlans:c}=le(),[o,l]=E(),[d,h]=E(new Set([t.primaryGuest,...t.linkedGuests].slice(0,t.selectionLimit))),[u,p]=E({}),{loadData:f,loaderElem:b}=Y();async function k(){o&&f(async()=>{try{const x=await s.book({park:e,experience:o,primaryGuest:t.primaryGuest,guests:[...d]});c(),Et(a,"D"),await r({screen:ce}),n(i(fe,{booking:x,isNew:!0}))}catch(x){throw x instanceof Hn&&p(x.conflicts),x}},{messages:{ConflictsError:"Some guests not eligible",ExperienceUnavailable:"Experience currently unavailable"}})}return i(M,{title:"DAS Selection",theme:e.theme,children:[i("h3",{children:"Experience"}),o?i("div",{className:"flex items-center mt-3",children:[i("div",{className:"text-lg font-semibold truncate",children:o.name}),i("div",{className:"ml-3",children:i(P,{type:"small",onClick:()=>n(i(fn,{park:e,onSelect:x=>{l(x),r()}})),children:"Change"})})]}):i("div",{className:"mt-3 text-center",children:i(P,{onClick:()=>n(i(fn,{park:e,onSelect:x=>{l(x),r()}})),children:"Select Experience"})}),i("h3",{children:"DAS Guest"}),i(F,{guests:[t.primaryGuest],conflicts:u}),t.linkedGuests.length>0&&i(w,{children:[i("h3",{children:"Additional Guests"}),i(F,{guests:t.linkedGuests,selectable:{isSelected:x=>d.has(x),onToggle:x=>{d[d.has(x)?"delete":"add"](x),h(new Set(d))},limit:t.selectionLimit-1},conflicts:u})]}),i(V,{disabled:!t||!o,onClick:k,children:"Request Return Time"}),b]})}function na({parties:e}){const{goTo:t}=G(),{park:n}=Ue(),{plans:r,refreshPlans:a,loaderElem:s}=le();mt(a,[a]);const c=new Set(e.map(u=>u.primaryGuest.id)),o=r.filter(u=>u.type==="DAS"&&u.subtype==="IN_PARK"),l=new Map(o.filter(u=>u.type==="DAS"&&u.subtype==="IN_PARK").map(u=>{var p;return[((p=u.guests.find(f=>c.has(f.id)))==null?void 0:p.id)??"",u]}));if(!s&&e.length===1){const u=e[0],p=l.get(u.primaryGuest.id);return p?i(fe,{booking:p}):i(_n,{park:n,party:u})}const d=e.filter(u=>!(l!=null&&l.has(u.primaryGuest.id))),h=e.filter(u=>l==null?void 0:l.has(u.primaryGuest.id));return i(M,{title:`DAS ${e.length===1?"Selection":"Parties"}`,theme:n.theme,children:s||(e.length>0?i(w,{children:[d.length>0&&i(w,{children:[i("h3",{children:"Select Next Experience"}),i("ul",{className:"mt-2",children:d.map(u=>i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:u.primaryGuest.avatarImageUrl?i("img",{src:u.primaryGuest.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):u.primaryGuest.name[0]}),i("span",{className:"flex-1 leading-tight",children:u.primaryGuest.name}),i(P,{type:"small",onClick:()=>t(i(_n,{park:n,party:u})),children:"Select"})]},u.primaryGuest.id))})]}),h.length>0&&i(w,{children:[i("h3",{children:"Current Selection"}),i("ul",{className:"mt-2",children:h.map(u=>{const p=l.get(u.primaryGuest.id);return i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:u.primaryGuest.avatarImageUrl?i("img",{src:u.primaryGuest.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):u.primaryGuest.name[0]}),i("div",{className:"flex-1",children:[i("div",{children:u.primaryGuest.name}),p&&i("div",{className:"text-gray-500 text-xs font-semibold uppercase",children:[p.name," @"," ",i(ie,{time:p.start.time})]})]}),i(P,{type:"small",onClick:()=>{p&&t(i(fe,{booking:p}))},children:"Details"})]},u.primaryGuest.id)})})]})]}):i("div",{}))})}function ia({contentRef:e}){const{goTo:t}=G(),{experiences:n,refreshExperiences:r,loaderElem:a}=_e(),s=ni();return i(It,{title:"Times Guide",buttons:i(w,{children:[s.length>0&&i(P,{title:"Disability Access Service",onClick:()=>t(i(na,{parties:s})),children:"DAS"}),i(Ni,{}),i(Ie,{name:"Times",onClick:r})]}),contentRef:e,children:[i(ra,{experiences:n}),a]})}const ra=_t(function({experiences:t}){const{goTo:n}=G(),r=s=>n(i(sa,{exp:s})),a=new Map;return t.filter(s=>{var c;return s.standby.available||s.standby.unavailableReason==="TEMPORARILY_DOWN"||((c=s.individual)==null?void 0:c.available)||s.virtualQueue}).sort((s,c)=>s.land.sort-c.land.sort||s.name.localeCompare(c.name)).forEach(s=>{var c,o;a.has(s.land)||a.set(s.land,{ATTRACTION:[],ENTERTAINMENT:[],CHARACTER:[],HOLIDAY:[]}),(o=(c=a.get(s.land))==null?void 0:c[s.type])==null||o.push(s)}),i(w,{children:[[...a].map(([s,c])=>i("div",{children:[i("h2",{className:`pr-1 ${s.theme.text} text-sm font-semibold text-right uppercase`,children:s.name}),i("div",{className:"rounded overflow-hidden",children:[i(De,{title:"Attractions",land:s,experiences:c.ATTRACTION,onInfoClick:r}),i(De,{title:"Entertainment",land:s,experiences:c.ENTERTAINMENT,onInfoClick:r}),i(De,{title:"Holiday Entertainment",land:s,experiences:c.HOLIDAY,onInfoClick:r}),i(De,{title:"Characters",land:s,experiences:c.CHARACTER,onInfoClick:r})]})]},s.name)),t.length>0&&i(Ii,{children:[i(me,{sym:"*",def:"No posted wait/show time"}),i(me,{sym:"\u274C",def:"Temporarily down"}),i(me,{sym:"VQ",def:"Virtual queue"})]})]})});function De({title:e,land:t,experiences:n,onInfoClick:r}){return n.length===0?null:i("div",{className:`${t.theme.bg}`,"data-testid":`${t.name}-${e}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:e}),i("table",{className:"w-full leading-snug",children:i("tbody",{children:n.map(a=>{var s;return i("tr",{className:"group",children:[i("td",{className:`${a.standby.nextShowTime?"min-w-[5.625rem]":"min-w-[2.75rem]"} px-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-80 font-bold text-center uppercase whitespace-nowrap`,children:a.standby.nextShowTime?(((s=a.additionalShowTimes)==null?void 0:s.length)??0)>0?i("button",{onClick:()=>r(a),className:"underline",children:H(a.standby.nextShowTime)}):H(a.standby.nextShowTime):a.standby.available?a.standby.waitTime??"*":a.virtualQueue&&a.standby.unavailableReason==="NOT_STANDBY_ENABLED"?"VQ":"\u274C"}),i("td",{className:"w-full px-1 pl-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-90",children:i("div",{className:"flex items-center gap-x-2",children:[i("div",{className:`flex-1 ${a.type==="ATTRACTION"&&!a.virtualQueue&&(a.priority??4)<4?`font-bold ${t.theme.text}`:""}`,children:a.name}),(a==null?void 0:a.individual)&&i("div",{className:`${t.theme.text} text-xs leading-tight font-semibold text-center uppercase`,children:[i("div",{children:[i("abbr",{title:"Individual Lightning Lane",children:"ILL"}),": "+a.individual.displayPrice]}),a.individual.nextAvailableTime&&i("div",{children:H(a.individual.nextAvailableTime)})]})]})})]},a.id)})})})]})}const sa=({exp:e})=>{var t;return i(M,{title:"Experience Info",children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),i("h3",{children:["Upcoming ",e.type==="CHARACTER"?"Appearances":"Shows"]}),i("ul",{className:"list-disc mt-2 pl-6",children:[!!e.standby.nextShowTime&&i("li",{children:H(e.standby.nextShowTime)}),(t=e.additionalShowTimes)==null?void 0:t.map(n=>i("li",{children:H(n)},n))]})]})},gn=6e4,Pi=["bg1","genie","merlock","tab"],aa=()=>O.get(Pi)??"LL",oa=[{name:"LL",icon:i(st,{}),component:Hs},{name:"Times",icon:i(os,{}),component:ia},{name:"Plans",icon:i(hi,{}),component:xi}],ca=i(Zs,{}),ce=as({tabs:oa,footer:ca},({tab:e})=>{const{current:t}=Qn(),n=ge(),{park:r}=Ue(),{refreshExperiences:a}=_e(),{refreshPlans:s}=le(),c=ne(null);return C(()=>{O.set(Pi,e.name)},[e]),C(()=>xt(()=>{t.type===ce&&(a(gn),s(gn))}),[t,a,s]),C(()=>{var o;n.current&&((o=c.current)==null||o.scroll(0,0))},[n]),i(Zn,{value:r.theme,children:i(e.component,{contentRef:c})})});function la(){return i(Kr,{children:i(rs,{children:i(li,{children:i(ns,{children:i(is,{children:i(Jn,{children:i(ce,{tabName:aa()})})})})})})})}const da=500,yn=100,ua=5,ha=5*6e4;let Di=0,Ae=0;const vn=()=>Date.now()+Di;class ma extends Error{constructor(){super(...arguments);N(this,"name","SyncFailed")}}async function pa(){if(Date.now()-Aea-s);for(const[a,s]of n.slice(0,-1).entries()){const c=n[a+1],o=Math.abs(s-c);oda)return NaN;const a=parseFloat(String(t==null?void 0:t.get("T")))*1e3;return Math.round(a-(e+n)/2)}const _a=50;function ga({onSync:e}){const[t,n]=E(vn());return C(()=>{const r=setInterval(()=>n(vn()),_a);return()=>clearInterval(r)},[]),C(()=>{pa().then(()=>e(!0)).catch(()=>e(!1))},[e]),i("time",{children:R(t).time})}function ya({time:e,label:t}){const[n,r]=E(!0);return i("table",{className:"mt-4 mx-auto text-gray-500",children:i("tbody",{children:[i(bn,{heading:t,time:i("time",{children:e||"--:--:--"})}),i(bn,{heading:"Current time",time:i(w,{children:[i(ga,{onSync:r}),!n&&i("span",{className:"text-sm font-sans font-semibold text-red-600",children:[" ","(unsynced)"]})]})})]})})}function bn({heading:e,time:t}){return i("tr",{children:[i("th",{scope:"row",className:"pr-3 text-right text-xs font-semibold uppercase",children:[e,":"]}),i("td",{className:"text-xl font-mono leading-tight",children:["\uFEFF",t]})]})}function Ct({queue:e,title:t,children:n}){var r;return i(M,{title:t,theme:(r=e.park)==null?void 0:r.theme,children:[i("h2",{children:e.name}),n]})}const va=5e3;function ba({queue:e,guests:t,result:n}){const{boardingGroup:r,conflicts:a}=n,s=r!==null,c=t.filter(u=>!(u.id in a)),o=t.filter(u=>u.id in a),{goBack:l}=G(),[d,h]=E(!1);return C(()=>{s&&setTimeout(()=>h(!0),va)},[s]),i(Ct,{queue:e,title:"Boarding Group",children:s?i(w,{children:[i("h3",{children:"Congratulations! \u{1F389}"}),i("p",{children:"You joined the virtual queue!"}),i("p",{className:"text-lg font-semibold",children:["Boarding Group: ",r]}),i(F,{guests:c}),Object.keys(a).length>0&&i(w,{children:[i("p",{className:"font-semibold",children:"These guests could not join:"}),i(F,{guests:o,conflicts:a})]}),i("p",{children:"Refer to the My Disney Experience app for return time and other information."}),d&&i(V,{onClick:()=>l({screen:Ai}),children:"Done"})]}):i(w,{children:[i("h3",{children:"Sorry!"}),i("p",{children:"A boarding group could not be obtained. Go back and try again."}),i(F,{guests:o,conflicts:a})]})})}function xa({queue:e,guests:t}){const{goTo:n}=G(),r=L(),{vq:a}=r,{loadData:s,loaderElem:c}=Y();async function o(){await s(async l=>{const d=await a.getQueue(e);if(!d.isAcceptingJoins)return l(d.isAcceptingPartyCreation?"Queue not open yet":"No boarding groups available");const h=await a.joinQueue(e,t);n(i(ba,{queue:e,guests:t,result:h}),{replace:!0}),h.boardingGroup!==null&&Et(r,"V")},{minLoadTime:999})}return i(Ct,{queue:e,title:"Virtual Queue",children:[!e.isAcceptingJoins&&i(ya,{time:e.nextScheduledOpenTime,label:"Next queue opening"}),!e.isAcceptingJoins&&e.nextScheduledOpenTime!==null&&i("p",{children:["Tap the ",i("b",{children:"Join Virtual Queue"})," button when the clock reads"," ",i("time",{className:"font-semibold",children:e.nextScheduledOpenTime}),". The queue can fill up almost instantly, so be quick!"]}),i("h3",{children:"Your Party"}),i(F,{guests:t}),i(V,{onClick:o,children:"Join Virtual Queue"}),c]})}function wa({queue:e}){const{goTo:t}=G(),{vq:n}=L(),{loadData:r,loaderElem:a}=Y(),[s,c]=E([]),[o,l]=E(new Set);C(()=>{r(async()=>{const h=await n.getLinkedGuests(e);c(h),l(new Set(h.filter(u=>u.preselected)))})},[e,n,r]);function d(h){o[o.has(h)?"delete":"add"](h),l(new Set(o))}return i(Ct,{queue:e,title:"Choose Your Party",children:[e.howToEnterMessage.split(` -`).map((h,u)=>i("p",{children:h},u)),i("h3",{children:"Choose Your Party"}),s.length>0?i(F,{guests:s,selectable:{isSelected:h=>o.has(h),onToggle:d,limit:e.maxPartySize}}):i("p",{children:"No guests available"}),i(V,{disabled:o.size===0,onClick:()=>t(i(xa,{queue:e,guests:[...o]})),children:"Confirm Party"}),a]})}const xn=e=>e.categoryContentId==="attraction",Le=e=>e.isAcceptingPartyCreation||e.isAcceptingJoins;function Ai(){const{vq:e}=L(),{goTo:t}=G(),n=W(),{loadData:r,loaderElem:a}=Y(),[s,c]=E(),o=q(()=>{r(async()=>{c((await e.getQueues()).sort((l,d)=>+Le(d)-+Le(l)||+xn(d)-+xn(l)))})},[e,r]);return C(()=>(o(),xt(o)),[o]),i(M,{title:"Virtual Queues",buttons:i(P,{title:"Refresh Queues",onClick:o,children:i(wt,{})}),footer:i("div",{className:"p-2 text-right",children:i(P,{className:`bg-opacity-90 bg-white ${n.text}`,onClick:()=>K.deleteData(),children:"Log Out"})}),children:[s?s.length>0?i("ul",{className:"mt-1",children:s.map(l=>i("li",{className:"py-3 first:border-0 border-t-4 border-gray-300",children:[i("h2",{className:"mt-0",children:l.name}),i("div",{className:"flex items-center mt-2",children:[i("div",{className:"flex-1",children:l.isAcceptingJoins?i("span",{children:"Available now"}):l.nextScheduledOpenTime?i(w,{children:["Next opening:"," ",i("time",{dateTime:l.nextScheduledOpenTime,className:"font-semibold",children:z(l.nextScheduledOpenTime)})]}):"No more openings today"}),i("div",{className:"pl-3",children:i(P,{disabled:!Le(l),onClick:()=>t(i(wa,{queue:l})),children:Le(l)?"Join Queue":"Closed"})})]})]},l.id))}):!a&&i("p",{className:"text-gray-500 font-semibold text-center uppercase",children:"No virtual queues found"}):null,a]})}function ka(){return i(Jn,{children:i(Ai,{})})}const Ia=0;function Ea(){document.body.addEventListener("click",()=>null)}function Na(){const[e,t]=E(),[n,r]=E(i("div",{})),a=Hr(),s=jr(Ia),[c,o]=E(()=>{try{K.getData()}catch(l){if(!(l instanceof Un))throw l;return!0}return!1});return C(()=>{Ea()},[]),C(()=>{K.onUnauthorized=()=>o(!0),(async()=>{for(const[l,d]of[[vt,la],[yt,ka]])try{const h=await Nr(l.originToResortId(origin));t(h),lr({WDW:"America/New_York",DLR:"America/Los_Angeles"}[h.id]),r(i(Rr,{value:h,children:i(d,{})}));return}catch(h){if(!(h instanceof Hn))throw h}location.assign("https://joelface.github.io/bg1/start.html")})()},[]),C(()=>{function l(){if(!c)try{K.getData(),o(!1)}catch{o(!0)}}return l(),xt(l)},[c]),a||s||c&&e&&i(qr,{resort:e,onLogin:l=>{K.setData(l),o(!1)}})||n}Li();function Li(){if(!document.body){setTimeout(Li,100);return}document.close(),Ta(),Sa(),Ca().render(i(Na,{}))}function Ta(){const e=document.createElement("meta");e.name="viewport",e.content="width=device-width, initial-scale=1, maximum-scale=1",document.head.appendChild(e)}function Sa(){const e=document.createElement("link");e.rel="icon",e.href="data:,",document.head.appendChild(e)}function Ca(){return cr(document.body.appendChild(document.createElement("div")))} +`).map((h,u)=>i("p",{children:h},u)),i("h3",{children:"Choose Your Party"}),s.length>0?i(F,{guests:s,selectable:{isSelected:h=>o.has(h),onToggle:d,limit:e.maxPartySize}}):i("p",{children:"No guests available"}),i(V,{disabled:o.size===0,onClick:()=>t(i(xa,{queue:e,guests:[...o]})),children:"Confirm Party"}),a]})}const xn=e=>e.categoryContentId==="attraction",Le=e=>e.isAcceptingPartyCreation||e.isAcceptingJoins;function Ai(){const{vq:e}=L(),{goTo:t}=G(),n=W(),{loadData:r,loaderElem:a}=Y(),[s,c]=E(),o=q(()=>{r(async()=>{c((await e.getQueues()).sort((l,d)=>+Le(d)-+Le(l)||+xn(d)-+xn(l)))})},[e,r]);return C(()=>(o(),xt(o)),[o]),i(M,{title:"Virtual Queues",buttons:i(P,{title:"Refresh Queues",onClick:o,children:i(wt,{})}),footer:i("div",{className:"p-2 text-right",children:i(P,{className:`bg-opacity-90 bg-white ${n.text}`,onClick:()=>K.deleteData(),children:"Log Out"})}),children:[s?s.length>0?i("ul",{className:"mt-1",children:s.map(l=>i("li",{className:"py-3 first:border-0 border-t-4 border-gray-300",children:[i("h2",{className:"mt-0",children:l.name}),i("div",{className:"flex items-center mt-2",children:[i("div",{className:"flex-1",children:l.isAcceptingJoins?i("span",{children:"Available now"}):l.nextScheduledOpenTime?i(w,{children:["Next opening:"," ",i("time",{dateTime:l.nextScheduledOpenTime,className:"font-semibold",children:H(l.nextScheduledOpenTime)})]}):"No more openings today"}),i("div",{className:"pl-3",children:i(P,{disabled:!Le(l),onClick:()=>t(i(wa,{queue:l})),children:Le(l)?"Join Queue":"Closed"})})]})]},l.id))}):!a&&i("p",{className:"text-gray-500 font-semibold text-center uppercase",children:"No virtual queues found"}):null,a]})}function ka(){return i(Jn,{children:i(Ai,{})})}const Ia=0;function Ea(){document.body.addEventListener("click",()=>null)}function Na(){const[e,t]=E(),[n,r]=E(i("div",{})),a=zr(),s=jr(Ia),[c,o]=E(()=>{try{K.getData()}catch(l){if(!(l instanceof Un))throw l;return!0}return!1});return C(()=>{Ea()},[]),C(()=>{K.onUnauthorized=()=>o(!0),(async()=>{for(const[l,d]of[[vt,la],[yt,ka]])try{const h=await Nr(l.originToResortId(origin));t(h),lr({WDW:"America/New_York",DLR:"America/Los_Angeles"}[h.id]),r(i(Rr,{value:h,children:i(d,{})}));return}catch(h){if(!(h instanceof zn))throw h}location.assign("https://joelface.github.io/bg1/start.html")})()},[]),C(()=>{function l(){if(!c)try{K.getData(),o(!1)}catch{o(!0)}}return l(),xt(l)},[c]),a||s||c&&e&&i(qr,{resort:e,onLogin:l=>{K.setData(l),o(!1)}})||n}Li();function Li(){if(!document.body){setTimeout(Li,100);return}document.close(),Ta(),Sa(),Ca().render(i(Na,{}))}function Ta(){const e=document.createElement("meta");e.name="viewport",e.content="width=device-width, initial-scale=1, maximum-scale=1",document.head.appendChild(e)}function Sa(){const e=document.createElement("link");e.rel="icon",e.href="data:,",document.head.appendChild(e)}function Ca(){return cr(document.body.appendChild(document.createElement("div")))}