PageSourceSearch

https://app.swum.ai/assets/publicSubscriptionPlanAvailability-CcxT8Ima.js

js swum.ai collected 2026-10-02 00:16:33 UTC 3,400 bytes, 1 lines download raw bytes

1import{A as e,R as t,p as n,w as r}from"./firebase-vendor-DfhfF3vp.js";import{o as i}from"./firebase.config-B5x2J5dU.js";var a=`publicSubscriptionPlanAvailability`,o=`publicPlanLessonBlockAvailability`,s=`publicPlanOccurrenceAvailability`,c=10,l=e=>Array.from(new Set(e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean))),u=(e,t)=>{let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},d=e=>{if(typeof e==`string`){let t=e.slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(t)?t:null}if(e&&typeof e==`object`&&`toDate`in e){let t=e;if(typeof t.toDate==`function`)try{let e=t.toDate();return Number.isNaN(e.getTime())?null:e.toISOString().slice(0,10)}catch{return null}}return null},f=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e.getTime();if(e&&typeof e==`object`){let t=e;if(typeof t.toMillis==`function`){let e=t.toMillis();return Number.isFinite(e)?e:null}if(typeof t.toDate==`function`){let e=t.toDate();return Number.isNaN(e.getTime())?null:e.getTime()}}if(typeof e==`string`||typeof e==`number`){let t=new Date(e).getTime();return Number.isNaN(t)?null:t}return null},p=(e,t,n)=>{if(!t||!n)return!0;let r=t.getTime(),i=n.getTime();return!Number.isFinite(r)||!Number.isFinite(i)||[[f(e.originalStartTime),f(e.originalEndTime)],[f(e.startTime),f(e.endTime)]].some(([e,t])=>e!==null&&t!==null&&e<=i&&t>=r)},m=(e,t=[],n=[])=>{let r=new Map,i=new Map;t.forEach(({data:e})=>{let t=typeof e.planId==`string`?e.planId.trim():``,n=d(e.dateKey)||d(e.date||e.startTimeTimestamp);if(!t||!n||e.status!==`blocked`||e.type!==`cancellation`)return;let i=r.get(t)||new Set;i.add(n),r.set(t,i)}),n.forEach(({id:e,data:t})=>{let n=typeof t.planId==`string`?t.planId.trim():``;if(!n||!t.startTime||!t.endTime||!t.originalStartTime||!t.originalEndTime)return;let r=i.get(n)||new Map;r.set(e,{id:e,...t,planId:n}),i.set(n,r)});let a=new Map;return e.forEach(({id:e,data:t})=>{let n=typeof t.planId==`string`&&t.planId.trim()?t.planId.trim():e,o=t.coachId||t.coachUid||``;a.set(n,{id:n,...t,coachId:o,coachUid:t.coachUid||o,canceledDateKeys:Array.from(r.get(n)||[]).sort(),concreteLessonOccurrences:Array.from(i.get(n)?.values()||[]),isPublicAvailabilityProjection:!0})}),Array.from(a.values())},h=(e,t)=>{let n=new Map;return e.forEach(e=>n.set(e.id,e)),t.forEach(e=>n.set(e.id,e)),Array.from(n.values())},g=async(d,f=i,h={})=>{let g=l(d);if(g.length===0)return[];let _=t(f,a),v=await Promise.all(u(g,c).flatMap(t=>[n(r(_,e(`coachId`,`in`,t))),n(r(_,e(`coachUid`,`in`,t)))])),y=new Map;v.forEach(e=>{e.docs.forEach(e=>{y.set(e.id,{id:e.id,data:e.data()})})});let b=l(Array.from(y.values()).map(({id:e,data:t})=>typeof t.planId==`string`&&t.planId.trim()?t.planId:e));if(b.length===0)return[];let x=t(f,o),S=await Promise.all(u(b,c).map(t=>n(r(x,e(`planId`,`in`,t))))),C=new Map;S.forEach(e=>{e.docs.forEach(e=>{C.set(e.id,{id:e.id,data:e.data()})})});let w=new Map;if(h.includeOccurrences===!0){let i=t(f,s);try{let t=u(b,c).map(t=>n(r(i,e(`planId`,`in`,t))));(await Promise.all(t)).forEach(e=>{e.docs.forEach(e=>{let t=e.data();p(t,h.occurrenceStartDate,h.occurrenceEndDate)&&w.set(e.id,{id:e.id,data:t})})})}catch(e){if(h.requireOccurrences===!0)throw e;console.warn(`Unable to load public plan occurrence availability:`,e)}}return m(Array.from(y.values()),Array.from(C.values()),Array.from(w.values()))},_=async(e,t=i,n={})=>g([e],t,n);export{h as a,g as i,a as n,_ as r,o as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.