PageSourceSearch

https://scorekinole.web.app/_app/immutable/chunks/6qoY3o7f.js

js scorekinole.web.app collected 2026-10-03 12:38:35 UTC 2,807 bytes, 1 lines download raw bytes

1import{d as h}from"./MQfk2cFN.js";import{c as y}from"./B8vtAFm8.js";import{g}from"./BZ44leac.js";import{s as I,a as M,b as F}from"./WBc5orQ4.js";import{collection as w,query as u,where as n,getDocs as N,doc as E,serverTimestamp as D,setDoc as P}from"./CNdHCdTS.js";function R(){return`match_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function S(e,t){var a,o,i,l,c,r;return!e||!t?!1:((a=e.team1)==null?void 0:a.userId)===t||((o=e.team2)==null?void 0:o.userId)===t||((l=(i=e.team1)==null?void 0:i.partner)==null?void 0:l.userId)===t||((r=(c=e.team2)==null?void 0:c.partner)==null?void 0:r.userId)===t}async function b(e,t,a,o,i,l,c){if(!t&&!a&&!o&&!i)return console.log("No registered players - match not saved to cloud"),null;const r=g(y);try{const s=e.id||R(),v=E(h,"matches",s),m={team1:{name:e.team1Name,userId:t||null,...l&&{partner:{name:l,userId:o||null}}},team2:{name:e.team2Name,userId:a||null,...c&&{partner:{name:c,userId:i||null}}}};if(!S(m,r==null?void 0:r.id))return console.log("Signed-in user is not a player in this match - kept local only"),null;const f={...e,id:s,savedBy:r?{userId:r.id,userName:r.name||"Unknown",userEmail:r.email||""}:void 0,players:m,syncStatus:"synced"},p={...f,syncedAt:D(),status:"active"};return await P(v,p),console.log("✅ Friendly match saved to Firestore:",s),f}catch(s){return console.error("❌ Error saving friendly match:",s),null}}const d="pendingFriendlyMatch";function A(e){I(d,JSON.stringify(e))}function T(){M(d)}async function B(){const e=F(d);if(!e)return!1;try{const t=JSON.parse(e),a=await b(t.match,t.team1UserId,t.team2UserId,t.team1PartnerUserId,t.team2PartnerUserId,t.team1PartnerName,t.team2PartnerName);return a?(T(),console.log("✅ Pending friendly match synced to Firestore:",a.id),!0):!1}catch(t){return console.error("❌ Error retrying pending friendly match:",t),!1}}async function G(){var t;const e=g(y);if(!e)return console.warn("No user authenticated"),[];try{const a=w(h,"matches"),o=new Map,i=[u(a,n("players.team1.userId","==",e.id),n("status","==","active")),u(a,n("players.team2.userId","==",e.id),n("status","==","active")),u(a,n("players.team1.partner.userId","==",e.id),n("status","==","active")),u(a,n("players.team2.partner.userId","==",e.id),n("status","==","active")),u(a,n("savedBy.userId","==",e.id),n("status","==","active"))],l=await Promise.allSettled(i.map(r=>N(r)));for(const r of l)r.status==="fulfilled"?r.value.forEach(s=>{o.set(s.id,{id:s.id,...s.data()})}):console.warn("Match query failed:",(t=r.reason)==null?void 0:t.message);const c=Array.from(o.values()).sort((r,s)=>s.startTime-r.startTime);return console.log(`✅ Retrieved ${c.length} active matches from cloud`),c}catch(a){return console.error("❌ Error getting matches from cloud:",a),[]}}export{b as a,B as b,G as g,T as r,A as s};

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.