PageSourceSearch

https://shirat-learning.web.app/assets/index-Bdp-m5WO.js

js shirat-learning.web.app collected 2026-10-03 12:35:30 UTC 1,961,623 bytes, 4,081 lines download raw bytes

1var E_=Object.defineProperty;var N_=(n,e,t)=>e in n?E_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var L=(n,e,t)=>N_(n,typeof e!="symbol"?e+"":e,t);import{r as S_,R as td,a as E,j as o,u as A_,b as It,c as fe,L as un,O as jx,d as lt,e as en,f as ri,g as C_,h as Se,i as M_,k as Kr,Q as P_,l as R_,m as O_}from"./tanstack-BQ50hRJ_.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();var nd={},yy;function D_(){if(yy)return nd;yy=1;var n=S_();return nd.createRoot=n.createRoot,nd.hydrateRoot=n.hydrateRoot,nd}var V_=D_();const by=n=>{let e;const t=new Set,r=(d,m)=>{const p=typeof d=="function"?d(e):d;if(!Object.is(p,e)){const f=e;e=m??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(g=>g(e,f))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>l,subscribe:d=>(t.add(d),()=>t.delete(d))},l=e=n(r,s,c);return c},L_=(n=>n?by(n):by),q_=n=>n;function z_(n,e=q_){const t=td.useSyncExternalStore(n.subscribe,td.useCallback(()=>e(n.getState()),[n,e]),td.useCallback(()=>e(n.getInitialState()),[n,e]));return td.useDebugValue(t),t}const xy=n=>{const e=L_(n),t=r=>z_(e,r);return Object.assign(t,e),t},ul=(n=>n?xy(n):xy);function F_(n,e){let t;try{t=n()}catch{return}return{getItem:s=>{var i;const a=l=>l===null?null:JSON.parse(l,void 0),c=(i=t.getItem(s))!=null?i:null;return c instanceof Promise?c.then(a):a(c)},setItem:(s,i)=>t.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>t.removeItem(s)}}const op=n=>e=>{try{const t=n(e);return t instanceof Promise?t:{then(r){return op(r)(t)},catch(r){return this}}}catch(t){return{then(r){return this},catch(r){return op(r)(t)}}}},$_=(n,e)=>(t,r,s)=>{let i={storage:F_(()=>window.localStorage),partialize:I=>I,version:0,merge:(I,N)=>({...N,...I}),...e},a=!1,c=0;const l=new Set,d=new Set;let m=i.storage;if(!m)return n((...I)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...I)},r,s);const p=()=>{const I=i.partialize({...r()});return m.setItem(i.name,{state:I,version:i.version})},f=s.setState;s.setState=(I,N)=>(f(I,N),p());const g=n((...I)=>(t(...I),p()),r,s);s.getInitialState=()=>g;let x;const b=()=>{var I,N;if(!m)return;const V=++c;a=!1,l.forEach(T=>{var M;return T((M=r())!=null?M:g)});const D=((N=i.onRehydrateStorage)==null?void 0:N.call(i,(I=r())!=null?I:g))||void 0;return op(m.getItem.bind(m))(i.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==i.version){if(i.migrate){const M=i.migrate(T.state,T.version);return M instanceof Promise?M.then(R=>[!0,R]):[!0,M]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var M;if(V!==c)return;const[R,_]=T;if(x=i.merge(_,(M=r())!=null?M:g),t(x,!0),R)return p()}).then(()=>{V===c&&(D==null||D(r(),void 0),x=r(),a=!0,d.forEach(T=>T(x)))}).catch(T=>{V===c&&(D==null||D(void 0,T))})};return s.persist={setOptions:I=>{i={...i,...I},I.storage&&(m=I.storage)},clearStorage:()=>{m==null||m.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>b(),hasHydrated:()=>a,onHydrate:I=>(l.add(I),()=>{l.delete(I)}),onFinishHydration:I=>(d.add(I),()=>{d.delete(I)})},i.skipHydration||b(),x||g},$u=$_,Pt=(n,e=17)=>{const t=new Date;return t.setDate(t.getDate()-n),t.setHours(e,15,0,0),t.toISOString()},B_=[{id:"org-shirat",name:"שירת הלויים",isPublicScope:!1},{id:"org-public",name:"פלטפורמה ציבורית",isPublicScope:!0}],xo=[{id:"u-noa",organizationId:"org-shirat",displayName:"נועה לוי",roles:["musician"],instruments:["פסנתר"],avatarColor:"#7c5cff"},{id:"u-amit",organizationId:"org-shirat",displayName:"עמית כהן",roles:["teacher","content_author"],instruments:["פסנתר","שירה"],avatarColor:"#f59e0b"},{id:"u-dana",organizationId:"org-shirat",displayName:"דנה אברהם",roles:["admin","teacher"],instruments:[],avatarColor:"#10b981"}],u1=[xo[0],{id:"u-yoav",organizationId:"org-shirat",displayName:"יואב פרץ",roles:["musician"],instruments:["גיטרה"],avatarColor:"#3b82f6"},{id:"u-tamar",organizationId:"org-shirat",displayName:"תמר שמעוני",roles:["musician"],instruments:["שירה"],avatarColor:"#ef4444"},{id:"u-ori",organizationId:"org-shirat",displayName:"אורי מזרחי",roles:["musician"],instruments:["תופים"],avatarColor:"#10b981"},{id:"u-maya",organizationId:"org-shirat",displayName:"מאיה גולן",roles:["musician"],instruments:["פסנתר","הפקה"],avatarColor:"#f59e0b"},{id:"u-itai",organizationId:"org-shirat",displayName:"איתי ברק",roles:["musician"],instruments:["פסנתר"],avatarColor:"#8b5cf6"}],U_=[{id:"act-intervals-1",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — טרצות",description:"האזינו לשני צלילים וזהו אם המרווח הוא טרצה גדולה או קטנה.",modalities:["listening"],parameters:{intervals:["m3","M3"],questionCount:5,rootMidiRange:[57,76],direction:"ascending",objectiveId:"obj-1"},estimatedMinutes:5},{id:"act-intervals-2",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — קוורטה וקווינטה",description:"האזינו לשני צלילים וזהו אם המרווח הוא קוורטה זכה או קווינטה זכה.",modalities:["listening"],parameters:{intervals:["P4","P5"],questionCount:5,rootMidiRange:[57,74],direction:"ascending",objectiveId:"obj-1"},estimatedMinutes:5},{id:"act-intervals-3",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"מרווחים הרמוניים — שני צלילים יחד",description:"שני הצלילים מושמעים בו־זמנית — זהו את המרווח.",modalities:["listening"],parameters:{intervals:["m3","M3","P5","P8"],questionCount:5,rootMidiRange:[55,72],direction:"harmonic",objectiveId:"obj-6"},estimatedMinutes:5},{id:"act-chord-quality-1",organizationId:"org-public",type:"ear_training",typeId:"ear_chord_quality",title:"סוגי אקורדים בשמיעה — מז׳ור ומינור",description:"האזינו לאקורד וזהו את איכותו.",modalities:["listening"],parameters:{optionIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[50,65],objectiveId:"obj-7"},estimatedMinutes:5},{id:"act-scale-rec-1",organizationId:"org-public",type:"ear_training",typeId:"ear_scale_recognition",title:"מז׳ור או מינור? זיהוי סולמות",description:"האזינו לסולם עולה וזהו את סוגו.",modalities:["listening"],parameters:{optionIds:["scale.major","scale.natural_minor"],questionCount:5,rootMidiRange:[52,64],objectiveId:"obj-9"},estimatedMinutes:5},{id:"act-cadence-1",organizationId:"org-public",type:"ear_training",typeId:"ear_cadence",title:"קדנצות בשמיעה — אותנטית ופלגלית",de
1scription:"האזינו לסיום ההרמוני וזהו את סוג הקדנצה.",modalities:["listening"],parameters:{optionIds:["cadence.authentic","cadence.plagal"],questionCount:4,rootMidiRange:[53,62],objectiveId:"obj-8"},estimatedMinutes:6},{id:"act-rhythm-1",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — רבעים ושמיניות",description:"הקישו את התבנית המוצגת בקצב של 80 BPM.",modalities:["tapping","reading"],parameters:{bpm:80,beatsPerBar:4,bars:1,pattern:[0,1,1.5,2,3],rounds:3,toleranceMs:140,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-rhythm-3",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — ריתמוס מנוקד",description:"רבע מנוקד ואחריו שמינית (דָם־דָ־דָם): הקישו את התבנית ב-76 BPM.",modalities:["tapping","reading"],parameters:{bpm:76,beatsPerBar:4,bars:1,pattern:[0,1.5,2,3],rounds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-rhythm-4",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — שש-עשיריות",description:"תת-חלוקה לארבע (1-e-and-a) בפעימה הראשונה, ואז רבעים. ב-66 BPM.",modalities:["tapping","reading"],parameters:{bpm:66,beatsPerBar:4,bars:1,pattern:[0,.25,.5,.75,1,2,3],rounds:3,toleranceMs:120,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-rhythm-5",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — סינקופה",description:"הדגשה מחוץ לפעימה (off-beat) — שמיניות מוסטות. ב-84 BPM.",modalities:["tapping","reading"],parameters:{bpm:84,beatsPerBar:4,bars:1,pattern:[0,1,1.5,2.5,3],rounds:3,toleranceMs:140,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-piano-scale-1",organizationId:"org-public",type:"piano",typeId:"piano_scale",title:"סולם דו מז׳ור — שתי ידיים",description:"נגנו את הסולם עלייה וירידה, אוקטבה אחת, בקצב אחיד.",modalities:["playing","reading"],parameters:{key:"C",hands:"both",octaves:1},estimatedMinutes:7},{id:"act-theory-1",organizationId:"org-public",type:"theory",typeId:"theory_chord_build",title:"בניית אקורדים — משולשים",description:"השלימו את צלילי האקורד על המקלדת מתוך צליל היסוד.",modalities:["writing"],parameters:{chordIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,67],objectiveId:"obj-4"},estimatedMinutes:6},{id:"act-singing-1",organizationId:"org-public",type:"singing",typeId:"sing_back",title:"חיקוי מלודי — חמישה צלילים",description:"האזינו למוטיב קצר ושירו אותו בחזרה.",modalities:["listening","singing"],parameters:{range:"C4-G4",phraseLength:5},estimatedMinutes:5},{id:"act-sight-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_note_id",title:"קריאת תווים — מפתח סול",description:"זהו את הצליל הרשום בחמשה — מדו אמצעי ועד סול גבוה.",modalities:["reading"],parameters:{clef:"treble",lowMidi:60,highMidi:79,questionCount:8,objectiveId:"obj-11"},estimatedMinutes:5},{id:"act-rhythm-2",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"קריאת מקצב מתווים",description:"קראו את המקצב מהחמשה והקישו אותו בקצב הקליקים.",modalities:["tapping","reading"],parameters:{bpm:76,beatsPerBar:4,bars:1,pattern:[0,1.5,2.5,3],rounds:3,toleranceMs:150,displayMode:"notation",objectiveId:"obj-10"},estimatedMinutes:5},{id:"act-piano-play-1",organizationId:"org-public",type:"piano",typeId:"piano_scale_play",title:"נגינת סולם דו מז׳ור",description:"נגנו את הסולם צליל אחר צליל על המקלדת — אפשר להאזין קודם.",modalities:["playing","reading"],parameters:{sourceId:"scale.major",rootMidi:60,mode:"scale",direction:"ascending",rounds:3,objectiveId:"obj-3"},estimatedMinutes:6},{id:"act-theory-matching-1",organizationId:"org-public",type:"theory",typeId:"theory_matching",title:"משחק התאמה — מרווחים",description:"התאימו כל סמל מרווח לשם העברי שלו.",modalities:["reading"],parameters:{itemIds:["interval.m2","interval.M2","interval.m3","interval.M3"],promptField:"symbol",rounds:2,objectiveId:"obj-4"},estimatedMinutes:5},{id:"act-score-1",organizationId:"org-public",type:"theory",typeId:"score_label",title:"ניתוח קטע — מציאת הקדנצה",description:"התבוננו בקטע וענו על שאלות מודרכות בלחיצה על התיבה הנכונה.",modalities:["reading"],parameters:{excerpt:"c4:q,e4
1:q,g4:h|f4:q,a4:q,f4:h|d4:q,g4:q,b4:h|c5:w",clef:"treble",questions:[{prompt:"באיזו תיבה הקטע נחתם בצליל הטוניקה?",correctMeasure:3},{prompt:"באיזו תיבה מופיעה הדומיננטה המובילה לסיום?",correctMeasure:2}],objectiveId:"obj-8"},estimatedMinutes:5},{id:"act-record-1",organizationId:"org-shirat",type:"performance",typeId:"repertoire_record",title:"הקלטת ביצוע — הקטע שלכם",description:"הקליטו את הביצוע, האזינו, השוו לדוגמה ודרגו את עצמכם.",modalities:["playing"],parameters:{referenceAssetId:"asset-seed-1",minSeconds:5},estimatedMinutes:6,assetIds:["asset-seed-1"]},{id:"act-perf-1",organizationId:"org-shirat",type:"performance",typeId:"repertoire_piece",title:"רפרטואר — מנואט בסול מז׳ור",description:"נגנו את הקטע במלואו והקליטו את הביצוע.",modalities:["playing"],parameters:{pieceId:"minuet-g"},estimatedMinutes:12},{id:"act-sr-name-bass",organizationId:"org-public",type:"sight_reading",typeId:"sight_reading",title:"קריאת תווים — מפתח פה",description:"זהו את שם הצליל בחמשה במפתח פה.",modalities:["reading"],parameters:{mode:"name_note",clef:"bass",lowMidi:43,highMidi:64,questionCount:8,objectiveId:"obj-11"},estimatedMinutes:5},{id:"act-sr-extreme",organizationId:"org-public",type:"sight_reading",typeId:"sight_reading",title:"הגבוה או הנמוך?",description:"קראו רצף קצר וזהו את הצליל הקיצוני.",modalities:["reading"],parameters:{mode:"extreme",clef:"treble",lowMidi:57,highMidi:79,questionCount:6,sequenceLength:5,objectiveId:"obj-11"},estimatedMinutes:6},{id:"act-sri-3rds",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_interval",title:"קריאת מרווחים — טרצות",description:"טרצה גדולה או קטנה — במבט אחד.",modalities:["reading"],parameters:{clef:"treble",intervals:["m3","M3"],presentation:"melodic",lowMidi:60,highMidi:79,questionCount:6,objectiveId:"obj-1"},estimatedMinutes:5},{id:"act-sri-harm",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_interval",title:"קריאת מרווחים — הרמוני",description:"שני צלילים יחד — זהו את המרווח.",modalities:["reading"],parameters:{clef:"treble",intervals:["m3","M3","P4","P5","P8"],presentation:"harmonic",lowMidi:55,highMidi:81,questionCount:6,objectiveId:"obj-1"},estimatedMinutes:6},{id:"act-key-first",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_key",title:"חתימות מפתח — ראשונות",description:"עד חתימה אחת — דו, סול, פה.",modalities:["reading"],parameters:{clef:"treble",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6,objectiveId:"obj-14"},estimatedMinutes:5},{id:"act-key-sharps",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_key",title:"חתימות מפתח — סולמות דיאז",description:"זהו סולמות עם דיאזים.",modalities:["reading"],parameters:{clef:"treble",keyIds:["key.g_major","key.d_major","key.a_major","key.e_major","key.b_major"],questionCount:6,objectiveId:"obj-14"},estimatedMinutes:6},{id:"act-acc-sharps",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_accidental",title:"סימני היתק — דיאזים",description:"זהו תווים עם דיאז; שקילות אנהרמונית מתקבלת.",modalities:["reading"],parameters:{clef:"treble",accidentalType:"sharps",lowMidi:60,highMidi:72,questionCount:6,objectiveId:"obj-15"},estimatedMinutes:5},{id:"act-acc-bass",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_accidental",title:"סימני היתק — מפתח פה",description:"דיאזים ובמולים בטווח הנמוך.",modalities:["reading"],parameters:{clef:"bass",accidentalType:"both",lowMidi:43,highMidi:64,questionCount:6,objectiveId:"obj-15"},estimatedMinutes:6},{id:"act-mel-c",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_melody",title:"קריאת מלודיה — דו מז׳ור",description:"קראו מלודיה קצרה ונגנו אותה על המקלדת.",modalities:["reading","playing"],parameters:{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:72,noteCount:5,questionCount:4,objectiveId:"obj-16"},estimatedMinutes:6},{id:"act-mel-g",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_melody",title:"קריאת מלודיה — סול מז׳ור",description:"מלודיה עם חתימת מפתח — קראו ונגנו.",modalities:["reading","playing"],parameters:{clef:"treble",keyId:"key.g_major",lowMidi:62,highMidi:74,noteCount:6,questionCount:4,objectiveId:"obj-16"},estimatedMinutes:7},{id:"act-nb-3rd",organizationId:"org-public",type:"sight_reading",typeId:"notation_build",title:"בנייה על החמשה — טרצה",description:"הציבו צליל טרצה מעל הנתון.",modalities:["reading","writing"],parameters:{mode:"build_interval",clef:"treble",intervalSemitones:4,lowMidi:60,highMidi:72,questionCount:6,objectiveId:"obj-12"},estimatedMinutes:6},{id:"act-nb-chord",organizationId:"org-public",type:"sight_reading",typeId:"notation_build",title:"בנייה על החמשה — אקורד מז׳ור",description:"אייתו אקורד מז׳ור על החמשה.",modalities:["reading","writing"],parameters:{mode:"build_chord",clef:"treble",sourceId:"chord.maj",lowMidi:55,highMidi:76,questionCount:6,objectiveId:"obj-12"},estimatedMinutes:6},{id:"act-nb-place",organizationId:"org-public",type:"sight_reading",typeId:"notation_build",title:"בנייה על החמשה — הצבת צליל בודד",description:"הציבו צליל נתון בשמו במקומו הנכון על החמשה.",modalities:["reading","writing"],parameters:{mode:"place_note",clef:"treble",pitchLetters:["c","d","e","f","g","a","b"],lowMidi:60,highMidi:72,questionCount:6,objectiveId:"obj-12"},estimatedMinutes:5},{id:"act-nsel-high",organizationId:"org-public",type:"sight_reading",typeId:"notation_select",title:"איתור — הצליל הגבוה ביותר",description:"לחצו על הצליל הגבוה ביותר בקבוצה.",modalities:["reading"],parameters:{mode:"find_extreme",extreme:"highest",clef:"treble",keyId:"key.c_major",noteCount:4,lowMidi:60,highMidi:76,questionCount:6,objectiveId:"obj-18"},estimatedMinutes:5},{id:"act-nsel-wrong",organizationId:"org-public",type:"sight_reading",typeId:"notation_select",title:"איתור הטעות — דו מז׳ור",description:"צליל אחד יצא מהסולם — אתרו אותו.",modalities:["reading"],parameters:{mode:"find_wrong",clef:"treble",keyId:"key.c_major",noteCount:5,lowMidi:60,highMidi:74,questionCount:6,objectiveId:"obj-18"},estimatedMinutes:6},{id:"act-spell-maj",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולמות מז׳ור",description:"אַיְּתו סולמות מז׳ור בשמות הצלילים.",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6,objectiveId:"obj-17"},estimatedMinutes:6},{id:"act-spell-min",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולמות מינור",description:"אַיְּתו סולמות מינור טבעי בשמות הצלילים.",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.a_minor","key.e_minor","key.d_minor"],questionCount:6,objectiveId:"obj-17"},estimatedMinutes:6},{id:"act-spell-triad",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות משולשים",description:"אַיְּתו אקורדים מז׳ור ומינור בשמות הצלילים.",modalities:["writing"],parameters:{mode:"spell_chord",chordIds:["chord.maj","chord.min"],rootMidis:[60,62,64,65,67,69],questionCount:6,objectiveId:"obj-17"},estimatedMinutes:6},{id:"act-spell-7th",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות ספטאקורדים",description:"אַיְּתו ספטאקורדים בשמות הצלילים.",modalities:["writing"],parameters:{mode:"spell_chord",chordIds:["chord.dom7","chord.maj7","chord.m7"],rootMidis:[60,62,64,65,67],questionCount:6,objectiveId:"obj-17"},estimatedMinutes:7},{id:"act-func-fn",organizationId:"org-public",type:"theory",typeId:"theory_function",title:"תפקוד אקורדים — דו מז׳ור",description:"טוניקה, סובדומיננטה או דומיננטה?",modalities:["reading"],parameters:{mode:"function",keyIds:["key.c_major"],degrees:[1,2,3,4,5,6,7],questionCount:6,objectiveId:"obj-19"},estimatedMinutes:6},{id:"act-func-num",organizationId:"org-public",type:"theory",typeId:"theory_function",title:"דרגות רומיות — דו מז׳ור",description:"זהו את הדרגה I–vii° של כל אקורד.",modalities:["reading"],parameters:{mode:"numeral",keyIds:["key.c_major"],degrees:[1,2,3,4,5,6,7],questionCount:7,objectiveId:"obj-19"},estimatedMinutes:7},{id:"act-func-sharp",organizationId:"org-public",type:"theory",typeId:"theory_function",title:"דרגות רומיות — סולמות דיאז",description:"זיהוי דרגות בכמה סולמות.",modalities:["reading"],parameters:{mode:"numeral",keyIds:["key.c_major","key.g_major","key.d_major","key.a_major"],degrees:[1,2,3,4,5,6,7],questionCount:8,objectiveId:"obj-19"},estimatedMinutes:8},{id:"act-inv-triad",organizationId:"org-public",type:"theory",typeId:"chord_inversion",title:"זיהוי היפוכי משולשים",description:"מצב יסוד, היפוך ראשון או היפוך שני?",modalities:["reading"],parameters:{chordIds:["chord.maj","chord.min"],rootMidiRange:[55,67],inversions:["root","first","second"],questionCount:6,objectiveId:"obj-4"},estimatedMinutes:6},{id:"act-inv-7th",organizationId:"org-public",type:"theory",typeId:"chord_inversion",title:"זיהוי היפוכי ספטאקורד",description:"זהו את היפוך הספטאקורד הדומיננטי לפי צליל הבס.",modalities:["reading"],parameters:{chordIds:["chord.dom7"],rootMidiRange:[55,65],inversions:["root","first","second","third"],questionCount:7,objectiveId:"obj-4"},estimatedMinutes:7},{id:"act-org-cons",organizationId:"org-public",type:"theory",typeId:"theory_organize",title:"קונסוננס מול דיסוננס",description:"מיינו מרווחים לפי צליל מתמזג או מתוח.",modalities:["reading","writing"],parameters:{mode:"classify",buckets:[{id:"consonant",label:{he:"קונסוננס",en:"Consonant"},itemIds:["interval.P5","interval.P4","interval.M3","interval.m3","interval.M6","interval.P8"]},{id:"dissonant",label:{he:"דיסוננס",en:"Dissonant"},itemIds:["interval.m2","interval.M2","interval.m7","interval.M7","interval.TT"]}],sampleSize:6,questionCount:4,objectiveId:"obj-13"},estimatedMinutes:6},{id:"act-org-order",organizationId:"org-public",type:"theory",typeId:"theory_organize",title:"סדר מרווחים לפי גודל",de
1scription:"סדרו מרווחים מהקטן לגדול.",modalities:["reading","writing"],parameters:{mode:"order",orderedItemIds:["interval.m2","interval.M3","interval.P5","interval.P8"],questionCount:5,objectiveId:"obj-13"},estimatedMinutes:5},{id:"act-chord-7th",organizationId:"org-public",type:"theory",typeId:"theory_chord_build",title:"בניית ספטאקורדים",description:"בנו ספטאקורדים על המקלדת.",modalities:["writing"],parameters:{chordIds:["chord.dom7","chord.maj7","chord.m7"],questionCount:5,rootMidiRange:[55,67],objectiveId:"obj-4"},estimatedMinutes:7},{id:"act-mek-2nd-mel",organizationId:"org-public",type:"ear_training",typeId:"ear_interval_quality",title:"מכינה — סקונדות (מלודי)",description:"האזינו לסקונדה המושמעת בזה אחר זה — זהו אם היא קטנה או גדולה, ובאיזה כיוון (עולה/יורד).",modalities:["listening"],parameters:{intervals:["m2","M2"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8,objectiveId:"obj-20"},estimatedMinutes:6},{id:"act-mek-2nd-harm",organizationId:"org-public",type:"ear_training",typeId:"ear_interval_quality",title:"מכינה — סקונדות (הרמוני)",description:"האזינו לסקונדה המושמעת יחד — זהו אם היא קטנה או גדולה.",modalities:["listening"],parameters:{intervals:["m2","M2"],presentation:"harmonic",rootMidiRange:[55,74],questionCount:8,objectiveId:"obj-20"},estimatedMinutes:6},{id:"act-mek-3rd-mel",organizationId:"org-public",type:"ear_training",typeId:"ear_interval_quality",title:"מכינה — טרצות (מלודי)",description:"האזינו לטרצה המושמעת בזה אחר זה — זהו אם היא קטנה או גדולה, ובאיזה כיוון.",modalities:["listening"],parameters:{intervals:["m3","M3"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8,objectiveId:"obj-20"},estimatedMinutes:6},{id:"act-mek-3rd-harm",organizationId:"org-public",type:"ear_training",typeId:"ear_interval_quality",title:"מכינה — טרצות (הרמוני)",description:"האזינו לטרצה המושמעת יחד — זהו אם היא קטנה או גדולה.",modalities:["listening"],parameters:{intervals:["m3","M3"],presentation:"harmonic",rootMidiRange:[55,74],questionCount:8,objectiveId:"obj-20"},estimatedMinutes:6},{id:"act-mek-dict-1",organizationId:"org-public",type:"rhythm",typeId:"rhythm_dictation",title:"מכינה — הכתבה רתמית (תיבה אחת)",description:"האזינו למקצב וזהו את הרישום הנכון: חצאים, רבעים, שמיניות ושתיקות. עד 5 האזנות.",modalities:["listening","reading"],parameters:{bpm:70,bars:1,optionCount:3,maxPlays:5,questionCount:6,objectiveId:"obj-21"},estimatedMinutes:6},{id:"act-mek-dict-2",organizationId:"org-public",type:"rhythm",typeId:"rhythm_dictation",title:"מכינה — הכתבה רתמית (שתי תיבות)",description:"הכתבה בת שתי תיבות ב־70 — זהו את הרישום שהושמע. עד 5 האזנות.",modalities:["listening","reading"],parameters:{bpm:70,bars:2,optionCount:3,maxPlays:5,questionCount:6,objectiveId:"obj-21"},estimatedMinutes:7},{id:"act-mek-mdict-end",organizationId:"org-public",type:"ear_training",typeId:"melody_dictation",title:"מכינה — השלמת סוף המשפט",description:"שמעו מנגינה קצרה (דו–סול) ובחרו את התו החסר בסופה.",modalities:["listening","reading"],parameters:{mode:"blank",blankPosition:"end",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6,objectiveId:"obj-22"},estimatedMinutes:6},{id:"act-mek-mdict-start",organizationId:"org-public",type:"ear_training",typeId:"melody_dictation",title:"מכינה — השלמת תחילת המשפט",description:"שמעו מנגינה ובחרו את התו החסר בפתיחה.",modalities:["listening","reading"],parameters:{mode:"blank",blankPosition:"start",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6,objectiveId:"obj-22"},estimatedMinutes:6},{id:"act-mek-mdict-mid",organizationId:"org-public",type:"ear_training",typeId:"melody_dictation",title:"מכינה — השלמת האמצע",description:"שמעו מנגינה ובחרו את התו החסר באמצע.",modalities:["listening","reading"],parameters:{mode:"blank",blankPosition:"middle",ke
1yId:"key.c_major",lowMidi:60,highMidi:67,noteCount:5,optionCount:4,maxPlays:5,questionCount:6,objectiveId:"obj-22"},estimatedMinutes:6},{id:"act-mek-mdict-mc",organizationId:"org-public",type:"ear_training",typeId:"melody_dictation",title:"מכינה — הכתבה מלודית (בחירה מרובה)",description:"שמעו מנגינה ובחרו מבין האפשרויות את הרישום הנכון. עד 5 האזנות.",modalities:["listening","reading"],parameters:{mode:"full",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6,objectiveId:"obj-22"},estimatedMinutes:6},{id:"act-note-tb-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_note_id",title:"קריאת תווים — טבעיים במפתח סול (דו–דו)",description:"זהו את שם הצליל הטבעי בחמשה, מדו אמצעי עד דו הבא (אוקטבה).",modalities:["reading"],parameters:{clef:"treble",lowMidi:60,highMidi:72,questionCount:8,objectiveId:"obj-11"},estimatedMinutes:5},{id:"act-note-bs-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_note_id",title:"קריאת תווים — טבעיים במפתח פה",description:"זהו את שם הצליל הטבעי במפתח פה, דו נמוך עד דו אמצעי.",modalities:["reading"],parameters:{clef:"bass",lowMidi:48,highMidi:60,questionCount:8,objectiveId:"obj-11"},estimatedMinutes:5},{id:"act-note-ledger-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_note_id",title:"קריאת תווים — דו אמצעי וקווי-עזר",description:"זיהוי צלילים סביב דו האמצעי, כולל קווי-עזר מתחת למפתח סול.",modalities:["reading"],parameters:{clef:"treble",lowMidi:57,highMidi:65,questionCount:8,objectiveId:"obj-11"},estimatedMinutes:5},{id:"act-rhythm-basic-1",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — חצי ורבעים",description:"תו חצי (2 פעימות) ואחריו שני רבעים, ב-4/4. הקישו ב-70 BPM.",modalities:["tapping","reading"],parameters:{bpm:70,beatsPerBar:4,bars:1,pattern:[0,2,3],rounds:3,toleranceMs:160,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-rhythm-basic-2",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — רבעים ושתיקה",description:"רבע, רבע, שתיקת-רבע, רבע (ללא הקשה בפעימה 3). ב-76 BPM.",modalities:["tapping","reading"],parameters:{bpm:76,beatsPerBar:4,bars:1,pattern:[0,1,3],rounds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-rhythm-basic-3",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — רבעים ושמיניות (בסיסי)",description:"שני רבעים, ואז זוג שמיניות ורבע (דָ־דָ־דָ-דָ־דָ). ב-80 BPM.",modalities:["tapping","reading"],parameters:{bpm:80,beatsPerBar:4,bars:1,pattern:[0,1,2,2.5,3],rounds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-int-oct-1",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — סקונדה מול אוקטבה",description:"הניגוד הקל ביותר: סקונדה גדולה (2 חצאי-טונים) מול אוקטבה זכה (12).",modalities:["listening"],parameters:{intervals:["M2","P8"],questionCount:6,rootMidiRange:[57,72],direction:"ascending",objectiveId:"obj-1"},estimatedMinutes:4},{id:"act-int-2v3-1",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — סקונדה מול טרצה",description:"סקונדה גדולה (2) מול טרצה גדולה (4 חצאי-טונים) — צעד מול דילוג.",modalities:["listening"],parameters:{intervals:["M2","M3"],questionCount:6,rootMidiRange:[57,74],direction:"ascending",objectiveId:"obj-1"},estimatedMinutes:5},{id:"act-int-sight-2nd-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_interval",title:"קריאת מרווחים — סקונדות",description:"סקונדה קטנה (חצי-טון) או גדולה (טון) — במבט אחד.",modalities:["reading"],parameters:{clef:"treble",intervals:["m2","M2"],presentation:"melodic",lowMidi:60,highMidi:79,questionCount:6,objectiveId:"obj-1"},estimatedMinutes:5},{id:"act-spell-cmaj",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולם דו מז׳ור",description:"אַיְּתו את דו מז׳ור: דו רה מי פה סול לה סי — בלי היתקים.",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.c_major"],questionCount:5,objectiveId:"obj-17"},estimatedMinutes:5},{id:"act-spell-g",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולם סול מז׳ור",description:"אַיְּתו את סול מז׳ור: סול לה סי דו רה מי פה♯ — דיאז אחד.",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.g_major"],questionCount:5,objectiveId:"obj-17"},estimatedMinutes:5},{id:"act-spell-f",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולם פה מז׳ור",description:"אַיְּתו את פה מז׳ור: פה סול לה סי♭ דו רה מי — במול אחד.",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.f_major"],questionCount:5,objectiveId:"obj-17"},estimatedMinutes:5},{id:"act-key-basic-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_key",title:"חתימות מפתח — 0–1 היתקים",description:"זהו חתימות ללא היתק (דו), דיאז אחד (סול) או במול אחד (פה).",modalities:["reading"],parameters:{clef:"treble",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6,objectiveId:"obj-14"},estimatedMinutes:5},{id:"act-chord-mm-1",organizationId:"org-public",type:"ear_training",typeId:"ear_chord_quality",title:"איכות אקורד — מז׳ור מול מינור (בסיסי)",description:"האזינו למשולש במצב יסוד וזהו אם הוא מז׳ורי או מינורי.",modalities:["listening"],parameters:{optionIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[52,64],objectiveId:"obj-7"},estimatedMinutes:5},{id:"act-chord-mm-build-1",organizationId:"org-public",type:"theory",typeId:"theory_chord_build",title:"בניית משולש — מז׳ור ומינור",description:"בנו משולש מז׳ורי (יסוד+4+7) או מינורי (יסוד+3+7) על המקלדת.",modalities:["writing"],parameters:{chordIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,67],objectiveId:"obj-4"},estimatedMinutes:6},{id:"act-int-2v3-easy",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — סקונדה מול טרצה (מגע ראשון)",description:"סקונדה גדולה (2 חצאי-טונים) מול טרצה גדולה (4) — עולה ואיטי, טווח נוח.",modalities:["listening"],parameters:{intervals:["M2","M3"],questionCount:5,rootMidiRange:[60,72],direction:"ascending",objectiveId:"obj-1"},estimatedMinutes:4},{id:"act-int-large-1",organizationId:"org-public",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — מרווחים גדולים (שליטה)",description:"סקסטות וספטימות: מינורית מול גדולה (m6=8, M6=9, m7=10, M7=11) — הרמוני (בו-זמני).",modalities:["listening"],parameters:{intervals:["m6","M6","m7","M7"],questionCount:8,rootMidiRange:[52,76],direction:"harmonic",objectiveId:"obj-1"},estimatedMinutes:6},{id:"act-rhythm-rest-1",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"הקשת מקצב — שתיקות (רבע, שתיקה, חצי)",description:"רבע בפעימה 1, שתיקת-רבע בפעימה 2, ואז תו חצי (פעימות 3–4). ב-72 BPM. הקשה בפעימות 0 ו-2 בלבד.",modalities:["tapping","reading"],parameters:{bpm:72,beatsPerBar:4,bars:1,pattern:[0,2],rounds:3,toleranceMs:160,objectiveId:"obj-2"},estimatedMinutes:4},{id:"act-note-fluency-1",organizationId:"org-public",type:"sight_reading",typeId:"sight_note_id",title:"קריאת תווים — שטף במפתח סול (סול3–סול5)",description:"זיהוי מהיר של צלילים טבעיים בטווח רחב במפתח סול, מסול נמוך (55) עד סול גבוה (79).",modalities:["reading"],parameters:{clef:"treble",lowMidi:55,highMidi:79,questionCount:10,objectiveId:"obj-11"},estimatedMinutes:6},{id:"act-spell-d",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולם רה מז׳ור",description:"אַיְּתו את רה מז׳ור: רה מי פה♯ סול לה סי דו♯ — שני דיאזים (פה♯, דו♯).",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.d_major"],questionCount:5,objectiveId:"obj-17"},estimatedMinutes:5},{id:"act-spell-bb",organizationId:"org-public",type:"theory",typeId:"theory_spell",title:"איות סולם סי-במול מז׳ור",description:"אַיְּתו את סי♭ מז׳ור: סי♭ דו רה מי♭ פה סול לה — שני במולים (סי♭, מי♭).",modalities:["writing"],parameters:{mode:"spell_scale",keyIds:["key.bb_major"],questionCount:5,objectiveId:"obj-17"},estimatedMinutes:5},{id:"act-chord-mm-easy",organizationId:"org-public",type:"ear_training",typeId:"ear_chord_quality",title:"איכות אקורד — מז׳ור מול מינור (מגע ראשון)",description:"האזינו למשולש מלא (בלוק) במצב יסוד, טווח נוח, וזהו אם הוא מז׳ורי או מינורי. גרסה עדינה.",modalities:["listening"],parameters:{optionIds:["chord.maj","chord.min"],questionCount:4,rootMidiRange:[55,67],objectiveId:"obj-7"},estimatedMinutes:4},{id:"act-meter-68",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"משקל 6/8 — שש שמיניות (שתי פעימות מנוקדות)",description:"משקל מורכב 6/8: שש שמיניות בקבוצות 3+3 (שתי פעימות רבע-מנוקד). דגש בשמינית 0 ו-3.",modalities:["tapping","reading"],parameters:{bpm:120,beatsPerBar:6,bars:1,pattern:[0,1,2,3,4,5],roun
1ds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:5},{id:"act-meter-58",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"משקל 5/8 א-סימטרי (3+2)",description:"משקל א-סימטרי 5/8 בחלוקה 3+2: חמש שמיניות עם דגשים בשמינית 0 ו-3.",modalities:["tapping","reading"],parameters:{bpm:120,beatsPerBar:5,bars:1,pattern:[0,1,2,3,4],rounds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:5},{id:"act-meter-78",organizationId:"org-public",type:"rhythm",typeId:"rhythm_tap",title:"משקל 7/8 א-סימטרי (2+2+3)",description:"משקל א-סימטרי 7/8 בחלוקה 2+2+3: שבע שמיניות עם דגשים בשמינית 0, 2 ו-4.",modalities:["tapping","reading"],parameters:{bpm:132,beatsPerBar:7,bars:1,pattern:[0,1,2,3,4,5,6],rounds:3,toleranceMs:150,objectiveId:"obj-2"},estimatedMinutes:5},{id:"act-echo-basic-1",organizationId:"org-public",type:"rhythm",typeId:"rhythm_echo",title:"הד קצבי — רבעים (4/4)",description:"האזינו לתבנית של ארבעה רבעים ב-4/4 והחזירו אותה מיד בהקשה. 70 BPM.",modalities:["listening","tapping"],parameters:{bpm:70,beatsPerBar:4,bars:1,patternIds:["rhythm_pattern.quarters"],rounds:4,toleranceMs:180,mode:"echo",objectiveId:"obj-10"},estimatedMinutes:5},{id:"act-echo-basic-2",organizationId:"org-public",type:"rhythm",typeId:"rhythm_echo",title:"הד קצבי — רבעים ושמיניות (4/4)",description:"האזינו לתבנית של רבעים ושמיניות ב-4/4 והחזירו אותה מיד בהקשה. 76 BPM.",modalities:["listening","tapping"],parameters:{bpm:76,beatsPerBar:4,bars:1,patternIds:["rhythm_pattern.quarters_eighths"],rounds:4,toleranceMs:160,mode:"echo",objectiveId:"obj-10"},estimatedMinutes:5},{id:"act-vocab-dynamics",organizationId:"org-public",type:"theory",typeId:"theory_matching",title:"מילון דינמיקה — סמל למשמעות",description:"התאימו כל סימן דינמיקה (p, f, mf, cresc., dim.) למשמעות שלו: עוצמת הנגינה.",modalities:["reading"],parameters:{itemIds:["concept.mark_p","concept.mark_f","concept.mark_mf","concept.mark_cresc","concept.mark_dim"],promptField:"symbol",rounds:2,objectiveId:"obj-13"},estimatedMinutes:5},{id:"act-vocab-tempo",organizationId:"org-public",type:"theory",typeId:"theory_matching",title:"מילון טמפו — מונח למשמעות",description:"התאימו כל מונח טמפו (Adagio, Andante, Moderato, Allegro, Presto) למהירות שהוא מציין — מהאיטי למהיר.",modalities:["reading"],parameters:{itemIds:["concept.mark_adagio","concept.mark_andante","concept.mark_moderato","concept.mark_allegro","concept.mark_presto"],promptField:"symbol",rounds:2,objectiveId:"obj-13"},estimatedMinutes:5},{id:"act-vocab-articulation",organizationId:"org-public",type:"theory",typeId:"theory_matching",title:"מילון ארטיקולציה — מונח למשמעות",description:"התאימו כל מונח ארטיקולציה (staccato, legato, accent, fermata) לאופן הנגינה שהוא מציין.",modalities:["reading"],parameters:{itemIds:["concept.mark_staccato","concept.mark_legato","concept.mark_accent","concept.mark_fermata"],promptField:"symbol",rounds:2,objectiveId:"obj-13"},estimatedMinutes:5},{id:"act-cof-sharps",organizationId:"org-public",type:"theory",typeId:"theory_organize",title:"מעגל הקווינטות — צד הדיאזים",description:"סדרו את הסולמות לפי מספר הדיאזים העולה: דו (0), סול (1♯), רה (2♯), לה (3♯), מי (4♯).",modalities:["reading","writing"],parameters:{mode:"order",orderedItemIds:["key.c_major","key.g_major","key.d_major","key.a_major","key.e_major"],questionCount:5,objectiveId:"obj-14"},estimatedMinutes:5},{id:"act-cof-flats",organizationId:"org-public",type:"theory",typeId:"theory_organize",title:"מעגל הקווינטות — צד הבמולים",description:"סדרו את הסולמות לפי מספר הבמולים העולה: דו (0), פה (1♭), סי♭ (2♭), מי♭ (3♭), לה♭ (4♭).",modalities:["reading","writing"],parameters:{mode:"order",orderedItemIds:["key.c_major","key.f_major","key.bb_major","key.eb_major","key.ab_major"],questionCount:5,objectiveId:"obj-14"},estimatedMinutes:5},{id:"act-acc-flats",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_accidental",title:"סימני היתק — במולים",description:"זהו תווים עם במול (למשל סי♭ מול סי מול לה); שקילות אנהרמונית מתקבלת.",modalities:["reading"],parameters:{clef:"treble",accidentalType:"flats",lowMidi:60,highMidi:72,questionCount:6,objectiveId:"obj-15"},estimatedMinutes:5},{id:"act-acc-wide",organizationId:"org-public",type:"sight_reading",typeId:"sight_read_accidental",title:"סימני היתק — דיאזים ובמולים בטווח רחב",description:"דיאזים ובמולים על פני שתי אוקטבות במפתח סול (למשל פה♯ מול פה מול סול♭).",modalities:["reading"],parameters:{clef:"treble",accidentalType:"both",lowMidi:48,highMidi:84,questionCount:8,objectiveId:"obj-15"},estimatedMinutes:6}],Tx=[{id:"ps-1",musicianId:"u-noa",status:"completed",startedAt:Pt(0,8),totalMinutes:22,source:"recommendation",runs:[{id:"run-1",activityId:"act-intervals-1",activityTitle:"זיהוי מרווחים — טרצות",activityType:"ear_training",startedAt:Pt(0,8),durationMinutes:6,score:.85,objectiveSignals:[{objectiveId:"obj-1",signal:.85}]},{id:"run-2",activityId:"act-rhythm-1",activityTitle:"הקשת מקצב — רבעים ושמיניות",activityType:"rhythm",startedAt:Pt(0,8),durationMinutes:5,score:.72,objectiveSignals:[{objectiveId:"obj-2",signal:.72}]},{id:"run-3",activityId:"act-piano-scale-1",activityTitle:"סולם דו מז׳ור — שתי ידיים",activityType:"piano",startedAt:Pt(0,8),durationMinutes:11}]},{id:"ps-2",musicianId:"u-noa",status:"completed",startedAt:Pt(1),totalMinutes:18,source:"assignment",runs:[{id:"run-4",activityId:"act-perf-1",activityTitle:"רפרטואר — מנואט בסול מז׳ור",activityType:"performance",startedAt:Pt(1),durationMinutes:18,score:.9}]},{id:"ps-3",musicianId:"u-noa",status:"completed",startedAt:Pt(2),totalMinutes:25,source:"free_choice",runs:[{id:"run-5",activityId:"act-theory-1",activityTitle:"בניית אקורדים — משולשים",activityType:"theory",startedAt:Pt(2),durationMinutes:10,score:.95,objectiveSignals:[{objectiveId:"obj-4",signal:.95}]},{id:"run-6",activityId:"act-singing-1",activityTitle:"חיקוי מלודי — חמישה צלילים",activityType:"singing",startedAt:Pt(2),durationMinutes:15,score:.68,objectiveSignals:[{objectiveId:"obj-5",signal:.68}]}]},{id:"ps-4",musicianId:"u-noa",status:"completed",startedAt:Pt(4),totalMinutes:15,source:"recommendation",runs:[{id:"run-7",activityId:"act-intervals-1",activityTitle:"זיהוי מרווחים — טרצות",activityType:"ear_training",startedAt:Pt(4),durationMinutes:15,score:.78,objectiveSignals:[{objectiveId:"obj-1",signal:.78}]}]}],G_=[{id:"seed-authored-1",organizationId:"org-shirat",createdBy:"u-amit",createdAt:Pt(3,10),updatedAt:Pt(3,11),status:"published",draft:{typeId:"ear_interval",type:"ear_training",title:"זיהוי מרווחים — סקסטות",description:"האזינו לשני צלילים וזהו אם המרווח הוא סקסטה גדולה או קטנה.",modalities:["listening"],estimatedMinutes:5,parameters:{intervals:["m6","M6"],questionCount:5,rootMidiRange:[55,72],direction:"ascending",objectiveId:"obj-1"}},versions:[{version:1,publishedAt:Pt(3,11),activity:{id:"authored-seed-authored-1",organizationId:"org-shirat",type:"ear_training",typeId:"ear_interval",title:"זיהוי מרווחים — סקסטות",description:"האזינו לשני צלילים וזהו אם המרווח הוא סקסטה גדולה או קטנה.",modalities:["listening"],estimatedMinutes:5,parameters:{intervals:["m6","M6"],questionCount:5,rootMidiRange:[55,72],direction:"ascending",objectiveId:"obj-1"}}}]}],K_=[{id:"n-1",userId:"u-noa",kind:"teacher_note",title:"הערה מעמית",body:"שמעתי את ההקלטה של המנואט — התקדמות יפה! שימי לב לפראזה בתיבות 9–12.",createdAt:Pt(0,12),read:!1},{id:"n-2",userId:"u-noa",kind:"assignment",title:"תרגול חדש הוקצה",body:"עמית הקצה לך תרגול מקצב לקראת השיעור ביום רביעי.",createdAt:Pt(1,9),read:!1},{id:"n-3",userId:"u-noa",kind:"milestone",title:"רצף של 5 ימים! 🔥",body:"תרגלת חמישה ימים ברציפות. כל הכבוד על ההתמדה!",createdAt:Pt(2,18),read:!0}],Ex=[{id:"lesson-seed-1",groupId:"g-w-year2-boker",groupName:"שנה ב׳ בוקר · נשים",teacherId:"u-amit",date:Pt(1,16),note:"מרווחים ותבניות מקצב — הכנה למופע הכיתה",topicIds:["interval.M3","rhythm_pattern.quarters_eighths"],recommendedActivityIds:["act-intervals-1","act-rhythm-1"]},{id:"lesson-seed-2",groupId:"g-w-piano-adv",groupName:"פסנתר מתקדמות",teacherId:"u-amit",date:Pt(3,18),note:"זיהוי טרצות וסקסטות בשמיעה, וארפג׳יו בשתי ידיים",topicIds:["interval.m3","interval.M6"],recommendedActivityIds:["act-intervals-1","act-intervals-2"]},{id:"lesson-seed-prep",groupId:"g-m-prep-course",groupName:"מכינה ללימודים",teacherId:"u-amit",date:Pt(1,16),note:"שיעורי בית מכינה: זיהוי סקונדות וטרצות (מלודי והרמוני) + הכתבה רתמית",topicIds:["interval.m2","interval.M2","interval.m3","interval.M3"],recommendedActivityIds:["act-mek-2nd-mel","act-mek-2nd-harm","act-mek-3rd-mel","act-mek-3rd-harm","act-mek-dict-1","act-mek-dict-2","act-mek-mdict-end","act-mek-mdict-start","act-mek-mdict-mid","act-mek-mdict-mc"]}],Nx=[{id:"track-seed-melody-y2",kind:"course",title:"תרגול בנושא קריאת מנגינות",objectiveIds:["obj-16"],exerciseIds:["act-mel-c","act-mel-g"],groupIds:["g-w-year2-boker"],publishedToFreePractice:!1,authorId:"u-keren",authorName:"קרן גולן",authorRole:"teacher",createdAt:"2026-07-10T09:00:00.000Z",updatedAt:"2026-07-10T09:00:00.000Z"},{id:"track-seed-ear-y1",kind:"standalone",title:"תרגול בנושא פיתוח שמיעה — שנה א׳",objectiveIds:["obj-1"],exerciseIds:["act-sri-3rds","act-sri-harm"],level:"שנה א׳",groupIds:[],publishedToFreePractice:!0,authorId:"u-michal",authorName:"מיכל עמר",authorRole:"admin",createdAt:"2026-07-10T10:00:00.000Z",updatedAt:"2026-07-10T10:00:00.000Z"}],Sx=[{id:"ann-seed-1",groupId:"g-w-year2-boker",groupName:"שנה ב׳ בוקר · נשים",teacherId:"u-keren",teacherName:"קרן גולן",title:"לקראת המפגש הבא",body:"כל הכבוד על העבודה השבוע! למפגש הבא נא לתרגל את סט התרגילים שהעליתי, ולחזור על זיהוי המרווחים ההרמוניים. נתראה 🎵",createdAt:"2026-07-09T18:00:00.000Z"}],H_=u1.map((n,e)=>({profile:n,weeklyMinutes:[80,45,120,15,95,60][e]??30,streakDays:[5,2,11,0,7,3][e]??1,lastPracticeAt:e===3?null:Pt(e%3)})),Ax=[{id:"u-ayala",organizationId:"org-shirat",displayName:"אילה ילינק",roles:["admin","teacher"],instruments:[],avatarColor:"#0e7490",email:"[email protected]",mustChangePassword:!0},{id:"u-eitan",organizationId:"org-shirat",displayName:"איתן אבנט",roles:["admin","teacher"],instruments:[],avatarColor:"#b45309",email:"[email protected]",mustChangePassword:!0},{id:"u-hadas",organizationId:"org-shirat",displayName:"הדס שמרלינג",roles:["teacher"],instruments:[],avatarColor:"#7c5cff",email:"[email protected]",mustChangePassword:!0},{id:"u-hadassa",organizationId:"org-shirat",displayName:"הדסה דניאלס",roles:["teacher"],instruments:[],avatarColor:"#0f766e",email:"[email protected]",mustChangePassword:!0},{id:"u-mayap",organizationId:"org-shirat",displayName:"מאיה פוליצר",roles:["teacher"],instruments:[],avatarColor:"#be123c",email:"[email protected]",mustChangePassword:!0},{id:"u-mayah",organizationId:"org-shirat",displayName:"מאיה הרטמן",roles:["teacher"],instruments:[],avatarColor:"#4d7c0f",email:"[email protected]",mustChangePassword:!0},{id:"u-noash",organizationId:"org-shirat",displayName:"נועה שמר",roles:["teacher"],instruments:[],avatarColor:"#6d28d9",email:"[email protected]",mustChangePassword:!0},{id:"u-orpaz",organizationId:"org-shirat",displayName:"אורפז קודיש",roles:["teacher"],instruments:[],avatarColor:"#1d4ed8",email:"[email protected]",mustChangePassword:!0},{id:"u-rivka",organizationId:"org-shirat",displayName:"רבקה רביבו",roles:["teacher"],instruments:[],avatarColor:"#a16207",email:"[email protected]",mustChangePassword:!0},{id:"u-shira",organizationId:"org-shirat",displayName:"שירה גל",roles:["teacher"],instruments:[],avatarColor:"#0891b2",email:"[email protected]",mustChangePassword:!0},{id:"u-tal",organizationId:"org-shirat",displayName:"טל אברמוביץ'",roles:["teacher"],instruments:[],avatarColor:"#c026d3",email:"[email protected]",mustChangePassword:!0},{id:"u-todahya",organizationId:"org-shirat",displayName:"תודהיה שנדוביץ'",roles:["teacher"],instruments:[],avatarColor:"#15803d",email:"[email protected]",mustChangePassword:!0},{id:"u-david",organizationId:"org-shirat",displayName:"דוד ילינק",roles:["admin","teacher"],instruments:[],avatarColor:"#9333ea",email:"[email protected]",mustChangePassword:!0},{id:"u-yair",organizationId:"org-shirat",displayName:"יאיר רוזנשטיין",roles:["admin","teacher"],instruments:[],avatarColor:"#c2410c",email:"[email protected]",mustChangePassword:!0},{id:"u-yonatan",organizationId:"org-shirat",displayName:"יונתן רזאל",roles:["admin","teacher"],instruments:[],avatarColor:"#0369a1",email:"[email protected]",mustChangePassword:!0},{id:"u-michal",organizationId:"org-shirat",displayName:"מיכל עמר",roles:["admin","teacher"],instruments:[],avatarColor:"#65a30d",email:"[email protected]",mustChangePassword:!0},{id:"u-office",organizationId:"org-shirat",displayName:"משרד שירת הלויים",roles:["admin","teacher"],instruments:[],avatarColor:"#db2777",email:"[email protected]",mustChangePassword:!0},{id:"u-keren",organizationId:"org-shirat",displayName:"קרן גולן",roles:["admin","teacher"],instruments:[],avatarColor:"#047857",email:"[email protected]",mustChangePassword:!0}],Bu=[{id:"obj-1",title:{he:"זיהוי מרווחים בשמיעה",en:"Interval recognition by ear"},knowledgeIds:["interval.m3","interval.M3","interval.P4","interval.P5","interval.m6","interval.M6"],activityType:"ear_training",defaultBaseline:.4},{id:"obj-2",title:{he:"יציבות קצב 60–100 BPM",en:"Rhythmic stability 60–100 BPM"},knowledgeIds:["rhythm_pattern.quarters","rhythm_pattern.quarters_eighths","time_signature.4_4"],activityType:"rhythm",defaultBaseline:.4},{id:"obj-3",title:{he:"סולמות מז׳וריים — שתי ידיים",en:"Major scales — both hands"},knowledgeIds:["scale.major","key.c_major","key.g_major"],activityType:"piano",defaultBaseline:.35},{id:"obj-4",title:{he:"בניית משולשים",en:"Building triads"},knowledgeIds:["chord.maj","chord.min","chord.dim","chord.aug"],activityType:"theory",defaultBaseline:.4},{id:"obj-5",title:{he:"דיוק אינטונציה בשירה",en:"Vocal intonation accuracy"},knowledgeIds:["interval.m2","interval.M2","scale.major"],activityType:"singing",defaultBaseline:.35},{id:"obj-6",title:{he:"מרווחים הרמוניים בשמיעה",en:"Harmonic intervals by ear"},knowledgeIds:["interval.m3","interval.M3","interval.P5","interval.P8"],activityType:"ear_training",defaultBaseline:.3},{id:"obj-7",title:{he:"זיהוי סוגי אקורדים בשמיעה",en:"Chord qualities by ear"},knowledgeIds:["chord.maj","chord.min","chord.dim","chord.aug"],activityType:"ear_training",defaultBaseline:.3},{id:"obj-8",title:{he:"זיהוי קדנצות בשמיעה",en:"Cadence recognition by ear"},knowledgeIds:["cadence.authentic","cadence.plagal","cadence.half","cadence.deceptive"],activit
1yType:"ear_training",defaultBaseline:.25},{id:"obj-9",title:{he:"זיהוי סולמות ומודוסים בשמיעה",en:"Scales and modes by ear"},knowledgeIds:["scale.major","scale.natural_minor","scale.harmonic_minor","mode.dorian"],activityType:"ear_training",defaultBaseline:.25},{id:"obj-11",title:{he:"קריאת תווים בחמשה",en:"Staff note reading"},knowledgeIds:["pitch.c","pitch.d","pitch.e","pitch.f","pitch.g","pitch.a","pitch.b"],activityType:"sight_reading",defaultBaseline:.3},{id:"obj-10",title:{he:"סינקופות ומשקל מורכב",en:"Syncopation and compound meter"},knowledgeIds:["rhythm_pattern.syncopation_basic","time_signature.6_8"],activityType:"rhythm",defaultBaseline:.25},{id:"obj-12",title:{he:"כתיבה ובנייה על החמשה",en:"Notation writing & construction"},knowledgeIds:["scale.major","chord.maj","interval.M3","interval.P5"],activityType:"sight_reading",defaultBaseline:.3},{id:"obj-13",title:{he:"ארגון ומיון מושגים מוסיקליים",en:"Organising musical concepts"},knowledgeIds:["interval.P5","interval.m2","chord.maj","chord.min"],activityType:"theory",defaultBaseline:.35},{id:"obj-14",title:{he:"זיהוי חתימות מפתח",en:"Key-signature reading"},knowledgeIds:["key.g_major","key.f_major","key.d_major","key.bb_major"],activityType:"sight_reading",defaultBaseline:.25},{id:"obj-15",title:{he:"קריאת סימני היתק",en:"Reading accidentals"},knowledgeIds:["pitch.c","pitch.d","pitch.f","pitch.g"],activityType:"sight_reading",defaultBaseline:.25},{id:"obj-16",title:{he:"קריאת מלודיה — גובה ומקצב",en:"Melodic reading — pitch & rhythm"},knowledgeIds:["scale.major","key.c_major","key.g_major","pitch.c","pitch.g"],activityType:"sight_reading",defaultBaseline:.2},{id:"obj-17",title:{he:"כתיב סולמות ואקורדים",en:"Spelling scales & chords"},knowledgeIds:["scale.major","scale.natural_minor","chord.maj","chord.min"],activityType:"theory",defaultBaseline:.3},{id:"obj-18",title:{he:"איתור וזיהוי טעויות על החמשה",en:"Locating & error-spotting on the staff"},knowledgeIds:["pitch.c","pitch.g","scale.major"],activityType:"sight_reading",defaultBaseline:.3},{id:"obj-19",title:{he:"הרמוניה פונקציונלית ודרגות",en:"Functional harmony & scale degrees"},knowledgeIds:["cadence.authentic","chord.maj","chord.min","key.c_major"],activityType:"theory",defaultBaseline:.2},{id:"obj-20",title:{he:"זיהוי איכות מרווח בשמיעה",en:"Interval quality by ear"},knowledgeIds:["interval.m2","interval.M2","interval.m3","interval.M3"],activityType:"ear_training",defaultBaseline:.3},{id:"obj-21",title:{he:"הכתבה רתמית",en:"Rhythmic dictation"},knowledgeIds:["rhythm_pattern.quarters","rhythm_pattern.quarters_eighths","time_signature.4_4"],activityType:"rhythm",defaultBaseline:.3},{id:"obj-22",title:{he:"הכתבה מלודית",en:"Melodic dictation"},knowledgeIds:["pitch.c","pitch.d","pitch.e","pitch.f","pitch.g"],activityType:"ear_training",defaultBaseline:.3}];function Cx(n){return Bu.find(e=>e.id===n)??null}function Mx(n,e="he"){var t;return((t=Cx(n))==null?void 0:t.title[e])??n}const W_=14,vy=2,Y_=7,rd=.05;function h1(n,e){const t=new Set(n.map(i=>new Date(i.startedAt).toDateString()));let r=0;const s=new Date(e);for(t.has(s.toDateString())||s.setDate(s.getDate()-1);t.has(s.toDateString());)r+=1,s.setDate(s.getDate()-1);return r}function Q_(n){const e=[];for(const t of n)for(const r of t.runs)for(const s of r.objectiveSignals??[])e.push({objectiveId:s.objectiveId,signal:s.signal,at:new Date(r.startedAt).getTime()});return e}function Z_(n){const e=n.now.getTime(),t=Q_(n.sessions),r=new Map((n.overrides??[]).map(s=>[s.objectiveId,s.mastery]));return Bu.map(s=>{var x;const i=t.filter(b=>b.objectiveId===s.id).sort((b,I)=>b.at-I.at),a=((x=n.baselines)==null?void 0:x[s.id])??s.defaultBaseline;let c=vy,l=a*vy;for(const b of i){const N=.5**(Math.max(0,(e-b.at)/864e5)/W_);c+=N,l+=b.signal*N}const d=l/c,m=e-Y_*864e5,p=i.filter(b=>b.at>=m);let f="flat";if(p.length>0&&i.length>p.length){const b=i.filter(V=>V.at<m),I=b.reduce((V,D)=>V+D.signal,0)/b.length,N=p.reduce((V,D)=>V+D.signal,0)/p.length;N-I>rd?f="up":I-N>rd&&(f="down")}else if(p.length>0){const b=p.reduce((I,N)=>I+N.signal,0)/p.length;b-a>rd?f="up":a-b>rd&&(f="down")}const g=r.get(s.id);return{objectiveId:s.id,objectiveTitle:s.title.he,activityType:s.activityType,mastery:g??d,trend:f,confidence:i.length/(i.length+3),samples:i.length,teacherOverride:g
1!==void 0}})}const Re=(n,e)=>({type:n,targetId:e}),Kn=(n,e,t,r,s)=>({id:`interval.${n}`,kind:"interval",name:{he:t,en:r},symbol:e,data:{semitones:s},relations:[],tags:["ear_training","theory"]}),J_=[Kn("m2","m2","סקונדה קטנה","Minor second",1),Kn("M2","M2","סקונדה גדולה","Major second",2),Kn("m3","m3","טרצה קטנה","Minor third",3),Kn("M3","M3","טרצה גדולה","Major third",4),Kn("P4","P4","קוורטה זכה","Perfect fourth",5),Kn("TT","TT","טריטון","Tritone",6),Kn("P5","P5","קווינטה זכה","Perfect fifth",7),Kn("m6","m6","סקסטה קטנה","Minor sixth",8),Kn("M6","M6","סקסטה גדולה","Major sixth",9),Kn("m7","m7","ספטימה קטנה","Minor seventh",10),Kn("M7","M7","ספטימה גדולה","Major seventh",11),Kn("P8","P8","אוקטבה","Octave",12)],Px=[{id:"scale.major",kind:"scale",name:{he:"סולם מז׳ורי",en:"Major scale"},data:{steps:[2,2,1,2,2,2,1]},relations:[],tags:["theory","piano"]},{id:"scale.natural_minor",kind:"scale",name:{he:"סולם מינורי טבעי",en:"Natural minor scale"},data:{steps:[2,1,2,2,1,2,2]},relations:[Re("related_to","scale.major")],tags:["theory","piano"]},{id:"scale.harmonic_minor",kind:"scale",name:{he:"סולם מינורי הרמוני",en:"Harmonic minor scale"},data:{steps:[2,1,2,2,1,3,1]},relations:[Re("related_to","scale.natural_minor")],tags:["theory","piano"]},{id:"scale.major_pentatonic",kind:"scale",name:{he:"פנטטוני מז׳ורי",en:"Major pentatonic"},data:{steps:[2,2,3,2,3]},relations:[Re("related_to","scale.major")],tags:["theory","improvisation"]}],X_=[{id:"mode.dorian",kind:"mode",name:{he:"מודוס דוריאני",en:"Dorian mode"},data:{steps:[2,1,2,2,2,1,2]},relations:[Re("part_of","scale.major")],tags:["theory","improvisation"]},{id:"mode.mixolydian",kind:"mode",name:{he:"מודוס מיקסולידי",en:"Mixolydian mode"},data:{steps:[2,2,1,2,2,1,2]},relations:[Re("part_of","scale.major")],tags:["theory","improvisation"]}],_r=(n,e,t,r,s,i=[])=>({id:`chord.${n}`,kind:"chord",name:{he:t,en:r},symbol:e,data:{intervals:s},relations:i,tags:["harmony","theory"]}),e5=[_r("maj","maj","אקורד מז׳ורי","Major triad",[0,4,7]),_r("min","min","אקורד מינורי","Minor triad",[0,3,7]),_r("dim","dim","אקורד מוקטן","Diminished triad",[0,3,6]),_r("aug","aug","אקורד מוגדל","Augmented triad",[0,4,8]),_r("dom7","7","ספטאקורד דומיננטי","Dominant seventh",[0,4,7,10],[Re("related_to","chord.maj"),Re("related_to","cadence.authentic")])],t5=[{id:"rhythm_pattern.quarters",kind:"rhythm_pattern",name:{he:"רבעים",en:"Quarter notes"},data:{beatsPerBar:4,bars:1,onsets:[0,1,2,3]},relations:[Re("related_to","time_signature.4_4")],tags:["rhythm"]},{id:"rhythm_pattern.quarters_eighths",kind:"rhythm_pattern",name:{he:"רבעים ושמיניות",en:"Quarters and eighths"},data:{beatsPerBar:4,bars:1,onsets:[0,1,1.5,2,3]},relations:[Re("prerequisite_of","rhythm_pattern.syncopation_basic"),Re("related_to","time_signature.4_4")],tags:["rhythm"]},{id:"rhythm_pattern.syncopation_basic",kind:"rhythm_pattern",name:{he:"סינקופה בסיסית",en:"Basic syncopation"},data:{beatsPerBar:4,bars:1,onsets:[0,1.5,2.5,3]},relations:[Re("related_to","time_signature.4_4")],tags:["rhythm"]}],sd=(n,e,t,r,s)=>({id:`cadence.${n}`,kind:"cadence",name:{he:t,en:r},symbol:e,data:{progression:s},relations:[Re("related_to","concept.functional_harmony")],tags:["harmony"]}),n5=[sd("authentic","V–I","קדנצה אותנטית","Authentic cadence",["V","I"]),sd("plagal","IV–I","קדנצה פלגלית","Plagal cadence",["IV","I"]),sd("half","I–V","חצי קדנצה","Half cadence",["I","V"]),sd("deceptive","V–vi","קדנצה מתעתעת","Deceptive cadence",["V","vi"])],nt=(n,e,t,r,s,i,a,c)=>({id:`key.${n}_${a}`,kind:"key",name:{he:e,en:t},symbol:r,data:{tonicMidiClass:s,scaleId:a==="major"?"scale.major":"scale.natural_minor",accidentals:i},relations:[Re("related_to",c)],tags:["theory","key_signature"]}),r5=[nt("c","דו מז׳ור","C major","C",0,0,"major","key.a_minor"),nt("g","סול מז׳ור","G major","G",7,1,"major","key.e_minor"),nt("d","רה מז׳ור","D major","D",2,2,"major","key.b_minor"),nt("a","לה מז׳ור","A major","A",9,3,"major","key.fs_minor"),nt("e","מי מז׳ור","E major","E",4,4,"major","key.cs_minor"),nt("b","סי מז׳ור","B major","B",11,5,"major","key.gs_minor"),nt("fs","פה דיאז מז׳ור","F-sharp major","F#",6,6,"major","key.ds_minor"),nt("cs","דו דיאז מז׳ור","C-sharp major","C#",1,7,"major","key.as_minor"),nt("f","פה מז׳ור","F major","F",5,-1,"major","key.d_minor"),nt("bb","סי במול מז׳ור","B-flat major","Bb",10,-2,"major","key.g_minor"),nt("eb","מי במול מז׳ור","E-flat major","Eb",3,-3,"major","key.c_minor"),nt("ab","לה במול מז׳ור","A-flat major","Ab",8,-4,"major","key.f_minor"),nt("db","רה במול מז׳ור","D-flat major","Db",1,-5,"major","key.bb_minor"),nt("gb","סול במול מז׳ור","G-flat major","Gb",6,-6,"major","key.eb_minor"),nt("cb","דו במול מז׳ור","C-flat major","Cb",11,-7,"major","key.ab_minor"),nt("a","לה מינור","A minor","Am",9,0,"minor","key.c_major"),nt("e","מי מינור","E minor","Em",4,1,"minor","key.g_major"),nt("b","סי מינור","B minor","Bm",11,2,"minor","key.d_major"),nt("fs","פה דיאז מינור","F-sharp minor","F#m",6,3,"minor","key.a_major"),nt("cs","דו דיאז מינור","C-sharp minor","C#m",1,4,"minor","key.e_major"),nt("gs","סול דיאז מינור","G-sharp minor","G#m",8,5,"minor","key.b_major"),nt("ds","רה דיאז מינור","D-sharp minor","D#m",3,6,"minor","key.fs_major"),nt("as","לה דיאז מינור","A-sharp minor","A#m",10,7,"minor","key.cs_major"),nt("d","רה מינור","D minor","Dm",2,-1,"minor","key.f_major"),nt("g","סול מינור","G minor","Gm",7,-2,"minor","key.bb_major"),nt("c","דו מינור","C minor","Cm",0,-3,"minor","key.eb_major"),nt("f","פה מינור","F minor","Fm",5,-4,"minor","key.ab_major"),nt("bb","סי במול מינור","B-flat minor","Bbm",10,-5,"minor","key.db_major"),nt("eb","מי במול מינור","E-flat minor","Ebm",3,-6,"minor","key.gb_major"),nt("ab","לה במול מינור","A-flat minor","Abm",8,-7,"minor","key.cb_major")],id=(n,e,t,r)=>({id:`time_signature.${n}_${e}`,kind:"time_signature",name:{he:t,en:r},symbol:`${n}/${e}`,data:{beats:n,beatUnit:e},relations:[],tags:["rhythm","theory"]}),s5=[id(2,4,"שני רבעים","Two-four"),id(3,4,"שלושה רבעים","Three-four"),id(4,4,"ארבעה רבעים","Four-four"),id(6,8,"שש שמיניות","Six-eight")],Hn=(n,e,t,r,s=[])=>({id:`concept.${n}`,kind:"concept",name:{he:e,en:t},description:{he:r,en:""},data:{},relations:s,tags:["terminology"]}),i5=[Hn("tempo","טמפו","Tempo","מהירות הפעימה של המוסיקה, נמדדת בפעימות לדקה (BPM)."),Hn("dynamics","דינמיקה","Dynamics","עוצמת הנגינה — מפיאניסימו ועד פורטיסימו."),Hn("legato","לגאטו","Legato","נגינה מקושרת ורציפה, ללא הפסקות בין הצלילים.",[Re("related_to","concept.staccato")]),Hn("staccato","סטקאטו","Staccato","נגינה מנותקת וקצרה של כל צליל.",[Re("related_to","concept.legato")]),Hn("functional_harmony","הרמוניה פונקציונלית","Functional harmony","תפיסת האקורדים לפי תפקידם — טוניקה, סובדומיננטה ודומיננטה.")],bi=(n,e,t,r)=>({id:`pitch.${n}`,kind:"pitch",name:{he:t,en:r},symbol:r,data:{pitchClass:e,letter:n},relations:[],tags:["sight_reading","theory"]}),Uu=[bi("c",0,"דו","C"),bi("d",2,"רה","D"),bi("e",4,"מי","E"),bi("f",5,"פה","F"),bi("g",7,"סול","G"),bi("a",9,"לה","A"),bi("b",11,"סי","B")],m1=[{id:"scale.melodic_minor",kind:"scale",name:{he:"מינור מלודי",en:"Melodic minor scale"},data:{steps:[2,1,2,2,2,2,1]},relations:[Re("related_to","scale.natural_minor"),Re("related_to","scale.harmonic_minor")],tags:["theory","piano"]},{id:"scale.minor_pentatonic",kind:"scale",name:{he:"פנטטוני מינורי",en:"Minor pentatonic"},data:{steps:[3,2,2,3,2]},relations:[Re("related_to","scale.natural_minor"),Re("related_to","scale.major_pentatonic")],tags:["theory","improvisation"]},{id:"scale.blues",kind:"scale",name:{he:"סולם בלוז",en:"Blues scale"},data:{steps:[3,2,1,1,3,2]},relations:[Re("related_to","scale.minor_pentatonic")],tags:["theory","improvisation"]}],a5=[{id:"mode.phrygian",kind:"mode",name:{he:"מודוס פריגי",en:"Phrygian mode"},data:{steps:[1,2,2,2,1,2,2]},relations:[Re("part_of","scale.major")],tags:["theory","improvisation"]},{id:"mode.lydian",kind:"mode",name:{he:"מודוס לידי",en:"Lydian mode"},data:{steps:[2,2,2,1,2,2,1]},relations:[Re("part_of","scale.major")],tags:["theory","improvisation"]},{id:"mode.locrian",kind:"mode",name:{he:"מודוס לוקרי",en:"Locrian mode"},data:{steps:[1,2,2,1,2,2,2]},relations:[Re("part_of","scale.major")],tags:["theory","improvisation"]}],o5=[_r("sus2","sus2","אקורד סוס 2","Suspended second",[0,2,7],[Re("related_to","chord.maj")]),_r("sus4","sus4","אקורד סוס 4","Suspended fourth",[0,5,7],[Re("related_to","chord.maj")]),_r("maj7","maj7","ספטאקורד מז׳ורי גדול","Major seventh",[0,4,7,11],[Re("related_to","chord.maj")]),_r("m7","m7","ספטאקורד מינורי","Minor seventh",[0,3,7,10],[Re("related_to","chord.min")]),_r("m7b5","m7♭5","מינור שבע עם חמישית מוקטנת","Half-diminished seventh",[0,3,6,10],[Re("related_to","chord.dim"),Re("related_to","chord.m7")])],vm=(n,e,t,r,s)=>({id:`cadence.${n}`,kind:"cadence",name:{he:t,en:r},symbol:e,data:{progression:s},relations:[Re("related_to","concept.functional_harmony")],tags:["harmony","progression"]}),c5=[vm("pop","I–V–vi–IV","מהלך פופ קלאסי","Pop progression",["I","V","vi","IV"]),vm("two_five_one","ii–V–I","מהלך שתיים-חמש-אחת","Two-five-one",["ii","V","I"]),vm("fifties","I–vi–IV–V","מהלך שנות החמישים","Fifties progression",["I","vi","IV","V"])],l5=[{id:"rhythm_pattern.six_eight_straight",kind:"rhythm_pattern",name:{he:"שש שמיניות רצופות",en:"Six straight eighths"},data:{beatsPerBar:6,bars:1,onsets:[0,1,2,3,4,5]},relations:[Re("related_to","time_signature.6_8")],tags:["rhythm"]},{id:"rhythm_pattern.compound_accent",kind:"rhythm_pattern",name:{he:"הטעמות משקל מורכב",en:"Compound-meter accents"},data:{beatsPerBar:6,bars:1,onsets:[0,3]},relations:[Re("related_to","time_signature.6_8"),Re("related_to","rhythm_pattern.six_eight_straight")],tags:["rhythm"]},{id:"rhythm_pattern.offbeat",kind:"rhythm_pattern",name:{he:"אופ-ביט — אחרי הפעימה",en:"Offbeat pattern"},data:{beatsPerBar:4,bars:1,onsets:[.5,1.5,2.5,3.5]},relations:[Re("related_to","time_signature.4_4"),Re("related_to","rhythm_pattern.syncopation_basic")],tags:["rhythm"]},{id:"rhythm_pattern.rest_start_syncopation",kind:"rhythm_pattern",name:{he:"סינקופה עם שתיקה בפתיחה",en:"Rest-start syncopation"},data:{beatsPerBar:4,bars:1,onsets:[1,1.5,3]},relations:[Re("related_to","time_signature.4_4"),Re("related_to","rhythm_pattern.syncopation_basic")],tags:["rhythm"]}],d5=[],u5=[Hn("allegro","אלגרו","Allegro","סימון טמפו מהיר ותוסס.",[Re("related_to","concept.tempo")]),Hn("andante","אנדנטה","Andante","סימון טמפו מתון, בקצב הליכה נינוח.",[Re("related_to","concept.tempo")]),Hn("adagio","אדג׳יו","Adagio","סימון טמפו איטי ורגוע.",[Re("related_to","concept.tempo")]),Hn("motif","מוטיב","Motif","תא מלודי או ריתמי קצר המשמש אבן בניין ליצירה."),Hn("phrase","פראזה","Phrase","יחידה מוסיקלית שלמה בעלת משמעות, כמשפט בשפה.",[Re("related_to","concept.motif")]),Hn("verse_chorus","בית ופזמון","Verse and chorus","מבנה שיר נפוץ המבוסס על חילופין בין בית לפזמון.",[Re("related_to","concept.phrase")]),Hn("accent","אקצנט","Accent","הדגשה של צליל או פעימה מסוימת בעוצמה מוגברת.",[Re("related_to","concept.dynamics")])],jn=(n,e,t,r,s)=>({id:`concept.${n}`,kind:"concept",name:{he:t,en:r},symbol:e,data:{},relations:s?[Re("related_to",s)]:[],tags:["terminology","marking"]}),h5=[jn("mark_p","p","חלש (פּיאנוֹ)","Piano (soft)","concept.dynamics"),jn("mark_f","f","חזק (פוֹרְטֶה)","Forte (loud)","concept.dynamics"),jn("mark_mf","mf","חזק במידה (מֶצוֹ־פוֹרְטֶה)","Mezzo-forte (moderately loud)","concept.dynamics"),jn("mark_cresc","cresc.","הולך ומתחזק (קרֶשֶׁנְדוֹ)","Crescendo (getting louder)","concept.dynamics"),jn("mark_dim","dim.","הולך ונחלש (דימינוּאֶנְדוֹ)","Diminuendo (getting softer)","concept.dynamics"),jn("mark_adagio","Adagio","לאט","Slow","concept.tempo"),jn("mark_andante","Andante","בקצב הליכה","Walking pace","concept.tempo"),jn("mark_moderato","Moderato","מתון (בינוני)","Moderate","concept.tempo"),jn("mark_allegro","Allegro","מהיר","Fast","concept.tempo"),jn("mark_presto","Presto","מהיר מאוד","Very fast","concept.tempo"),jn("mark_staccato","staccato","קצר ומנותק","Short / detached","concept.staccato"),jn("mark_legato","legato","מקושר ורציף","Smooth / connected","concept.legato"),jn("mark_accent",">
1","מודגש","Accented / emphasized","concept.accent"),jn("mark_fermata","fermata","החזקה / עצירה","Hold / pause","concept.tempo")];var _x;(_x=m1[0])==null||_x.relations.push(Re("prerequisite_of","scale.blues"));var kx;(kx=m1[1])==null||kx.relations.push(Re("prerequisite_of","scale.blues"));var wx;(wx=Px[0])==null||wx.relations.push(Re("prerequisite_of","mode.lydian"),Re("prerequisite_of","mode.phrygian"),Re("prerequisite_of","mode.locrian"));const m5=[...Uu,...J_,...Px,...X_,...e5,...t5,...n5,...r5,...s5,...i5,...m1,...a5,...o5,...c5,...l5,...d5,...u5,...h5];function hl(n,e){return Ht(n).data.intervals.map(r=>e+r)}function Os(n,e){const t=Ht(n).data,r=[e];let s=e;for(const i of t.steps)s+=i,r.push(s);return r}const p5={I:{offset:0,intervals:[0,4,7]},ii:{offset:2,intervals:[0,3,7]},iii:{offset:4,intervals:[0,3,7]},IV:{offset:5,intervals:[0,4,7]},V:{offset:7,intervals:[0,4,7]},vi:{offset:9,intervals:[0,3,7]},"vii°":{offset:11,intervals:[0,3,6]}};function Gd(n,e){const t=p5[n];if(!t)throw new Error(`Unknown roman numeral: ${n}`);return t.intervals.map(r=>e+t.offset+r)}function f5(n,e){const{progression:t}=Ht(n).data,r=t.map(s=>Gd(s,e));return t[0]!=="I"?[Gd("I",e),...r]:r}function ad(n,e){const t=n-((n-e)%12+12)%12;return Math.abs(t+12-n)<Math.abs(t-n)?t+12:t}function Rx(n,e={}){const t=e.bassCenter??45,r=e.upperCenter??67;let s=null,i=t;return n.map(a=>{const c=[...new Set(a.map(p=>(p%12+12)%12))],l=(a[0]%12+12)%12,d=ad(i,l);i=d;let m;if(s)m=s.map(p=>{let f=ad(p,c[0]);for(const g of c.slice(1)){const x=ad(p,g);Math.abs(x-p)<Math.abs(f-p)&&(f=x)}return f});else{const p=[...c].sort((g,x)=>g-x);let f=r-4;m=p.map(g=>f=ad(f+3,g))}return s=m,[d,...m]})}const g5=new Set(Uu.map(n=>n.data.pitchClass));function Kd(n){return g5.has(n%12)}function cr(n){const e=Uu.find(t=>t.data.pitchClass===n%12);if(!e)throw new Error(`Not a natural pitch: midi ${n}`);return e.id}function Ox(n){const e=Uu.find(t=>t.data.pitchClass===n%12);if(!e)throw new Error(`Not a natural pitch: midi ${n}`);return`${e.data.letter}/${Math.floor(n/12)-1}`}function os(n,e){const t=[];for(let r=n;r<=e;r++)Kd(r)&&t.push(r);return t}const Iy=[{gap:4,duration:"w"},{gap:3,duration:"hd"},{gap:2,duration:"h"},{gap:1.5,duration:"qd"},{gap:1,duration:"q"},{gap:.75,duration:"8d"},{gap:.5,duration:"8"},{gap:.25,duration:"16"}];function y5(n,e){return n.map((t,r)=>{var c;const i=(n[r+1]??e)-t,a=Iy.find(l=>Math.abs(l.gap-i)<.001);return a?a.duration:((c=Iy.find(l=>l.gap<=i))==null?void 0:c.duration)??"16"})}const Dx=["c","d","e","f","g","a","b"],Vx={c:0,d:2,e:4,f:5,g:7,a:9,b:11};function Ra(n,e){const t=Dx.indexOf(n);if(t<0)throw new Error(`Bad letter: ${n}`);return e*7+t}function Lx(n){const e=Math.floor(n/7);return{letter:Dx[(n%7+7)%7],octave:e}}function qx(n){const{letter:e,octave:t}=Lx(n);return(t+1)*12+Vx[e]}function cp(n){return(n.octave+1)*12+Vx[n.letter]+n.accidental}function b5(n){return Ra(n.letter,n.octave)}const x5={[-2]:"bb",[-1]:"b",0:"",1:"#",2:"##"};function Gu(n){return`${n.letter}${x5[n.accidental]}/${n.octave}`}const v5={bb:-2,b:-1,"":0,n:0,"#":1,"##":2};function I5(n){const[e,t]=n.split("/"),r=(e??"").charAt(0).toLowerCase(),s=v5[(e??"").slice(1)]??0;return cp({letter:r,octave:Number(t),accidental:s})}function Ks(n){const e=Math.floor(n/12)-1,t=(n%12+12)%12,r={0:"c",2:"d",4:"e",5:"f",7:"g",9:"a",11:"b"};return r[t]?{letter:r[t],octave:e,accidental:0}:{letter:r[(t-1+12)%12],octave:e,accidental:1}}function _5(n){const e=Math.floor(n/12)-1,t=(n%12+12)%12,r={0:"c",2:"d",4:"e",5:"f",7:"g",9:"a",11:"b"};return r[t]?{letter:r[t],octave:e,accidental:0}:{letter:r[(t+1)%12],octave:e,accidental:-1}}function zx(n,e){return e==="flat"?_5(n):Ks(n)}function Ku(n){return Gu(Ks(n))}function k5(n){return[1,3,6,8,10].includes((n%12+12)%12)}const Fx={treble:Ra("b",4),bass:Ra("d",3),alto:Ra("c",4),tenor:Ra("a",3)};function w5(n,e){return 2-(e-Fx[n])/2}function j5(n,e){return Fx[n]+Math.round((2-e)*2)}function T5(n,e){return w5(n,b5(Ks(e)))}var _y;function te(n,e,t){function r(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(n))return;c._zod.traits.add(n),e(c,l);const d=a.prototype,m=Object.keys(d);for(let p=0;p<m.length;p++){const f=m[p];f in c||(c[f]=d[f].bind(c))}}const s=(t==null?void 0:t.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:n});function a(c){var l;const d=t!=null&&t.Parent?new i:this;r(d,c),(l=d._zod).deferred??(l.deferred=[]);for(const m of d._zod.deferred)m();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>{var l,d;return t!=null&&t.Parent&&c instanceof t.Parent?!0:(d=(l=c==null?void 0:c._zod)==null?void 0:l.traits)==null?void 0:d.has(n)}}),Object.defineProperty(a,"name",{value:n}),a}
1class Va extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $x extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(_y=globalThis).__zod_globalConfig??(_y.__zod_globalConfig={});const p1=globalThis.__zod_globalConfig;function Qr(n){return p1}function Bx(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,s])=>e.indexOf(+r)===-1).map(([r,s])=>s)}function lp(n,e){return typeof e=="bigint"?e.toString():e}function Hu(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function f1(n){return n==null}function g1(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function E5(n,e){const t=n/e,r=Math.round(t),s=Number.EPSILON*Math.max(Math.abs(t),1);return Math.abs(t-r)<s?0:t-r}const ky=Symbol("evaluating");function it(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==ky)return r===void 0&&(r=ky,r=t()),r},set(s){Object.defineProperty(n,e,{value:s})},configurable:!0})}function ea(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function si(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function wy(n){return JSON.stringify(n)}function N5(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ux="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Lc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const S5=Hu(()=>{var n;if(p1.jitless||typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ga(n){if(Lc(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(Lc(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Gx(n){return Ga(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const A5=new Set(["string","number","symbol"]);function Ka(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ii(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function ke(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function C5(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const M5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function P5(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=si(n._zod.def,{get shape(){const a={};for(const c in e){if(!(c in t.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&(a[c]=t.shape[c])}return ea(this,"shape",a),a},checks:[]});return ii(n,i)}function R5(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=si(n._zod.def,{get shape(){const a={...n._zod.def.shape};for(const c in e){if(!(c in t.shape))throw new Error(`Unrecognized key: "${c}"`);e[c]&&delete a[c]}return ea(this,"shape",a),a},checks:[]});return ii(n,i)}function O5(n,e){if(!Ga(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const i=n._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=si(n._zod.def,{get shape(){const i={...n._zod.def.shape,...e};return ea(this,"shape",i),i}});return ii(n,s)}function D5(n,e){if(!Ga(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=si(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return ea(this,"shape",r),r}});return ii(n,t)}function V5(n,e){var r;if((r=n._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const t=si(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e._zod.def.shape};return ea(this,"shape",s),s},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ii(n,t)}function L5(n,e,t){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=si(e._zod.def,{get shape(){const c=e._zod.def.shape,l={...c};if(t)for(const d in t){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(l[d]=n?new n({type:"optional",innerType:c[d]}):c[d])}else for(const d in c)l[d]=n?new n({type:"optional",innerType:c[d]}):c[d];return ea(this,"shape",l),l},checks:[]});return ii(e,a)}function q5(n,e,t){const r=si(e._zod.def,{get shape(){const s=e._zod.def.shape,i={...s};if(t)for(const a in t){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=new n({type:"nonoptional",innerType:s[a]}))}else for(const a in s)i[a]=new n({type:"nonoptional",innerType:s[a]});return ea(this,"shape",i),i}});return ii(e,r)}function Oa(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function z5(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)===!1)return!0;return!1}function Ps(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function od(n){return typeof n=="string"?n:n==null?void 0:n.message}function Zr(n,e,t){var l,d,m,p,f,g;const r=n.message?n.message:od((m=(d=(l=n.inst)==null?void 0:l._zod.def)==null?void 0:d.error)==null?void 0:m.call(d,n))??od((p=e==null?void 0:e.error)==null?void 0:p.call(e,n))??od((f=t.customError)==null?void 0:f.call(t,n))??od((g=t.localeError)==null?void 0:g.call(t,n))??"Invalid input",{inst:s,continue:i,input:a,...c}=n;return c.path??(c.path=[]),c.message=r,e!=null&&e.reportInput&&(c.input=a),c}function y1(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function qc(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Kx=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,lp,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Hx=te("$ZodError",Kx),Wx=te("$ZodError",Kx,{Parent:Error});function F5(n,e=t=>t.message){const t={},r=[];for(const s of n.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:t}}function $5(n,e=t=>t.message){const t={_errors:[]},r=(s,i=[])=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{const c=[...i,...a.path];if(c.length===0)t._errors.push(e(a));else{let l=t,d=0;for(;d<c.length;){const m=c[d];d===c.length-1?(l[m]=l[m]||{_errors:[]},l[m]._errors.push(e(a))):l[m]=l[m]||{_errors:[]},l=l[m],d++}}}};return r(n),t}const b1=n=>(e,t,r,s)=>{const i=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:t,issues:[]},i);if(a instanceof Promise)throw new Va;if(a.issues.length){const c=new((s==null?void 0:s.Err)??n)(a.issues.map(l
vendor: 17,860 bytes, lines 1-3
1=>Zr(l,i,Qr())));throw Ux(c,s==null?void 0:s.callee),c}return a.value},x1=n=>async(e,t,r,s)=>{const i=r?{...r,async:!0}:{async:!0};let a=e._zod.run({value:t,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new((s==null?void 0:s.Err)??n)(a.issues.map(l=>Zr(l,i,Qr())));throw Ux(c,s==null?void 0:s.callee),c}return a.value},Wu=n=>(e,t,r)=>{const s=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:t,issues:[]},s);if(i instanceof Promise)throw new Va;return i.issues.length?{success:!1,error:new(n??Hx)(i.issues.map(a=>Zr(a,s,Qr())))}:{success:!0,data:i.value}},B5=Wu(Wx),Yu=n=>async(e,t,r)=>{const s=r?{...r,async:!0}:{async:!0};let i=e._zod.run({value:t,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new n(i.issues.map(a=>Zr(a,s,Qr())))}:{success:!0,data:i.value}},U5=Yu(Wx),G5=n=>(e,t,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return b1(n)(e,t,s)},K5=n=>(e,t,r)=>b1(n)(e,t,r),H5=n=>async(e,t,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return x1(n)(e,t,s)},W5=n=>async(e,t,r)=>x1(n)(e,t,r),Y5=n=>(e,t,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Wu(n)(e,t,s)},Q5=n=>(e,t,r)=>Wu(n)(e,t,r),Z5=n=>async(e,t,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Yu(n)(e,t,s)},J5=n=>async(e,t,r)=>Yu(n)(e,t,r),X5=/^[cC][0-9a-z]{6,}$/,e8=/^[0-9a-z]+$/,t8=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,n8=/^[0-9a-vA-V]{20}$/,r8=/^[A-Za-z0-9]{27}$/,s8=/^[a-zA-Z0-9_-]{21}$/,i8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,a8=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jy=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,o8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,c8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function l8(){return new RegExp(c8,"u")}const d8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,h8=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,m8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yx=/^[A-Za-z0-9_-]*$/,f8=/^https?$/,g8=/^\+[1-9]\d{6,14}$/,Qx="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",y8=new RegExp(`^${Qx}$`);function Zx(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function b8(n){return new RegExp(`^${Zx(n)}$`)}function x8(n){const e=Zx({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${Qx}T(?:${r})$`)}const v8=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},I8=/^-?\d+$/,Jx=/^-?\d+(?:\.\d+)?$/,_8=/^(?:true|false)$/i,k8=/^[^A-Z]*$/,w8=/^[^a-z]*$/,On=te("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Xx={number:"number",bigint:"bigint",object:"date"},e6=te("$ZodCheckLessThan",(n,e)=>{On.init(n,e);const t=Xx[typeof e.value];n._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),t6=te("$ZodCheckGreaterThan",(n,e)=>{On.init(n,e);const t=Xx[typeof e.value];n._zod.onattach.push(r=>{const s=r._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),j8=te("$ZodCheckMultipleOf",(n,e)=>{On.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):E5(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),T8=te("$ZodCheckNumberFormat",(n,e)=>{var a;On.init(n,e),e.format=e.format||"float64";const t=(a=e.format)==null?void 0:a.includes("int"),r=t?"int":"number",[s,i]=M5[e.format];n._zod.onattach.push(c=>{const l=c._zod.bag;l.format=e.format,l.minimum=s,l.maximum=i,t&&(l.pattern=I8)}),n._zod.check=c=>{const l=c.value;if(t){if(!Number.isInteger(l)){c.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:n});return}if(!Number.isSafeInteger(l)){l>0?c.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):c.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}l<s&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:s,inclusive:!0,inst:n,continue:!e.abort}),l>i&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:n,continue:!e.abort})}}),E8=te("$ZodCheckMaxLength",(n,e)=>{var t;On.init(n,e),(t=n._zod.def).when??(t.when=r=>{const s=r.value;return!f1(s)&&s.length!==void 0}),n._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const s=r.value;if(s.length<=e.maximum)return;const a=y1(s);r.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:n,continue:!e.abort})}}),N8=te("$ZodCheckMinLength",(n,e)=>{var t;On.init(n,e),(t=n._zod.def).when??(t.when=r=>{const s=r.value;return!f1(s)&&s.length!==void 0}),n._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const s=r.value;if(s.length>=e.minimum)return;const a=y1(s);r.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:n,continue:!e.abort})}}),S8=te("$ZodCheckLengthEquals",(n,e)=>{var t;On.init(n,e),(t=n._zod.def).when??(t.when=r=>{const s=r.value;return!f1(s)&&s.length!==void 0}),n._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),n._zod.check=r=>{const s=r.value,i=s.length;if(i===e.length)return;const a=y1(s),c=i>e.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Qu=te("$ZodCheckStringFormat",(n,e)=>{var t,r;On.init(n,e),n._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),A8=te("$ZodCheckRegex",(n,e)=>{Qu.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),C8=te("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=k8),Qu.init(n,e)}),M8=te("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=w8),Qu.init(n,e)}),P8=te("$ZodCheckIncludes",(n,e)=>{On.init(n,e);const t=Ka(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),n._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:n,continue:!e.abort})}}),R8=te("$ZodCheckStartsWith",(n,e)=>{On.init(n,e);const t=new RegExp(`^${Ka(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),O8=te("$ZodCheckEndsWith",(n,e)=>{On.init(n,e);const t=new RegExp(`.*${Ka(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),D8=te("$ZodCheckOverwrite",(n,e)=>{On.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class V8{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
2`).filter(a=>a),s=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(s)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const e=Function,t=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>`  ${i}`)];return new e(...t,s.join(`
3`))}}const L8={major:4,minor:4,patch:3},yt=te("$ZodType",(n,e)=>{var s;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=L8;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const i of r)for(const a of i._zod.onattach)a(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(s=n._zod.deferred)==null||s.push(()=>{n._zod.run=n._zod.parse});else{const i=(c,l,d)=>{let m=Oa(c),p;for(const f of l){if(f._zod.def.when){if(z5(c)||!f._zod.def.when(c))continue}else if(m)continue;const g=c.issues.length,x=f._zod.check(c);if(x instanceof Promise&&(d==null?void 0:d.async)===!1)throw new Va;if(p||x instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await x,c.issues.length!==g&&(m||(m=Oa(c,g)))});else{if(c.issues.length===g)continue;m||(m=Oa(c,g))}}return p?p.then(()=>c):c},a=(c,l,d)=>{if(Oa(c))return c.aborted=!0,c;const m=i(l,r,d);if(m instanceof Promise){if(d.async===!1)throw new Va;return m.then(p=>n._zod.parse(p,d))}return n._zod.parse(m,d)};n._zod.run=(c,l)=>{if(l.skipChecks)return n._zod.parse(c,l);if(l.direction==="backward"){const m=n._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return m instanceof Promise?m.then(p=>a(p,c,l)):a(m,c,l)}const d=n._zod.parse(c,l);if(d instanceof Promise){if(l.async===!1)throw new Va;return d.then(m=>i(m,r,l))}return i(d,r,l)}}it(n,"~standard",()=>({validate:i=>{var a;try{const c=B5(n,i);return c.success?{value:c.data}:{issues:(a=c.error)==null?void 0:a.issues}}catch{return U5(n,i).then(l=>{var d;return l.success?{value:l.data}:{issues:(d=l.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),v1=te("$ZodString",(n,e)=>{var t;yt.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??v8(n._zod.bag),n._zod.parse=(r,s)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),_t=te("$ZodStringFormat",(n,e)=>{Qu.init(n,e),v1.init(n,e)}),q8=te("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=a8),_t.init(n,e)}),z8=te("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=jy(r))}else e.pattern??(e.pattern=jy());_t.init(n,e)}),F8=te("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=o8),_t.init(n,e)}),$8=te("$ZodURL",(n,e)=>{_t.init(n,e),n._zod.check=t=>{var r;try{const s=t.value.trim();if(!e.normalize&&((r=e.protocol)==null?void 0:r.source)===f8.source&&!/^https?:\/\//i.test(s)){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:n,continue:!e.abort});return}const i=new URL(s);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=s;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),B8=te("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=l8()),_t.init(n,e)}),U8=te("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=s8),_t.init(n,e)}),G8=te("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=X5),_t.init(n,e)}),K8=te("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=e8),_t.init(n,e)}),H8=te("$ZodULID",(n,e)=>{e.pattern??(e.pattern=t8),_t.init(n,e)}),W8=te("$ZodXID",(n,e)=>{e.pattern??(e.pattern=n8),_t.init(n,e)}),Y8=te("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=r8),_t.init(n,e)}),Q8=te("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=x8(e)),_t.init(n,e)}),Z8=te("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=y8),_t.init(n,e)}),J8=te("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=b8(e)),_t.init(n,e)}),X8=te("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=i8),_t.init(n,e)}),e9=te("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=d8),_t.init(n,e),n._zod.bag.format="ipv4"}),t9=te("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=u8),_t.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),n9=te("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=h8),_t.init(n,e)}),r9=te("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=m8),_t.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[s,i]=r;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${s}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function n6(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const s9=te("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=p8),_t.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{n6(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function i9(n){if(!Yx.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return n6(t)}const a9=te("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Yx),_t.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{i9(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),o9=te("$ZodE164",(n,e)=>{e.pattern??(e.pattern=g8),_t.init(n,e)});function c9(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const l9=te("$ZodJWT",(n,e)=>{_t.init(n,e),n._zod.check=t=>{c9(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),r6=te("$ZodNumber",(n,e)=>{yt.init(n,e),n._zod.pattern=n._zod.bag.pattern??Jx,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const s=t.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return t;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:s,inst:n,...i?{received:i}:{}}),t}}),d9=te("$ZodNumberFormat",(n,e)=>{T8.init(n,e),r6.init(n,e)}),u9=te("$ZodBoolean",(n,e)=>{yt.init(n,e),n._zod.pattern=_8,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const s=t.value;return typeof s=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:n}),t}}),h9=te("$ZodUnknown",(n,e)=>{yt.init(n,e),n._zod.parse=t=>t}),m9=te("$ZodNever",(n,e)=>{yt.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)}
3);function Ty(n,e,t){n.issues.length&&e.issues.push(...Ps(t,n.issues)),e.value[t]=n.value}const p9=te("$ZodArray",(n,e)=>{yt.init(n,e),n._zod.parse=(t,r)=>{const s=t.value;if(!Array.isArray(s))return t.issues.push({expected:"array",code:"invalid_type",input:s,inst:n}),t;t.value=Array(s.length);const i=[];for(let a=0;a<s.length;a++){const c=s[a],l=e.element._zod.run({value:c,issues:[]},r);l instanceof Promise?i.push(l.then(d=>Ty(d,t,a))):Ty(l,t,a)}return i.length?Promise.all(i).then(()=>t):t}});function Hd(n,e,t,r,s,i){const a=t in r;if(n.issues.length){if(s&&i&&!a)return;e.issues.push(...Ps(t,n.issues))}if(!a&&!s){n.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}n.value===void 0?a&&(e.value[t]=void 0):e.value[t]=n.value}function s6(n){var r,s,i,a;const e=Object.keys(n.shape);for(const c of e)if(!((a=(i=(s=(r=n.shape)==null?void 0:r[c])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const t=C5(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function i6(n,e,t,r,s,i){const a=[],c=s.keySet,l=s.catchall._zod,d=l.def.type,m=l.optin==="optional",p=l.optout==="optional";for(const f in e){if(f==="__proto__"||c.has(f))continue;if(d==="never"){a.push(f);continue}const g=l.run({value:e[f],issues:[]},r);g instanceof Promise?n.push(g.then(x=>Hd(x,t,f,e,m,p))):Hd(g,t,f,e,m,p)}return a.length&&t.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),n.length?Promise.all(n).then(()=>t):t}const f9=te("$ZodObject",(n,e)=>{yt.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const c=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...c};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=Hu(()=>s6(e));it(n._zod,"propValues",()=>{const c=e.shape,l={};for(const d in c){const m=c[d]._zod;if(m.values){l[d]??(l[d]=new Set);for(const p of m.values)l[d].add(p)}}return l});const s=Lc,i=e.catchall;let a;n._zod.parse=(c,l)=>{a??(a=r.value);const d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:n}),c;c.value={};const m=[],p=a.shape;for(const f of a.keys){const g=p[f],x=g._zod.optin==="optional",b=g._zod.optout==="optional",I=g._zod.run({value:d[f],issues:[]},l);I instanceof Promise?m.push(I.then(N=>Hd(N,c,f,d,x,b))):Hd(I,c,f,d,x,b)}return i?i6(m,d,c,l,r.value,n):m.length?Promise.all(m).then(()=>c):c}}),g9=te("$ZodObjectJIT",(n,e)=>{f9.init(n,e);const t=n._zod.parse,r=Hu(()=>s6(e)),s=f=>{var D,T;const g=new V8(["shape","payload","ctx"]),x=r.value,b=M=>{const R=wy(M);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};g.write("const input = payload.value;");const I=Object.create(null);let N=0;for(const M of x.keys)I[M]=`key_${N++}`;g.write("const newResult = {};");for(const M of x.keys){const R=I[M],_=wy(M),j=f[M],w=((D=j==null?void 0:j._zod)==null?void 0:D.optin)==="optional",A=((T=j==null?void 0:j._zod)==null?void 0:T.optout)==="optional";g.write(`const ${R} = ${b(M)};`),w&&A?g.write(`
4        if (${R}.issues.length) {
5          if (${_} in input) {
6            payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
7              ...iss,
8              path: iss.path ? [${_}, ...iss.path] : [${_}]
9            })));
10          }
11        }
12        
13        if (${R}.value === undefined) {
14          if (${_} in input) {
15            newResult[${_}] = undefined;
16          }
17        } else {
18          newResult[${_}] = ${R}.value;
19        }
20        
21      `):w?g.write(`
22        if (${R}.issues.length) {
23          payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
24            ...iss,
25            path: iss.path ? [${_}, ...iss.path] : [${_}]
26          })));
27        }
28        
29        if (${R}.value === undefined) {
30          if (${_} in input) {
31            newResult[${_}] = undefined;
32          }
33        } else {
34          newResult[${_}] = ${R}.value;
35        }
36        
37      `):g.write(`
38        const ${R}_present = ${_} in input;
39        if (${R}.issues.length) {
40          payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
41            ...iss,
42            path: iss.path ? [${_}, ...iss.path] : [${_}]
43          })));
44        }
45        if (!${R}_present && !${R}.issues.length) {
46          payload.issues.push({
47            code: "invalid_type",
48            expected: "nonoptional",
49            input: undefined,
50            path: [${_}]
51          });
52        }
53
54        if (${R}_present) {
55          if (${R}.value === undefined) {
56            newResult[${_}] = undefined;
57          } else {
58            newResult[${_}] = ${R}.value;
59          }
60        }
61
62      `)}g.write("payload.value = newResult;"),g.write("return payload;");const V=g.compile();return(M,R)=>V(f,M,R)};let i;const a=Lc,c=!p1.jitless,d=c&&S5.value,m=e.catchall;let p;n._zod.parse=(f,g)=>{p??(p=r.value);const x=f.value;return a(x)?c&&d&&(g==null?void 0:g.async)===!1&&g.jitless!==!0?(i||(i=s(e.shape)),f=i(f,g),m?i6([],x,f,g,p,n):f):t(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:x,inst:n}),f)}});function Ey(n,e,t,r){for(const i of n)if(i.issues.length===0)return e.value=i.value,e;const s=n.filter(i=>!Oa(i));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(i=>i.issues.map(a=>Zr(a,r,Qr())))}),e)}const a6=te("$ZodUnion",(n,e)=>{yt.init(n,e),it(n._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),it(n._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),it(n._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),it(n._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>g1(s.source)).join("|")})$`)}});const t=e.options.length===1?e.options[0]._zod.run:null;n._zod.parse=(r,s)=>{if(t)return t(r,s);let i=!1;const a=[];for(const c of e.options){const l=c._zod.run({value:r.value,issues:[]},s);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Ey(c,r,n,s)):Ey(a,r,n,s)}}),y9=te("$ZodDiscriminatedUnion",(n,e)=>{e.inclusive=!1,a6.init(n,e);const t=n._zod.parse;it(n._zod,"propValues",()=>{const s={};for(const i of e.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[c,l]of Object.entries(a)){s[c]||(s[c]=new Set);for(const d of l)s[c].add(d)}}return s});const r=Hu(()=>{var a;const s=e.options,i=new Map;for(const c of s){const l=(a=c._zod.propValues)==null?void 0:a[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(c)}"`);for(const d of l){if(i.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);i.set(d,c)}}return i});n._zod.parse=(s,i)=>{const a=s.value;if(!Lc(a))return s.issues.push({code:"invalid_type",expected:"object",input:a,inst:n}),s;const c=r.value.get(a==null?void 0:a[e.discriminator]);return c?c._zod.run(s,i):e.unionFallback||i.direction==="backward"?t(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:a,path:[e.discriminator],inst:n}),s)}}),b9=te("$ZodIntersection",(n,e)=>{yt.init(n,e),n._zod.parse=(t,r)=>{const s=t.value,i=e.left._zod.run({value:s,issues:[]},r),a=e.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,d])=>Ny(t,l,d)):Ny(t,i,a)}});function dp(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(Ga(n)&&Ga(e)){const t=Object.keys(e),r=Object.keys(n).filter(i=>t.indexOf(i)!==-1),s={...n,...e};for(const i of r){const a=dp(n[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};s[i]=a.data}return{valid:!0,data:s}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const s=n[r],i=e[r],a=dp(s,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};t.push(a.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Ny(n,e,t){const r=new Map;let s;for(const c of e.issues)if(c.code==="unrecognized_keys"){s??(s=c);for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else n.issues.push(c);for(const c of t.issues)if(c.code==="unrecognized_keys")for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else n.issues.push(c);const i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&s&&n.issues.push({...s,keys:i}),Oa(n))return n;const a=dp(e.value,t.value);
62if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}const x9=te("$ZodTuple",(n,e)=>{yt.init(n,e);const t=e.items;n._zod.parse=(r,s)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({input:i,inst:n,expected:"tuple",code:"invalid_type"}),r;r.value=[];const a=[],c=Sy(t,"optin"),l=Sy(t,"optout");if(!e.rest){if(i.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:i,inst:n,origin:"array"}),r;i.length>t.length&&r.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:i,inst:n,origin:"array"})}const d=new Array(t.length);for(let m=0;m<t.length;m++){const p=t[m]._zod.run({value:i[m],issues:[]},s);p instanceof Promise?a.push(p.then(f=>{d[m]=f})):d[m]=p}if(e.rest){let m=t.length-1;const p=i.slice(t.length);for(const f of p){m++;const g=e.rest._zod.run({value:f,issues:[]},s);g instanceof Promise?a.push(g.then(x=>Ay(x,r,m))):Ay(g,r,m)}}return a.length?Promise.all(a).then(()=>Cy(d,r,t,i,l)):Cy(d,r,t,i,l)}});function Sy(n,e){for(let t=n.length-1;t>=0;t--)if(n[t]._zod[e]!=="optional")return t+1;return 0}function Ay(n,e,t){n.issues.length&&e.issues.push(...Ps(t,n.issues)),e.value[t]=n.value}function Cy(n,e,t,r,s){for(let i=0;i<t.length;i++){const a=n[i],c=i<r.length;if(a.issues.length){if(!c&&i>=s){e.value.length=i;break}e.issues.push(...Ps(i,a.issues))}e.value[i]=a.value}for(let i=e.value.length-1;i>=r.length&&(t[i]._zod.optout==="optional"&&e.value[i]===void 0);i--)e.value.length=i;return e}const v9=te("$ZodRecord",(n,e)=>{yt.init(n,e),n._zod.parse=(t,r)=>{const s=t.value;if(!Ga(s))return t.issues.push({expected:"record",code:"invalid_type",input:s,inst:n}),t;const i=[],a=e.keyType._zod.values;if(a){t.value={};const c=new Set;for(const d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){c.add(typeof d=="number"?d.toString():d);const m=e.keyType._zod.run({value:d,issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(m.issues.length){t.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>Zr(g,r,Qr())),input:d,path:[d],inst:n});continue}const p=m.value,f=e.valueType._zod.run({value:s[d],issues:[]},r);f instanceof Promise?i.push(f.then(g=>{g.issues.length&&t.issues.push(...Ps(d,g.issues)),t.value[p]=g.value})):(f.issues.length&&t.issues.push(...Ps(d,f.issues)),t.value[p]=f.value)}let l;for(const d in s)c.has(d)||(l=l??[],l.push(d));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:s,inst:n,keys:l})}else{t.value={};for(const c of Reflect.ownKeys(s)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,c))continue;let l=e.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Jx.test(c)&&l.issues.length){const p=e.keyType._zod.run({value:Number(c),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){e.mode==="loose"?t.value[c]=s[c]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>Zr(p,r,Qr())),input:c,path:[c],inst:n});continue}const m=e.valueType._zod.run({value:s[c],issues:[]},r);m instanceof Promise?i.push(m.then(p=>{p.issues.length&&t.issues.push(...Ps(c,p.issues)),t.value[l.value]=p.value})):(m.issues.length&&t.issues.push(...Ps(c,m.issues)),t.value[l.value]=m.value)}}return i.length?Promise.all(i).then(()=>t):t}}),I9=te("$ZodEnum",(n,e)=>{yt.init(n,e);const t=Bx(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(s=>A5.has(typeof s)).map(s=>typeof s=="string"?Ka(s):s.toString()).join("|")})$`),n._zod.parse=(s,i)=>{const a=s.value;return r.has(a)||s.issues.push({code:"invalid_value",values:t,input:a,inst:n}),s}}),_9=te("$ZodLiteral",(n,e)=>{if(yt.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ka(r):r?Ka(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,s)=>{const i=r.value;return t.has(i)||r.issues.push({code:"invalid_value",values:e.values,input:i,inst:n}),r}}),k9=te("$ZodTransform",(n,e)=>{yt.init(n,e),n._zod.optin="optional",n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new $x(n.constructor.name);const s=e.transform(t.value,t);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(a=>(t.value=a,t.fallback=!0,t));if(s instanceof Promise)throw new Va;return t.value=s,t.fallback=!0,t}});function My(n,e){return e===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const o6=te("$ZodOptional",(n,e)=>{yt.init(n,e),n._zod.optin="optional",n._zod.optout="optional",it(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),it(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${g1(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const s=t.value,i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(a=>My(a,s)):My(i,s)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}
vendor: 13,752 bytes, lines 62-64
62),w9=te("$ZodExactOptional",(n,e)=>{o6.init(n,e),it(n._zod,"values",()=>e.innerType._zod.values),it(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),j9=te("$ZodNullable",(n,e)=>{yt.init(n,e),it(n._zod,"optin",()=>e.innerType._zod.optin),it(n._zod,"optout",()=>e.innerType._zod.optout),it(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${g1(t.source)}|null)$`):void 0}),it(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),T9=te("$ZodDefault",(n,e)=>{yt.init(n,e),n._zod.optin="optional",it(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const s=e.innerType._zod.run(t,r);return s instanceof Promise?s.then(i=>Py(i,e)):Py(s,e)}});function Py(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const E9=te("$ZodPrefault",(n,e)=>{yt.init(n,e),n._zod.optin="optional",it(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),N9=te("$ZodNonOptional",(n,e)=>{yt.init(n,e),it(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const s=e.innerType._zod.run(t,r);return s instanceof Promise?s.then(i=>Ry(i,n)):Ry(s,n)}});function Ry(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const S9=te("$ZodCatch",(n,e)=>{yt.init(n,e),n._zod.optin="optional",it(n._zod,"optout",()=>e.innerType._zod.optout),it(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const s=e.innerType._zod.run(t,r);return s instanceof Promise?s.then(i=>(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(a=>Zr(a,r,Qr()))},input:t.value}),t.issues=[],t.fallback=!0),t)):(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(i=>Zr(i,r,Qr()))},input:t.value}),t.issues=[],t.fallback=!0),t)}}),A9=te("$ZodPipe",(n,e)=>{yt.init(n,e),it(n._zod,"values",()=>e.in._zod.values),it(n._zod,"optin",()=>e.in._zod.optin),it(n._zod,"optout",()=>e.out._zod.optout),it(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const i=e.out._zod.run(t,r);return i instanceof Promise?i.then(a=>cd(a,e.in,r)):cd(i,e.in,r)}const s=e.in._zod.run(t,r);return s instanceof Promise?s.then(i=>cd(i,e.out,r)):cd(s,e.out,r)}});function cd(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},t)}const C9=te("$ZodReadonly",(n,e)=>{yt.init(n,e),it(n._zod,"propValues",()=>e.innerType._zod.propValues),it(n._zod,"values",()=>e.innerType._zod.values),it(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),it(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const s=e.innerType._zod.run(t,r);return s instanceof Promise?s.then(Oy):Oy(s)}});function Oy(n){return n.value=Object.freeze(n.value),n}const M9=te("$ZodCustom",(n,e)=>{On.init(n,e),yt.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,s=e.fn(r);if(s instanceof Promise)return s.then(i=>Dy(i,t,r,n));Dy(s,t,r,n)}});function Dy(n,e,t,r){if(!n){const s={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),e.issues.push(qc(s))}}var Vy;class P9{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function R9(){return new P9}(Vy=globalThis).__zod_globalRegistry??(Vy.__zod_globalRegistry=R9());const hc=globalThis.__zod_globalRegistry;function O9(n,e){return new n({type:"string",...ke(e)})}function D9(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...ke(e)})}function Ly(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...ke(e)})}function V9(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(e)})}function L9(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(e)})}function q9(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(e)})}function z9(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(e)})}function F9(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...ke(e)})}function $9(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(e)})}function B9(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(e)})}function U9(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(e)})}function G9(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(e)})}function K9(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(e)})}function H9(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...ke(e)})}function W9(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(e)})}function Y9(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(e)})}function Q9(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(e)})}function Z9(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(e)})}function J9(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(e)})}function X9(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...ke(e)})}function ek(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(e)})}function tk(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...ke(e)})}function nk(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(e)})}function rk(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(e)})}function sk(n,e){return new n({type:"string",format:"date",check:"string_format",...ke(e)})}function ik(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...ke(e)})}function ak(n,e){return new n({type:"string",format:"duration",check:"string_format",...ke(e)})}function ok(n,e){return new n({type:"number",checks:[],...ke(e)})}function ck(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...ke(e)})}function lk(n,e){return new n({type:"boolean",...ke(e)})}function dk(n){return new n({type:"unknown"})}function uk(n,e){return new n({type:"never",...ke(e)})}function qy(n,e){return new e6({check:"less_than",...ke(e),value:n,inclusive:!1})}function Im(n,e){return new e6({check:"less_than",...ke(e),value:n,inclusive:!0})}function zy(n,e){return new t6({check:"greater_than",...ke(e),value:n,inclusive:!1})}function _m(n,e){return new t6({check:"greater_than",...ke(e),value:n,inclusive:!0})}function Fy(n,e){return new j8({check:"multiple_of",...ke(e),value:n})}function c6(n,e){return new E8({check:"max_length",...ke(e),maximum:n})}function Wd(n,e){return new N8({check:"min_length",...ke(e),minimum:n})}function l6(n,e){return new S8({check:"length_equals",...ke(e),length:n})}function hk(n,e){return new A8({check:"string_format",format:"regex",...ke(e),pattern:n})}function mk(n){return new C8({check:"string_format",format:"lowercase",...ke(n)})}function pk(n){return new M8({check:"string_format",format:"uppercase",...ke(n)})}function fk(n,e){return new P8({check:"string_format",format:"includes",...ke(e),includes:n})}function gk(n,e){return new R8({check:"string_format",format:"starts_with",...ke(e),prefix:n})}function yk(n,e){return new O8({check:"string_format",format:"ends_with",...ke(e),suffix:n})}function vo(n){return new D8({check:"overwrite",tx:n})}function bk(n){return vo(e=>e.normalize(n))}function xk(){return vo(n=>n.trim())}function vk(){return vo(n=>n.toLowerCase())}function Ik(){return vo(n=>n.toUpperCase())}function _k(){return vo(n=>N5(n))}function kk(n,e,t){return new n({type:"array",element:e,...ke(t)})}function wk(n,e,t){const r=ke(t);return r.abort??(r.abort=!0),new n({type:"custom",check:"custom",fn:e,...r})}function jk(n,e,t){return new n({type:"custom",check:"custom",fn:e,...ke(t)})}function Tk(n,e){const t=Ek(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(qc(s,r.value,t._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(qc(i))}},n(r.value,r)),e);return t}function Ek(n,e){const t=new On({check:"custom",...ke(e)});return t._zod.check=n,t}function d6(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??hc,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function At(n,e,t={path:[],schemaPath:[]}){var m,p;var r;const s=n._zod.def,i=e.seen.get(n);if(i)return i.count++,t.schemaPath.includes(n)&&(i.cycle=t.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,a);const c=(p=(m=n._zod).toJSONSchema)==null?void 0:p.call(m);if(c)a.schema=c;else{const f={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,a.schema,f);else{const x=a.schema,b=e.processors[s.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);b(n,e,x,f)}const g=n._zod.parent;g&&(a.ref||(a.ref=g),At(g,e,f),e.seen.get(g).isParent=!0)}const l=e.metadataRegistry.get(n);return l&&Object.assign(a.schema,l),e.io==="input"&&vn(n)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(n).schema}function u6(n,e){var a,c,l,d;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const m of n.seen.entries()){const p=(a=n.metadataRegistry.get(m[0]))==null?void 0:a.id;if(p){const f=r.get(p);if(f&&f!==m[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,m[0])}}const s=m=>{var b;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(b=n.external.registry.get(m[0]))==null?void 0:b.id,N=n.external.uri??(D=>D);if(I)return{ref:N(I)};const V=m[1].defId??m[1].schema.id??`schema${n.counter++}`;return m[1].defId=V,{defId:V,ref:`${N("__shared")}#/${p}/${V}`}}if(m[1]===t)return{ref:"#"};const g=`#/${p}/`,x=m[1].schema.id??`__schema${n.counter++}`;return{defId:x,ref:g+x}},i=m=>{if(m[1].schema.$ref)return;const p=m[1],{ref:f,defId:g}=s(m);p.def={...p.schema},g&&(p.defId=g);const x=p.schema;for(const b in x)delete x[b];x.$ref=f};if(n.cycles==="throw")for(const m of n.seen.entries()){const p=m[1];if(p.cycle)throw new Error(`Cycle detected: #/${(c=p.cycle)==null?void 0:c.join("/")}/<root>
63
64Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const m of n.seen.entries()){const p=m[1];if(e===m[0]){i(m);continue}if(n.external){const g=(l=n.external.registry.get(m[0]))==null?void 0:l.id;if(e!==m[0]&&g){i(m);continue}}if((d=n.metadataRegistry.get(m[0]))==null?void 0:d.id){i(m);continue}if(p.cycle){i(m);continue}if(p.count>1&&n.reused==="ref"){i(m);continue}}}function h6(n,e){var c,l,d,m;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const f=n.seen.get(p);if(f.ref===null)return;const g=f.def??f.schema,x={...g},b=f.ref;if(f.ref=null,b){r(b);const N=n.seen.get(b),V=N.schema;if(V.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(V)):Object.assign(g,V),Object.assign(g,x),p._zod.parent===b)for(const T in g)T==="$ref"||T==="allOf"||T in x||delete g[T];if(V.$ref&&N.def)for(const T in g)T==="$ref"||T==="allOf"||T in N.def&&JSON.stringify(g[T])===JSON.stringify(N.def[T])&&delete g[T]}const I=p._zod.parent;if(I&&I!==b){r(I);const N=n.seen.get(I);if(N!=null&&N.schema.$ref&&(g.$ref=N.schema.$ref,N.def))for(const V in g)V==="$ref"||V==="allOf"||V in N.def&&JSON.stringify(g[V])===JSON.stringify(N.def[V])&&delete g[V]}n.override({zodSchema:p,jsonSchema:g,path:f.path??[]})};for(const p of[...n.seen.entries()].reverse())r(p[0]);const s={};
64if(n.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":n.target,(c=n.external)!=null&&c.uri){const p=(l=n.external.registry.get(e))==null?void 0:l.id;if(!p)throw new Error("Schema is missing an `id` property");s.$id=n.external.uri(p)}Object.assign(s,t.def??t.schema);const i=(d=n.metadataRegistry.get(e))==null?void 0:d.id;i!==void 0&&s.id===i&&delete s.id;const a=((m=n.external)==null?void 0:m.defs)??{};for(const p of n.seen.entries()){const f=p[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,a[f.defId]=f.def)}n.external||Object.keys(a).length>0&&(n.target==="draft-2020-12"?s.$defs=a:s.definitions=a);try{const p=JSON.parse(JSON.stringify(s));return Object.defineProperty(p,"~standard",{value:{...e["~standard"],jsonSchema:{input:Yd(e,"input",n.processors),output:Yd(e,"output",n.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function vn(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return vn(r.element,t);if(r.type==="set")return vn(r.valueType,t);if(r.type==="lazy")return vn(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return vn(r.innerType,t);if(r.type==="intersection")return vn(r.left,t)||vn(r.right,t);if(r.type==="record"||r.type==="map")return vn(r.keyType,t)||vn(r.valueType,t);if(r.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:vn(r.in,t)||vn(r.out,t);if(r.type==="object"){for(const s in r.shape)if(vn(r.shape[s],t))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(vn(s,t))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(vn(s,t))return!0;return!!(r.rest&&vn(r.rest,t))}return!1}const Nk=(n,e={})=>t=>{const r=d6({...t,processors:e});return At(n,r),u6(r,n),h6(r,n)},Yd=(n,e,t={})=>r=>{const{libraryOptions:s,target:i}=r??{},a=d6({...s??{},target:i,io:e,processors:t});return At(n,a),u6(a,n),h6(a,n)},Sk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ak=(n,e,t,r)=>{const s=t;s.type="string";const{minimum:i,maximum:a,format:c,patterns:l,contentEncoding:d}=n._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof a=="number"&&(s.maxLength=a),c&&(s.format=Sk[c]??c,s.format===""&&delete s.format,c==="time"&&delete s.format),d&&(s.contentEncoding=d),l&&l.size>0){const m=[...l];m.length===1?s.pattern=m[0].source:m.length>1&&(s.allOf=[...m.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Ck=(n,e,t,r)=>{const s=t,{minimum:i,maximum:a,format:c,multipleOf:l,exclusiveMaximum:d,exclusiveMinimum:m}=n._zod.bag;typeof c=="string"&&c.includes("int")?s.type="integer":s.type="number";const p=typeof m=="number"&&m>=(i??Number.NEGATIVE_INFINITY),f=typeof d=="number"&&d<=(a??Number.POSITIVE_INFINITY),g=e.target==="draft-04"||e.target==="openapi-3.0";p?g?(s.minimum=m,s.exclusiveMinimum=!0):s.exclusiveMinimum=m:typeof i=="number"&&(s.minimum=i),f?g?(s.maximum=d,s.exclusiveMaximum=!0):s.exclusiveMaximum=d:typeof a=="number"&&(s.maximum=a),typeof l=="number"&&(s.multipleOf=l)},Mk=(n,e,t,r)=>{t.type="boolean"},Pk=(n,e,t,r)=>{t.not={}},Rk=(n,e,t,r)=>{},Ok=(n,e,t,r)=>{const s=n._zod.def,i=Bx(s.entries);i.every(a=>typeof a=="number")&&(t.type="number"),i.every(a=>typeof a=="string")&&(t.type="string"),t.enum=i},Dk=(n,e,t,r)=>{const s=n._zod.def,i=[];for(const a of s.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];t.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[a]:t.const=a}else i.every(a=>typeof a=="number")&&(t.type="number"),i.every(a=>
64typeof a=="string")&&(t.type="string"),i.every(a=>typeof a=="boolean")&&(t.type="boolean"),i.every(a=>a===null)&&(t.type="null"),t.enum=i},Vk=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Lk=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},qk=(n,e,t,r)=>{const s=t,i=n._zod.def,{minimum:a,maximum:c}=n._zod.bag;typeof a=="number"&&(s.minItems=a),typeof c=="number"&&(s.maxItems=c),s.type="array",s.items=At(i.element,e,{...r,path:[...r.path,"items"]})},zk=(n,e,t,r)=>{var d;const s=t,i=n._zod.def;s.type="object",s.properties={};const a=i.shape;for(const m in a)s.properties[m]=At(a[m],e,{...r,path:[...r.path,"properties",m]});const c=new Set(Object.keys(a)),l=new Set([...c].filter(m=>{const p=i.shape[m]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));l.size>0&&(s.required=Array.from(l)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=At(i.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Fk=(n,e,t,r)=>{const s=n._zod.def,i=s.inclusive===!1,a=s.options.map((c,l)=>At(c,e,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?t.oneOf=a:t.anyOf=a},$k=(n,e,t,r)=>{const s=n._zod.def,i=At(s.left,e,{...r,path:[...r.path,"allOf",0]}),a=At(s.right,e,{...r,path:[...r.path,"allOf",1]}),c=d=>"allOf"in d&&Object.keys(d).length===1,l=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];t.allOf=l},Bk=(n,e,t,r)=>{const s=t,i=n._zod.def;s.type="array";const a=e.target==="draft-2020-12"?"prefixItems":"items",c=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((f,g)=>At(f,e,{...r,path:[...r.path,a,g]})),d=i.rest?At(i.rest,e,{...r,path:[...r.path,c,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(s.prefixItems=l,d&&(s.items=d)):e.target==="openapi-3.0"?(s.items={anyOf:l},d&&s.items.anyOf.push(d),s.minItems=l.length,d||(s.maxItems=l.length)):(s.items=l,d&&(s.additionalItems=d));const{minimum:m,maximum:p}=n._zod.bag;typeof m=="number"&&(s.minItems=m),typeof p=="number"&&(s.maxItems=p)},Uk=(n,e,t,r)=>{const s=t,i=n._zod.def;s.type="object";const a=i.keyType,c=a._zod.bag,l=c==null?void 0:c.patterns;if(i.mode==="loose"&&l&&l.size>0){const m=At(i.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const p of l)s.patternProperties[p.source]=m}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(s.propertyNames=At(i.keyType,e,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=At(i.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const d=a._zod.values;if(d){const m=[...d].filter(p=>typeof p=="string"||typeof p=="number");m.length>0&&(s.required=m)}},Gk=(n,e,t,r)=>{const s=n._zod.def,i=At(s.innerType,e,r),a=e.seen.get(n);e.target==="openapi-3.0"?(a.ref=s.innerType,t.nullable=!0):t.anyOf=[i,{type:"null"}]},Kk=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType},Hk=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType,t.default=JSON.parse(JSON.stringify(s.defaultValue))},Wk=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Yk=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType;let a;try{a=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a},Qk=(n,e,t,r)=>{const s=n._zod.def,i=s.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?i?s.out:s.in:s.out;At(a,e,r);const c=e.seen.get(n);c.ref=a},Zk=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType,t.readOnly=!0},m6=(n,e,t,r)=>{const s=n._zod.def;At(s.innerType,e,r);const i=e.seen.get(n);i.ref=s.innerType},Jk=te("ZodISODateTime",(n,e)=>{Q8.init(n,e),jt.init(n,e)});function Xk(n){return rk(Jk,n)}const ew=te("ZodISODate",(n,e)=>{Z8.init(n,e),jt.init(n,e)});function tw(n){return sk(ew,n)}const nw=te("ZodISOTime",(n,e)=>{J8.init(n,e),jt.init(n,e)});function rw(n){return ik(nw,n)}const sw=te("ZodISODuration",(n,e)=>{X8.init(n,e),jt.init(n,e)});function iw(n){return ak(sw,n)}const aw=(n,e)=>{Hx.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>$5(n,t)},flatten:{value:t=>F5(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,lp,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,lp,2)}},isEmpty:{get(){return n.issues.length===0}}})},er=te("ZodError",aw,{Parent:Error}),ow=b1(er),cw=x1(er),lw=Wu(er),dw=Yu(er),uw=G5(er),hw=K5(er),mw=H5(er),pw=W5(er),fw=Y5(er),gw=Q5(er),yw=Z5(er),bw=J5(er),$y=new WeakMap;function ml(n,e,t){const r=Object.getPrototypeOf(n);let s=$y.get(r);if(s||(s=new Set,$y.set(r,s)),!s.has(e)){s.add(e);for(const i in t){const a=t[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const c=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const kt=te("ZodType",(n,e)=>(yt.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:Yd(n,"input"),output:Yd(n,"output")}}),n.toJSONSchema=Nk(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.parse=(t,r)=>ow(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>lw(n,t,r),n.parseAsync=async(t,r)=>cw(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>dw(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>uw(n,t,r),n.decode=(t,r)=>hw(n,t,r),n.encodeAsync=async(t,r)=>mw(n,t,r),n.decodeAsync=async(t,r)=>pw(n,t,r),n.safeEncode=(t,r)=>fw(n,t,r),n.safeDecode=(t,r)=>gw(n,t,r),n.safeEncodeAsync=async(t,r)=>yw(n,t,r),n.safeDecodeAsync=async(t,r)=>bw(n,t,r),ml(n,"ZodType",{check(...t){const r=this.def;return this.clone(si(r,{checks:[...r.checks??[],...t.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,r){return ii(this,t,r)},brand(){return this},register(t,r){return t.add(this,r),this}
64,refine(t,r){return this.check(uj(t,r))},superRefine(t,r){return this.check(hj(t,r))},overwrite(t){return this.check(vo(t))},optional(){return Ky(this)},exactOptional(){return Xw(this)},nullable(){return Hy(this)},nullish(){return Ky(Hy(this))},nonoptional(t){return ij(this,t)},array(){return Te(this)},or(t){return y6([this,t])},and(t){return Hw(this,t)},transform(t){return Wy(this,Zw(t))},default(t){return nj(this,t)},prefault(t){return sj(this,t)},catch(t){return oj(this,t)},pipe(t){return Wy(this,t)},readonly(){return dj(this)},describe(t){const r=this.clone();return hc.add(r,{description:t}),r},meta(...t){if(t.length===0)return hc.get(this);const r=this.clone();return hc.add(r,t[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t){return t(this)}}),Object.defineProperty(n,"description",{get(){var t;return(t=hc.get(n))==null?void 0:t.description},configurable:!0}),n)),p6=te("_ZodString",(n,e)=>{v1.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(r,s,i)=>Ak(n,r,s);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,ml(n,"_ZodString",{regex(...r){return this.check(hk(...r))},includes(...r){return this.check(fk(...r))},startsWith(...r){return this.check(gk(...r))},endsWith(...r){return this.check(yk(...r))},min(...r){return this.check(Wd(...r))},max(...r){return this.check(c6(...r))},length(...r){return this.check(l6(...r))},nonempty(...r){return this.check(Wd(1,...r))},lowercase(r){return this.check(mk(r))},uppercase(r){return this.check(pk(r))},trim(){return this.check(xk())},normalize(...r){return this.check(bk(...r))},toLowerCase(){return this.check(vk())},toUpperCase(){return this.check(Ik())},slugify(){return this.check(_k())}})}),xw=te("ZodString",(n,e)=>{v1.init(n,e),p6.init(n,e),n.email=t=>n.check(D9(vw,t)),n.url=t=>n.check(F9(Iw,t)),n.jwt=t=>n.check(nk(Dw,t)),n.emoji=t=>n.check($9(_w,t)),n.guid=t=>n.check(Ly(By,t)),n.uuid=t=>n.check(V9(ld,t)),n.uuidv4=t=>n.check(L9(ld,t)),n.uuidv6=t=>n.check(q9(ld,t)),n.uuidv7=t=>n.check(z9(ld,t)),n.nanoid=t=>n.check(B9(kw,t)),n.guid=t=>n.check(Ly(By,t)),n.cuid=t=>n.check(U9(ww,t)),n.cuid2=t=>n.check(G9(jw,t)),n.ulid=t=>n.check(K9(Tw,t)),n.base64=t=>n.check(X9(Pw,t)),n.base64url=t=>n.check(ek(Rw,t)),n.xid=t=>n.check(H9(Ew,t)),n.ksuid=t=>n.check(W9(Nw,t)),n.ipv4=t=>n.check(Y9(Sw,t)),n.ipv6=t=>n.check(Q9(Aw,t)),n.cidrv4=t=>n.check(Z9(Cw,t)),n.cidrv6=t=>n.check(J9(Mw,t)),n.e164=t=>n.check(tk(Ow,t)),n.datetime=t=>n.check(Xk(t)),n.date=t=>n.check(tw(t)),n.time=t=>n.check(rw(t)),n.duration=t=>n.check(iw(t))});function G(n){return O9(xw,n)}const jt=te("ZodStringFormat",(n,e)=>{_t.init(n,e),p6.init(n,e)}),vw=te("ZodEmail",(n,e)=>{F8.init(n,e),jt.init(n,e)}),By=te("ZodGUID",(n,e)=>{q8.init(n,e),jt.init(n,e)}),ld=te("ZodUUID",(n,e)=>{z8.init(n,e),jt.init(n,e)}),Iw=te("ZodURL",(n,e)=>{$8.init(n,e),jt.init(n,e)}),_w=te("ZodEmoji",(n,e)=>{B8.init(n,e),jt.init(n,e)}),kw=te("ZodNanoID",(n,e)=>{U8.init(n,e),jt.init(n,e)}),ww=te("ZodCUID",(n,e)=>{G8.init(n,e),jt.init(n,e)}),jw=te("ZodCUID2",(n,e)=>{K8.init(n,e),jt.init(n,e)}),Tw=te("ZodULID",(n,e)=>{H8.init(n,e),jt.init(n,e)}),Ew=te("ZodXID",(n,e)=>{W8.init(n,e),jt.init(n,e)}),Nw=te("ZodKSUID",(n,e)=>{Y8.init(n,e),jt.init(n,e)}),Sw=te("ZodIPv4",(n,e)=>{e9.init(n,e),jt.init(n,e)}),Aw=te("ZodIPv6",(n,e)=>{t9.init(n,e),jt.init(n,e)}),Cw=te("ZodCIDRv4",(n,e)=>{n9.init(n,e),jt.init(n,e)}),Mw=te("ZodCIDRv6",(n,e)=>{r9.init(n,e),jt.init(n,e)}),Pw=te("ZodBase64",(n,e)=>{s9.init(n,e),jt.init(n,e)}),Rw=te("ZodBase64URL",(n,e)=>{a9.init(n,e),jt.init(n,e)}),Ow=te("ZodE164",(n,e)=>{o9.init(n,e),jt.init(n,e)}),Dw=te("ZodJWT",(n,e)=>{l9.init(n,e),jt.init(n,e)}),f6=te("ZodNumber",(n,e)=>{r6.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(r,s,i)=>Ck(n,r,s),ml(n,"ZodNumber",{gt(r,s){return this.check(zy(r,s))},gte(r,s){return this.check(_m(r,s))},min(r,s){return this.check(_m(r,s))},lt(r,s){return this.check(qy(r,s))},lte(r,s){return this.check(Im(r,s))},max(r,s){return this.check(Im(r,s))},int(r){return this.check(Uy(r))},safe(r){return this.check(Uy(r))},positive(r){return this.check(zy(0,r))},nonnegative(r){return this.check(_m(0,r))},negative(r){return this.check(qy(0,r))},nonpositive(r){return this.check(Im(0,r))},multipleOf(r,s){return this.check(Fy(r,s))},step(r,s){return this.check(Fy(r,s))},finite(){return this}});const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function B(n){return ok(f6,n)}const Vw=te("ZodNumberFormat",(n,e)=>{d9.init(n,e),f6.init(n,e)});function Uy(n){return ck(Vw,n)}const Lw=te("ZodBoolean",(n,e)=>{u9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Mk(n,t,r)});function mn(n){return lk(Lw,n)}const qw=te("ZodUnknown",(n,e)=>{h9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Rk()});function up(){return dk(qw)}const zw=te("ZodNever",(n,e)=>{m9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Pk(n,t,r)});function Fw(n){return uk(zw,n)}const $w=te("ZodArray",(n,e)=>{p9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>qk(n,t,r,s),n.element=e.element,ml(n,"ZodArray",{min(t,r){return this.check(Wd(t,r))},nonempty(t){return this.check(Wd(1,t))},max(t,r){return this.check(c6(t,r))},length(t,r){return this.check(l6(t,r))},unwrap(){return this.element}})});function Te(n,e){return kk($w,n,e)}const Bw=te("ZodObject",(n,e)=>{g9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>zk(n,t,r,s),it(n,"shape",()=>e.shape),ml(n,"ZodObject",{keyof(){return Le(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:up()})},loose(){return this.clone({...this._zod.def,catchall:up()})},strict(){return this.clone({...this._zod.def,catchall:Fw()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return O5(this,t)},safeExtend(t){return D5(this,t)},merge(t){return V5(this,t)},pick(t){return P5(this,t)},omit(t){return R5(this,t)},partial(...t){return L5(b6,this,t[0])},required(...t){return q5(x6,this,t[0])}})});function ue(n,e){const t={type:"object",shape:n??{},...ke(e)};return new Bw(t)}const g6=te("ZodUnion",(n,e)=>{a6.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Fk(n,t,r,s),n.options=e.options});function y6(n,e){return new g6({type:"union",options:n,...ke(e)})}const Uw=te("ZodDiscriminatedUnion",(n,e)=>{g6.init(n,e),y9.init(n,e)});function Gw(n,e,t){return new Uw({type:"union",options:e,discriminator:n,...ke(t)})}const Kw=te("ZodIntersection",(n,e)=>{b9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>$k(n,t,r,s)});function Hw(n,e){return new Kw({type:"intersection",left:n,right:e})}const Ww=te("ZodTuple",(n,e)=>{x9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Bk(n,t,r,s),n.rest=t=>n.clone({...n._zod.def,rest:t})});function Io(n,e,t){const r=e instanceof yt,s=r?t:e,i=r?e:null;return new Ww({type:"tuple",items:n,rest:i,...ke(s)})}const Gy=te("ZodRecord",(n,e)=>{v9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Uk(n,t,r,s),n.keyType=e.keyType,n.valueType=e.valueType});function hp(n,e,t){return!e||!e._zod?new Gy({type:"record",keyType:G(),valueType:n,...ke(e)}):new Gy({type:"record",keyType:n,valueType:e,...ke(t)})}const mp=te("ZodEnum",(n,e)=>{I9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(r,s,i)=>Ok(n,r,s),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,s)=>{const i={};for(const a of r)if(t.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);
64return new mp({...e,checks:[],...ke(s),entries:i})},n.exclude=(r,s)=>{const i={...e.entries};for(const a of r)if(t.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new mp({...e,checks:[],...ke(s),entries:i})}});function Le(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new mp({type:"enum",entries:t,...ke(e)})}const Yw=te("ZodLiteral",(n,e)=>{_9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Dk(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function sn(n,e){return new Yw({type:"literal",values:Array.isArray(n)?n:[n],...ke(e)})}const Qw=te("ZodTransform",(n,e)=>{k9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Lk(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new $x(n.constructor.name);t.addIssue=i=>{if(typeof i=="string")t.issues.push(qc(i,t.value,e));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=t.value),a.inst??(a.inst=n),t.issues.push(qc(a))}};const s=e.transform(t.value,t);return s instanceof Promise?s.then(i=>(t.value=i,t.fallback=!0,t)):(t.value=s,t.fallback=!0,t)}});function Zw(n){return new Qw({type:"transform",transform:n})}const b6=te("ZodOptional",(n,e)=>{o6.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>m6(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function Ky(n){return new b6({type:"optional",innerType:n})}const Jw=te("ZodExactOptional",(n,e)=>{w9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>m6(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function Xw(n){return new Jw({type:"optional",innerType:n})}const ej=te("ZodNullable",(n,e)=>{j9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Gk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function Hy(n){return new ej({type:"nullable",innerType:n})}const tj=te("ZodDefault",(n,e)=>{T9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Hk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function nj(n,e){return new tj({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Gx(e)}})}const rj=te("ZodPrefault",(n,e)=>{E9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Wk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function sj(n,e){return new rj({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Gx(e)}})}const x6=te("ZodNonOptional",(n,e)=>{N9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Kk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function ij(n,e){return new x6({type:"nonoptional",innerType:n,...ke(e)})}const aj=te("ZodCatch",(n,e)=>{S9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Yk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function oj(n,e){return new aj({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const cj=te("ZodPipe",(n,e)=>{A9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Qk(n,t,r,s),n.in=e.in,n.out=e.out});function Wy(n,e){return new cj({type:"pipe",in:n,out:e})}const lj=te("ZodReadonly",(n,e)=>{C9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Zk(n,t,r,s),n.unwrap=()=>n._zod.def.innerType});function dj(n){return new lj({type:"readonly",innerType:n})}const v6=te("ZodCustom",(n,e)=>{M9.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,r,s)=>Vk(n,t)});function I6(n,e){return wk(v6,n??(()=>!0),e)}function uj(n,e={}){return jk(v6,n,e)}function hj(n,e){return Tk(n,e)}const Yy=1,Qy=ue({he:G(),en:G()}),mj=ue({type:Le(["prerequisite_of","part_of","related_to"]),targetId:G()}),pj=["interval","scale","mode","chord","rhythm_pattern","cadence","key","time_signature","pitch","concept"],fj=Le(pj),gj=/^[a-z_]+\.[a-z0-9_]+$/,yj=ue({semitones:B().int().min(0).max(24)}),bj=ue({steps:Te(B().int().positive())}),xj=ue({intervals:Te(B().int()).refine(n=>n.length===0||n[0]===0,{message:"chord intervals must start at 0 (root)"})}),vj=ue({beatsPerBar:B().int().min(1),bars:B().int().min(1),onsets:Te(B().min(0))}),Ij=ue({progression:Te(G()).min(1)}
64),_j=ue({tonicMidiClass:B().int().min(0).max(11),scaleId:G(),accidentals:B().int()}),kj=ue({beats:B().int().min(1),beatUnit:y6([sn(1),sn(2),sn(4),sn(8),sn(16)])}),wj=ue({pitchClass:B().int().min(0).max(11),letter:G().regex(/^[a-g]$/)}),Zy=hp(G(),up()),yr={id:G().regex(gj,"id must match /^[a-z_]+\\.[a-z0-9_]+$/"),kind:fj,name:Qy,symbol:G().optional(),description:Qy.optional(),relations:Te(mj),tags:Te(G())};function Jy(n){const e=n.indexOf(".");return e===-1?n:n.slice(0,e)}const jj=Gw("kind",[ue({...yr,kind:sn("interval"),data:yj}),ue({...yr,kind:sn("scale"),data:bj}),ue({...yr,kind:sn("mode"),data:Zy}),ue({...yr,kind:sn("chord"),data:xj}),ue({...yr,kind:sn("rhythm_pattern"),data:vj}),ue({...yr,kind:sn("cadence"),data:Ij}),ue({...yr,kind:sn("key"),data:_j}),ue({...yr,kind:sn("time_signature"),data:kj}),ue({...yr,kind:sn("pitch"),data:wj}),ue({...yr,kind:sn("concept"),data:Zy})]).superRefine((n,e)=>{Jy(n.id)!==n.kind&&e.addIssue({code:"custom",message:`id prefix must equal kind ('${Jy(n.id)}' !== '${n.kind}')`,path:["id"]})}),Tj=ue({schemaVersion:B(),source:G(),exportedAt:G(),entities:Te(jj)});function Xy(n){let e=0;for(const t of n)e+=t;return e}function Ej(n,e){const t=[];if(typeof n!="object"||n===null||Array.isArray(n))return{ok:!1,issues:[{entityId:null,level:"error",message:"document must be an object"}],document:null};const r=n;if(r.schemaVersion!==Yy)return t.push({entityId:null,level:"error",message:`unsupported schemaVersion: expected ${Yy}, got ${JSON.stringify(r.schemaVersion)}`}),{ok:!1,issues:t,document:null};if(typeof r.source!="string"&&t.push({entityId:null,level:"error",message:"missing or invalid field: source"}),typeof r.exportedAt!="string"&&t.push({entityId:null,level:"error",message:"missing or invalid field: exportedAt"}),Array.isArray(r.entities)||t.push({entityId:null,level:"error",message:"missing or invalid field: entities"}),t.length>0)return{ok:!1,issues:t,document:null};const s=Tj.safeParse(r);if(!s.success){for(const d of s.error.issues){const m=d.path;let p=null;if(m[0]==="entities"&&typeof m[1]=="number"){const f=r.entities,g=Array.isArray(f)?f[m[1]]:void 0;if(g&&typeof g=="object"&&"id"in g){const x=g.id;p=typeof x=="string"?x:null}}t.push({entityId:p,level:"error",message:`${m.join(".")}: ${d.message}`})}return{ok:!1,issues:t,document:null}}const i=s.data,a=new Set;for(const d of i.entities)a.has(d.id)&&t.push({entityId:d.id,level:"error",message:`duplicate id in document: ${d.id}`}),a.add(d.id);const c=new Set([...e,...i.entities.map(d=>d.id)]);for(const d of i.entities)for(const m of d.relations)c.has(m.targetId)||t.push({entityId:d.id,level:"error",message:`relation targetId not found: ${m.targetId}`});for(const d of i.entities){if(d.kind==="scale"){const m=d.data;Xy(m.steps)!==12&&t.push({entityId:d.id,level:"warning",message:`scale steps sum to ${Xy(m.steps)}, expected 12`})}d.relations.length===0&&d.tags.length===0&&t.push({entityId:d.id,level:"warning",message:"isolated entity: no relations and no tags"})}const l=!t.some(d=>d.level==="error");return{ok:l,issues:t,document:l?i:null}}const Nj=["name","symbol","description","data","relations","tags"];function pp(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(n===null||e===null)return n===e;if(typeof n!="object"||typeof e!="object")return!1;if(Array.isArray(n)||Array.isArray(e)){if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let a=0;a<n.length;a++)if(!pp(n[a],e[a]))return!1;return!0}const t=n,r=e,s=Object.keys(t),i=Object.keys(r);if(s.length!==i.length)return!1;for(const a of s)if(!pp(t[a],r[a]))return!1;return!0}function Sj(n,e){const t=new Map;for(const c of n)t.set(c.id,c);const r=[],s=[],i=[];let a=0;for(const c of e){const l=t.get(c.id);if(!l){r.push(c);continue}if(l.kind!==c.kind){i.push({incoming:c,reason:"kind-changed"});continue}const d=Nj.filter(m=>!pp(l[m],c[m]));d.length===0?a+=1:s.push({incoming:c,changedFields:d})}return{adds:r,updates:s,unchangedCount:a,conflicts:i}}const Zu=new Map(m5.map(n=>[n.id,n]));function Ht(n){const e=Zu.get(n);if(!e)throw new Error(`Unknown knowledge object: ${n}`);return e}function pn(n){return Zu.get(n)??null}function Vt(n){const e=[...Zu.values()];return n?e.filter(t=>t.kind===n):e}function qe(n,e="he"){return(typeof n=="string"?Ht(n):n).name[e]}function Aj(n){const e=[];for(const t of Ht(n).relations){const r=Zu.get(t.targetId);r&&e.push({type:t.type,object:r})}return e}function _6(n){return Ht(`interval.${n}`)}function Cj(n){return _6(n).data.semitones}function pl(n,e="he"){return _6(n).name[e]}function I1(n){return Bu.map(e=>({objectiveId:e.id,title:e.title,category:e.activityType,activityIds:n.filter(t=>t.parameters.objectiveId===e.id).map(t=>
64t.id)})).filter(e=>e.activityIds.length>0)}function k6(n,e){const t=new Set(n),r=new Set;for(const s of e)t.has(s.objectiveId)&&s.activityIds.forEach(i=>r.add(i));return[...r]}function Mj(n){const e=new Set(n),t=new Set;for(const r of Bu)e.has(r.id)&&r.knowledgeIds.forEach(s=>t.add(s));return[...t]}function _1(n,e){const t=new Map(e.map(r=>[r.objectiveId,r]));return n.map(r=>{var s;return(s=t.get(r))==null?void 0:s.title.he}).filter(r=>!!r)}const w6=[{id:"path.ear_foundations",title:{he:"יסודות פיתוח השמיעה",en:"Ear training foundations"},description:{he:"מזיהוי מרווחים ועד קדנצות — הצעד הראשון לאוזן של מוסיקאי",en:"From intervals to cadences — the first step toward a musician’s ear"},steps:[{objectiveId:"obj-1",masteryThreshold:.6},{objectiveId:"obj-6",masteryThreshold:.6},{objectiveId:"obj-7",masteryThreshold:.6},{objectiveId:"obj-8",masteryThreshold:.55}]},{id:"path.rhythm_solid",title:{he:"מקצב איתן",en:"Solid rhythm"},description:{he:"פעימה יציבה, תבניות, סינקופות ומשקלים מורכבים",en:"Steady pulse, patterns, syncopation and compound meters"},steps:[{objectiveId:"obj-2",masteryThreshold:.6},{objectiveId:"obj-10",masteryThreshold:.6}]},{id:"path.harmony_intro",title:{he:"מבוא להרמוניה",en:"Introduction to harmony"},description:{he:"בניית אקורדים, איכויות והקשרים — הבסיס לחשיבה הרמונית",en:"Chord construction, qualities and context — the basis of harmonic thinking"},steps:[{objectiveId:"obj-4",masteryThreshold:.6},{objectiveId:"obj-7",masteryThreshold:.55},{objectiveId:"obj-8",masteryThreshold:.55}]}];function j6(n){return w6.find(e=>e.id===n)??null}function k1(n,e){const t=i=>{var a;return((a=e.find(c=>c.objectiveId===i))==null?void 0:a.mastery)??0};let r=0,s=null;for(const i of n.steps)if(t(i.objectiveId)>=i.masteryThreshold)r+=1;else{s=i.objectiveId;break}return{path:n,completedSteps:r,totalSteps:n.steps.length,percent:n.steps.length?r/n.steps.length:0,currentObjectiveId:s}}const Pj=.75,Rj=10;function Oj(n,e,t){const r=new Map;for(const i of e)for(const a of i.runs)for(const c of a.objectiveSignals??[]){const l=new Date(a.startedAt).getTime();r.set(c.objectiveId,Math.max(r.get(c.objectiveId)??0,l))}const s=t.getTime()-Rj*864e5;return n.filter(i=>{const a=r.get(i.objectiveId);return i.mastery>=Pj&&a!==void 0&&a<s})}const Qd=new Map;
64function Dj(n){if(Qd.has(n.typeId))throw new Error(`ActivityType already registered: ${n.typeId}`);Qd.set(n.typeId,n)}function w1(n){const e=Qd.get(n);if(!e)throw new Error(`Unknown ActivityType: ${n}`);return e}function j1(n){return Qd.has(n)}function Vj(n,e,t){const r=w1(n),s=r.paramsSchema.parse(e),i=r.answerSchema.parse(t.payload);return r.evaluator(s,{...t,payload:i})}const T1=["m2","M2","m3","M3","P4","TT","P5","m6","M6","m7","M7","P8"],ta=Object.fromEntries(T1.map(n=>[n,Cj(n)])),fp=Le(T1),T6=ue({intervals:Te(fp).min(2),questionCount:B().int().min(1).max(50),rootMidiRange:Io([B().int().min(21),B().int().max(108)]),direction:Le(["ascending","descending","harmonic"]),objectiveId:G().optional()});function Lj(n,e){const[t,r]=n.rootMidiRange;return Array.from({length:n.questionCount},(s,i)=>{const a=n.intervals[Math.floor(e()*n.intervals.length)],c=r-ta[a],l=Math.floor(e()*(Math.max(t,c)-t+1))+t;return{index:i,rootMidi:l,interval:a}})}const qj=ue({questionIndex:B().int().min(0),rootMidi:B().int(),expected:fp,answered:fp,responseMs:B().nonnegative().optional()}),zj={typeId:"ear_interval",category:"ear_training",modalities:["listening"],evidenceKinds:["answer"],paramsSchema:T6,answerSchema:qj,evaluator:(n,e)=>{const{expected:t,answered:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectInterval",detail:{expected:t}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}},E6=ue({bpm:B().int().min(40).max(220),beatsPerBar:B().int().min(2).max(7),bars:B().int().min(1).max(4),pattern:Te(B().min(0)).min(1),rounds:B().int().min(1).max(10),toleranceMs:B().min(40).max(400),displayMode:Le(["grid","notation"]).optional(),objectiveId:G().optional()}).refine(n=>n.pattern.every(e=>e<n.beatsPerBar*n.bars)&&n.pattern.every((e,t)=>t===0||e>(n.pattern[t-1]??0)),{message:"pattern onsets must be strictly increasing and inside the bar range"}),Fj=ue({round:B().int().min(0),taps:Te(B())});function fl(n){return 6e4/n}function $j(n){return n.pattern.map(e=>e*fl(n.bpm))}function Bj(n,e){const t=[];n.forEach((i,a)=>e.forEach((c,l)=>t.push({i:a,j:l,d:Math.abs(c-i)}))),t.sort((i,a)=>i.d-a.d||i.i-a.i||i.j-a.j);const r=n.map(()=>null),s=new Set;for(const{i,j:a}of t)r[i]!==null||s.has(a)||(r[i]=e[a]??null,s.add(a));return r}function Uj(n,e){return n<=e?1:n>=e*2?0:1-(n-e)/e}function Gj(n,e){return n>=.85?{correct:!0,messageKey:"practice.feedback.rhythmGreat"}:n>=.5?{correct:!1,messageKey:"practice.feedback.rhythmOk",detail:{ms:Math.round(e??0)}}:{correct:!1,messageKey:"practice.feedback.rhythmRetry"}}const Kj={typeId:"rhythm_tap",category:"rhythm",modalities:["listening","tapping"],evidenceKinds:["tap"],paramsSchema:E6,answerSchema:Fj,evaluator:(n,e)=>{const t=$j(n),r=e.payload.taps,s=Bj(t,r),i=s.map((f,g)=>f===null?null:Math.abs(f-(t[g]??0))).filter(f=>f!==null),a=s.map((f,g)=>f===null?0:Uj(Math.abs(f-(t[g]??0)),n.toleranceMs)),c=a.reduce((f,g)=>f+g,0)/t.length,l=Math.max(0,r.length-t.length),d=Math.max(0,Math.min(1,c-Math.min(.3,l*.1))),m=i.length?i.reduce((f,g)=>f+g,0)/i.length:null,p=a.filter(f=>f===1).length;return{score:d,breakdown:{hitRate:p/t.length,meanAbsDeviationMs:m===null?-1:Math.round(m),extraTaps:l},feedback:Gj(d,m),objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:d}]:[]}}},N6=ue({bpm:B().int().min(40).max(220),beatsPerBar:B().int().min(2).max(7),bars:B().int().min(1).max(2),patternIds:Te(G()).min(1),rounds:B().int().min(1).max(10),toleranceMs:B().min(40).max(400),mode:Le(["echo","memory"]),objectiveId:G().optional()}).refine(n=>n.patternIds.every(e=>{const t=pn(e);return t!==null&&t.kind==="rhythm_pattern"}),{message:"patternIds must reference existing rhythm_pattern knowledge objects"}).refine(n=>n.patternIds.every(e=>{const t=pn(e);return t===null||t.data.beatsPerBar===n.beatsPerBar}),{message:"every pattern must share params.beatsPerBar"});function Hj(n,e){return Array.from({length:n.rounds},(t,r)=>{const s=n.patternIds[Math.floor(e()*n.patternIds.length)];return{round:r,patternId:s}})}const Wj=ue({round:B().int().min(0),patternId:G(),taps:Te(B())});function Yj(n,e){const t=Ht(e).data,r=fl(n.bpm);return t.onsets.map(s=>s*r)}function Qj(n,e){const t=[];
64n.forEach((i,a)=>e.forEach((c,l)=>t.push({i:a,j:l,d:Math.abs(c-i)}))),t.sort((i,a)=>i.d-a.d||i.i-a.i||i.j-a.j);const r=n.map(()=>null),s=new Set;for(const{i,j:a}of t)r[i]!==null||s.has(a)||(r[i]=e[a]??null,s.add(a));return r}function Zj(n,e){return n<=e?1:n>=e*2?0:1-(n-e)/e}function Jj(n,e){return n>=.85?{correct:!0,messageKey:"practice.feedback.rhythmGreat"}:n>=.5?{correct:!1,messageKey:"practice.feedback.rhythmOk",detail:{ms:Math.round(e??0)}}:{correct:!1,messageKey:"practice.feedback.rhythmRetry"}}const Xj={typeId:"rhythm_echo",category:"rhythm",modalities:["listening","tapping"],evidenceKinds:["tap"],paramsSchema:N6,answerSchema:Wj,evaluator:(n,e)=>{const t=Yj(n,e.payload.patternId),r=e.payload.taps,s=Qj(t,r),i=s.map((f,g)=>f===null?null:Math.abs(f-(t[g]??0))).filter(f=>f!==null),a=s.map((f,g)=>f===null?0:Zj(Math.abs(f-(t[g]??0)),n.toleranceMs)),c=a.reduce((f,g)=>f+g,0)/t.length,l=Math.max(0,r.length-t.length),d=Math.max(0,Math.min(1,c-Math.min(.3,l*.1))),m=i.length?i.reduce((f,g)=>f+g,0)/i.length:null,p=a.filter(f=>f===1).length;return{score:d,breakdown:{hitRate:p/t.length,meanAbsDeviationMs:m===null?-1:Math.round(m),extraTaps:l},feedback:Jj(d,m),objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:d}]:[]}}},eT=[{level:1,label:{he:"הד — רבעים",en:"Echo — quarters"},paramOverrides:{mode:"echo",bpm:70,patternIds:["rhythm_pattern.quarters"],toleranceMs:180}},{level:2,label:{he:"הד — רבעים ושמיניות",en:"Echo — quarters+eighths"},paramOverrides:{mode:"echo",bpm:76,patternIds:["rhythm_pattern.quarters_eighths"],toleranceMs:150}},{level:3,label:{he:"הד — סינקופה",en:"Echo — syncopation"},paramOverrides:{mode:"echo",bpm:80,patternIds:["rhythm_pattern.syncopation_basic"],toleranceMs:140}},{level:4,label:{he:"זיכרון — רבעים ושמיניות",en:"Memory — quarters+eighths"},paramOverrides:{mode:"memory",bpm:76,patternIds:["rhythm_pattern.quarters_eighths"],toleranceMs:150}},{level:5,label:{he:"זיכרון — אחרי הפעימה",en:"Memory — offbeat"},paramOverrides:{mode:"memory",bpm:84,patternIds:["rhythm_pattern.offbeat"],toleranceMs:140}},{level:6,label:{he:"זיכרון — סינקופה עם שתיקה",en:"Memory — rest-start syncopation"},paramOverrides:{mode:"memory",bpm:84,patternIds:["rhythm_pattern.rest_start_syncopation"],toleranceMs:130}}],S6=G().refine(n=>{try{return Ht(n).kind==="chord"}catch{return!1}},{message:"unknown chord knowledge id"}),A6=ue({chordIds:Te(S6).min(1),questionCount:B().int().min(1).max(30),rootMidiRange:Io([B().int().min(36),B().int().max(84)]),objectiveId:G().optional()});function tT(n,e){const[t,r]=n.rootMidiRange;return Array.from({length:n.questionCount},(s,i)=>{const a=n.chordIds[Math.floor(e()*n.chordIds.length)],c=nT(a),l=r-c,d=Math.floor(e()*(Math.max(t,l)-t+1))+t;return{index:i,rootMidi:d,chordId:a}})}function C6(n){return Ht(n).data.intervals}function nT(n){return Math.max(...C6(n))}function M6(n,e){return C6(e).map(t=>n+t)}function rT(){return Vt("chord")}const sT=ue({questionIndex:B().int().min(0),rootMidi:B().int(),chordId:S6,selectedMidis:Te(B().int())}),iT={typeId:"theory_chord_build",category:"theory",modalities:["writing"],evidenceKinds:["answer"],paramsSchema:A6,answerSchema:sT,evaluator:(n,e)=>{const{rootMidi:t,chordId:r,selectedMidis:s}=e.payload,i=new Set(M6(t,r)),a=new Set(s),c=[...i].filter(f=>f!==t),l=c.filter(f=>a.has(f)).length,d=[...a].filter(f=>!i.has(f)).length,m=Math.max(0,Math.min(1,(l-d*.5)/c.length)),p=m===1&&d===0;return{score:m,breakdown:{correctTones:l,missingTones:c.length-l,extraTones:d},feedback:p?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.chordIncorrect",detail:{chord:qe(r)}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:m}]:[]}}},aT=ue({questionIndex:B().int().min(0),rootMidi:B().int(),expectedId:G(),answeredId:G()});function oT(n){const e=G().refine(t=>{const r=pn(t);return r!==null&&n.includes(r.kind)},{message:`knowledge id must be one of kinds: ${n.join(", ")}`});return ue({optionIds:Te(e).min(2),questionCount:B().int().min(1).max(30),rootMidiRange:Io([B().int().min(36),B().int().max(96)]),objectiveId:G().optional()})}function cT(n){return n.kind==="chord"?Math.max(...n.data.intervals):n.kind==="scale"||n.kind==="mode"?n.data.steps.reduce((e,t)=>
64e+t,0):12}function lT(n,e){const[t,r]=n.rootMidiRange;return Array.from({length:n.questionCount},(s,i)=>{const a=n.optionIds[Math.floor(e()*n.optionIds.length)],c=r-cT(Ht(a)),l=Math.floor(e()*(Math.max(t,c)-t+1))+t;return{index:i,rootMidi:l,correctId:a}})}function E1(n){return{typeId:n.typeId,category:n.category,modalities:n.modalities,evidenceKinds:["answer"],paramsSchema:oT(n.knowledgeKinds),answerSchema:aT,evaluator:(e,t)=>{const{expectedId:r,answeredId:s}=t.payload,i=r===s;return{score:i?1:0,breakdown:{correct:i?1:0},feedback:i?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:qe(r)}},objectiveSignals:e.objectiveId?[{objectiveId:e.objectiveId,signal:i?1:0}]:[]}}}}const dT=E1({typeId:"ear_chord_quality",category:"ear_training",modalities:["listening"],knowledgeKinds:["chord"]}),uT=E1({typeId:"ear_scale_recognition",category:"ear_training",modalities:["listening"],knowledgeKinds:["scale","mode"]}),hT=E1({typeId:"ear_cadence",category:"ear_training",modalities:["listening"],knowledgeKinds:["cadence"]}),P6=ue({clef:Le(["treble","bass"]),lowMidi:B().int().min(36),highMidi:B().int().max(96),questionCount:B().int().min(1).max(30),objectiveId:G().optional()}).refine(n=>os(n.lowMidi,n.highMidi).length>=2,{message:"range must contain at least two natural pitches"});function mT(n,e){const t=os(n.lowMidi,n.highMidi);let r=-1;return Array.from({length:n.questionCount},(s,i)=>{let a=t[Math.floor(e()*t.length)];return a===r&&t.length>1&&(a=t[(t.indexOf(a)+1)%t.length]),r=a,{index:i,midi:a}})}const pT=ue({questionIndex:B().int().min(0),midi:B().int(),expectedPitchId:G(),answeredPitchId:G()}),fT={typeId:"sight_note_id",category:"sight_reading",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:P6,answerSchema:pT,evaluator:(n,e)=>{const{expectedPitchId:t,answeredPitchId:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:qe(t)}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}};function gp(n){var e;return((e=pn(n))==null?void 0:e.kind)??null}const gT=new Set(["scale","mode","chord"]),R6=ue({sourceId:G().refine(n=>{const e=gp(n);return e!==null&&gT.has(e)},{message:"sourceId must be a scale, mode, or chord knowledge id"}),rootMidi:B().int().min(48).max(84),mode:Le(["scale","arpeggio"]),direction:Le(["ascending","descending"]),rounds:B().int().min(1).max(5),objectiveId:G().optional()}).refine(n=>{const e=gp(n.sourceId);return e===null?!0:n.mode==="arpeggio"?e==="chord":e==="scale"||e==="mode"},{message:"mode is inconsistent with the source kind",path:["mode"]});function O6(n){const t=gp(n.sourceId)==="chord"?hl(n.sourceId,n.rootMidi):Os(n.sourceId,n.rootMidi);return n.direction==="descending"?[...t].reverse():t}function yT(){return[...Vt("scale"),...Vt("mode"),...Vt("chord")]}const bT=ue({round:B().int().min(0),playedMidis:Te(B().int())}),xT={typeId:"piano_scale_play",category:"piano",modalities:["playing","reading"],evidenceKinds:["answer"],paramsSchema:R6,answerSchema:bT,evaluator:(n,e)=>{const{playedMidis:t}=e.payload,r=O6(n),s=r.length;let i=0;for(let m=0;m<s;m++)m<t.length&&t[m]===r[m]&&i++;const a=Math.max(0,t.length-s),c=i/s-.25*(a/s),l=Math.max(0,Math.min(1,c));return{score:l,breakdown:{correctPositions:i,expectedLength:s,extraPresses:a},feedback:i===s&&a===0?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.sequenceIncorrect",detail:{expected:qe(n.sourceId)}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:l}]:[]}}},vT=ue({itemIds:Te(G().refine(n=>{const e=pn(n);return e!==null&&typeof e.symbol=="string"&&e.symbol.length>0},{message:"knowledge id must resolve and have a non-empty symbol"})).min(3).max(8),promptField:Le(["symbol","name_en"]),rounds:B().int().min(1).max(5),objectiveId:G().optional()}),IT=ue({round:B().int().min(0),matches:Te(ue({itemId:G(),matchedItemId:G()}))});function _T(n,e){const t=pn(n);return t?e==="symbol"?t.symbol??n:t.name.en:n}function e2(n){return qe(n)}const kT={typeId:"theory_matching",category:"theory",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:vT,answerSchema:IT,evaluator:(n,e)=>{const{matches:t}=e.payload,r=t.length,s=t.filter(l=>l.itemId===l.matchedItemId).length,i=r===0?0:s/r,a=r>0&&s===r,c=r-s;return{score:i,breakdown:{correctMatches:s,totalItems:r},feedback:a?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.matchingIncorrect",detail:{n:c}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:i}]:[]}}},D6=ue({referenceAssetId:G().optional(),minSeconds:B().int().min(1).max(600).optional(),objectiveId:G().optional()}),wT=5,jT=ue({rating:B().int().min(1).max(5),durationSec:B().min(0),recordingAssetId:G()}),TT={typeId:"repertoire_record",category:"performance",modalities:["playing"],evidenceKinds:["self_report","audio"],paramsSchema:D6,answerSchema:jT,evaluator:(n,e)=>{const{rating:t,durationSec:r}=e.payload,s=t/5;return{score:s,breakdown:{selfRating:t,durationSec:r},feedback:{correct:null,messageKey:"practice.feedback.selfAssessed",detail
64:{rating:t}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s}]:[]}}},ET=/^([a-g][0-8])?:(wd?|hd?|qd?|8d?|16d?)$/;function N1(n){return n.split("|").map(e=>e.trim().split(",").map(t=>{const r=ET.exec(t.trim());if(!r)throw new Error(`Invalid excerpt note: '${t.trim()}'`);const[,s,i]=r;return{keys:s?[`${s[0]}/${s[1]}`]:["b/4"],duration:i}}))}function NT(n){try{const e=N1(n);return e.length>=2&&e.every(t=>t.length>=1)}catch{return!1}}const V6=ue({excerpt:G().refine(NT,{message:"invalid excerpt notation"}),questions:Te(ue({prompt:G().min(3),correctMeasure:B().int().min(0)})).min(1),clef:Le(["treble","bass"]).optional(),objectiveId:G().optional()}).refine(n=>{try{const e=N1(n.excerpt).length;return n.questions.every(t=>t.correctMeasure<e)}catch{return!0}},{message:"question measure out of range"}),ST=ue({questionIndex:B().int().min(0),expectedMeasure:B().int().min(0),answeredMeasure:B().int().min(0)}),AT={typeId:"score_label",category:"theory",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:V6,answerSchema:ST,evaluator:(n,e)=>{const{expectedMeasure:t,answeredMeasure:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.wrongMeasure",detail:{measure:t+1}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}},CT=G().refine(n=>{try{const e=Ht(n).kind;return e==="scale"||e==="mode"}catch{return!1}},{message:"unknown scale/mode knowledge id"}),L6=ue({mode:Le(["pitch","degree"]),lowMidi:B().int().min(36).max(84),highMidi:B().int().min(48).max(96),questionCount:B().int().min(1).max(30),scaleId:CT.optional(),anyOctave:mn().optional(),objectiveId:G().optional()}).refine(n=>n.highMidi-n.lowMidi>=12,{message:"range must span at least an octave"}).refine(n=>os(n.lowMidi,n.highMidi).length>0,{message:"range must contain at least one natural pitch"}).refine(n=>n.mode!=="degree"||!!n.scaleId,{message:'scaleId is required when mode is "degree"'});function MT(n,e){const t=os(n.lowMidi,n.highMidi);if(n.mode==="pitch")return Array.from({length:n.questionCount},(s,i)=>{const a=t[Math.floor(e()*t.length)];return{index:i,mode:"pitch",targetMidi:a}});const r=n.scaleId;return Array.from({length:n.questionCount},(s,i)=>{const a=t[Math.floor(e()*t.length)],c=Math.floor(e()*7)+1,l=Os(r,a)[c-1];return{index:i,mode:"degree",targetMidi:l,rootMidi:a,degree:c}})}const PT=ue({questionIndex:B().int().min(0),mode:Le(["pitch","degree"]),targetMidi:B().int(),answeredMidi:B().int(),anyOctave:mn()});function RT(n,e){return(n%12+12)%12===(e%12+12)%12}const OT={typeId:"piano_locate",category:"piano",modalities:["playing"],evidenceKinds:["answer"],paramsSchema:L6,answerSchema:PT,evaluator:(n,e)=>{const{targetMidi:t,answeredMidi:r,anyOctave:s}=e.payload,i=r===t||s&&RT(r,t);return{score:i?1:0,breakdown:{correct:i?1:0},feedback:i?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:qe(cr(t))}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:i?1:0}]:[]}}},DT=[{level:1,label:{he:"איתור צליל — כל אוקטבה",en:"Locate pitch — any octave"},paramOverrides:{mode:"pitch",lowMidi:60,highMidi:72,anyOctave:!0}},{level:2,label:{he:"איתור צליל מדויק",en:"Locate exact pitch"},paramOverrides:{mode:"pitch",lowMidi:60,highMidi:72,anyOctave:!1}},{level:3,label:{he:"איתור צליל — טווח מורחב",en:"Locate pitch — wide range"},paramOverrides:{mode:"pitch",lowMidi:48,highMidi:84,anyOctave:!1}},{level:4,label:{he:"מדרגות בסולם מז׳ור",en:"Degrees in major scale"},paramOverrides:{mode:"degree",scaleId:"scale.major",lowMidi:48,highMidi:84}},{level:5,label:{he:"מדרגות במינור טבעי",en:"Degrees in natural minor"},paramOverrides:{mode:"degree",scaleId:"scale.natural_minor",lowMidi:48,highMidi:84}},{level:6,label:{he:"מדרגות במודוס דוריאני",en:"Degrees in dorian mode"},paramOverrides:{mode:"degree",scaleId:"mode.dorian",lowMidi:48,highMidi:84}}],q6=["name_note","click_note","sequence","extreme"],z6=ue({mode:Le(q6),clef:Le(["treble","bass"]),lowMidi:B().int().min(36).max(96),highMidi:B().int().min(36).max(96),questionCount:B().int().min(1).max(30),sequenceLength:B().int().min(2).max(8).optional(),timedSeconds:B().int().min(0).max(30).optional(),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>os(n.lowMidi,n.highMidi).length>=4,{message:"range must contain at least four natural pitches"}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must be greater than lowMidi"});function t2(n,e,t){let r=n[Math.floor(e()*n.length)];return r===t&&n.length>1&&(r=n[(n.indexOf(r)+1)%n.length]),r}function n2(n,e){const t=os(n.lowMidi,n.highMidi),r=n.sequenceLength??3;let s=-1;return Array.from({length:n.questionCount},(i,a)=>
64{if(n.mode==="sequence"||n.mode==="extreme"){const l=[];let d=-1;for(let m=0;m<r;m++){const p=t2(t,e,d);l.push(p),d=p}if(n.mode==="extreme"){const m=e()<.5?"highest":"lowest";return{index:a,mode:"extreme",midis:l,extreme:m}}return{index:a,mode:"sequence",midis:l}}const c=t2(t,e,s);return s=c,n.mode==="click_note"?{index:a,mode:"click_note",midis:[c],targetPitchId:cr(c)}:{index:a,mode:"name_note",midis:[c]}})}const VT=ue({questionIndex:B().int().min(0),mode:Le(q6),expectedMidis:Te(B().int()),answeredMidis:Te(B().int()).optional(),answeredPitchIds:Te(G()).optional()}),LT={typeId:"sight_reading",category:"sight_reading",modalities:["reading","playing"],evidenceKinds:["answer"],paramsSchema:z6,answerSchema:VT,evaluator:(n,e)=>{const{mode:t,expectedMidis:r,answeredMidis:s,answeredPitchIds:i}=e.payload,a=m=>n.objectiveId?[{objectiveId:n.objectiveId,signal:m}]:[];if(t==="sequence"){const m=r,p=i??[];let f=0;for(let b=0;b<m.length;b++){const I=cr(m[b]);p[b]===I&&f++}const g=m.length>0?f/m.length:0,x=f===m.length;return{score:g,breakdown:{correct:f,total:m.length},feedback:x?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.sequencePartial",detail:{n:f}},objectiveSignals:a(g)}}const c=r[0],l=(s??[])[0],d=c!==void 0&&l===c;return{score:d?1:0,breakdown:{correct:d?1:0},feedback:d?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:c!==void 0?qe(cr(c)):""}},objectiveSignals:a(d?1:0)}}},qT=[{level:1,label:{he:"שמות תווים — מפתח סול",en:"Name notes — treble"},paramOverrides:{mode:"name_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:5}},{level:2,label:{he:"עם קווים עזר",en:"With ledger lines"},paramOverrides:{mode:"name_note",clef:"treble",lowMidi:57,highMidi:79,questionCount:6}},{level:3,label:{he:"איתור על המקלדת",en:"Locate on keyboard"},paramOverrides:{mode:"click_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:6}},{level:4,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{mode:"name_note",clef:"bass",lowMidi:43,highMidi:60,questionCount:6}},{level:5,label:{he:"קריאת רצף",en:"Read a sequence"},paramOverrides:{mode:"sequence",clef:"treble",lowMidi:60,highMidi:72,questionCount:6,sequenceLength:3}},{level:6,label:{he:"רצף בזמן",en:"Timed sequence"},paramOverrides:{mode:"sequence",clef:"treble",lowMidi:57,highMidi:79,questionCount:6,sequenceLength:5,timedSeconds:10}},{level:7,label:{he:"הגבוה או הנמוך?",en:"Highest or lowest?"},paramOverrides:{mode:"extreme",clef:"treble",lowMidi:57,highMidi:79,questionCount:6,sequenceLength:5}},{level:8,label:{he:"קריאה מהירה — טווח מלא",en:"Rapid reading — full range"},paramOverrides:{mode:"name_note",clef:"treble",lowMidi:48,highMidi:84,questionCount:8,timedSeconds:5}}],zT={engineId:"sight_reading",name:{he:"מנוע קריאת תווים",en:"Sight-reading engine"},description:{he:"תו על החמשה — והלומד מזהה, מאתר, קורא רצף או מוצא את הצליל הקיצוני. מצב האינטראקציה הוא פרמטר",en:"A note on the staff — name it, locate it, read a run, or spot the extreme. The interaction mode is a parameter"},typeIds:["sight_reading"],ladders:{sight_reading:qT}},FT=["build_scale","build_chord","build_interval","complete_scale","missing_note","place_note"],F6=ue({mode:Le(FT),clef:Le(["treble","bass","alto","tenor"]),lowMidi:B().int().min(24).max(96),highMidi:B().int().min(24).max(108),sourceId:G().optional(),intervalSemitones:B().int().min(1).max(24).optional(),pitchLetters:Te(Le(["c","d","e","f","g","a","b"])).min(1).optional(),questionCount:B().int().min(1).max(30),completeCount:B().int().min(1).max(6).optional(),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"}).refine(n=>n.mode==="build_interval"?typeof n.intervalSemitones=="number":n.mode==="build_scale"||n.mode==="build_chord"||n.mode==="complete_scale"||n.mode==="missing_note"?typeof n.sourceId=="string":!0,{message:"mode requires sourceId or intervalSemitones"});function Xo(n,e){return os(n.lowMidi,n.highMidi-e)}function fa(n,e){return n[Math.floor(e()*n.length)]}function r2(n,e){const t=n.clef;return Array.from({length:n.questionCount},(r,s)=>{switch(n.mode){case"build_scale":{const i=Os(n.sourceId,fa(Xo(n,12),e));return{index:s,clef:t,givenMidis:[i[0]],expectedMidis:i.slice(1),ordered:!0,promptKey:"practice.build.buildScale",promptDetail:{name:qe(n.sourceId)}}}case"complete_scale":{const i=Os(n.sourceId,fa(Xo(n,12),e)),a=Math.min(n.completeCount??3,i.length-1);return{index:s,clef:t,givenMidis:i.slice(0,i.length-a),expectedMidis:i.slice(i.length-a),ordered:!0,promptKey:"practice.build.completeScale",promptDetail:{name:qe(n.sourceId)}}}case"missing_note":{const i=Os(n.sourceId,fa(Xo(n,12),e)),a=1+Math.floor(e()*(i.length-2));return{index:s,clef:t,givenMidis:i.filter((c,l)=>l!==a),expectedMidis:[i[a]],ordered:!1,promptKey:"practice.build.missingNote",promptDetail:{name:qe(n.sourceId)}}}case"build_chord":{const i=hl(n.sourceId,fa(Xo(n,12),e));return{index:s,clef:t,givenMidis:[i[0]],expectedMidis:i.slice(1),ordered:!1,promptKey:"practice.build.buildChord",promptDetail:{name:qe(n.sourceId)}}}case"place_note":{let i=os(n.lowMidi,n.highMidi);if(n.pitchLetters&&n.pitchLetters.length>0){const c=new Set(n.pitchLetters);i=i.filter(l=>c.has(Ks(l).letter))}const a=fa(i,e);return{index:s,clef:t,givenMidis:[],expectedMidis:[a],ordered:!1,promptKey:"practice.build.placeNote",promptDetail:{name:qe(`pitch.${Ks(a).letter}`)}}}case"build_interval":{const i=n.intervalSemitones,a=fa(Xo(n,i),e);return{index:s,clef:t,givenMidis:[a],expectedMidis:[a+i],ordered:!1,promptKey:"practice.build.buildInterval",promptDetail:{semis:i}}}}})}const $T=ue({questionIndex:B().int().min(0),expectedMidis:Te(B().int()),answeredMidis:Te(B().int()),ordered:mn()});function BT(n,e){const t=[...e];let r=0;for(const s of n){const i=t.indexOf(s);i>=0&&(t.splice(i,1),r++)}return r}const UT={typeId:"notation_build",category:"sight_reading",modalities:["reading","writing"],evidenceKinds:["answer"],paramsSchema:F6,answerSchema:$T,evaluator:(n,e)=>{const{expectedMidis:t,answeredMidis:r,ordered:s}=e.payload,i=t.length;let a;if(s){a=0;for(let p=0;p<i;p++)r[p]===t[p]&&a++}else a=BT(t,r);const c=s?i:Math.max(i,r.length),l=c>0?a/c:0,d=a===i&&r.length===i,m=n.objectiveId?[{objectiveId:n.objectiveId,signal:l}]:[];return{score:l,breakdown:{correct:a,total:i},feedback:d?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.buildPartial",detail:{n:a,total:i}},objectiveSignals:m}}},GT=[{level:1,label:{he:"הצבת צליל בודד",en:"Place a single note"},paramOverrides:{mode:"place_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:6}},{level:2,label:{he:"שלישית — מרווח על החמשה",en:"Third — interval"},paramOverrides:{mode:"build_interval",clef:"treble",intervalSemitones:4,lowMidi:60,highMidi:72,questionCount:6}},{level:3,label:{he:"מרווחים מעורבים",en:"Mixed intervals"},paramOverrides:{mode:"build_interval",clef:"treble",intervalSemitones:7,lowMidi:57,highMidi:76,questionCount:6}},{level:4,label:{he:"השלמת תו חסר בסולם",en:"Missing note"},paramOverrides:{mode:"missing_note",clef:"treble",sourceId:"scale.major",lowMidi:60,highMidi:72,questionCount:6}},{level:5,label:{he:"בניית משולש",en:"Build a triad"},paramOverrides:{mode:"build_chord",clef:"treble",sourceId:"chord.maj",lowMidi:55,highMidi:76,questionCount:6}},{level:6,label:{he:"השלמת סוף הסולם",en:"Complete the scale"},paramOverrides:{mode:"complete_scale",clef:"treble",sourceId:"scale.major",completeCount:3,lowMidi:60,highMidi:72,questionCount:5}},{level:7,label:{he:"בניית סולם מלא",en:"Build a full scale"},paramOverrides:{mode:"build_scale",clef:"treble",sourceId:"scale.major",lowMidi:60,highMidi:72,questionCount:5}},{level:8,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{mode:"build_scale",clef:"bass",sourceId:"scale.major",lowMidi:43,highMidi:55,questionCount:5}},{level:9,label:{he:"מינור הרמוני",en:"Harmonic minor"},paramOverrides:{mode:"build_scale",clef:"treble",sourceId:"scale.harmonic_minor",lowMidi:60,highMidi:72,questionCount:5}}],KT={engineId:"notation_build",name:{he:"מנוע בנייה על החמשה",en:"Notation construction engine"},description:{he:"הלומד בונה תווים על החמשה בעצמו — משלים סולם, מאיית אקורד, מציב מרווח או תו חסר. מצב הבנייה הוא פרמטר",en:"The student builds notation on the staff — complete a scale, spell a chord, place an interval or a missing note. The task is a parameter"},typeIds:["notation_build"],ladders:{notation_build:GT}},$6=["classify","order"],HT=ue({he:G(),en:G()}),WT=ue({id:G().min(1),label:HT,itemIds:Te(G().min(1)).min(1)}),B6=ue({mode:Le($6),buckets:Te(WT).min(2).optional(),orderedItemIds:Te(G().min(1)).min(2).optional(),sampleSize:B().int().min(2).max(12).optional(),questionCount:B().int().min(1).max(20),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.mode==="classify"?!!n.buckets:!0,{message:"classify mode requires buckets"}).refine(n=>
64n.mode==="order"?!!n.orderedItemIds:!0,{message:"order mode requires orderedItemIds"}),s2=n=>{try{return qe(n)}catch{return n}};function yp(n,e){const t=[...n];for(let r=t.length-1;r>0;r--){const s=Math.floor(e()*(r+1));[t[r],t[s]]=[t[s],t[r]]}return t}function YT(n,e,t){return yp(n,t).slice(0,e)}function i2(n,e){return Array.from({length:n.questionCount},(t,r)=>{if(n.mode==="classify"){const a=n.buckets,c={};for(const p of a)for(const f of p.itemIds)c[f]=p.id;const l=a.flatMap(p=>p.itemIds),d=n.sampleSize?YT(l,n.sampleSize,e):yp(l,e),m=Object.fromEntries(d.map(p=>[p,c[p]]));return{index:r,mode:"classify",items:d.map(p=>({id:p,label:s2(p)})),buckets:a.map(p=>({id:p.id,label:p.label.he})),answerBucket:m,answerOrder:[]}}const s=n.orderedItemIds,i=n.sampleSize?s.slice(0,n.sampleSize):s;return{index:r,mode:"order",items:yp(i,e).map(a=>({id:a,label:s2(a)})),buckets:[],answerBucket:{},answerOrder:i}})}const QT=ue({questionIndex:B().int().min(0),mode:Le($6),placement:hp(G(),G()).optional(),sequence:Te(G()).optional(),answerBucket:hp(G(),G()).optional(),answerOrder:Te(G()).optional()}),ZT={typeId:"theory_organize",category:"theory",modalities:["reading","writing"],evidenceKinds:["answer"],paramsSchema:B6,answerSchema:QT,evaluator:(n,e)=>{const{mode:t}=e.payload;let r=0,s=0;if(t==="classify"){const l=e.payload.placement??{},d=e.payload.answerBucket??{},m=Object.keys(d);s=m.length;for(const p of m)l[p]===d[p]&&r++}else{const l=e.payload.sequence??[],d=e.payload.answerOrder??[];s=d.length;for(let m=0;m<s;m++)l[m]===d[m]&&r++}const i=s>0?r/s:0,a=r===s&&s>0,c=n.objectiveId?[{objectiveId:n.objectiveId,signal:i}]:[];return{score:i,breakdown:{correct:r,total:s},feedback:a?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.organizePartial",detail:{n:r,total:s}},objectiveSignals:c}}},JT=[{id:"consonant",label:{he:"צלילים מתמזגים (קונסוננס)",en:"Consonant"},itemIds:["interval.P5","interval.P4","interval.M3","interval.m3","interval.M6","interval.P8"]},{id:"dissonant",label:{he:"צלילים מתוחים (דיסוננס)",en:"Dissonant"},itemIds:["interval.m2","interval.M2","interval.m7","interval.M7","interval.TT"]}],XT=[{id:"maj",label:{he:"מז׳ורי",en:"Major"},itemIds:["chord.maj","chord.maj7"]},{id:"min",label:{he:"מינורי",en:"Minor"},itemIds:["chord.min","chord.m7"]},{id:"other",label:{he:"מוקטן/מוגדל",en:"Dim/Aug"},itemIds:["chord.dim","chord.aug"]}],eE=[{level:1,label:{he:"קונסוננס מול דיסוננס",en:"Consonant vs dissonant"},paramOverrides:{mode:"classify",buckets:JT,sampleSize:6,questionCount:4}},{level:2,label:{he:"סדר מרווחים לפי גודל",en:"Order intervals by size"},paramOverrides:{mode:"order",orderedItemIds:["interval.m2","interval.M3","interval.P5","interval.P8"],questionCount:5}},{level:3,label:{he:"מיון איכויות אקורד",en:"Classify chord qualities"},paramOverrides:{mode:"classify",buckets:XT,sampleSize:6,questionCount:5}},{level:4,label:{he:"סדר מרווחי הסולם המז׳ורי",en:"Order major-scale intervals"},paramOverrides:{mode:"order",orderedItemIds:["interval.M2","interval.M3","interval.P4","interval.P5","interval.M6","interval.M7"],questionCount:5}}],tE={engineId:"theory_organize",name:{he:"מנוע ארגון ומיון",en:"Organize engine"},description:{he:"הלומד מארגן מושגים מוסיקליים — ממיין לקטגוריות או מסדר ברצף. מודל האינטראקציה קבוע, התוכן משתנה",en:"The student organises musical objects — sort into categories or arrange in order. The interaction is fixed, the content is data"},typeIds:["theory_organize"],ladders:{theory_organize:eE}},nE=["melodic","harmonic","mixed"],rE=I6(n=>typeof n=="string"&&n in ta),U6=ue({clef:Le(["treble","bass","alto","tenor"]),intervals:Te(rE).min(2),presentation:Le(nE),lowMidi:B().int().min(24).max(96),highMidi:B().int().min(24).max(108),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"});function a2(n,e){return n[Math.floor(e()*n.length)]}function o2(n,e){return Array.from({length:n.questionCount},(t,r)=>{const s=a2(n.intervals,e),i=ta[s],a=os(n.lowMidi,n.highMidi-i),c=a.length>0?a2(a,e):n.lowMidi,l=n.presentation==="mixed"?e()<.5?"melodic":"harmonic":n.presentation;
64return{index:r,clef:n.clef,midis:[c,c+i],intervalSymbol:s,presentation:l}})}const sE={m2:1,M2:1,m3:2,M3:2,P4:3,TT:3,P5:4,m6:5,M6:5,m7:6,M7:6,P8:7};function iE(n,e){const t=Ks(n),r=Ra(t.letter,t.octave)+sE[e],{letter:s,octave:i}=Lx(r),a=n+ta[e]-qx(r);return Gu({letter:s,octave:i,accidental:a})}function aE(n){const[e]=n.midis,t=Ku(e),r=iE(e,n.intervalSymbol);return n.presentation==="harmonic"?[{keys:[t,r],duration:"h"}]:[{keys:[t],duration:"q"},{keys:[r],duration:"q"}]}const oE=ue({questionIndex:B().int().min(0),expectedSymbol:G(),answeredSymbol:G()}),cE={typeId:"sight_read_interval",category:"sight_reading",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:U6,answerSchema:oE,evaluator:(n,e)=>{const{expectedSymbol:t,answeredSymbol:r}=e.payload,s=t===r,i=n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[];return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectInterval",detail:{expected:t}},objectiveSignals:i}}},lE=[{level:1,label:{he:"טרצות",en:"Thirds"},paramOverrides:{clef:"treble",intervals:["m3","M3"],presentation:"melodic",lowMidi:60,highMidi:79}},{level:2,label:{he:"סקונדות וטרצות",en:"Seconds & thirds"},paramOverrides:{clef:"treble",intervals:["m2","M2","m3","M3"],presentation:"melodic",lowMidi:60,highMidi:79}},{level:3,label:{he:"קוורטה וקווינטה",en:"Fourths & fifths"},paramOverrides:{clef:"treble",intervals:["P4","P5"],presentation:"melodic",lowMidi:57,highMidi:81}},{level:4,label:{he:"הרמוני — יחד",en:"Harmonic"},paramOverrides:{clef:"treble",intervals:["m3","M3","P5","P8"],presentation:"harmonic",lowMidi:57,highMidi:81}},{level:5,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{clef:"bass",intervals:["m3","M3","P4","P5"],presentation:"mixed",lowMidi:40,highMidi:60}},{level:6,label:{he:"סקסטות ומרווחים גדולים",en:"Sixths & wide"},paramOverrides:{clef:"treble",intervals:["m6","M6","m7","M7","P8"],presentation:"mixed",lowMidi:55,highMidi:84}},{level:7,label:{he:"כל המרווחים",en:"All intervals"},paramOverrides:{clef:"treble",intervals:["m2","M2","m3","M3","P4","TT","P5","m6","M6","m7","M7","P8"],presentation:"mixed",lowMidi:55,highMidi:84}},{level:8,label:{he:"מפתח דו (אלט)",en:"Alto clef"},paramOverrides:{clef:"alto",intervals:["m3","M3","P4","P5","M6"],presentation:"mixed",lowMidi:50,highMidi:74}}],dE={engineId:"sight_read_interval",name:{he:"מנוע קריאת מרווחים",en:"Interval reading engine"},description:{he:"שני צלילים על החמשה — והלומד מזהה את המרווח במבט. מלודי או הרמוני, בכל מפתח. מודל האינטראקציה קבוע, התוכן דאטה",en:"Two notes on the staff — name the interval at sight. Melodic or harmonic, any clef. Content is data"},typeIds:["sight_read_interval"],ladders:{sight_read_interval:lE}},G6=ue({clef:Le(["treble","bass","alto","tenor"]),keyIds:Te(G().min(1)).min(2),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.keyIds.every(e=>e.startsWith("key.")),{message:"keyIds must be key knowledge ids"});function uE(n,e){return n[Math.floor(e()*n.length)]}function hE(n){return Ht(n).symbol??"C"}function c2(n,e){let t="";return Array.from({length:n.questionCount},(r,s)=>{let i=uE(n.keyIds,e);return i===t&&n.keyIds.length>1&&(i=n.keyIds[(n.keyIds.indexOf(i)+1)%n.keyIds.length]),t=i,{index:s,clef:n.clef,keyId:i,vexSignature:hE(i)}})}const mE=ue({questionIndex:B().int().min(0),expectedKeyId:G(),answeredKeyId:G()}),pE={typeId:"sight_read_key",category:"sight_reading",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:G6,answerSchema:mE,evaluator:(n,e)=>{const{expectedKeyId:t,answeredKeyId:r}=e.payload,s=t===r,i=n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[];return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail
64:{expected:Ht(t).name.he}},objectiveSignals:i}}},Ge=n=>`key.${n}_major`,fE=[{level:1,label:{he:"עד חתימה אחת",en:"Up to one accidental"},paramOverrides:{clef:"treble",keyIds:[Ge("c"),Ge("g"),Ge("f")],questionCount:6}},{level:2,label:{he:"עד שתי חתימות",en:"Up to two"},paramOverrides:{clef:"treble",keyIds:[Ge("c"),Ge("g"),Ge("d"),Ge("f"),Ge("bb")],questionCount:6}},{level:3,label:{he:"עד שלוש חתימות",en:"Up to three"},paramOverrides:{clef:"treble",keyIds:[Ge("g"),Ge("d"),Ge("a"),Ge("f"),Ge("bb"),Ge("eb")],questionCount:6}},{level:4,label:{he:"דיאזים",en:"Sharp keys"},paramOverrides:{clef:"treble",keyIds:[Ge("g"),Ge("d"),Ge("a"),Ge("e"),Ge("b")],questionCount:6}},{level:5,label:{he:"במולים",en:"Flat keys"},paramOverrides:{clef:"treble",keyIds:[Ge("f"),Ge("bb"),Ge("eb"),Ge("ab"),Ge("db")],questionCount:6}},{level:6,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{clef:"bass",keyIds:[Ge("c"),Ge("g"),Ge("d"),Ge("f"),Ge("bb")],questionCount:6}},{level:7,label:{he:"סולמות מינור",en:"Minor keys"},paramOverrides:{clef:"treble",keyIds:["key.a_minor","key.e_minor","key.b_minor","key.d_minor","key.g_minor"],questionCount:6}},{level:8,label:{he:"מעגל הקווינטות המלא",en:"Full circle of fifths"},paramOverrides:{clef:"treble",keyIds:[Ge("c"),Ge("g"),Ge("d"),Ge("a"),Ge("e"),Ge("b"),Ge("f"),Ge("bb"),Ge("eb"),Ge("ab"),Ge("db")],questionCount:8}}],gE={engineId:"sight_read_key",name:{he:"מנוע חתימות מפתח",en:"Key-signature engine"},description:{he:"חתימת מפתח על החמשה — והלומד מזהה את הסולם. מבוסס על מעגל הקווינטות המלא. מודל האינטראקציה קבוע, התוכן דאטה",en:"A key signature on the staff — name the key. Built on the full circle of fifths. Content is data"},typeIds:["sight_read_key"],ladders:{sight_read_key:fE}},yE=["sharps","flats","both"],K6=ue({clef:Le(["treble","bass","alto","tenor"]),accidentalType:Le(yE),lowMidi:B().int().min(24).max(96),highMidi:B().int().min(24).max(108),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"});function bE(n,e){const t=[];for(let r=n;r<=e;r++)k5(r)&&t.push(r);return t}function l2(n,e){const t=bE(n.lowMidi,n.highMidi);let r=-1;return Array.from({length:n.questionCount},(s,i)=>{let a=t[Math.floor(e()*t.length)]??n.lowMidi+1;a===r&&t.length>1&&(a=t[(t.indexOf(a)+1)%t.length]),r=a;const c=n.accidentalType==="sharps"?"sharp":n.accidentalType==="flats"?"flat":e()<.5?"sharp":"flat",l=zx(a,c
64);return{index:i,clef:n.clef,midi:a,vexKey:Gu(l),letter:l.letter,accidental:l.accidental}})}const xE=ue({questionIndex:B().int().min(0),expectedMidi:B().int(),answeredMidi:B().int(),expectedLetter:G(),expectedAccidental:B().int()}),vE={typeId:"sight_read_accidental",category:"sight_reading",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:K6,answerSchema:xE,evaluator:(n,e)=>{const{expectedMidi:t,answeredMidi:r,expectedLetter:s,expectedAccidental:i}=e.payload,a=t===r,c=n.objectiveId?[{objectiveId:n.objectiveId,signal:a?1:0}]:[];return{score:a?1:0,breakdown:{correct:a?1:0},feedback:a?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectAccidental",detail:{letter:s,accidental:i}},objectiveSignals:c}}},IE=[{level:1,label:{he:"דיאזים — מפתח סול",en:"Sharps — treble"},paramOverrides:{clef:"treble",accidentalType:"sharps",lowMidi:60,highMidi:72}},{level:2,label:{he:"במולים — מפתח סול",en:"Flats — treble"},paramOverrides:{clef:"treble",accidentalType:"flats",lowMidi:60,highMidi:72}},{level:3,label:{he:"דיאזים ובמולים",en:"Sharps & flats"},paramOverrides:{clef:"treble",accidentalType:"both",lowMidi:57,highMidi:79}},{level:4,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{clef:"bass",accidentalType:"both",lowMidi:43,highMidi:64}},{level:5,label:{he:"טווח רחב",en:"Wide range"},paramOverrides:{clef:"treble",accidentalType:"both",lowMidi:48,highMidi:84}},{level:6,label:{he:"מפתח דו (אלט)",en:"Alto clef"},paramOverrides:{clef:"alto",accidentalType:"both",lowMidi:50,highMidi:74}}],_E={engineId:"sight_read_accidental",name:{he:"מנוע קריאת סימני היתק",en:"Accidental reading engine"},description:{he:"תו עם דיאז או במול על החמשה — והלומד מזהה אותו. שקילות אנהרמונית מתקבלת. מודל האינטראקציה קבוע, התוכן דאטה",en:"A sharp/flat note on the staff — name it; enharmonic equivalents accepted. Content is data"},typeIds:["sight_read_accidental"],ladders:{sight_read_accidental:IE}},d2=["c","d","e","f","g","a","b"],kE={c:0,d:2,e:4,f:5,g:7,a:9,b:11};function wE(n){return n.replace(/^key\./,"").charAt(0)}function _o(n,e,t){const r=pn(n);if(!r||r.kind!=="key")return[];const s=r.data,i=Os(s.scaleId,s.tonicMidiClass).slice(0,7).map(d=>(d%12+12)%12),a=d2.indexOf(wE(n)),c=i.map((d,m)=>d2[((a+m)%7+7)%7]),l=[];for(let d=e;d<=t;d++){const m=(d%12+12)%12,p=i.indexOf(m);if(p<0)continue;const f=c[p],g=kE[f],x=Math.round((d-g)/12)-1;l.push({midi:d,vexKey:`${f}/${x}`})}return l}const H6=ue({clef:Le(["treble","bass","alto","tenor"]),keyId:G().min(1).refine(n=>n.startsWith("key."),{message:"keyId must be a key knowledge id"}),lowMidi:B().int().min(24).max(96),highMidi:B().int().min(24).max(108),noteCount:B().int().min(3).max(16),questionCount:B().int().min(1).max(20),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"}).refine(n=>_o(n.keyId,n.lowMidi,n.highMidi).length>=3,{message:"range must contain at least 3 diatonic notes of the key"});function jE(n,e,t){if(n===0)return[];let r=Math.floor(n/2);const s=[r];for(let i=1;i<e;i++){const a=t();let c=a<.6?1:a<.85?2:3+Math.floor(t()*2);t()<.5&&(c=-c);let l=Math.max(0,Math.min(n-1,r+c));l===r&&n>1&&(l=r===0?1:r-1),r=l,s.push(r)}return s}function TE(n,e){return Array.from({length:n},(t,r)=>{if(r===n-1)return"h";const s=e();return s<.35?"8":s<.9?"q":"h"})}function u2(n,e){var s;const t=_o(n.keyId,n.lowMidi,n.highMidi),r=((s=pn(n.keyId))==null?void 0:s.symbol)??"C";return Array.from({length:n.questionCount},(i,a)=>{const c=jE(t.length,n.noteCount,e),l=TE(c.length,e),d=c.map((p,f)=>({vexKey:t[p].vexKey,duration:l[f]})),m=c.map(p=>t[p].midi);return{index:a,clef:n.clef,keySignature:r,notes:d,midis:m}})}const EE=ue({questionIndex:B().int().min(0),playedMidis:Te(B().int()),expectedMidis:Te(B().int())}),NE={typeId:"sight_read_melody",category:"sight_reading",modalities:["reading","playing"],evidenceKinds:["answer"],paramsSchema:H6,answerSchema:EE,evaluator:(n,e)=>{var m;const{playedMidis:t,expectedMidis:r}=e.payload,s=r.length;let i=0;for(let p=0;p<s;p++)p<t.length&&t[p]===r[p]&&i++;const a=Math.max(0,t.length-s),c=s===0?0:i/s-.25*(a/s),l=Math.max(0,Math.min(1,c));return{score:l,breakdown:{correctPositions:i,expectedLength:s,extraPresses:a},feedback:i===s&&a===0?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.sequenceIncorrect",detail:{expected:((m=pn(n.keyId))==null?void 0:m.name.he)??""}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:l}]:[]}}},SE=[{level:1,label:{he:"מלודיה קצרה — דו מז׳ור",en:"Short melody — C major"},paramOverrides:{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:72,noteCount:4,questionCount:4}},{level:2,label:{he:"מלודיה ארוכה יותר",en:"Longer melody"},paramOverrides:{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:72,noteCount:6,questionCount:4}},{level:3,label:{he:"סול מז׳ור",en:"G major"},paramOverrides:{clef:"treble",keyId:"key.g_major",lowMidi:62,highMidi:74,noteCount:6,questionCount:4}},{level:4,label:{he:"פה מז׳ור",en:"F major"},paramOverrides:{clef:"treble",keyId:"key.f_major",lowMidi:60,highMidi:72,noteCount:6,questionCount:4}},{level:5,label:{he:"טווח רחב וקפיצות",en:"Wider range & leaps"},paramOverrides:{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:79,noteCount:7,questionCount:4}},{level:6,label:{he:"לה מינור",en:"A minor"},paramOverrides:{clef:"treble",keyId:"key.a_minor",lowMidi:57,highMidi:72,noteCount:6,questionCount:4}},{level:7,label:{he:"מפתח פה",en:"Bass clef"},paramOverrides:{clef:"bass",keyId:"key.c_major",lowMidi:48,highMidi:60,noteCount:6,questionCount:4}},{level:8,label:{he:"רה מז׳ור — טווח רחב",en:"D major — wide"},paramOverrides:{clef:"treble",keyId:"key.d_major",lowMidi:62,highMidi:81,noteCount:8,questionCount:5}}],AE={engineId:"sight_read_melody",name:{he:"מנוע קריאת מלודיה",en:"Melodic reading engine"},description:{he:"מלודיה שלמה על החמשה — גבהים ומקצב — והלומד מנגן אותה לפי הסדר על המקלדת. מודל האינטראקציה קבוע, התוכן דאטה",en:"A full melody on the staff — pitch and rhythm — performed in order on the keyboard. Content is data"},typeIds:["sight_read_melody"],ladders:{sight_read_melody:SE}},CE=["spell_scale","spell_chord"],W6=ue({mode:Le(CE),keyIds:Te(G().min(1)).optional(),chordIds:Te(G().min(1)).optional(),rootMidis:Te(B().int().min(48).max(72)).optional(),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>{var e;return n.mode==="spell_scale"?(((e=n.keyIds)==null?void 0:e.length)??0)>0:!0}
64,{message:"spell_scale requires keyIds",path:["keyIds"]}).refine(n=>{var e;return n.mode==="spell_chord"?(((e=n.chordIds)==null?void 0:e.length)??0)>0:!0},{message:"spell_chord requires chordIds",path:["chordIds"]});function km(n,e){return n[Math.floor(e()*n.length)]}const h2=n=>(n%12+12)%12;function ME(n){const e=pn(n);if(!e||e.kind!=="key")return[];const t=e.data,r=60+t.tonicMidiClass;return Os(t.scaleId,r)}function m2(n,e){let t="";return Array.from({length:n.questionCount},(r,s)=>{var p,f;if(n.mode==="spell_scale"){const g=n.keyIds??[];let x=km(g,e);x===t&&g.length>1&&(x=g[(g.indexOf(x)+1)%g.length]),t=x;const b=ME(x);return{index:s,mode:"spell_scale",promptId:x,promptName:((p=pn(x))==null?void 0:p.name.he)??x,targetPcs:b.map(h2),targetMidis:b}}const i=n.chordIds??[],a=n.rootMidis??[60,62,64,65,67,69,71],c=km(i,e),l=km(a,e),d=hl(c,l),m=qe(`pitch.${Ks(l).letter}`);return{index:s,mode:"spell_chord",promptId:c,promptName:`${((f=pn(c))==null?void 0:f.name.he)??c} על ${m}`,targetPcs:d.map(h2),targetMidis:d}})}const PE=ue({questionIndex:B().int().min(0),playedPcs:Te(B().int()),expectedPcs:Te(B().int()),promptName:G()}),RE={typeId:"theory_spell",category:"theory",modalities:["writing"],evidenceKinds:["answer"],paramsSchema:W6,answerSchema:PE,evaluator:(n,e)=>{const{playedPcs:t,expectedPcs:r,promptName:s}=e.payload,i=r.length;let a=0;for(let p=0;p<i;p++)p<t.length&&t[p]===r[p]&&a++;const c=Math.max(0,t.length-i),l=i===0?0:a/i-.25*(c/i),d=Math.max(0,Math.min(1,l));return{score:d,breakdown:{correct:a,expectedLength:i,extra:c},feedback:a===i&&c===0?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.sequenceIncorrect",detail:{expected:s}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:d}]:[]}}},tr=n=>`key.${n}_major`,OE=[{level:1,label:{he:"סולמות מז׳ור קלים",en:"Easy major scales"},paramOverrides:{mode:"spell_scale",keyIds:[tr("c"),tr("g"),tr("f")],questionCount:6}},{level:2,label:{he:"עוד סולמות מז׳ור",en:"More major scales"},paramOverrides:{mode:"spell_scale",keyIds:[tr("d"),tr("a"),tr("bb"),tr("eb")],questionCount:6}},{level:3,label:{he:"סולמות מינור",en:"Minor scales"},paramOverrides:{mode:"spell_scale",keyIds:["key.a_minor","key.e_minor","key.d_minor","key.g_minor"],questionCount:6}},{level:4,label:{he:"משולשים מז׳ור ומינור",en:"Major & minor triads"},paramOverrides:{mode:"spell_chord",chordIds:["chord.maj","chord.min"],rootMidis:[60,62,64,65,67,69],questionCount:6}},{level:5,label:{he:"כל המשולשים",en:"All triads"},paramOverrides:{mode:"spell_chord",chordIds:["chord.maj","chord.min","chord.dim","chord.aug"],rootMidis:[60,62,64,65,67,69,71],questionCount:6}},{level:6,label:{he:"סולמות מתקדמים",en:"Advanced scales"},paramOverrides:{mode:"spell_scale",keyIds:[tr("e"),tr("b"),tr("ab"),tr("db")],questionCount:6}},{level:7,label:{he:"ספטאקורדים",en:"Seventh chords"},paramOverrides:{mode:"spell_chord",chordIds:["chord.dom7","chord.maj7","chord.m7"],rootMidis:[60,62,64,65,67],questionCount:6}}],DE={engineId:"theory_spell",name:{he:"מנוע כתיב תיאורטי",en:"Theory spelling engine"},description:{he:"איות סולמות ואקורדים בשמות הצלילים — הפקה אמיתית, לא זיהוי. שקילות אנהרמונית מתקבלת. מודל האינטראקציה קבוע, התוכן דאטה",en:"Spell scales and chords by note name — production, not recognition; enharmonics accepted. Content is data"},typeIds:["theory_spell"],ladders:{theory_spell:OE}},VE=["find_wrong","find_extreme"],Y6=ue({mode:Le(VE),clef:Le(["treble","bass","alto","tenor"]),keyId:G().min(1).refine(n=>n.startsWith("key."),{message:"keyId must be a key knowledge id"}),extreme:Le(["highest","lowest"]).optional(),noteCount:B().int().min(3).max(8),lowMidi:B().int().min(24).max(96),highMidi:B().int().min(24).max(108),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"}).refine(n=>_o(n.keyId,n.lowMidi,n.highMidi).length>=n.noteCount,{message:"range must contain at least noteCount diatonic notes"});function LE(n,e,t){const r=new Set;let s=0;for(;r.size<e&&s++<500;)r.add(Math.floor(t()*n));return[...r]}function p2(n,e){var a;const t=_o(n.keyId,n.lowMidi,n.highMidi),r=new Set(t.map(c=>(c.midi%12+12)%12)),s=c=>!r.has((c%12+12)%12),i=((a=pn(n.keyId))==null?void 0:a.symbol)??"C";return Array.from({length:n.questionCount},(c,l)=>{if(n.mode==="find_wrong"){const g=Math.max(0,t.length-n.noteCount),x=Math.floor(e()*(g
64+1)),b=t.slice(x,x+n.noteCount),I=1+Math.floor(e()*(b.length-2||1)),N=b[I].midi,V=e()<.5,D=s(N+(V?1:-1))?V?1:-1:V?-1:1,T=N+D,M=b.map((R,_)=>_===I?{midi:T,vexKey:Gu(zx(T,D>0?"sharp":"flat"))}:{midi:R.midi,vexKey:R.vexKey});return{index:l,mode:"find_wrong",clef:n.clef,notes:M,correctIndex:I}}const m=LE(t.length,n.noteCount,e).map(g=>({midi:t[g].midi,vexKey:t[g].vexKey})),p=n.extreme??"highest";let f=0;for(let g=1;g<m.length;g++)(p==="highest"?m[g].midi>m[f].midi:m[g].midi<m[f].midi)&&(f=g);return{index:l,mode:"find_extreme",clef:n.clef,keySignature:i,extreme:p,notes:m,correctIndex:f}})}const qE=ue({questionIndex:B().int().min(0),selectedIndex:B().int(),correctIndex:B().int()}),zE={typeId:"notation_select",category:"sight_reading",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:Y6,answerSchema:qE,evaluator:(n,e)=>{const{selectedIndex:t,correctIndex:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:n.mode==="find_wrong"?"practice.feedback.selectIncorrectWrong":"practice.feedback.selectIncorrect"},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}},FE=[{level:1,label:{he:"הצליל הגבוה",en:"Highest note"},paramOverrides:{mode:"find_extreme",extreme:"highest",clef:"treble",keyId:"key.c_major",noteCount:4,lowMidi:60,highMidi:76,questionCount:6}},{level:2,label:{he:"הצליל הנמוך",en:"Lowest note"},paramOverrides:{mode:"find_extreme",extreme:"lowest",clef:"treble",keyId:"key.c_major",noteCount:4,lowMidi:60,highMidi:76,questionCount:6}},{level:3,label:{he:"איתור הטעות — דו מז׳ור",en:"Spot the error — C major"},paramOverrides:{mode:"find_wrong",clef:"treble",keyId:"key.c_major",noteCount:5,lowMidi:60,highMidi:74,questionCount:6}},{level:4,label:{he:"איתור הטעות — לה מינור",en:"Spot the error — A minor"},paramOverrides:{mode:"find_wrong",clef:"treble",keyId:"key.a_minor",noteCount:5,lowMidi:57,highMidi:72,questionCount:6}},{level:5,label:{he:"קיצון — טווח רחב",en:"Extreme — wide range"},paramOverrides:{mode:"find_extreme",extreme:"highest",clef:"treble",keyId:"key.c_major",noteCount:6,lowMidi:55,highMidi:81,questionCount:6}},{level:6,label:{he:"איתור הטעות — מפתח פה",en:"Spot the error — bass"},paramOverrides:{mode:"find_wrong",clef:"bass",keyId:"key.c_major",noteCount:5,lowMidi:43,highMidi:60,questionCount:6}}],$E={engineId:"notation_select",name:{he:"מנוע בחירה על החמשה",en:"Notation select engine"},description:{he:"לחיצה על הצליל הנכון בחמשה — איתור טעויות וזיהוי קיצון ותבניות. מודל האינטראקציה קבוע, התוכן דאטה",en:"Click the right note on the staff — error detection and extreme/pattern spotting. Content is data"},typeIds:["notation_select"],ladders:{notation_select:FE}},BE=["function","numeral"],Q6=["I","ii","iii","IV","V","vi","vii°"],UE=["tonic","subdominant","dominant"],GE={1:"tonic",2:"subdominant",3:"tonic",4:"subdominant",5:"dominant",6:"tonic",7:"dominant"},Z6=ue({mode:Le(BE),keyIds:Te(G().min(1)).min(1),degrees:Te(B().int().min(1).max(7)).min(1),questionCount:B().int().min(1).max(30),adaptive:mn().optional(),level:B().int().min(1).optional(),objectiveId:G().optional()}).refine(n=>n.keyIds.every(e=>e.startsWith("key.")),{message:"keyIds must be key knowledge ids"});function f2(n,e){return n[Math.floor(e()*n.length)]}function g2(n,e){let t="";return Array.from({length:n.questionCount},(r,s)=>{var g,x;const i=f2(n.keyIds,e),a=(g=pn(i))==null?void 0:g.data,c=60+((a==null?void 0:a.tonicMidiClass)??0);let l=f2(n.degrees,e);`${i}:${l}`===t&&n.degrees.length>1&&(l=n.degrees[(n.degrees.indexOf(l)+1)%n.degrees.length]),t=`${i}:${l}`;const m=Q6[l-1],p=GE[l],f=Gd(m,c);return{index:s,mode:n.mode,keyId:i,keyName:((x=pn(i))==null?void 0:x.name.he)??i,degree:l,numeral:m,functionId:p,chordVexKeys:f.map(Ku),chordMidis:f,tonicMidis:Gd("I",c),correctId:n.mode==="numeral"?m:p}})}const KE=ue({questionIndex:B().int().min(0),answeredId:G(),correctId:G(),correctLabel:G
64()}),HE={typeId:"theory_function",category:"theory",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:Z6,answerSchema:KE,evaluator:(n,e)=>{const{answeredId:t,correctId:r,correctLabel:s}=e.payload,i=t===r;return{score:i?1:0,breakdown:{correct:i?1:0},feedback:i?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:s}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:i?1:0}]:[]}}},nn=n=>`key.${n}_major`,ec=[1,2,3,4,5,6,7],y2=[1,4,5],WE=[{level:1,label:{he:"תפקוד — דו מז׳ור",en:"Function — C major"},paramOverrides:{mode:"function",keyIds:[nn("c")],degrees:ec,questionCount:6}},{level:2,label:{he:"תפקוד — דו וסול",en:"Function — C & G"},paramOverrides:{mode:"function",keyIds:[nn("c"),nn("g")],degrees:ec,questionCount:6}},{level:3,label:{he:"תפקוד — שלושה סולמות",en:"Function — three keys"},paramOverrides:{mode:"function",keyIds:[nn("c"),nn("g"),nn("d")],degrees:ec,questionCount:6}},{level:4,label:{he:"דרגות ראשיות — דו",en:"Primary triads — C"},paramOverrides:{mode:"numeral",keyIds:[nn("c")],degrees:y2,questionCount:6}},{level:5,label:{he:"כל הדרגות — דו",en:"All degrees — C"},paramOverrides:{mode:"numeral",keyIds:[nn("c")],degrees:ec,questionCount:7}},{level:6,label:{he:"דרגות ראשיות — דו/סול/רה",en:"Primary — C/G/D"},paramOverrides:{mode:"numeral",keyIds:[nn("c"),nn("g"),nn("d")],degrees:y2,questionCount:6}},{level:7,label:{he:"כל הדרגות — סולמות דיאז",en:"All degrees — sharp keys"},paramOverrides:{mode:"numeral",keyIds:[nn("c"),nn("g"),nn("d"),nn("a"),nn("e")],degrees:ec,questionCount:8}}],YE={engineId:"theory_function",name:{he:"מנוע הרמוניה פונקציונלית",en:"Functional harmony engine"},description:{he:"אקורד דיאטוני בסולם — והלומד מזהה את הדרגה (I–vii°) או את התפקוד (טוניקה/סובדומיננטה/דומיננטה). מודל האינטראקציה קבוע, התוכן דאטה",en:"A diatonic chord in a key — name its degree (I–vii°) or function (tonic/subdominant/dominant). Content is data"},typeIds:["theory_function"],ladders:{theory_function:WE}},QE=["melodic","harmonic","mixed"],ZE=I6(n=>typeof n=="string"&&n in ta),J6=ue({intervals:Te(ZE).min(2),presentation:Le(QE),rootMidiRange:Io([B().int().min(36),B().int().max(96)]),questionCount:B().int().min(1).max(50),objectiveId:G().optional()});function b2(n){return n.startsWith("m")?"minor":"major"}function JE(n,e){return n[Math.floor(e()*n.length)]}function XE(n,e){const[t,r]=n.rootMidiRange;return Array.from({length:n.questionCount},(s,i)=>{const a=JE(n.intervals,e),c=ta[a],l=r-c,d=Math.floor(e()*(Math.max(t,l)-t+1))+t,m=n.presentation==="mixed"?e()<.5?"melodic":"harmonic":n.presentation;if(m==="harmonic")return{index:i,rootMidi:d,interval:a,presentation:m,direction:null,midis:[d,d+c]};const p=e()<.5?"up":"down",f=p==="up"?[d,d+c]:[d+c,d];return{index:i,rootMidi:d,interval:a,presentation:m,direction:p,midis:f}})}const eN=ue({questionIndex:B().int().min(0),presentation:Le(["melodic","harmonic"]),expectedQuality:Le(["minor","major"]),answeredQuality:Le(["minor","major"]),expectedDirection:Le(["up","down"]).nullable(),answeredDirection:Le(["up","down"]).nullable()}),tN={typeId:"ear_interval_quality",category:"ear_training",modalities:["listening"],evidenceKinds:["answer"],paramsSchema:J6,answerSchema:eN,evaluator:(n,e)=>{const{presentation:t,expectedQuality:r,answeredQuality:s,expectedDirection:i,answeredDirection:a}=e.payload,c=r===s;let l,d;if(t==="harmonic")l=c?1:0,d=c;else{const m=i===a;l=(c?.5:0)+(m?.5:0),d=c&&m}return{score:l,breakdown:{qualityRight:c?1:0},feedback:d?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.intervalQuality",detail:{quality:r,direction:i??""}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:l}]:[]}}},nN=[{level:1,label:{he:"סקונדות — מלודי",en:"Seconds — melodic"},paramOverrides:{intervals:["m2","M2"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8}},{level:2,label:{he:"סקונדות — הרמוני",en:"Seconds — harmonic"},paramOverrides:{intervals:["m2","M2"],presentation:"harmonic",rootMidiRange:[55,74],questionCount:8}},{level:3,label:{he:"טרצות — מלודי",en:"Thirds — melodic"},paramOverrides:{intervals:["m3","M3"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8}},{level:4,label:{he:"טרצות — הרמוני",en:"Thirds — harmonic"},paramOverrides:{intervals:["m3","M3"],presentation:"harmonic",rootMidiRange:[55,74],questionCount:8}},{level:5,label:{he:"סקונדות וטרצות — מעורב",en:"Seconds & thirds — mixed"},paramOverrides:{intervals:["m2","M2","m3","M3"],presentation:"mixed",rootMidiRange:[55,76],questionCount:10}}],rN={engineId:"ear_interval_quality",name:{he:"מנוע איכות מרווח בשמיעה",en:"Interval quality-by-ear engine"},description:{he:"המרווח מושמע — והלומד מזהה אם הוא קטן או גדול, ובמרווח מלודי גם את כיוונו. מודל האינטראקציה קבוע, התוכן דאטה",en:"An interval is played — name whether it is minor or major, and (melodic) its direction. Content is data"},typeIds:["ear_interval_quality"],ladders:{ear_interval_quality:nN}},sN={h:2,q:1,8:.5},X6=ue({bpm:B().int().min(40).max(160),bars:B().int().min(1).max(2),optionCount:B().int().min(2).max(4),maxPlays:B().int().min(0).max(20),questionCount:B().int().min(1).max(30),objectiveId:G().optional()});function x2(n){return n.map(e=>e.map(t=>(t.rest?"r":"")+t.duration).join(".")).join("|")}function iN(n){const e=[];let t=0;for(;t<4;){const r=4-t,s=n();r>=2&&s<.3?(e.push({duration:"h",rest:n()<.2}),t+=2):s<.65?(e.push({duration:"q",rest:n()<.25}),t+=1):(e.push({duration:"8",rest:n()<.3}),e.push({duration:"8",rest:n()<.3}),t+=1)}return e}function aN(n){return n.reduce((e,t)=>
64e+t.filter(r=>!r.rest).length,0)}function v2(n,e){for(let t=0;t<50;t++){const r=Array.from({length:n},()=>iN(e));if(aN(r)>=Math.max(3,n+1))return r}return Array.from({length:n},()=>Array.from({length:4},()=>({duration:"q",rest:!1})))}function oN(n,e){return Array.from({length:n.questionCount},(t,r)=>{const s=v2(n.bars,e),i=new Set([x2(s)]),a=[];for(let d=0;a.length<n.optionCount-1&&d<200;d++){const m=v2(n.bars,e),p=x2(m);i.has(p)||(i.add(p),a.push(m))}const c=Math.floor(e()*(a.length+1)),l=[...a];return l.splice(c,0,s),{index:r,bars:s,options:l,correctIndex:c}})}function cN(n,e){const t=fl(e),r=[];let s=0;for(const i of n)for(const a of i)a.rest||r.push(s*t),s+=sN[a.duration];return r}const lN=ue({questionIndex:B().int().min(0),chosenIndex:B().int(),correctIndex:B().int()}),dN={typeId:"rhythm_dictation",category:"rhythm",modalities:["listening","reading"],evidenceKinds:["answer"],paramsSchema:X6,answerSchema:lN,evaluator:(n,e)=>{const{chosenIndex:t,correctIndex:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.dictationIncorrect"},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}},uN=[{level:1,label:{he:"תיבה אחת — 3 אפשרויות",en:"One bar — 3 options"},paramOverrides:{bpm:70,bars:1,optionCount:3,maxPlays:5,questionCount:6}},{level:2,label:{he:"שתי תיבות — 3 אפשרויות",en:"Two bars — 3 options"},paramOverrides:{bpm:70,bars:2,optionCount:3,maxPlays:5,questionCount:6}},{level:3,label:{he:"שתי תיבות — 4 אפשרויות",en:"Two bars — 4 options"},paramOverrides:{bpm:70,bars:2,optionCount:4,maxPlays:5,questionCount:8}}],hN={engineId:"rhythm_dictation",name:{he:"מנוע הכתבה רתמית",en:"Rhythmic dictation engine"},description:{he:"מקצב קצר מושמע — והלומד מזהה את הרישום הנכון מבין האפשרויות. חצאים, רבעים, שמיניות ושתיקות. מודל האינטראקציה קבוע, התוכן דאטה",en:"A short rhythm is played — pick the matching notation. Halves, quarters, eighths and rests. Content is data"},typeIds:["rhythm_dictation"],ladders:{rhythm_dictation:uN}},mN=["full","blank"],pN=["start","middle","end"],e4=ue({mode:Le(mN),blankPosition:Le(pN).optional(),keyId:G().min(1).refine(n=>n.startsWith("key."),{message:"keyId must be a key id"}),lowMidi:B().int().min(36).max(96),highMidi:B().int().min(36).max(96),noteCount:B().int().min(3).max(8),optionCount:B().int().min(2).max(4),maxPlays:B().int().min(0).max(20),questionCount:B().int().min(1).max(30),objectiveId:G().optional()}).refine(n=>n.highMidi>n.lowMidi,{message:"highMidi must exceed lowMidi"}).refine(n=>_o(n.keyId,n.lowMidi,n.highMidi).length>=3,{message:"range must contain at least three diatonic notes (the bank)"});function fN(n,e){return n[Math.floor(e()*n.length)]}function gN(n,e,t){let r=Math.floor(t()*n);const s=[r];for(let i=1;i<e;i++){const a=t()<.7?1:2;let c=r+(t()<.5?-a:a);(c<0||c>=n)&&(c=r-(c-r)),c=Math.max(0,Math.min(n-1,c)),c===r&&n>1&&(c=r===0?1:r-1),r=c,s.push(r)}return s}const I2=n=>n.join(".");function yN(n,e){const t=_o(n.keyId,n.lowMidi,n.highMidi),r=s=>qe(cr(s));return Array.from({length:n.questionCount},(s,i)=>{const a=gN(t.length,n.noteCount,e),c=a.map(N=>t[N].midi),l=c.map(r);if(n.mode==="full"){const N=new Set([I2(a)]),V=[];for(let R=0;V.length<n.optionCount-1&&R<200;R++){const _=[...a],j=1+Math.floor(e()*2);for(let A=0;A<j;A++){const O=Math.floor(e()*_.length);let C=Math.floor(e()*t.length);C===_[O]&&(C=(C+1)%t.length),_[O]=C}const w=I2(_);N.has(w)||(N.add(w),V.push(_))}const D=Math.floor(e()*(V.length+1)),T=[...V];T.splice(D,0,a);const M=T.map(R=>({vexKeys:R.map(_=>t[_].vexKey)}));return{index:i,mode:"full",midis:c,names:l,blankIndex:null,options:M,correctIndex:D}}const d=n.blankPosition??"end",m=d==="start"?0:d==="end"?c.length-1:1+Math.floor(e()*Math.max(1,c.length-2)),p=c[m],f=t.map(N=>N.midi).filter(N=>N%12!==p%12),g=[];for(let N=0;g.length<n.optionCount-1&&N<200&&f.length>0;N++){const V=fN(f,e);g.some(D=>D%12===V%12)||g.push(V)}const x=Math.floor(e()*(g.length+1)),b=[...g];b.splice(x,0,p);const I=b.map(N=>({label:r(N)}));return{index:i,mode:"blank",midis:c,names:l,blankIndex:m,options:I,correctIndex:x}})}const bN=ue({questionIndex:B().int().min(0),chosenIndex:B().int(),correctIndex:B().int()}),xN={typeId:"melody_dictation",category:"ear_training",modalities:["listening","reading"],evidenceKinds:["answer"],paramsSchema:e4,answerSchema:bN,evaluator:(n,e)=>{const{chosenIndex:t,correctIndex:r}=e.payload,s=t===r;return{score:s?1:0,breakdown:{correct:s?1:0},feedback:s?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.dictationIncorrect"},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:s?1:0}]:[]}}},tc={keyId:"key.c_major",lowMidi:60,highMidi:67}
64,vN=[{level:1,label:{he:"השלמת סוף המשפט",en:"Complete the end"},paramOverrides:{mode:"blank",blankPosition:"end",...tc,noteCount:4,optionCount:3,maxPlays:5,questionCount:6}},{level:2,label:{he:"השלמת תחילת המשפט",en:"Complete the start"},paramOverrides:{mode:"blank",blankPosition:"start",...tc,noteCount:4,optionCount:3,maxPlays:5,questionCount:6}},{level:3,label:{he:"השלמת האמצע",en:"Complete the middle"},paramOverrides:{mode:"blank",blankPosition:"middle",...tc,noteCount:5,optionCount:4,maxPlays:5,questionCount:6}},{level:4,label:{he:"הכתבה — בחירה מרובה",en:"Dictation — multiple choice"},paramOverrides:{mode:"full",...tc,noteCount:4,optionCount:3,maxPlays:5,questionCount:6}},{level:5,label:{he:"הכתבה ארוכה יותר",en:"Longer dictation"},paramOverrides:{mode:"full",...tc,noteCount:5,optionCount:4,maxPlays:5,questionCount:8}}],IN={engineId:"melody_dictation",name:{he:"מנוע הכתבה מלודית",en:"Melodic dictation engine"},description:{he:"מנגינה קצרה מושמעת — והלומד בוחר את הרישום הנכון או את התו החסר. מודל האינטראקציה קבוע, התוכן דאטה",en:"A short melody is played — pick the matching notation or the missing note. Content is data"},typeIds:["melody_dictation"],ladders:{melody_dictation:vN}},La=["root","first","second","third"];function _N(n){return Ht(n).data.intervals.length}function kN(n,e){return Ht(n).data.intervals.map(t=>e+t)}function wN(n,e){return[...n.map((r,s)=>s<e?r+12:r)].sort((r,s)=>r-s)}const t4=ue({chordIds:Te(G().min(1)).min(1),rootMidiRange:Io([B().int(),B().int()]),inversions:Te(Le(La)).min(1),questionCount:B().int().min(1).max(30),objectiveId:G().optional()}).refine(n=>n.chordIds.every(e=>e.startsWith("chord.")),{message:"chordIds must be chord knowledge ids"}).refine(n=>n.rootMidiRange[0]<=n.rootMidiRange[1],{message:"rootMidiRange must be ascending"});function _2(n,e){return n[Math.floor(e()*n.length)]}function jN(n,e){const[t,r]=n.rootMidiRange;let s="";return Array.from({length:n.questionCount},(i,a)=>{const c=_2(n.chordIds,e),l=_N(c),d=n.inversions.filter(M=>La.indexOf(M)<l),m=d.length>0?d:["root"];let p=_2(m,e);const f=t+Math.floor(e()*(r-t+1));`${c}:${p}`===s&&m.length>1&&(p=m[(m.indexOf(p)+1)%m.length]),s=`${c}:${p}`;const x=La.indexOf(p),b=kN(c,f),I=wN(b,x),N=((I[0]-f)%12+12)%12,D=Ht(c).data.intervals.findIndex(M=>(M%12+12)%12===N),T=La[D];return{index:a,chordId:c,chordName:Ht(c).name.he,rootMidi:f,inversionIndex:x,midis:I,vexKeys:I.map(Ku),correctId:T}})}const TN=ue({questionIndex:B().int().min(0),answeredId:G(),correctId:G(),correctLabel:G()}),EN={typeId:"chord_inversion",category:"theory",modalities:["reading"],evidenceKinds:["answer"],paramsSchema:t4,answerSchema:TN,evaluator:(n,e)=>{const{answeredId:t,correctId:r,correctLabel:s}=e.payload,i=t===r;return{score:i?1:0,breakdown:{correct:i?1:0},feedback:i?{correct:!0,messageKey:"practice.feedback.correct"}:{correct:!1,messageKey:"practice.feedback.incorrectEntity",detail:{expected:s}},objectiveSignals:n.objectiveId?[{objectiveId:n.objectiveId,signal:i?1:0}]:[]}}};ue({id:G().min(1),kind:Le(["course","standalone"]),title:G().min(1),objectiveIds:Te(G()),exerciseIds:Te(G()),level:G().optional(),lessonNumber:B().int().min(1).max(30).optional(),groupIds:Te(G()),publishedToFreePractice:mn(),authorId:G(),authorName:G(),authorRole:Le(["teacher","admin"]),createdAt:G(),updatedAt:G()});function NN(n,e){const t=n.filter(s=>s.trim().length>0).join(", "),r=t?`תרגול בנושא ${t}`:"תרגול חדש";return e&&e.trim()?`${r} — ${e.trim()}`:r}const k2={"obj-1":{objectiveId:"obj-1",title:"זיהוי מרווחים בשמיעה",intro:"מרווח הוא המרחק בין שני צלילים, והיכולת לזהות אותו באוזן היא הבסיס לכל שמיעה מוסיקלית — היא מאפשרת לך לתפוס מלודיה, הרמוניה ומבנה בלי לראות תווים.",sections:[{heading:"מהו מרווח מלודי",body:"מרווח מלודי נשמע כששני צלילים מתנגנים בזה אחר זה, עולה או יורד. בתרגול זה נתמקד במרווחים המרכזיים: טרצה קטנה וגדולה, קווארטה וקווינטה זכות, וסקסטה קטנה וגדולה. לכל מרווח יש טביעת אוזן אופיינית שנלמדת דרך חזרה והשוואה."},{heading:"איך לזהות",body:'קשירת המרווח לפתיחה של שיר מוכר עוזרת מאוד: קווינטה זכה נשמעת כמו שני הצלילים הפותחים של "Twinkle Twinkle" (דו-סול), וטרצה גדולה כמו שני הצלילים הראשונים בסולם מז׳ורי (דו-מי). שים לב אם המרווח נשמע רחב או צר, ואם צלצולו בהיר או קודר.'},{heading:"בלבולים נפוצים",body:"ההבחנה בין טרצה גדולה לקטנה היא ההבחנה בין צליל בהיר ומז׳ורי לצליל קודר ומינורי — חצי טון בלבד מפריד ביניהם. גם קווארטה וקווינטה מתבלבלות: הקווינטה יציבה ופתוחה יותר, הקווארטה מעט מתוחה ומצפה להמשך."}],tip:"זמזם בעצמך את שני הצלילים אחרי ההשמעה. הפקה קולית מקבעת את גודל המרווח באוזן מהר יותר מהאזנה פסיבית."},"obj-2":{objectiveId:"obj-2",title:"יציבות קצב 60–100 BPM",intro:"קצב יציב הוא עמוד השדרה של כל ביצוע מוסיקלי. היכולת לשמור על פעימה קבועה, בלי להאיץ או להאט, היא מיומנות נרכשת שאפשר לאמן.",sections:[{heading:"מהי פעימה ומהו טמפו",body:"הפעימה היא הדופק הקבוע שמתחתיו זורמת המוסיקה, והטמפו הוא מהירותו הנמדדת ב-BPM (פעימות לדקה). בטווח 60–100 הפעימה נעה מאיטית ורגועה עד בינונית וזורמת, טווח שבו קל לחוש את הדופק אך גם קל לסטות ממנו."},{heading:"חלוקה פנימית",body:"במשקל 4/4 כל פעימה היא רבע, וארבע פעימות ממלאות תיבה. כשמופיעות שמיניות, כל פעימה מתחלקת לשתיים שוות; היכולת לחלק את הפעימה בפנים, בלי לזוז מהדופק הראשי, היא המפתח ליציבות."},{heading:"עבודה עם מטרונום",body:"המטרונום חושף האצות והאטות שהאוזן לבדה מפספסת. נגן או הקש יחד איתו והקשב אם ההקשה שלך מקדימה או מפגרת אחרי הקליק — סטייה קבועה מעידה על נטייה שכדאי לתקן."}],tip:"תרגל תחילה בטמפו איטי ויציב לחלוטין, ורק כשהוא נקי העלה מהירות. מדויק ואיטי עדיף על מהיר ורופף."},"obj-3":{objectiveId:"obj-3",title:"סולמות מז׳וריים — שתי ידיים",intro:"הסולם המז׳ורי הוא אבן היסוד של המערכת הטונלית, ונגינתו בשתי ידיים בונה טכניקה, שליטה באצבוע וחוש טונלי בו-זמנית.",sections:[{heading:"מבנה הסולם המז׳ורי",body:"הסולם המז׳ורי בנוי על רצף קבוע של טונים וחצאי טונים: טון-טון-חצי-טון-טון-טון-חצי. חצאי הטונים נמצאים תמיד בין הדרגה השלישית לרביעית ובין השביעית לשמינית. רצף זה הוא שנותן לסולם את צלילו הבהיר, ומכתיב אילו סימני היתק נחוצים בכל טוניקה."},{heading:"דו מז׳ור וסול מז׳ור",body:"דו מז׳ור אינו כולל דיאזים או במולים והוא נקודת הפתיחה הטבעית. סול מז׳ור מוסיף פה דיאז אחד כדי לשמור על אותו מבנה מרווחים, והדיאז הזה הוא הדרגה השביעית — הצליל המוביל שנמשך אל הטוניקה."},{heading:"תיאום שתי הידיים",body:"בנגינה בשתי ידיים חשוב אצבוע עקבי, והידיים משתמשות בתבניות אצבוע משלימות. תרגל כל יד בנפרד עד לזרימה, ורק אז חבר — כך המוח מקבע את התנועה לפני שהוא מתמודד עם התיאום."}],tip:"עבור על הסולם לאט וללא מטרונום כדי לוודא אצבוע נקי, ורק אחר כך הוסף פעימה. אצבוע לא נכון בטמפו איטי יתפוצץ במהיר."},"obj-4":{objectiveId:"obj-4",title:"בניית משולשים",intro:"המשולש (טריאדה) הוא האקורד הבסיסי במוסיקה הטונלית — שלושה צלילים בבנייה של טרצות. הבנת בנייתו היא היסוד להרמוניה כולה.",sections:[{heading:"ארבעת סוגי המשולשים",body:"משולש נבנה מיסוד, טרצה וקווינטה. במז׳ורי יש טרצה גדולה מתחת וטרצה קטנה מעל, וביחד קווינטה זכה. במינורי הסדר הפוך: טרצה קטנה מתחת וגדולה מעל, גם כאן קווינטה זכה. המוקטן בנוי משתי טרצות קטנות עם קווינטה מוקטנת, והמוגדל משתי טרצות גדולות עם קווינטה מוגדלת."},{heading:"זיהוי לפי הטרצות",body:"הדרך הבטוחה לבנות משולש היא לחשוב במונחי טרצות, לא במונחי צלילים בודדים. שאל את עצמך: הטרצה התחתונה גדולה או קטנה, וכך גם העליונה. צירוף האיכויות קובע את סוג המשולש באופן חד-משמעי."},{heading:"האיכות והצליל",body:"מז׳ורי נשמע יציב ובהיר, מינורי קודר ורך, מוקטן מתוח ולא יציב הדורש פתרון, ומוגדל חלומי ומרחף. הקווינטה היא שקובעת יציבות: זכה במז׳ורי ובמינורי, ואילו החריגה שלה מייצרת את המתח במוקטן ובמוגדל."}],tip:"בנה כל משולש משלושת השורשים — יסוד, טרצה, קווינטה — ורק אחר כך בדוק היפוכים. חשיבה בטרצות מונעת טעויות איות."},"obj-5":{objectiveId:"obj-5",title:"דיוק אינטונציה בשירה",intro:"אינטונציה היא מידת הדיוק שבה הקול פוגע בגובה הצליל הנכון. שירה מדויקת דורשת אוזן שמקשיבה תוך כדי הפקה, ותיקון רציף.",sections:[{heading:"מרווחים צמודים",body:"הצעדים הקטנים ביותר בסולם הם הסקונדה הגדולה (טון שלם) והסקונדה הקטנה (חצי טון). דיוק בה×
64 קריטי, כי סטייה קטנה כבר נשמעת זייפנית. חצי הטון דורש קרבה מדויקת בין הצלילים, בעוד הטון השלם פותח מעט יותר."},{heading:"שירה לאורך הסולם",body:"הליכה לאורך הסולם המז׳ורי חושפת את מקומות חצאי הטונים — בין הדרגה השלישית לרביעית ובין השביעית לשמינית. נטייה נפוצה היא לשיר את הדרגה השביעית נמוך מדי; יש למשוך אותה כלפי הטוניקה כצליל מוביל."},{heading:"תיקון תוך כדי הפקה",body:"אינטונציה משתפרת כשמקשיבים לצליל התייחסות ומכוונים אליו את הקול תוך כדי שירה. שיר לאט, החזק צלילים ארוכים, וכוון עדין למעלה או למטה עד שהצליל מתמזג עם ההתייחסות בלי פעימות מרעד."}],tip:"הקלט את עצמך ושיר מול צליל התייחסות מנגן. השוואה חיצונית חושפת סטיות שהאוזן הפנימית מפספסת בזמן אמת."},"obj-6":{objectiveId:"obj-6",title:"מרווחים הרמוניים בשמיעה",intro:"מרווח הרמוני נשמע כששני צלילים מתנגנים יחד באותו הרגע. זיהויו דורש אוזן שמפרקת צליל מורכב לרכיביו — מיומנות בסיסית להאזנה הרמונית.",sections:[{heading:"מלודי מול הרמוני",body:"בניגוד למרווח מלודי הנשמע ברצף, המרווח ההרמוני נשמע בו-זמנית וכל הצלילים מתמזגים לצליל אחד. האתגר הוא לשמוע את שני הצלילים בתוך המזיגה, ולהעריך את המרחק ביניהם לפי אופי הצליל הכולל."},{heading:"קונסוננס ודיסוננס",body:"הטרצות והסקסטות נשמעות מתוקות ומלאות, הקווינטה הזכה פתוחה וחלולה, והאוקטבה נשמעת כמו הכפלה של אותו צליל. טרצה קטנה נשמעת קודרת יותר מגדולה. ככל שהמרווח קונסוננטי יותר, כך הצליל מתלכד וזורם בלי מתח."},{heading:"שיטת הפירוק",body:"כשקשה לזהות, נסה לזמזם כלפי מעלה מהצליל התחתון אל העליון — הפיכת המרווח ההרמוני למלודי חושפת את גודלו. האוקטבה בולטת כי שני הצלילים נשמעים כאותה נימה בגובה שונה."}],tip:"התאמן לזהות תחילה את הצליל התחתון, ואז לזמזם כלפי מעלה עד לצליל העליון. הפיכה למלודי היא הגשר הבטוח ביותר."},"obj-7":{objectiveId:"obj-7",title:"זיהוי סוגי אקורדים בשמיעה",intro:"זיהוי איכות האקורד באוזן — מז׳ורי, מינורי, מוקטן או מוגדל — הוא צעד מעבר למרווח בודד אל תפיסת צבע הרמוני שלם.",sections:[{heading:"הצבע ההרמוני",body:"לכל איכות משולש יש אופי רגשי מובחן: מז׳ורי בהיר ופתוח, מינורי קודר ורך, מוקטן מתוח וחסר יציבות, ומוגדל מרחף וחלומי. הצבע נקבע בעיקר בטרצה שמעל היסוד — גדולה למז׳ורי, קטנה למינורי."},{heading:"תפקיד הקווינטה",body:"המז׳ורי והמינורי חולקים קווינטה זכה ולכן נשמעים יציבים; ההבדל ביניהם הוא באיכות הטרצה בלבד. המוקטן מכווץ את הקווינטה למוקטנת ויוצר מתח הדורש פתרון, והמוגדל מרחיב אותה למוגדלת ויוצר תחושה מרחפת ולא ממוקדת."},{heading:"אסטרטגיית האזנה",body:"ראשית קבע אם הצליל בהיר או קודר — כך תפריד מז׳ורי ממינורי. אם הצליל אינו יציב ודורש המשך, בדוק אם הוא מתוח וכיווצי (מוקטן) או מרחף ופתוח (מוגדל). זיהוי הטרצה ואז הקווינטה נותן תשובה ודאית."}],tip:"פרק את האקורד לצלילים בודדים על ידי זמזום מלמטה למעלה. שמיעת הטרצה והקווינטה בנפרד מסירה כל ספק לגבי האיכות."}
64,"obj-8":{objectiveId:"obj-8",title:"זיהוי קדנצות בשמיעה",intro:"קדנצה היא נקודת פיסוק הרמונית — הדרך שבה משפט מוסיקלי נעצר או מסתיים. זיהוי הקדנצה באוזן הוא זיהוי הדקדוק של ההרמוניה.",sections:[{heading:"קדנצה אותנטית ופלגלית",body:"הקדנצה האותנטית נעה מדרגה חמישית (הדומיננטה) אל הראשונה (הטוניקה), V–I, ונשמעת כסיום מלא וסגור. הקדנצה הפלגלית נעה מדרגה רביעית אל ראשונה, IV–I, ונשמעת רכה ומרוככת יותר — היא מוכרת כסיום אמן בשירה כנסייתית."},{heading:"חצי קדנצה וקדנצה מטעה",body:"חצי הקדנצה נעצרת על הדומיננטה, על דרגה חמישית, ומשאירה תחושת שאלה פתוחה שמצפה להמשך. הקדנצה המטעה מבטיחה סיום אותנטי אך במקום הטוניקה מגיעה דרגה שישית, V–vi — הפתעה רכה שמאריכה את המשפט במקום לסגור אותו."},{heading:"מה להקשיב",body:"שאל תחילה: האם המשפט מרגיש סגור או פתוח. סגור מעיד על אותנטית או פלגלית, פתוח על חצי קדנצה. אם ציפית לסגירה מלאה אך קיבלת צליל מינורי לא צפוי — זו כנראה קדנצה מטעה."}],tip:"שיר את צליל הבס של האקורד האחרון ובדוק אם הוא הטוניקה. הבס לבדו חושף את מרבית ההבדל בין סוגי הקדנצות."},"obj-9":{objectiveId:"obj-9",title:"זיהוי סולמות ומודוסים בשמיעה",intro:"לכל סולם ומודוס אופי צליל ייחודי הנקבע במיקום חצאי הטונים. זיהויו באוזן פותח את הדלת לצבעים שמעבר למז׳ור ולמינור.",sections:[{heading:"מז׳ור מול מינור",body:"הסולם המז׳ורי בהיר, עם טרצה גדולה מעל הטוניקה. המינור הטבעי קודר, עם טרצה קטנה, וכן סקסטה וספטימה קטנות. ההבדל הראשון שהאוזן קולטת הוא צבע הטרצה — בהיר או עצוב."},{heading:"מינור הרמוני",body:"המינור ההרמוני מעלה את הדרגה השביעית בחצי טון כדי ליצור צליל מוביל חזק אל הטוניקה. התוצאה היא מרווח מוגדל אופייני בין הדרגה השישית לשביעית, שנותן לסולם צבע מזרחי ומתוח שקל לזהות באוזן."},{heading:"המודוס הדוריאני",body:"הדוריאני הוא מודוס מינורי במהותו — טרצה קטנה — אך עם סקסטה גדולה, בניגוד למינור הטבעי. הסקסטה המורמת מעניקה לו צליל קודר אך מואר, לא לגמרי עצוב, מוכר מפולק ומג׳אז מודאלי."}],tip:"שיר את הסולם כלפי מעלה ומטה ואתר היכן נופלים חצאי הטונים. מיקומם הוא טביעת האצבע שמבדילה מודוס ממודוס."},"obj-11":{objectiveId:"obj-11",title:"קריאת תווים בחמשה",intro:"קריאת תווים היא היכולת לתרגם סימן על החמשה לגובה צליל מיידי. שטף בקריאה הוא הבסיס לכל נגינה ושירה מן הכתב.",sections:[{heading:"החמשה והמפתח",body:"החמשה בנויה מחמישה קווים וארבעה רווחים, והמפתח בתחילתה קובע את שמות הצלילים. במפתח סול, הקו השני מלמטה הוא סול, ומשם נגזרים שאר התווים בסדר האלפביתי החוזר דו רה מי פה סול לה סי."},{heading:"קווים ורווחים",body:"צלילים מתחלפים בין קו לרווח כשעולים מעלה. במפתח סול הרווחים מלמטה למעלה מאייתים פה לה דו מי, והקווים מי סול סי רה פה. שינון עוגני זיכרון אלה מאיץ את הזיהוי עד שהוא מיידי."},{heading:"קריאה ביחס",body:"קורא מיומן אינו מאיית כל תו מחדש אלא קורא במרווחים: אם צליל אחד ידוע, השכן שמעליו בקו הבא הוא טרצה, ורצף צמוד הוא צעד סולם. קריאת צורות ותנועות מהירה מקריאת אות בודדת."}],tip:"בחר מספר תווי עוגן שאתה מזהה מיד, וקרא את השכנים ביחס אליהם. עדיף לחשוב במרווחים מאשר לאיית כל צליל בנפרד."},"obj-10":{objectiveId:"obj-10",title:"סינקופות ומשקל מורכב",intro:"סינקופה היא הדגשה במקום הבלתי צפוי, ומשקל מורכב מחלק את הפעימה לשלושה. שניהם מייצרים את התחושה הריתמית החיה שמעבר לרבעים פשוטים.",sections:[{heading:"מהי סינקופה",body:"סינקופה מדגישה חלקים חלשים של הפעימה — למשל את המקצב שבין שני רבעים במקום את הרבעים עצמם. ההדגשה מזיזה את המשקל מהמקום החזק הצפוי, ויוצרת דחיפה ומתח שמושכים את המוסיקה קדימה."},{heading:"משקל מורכב — 6/8",body:"ב-6/8 יש שש שמיניות בתיבה, אך הן מקובצות לשתי פעימות ראשיות של שלוש שמיניות כל אחת. זהו משקל מורכב: כל פעימה מתחלקת לשלושה, בניגוד למשקל הפשוט שבו הפעימה מתחלקת לשניים. התחושה מתנדנדת ומתגלגלת."},{heading:"ספירה נכונה",body:"ב-6/8 ספור שתי פעימות גדולות ולא שש קטנות — אחת שתיים שלוש, ארבע חמש שש — כשההדגשה על אחת ועל ארבע. תפיסת שתי הפעימות הגדולות היא שמבדילה את הגלגול של 6/8 מהצעד הישר של 3/4."}],tip:"הקש את הפעימה הראשית ברגל ואת התבנית המסונקפת ביד. הפרדה זו בין הדופק היציב להדגשה החורגת היא סוד הביצוע הנקי."},"obj-12":{objectiveId:"obj-12",title:"כתיבה ובנייה על החמשה",intro:"כתיבה על החמשה היא הצד הפעיל של הקריאה: לא רק לזהות סימן, אלא למקם צליל, מרווח או אקורד במקומו המדויק. זו מיומנות שמעמיקה את ההבנה התיאורטית.",sections:[{heading:"מיקום צליל מדויק",body:"כתיבת תו נכונה מחייבת דיוק בקו או ברווח, כי הזזה של מדרגה אחת משנה את הצליל. עבוד מתוך המפתח: קבע צליל עוגן ידוע וספור מרווחים ממנו כלפי מעלה או מטה עד ליעד."},{heading:"בניית מרווחים",body:"כדי לכתוב טרצה גדולה מעל דו, ספור שלושה שמות צלילים דו-רה-מי וודא שהמרחק הוא שני טונים שלמים. שם הצליל קובע את גודל המרווח, והאיכות נקבעת במספר חצאי הטונים שבין הצלילים."},{heading:"בניית סולם ומשולש",body:"בבניית סולם מז׳ורי החל מהטוניקה ויישם את תבנית הטונים וחצאי הטונים, והוסף סימני היתק כנדרש. בבניית משולש מז׳ורי הנח יסוד, טרצה גדולה מעליו וקווינטה זכה מעל היסוד — שלושה צלילים בהפרשי טרצה."}],tip:"לפני כתיבה אמור בקול את שמות הצלילים של המרווח או הסולם. איות מילולי נכון מונע שגיאות מיקום על החמשה."},"obj-13":{objectiveId:"obj-13",title:"ארגון ומיון מושגים מוסיקליים",intro:"הבנה מוסיקלית עמוקה אינה רשימת עובדות אלא רשת של קשרים. מיון וארגון מושגים לפי תכונות משותפות הופך ידע מפוזר למפה קוהרנטית.",sections:[{heading:"מיון לפי איכות",body:"מרווחים ואקורדים ניתן לקבץ לפי איכות: קונסוננטי מול דיסוננטי, מז׳ורי מול מינורי, יציב מול מתוח. קווינטה זכה ואקורד מז׳ורי שייכים למשפחת היציבים, בעוד סקונדה קטנה ואקורד מוקטן שייכים למתוחים הדורשים פתרון."},{heading:"מיון לפי גודל ותפקיד",body:"אפשר גם לסדר מושגים על ציר: מרווחים מהצר לרחב, אקורדים מהבהיר לקודר, דרגות לפי מידת המתח שלהן. סידור על ציר חושף יחסים שלא נראים כשהמושגים מפוזרים — למשל שהסקונדה הקטנה היא המרווח הצמוד והמתוח מכולם."},{heading:"למה זה עוזר",body:"כשמושג חדש נכנס למשפחה מוכרת, קל יותר לזכור ולהשתמש בו. אם אתה יודע שאקורד מינורי דומה למז׳ורי אך עם טרצה קטנה, אתה לומד אותו כווריאציה ולא כישות חדשה לגמרי. ארגון הוא כלי לזיכרון ולהעברה."}],tip:"כשאתה פוגש מושג חדש, שאל למי הוא דומה וממי הוא שונה. מיקומו ביחס למוכר מקבע אותו בזיכרון טוב יותר משינון בודד."},"obj-14":{objectiveId:"obj-14",title:"זיהוי חתימות מפתח",intro:"חתימת המפתח היא אוסף הדיאזים או הבמולים בתחילת החמשה שקובע את הסולם. זיהוי מהיר שלה חוסך קריאת סימני היתק בכל תו ותו.",sections:[{heading:"סדר הדיאזים והבמולים",body:"הדיאזים מופיעים תמיד בסדר קבוע: פה דו סול רה לה מי סי. הבמולים בסדר ההפוך: סי מי לה רה סול דו פה. הסדר קבוע לחלוטין ואינו משתנה, כך שחתימה עם שני דיאזים תמיד תכלול פה דו ולא צירוף אחר."},{heading:"זיהוי הסולם המז׳ורי",body:"בחתימת דיאזים, הדיאז האחרון הוא הצליל המוביל, וחצי טון מעליו נמצאת הטוניקה. פה דיאז אחד נותן סול מז׳ור, ופה-דו נותנים רה מז׳ור. בחתימת במולים, הבמול הלפני-אחרון הוא שם הסולם: סי-מי במול נותנים סי במול מז׳ור, ובמול אחד לבדו הוא פה מז׳ור."},{heading:"סולמות מקבילים",body:"כל חתימת מפתח משרתת גם סולם מז׳ורי וגם מינורי מקבילי, היושב טרצה קטנה מתחת לטוניקה המז׳ורית. סול מז׳ור ומי מינור חולקים את אותו פה דיאז. ההקשר המוסיקלי — הצליל שעליו הכל נשען — קובע איזה מהשניים פעיל."}],tip:"שנן את סדר הדיאזים פה-דו-סול-רה-לה-מי-סי כרצף אחד. כשהוא אוטומטי, אתה מזהה כל חתימה בשבריר שנייה."},"obj-15":{objectiveId:"obj-15",title:"קריאת סימני היתק",intro:"סימני היתק — דיאז, במול ובקר — משנים את גובה הצליל בחצי טון ומאפשרים לגשת לכל צליל כרומטי. קריאתם הנכונה חיונית לדיוק.",sections:[{heading:"שלושת הסימנים",body:"הדיאז מעלה צליל בחצי טון, הבמול מוריד אותו בחצי טון, והבקר מבטל היתק קודם ומחזיר את הצליל לטבעי. חצי טון הוא המרחק הקטן ביותר במערכת — כמו מדו לדו דיאז, או מסי לסי במול."},{heading:"תחולה בתוך התיבה",body:"סימן היתק חל על כל הצלילים באותו גובה בתיבה שבה הופיע, עד לקו התיבה הבא. אם דו הפך לדו דיאז בתחילת התיבה, כל דו נוסף באותה תיבה יישאר דיאז — אלא אם בקר מבטל אותו. מעבר לקו התיבה ההיתק מתאפס."},{heading:"אנהרמוניה",body:"לעיתים אותו צליל בגובהו נכתב בשני שמות: דו דיאז ורה במול הם אותו מקש בפסנתר אך שמות שונים. הבחירה בשם נקבעת בהקשר הטונלי — הכיוון שאליו הצליל נמשך והסולם שבו הוא יושב. באוזן הם זהים, בכתיב הם נבדלים."}],tip:"סמן לעצמך היכן היתק חל ומתי הוא מתבטל בקו התיבה. שכחת התאפסות ההיתק היא מקור טעות נפוץ בקריאה."},"obj-16":{objectiveId:"obj-16",title:"קריאת מלודיה — גובה ומקצב",intro:"קריאת מלודיה מאחדת שני ממדים בו-זמנית: הגובה הנכון והמשך הנכון. זהו האתגר האמיתי של קריאה מן הכתב — לשלב הכל לזרימה אחת.",sections:[{heading:"שילוב גובה ומקצב",body:"תו נושא שני נתונים: מיקומו על החמשה קובע את הגובה, וצורתו קובעת את משך הצליל. קריאה שוטפת דורשת לעבד את שניהם יחד — לדעת גם איזה צליל וגם כמה זמן — בלי לעצור ולפענח כל אחד בנפרד."},{heading:"תנועה בתוך הסולם",body:"רוב המלודיות נעות בצעדים צמודים לאורך הסולם, עם קפיצות מדי פעם. בדו מז׳ור וסול מז׳ור, זיהוי הצלילים הצמודים כצעדי סולם ושל הקפיצות כמרווחים מוכרים — טרצה, קווינטה — מאיץ מאוד את הקריאה."},{heading:"מבט קדימה",body:"קורא מיומן מסתכל תו אחד או שניים קדימה בזמן שהוא מבצע את הנוכחי, כמו נהג המסתכל אל הכביש שלפניו. מבט מקדים מונע עצירות ומאפשר לשמור על הפעימה גם כשמופיע מקצב מורכב."}],tip:"קרא תחילה את המקצב לבדו בהקשה, ואז את הגובה לבדו בזמזום, ורק אז חבר. פיצול המשימה מפנה את הראש לזרימה."},"obj-17":{objectiveId:"obj-17",title:"כתיב סולמות ואקורדים",intro:"כתיב נכון הוא בחירת שמות הצלילים הנכונים — לא רק גובה הצליל אלא האיות התיאורטי המדויק. כתיב מדויק חושף את ההיגיון ההרמוני.",sections:[{heading:"עיקרון האות הרצופה",body:"בכתיבת סולם, כל דרגה מקבלת אות שם עוקבת ורצופה: דו רה מי פה סול לה סי, בלי לדלג או לחזור על אות. לכן בסולם מסוים ייתכן פה דיאז ולא סול במול, אף שהם אותו צליל — כי אחרי מי חייבת לבוא פה, לא סול."},{heading:"כתיב מז׳ור ומינור",body:"הסולם המז׳ורי בנוי בתבנית טון-טון-חצי-טון-טון-טון-חצי, והמינור הטבעי בתבנית טון-חצי-טון-טון-חצי-טון-טון. הכתיב נגזר מהתבנית: מוסיפים דיאזים או במולים כדי לשמר את המרווחים הנכונים בין הדרגות."},{heading:"כתיב אקורדים",body:"משולש נכתב בטרצות רצופות: יסוד, ואות שמדלגת אחת מעליו, ושוב מדלגת אחת. במז׳ורי דו-מי-סול, במינורי דו-מי במול-סול. השמירה על מבנה הטרצות באיות היא שמבדילה כתיב נכון מצליל נכון בכתיב שגוי."}],tip:"ודא שכל דרגה בסולם או אקורד נושאת אות שם שונה ורצופה. הופעת אותה אות פעמ×
64™×™× או דילוג מסגירים כתיב שגוי."},"obj-18":{objectiveId:"obj-18",title:"איתור וזיהוי טעויות על החמשה",intro:"עין ביקורתית שמזהה טעות בכתיב — צליל חורג, קפיצה לא הגיונית, סימן חסר — היא מיומנות שמחדדת את הקריאה ואת ההבנה גם יחד.",sections:[{heading:"צליל חורג מהסולם",body:"כשמלודיה יושבת בסולם מסוים, צליל שאינו שייך לו בולט כזר. אם קטע בדו מז׳ור מכיל פה דיאז בלי סיבה הרמונית, סביר שזו טעות. היכרות עם צלילי הסולם הפעיל היא הכלי הראשון לאיתור חריגות."},{heading:"עקביות מרחבית",body:"קפיצה בלתי צפויה או תו שקפץ מדרגה אחת מהמקום ההגיוני מסגירים טעות מיקום. השוואת התו החשוד לשכניו ולמתאר הכללי של המלודיה עוזרת לאתר אם הוא סוטה ממה שההקשר מוביל אליו."},{heading:"סימנים חסרים או מיותרים",body:"לעיתים הטעות אינה בצליל אלא בסימון: היתק שנשכח, בקר מיותר או משך שלא מסתדר עם המשקל. סריקה שיטתית — קודם הגבהים, אחר כך ההיתקים, ואז המשכים — חושפת סוגי טעות שונים באופן מסודר."}],tip:"קבע תחילה מהו הסולם הפעיל, ורק אז סרוק תו-תו. רשת ההתייחסות של הסולם הופכת כל חריגה לגלויה מיד."},"obj-19":{objectiveId:"obj-19",title:"הרמוניה פונקציונלית ודרגות",intro:"הרמוניה פונקציונלית מסבירה מדוע אקורדים נעים כפי שהם נעים. כל דרגה בסולם ממלאת תפקיד — יציבות, מתח או מעבר — והבנתם היא הבנת שפת ההרמוניה.",sections:[{heading:"שלוש הפונקציות",body:"שלוש פונקציות מרכזיות מניעות את ההרמוניה הטונלית: הטוניקה (דרגה I) היא הבית והיציבות, הדומיננטה (דרגה V) היא המתח שדורש חזרה הביתה, והסאב-דומיננטה (דרגה IV) מכינה את הדרך אל הדומיננטה. המסע × ×¢ מיציבות למתח ובחזרה."},{heading:"דרגות הסולם",body:"בדו מז׳ור, האקורדים הבנויים על הדרגות הם I מז׳ורי, ii מינורי, iii מינורי, IV מז׳ורי, V מז׳ורי, vi מינורי ו-vii מוקטן. איכות כל אקורד נובעת מהצלילים הדיאטוניים של הסולם — לא נבחרת שרירותית אלא נגזרת מהמבנה."},{heading:"משיכה אל הטוניקה",body:"הקדנצה האותנטית V–I מגלמת את ליבת הפונקציונליות: הדומיננטה מכילה את הצליל המוביל, הדרגה השביעית, שנמשך בחצי טון אל הטוניקה. משיכה זו היא המנוע שנותן להרמוניה הטונלית את תחושת הכיוון והפתרון."}],tip:"נתח כל קטע בשאלה: האם אקורד זה בית, מתח או הכנה. חשיבה בפונקציות במקום בשמות אקורדים חושפת את היגיון התנועה."},"obj-20":{objectiveId:"obj-20",title:"זיהוי איכות מרווח בשמיעה",intro:"מעבר לזיהוי גודל המרווח, האוזן המיומנת מבחינה באיכותו המדויקת — קטנה מול גדולה. חצי טון בלבד מפריד ביניהן, אך הצבע שונה לגמרי.",sections:[{heading:"סקונדה קטנה וגדולה",body:"הסקונדה הקטנה היא חצי טון — הצעד הצמוד והמתוח ביותר, כמו מסי לדו. הסקונדה הגדולה היא טון שלם — צעד רחב ופתוח יותר, כמו מדו לרה. ההבחנה ביניהן היא ההבחנה בין מתח כמעט חורק לצעד סולם רגיל."},{heading:"טרצה קטנה וגדולה",body:"הטרצה הקטנה בת שלושה חצאי טונים ונשמעת קודרת ומינורית, כמו מלה לדו. הטרצה הגדולה בת ארבעה חצאי טונים ונשמעת בהירה ומז׳ורית, כמו מדו למי. שתיהן קונסוננטיות ומתוקות, אך הצבע הרגשי מנוגד."},{heading:"האזנה לצבע",body:"האיכות היא עניין של צבע לא פחות מגודל. גדולה נוטה להישמע פתוחה, בהירה ומרוממת, וקטנה נוטה להישמע צרה, קרובה או עצובה. לאחר קביעת מספר הצעדים במרווח, הקשב לצבע כדי להכריע בין קטנה לגדולה."}],tip:"צמד כל איכות לשיר מוכר: טרצה גדולה לפתיחת סולם עולה, טרצה קטנה למנגינה מינורית. עוגני צליל מזרזים את ההכרעה."},"obj-21":{objectiveId:"obj-21",title:"הכתבה רתמית",intro:"הכתבה רתמית היא תרגום מקצב נשמע לכתיב מדויק. היא בונה גשר ישיר בין האוזן ליד, ומחדדת את תפיסת הפעימה והחלוקה.",sections:[{heading:"תפיסת הפעימה תחילה",body:"לפני שמנסים לרשום, יש לקבע את הפעימה היציבה ואת המשקל. במשקל 4/4 קבע ארבע פעימות רבע בתיבה, ומקם את הצלילים ששמעת ביחס אליהן. הפעימה היא הסרגל שעליו נמדד כל אורך."},{heading:"רבעים ושמיניות",body:"צליל התופס פעימה שלמה הוא רבע, וזוג צלילים מהירים הממלאים פעימה אחת הם שתי שמיניות. ההבחנה המרכזית בהכתבה בטווח זה היא בין פעימה שנשארת שלמה (רבע) לפעימה שמתחלקת לשתיים (שמיניות)."},{heading:"עבודה בשלבים",body:"הקשב תחילה למתאר הכללי — היכן צפוף והיכן דליל — ואז מלא תיבה אחר תיבה. הקשה קלה של הפעימה תוך כדי האזנה עוזרת למקם כל צליל, וחזרה נוספת מאמתת את מה שרשמת."}],tip:"הקש את הפעימה ביד אחת ואת המקצב הנשמע ביד השנייה לפני הרישום. תחושה גופנית של החלוקה מדייקת את הכתיב."},"obj-22":{objectiveId:"obj-22",title:"הכתבה מלודית",intro:"הכתבה מלודית היא הפסגה של אימון השמיעה: לשמוע מנגינה ולרשום אותה בגובה ובמקצב הנכונים. היא מאחדת זיהוי מרווחים, תחושת סולם ותפיסה ריתמית.",sections:[{heading:"עוגן הטוניקה",body:"התחל תמיד מזיהוי הטוניקה — הצליל שאליו המנגינה נשענת ונחה. משם קל יותר למקם כל צליל ביחס לסולם. מנגינות רבות פותחות או מסתיימות בטוניקה, מה שהופך אותה לנקודת ייחוס טבעית."},{heading:"תנועה במרווחים",body:"רשום את המנגינה צליל אחר צליל לפי המרווח מהצליל הקודם: האם עלה או ירד, ובכמה. רוב התנועה היא בצעדי סולם צמודים; קפיצות בולטות כטרצה, קווארטה או קווינטה. שילוב תחושת הסולם עם זיהוי המרווח מקבע את הגבהים."},{heading:"גובה ומקצב יחד",body:"הכתבה מלודית שלמה דורשת גם את מה וגם את מתי. כדאי לרשום תחילה את מתאר הגבהים, אחר כך את המקצב, ולבסוף לאחד. פיצול המשימה לשני ממדים מפחית עומס ומעלה את הדיוק."}],tip:"שיר בחזרה את המנגינה מהזיכרון לפני הרישום. אם אתה יכול לזמזם אותה נכון, כבר תפסת את המרווחים שנותר רק לתעד."}};function SN(n){const e=n.parameters.objectiveId;return typeof e=="string"&&k2[e]?k2[e]:null}function gl(n,e){if(n.status!=="in_progress")throw new Error(`Cannot ${e}: session is ${n.status}`)}function AN(n,e){return{id:e.newId(),musicianId:n.musicianId,status:"in_progress",source:n.source,startedAt:e.now(),endedAt:null,runs:[],activeRunId:null}}function w2(n,e,t){if(gl(n,"start a run"),n.activeRunId!==null)throw new Error("A run is already active");const r={id:t.newId(),activity:e,startedAt:t.now(),endedAt:null,captured:[],result:null};return{...n,runs:[...n.runs,r],activeRunId:r.id}}function CN(n,e){gl(n,"capture evidence");const t=n.runs.find(i=>i.id===n.activeRunId);if(!t)throw new Error("No active run");const r=Vj(t.activity.typeId,t.activity.parameters,e),s={...t,captured:[...t.captured,{evidence:e,evaluation:r}]};return{state:{...n,runs:n.runs.map(i=>i.id===t.id?s:i)},evaluation:r}}function MN(n,e){gl(n,"complete a run");const t=n.runs.find(a=>a.id===n.activeRunId);if(!t)throw new Error("No active run");const r=t.captured.map(a=>a.evaluation.score),s={runId:t.id,activityId:t.activity.id,score:r.length?r.reduce((a,c)=>a+c,0)/r.length:null,evidenceCount:t.captured.length,startedAt:t.startedAt,endedAt:e.now()},i={...t,endedAt:s.endedAt,result:s};return{state:{...n,runs:n.runs.map(a=>a.id===t.id?i:a),activeRunId:null},result:s}}function PN(n,e){if(gl(n,"complete the session"),n.activeRunId!==null)throw new Error("Complete the active run first");return{...n,status:"completed",endedAt:e.now()}}function RN(n,e){return gl(n,"abandon the session"),{...n,status:"abandoned",activeRunId:null,endedAt:e.now()}}function j2(n){if(n.status==="in_progress")throw new Error("Session is still in progress");const e=n.runs.reduce((t,r)=>{const s=r.endedAt??n.endedAt??r.startedAt;return t+(new Date(s).getTime()-new Date(r.startedAt).getTime())},0);return{id:n.id,musicianId:n.musicianId,status:n.status,startedAt:n.startedAt,totalMinutes:Math.max(1,Math.round(e/6e4)),source:n.source,runs:n.runs.map(t=>{var i;const r=new Map;for(const a of t.captured)for(const c of a.evaluation.objectiveSignals)r.set(c.objectiveId,[...r.get(c.objectiveId)??[],c.signal]);const s=[...r.entries()].map(([a,c])=>({objectiveId:a,signal:c.reduce((l,d)=>l+d,0)/c.length}));return{id:t.id,activityId:t.activity.id,activityTitle:t.activity.title,activityType:t.activity.type,startedAt:t.startedAt,durationMinutes:Math.max(1,Math.round((new Date(t.endedAt??t.startedAt).getTime()-new Date(t.startedAt).getTime())/6e4)),...((i=t.result)==null?void 0:i.score)!==null&&t.result!==null?{score:t.result.score}:{},...s.length>0?{objectiveSignals:s}:{}}})}}function ON(n){switch(n.source){case"teacher":case"course":return"assignment";case"user":return"free_choice";default:return"recommendation"}}const Zd=new Map;function DN(n){if(Zd.has(n.engineId))throw new Error(`Engine already registered: ${n.engineId}`);Zd.set(n.engineId,n)}function VN(){return[...Zd.values()]}function LN(n){for(const e of Zd.values())if(e.typeIds.includes(n))return e;return null}function ur(n){var e,t;return((t=(e=LN(n))==null?void 0:e.ladders)==null?void 0:t[n])??[]}function hr(n,e,t){const s=ur(n).find(a=>a.level===t),i={...e,...(s==null?void 0:s.paramOverrides)??{}};return j1(n)?w1(n).paramsSchema.parse(i):i}const qN={upStreak:3,downStreak:2,failThreshold:.5,reviewMean:.25};function qr(n){const e=n.policy??qN,t=n.recentScores,r=i=>Math.max(1,Math.min(n.maxLevel,i));if(t.length>=e.downStreak+1&&n.currentLevel===1&&t.reduce((a,c)=>a+c,0)/t.length<e.reviewMean){const a=n.objectiveId?Cx(n.objectiveId):null,c=a!=null&&a.knowledgeIds[0]?n.objectiveId:void 0;return{action:"review_prerequisite",nextLevel:1,...c?{reviewObjectiveId:c}:{}}}const s=i=>t.slice(-i);return t.length>=e.upStreak&&s(e.upStreak).every(i=>i>=.999)&&n.currentLevel<n.maxLevel?{action:"level_up",nextLevel:r(n.currentLevel+1)}:t.length>=e.downStreak&&s(e.downStreak).every(i=>i<e.failThreshold)&&n.currentLevel>1?{action:"level_down",nextLevel:r(n.currentLevel-1)}:{action:"stay",nextLevel:n.currentLevel}}const nc={questionCount:5,rootMidiRange:[55,72],intervals:["m3","M3"],direction:"ascending"},je=(n,e,t,r,s,i,a,c,l,d=5)=>({id:n,typeId:e,category:t,modalities:r,level:s,title:{he:i,en:n},description:{he:a,en:""},baseParameters:c,...l?{objectiveId:l}:{},estimatedMinutes:d}),zN=[je("tpl-ear-int-1","ear_interval","ear_training",["listening"],1,"צעד ראשון בשמיעה — ניגודים","סקונדה מול אוקטבה — ההבדל הכי גדול שיש",nc,"obj-1"),je("tpl-ear-int-2","ear_interval","ear_training",["listening"],2,"טרצות — הלב של האקורד","מבחינים בין טרצה גדולה לקטנה",nc,"obj-1"),je("tpl-ear-int-5","ear_interval","ear_training",["listening"],5,"מרווחים יורדים","אותם מרווחים — בכיוון ההפוך",nc,"obj-1"),je("tpl-ear-int-6","ear_interval","ear_training",["listening"],6,"מרווחים הרמוניים","שני צלילים יחד — כמו בליווי אמיתי",nc,"obj-6"),je("tpl-ear-int-7","ear_interval","ear_training",["listening"],7,"שליטה מלאה במרווחים","כל שנים-עשר המרווחים בתרגול אחד",nc,"obj-1",8),je("tpl-ear-chord-1","ear_chord_quality","ear_training",["listening"],1,"מז׳ור או מינור?","האיכות הבסיסית של כל אקורד",{optionIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[50,65]},"obj-7"),je("tpl-ear-chord-4","ear_chord_quality","ear_training",["listening"],4,"ספטאקורדים בשמיעה","מז׳ור7, מינור7 ודומיננטה",{optionIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[50,65]},"obj-7",6),je("tpl-ear-cad-1","ear_cadence","ear_training",["listening"],1,"סיומים הרמוניים","אותנטית מול פלגלית — איך נשמע סוף?",{optionIds:["cadence.authentic","cadence.plagal"],questionCount:4,rootMidiRange:[53,62]},"obj-8",6),je("tpl-ear-cad-4","ear_cadence","ear_training",["listening"],4,"מהלכים מהמוסיקה שסביבנו","פופ, ג׳אז ושנות החמישים — זיהוי מהלכים",{optionIds:["cadence.authentic","cadence.plagal"],questionCount:4,rootMidiRange:[53,62]},"obj-8",7),je("tpl-kb-chord-1","theory_chord_build","theory",["writing"],1,"בניית משולשים","מז׳ור ומינור על המקלדת",{chordIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,67]},"obj-4",6),je("tpl-kb-chord-4","theory_chord_build","theory",["writing"],4,"בניית ספטאקורדים","ארבעה צלילים — הצבע של ההרמוניה",{chordIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,67]},"obj-4",7),je("tpl-kb-scale-1","piano_scale_play","piano",["playing","reading"],1,"סולם מז׳ור ראשון","דו מז׳ור, צליל אחר צליל",{sourceId:"scale.major",rootMidi:60,mode:"scale",direction:"ascending",rounds:3},"obj-3",6),je("tpl-kb-scale-4","piano_scale_play","piano",["playing","reading"],4,"ארפג׳יו","האקורד — צליל אחרי צליל",{sourceId:"chord.maj",rootMidi:60,mode:"arpeggio",direction:"ascending",rounds:3}
64,"obj-3",5),je("tpl-rhy-1","rhythm_tap","rhythm",["tapping"],1,"פעימה יציבה","רבעים על קליק — הבסיס של הכול",{bpm:70,beatsPerBar:4,bars:1,pattern:[0,1,2,3],rounds:3,toleranceMs:180},"obj-2"),je("tpl-rhy-3","rhythm_tap","rhythm",["tapping"],3,"סינקופה ראשונה","ההקשה שבורחת מהפעימה",{bpm:80,beatsPerBar:4,bars:1,pattern:[0,1,2,3],rounds:3,toleranceMs:140},"obj-10"),je("tpl-rhy-6","rhythm_tap","rhythm",["tapping","reading"],6,"קריאת מקצב מתווים","מהחמשה ישר לידיים",{bpm:80,beatsPerBar:4,bars:1,pattern:[0,1,2,3],rounds:3,toleranceMs:140},"obj-10",6),je("tpl-echo-1","rhythm_echo","rhythm",["listening","tapping"],1,"הד — חזרה על מקצב","האזינו לתבנית והחזירו אותה מיד",{bpm:70,beatsPerBar:4,bars:1,patternIds:["rhythm_pattern.quarters"],rounds:4,toleranceMs:180,mode:"echo"},"obj-10"),je("tpl-echo-4","rhythm_echo","rhythm",["listening","tapping"],4,"זיכרון קצבי","תיבה שקטה בין ההאזנה להקשה — מאתגר את הזיכרון",{bpm:76,beatsPerBar:4,bars:1,patternIds:["rhythm_pattern.quarters_eighths"],rounds:4,toleranceMs:150,mode:"memory"},"obj-10",6),je("tpl-locate-1","piano_locate","piano",["playing"],1,"איתור צלילים ראשון","מצאו כל צליל בכל אוקטבה שנוח לכם",{mode:"pitch",lowMidi:60,highMidi:72,questionCount:8,anyOctave:!0},"obj-3",5),je("tpl-locate-4","piano_locate","piano",["playing"],4,"מדרגות בסולם מז׳ור","מהצליל המסומן — מצאו את המדרגה המבוקשת",{mode:"degree",scaleId:"scale.major",lowMidi:48,highMidi:84,questionCount:8},"obj-3",6),je("tpl-sr-1","sight_reading","sight_reading",["reading"],1,"שמות תווים — מפתח סול","תו על החמשה, בוחרים את שמו",{mode:"name_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:5},"obj-11"),je("tpl-sr-3","sight_reading","sight_reading",["reading","playing"],3,"איתור על המקלדת","שומעים שם צליל — מאתרים אותו על המקלדת",{mode:"click_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:6},"obj-11"),je("tpl-sr-7","sight_reading","sight_reading",["reading"],7,"הגבוה או הנמוך?","קוראים רצף ומזהים את הצליל הקיצוני",{mode:"extreme",clef:"treble",lowMidi:57,highMidi:79,questionCount:6,sequenceLength:5},"obj-11",6),je("tpl-nb-1","notation_build","sight_reading",["reading","writing"],1,"בניית שלישית","מציבים צליל שלישית מעל הנתון",{mode:"build_interval",clef:"treble",intervalSemitones:4,lowMidi:60,highMidi:72,questionCount:6},"obj-12"),je("tpl-nb-4","notation_build","sight_reading",["reading","writing"],4,"איות משולש","בונים אקורד מז׳ור על החמשה",{mode:"build_chord",clef:"treble",sourceId:"chord.maj",lowMidi:55,highMidi:76,questionCount:6},"obj-12"),je("tpl-nb-6","notation_build","sight_reading",["reading","writing"],6,"בניית סולם מז׳ור","סולם שלם מהיסוד ומעלה",{mode:"build_scale",clef:"treble",sourceId:"scale.major",lowMidi:60,highMidi:72,questionCount:5},"obj-12"),je("tpl-nb-3","notation_build","sight_reading",["reading","writing"],3,"תו חסר בסולם","מאתרים ומציבים את התו החסר",{mode:"missing_note",clef:"treble",sourceId:"scale.major",lowMidi:60,highMidi:72,questionCount:6},"obj-12"),je("tpl-org-1","theory_organize","theory",["reading","writing"],1,"קונסוננס מול דיסוננס","ממיינים מרווחים לפי צליל מתמזג או מתוח",{mode:"classify",buckets:[{id:"consonant",label:{he:"קונסוננס",en:"Consonant"},itemIds:["interval.P5","interval.P4","interval.M3","interval.m3","interval.M6","interval.P8"]},{id:"dissonant",label:{he:"דיסוננס",en:"Dissonant"},itemIds:["interval.m2","interval.M2","interval.m7","interval.M7","interval.TT"]}],sampleSize:6,questionCount:4},"obj-13"),je("tpl-org-2","theory_organize","theory",["reading","writing"],2,"סדר מרווחים לפי גודל","מסדרים מרווחים מהקטן לגדול",{mode:"order",orderedItemIds:["interval.m2","interval.M3","interval.P5","interval.P8"],questionCount:5},"obj-13"),je("tpl-org-3","theory_organize","theory",["reading","writing"],3,"מיון איכויות אקורד","ממיינים אקורדים למז׳ורי, מינורי ומוקטן/מוגדל",{mode:"classify",buckets:[{id:"maj",label:{he:"מז׳ורי",en:"Major"},itemIds:["chord.maj","chord.maj7"]},{id:"min",label:{he:"מינורי",en:"Minor"},itemIds:["chord.min","chord.m7"]},{id:"other",label:{he:"מוקטן/מוגדל",en:"Dim/Aug"},itemIds:["chord.dim","chord.aug"]}],sampleSize:6,questionCount:5},"obj-13"),je("tpl-sri-1","sight_read_interval","sight_reading",["reading"],1,"קריאת טרצות","טרצה גדולה או קטנה — במבט",{clef:"treble",intervals:["m3","M3"],presentation:"melodic",lowMidi:60,highMidi:79,questionCount:6},"obj-1"),je("tpl-sri-4","sight_read_interval","sight_reading",["reading"],4,"מרווחים הרמוניים","שני צלילים יחד — מזהים את המרווח",{clef:"treble",intervals:["m3","M3","P5","P8"],presentation:"harmonic",lowMidi:57,highMidi:81,questionCount:6},"obj-1"),je("tpl-sri-5","sight_read_interval","sight_reading",["reading"],5,"קריאת מרווחים במפתח פה","מרווחים בטווח הנמוך",{clef:"bass",intervals:["m3","M3","P4","P5"],presentation:"mixed",lowMidi:40,highMidi:60,questionCount:6},"obj-1"),je("tpl-key-1","sight_read_key","sight_reading",["reading"],1,"חתימות מפתח ראשונות","עד חתימה אחת — דו, סול, פה",{clef:"treble",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6},"obj-14"),je("tpl-key-4","sight_read_key","sight_reading",["reading"],4,"סולמות דיאז","זיהוי סולמות עם דיאזים",{clef:"treble",keyIds:["key.g_major","key.d_major","key.a_major","key.e_major","key.b_major"],questionCount:6},"obj-14"),je("tpl-key-6","sight_read_key","sight_reading",["reading"],6,"חתימות במפתח פה","קריאת חתימות מפתח בטווח הנמוך",{clef:"bass",keyIds:["key.c_major","key.g_major","key.d_major","key.f_major","key.bb_major"],questionCount:6},"obj-14"),je("tpl-acc-1","sight_read_accidental","sight_reading",["reading"],1,"קריאת דיאזים","זיהוי תווים עם דיאז",{clef:"treble",accidentalType:"sharps",lowMidi:60,highMidi:72,questionCount:6},"obj-15"),je("tpl-acc-2","sight_read_accidental","sight_reading",["reading"],2,"קריאת במולים","זיהוי תווים עם במול",{clef:"treble",accidentalType:"flats",lowMidi:60,highMidi:72,questionCount:6},"obj-15"),je("tpl-acc-4","sight_read_accidental","sight_reading",["reading"],4,"סימני היתק במפתח פה","דיאזים ובמולים בטווח הנמוך",{clef:"bass",accidentalType:"both",lowMidi:43,highMidi:64,questionCount:6},"obj-15"),je("tpl-mel-1","sight_read_melody","sight_reading",["reading","playing"],1,"מלודיה קצרה — דו מז׳ור","קוראים מלודיה קצרה ומנגנים אותה על המקלדת",{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:72,noteCount:4,questionCount:4},"obj-16",6),je("tpl-mel-3","sight_read_melody","sight_reading",["reading","playing"],3,"מלודיה בסול מז׳ור","מלודיה עם חתימת מפתח — קוראים ומנגנים",{clef:"treble",keyId:"key.g_major",lowMidi:62,highMidi:74,noteCount:6,questionCount:4},"obj-16",6),je("tpl-mel-8","sight_read_melody","sight_reading",["reading","playing"],8,"מלודיה ברה מז׳ור — טווח רחב","מלודיה ארוכה בטווח רחב עם שני דיאזים",{clef:"treble",keyId:"key.d_major",lowMidi:62,highMidi:81,noteCount:8,questionCount:5},"obj-16",7),je("tpl-spell-1","theory_spell","theory",["writing"],1,"איות סולמות מז׳ור","אַיְּתו סולמות מז׳ור בשמות הצלילים",{mode:"spell_scale",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6},"obj-17",6),je("tpl-spell-4","theory_spell","theory",["writing"],4,"איות משולשים","אַיְּתו אקורדים מז׳ור ומינור בשמות הצלילים",{mode:"spell_chord",chordIds:["chord.maj","chord.min"],rootMidis:[60,62,64,65,67,69],questionCount:6},"obj-17",6),je("tpl-spell-7","theory_spell","theory",["writing"],7,"איות ספטאקורדים","אַיְּתו ספטאקורדים בשמות הצלילים",{mode:"spell_chord",chordIds:["chord.dom7","chord.maj7","chord.m7"],rootMidis:[60,62,64,65,67],questionCount:6},"obj-17",7),je("tpl-sel-1","notation_select","sight_reading",["reading"],1,"הצליל הגבוה ביותר","לחצו על הצליל הגבוה ביותר בקבוצה",{mode:"find_extreme",extreme:"highest",clef:"treble",keyId:"key.c_major",noteCount:4,lowMidi:60,highMidi:76,questionCount:6},"obj-18",5),je("tpl-sel-3","notation_select","sight_reading",["reading"],3,"איתור הטעות — דו מז׳ור","צליל אחד יצא מהסולם — אתרו אותו",{mode:"find_wrong",clef:"treble",keyId:"key.c_major",noteCount:5,lowMidi:60,highMidi:74,questionCount:6},"obj-18",6),je("tpl-sel-4","notation_select","sight_reading",["reading"],4,"איתור הטעות — לה מינור","צליל אחד יצא מהסולם — אתרו אותו",{mode:"find_wrong",clef:"treble",keyId:"key.a_minor",noteCount:5,lowMidi:57,highMidi:72,questionCount:6},"obj-18",6),je("tpl-func-1","theory_function","theory",["reading"],1,"תפקוד אקורדים — דו מז׳ור","טוניקה, סובדומיננטה או דומיננטה?",{mode:"function",keyIds:["key.c_major"],degrees:[1,2,3,4,5,6,7],questionCount:6},"obj-19",6),je("tpl-func-5","theory_function","theory",["reading"],5,"דרגות רומיות — דו מז׳ור","זהו את הדרגה I–vii° של כל אקורד",{mode:"numeral",keyIds:["key.c_major"],degrees:[1,2,3,4,5,6,7],questionCount:7},"obj-19",7),je("tpl-func-7","theory_function","theory",["reading"],7,"דרגות בסולמות דיאז","דרגות רומיות בכמה סולמות",{mode:"numeral",keyIds:["key.c_major","key.g_major","key.d_major","key.a_major","key.e_major"],degrees:[1,2,3,4,5,6,7],questionCount:8},"obj-19",8),je("tpl-iq-2nd-mel","ear_interval_quality","ear_training",["listening"],1,"סקונדות — מלודי","קטנה או גדולה, עולה או יורד",{intervals:["m2","M2"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8},"obj-20",6),je("tpl-iq-2nd-harm","ear_interval_quality","ear_training",["listening"],2,"סקונדות — הרמוני","קטנה או גדולה (יחד)",{intervals:["m2","M2"],presentation:"harmonic",rootMidiRange:[55,74],questionCount:8},"obj-20",6),je("tpl-iq-3rd-mel","ear_interval_quality","ear_training",["listening"],3,"טרצות — מלודי","קטנה או גדולה, עולה או יורד",{intervals:["m3","M3"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8},"obj-20",6),je("tpl-dict-1","rhythm_dictation","rhythm",["listening","reading"],1,"הכתבה רתמית — תיבה","זהו את המקצב שהושמע",{bpm:70,bars:1,optionCount:3,maxPlays:5,questionCount:6},"obj-21",6),je("tpl-dict-2","rhythm_dictation","rhythm",["listening","reading"],2,"הכתבה רתמית — שתי תיבות","זהו את המקצב שהושמע",{bpm:70,bars:2,optionCount:3,maxPlays:5,questionCount:6},"obj-21",7),je("tpl-mdict-end","melody_dictation","ear_training",["listening","reading"],1,"השלמת סוף המשפט","שמעו את המנגינה ובחרו את התו החסר בסוף",{mode:"blank",blankPosition:"end",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6},"obj-22",6),je("tpl-mdict-mc","melody_dictation","ear_training",["listening","reading"],4,"הכתבה — בחירה מרובה","שמעו מנגינה ובחרו את הרישום הנכון",{mode:"full",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6},"obj-22",6)];function FN(n){const e=hr(n.typeId,n.baseParameters,n.level);return n.objectiveId?{...e,objectiveId:n.objectiveId}:e}const $N=.999,BN=864e5;function ga(n){return n.filter(e=>e.status==="completed")}function T2(n,e,t){const r=t.getTime()-e*BN;return n.filter(s=>new Date(s.startedAt).getTime()>=r)}const n4=[{id:"first_session",title:{he:"צעד ראשון",en:"First Step"},description:{he:"השלמת אימון תרגול ראשון",en:"Completed your first practice session"},check:({sessions:n})=>ga(n).length>=1},{id:"five_sessions",title:{he:"5 אימונים",en:"5 Sessions"},description:{he:"השלמת 5 אימוני תרגול",en:"Completed 5 practice sessions"},check:({sessions:n})=>ga(n).length>=5},{id:"twenty_five_sessions",title:{he:"25 אימונים",en:"25 Sessions"},description:{he:"השלמת 25 אימוני תרגול",en:"Completed 25 practice sessions"},check:({sessions:n})=>ga(n).length>=25},{id:"three_day_streak",title:{he:"רצף 3 ימים",en:"3-Day Streak"},description:{he:"תרגלת 3 ימים ברצף",en:"Practiced 3 days in a row"},check:({streakDays:n})=>n>=3},{id:"seven_day_streak",title:{he:"רצף 7 ימים",en:"7-Day Streak"},description:{he:"תרגלת 7 ימים ברצף",en:"Practiced 7 days in a row"},check:({streakDays:n})=>n>=7},{id:"perfect_session",title:{he:"ציון מושלם",en:"Perfect Score"},description:{he:"סיימת אימון עם ציון ממוצע מושלם",en:"Completed a session with a perfect mean score"},check:({sessions:n})=>ga(n).some(e=>{const t=e.runs.filter(s=>s.score!==void 0).map(s=>s.score);return t.length===0?!1:t.reduce((s,i)=>s+i,0)/t.length>=$N})},{id:"three_categories_week",title:{he:"גיוון שבועי",en:"Weekly Variety"},description:{he:"תרגלת 3 תחומים שונים באותו שבוע",en:"Practiced 3 different categories in one week"},check:({sessions:n})=>{const e=new Date,t=T2(ga(n),7,e),r=new Set;for(const s of t)for(const i of s.runs)r.add(i.activityType);return r.size>=3}},{id:"sixty_minutes_week",title:{he:"שעה שבועית",en:"Weekly Hour"},description:{he:"תרגלת 60 דקות במצטבר בשבוע אחד",en:"Practiced 60 total minutes in a week"},check:({sessions:n})=>{const e=new Date;return T2(ga(n),7,e).reduce((s,i)=>s+i.totalMinutes,0)>=60}}];function UN(n){return n4.filter(e=>e.check(n)).map(e=>e.id)}const GN={engineId:"identify",name:{he:"מנוע זיהוי",en:"Identify engine"},description:{he:"גירוי בשמיעה או בתווים — והלומד מזהה: מרווח, אקורד, סולם, קדנצה או תו",en:"Hear or see a stimulus and name it — intervals, chords, scales, cadences, notes"},typeIds:["ear_interval","ear_chord_quality","ear_scale_recognition","ear_cadence","sight_note_id"],ladders:{ear_interval:[{level:1,label:{he:"ניגודים גדולים",en:"Big contrasts"},paramOverrides:{intervals:["m2","P8"],direction:"ascending"}},{level:2,label:{he:"טרצות",en:"Thirds"},paramOverrides:{intervals:["m3","M3"],direction:"ascending"}},{level:3,label:{he:"קוורטה וקווינטה",en:"Fourths & fifths"},paramOverrides:{intervals:["P4","P5"],direction:"ascending"}},{level:4,label:{he:"סקסטות",en:"Sixths"},paramOverrides:{intervals:["m6","M6"],direction:"ascending"}},{level:5,label:{he:"מרווחים יורדים",en:"Descending"},paramOverrides:{intervals:["m3","M3","P4","P5"],direction:"descending"}},{level:6,label:{he:"הרמוני — יחד",en:"Harmonic"},paramOverrides:{intervals:["m3","M3","P5","P8"],direction:"harmonic"}},{level:7,label:{he:"כל המרווחים",en:"All intervals"},paramOverrides:{intervals:["m2","M2","m3","M3","P4","TT","P5","m6","M6","m7","M7","P8"],direction:"ascending"}}],ear_chord_quality:[{level:1,label:{he:"מז׳ור ומינור",en:"Major/minor"},paramOverrides:{optionIds:["chord.maj","chord.min"]}},{level:2,label:{he:"עם מוקטן",en:"+diminished"},paramOverrides:{optionIds:["chord.maj","chord.min","chord.dim"]}}
64,{level:3,label:{he:"ארבע איכויות",en:"Four qualities"},paramOverrides:{optionIds:["chord.maj","chord.min","chord.dim","chord.aug"]}},{level:4,label:{he:"ספטאקורדים",en:"Sevenths"},paramOverrides:{optionIds:["chord.maj7","chord.m7","chord.dom7"]}},{level:5,label:{he:"סוספנד והרחבות",en:"Sus & extensions"},paramOverrides:{optionIds:["chord.sus2","chord.sus4","chord.maj","chord.dom7"]}}],ear_cadence:[{level:1,label:{he:"אותנטית ופלגלית",en:"Authentic/plagal"},paramOverrides:{optionIds:["cadence.authentic","cadence.plagal"]}},{level:2,label:{he:"עם חצי קדנצה",en:"+half"},paramOverrides:{optionIds:["cadence.authentic","cadence.plagal","cadence.half"]}},{level:3,label:{he:"עם מתעתעת",en:"+deceptive"},paramOverrides:{optionIds:["cadence.authentic","cadence.plagal","cadence.half","cadence.deceptive"]}},{level:4,label:{he:"מהלכים הרמוניים",en:"Progressions"},paramOverrides:{optionIds:["cadence.pop","cadence.two_five_one","cadence.fifties"]}}]}},KN={engineId:"perform_keyboard",name:{he:"מנוע מקלדת",en:"Keyboard engine"},description:{he:"המקלדת כסביבת עבודה — בנייה, נגינה ואיתור של צלילים, אקורדים וסולמות",en:"The keyboard as a workspace — build, play and locate notes, chords and scales"},typeIds:["theory_chord_build","piano_scale_play","piano_locate"],ladders:{piano_locate:DT,theory_chord_build:[{level:1,label:{he:"משולשים בסיסיים",en:"Basic triads"},paramOverrides:{chordIds:["chord.maj","chord.min"]}},{level:2,label:{he:"כל המשולשים",en:"All triads"},paramOverrides:{chordIds:["chord.maj","chord.min","chord.dim","chord.aug"]}},{level:3,label:{he:"סוספנדים",en:"Sus chords"},paramOverrides:{chordIds:["chord.sus2","chord.sus4","chord.maj","chord.min"]}},{level:4,label:{he:"ספטאקורדים",en:"Seventh chords"},paramOverrides:{chordIds:["chord.dom7","chord.maj7","chord.m7"]}},{level:5,label:{he:"מתקדם",en:"Advanced"},paramOverrides:{chordIds:["chord.m7b5","chord.dom7","chord.maj7","chord.m7"]}}],piano_scale_play:[{level:1,label:{he:"מז׳ור עולה",en:"Major up"},paramOverrides:{sourceId:"scale.major",mode:"scale",direction:"ascending"}},{level:2,label:{he:"מינור טבעי",en:"Natural minor"},paramOverrides:{sourceId:"scale.natural_minor",mode:"scale",direction:"ascending"}},{level:3,label:{he:"יורד",en:"Descending"},paramOverrides:{sourceId:"scale.major",mode:"scale",direction:"descending"}},{level:4,label:{he:"ארפג׳יו",en:"Arpeggio"},paramOverrides:{sourceId:"chord.maj",mode:"arpeggio",direction:"ascending"}},{level:5,label:{he:"מינור הרמוני",en:"Harmonic minor"},paramOverrides:{sourceId:"scale.harmonic_minor",mode:"scale",direction:"ascending"}}]}},HN={engineId:"rhythm",name:{he:"מנוע מקצב",en:"Rhythm engine"},description:{he:"פעימה, תבניות, קריאה וסינקופות — הקשה מדויקת על ציר הזמן",en:"Pulse, patterns, reading and syncopation — precise tapping on the timeline"},typeIds:["rhythm_tap","rhythm_echo"],ladders:{rhythm_tap:[{level:1,label:{he:"רבעים",en:"Quarters"},paramOverrides:{bpm:70,pattern:[0,1,2,3],toleranceMs:180}},{level:2,label:{he:"רבעים ושמיניות",en:"Quarters+eighths"},paramOverrides:{bpm:76,pattern:[0,1,1.5,2,3],toleranceMs:150}},{level:3,label:{he:"סינקופה",en:"Syncopation"},paramOverrides:{bpm:80,pattern:[0,1.5,2.5,3],toleranceMs:140}},{level:4,label:{he:"אחרי הפעימה",en:"Offbeats"},paramOverrides:{bpm:84,pattern:[.5,1.5,2.5,3.5],toleranceMs:130}},{level:5,label:{he:"משקל מורכב",en:"Compound meter"},paramOverrides:{bpm:100,beatsPerBar:6,pattern:[0,3],toleranceMs:130}},{level:6,label:{he:"קריאה מתווים",en:"Notation reading"},paramOverrides:{bpm:80,pattern:[0,1.5,2.5,3],displayMode:"notation",toleranceMs:140}}],rhythm_echo:eT}},WN={engineId:"matching",name:{he:"מנוע התאמה",en:"Matching engine"},description:{he:"למידה פעילה בהתאמת סמלים, שמות ומבנים מכל שכבת הידע",en:"Active learning by matching symbols, names and structures from the Knowledge Layer"},typeIds:["theory_matching"]},YN={engineId:"score",name:{he:"מנוע פרטיטורה",en:"Score engine"},description:{he:"התווים כממשק — זיהוי, סימון וניתוח בתוך הפרטיטורה עצמה",en:"The score as interface — identify, label and analyse inside the notation"},typeIds:["score_label"]},QN={engineId:"record",name:{he:"מנוע הקלטה",en:"Recording engine"},description:{he:"ביצוע, האזנה עצמית והשוואה לדוגמה — תשתית לניתוח פיץ׳ עתידי",en:"Perform, self-listen and compare to a reference — pitch analysis later"},typeIds:["repertoire_record"]},ZN=[GN,KN,HN,zT,dE,gE,_E,AE,DE,$E,YE,rN,hN,IN,KT,tE,WN,YN,QN];function JN(){const n=[zj,Kj,Xj,iT,dT,uT,hT,fT,xT,kT,TT,AT,OT,LT,UT,ZT,cE,pE,vE,NE,RE,zE,HE,tN,dN,xN,EN];for(const e of n)j1(e.typeId)||Dj(e);for(const e of ZN)VN().some(t=>t.engineId===e.engineId)||DN(e)}JN();function S1(n){const e=[];
64if(n.title.trim()||e.push({path:"title",messageKey:"studio.errors.titleRequired"}),(n.estimatedMinutes<1||n.estimatedMinutes>60)&&e.push({path:"estimatedMinutes",messageKey:"studio.errors.minutesRange"}),!j1(n.typeId))return e.push({path:"typeId",messageKey:"studio.errors.unknownType"}),e;const t=w1(n.typeId).paramsSchema.safeParse(n.parameters);if(!t.success)for(const r of t.error.issues)e.push({path:r.path.join(".")||"(root)",messageKey:"studio.errors.invalidParam"});return e}function E2(n,e){const t=e.now();return{id:n.id,organizationId:n.organizationId,createdBy:n.createdBy,createdAt:t,updatedAt:t,status:"draft",draft:{typeId:n.typeId,type:n.type,title:"",description:"",modalities:n.modalities,estimatedMinutes:5,parameters:n.defaultParameters},versions:[]}}function XN(n,e,t){if(n.status==="archived")throw new Error("Cannot edit an archived item");return{...n,draft:e,updatedAt:t.now()}}function r4(n){return`authored-${n.id}`}function eS(n,e){if(n.status==="archived")throw new Error("Cannot publish an archived item");const t=S1(n.draft);if(t.length>0)throw new Error(`Draft is not valid: ${t.map(i=>i.path).join(", ")}`);const r=e.now(),s={id:r4(n),organizationId:n.organizationId,type:n.draft.type,typeId:n.draft.typeId,title:n.draft.title,description:n.draft.description,modalities:[...n.draft.modalities],parameters:structuredClone(n.draft.parameters),estimatedMinutes:n.draft.estimatedMinutes,assetIds:[...n.draft.assetIds??[]]};return{...n,status:"published",updatedAt:r,versions:[...n.versions,{version:n.versions.length+1,publishedAt:r,activity:s}]}}function tS(n,e){return{...n,status:"archived",updatedAt:e.now()}}function nS(n,e){return n.status!=="archived"?n:{...n,status:n.versions.length>0?"published":"draft",updatedAt:e.now()}}function rS(n){var e;return n.status!=="published"?null:((e=n.versions[n.versions.length-1])==null?void 0:e.activity)??null}function sS(n){var r;const e=(r=n.versions[n.versions.length-1])==null?void 0:r.activity;if(!e)return!0;const t=n.draft;return t.title!==e.title||t.description!==e.description||t.estimatedMinutes!==e.estimatedMinutes||JSON.stringify(t.parameters)!==JSON.stringify(e.parameters)}const s4="shirat-mock-passwords";function i4(){try{return JSON.parse(localStorage.getItem(s4)??"{}")}catch{return{}}}function iS(n,e){const t=i4();t[n]=e,localStorage.setItem(s4,JSON.stringify(t))}function aS(n){return i4()[n]??null}const a4=2,ir=G().min(1),N2=G().regex(/^\d{4}-\d{2}-\d{2}/),S2=G().regex(/^([01]\d|2[0-3]):[0-5]\d$/),oS=G().regex(/^#[0-9a-fA-F]{6}$/),cS=ue({id:ir,name:G().min(1)}),lS=ue({id:ir,name:G().min(1),startsOn:N2,endsOn:N2}),dS=ue({id:ir,name:G().min(1),subjects:Te(G()),userId:G().optional(),email:G().optional(),phone:G().optional(),active:mn().optional(),canAuthor:mn().optional()}),uS=ue({id:ir,name:G().min(1),trackId:ir,academicYearId:ir,color:oS,parentGroupId:ir.optional(),teacherIds:Te(ir)}),hS=ue({id:ir,groupId:ir,dayOfWeek:B().int().min(0).max(6),startTime:S2,endTime:S2,location:G().optional()}),mS=ue({groupId:ir,userId:G().min(1)}),pS=ue({schemaVersion:sn(a4),source:G().min(1),updatedAt:G(),organizationId:G().min(1),tracks:Te(cS),years:Te(lS),teachers:Te(dS),groups:Te(uS),schedule:Te(hS),memberships:Te(mS)}),A2=["#0e7490","#b45309","#7c5cff","#0f766e","#be123c","#4d7c0f","#6d28d9","#b91c1c","#1d4ed8","#a16207"],br=(n,e)=>({level:"error",entityId:n,message:e}),wm=(n,e)=>({level:"warning",entityId:n,message:e});function fS(n){const e=new Set,t=new Set;for(const r of n)e.has(r)&&t.add(r),e.add(r);return[...t]}const ya=n=>{const[e,t]=n.split(":");return Number(e)*60+Number(t)};function gS(n){const e=pS.safeParse(n);if(!e.success)return{ok:!1,issues:e.error.issues.map(f=>br(null,`${f.path.join(".")}: ${f.message}`)),structure:null};const t=e.data,r=[],s=[["track",t.tracks.map(p=>p.id)],["year",t.years.map(p=>p.id)],["teacher",t.teachers.map(p=>p.id)],["group",t.groups.map(p=>p.id)],["slot",t.schedule.map(p=>p.id)]];for(const[p,f]of s)for(const g of fS(f))r.push(br(g,`duplicate ${p} id`));const i=new Set(t.tracks.map(p=>p.id)),a=new Set(t.years.map(p=>p.id)),c=new Set(t.teachers.map(p=>p.id)),l=new Map(t.groups.map(p=>[p.id,p]));for(const p of t.groups){i.has(p.trackId)||r.push(br(p.id,`group references unknown track '${p.trackId}'`)),a.has(p.academicYearId)||r.push(br(p.id,`group references unknown year '${p.academicYearId}'`));for(const f of p.teacherIds)c.has(f)||r.push(br(p.id,`group references unknown teacher '${f}'`));if(p.parentGroupId){const f=l.get(p.parentGroupId);f?(f.trackId!==p.trackId&&r.push(wm(p.id,`sub-group track differs from parent '${f.id}'`)),f.academicYearId!==p.academicYearId&&r.push(wm(p.id,`sub-group year differs from parent '${f.id}'`))):r.push(br(p.id,`sub-group references unknown parent '${p.parentGroupId}'`))}}for(const p of t.groups){const f=new Set([p.id]);let g=p.parentGroupId?l.get(p.parentGroupId):void 0;for(;g;){if(f.has(g.id)){r.push(br(p.id,`group nesting cycle through '${g.id}'`));break}f.add(g.id),g=g.parentGroupId?l.get(g.parentGroupId):void 0}}for(const p of t.schedule)l.has(p.groupId)||r.push(br(p.id,`slot references unknown group '${p.groupId}'`)),ya(p.endTime)<=ya(p.startTime)&&r.push(br(p.id,`slot ends (${p.endTime}) before it starts (${p.startTime})`));const d=new Map;for(const p of t.schedule){const f=`${p.groupId}|${p.dayOfWeek}`;d.set(f,[...d.get(f)??[],p])}for(const p of d.values()){const f=[...p].sort((g,x)=>ya(g.startTime)-ya(x.startTime));for(let g=1;g<f.length;g++){const x=f[g-1],b=f[g];ya(b.startTime)<ya(x.endTime)&&r.push(wm(b.id,`slot overlaps '${x.id}' in the same group's day`))}}for(const p of t.memberships)l.has(p.groupId)||r.push(br(null,`membership of '${p.userId}' references unknown group '${p.groupId}'`));const m=!r.some(p=>p.level==="error");return{ok:m,issues:r,structure:m?t:null}}const Jd=n=>{const[e,t]=n.split(":");return Number(e)*60+Number(t)};function cs(n,e){const t=e.toISOString().slice(0,10),r=n.years.find(s=>s.startsOn<=t&&t<=s.endsOn);return r||([...n.years].sort((s,i)=>i.startsOn.localeCompare(s.startsOn))[0]??null)}function o4(n,e,t){return n.groups.filter(r=>r.trackId===e&&!r.parentGroupId&&(!t||r.academicYearId===t)).sort((r,s)=>r.name.localeCompare(s.name,"he"))}function vc(n,e){return n.groups.filter(t=>t.parentGroupId===e).sort((t,r)=>t.name.localeCompare(r.name,"he"))}function yS(n,e){const t=new Map(n.groups.map(a=>[a.id,a])),r=[];let s=t.get(e);const i=new Set;for(;s&&!i.has(s.id);)i.add(s.id),r.unshift(s),s=s.parentGroupId?t.get(s.parentGroupId):void 0;return r}function Ha(n,e,t){const r=new Set(n.memberships.filter(s=>s.userId===e).map(s=>s.groupId));return n.groups.filter(s=>r.has(s.id)&&(!t||s.academicYearId===t)).sort((s,i)=>s.name.localeCompare(i.name,"he"))}function Vi(n,e){return n.memberships.filter(t=>t.groupId===e).map(t=>t.userId)}function Wa(n,e){return e.teacherIds.map(t=>{var r;return(r=n.teachers.find(s=>s.id===t))==null?void 0:r.name}).filter(t=>!!t)}function Ju(n,e,t){const r=n.teachers.find(s=>s.userId===e);return r?n.groups.filter(s=>
64s.teacherIds.includes(r.id)&&(!t||s.academicYearId===t)).sort((s,i)=>s.name.localeCompare(i.name,"he")):[]}function bS(n,e){return n.groups.filter(t=>t.teacherIds.includes(e)).sort((t,r)=>t.academicYearId.localeCompare(r.academicYearId)||t.name.localeCompare(r.name,"he"))}function c4(n,e){const t=n.groups.find(r=>r.id===e);return t?n.schedule.filter(r=>r.groupId===e).sort((r,s)=>r.dayOfWeek-s.dayOfWeek||Jd(r.startTime)-Jd(s.startTime)).map(r=>({slot:r,groupName:t.name,groupColor:t.color,teacherNames:Wa(n,t)})):[]}function xS(n,e){const t=new Set([e]);let r=!0;for(;r;){r=!1;for(const s of n.groups)s.parentGroupId&&t.has(s.parentGroupId)&&!t.has(s.id)&&(t.add(s.id),r=!0)}return t}function vS(n,e,t){const r=Ha(n,e,t),s=new Set;for(const i of r)for(const a of xS(n,i.id))s.add(a);return[...s].flatMap(i=>c4(n,i)).sort((i,a)=>i.slot.dayOfWeek-a.slot.dayOfWeek||Jd(i.slot.startTime)-Jd(a.slot.startTime))}const C2="year-5785",le="year-5786",Xd={schemaVersion:a4,source:"shirat-timetable-5786",updatedAt:"2026-07-10T00:00:00.000Z",organizationId:"org-shirat",tracks:[{id:"track-men",name:"גברים"},{id:"track-women",name:"נשים"}],years:[{id:C2,name:"תשפ״ה",startsOn:"2024-09-01",endsOn:"2025-07-31"},{id:le,name:"תשפ״ו",startsOn:"2025-09-01",endsOn:"2026-07-31"}],teachers:[{id:"t-01",name:"אביה גרינברג",subjects:[]},{id:"t-02",name:"איתן אבנט",subjects:[],userId:"u-eitan",email:"[email protected]"},{id:"t-03",name:"יונתן ניצן",subjects:[]},{id:"t-04",name:"נאור כרמי",subjects:[]},{id:"t-05",name:"יונתן רזאל",subjects:[],userId:"u-yonatan",email:"[email protected]"},{id:"t-06",name:"איתמר רינגל",subjects:[]},{id:"t-07",name:"יפתח דקל",subjects:[]},{id:"t-08",name:"עומרי מור",subjects:[]},{id:"t-09",name:"שמוליק ישורון",subjects:[]},{id:"t-10",name:"דוד עדה",subjects:[]},{id:"t-11",name:"אהרון רזאל",subjects:[]},{id:"t-12",name:"נועה שמר",subjects:[],userId:"u-noash",email:"[email protected]"},{id:"t-13",name:"ריקה רזאל",subjects:[]},{id:"t-14",name:"מאיה פוליצר",subjects:[],userId:"u-mayap",email:"[email protected]"},{id:"t-15",name:"קרן גולן",subjects:[],userId:"u-keren",email:"[email protected]"},{id:"t-16",name:"מיכל עמר",subjects:[],userId:"u-michal",email:"[email protected]"},{id:"t-17",name:"טל אברמוביץ'",subjects:[],userId:"u-tal",email:"[email protected]"},{id:"t-18",name:"מאיה הרטמן",subjects:[],userId:"u-mayah",email:"[email protected]"},{id:"t-19",name:"רבקה רביבו",subjects:[],userId:"u-rivka",email:"[email protected]"},{id:"t-20",name:"הדס שמרלינג",subjects:[],userId:"u-hadas",email:"[email protected]"},{id:"t-21",name:"שירה גל",subjects:[],userId:"u-shira",email:"[email protected]"},{id:"t-22",name:"אורפז קודיש",subjects:[],userId:"u-orpaz",email:"[email protected]"},{id:"t-23",name:"הדסה דניאלס",subjects:[],userId:"u-hadassa",email:"[email protected]"}
64,{id:"t-24",name:"תודהיה שנדוביץ'",subjects:[],userId:"u-todahya",email:"[email protected]"}],groups:[{id:"g-m-winter-piano-beg",name:"קורסי חורף - פסנתר מתחילים",trackId:"track-men",academicYearId:le,color:"#0e7490",teacherIds:["t-01"]},{id:"g-m-year1-erev",name:"שנה א' ערב",trackId:"track-men",academicYearId:le,color:"#b45309",teacherIds:["t-02","t-01","t-03","t-04"]},{id:"g-m-year2",name:"שנה ב'",trackId:"track-men",academicYearId:le,color:"#7c5cff",teacherIds:["t-02","t-01","t-03","t-04","t-05","t-06","t-07"]},{id:"g-m-year1-erev-ens",name:"שנה א' ערב - הרכבים",trackId:"track-men",academicYearId:le,color:"#0f766e",teacherIds:["t-03","t-02"]},{id:"g-m-year2-ens",name:"שנה ב' - הרכבים",trackId:"track-men",academicYearId:le,color:"#be123c",teacherIds:["t-04","t-02"]},{id:"g-m-ensemble-grad",name:"אנסמבל בוגרים",trackId:"track-men",academicYearId:le,color:"#4d7c0f",teacherIds:["t-08"]},{id:"g-m-winter-vocal",name:"קורסי חורף - אנסמבל ווקאלי",trackId:"track-men",academicYearId:le,color:"#6d28d9",teacherIds:["t-09","t-03"]},{id:"g-m-year1-intensive",name:"שנה א' מרוכז",trackId:"track-men",academicYearId:le,color:"#1d4ed8",teacherIds:["t-01","t-03","t-10","t-02"]},{id:"g-m-year3",name:"שנה ג'",trackId:"track-men",academicYearId:le,color:"#a16207",teacherIds:["t-08","t-10"]},{id:"g-m-year1-boker-ens",name:"שנה א' בוקר- הרכבים",trackId:"track-men",academicYearId:le,color:"#0891b2",teacherIds:["t-02","t-01","t-03","t-10"]},{id:"g-m-year1-intensive-meet",name:"מפגש מרוכז - מסלולי שנה א'",trackId:"track-men",academicYearId:le,color:"#c026d3",teacherIds:["t-08","t-11"]},{id:"g-w-singers",name:"מסלול זמרות",trackId:"track-women",academicYearId:le,color:"#15803d",teacherIds:["t-12","t-13","t-14"]},{id:"g-w-year1-boker",name:"שנה א' בוקר",trackId:"track-women",academicYearId:le,color:"#0e7490",teacherIds:["t-15","t-16","t-17","t-14","t-18","t-19","t-20","t-21","t-22"]},{id:"g-w-year1-erev",name:"שנה א' ערב",trackId:"track-women",academicYearId:le,color:"#b45309",teacherIds:["t-15","t-16","t-12","t-17","t-23"]},{id:"g-w-piano-adv",name:"פסנתר מתקדמות",trackId:"track-women",academicYearId:le,color:"#7c5cff",teacherIds:["t-19"]},{id:"g-w-year2-boker",name:"שנה ב' בוקר",trackId:"track-women",academicYearId:le,color:"#0f766e",teacherIds:["t-15","t-16","t-23","t-14","t-24","t-17"]},{id:"g-w-year2-erev",name:"שנה ב' ערב",trackId:"track-women",academicYearId:le,color:"#be123c",teacherIds:["t-15","t-16","t-17","t-23"]},{id:"g-w-year3",name:"שנה ג'",trackId:"track-women",academicYearId:le,color:"#4d7c0f",teacherIds:["t-16","t-17","t-23","t-24"]},{id:"c-m-winter-piano-beg-1",name:"מיומנויות פסנתר מתחילים",trackId:"track-men",academicYearId:le,color:"#0e7490",parentGroupId:"g-m-winter-piano-beg",teacherIds:["t-01"]},{id:"c-m-year1-erev-1",name:"מבוא ליסודות המוסיקה",trackId:"track-men",academicYearId:le,color:"#b45309",parentGroupId:"g-m-year1-erev",teacherIds:["t-02"]},{id:"c-m-year1-erev-2",name:"מיומנויות ביצוע",trackId:"track-men",academicYearId:le,color:"#b45309",parentGroupId:"g-m-year1-erev",teacherIds:["t-01"]},{id:"c-m-year1-erev-3",name:"מיומנויות ביצוע",trackId:"track-men",academicYearId:le,color:"#b45309",parentGroupId:"g-m-year1-erev",teacherIds:["t-03"]},{id:"c-m-year1-erev-4",name:"סגנונות מוסיקלים",trackId:"track-men",academicYearId:le,color:"#b45309",parentGroupId:"g-m-year1-erev",teacherIds:["t-04"]},{id:"c-m-year2-1",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-02"]},{id:"c-m-year2-2",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-01"]},{id:"c-m-year2-3",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-03"]},{id:"c-m-year2-4",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-04"]},{id:"c-m-year2-5",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-05"]},{id:"c-m-year2-6",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-06"]},{id:"c-m-year2-7",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#7c5cff",parentGroupId:"g-m-year2",teacherIds:["t-07"]},{id:"c-m-year1-erev-ens-1",name:"הרכבים - שנה א'",trackId:"track-men",academicYearId:le,color:"#0f766e",parentGroupId:"g-m-year1-erev-ens",teacherIds:["t-03"]},{id:"c-m-year2-ens-1",name:"הרכבים - שנה ב'",trackId:"track-men",academicYearId:le,color:"#be123c",parentGroupId:"g-m-year2-ens",teacherIds:["t-04"]},{id:"c-m-year2-ens-2",name:"הרכבים - שנה ב'",trackId:"track-men",academicYearId:le,color:"#be123c",parentGroupId:"g-m-year2-ens",teacherIds:["t-02"]},{id:"c-m-ensemble-grad-1",name:"אנסמבל בוגרים",trackId:"track-men",academicYearId:le,color:"#4d7c0f",parentGroupId:"g-m-ensemble-grad",teacherIds:["t-08"]},{id:"c-m-winter-vocal-1",name:"אנסמבל ווקאלי",trackId:"track-men",academicYearId:le,color:"#6d28d9",parentGroupId:"g-m-winter-vocal",teacherIds:["t-09"]},{id:"c-m-winter-vocal-2",name:"אנסמבל ווקאלי",trackId:"track-men",academicYearId:le,color:"#6d28d9",parentGroupId:"g-m-winter-vocal",teacherIds:["t-03"]},{id:"c-m-year1-intensive-1",name:"מיומנויות ביצוע",trackId:"track-men",academicYearId:le,color:"#1d4ed8",parentGroupId:"g-m-year1-intensive",teacherIds:["t-01"]},{id:"c-m-year1-intensive-2",name:"מיומנויות ביצוע",trackId:"track-men",academicYearId:le,color:"#1d4ed8",parentGroupId:"g-m-year1-intensive",teacherIds:["t-03"]},{id:"c-m-year1-intensive-3",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#1d4ed8",parentGroupId:"g-m-year1-intensive",teacherIds:["t-10"]},{id:"c-m-year1-intensive-4",name:"מבוא ליסודות המוסיקה",trackId:"track-men",academicYearId:le,color:"#1d4ed8",parentGroupId:"g-m-year1-intensive",teacherIds:["t-02"]},{id:"c-m-year1-erev-5",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#b45309",parentGroupId:"g-m-year1-erev",teacherIds:["t-02"]},{id:"c-m-year3-1",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#a16207",parentGroupId:"g-m-year3",teacherIds:["t-08"]},{id:"c-m-year3-2",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#a16207",parentGroupId:"g-m-year3",teacherIds:["t-10"]},{id:"c-m-year1-boker-ens-1",name:"הרכבים שנה א'",trackId:"track-men",academicYearId:le,color:"#0891b2",parentGroupId:"g-m-year1-boker-ens",teacherIds:["t-02"]},{id:"c-m-year1-boker-ens-2",name:"הרכבים שנה א'",trackId:"track-men",academicYearId:le,color:"#0891b2",parentGroupId:"g-m-year1-boker-ens",teacherIds:["t-01"]},{id:"c-m-year1-boker-ens-3",name:"הרכבים שנה א'",trackId:"track-men",academicYearId:le,color:"#0891b2",parentGroupId:"g-m-year1-boker-ens",teacherIds:["t-03"]},{id:"c-m-year1-boker-ens-4",name:"הרכבים שנה א'",trackId:"track-men",academicYearId:le,color:"#0891b2",parentGroupId:"g-m-year1-boker-ens",teacherIds:["t-10"]},{id:"c-m-year1-erev-ens-2",name:"הרכבים שנה א'",trackId:"track-men",academicYearId:le,color:"#0f766e",parentGroupId:"g-m-year1-erev-ens",teacherIds:["t-02"]},{id:"c-m-year1-intensive-meet-1",name:"להשלים שמות קורסים",trackId:"track-men",academicYearId:le,color:"#c026d3",parentGroupId:"g-m-year1-intensive-meet",teacherIds:["t-08"]},{id:"c-m-year1-intensive-meet-2",name:"הלחנה ועבודה על טקסט",trackId:"track-men",academicYearId:le,color:"#c026d3",parentGroupId:"g-m-year1-intensive-meet",teacherIds:["t-11"]},{id:"c-w-singers-1",name:"הרמוניה וליוי",trackId:"track-women",academicYearId:le,color:"#15803d",parentGroupId:"g-w-singers",teacherIds:["t-12"]},{id:"c-w-singers-2",name:"פרפורמנס / אינטרפרטציה",trackId:"track-women",academicYearId:le,color:"#15803d",parentGroupId:"g-w-singers",teacherIds:["t-13"]},{id:"c-w-singers-3",name:"פיתוח קול",trackId:"track-women",academicYearId:le,color:"#15803d",parentGroupId:"g-w-singers",teacherIds:["t-14"]},{id:"c-w-year1-boker-1",name:"יסודות המוסיקה ב'",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-15"]},{id:"c-w-year1-boker-2",name:"קצב ומיומנות ביצוע",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-16"]},{id:"c-w-year1-boker-3",name:"סגנונות מוסיקלים",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-17"]},{id:"c-w-year1-boker-4",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-14"]},{id:"c-w-year1-boker-5",name:"הרמוניה",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-18"]},{id:"c-w-year1-boker-6",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-19"]}
64,{id:"c-w-year1-boker-7",name:"הלחנה ויצירה",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-20"]},{id:"c-w-year1-boker-8",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-21"]},{id:"c-w-year1-boker-9",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-22"]},{id:"c-w-year1-boker-10",name:"מבוא לאלתור",trackId:"track-women",academicYearId:le,color:"#0e7490",parentGroupId:"g-w-year1-boker",teacherIds:["t-19"]},{id:"c-w-year1-erev-1",name:"יסודות המוסיקה",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-15"]},{id:"c-w-year1-erev-2",name:"קצב ומיומנות",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-16"]},{id:"c-w-year1-erev-3",name:"הלחנה ויצירה",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-12"]},{id:"c-w-year1-erev-4",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-17"]},{id:"c-w-year1-erev-5",name:"הרמוניה ליד המקלדת",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-23"]},{id:"c-w-year1-erev-6",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#b45309",parentGroupId:"g-w-year1-erev",teacherIds:["t-15"]},{id:"c-w-piano-adv-1",name:"פסנתר מתקדמות",trackId:"track-women",academicYearId:le,color:"#7c5cff",parentGroupId:"g-w-piano-adv",teacherIds:["t-19"]},{id:"c-w-year2-boker-1",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-15"]},{id:"c-w-year2-boker-2",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-16"]},{id:"c-w-year2-boker-3",name:"פתש",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-23"]},{id:"c-w-year2-boker-4",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-14"]},{id:"c-w-year2-boker-5",name:"עיבוד לפי סגנונות",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-24"]},{id:"c-w-year2-boker-6",name:"הרמוניה וכתיבה רב קולית",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-15"]},{id:"c-w-year2-boker-7",name:"קצב ומיומנות ביצוע",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-16"]},{id:"c-w-year2-boker-8",name:"אימפרוביזציה",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-15"]},{id:"c-w-year2-boker-9",name:"קיובייס",trackId:"track-women",academicYearId:le,color:"#0f766e",parentGroupId:"g-w-year2-boker",teacherIds:["t-17"]},{id:"c-w-year2-erev-1",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#be123c",parentGroupId:"g-w-year2-erev",teacherIds:["t-15"]},{id:"c-w-year2-erev-2",name:"הרכבים",trackId:"track-women",academicYearId:le,color:"#be123c",parentGroupId:"g-w-year2-erev",teacherIds:["t-16"]},{id:"c-w-year2-erev-3",name:"עיבוד",trackId:"track-women",academicYearId:le,color:"#be123c",parentGroupId:"g-w-year2-erev",teacherIds:["t-17"]},{id:"c-w-year2-erev-4",name:"פתש",trackId:"track-women",academicYearId:le,color:"#be123c",parentGroupId:"g-w-year2-erev",teacherIds:["t-17"]},{id:"c-w-year2-erev-5",name:"הרמוניה- זום",trackId:"track-women",academicYearId:le,color:"#be123c",parentGroupId:"g-w-year2-erev",teacherIds:["t-23"]},{id:"c-w-year3-1",name:"הרכב",trackId:"track-women",academicYearId:le,color:"#4d7c0f",parentGroupId:"g-w-year3",teacherIds:["t-16"]},{id:"c-w-year3-2",name:"אימפרוביזציה",trackId:"track-women",academicYearId:le,color:"#4d7c0f",parentGroupId:"g-w-year3",teacherIds:["t-17"]},{id:"c-w-year3-3",name:"חכמת המוסיקה (הרמוניה) ד'",trackId:"track-women",academicYearId:le,color:"#4d7c0f",parentGroupId:"g-w-year3",teacherIds:["t-23"]},{id:"c-w-year3-4",name:"עיבוד ותזמור",trackId:"track-women",academicYearId:le,color:"#4d7c0f",parentGroupId:"g-w-year3",teacherIds:["t-24"]},{id:"g-m-prep-course",name:"מכינה ללימודים",trackId:"track-men",academicYearId:le,color:"#6d28d9",teacherIds:[]},{id:"g-w-year1-5785",name:"שנה א׳",trackId:"track-women",academicYearId:C2,color:"#0e7490",teacherIds:[]}],schedule:[{id:"c-m-winter-piano-beg-1-slot",groupId:"c-m-winter-piano-beg-1",dayOfWeek:1,startTime:"13:00",endTime:"14:30"},{id:"c-m-year1-erev-1-slot",groupId:"c-m-year1-erev-1",dayOfWeek:1,startTime:"16:00",endTime:"16:45"},{id:"c-m-year1-erev-2-slot",groupId:"c-m-year1-erev-2",dayOfWeek:1,startTime:"17:00",endTime:"18:30"},{id:"c-m-year1-erev-3-slot",groupId:"c-m-year1-erev-3",dayOfWeek:1,startTime:"17:00",endTime:"18:30"},{id:"c-m-year1-erev-4-slot",groupId:"c-m-year1-erev-4",dayOfWeek:1,startTime:"18:45",endTime:"19:30"},{id:"c-m-year2-1-slot",groupId:"c-m-year2-1",dayOfWeek:1,startTime:"12:15",endTime:"13:00"},{id:"c-m-year2-2-slot",groupId:"c-m-year2-2",dayOfWeek:1,startTime:"14:30",endTime:"16:00"},{id:"c-m-year2-3-slot",groupId:"c-m-year2-3",dayOfWeek:1,startTime:"14:30",endTime:"16:00"},{id:"c-m-year2-4-slot",groupId:"c-m-year2-4",dayOfWeek:1,startTime:"16:15",endTime:"17:45"},{id:"c-m-year2-5-slot",groupId:"c-m-year2-5",dayOfWeek:1,startTime:"13:15",endTime:"14:15"},{id:"c-m-year2-6-slot",groupId:"c-m-year2-6",dayOfWeek:1,startTime:"18:00",endTime:"19:30"},{id:"c-m-year2-7-slot",groupId:"c-m-year2-7",dayOfWeek:1,startTime:"12:15",endTime:"13:00"},{id:"c-m-year1-erev-ens-1-slot",groupId:"c-m-year1-erev-ens-1",dayOfWeek:1,startTime:"19:45",endTime:"20:30"},{id:"c-m-year2-ens-1-slot",groupId:"c-m-year2-ens-1",dayOfWeek:1,startTime:"19:45",endTime:"20:30"},{id:"c-m-year2-ens-2-slot",groupId:"c-m-year2-ens-2",dayOfWeek:1,startTime:"11:15",endTime:"12:30"},{id:"c-m-ensemble-grad-1-slot",groupId:"c-m-ensemble-grad-1",dayOfWeek:3,startTime:"14:00",endTime:"15:30"},{id:"c-m-winter-vocal-1-slot",groupId:"c-m-winter-vocal-1",dayOfWeek:3,startTime:"19:45",endTime:"21:15"},{id:"c-m-winter-vocal-2-slot",groupId:"c-m-winter-vocal-2",dayOfWeek:3,startTime:"19:45",endTime:"21:15"},{id:"c-m-year1-intensive-1-slot",groupId:"c-m-year1-intensive-1",dayOfWeek:3,startTime:"10:00",endTime:"11:30"},{id:"c-m-year1-intensive-2-slot",groupId:"c-m-year1-intensive-2",dayOfWeek:3,startTime:"10:00",endTime:"11:30"},{id:"c-m-year1-intensive-3-slot",groupId:"c-m-year1-intensive-3",dayOfWeek:3,startTime:"13:00",endTime:"13:45"},{id:"c-m-year1-intensive-4-slot",groupId:"c-m-year1-intensive-4",dayOfWeek:3,startTime:"14:00",endTime:"15:30"},{id:"c-m-year1-erev-5-slot",groupId:"c-m-year1-erev-5",dayOfWeek:3,startTime:"17:30",endTime:"18:45"},{id:"c-m-year3-1-slot",groupId:"c-m-year3-1",dayOfWeek:3,startTime:"10:30",endTime:"13:00"},{id:"c-m-year3-2-slot",groupId:"c-m-year3-2",dayOfWeek:3,startTime:"14:00",endTime:"15:30"},{id:"c-m-year1-boker-ens-1-slot",groupId:"c-m-year1-boker-ens-1",dayOfWeek:3,startTime:"12:00",endTime:"12:45"},{id:"c-m-year1-boker-ens-2-slot",groupId:"c-m-year1-boker-ens-2",dayOfWeek:3,startTime:"12:00",endTime:"12:45"},{id:"c-m-year1-boker-ens-3-slot",groupId:"c-m-year1-boker-ens-3",dayOfWeek:3,startTime:"12:00",endTime:"12:45"},{id:"c-m-year1-boker-ens-4-slot",groupId:"c-m-year1-boker-ens-4",dayOfWeek:3,startTime:"12:00",endTime:"12:45"},{id:"c-m-year1-erev-ens-2-slot",groupId:"c-m-year1-erev-ens-2",dayOfWeek:3,startTime:"19:45",endTime:"20:30"},{id:"c-m-year1-intensive-meet-1-slot",groupId:"c-m-year1-intensive-meet-1",dayOfWeek:3,startTime:"16:00",endTime:"16:45"},{id:"c-m-year1-intensive-meet-2-slot",groupId:"c-m-year1-intensive-meet-2",dayOfWeek:3,startTime:"17:00",endTime:"18:30"},{id:"c-w-singers-1-slot",groupId:"c-w-singers-1",dayOfWeek:0,startTime:"15:30",endTime:"16:30"},{id:"c-w-singers-2-slot",groupId:"c-w-singers-2",dayOfWeek:0,startTime:"13:30",endTime:"15:00"},{id:"c-w-singers-3-slot",groupId:"c-w-singers-3",dayOfWeek:0,startTime:"11:30",endTime:"13:00"},{id:"c-w-year1-boker-1-slot",groupId:"c-w-year1-boker-1",dayOfWeek:0,startTime:"15:30",endTime:"17:00"},{id:"c-w-year1-boker-2-slot",groupId:"c-w-year1-boker-2",dayOfWeek:0,startTime:"13:30",endTime:"15:15"},{id:"c-w-year1-boker-3-slot",groupId:"c-w-year1-boker-3",dayOfWeek:0,startTime:"17:15",endTime:"18:15"},{id:"c-w-year1-boker-4-slot",groupId:"c-w-year1-boker-4",dayOfWeek:0,startTime:"10:00",endTime:"11:15"},{id:"c-w-year1-boker-5-slot",groupId:"c-w-year1-boker-5",dayOfWeek:0,startTime:"13:30",endTime:"15:15"},{id:"c-w-year1-boker-6-slot",groupId:"c-w-year1-boker-6",dayOfWeek:0,startTime:"10:00",endTime:"11:15"},{id:"c-w-year1-boker-7-slot",groupId:"c-w-year1-boker-7",dayOfWeek:0,startTime:"11:30",endTime:"12:45"},{id:"c-w-year1-boker-8-slot",groupId:"c-w-year1-boker-8",dayOfWeek:0,startTime:"10:00",endTime:"11:15"},{id:"c-w-year1-boker-9-slot",groupId:"c-w-year1-boker-9",dayOfWeek:0,startTime:"10:00",endTime:"11:15"},{id:"c-w-year1-boker-10-slot",groupId:"c-w-year1-boker-10",dayOfWeek:0,startTime:"11:45",endTime:"13:00"},{id:"c-w-year1-erev-1-slot",groupId:"c-w-year1-erev-1",dayOfWeek:0,startTime:"18:15",endTime:"19:15"},{id:"c-w-year1-erev-2-slot",groupId:"c-w-year1-erev-2",dayOfWeek:0,startTime:"16:00",endTime:"16:45"},{id:"c-w-year1-erev-3-slot",groupId:"c-w-year1-erev-3",dayOfWeek:0,startTime:"16:45",endTime:"18:00"},{id:"c-w-year1-erev-4-slot",groupId:"c-w-year1-erev-4",dayOfWeek:0,startTime:"19:30",endTime:"20:30"},{id:"c-w-year1-erev-5-slot",groupId:"c-w-year1-erev-5",dayOfWeek:0,startTime:"20:45",endTime:"21:30"},{id:"c-w-year1-erev-6-slot",groupId:"c-w-year1-erev-6",dayOfWeek:0,startTime:"19:30",endTime:"20:30"},{id:"c-w-piano-adv-1-slot",groupId:"c-w-piano-adv-1",dayOfWeek:2,startTime:"19:00",endTime:"20:30"},{id:"c-w-year2-boker-1-slot",groupId:"c-w-year2-boker-1",dayOfWeek:2,startTime:"12:30",endTime:"13:45"},{id:"c-w-year2-boker-2-slot",groupId:"c-w-year2-boker-2",dayOfWeek:2,startTime:"12:30",endTime:"13:45"},{id:"c-w-year2-boker-3-slot",groupId:"c-w-year2-boker-3",dayOfWeek:2,startTime:"11:30",endTime:"12:15"},{id:"c-w-year2-boker-4-slot",groupId:"c-w-year2-boker-4",dayOfWeek:2,startTime:"12:30",endTime:"13:45"},{id:"c-w-year2-boker-5-slot",groupId:"c-w-year2-boker-5",dayOfWeek:2,startTime:"10:00",endTime:"11:15"},{id:"c-w-year2-boker-6-slot",groupId:"c-w-year2-boker-6",dayOfWeek:2,startTime:"14:15",endTime:"15:15"},{id:"c-w-year2-boker-7-slot",groupId:"c-w-year2-boker-7",dayOfWeek:2,startTime:"15:30",endTime:"16:45"},{id:"c-w-year2-boker-8-slot",groupId:"c-w-year2-boker-8",dayOfWeek:2,startTime:"17:00",endTime:"18:00"},{id:"c-w-year2-boker-9-slot",groupId:"c-w-year2-boker-9",dayOfWeek:2,startTime:"17:00",endTime:"18:00"},{id:"c-w-year2-erev-1-slot",groupId:"c-w-year2-erev-1",dayOfWeek:2,startTime:"18:15",endTime:"19:30"},{id:"c-w-year2-erev-2-slot",groupId:"c-w-year2-erev-2",dayOfWeek:2,startTime:"18:15",endTime:"19:30"},{id:"c-w-year2-erev-3-slot",groupId:"c-w-year2-erev-3",dayOfWeek:2,startTime:"19:45",endTime:"20:45"},{id:"c-w-year2-erev-4-slot",groupId:"c-w-year2-erev-4",dayOfWeek:2,startTime:"20:45",endTime:"21:30"},{id:"c-w-year2-erev-5-slot",groupId:"c-w-year2-erev-5",dayOfWeek:2,startTime:"20:15",endTime:"21:30"},{id:"c-w-year3-1-slot",groupId:"c-w-year3-1",dayOfWeek:2,startTime:"14:00",endTime:"15:15"},{id:"c-w-year3-2-slot",groupId:"c-w-year3-2",dayOfWeek:2,startTime:"15:30",endTime:"16:45"},{id:"c-w-year3-3-slot",groupId:"c-w-year3-3",dayOfWeek:2,startTime:"12:45",endTime:"13:45"},{id:"c-w-year3-4-slot",groupId:"c-w-year3-4",dayOfWeek:2,startTime:"11:15",endTime:"12:30"}],memberships:[{groupId:"g-w-year1-5785",userId:"u-noa"},{groupId:"g-w-year2-boker",userId:"u-noa"},{groupId:"g-w-piano-adv",userId:"u-noa"},{groupId:"g-w-year1-boker",userId:"u-tamar"},{groupId:"g-w-year2-boker",userId:"u-maya"},{groupId:"g-w-piano-adv",userId:"u-maya"},{groupId:"g-m-year1-erev",userId:"u-yoav"},{groupId:"g-m-year2",userId:"u-ori"},{groupId:"g-m-ensemble-grad",userId:"u-ori"},{groupId:"g-m-year1-intensive",userId:"u-itai"},{groupId:"g-m-prep-course",userId:"u-noa"},{groupId:"g-m-prep-course",userId:"u-yoav"},{groupId:"g-m-prep-course",userId:"u-ori"},{groupId:"g-m-prep-course",userId:"u-itai"}]},IS=ue({firstName:G().min(1),lastName:G().min(1),hebrewFullName:G().min(2),phone:G().regex(/^0\d{1,2}-?\d{7}$/,"invalid-phone"),email:G().email(),password:G().min(6),confirmPassword:G().min(6)}).refine(n=>n.password===n.confirmPassword,{message:"passwords-mismatch",path:["confirmPassword"]}),_S=ue({primaryInstrument:G().min(1),secondaryInstrument:G().optional(),musicalBackgroun
64d:G().min(2),yearsExperience:B().int().min(0).max(80),previousStudies:G().optional()}),kS=ue({genderTrack:Le(["men","women"]),trackId:G().min(1),groupId:G().min(1),city:G().min(1),dateOfBirth:G().optional(),notes:G().optional()});ue({firstName:G().min(1),lastName:G().min(1),hebrewFullName:G().min(2),phone:G().min(1),email:G().email(),password:G().min(6),primaryInstrument:G().min(1),secondaryInstrument:G().optional(),musicalBackground:G().min(1),yearsExperience:B().int().min(0).max(80),previousStudies:G().optional(),genderTrack:Le(["men","women"]),trackId:G().min(1),groupId:G().min(1),city:G().min(1),dateOfBirth:G().optional(),notes:G().optional()});const M2=["#7c5cff","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#0e7490"];function wS(n,e,t){const r=[n.primaryInstrument,...n.secondaryInstrument?[n.secondaryInstrument]:[]];return{id:e,organizationId:"org-shirat",displayName:n.hebrewFullName.trim(),roles:["musician"],instruments:r,avatarColor:M2[t%M2.length],email:n.email,phone:n.phone}}const jS={men:"track-men",women:"track-women"},TS=()=>{};var P2={};/**
65 * @license
66 * Copyright 2017 Google LLC
67 *
68 * Licensed under the Apache License, Version 2.0 (the "License");
69 * you may not use this file except in compliance with the License.
70 * You may obtain a copy of the License at
71 *
72 *   http://www.apache.org/licenses/LICENSE-2.0
73 *
74 * Unless required by applicable law or agreed to in writing, software
75 * distributed under the License is distributed on an "AS IS" BASIS,
76 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77 * See the License for the specific language governing permissions and
78 * limitations under the License.
79 */const l4=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},ES=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],a=n[t++],c=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},d4={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],a=s+1<n.length,c=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,m=i>>2,p=(i&3)<<4|c>>4;let f=(c&15)<<2|d>>6,g=d&63;l||(g=64,a||(f=64)),r.push(t[m],t[p],t[f],t[g])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(l4(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):ES(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const p=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||p==null)throw new NS;const f=i<<2|c>>4;if(r.push(f),d!==64){const g=c<<4&240|d>>2;if(r.push(g),p!==64){const x=d<<6&192|p;r.push(x)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};
79class NS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const SS=function(n){const e=l4(n);return d4.encodeByteArray(e,!0)},u4=function(n){return SS(n).replace(/\./g,"")},h4=function(n){try{return d4.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
80 * @license
81 * Copyright 2022 Google LLC
82 *
83 * Licensed under the Apache License, Version 2.0 (the "License");
84 * you may not use this file except in compliance with the License.
85 * You may obtain a copy of the License at
86 *
87 *   http://www.apache.org/licenses/LICENSE-2.0
88 *
89 * Unless required by applicable law or agreed to in writing, software
90 * distributed under the License is distributed on an "AS IS" BASIS,
91 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92 * See the License for the specific language governing permissions and
93 * limitations under the License.
94 */function m4(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
95 * @license
96 * Copyright 2022 Google LLC
97 *
98 * Licensed under the Apache License, Version 2.0 (the "License");
99 * you may not use this file except in compliance with the License.
100 * You may obtain a copy of the License at
101 *
102 *   http://www.apache.org/licenses/LICENSE-2.0
103 *
104 * Unless required by applicable law or agreed to in writing, software
105 * distributed under the License is distributed on an "AS IS" BASIS,
106 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
107 * See the License for the specific language governing permissions and
108 * limitations under the License.
109 */const AS=()=>m4().__FIREBASE_DEFAULTS__,CS=()=>{if(typeof process>"u"||typeof P2>"u")return;const n=P2.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},MS=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&h4(n[1]);return e&&JSON.parse(e)},Xu=()=>{try{return TS()||AS()||CS()||MS()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},PS=n=>{var e,t;return(t=(e=Xu())==null?void 0:e.emulatorHosts)==null?void 0:t[n]},p4=()=>{var n;return(n=Xu())==null?void 0:n.config},f4=n=>{var e;return(e=Xu())==null?void 0:e[`_${n}`]};/**
110 * @license
111 * Copyright 2017 Google LLC
112 *
113 * Licensed under the Apache License, Version 2.0 (the "License");
114 * you may not use this file except in compliance with the License.
115 * You may obtain a copy of the License at
116 *
117 *   http://www.apache.org/licenses/LICENSE-2.0
118 *
119 * Unless required by applicable law or agreed to in writing, software
120 * distributed under the License is distributed on an "AS IS" BASIS,
121 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122 * See the License for the specific language governing permissions and
123 * limitations under the License.
124 */class RS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
125 * @license
126 * Copyright 2017 Google LLC
127 *
128 * Licensed under the Apache License, Version 2.0 (the "License");
129 * you may not use this file except in compliance with the License.
130 * You may obtain a copy of the License at
131 *
132 *   http://www.apache.org/licenses/LICENSE-2.0
133 *
134 * Unless required by applicable law or agreed to in writing, software
135 * distributed under the License is distributed on an "AS IS" BASIS,
136 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137 * See the License for the specific language governing permissions and
138 * limitations under the License.
139 */function $t(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function OS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test($t())}function g4(){var e;const n=(e=Xu())==null?void 0:e.forceEnvironment;if(n==="node")return!0;
139if(n==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function DS(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function VS(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function LS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function qS(){const n=$t();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function y4(){return!g4()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function b4(){return!g4()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function x4(){try{return typeof indexedDB=="object"}catch{return!1}}function zS(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(t){e(t)}})}/**
140 * @license
141 * Copyright 2017 Google LLC
142 *
143 * Licensed under the Apache License, Version 2.0 (the "License");
144 * you may not use this file except in compliance with the License.
145 * You may obtain a copy of the License at
146 *
147 *   http://www.apache.org/licenses/LICENSE-2.0
148 *
149 * Unless required by applicable law or agreed to in writing, software
150 * distributed under the License is distributed on an "AS IS" BASIS,
151 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
152 * See the License for the specific language governing permissions and
153 * limitations under the License.
154 */const FS="FirebaseError";class ls extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=FS,Object.setPrototypeOf(this,ls.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,yl.prototype.create)}}class yl{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],a=i?$S(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new ls(s,c,r)}}function $S(n,e){return n.replace(BS,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const BS=/\{\$([^}]+)}/g;function US(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Jr(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],a=e[s];if(R2(i)&&R2(a)){if(!Jr(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function R2(n){return n!==null&&typeof n=="object"}/**
155 * @license
156 * Copyright 2017 Google LLC
157 *
158 * Licensed under the Apache License, Version 2.0 (the "License");
159 * you may not use this file except in compliance with the License.
160 * You may obtain a copy of the License at
161 *
162 *   http://www.apache.org/licenses/LICENSE-2.0
163 *
164 * Unless required by applicable law or agreed to in writing, software
165 * distributed under the License is distributed on an "AS IS" BASIS,
166 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167 * See the License for the specific language governing permissions and
168 * limitations under the License.
169 */function bl(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function GS(n,e){const t=new KS(n,e);return t.subscribe.bind(t)}class KS{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");HS(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=jm),s.error===void 0&&(s.error=jm),s.complete===void 0&&(s.complete=jm);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>
169{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function HS(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function jm(){}/**
170 * @license
171 * Copyright 2021 Google LLC
172 *
173 * Licensed under the Apache License, Version 2.0 (the "License");
174 * you may not use this file except in compliance with the License.
175 * You may obtain a copy of the License at
176 *
177 *   http://www.apache.org/licenses/LICENSE-2.0
178 *
179 * Unless required by applicable law or agreed to in writing, software
180 * distributed under the License is distributed on an "AS IS" BASIS,
181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182 * See the License for the specific language governing permissions and
183 * limitations under the License.
184 */function Cn(n){return n&&n._delegate?n._delegate:n}/**
185 * @license
186 * Copyright 2025 Google LLC
187 *
188 * Licensed under the Apache License, Version 2.0 (the "License");
189 * you may not use this file except in compliance with the License.
190 * You may obtain a copy of the License at
191 *
192 *   http://www.apache.org/licenses/LICENSE-2.0
193 *
194 * Unless required by applicable law or agreed to in writing, software
195 * distributed under the License is distributed on an "AS IS" BASIS,
196 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
197 * See the License for the specific language governing permissions and
198 * limitations under the License.
199 */function xl(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function v4(n){return(await fetch(n,{credentials:"include"})).ok}class Li{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
200 * @license
201 * Copyright 2019 Google LLC
202 *
203 * Licensed under the Apache License, Version 2.0 (the "License");
204 * you may not use this file except in compliance with the License.
205 * You may obtain a copy of the License at
206 *
207 *   http://www.apache.org/licenses/LICENSE-2.0
208 *
209 * Unless required by applicable law or agreed to in writing, software
210 * distributed under the License is distributed on an "AS IS" BASIS,
211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
212 * See the License for the specific language governing permissions and
213 * limitations under the License.
214 */const xi="[DEFAULT]";/**
215 * @license
216 * Copyright 2019 Google LLC
217 *
218 * Licensed under the Apache License, Version 2.0 (the "License");
219 * you may not use this file except in compliance with the License.
220 * You may obtain a copy of the License at
221 *
222 *   http://www.apache.org/licenses/LICENSE-2.0
223 *
224 * Unless required by applicable law or agreed to in writing, software
225 * distributed under the License is distributed on an "AS IS" BASIS,
226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
227 * See the License for the specific language governing permissions and
228 * limitations under the License.
229 */class WS{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new RS;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(QS(e))try{this.getOrInitializeService({instanceIdentifier:xi})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=xi){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=xi){return this.instances.has(e)}getOptions(e=xi){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.resolve(s)}return s}onInit(e,t){const r=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:YS(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=xi){return this.component?this.component.multipleInstances?e:xi:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function YS(n){return n===xi?void 0:n}function QS(n){return n.instantiationMode==="EAGER"}/**
230 * @license
231 * Copyright 2019 Google LLC
232 *
233 * Licensed under the Apache License, Version 2.0 (the "License");
234 * you may not use this file except in compliance with the License.
235 * You may obtain a copy of the License at
236 *
237 *   http://www.apache.org/licenses/LICENSE-2.0
238 *
239 * Unless required by applicable law or agreed to in writing, software
240 * distributed under the License is distributed on an "AS IS" BASIS,
241 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
242 * See the License for the specific language governing permissions and
243 * limitations under the License.
244 */class ZS{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new WS(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
245 * @license
246 * Copyright 2017 Google LLC
247 *
248 * Licensed under the Apache License, Version 2.0 (the "License");
249 * you may not use this file except in compliance with the License.
250 * You may obtain a copy of the License at
251 *
252 *   http://www.apache.org/licenses/LICENSE-2.0
253 *
254 * Unless required by applicable law or agreed to in writing, software
255 * distributed under the License is distributed on an "AS IS" BASIS,
256 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
257 * See the License for the specific language governing permissions and
258 * limitations under the License.
259 */var He;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(He||(He={}));const JS={debug:He.DEBUG,verbose:He.VERBOSE,info:He.INFO,warn:He.WARN,error:He.ERROR,silent:He.SILENT},XS=He.INFO,eA={[He.DEBUG]:"log",[He.VERBOSE]:"log",[He.INFO]:"info",[He.WARN]:"warn",[He.ERROR]:"error"},tA=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=eA[e];if(s)console[s](`[${r}]  ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class A1{constructor(e){this.name=e,this._logLevel=XS,this._logHandler=tA,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in He))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?JS[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,He.DEBUG,...e),this._logHandler(this,He.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,He.VERBOSE,...e),this._logHandler(this,He.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,He.INFO,...e),this._logHandler(this,He.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,He.WARN,...e),this._logHandler(this,He.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,He.ERROR,...e),this._logHandler(this,He.ERROR,...e)}}const nA=(n,e)=>e.some(t=>n instanceof t);let O2,D2;function rA(){return O2||(O2=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function sA(){return D2||(D2=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const I4=new WeakMap,bp=new WeakMap,_4=new WeakMap,Tm=new WeakMap,C1=new WeakMap;function iA(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",a)},i=()=>{t(Ds(n.result)),s()},a=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&I4.set(t,n)}).catch(()=>{}),C1.set(e,n),e}function aA(n){if(bp.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",a),n.removeEventListener("abort",a)},i=()=>{t(),s()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",a),n.addEventListener("abort",a)});bp.set(n,e)}let xp={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return bp.get(n);if(e==="objectStoreNames")return n.objectStoreNames||_4.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return Ds(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function oA(n){xp=n(xp)}
259function cA(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Em(this),e,...t);return _4.set(r,e.sort?e.sort():[e]),Ds(r)}:sA().includes(n)?function(...e){return n.apply(Em(this),e),Ds(I4.get(this))}:function(...e){return Ds(n.apply(Em(this),e))}}function lA(n){return typeof n=="function"?cA(n):(n instanceof IDBTransaction&&aA(n),nA(n,rA())?new Proxy(n,xp):n)}function Ds(n){if(n instanceof IDBRequest)return iA(n);if(Tm.has(n))return Tm.get(n);const e=lA(n);return e!==n&&(Tm.set(n,e),C1.set(e,n)),e}const Em=n=>C1.get(n);function dA(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(n,e),c=Ds(a);return r&&a.addEventListener("upgradeneeded",l=>{r(Ds(a.result),l.oldVersion,l.newVersion,Ds(a.transaction),l)}),t&&a.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{i&&l.addEventListener("close",()=>i()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}const uA=["get","getKey","getAll","getAllKeys","count"],hA=["put","add","delete","clear"],Nm=new Map;function V2(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Nm.get(e))return Nm.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=hA.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||uA.includes(t)))return;const i=async function(a,...c){const l=this.transaction(a,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[t](...c),s&&l.done]))[0]};return Nm.set(e,i),i}oA(n=>({...n,get:(e,t,r)=>V2(e,t)||n.get(e,t,r),has:(e,t)=>!!V2(e,t)||n.has(e,t)}));/**
260 * @license
261 * Copyright 2019 Google LLC
262 *
263 * Licensed under the Apache License, Version 2.0 (the "License");
264 * you may not use this file except in compliance with the License.
265 * You may obtain a copy of the License at
266 *
267 *   http://www.apache.org/licenses/LICENSE-2.0
268 *
269 * Unless required by applicable law or agreed to in writing, software
270 * distributed under the License is distributed on an "AS IS" BASIS,
271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
272 * See the License for the specific language governing permissions and
273 * limitations under the License.
274 */class mA{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(pA(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function pA(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const vp="@firebase/app",L2="0.15.1";/**
275 * @license
276 * Copyright 2019 Google LLC
277 *
278 * Licensed under the Apache License, Version 2.0 (the "License");
279 * you may not use this file except in compliance with the License.
280 * You may obtain a copy of the License at
281 *
282 *   http://www.apache.org/licenses/LICENSE-2.0
283 *
284 * Unless required by applicable law or agreed to in writing, software
285 * distributed under the License is distributed on an "AS IS" BASIS,
286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
287 * See the License for the specific language governing permissions and
288 * limitations under the License.
289 */const Xr=new A1("@firebase/app"),fA="@firebase/app-compat",gA="@firebase/analytics-compat",yA="@firebase/analytics",bA="@firebase/app-check-compat",xA="@firebase/app-check",vA="@firebase/auth",IA="@firebase/auth-compat",_A="@firebase/database",kA="@firebase/data-connect",wA="@firebase/database-compat",jA="@firebase/functions",TA="@firebase/functions-compat",EA="@firebase/installations",NA="@firebase/installations-compat",SA="@firebase/messaging",AA="@firebase/messaging-compat",CA="@firebase/performance",MA="@firebase/performance-compat",PA="@firebase/remote-config",RA="@firebase/remote-config-compat",OA="@firebase/storage",DA="@firebase/storage-compat",VA="@firebase/firestore",LA="@firebase/ai",qA="@firebase/firestore-compat",zA="firebase",FA="12.16.0";/**
290 * @license
291 * Copyright 2019 Google LLC
292 *
293 * Licensed under the Apache License, Version 2.0 (the "License");
294 * you may not use this file except in compliance with the License.
295 * You may obtain a copy of the License at
296 *
297 *   http://www.apache.org/licenses/LICENSE-2.0
298 *
299 * Unless required by applicable law or agreed to in writing, software
300 * distributed under the License is distributed on an "AS IS" BASIS,
301 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302 * See the License for the specific language governing permissions and
303 * limitations under the License.
304 */const Ip="[DEFAULT]",$A={[vp]:"fire-core",[fA]:"fire-core-compat",[yA]:"fire-analytics",[gA]:"fire-analytics-compat",[xA]:"fire-app-check",[bA]:"fire-app-check-compat",[vA]:"fire-auth",[IA]:"fire-auth-compat",[_A]:"fire-rtdb",[kA]:"fire-data-connect",[wA]:"fire-rtdb-compat",[jA]:"fire-fn",[TA]:"fire-fn-compat",[EA]:"fire-iid",[NA]:"fire-iid-compat",[SA]:"fire-fcm",[AA]:"fire-fcm-compat",[CA]:"fire-perf",[MA]:"fire-perf-compat",[PA]:"fire-rc",[RA]:"fire-rc-compat",[OA]:"fire-gcs",[DA]:"fire-gcs-compat",[VA]:"fire-fst",[qA]:"fire-fst-compat",[LA]:"fire-vertex","fire-js":"fire-js",[zA]:"fire-js-all"};/**
305 * @license
306 * Copyright 2019 Google LLC
307 *
308 * Licensed under the Apache License, Version 2.0 (the "License");
309 * you may not use this file except in compliance with the License.
310 * You may obtain a copy of the License at
311 *
312 *   http://www.apache.org/licenses/LICENSE-2.0
313 *
314 * Unless required by applicable law or agreed to in writing, software
315 * distributed under the License is distributed on an "AS IS" BASIS,
316 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
317 * See the License for the specific language governing permissions and
318 * limitations under the License.
319 */const eu=new Map,BA=new Map,_p=new Map;function q2(n,e){try{n.container.addComponent(e)}catch(t){Xr.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ya(n){const e=n.name;if(_p.has(e))return Xr.debug(`There were multiple attempts to register component ${e}.`),!1;_p.set(e,n);for(const t of eu.values())q2(t,n);for(const t of BA.values())q2(t,n);return!0}function M1(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function ar(n){return n==null?!1:n.settings!==void 0}/**
320 * @license
321 * Copyright 2019 Google LLC
322 *
323 * Licensed under the Apache License, Version 2.0 (the "License");
324 * you may not use this file except in compliance with the License.
325 * You may obtain a copy of the License at
326 *
327 *   http://www.apache.org/licenses/LICENSE-2.0
328 *
329 * Unless required by applicable law or agreed to in writing, software
330 * distributed under the License is distributed on an "AS IS" BASIS,
331 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
332 * See the License for the specific language governing permissions and
333 * limitations under the License.
334 */const UA={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
334d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Vs=new yl("app","Firebase",UA);/**
335 * @license
336 * Copyright 2019 Google LLC
337 *
338 * Licensed under the Apache License, Version 2.0 (the "License");
339 * you may not use this file except in compliance with the License.
340 * You may obtain a copy of the License at
341 *
342 *   http://www.apache.org/licenses/LICENSE-2.0
343 *
344 * Unless required by applicable law or agreed to in writing, software
345 * distributed under the License is distributed on an "AS IS" BASIS,
346 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
347 * See the License for the specific language governing permissions and
348 * limitations under the License.
349 */class GA{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Li("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Vs.create("app-deleted",{appName:this._name})}}/**
350 * @license
351 * Copyright 2019 Google LLC
352 *
353 * Licensed under the Apache License, Version 2.0 (the "License");
354 * you may not use this file except in compliance with the License.
355 * You may obtain a copy of the License at
356 *
357 *   http://www.apache.org/licenses/LICENSE-2.0
358 *
359 * Unless required by applicable law or agreed to in writing, software
360 * distributed under the License is distributed on an "AS IS" BASIS,
361 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362 * See the License for the specific language governing permissions and
363 * limitations under the License.
364 */const ko=FA;function P1(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r={name:Ip,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw Vs.create("bad-app-name",{appName:String(s)});if(t||(t=p4()),!t)throw Vs.create("no-options");const i=eu.get(s);if(i){if(Jr(t,i.options)&&Jr(r,i.config))return i;throw Vs.create("duplicate-app",{appName:s})}const a=new ZS(s);for(const l of _p.values())a.addComponent(l);const c=new GA(t,r,a);return eu.set(s,c),c}function KA(n=Ip){const e=eu.get(n);if(!e&&n===Ip&&p4())return P1();if(!e)throw Vs.create("no-app",{appName:n});return e}function Ls(n,e,t){let r=$A[n]??n;t&&(r+=`-${t}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const a=[`Unable to register library "${r}" with version "${e}":`];s&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&a.push("and"),i&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Xr.warn(a.join(" "));return}Ya(new Li(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
365 * @license
366 * Copyright 2021 Google LLC
367 *
368 * Licensed under the Apache License, Version 2.0 (the "License");
369 * you may not use this file except in compliance with the License.
370 * You may obtain a copy of the License at
371 *
372 *   http://www.apache.org/licenses/LICENSE-2.0
373 *
374 * Unless required by applicable law or agreed to in writing, softw
374are
375 * distributed under the License is distributed on an "AS IS" BASIS,
376 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
377 * See the License for the specific language governing permissions and
378 * limitations under the License.
379 */const HA="firebase-heartbeat-database",WA=1,zc="firebase-heartbeat-store";let Sm=null;function k4(){return Sm||(Sm=dA(HA,WA,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(zc)}catch(t){console.warn(t)}}}}).catch(n=>{throw Vs.create("idb-open",{originalErrorMessage:n.message})})),Sm}async function YA(n){try{const t=(await k4()).transaction(zc),r=await t.objectStore(zc).get(w4(n));return await t.done,r}catch(e){if(e instanceof ls)Xr.warn(e.message);else{const t=Vs.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Xr.warn(t.message)}}}async function z2(n,e){try{const r=(await k4()).transaction(zc,"readwrite");await r.objectStore(zc).put(e,w4(n)),await r.done}catch(t){if(t instanceof ls)Xr.warn(t.message);else{const r=Vs.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});
379Xr.warn(r.message)}}}function w4(n){return`${n.name}!${n.options.appId}`}/**
380 * @license
381 * Copyright 2021 Google LLC
382 *
383 * Licensed under the Apache License, Version 2.0 (the "License");
384 * you may not use this file except in compliance with the License.
385 * You may obtain a copy of the License at
386 *
387 *   http://www.apache.org/licenses/LICENSE-2.0
388 *
389 * Unless required by applicable law or agreed to in writing, software
390 * distributed under the License is distributed on an "AS IS" BASIS,
391 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
392 * See the License for the specific language governing permissions and
393 * limitations under the License.
394 */const QA=1024,ZA=30;class JA{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new eC(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=F2();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>ZA){const a=tC(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Xr.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=F2(),{heartbeatsToSend:r,unsentEntries:s}=XA(this._heartbeatsCache.heartbeats),i=u4(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return Xr.warn(t),""}}}function F2(){return new Date().toISOString().substring(0,10)}function XA(n,e=QA){const t=[];let r=n.slice();for(const s of n){const i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),$2(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),$2(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class eC{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return x4()?zS().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await YA(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return z2(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return z2(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function $2(n){return u4(JSON.stringify({version:2,heartbeats:n})).length}function tC(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
395 * @license
396 * Copyright 2019 Google LLC
397 *
398 * Licensed under the Apache License, Version 2.0 (the "License");
399 * you may not use this file except in compliance with the License.
400 * You may obtain a copy of the License at
401 *
402 *   http://www.apache.org/licenses/LICENSE-2.0
403 *
404 * Unless required by applicable law or agreed to in writing, software
405 * distributed under the License is distributed on an "AS IS" BASIS,
406 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
407 * See the License for the specific language governing permissions and
408 * limitations under the License.
409 */function nC(n){Ya(new Li("platform-logger",e=>new mA(e),"PRIVATE")),Ya(new Li("heartbeat",e=>new JA(e),"PRIVATE")),Ls(vp,L2,n),Ls(vp,L2,"esm2020"),Ls("fire-js","")}nC("");var rC="firebase",sC="12.16.0";/**
410 * @license
411 * Copyright 2020 Google LLC
412 *
413 * Licensed under the Apache License, Version 2.0 (the "License");
414 * you may not use this file except in compliance with the License.
415 * You may obtain a copy of the License at
416 *
417 *   http://www.apache.org/licenses/LICENSE-2.0
418 *
419 * Unless required by applicable law or agreed to in writing, software
420 * distributed under the License is distributed on an "AS IS" BASIS,
421 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
422 * See the License for the specific language governing permissions and
423 * limitations under the License.
424 */Ls(rC,sC,"app");var B2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
425Copyright The Closure Library Authors.
426SPDX-License-Identifier: Apache-2.0
427*/var qs,j4;(function(){var n;/** @license
428
429 Copyright The Closure Library Authors.
430 SPDX-License-Identifier: Apache-2.0
431*/function e(_,j){function w(){}w.prototype=j.prototype,_.F=j.prototype,_.prototype=new w,_.prototype.constructor=_,_.D=function(A,O,C){for(var S=Array(arguments.length-2),z=2;z<arguments.length;z++)S[z-2]=arguments[z];return j.prototype[O].apply(A,S)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(r,t),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(_,j,w){w||(w=0);const A=Array(16);if(typeof j=="string")for(var O=0;O<16;++O)A[O]=j.charCodeAt(w++)|j.charCodeAt(w++)<<8|j.charCodeAt(w++)<<16|j.charCodeAt(w++)<<24;else for(O=0;O<16;++O)A[O]=j[w++]|j[w++]<<8|j[w++]<<16|j[w++]<<24;j=_.g[0],w=_.g[1],O=_.g[2];let C=_.g[3],S;S=j+(C^w&(O^C))+A[0]+3614090360&4294967295,j=w+(S<<7&4294967295|S>>>25),S=C+(O^j&(w^O))+A[1]+3905402710&4294967295,C=j+(S<<12&4294967295|S>>>20),S=O+(w^C&(j^w))+A[2]+606105819&4294967295,O=C+(S<<17&4294967295|S>>>15),S=w+(j^O&(C^j))+A[3]+3250441966&4294967295,w=O+(S<<22&4294967295|S>>>10),S=j+(C^w&(O^C))+A[4]+4118548399&4294967295,j=w+(S<<7&4294967295|S>>>25),S=C+(O^j&(w^O))+A[5]+1200080426&4294967295,C=j+(S<<12&4294967295|S>>>20),S=O+(w^C&(j^w))+A[6]+2821735955&4294967295,O=C+(S<<17&4294967295|S>>>15),S=w+(j^O&(C^j))+A[7]+4249261313&4294967295,w=O+(S<<22&4294967295|S>>>10),S=j+(C^w&(O^C))+A[8]+1770035416&4294967295,j=w+(S<<7&4294967295|S>>>25),S=C+(O^j&(w^O))+A[9]+2336552879&4294967295,C=j+(S<<12&4294967295|S>>>20),S=O+(w^C&(j^w))+A[10]+4294925233&4294967295,O=C+(S<<17&4294967295|S>>>15),S=w+(j^O&(C^j))+A[11]+2304563134&4294967295,w=O+(S<<22&4294967295|S>>>10),S=j+(C^w&(O^C))+A[12]+1804603682&4294967295,j=w+(S<<7&4294967295|S>>>25),S=C+(O^j&(w^O))+A[13]+4254626195&4294967295,C=j+(S<<12&4294967295|S>>>20),S=O+(w^C&(j^w))+A[14]+2792965006&4294967295,O=C+(S<<17&4294967295|S>>>15),S=w+(j^O&(C^j))+A[15]+1236535329&4294967295,w=O+(S<<22&4294967295|S>>>10),S=j+(O^C&(w^O))+A[1]+4129170786&4294967295,j=w+(S<<5&4294967295|S>>>27),S=C+(w^O&(j^w))+A[6]+3225465664&4294967295,C=j+(S<<9&4294967295|S>>>23),S=O+(j^w&(C^j))+A[11]+643717713&4294967295,O=C+(S<<14&4294967295|S>>>18),S=w+(C^j&(O^C))+A[0]+3921069994&4294967295,w=O+(S<<20&4294967295|S>>>12),S=j+(O^C&(w^O))+A[5]+3593408605&4294967295,j=w+(S<<5&4294967295|S>>>27),S=C+(w^O&(j^w))+A[10]+38016083&4294967295,C=j+(S<<9&4294967295|S>>>23),S=O+(j^w&(C^j))+A[15]+3634488961&4294967295,O=C+(S<<14&4294967295|S>>>18),S=w+(C^j&(O^C))+A[4]+3889429448&4294967295,w=O+(S<<20&4294967295|S>>>12),S=j+(O^C&(w^O))+A[9]+568446438&4294967295,j=w+(S<<5&4294967295|S>>>27),S=C+(w^O&(j^w))+A[14]+3275163606&4294967295,C=j+(S<<9&4294967295|S>>>23),S=O+(j^w&(C^j))+A[3]+4107603335&4294967295,O=C+(S<<14&4294967295|S>>>18),S=w+(C^j&(O^C))+A[8]+1163531501&4294967295,w=O+(S<<20&4294967295|S>>>12),S=j+(O^C&(w^O))+A[13]+2850285829&4294967295,j=w+(S<<5&4294967295|S>>>27),S=C+(w^O&(j^w))+A[2]+4243563512&4294967295,C=j+(S<<9&4294967295|S>>>23),S=O+(j^w&(C^j))+A[7]+1735328473&4294967295,O=C+(S<<14&4294967295|S>>>18),S=w+(C^j&(O^C))+A[12]+2368359562&4294967295,w=O+(S<<20&4294967295|S>>>12),S=j+(w^O^C)+A[5]+4294588738&4294967295,j=w+(S<<4&4294967295|S>>>28),S=C+(j^w^O)+A[8]+2272392833&4294967295,C=j+(S<<11&4294967295|S>>>21),S=O+(C^j^w)+A[11]+1839030562&4294967295,O=C+(S<<16&4294967295|S>>>16),S=w+(O^C^j)+A[14]+4259657740&4294967295,w=O+(S<<23&4294967295|S>>>9),S=j+(w^O^C)+A[1]+2763975236&4294967295,j=w+(S<<4&4294967295|S>>>28),S=C+(j^w^O)+A[4]+1272893353&4294967295,C=j+(S<<11&4294967295|S>>>21),S=O+(C^j^w)+A[7]+4139469664&4294967295,O=C+(S<<16&4294967295|S>>>16),S=w+(O^C^j)+A[10]+3200236656&4294967295,w=O+(S<<23&4294967295|S>>>9),S=j+(w^O^C)+A[13]+681279174&4294967295,j=w+(S<<4&4294967295|S>>>28),S=C+(j^w^O)+A[0]+3936430074&4294967295,C=j+(S<<11&4294967295|S>>>21),S=O+(C^j^w)+A[3]+3572445317&4294967295,O=C+(S<<16&4294967295|S>>>16),S=w+(O^C^j)+A[6]+76029189&4294967295,w=O+(S<<23&4294967295|S>>>9),S=j+(w^O^C)+A[9]+3654602809&4294967295,j=w+(S<<4&4294967295|S>>>28),S=C+(j^w^O)+A[12]+3873151461&4294967295,C=j+(S<<11&4294967295|S>>>21),S=O+(C^j^w)+A[15]+530742520&4294967295,O=C+(S<<16&4294967295|S>>>16),S=w+(O^C^j)+A[2]+3299628645&4294967295,w=O+(S<<23&4294967295|S>>>9),S=j+(O^(w|~C))+A[0]+4096336452&4294967295,j=w+(S<<6&4294967295|S>>>26),S=C+(w^(j|~O))+A[7]+1126891415&4294967295,C=j+(S<<10&4294967295|S>>>22),S=O+(j^(C|~w))+A[14]+2878612391&4294967295,O=C+(S<<15&4294967295|S>>>17),S=w+(C^(O|~j))+A[5]+4237533241&4294967295,w=O+(S<<21&4294967295|S>>>11),S=j+(O^(w|~C))+A[12]+1700485571&4294967295,j=w+(S<<6&4294967295|S>>>26),S=C+(w^(j|~O))+A[3]+2399980690&4294967295,C=j+(S<<10&4294967295|S>>>22),S=O+(j^(C|~w))+A[10]+4293915773&4294967295,O=C+(S<<15&4294967295|S>>>17),S=w+(C^(O|~j))+A[1]+2240044497&4294967295,w=O+(S<<21&4294967295|S>>>11),S=j+(O^(w|~C))+A[8]+1873313359&4294967295,j=w+(S<<6&4294967295|S>>>26),S=C+(w^(j|~O))+A[15]+4264355552&4294967295,C=j+(S<<10&4294967295|S>>>22),S=O+(j^(C|~w))+A[6]+2734768916&4294967295,O=C+(S<<15&4294967295|S>>>17),S=w+(C^(O|~j))+A[13]+1309151649&4294967295,w=O+(S<<21&4294967295|S>>>11),S=j+(O^(w|~C))+A[4]+4149444226&4294967295,j=w+(S<<6&4294967295|S>>>26),S=C+(w^(j|~O))+A[11]+3174756917&4294967295,C=j+(S<<10&4294967295|S>>>22),S=O+(j^(C|~w))+A[2]+718787259&4294967295,O=C+(S<<15&4294967295|S>>>17),S=w+(C^(O|~j))+A[9]+3951481745&4294967295,_.g[0]=_.g[0]+j&4294967295,_.g[1]=_.g[1]+(O+(S<<21&4294967295|S>>>11))&4294967295,_.g[2]=_.g[2]+O&4294967295,_.g[3]=_.g[3]+C&4294967295}
431r.prototype.v=function(_,j){j===void 0&&(j=_.length);const w=j-this.blockSize,A=this.C;let O=this.h,C=0;for(;C<j;){if(O==0)for(;C<=w;)s(this,_,C),C+=this.blockSize;if(typeof _=="string"){for(;C<j;)if(A[O++]=_.charCodeAt(C++),O==this.blockSize){s(this,A),O=0;break}}else for(;C<j;)if(A[O++]=_[C++],O==this.blockSize){s(this,A),O=0;break}}this.h=O,this.o+=j},r.prototype.A=function(){var _=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);_[0]=128;for(var j=1;j<_.length-8;++j)_[j]=0;j=this.o*8;for(var w=_.length-8;w<_.length;++w)_[w]=j&255,j/=256;for(this.v(_),_=Array(16),j=0,w=0;w<4;++w)for(let A=0;A<32;A+=8)_[j++]=this.g[w]>>>A&255;return _};function i(_,j){var w=c;return Object.prototype.hasOwnProperty.call(w,_)?w[_]:w[_]=j(_)}function a(_,j){this.h=j;const w=[];let A=!0;for(let O=_.length-1;O>=0;O--){const C=_[O]|0;A&&C==j||(w[O]=C,A=!1)}this.g=w}var c={};function l(_){return-128<=_&&_<128?i(_,function(j){return new a([j|0],j<0?-1:0)}):new a([_|0],_<0?-1:0)}function d(_){if(isNaN(_)||!isFinite(_))return p;if(_<0)return I(d(-_));const j=[];let w=1;for(let A=0;_>=w;A++)j[A]=_/w|0,w*=4294967296;return new a(j,0)}function m(_,j){if(_.length==0)throw Error("number format error: empty string");if(j=j||10,j<2||36<j)throw Error("radix out of range: "+j);if(_.charAt(0)=="-")return I(m(_.substring(1),j));if(_.indexOf("-")>=0)throw Error('number format error: interior "-" character');const w=d(Math.pow(j,8));let A=p;for(let C=0;C<_.length;C+=8){var O=Math.min(8,_.length-C);const S=parseInt(_.substring(C,C+O),j);O<8?(O=d(Math.pow(j,O)),A=A.j(O).add(d(S))):(A=A.j(w),A=A.add(d(S)))}return A}var p=l(0),f=l(1),g=l(16777216);n=a.prototype,n.m=function(){if(b(this))return-I(this).m();let _=0,j=1;for(let w=0;w<this.g.length;w++){const A=this.i(w);_+=(A>=0?A:4294967296+A)*j,j*=4294967296}return _},n.toString=function(_){if(_=_||10,_<2||36<_)throw Error("radix out of range: "+_);if(x(this))return"0";if(b(this))return"-"+I(this).toString(_);const j=d(Math.pow(_,6));var w=this;let A="";for(;;){const O=T(w,j).g;w=N(w,O.j(j));let C=((w.g.length>0?w.g[0]:w.h)>>>0).toString(_);if(w=O,x(w))return C+A;for(;C.length<6;)C="0"+C;A=C+A}},n.i=function(_){return _<0?0:_<this.g.length?this.g[_]:this.h};function x(_){if(_.h!=0)return!1;for(let j=0;j<_.g.length;j++)if(_.g[j]!=0)return!1;return!0}function b(_){return _.h==-1}n.l=function(_){return _=N(this,_),b(_)?-1:x(_)?0:1};function I(_){const j=_.g.length,w=[];for(let A=0;A<j;A++)w[A]=~_.g[A];return new a(w,~_.h).add(f)}n.abs=function(){return b(this)?I(this):this},n.add=function(_){const j=Math.max(this.g.length,_.g.length),w=[];let A=0;for(let O=0;O<=j;O++){let C=A+(this.i(O)&65535)+(_.i(O)&65535),S=(C>>>16)+(this.i(O)>>>16)+(_.i(O)>>>16);A=S>>>16,C&=65535,S&=65535,w[O]=S<<16|C}return new a(w,w[w.length-1]&-2147483648?-1:0)};function N(_,j){return _.add(I(j))}n.j=function(_){if(x(this)||x(_))return p;if(b(this))return b(_)?I(this).j(I(_)):I(I(this).j(_));if(b(_))return I(this.j(I(_)));if(this.l(g)<0&&_.l(g)<0)return d(this.m()*_.m());const j=this.g.length+_.g.length,w=[];for(var A=0;A<2*j;A++)w[A]=0;for(A=0;A<this.g.length;A++)for(let O=0;O<_.g.length;O++){const C=this.i(A)>>>16,S=this.i(A)&65535,z=_.i(O)>>>16,re=_.i(O)&65535;w[2*A+2*O]+=S*re,V(w,2*A+2*O),w[2*A+2*O+1]+=C*re,V(w,2*A+2*O+1),w[2*A+2*O+1]+=S*z,V(w,2*A+2*O+1),w[2*A+2*O+2]+=C*z,V(w,2*A+2*O+2)}for(_=0;_<j;_++)w[_]=w[2*_+1]<<16|w[2*_];for(_=j;_<2*j;_++)w[_]=0;return new a(w,0)};function V(_,j){for(;(_[j]&65535)!=_[j];)_[j+1]+=_[j]>>>16,_[j]&=65535,j++}function D(_,j){this.g=_,this.h=j}function T(_,j){if(x(j))throw Error("division by zero");if(x(_))return new D(p,p);if(b(_))return j=T(I(_),j),new D(I(j.g),I(j.h));if(b(j))return j=T(_,I(j)),new D(I(j.g),j.h);if(_.g.length>30){if(b(_)||b(j))throw Error("slowDivide_ only works with positive integers.");for(var w=f,A=j;A.l(_)<=0;)w=M(w),A=M(A);var O=R(w,1),C=R(A,1);for(A=R(A,2),w=R(w,2);!x(A);){var S=C.add(A);S.l(_)<=0&&(O=O.add(w),C=S),A=R(A,1),w=R(w,1)}return j=N(_,O.j(j)),new D(O,j)}for(O=p;_.l(j)>=0;){for(w=Math.max(1,Math.floor(_.m()/j.m())),A=Math.ceil(Math.log(w)/Math.LN2),A=A<=48?1:Math.pow(2,A-48),C=d(w),S=C.j(j);b(S)||S.l(_)>0;)w-=A,C=d(w),S=C.j(j);x(C)&&(C=f),O=O.add(C),_=N(_,S)}return new D(O,_)}n.B=function(_){return T(this,_).h},n.and=function(_){const j=Math.max(this.g.length,_.g.length),w=[];for(let A=0;A<j;A++)w[A]=this.i(A)&_.i(A);return new a(w,this.h&_.h)},n.or=function(_){const j=Math.max(this.g.length,_.g.length),w=[];for(let A=0;A<j;A++)w[A]=this.i(A)|_.i(A);return new a(w,this.h|_.h)},n.xor=function(_){const j=Math.max(this.g.length,_.g.length),w=[];for(let A=0;A<j;A++)w[A]=this.i(A)^_.i(A);return new a(w,this.h^_.h)};function M(_){const j=_.g.length+1,w=[];for(let A=0;A<j;A++)w[A]=_.i(A)<<1|_.i(A-1)>>>31;return new a(w,_.h)}function R(_,j){const w=j>>5;j%=32;const A=_.g.length-w,O=[];for(let C=0;C<A;C++)O[C]=j>0?_.i(C+w)>>>j|_.i(C+w+1)<<32-j:_.i(C+w);return new a(O,_.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,j4=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.B,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=m,qs=a}).apply(typeof B2<"u"?B2:typeof self<"u"?self:typeof window<"u"?window:{});var dd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
432Copyright The Closure Library Authors.
433SPDX-License-Identifier: Apache-2.0
434*/var T4,mc,E4,Ed,kp,N4,S4,A4;(function(){var n,e=Object.defineProperty;function t(h){h=[typeof globalThis=="object"&&globalThis,h,typeof window=="object"&&window,typeof self=="object"&&self,typeof dd=="object"&&dd];for(var y=0;
434y<h.length;++y){var v=h[y];if(v&&v.Math==Math)return v}throw Error("Cannot find global object")}var r=t(this);function s(h,y){if(y)e:{var v=r;h=h.split(".");for(var P=0;P<h.length-1;P++){var U=h[P];if(!(U in v))break e;v=v[U]}h=h[h.length-1],P=v[h],y=y(P),y!=P&&y!=null&&e(v,h,{configurable:!0,writable:!0,value:y})}}s("Symbol.dispose",function(h){return h||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(h){return h||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(h){return h||function(y){var v=[],P;for(P in y)Object.prototype.hasOwnProperty.call(y,P)&&v.push([P,y[P]]);return v}});/** @license
435
436 Copyright The Closure Library Authors.
437 SPDX-License-Identifier: Apache-2.0
438*/var i=i||{},a=this||self;function c(h){var y=typeof h;return y=="object"&&h!=null||y=="function"}function l(h,y,v){return h.call.apply(h.bind,arguments)}function d(h,y,v){return d=l,d.apply(null,arguments)}function m(h,y){var v=Array.prototype.slice.call(arguments,1);return function(){var P=v.slice();return P.push.apply(P,arguments),h.apply(this,P)}}function p(h,y){function v(){}v.prototype=y.prototype,h.Z=y.prototype,h.prototype=new v,h.prototype.constructor=h,h.Ob=function(P,U,H){for(var pe=Array(arguments.length-2),Ue=2;Ue<arguments.length;Ue++)pe[Ue-2]=arguments[Ue];return y.prototype[U].apply(P,pe)}}var f=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?h=>h&&AsyncContext.Snapshot.wrap(h):h=>h;function g(h){const y=h.length;if(y>0){const v=Array(y);for(let P=0;P<y;P++)v[P]=h[P];return v}return[]}function x(h,y){for(let P=1;P<arguments.length;P++){const U=arguments[P];var v=typeof U;if(v=v!="object"?v:U?Array.isArray(U)?"array":v:"null",v=="array"||v=="object"&&typeof U.length=="number"){v=h.length||0;const H=U.length||0;h.length=v+H;for(let pe=0;pe<H;pe++)h[v+pe]=U[pe]}else h.push(U)}}class b{constructor(y,v){this.i=y,this.j=v,this.h=0,this.g=null}get(){let y;return this.h>0?(this.h--,y=this.g,this.g=y.next,y.next=null):y=this.i(),y}}function I(h){a.setTimeout(()=>{throw h},0)}function N(){var h=_;let y=null;return h.g&&(y=h.g,h.g=h.g.next,h.g||(h.h=null),y.next=null),y}class V{constructor(){this.h=this.g=null}add(y,v){const P=D.get();P.set(y,v),this.h?this.h.next=P:this.g=P,this.h=P}}var D=new b(()=>new T,h=>h.reset());class T{constructor(){this.next=this.g=this.h=null}set(y,v){this.h=y,this.g=v,this.next=null}reset(){this.next=this.g=this.h=null}}let M,R=!1,_=new V,j=()=>{const h=Promise.resolve(void 0);M=()=>{h.then(w)}};function w(){for(var h;h=N();){try{h.h.call(h.g)}catch(v){I(v)}var y=D;y.j(h),y.h<100&&(y.h++,h.next=y.g,y.g=h)}R=!1}function A(){this.u=this.u,this.C=this.C}A.prototype.u=!1,A.prototype.dispose=function(){this.u||(this.u=!0,this.N())},A.prototype[Symbol.dispose]=function(){this.dispose()},A.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function O(h,y){this.type=h,this.g=this.target=y,this.defaultPrevented=!1}O.prototype.h=function(){this.defaultPrevented=!0};var C=(function(){if(!a.addEventListener||!Object.defineProperty)return!1;var h=!1,y=Object.defineProperty({},"passive",{get:function(){h=!0}});try{const v=()=>{};a.addEventListener("test",v,y),a.removeEventListener("test",v,y)}catch{}return h})();function S(h){return/^[\s\xa0]*$/.test(h)}function z(h,y){O.call(this,h?h.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,h&&this.init(h,y)}p(z,O),z.prototype.init=function(h,y){const v=this.type=h.type,P=h.changedTouches&&h.
438changedTouches.length?h.changedTouches[0]:null;this.target=h.target||h.srcElement,this.g=y,y=h.relatedTarget,y||(v=="mouseover"?y=h.fromElement:v=="mouseout"&&(y=h.toElement)),this.relatedTarget=y,P?(this.clientX=P.clientX!==void 0?P.clientX:P.pageX,this.clientY=P.clientY!==void 0?P.clientY:P.pageY,this.screenX=P.screenX||0,this.screenY=P.screenY||0):(this.clientX=h.clientX!==void 0?h.clientX:h.pageX,this.clientY=h.clientY!==void 0?h.clientY:h.pageY,this.screenX=h.screenX||0,this.screenY=h.screenY||0),this.button=h.button,this.key=h.key||"",this.ctrlKey=h.ctrlKey,this.altKey=h.altKey,this.shiftKey=h.shiftKey,this.metaKey=h.metaKey,this.pointerId=h.pointerId||0,this.pointerType=h.pointerType,this.state=h.state,this.i=h,h.defaultPrevented&&z.Z.h.call(this)},z.prototype.h=function(){z.Z.h.call(this);const h=this.i;h.preventDefault?h.preventDefault():h.returnValue=!1};var re="closure_listenable_"+(Math.random()*1e6|0),ne=0;function ve(h,y,v,P,U){this.listener=h,this.proxy=null,this.src=y,this.type=v,this.capture=!!P,this.ha=U,this.key=++ne,this.da=this.fa=!1}function $(h){h.da=!0,h.listener=null,h.proxy=null,h.src=null,h.ha=null}function oe(h,y,v){for(const P in h)y.call(v,h[P],P,h)}function ie(h,y){for(const v in h)y.call(void 0,h[v],v,h)}function Ie(h){const y={};for(const v in h)y[v]=h[v];return y}const Ee="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Y(h,y){let v,P;for(let U=1;U<arguments.length;U++){P=arguments[U];for(v in P)h[v]=P[v];for(let H=0;H<Ee.length;H++)v=Ee[H],Object.prototype.hasOwnProperty.call(P,v)&&(h[v]=P[v])}}function xe(h){this.src=h,this.g={},this.h=0}xe.prototype.add=function(h,y,v,P,U){const H=h.toString();h=this.g[H],h||(h=this.g[H]=[],this.h++);const pe=Ze(h,y,P,U);return pe>-1?(y=h[pe],v||(y.fa=!1)):(y=new ve(y,this.src,H,!!P,U),y.fa=v,h.push(y)),y};function Ae(h,y){const v=y.type;if(v in h.g){var P=h.g[v],U=Array.prototype.indexOf.call(P,y,void 0),H;(H=U>=0)&&Array.prototype.splice.call(P,U,1),H&&($(y),h.g[v].length==0&&(delete h.g[v],h.h--))}}function Ze(h,y,v,P){for(let U=0;U<h.length;++U){const H=h[U];if(!H.da&&H.listener==y&&H.capture==!!v&&H.ha==P)return U}return-1}var Yt="closure_lm_"+(Math.random()*1e6|0),hs={};function $l(h,y,v,P,U){if(Array.isArray(y)){for(let H=0;H<y.length;H++)$l(h,y[H],v,P,U);return null}return v=_g(v),h&&h[re]?h.J(y,v,c(P)?!!P.capture:!1,U):Xh(h,y,v,!1,P,U)}function Xh(h,y,v,P,U,H){if(!y)throw Error("Invalid event type");const pe=c(U)?!!U.capture:!!U;let Ue=tm(h);if(Ue||(h[Yt]=Ue=new xe(h)),v=Ue.add(y,v,P,pe,H),v.proxy)return v;if(P=X7(),v.proxy=P,P.src=h,P.listener=v,h.addEventListener)C||(U=pe),U===void 0&&(U=!1),h.addEventListener(y.toString(),P,U);else if(h.attachEvent)h.attachEvent(Ig(y.toString()),P);else if(h.addListener&&h.removeListener)h.addListener(P);else throw Error("addEventListener and attachEvent are unavailable.");return v}function X7(){function h(v){return y.call(h.src,h.listener,v)}const y=e_;return h}function vg(h,y,v,P,U){if(Array.isArray(y))for(var H=0;H<y.length;H++)vg(h,y[H],v,P,U);else P=c(P)?!!P.capture:!!P,v=_g(v),h&&h[re]?(h=h.i,H=String(y).toString(),H in h.g&&(y=h.g[H],v=Ze(y,v,P,U),v>-1&&($(y[v]),Array.prototype.splice.call(y,v,1),y.length==0&&(delete h.g[H],h.h--)))):h&&(h=tm(h))&&(y=h.g[y.toString()],h=-1,y&&(h=Ze(y,v,P,U)),(v=h>-1?y[h]:null)&&em(v))}function em(h){if(typeof h!="number"&&h&&!h.da){var y=h.src;if(y&&y[re])Ae(y.i,h);else{var v=h.type,P=h.proxy;y.removeEventListener?y.removeEventListener(v,P,h.capture):y.detachEvent?y.detachEvent(Ig(v),P):y.addListener&&y.removeListener&&y.removeListener(P),(v=tm(y))?(Ae(v,h),v.h==0&&(v.src=null,y[Yt]=null)):$(h)}}}function Ig(h){return h in hs?hs[h]:hs[h]="on"+h}function e_(h,y){if(h.da)h=!0;else{y=new z(y,this);const v=h.listener,P=h.ha||h.src;h.fa&&em(h),h=v.call(P,y)}return h}function tm(h){return h=h[Yt],h instanceof xe?h:null}var nm="__closure_events_fn_"+(Math.random()*1e9>>>0);function _g(h){return typeof h=="function"?h:(h[nm]||(h[nm]=function(y){return h.handleEvent(y)}),h[nm])}function tn(){A.call(this),this.i=new xe(this),this.M=this,this.G=null}p(tn,A),tn.prototype[re]=!0,tn.prototype.removeEventListener=function(h,y,v,P){vg(this,h,y,v,P)};function bn(h,y){var v,P=h.G;if(P)for(v=[];P;P=P.G)v.push(P);if(h=h.M,P=y.type||y,typeof y=="string")y=new O(y,h);else if(y instanceof O)y.target=y.target||h;else{var U=y;y=new O(P,h),Y(y,U)}U=!0;let H,pe;if(v)for(pe=v.length-1;pe>=0;pe--)H=y.g=v[pe],U=Bl(H,P,!0,y)&&U;if(H=y.g=h,U=Bl(H,P,!0,y)&&U,U=Bl(H,P,!1,y)&&U,v)for(pe=0;pe<v.length;pe++)H=y.g=v[pe],U=Bl(H,P,!1,y)&&U}tn.prototype.N=function(){if(tn.Z.N.call(this),this.i){var h=this.i;for(const y in h.g){const v=h.g[y];for(let P=0;P<v.length;P++)$(v[P]);delete h.g[y],h.h--}}this.G=null},tn.prototype.J=function(h,y,v,P){return this.i.add(String(h),y,!1,v,P)},tn.prototype.K=function(h,y,v,P){return this.i.add(String(h),y,!0,v,P)};function Bl(h,y,v,P){if(y=h.i.g[String(y)],!y)return!0;y=y.concat();let U=!0;for(let H=0;H<y.length;++H){const pe=y[H];if(pe&&!pe.da&&pe.capture==v){const Ue=pe.listener,zt=pe.ha||pe.src;pe.fa&&Ae(h.i,pe),U=Ue.call(zt,P)!==!1&&U}}return U&&!P.defaultPrevented}function t_(h,y){if(typeof h!="function")if(h&&typeof h.handleEvent=="function")h=d(h.handleEvent,h);else throw Error("Invalid listener argument");return Number(y)>2147483647?-1:a.setTimeout(h,y||0)}function kg(h){h.g=t_(()=>{h.g=null,h.i&&(h.i=!1,kg(h))},h.l);const y=h.h;h.h=null,h.m.apply(null,y)}class n_ extends A{constructor(y,v){super(),this.m=y,this.l=v,this.h=null,this.i=!1,this.g=null}j(y){this.h=arguments,this.g?this.i=!0:kg(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Vo(h){A.call(this),this.h=h,this.g={}}p(Vo,A);var wg=[];function jg(h){oe(h.g,function(y,v){this.g.hasOwnProperty(v)&&em(y)},h),h.g={}}Vo.prototype.N=function(){Vo.Z.N.call(this),jg(this)},Vo.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var rm=a.JSON.stringify,r_=a.JSON.parse,s_=class{stringify(h){return a.JSON.stringify(h,void 0)}parse(h){return a.JSON.parse(h,void 0)}};function Tg(){}function Eg(){}var Lo={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function sm(){O.call(this,"d")}p(sm,O);function im(){O.call(this,"c")}p(im,O);var mi={},Ng=null;function Ul(){return Ng=Ng||new tn}mi.Ia="serverreachability";function Sg(h){O.call(this,mi.Ia,h)}p(Sg,O);
438function qo(h){const y=Ul();bn(y,new Sg(y))}mi.STAT_EVENT="statevent";function Ag(h,y){O.call(this,mi.STAT_EVENT,h),this.stat=y}p(Ag,O);function xn(h){const y=Ul();bn(y,new Ag(y,h))}mi.Ja="timingevent";function Cg(h,y){O.call(this,mi.Ja,h),this.size=y}p(Cg,O);function zo(h,y){if(typeof h!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){h()},y)}function Fo(){this.g=!0}Fo.prototype.ua=function(){this.g=!1};function i_(h,y,v,P,U,H){h.info(function(){if(h.g)if(H){var pe="",Ue=H.split("&");for(let dt=0;dt<Ue.length;dt++){var zt=Ue[dt].split("=");if(zt.length>1){const Ut=zt[0];zt=zt[1];const gr=Ut.split("_");pe=gr.length>=2&&gr[1]=="type"?pe+(Ut+"="+zt+"&"):pe+(Ut+"=redacted&")}}}else pe=null;else pe=H;return"XMLHTTP REQ ("+P+") [attempt "+U+"]: "+y+`
439`+v+`
440`+pe})}function a_(h,y,v,P,U,H,pe){h.info(function(){return"XMLHTTP RESP ("+P+") [ attempt "+U+"]: "+y+`
441`+v+`
442`+H+" "+pe})}function ha(h,y,v,P){h.info(function(){return"XMLHTTP TEXT ("+y+"): "+c_(h,v)+(P?" "+P:"")})}function o_(h,y){h.info(function(){return"TIMEOUT: "+y})}Fo.prototype.info=function(){};function c_(h,y){if(!h.g)return y;if(!y)return null;try{const H=JSON.parse(y);if(H){for(h=0;h<H.length;h++)if(Array.isArray(H[h])){var v=H[h];if(!(v.length<2)){var P=v[1];if(Array.isArray(P)&&!(P.length<1)){var U=P[0];if(U!="noop"&&U!="stop"&&U!="close")for(let pe=1;pe<P.length;pe++)P[pe]=""}}}}return rm(H)}catch{return y}}var Gl={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Mg={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},Pg;function am(){}p(am,Tg),am.prototype.g=function(){return new XMLHttpRequest},Pg=new am;function $o(h){return encodeURIComponent(String(h))}function l_(h){var y=1;h=h.split(":");const v=[];for(;y>0&&h.length;)v.push(h.shift()),y--;return h.length&&v.push(h.join(":")),v}function ms(h,y,v,P){this.j=h,this.i=y,this.l=v,this.S=P||1,this.V=new Vo(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Rg}function Rg(){this.i=null,this.g="",this.h=!1}var Og={},om={};function cm(h,y,v){h.M=1,h.A=Hl(fr(y)),h.u=v,h.R=!0,Dg(h,null)}function Dg(h,y){h.F=Date.now(),Kl(h),h.B=fr(h.A);var v=h.B,P=h.S;Array.isArray(P)||(P=[String(P)]),Yg(v.i,"t",P),h.C=0,v=h.j.L,h.h=new Rg,h.g=my(h.j,v?y:null,!h.u),h.P>0&&(h.O=new n_(d(h.Y,h,h.g),h.P)),y=h.V,v=h.g,P=h.ba;var U="readystatechange";Array.isArray(U)||(U&&(wg[0]=U.toString()),U=wg);for(let H=0;H<U.length;H++){const pe=$l(v,U[H],P||y.handleEvent,!1,y.h||y);if(!pe)break;y.g[pe.key]=pe}y=h.J?Ie(h.J):{}
442,h.u?(h.v||(h.v="POST"),y["Content-Type"]="application/x-www-form-urlencoded",h.g.ea(h.B,h.v,h.u,y)):(h.v="GET",h.g.ea(h.B,h.v,null,y)),qo(),i_(h.i,h.v,h.B,h.l,h.S,h.u)}ms.prototype.ba=function(h){h=h.target;const y=this.O;y&&gs(h)==3?y.j():this.Y(h)},ms.prototype.Y=function(h){try{if(h==this.g)e:{const Ue=gs(this.g),zt=this.g.ya(),dt=this.g.ca();if(!(Ue<3)&&(Ue!=3||this.g&&(this.h.h||this.g.la()||ny(this.g)))){this.K||Ue!=4||zt==7||(zt==8||dt<=0?qo(3):qo(2)),lm(this);var y=this.g.ca();this.X=y;var v=d_(this);if(this.o=y==200,a_(this.i,this.v,this.B,this.l,this.S,Ue,y),this.o){if(this.U&&!this.L){t:{if(this.g){var P,U=this.g;if((P=U.g?U.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!S(P)){var H=P;break t}}H=null}if(h=H)ha(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,dm(this,h);else{this.o=!1,this.m=3,xn(12),pi(this),Bo(this);break e}}if(this.R){h=!0;let Ut;for(;!this.K&&this.C<v.length;)if(Ut=u_(this,v),Ut==om){Ue==4&&(this.m=4,xn(14),h=!1),ha(this.i,this.l,null,"[Incomplete Response]");break}else if(Ut==Og){this.m=4,xn(15),ha(this.i,this.l,v,"[Invalid Chunk]"),h=!1;break}else ha(this.i,this.l,Ut,null),dm(this,Ut);if(Vg(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Ue!=4||v.length!=0||this.h.h||(this.m=1,xn(16),h=!1),this.o=this.o&&h,!h)ha(this.i,this.l,v,"[Invalid Chunked Response]"),pi(this),Bo(this);else if(v.length>0&&!this.W){this.W=!0;var pe=this.j;pe.g==this&&pe.aa&&!pe.P&&(pe.j.info("Great, no buffering proxy detected. Bytes received: "+v.length),bm(pe),pe.P=!0,xn(11))}}else ha(this.i,this.l,v,null),dm(this,v);Ue==4&&pi(this),this.o&&!this.K&&(Ue==4?ly(this.j,this):(this.o=!1,Kl(this)))}else j_(this.g),y==400&&v.indexOf("Unknown SID")>0?(this.m=3,xn(12)):(this.m=0,xn(13)),pi(this),Bo(this)}}}catch{}finally{}};function d_(h){if(!Vg(h))return h.g.la();const y=ny(h.g);if(y==="")return"";let v="";const P=y.length,U=gs(h.g)==4;if(!h.h.i){if(typeof TextDecoder>"u")return pi(h),Bo(h),"";h.h.i=new a.TextDecoder}for(let H=0;H<P;H++)h.h.h=!0,v+=h.h.i.decode(y[H],{stream:!(U&&H==P-1)});return y.length=0,h.h.g+=v,h.C=0,h.h.g}function Vg(h){return h.g?h.v=="GET"&&h.M!=2&&h.j.Aa:!1}function u_(h,y){var v=h.C,P=y.indexOf(`
443`,v);return P==-1?om:(v=Number(y.substring(v,P)),isNaN(v)?Og:(P+=1,P+v>y.length?om:(y=y.slice(P,P+v),h.C=P+v,y)))}ms.prototype.cancel=function(){this.K=!0,pi(this)};function Kl(h){h.T=Date.now()+h.H,Lg(h,h.H)}function Lg(h,y){if(h.D!=null)throw Error("WatchDog timer not null");h.D=zo(d(h.aa,h),y)}function lm(h){h.D&&(a.clearTimeout(h.D),h.D=null)}ms.prototype.aa=function(){this.D=null;const h=Date.now();h-this.T>=0?(o_(this.i,this.B),this.M!=2&&(qo(),xn(17)),pi(this),this.m=2,Bo(this)):Lg(this,this.T-h)};function Bo(h){h.j.I==0||h.K||ly(h.j,h)}function pi(h){lm(h);var y=h.O;y&&typeof y.dispose=="function"&&y.dispose(),h.O=null,jg(h.V),h.g&&(y=h.g,h.g=null,y.abort(),y.dispose())}function dm(h,y){try{var v=h.j;if(v.I!=0&&(v.g==h||um(v.h,h))){if(!h.L&&um(v.h,h)&&v.I==3){try{var P=v.Ba.g.parse(y)}catch{P=null}if(Array.isArray(P)&&P.length==3){var U=P;if(U[0]==0){e:if(!v.v){if(v.g)if(v.g.F+3e3<h.F)Jl(v),Ql(v);else break e;ym(v),xn(18)}}else v.xa=U[1],0<v.xa-v.K&&U[2]<37500&&v.F&&v.A==0&&!v.C&&(v.C=zo(d(v.Va,v),6e3));Fg(v.h)<=1&&v.ta&&(v.ta=void 0)}else gi(v,11)}else if((h.L||v.g==h)&&Jl(v),!S(y))for(U=v.Ba.g.parse(y),y=0;y<U.length;y++){let dt=U[y];const Ut=dt[0];if(!(Ut<=v.K))if(v.K=Ut,dt=dt[1],v.I==2)if(dt[0]=="c"){v.M=dt[1],v.ba=dt[2];const gr=dt[3];gr!=null&&(v.ka=gr,v.j.info("VER="+v.ka));const yi=dt[4];yi!=null&&(v.za=yi,v.j.info("SVER="+v.za));const ys=dt[5];ys!=null&&typeof ys=="number"&&ys>0&&(P=1.5*ys,v.O=P,v.j.info("backChannelRequestTimeoutMs_="+P)),P=v;const bs=h.g;if(bs){const ed=bs.g?bs.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(ed){var H=P.h;H.g||ed.indexOf("spdy")==-1&&ed.indexOf("quic")==-1&&ed.indexOf("h2")==-1||(H.j=H.l,H.g=new Set,H.h&&(hm(H,H.h),H.h=null))}if(P.G){const xm=bs.g?bs.g.getResponseHeader("X-HTTP-Session-Id"):null;xm&&(P.wa=xm,mt(P.J,P.G,xm))}}v.I=3,v.l&&v.l.ra(),v.aa&&(v.T=Date.now()-h.F,v.j.info("Handshake RTT: "+v.T+"ms")),P=v;var pe=h;if(P.na=hy(P,P.L?P.ba:null,P.W),pe.L){$g(P.h,pe);var Ue=pe,zt=P.O;zt&&(Ue.H=zt),Ue.D&&(lm(Ue),Kl(Ue)),P.g=pe}else oy(P);v.i.length>0&&Zl(v)}else dt[0]!="stop"&&dt[0]!="close"||gi(v,7);else v.I==3&&(dt[0]=="stop"||dt[0]=="close"?dt[0]=="stop"?gi(v,7):gm(v):dt[0]!="noop"&&v.l&&v.l.qa(dt),v.A=0)}}qo(4)}catch{}}var h_=class{constructor(h,y){this.g=h,this.map=y}};function qg(h){this.l=h||10,a.PerformanceNavigationTiming?(h=a.performance.getEntriesByType("navigation"),h=h.length>0&&(h[0].nextHopProtocol=="hq"||h[0].nextHopProtocol=="h2")):h=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=h?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function zg(h){return h.h?!0:h.g?h.g.size>=h.j:!1}function Fg(h){return h.h?1:h.g?h.g.size:0}function um(h,y){return h.h?h.h==y:h.g?h.g.has(y):!1}function hm(h,y){h.g?h.g.add(y):h.h=y}function $g(h,y){h.h&&h.h==y?h.h=null:h.g&&h.g.has(y)&&h.g.delete(y)}qg.prototype.cancel=function(){if(this.i=Bg(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const h of this.g.values())h.cancel();this.g.clear()}};
443function Bg(h){if(h.h!=null)return h.i.concat(h.h.G);if(h.g!=null&&h.g.size!==0){let y=h.i;for(const v of h.g.values())y=y.concat(v.G);return y}return g(h.i)}var Ug=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function m_(h,y){if(h){h=h.split("&");for(let v=0;v<h.length;v++){const P=h[v].indexOf("=");let U,H=null;P>=0?(U=h[v].substring(0,P),H=h[v].substring(P+1)):U=h[v],y(U,H?decodeURIComponent(H.replace(/\+/g," ")):"")}}}function ps(h){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let y;h instanceof ps?(this.l=h.l,Uo(this,h.j),this.o=h.o,this.g=h.g,Go(this,h.u),this.h=h.h,mm(this,Qg(h.i)),this.m=h.m):h&&(y=String(h).match(Ug))?(this.l=!1,Uo(this,y[1]||"",!0),this.o=Ko(y[2]||""),this.g=Ko(y[3]||"",!0),Go(this,y[4]),this.h=Ko(y[5]||"",!0),mm(this,y[6]||"",!0),this.m=Ko(y[7]||"")):(this.l=!1,this.i=new Wo(null,this.l))}ps.prototype.toString=function(){const h=[];var y=this.j;y&&h.push(Ho(y,Gg,!0),":");var v=this.g;return(v||y=="file")&&(h.push("//"),(y=this.o)&&h.push(Ho(y,Gg,!0),"@"),h.push($o(v).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),v=this.u,v!=null&&h.push(":",String(v))),(v=this.h)&&(this.g&&v.charAt(0)!="/"&&h.push("/"),h.push(Ho(v,v.charAt(0)=="/"?g_:f_,!0))),(v=this.i.toString())&&h.push("?",v),(v=this.m)&&h.push("#",Ho(v,b_)),h.join("")},ps.prototype.resolve=function(h){const y=fr(this);let v=!!h.j;v?Uo(y,h.j):v=!!h.o,v?y.o=h.o:v=!!h.g,v?y.g=h.g:v=h.u!=null;var P=h.h;if(v)Go(y,h.u);else if(v=!!h.h){if(P.charAt(0)!="/")if(this.g&&!this.h)P="/"+P;else{var U=y.h.lastIndexOf("/");U!=-1&&(P=y.h.slice(0,U+1)+P)}if(U=P,U==".."||U==".")P="";else if(U.indexOf("./")!=-1||U.indexOf("/.")!=-1){P=U.lastIndexOf("/",0)==0,U=U.split("/");const H=[];for(let pe=0;pe<U.length;){const Ue=U[pe++];Ue=="."?P&&pe==U.length&&H.push(""):Ue==".."?((H.length>1||H.length==1&&H[0]!="")&&H.pop(),P&&pe==U.length&&H.push("")):(H.push(Ue),P=!0)}P=H.join("/")}else P=U}return v?y.h=P:v=h.i.toString()!=="",v?mm(y,Qg(h.i)):v=!!h.m,v&&(y.m=h.m),y};function fr(h){return new ps(h)}function Uo(h,y,v){h.j=v?Ko(y,!0):y,h.j&&(h.j=h.j.replace(/:$/,""))}function Go(h,y){if(y){if(y=Number(y),isNaN(y)||y<0)throw Error("Bad port number "+y);h.u=y}else h.u=null}function mm(h,y,v){y instanceof Wo?(h.i=y,x_(h.i,h.l)):(v||(y=Ho(y,y_)),h.i=new Wo(y,h.l))}function mt(h,y,v){h.i.set(y,v)}function Hl(h){return mt(h,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),h}function Ko(h,y){return h?y?decodeURI(h.replace(/%25/g,"%2525")):decodeURIComponent(h):""}function Ho(h,y,v){return typeof h=="string"?(h=encodeURI(h).replace(y,p_),v&&(h=h.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h):null}function p_(h){return h=h.charCodeAt(0),"%"+(h>>4&15).toString(16)+(h&15).toString(16)}var Gg=/[#\/\?@]/g,f_=/[#\?:]/g,g_=/[#\?]/g,y_=/[#\?@]/g,b_=/#/g;function Wo(h,y){this.h=this.g=null,this.i=h||null,this.j=!!y}function fi(h){h.g||(h.g=new Map,h.h=0,h.i&&m_(h.i,function(y,v){h.add(decodeURIComponent(y.replace(/\+/g," ")),v)}))}n=Wo.prototype,n.add=function(h,y){fi(this),this.i=null,h=ma(this,h);let v=this.g.get(h);return v||this.g.set(h,v=[]),v.push(y),this.h+=1,this};function Kg(h,y){fi(h),y=ma(h,y),h.g.has(y)&&(h.i=null,h.h-=h.g.get(y).length,h.g.delete(y))}function Hg(h,y){return fi(h),y=ma(h,y),h.g.has(y)}n.forEach=function(h,y){fi(this),this.g.forEach(function(v,P){v.forEach(function(U){h.call(y,U,P,this)},this)},this)};function Wg(h,y){fi(h);let v=[];if(typeof y=="string")Hg(h,y)&&(v=v.concat(h.g.get(ma(h,y))));else for(h=Array.from(h.g.values()),y=0;y<h.length;y++)v=v.concat(h[y]);return v}n.set=function(h,y){return fi(this),this.i=null,h=ma(this,h),Hg(this,h)&&(this.h-=this.g.get(h).length),this.g.set(h,[y]),this.h+=1,this},n.get=function(h,y){return h?(h=Wg(this,h),h.length>0?String(h[0]):y):y};function Yg(h,y,v){Kg(h,y),v.length>0&&(h.i=null,h.g.set(ma(h,y),g(v)),h.h+=v.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const h=[],y=Array.from(this.g.keys());for(let P=0;P<y.length;P++){var v=y[P];const U=$o(v);v=Wg(this,v);for(let H=0;H<v.length;H++){let pe=U;v[H]!==""&&(pe+="="+$o(v[H])),h.push(pe)}}return this.i=h.join("&")};function Qg(h){const y=new Wo;return y.i=h.i,h.g&&(y.g=new Map(h.g),y.h=h.h),y}function ma(h,y){return y=String(y),h.j&&(y=y.toLowerCase()),y}function x_(h,y){y&&!h.j&&(fi(h),h.i=null,h.g.forEach(function(v,P){const U=P.toLowerCase();P!=U&&(Kg(this,P),Yg(this,U,v))},h)),h.j=y}function v_(h,y){const v=new Fo;if(a.Image){const P=new Image;P.onload=m(fs,v,"TestLoadImage: loaded",!0,y,P),P.onerror=m(fs,v,"TestLoadImage: error",!1,y,P),P.onabort=m(fs,v,"TestLoadImage: abort",!1,y,P),P.ontimeout=m(fs,v,"TestLoadImage: timeout",!1,y,P),a.setTimeout(function(){P.ontimeout&&P.ontimeout()},1e4),P.src=h}else y(!1)}function I_(h,y){const v=new Fo,P=new AbortController,U=setTimeout(()=>{P.abort(),fs(v,"TestPingServer: timeout",!1,y)},1e4);fetch(h,{signal:P.signal}).then(H=>{clearTimeout(U),H.ok?fs(v,"TestPingServer: ok",!0,y):fs(v,"TestPingServer: server error",!1,y)}).catch(()=>{clearTimeout(U),fs(v,"TestPingServer: error",!1,y)})}
443function fs(h,y,v,P,U){try{U&&(U.onload=null,U.onerror=null,U.onabort=null,U.ontimeout=null),P(v)}catch{}}function __(){this.g=new s_}function pm(h){this.i=h.Sb||null,this.h=h.ab||!1}p(pm,Tg),pm.prototype.g=function(){return new Wl(this.i,this.h)};function Wl(h,y){tn.call(this),this.H=h,this.o=y,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}p(Wl,tn),n=Wl.prototype,n.open=function(h,y){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=h,this.D=y,this.readyState=1,Qo(this)},n.send=function(h){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const y={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};h&&(y.body=h),(this.H||a).fetch(new Request(this.D,y)).then(this.Pa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Yo(this)),this.readyState=0},n.Pa=function(h){if(this.g&&(this.l=h,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=h.headers,this.readyState=2,Qo(this)),this.g&&(this.readyState=3,Qo(this),this.g)))if(this.responseType==="arraybuffer")h.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in h){if(this.j=h.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Zg(this)}else h.text().then(this.Oa.bind(this),this.ga.bind(this))};function Zg(h){h.j.read().then(h.Ma.bind(h)).catch(h.ga.bind(h))}n.Ma=function(h){if(this.g){if(this.o&&h.value)this.response.push(h.value);else if(!this.o){var y=h.value?h.value:new Uint8Array(0);(y=this.B.decode(y,{stream:!h.done}))&&(this.response=this.responseText+=y)}h.done?Yo(this):Qo(this),this.readyState==3&&Zg(this)}},n.Oa=function(h){this.g&&(this.response=this.responseText=h,Yo(this))},n.Na=function(h){this.g&&(this.response=h,Yo(this))},n.ga=function(){this.g&&Yo(this)};function Yo(h){h.readyState=4,h.l=null,h.j=null,h.B=null,Qo(h)}n.setRequestHeader=function(h,y){this.A.append(h,y)},n.getResponseHeader=function(h){return this.h&&this.h.get(h.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const h=[],y=this.h.entries();for(var v=y.next();!v.done;)v=v.value,h.push(v[0]+": "+v[1]),v=y.next();return h.join(`\r
444`)};function Qo(h){h.onreadystatechange&&h.onreadystatechange.call(h)}Object.defineProperty(Wl.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(h){this.m=h?"include":"same-origin"}});function Jg(h){let y="";return oe(h,function(v,P){y+=P,y+=":",y+=v,y+=`\r
445`}),y}function fm(h,y,v){e:{for(P in v){var P=!1;break e}P=!0}P||(v=Jg(v),typeof h=="string"?v!=null&&$o(v):mt(h,y,v))}function Tt(h){tn.call(this),this.headers=new Map,this.L=h||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}p(Tt,tn);var k_=/^https?$/i,w_=["POST","PUT"];n=Tt.prototype,n.Fa=function(h){this.H=h},n.ea=function(h,y,v,P){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+h);y=y?y.toUpperCase():"GET",this.D=h,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Pg.g(),this.g.onreadystatechange=f(d(this.Ca,this));try{this.B=!0,this.g.open(y,String(h),!0),this.B=!1}catch(H){Xg(this,H);return}if(h=v||"",v=new Map(this.headers),P)if(Object.getPrototypeOf(P)===Object.prototype)for(var U in P)v.set(U,P[U]);else if(typeof P.keys=="function"&&typeof P.get=="function")for(const H of P.keys())v.set(H,P.get(H));else throw Error("Unknown input type for opt_headers: "+String(P));P=Array.from(v.keys()).find(H=>H.toLowerCase()=="content-type"),U=a.FormData&&h instanceof a.FormData,!(Array.prototype.indexOf.call(w_,y,void 0)>=0)||P||U||v.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[H,pe]of v)this.g.setRequestHeader(H,pe);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(
445h),this.v=!1}catch(H){Xg(this,H)}};function Xg(h,y){h.h=!1,h.g&&(h.j=!0,h.g.abort(),h.j=!1),h.l=y,h.o=5,ey(h),Yl(h)}function ey(h){h.A||(h.A=!0,bn(h,"complete"),bn(h,"error"))}n.abort=function(h){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=h||7,bn(this,"complete"),bn(this,"abort"),Yl(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Yl(this,!0)),Tt.Z.N.call(this)},n.Ca=function(){this.u||(this.B||this.v||this.j?ty(this):this.Xa())},n.Xa=function(){ty(this)};function ty(h){if(h.h&&typeof i<"u"){if(h.v&&gs(h)==4)setTimeout(h.Ca.bind(h),0);else if(bn(h,"readystatechange"),gs(h)==4){h.h=!1;try{const H=h.ca();e:switch(H){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var y=!0;break e;default:y=!1}var v;if(!(v=y)){var P;if(P=H===0){let pe=String(h.D).match(Ug)[1]||null;!pe&&a.self&&a.self.location&&(pe=a.self.location.protocol.slice(0,-1)),P=!k_.test(pe?pe.toLowerCase():"")}v=P}if(v)bn(h,"complete"),bn(h,"success");else{h.o=6;try{var U=gs(h)>2?h.g.statusText:""}catch{U=""}h.l=U+" ["+h.ca()+"]",ey(h)}}finally{Yl(h)}}}}function Yl(h,y){if(h.g){h.m&&(clearTimeout(h.m),h.m=null);const v=h.g;h.g=null,y||bn(h,"ready");try{v.onreadystatechange=null}catch{}}}n.isActive=function(){return!!this.g};function gs(h){return h.g?h.g.readyState:0}n.ca=function(){try{return gs(this)>2?this.g.status:-1}catch{return-1}},n.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.La=function(h){if(this.g){var y=this.g.responseText;return h&&y.indexOf(h)==0&&(y=y.substring(h.length)),r_(y)}};function ny(h){try{if(!h.g)return null;if("response"in h.g)return h.g.response;switch(h.F){case"":case"text":return h.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in h.g)return h.g.mozResponseArrayBuffer}return null}catch{return null}}function j_(h){const y={};h=(h.g&&gs(h)>=2&&h.g.getAllResponseHeaders()||"").split(`\r
446`);for(let P=0;P<h.length;P++){if(S(h[P]))continue;var v=l_(h[P]);const U=v[0];if(v=v[1],typeof v!="string")continue;v=v.trim();const H=y[U]||[];y[U]=H,H.push(v)}ie(y,function(P){return P.join(", ")})}n.ya=function(){return this.o},n.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function Zo(h,y,v){return v&&v.internalChannelParams&&v.internalChannelParams[h]||y}function ry(h){this.za=0,this.i=[],this.j=new Fo,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Zo("failFast",!1,h),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Zo("baseRetryDelayMs",5e3,h),this.Za=Zo("retryDelaySeedMs",1e4,h),this.Ta=Zo("forwardChannelMaxRetries",2,h),this.va=Zo("forwardChannelRequestTimeoutMs",2e4,h),this.ma=h&&h.xmlHttpFactory||void 0,this.Ua=h&&h.Rb||void 0,this.Aa=h&&h.useFetchStreams||!1,this.O=void 0,this.L=h&&h.supportsCrossDomainXhr||!1,this.M="",this.h=new qg(h&&h.concurrentRequestLimit),this.Ba=new __,this.S=h&&h.fastHandshake||!1,this.R=h&&h.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=h&&h.Pb||!1,h&&h.ua&&this.j.ua(),h&&h.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&h&&h.detectBufferingProxy||!1,this.ia=void 0,h&&h.longPollingTimeout&&h.longPollingTimeout>0&&(this.ia=h.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}n=ry.prototype,n.ka=8,n.I=1,n.connect=function(h,y,v,P){xn(0),this.W=h,this.H=y||{},v&&P!==void 0&&(this.H.OSID=v,this.H.OAID=P),this.F=this.X,this.J=hy(this,null,this.W),Zl(this)};function gm(h){if(sy(h),h.I==3){var y=h.V++,v=fr(h.J);if(mt(v,"SID",h.M),mt(v,"RID",y),mt(v,"TYPE","terminate"),Jo(h,v),y=new ms(h,h.j,y),y.M=2,y.A=Hl(fr(v)),v=!1,a.navigator&&a.navigator.sendBeacon)try{v=a.navigator.sendBeacon(y.A.toString(),"")}catch{}!v&&a.Image&&(new Image().src=y.A,v=!0),v||(y.g=my(y.j,null),y.g.ea(y.A)),y.F=Date.now(),Kl(y)}uy(h)}function Ql(h){h.g&&(bm(h),h.g.cancel(),h.g=null)}function sy(h){Ql(h),h.v&&(a.clearTimeout(h.v),h.v=null),Jl(h),h.h.cancel(),h.m&&(typeof h.m=="number"&&a.clearTimeout(h.m),h.m=null)}function Zl(h){if(!zg(h.h)&&!h.m){h.m=!0;var y=h.Ea;M||j(),R||(M(),R=!0),_.add(y,h),h.D=0}}function T_(h,y){return Fg(h.h)>=h.h.j-(h.m?1:0)?!1:h.m?(h.i=y.G.concat(h.i),!0):h.I==1||h.I==2||h.D>=(h.Sa?0:h.Ta)?!1:(h.m=zo(d(h.Ea,h,y),dy(h,h.D)),h.D++,!0)}n.Ea=function(h){if(this.m)if(this.m=null,this.I==1){if(!h){this.V=Math.floor(Math.random()*1e5),h=this.V++;const U=new ms(this,this.j,h);let H=this.o;
446if(this.U&&(H?(H=Ie(H),Y(H,this.U)):H=this.U),this.u!==null||this.R||(U.J=H,H=null),this.S)e:{for(var y=0,v=0;v<this.i.length;v++){t:{var P=this.i[v];if("__data__"in P.map&&(P=P.map.__data__,typeof P=="string")){P=P.length;break t}P=void 0}if(P===void 0)break;if(y+=P,y>4096){y=v;break e}if(y===4096||v===this.i.length-1){y=v+1;break e}}y=1e3}else y=1e3;y=ay(this,U,y),v=fr(this.J),mt(v,"RID",h),mt(v,"CVER",22),this.G&&mt(v,"X-HTTP-Session-Id",this.G),Jo(this,v),H&&(this.R?y="headers="+$o(Jg(H))+"&"+y:this.u&&fm(v,this.u,H)),hm(this.h,U),this.Ra&&mt(v,"TYPE","init"),this.S?(mt(v,"$req",y),mt(v,"SID","null"),U.U=!0,cm(U,v,null)):cm(U,v,y),this.I=2}}else this.I==3&&(h?iy(this,h):this.i.length==0||zg(this.h)||iy(this))};function iy(h,y){var v;y?v=y.l:v=h.V++;const P=fr(h.J);mt(P,"SID",h.M),mt(P,"RID",v),mt(P,"AID",h.K),Jo(h,P),h.u&&h.o&&fm(P,h.u,h.o),v=new ms(h,h.j,v,h.D+1),h.u===null&&(v.J=h.o),y&&(h.i=y.G.concat(h.i)),y=ay(h,v,1e3),v.H=Math.round(h.va*.5)+Math.round(h.va*.5*Math.random()),hm(h.h,v),cm(v,P,y)}function Jo(h,y){h.H&&oe(h.H,function(v,P){mt(y,P,v)}),h.l&&oe({},function(v,P){mt(y,P,v)})}function ay(h,y,v){v=Math.min(h.i.length,v);const P=h.l?d(h.l.Ka,h.l,h):null;e:{var U=h.i;let Ue=-1;for(;;){const zt=["count="+v];Ue==-1?v>0?(Ue=U[0].g,zt.push("ofs="+Ue)):Ue=0:zt.push("ofs="+Ue);let dt=!0;for(let Ut=0;Ut<v;Ut++){var H=U[Ut].g;const gr=U[Ut].map;if(H-=Ue,H<0)Ue=Math.max(0,U[Ut].g-100),dt=!1;else try{H="req"+H+"_"||"";try{var pe=gr instanceof Map?gr:Object.entries(gr);for(const[yi,ys]of pe){let bs=ys;c(ys)&&(bs=rm(ys)),zt.push(H+yi+"="+encodeURIComponent(bs))}}catch(yi){throw zt.push(H+"type="+encodeURIComponent("_badmap")),yi}}catch{P&&P(gr)}}if(dt){pe=zt.join("&");break e}}pe=void 0}return h=h.i.splice(0,v),y.G=h,pe}function oy(h){if(!h.g&&!h.v){h.Y=1;var y=h.Da;M||j(),R||(M(),R=!0),_.add(y,h),h.A=0}}function ym(h){return h.g||h.v||h.A>=3?!1:(h.Y++,h.v=zo(d(h.Da,h),dy(h,h.A)),h.A++,!0)}n.Da=function(){if(this.v=null,cy(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var h=4*this.T;this.j.info("BP detection timer enabled: "+h),this.B=zo(d(this.Wa,this),h)}},n.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,xn(10),Ql(this),cy(this))};function bm(h){h.B!=null&&(a.clearTimeout(h.B),h.B=null)}function cy(h){h.g=new ms(h,h.j,"rpc",h.Y),h.u===null&&(h.g.J=h.o),h.g.P=0;var y=fr(h.na);mt(y,"RID","rpc"),mt(y,"SID",h.M),mt(y,"AID",h.K),mt(y,"CI",h.F?"0":"1"),!h.F&&h.ia&&mt(y,"TO",h.ia),mt(y,"TYPE","xmlhttp"),Jo(h,y),h.u&&h.o&&fm(y,h.u,h.o),h.O&&(h.g.H=h.O);var v=h.g;h=h.ba,v.M=1,v.A=Hl(fr(y)),v.u=null,v.R=!0,Dg(v,h)}n.Va=function(){this.C!=null&&(this.C=null,Ql(this),ym(this),xn(19))};function Jl(h){h.C!=null&&(a.clearTimeout(h.C),h.C=null)}function ly(h,y){var v=null;if(h.g==y){Jl(h),bm(h),h.g=null;var P=2}else if(um(h.h,y))v=y.G,$g(h.h,y),P=1;else return;if(h.I!=0){if(y.o)if(P==1){v=y.u?y.u.length:0,y=Date.now()-y.F;var U=h.D;P=Ul(),bn(P,new Cg(P,v)),Zl(h)}else oy(h);else if(U=y.m,U==3||U==0&&y.X>0||!(P==1&&T_(h,y)||P==2&&ym(h)))switch(v&&v.length>0&&(y=h.h,y.i=y.i.concat(v)),U){case 1:gi(h,5);break;case 4:gi(h,10);break;case 3:gi(h,6);break;default:gi(h,2)}}}function dy(h,y){let v=h.Qa+Math.floor(Math.random()*h.Za);return h.isActive()||(v*=2),v*y}function gi(h,y){if(h.j.info("Error code "+y),y==2){var v=d(h.bb,h),P=h.Ua;const U=!P;P=new ps(P||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||Uo(P,"https"),Hl(P),U?v_(P.toString(),v):I_(P.toString(),v)}else xn(2);h.I=0,h.l&&h.l.pa(y),uy(h),sy(h)}n.bb=function(h){h?(this.j.info("Successfully pinged google.com"),xn(2)):(this.j.info("Failed to ping google.com"),xn(1))};function uy(h){if(h.I=0,h.ja=[],h.l){const y=Bg(h.h);(y.length!=0||h.i.length!=0)&&(x(h.ja,y),x(h.ja,h.i),h.h.i.length=0,g(h.i),h.i.length=0),h.l.oa()}}function hy(h,y,v){var P=v instanceof ps?fr(v):new ps(v);if(P.g!="")y&&(P.g=y+"."+P.g),Go(P,P.u);else{var U=a.location;P=U.protocol,y=y?y+"."+U.hostname:U.hostname,U=+U.port;const H=new ps(null);P&&Uo(H,P),y&&(H.g=y),U&&Go(H,U),v&&(H.h=v),P=H}return v=h.G,y=h.wa,v&&y&&mt(P,v,y),mt(P,"VER",h.ka),Jo(h,P),P}function my(h,y,v){if(y&&!h.L)throw Error("Can't create secondary domain capable XhrIo object.");return y=h.Aa&&!h.ma?new Tt(new pm({ab:v})):new Tt(h.ma),y.Fa(h.L),y}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function py(){}n=py.prototype,n.ra=function(){},n.qa=function(){},n.pa=function(){},n.oa=function(){},n.isActive=function(){return!0},n.Ka=function(){};function Xl(){}Xl.prototype.g=function(h,y){return new Dn(h,y)};
446function Dn(h,y){tn.call(this),this.g=new ry(y),this.l=h,this.h=y&&y.messageUrlParams||null,h=y&&y.messageHeaders||null,y&&y.clientProtocolHeaderRequired&&(h?h["X-Client-Protocol"]="webchannel":h={"X-Client-Protocol":"webchannel"}),this.g.o=h,h=y&&y.initMessageHeaders||null,y&&y.messageContentType&&(h?h["X-WebChannel-Content-Type"]=y.messageContentType:h={"X-WebChannel-Content-Type":y.messageContentType}),y&&y.sa&&(h?h["X-WebChannel-Client-Profile"]=y.sa:h={"X-WebChannel-Client-Profile":y.sa}),this.g.U=h,(h=y&&y.Qb)&&!S(h)&&(this.g.u=h),this.A=y&&y.supportsCrossDomainXhr||!1,this.v=y&&y.sendRawJson||!1,(y=y&&y.httpSessionIdParam)&&!S(y)&&(this.g.G=y,h=this.h,h!==null&&y in h&&(h=this.h,y in h&&delete h[y])),this.j=new pa(this)}p(Dn,tn),Dn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Dn.prototype.close=function(){gm(this.g)},Dn.prototype.o=function(h){var y=this.g;if(typeof h=="string"){var v={};v.__data__=h,h=v}else this.v&&(v={},v.__data__=rm(h),h=v);y.i.push(new h_(y.Ya++,h)),y.I==3&&Zl(y)},Dn.prototype.N=function(){this.g.l=null,delete this.j,gm(this.g),delete this.g,Dn.Z.N.call(this)};function fy(h){sm.call(this),h.__headers__&&(this.headers=h.__headers__,this.statusCode=h.__status__,delete h.__headers__,delete h.__status__);var y=h.__sm__;if(y){e:{for(const v in y){h=v;break e}h=void 0}(this.i=h)&&(h=this.i,y=y!==null&&h in y?y[h]:void 0),this.data=y}else this.data=h}p(fy,sm);function gy(){im.call(this),this.status=1}p(gy,im);function pa(h){this.g=h}p(pa,py),pa.prototype.ra=function(){bn(this.g,"a")},pa.prototype.qa=function(h){bn(this.g,new fy(h))},pa.prototype.pa=function(h){bn(this.g,new gy)},pa.prototype.oa=function(){bn(this.g,"b")},Xl.prototype.createWebChannel=Xl.prototype.g,Dn.prototype.send=Dn.prototype.o,Dn.prototype.open=Dn.prototype.m,Dn.prototype.close=Dn.prototype.close,A4=function(){return new Xl},S4=function(){return Ul()},N4=mi,kp={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Gl.NO_ERROR=0,Gl.TIMEOUT=8,Gl.HTTP_ERROR=6,Ed=Gl,Mg.COMPLETE="complete",E4=Mg,Eg.EventType=Lo,Lo.OPEN="a",Lo.CLOSE="b",Lo.ERROR="c",Lo.MESSAGE="d",tn.prototype.listen=tn.prototype.J,mc=Eg,Tt.prototype.listenOnce=Tt.prototype.K,Tt.prototype.getLastError=Tt.prototype.Ha,Tt.prototype.getLastErrorCode=Tt.prototype.ya,Tt.prototype.getStatus=Tt.prototype.ca,Tt.prototype.getResponseJson=Tt.prototype.La,Tt.prototype.getResponseText=Tt.prototype.la,Tt.prototype.send=Tt.prototype.ea,Tt.prototype.setWithCredentials=Tt.prototype.Fa,T4=Tt}).apply(typeof dd<"u"?dd:typeof self<"u"?self:typeof window<"u"?window:{});/*!
447 * re2js
448 * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
449 *
450 * @version v0.4.3
451 * @author Alexey Vasiliev
452 * @homepage https://github.com/le0pard/re2js#readme
453 * @repository github:le0pard/re2js
454 * @license MIT
455 */const wt=class wt{};L(wt,"FOLD_CASE",1),L(wt,"LITERAL",2),L(wt,"CLASS_NL",4),L(wt,"DOT_NL",8),L(wt,"ONE_LINE",16),L(wt,"NON_GREEDY",32),L(wt,"PERL_X",64),L(wt,"UNICODE_GROUPS",128),L(wt,"WAS_DOLLAR",256),L(wt,"MATCH_NL",wt.CLASS_NL|wt.DOT_NL),L(wt,"PERL",wt.CLASS_NL|wt.ONE_LINE|wt.PERL_X|wt.UNICODE_GROUPS),L(wt,"POSIX",0),L(wt,"UNANCHORED",0),L(wt,"ANCHOR_START",1),L(wt,"ANCHOR_BOTH",2);let ge=wt;class K{static toUpperCase(e){const t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;const r=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){const t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;const r=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==e?e:t.codePointAt(0)}}L(K,"CODES",new Map([["\x07",7],["\b",8],["	",9],[`
456`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]));const k=class k{};L(k,"CASE_ORBIT",new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8
456147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[937
45671,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]])),L(k,"C",[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,
4561],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]]),L(k,"Cc",[[0,31,1],[127,159,1]]),L(k,"Cf",[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]]),L(k,"Co",[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]]),L(k,"Cs",[[55296,57343,1]]),L(k,"L",[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7
456],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,5
4565291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),L(k,"foldL",[[837,837,1]]),L(k,"Ll",[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,12
4560275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]]),L(k,"foldLl",[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]]),L(k,"Lm",[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]]),L(k,"Lo",[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11
456742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),L(k,"Lt",[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]]),L(k,"foldLt",[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]]),L(k,"Lu",[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,10
45671,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]]),L(k,"Upper",k.Lu),L(k,"foldLu",[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]]),L(k,"M",[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,
4561],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]]),L(k,"foldM",[[921,953,32],[8126,8126,1]]),L(k,"Mc",[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]]),L(k,"Me",[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]]),L(k,"Mn",[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,
4561],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]]),L(k,"foldMn",[[921,953,32],[8126,8126,1]]),L(k,"N",[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]]),L(k,"Nd",[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]]),L(k,"Nl",[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]]),L(k,"No",[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]]),L(k,"P",[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,3
45668],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]]),L(k,"Pc",[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]]),L(k,"Pd",[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]]),L(k,"Pe",[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]]),L(k,"Pf",[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]]),L(k,"Pi",[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]]),L(k,"Po",[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,
45668342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]]),L(k,"Ps",[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]]),L(k,"S",[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129
456095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]]),L(k,"Sc",[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]]),L(k,"Sk",[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]]),L(k,"Sm",[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]]),L(k,"So",[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129
456095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]]),L(k,"Z",[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]]),L(k,"Zl",[[8232,8232,1]]),L(k,"Zp",[[8233,8233,1]]),L(k,"Zs",[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]]),L(k,"Adlam",[[125184,125259,1],[125264,125273,1],[125278,125279,1]]),L(k,"Ahom",[[71424,71450,1],[71453,71467,1],[71472,71494,1]]),L(k,"Anatolian_Hieroglyphs",[[82944,83526,1]]),L(k,"Arabic",[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]]),L(k,"Armenian",[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]]),L(k,"Avestan",[[68352,68405,1],[68409,68415,1]]),L(k,"Balinese",[[6912,6988,1],[6992,7038,1]]),L(k,"Bamum",[[42656,42743,1],[92160,92728,1]]),L(k,"Bassa_Vah",[[92880,92909,1],[92912,92917,1]]),L(k,"Batak",[[7104,7155,1],[7164,7167,1]]),L(k,"Bengali",[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]]),L(k,"Bhaiksuki",[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]]),L(k,"Bopomofo",[[746,747,1],[12549,12591,1],[12704,12735,1]]),L(k,"Brahmi",[[69632,69709,1],[69714,69749,1],[69759,69759,1]]),L(k,"Braille",[[10240,10495,1]]),L(k,"Buginese",[[6656,6683,1],[6686,6687,1]]),L(k,"Buhid",[[5952,5971,1]]),L(k,"Canadian_Aboriginal",[[5120,5759,1],[6320,6389,1],[72368,72383,1]]),L(k,"Carian",[[66208,66256,1]]),L(k,"Caucasian_Albanian",[[66864,66915,1],[66927,66927,1]]),L(k,"Chakma",[[69888,69940,1],[69942,69959,1]]),L(k,"Cham",[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]]),L(k,"Cherokee",[[5024,5109,1],[5112,5117,1],[43888,43967,1]]),L(k,"Chorasmian",[[69552,69579,1]]),L(k,"Common",[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,
456119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]]),L(k,"foldCommon",[[924,956,32]]),L(k,"Coptic",[[994,1007,1],[11392,11507,1],[11513,11519,1]]),L(k,"Cuneiform",[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]]),L(k,"Cypriot",[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]]),L(k,"Cypro_Minoan",[[77712,77810,1]]),L(k,"Cyrillic",[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]]),L(k,"Deseret",[[66560,66639,1]]),L(k,"Devanagari",[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]]),L(k,"Dives_Akuru",[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]]),L(k,"Dogra",[[71680,71739,1]]),L(k,"Duployan",[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]]),L(k,"Egyptian_Hieroglyphs",[[77824,78933,1]]),L(k,"Elbasan",[[66816,66855,1]]),L(k,"Elymaic",[[69600,69622,1]]),L(k,"Ethiopic",[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]]),L(k,"Georgian",[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]]),L(k,"Glagolitic",[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]]),L(k,"Gothic",[[66352,66378,1]]),L(k,"Grantha",[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]]),L(k,"Greek",[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]]),L(k,"foldGreek",[[181,837,656]]),L(k,"Gujarati",[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]]),L(k,"Gunjala_Gondi",[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]]),L(k,"Gurmukhi",[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]]),L(k,"Han",[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]]),L(k,"Hangul",[[4352,4607,1],[12334,12335,1],[12593,12
456686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]]),L(k,"Hanifi_Rohingya",[[68864,68903,1],[68912,68921,1]]),L(k,"Hanunoo",[[5920,5940,1]]),L(k,"Hatran",[[67808,67826,1],[67828,67829,1],[67835,67839,1]]),L(k,"Hebrew",[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]]),L(k,"Hiragana",[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]]),L(k,"Imperial_Aramaic",[[67648,67669,1],[67671,67679,1]]),L(k,"Inherited",[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]]),L(k,"foldInherited",[[921,953,32],[8126,8126,1]]),L(k,"Inscriptional_Pahlavi",[[68448,68466,1],[68472,68479,1]]),L(k,"Inscriptional_Parthian",[[68416,68437,1],[68440,68447,1]]),L(k,"Javanese",[[43392,43469,1],[43472,43481,1],[43486,43487,1]]),L(k,"Kaithi",[[69760,69826,1],[69837,69837,1]]),L(k,"Kannada",[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]]),L(k,"Katakana",[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]]),L(k,"Kawi",[[73472,73488,1],[73490,73530,1],[73534,73561,1]]),L(k,"Kayah_Li",[[43264,43309,1],[43311,43311,1]]),L(k,"Kharoshthi",[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]]),L(k,"Khitan_Small_Script",[[94180,101120,6940],[101121,101589,1]]),L(k,"Khmer",[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]]),L(k,"Khojki",[[70144,70161,1],[70163,70209,1]]),L(k,"Khudawadi",[[70320,70378,1],[70384,70393,1]]),L(k,"Lao",[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]]),L(k,"Latin",[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]]),L(k,"Lepcha",[[7168,7223,1],[7227,7241,1],[7245,7247,1]]),L(k,"Limbu",[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]]),L(k,"Linear_A",[[67072,67382,1],[67392,67413,1],[67424,67431,1]]),L(k,"Linear_B",[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]]),L(k,"Lisu",[[42192,42239,1],[73648,73648,1]]),L(k,"Lycian",[[66176,66204,1]]),L(k,"Lydian",[[67872,67897,1],[67903,67903,1]]),L(k,"Mahajani",[[69968,70006,1]]),L(k,"Makasar",[[73440,73464,1]]),L(k,"Malayalam",[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]]),L(k,"Mandaic",[[2112,2139,1],[2142,2142,1]]),L(k,"Manichaean",[[68288,68326,1],[68331,68342,1]]),L(k,"Marchen",[[72816,72847,1],[72850,72871,1],[72873,72886,1]]),L(k,"Masaram_Gondi",[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]]),L(k,"Medefaidrin",[[93760,93850,1]]),L(k,"Meetei_Mayek",[[43744,43766,1],[43968,44013,1],[44016,44025,1]]),L(k,"Mende_Kikakui",[[124928,125124,1],[125127,125142,1]]),L(k,"Meroitic_Cursive",[[68e3,68023,1],[68028,68047,1],[68050,68095,1]]),L(k,"Meroitic_Hieroglyphs",[[67968,67999,1]]),L(k,"Miao",[[93952,94026,1],[94031,94087,1],[94095,94111,1]]),L(k,"Modi",[[71168,71236,1],[71248,71257,1]]),L(k,"Mongolian",[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]]),L(k,"Mro",[[92736,92766,1],[92768,92777,1],[92782,92783,1]]),L(k,"Multani",[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]]),L(k,"Myanmar",[[4096,4255,1],[43488,43518,1],[43616,43647,1]]),L(k,"Nabataean",[[67712,67742,1],[67751,67759,1]]),L(k,"Nag_Mundari",[[124112,124153,1]]),L(k,"Nandinagari",[[72096,72103,1],[72106,72151,1],[72154,72164,1]]),L(k,"New_Tai_Lue",[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]]),L(k,"Newa",[[70656,70747,1],[70749,70753,1]]),L(k,"Nko",[[1984,2042,1],[2045,2047,1]]),L(k,"Nushu",[[94177,110960,16
456783],[110961,111355,1]]),L(k,"Nyiakeng_Puachue_Hmong",[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]]),L(k,"Ogham",[[5760,5788,1]]),L(k,"Ol_Chiki",[[7248,7295,1]]),L(k,"Old_Hungarian",[[68736,68786,1],[68800,68850,1],[68858,68863,1]]),L(k,"Old_Italic",[[66304,66339,1],[66349,66351,1]]),L(k,"Old_North_Arabian",[[68224,68255,1]]),L(k,"Old_Permic",[[66384,66426,1]]),L(k,"Old_Persian",[[66464,66499,1],[66504,66517,1]]),L(k,"Old_Sogdian",[[69376,69415,1]]),L(k,"Old_South_Arabian",[[68192,68223,1]]),L(k,"Old_Turkic",[[68608,68680,1]]),L(k,"Old_Uyghur",[[69488,69513,1]]),L(k,"Oriya",[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]]),L(k,"Osage",[[66736,66771,1],[66776,66811,1]]),L(k,"Osmanya",[[66688,66717,1],[66720,66729,1]]),L(k,"Pahawh_Hmong",[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]]),L(k,"Palmyrene",[[67680,67711,1]]),L(k,"Pau_Cin_Hau",[[72384,72440,1]]),L(k,"Phags_Pa",[[43072,43127,1]]),L(k,"Phoenician",[[67840,67867,1],[67871,67871,1]]),L(k,"Psalter_Pahlavi",[[68480,68497,1],[68505,68508,1],[68521,68527,1]]),L(k,"Rejang",[[43312,43347,1],[43359,43359,1]]),L(k,"Runic",[[5792,5866,1],[5870,5880,1]]),L(k,"Samaritan",[[2048,2093,1],[2096,2110,1]]),L(k,"Saurashtra",[[43136,43205,1],[43214,43225,1]]),L(k,"Sharada",[[70016,70111,1]]),L(k,"Shavian",[[66640,66687,1]]),L(k,"Siddham",[[71040,71093,1],[71096,71133,1]]),L(k,"SignWriting",[[120832,121483,1],[121499,121503,1],[121505,121519,1]]),L(k,"Sinhala",[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]]),L(k,"Sogdian",[[69424,69465,1]]),L(k,"Sora_Sompeng",[[69840,69864,1],[69872,69881,1]]),L(k,"Soyombo",[[72272,72354,1]]),L(k,"Sundanese",[[7040,7103,1],[7360,7367,1]]),L(k,"Syloti_Nagri",[[43008,43052,1]]),L(k,"Syriac",[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]]),L(k,"Tagalog",[[5888,5909,1],[5919,5919,1]]),L(k,"Tagbanwa",[[5984,5996,1],[5998,6e3,1],[6002,6003,1]]),L(k,"Tai_Le",[[6480,6509,1],[6512,6516,1]]),L(k,"Tai_Tham",[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]]),L(k,"Tai_Viet",[[43648,43714,1],[43739,43743,1]]),L(k,"Takri",[[71296,71353,1],[71360,71369,1]]),L(k,"Tamil",[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]]),L(k,"Tangsa",[[92784,92862,1],[92864,92873,1]]),L(k,"Tangut",[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]]),L(k,"Telugu",[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]]),L(k,"Thaana",[[1920,1969,1]]),L(k,"Thai",[[3585,3642,1],[3648,3675,1]]),L(k,"Tibetan",[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]]),L(k,"Tifinagh",[[11568,11623,1],[11631,11632,1],[11647,11647,1]]),L(k,"Tirhuta",[[70784,70855,1],[70864,70873,1]]),L(k,"Toto",[[123536,123566,1]]),L(k,"Ugaritic",[[66432,66461,1],[66463,66463,1]]),L(k,"Vai",[[42240,42539,1]]),L(k,"Vithkuqi",[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]]),L(k,"Wancho",[[123584,123641,1],[123647,123647,1]]),L(k,"Warang_Citi",[[71840,71922,1],[71935,71935,1]]),L(k,"Yezidi",[[69248,69289,1],[69291,69293,1],[69296,69297,1]]),L(k,"Yi",[[40960,42124,1],[42128,42182,1]]),L(k,"Zanabazar_Square",[[72192,72263,1]]),L(k,"CATEGORIES",new Map([["C",k.C],["Cc",k.Cc],["Cf",k.Cf],["Co",k.Co],["Cs",k.Cs],["L",k.L],["Ll",k.Ll],["Lm",k.Lm],["Lo",k.Lo],["Lt",k.Lt],["Lu",k.Lu],["M",k.M],["Mc",k.Mc],["Me",k.Me],["Mn",k.Mn],["N",k.N],["Nd",k.Nd],["Nl",k.Nl],["No",k.No],["P",k.P],["Pc",k.Pc],["Pd",k.Pd],["Pe",k.Pe],["Pf",k.Pf],["Pi",k.Pi],["Po",k.Po],["Ps",k.Ps],["S",k.S],["Sc",k.Sc],["Sk",k.Sk],["Sm",k.Sm],["So",k.So],["Z",k.Z],["Zl",k.Zl],["Zp",k.Zp],["Zs",k.Zs]])),L(k,"SCRIPTS",new Map([["Adlam",k.Adlam],["Ahom",k.Ahom],["Anatolian_Hieroglyphs",k.Anatolian_Hieroglyphs],["Arabic",k.Arabic],["Armenian",k.Armenian],["Avestan",k.Avestan],["Balinese",k.Balinese],["Bamum",k.Bamum],["Bassa_Vah",k.Bassa_Vah],["Batak",k.Batak],["Bengali",k.Bengali],["Bhaiksuki",k.Bh
456aiksuki],["Bopomofo",k.Bopomofo],["Brahmi",k.Brahmi],["Braille",k.Braille],["Buginese",k.Buginese],["Buhid",k.Buhid],["Canadian_Aboriginal",k.Canadian_Aboriginal],["Carian",k.Carian],["Caucasian_Albanian",k.Caucasian_Albanian],["Chakma",k.Chakma],["Cham",k.Cham],["Cherokee",k.Cherokee],["Chorasmian",k.Chorasmian],["Common",k.Common],["Coptic",k.Coptic],["Cuneiform",k.Cuneiform],["Cypriot",k.Cypriot],["Cypro_Minoan",k.Cypro_Minoan],["Cyrillic",k.Cyrillic],["Deseret",k.Deseret],["Devanagari",k.Devanagari],["Dives_Akuru",k.Dives_Akuru],["Dogra",k.Dogra],["Duployan",k.Duployan],["Egyptian_Hieroglyphs",k.Egyptian_Hieroglyphs],["Elbasan",k.Elbasan],["Elymaic",k.Elymaic],["Ethiopic",k.Ethiopic],["Georgian",k.Georgian],["Glagolitic",k.Glagolitic],["Gothic",k.Gothic],["Grantha",k.Grantha],["Greek",k.Greek],["Gujarati",k.Gujarati],["Gunjala_Gondi",k.Gunjala_Gondi],["Gurmukhi",k.Gurmukhi],["Han",k.Han],["Hangul",k.Hangul],["Hanifi_Rohingya",k.Hanifi_Rohingya],["Hanunoo",k.Hanunoo],["Hatran",k.Hatran],["Hebrew",k.Hebrew],["Hiragana",k.Hiragana],["Imperial_Aramaic",k.Imperial_Aramaic],["Inherited",k.Inherited],["Inscriptional_Pahlavi",k.Inscriptional_Pahlavi],["Inscriptional_Parthian",k.Inscriptional_Parthian],["Javanese",k.Javanese],["Kaithi",k.Kaithi],["Kannada",k.Kannada],["Katakana",k.Katakana],["Kawi",k.Kawi],["Kayah_Li",k.Kayah_Li],["Kharoshthi",k.Kharoshthi],["Khitan_Small_Script",k.Khitan_Small_Script],["Khmer",k.Khmer],["Khojki",k.Khojki],["Khudawadi",k.Khudawadi],["Lao",k.Lao],["Latin",k.Latin],["Lepcha",k.Lepcha],["Limbu",k.Limbu],["Linear_A",k.Linear_A],["Linear_B",k.Linear_B],["Lisu",k.Lisu],["Lycian",k.Lycian],["Lydian",k.Lydian],["Mahajani",k.Mahajani],["Makasar",k.Makasar],["Malayalam",k.Malayalam],["Mandaic",k.Mandaic],["Manichaean",k.Manichaean],["Marchen",k.Marchen],["Masaram_Gondi",k.Masaram_Gondi],["Medefaidrin",k.Medefaidrin],["Meetei_Mayek",k.Meetei_Mayek],["Mende_Kikakui",k.Mende_Kikakui],["Meroitic_Cursive",k.Meroitic_Cursive],["Meroitic_Hieroglyphs",k.Meroitic_Hieroglyphs],["Miao",k.Miao],["Modi",k.Modi],["Mongolian",k.Mongolian],["Mro",k.Mro],["Multani",k.Multani],["Myanmar",k.Myanmar],["Nabataean",k.Nabataean],["Nag_Mundari",k.Nag_Mundari],["Nandinagari",k.Nandinagari],["New_Tai_Lue",k.New_Tai_Lue],["Newa",k.Newa],["Nko",k.Nko],["Nushu",k.Nushu],["Nyiakeng_Puachue_Hmong",k.Nyiakeng_Puachue_Hmong],["Ogham",k.Ogham],["Ol_Chiki",k.Ol_Chiki],["Old_Hungarian",k.Old_Hungarian],["Old_Italic",k.Old_Italic],["Old_North_Arabian",k.Old_North_Arabian],["Old_Permic",k.Old_Permic],["Old_Persian",k.Old_Persian],["Old_Sogdian",k.Old_Sogdian],["Old_South_Arabian",k.Old_South_Arabian],["Old_Turkic",k.Old_Turkic],["Old_Uyghur",k.Old_Uyghur],["Oriya",k.Oriya],["Osage",k.Osage],["Osmanya",k.Osmanya],["Pahawh_Hmong",k.Pahawh_Hmong],["Palmyrene",k.Palmyrene],["Pau_Cin_Hau",k.Pau_Cin_Hau],["Phags_Pa",k.Phags_Pa],["Phoenician",k.Phoenician],["Psalter_Pahlavi",k.Psalter_Pahlavi],["Rejang",k.Rejang],["Runic",k.Runic],["Samaritan",k.Samaritan],["Saurashtra",k.Saurashtra],["Sharada",k.Sharada],["Shavian",k.Shavian],["Siddham",k.Siddham],["SignWriting",k.SignWriting],["Sinhala",k.Sinhala],["Sogdian",k.Sogdian],["Sora_Sompeng",k.Sora_Sompeng],["Soyombo",k.Soyombo],["Sundanese",k.Sundanese],["Syloti_Nagri",k.Syloti_Nagri],["Syriac",k.Syriac],["Tagalog",k.Tagalog],["Tagbanwa",k.Tagbanwa],["Tai_Le",k.Tai_Le],["Tai_Tham",k.Tai_Tham],["Tai_Viet",k.Tai_Viet],["Takri",k.Takri],["Tamil",k.Tamil],["Tangsa",k.Tangsa],["Tangut",k.Tangut],["Telugu",k.Telugu],["Thaana",k.Thaana],["Thai",k.Thai],["Tibetan",k.Tibetan],["Tifinagh",k.Tifinagh],["Tirhuta",k.Tirhuta],["Toto",k.Toto],["Ugaritic",k.Ugaritic],["Vai",k.Vai],["Vithkuqi",k.Vithkuqi],["Wancho",k.Wancho],["Warang_Citi",k.Warang_Citi],["Yezidi",k.Yezidi],["Yi",k.Yi],["Zanabazar_Square",k.Zanabazar_Square]])),L(k,"FOLD_CATEGORIES",new Map([["L",k.foldL],["Ll",k.foldLl],["Lt",k.foldLt],["Lu",k.foldLu],["M",k.foldM],["Mn",k.foldMn]])),L(k,"FOLD_SCRIPT",new Map([["Common",k.foldCommon],["Greek",k.foldGreek],["Inherited",k.foldInherited]]));let an=k;class Oe{static is32(e,t){let r=0,s=e.length;for(;r<s;){let i=r+Math.floor((s-r)/2),a=e[i];if(a[0]<=t&&t<=a[1])return(t-a[0])%a[2]===0;t<a[0]?s=i:r=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let r of e)if(!(t>
456r[1]))return t<r[0]?!1:(t-r[0])%r[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(an.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(an.L,e)||this.is(an.M,e)||this.is(an.N,e)||this.is(an.P,e)||this.is(an.S,e)}static simpleFold(e){if(an.CASE_ORBIT.has(e))return an.CASE_ORBIT.get(e);const t=K.toLowerCase(e);return t!==e?t:K.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return K.CODES.get("A")<=e&&e<=K.CODES.get("Z")&&(e|=32),K.CODES.get("A")<=t&&t<=K.CODES.get("Z")&&(t|=32),e===t;for(let r=this.simpleFold(e);r!==e;r=this.simpleFold(r))if(r===t)return!0;return!1}}L(Oe,"MAX_RUNE",1114111),L(Oe,"MAX_ASCII",127),L(Oe,"MAX_LATIN1",255),L(Oe,"MAX_BMP",65535),L(Oe,"MIN_FOLD",65),L(Oe,"MAX_FOLD",125251);class ze{static emptyInts(){return[]}static isalnum(e){return K.CODES.get("0")<=e&&e<=K.CODES.get("9")||K.CODES.get("a")<=e&&e<=K.CODES.get("z")||K.CODES.get("A")<=e&&e<=K.CODES.get("Z")}static unhex(e){return K.CODES.get("0")<=e&&e<=K.CODES.get("9")?e-K.CODES.get("0"):K.CODES.get("a")<=e&&e<=K.CODES.get("f")?e-K.CODES.get("a")+10:K.CODES.get("A")<=e&&e<=K.CODES.get("F")?e-K.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(Oe.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case K.CODES.get('"'):t+='\\"';break;case K.CODES.get("\\"):t+="\\\\";break;case K.CODES.get("	"):t+="\\t";break;case K.CODES.get(`
457`):t+="\\n";break;case K.CODES.get("\r"):t+="\\r";break;case K.CODES.get("\b"):t+="\\b";break;case K.CODES.get("\f"):t+="\\f";break;default:{let r=e.toString(16);e<256?(t+="\\x",r.length===1&&(t+="0"),t+=r):t+=`\\x{${r}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(t=>t.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return K.CODES.get("a")<=e&&e<=K.CODES.get("z")||K.CODES.get("A")<=e&&e<=K.CODES.get("Z")||K.CODES.get("0")<=e&&e<=K.CODES.get("9")||e===K.CODES.get("_")}static emptyOpContext(e,t){let r=0;return e<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===K.CODES.get(`
458`)&&(r|=this.EMPTY_BEGIN_LINE),t<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===K.CODES.get(`
459`)&&(r|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(e){return e.split("").map(t=>this.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>Oe.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&s+1<e.length&&(e.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++s)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],r=0,s=0;for(;r<e.length;){let i=e[r++];if(i<128)t[s++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[r++];t[s++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[r++],c=e[r++],l=e[r++],d=((i&7)<<18|(a&63)<<12|(c&63)<<6|l&63)-65536;t[s++]=String.fromCharCode(55296+(d>>10)),t[s++]=String.fromCharCode(56320+(d&1023))}else{let a=e[r++],c=e[r++];t[s++]=String.fromCharCode((i&15)<<12|(a&63)<<6|c&63)}}return t.join("")}}}L(ze,"METACHARACTERS","\\.+*?()|[]{}^$"),L(ze,"EMPTY_BEGIN_LINE",1),L(ze,"EMPTY_END_LINE",2),L(ze,"EMPTY_BEGIN_TEXT",4),L(ze,"EMPTY_END_TEXT",8),L(ze,"EMPTY_WORD_BOUNDARY",16),L(ze,"EMPTY_NO_WORD_BOUNDARY",32),L(ze,"EMPTY_ALL",-1);const C4=(n=[],e=0)=>{const t={};for(let r=0;r<n.length;r++){const s=n[r],i=e+r;t[s]=i,t[i]=s}return Object.freeze(t)},Vc=class Vc{getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===Vc.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===Vc.Encoding.UTF_16}};L(Vc,"Encoding",C4(["UTF_16","UTF_8"]));let Hs=Vc;class U2 extends Hs{constructor(e=null){super(),this.bytes=e}getEncoding(){return Hs.Encoding.UTF_8}asCharSequence(){return ze.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}}class iC extends Hs{constructor(e=null){super(),this.charSequence=e}getEncoding(){return Hs.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(e=>e.codePointAt(0))}length(){return this.charSequence.length}}class tu{static utf16(e){return new iC(e)}static utf8(e){return Array.isArray(e)?new U2(e):new U2(ze.stringToUtf8ByteArray(e))}}
459class eh extends Error{constructor(e){super(e),this.name="RE2JSException"}}class Ct extends eh{constructor(e,t=null){let r=`error parsing regexp: ${e}`;t&&(r+=`: \`${t}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}}class aC extends eh{constructor(e){super(e),this.name="RE2JSCompileException"}}class zr extends eh{constructor(e){super(e),this.name="RE2JSGroupException"}}class oC extends eh{constructor(e){super(e),this.name="RE2JSFlagsException"}}class cC{static quoteReplacement(e){return e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(t=>{const r=t.codePointAt(0);return r===K.CODES["\\"]||r===K.CODES.$?`\\${t}`:t}).join("")}constructor(e,t){if(e===null)throw new Error("pattern is null");this.patternInput=e;const r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,t instanceof Hs?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(tu.utf8(t)):this.resetMatcherInput(tu.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new zr(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new zr(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e=="string"){const s=this.namedGroups[e];if(!Number.isFinite(s))throw new zr(`group '${e}' not found`);e=s}const t=this.start(e),r=this.end(e);return t<0&&r<0?null:this.substring(t,r)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new zr(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new zr("perhaps no match attempted");if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);const r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new zr("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,ge.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,ge.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new zr(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,ge.UNANCHORED)}genMatch(e,t){const r=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?ze.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let r="";const s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),r}appendReplacementInternal(e){let t="",r=0;const s=e.length;for(let i=0;i<s-1;i++){if(e.codePointAt(i)===K.CODES.get("\\")){r<i&&(t+=e.substring(r,i)),i++,r=i;continue}if(e.codePointAt(i)===K.CODES.get("$")){let a=e.codePointAt(i+1);if(K.CODES.get("0")<=a&&a<=K.CODES.get("9")){let c=a-K.CODES.get("0");for(r<i&&(t+=e.substring(r,i)),i+=2;i<s&&(a=e.codePointAt(i),!(a<K.CODES.get("0")||a>K.CODES.get("9")||c*10+a-K.CODES.get("0")>this.patternGroupCount));i++)c=c*10+a-K.CODES.get("0");if(c>this.patternGroupCount)throw new zr(`n > number of groups: ${c}`);const l=this.group(c);l!==null&&(t+=l),r=i,i--;continue}else if(a===K.CODES.get("{")){r<i&&(t+=e.substring(r,i)),i++;let c=i+1;for(;c<e.length&&e.codePointAt(c)!==K.CODES.get("}")&&e.codePointAt(c)!==K.CODES.get(" ");)c++;if(c===e.length||e.codePointAt(c)!==K.CODES.get("}"))throw new zr("named capture group is missing trailing '}'");const l=e.substring(i+1,c);t+=this.group(l),r=c+1}}}return r<s&&(t+=e.substring(r,s)),t}appendReplacementInternalPerl(e){let t="",r=0;const s=e.length;for(let i=0;i<s-1;i++)if(e.codePointAt(i)===K.CODES.get("$")){let a=e.codePointAt(i+1);if(K.CODES.get("$")===a){r<i&&(t+=e.substring(r,i)),t+="$",i++,r=i+1;continue}else if(K.CODES.get("&")===a){r<i&&(t+=e.substring(r,i));const c=this.group(0);c!==null?t+=c:t+="$&",i++,r=i+1;continue}else if(K.CODES.get("1")<=a&&a<=K.CODES.get("9")){let c=a-K.CODES.get("0");for(r<i&&(t+=e.substring(r,i)),i+=2;i<s&&(a=e.codePointAt(i),!(a<K.CODES.get("0")||a>K.CODES.get("9")||c*10+a-K.CODES.get("0")>this.patternGroupCount));i++)c=c*10+a-K.CODES.get("0");if(c>this.patternGroupCount){t+=`$${c}`,r=i,i--;continue}const l=this.group(c);l!==null&&(t+=l),r=i,i--;continue}
459else if(a===K.CODES.get("<")){r<i&&(t+=e.substring(r,i)),i++;let c=i+1;for(;c<e.length&&e.codePointAt(c)!==K.CODES.get(">")&&e.codePointAt(c)!==K.CODES.get(" ");)c++;if(c===e.length||e.codePointAt(c)!==K.CODES.get(">")){t+=e.substring(i-1,c+1),r=c+1;continue}const l=e.substring(i+1,c);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?t+=this.group(l):t+=`$<${l}>`,r=c+1}}return r<s&&(t+=e.substring(r,s)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(e,r),!!t););return s+=this.appendTail(),s}}class Es{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}}class lC extends Es{constructor(e,t=0,r=e.length){super(),this.bytes=e,this.start=t,this.end=r}step(e){if(e+=this.start,e>=this.end)return Es.EOF();let t=this.bytes[e++]&255;return(t&128)===0?t<<3|1:(t&224)===192?(t=t&31,e>=this.end?Es.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)===224?(t=t&15,e+1>=this.end?Es.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t=t&7,e+2>=this.end?Es.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4))}index(e,t){t+=this.start;const r=this.indexOf(this.bytes,e.prefixUTF8,t);return r<0?r:r-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let s=e-1;if(t=this.bytes[s--],t>=128){let i=e-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),t=this.step(s)>>3}}const r=e<this.end?this.step(e)>>3:-1;return ze.emptyOpContext(t,r)}indexOf(e,t,r=0){let s=t.length;if(s===0)return-1;let i=e.length;for(let a=r;a<=i-s;a++)for(let c=0;c<s&&e[a+c]===t[c];c++)if(c===s-1)return a;return-1}}
459class dC extends Es{constructor(e,t=0,r=e.length){super(),this.charSequence=e,this.start=t,this.end=r}step(e){if(e+=this.start,e<this.end){const t=this.charSequence.codePointAt(e);return t<<3|ze.charCount(t)}else return Es.EOF()}index(e,t){t+=this.start;const r=this.charSequence.indexOf(e.prefix,t);return r<0?r:r-t}context(e){e+=this.start;const t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,r=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return ze.emptyOpContext(t,r)}}class Mt{static fromUTF8(e,t=0,r=e.length){return new lC(e,t,r)}static fromUTF16(e,t=0,r=e.length){return new dC(e,t,r)}}const Me=class Me{static isPseudoOp(e){return e>=Me.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===K.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new Me(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t}constructor(e){this.op=e,this.flags=0,this.subs=Me.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=Me.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case Me.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case Me.Op.EMPTY_MATCH:e+="(?:)";break;case Me.Op.STAR:case Me.Op.PLUS:case Me.Op.QUEST:case Me.Op.REPEAT:{const t=this.subs[0];switch(t.op>Me.Op.CAPTURE||t.op===Me.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case Me.Op.STAR:e+="*";break;case Me.Op.PLUS:e+="+";break;case Me.Op.QUEST:e+="?";break;case Me.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}";break}(this.flags&ge.NON_GREEDY)!==0&&(e+="?");break}case Me.Op.CONCAT:{for(let t of this.subs)t.op===Me.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break}case Me.Op.ALTERNATE:{let t="";for(let r of this.subs)e+=t,t="|",e+=r.appendTo();break}case Me.Op.LITERAL:(this.flags&ge.FOLD_CASE)!==0&&(e+="(?i:");for(let t of this.runes)e+=ze.escapeRune(t);(this.flags&ge.FOLD_CASE)!==0&&(e+=")");break;case Me.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case Me.Op.ANY_CHAR:e+="(?s:.)";break;case Me.Op.CAPTURE:this.name===null||this.name.length===0?e+="(":e+=`(?P<${this.name}>`,this.subs[0].op!==Me.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case Me.Op.BEGIN_TEXT:e+="\\A";break;case Me.Op.END_TEXT:(this.flags&ge.WAS_DOLLAR)!==0?e+="(?-m:$)":e+="\\z";break;case Me.Op.BEGIN_LINE:e+="^";break;case Me.Op.END_LINE:e+="$";break;case Me.Op.WORD_BOUNDARY:e+="\\b";break;case Me.Op.NO_WORD_BOUNDARY:e+="\\B";break;case Me.Op.CHAR_CLASS:if(this.runes.length%2!==0){e+="[invalid char class]";break}if(e+="[",this.runes.length===0)e+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===Oe.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const r=this.runes[t]+1,s=this.runes[t+1]-1;e+=Me.quoteIfHyphen(r),e+=ze.escapeRune(r),r!==s&&(e+="-",e+=Me.quoteIfHyphen(s),e+=ze.escapeRune(s))}}else for(let t=0;t<this.runes.length;t+=2){const r=this.runes[t],s=this.runes[t+1];e+=Me.quoteIfHyphen(r),e+=ze.escapeRune(r),r!==s&&(e+="-",e+=Me.quoteIfHyphen(s),e+=ze.escapeRune(s))}e+="]";break;default:e+=this.op;break}return e}maxCap(){let e=0;if(this.op===Me.Op.CAPTURE&&(e=this.cap),this.subs!==null)for(let t of this.subs){const r=t.maxCap();e<r&&(e=r)}return e}equals(e){if(!(e!==null&&e instanceof Me)||this.op!==e.op)return!1;switch(this.op){case Me.Op.END_TEXT:{if((this.flags&ge.WAS_DOLLAR)!==(e.flags&ge.WAS_DOLLAR))return!1;break}case Me.Op.LITERAL:case Me.Op.CHAR_CLASS:{if(this.runes===null&&e.runes===null)break;if(this.runes===null||e.runes===null||this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break}case Me.Op.ALTERNATE:case Me.Op.CONCAT:{if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break}case Me.Op.STAR:case Me.Op.PLUS:case Me.Op.QUEST:{if((this.flags&ge.NON_GREEDY)!==(e.flags&ge.NON_GREEDY)||!this.subs[
4590].equals(e.subs[0]))return!1;break}case Me.Op.REPEAT:{if((this.flags&ge.NON_GREEDY)!==(e.flags&ge.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break}case Me.Op.CAPTURE:{if(this.cap!==e.cap||(this.name===null?e.name!==null:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1;break}}return!0}};L(Me,"Op",C4(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]));let Z=Me;const ct=class ct{static isRuneOp(e){return ct.RUNE<=e&&e<=ct.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let r of e)t+=ze.escapeRune(r);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){const s=this.runes[0];return(this.arg&ge.FOLD_CASE)!==0?Oe.equalsIgnoreCase(s,e):e===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(e<this.runes[s])return!1;if(e<=this.runes[s+1])return!0}let t=0,r=this.runes.length/2|0;for(;t<r;){const s=t+((r-t)/2|0);if(this.runes[2*s]<=e){if(e<=this.runes[2*s+1])return!0;t=s+1}else r=s}return!1}toString(){switch(this.op){case ct.ALT:return`alt -> ${this.out}, ${this.arg}`;case ct.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case ct.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case ct.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case ct.MATCH:return"match";case ct.FAIL:return"fail";case ct.NOP:return`nop -> ${this.out}`;case ct.RUNE:return this.runes===null?"rune <null>":["rune ",ct.escapeRunes(this.runes),(this.arg&ge.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case ct.RUNE1:return`rune1 ${ct.escapeRunes(this.runes)} -> ${this.out}`;case ct.RUNE_ANY:return`any -> ${this.out}`;case ct.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}};L(ct,"ALT",1),L(ct,"ALT_MATCH",2),L(ct,"CAPTURE",3),L(ct,"EMPTY_WIDTH",4),L(ct,"FAIL",5),L(ct,"MATCH",6),L(ct,"NOP",7),L(ct,"RUNE",8),L(ct,"RUNE1",9),L(ct,"RUNE_ANY",10),L(ct,"RUNE_ANY_NOT_NL",11);let $e=ct;class uC{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new $e(e))}skipNop(e){let t=this.inst[e];for(;t.op===$e.NOP||t.op===$e.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!$e.isRuneOp(t.op)||t.runes.length!==1)return[t.op===$e.MATCH,e];for(;$e.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&ge.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===$e.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const r=this.inst[t];switch(r.op){case $e.EMPTY_WIDTH:e|=r.arg;break;case $e.FAIL:return-1;case $e.CAPTURE:case $e.NOP:break;default:break e}t=r.out}return e}next(e){const t=this.inst[e>>1];return(e&1)===0?t.out:t.arg}patch(e,t){for(;e!==0;){const r=this.inst[e>>1];(e&1)===0?(e=r.out,r.out=t):(e=r.arg,r.arg=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let r=e;for(;;){const i=this.next(r);if(i===0)break;r=i}const s=this.inst[r>>1];return(r&1)===0?s.out=t:s.arg=t,e}toString(){let e="";for(let t=0;t<this.inst.length;t++){const r=e.length;e+=t,t===this.start&&(e+="*"),e+="        ".substring(e.length-r),e+=this.inst[t],e+=`
460`}return e}}class ud{constructor(e=0,t=0,r=!1){this.i=e,this.out=t,this.nullable=r}}class Ic{static ANY_RUNE_NOT_NL(){return[0,K.CODES.get(`
461`)-1,K.CODES.get(`
462`)+1,Oe.MAX_RUNE]}static ANY_RUNE(){return[0,Oe.MAX_RUNE]}static compileRegexp(e){const t=new Ic,r=t.compile(e);return t.prog.patch(r.out,t.newInst($e.MATCH).i),t.prog.start=r.i,t.prog}constructor(){this.prog=new uC,this.newInst($e.FAIL)}newInst(e){return this.prog.addInst(e),new ud(this.prog.numInst()-1,0,!0)}nop(){const e=this.newInst($e.NOP);return e.out=e.i<<1,e}fail(){return new ud}cap(e){const t=this.newInst($e.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new ud(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;const r=this.newInst($e.ALT),s=this.prog.getInst(r.i);return s.out=e.i,s.arg=t.i,r.out=this.prog.append(e.out,t.out),r.nullable=e.nullable||t.nullable,r}loop(e,t){const r=this.newInst($e.ALT),s=this.prog.getInst(r.i);return t?(s.arg=e.i,r.out=r.i<<1):(s.out=e.i,r.out=r.i<<1|1),this.prog.patch(e.out,r.i),r}quest(e,t){const r=this.newInst($e.ALT),s=this.prog.getInst(r.i);return t?(s.arg=e.i,r.out=r.i<<1):(s.out=e.i,r.out=r.i<<1|1),r.out=this.prog.append(r.out,e.out),r}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new ud(e.i,this.loop(e,t).out,e.nullable)}
462empty(e){const t=this.newInst($e.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){const r=this.newInst($e.RUNE);r.nullable=!1;const s=this.prog.getInst(r.i);return s.runes=e,t&=ge.FOLD_CASE,(e.length!==1||Oe.simpleFold(e[0])===e[0])&&(t&=-2),s.arg=t,r.out=r.i<<1,(t&ge.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?s.op=$e.RUNE1:e.length===2&&e[0]===0&&e[1]===Oe.MAX_RUNE?s.op=$e.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===K.CODES.get(`
463`)-1&&e[2]===K.CODES.get(`
464`)+1&&e[3]===Oe.MAX_RUNE&&(s.op=$e.RUNE_ANY_NOT_NL),r}compile(e){switch(e.op){case Z.Op.NO_MATCH:return this.fail();case Z.Op.EMPTY_MATCH:return this.nop();case Z.Op.LITERAL:if(e.runes.length===0)return this.nop();{let t=null;for(let r of e.runes){const s=this.rune([r],e.flags);t=t===null?s:this.cat(t,s)}return t}case Z.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case Z.Op.ANY_CHAR_NOT_NL:return this.rune(Ic.ANY_RUNE_NOT_NL(),0);case Z.Op.ANY_CHAR:return this.rune(Ic.ANY_RUNE(),0);case Z.Op.BEGIN_LINE:return this.empty(ze.EMPTY_BEGIN_LINE);case Z.Op.END_LINE:return this.empty(ze.EMPTY_END_LINE);case Z.Op.BEGIN_TEXT:return this.empty(ze.EMPTY_BEGIN_TEXT);case Z.Op.END_TEXT:return this.empty(ze.EMPTY_END_TEXT);case Z.Op.WORD_BOUNDARY:return this.empty(ze.EMPTY_WORD_BOUNDARY);case Z.Op.NO_WORD_BOUNDARY:return this.empty(ze.EMPTY_NO_WORD_BOUNDARY);case Z.Op.CAPTURE:{const t=this.cap(e.cap<<1),r=this.compile(e.subs[0]),s=this.cap(e.cap<<1|1);return this.cat(this.cat(t,r),s)}case Z.Op.STAR:return this.star(this.compile(e.subs[0]),(e.flags&ge.NON_GREEDY)!==0);case Z.Op.PLUS:return this.plus(this.compile(e.subs[0]),(e.flags&ge.NON_GREEDY)!==0);case Z.Op.QUEST:return this.quest(this.compile(e.subs[0]),(e.flags&ge.NON_GREEDY)!==0);case Z.Op.CONCAT:{if(e.subs.length===0)return this.nop();{let t=null;for(let r of e.subs){const s=this.compile(r);t=t===null?s:this.cat(t,s)}return t}}case Z.Op.ALTERNATE:{if(e.subs.length===0)return this.nop();{let t=null;for(let r of e.subs){const s=this.compile(r);t=t===null?s:this.alt(t,s)}return t}}default:throw new aC("regexp: unhandled case in compile")}}}class rr{static simplify(e){if(e===null)return null;switch(e.op){case Z.Op.CAPTURE:case Z.Op.CONCAT:case Z.Op.ALTERNATE:{let t=e;for(let r=0;r<e.subs.length;r++){const s=e.subs[r],i=rr.simplify(s);t===e&&i!==s&&(t=Z.fromRegexp(e),t.runes=null,t.subs=e.subs.slice(0,e.subs.length)),t!==e&&(t.subs[r]=i)}return t}case Z.Op.STAR:case Z.Op.PLUS:case Z.Op.QUEST:{const t=rr.simplify(e.subs[0]);return rr.simplify1(e.op,e.flags,t,e)}case Z.Op.REPEAT:{if(e.min===0&&e.max===0)return new Z(Z.Op.EMPTY_MATCH);const t=rr.simplify(e.subs[0]);if(e.max===-1){if(e.min===0)return rr.simplify1(Z.Op.STAR,e.flags,t,null);if(e.min===1)return rr.simplify1(Z.Op.PLUS,e.flags,t,null);const s=new Z(Z.Op.CONCAT),i=[];for(let a=0;a<e.min-1;a++)i.push(t);return i.push(rr.simplify1(Z.Op.PLUS,e.flags,t,null)),s.subs=i.slice(0),s}if(e.min===1&&e.max===1)return t;let r=null;if(e.min>0){r=[];for(let s=0;s<e.min;s++)r.push(t)}if(e.max>e.min){let s=rr.simplify1(Z.Op.QUEST,e.flags,t,null);for(let i=e.min+1;i<e.max;i++){const a=new Z(Z.Op.CONCAT);a.subs=[t,s],s=rr.simplify1(Z.Op.QUEST,e.flags,a,null)}if(r===null)return s;r.push(s)}if(r!==null){const s=new Z(Z.Op.CONCAT);return s.subs=r.slice(0),s}return new Z(Z.Op.NO_MATCH)}}return e}static simplify1(e,t,r,s){return r.op===Z.Op.EMPTY_MATCH||e===r.op&&(t&ge.NON_GREEDY)===(r.flags&ge.NON_GREEDY)?r:(s!==null&&s.op===e&&(s.flags&ge.NON_GREEDY)===(t&ge.NON_GREEDY)&&r===s.subs[0]||(s=new Z(e),s.flags=t,s.subs=[r]),s)}}class Xe{constructor(e,t){this.sign=e,this.cls=t}}const G2=[48,57],K2=[9,10,12,13,32,32],H2=[48,57,65,90,95,95,97,122],W2=new Map([["\\d",new Xe(1,G2)],["\\D",new Xe(-1,G2)],["\\s",new Xe(1,K2)],["\\S",new Xe(-1,K2)],["\\w",new Xe(1,H2)],["\\W",new Xe(-1,H2)]]),Y2=[48,57,65,90,97,122],Q2=[65,90,97,122],Z2=[0,127],J2=[9,9,32,32],X2=[0,31,127,127],e0=[48,57],t0=[33,126],n0=[97,122],r0=[32,126],s0=[33,47,58,64,91,96,123,126],i0=[9,13,32,32],a0=[65,90],o0=[48,57,65,90,95,95,97,122],c0=[48,57,65,70,97,102],l0=new Map([["[:alnum:]",new Xe(1,Y2)],["[:^alnum:]",new Xe(-1,Y2)],["[:alpha:]",new Xe(1,Q2)],["[:^alpha:]",new Xe(-1,Q2)],["[:ascii:]",new Xe(1,Z2)],["[:^ascii:]",new Xe(-1,Z2)],["[:blank:]",new Xe(1,J2)],["[:^blank:]",new Xe(-1,J2)],["[:cntrl:]",new Xe(1,X2)],["[:^cntrl:]",new Xe(-1,X2)],["[:digit:]",new Xe(1,e0)],["[:^digit:]",new Xe(-1,e0)],["[:graph:]",new Xe(1,t0)],["[:^graph:]",new Xe(-1,t0)],["[:lower:]",new Xe(1,n0)],["[:^lower:]",new Xe(-1,n0)],["[:print:]",new Xe(1,r0)],["[:^print:]",new Xe(-1,r0)],["[:punct:]",new Xe(1,s0)],["[:^punct:]",new Xe(-1,s0)],["[:space:]",new Xe(1,i0)],["[:^
464space:]",new Xe(-1,i0)],["[:upper:]",new Xe(1,a0)],["[:^upper:]",new Xe(-1,a0)],["[:word:]",new Xe(1,o0)],["[:^word:]",new Xe(-1,o0)],["[:xdigit:]",new Xe(1,c0)],["[:^xdigit:]",new Xe(-1,c0)]]);class on{static charClassToString(e,t){let r="[";for(let s=0;s<t;s+=2){s>0&&(r+=" ");const i=e[s],a=e[s+1];i===a?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${a.toString(16)}`}return r+="]",r}static cmp(e,t,r,s){const i=e[t]-r;return i!==0?i:s-e[t+1]}static qsortIntPair(e,t,r){const s=((t+r)/2|0)&-2,i=e[s],a=e[s+1];let c=t,l=r;for(;c<=l;){for(;c<r&&on.cmp(e,c,i,a)<0;)c+=2;for(;l>t&&on.cmp(e,l,i,a)>0;)l-=2;if(c<=l){if(c!==l){let d=e[c];e[c]=e[l],e[l]=d,d=e[c+1],e[c+1]=e[l+1],e[l+1]=d}c+=2,l-=2}}t<l&&on.qsortIntPair(e,t,l),c<r&&on.qsortIntPair(e,c,r)}constructor(e=ze.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;on.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const r=this.r[t],s=this.r[t+1];if(r<=this.r[e-1]+1){s>this.r[e-1]&&(this.r[e-1]=s);continue}this.r[e]=r,this.r[e+1]=s,e+=2}return this.len=e,this}appendLiteral(e,t){return(t&ge.FOLD_CASE)!==0?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){const s=this.r[this.len-r],i=this.r[this.len-r+1];if(e<=i+1&&s<=t+1)return e<s&&(this.r[this.len-r]=e),t>i&&(this.r[this.len-r+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=Oe.MIN_FOLD&&t>=Oe.MAX_FOLD)return this.appendRange(e,t);if(t<Oe.MIN_FOLD||e>Oe.MAX_FOLD)return this.appendRange(e,t);e<Oe.MIN_FOLD&&(this.appendRange(e,Oe.MIN_FOLD-1),e=Oe.MIN_FOLD),t>Oe.MAX_FOLD&&(this.appendRange(Oe.MAX_FOLD+1,t),t=Oe.MAX_FOLD);for(let r=e;r<=t;r++){this.appendRange(r,r);for(let s=Oe.simpleFold(r);s!==r;s=Oe.simpleFold(s))this.appendRange(s,s)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let r=0;r<e.length;r+=2){const s=e[r],i=e[r+1];t<=s-1&&this.appendRange(t,s-1),t=i+1}return t<=Oe.MAX_RUNE&&this.appendRange(t,Oe.MAX_RUNE),this}appendTable(e){for(let t of e){const r=t[0],s=t[1],i=t[2];if(i===1){this.appendRange(r,s);continue}for(let a=r;a<=s;a+=i)this.appendRange(a,a)}return this}appendNegatedTable(e){let t=0;for(let r of e){const s=r[0],i=r[1],a=r[2];if(a===1){t<=s-1&&this.appendRange(t,s-1),t=i+1;continue}for(let c=s;c<=i;c+=a)t<=c-1&&this.appendRange(t,c-1),t=c+1}return t<=Oe.MAX_RUNE&&this.appendRange(t,Oe.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let r=0;r<this.len;r+=2){const s=this.r[r],i=this.r[r+1];e<=s-1&&(this.r[t]=e,this.r[t+1]=s-1,t+=2),e=i+1}return this.len=t,e<=Oe.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=Oe.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let r=e.cls;return t&&(r=new on().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,e.sign)}toString(){return on.charClassToString(this.r,this.len)}}class _c{static of(e,t){return new _c(e,t)}constructor(e,t){this.first=e,this.second=t}}class hC{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=ze.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}
464rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}}const we=class we{static ANY_TABLE(){return[[0,Oe.MAX_RUNE,1]]}static unicodeTable(e){return e==="Any"?_c.of(we.ANY_TABLE(),we.ANY_TABLE()):an.CATEGORIES.has(e)?_c.of(an.CATEGORIES.get(e),an.FOLD_CATEGORIES.get(e)):an.SCRIPTS.has(e)?_c.of(an.SCRIPTS.get(e),an.FOLD_SCRIPT.get(e)):null}static minFoldRune(e){if(e<Oe.MIN_FOLD||e>Oe.MAX_FOLD)return e;let t=e;const r=e;for(e=Oe.simpleFold(e);e!==r;e=Oe.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===Z.Op.EMPTY_MATCH)return null;if(e.op===Z.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===Z.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const r=new Z(Z.Op.LITERAL);return r.flags=t,r.runes=ze.stringToRunes(e),r}static parse(e,t){return new we(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const r=we.parseInt(e);if(r===-1||!e.more())return-1;let s;if(!e.lookingAt(","))s=r;else{if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))s=-1;else if((s=we.parseInt(e))===-1)return-1}if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new Ct(we.ERR_INVALID_REPEAT_SIZE,e.from(t));return r<<16|s&Oe.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){const r=e.codePointAt(t);if(r!==K.CODES.get("_")&&!ze.isalnum(r))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=K.CODES.get("0")&&e.peek()<=K.CODES.get("9");)e.skip(1);const r=e.from(t);return r.length===0||r.length>1&&r.codePointAt(0)===K.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(e){return e.op===Z.Op.LITERAL&&e.runes.length===1||e.op===Z.Op.CHAR_CLASS||e.op===Z.Op.ANY_CHAR_NOT_NL||e.op===Z.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case Z.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case Z.Op.CHAR_CLASS:for(let r=0;r<e.runes.length;r+=2)if(e.runes[r]<=t&&t<=e.runes[r+1])return!0;return!1;case Z.Op.ANY_CHAR_NOT_NL:return t!==K.CODES.get(`
465`);case Z.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case Z.Op.ANY_CHAR:break;case Z.Op.ANY_CHAR_NOT_NL:we.matchRune(t,K.CODES.get(`
466`))&&(e.op=Z.Op.ANY_CHAR);break;case Z.Op.CHAR_CLASS:t.op===Z.Op.LITERAL?e.runes=new on(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new on(e.runes).appendClass(t.runes).toArray();break;case Z.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=Z.Op.CHAR_CLASS,e.runes=new on().appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray();break}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new Ct(we.ERR_TRAILING_BACKSLASH);let r=e.pop();e:switch(r){case K.CODES.get("1"):case K.CODES.get("2"):case K.CODES.get("3"):case K.CODES.get("4"):case K.CODES.get("5"):case K.CODES.get("6"):case K.CODES.get("7"):if(!e.more(
466)||e.peek()<K.CODES.get("0")||e.peek()>K.CODES.get("7"))break;case K.CODES.get("0"):{let s=r-K.CODES.get("0");for(let i=1;i<3&&!(!e.more()||e.peek()<K.CODES.get("0")||e.peek()>K.CODES.get("7"));i++)s=s*8+e.peek()-K.CODES.get("0"),e.skip(1);return s}case K.CODES.get("x"):{if(!e.more())break;if(r=e.pop(),r===K.CODES.get("{")){let a=0,c=0;for(;;){if(!e.more())break e;if(r=e.pop(),r===K.CODES.get("}"))break;const l=ze.unhex(r);if(l<0||(c=c*16+l,c>Oe.MAX_RUNE))break e;a++}if(a===0)break e;return c}const s=ze.unhex(r);if(!e.more())break;r=e.pop();const i=ze.unhex(r);if(s<0||i<0)break;return s*16+i}case K.CODES.get("a"):return K.CODES.get("\x07");case K.CODES.get("f"):return K.CODES.get("\f");case K.CODES.get("n"):return K.CODES.get(`
467`);case K.CODES.get("r"):return K.CODES.get("\r");case K.CODES.get("t"):return K.CODES.get("	");case K.CODES.get("v"):return K.CODES.get("\v");default:if(!ze.isalnum(r))return r;break}throw new Ct(we.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new Ct(we.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?we.parseEscape(e):e.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new Z(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!Z.isPseudoOp(this.stack[t-1].op);)t--;const r=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),r}push(e){if(e.op===Z.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=Z.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===Z.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&Oe.simpleFold(e.runes[0])===e.runes[2]&&Oe.simpleFold(e.runes[2])===e.runes[0]||e.op===Z.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&Oe.simpleFold(e.runes[0])===e.runes[1]&&Oe.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|ge.FOLD_CASE))return null;e.op=Z.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|ge.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(e,t){const r=this.stack.length;if(r<2)return!1;const s=this.stack[r-1],i=this.stack[r-2];
467return s.op!==Z.Op.LITERAL||i.op!==Z.Op.LITERAL||(s.flags&ge.FOLD_CASE)!==(i.flags&ge.FOLD_CASE)?!1:(i.runes=we.concatRunes(i.runes,s.runes),e>=0?(s.runes=[e],s.flags=t,!0):(this.pop(),this.reuse(s),!1))}newLiteral(e,t){const r=this.newRegexp(Z.Op.LITERAL);return r.flags=t,(t&ge.FOLD_CASE)!==0&&(e=we.minFoldRune(e)),r.runes=[e],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,r,s,i,a){let c=this.flags;if((c&ge.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),c^=ge.NON_GREEDY),a!==-1))throw new Ct(we.ERR_INVALID_REPEAT_OP,i.from(a));const l=this.stack.length;if(l===0)throw new Ct(we.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const d=this.stack[l-1];if(Z.isPseudoOp(d.op))throw new Ct(we.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const m=this.newRegexp(e);m.min=t,m.max=r,m.flags=c,m.subs=[d],this.stack[l-1]=m}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(Z.Op.EMPTY_MATCH)):this.push(this.collapse(e,Z.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(Z.Op.NO_MATCH)):this.push(this.collapse(e,Z.Op.ALTERNATE))}cleanAlt(e){e.op===Z.Op.CHAR_CLASS&&(e.runes=new on(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===Oe.MAX_RUNE?(e.runes=null,e.op=Z.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===K.CODES.get(`
468`)-1&&e.runes[2]===K.CODES.get(`
469`)+1&&e.runes[3]===Oe.MAX_RUNE&&(e.runes=null,e.op=Z.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let r=0;for(let c of e)r+=c.op===t?c.subs.length:1;let s=new Array(r).fill(null),i=0;for(let c of e)c.op===t?(s.splice(i,c.subs.length,...c.subs),i+=c.subs.length,this.reuse(c)):s[i++]=c;let a=this.newRegexp(t);if(a.subs=s,t===Z.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){const c=a;a=a.subs[0],this.reuse(c)}return a}factor(e){if(e.length<2)return e;let t=0,r=e.length,s=0,i=null,a=0,c=0,l=0;for(let m=0;m<=r;m++){let p=null,f=0,g=0;if(m<r){let x=e[t+m];if(x.op===Z.Op.CONCAT&&x.subs.length>0&&(x=x.subs[0]),x.op===Z.Op.LITERAL&&(p=x.runes,f=x.runes.length,g=x.flags&ge.FOLD_CASE),g===c){let b=0;for(;b<a&&b<f&&i[b]===p[b];)b++;if(b>0){a=b;continue}}}if(m!==l)if(m===l+1)e[s++]=e[t+l];else{const x=this.newRegexp(Z.Op.LITERAL);x.flags=c,x.runes=i.slice(0,a);for(let N=l;N<m;N++)e[t+N]=this.removeLeadingString(e[t+N],a);const b=this.collapse(e.slice(t+l,t+m),Z.Op.ALTERNATE),I=this.newRegexp(Z.Op.CONCAT);I.subs=[x,b],e[s++]=I}l=m,i=p,a=f,c=g}r=s,t=0,l=0,s=0;let d=null;for(let m=0;m<=r;m++){let p=null;if(!(m<r&&(p=we.leadingRegexp(e[t+m]),d!==null&&d.equals(p)&&(we.isCharClass(d)||d.op===Z.Op.REPEAT&&d.min===d.max&&we.isCharClass(d.subs[0]))))){if(m!==l)if(m===l+1)e[s++]=e[t+l];else{const f=d;for(let b=l;b<m;b++){const I=b!==l;e[t+b]=this.removeLeadingRegexp(e[t+b],I)}const g=this.collapse(e.slice(t+l,t+m),Z.Op.ALTERNATE),x=this.newRegexp(Z.Op.CONCAT);x.subs=[f,g],e[s++]=x}l=m,d=p}}r=s,t=0,l=0,s=0;for(let m=0;m<=r;m++)if(!(m<r&&we.isCharClass(e[t+m]))){if(m!==l)if(m===l+1)e[s++]=e[t+l];else{let p=l;for(let g=l+1;g<m;g++){const x=e[t+p],b=e[t+g];(x.op<b.op||x.op===b.op&&(x.runes!==null?x.runes.length:0)<(b.runes!==null?b.runes.length:0))&&(p=g)}const f=e[t+l];e[t+l]=e[t+p],e[t+p]=f;for(let g=l+1;g<m;g++)we.mergeCharClass(e[t+l],e[t+g]),this.reuse(e[t+g]);this.cleanAlt(e[t+l]),e[s++]=e[t+l]}m<r&&(e[s++]=e[t+m]),l=m+1}r=s,t=0,l=0,s=0;for(let m=0;m<r;++m)m+1<r&&e[t+m].op===Z.Op.EMPTY_MATCH&&e[t+m+1].op===Z.Op.EMPTY_MATCH||(e[s++]=e[t+m]);return r=s,t=0,e.slice(t,r)}removeLeadingString(e,t){if(e.op===Z.Op.CONCAT&&e.subs.length>0){const r=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=r,r.op===Z.Op.EMPTY_MATCH)switch(this.reuse(r),e.subs.length){case 0:case 1:e.op=Z.Op.EMPTY_MATCH,e.subs=null;break;case 2:{const s=e;e=e.subs[1],this.reuse(s);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===Z.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=Z.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===Z.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:{e.op=Z.Op.EMPTY_MATCH,e.subs=Z.emptySubs();break}case 1:{const r=e;e=e.subs[0],this.reuse(r);break}}return e}return t&&this.reuse(e),this.newRegexp(Z.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&ge.LITERAL)!==0)return we.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,r=-1;const s=new hC(this.wholeRegexp);for(;s.more();){let a=-1;e:switch(s.peek()){case K.CODES.get("("):if((this.flags&ge.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(Z.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case K.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case K.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case K.CODES.get("^"):(this.flags&ge.ONE_LINE)!==0?this.op(Z.Op.BEGIN_TEXT):this.op(Z.Op.BEGIN_LINE),s.skip(1);break;case K.CODES.get("$"):(this.flags&ge.ONE_LINE)!==0?this.op(Z.Op.END_TEXT).flags|=ge.WAS_DOLLAR:this.op(Z.Op.END_LINE),s.skip(1);break;case K.CODES.get("."):(this.flags&ge.DOT_NL)!==0?this.op(Z.Op.ANY_CHAR):this.op(Z.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case K.CODES.get("["):this.parseClass(s);break;case K.CODES.get("*"):case K.CODES.get("+"):case K.CODES.get("?"):{a=s.pos();let c=null;switch(s.pop()){case K.CODES.get("*"):c=Z.Op.STAR;break;case K.CODES.get("+"):c=Z.Op.PLUS;break;case K.CODES.get("?"):c=Z.Op.QUEST;break}this.repeat(c,t,r,a,s,e);break}case K.CODES.get("{"):{a=s.pos();const c=we.parseRepeat(s);if(c<0){s.rewindTo(a),this.literal(s.pop());break}t=c>>16,r=(c&Oe.MAX_BMP)<<16>>16,this.repeat(Z.Op.REPEAT,t,r,a,s,e);break}case K.CODES.get("\\"):{const c=s.pos();if(s.skip(1),(this.flags&ge.PERL_X)!==0&&s.more())switch(s.pop()){case K.CODES.get("A"):this.op(Z.Op.BEGIN_TEXT);break e;
469case K.CODES.get("b"):this.op(Z.Op.WORD_BOUNDARY);break e;case K.CODES.get("B"):this.op(Z.Op.NO_WORD_BOUNDARY);break e;case K.CODES.get("C"):throw new Ct(we.ERR_INVALID_ESCAPE,"\\C");case K.CODES.get("Q"):{let p=s.rest();const f=p.indexOf("\\E");f>=0&&(p=p.substring(0,f)),s.skipString(p),s.skipString("\\E");let g=0;for(;g<p.length;){const x=p.codePointAt(g);this.literal(x),g+=ze.charCount(x)}break e}case K.CODES.get("z"):this.op(Z.Op.END_TEXT);break e;default:s.rewindTo(c);break}const l=this.newRegexp(Z.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){const m=new on;if(this.parseUnicodeClass(s,m)){l.runes=m.toArray(),this.push(l);break e}}const d=new on;if(this.parsePerlClassEscape(s,d)){l.runes=d.toArray(),this.push(l);break e}s.rewindTo(c),this.reuse(l),this.literal(we.parseEscape(s));break}default:this.literal(s.pop());break}e=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Ct(we.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),r=e.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){const c=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new Ct(we.ERR_INVALID_NAMED_CAPTURE,r);const d=r.substring(c,l);if(e.skipString(d),e.skip(c+1),!we.isValidCaptureName(d))throw new Ct(we.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));const m=this.op(Z.Op.LEFT_PAREN);if(m.cap=++this.numCap,this.namedGroups[d])throw new Ct(we.ERR_DUPLICATE_NAMED_CAPTURE,d);this.namedGroups[d]=this.numCap,m.name=d;return}e.skip(2);let s=this.flags,i=1,a=!1;e:for(;e.more();){const c=e.pop();switch(c){case K.CODES.get("i"):s|=ge.FOLD_CASE,a=!0;break;case K.CODES.get("m"):s&=-17,a=!0;break;case K.CODES.get("s"):s|=ge.DOT_NL,a=!0;break;case K.CODES.get("U"):s|=ge.NON_GREEDY,a=!0;break;case K.CODES.get("-"):if(i<0)break e;i=-1,s=~s,a=!1;break;case K.CODES.get(":"):case K.CODES.get(")"):if(i<0){if(!a)break e;s=~s}c===K.CODES.get(":")&&this.op(Z.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new Ct(we.ERR_INVALID_PERL_OP,e.from(t))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(Z.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===Z.Op.VERTICAL_BAR&&we.isCharClass(this.stack[e-1])&&we.isCharClass(this.stack[e-3])){let t=this.stack[e-1],r=this.stack[e-3];if(t.op>r.op){const s=r;r=t,t=s,this.stack[e-3]=r}return we.mergeCharClass(r,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],r=this.stack[e-2];if(r.op===Z.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Ct(we.ERR_INTERNAL_ERROR,"stack underflow");const t=this.pop(),r=this.pop();if(r.op!==Z.Op.LEFT_PAREN)throw new Ct(we.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(t):(r.op=Z.Op.CAPTURE,r.subs=[t],this.push(r))}parsePerlClassEscape(e,t){const r=e.pos();if((this.flags&ge.PERL_X)===0||!e.more()||e.pop()!==K.CODES.get("\\")||!e.more())return!1;e.pop();const s=e.from(r),i=W2.has(s)?W2.get(s):null;return i===null?!1:(t.appendGroup(i,(this.flags&ge.FOLD_CASE)!==0),!0)}parseNamedClass(e,t){const r=e.rest(),s=r.indexOf(":]");if(s<0)return!1;const i=r.substring(0,s+2);e.skipString(i);const a=l0.has(i)?l0.get(i):null;if(a===null)throw new Ct(we.ERR_INVALID_CHAR_RANGE,i);return t.appendGroup(a,(this.flags&ge.FOLD_CASE)!==0),!0}parseUnicodeClass(e,t){const r=e.pos();if((this.flags&ge.UNICODE_GROUPS)===0||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let s=1,i=e.pop();if(i===K.CODES.get("P")&&(s=-1),!e.more())throw e.rewindTo(r),new Ct(we.ERR_INVALID_CHAR_RANGE,e.rest());i=e.pop();let a;if(i!==K.CODES.get("{"))a=ze.runeToString(i);else{const m=e.rest(),p=m.indexOf("}");if(p<0)throw e.rewindTo(r),new Ct(we.ERR_INVALID_CHAR_RANGE,e.rest());a=m.substring(0,p),e.skipString(a),e.skip(1)}a.length!==0&&a.codePointAt(0)===K.CODES.get("^")&&(s=0-s,a=a.substring(1));const c=we.unicodeTable(a);if(c===null)throw new Ct(we.ERR_INVALID_CHAR_RANGE,e.from(r));const l=c.first,d=c.second;if((this.flags&ge.FOLD_CASE)===0||d===null)t.appendTableWithSign(l,s);else{const m=new on().appendTable(l).appendTable(d).cleanClass().toArray();t.appendClassWithSign(m,s)}return!0}parseClass(e){const t=e.pos();e.skip(1);const r=this.newRegexp(Z.Op.CHAR_CLASS);r.flags=this.flags;const s=new on;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),(this.flags&ge.CLASS_NL)===0&&s.appendRange(K.CODES.get(`
470`),K.CODES.get(`
471`)));let a=!0;for(;!e.more()||e.peek()!==K.CODES.get("]")||a;){if(e.more()&&e.lookingAt("-")&&(this.flags&ge.PERL_X)===0&&!a){const m=e.rest();if(m==="-"||!m.startsWith("-]"))throw e.rewindTo(t),new Ct(we.ERR_INVALID_CHAR_RANGE,e.rest())}a=!1;const c=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,s))continue;e.rewindTo(c)}if(this.parseUnicodeClass(e,s)||this.parsePerlClassEscape(e,s))continue;e.rewindTo(c);const l=we.parseClassChar(e,t);let d=l;if(e.more()&&e.lookingAt("-")){if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(d=we.parseClassChar(e,t),d<l)throw new Ct(we.ERR_INVALID_CHAR_RANGE,e.from(c))}(this.flags&ge.FOLD_CASE)===0?s.appendRange(l,d):s.appendFoldedRange(l,d)}e.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}};L(we,"ERR_INTERNAL_ERROR","regexp/syntax: internal error"),L(we,"ERR_INVALID_CHAR_RANGE","invali
471d character class range"),L(we,"ERR_INVALID_ESCAPE","invalid escape sequence"),L(we,"ERR_INVALID_NAMED_CAPTURE","invalid named capture"),L(we,"ERR_INVALID_PERL_OP","invalid or unsupported Perl syntax"),L(we,"ERR_INVALID_REPEAT_OP","invalid nested repetition operator"),L(we,"ERR_INVALID_REPEAT_SIZE","invalid repeat count"),L(we,"ERR_MISSING_BRACKET","missing closing ]"),L(we,"ERR_MISSING_PAREN","missing closing )"),L(we,"ERR_MISSING_REPEAT_ARGUMENT","missing argument to repetition operator"),L(we,"ERR_TRAILING_BACKSLASH","trailing backslash at end of expression"),L(we,"ERR_DUPLICATE_NAMED_CAPTURE","duplicate capture group name");let wp=we;class mC{constructor(){this.inst=null,this.cap=[]}}class d0{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){const t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e="{";for(let t=0;t<this.size;t++)t!==0&&(e+=", "),e+=this.densePcs[t];return e+="}",e}}class qa{static fromRE2(e){const t=new qa;return t.prog=e.prog,t.re2=e,t.q0=new d0(t.prog.numInst()),t.q1=new d0(t.prog.numInst()),t.pool=[],t.poolSize=0,t.matched=!1,t.matchcap=Array(t.prog.numCap<2?2:t.prog.numCap).fill(0),t.ncap=0,t}static fromMachine(e){const t=new qa;return t.re2=e.re2,t.prog=e.prog,t.q0=e.q0,t.q1=e.q1,t.pool=e.pool,t.poolSize=e.poolSize,t.matched=e.matched,t.matchcap=e.matchcap,t.ncap=e.ncap,t}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){const r=this.pool[t];r.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){const r=this.pool[t];r.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?ze.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new mC,t.inst=e,t}freeQueue(e,t=0){const r=e.size-t,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=t;i<e.size;i++){const a=e.denseThreads[i];a!==null&&(this.pool[this.poolSize]=a,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,r){const s=this.re2.cond;if(s===ze.EMPTY_ALL||(r===ge.ANCHOR_START||r===ge.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,c=e.step(t),l=c>>3,d=c&7,m=-1,p=0;c!==Es.EOF()&&(c=e.step(t+d),m=c>>3,p=c&7);let f;for(t===0?f=ze.emptyOpContext(-1,l):f=e.context(t);;){if(i.isEmpty()){if((s&ze.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&m!==this.re2.prefixRune&&e.canCheckPrefix()){const b=e.index(this.re2,t);if(b<0)break;t+=b,c=e.step(t),l=c>>3,d=c&7,c=e.step(t+d),m=c>>3,p=c&7}}!this.matched&&(t===0||r===ge.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,f,null));const g=t+d;if(f=e.context(g),this.step(i,a,t,g,l,f,r,t===e.endPos()),d===0||this.ncap===0&&this.matched)break;t+=d,l=m,d=p,l!==-1&&(c=e.step(t+d),m=c>>3,p=c&7);const x=i;i=a,a=x}return this.freeQueue(a),this.matched}step(e,t,r,s,i,a,c,l){const d=this.re2.longest;for(let m=0;m<e.size;m++){let p=e.denseThreads[m];if(p===null)continue;if(d&&this.matched&&this.ncap>0&&this.matchcap[0]<p.cap[0]){this.freeThread(p);continue}const f=p.inst;let g=!1;switch(f.op){case $e.MATCH:if(c===ge.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!d||!this.matched||this.matchcap[1]<r)&&(p.cap[1]=r,this.matchcap=p.cap.slice(0,this.ncap)),d||this.freeQueue(e,m+1),this.matched=!0;break;case $e.RUNE:g=f.matchRune(i);break;case $e.RUNE1:g=i===f.runes[0];break;case $e.RUNE_ANY:g=!0;break;case $e.RUNE_ANY_NOT_NL:g=i!==K.CODES.get(`
472`);break;default:throw new Error("bad inst")}g&&(p=this.add(t,f.out,s,p.cap,a,p)),p!==null&&(this.freeThread(p),e.denseThreads[m]=null)}e.clear()}add(e,t,r,s,i,a){if(t===0||e.contains(t))return a;const c=e.add(t),l=this.prog.inst[t];switch(l.op){case $e.FAIL:break;case $e.ALT:case $e.ALT_MATCH:a=this.add(e,l.out,r,s,i,a),a=this.add(e,l.arg,r,s,i,a);break;case $e.EMPTY_WIDTH:(l.arg&~i)===0&&(a=this.add(e,l.out,r,s,i,a));break;case $e.NOP:a=this.add(e,l.out,r,s,i,a);break;case $e.CAPTURE:if(l.arg<this.ncap){const d=s[l.arg];s[l.arg]=r,this.add(e,l.out,r,s,i,null),s[l.arg]=d}else a=this.add(e,l.out,r,s,i,a);break;case $e.MATCH:case $e.RUNE:case $e.RUNE1:case $e.RUNE_ANY:case $e.RUNE_ANY_NOT_NL:a===null?a=this.alloc(l):a.inst=l,this.ncap>
4720&&a.cap!==s&&(a.cap=s.slice(0,this.ncap)),e.denseThreads[c]=a,a=null;break;default:throw new Error("unhandled")}return a}}class pC{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}}class js{static initTest(e){const t=js.compile(e),r=new js(t.expr,t.prog,t.numSubexp,t.longest);return r.cond=t.cond,r.prefix=t.prefix,r.prefixUTF8=t.prefixUTF8,r.prefixComplete=t.prefixComplete,r.prefixRune=t.prefixRune,r}static compile(e){return js.compileImpl(e,ge.PERL,!1)}static compilePOSIX(e){return js.compileImpl(e,ge.POSIX,!0)}static compileImpl(e,t,r){let s=wp.parse(e,t);const i=s.maxCap();s=rr.simplify(s);const a=Ic.compileRegexp(s),c=new js(e,a,i,r),[l,d]=a.prefix();return c.prefixComplete=l,c.prefix=d,c.prefixUTF8=ze.stringToUtf8ByteArray(c.prefix),c.prefix.length>0&&(c.prefixRune=c.prefix.codePointAt(0)),c.namedGroups=s.namedGroups,c}static match(e,t){return js.compile(e).match(t)}constructor(e,t,r=0,s=0){this.expr=e,this.prog=t,this.numSubexp=r,this.longest=s,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new pC}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let r=this.pooled.get();do r=this.pooled.get(),!t&&r&&(e=qa.fromMachine(e),t=!0),e.next!==r&&(e.next=r);while(!this.pooled.compareAndSet(r,e))}toString(){return this.expr}doExecute(e,t,r,s){let i=this.get(),a=!1;i?i.next!==null&&(i=qa.fromMachine(i),a=!0):(i=qa.fromRE2(this),a=!0),i.init(s);const c=i.match(e,t,r)?i.submatches():null;return this.put(i,a),c}match(e){return this.doExecute(Mt.fromUTF16(e),0,ge.UNANCHORED,0)!==null}matchWithGroup(e,t,r,s,i){return e instanceof Hs||(e=tu.utf16(e)),this.matchMachineInput(e,t,r,s,i)}matchMachineInput(e,t,r,s,i){if(t>r)return[!1,null];const a=e.isUTF16Encoding()?Mt.fromUTF16(e.asCharSequence(),0,r):Mt.fromUTF8(e.asBytes(),0,r),c=this.doExecute(a,t,s,2*i);return c===null?[!1,null]:[!0,c]}matchUTF8(e){return this.doExecute(Mt.fromUTF8(e),0,ge.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,r){let s=0,i=0,a="";const c=Mt.fromUTF16(e);let l=0;for(;i<=e.length;){const d=this.doExecute(c,i,ge.UNANCHORED,2);if(d===null||d.length===0)break;a+=e.substring(s,d[0]),(d[1]>s||d[0]===0)&&(a+=t(e.substring(d[0],d[1])),l++),s=d[1];const m=c.step(i)&7;
472if(i+m>d[1]?i+=m:i+1>d[1]?i++:i=d[1],l>=r)break}return a+=e.substring(s),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let r=new Array(t).fill(-1);for(let s=0;s<e.length;s++)r[s]=e[s];e=r}return e}allMatches(e,t,r=s=>s){let s=[];const i=e.endPos();t<0&&(t=i+1);let a=0,c=0,l=-1;for(;c<t&&a<=i;){const d=this.doExecute(e,a,ge.UNANCHORED,this.prog.numCap);if(d===null||d.length===0)break;let m=!0;if(d[1]===a){d[0]===l&&(m=!1);const p=e.step(a);p<0?a=i+1:a+=p&7}else a=d[1];l=d[1],m&&(s.push(r(this.pad(d))),c++)}return s}findUTF8(e){const t=this.doExecute(Mt.fromUTF8(e),0,ge.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.doExecute(Mt.fromUTF8(e),0,ge.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){const t=this.doExecute(Mt.fromUTF16(e),0,ge.UNANCHORED,2);return t===null?"":e.substring(t[0],t[1])}findIndex(e){return this.doExecute(Mt.fromUTF16(e),0,ge.UNANCHORED,2)}findUTF8Submatch(e){const t=this.doExecute(Mt.fromUTF8(e),0,ge.UNANCHORED,this.prog.numCap);if(t===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<t.length&&t[2*s]>=0&&(r[s]=e.slice(t[2*s],t[2*s+1]));return r}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(Mt.fromUTF8(e),0,ge.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.doExecute(Mt.fromUTF16(e),0,ge.UNANCHORED,this.prog.numCap);if(t===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<t.length&&t[2*s]>=0&&(r[s]=e.substring(t[2*s],t[2*s+1]));return r}findSubmatchIndex(e){return this.pad(this.doExecute(Mt.fromUTF16(e),0,ge.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const r=this.allMatches(Mt.fromUTF8(e),t,s=>e.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(e,t){const r=this.allMatches(Mt.fromUTF8(e),t,s=>s.slice(0,2));return r.length===0?null:r}findAll(e,t){const r=this.allMatches(Mt.fromUTF16(e),t,s=>e.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(e,t){const r=this.allMatches(Mt.fromUTF16(e),t,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(e,t){const r=this.allMatches(Mt.fromUTF8(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let a=0;a<i.length;a++)s[2*a]>=0&&(i[a]=e.slice(s[2*a],s[2*a+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(e,t){const r=this.allMatches(Mt.fromUTF8(e),t);return r.length===0?null:r}findAllSubmatch(e,t){const r=this.allMatches(Mt.fromUTF16(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let a=0;a<i.length;a++)s[2*a]>=0&&(i[a]=e.substring(s[2*a],s[2*a+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(e,t){const r=this.allMatches(Mt.fromUTF16(e),t);return r.length===0?null:r}}const In=class In{static quote(e){return ze.quoteMeta(e)}static compile(e,t=0){let r=e;if((t&In.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(t&In.DOTALL)!==0&&(r=`(?s)${r}`),(t&In.MULTILINE)!==0&&(r=`(?m)${r}`),(t&-32)!==0)throw new oC("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=ge.PERL;(t&In.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);const i=new In(e,t);return i.re2Input=js.compileImpl(r,s,(t&In.LONGEST_MATCH)!==0),i}static matches(e,t){return In.compile(e).matcher(t).matches()}static initTest(e,t,r){if(e==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");const s=new In(e,t);return s.re2Input=r,s}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=tu.utf8(e)),new cC(this,e)}split(e,t=0){const r=this.matcher(e),s=[];let i=0,a=0;for(;r.find();){if(a===0&&r.end()===0){a=r.end();continue}if(t>0&&s.length===t-1)break;if(a===r.start()){if(t===0){i+=1,a=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(a,r.start())),a=r.end()}if(t===0&&a!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(a,r.inputLength()))}return(t!==0||s.length===0)&&s.push(r.substring(a,r.inputLength())),s}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput
472===e.patternInput}};L(In,"CASE_INSENSITIVE",1),L(In,"DOTALL",2),L(In,"MULTILINE",4),L(In,"DISABLE_UNICODE_GROUPS",8),L(In,"LONGEST_MATCH",16);let Fc=In;/**
473 * @license
474 * Copyright 2017 Google LLC
475 *
476 * Licensed under the Apache License, Version 2.0 (the "License");
477 * you may not use this file except in compliance with the License.
478 * You may obtain a copy of the License at
479 *
480 *   http://www.apache.org/licenses/LICENSE-2.0
481 *
482 * Unless required by applicable law or agreed to in writing, software
483 * distributed under the License is distributed on an "AS IS" BASIS,
484 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485 * See the License for the specific language governing permissions and
486 * limitations under the License.
487 */let cn=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};cn.UNAUTHENTICATED=new cn(null),cn.GOOGLE_CREDENTIALS=new cn("google-credentials-uid"),cn.FIRST_PARTY=new cn("first-party-uid"),cn.MOCK_USER=new cn("mock-user");/**
488 * @license
489 * Copyright 2017 Google LLC
490 *
491 * Licensed under the Apache License, Version 2.0 (the "License");
492 * you may not use this file except in compliance with the License.
493 * You may obtain a copy of the License at
494 *
495 *   http://www.apache.org/licenses/LICENSE-2.0
496 *
497 * Unless required by applicable law or agreed to in writing, software
498 * distributed under the License is distributed on an "AS IS" BASIS,
499 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
500 * See the License for the specific language governing permissions and
501 * limitations under the License.
502 */let wo="12.15.0";function fC(n){wo=n}/**
503 * @license
504 * Copyright 2020 Google LLC
505 *
506 * Licensed under the Apache License, Version 2.0 (the "License");
507 * you may not use this file except in compliance with the License.
508 * You may obtain a copy of the License at
509 *
510 *   http://www.apache.org/licenses/LICENSE-2.0
511 *
512 * Unless required by applicable law or agreed to in writing, software
513 * distributed under the License is distributed on an "AS IS" BASIS,
514 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
515 * See the License for the specific language governing permissions and
516 * limitations under the License.
517 *//**
518 * @license
519 * Copyright 2017 Google LLC
520 *
521 * Licensed under the Apache License, Version 2.0 (the "License");
522 * you may not use this file except in compliance with the License.
523 * You may obtain a copy of the License at
524 *
525 *   http://www.apache.org/licenses/LICENSE-2.0
526 *
527 * Unless required by applicable law or agreed to in writing, software
528 * distributed under the License is distributed on an "AS IS" BASIS,
529 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
530 * See the License for the specific language governing permissions and
531 * limitations under the License.
532 */const qi=new A1("@firebase/firestore");function Aa(){return qi.logLevel}function se(n,...e){if(qi.logLevel<=He.DEBUG){const t=e.map(R1);qi.debug(`Firestore (${wo}): ${n}`,...t)}}function Rt(n,...e){if(qi.logLevel<=He.ERROR){const t=e.map(R1);qi.error(`Firestore (${wo}): ${n}`,...t)}}function lr(n,...e){if(qi.logLevel<=He.WARN){const t=e.map(R1);qi.warn(`Firestore (${wo}): ${n}`,...t)}}function R1(n){if(typeof n=="string")return n;try{return(function(t){return JSON.stringify(t)})(n)}catch{return n}}/**
533 * @license
534 * Copyright 2017 Google LLC
535 *
536 * Licensed under the Apache License, Version 2.0 (the "License");
537 * you may not use this file except in compliance with the License.
538 * You may obtain a copy of the License at
539 *
540 *   http://www.apache.org/licenses/LICENSE-2.0
541 *
542 * Unless required by applicable law or agreed to in writing, software
543 * distributed under the License is distributed on an "AS IS" BASIS,
544 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
545 * See the License for the specific language governing permissions and
546 * limitations under the License.
547 */function ye(n,e,t){let r="Unexpected state";
547typeof e=="string"?r=e:t=e,M4(n,r,t)}function M4(n,e,t){let r=`FIRESTORE (${wo}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(t!==void 0)try{r+=" CONTEXT: "+JSON.stringify(t)}catch{r+=" CONTEXT: "+t}throw Rt(r),new Error(r)}function ce(n,e,t,r){let s="Unexpected state";typeof t=="string"?s=t:r=t,n||M4(e,s,r)}function _e(n,e){return n}/**
548 * @license
549 * Copyright 2017 Google LLC
550 *
551 * Licensed under the Apache License, Version 2.0 (the "License");
552 * you may not use this file except in compliance with the License.
553 * You may obtain a copy of the License at
554 *
555 *   http://www.apache.org/licenses/LICENSE-2.0
556 *
557 * Unless required by applicable law or agreed to in writing, software
558 * distributed under the License is distributed on an "AS IS" BASIS,
559 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
560 * See the License for the specific language governing permissions and
561 * limitations under the License.
562 */const J={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class de extends ls{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
563 * @license
564 * Copyright 2017 Google LLC
565 *
566 * Licensed under the Apache License, Version 2.0 (the "License");
567 * you may not use this file except in compliance with the License.
568 * You may obtain a copy of the License at
569 *
570 *   http://www.apache.org/licenses/LICENSE-2.0
571 *
572 * Unless required by applicable law or agreed to in writing, software
573 * distributed under the License is distributed on an "AS IS" BASIS,
574 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
575 * See the License for the specific language governing permissions and
576 * limitations under the License.
577 */class Nr{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}/**
578 * @license
579 * Copyright 2017 Google LLC
580 *
581 * Licensed under the Apache License, Version 2.0 (the "License");
582 * you may not use this file except in compliance with the License.
583 * You may obtain a copy of the License at
584 *
585 *   http://www.apache.org/licenses/LICENSE-2.0
586 *
587 * Unless required by applicable law or agreed to in writing, software
588 * distributed under the License is distributed on an "AS IS" BASIS,
589 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
590 * See the License for the specific language governing permissions and
591 * limitations under the License.
592 */class gC{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class yC{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(cn.UNAUTHENTICATED)))}shutdown(){}}class bC{constructor(e){this.t=e,this.currentUser=cn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){ce(this.o===void 0,42304);let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new Nr;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Nr,e.enqueueRetryable((()=>s(this.currentUser)))};const a=()=>{const l=i;e.enqueueRetryable((async()=>{await l.promise,await s(this.currentUser)}))},c=l=>{se("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((l=>c(l))),setTimeout((()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(se("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Nr)}}),0),a()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((r=>this.i!==e?(se("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(ce(typeof r.accessToken=="string",31837,{l:r}),new gC(r.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return ce(e===null||typeof e=="string",2055,{h:e}),new cn(e)}}class xC{constructor(e,t,r){this.T=e,this.P=t,this.R=r,this.type="FirstParty",this.user=cn.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set("X-Goog-AuthUser",this.T);const e=this.A();return e&&this.I.set("Authorization",e),this.P&&this.I.set("X-Goog-Iam-Authorization-Token",this.P),this.I}}class vC{constructor(e,t,r){this.T=e,this.P=t,this.R=r}getToken(){return Promise.resolve(new xC(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(cn.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class u0{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class IC{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,ar(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){ce(this.o===void 0,3512);const r=i=>{i.error!=null&&se("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.m;return this.m=i.token,se("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>r(i)))};const s=i=>{se("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>s(i))),setTimeout((()=>
592{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):se("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new u0(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((t=>t?(ce(typeof t.token=="string",44558,{tokenResult:t}),this.m=t.token,new u0(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
593 * @license
594 * Copyright 2020 Google LLC
595 *
596 * Licensed under the Apache License, Version 2.0 (the "License");
597 * you may not use this file except in compliance with the License.
598 * You may obtain a copy of the License at
599 *
600 *   http://www.apache.org/licenses/LICENSE-2.0
601 *
602 * Unless required by applicable law or agreed to in writing, software
603 * distributed under the License is distributed on an "AS IS" BASIS,
604 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
605 * See the License for the specific language governing permissions and
606 * limitations under the License.
607 */function _C(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<n;r++)t[r]=Math.floor(256*Math.random());return t}/**
608 * @license
609 * Copyright 2017 Google LLC
610 *
611 * Licensed under the Apache License, Version 2.0 (the "License");
612 * you may not use this file except in compliance with the License.
613 * You may obtain a copy of the License at
614 *
615 *   http://www.apache.org/licenses/LICENSE-2.0
616 *
617 * Unless required by applicable law or agreed to in writing, software
618 * distributed under the License is distributed on an "AS IS" BASIS,
619 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620 * See the License for the specific language governing permissions and
621 * limitations under the License.
622 */class O1{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=_C(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%62))}return r}}function De(n,e){return n<e?-1:n>e?1:0}function jp(n,e){const t=Math.min(n.length,e.length);for(let r=0;r<t;r++){const s=n.charAt(r),i=e.charAt(r);if(s!==i)return Am(s)===Am(i)?De(s,i):Am(s)?1:-1}return De(n.length,e.length)}const kC=55296,wC=57343;function Am(n){const e=n.charCodeAt(0);return e>=kC&&e<=wC}function Qa(n,e,t){return n.length===e.length&&n.every(((r,s)=>t(r,e[s])))}function P4(n){return n+"\0"}/**
623 * @license
624 * Copyright 2017 Google LLC
625 *
626 * Licensed under the Apache License, Version 2.0 (the "License");
627 * you may not use this file except in compliance with the License.
628 * You may obtain a copy of the License at
629 *
630 *   http://www.apache.org/licenses/LICENSE-2.0
631 *
632 * Unless required by applicable law or agreed to in writing, software
633 * distributed under the License is distributed on an "AS IS" BASIS,
634 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635 * See the License for the specific language governing permissions and
636 * limitations under the License.
637 */const kr="__name__";class vr{constructor(e,t,r){t===void 0?t=0:t>e.length&&ye(637,{offset:t,range:e.length}),r===void 0?r=e.length-t:r>e.length-t&&ye(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return vr.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof vr?e.forEach((r=>{t.push(r)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let s=0;s<r;s++){const i=vr.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return De(e.length,t.length)}static compareSegments(e,t){const r=vr.isNumericId(e),s=vr.isNumericId(t);return r&&!s?-1:!r&&s?1:r&&s?vr.extractNumericId(e).compare(vr.extractNumericId(t)):jp(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return qs.fromString(e.substring(4,e.length-2))}}class Ke extends vr{construct(e,t,r){return new Ke(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}
637toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new de(J.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter((s=>s.length>0)))}return new Ke(t)}static emptyPath(){return new Ke([])}}const jC=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ft extends vr{construct(e,t,r){return new ft(e,t,r)}static isValidIdentifier(e){return jC.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ft.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===kr}static keyField(){return new ft([kr])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new de(J.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];if(c==="\\"){if(s+1===e.length)throw new de(J.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new de(J.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new de(J.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ft(t)}static emptyPath(){return new ft([])}}/**
638 * @license
639 * Copyright 2017 Google LLC
640 *
641 * Licensed under the Apache License, Version 2.0 (the "License");
642 * you may not use this file except in compliance with the License.
643 * You may obtain a copy of the License at
644 *
645 *   http://www.apache.org/licenses/LICENSE-2.0
646 *
647 * Unless required by applicable law or agreed to in writing, software
648 * distributed under the License is distributed on an "AS IS" BASIS,
649 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
650 * See the License for the specific language governing permissions and
651 * limitations under the License.
652 */class me{constructor(e){this.path=e}static fromPath(e){return new me(Ke.fromString(e))}static fromName(e){return new me(Ke.fromString(e).popFirst(5))}static empty(){return new me(Ke.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Ke.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return Ke.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new me(new Ke(e.slice()))}}/**
653 * @license
654 * Copyright 2017 Google LLC
655 *
656 * Licensed under the Apache License, Version 2.0 (the "License");
657 * you may not use this file except in compliance with the License.
658 * You may obtain a copy of the License at
659 *
660 *   http://www.apache.org/licenses/LICENSE-2.0
661 *
662 * Unless required by applicable law or agreed to in writing, software
663 * distributed under the License is distributed on an "AS IS" BASIS,
664 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
665 * See the License for the specific language governing permissions and
666 * limitations under the License.
667 */function R4(n,e,t){if(!t)throw new de(J.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function TC(n,e,t,r){if(e===!0&&r===!0)throw new de(J.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function h0(n){if(!me.isDocumentKey(n))throw new de(J.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function m0(n){if(me.isDocumentKey(n))throw new de(J.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function vl(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}function th(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=(function(r){return r.constructor?r.constructor.name:null})(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":ye(12329,{type:typeof n})}function Sr(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new de(J.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=th(n);throw new de(J.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}/**
668 * @license
669 * Copyright 2025 Google LLC
670 *
671 * Licensed under the Apache License, Version 2.0 (the "License");
672 * you may not use this file except in compliance with the License.
673 * You may obtain a copy of the License at
674 *
675 *   http://www.apache.org/licenses/LICENSE-2.0
676 *
677 * Unless required by applicable law or agreed to in writing, software
678 * distributed under the License is distributed on an "AS IS" BASIS,
679 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
680 * See the License for the specific language governing permissions and
681 * limitations under the License.
682 */function Lt(n,e){const t={typeString:n};return e&&(t.value=e),t}function Il(n,e){if(!vl(n))throw new de(J.INVALID_ARGUMENT,"JSON must be an object");let t;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in n)){t=`JSON missing required field: '${r}'`;break}const a=n[r];if(s&&typeof a!==s){t=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&a!==i.value){t=`Expected '${r}' field to equal '${i.value}'`;break}}if(t)throw new de(J.INVALID_ARGUMENT,t);return!0}/**
683 * @license
684 * Copyright 2017 Google LLC
685 *
686 * Licensed under the Apache License, Version 2.0 (the "License");
687 * you may not use this file except in compliance with the License.
688 * You may obtain a copy of the License at
689 *
690 *   http://www.apache.org/licenses/LICENSE-2.0
691 *
692 * Unless required by applicable law or agreed to in writing, software
693 * distributed under the License is distributed on an "AS IS" BASIS,
694 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
695 * See the License for the specific language governing permissions and
696 * limitations under the License.
697 */const p0=-62135596800,f0=1e6;class st{static now(){return st.fromMillis(Date.now())}static fromDate(e){return st.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*f0);return new st(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new de(J.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new de(J.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<p0)throw new de(J.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new de(J.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/f0}_compareTo(e){return this.seconds===e.seconds?De(this.nanoseconds,e.nanoseconds):De(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:st._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Il(e,st._jsonSchema))return new st(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-p0;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}st._jsonSchemaVersion="firestore/timestamp/1.0",st._jsonSchema={type:Lt("string",st._jsonSchemaVersion),seconds:Lt("number"),nanoseconds:Lt("number")};/**
698 * @license
699 * Copyright 2017 Google LLC
700 *
701 * Licensed under the Apache License, Version 2.0 (the "License");
702 * you may not use this file except in compliance with the License.
703 * You may obtain a copy of the License at
704 *
705 *   http://www.apache.org/licenses/LICENSE-2.0
706 *
707 * Unless required by applicable law or agreed to in writing, software
708 * distributed under the License is distributed on an "AS IS" BASIS,
709 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
710 * See the License for the specific language governing permissions and
711 * limitations under the License.
712 */class Ne{static fromTimestamp(e){return new Ne(e)}static min(){return new Ne(new st(0,0))}static max(){return new Ne(new st(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
713 * @license
714 * Copyright 2021 Google LLC
715 *
716 * Licensed under the Apache License, Version 2.0 (the "License");
717 * you may not use this file except in compliance with the License.
718 * You may obtain a copy of the License at
719 *
720 *   http://www.apache.org/licenses/LICENSE-2.0
721 *
722 * Unless required by applicable law or agreed to in writing, software
723 * distributed under the License is distributed on an "AS IS" BASIS,
724 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
725 * See the License for the specific language governing permissions and
726 * limitations under the License.
727 */const Za=-1;class nu{constructor(e,t,r,s){this.indexId=e,this.collectionGroup=t,this.fields=r,this.indexState=s}}function Tp(n){return n.fields.find((e=>e.kind===2))}function vi(n){return n.fields.filter((e=>e.kind!==2))}nu.UNKNOWN_ID=-1;class Nd{constructor(e,t){this.fieldPath=e,this.kind=t}}class $c{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new $c(0,Bn.min())}}function O4(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=Ne.fromTimestamp(r===1e9?new st(t+1,0):new st(t,r));return new Bn(s,me.empty(),e)}function D4(n){return new Bn(n.readTime,n.key,Za)}class Bn{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Bn(Ne.min(),me.empty(),Za)}static max(){return new Bn(Ne.max(),me.empty(),Za)}}function D1(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=me.comparator(n.documentKey,e.documentKey),t!==0?t:De(n.largestBatchId,e.largestBatchId))}/**
728 * @license
729 * Copyright 2020 Google LLC
730 *
731 * Licensed under the Apache License, Version 2.0 (the "License");
732 * you may not use this file except in compliance with the License.
733 * You may obtain a copy of the License at
734 *
735 *   http://www.apache.org/licenses/LICENSE-2.0
736 *
737 * Unless required by applicable law or agreed to in writing, software
738 * distributed under the License is distributed on an "AS IS" BASIS,
739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
740 * See the License for the specific language governing permissions and
741 * limitations under the License.
742 */const V4="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class L4{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}/**
743 * @license
744 * Copyright 2017 Google LLC
745 *
746 * Licensed under the Apache License, Version 2.0 (the "License");
747 * you may not use this file except in compliance with the License.
748 * You may obtain a copy of the License at
749 *
750 *   http://www.apache.org/licenses/LICENSE-2.0
751 *
752 * Unless required by applicable law or agreed to in writing, software
753 * distributed under the License is distributed on an "AS IS" BASIS,
754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
755 * See the License for the specific language governing permissions and
756 * limitations under the License.
757 */async function ai(n){if(n.code!==J.FAILED_PRECONDITION||n.message!==V4)throw n;se("LocalStore","Unexpectedly lost primary lease")}/**
758 * @license
759 * Copyright 2017 Google LLC
760 *
761 * Licensed under the Apache License, Version 2.0 (the "License");
762 * you may not use this file except in compliance with the License.
763 * You may obtain a copy of the License at
764 *
765 *   http://www.apache.org/licenses/LICENSE-2.0
766 *
767 * Unless required by applicable law or agreed to in writing, software
768 * distributed under the License is distributed on an "AS IS" BASIS,
769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
770 * See the License for the specific language governing permissions and
771 * limitations under the License.
772 */class F{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&ye(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new F(((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(r,s)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof F?t:F.resolve(t)}catch(t){return F.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):F.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):F.reject(t)}static resolve(e){return new F(((t,r)=>{t(e)}))}static reject(e){return new F(((t,r)=>{r(e)}))}static waitFor(e){return new F(((t,r)=>{let s=0,i=0,a=!1;e.forEach((c=>{++s,c.next((()=>{++i,a&&i===s&&t()}),(l=>r(l)))})),a=!0,i===s&&t()}))}static or(e){let t=F.resolve(!1);for(const r of e)t=t.next((s=>s?F.resolve(s):r()));return t}static forEach(e,t){const r=[];return e.forEach(((s,i)=>{r.push(t.call(this,s,i))})),this.waitFor(r)}static mapArray(e,t){return new F(((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next((m=>{a[d]=m,++c,c===i&&r(a)}),(m=>s(m)))}}))}static doWhile(e,t){return new F(((r,s)=>{const i=()=>{e()===!0?t().next((()=>{i()}),s):r()};i()}))}}/**
773 * @license
774 * Copyright 2017 Google LLC
775 *
776 * Licensed under the Apache License, Version 2.0 (the "License");
777 * you may not use this file except in compliance with the License.
778 * You may obtain a copy of the License at
779 *
780 *   http://www.apache.org/licenses/LICENSE-2.0
781 *
782 * Unless required by applicable law or agreed to in writing, software
783 * distributed under the License is distributed on an "AS IS" BASIS,
784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
785 * See the License for the specific language governing permissions and
786 * limitations under the License.
787 */const zn="SimpleDb";class nh{static open(e,t,r,s){try{return new nh(t,e.transaction(s,r))}catch(i){throw new kc(t,i)}}constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.v=new Nr,this.transaction.oncomplete=()=>{this.v.resolve()},this.transaction.onabort=()=>{t.error?this.v.reject(new kc(e,t.error)):this.v.resolve()},this.transaction.onerror=r=>{const s=V1(r.target.error);this.v.reject(new kc(e,s))}}get S(){return this.v.promise}abort(e){e&&this.v.reject(e),this.aborted||(se(zn,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}D(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const t=this.transaction.objectStore(e);return new NC(t)}}class zs{static delete(e){return se(zn,"Removing database:",e),ki(m4().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!x4())return!1;if(zs.F())return!0;const e=$t(),t=zs.O(e),r=0<t&&t<10,s=q4(e),i=0<s&&s<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||i)}static F(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)==null?void 0:e.__PRIVATE_USE_MOCK_PERSISTENCE)==="YES"}static M(e,t){return e.store(t)}static O(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(r)}constructor(e,t,r){this.name=e,this.version=t,this.N=r,this.L=null,zs.O($t())===12.2&&Rt("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async B(e){return this.db||(se(zn,"Opening database:",this.name),this.db=await new Promise(((t,r)=>{const s=indexedDB.open(this.name,this.version);s.onsuccess=i=>{const a=i.target.result;t(a)},s.onblocked=()=>{r(new kc(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},s.onerror=i=>{const a=i.target.error;a.name==="VersionError"?r(new de(J.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):a.name==="InvalidStateError"?r(new de(J.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+a)):r(new kc(e,a))},s.onupgradeneeded=i=>{se(zn,'Database "'+this.name+'" requires upgrade from version:',i.oldVersion);const a=i.target.result;this.N.U(a,s.transaction,i.oldVersion,this.version).next((()=>{se(zn,"Database upgrade to version "+this.version+" complete")}))}}))),this.k&&(this.db.onversionchange=t=>this.k(t)),this.db}q(e){this.k=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,r,s){const i=t==="readonly";let a=0;for(;;){++a;try{this.db=await this.B(e);const c=nh.open(this.db,e,i?"readonly":"readwrite",r),l=s(c).next((d=>(c.D(),d))).catch((d=>(c.abort(d),F.reject(d)))).toPromise();return l.catch((()=>{})),await c.S,l}catch(c){const l=c,d=l.name!=="FirebaseError"&&a<3;if(se(zn,"Transaction failed with error:",l.message,"Retrying:",d),this.close(),!d)return Promise.reject(l)}}}close(){this.db&&this.db.close(),this.db=void 0}}function q4(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}class EC{constructor(e){this.$=e,this.K=!1,this.W=null}get isDone(){return this.K}get G(){return this.W}set cursor(e){this.$=e}done(){this.K=!0}j(e){this.W=e}delete(){return ki(this.$.delete())}}class kc extends de{constructor(e,t){super(J.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${t}`),this.name="IndexedDbTransactionError"}}function oi(n){return n.name==="IndexedDbTransactionError"}class NC{constructor(e){this.store=e}put(e,t){let r;return t!==void 0?(se(zn,"PUT",this.store.name,e,t),r=this.store.put(t,e)):(se(zn,"PUT",this.store.name,"<auto-key>",e),r=this.store.put(e)),ki(r)}add(e){return se(zn,"ADD",this.store.name,e,e),ki(this.store.add(e))}get(e){return ki(this.store.get(e)).next((t=>(t===void 0&&(t=null),se(zn,"GET",this.store.name,e,t),t)))}
787delete(e){return se(zn,"DELETE",this.store.name,e),ki(this.store.delete(e))}count(){return se(zn,"COUNT",this.store.name),ki(this.store.count())}H(e,t){const r=this.options(e,t),s=r.index?this.store.index(r.index):this.store;if(typeof s.getAll=="function"){const i=s.getAll(r.range);return new F(((a,c)=>{i.onerror=l=>{c(l.target.error)},i.onsuccess=l=>{a(l.target.result)}}))}{const i=this.cursor(r),a=[];return this.J(i,((c,l)=>{a.push(l)})).next((()=>a))}}Y(e,t){const r=this.store.getAll(e,t===null?void 0:t);return new F(((s,i)=>{r.onerror=a=>{i(a.target.error)},r.onsuccess=a=>{s(a.target.result)}}))}Z(e,t){se(zn,"DELETE ALL",this.store.name);const r=this.options(e,t);r.X=!1;const s=this.cursor(r);return this.J(s,((i,a,c)=>c.delete()))}ee(e,t){let r;t?r=e:(r={},t=e);const s=this.cursor(r);return this.J(s,t)}te(e){const t=this.cursor({});return new F(((r,s)=>{t.onerror=i=>{const a=V1(i.target.error);s(a)},t.onsuccess=i=>{const a=i.target.result;a?e(a.primaryKey,a.value).next((c=>{c?a.continue():r()})):r()}}))}J(e,t){const r=[];return new F(((s,i)=>{e.onerror=a=>{i(a.target.error)},e.onsuccess=a=>{const c=a.target.result;if(!c)return void s();const l=new EC(c),d=t(c.primaryKey,c.value,l);if(d instanceof F){const m=d.catch((p=>(l.done(),F.reject(p))));r.push(m)}l.isDone?s():l.G===null?c.continue():c.continue(l.G)}})).next((()=>F.waitFor(r)))}options(e,t){let r;return e!==void 0&&(typeof e=="string"?r=e:t=e),{index:r,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const r=this.store.index(e.index);return e.X?r.openKeyCursor(e.range,t):r.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function ki(n){return new F(((e,t)=>{n.onsuccess=r=>{const s=r.target.result;e(s)},n.onerror=r=>{const s=V1(r.target.error);t(s)}}))}let g0=!1;function V1(n){const e=zs.O($t());if(e>=12.2&&e<13){const t="An internal error was encountered in the Indexed Database server";if(n.message.indexOf(t)>=0){const r=new de("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return g0||(g0=!0,setTimeout((()=>{throw r}),0)),r}}return n}const wc="IndexBackfiller";class SC{constructor(e,t){this.asyncQueue=e,this.ne=t,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}re(e){se(wc,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,(async()=>{this.task=null;try{const t=await this.ne.ie();se(wc,`Documents written: ${t}`)}catch(t){oi(t)?se(wc,"Ignoring IndexedDB error during index backfill: ",t):await ai(t)}await this.re(6e4)}))}}class AC{constructor(e,t){this.localStore=e,this.persistence=t}async ie(e=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",(t=>this.se(t,e)))}se(e,t){const r=new Set;let s=t,i=!0;return F.doWhile((()=>i===!0&&s>0),(()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next((a=>{if(a!==null&&!r.has(a))return se(wc,`Processing collection: ${a}`),this._e(e,a,s).next((c=>{s-=c,r.add(a)}));i=!1})))).next((()=>t-s))}_e(e,t,r){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,t).next((s=>this.localStore.localDocuments.getNextDocuments(e,t,s,r).next((i=>{const a=i.changes;return this.localStore.indexManager.updateIndexEntries(e,a).next((()=>this.oe(s,i))).next((c=>(se(wc,`Updating offset: ${c}`),this.localStore.indexManager.updateCollectionGroup(e,t,c)))).next((()=>a.size))}))))}oe(e,t){let r=e;
787return t.changes.forEach(((s,i)=>{const a=D4(i);D1(a,r)>0&&(r=a)})),new Bn(r.readTime,r.documentKey,Math.max(t.batchId,e.largestBatchId))}}/**
788 * @license
789 * Copyright 2018 Google LLC
790 *
791 * Licensed under the Apache License, Version 2.0 (the "License");
792 * you may not use this file except in compliance with the License.
793 * You may obtain a copy of the License at
794 *
795 *   http://www.apache.org/licenses/LICENSE-2.0
796 *
797 * Unless required by applicable law or agreed to in writing, software
798 * distributed under the License is distributed on an "AS IS" BASIS,
799 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
800 * See the License for the specific language governing permissions and
801 * limitations under the License.
802 */class Nn{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>t.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Nn.ce=-1;/**
803 * @license
804 * Copyright 2017 Google LLC
805 *
806 * Licensed under the Apache License, Version 2.0 (the "License");
807 * you may not use this file except in compliance with the License.
808 * You may obtain a copy of the License at
809 *
810 *   http://www.apache.org/licenses/LICENSE-2.0
811 *
812 * Unless required by applicable law or agreed to in writing, software
813 * distributed under the License is distributed on an "AS IS" BASIS,
814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
815 * See the License for the specific language governing permissions and
816 * limitations under the License.
817 */const Ai=-1;function rh(n){return n==null}function Ja(n){return n===0&&1/n==-1/0}function z4(n){return typeof n=="number"&&Number.isInteger(n)&&!Ja(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}function CC(n){return typeof n=="string"}/**
818 * @license
819 * Copyright 2017 Google LLC
820 *
821 * Licensed under the Apache License, Version 2.0 (the "License");
822 * you may not use this file except in compliance with the License.
823 * You may obtain a copy of the License at
824 *
825 *   http://www.apache.org/licenses/LICENSE-2.0
826 *
827 * Unless required by applicable law or agreed to in writing, software
828 * distributed under the License is distributed on an "AS IS" BASIS,
829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830 * See the License for the specific language governing permissions and
831 * limitations under the License.
832 */const ru="�";function hn(n){let e="";for(let t=0;t<n.length;t++)e.length>0&&(e=y0(e)),e=MC(n.get(t),e);return y0(e)}function MC(n,e){let t=e;const r=n.length;for(let s=0;s<r;s++){const i=n.charAt(s);switch(i){case"\0":t+="��";break;case ru:t+="��";break;default:t+=i}}return t}function y0(n){return n+ru+"�"}function wr(n){const e=n.length;if(ce(e>=2,64408,{path:n}),e===2)return ce(n.charAt(0)===ru&&n.charAt(1)==="�",56145,{path:n}),Ke.emptyPath();const t=e-2,r=[];let s="";for(let i=0;i<e;){const a=n.indexOf(ru,i);switch((a<0||a>t)&&ye(50515,{path:n}),n.charAt(a+1)){case"�":const c=n.substring(i,a);let l;s.length===0?l=c:(s+=c,l=s,s=""),r.push(l);break;case"�":s+=n.substring(i,a),s+="\0";break;case"�":s+=n.substring(i,a+1);break;default:ye(61167,{path:n})}i=a+2}return new Ke(r)}/**
833 * @license
834 * Copyright 2022 Google LLC
835 *
836 * Licensed under the Apache License, Version 2.0 (the "License");
837 * you may not use this file except in compliance with the License.
838 * You may obtain a copy of the License at
839 *
840 *   http://www.apache.org/licenses/LICENSE-2.0
841 *
842 * Unless required by applicable law or agreed to in writing, software
843 * distributed under the License is distributed on an "AS IS" BASIS,
844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
845 * See the License for the specific language governing permissions and
846 * limitations under the License.
847 */const Ii="remoteDocuments",_l="owner",ba="owner",Bc="mutation
847Queues",PC="userId",sr="mutations",b0="batchId",Ni="userMutationsIndex",x0=["userId","batchId"];/**
848 * @license
849 * Copyright 2022 Google LLC
850 *
851 * Licensed under the Apache License, Version 2.0 (the "License");
852 * you may not use this file except in compliance with the License.
853 * You may obtain a copy of the License at
854 *
855 *   http://www.apache.org/licenses/LICENSE-2.0
856 *
857 * Unless required by applicable law or agreed to in writing, software
858 * distributed under the License is distributed on an "AS IS" BASIS,
859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
860 * See the License for the specific language governing permissions and
861 * limitations under the License.
862 */function Sd(n,e){return[n,hn(e)]}function F4(n,e,t){return[n,hn(e),t]}const RC={},Xa="documentMutations",su="remoteDocumentsV14",OC=["prefixPath","collectionGroup","readTime","documentId"],Ad="documentKeyIndex",DC=["prefixPath","collectionGroup","documentId"],$4="collectionGroupIndex",VC=["collectionGroup","readTime","prefixPath","documentId"],Uc="remoteDocumentGlobal",Ep="remoteDocumentGlobalKey",eo="targets",B4="queryTargetsIndex",LC=["canonicalId","targetId"],to="targetDocuments",qC=["targetId","path"],L1="documentTargetsIndex",zC=["path","targetId"],iu="targetGlobalKey",Ci="targetGlobal",Gc="collectionParents",FC=["collectionId","parent"],no="clientMetadata",$C="clientId",sh="bundles",BC="bundleId",ih="namedQueries",UC="name",q1="indexConfiguration",GC="indexId",Np="collectionGroupIndex",KC="collectionGroup",jc="indexState",HC=["indexId","uid"],U4="sequenceNumberIndex",WC=["uid","sequenceNumber"],Tc="indexEntries",YC=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],G4="documentKeyIndex",QC=["indexId","uid","orderedDocumentKey"],ah="documentOverlays",ZC=["userId","collectionPath","documentId"],Sp="collectionPathOverlayIndex",JC=["userId","collectionPath","largestBatchId"],K4="collectionGroupOverlayIndex",XC=["userId","collectionGroup","largestBatchId"],z1="globals",eM="name",H4=[Bc,sr,Xa,Ii,eo,_l,Ci,to,no,Uc,Gc,sh,ih],tM=[...H4,ah],W4=[Bc,sr,Xa,su,eo,_l,Ci,to,no,Uc,Gc,sh,ih,ah],Y4=W4,F1=[...Y4,q1,jc,Tc],nM=F1,Q4=[...F1,z1],rM=Q4;/**
863 * @license
864 * Copyright 2020 Google LLC
865 *
866 * Licensed under the Apache License, Version 2.0 (the "License");
867 * you may not use this file except in compliance with the License.
868 * You may obtain a copy of the License at
869 *
870 *   http://www.apache.org/licenses/LICENSE-2.0
871 *
872 * Unless required by applicable law or agreed to in writing, software
873 * distributed under the License is distributed on an "AS IS" BASIS,
874 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
875 * See the License for the specific language governing permissions and
876 * limitations under the License.
877 */class Ap extends L4{constructor(e,t){super(),this.le=e,this.currentSequenceNumber=t}}function Bt(n,e){const t=_e(n);return zs.M(t.le,e)}/**
878 * @license
879 * Copyright 2017 Google LLC
880 *
881 * Licensed under the Apache License, Version 2.0 (the "License");
882 * you may not use this file except in compliance with the License.
883 * You may obtain a copy of the License at
884 *
885 *   http://www.apache.org/licenses/LICENSE-2.0
886 *
887 * Unless required by applicable law or agreed to in writing, software
888 * distributed under the License is distributed on an "AS IS" BASIS,
889 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
890 * See the License for the specific language governing permissions and
891 * limitations under the License.
892 */class ut{constructor(e,t){this.comparator=e,this.root=t||Qt.EMPTY}insert(e,t){return new ut(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Qt.BLACK,null,null))}remove(e){return new ut(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Qt.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return t+r.left.size;s<0?r=r.left:(t+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,r)=>(e(t,r),!1)))}toString(){const e=[];return this.inorderTraversal(((t,r)=>(e.push(`${t}:${r}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new hd(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new hd(this.root,e,this.comparator,!1)}getReverseIterator(){return new hd(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new hd(this.root,e,this.comparator,!0)}}class hd{constructor(e,t,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Qt{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??Qt.RED,this.left=s??Qt.EMPTY,this.right=i??Qt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new Qt(e??this.key,t??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,r),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return Qt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let r,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.
vendor: 4,269 bytes, lines 892-911
892key)===0){if(s.right.isEmpty())return Qt.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Qt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Qt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ye(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ye(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw ye(27949);return e+(this.isRed()?0:1)}}Qt.EMPTY=null,Qt.RED=!0,Qt.BLACK=!1;Qt.EMPTY=new class{constructor(){this.size=0}get key(){throw ye(57766)}get value(){throw ye(16141)}get color(){throw ye(16727)}get left(){throw ye(29726)}get right(){throw ye(36894)}copy(e,t,r,s,i){return this}insert(e,t,r){return new Qt(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
893 * @license
894 * Copyright 2017 Google LLC
895 *
896 * Licensed under the Apache License, Version 2.0 (the "License");
897 * you may not use this file except in compliance with the License.
898 * You may obtain a copy of the License at
899 *
900 *   http://www.apache.org/licenses/LICENSE-2.0
901 *
902 * Unless required by applicable law or agreed to in writing, software
903 * distributed under the License is distributed on an "AS IS" BASIS,
904 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
905 * See the License for the specific language governing permissions and
906 * limitations under the License.
907 */class rt{constructor(e){this.comparator=e,this.data=new ut(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,r)=>(e(t),!1)))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new v0(this.data.getIterator())}getIteratorFrom(e){return new v0(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((r=>{t=t.add(r)})),t}isEqual(e){if(!(e instanceof rt)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new rt(this.comparator);return t.data=e,t}}class v0{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function xa(n){return n.hasNext()?n.getNext():void 0}/**
908 * @license
909 * Copyright 2020 Google LLC
910 *
911 * Licensed under the Apache License, Version 2.0 (the "License");
912 * you may not use this file except in compliance with the License.
913 * You may obtain a copy of the License at
914 *
915 *   http://www.apache.org/licenses/LICENSE-2.0
916 *
917 * Unless required by applicable law or agreed to in writing, software
918 * distributed under the License is distributed on an "AS IS" BASIS,
919 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
920 * See the License for the specific language governing permissions and
921 * limitations under the License.
922 */class Qn{constructor(e){this.fields=e,e.sort(ft.comparator)}static empty(){return new Qn([])}unionWith(e){let t=new rt(ft.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Qn(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Qa(this.fields,e.fields,((t,r)=>t.isEqual(r)))}}/**
923 * @license
924 * Copyright 2017 Google LLC
925 *
926 * Licensed under the Apache License, Version 2.0 (the "License");
927 * you may not use this file except in compliance with the License.
928 * You may obtain a copy of the License at
929 *
930 *   http://www.apache.org/licenses/LICENSE-2.0
931 *
932 * Unless required by applicable law or agreed to in writing, software
933 * distributed under the License is distributed on an "AS IS" BASIS,
934 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
935 * See the License for the specific language governing permissions and
936 * limitations under the License.
937 */function au(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function na(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function sM(n,e){const t=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.push(e(n[r],r,n));return t}function Z4(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
938 * @license
939 * Copyright 2023 Google LLC
940 *
941 * Licensed under the Apache License, Version 2.0 (the "License");
942 * you may not use this file except in compliance with the License.
943 * You may obtain a copy of the License at
944 *
945 *   http://www.apache.org/licenses/LICENSE-2.0
946 *
947 * Unless required by applicable law or agreed to in writing, software
948 * distributed under the License is distributed on an "AS IS" BASIS,
949 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
950 * See the License for the specific language governing permissions and
951 * limitations under the License.
952 */class J4 extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
953 * @license
954 * Copyright 2020 Google LLC
955 *
956 * Licensed under the Apache License, Version 2.0 (the "License");
957 * you may not use this file except in compliance with the License.
958 * You may obtain a copy of the License at
959 *
960 *   http://www.apache.org/licenses/LICENSE-2.0
961 *
962 * Unless required by applicable law or agreed to in writing, software
963 * distributed under the License is distributed on an "AS IS" BASIS,
964 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
965 * See the License for the specific language governing permissions and
966 * limitations under the License.
967 */class vt{constructor(e){this.binaryString=e}static fromBase64String(e){const t=(function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new J4("Invalid base64 string: "+i):i}})(e);return new vt(t)}static fromUint8Array(e){const t=(function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i})(e);return new vt(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(t){return btoa(t)})(this.binaryString)}toUint8Array(){return(function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return De(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}vt.EMPTY_BYTE_STRING=new vt("");const iM=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function es(n){if(ce(!!n,39018),typeof n=="string"){let e=0;const t=iM.exec(n);if(ce(!!t,46558,{timestamp:n}),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:ht(n.seconds),nanos:ht(n.nanos)}}function ht(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function ts(n){return typeof n=="string"?vt.fromBase64String(n):vt.fromUint8Array(n)}/**
968 * @license
969 * Copyright 2020 Google LLC
970 *
971 * Licensed under the Apache License, Version 2.0 (the "License");
972 * you may not use this file except in compliance with the License.
973 * You may obtain a copy of the License at
974 *
975 *   http://www.apache.org/licenses/LICENSE-2.0
976 *
977 * Unless required by applicable law or agreed to in writing, software
978 * distributed under the License is distributed on an "AS IS" BASIS,
979 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
980 * See the License for the specific language governing permissions and
981 * limitations under the License.
982 */const X4="server_timestamp",ev="__type__",tv="__previous_value__",nv="__local_write_time__";function oh(n){var t,r;return((r=(((t=n==null?void 0:n.mapValue)==null?void 0:t.fields)||{})[ev])==null?void 0:r.stringValue)===X4}function kl(n){const e=n.mapValue.fields[tv];return oh(e)?kl(e):e}function ro(n){const e=es(n.mapValue.fields[nv].timestampValue);return new st(e.seconds,e.nanos)}/**
983 * @license
984 * Copyright 2017 Google LLC
985 *
986 * Licensed under the Apache License, Version 2.0 (the "License");
987 * you may not use this file except in compliance with the License.
988 * You may obtain a copy of the License at
989 *
990 *   http://www.apache.org/licenses/LICENSE-2.0
991 *
992 * Unless required by applicable law or agreed to in writing, software
993 * distributed under the License is distributed on an "AS IS" BASIS,
994 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
995 * See the License for the specific language governing permissions and
996 * limitations under the License.
997 */class aM{constructor(e,t,r,s,i,a,c,l,d,m,p){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d,this.isUsingEmulator=m,this.apiKey=p}}const ou="(default)";class zi{constructor(e,t){this.projectId=e,this.database=t||ou}static empty(){return new zi("","")}get isDefaultDatabase(){return this.database===ou}isEqual(e){return e instanceof zi&&e.projectId===this.projectId&&e.database===this.database}}function oM(n,e){if(!Object.prototype.hasOwnProperty.apply(n.options,["projectId"]))throw new de(J.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new zi(n.options.projectId,e)}/**
998 * @license
999 * Copyright 2020 Google LLC
1000 *
1001 * Licensed under the Apache License, Version 2.0 (the "License");
1002 * you may not use this file except in compliance with the License.
1003 * You may obtain a copy of the License at
1004 *
1005 *   http://www.apache.org/licenses/LICENSE-2.0
1006 *
1007 * Unless required by applicable law or agreed to in writing, software
1008 * distributed under the License is distributed on an "AS IS" BASIS,
1009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010 * See the License for the specific language governing permissions and
1011 * limitations under the License.
1012 */const $1="__type__",rv="__max__",Rs={mapValue:{fields:{__type__:{stringValue:rv}}}},B1="__vector__",Fi="value",Ar={nullValue:"NULL_VALUE"},Mn={booleanValue:!0},Kt={booleanValue:!1};function qt(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?oh(n)?4:sv(n)?9007199254740991:$i(n)?10:11:ye(28295,{value:n})}function Jn(n,e,t){if(n===e)return!0;const r=qt(n);if(r!==qt(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return ro(n).isEqual(ro(e));case 3:return(function(i,a){if(typeof i.timestampValue=="string"&&typeof a.timestampValue=="string"&&i.timestampValue.length===a.timestampValue.length)return i.timestampValue===a.timestampValue;const c=es(i.timestampValue),l=es(a.timestampValue);return c.seconds===l.seconds&&c.nanos===l.nanos})(n,e);case 5:return n.stringValue===e.stringValue;case 6:return(function(i,a){return ts(i.bytesValue).isEqual(ts(a.bytesValue))})(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return(function(i,a){return ht(i.geoPointValue.latitude)===ht(a.geoPointValue.latitude)&&ht(i.geoPointValue.longitude)===ht(a.geoPointValue.longitude)})(n,e);case 2:return(function(i,a,c){if("integerValue"in i&&"integerValue"in a)return ht(i.integerValue)===
1012ht(a.integerValue);let l,d;if("doubleValue"in i&&"doubleValue"in a)l=ht(i.doubleValue),d=ht(a.doubleValue);else{if(!(c!=null&&c.Ee))return!1;l=ht(i.integerValue??i.doubleValue),d=ht(a.integerValue??a.doubleValue)}return l===d?!!(c!=null&&c.he)||Ja(l)===Ja(d):!!(c===void 0||c.Te)&&isNaN(l)&&isNaN(d)})(n,e,t);case 9:return Qa(n.arrayValue.values||[],e.arrayValue.values||[],((s,i)=>Jn(s,i,t)));case 10:case 11:return(function(i,a,c){const l=i.mapValue.fields||{},d=a.mapValue.fields||{};if(au(l)!==au(d))return!1;for(const m in l)if(l.hasOwnProperty(m)&&(d[m]===void 0||!Jn(l[m],d[m],c)))return!1;return!0})(n,e,t);default:return ye(52216,{left:n})}}function Kc(n,e){return(n.values||[]).find((t=>Jn(t,e)))!==void 0}function fn(n,e){if(n===e)return 0;const t=qt(n),r=qt(e);if(t!==r)return De(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return De(n.booleanValue,e.booleanValue);case 2:return(function(i,a){const c=ht(i.integerValue||i.doubleValue),l=ht(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1})(n,e);case 3:return I0(n.timestampValue,e.timestampValue);case 4:return I0(ro(n),ro(e));case 5:return jp(n.stringValue,e.stringValue);case 6:return(function(i,a){const c=ts(i),l=ts(a);return c.compareTo(l)})(n.bytesValue,e.bytesValue);case 7:return(function(i,a){const c=i.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const m=De(c[d],l[d]);if(m!==0)return m}return De(c.length,l.length)})(n.referenceValue,e.referenceValue);case 8:return(function(i,a){const c=De(ht(i.latitude),ht(a.latitude));return c!==0?c:De(ht(i.longitude),ht(a.longitude))})(n.geoPointValue,e.geoPointValue);case 9:return _0(n.arrayValue,e.arrayValue);case 10:return(function(i,a){var f,g,x,b;const c=i.fields||{},l=a.fields||{},d=(f=c[Fi])==null?void 0:f.arrayValue,m=(g=l[Fi])==null?void 0:g.arrayValue,p=De(((x=d==null?void 0:d.values)==null?void 0:x.length)||0,((b=m==null?void 0:m.values)==null?void 0:b.length)||0);return p!==0?p:_0(d,m)})(n.mapValue,e.mapValue);case 11:return(function(i,a){if(i===Rs.mapValue&&a===Rs.mapValue)return 0;if(i===Rs.mapValue)return 1;if(a===Rs.mapValue)return-1;const c=i.fields||{},l=Object.keys(c),d=a.fields||{},m=Object.keys(d);l.sort(),m.sort();for(let p=0;p<l.length&&p<m.length;++p){const f=jp(l[p],m[p]);if(f!==0)return f;const g=fn(c[l[p]],d[m[p]]);if(g!==0)return g}return De(l.length,m.length)})(n.mapValue,e.mapValue);default:throw ye(23264,{Pe:t})}}function I0(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return De(n,e);const t=es(n),r=es(e),s=De(t.seconds,r.seconds);return s!==0?s:De(t.nanos,r.nanos)}function _0(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=fn(t[s],r[s]);if(i!==void 0&&i!==0)return i}return De(t.length,r.length)}function so(n){return Cp(n)}function Cp(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?(function(t){const r=es(t);return`time(${r.seconds},${r.nanos})`})(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?(function(t){return ts(t).toBase64()})(n.bytesValue):"referenceValue"in n?(function(t){return me.fromName(t).toString()})(n.referenceValue):"geoPointValue"in n?(function(t){return`geo(${t.latitude},${t.longitude})`})(n.geoPointValue):"arrayValue"in n?(function(t){let r="[",s=!0;for(const i of t.values||[])s?s=!1:r+=",",r+=Cp(i);return r+"]"})(n.arrayValue):"mapValue"in n?(function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${Cp(t.fields[a])}`;return s+"}"})(n.mapValue):ye(61005,{value:n})}function Cd(n){switch(qt(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=kl(n);return e?16+Cd(e):16;case 5:return 2*n.stringValue.length;case 6:return ts(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return(function(r){return(r.values||[]).reduce(((s,i)=>s+Cd(i)),0)})(n.arrayValue);case 10:case 11:return(function(r){let s=0;return na(r.fields,((i,a)=>{s+=i.length+Cd(a)})),s})(n.mapValue);default:throw ye(13486,{value:n})}}function Hc(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function jr(n){return!!n&&"integerValue"in n}function Si(n){return!!n&&"doubleValue"in n}function Ws(n){return jr(n)||Si(n)}function Ys(n){return!!n&&"arrayValue"in n}function Fn(n){return!!n&&"nullValue"in n}function Pn(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Mi(n){return!!n&&"mapValue"in n}function $i(n){var t,r;return((r=(((t=n==null?void 0:n.mapValue)==null?void 0:t.fields)||{})[$1])==null?void 0:r.stringValue)===B1}function Mp(n){var e,t;return(t=(((e=n==null?void 0:n.mapValue)==null?void 0:e.fields)||{})[Fi])==null?void 0:t.arrayValue}function Ec(n){if(n.geoPointValue)return{geoPointValue:{...n.geoPointValue}};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:{...n.timestampValue}};if(n.mapValue){const e={mapValue:{fields:{}}};return na(n.mapValue.fields,((t,r)=>e.mapValue.fields[t]=Ec(r))),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Ec(n.arrayValue.values[t]);return e}return{...n}}function sv(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===rv}const iv={mapValue:{fields:{[$1]:{stringValue:B1},[Fi]:{arrayValue:{}}}}};function cM(n){return"nullValue"in n?Ar:"booleanValue"in n?{booleanValue:!1}:"integerValue"in n||"doubleValue"in n?{doubleValue:NaN}:"timestampValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in n?{stringValue:""}
vendor: 2,809 bytes, lines 1012-1027
1012:"bytesValue"in n?{bytesValue:""}:"referenceValue"in n?Hc(zi.empty(),me.empty()):"geoPointValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in n?{arrayValue:{}}:"mapValue"in n?$i(n)?iv:{mapValue:{}}:ye(35942,{value:n})}function lM(n){return"nullValue"in n?{booleanValue:!1}:"booleanValue"in n?{doubleValue:NaN}:"integerValue"in n||"doubleValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in n?{stringValue:""}:"stringValue"in n?{bytesValue:""}:"bytesValue"in n?Hc(zi.empty(),me.empty()):"referenceValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in n?{arrayValue:{}}:"arrayValue"in n?iv:"mapValue"in n?$i(n)?{mapValue:{}}:Rs:ye(61959,{value:n})}function k0(n,e){const t=fn(n.value,e.value);return t!==0?t:n.inclusive&&!e.inclusive?-1:!n.inclusive&&e.inclusive?1:0}function w0(n,e){const t=fn(n.value,e.value);return t!==0?t:n.inclusive&&!e.inclusive?1:!n.inclusive&&e.inclusive?-1:0}/**
1013 * @license
1014 * Copyright 2017 Google LLC
1015 *
1016 * Licensed under the Apache License, Version 2.0 (the "License");
1017 * you may not use this file except in compliance with the License.
1018 * You may obtain a copy of the License at
1019 *
1020 *   http://www.apache.org/licenses/LICENSE-2.0
1021 *
1022 * Unless required by applicable law or agreed to in writing, software
1023 * distributed under the License is distributed on an "AS IS" BASIS,
1024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1025 * See the License for the specific language governing permissions and
1026 * limitations under the License.
1027 */class _n{constructor(e){this.value=e}static empty(){return new _n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!Mi(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ec(t)}setAll(e){let t=ft.emptyPath(),r={},s=[];e.forEach(((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=c.popLast()}a?r[c.lastSegment()]=Ec(a):s.push(c.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());Mi(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Jn(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=t.mapValue.fields[e.get(r)];Mi(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){na(t,((s,i)=>e[s]=i));for(const s of r)delete e[s]}clone(){return new _n(Ec(this.value))}}function av(n){const e=[];return na(n.fields,((t,r)=>{const s=new ft([t]);if(Mi(r)){const i=av(r.mapValue).fields;
1027if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)})),new Qn(e)}/**
1028 * @license
1029 * Copyright 2020 Google LLC
1030 *
1031 * Licensed under the Apache License, Version 2.0 (the "License");
1032 * you may not use this file except in compliance with the License.
1033 * You may obtain a copy of the License at
1034 *
1035 *   http://www.apache.org/licenses/LICENSE-2.0
1036 *
1037 * Unless required by applicable law or agreed to in writing, software
1038 * distributed under the License is distributed on an "AS IS" BASIS,
1039 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1040 * See the License for the specific language governing permissions and
1041 * limitations under the License.
1042 */function ch(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ja(e)?"-0":e}}function U1(n){return{integerValue:""+n}}function G1(n,e,t){return Number.isInteger(e)&&(t!=null&&t.preferIntegers)||z4(e)?U1(e):ch(n,e)}/**
1043 * @license
1044 * Copyright 2018 Google LLC
1045 *
1046 * Licensed under the Apache License, Version 2.0 (the "License");
1047 * you may not use this file except in compliance with the License.
1048 * You may obtain a copy of the License at
1049 *
1050 *   http://www.apache.org/licenses/LICENSE-2.0
1051 *
1052 * Unless required by applicable law or agreed to in writing, software
1053 * distributed under the License is distributed on an "AS IS" BASIS,
1054 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1055 * See the License for the specific language governing permissions and
1056 * limitations under the License.
1057 */class lh{constructor(){this._=void 0}}function dM(n,e,t){return n instanceof Wc?(function(s,i){const a={fields:{[ev]:{stringValue:X4},[nv]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&oh(i)&&(i=kl(i)),i&&(a.fields[tv]=i),{mapValue:a}})(t,e):n instanceof Bi?cv(n,e):n instanceof Ui?lv(n,e):n instanceof io?(function(s,i){const a=ov(s,i),c=cu(a)+cu(s.Re);return jr(a)&&jr(s.Re)?U1(c):ch(s.serializer,c)})(n,e):n instanceof Yc?(function(s,i){return j0(s,i,Math.min)})(n,e):n instanceof Qc?(function(s,i){return j0(s,i,Math.max)})(n,e):void 0}function uM(n,e,t){return n instanceof Bi?cv(n,e):n instanceof Ui?lv(n,e):t}function ov(n,e){return n instanceof io?Ws(e)?e:{integerValue:0}:null}class Wc extends lh{}class Bi extends lh{constructor(e){super(),this.elements=e}}function cv(n,e){const t=dv(e);for(const r of n.elements)t.some((s=>Jn(s,r)))||t.push(r);return{arrayValue:{values:t}}}class Ui extends lh{constructor(e){super(),this.elements=e}}function lv(n,e){let t=dv(e);for(const r of n.elements)t=t.filter((s=>!Jn(s,r)));return{arrayValue:{values:t}}}class K1 extends lh{constructor(e,t){super(),this.serializer=e,this.Re=t}}class io extends K1{}class Yc extends K1{}class Qc extends K1{}function j0(n,e,t){if(!Ws(e))return n.Re;const r=t(cu(e),cu(n.Re));return jr(e)&&jr(n.Re)?U1(r):ch(n.serializer,r)}function cu(n){return ht(n.integerValue||n.doubleValue)}function dv(n){return Ys(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}/**
1058 * @license
1059 * Copyright 2017 Google LLC
1060 *
1061 * Licensed under the Apache License, Version 2.0 (the "License");
1062 * you may not use this file except in compliance with the License.
1063 * You may obtain a copy of the License at
1064 *
1065 *   http://www.apache.org/licenses/LICENSE-2.0
1066 *
1067 * Unless required by applicable law or agreed to in writing, software
1068 * distributed under the License is distributed on an "AS IS" BASIS,
1069 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070 * See the License for the specific language governing permissions and
1071 * limitations under the License.
1072 */class H1{constructor(e,t){this.field=e,this.transform=t}}function hM(n,e){return n.field.isEqual(e.field)&&(function(r,s){return r instanceof Bi&&s instanceof Bi||r instanceof Ui&&s instanceof Ui?Qa(r.elements,s.elements,Jn):r instanceof io&&s instanceof io||r instanceof Yc&&s instanceof Yc||r instanceof Qc&&s instanceof Qc?Jn(r.Re,s.Re):r instanceof Wc&&s instanceof Wc})(n.transform,e.transform)}class mM{constructor(e,t){this.version=e,this.transformResults=t}}class Sn{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Sn}static exists(e){return new Sn(void 0,e)}static updateTime(e){return new Sn(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Md(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class dh{}function uv(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new uh(n.key,Sn.none()):new jo(n.key,n.data,Sn.none());{const t=n.data,r=_n.empty();let s=new rt(ft.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new ci(n.key,r,new Qn(s.toArray()),Sn.none())}}function pM(n,e,t){n instanceof jo?(function(s,i,a){const c=s.value.clone(),l=E0(s.fieldTransforms,i,a.transformResults);
1072c.setAll(l),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()})(n,e,t):n instanceof ci?(function(s,i,a){if(!Md(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=E0(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(hv(s)),l.setAll(c),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()})(n,e,t):(function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()})(0,e,t)}function Nc(n,e,t,r){return n instanceof jo?(function(i,a,c,l){if(!Md(i.precondition,a))return c;const d=i.value.clone(),m=N0(i.fieldTransforms,l,a);return d.setAll(m),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null})(n,e,t,r):n instanceof ci?(function(i,a,c,l){if(!Md(i.precondition,a))return c;const d=N0(i.fieldTransforms,l,a),m=a.data;return m.setAll(hv(i)),m.setAll(d),a.convertToFoundDocument(a.version,m).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((p=>p.field)))})(n,e,t,r):(function(i,a,c){return Md(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c})(n,e,t)}function fM(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=ov(r.transform,s||null);i!=null&&(t===null&&(t=_n.empty()),t.set(r.field,i))}return t||null}function T0(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!(function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&Qa(r,s,((i,a)=>hM(i,a)))})(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class jo extends dh{constructor(e,t,r,s=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class ci extends dh{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function hv(n){const e=new Map;return n.fieldMask.fields.forEach((t=>{if(!t.isEmpty()){const r=n.data.field(t);e.set(t,r)}})),e}function E0(n,e,t){const r=new Map;ce(n.length===t.length,32656,{Ie:t.length,Ae:n.length});for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,uM(a,c,t[s]))}return r}function N0(n,e,t){const r=new Map;for(const s of n){const i=s.transform,a=t.data.field(s.field);r.set(s.field,dM(i,a,e))}return r}class uh extends dh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class mv extends dh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
1073 * @license
1074 * Copyright 2022 Google LLC
1075 *
1076 * Licensed under the Apache License, Version 2.0 (the "License");
1077 * you may not use this file except in compliance with the License.
1078 * You may obtain a copy of the License at
1079 *
1080 *   http://www.apache.org/licenses/LICENSE-2.0
1081 *
1082 * Unless required by applicable law or agreed to in writing, software
1083 * distributed under the License is distributed on an "AS IS" BASIS,
1084 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1085 * See the License for the specific language governing permissions and
1086 * limitations under the License.
1087 */class ao{constructor(e,t){this.position=e,this.inclusive=t}}function S0(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],a=n.position[s];if(i.field.isKeyField()?r=me.comparator(me.fromName(a.referenceValue),t.key):r=fn(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function A0(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!Jn(n.position[t],e.position[t]))return!1;return!0}/**
1088 * @license
1089 * Copyright 2022 Google LLC
1090 *
1091 * Licensed under the Apache License, Version 2.0 (the "License");
1092 * you may not use this file except in compliance with the License.
1093 * You may obtain a copy of the License at
1094 *
1095 *   http://www.apache.org/licenses/LICENSE-2.0
1096 *
1097 * Unless required by applicable law or agreed to in writing, softw
1097are
1098 * distributed under the License is distributed on an "AS IS" BASIS,
1099 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1100 * See the License for the specific language governing permissions and
1101 * limitations under the License.
1102 */class pv{}class Ye extends pv{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new gM(e,t,r):t==="array-contains"?new xM(e,r):t==="in"?new vv(e,r):t==="not-in"?new vM(e,r):t==="array-contains-any"?new IM(e,r):new Ye(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new yM(e,r):new bM(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(fn(t,this.value)):t!==null&&qt(this.value)===qt(t)&&this.matchesComparison(fn(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return ye(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class at extends pv{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(e,t){return new at(e,t)}matches(e){return oo(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}}function oo(n){return n.op==="and"}function Pp(n){return n.op==="or"}function W1(n){return fv(n)&&oo(n)}function fv(n){for(const e of n.filters)if(e instanceof at)return!1;return!0}function Rp(n){if(n instanceof Ye)return n.field.canonicalString()+n.op.toString()+so(n.value);if(W1(n))return n.filters.map((e=>Rp(e))).join(",");{const e=n.filters.map((t=>Rp(t))).join(",");return`${n.op}(${e})`}}function gv(n,e){return n instanceof Ye?(function(r,s){return s instanceof Ye&&r.op===s.op&&r.field.isEqual(s.field)&&Jn(r.value,s.value)})(n,e):n instanceof at?(function(r,s){return s instanceof at&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce(((i,a,c)=>i&&gv(a,s.filters[c])),!0):!1})(n,e):void ye(19439)}function yv(n,e){const t=n.filters.concat(e);return at.create(t,n.op)}function bv(n){return n instanceof Ye?(function(t){return`${t.field.canonicalString()} ${t.op} ${so(t.value)}`})(n):n instanceof at?(function(t){return t.op.toString()+" {"+t.getFilters().map(bv).join(" ,")+"}"})(n):"Filter"}class gM extends Ye{constructor(e,t,r){super(e,t,r),this.key=me.fromName(r.referenceValue)}matches(e){const t=me.comparator(e.key,this.key);return this.matchesComparison(t)}}class yM extends Ye{constructor(e,t){super(e,"in",t),this.keys=xv("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class bM extends Ye{constructor(e,t){super(e,"not-in",t),this.keys=xv("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function xv(n,e){var t;return(((t=e.arrayValue)==null?void 0:t.values)||[]).map((r=>me.fromName(r.referenceValue)))}class xM extends Ye{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Ys(t)&&Kc(t.arrayValue,this.value)}}class vv extends Ye{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&Kc(this.value.arrayValue,t)}}class vM extends Ye{constructor(e,t){super(e,"not-in",t)}matches(e){if(Kc(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Kc(this.value.arrayValue,t)}}class IM extends Ye{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Ys(t)||!t.arrayValue.values)&&t.arrayValue.values.some((r=>Kc(this.value.arrayValue,r)))}}/**
1103 * @license
1104 * Copyright 2022 Google LLC
1105 *
1106 * Licensed under the Apache License, Version 2.0 (the "License");
1107 * you may not use this file except in compliance with the License.
1108 * You may obtain a copy of the License at
1109 *
1110 *   http://www.apache.org/licenses/LICENSE-2.0
1111 *
1112 * Unless required by applicable law or agreed to in writing, software
1113 * distributed under the License is distributed on an "AS IS" BASIS,
1114 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1115 * See the License for the specific language governing permissions and
1116 * limitations under the License.
1117 */class lu{constructor(e,t="asc"){this.field=e,this.dir=t}}function _M(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
1118 * @license
1119 * Copyright 2017 Google LLC
1120 *
1121 * Licensed under the Apache License, Version 2.0 (the "License");
1122 * you may not use this file except in compliance with the License.
1123 * You may obtain a copy of the License at
1124 *
1125 *   http://www.apache.org/licenses/LICENSE-2.0
1126 *
1127 * Unless required by applicable law or agreed to in writing, software
1128 * distributed under the License is distributed on an "AS IS" BASIS,
1129 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1130 * See the License for the specific language governing permissions and
1131 * limitations under the License.
1132 */class Et{constructor(e,t,r,s,i,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new Et(e,0,Ne.min(),Ne.min(),Ne.min(),_n.empty(),0)}static newFoundDocument(e,t,r,s){return new Et(e,1,t,Ne.min(),r,s,0)}static newNoDocument(e,t){return new Et(e,2,t,Ne.min(),Ne.min(),_n.empty(),0)}static newUnknownDocument(e,t){return new Et(e,3,t,Ne.min(),Ne.min(),_n.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=_n.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=_n.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Et&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Et(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
1133 * @license
1134 * Copyright 2019 Google LLC
1135 *
1136 * Licensed under the Apache License, Version 2.0 (the "License");
1137 * you may not use this file except in compliance with the License.
1138 * You may obtain a copy of the License at
1139 *
1140 *   http://www.apache.org/licenses/LICENSE-2.0
1141 *
1142 * Unless required by applicable law or agreed to in writing, software
1143 * distributed under the License is distributed on an "AS IS" BASIS,
1144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1145 * See the License for the specific language governing permissions and
1146 * limitations under the License.
1147 */class kM{constructor(e,t=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.de=null}}function Op(n,e=null,t=[],r=[],s=null,i=null,a=null){return new kM(n,e,t,r,s,i,a)}function du(n){const e=_e(n);if(e.de===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((r=>Rp(r))).join(","),t+="|ob:",t+=e.orderBy.map((r=>(function(i){return i.field.canonicalString()+i.dir})(r))).join(","),rh(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((r=>so(r))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((r=>so(r))).join(",")),e.de=t}return e.de}function Y1(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!_M(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!gv(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!A0(n.startAt,e.startAt)&&A0(n.endAt,e.endAt)}function $r(n){return!!n.isCorePipeline}function Q1(n){return!!n.path&&me.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function uu(n,e){return n.filters.filter((t=>t instanceof Ye&&t.field.isEqual(e)))}function C0(n,e,t){let r=Ar,s=!0;for(const i of uu(n,e)){let a=Ar,c=!0;switch(i.op){case"<":case"<=":a=cM(i.value);break;case"==":case"in":case">=":a=i.value;break;case">":a=i.value,c=!1;break;case"!=":case"not-in":a=Ar}k0({value:r,inclusive:s},{value:a,inclusive:c})<0&&(r=a,s=c)}if(t!==null){for(let i=0;i<n.orderBy.length;++i)if(n.orderBy[i].field.isEqual(e)){const a=t.position[i];k0({value:r,inclusive:s},{value:a,inclusive:t.inclusive})<0&&(r=a,s=t.inclusive);break}}return{value:r,inclusive:s}}function M0(n,e,t){let r=Rs,s=!0;for(const i of uu(n,e)){let a=Rs,c=!0;switch(i.op){case">=":case">
1147":a=lM(i.value),c=!1;break;case"==":case"in":case"<=":a=i.value;break;case"<":a=i.value,c=!1;break;case"!=":case"not-in":a=Rs}w0({value:r,inclusive:s},{value:a,inclusive:c})>0&&(r=a,s=c)}if(t!==null){for(let i=0;i<n.orderBy.length;++i)if(n.orderBy[i].field.isEqual(e)){const a=t.position[i];w0({value:r,inclusive:s},{value:a,inclusive:t.inclusive})>0&&(r=a,s=t.inclusive);break}}return{value:r,inclusive:s}}/**
1148 * @license
1149 * Copyright 2017 Google LLC
1150 *
1151 * Licensed under the Apache License, Version 2.0 (the "License");
1152 * you may not use this file except in compliance with the License.
1153 * You may obtain a copy of the License at
1154 *
1155 *   http://www.apache.org/licenses/LICENSE-2.0
1156 *
1157 * Unless required by applicable law or agreed to in writing, software
1158 * distributed under the License is distributed on an "AS IS" BASIS,
1159 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1160 * See the License for the specific language governing permissions and
1161 * limitations under the License.
1162 */class wl{constructor(e,t=null,r=[],s=[],i=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=l,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}}function Iv(n,e,t,r,s,i,a,c){return new wl(n,e,t,r,s,i,a,c)}function jl(n){return new wl(n)}function P0(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function wM(n){return me.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function _v(n){return n.collectionGroup!==null}function Sc(n){const e=_e(n);if(e.fe===null){e.fe=[];const t=new Set;for(const i of e.explicitOrderBy)e.fe.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new rt(ft.comparator);return a.filters.forEach((l=>{l.getFlattenedFilters().forEach((d=>{d.isInequality()&&(c=c.add(d.field))}))})),c})(e).forEach((i=>{t.has(i.canonicalString())||i.isKeyField()||e.fe.push(new lu(i,r))})),t.has(ft.keyField().canonicalString())||e.fe.push(new lu(ft.keyField(),r))}return e.fe}function $n(n){const e=_e(n);return e.me||(e.me=jM(e,Sc(n))),e.me}function jM(n,e){if(n.limitType==="F")return Op(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map((s=>{const i=s.dir==="desc"?"asc":"desc";return new lu(s.field,i)}));const t=n.endAt?new ao(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new ao(n.startAt.position,n.startAt.inclusive):null;return Op(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function Dp(n,e){const t=n.filters.concat([e]);return new wl(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function hu(n,e,t){return new wl(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function TM(n,e){return Y1($n(n),$n(e))&&n.limitType===e.limitType}function Ac(n){return`Query(target=${(function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map((s=>bv(s))).join(", ")}]`),rh(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map((s=>(function(a){return`${a.field.canonicalString()} (${a.dir})`})(s))).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map((s=>so(s))).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map((s=>so(s))).join(",")),`Target(${r})`})($n(n))}; limitType=${n.limitType})`}function hh(n,e){return e.isFoundDocument()&&(function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):me.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)})(n,e)&&(function(r,s){for(const i of Sc(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0})(n,e)&&(function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0})(n,e)&&(function(r,s){return!(r.startAt&&!(function(a,c,l){const d=S0(a,c,l);return a.inclusive?d<=0:d<0})(r.startAt,Sc(r),s)||r.endAt&&!(function(a,c,l){const d=S0(a,c,l);return a.inclusive?d>=0:d>0})(r.endAt,Sc(r),s))})(n,e)}function Z1(n){return(e,t)=>{let r=!1;for(const s of Sc(n)){const i=EM(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function EM(n,e,t){const r=n.field.isKeyField()?me.comparator(e.key,t.key):(function(i,a,c){const l=a.data.field(i),d=c.data.field(i);return l!==null&&d!==null?fn(l,d):ye(42886)})(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return ye(19790,{direction:n.dir})}}/**
1163 * @license
1164 * Copyright 2017 Google LLC
1165 *
1166 * Licensed under the Apache License, Version 2.0 (the "License");
1167 * you may not use this file except in compliance with the License.
1168 * You may obtain a copy of the License at
1169 *
1170 *   http://www.apache.org/licenses/LICENSE-2.0
1171 *
1172 * Unless required by applicable law or agreed to in writing, software
1173 * distributed under the License is distributed on an "AS IS" BASIS,
1174 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1175 * See the License for the specific language governing permissions and
1176 * limitations under the License.
1177 */class NM{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
1178 * @license
1179 * Copyright 2017 Google LLC
1180 *
1181 * Licensed under the Apache License, Version 2.0 (the "License");
1182 * you may not use this file except in compliance with the License.
1183 * You may obtain a copy of the License at
1184 *
1185 *   http://www.apache.org/licenses/LICENSE-2.0
1186 *
1187 * Unless required by applicable law or agreed to in writing, software
1188 * distributed under the License is distributed on an "AS IS" BASIS,
1189 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1190 * See the License for the specific language governing permissions and
1191 * limitations under the License.
1192 */var Dt,Je;function SM(n){switch(n){case J.OK:return ye(64938);case J.CANCELLED:case J.UNKNOWN:case J.DEADLINE_EXCEEDED:case J.RESOURCE_EXHAUSTED:case J.INTERNAL:case J.UNAVAILABLE:case J.UNAUTHENTICATED:return!1;case J.INVALID_ARGUMENT:case J.NOT_FOUND:case J.ALREADY_EXISTS:case J.PERMISSION_DENIED:case J.FAILED_PRECONDITION:case J.ABORTED:case J.OUT_OF_RANGE:case J.UNIMPLEMENTED:case J.DATA_LOSS:return!0;default:return ye(15467,{code:n})}}function kv(n){if(n===void 0)return Rt("GRPC error has no .code"),J.UNKNOWN;switch(n){case Dt.OK:return J.OK;case Dt.CANCELLED:return J.CANCELLED;case Dt.UNKNOWN:return J.UNKNOWN;case Dt.DEADLINE_EXCEEDED:return J.DEADLINE_EXCEEDED;case Dt.RESOURCE_EXHAUSTED:return J.RESOURCE_EXHAUSTED;case Dt.INTERNAL:return J.INTERNAL;case Dt.UNAVAILABLE:return J.UNAVAILABLE;case Dt.UNAUTHENTICATED:return J.UNAUTHENTICATED;case Dt.INVALID_ARGUMENT:return J.INVALID_ARGUMENT;case Dt.NOT_FOUND:return J.NOT_FOUND;case Dt.ALREADY_EXISTS:return J.ALREADY_EXISTS;case Dt.PERMISSION_DENIED:return J.PERMISSION_DENIED;case Dt.FAILED_PRECONDITION:return J.FAILED_PRECONDITION;case Dt.ABORTED:return J.ABORTED;case Dt.OUT_OF_RANGE:return J.OUT_OF_RANGE;case Dt.UNIMPLEMENTED:return J.UNIMPLEMENTED;case Dt.DATA_LOSS:return J.DATA_LOSS;default:return ye(39323,{code:n})}}(Je=Dt||(Dt={}))[Je.OK=0]="OK",Je[Je.CANCELLED=1]="CANCELLED",Je[Je.UNKNOWN=2]="UNKNOWN",Je[Je.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Je[Je.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Je[Je.NOT_FOUND=5]="NOT_FOUND",Je[Je.ALREADY_EXISTS=6]="ALREADY_EXISTS",Je[Je.PERMISSION_DENIED=7]="PERMISSION_DENIED",Je[Je.UNAUTHENTICATED=16]="UNAUTHENTICATED",Je[Je.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Je[Je.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Je[Je.ABORTED=10]="ABORTED",Je[Je.OUT_OF_RANGE=11]="OUT_OF_RANGE",Je[Je.UNIMPLEMENTED=12]="UNIMPLEMENTED",Je[Je.INTERNAL=13]="INTERNAL",Je[Je.UNAVAILABLE=14]="UNAVAILABLE",Je[Je.DATA_LOSS=15]="DATA_LOSS";/**
1193 * @license
1194 * Copyright 2017 Google LLC
1195 *
1196 * Licensed under the Apache License, Version 2.0 (the "License");
1197 * you may not use this file except in compliance with the License.
1198 * You may obtain a copy of the License at
1199 *
1200 *   http://www.apache.org/licenses/LICENSE-2.0
1201 *
1202 * Unless required by applicable law or agreed to in writing, software
1203 * distributed under the License is distributed on an "AS IS" BASIS,
1204 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1205 * See the License for the specific language governing permissions and
1206 * limitations under the License.
1207 */class ds{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[t]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){na(this.inner,((t,r)=>{for(const[s,i]of r)e(s,i)}))}
1207isEmpty(){return Z4(this.inner)}size(){return this.innerSize}}/**
1208 * @license
1209 * Copyright 2017 Google LLC
1210 *
1211 * Licensed under the Apache License, Version 2.0 (the "License");
1212 * you may not use this file except in compliance with the License.
1213 * You may obtain a copy of the License at
1214 *
1215 *   http://www.apache.org/licenses/LICENSE-2.0
1216 *
1217 * Unless required by applicable law or agreed to in writing, software
1218 * distributed under the License is distributed on an "AS IS" BASIS,
1219 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1220 * See the License for the specific language governing permissions and
1221 * limitations under the License.
1222 */const AM=new ut(me.comparator);function Ft(){return AM}const wv=new ut(me.comparator);function wi(...n){let e=wv;for(const t of n)e=e.insert(t.key,t);return e}function jv(n){let e=wv;return n.forEach(((t,r)=>e=e.insert(t,r.overlayedDocument))),e}function Wn(){return Cc()}function Tv(){return Cc()}function Cc(){return new ds((n=>n.toString()),((n,e)=>n.isEqual(e)))}const CM=new ut(me.comparator),MM=new rt(me.comparator);function Fe(...n){let e=MM;for(const t of n)e=e.add(t);return e}const PM=new rt(De);function J1(){return PM}/**
1223 * @license
1224 * Copyright 2023 Google LLC
1225 *
1226 * Licensed under the Apache License, Version 2.0 (the "License");
1227 * you may not use this file except in compliance with the License.
1228 * You may obtain a copy of the License at
1229 *
1230 *   http://www.apache.org/licenses/LICENSE-2.0
1231 *
1232 * Unless required by applicable law or agreed to in writing, software
1233 * distributed under the License is distributed on an "AS IS" BASIS,
1234 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235 * See the License for the specific language governing permissions and
1236 * limitations under the License.
1237 */function RM(){return new TextEncoder}/**
1238 * @license
1239 * Copyright 2022 Google LLC
1240 *
1241 * Licensed under the Apache License, Version 2.0 (the "License");
1242 * you may not use this file except in compliance with the License.
1243 * You may obtain a copy of the License at
1244 *
1245 *   http://www.apache.org/licenses/LICENSE-2.0
1246 *
1247 * Unless required by applicable law or agreed to in writing, software
1248 * distributed under the License is distributed on an "AS IS" BASIS,
1249 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1250 * See the License for the specific language governing permissions and
1251 * limitations under the License.
1252 */const OM=new qs([4294967295,4294967295],0);function R0(n){const e=RM().encode(n),t=new j4;return t.update(e),new Uint8Array(t.digest())}function O0(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new qs([t,r],0),new qs([s,i],0)]}class X1{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new pc(`Invalid padding: ${t}`);if(r<0)throw new pc(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new pc(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new pc(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=qs.fromNumber(this.ge)}we(e,t,r){let s=e.add(t.multiply(qs.fromNumber(r)));return s.compare(OM)===1&&(s=new qs([s.getBits(0),s.getBits(1)],0)),s.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const t=R0(e),[r,s]=O0(t);for(let i=0;i<this.hashCount;i++){const a=this.we(r,s,i);if(!this.be(a))return!1}return!0}static create(e,t,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new X1(i,s,t);return r.forEach((c=>a.insert(c))),a}insert(e){if(this.ge===0)return;const t=R0(e),[r,s]=O0(t);for(let i=0;i<this.hashCount;i++){const a=this.we(r,s,i);this.ve(a)}}ve(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}
vendor: 8,821 bytes, lines 1252-1282
1252class pc extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1253 * @license
1254 * Copyright 2017 Google LLC
1255 *
1256 * Licensed under the Apache License, Version 2.0 (the "License");
1257 * you may not use this file except in compliance with the License.
1258 * You may obtain a copy of the License at
1259 *
1260 *   http://www.apache.org/licenses/LICENSE-2.0
1261 *
1262 * Unless required by applicable law or agreed to in writing, software
1263 * distributed under the License is distributed on an "AS IS" BASIS,
1264 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1265 * See the License for the specific language governing permissions and
1266 * limitations under the License.
1267 */class To{constructor(e,t,r,s,i,a){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=s,this.augmentedDocumentUpdates=i,this.resolvedLimboDocuments=a}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const s=new Map;return s.set(e,Tl.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new To(Ne.min(),s,new ut(De),Ft(),Ft(),Fe())}}class Tl{constructor(e,t,r,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new Tl(r,t,Fe(),Fe(),Fe())}}/**
1268 * @license
1269 * Copyright 2017 Google LLC
1270 *
1271 * Licensed under the Apache License, Version 2.0 (the "License");
1272 * you may not use this file except in compliance with the License.
1273 * You may obtain a copy of the License at
1274 *
1275 *   http://www.apache.org/licenses/LICENSE-2.0
1276 *
1277 * Unless required by applicable law or agreed to in writing, software
1278 * distributed under the License is distributed on an "AS IS" BASIS,
1279 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280 * See the License for the specific language governing permissions and
1281 * limitations under the License.
1282 */class Pd{constructor(e,t,r,s){this.Se=e,this.removedTargetIds=t,this.key=r,this.De=s}}class Ev{constructor(e,t){this.targetId=e,this.xe=t}}class Nv{constructor(e,t,r=vt.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class D0{constructor(e){this.targetId=e,this.Ce=0,this.Fe=V0(),this.Oe=vt.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return this.Ce!==0}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=Fe(),t=Fe(),r=Fe();return this.Fe.forEach(((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:ye(38017,{changeType:i})}})),new Tl(this.Oe,this.Me,e,t,r)}qe(){this.Ne=!1,this.Fe=V0()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){this.Ce-=1,ce(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}}const rc="WatchChangeAggregator";class DM{constructor(e){this.ze=e,this.je=new Map,this.He=Ft(),this.Je=md(),this.Ye=Ft(),this.Ze=md(),this.Xe=new ut(De)}et(e){for(const t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(const t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,(t=>{const r=this.je.get(t);if(r)switch(e.state){case 0:this.it(t)&&r.Ue(e.resumeToken);break;case 1:r.Qe(),r.Le||r.qe(),r.Ue(e.resumeToken);break;case 2:r.Qe(),r.Le||this.removeTarget(t);break;case 3:this.it(t)&&(r.Ge(),r.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),r.Ue(e.resumeToken));break;default:ye(56790,{state:e.state})}else se(rc,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach(((r,s)=>{this.it(s)&&t(s)}))}_t(e){var t;return $r(e)?e.getPipelineSourceType()==="documents"&&((t=e.getPipelineDocuments())==null?void 0:t.length)===1:Q1(e)}ot(e){const t=e.targetId,r=e.xe.count,s=this.ut(t);if(s){const i=s.target;if(this._t(i))if(r===0){const a=new me($r(i)?Ke.fromString(i.getPipelineDocuments()[0]):i.path);this.nt(t,a,Et.newNoDocument(a,Ne.min()))}else ce(r===1,20013,"Single document existence filter with count: "+r);else{const a=this.ct(t);if(a!==r){const c=this.lt(e),l=c?this.Et(c,e,a):1;if(l!==0){this.st(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Xe=this.Xe.insert(t,d)}}}}}lt(e){const t=e.xe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,c;try{a=ts(r).toUint8Array()}catch(l){if(l instanceof J4)return lr("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new X1(a,s,i)}catch(l){return lr(l instanceof pc?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.ge===0?null:c}Et(e,t,r){return t.xe.count===r-this.Pt(e,t.targetId)?0:2}Pt(e,t){const r=this.ze.getRemoteKeysForTarget(t);let s=0;return r.forEach((i=>{const a=this.ze.Tt(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.nt(t,i,null),s++)})),s}Rt(e){const t=new Map;this.je.forEach(((i,a)=>{const c=this.ut(a);if(c){if(i.current&&this._t(c.target)){const l=$r(c.target)?Ke.fromString(c.target.getPipelineDocuments()[0]):c.target.path,d=new me(l);this.It(d).has(a)||this.At(a,d)||this.nt(a,d,Et.newNoDocument(d,e))}i.Be&&(t.set(a,i.ke()),i.qe())}}));let r=Fe();this.Ze.forEach(((i,a)=>{let c=!0;a.forEachWhile((l=>{const d=this.ut(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)})),c&&(r=r.add(i))})),this.He.forEach(((i,a)=>a.setReadTime(e))),this.Ye.forEach(((i,a)=>a.setReadTime(e)));const s=new To(e,t,this.Xe,this.He,this.Ye,r);return this.He=Ft(),this.Je=md(),this.Ye=Ft(),this.Ze=md(),this.Xe=new ut(De),s}tt(e,t){const r=this.je.get(e);if(!r||!this.it(e))return void se(rc,`addDocumentToTarget received document for unknown inactive target (${e})`);const s=this.At(e,t.key)?2:0;r.$e(t.key,s),$r(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,r){const s=this.je.get(e);s&&this.it(e)?(this.At(e,t)?s.$e(t,1):s.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),r&&($r(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t,r):this.He=this.He.insert(t,r))):se(rc,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){const t=this.je.get(e);if(!t)return 0;const r=t.ke();return this.ze.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}We(e){let t=this.je.get(e);t||(se(rc,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new D0(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new rt(De),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new rt(De),this.Je=this.Je.insert(e,t)),t}it(e){const t=this.ut(e)!==null;return t||se(rc,"Detected inactive target",e),t}ut(e){const t=this.je.get(e);return t===void 0||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new D0(e)),this.ze.getRemoteKeysForTarget(e).forEach((t=>{this.nt(e,t,null)}))}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function md(){return new ut(me.comparator)}function V0(){return new ut(me.comparator)}const VM={asc:"ASCENDING",desc:"DESCENDING"},LM={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},qM={and:"AND",or:"OR"};class zM{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Vp(n,e){return n.useProto3Json||rh(e)?e:{value:e}}function co(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function ef(n){const e=es(n);return new st(e.seconds,e.nanos)}function Sv(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function Rd(n,e){return co(n,e.toTimestamp())}function kn(n){return ce(!!n,49232),Ne.fromTimestamp(ef(n))}function tf(n,e){return Lp(n,e).canonicalString()}function Lp(n,e){const t=(function(s){return new Ke(["projects",s.projectId,"databases",s.database])})(n).child("documents");return e===void 0?t:t.child(e)}function Av(n){const e=Ke.fromString(n);return ce(zv(e),10190,{key:e.toString()}),e}function Zc(n,e){return tf(n.databaseId,e.path)}function Pi(n,e){const t=Av(e);
1282if(t.get(1)!==n.databaseId.projectId)throw new de(J.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new de(J.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new me(Pv(t))}function Cv(n,e){return tf(n.databaseId,e)}function Mv(n){const e=Av(n);return e.length===4?Ke.emptyPath():Pv(e)}function qp(n){return new Ke(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Pv(n){return ce(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function L0(n,e,t){return{name:Zc(n,e),fields:t.value.mapValue.fields}}function FM(n,e,t){const r=Pi(n,e.name),s=kn(e.updateTime),i=e.createTime?kn(e.createTime):Ne.min(),a=new _n({mapValue:{fields:e.fields}}),c=Et.newFoundDocument(r,s,i,a);return t&&c.setHasCommittedMutations(),t?c.setHasCommittedMutations():c}function $M(n,e){let t;if("targetChange"in e){e.targetChange;const r=(function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:ye(39313,{state:d})})(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=(function(d,m){return d.useProto3Json?(ce(m===void 0||typeof m=="string",58123),vt.fromBase64String(m||"")):(ce(m===void 0||m instanceof Buffer||m instanceof Uint8Array,16193),vt.fromUint8Array(m||new Uint8Array))})(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&(function(d){const m=d.code===void 0?J.UNKNOWN:kv(d.code);return new de(m,d.message||"")})(a);t=new Nv(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Pi(n,r.document.name),i=kn(r.document.updateTime),a=r.document.createTime?kn(r.document.createTime):Ne.min(),c=new _n({mapValue:{fields:r.document.fields}}),l=Et.newFoundDocument(s,i,a,c),d=r.targetIds||[],m=r.removedTargetIds||[];t=new Pd(d,m,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Pi(n,r.document),i=r.readTime?kn(r.readTime):Ne.min(),a=Et.newNoDocument(s,i),c=r.removedTargetIds||[];t=new Pd([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Pi(n,r.document),i=r.removedTargetIds||[];t=new Pd([],i,s,null)}else{if(!("filter"in e))return ye(11601,{ft:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new NM(s,i),c=r.targetId;t=new Ev(c,a)}}return t}function mu(n,e){let t;if(e instanceof jo)t={update:L0(n,e.key,e.value)};else if(e instanceof uh)t={delete:Zc(n,e.key)};else if(e instanceof ci)t={update:L0(n,e.key,e.data),updateMask:WM(e.fieldMask)};else{if(!(e instanceof mv))return ye(16599,{gt:e.type});t={verify:Zc(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map((r=>(function(i,a){const c=a.transform;if(c instanceof Wc)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof Bi)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof Ui)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof io)return{fieldPath:a.field.canonicalString(),increment:c.Re};if(c instanceof Yc)return{fieldPath:a.field.canonicalString(),minimum:c.Re};if(c instanceof Qc)return{fieldPath:a.field.canonicalString(),maximum:c.Re};throw ye(20930,{transform:a.transform})})(0,r)))),e.precondition.isNone||(t.currentDocument=(function(s,i){return i.updateTime!==void 0?{updateTime:Rd(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:ye(27497)})(n,e.precondition)),t}function zp(n,e){const t=e.currentDocument?(function(i){return i.updateTime!==void 0?Sn.updateTime(kn(i.updateTime)):i.exists!==void 0?Sn.exists(i.exists):Sn.none()})(e.currentDocument):Sn.none(),r=e.updateTransforms?e.updateTransforms.map((s=>(function(a,c){let l=null;if("setToServerValue"in c)ce(c.setToServerValue==="REQUEST_TIME",16630,{proto:c}),l=new Wc;else if("appendMissingElements"in c){const m=c.appendMissingElements.values||[];l=new Bi(m)}else if("removeAllFromArray"in c){const m=c.removeAllFromArray.values||[];l=new Ui(m)}else"increment"in c?l=new io(a,c.increment):"minimum"in c?l=new Yc(a,c.minimum):"maximum"in c?l=new Qc(a,c.maximum):ye(16584,{proto:c});const d=ft.fromServerFormat(c.fieldPath);return new H1(d,l)})(n,s))):[];if(e.update){e.update.name;const s=Pi(n,e.update.name),i=new _n({mapValue:{fields:e.update.fields}});if(e.updateMask){const a=(function(l){const d=l.fieldPaths||[];return new Qn(d.map((m=>ft.fromServerFormat(m))))})(e.updateMask);return new ci(s,i,a,t,r)}return new jo(s,i,t,r)}if(e.delete){const s=Pi(n,e.delete);return new uh(s,t)}if(e.verify){const s=Pi(n,e.verify);return new mv(s,t)}return ye(1463,{proto:e})}function BM(n,e){return n&&n.length>0?(ce(e!==void 0,14353),n.map((t=>(function(s,i){let a=s.updateTime?kn(s.updateTime):kn(i);return a.isEqual(Ne.min())&&(a=kn(i)),new mM(a,s.transformResults||[])})(t,e)))):[]}function Rv(n,e){return{documents:[Cv(n,e.path)]}}function Ov(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=Cv(n,s);const i=(function(d){if(d.length!==0)return qv(at.create(d,"and"))})(e.filters);i&&(t.structuredQuery.where=i);const a=(function(d){if(d.length!==0)return d.map((m=>(function(f){return{field:Ca(f.field),direction:GM(f.dir)}})(m)))})(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=Vp(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=(function(d){return{before:d.inclusive,values:d.position}})(e.startAt)),e.endAt&&(t.structuredQuery.endAt=(function(d){return{before:!d.inclusive,values:d.position}})(e.endAt)),{yt:t,parent:s}}function Dv(n){let e=Mv(n.parent);
1282const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){ce(r===1,65062);const m=t.from[0];m.allDescendants?s=m.collectionId:e=e.child(m.collectionId)}let i=[];t.where&&(i=(function(p){const f=Lv(p);return f instanceof at&&W1(f)?f.getFilters():[f]})(t.where));let a=[];t.orderBy&&(a=(function(p){return p.map((f=>(function(x){return new lu(Ma(x.field),(function(I){switch(I){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(x.direction))})(f)))})(t.orderBy));let c=null;t.limit&&(c=(function(p){let f;return f=typeof p=="object"?p.value:p,rh(f)?null:f})(t.limit));let l=null;t.startAt&&(l=(function(p){const f=!!p.before,g=p.values||[];return new ao(g,f)})(t.startAt));let d=null;return t.endAt&&(d=(function(p){const f=!p.before,g=p.values||[];return new ao(g,f)})(t.endAt)),Iv(e,s,a,i,c,"F",l,d)}function UM(n,e){const t=(function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ye(28987,{purpose:s})}})(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Vv(n,e){return{structuredPipeline:{pipeline:{stages:e.stages.map((t=>t._toProto(n)))}}}}function Lv(n){return n.unaryFilter!==void 0?(function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=Ma(t.unaryFilter.field);return Ye.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Ma(t.unaryFilter.field);return Ye.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Ma(t.unaryFilter.field);return Ye.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=Ma(t.unaryFilter.field);return Ye.create(a,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ye(61313);default:return ye(60726)}})(n):n.fieldFilter!==void 0?(function(t){return Ye.create(Ma(t.fieldFilter.field),(function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return ye(58110);default:return ye(50506)}})(t.fieldFilter.op),t.fieldFilter.value)})(n):n.compositeFilter!==void 0?(function(t){return at.create(t.compositeFilter.filters.map((r=>Lv(r))),(function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return ye(1026)}})(t.compositeFilter.op))})(n):ye(30097,{filter:n})}function GM(n){return VM[n]}function KM(n){return LM[n]}function HM(n){return qM[n]}function Ca(n){return{fieldPath:n.canonicalString()}}function Ma(n){return ft.fromServerFormat(n.fieldPath)}function qv(n){return n instanceof Ye?(function(t){if(t.op==="=="){if(Pn(t.value))return{unaryFilter:{field:Ca(t.field),op:"IS_NAN"}};if(Fn(t.value))return{unaryFilter:{field:Ca(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Pn(t.value))return{unaryFilter:{field:Ca(t.field),op:"IS_NOT_NAN"}};if(Fn(t.value))return{unaryFilter:{field:Ca(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Ca(t.field),op:KM(t.op),value:t.value}}})(n):n instanceof at?(function(t){const r=t.getFilters().map((s=>qv(s)));return r.length===1?r[0]:{compositeFilter:{op:HM(t.op),filters:r}}})(n):ye(54877,{filter:n})}function WM(n){const e=[];return n.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function zv(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}function Fv(n){return!!n&&typeof n._toProto=="function"&&n._protoValueType==="ProtoValue"}function Jc(n,e){const t={fields:{}};return e.forEach(((r,s)=>{if(typeof s!="string")throw new Error(`Cannot encode map with non-string key: ${s}`);t.fields[s]=r._toProto(n)})),{mapValue:t}}function $v(n){return{stringValue:n}}/**
1283 * @license
1284 * Copyright 2020 Google LLC
1285 *
1286 * Licensed under the Apache License, Version 2.0 (the "License");
1287 * you may not use this file except in compliance with the License.
1288 * You may obtain a copy of the License at
1289 *
1290 *   http://www.apache.org/licenses/LICENSE-2.0
1291 *
1292 * Unless required by applicable law or agreed to in writing, softw
1292are
1293 * distributed under the License is distributed on an "AS IS" BASIS,
1294 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295 * See the License for the specific language governing permissions and
1296 * limitations under the License.
1297 */function mh(n){return new zM(n,!0)}/**
1298 * @license
1299 * Copyright 2020 Google LLC
1300 *
1301 * Licensed under the Apache License, Version 2.0 (the "License");
1302 * you may not use this file except in compliance with the License.
1303 * You may obtain a copy of the License at
1304 *
1305 *   http://www.apache.org/licenses/LICENSE-2.0
1306 *
1307 * Unless required by applicable law or agreed to in writing, software
1308 * distributed under the License is distributed on an "AS IS" BASIS,
1309 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1310 * See the License for the specific language governing permissions and
1311 * limitations under the License.
1312 */class Yn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Yn(vt.fromBase64String(e))}catch(t){throw new de(J.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new Yn(vt.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Yn._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Il(e,Yn._jsonSchema))return Yn.fromBase64String(e.bytes)}}Yn._jsonSchemaVersion="firestore/bytes/1.0",Yn._jsonSchema={type:Lt("string",Yn._jsonSchemaVersion),bytes:Lt("string")};/**
1313 * @license
1314 * Copyright 2020 Google LLC
1315 *
1316 * Licensed under the Apache License, Version 2.0 (the "License");
1317 * you may not use this file except in compliance with the License.
1318 * You may obtain a copy of the License at
1319 *
1320 *   http://www.apache.org/licenses/LICENSE-2.0
1321 *
1322 * Unless required by applicable law or agreed to in writing, software
1323 * distributed under the License is distributed on an "AS IS" BASIS,
1324 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325 * See the License for the specific language governing permissions and
1326 * limitations under the License.
1327 */class nf{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new de(J.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ft(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function YM(){return new nf(kr)}/**
1328 * @license
1329 * Copyright 2020 Google LLC
1330 *
1331 * Licensed under the Apache License, Version 2.0 (the "License");
1332 * you may not use this file except in compliance with the License.
1333 * You may obtain a copy of the License at
1334 *
1335 *   http://www.apache.org/licenses/LICENSE-2.0
1336 *
1337 * Unless required by applicable law or agreed to in writing, software
1338 * distributed under the License is distributed on an "AS IS" BASIS,
1339 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1340 * See the License for the specific language governing permissions and
1341 * limitations under the License.
1342 */class ph{constructor(e){this._methodName=e}}/**
1343 * @license
1344 * Copyright 2017 Google LLC
1345 *
1346 * Licensed under the Apache License, Version 2.0 (the "License");
1347 * you may not use this file except in compliance with the License.
1348 * You may obtain a copy of the License at
1349 *
1350 *   http://www.apache.org/licenses/LICENSE-2.0
1351 *
1352 * Unless required by applicable law or agreed to in writing, software
1353 * distributed under the License is distributed on an "AS IS" BASIS,
1354 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1355 * See the License for the specific language governing permissions and
1356 * limitations under the License.
1357 */class Cr{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new de(J.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new de(J.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return De(this._lat,e._lat)||De(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Cr._jsonSchemaVersion}}static fromJSON(e){if(Il(e,Cr._jsonSchema))return new Cr(e.latitude,e.longitude)}}function Bv(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
1358 * @license
1359 * Copyright 2019 Google LLC
1360 *
1361 * Licensed under the Apache License, Version 2.0 (the "License");
1362 * you may not use this file except in compliance with the License.
1363 * You may obtain a copy of the License at
1364 *
1365 *   http://www.apache.org/licenses/LICENSE-2.0
1366 *
1367 * Unless required by applicable law or agreed to in writing, software
1368 * distributed under the License is distributed on an "AS IS" BASIS,
1369 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1370 * See the License for the specific language governing permissions and
1371 * limitations under the License.
1372 */Cr._jsonSchemaVersion="firestore/geoPoint/1.0",Cr._jsonSchema={type:Lt("string",Cr._jsonSchemaVersion),latitude:Lt("number"),longitude:Lt("number")};class QM{bt(e){}shutdown(){}}/**
1373 * @license
1374 * Copyright 2019 Google LLC
1375 *
1376 * Licensed under the Apache License, Version 2.0 (the "License");
1377 * you may not use this file except in compliance with the License.
1378 * You may obtain a copy of the License at
1379 *
1380 *   http://www.apache.org/licenses/LICENSE-2.0
1381 *
1382 * Unless required by applicable law or agreed to in writing, software
1383 * distributed under the License is distributed on an "AS IS" BASIS,
1384 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1385 * See the License for the specific language governing permissions and
1386 * limitations under the License.
1387 */const q0="ConnectivityMonitor";class z0{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener("online",this.vt),window.removeEventListener("offline",this.Dt)}Ft(){window.addEventListener("online",this.vt),window.addEventListener("offline",this.Dt)}St(){se(q0,"Network connectivity changed: AVAILABLE");for(const e of this.Ct)e(0)}xt(){se(q0,"Network connectivity changed: UNAVAILABLE");for(const e of this.Ct)e(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
1388 * @license
1389 * Copyright 2023 Google LLC
1390 *
1391 * Licensed under the Apache License, Version 2.0 (the "License");
1392 * you may not use this file except in compliance with the License.
1393 * You may obtain a copy of the License at
1394 *
1395 *   http://www.apache.org/licenses/LICENSE-2.0
1396 *
1397 * Unless required by applicable law or agreed to in writing, software
1398 * distributed under the License is distributed on an "AS IS" BASIS,
1399 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1400 * See the License for the specific language governing permissions and
1401 * limitations under the License.
1402 */let pd=null;function Fp(){return pd===null?pd=(function(){return 268435456+Math.round(2147483648*Math.random())})():pd++,"0x"+pd.toString(16)}/**
1403 * @license
1404 * Copyright 2020 Google LLC
1405 *
1406 * Licensed under the Apache License, Version 2.0 (the "License");
1407 * you may not use this file except in compliance with the License.
1408 * You may obtain a copy of the License at
1409 *
1410 *   http://www.apache.org/licenses/LICENSE-2.0
1411 *
1412 * Unless required by applicable law or agreed to in writing, software
1413 * distributed under the License is distributed on an "AS IS" BASIS,
1414 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1415 * See the License for the specific language governing permissions and
1416 * limitations under the License.
1417 */const Cm="RestConnection",ZM={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class JM{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Mt=t+"://"+e.host,this.Nt=`projects/${r}/databases/${s}`,this.Lt=this.databaseId.database===ou?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Bt(e,t,r,s,i){const a=Fp(),c=this.Ut(e,t.toUriEncodedString());se(Cm,`Sending RPC '${e}' ${a}:`,c,r);const l={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(l,s,i);const{host:d}=new URL(c),m=xl(d);return this.qt(e,c,l,r,m).then((p=>(se(Cm,`Received RPC '${e}' ${a}: `,p),p)),(p=>{throw lr(Cm,`RPC '${e}' ${a} failed with error: `,p,"url: ",c,"request:",r),p}))}$t(e,t,r,s,i,a){return this.Bt(e,t,r,s,i)}kt(e,t,r){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+wo})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEac
vendor: 4,580 bytes, lines 1417-1447
1417h(((s,i)=>e[i]=s)),r&&r.headers.forEach(((s,i)=>e[i]=s))}Ut(e,t){const r=ZM[e];let s=`${this.Mt}/v1/${t}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/**
1418 * @license
1419 * Copyright 2017 Google LLC
1420 *
1421 * Licensed under the Apache License, Version 2.0 (the "License");
1422 * you may not use this file except in compliance with the License.
1423 * You may obtain a copy of the License at
1424 *
1425 *   http://www.apache.org/licenses/LICENSE-2.0
1426 *
1427 * Unless required by applicable law or agreed to in writing, software
1428 * distributed under the License is distributed on an "AS IS" BASIS,
1429 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1430 * See the License for the specific language governing permissions and
1431 * limitations under the License.
1432 */class XM{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}}/**
1433 * @license
1434 * Copyright 2017 Google LLC
1435 *
1436 * Licensed under the Apache License, Version 2.0 (the "License");
1437 * you may not use this file except in compliance with the License.
1438 * You may obtain a copy of the License at
1439 *
1440 *   http://www.apache.org/licenses/LICENSE-2.0
1441 *
1442 * Unless required by applicable law or agreed to in writing, software
1443 * distributed under the License is distributed on an "AS IS" BASIS,
1444 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1445 * See the License for the specific language governing permissions and
1446 * limitations under the License.
1447 */const rn="WebChannelConnection",sc=(n,e,t)=>{n.listen(e,(r=>{try{t(r)}catch(s){setTimeout((()=>{throw s}),0)}}))};class za extends JM{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){if(!za.sn){const e=S4();sc(e,N4.STAT_EVENT,(t=>{t.stat===kp.PROXY?se(rn,"STAT_EVENT: detected buffering proxy"):t.stat===kp.NOPROXY&&se(rn,"STAT_EVENT: detected no buffering proxy")})),za.sn=!0}}qt(e,t,r,s,i){const a=Fp();return new Promise(((c,l)=>{const d=new T4;d.setWithCredentials(!0),d.listenOnce(E4.COMPLETE,(()=>{try{switch(d.getLastErrorCode()){case Ed.NO_ERROR:const p=d.getResponseJson();se(rn,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(p)),c(p);break;case Ed.TIMEOUT:se(rn,`RPC '${e}' ${a} timed out`),l(new de(J.DEADLINE_EXCEEDED,"Request time out"));break;case Ed.HTTP_ERROR:const f=d.getStatus();if(se(rn,`RPC '${e}' ${a} failed with status:`,f,"response text:",d.getResponseText()),f>0){let g=d.getResponseJson();Array.isArray(g)&&(g=g[0]);const x=g==null?void 0:g.error;if(x&&x.status&&x.message){const b=(function(N){const V=N.toLowerCase().replace(/_/g,"-");return Object.values(J).indexOf(V)>=0?V:J.UNKNOWN})(x.status);l(new de(b,x.message))}else l(new de(J.UNKNOWN,"Server responded with status "+d.getStatus()))}else l(new de(J.UNAVAILABLE,"Connection failed."));break;default:ye(9055,{_n:e,streamId:a,an:d.getLastErrorCode(),un:d.getLastError()})}}finally{se(rn,`RPC '${e}' ${a} completed.`)}}));const m=JSON.stringify(s);se(rn,`RPC '${e}' ${a} sending request:`,s),d.send(t,"POST",m,r,15)}))}cn(e,t,r){const s=Fp(),i=[this.Mt,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=this.createWebChannelTransport(),c={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;l!==void 0&&(c.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(c.useFetchStreams=!0),this.kt(c.initMessageHeaders,t,r),c.encodeInitMessageHeaders=!0;const d=i.join("");se(rn,`Creating RPC '${e}' stream ${s}: ${d}`,c);const m=a.createWebChannel(d,c);this.En(m);let p=!1,f=!1;const g=new XM({Kt:x=>{f?se(rn,`Not sending because RPC '${e}' stream ${s} is closed:`,x):(p||(se(rn,`Opening RPC '${e}' stream ${s} transport.`),m.open(),p=!0),se(rn,`RPC '${e}' stream ${s} sending:`,x),m.send(x))},Wt:()=>m.close()});return sc(m,mc.EventType.OPEN,(()=>{f||(se(rn,`RPC '${e}' stream ${s} transport opened.`),g.Zt())})),sc(m,mc.EventType.CLOSE,(()=>{f||(f=!0,se(rn,`RPC '${e}' stream ${s} transport closed`),g.en(),this.hn(m))}
1447)),sc(m,mc.EventType.ERROR,(x=>{f||(f=!0,lr(rn,`RPC '${e}' stream ${s} transport errored. Name:`,x.name,"Message:",x.message),g.en(new de(J.UNAVAILABLE,"The operation could not be completed")))})),sc(m,mc.EventType.MESSAGE,(x=>{var b;if(!f){const I=x.data[0];ce(!!I,16349);const N=I,V=(N==null?void 0:N.error)||((b=N[0])==null?void 0:b.error);if(V){se(rn,`RPC '${e}' stream ${s} received error:`,V);const D=V.status;let T=(function(_){const j=Dt[_];if(j!==void 0)return kv(j)})(D),M=V.message;D==="NOT_FOUND"&&M.includes("database")&&M.includes("does not exist")&&M.includes(this.databaseId.database)&&lr(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),T===void 0&&(T=J.INTERNAL,M="Unknown error status: "+D+" with message "+V.message),f=!0,g.en(new de(T,M)),m.close()}else se(rn,`RPC '${e}' stream ${s} received:`,I),g.tn(I)}})),za.rn(),setTimeout((()=>{g.Xt()}),0),g}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,r){super.kt(e,t,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return A4()}}/**
1448 * @license
1449 * Copyright 2020 Google LLC
1450 *
1451 * Licensed under the Apache License, Version 2.0 (the "License");
1452 * you may not use this file except in compliance with the License.
1453 * You may obtain a copy of the License at
1454 *
1455 *   http://www.apache.org/licenses/LICENSE-2.0
1456 *
1457 * Unless required by applicable law or agreed to in writing, software
1458 * distributed under the License is distributed on an "AS IS" BASIS,
1459 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1460 * See the License for the specific language governing permissions and
1461 * limitations under the License.
1462 */function eP(n){return new za(n)}za.sn=!1;class Uv{constructor(e,t,r=1e3,s=1.5,i=6e4){this.Tn=e,this.timerId=t,this.Pn=r,this.Rn=s,this.In=i,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();const t=Math.floor(this.An+this.pn()),r=Math.max(0,Date.now()-this.dn),s=Math.max(0,t-r);s>0&&se("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,s,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}}/**
1463 * @license
1464 * Copyright 2017 Google LLC
1465 *
1466 * Licensed under the Apache License, Version 2.0 (the "License");
1467 * you may not use this file except in compliance with the License.
1468 * You may obtain a copy of the License at
1469 *
1470 *   http://www.apache.org/licenses/LICENSE-2.0
1471 *
1472 * Unless required by applicable law or agreed to in writing, software
1473 * distributed under the License is distributed on an "AS IS" BASIS,
1474 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1475 * See the License for the specific language governing permissions and
1476 * limitations under the License.
1477 */const F0="PersistentStream";class Gv{constructor(e,t,r,s,i,a,c,l){this.Tn=e,this.yn=r,this.wn=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new Uv(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state!==4?this.auth():this.On()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&(this.vn.cancel(),this.vn=null)}kn(){this.Sn&&(this.Sn.cancel(),this.Sn=null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e!==4?this.xn.reset():t&&t.code===J.RESOURCE_EXHAUSTED?(Rt(t.toString()),Rt("Using maximum backoff delay to prevent overloading the backend."),this.xn.fn()):t&&t.code===J.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;
1477const e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([r,s])=>{this.bn===t&&this.Kn(r,s)}),(r=>{e((()=>{const s=new de(J.UNKNOWN,"Fetching auth token failed: "+r.message);return this.Wn(s)}))}))}Kn(e,t){const r=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{r((()=>this.listener.Qt()))})),this.stream.zt((()=>{r((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((s=>{r((()=>this.Wn(s)))})),this.stream.onMessage((s=>{r((()=>++this.Dn==1?this.Gn(s):this.onNext(s)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return se(F0,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(se(F0,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class tP extends Gv{constructor(e,t,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}Qn(e,t){return this.connection.cn("Listen",e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();const t=$M(this.serializer,e),r=(function(i){if(!("targetChange"in i))return Ne.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?Ne.min():a.readTime?kn(a.readTime):Ne.min()})(e);return this.listener.zn(t,r)}jn(e){const t={};t.database=qp(this.serializer),t.addTarget=(function(i,a){let c;const l=a.target;if(c=$r(l)?{pipelineQuery:Vv(i,l)}:Q1(l)?{documents:Rv(i,l)}:{query:Ov(i,l).yt},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=Sv(i,a.resumeToken);const d=Vp(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(Ne.min())>0){c.readTime=co(i,a.snapshotVersion.toTimestamp());const d=Vp(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c})(this.serializer,e);const r=UM(this.serializer,e);r&&(t.labels=r),this.Bn(t)}Hn(e){const t={};t.database=qp(this.serializer),t.removeTarget=e,this.Bn(t)}}class nP extends Gv{constructor(e,t,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn("Write",e,t)}Gn(e){return ce(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,ce(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){ce(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();const t=BM(e.writeResults,e.commitTime),r=kn(e.commitTime);return this.listener.Xn(r,t)}er(){const e={};e.database=qp(this.serializer),this.Bn(e)}Yn(e){const t={streamToken:this.lastStreamToken,writes:e.map((r=>mu(this.serializer,r)))};this.Bn(t)}}/**
1478 * @license
1479 * Copyright 2017 Google LLC
1480 *
1481 * Licensed under the Apache License, Version 2.0 (the "License");
1482 * you may not use this file except in compliance with the License.
1483 * You may obtain a copy of the License at
1484 *
1485 *   http://www.apache.org/licenses/LICENSE-2.0
1486 *
1487 * Unless required by applicable law or agreed to in writing, software
1488 * distributed under the License is distributed on an "AS IS" BASIS,
1489 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1490 * See the License for the specific language governing permissions and
1491 * limitations under the License.
1492 */class rP{}class sP extends rP{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.tr=!1}nr(){if(this.tr)throw new de(J.FAILED_PRECONDITION,"The client has already been terminated.")}Bt(e,t,r,s){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Bt(e,Lp(t,r),s,i,a))).catch((i=>{throw i.name==="FirebaseError"?(i.code===J.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new de(J.UNKNOWN,i.toString())}))}$t(e,t,r,s,i){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,c])=>this.connection.$t(e,Lp(t,r),s,a,c,i))).catch((a=>{throw a.name==="FirebaseError"?(a.code===J.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new de(J.UNKNOWN,a.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}}function iP(n,e,t,r){return new sP(n,e,t,r)}/**
1493 * @license
1494 * Copyright 2020 Google LLC
1495 *
1496 * Licensed under the Apache License, Version 2.0 (the "License");
1497 * you may not use this file except in compliance with the License.
1498 * You may obtain a copy of the License at
1499 *
1500 *   http://www.apache.org/licenses/LICENSE-2.0
1501 *
1502 * Unless required by applicable law or agreed to in writing, software
1503 * distributed under the License is distributed on an "AS IS" BASIS,
1504 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1505 * See the License for the specific language governing permissions and
1506 * limitations under the License.
1507 */const aP="ComponentProvider",$0=new Map;function oP(n,e,t,r,s){return new aM(n,e,t,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,Bv(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/**
1508 * @license
1509 * Copyright 2018 Google LLC
1510 *
1511 * Licensed under the Apache License, Version 2.0 (the "License");
1512 * you may not use this file except in compliance with the License.
1513 * You may obtain a copy of the License at
1514 *
1515 *   http://www.apache.org/licenses/LICENSE-2.0
1516 *
1517 * Unless required by applicable law or agreed to in writing, software
1518 * distributed under the License is distributed on an "AS IS" BASIS,
1519 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1520 * See the License for the specific language governing permissions and
1521 * limitations under the License.
1522 */const B0={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Kv=41943040;class ln{static withCacheSize(e){return new ln(e,ln.DEFAULT_COLLECTION_PERCENTILE,ln.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}ln.DEFAULT_COLLECTION_PERCENTILE=10,ln.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ln.DEFAULT=new ln(Kv,ln.DEFAULT_COLLECTION_PERCENTILE,ln.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ln.DISABLED=new ln(-1,0,0);/**
1523 * @license
1524 * Copyright 2020 Google LLC
1525 *
1526 * Licensed under the Apache License, Version 2.0 (the "License");
1527 * you may not use this file except in compliance with the License.
1528 * You may obtain a copy of the License at
1529 *
1530 *   http://www.apache.org/licenses/LICENSE-2.0
1531 *
1532 * Unless required by applicable law or agreed to in writing, software
1533 * distributed under the License is distributed on an "AS IS" BASIS,
1534 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1535 * See the License for the specific language governing permissions and
1536 * limitations under the License.
1537 */const U0="LruGarbageCollector",Hv=1048576;function G0([n,e],[t,r]){const s=De(n,t);return s===0?De(e,r):s}class cP{constructor(e){this.rr=e,this.buffer=new rt(G0),this.ir=0}sr(){return++this.ir}_r(e){const t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{const r=this.buffer.last();G0(t,r)<0&&(this.buffer=this.buffer.delete(r).add(t))}}get maxValue(){return this.buffer.last()[0]}}class Wv{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&(this.ar.cancel(),this.ar=null)}get started(){return this.ar!==null}ur(e){se(U0,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){oi(t)?se(U0,"Ignoring IndexedDB error during garbage collection: ",t):await ai(t)}await this.ur(3e5)}))}}class lP{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((r=>Math.floor(t/100*r)))}nthSequenceNumber(e,t){if(t===0)return F.resolve(Nn.ce);const r=new cP(t);return this.cr.forEachTarget(e,(s=>r._r(s.sequenceNumber))).next((()=>this.cr.Er(e,(s=>r._r(s))))).next((()=>r.maxValue))}removeTargets(e,t,r){return this.cr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(se("LruGarbageCollector","Garbage collection skipped; disabled"),F.resolve(B0)):this.getCacheSize(e).next((r=>r<this.params.cacheSizeCollectionThreshold?(se("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),B0):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let r,s,i,a,c,l,d;const m=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((p=>(p>this.params.maximumSequenceNumbersToCollect?(se("LruGarbageCollector",`C
1537apping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${p}`),s=this.params.maximumSequenceNumbersToCollect):s=p,a=Date.now(),this.nthSequenceNumber(e,s)))).next((p=>(r=p,c=Date.now(),this.removeTargets(e,r,t)))).next((p=>(i=p,l=Date.now(),this.removeOrphanedDocuments(e,r)))).next((p=>(d=Date.now(),Aa()<=He.DEBUG&&se("LruGarbageCollector",`LRU Garbage Collection
1538	Counted targets in ${a-m}ms
1539	Determined least recently used ${s} in `+(c-a)+`ms
1540	Removed ${i} targets in `+(l-c)+`ms
1541	Removed ${p} documents in `+(d-l)+`ms
1542Total Duration: ${d-m}ms`),F.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:p}))))}}function Yv(n,e){return new lP(n,e)}/**
1543 * @license
1544 * Copyright 2020 Google LLC
1545 *
1546 * Licensed under the Apache License, Version 2.0 (the "License");
1547 * you may not use this file except in compliance with the License.
1548 * You may obtain a copy of the License at
1549 *
1550 *   http://www.apache.org/licenses/LICENSE-2.0
1551 *
1552 * Unless required by applicable law or agreed to in writing, software
1553 * distributed under the License is distributed on an "AS IS" BASIS,
1554 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1555 * See the License for the specific language governing permissions and
1556 * limitations under the License.
1557 */const dP="firestore.googleapis.com",K0=!0;class H0{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new de(J.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=dP,this.ssl=K0}else this.host=e.host,this.ssl=e.ssl??K0;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=Kv;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Hv)throw new de(J.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}TC("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Bv(e.experimentalLongPollingOptions??{}),(function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new de(J.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new de(J.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new de(J.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(r,s){return r.timeoutSeconds===s.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class rf{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new H0({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new de(J.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new de(J.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new H0(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(r){if(!r)return new yC;switch(r.type){case"firstParty":return new vC(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new de(J.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
1557d credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(t){const r=$0.get(t);r&&(se(aP,"Removing Datastore"),$0.delete(t),r.terminate())})(this),Promise.resolve()}}/**
1558 * @license
1559 * Copyright 2020 Google LLC
1560 *
1561 * Licensed under the Apache License, Version 2.0 (the "License");
1562 * you may not use this file except in compliance with the License.
1563 * You may obtain a copy of the License at
1564 *
1565 *   http://www.apache.org/licenses/LICENSE-2.0
1566 *
1567 * Unless required by applicable law or agreed to in writing, software
1568 * distributed under the License is distributed on an "AS IS" BASIS,
1569 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1570 * See the License for the specific language governing permissions and
1571 * limitations under the License.
1572 */class li{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new li(this.firestore,e,this._query)}}class St{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Fs(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new St(this.firestore,e,this._key)}toJSON(){return{type:St._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,r){if(Il(t,St._jsonSchema))return new St(e,r||null,new me(Ke.fromString(t.referencePath)))}}St._jsonSchemaVersion="firestore/documentReference/1.0",St._jsonSchema={type:Lt("string",St._jsonSchemaVersion),referencePath:Lt("string")};class Fs extends li{constructor(e,t,r){super(e,t,jl(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new St(this.firestore,null,new me(e))}withConverter(e){return new Fs(this.firestore,e,this._path)}}function Eo(n,e,...t){if(n=Cn(n),R4("collection","path",e),n instanceof rf){const r=Ke.fromString(e,...t);return m0(r),new Fs(n,null,r)}{if(!(n instanceof St||n instanceof Fs))throw new de(J.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Ke.fromString(e,...t));return m0(r),new Fs(n.firestore,null,r)}}function ra(n,e,...t){if(n=Cn(n),arguments.length===1&&(e=O1.newId()),R4("doc","path",e),n instanceof rf){const r=Ke.fromString(e,...t);return h0(r),new St(n,null,new me(r))}{if(!(n instanceof St||n instanceof Fs))throw new de(J.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(Ke.fromString(e,...t));return h0(r),new St(n.firestore,n instanceof Fs?n.converter:null,new me(r))}}/**
1573 * @license
1574 * Copyright 2017 Google LLC
1575 *
1576 * Licensed under the Apache License, Version 2.0 (the "License");
1577 * you may not use this file except in compliance with the License.
1578 * You may obtain a copy of the License at
1579 *
1580 *   http://www.apache.org/licenses/LICENSE-2.0
1581 *
1582 * Unless required by applicable law or agreed to in writing, software
1583 * distributed under the License is distributed on an "AS IS" BASIS,
1584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1585 * See the License for the specific language governing permissions and
1586 * limitations under the License.
1587 *//**
1588 * @license
1589 * Copyright 2024 Google LLC
1590 *
1591 * Licensed under the Apache License, Version 2.0 (the "License");
1592 * you may not use this file except in compliance with the License.
1593 * You may obtain a copy of the License at
1594 *
1595 *   http://www.apache.org/licenses/LICENSE-2.0
1596 *
1597 * Unless required by applicable law or agreed to in writing, softw
1597are
1598 * distributed under the License is distributed on an "AS IS" BASIS,
1599 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1600 * See the License for the specific language governing permissions and
1601 * limitations under the License.
1602 */class An{constructor(e){this._values=(e||[]).map((t=>t))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:An._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Il(e,An._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((t=>typeof t=="number")))return new An(e.vectorValues);throw new de(J.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}An._jsonSchemaVersion="firestore/vectorValue/1.0",An._jsonSchema={type:Lt("string",An._jsonSchemaVersion),vectorValues:Lt("object")};/**
1603 * @license
1604 * Copyright 2017 Google LLC
1605 *
1606 * Licensed under the Apache License, Version 2.0 (the "License");
1607 * you may not use this file except in compliance with the License.
1608 * You may obtain a copy of the License at
1609 *
1610 *   http://www.apache.org/licenses/LICENSE-2.0
1611 *
1612 * Unless required by applicable law or agreed to in writing, software
1613 * distributed under the License is distributed on an "AS IS" BASIS,
1614 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1615 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1617 */const uP=/^__.*__$/;class hP{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new ci(e,this.data,this.fieldMask,t,this.fieldTransforms):new jo(e,this.data,t,this.fieldTransforms)}}function Qv(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ye(40011,{dataSource:n})}}class fh{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new fh({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var s;const t=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){var s;const t=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:t,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return pu(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(Qv(this.dataSource)&&uP.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class mP{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||mh(e)}createContext(e,t,r,s=!1){return new fh({dataSource:e,methodName:t,targetDoc:r,path:ft.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Zv(n){const e=n._freezeSettings(),t=mh(n._databaseId);return new mP(n._databaseId,!!e.ignoreUndefinedProperties,t)}function pP(n,e,t,r,s,i={}){const a=n.createContext(i.merge||i.mergeFields?2:0,e,t,s);t3("Data must be an object, but it was:",a,r);const c=Xv(r,a);let l,d;if(i.merge)l=new Qn(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const m=[];for(const p of i.mergeFields){const f=No(e,p,t);if(!a.contains(f))throw new de(J.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);bP(m,f)||m.push(f)}l=new Qn(m),d=a.fieldTransforms.filter((p=>l.covers(p.field)))}else l=null,d=a.fieldTransforms;return new hP(new _n(c),l,d)}function Jv(n,e,t){return new fh({dataSource:3,targetDoc:e.settings.targetDoc,methodName:n._methodName,arrayElement:t},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class sf extends ph{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=Jv(this,e,!0),r=this.Tr.map((i=>Qs(i,t))),s=new Bi(r);return new H1(e.path,s)}isEqual(e){return e instanceof sf&&Jr(this.Tr,e.Tr)}}class af extends ph{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=Jv(this,e,!0),r=this.Tr.map((i=>Qs(i,t))),s=new Ui(r);return new H1(e.path,s)}isEqual(e){return e instanceof af&&Jr(this.Tr,e.Tr)}}function fP(n,e,t,r=!1){return Qs(t,n.createContext(r?4:3,e))}
1617function Qs(n,e,t){if(e3(n=Cn(n)))return t3("Unsupported field value:",e,n),Xv(n,e);if(n instanceof ph)return(function(s,i){if(!Qv(i.dataSource))throw i.createError(`${s._methodName}() can only be used with update() and set()`);if(!i.path)throw i.createError(`${s._methodName}() is not currently supported inside arrays`);const a=s._toFieldTransform(i);a&&i.fieldTransforms.push(a)})(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return(function(s,i){const a=[];let c=0;for(const l of s){let d=Qs(l,i.childContextForArray(c));d==null&&(d={nullValue:"NULL_VALUE"}),a.push(d),c++}return{arrayValue:{values:a}}})(n,e)}return(function(s,i,a){if((s=Cn(s))===null)return{nullValue:"NULL_VALUE"};if(typeof s=="number")return G1(i.serializer,s,a);if(typeof s=="boolean")return{booleanValue:s};if(typeof s=="string")return{stringValue:s};if(s instanceof Date){const c=st.fromDate(s);return{timestampValue:co(i.serializer,c)}}if(s instanceof st){const c=new st(s.seconds,1e3*Math.floor(s.nanoseconds/1e3));return{timestampValue:co(i.serializer,c)}}if(s instanceof Cr)return{geoPointValue:{latitude:s.latitude,longitude:s.longitude}};if(s instanceof Yn)return{bytesValue:Sv(i.serializer,s._byteString)};if(s instanceof St){const c=i.databaseId,l=s.firestore._databaseId;if(!l.isEqual(c))throw i.createError(`Document reference is for database ${l.projectId}/${l.database} but should be for database ${c.projectId}/${c.database}`);return{referenceValue:tf(s.firestore._databaseId||i.databaseId,s._key.path)}}if(s instanceof An)return(function(l,d){const m=l instanceof An?l.toArray():l;return{mapValue:{fields:{[$1]:{stringValue:B1},[Fi]:{arrayValue:{values:m.map((f=>{if(typeof f!="number")throw d.createError("VectorValues must only contain numeric values.");return ch(d.serializer,f)}))}}}}}})(s,i);if(Fv(s))return s._toProto(i.serializer);throw i.createError(`Unsupported field value: ${th(s)}`)})(n,e,t)}function Xv(n,e){const t={};return Z4(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):na(n,((r,s)=>{const i=Qs(s,e.childContextForField(r));i!=null&&(t[r]=i)})),{mapValue:{fields:t}}}function e3(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof st||n instanceof Cr||n instanceof Yn||n instanceof St||n instanceof ph||n instanceof An||Fv(n))}function t3(n,e,t){if(!e3(t)||!vl(t)){const r=th(t);throw r==="an object"?e.createError(n+" a custom object"):e.createError(n+" "+r)}}function No(n,e,t){if((e=Cn(e))instanceof nf)return e._internalPath;if(typeof e=="string")return yP(n,e);throw pu("Field path arguments must be of type string or ",n,!1,void 0,t)}const gP=new RegExp("[~\\*/\\[\\]]");function yP(n,e,t){if(e.search(gP)>=0)throw pu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new nf(...e.split("."))._internalPath}catch{throw pu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function pu(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new de(J.INVALID_ARGUMENT,c+n+l)}function bP(n,e){return n.some((t=>t.isEqual(e)))}function n3(n){return typeof n._readUserData=="function"}/**
1618 * @license
1619 * Copyright 2025 Google LLC
1620 *
1621 * Licensed under the Apache License, Version 2.0 (the "License");
1622 * you may not use this file except in compliance with the License.
1623 * You may obtain a copy of the License at
1624 *
1625 *   http://www.apache.org/licenses/LICENSE-2.0
1626 *
1627 * Unless required by applicable law or agreed to in writing, software
1628 * distributed under the License is distributed on an "AS IS" BASIS,
1629 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1630 * See the License for the specific language governing permissions and
1631 * limitations under the License.
1632 */class gn{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const r=_n.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const i=this.optionDefinitions[s];if(s in e){const a=e[s];let c;i.nestedOptions&&vl(a)?c={mapValue:{fields:new gn(i.nestedOptions).getOptionsProto(t,a)}}:a&&(c=Qs(a,t)??void 0),c&&r.set(ft.fromServerFormat(i.serverName),c)}}return r}getOptionsProto(e,t,r){const s=this._getKnownOptions(t,e);if(r){const i=new Map(sM(r,((a,c)=>[ft.fromServerFormat(c),a!==void 0?Qs(a,e):null])));s.setAll(i)}return s.value.mapValue.fields??{}}}/**
1633 * @license
1634 * Copyright 2024 Google LLC
1635 *
1636 * Licensed under the Apache License, Version 2.0 (the "License");
1637 * you may not use this file except in compliance with the License.
1638 * You may obtain a copy of the License at
1639 *
1640 *   http://www.apache.org/licenses/LICENSE-2.0
1641 *
1642 * Unless required by applicable law or agreed to in writing, software
1643 * distributed under the License is distributed on an "AS IS" BASIS,
1644 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1645 * See the License for the specific language governing permissions and
1646 * limitations under the License.
1647 */function xP(n){return typeof n=="object"&&n!==null&&!!("nullValue"in n&&(n.nullValue===null||n.nullValue==="NULL_VALUE")||"booleanValue"in n&&(n.booleanValue===null||typeof n.booleanValue=="boolean")||"integerValue"in n&&(n.integerValue===null||typeof n.integerValue=="number"||typeof n.integerValue=="string")||"doubleValue"in n&&(n.doubleValue===null||typeof n.doubleValue=="number")||"timestampValue"in n&&(n.timestampValue===null||(function(t){return typeof t=="object"&&t!==null&&"seconds"in t&&(t.seconds===null||typeof t.seconds=="number"||typeof t.seconds=="string")&&"nanos"in t&&(t.nanos===null||typeof t.nanos=="number")})(n.timestampValue))||"stringValue"in n&&(n.stringValue===null||typeof n.stringValue=="string")||"bytesValue"in n&&(n.bytesValue===null||n.bytesValue instanceof Uint8Array)||"referenceValue"in n&&(n.referenceValue===null||typeof n.referenceValue=="string")||"geoPointValue"in n&&(n.geoPointValue===null||(function(t){return typeof t=="object"&&t!==null&&"latitude"in t&&(t.latitude===null||typeof t.latitude=="number")&&"longitude"in t&&(t.longitude===null||typeof t.longitude=="number")})(n.geoPointValue))||"arrayValue"in n&&(n.arrayValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("values"in t)||t.values!==null&&!Array.isArray(t.values))})(n.arrayValue))||"mapValue"in n&&(n.mapValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("fields"in t)||t.fields!==null&&!vl(t.fields))})(n.mapValue))||"fieldReferenceValue"in n&&(n.fieldReferenceValue===null||typeof n.fieldReferenceValue=="string")||"functionValue"in n&&(n.functionValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("name"in t)||t.name!==null&&typeof t.name!="string"||!("args"in t)||t.args!==null&&!Array.isArray(t.args))})(n.functionValue))||"pipelineValue"in n&&(n.pipelineValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("stages"in t)||t.stages!==null&&!Array.isArray(t.stages))})(n.pipelineValue)))}function r3(...n){return new sf("arrayUnion",n)}function vP(...n){return new af("arrayRemove",n)}function IP(n){return new An(n)}/**
1648 * @license
1649 * Copyright 2024 Google LLC
1650 *
1651 * Licensed under the Apache License, Version 2.0 (the "License");
1652 * you may not use this file except in compliance with the License.
1653 * You may obtain a copy of the License at
1654 *
1655 *   http://www.apache.org/licenses/LICENSE-2.0
1656 *
1657 * Unless required by applicable law or agreed to in writing, software
1658 * distributed under the License is distributed on an "AS IS" BASIS,
1659 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1660 * See the License for the specific language governing permissions and
1661 * limitations under the License.
1662 */function he(n){let e;return n instanceof sa?n:(e=vl(n)?TP(n):n instanceof Array?EP(n):s3(n,void 0),e)}function Mm(n){if(n instanceof sa)return n;if(n instanceof An)return Xc(n);if(Array.isArray(n))return Xc(IP(n));throw new Error("Unsupported value: "+typeof n)}function of(n){return CC(n)?Od(n):he(n)}class sa{constructor(){this._protoValueType="ProtoValue"}add(e){return new Q("add",[this,he(e)],"add")}asBoolean(){if(this instanceof Zs)return this;if(this instanceof aa)return new a3(this);if(this instanceof ia)return new jP(this);if(this instanceof Q)return new i3(this);throw new de("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new Q("subtract",[this,he(e)],"subtract")}multiply(e){return new Q("multiply",[this,he(e)],"multiply")}divide(e){return new Q("divide",[this,he(e)],"divide")}mod(e){return new Q("mod",[this,he(e)],"mod")}equal(e){return new Q("equal",[this,he(e)],"equal").asBoolean()}notEqual(e){return new Q("not_equal",[this,he(e)],"notEqual").asBoolean()}lessThan(e){return new Q("less_than",[this,he(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new Q("less_than_or_equal",[this,he(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new Q("greater_than",[this,he(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new Q("greater_than_or_equal",[this,he(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const r=[e,...t].map((s=>he(s)));return new Q("array_concat",[this,...r],"arrayConcat")}arrayContains(e){return new Q("array_contains",[this,he(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new fc(e.map(he),"arrayContainsAll"):e;return new Q("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new fc(e.map(he),"arrayContainsAny"):e;return new Q("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new Q("array_reverse",[this])}arrayLength(){return new Q("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new fc(e.map(he),"equalAny"):e;return new Q("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new fc(e.map(he),"notEqualAny"):e;return new Q("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new Q("exists",[this],"exists").asBoolean()}charLength(){return new Q("char_length",[this],"charLength")}like(e){return new Q("like",[this,he(e)],"like").asBoolean()}regexContains(e){return new Q("regex_contains",[this,he(e)],"regexContains").asBoolean()}regexFind(e){return new Q("regex_find",[this,he(e)],"regexFind")}regexFindAll(e){return new Q("regex_find_all",[this,he(e)],"regexFindAll")}regexMatch(e){return new Q("regex_match",[this,he(e)],"regexMatch").asBoolean()}stringContains(e){return new Q("string_contains",[this,he(e)],"stringContains").asBoolean()}startsWith(e){return new Q("starts_with",[this,he(e)],"startsWith").asBoolean()}endsWith(e){return new Q("ends_with",[this,he(e)],"endsWith").asBoolean()}toLower(){return new Q("to_lower",[this],"toLower")}toUpper(){return new Q("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(he(e)),new Q("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(he(e)),new Q("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(he(e)),new Q("rtrim",t,"rtrim")}type(){return new Q("type",[this])}isType(e){return new Q("is_type",[this,Xc(e)],"isType").asBoolean()}stringConcat(e,...t){const r=[e,...t].map(he);return new Q("string_concat",[this,...r],"stringConcat")}stringIndexOf(e){return new Q("string_index_of",[this,he(e)],"stringIndexOf")}stringRepeat(e){return new Q("string_repeat",[this,he(e)],"stringRepeat")}stringReplaceAll(e,t){return new Q("string_replace_all",[this,he(e),he(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new Q("string_replace_one",[this,he(e),he(t)],"stringReplaceOne")}concat(e,...t){const r=[e,...t].map(he);return new Q("concat",[this,...r],"concat")}reverse(){return new Q("reverse",[this],"reverse")}arrayFilter(e,t){return new Q("array_filter",[this,he(e),t],"arrayFilter")}arrayTransform(e,t){return new Q("array_transform",[this,he(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,r){return new Q("array_transform",[this,he(e),he(t),r],"arrayTransformWithIndex")}arraySlice(e,t){const r=[this,he(e)];return t!==void 0&&r.push(he(t)),new Q("array_slice",r,"arraySlice")}arrayFirst(){return new Q("array_first",[this],"arrayFirst")}arrayFirstN(e){return new Q("array_first_n",[this,he(e)],"arrayFirstN")}arrayLast(){return new Q("array_last",[this],"arrayLast")}arrayLastN(e){return new Q("array_last_n",[this,he(e)],"arrayLastN")}arrayMaximum(){return new Q("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new Q("maximum_n",[this,he(e)],"arrayMaximumN")}arrayMinimum(){return new Q("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new Q("minimum_n",[this,he(e)],"arrayMinimumN")}arrayIndexOf(e){return new Q("array_index_of",[this,he(e),he("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new Q("array_index_of",[this,he(e),he("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new Q("array_index_of_all",[this,he(e)],"arrayIndexOfAll")}byteLength(){return new Q("byte_length",[this],"byteLength")}ceil(){return new Q("ceil",[this])}floor(){return new Q("floor",[this])}abs(){return new Q("abs",[this])}exp(){return new Q("exp",[this])}mapGet(e){return new Q("map_get",[this,Xc(e)],"mapGet")}
vendor: 4,390 bytes, line 1662
1662mapSet(e,t,...r){const s=[this,he(e),he(t),...r.map(he)];return new Q("map_set",s,"mapSet")}mapKeys(){return new Q("map_keys",[this],"mapKeys")}mapValues(){return new Q("map_values",[this],"mapValues")}mapEntries(){return new Q("map_entries",[this],"mapEntries")}getField(e){return new Q("get_field",[this,he(e)],"get_field")}count(){return qn._create("count",[this],"count")}sum(){return qn._create("sum",[this],"sum")}average(){return qn._create("average",[this],"average")}minimum(){return qn._create("minimum",[this],"minimum")}maximum(){return qn._create("maximum",[this],"maximum")}first(){return qn._create("first",[this],"first")}last(){return qn._create("last",[this],"last")}arrayAgg(){return qn._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return qn._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return qn._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const r=[e,...t];return new Q("maximum",[this,...r.map(he)],"logicalMaximum")}logicalMinimum(e,...t){const r=[e,...t];return new Q("minimum",[this,...r.map(he)],"minimum")}vectorLength(){return new Q("vector_length",[this],"vectorLength")}cosineDistance(e){return new Q("cosine_distance",[this,Mm(e)],"cosineDistance")}dotProduct(e){return new Q("dot_product",[this,Mm(e)],"dotProduct")}euclideanDistance(e){return new Q("euclidean_distance",[this,Mm(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new Q("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new Q("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new Q("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new Q("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new Q("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new Q("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new Q("timestamp_add",[this,he(e),he(t)],"timestampAdd")}timestampSubtract(e,t){return new Q("timestamp_subtract",[this,he(e),he(t)],"timestampSubtract")}timestampDiff(e,t){return new Q("timestamp_diff",[this,of(e),he(t)],"timestampDiff")}timestampExtract(e,t){const r=[this,he(e)];return t&&r.push(he(t)),new Q("timestamp_extract",r,"timestampExtract")}documentId(){return new Q("document_id",[this],"documentId")}parent(){return new Q("parent",[this],"parent")}substring(e,t){const r=he(e);return new Q("substring",t===void 0?[this,r]:[this,r,he(t)],"substring")}arrayGet(e){return new Q("array_get",[this,he(e)],"arrayGet")}isError(){return new Q("is_error",[this],"isError").asBoolean()}ifError(e){const t=new Q("if_error",[this,he(e)],"ifError");return e instanceof Zs?t.asBoolean():t}isAbsent(){return new Q("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new Q("map_remove",[this,he(e)],"mapRemove")}mapMerge(e,...t){const r=he(e),s=t.map(he);return new Q("map_merge",[this,r,...s],"mapMerge")}pow(e){return new Q("pow",[this,he(e)])}trunc(e){return e===void 0?new Q("trunc",[this]):new Q("trunc",[this,he(e)],"trunc")}round(e){return e===void 0?new Q("round",[this]):new Q("round",[this,he(e)],"round")}collectionId(){return new Q("collection_id",[this])}length(){return new Q("length",[this])}ln(){return new Q("ln",[this])}sqrt(){return new Q("sqrt",[this])}stringReverse(){return new Q("string_reverse",[this])}ifAbsent(e){return new Q("if_absent",[this,he(e)],"ifAbsent")}ifNull(e){return new Q("if_null",[this,he(e)],"ifNull")}coalesce(e,...t){return new Q("coalesce",[this,he(e),...t.map(he)],"coalesce")}join(e){return new Q("join",[this,he(e)],"join")}log10(){return new Q("log10",[this])}arraySum(){return new Q("sum",[this])}split(e){return new Q("split",[this,he(e)])}timestampTruncate(e,t){const r=[this,he(e)];return t&&r.push(he(t)),new Q("timestamp_trunc",r)}ascending(){return NP(this)}descending(){return SP(this)}as(e){return new kP(this,e,"as")}}class qn{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,r){const s=new qn(e,t);return s._methodName=r,s}as(e){return new _P(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}
1662):e,this.params.forEach((t=>t._readUserData(e)))}}class _P{constructor(e,t,r){this.aggregate=e,this.alias=t,this._methodName=r}_readUserData(e){this.aggregate._readUserData(e)}}class kP{constructor(e,t,r){this.expr=e,this.alias=t,this._methodName=r,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class fc extends sa{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}}let ia=class extends sa{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new Q("geo_distance",[this,he(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}};function Od(n){return wP(n,"field")}function wP(n,e){return new ia(typeof n=="string"?kr===n?YM()._internalPath:No("field",n):n._internalPath,e)}class aa extends sa{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new aa(e,void 0);return t._protoValue=e,t}_toProto(e){return ce(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,xP(this._protoValue)||(this._protoValue=Qs(this.value,e))}}function Xc(n,e){return s3(n,"constant")}function s3(n,e){const t=new aa(n,e);return typeof n=="boolean"?new a3(t):t}class Q extends sa{constructor(e,t,r,s){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,r!==void 0&&(this._methodName=r),s!==void 0&&(this._options=s)}get _optionsUtil(){return new gn({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map((r=>r._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class Zs extends sa{get _methodName(){return this._expr._methodName}countIf(){return qn._create("count_if",[this],"countIf")}not(){return new Q("not",[this],"not").asBoolean()}conditional(e,t){return new Q("conditional",[this,e,t],"conditional")}ifError(e){const t=he(e),r=new Q("if_error",[this,t],"ifError");return t instanceof Zs?r.asBoolean():r}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class i3 extends Zs{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class a3 extends Zs{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class jP extends Zs{constructor(e){super(),this._expr=e,this.expressionType="Field"}}function TP(n,e){const t=[];for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const s=n[r];t.push(Xc(r)),t.push(he(s))}return new Q("map",t,"map")}function EP(n){return(function(t,r){return new Q("array",t.map((s=>he(s))),r)})(n,"array")}function NP(n){return new cf(of(n),"ascending","ascending")}function SP(n){return new cf(of(n),"descending","descending")}class cf{constructor(e,t,r){this.expr=e,this.direction=t,this._methodName=r,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:$v(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}/**
1663 * @license
1664 * Copyright 2024 Google LLC
1665 *
1666 * Licensed under the Apache License, Version 2.0 (the "License");
1667 * you may not use this file except in compliance with the License.
1668 * You may obtain a copy of the License at
1669 *
1670 *   http://www.apache.org/licenses/LICENSE-2.0
1671 *
1672 * Unless required by applicable law or agreed to in writing, software
1673 * distributed under the License is distributed on an "AS IS" BASIS,
1674 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1675 * See the License for the specific language governing permissions and
1676 * limitations under the License.
1677 */class Un{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class o3 extends Un{get _name(){return"add_fields"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[Jc(e,this.fields)]}}_readUserData(e){super._readUserData(e),Xs(this.fields,e)}}class c3 extends Un{get _name(){return"aggregate"}get _optionsUtil(){return new gn({})}constructor(e,t,r){super(r),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[Jc(e,this.accumulators),Jc(e,this.groups)]}}_readUserData(e){super._readUserData(e),Xs(this.groups,e),Xs(this.accumulators,e)}}class l3 extends Un{get _name(){return"distinct"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[Jc(e,this.groups)]}}_readUserData(e){super._readUserData(e),Xs(this.groups,e)}}class El extends Un{get _name(){return"collection"}get _optionsUtil(){return new gn({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.Vr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}}class Nl extends Un{get _name(){return"collection_group"}get _optionsUtil(){return new gn({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class gh extends Un{get _name(){return"database"}get _optionsUtil(){return new gn({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class yh extends Un{get _name(){return"documents"}get _optionsUtil(){return new gn({})}constructor(e,t){if(super(t),!e||e.length===0)throw new de(J.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const r=e.map((i=>i.startsWith("/")?i:"/"+i)),s=new Set(r);if(s.size!==r.length)throw new de(J.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.dr=r,this.mr=s}_toProto(e){return{...super._toProto(e),args:this.dr.map((t=>({referenceValue:t})))}}_readUserData(e){super._readUserData(e)}}class Sl extends Un{get _name(){return"where"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Xs(this.condition,e)}}class Js extends Un{get _name(){return"limit"}get _optionsUtil(){return new gn({})}constructor(e,t){ce(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[G1(e,this.limit)]}}}class W0 extends Un{get _name(){return"offset"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[G1(e,this.offset)]}}}class AP extends Un{get _name(){return"select"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[Jc(e,this.selections)]}}_readUserData(e){super._readUserData(e),Xs(this.selections,e)}}class Tr extends Un{get _name(){return"sort"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),Xs(this.orderings,e)}}class lf extends Un{get _name(){return"replace_with"}get _optionsUtil(){return new gn({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),$v(lf.pr)]}}_readUserData(e){super._readUserData(e),Xs(this.map,e)}}lf.pr="full_replace";function Xs(n,e){return n3(n)?n._readUserData(e):Array.isArray(n)?n.forEac
1677h((t=>t._readUserData(e))):n instanceof Map?n.forEach((t=>t._readUserData(e))):Object.values(n).forEach((t=>t._readUserData(e))),n}// Copyright 2024 Google LLC* @license
1678class dn{constructor(e,t,r){this.serializer=e,this.stages=t,this.listenOptions=r,this.isCorePipeline=!0}getPipelineCollection(){return Al(this)}getPipelineCollectionGroup(){return df(this)}getPipelineCollectionId(){return d3(this)}getPipelineDocuments(){return fu(this)}getPipelineFlavor(){return(function(t){let r="exact";return t.stages.forEach(((s,i)=>{s._name!==l3.name&&s._name!==c3.name||(r="keyless"),s._name===AP.name&&r==="exact"&&(r="augmented"),s._name===o3.name&&i<t.stages.length-1&&r==="exact"&&(r="augmented")})),r})(this)}getPipelineSourceType(){return Hr(this)}}function Hr(n){const e=n.stages[0];return e instanceof El||e instanceof Nl||e instanceof gh||e instanceof yh?e._name:"unknown"}function Al(n){if(Hr(n)==="collection")return n.stages[0].Vr}function df(n){if(Hr(n)==="collection_group")return n.stages[0].collectionId}function d3(n){switch(Hr(n)){case"collection":return Ke.fromString(Al(n)).lastSegment();case"collection_group":return df(n);default:return}}function fu(n){if(Hr(n)==="documents")return n.stages[0].dr}class Mc{constructor(e,t,r,s){this._db=e,this.userDataReader=t,this._userDataWriter=r,this.stages=s}wr(e,t){const r=this.userDataReader.createContext(3,e);return n3(t)?t._readUserData(r):Array.isArray(t)?t.forEach((s=>s._readUserData(r))):t.forEach((s=>s._readUserData(r))),t}where(e){const t=this.stages.map((r=>r));return this.wr("where",e),t.push(new Sl(e,{})),new Mc(this._db,this.userDataReader,this._userDataWriter,t)}limit(e){const t=this.stages.map((r=>r));return t.push(new Js(e,{})),new Mc(this._db,this.userDataReader,this._userDataWriter,t)}sort(e,...t){const r=this.stages.map((s=>s));return"orderings"in e?r.push(new Tr(this.wr("sort",e.orderings),{})):r.push(new Tr(this.wr("sort",[e,...t]),{})),new Mc(this._db,this.userDataReader,this._userDataWriter,r)}br(e){return{pipeline:{stages:this.stages.map((t=>t._toProto(e)))}}}}// Copyright 2024 Google LLC* @license
1679class q{constructor(e,t){this.type=e,this.value=t}static vr(){return new q("ERROR",void 0)}static Sr(){return new q("UNSET",void 0)}static Dr(){return new q("NULL",Ar)}static newValue(e){return Fn(e)?new q("NULL",Ar):(function(r){return!!r&&"booleanValue"in r})(e)?new q("BOOLEAN",e):jr(e)?new q("INT",e):Si(e)?new q("DOUBLE",e):(function(r){return!!r&&"timestampValue"in r&&!!r.timestampValue})(e)?new q("TIMESTAMP",e):(function(r){return!!r&&"stringValue"in r})(e)?new q("STRING",e):(function(r){return!!r&&"bytesValue"in r})(e)?new q("BYTES",e):e.referenceValue?new q("REFERENCE",e):e.geoPointValue?new q("GEO_POINT",e):Ys(e)?new q("ARRAY",e):$i(e)?new q("VECTOR",e):Mi(e)?new q("MAP",e):new q("ERROR",void 0)}Cr(){return this.type==="ERROR"||this.type==="UNSET"}Fr(){return this.type==="NULL"}}function Pc(n){if(!n.Cr())return n.value}function u3(n){return n instanceof Zs?n._expr:n}function Ce(n){if((n=u3(n))instanceof ia)return new CP(n);if(n instanceof aa)return new MP(n);if(n instanceof fc)return new PP(n);if(n instanceof Q){if(n.name==="add")return new DP(n);if(n.name==="subtract")return new VP(n);if(n.name==="multiply")return new LP(n);if(n.name==="divide")return new qP(n);if(n.name==="mod")return new zP(n);if(n.name==="and")return new FP(n);if(n.name==="equal")return new XP(n);if(n.name==="not_equal")return new eR(n);if(n.name==="less_than")return new tR(n);if(n.name==="less_than_or_equal")return new nR(n);if(n.name==="greater_than")return new rR(n);if(n.name==="greater_than_or_equal")return new sR(n);if(n.name==="array_concat")return new iR(n);if(n.name==="array_reverse")return new aR(n);if(n.name==="array_contains")return new oR(n);if(n.name==="array_contains_all")return new cR(n);if(n.name==="array_contains_any")return new lR(n);if(n.name==="array_length")return new dR(n);if(n.name==="array_element")return new uR(n);if(n.name==="equal_any")return new h3(n);if(n.name==="not_equal_any")return new BP(n);if(n.name==="is_nan")return new UP(n);if(n.name==="is_not_nan")return new GP(n);if(n.name==="is_null")return new KP(n);if(n.name==="is_not_null")return new HP(n);if(n.name==="is_error")return new WP(n);if(n.name==="exists")return new YP(n);if(n.name==="not")return new bh(n);if(n.name==="or")return new $P(n);if(n.name==="xor")return new uf(n);if(n.name==="conditional")return new QP(n);if(n.name==="maximum")return new ZP(n);if(n.name==="minimum")return new JP(n);if(n.name==="reverse")return new hR(n);if(n.name==="replace_first")return new mR(n);if(n.name==="replace_all")return new pR(n);if(n.name==="char_length")return new fR(n);if(n.name==="byte_length")return new gR(n);if(n.name==="like")return new yR(n);if(n.name==="regex_contains")return new bR(n);if(n.name==="regex_match")return new xR(n);if(n.name==="string_contains")return new vR(n);if(n.name==="starts_with")return new IR(n);if(n.name==="ends_with")return new _R(n);if(n.name==="to_lower")return new kR(n);if(n.name==="to_upper")return new wR(n);if(n.name==="trim")return new jR(n);if(n.name==="string_concat")return new TR(n);if(n.name==="map_get")return new ER(n);if(n.name==="cosine_distance")return new NR(n);if(n.name==="dot_product")return new SR(n);if(n.name==="euclidean_distance")return new AR(n);if(n.name==="vector_length")return new CR(n);if(n.name==="unix_micros_to_timestamp")return new DR(n);if(n.name==="timestamp_to_unix_micros")return new qR(n);if(n.name==="unix_millis_to_timestamp")return new VR(n);if(n.name==="timestamp_to_unix_millis")return new zR(n);if(n.name==="unix_seconds_to_timestamp")return new LR(n);if(n.name==="timestamp_to_unix_seconds")return new FR(n);if(n.name==="timestamp_add")return new $R(n);if(n.name==="timestamp_subtract")return new BR(n)}throw new Error(`Unknown Expr : ${n}`)}class CP{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===kr)return q.newValue({referenceValue:Zc(e.serializer,t.key)});if(this.expr.fieldName==="__update_time__")return q.newValue({timestampValue:Rd(e.serializer,t.version)});if(this.expr.fieldName==="__create_time__")return q.newValue({timestampValue:Rd(e.serializer,t.createTime)});const r=t.data.field(this.expr._fieldPath);return r?oh(r)?q.newValue((function(i,a){if(i.serverTimestampBehavior==="estimate")return{timestampValue:Rd(i.serializer,Ne.fromTimestamp(ro(a)))};if(i.serverTimestampBehavior==="previous"){const c=kl(a);if(c)return c}return{nullValue:"NULL_VALUE"}})(e,r)):q.newValue(r):q.Sr()}}class MP{constructor(e){this.expr=e}evaluate(e,t){return q.newValue(this.expr._getValue())}}class PP{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.Rr.map((s=>Ce(s).evaluate(e,t)));return r.some((s=>s.Cr()))?q.vr():q.newValue({arrayValue:{values:r.map((s=>s.value))}})}}function Jt(n){return Si(n)?Number(n.doubleValue):Number(n.integerValue)}function Or(n){return BigInt(n.integerValue)}const RP=BigInt("0x7fffffffffffffff"),OP=-BigInt("0x8000000000000000");class Cl{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length>=2,24778);const r=Ce(this.expr.params[0]).evaluate(e,t),s=Ce(this.expr.params[1]).evaluate(e,t);let i=this.Or(r,s);for(const a of this.expr.params.slice(2)){const c=Ce(a).evaluate(e,t);i=this.Or(i,c)}return i}Or(e,t){if(e.Cr()||t.Cr())return q.vr();if(e.Fr()||t.Fr())return q.Dr();const r=e.value,s=t.value;if(!Si(r)&&!jr(r)||!Si(s)&&!jr(s))return q.vr();if(Si(r)||Si(s)){const i=this.Mr(r,s);return i?q.newValue(i):q.vr()}if(jr(r)&&jr(s)){const i=this.Nr(r,s);return i===void 0?q.vr():typeof i=="number"?q.newValue({doubleValue:i}):i<OP||i>RP?q.vr():q.newValue({integerValue:`${i}`})}return q.vr()}}function ns(n,e){return qt(n)!==qt(e)?"TYPE_MISMATCH":Pn(n)||Pn(e)?"NOT_EQ":Fn(n)&&Fn(e)?"EQ":Fn(n)||Fn(e)?"NULL":Ys(n)&&Ys(e)?(function(r,s){var a,c,l;if(((a=r.values)==null?void 0:a.length)!==((c=s.values)==null?void 0:c.length))return"NOT_EQ";let i=!1;for(let d=0;d<(((l=r.values)==null?void 0:l.length)??0);d++){const m=r.values[d],p=s.values[d];switch(ns(m,p)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":i=!0;break;default:ye(44609,{Lr:m,Br:p})}}return i?"NULL":"EQ"})(n.arrayValue,e.arrayValue):$i(n)&&$i(e)||Mi(n)&&Mi(e)?(function(r,s){const i=r.fields||{},a=s.fields||{};if(au(i)!==au(a))return"NOT_EQ";let c=!1;for(const l in i)if(i.hasOwnProperty(l)){if(a[l]===void 0)return"NOT_EQ";switch(ns(i[l],a[l])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":c=!0}}return c?"NULL":"EQ"})(n.mapValue,e.mapValue):(function(r,s){return Jn(r,s,{Te:!1,Ee:!0,he:!0})})(n,e)?"EQ":"NOT_EQ"}class DP extends Cl{Nr(e,t){return Or(e)+Or(t)}Mr(e,t){return{doubleValue:Jt(e)+Jt(t)}}}class VP extends Cl{constructor(e){super(e),this.expr=e}Nr(e,t){return Or(e)-Or(t)}Mr(e,t){return{doubleValue:Jt(e)-Jt(t)}}}class LP extends Cl{constructor(e){super(e),this.expr=e}Nr(e,t){return Or(e)*Or(t)}Mr(e,t){return{doubleValue:Jt(e)*Jt(t)}}}class qP extends Cl{constructor(e){super(e),this.expr=e}Nr(e,t){const r=Or(t);if(r!==BigInt(0))return Or(e)/r}Mr(e,t){const r=Jt(t);return r===0?{doubleValue:Ja(r)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:Jt(e)/r}}}class zP extends Cl{constructor(e){super(e),this.expr=e}Nr(e,t){const r=Or(t);if(r!==BigInt(0))return Or(e)%r}Mr(e,t){const r=Jt(t);if(r!==0)return{doubleValue:Jt(e)%r}}}class FP{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const a of this.expr.params){const c=Ce(a).evaluate(e,t);switch(c.type){case"BOOLEAN":if(!((i=c.value)!=null&&i.booleanValue))return q.newValue(Kt);break;case"NULL":s=!0;break;default:r=!0}}return r?q.vr():s?q.Dr():q.newValue(Mn)}}class bh{constructor(e){this.expr=e}evaluate(e,t){var s;ce(this.expr.params.length===1,9634);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BOOLEAN":return q.newValue({booleanValue:!((s=r.value)!=null&&s.booleanValue)});case"NULL":return q.Dr();default:return q.vr()}}}class $P{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const a of this.expr.params){const c=Ce(a).evaluate(e,t);switch(c.type){case"BOOLEAN":if((i=c.value)!=null&&i.booleanValue)return q.newValue(Mn);break;case"NULL":s=!0;break;default:r=!0}}return r?q.vr():s?q.Dr():q.newValue(Kt)}}class uf{constructor(e){this.expr=e}evaluate(e,t){var i;let r=!1,s=!1;for(const a of this.expr.params){const c=Ce(a).evaluate(e,t);switch(c.type){case"BOOLEAN":r=uf.xor(r,!!((i=c.value)!=null&&i.booleanValue));break;case"NULL":s=!0;break;default:return q.vr()}}return s?q.Dr():q.newValue({booleanValue:r})}static xor(e,t){return(e||t)&&!(e&&t)}}class h3{constructor(e){this.expr=e}evaluate(e,t){var a,c;ce(this.expr.params.length===2,55094);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"NULL":r=!0;break;case"ERROR":case"UNSET":return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return q.vr()}if(r)return q.Dr();for(const l of((c=(a=i.value)==null?void 0:a.arrayValue)==null?void 0:c.values)??[])switch(Fn(s.value)&&Fn(l)?"EQ":ns(s.value,l)){case"EQ":return q.newValue(Mn);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:ye(44608,{value:s.value,candidate:l})}return r?q.Dr():q.newValue(Kt)}}class BP{constructor(e){this.expr=e}evaluate(e,t){return new bh(new Q("not",[new Q("equal_any",this.expr.params)])).evaluate(e,t)}}class UP{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===1,23322);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"INT":return q.newValue(Kt);case"DOUBLE":return q.newValue({booleanValue:isNaN(Jt(r.value))});case"NULL":return q.Dr();default:return q.vr()}}}class GP{constructor(e){this.expr=e}evaluate(e,t){return ce(this.expr.params.length===1,50406),new bh(new Q("not",[new Q("is_nan",this.expr.params)])).evaluate(e,t)}}class KP{constructor(e){this.expr=e}evaluate(e,t){switch(ce(this.expr.params.length===1,23123),Ce(this.expr.params[0]).evaluate(e,t).type){case"NULL":return q.newValue(Mn);case"UNSET":case"ERROR":return q.vr();default:return q.newValue(Kt)}}}class HP{constructor(e){this.expr=e}evaluate(e,t){return ce(this.expr.params.length===1,23167),new bh(new Q("not",[new Q("is_null",this.expr.params)])).evaluate(e,t)}}class WP{constructor(e){this.expr=e}evaluate(e,t){return ce(this.expr.params.length===1,5228),Ce(this.expr.params[0]).evaluate(e,t).type==="ERROR"?q.newValue(Mn):q.newValue(Kt)}}class YP{constructor(e){this.expr=e}evaluate(e,t){switch(ce(this.expr.params.length===1,6877),Ce(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return q.vr();case"UNSET":return q.newValue(Kt);default:return q.newValue(Mn)}}}class QP{constructor(e){this.expr=e}evaluate(e,t){var s;ce(this.expr.params.length===3,11706);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BOOLEAN":return(s=r.value)!=null&&s.booleanValue?Ce(this.expr.params[1]).evaluate(e,t):Ce(this.expr.params[2]).evaluate(e,t);case"NULL":return Ce(this.expr.params[2]).evaluate(e,t);default:return q.vr()}}}class ZP{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map((i=>Ce(i).evaluate(e,t)));let s;for(const i of r)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||fn(i.value,s.value)>0?i:s}return s===void 0?q.Dr():s}}class JP{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map((i=>Ce(i).evaluate(e,t)));let s;for(const i of r)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||fn(i.value,s.value)<0?i:s}return s===void 0?q.Dr():s}}class So{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"ERROR":case"UNSET":return q.vr()}const s=Ce(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ERROR":case"UNSET":return q.vr()}return this.Ur(r,s)}}class XP extends So{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return q.newValue(Mn);if(e.Fr()||t.Fr()||Pn(e.value)||Pn(t.value)||qt(e.value)!==qt(t.value))return q.newValue(Kt);switch(ns(e.value,t.value)){case"EQ":return q.newValue(Mn);case"NOT_EQ":return q.newValue(Kt);case"NULL":return q.Dr();default:ye(44615,{left:e,right:t})}}}class eR extends So{constructor(e){super(e),this.expr=e}Ur(e,t){switch(ns(e.value,t.value)){case"EQ":return q.newValue(Kt);case"NOT_EQ":case"TYPE_MISMATCH":return q.newValue(Mn);case"NULL":return q.Dr();default:ye(44614,{left:e,right:t})}}}class tR extends So{constructor(e){super(e),this.expr=e}Ur(e,t){return qt(e.value)!==qt(t.value)||Pn(e.value)||Pn(t.value)?q.newValue(Kt):q.newValue({booleanValue:fn(e.value,t.value)<0})}}class nR extends So{constructor(e){super(e),this.expr=e}Ur(e,t){return qt(e.value)!==qt(t.value)||Pn(e.value)||Pn(t.value)?q.newValue(Kt):ns(e.value,t.value)==="EQ"?q.newValue(Mn):q.newValue({booleanValue:fn(e.value,t.value)<0})}}class rR extends So{constructor(e){super(e),this.expr=e}Ur(e,t){return qt(e.value)!==qt(t.value)||Pn(e.value)||Pn(t.value)?q.newValue(Kt):q.newValue({booleanValue:fn(e.value,t.value)>0})}}class sR extends So{constructor(e){super(e),this.expr=e}Ur(e,t){return qt(e.value)!==qt(t.value)||Pn(e.value)||Pn(t.value)?q.newValue(Kt):ns(e.value,t.value)==="EQ"?q.newValue(Mn):q.newValue({booleanValue:fn(e.value,t.value)>0})}}class iR{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class aR{constructor(e){this.expr=e}evaluate(e,t){var s;ce(this.expr.params.length===1,216);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return q.Dr();case"ARRAY":{const i=((s=r.value.arrayValue)==null?void 0:s.values)??[];return q.newValue({arrayValue:{values:[...i].reverse()}})}default:return q.vr()}}}class oR{constructor(e){this.expr=e}evaluate(e,t){return ce(this.expr.params.length===2,52884),new h3(new Q("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class cR{constructor(e){this.expr=e}evaluate(e,t){var l,d,m,p;ce(this.expr.params.length===2,1392);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":r=!0;break;default:return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return q.vr()}if(r)return q.Dr();const a=((d=(l=i.value)==null?void 0:l.arrayValue)==null?void 0:d.values)??[],c=((p=(m=s.value)==null
1679?void 0:m.arrayValue)==null?void 0:p.values)??[];for(const f of a){let g=!1;r=!1;for(const x of c){switch(Fn(f)&&Fn(x)?"EQ":ns(f,x)){case"EQ":g=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:ye(44613,{value:x,search:f})}if(g)break}if(!g)return q.newValue(Kt)}return q.newValue(Mn)}}class lR{constructor(e){this.expr=e}evaluate(e,t){var l,d,m,p;ce(this.expr.params.length===2,2680);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":r=!0;break;default:return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":r=!0;break;default:return q.vr()}if(r)return q.Dr();const a=((d=(l=i.value)==null?void 0:l.arrayValue)==null?void 0:d.values)??[],c=((p=(m=s.value)==null?void 0:m.arrayValue)==null?void 0:p.values)??[];for(const f of c)for(const g of a)switch(Fn(f)&&Fn(g)?"EQ":ns(f,g)){case"EQ":return q.newValue(Mn);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":r=!0;break;default:ye(44608,{value:f,search:g})}return r?q.Dr():q.newValue(Kt)}}class dR{constructor(e){this.expr=e}evaluate(e,t){var s,i,a;ce(this.expr.params.length===1,38605);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return q.Dr();case"ARRAY":return q.newValue({integerValue:`${((a=(i=(s=r.value)==null?void 0:s.arrayValue)==null?void 0:i.values)==null?void 0:a.length)??0}`});default:return q.vr()}}}class uR{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class hR{constructor(e){this.expr=e}evaluate(e,t){var s,i;ce(this.expr.params.length===1,1508);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return q.Dr();case"BYTES":{const a=(s=r.value)==null?void 0:s.bytesValue;if(typeof a=="string"){const c=vt.fromBase64String(a).toUint8Array();return c.reverse(),q.newValue({bytesValue:vt.fromUint8Array(c).toBase64()})}return q.newValue({bytesValue:new Uint8Array(a).reverse()})}case"STRING":{const a=(i=r.value)==null?void 0:i.stringValue,c=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(a),l=Array.from(c,(d=>d.segment)).reverse();return q.newValue({stringValue:l.join("")})}default:return q.vr()}}}class mR{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class pR{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class fR{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===1,19400);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"NULL":return q.Dr();case"STRING":{const s=(function(a){let c=0;for(let l=0;l<a.length;l++){const d=a.codePointAt(l);if(d===void 0)return;if(d<=65535)if(d>=55296&&d<=57343)if(d<=56319){const m=a.codePointAt(l+1);m!==void 0&&m>=56320&&m<=57343?(c+=1,l++):c+=1}else c+=1;else c+=1;else{if(!(d<=1114111))return;c+=1,l++}}return c})(r.value.stringValue);return s===void 0?q.vr():q.newValue({integerValue:s})}default:return q.vr()}}}class gR{constructor(e){this.expr=e}evaluate(e,t){var s,i;ce(this.expr.params.length===1,8486);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"BYTES":{const a=(s=r.value)==null?void 0:s.bytesValue;return typeof a=="string"?q.newValue({integerValue:vt.fromBase64String(a).toUint8Array().length}):q.newValue({integerValue:new Uint8Array(a).length})}case"STRING":{const a=(function(l){let d=0;for(let m=0;m<l.length;m++){const p=l.codePointAt(m);if(p===void 0)return;if(p>=55296&&p<=57343){if(!(p<=56319))return;{const f=l.codePointAt(m+1);if(f===void 0||!(f>=56320&&f<=57343))return;d+=4,m++}}else if(p<=127)d+=1;else if(p<=2047)d+=2;else if(p<=65535)d+=3;else{if(!(p<=1114111))return;d+=4,m++}}return d})((i=r.value)==null?void 0:i.stringValue);return a===void 0?q.vr():q.newValue({integerValue:a})}case"NULL":return q.Dr();default:return q.vr()}}}class Ao{constructor(e){this.expr=e}evaluate(e,t){var a,c;ce(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":r=!0;break;default:return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);switch(i.type){case"STRING":break;case"NULL":r=!0;break;default:return q.vr()}return r?q.Dr():this.kr((a=s.value)==null?void 0:a.stringValue,(c=i.value)==null?void 0:c.stringValue)}}class yR extends Ao{kr(e,t){try{const r=(function(a){let c="";for(let l=0;l<a.length;l++){const d=a.charAt(l);switch(d){case"_":c+=".";break;case"%":c+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":c+="\\"+d;break;default:c+=d}}return"^"+c+"$"})(t),s=Fc.compile(r);return q.newValue({booleanValue:s.matches(e)})}catch(r){return lr(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${r}`),q.vr()}}}class bR extends Ao{kr(e,t){try{const r=Fc.compile(t);return q.newValue({booleanValue:r.matcher(e).find()})}catch{return lr(`Invalid regex pattern found in regex_contains: ${t}, returning error`),q.vr()}}}class xR extends Ao{kr(e,t){try{return q.newValue({booleanValue:Fc.compile(t).matches(e)})}catch{return lr(`Invalid regex pattern found in regex_match: ${t}, returning error`),q.vr()}}}class vR extends Ao{kr(e,t){return q.newValue({booleanValue:e.includes(t)})}}class IR extends Ao{kr(e,t){return q.newValue({booleanValue:e.startsWith(t)})}}class _R extends Ao{kr(e,t){return q.newValue({booleanValue:e.endsWith(t)})}}class kR{constructor(e){this.expr=e}evaluate(e,t){var s,i;ce(this.expr.params.length===1,29079);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return q.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.toLowerCase()});case"NULL":return q.Dr();default:return q.vr()}}}class wR{constructor(e){this.expr=e}evaluate(e,t){var s,i;ce(this.expr.params.length===1,60487);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return q.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.toUpperCase()});case"NULL":return q.Dr();default:return q.vr()}}}class jR{constructor(e){this.expr=e}evaluate(e,t){var s,i;ce(this.expr.params.length===1,28544);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"STRING":return q.newValue({stringValue:(i=(s=r.value)==null?void 0:s.stringValue)==null?void 0:i.trim()});case"NULL":return q.Dr();default:return q.vr()}}}class TR{constructor(e){this.expr=e}evaluate(e,t){const r=this.expr.params.map((a=>Ce(a).evaluate(e,t)));let s="",i=!1;for(const a of r)switch(a.type){case"STRING":s+=a.value.stringValue;break;case"NULL":i=!0;break;default:return q.vr()}return i?q.Dr():q.newValue({stringValue:s})}}class ER{constructor(e){this.expr=e}evaluate(e,t){var a,c,l,d;ce(this.expr.params.length===2,4483);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"UNSET":return q.Sr();case"MAP":break;default:return q.vr()}const s=Ce(this.expr.params[1]).evaluate(e,t);if(s.type!=="STRING")return q.vr();const i=(d=(c=(a=r.value)==null?void 0:a.mapValue)==null?void 0:c.fields)==null?void 0:d[(l=s.value)==null?void 0:l.stringValue];return i===void 0?q.Sr():q.newValue(i)}}class hf{constructor(e){this.expr=e}evaluate(e,t){var d,m;ce(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":r=!0;break;default:return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);switch(i.type){case"VECTOR":break;case"NULL":r=!0;break;default:return q.vr()}if(r)return q.Dr();
1679const a=Mp(s.value),c=Mp(i.value);if(a===void 0||c===void 0||((d=a.values)==null?void 0:d.length)!==((m=c.values)==null?void 0:m.length))return q.vr();const l=this.qr(a,c);return l===void 0||isNaN(l)?q.vr():q.newValue({doubleValue:l})}}class NR extends hf{qr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return;let i=0,a=0,c=0;for(let d=0;d<r.length;d++){if(!Ws(r[d])||!Ws(s[d]))return;const m=Jt(r[d]),p=Jt(s[d]);i+=m*p,a+=m*m,c+=p*p}const l=Math.sqrt(a)*Math.sqrt(c);if(l!==0)return 1-Math.max(-1,Math.min(1,i/l))}}class SR extends hf{qr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return 0;let i=0;for(let a=0;a<r.length;a++){if(!Ws(r[a])||!Ws(s[a]))return;i+=Jt(r[a])*Jt(s[a])}return i}}class AR extends hf{qr(e,t){const r=(e==null?void 0:e.values)??[],s=(t==null?void 0:t.values)??[];if(r.length===0)return 0;let i=0;for(let a=0;a<r.length;a++){if(!Ws(r[a])||!Ws(s[a]))return;const c=Jt(r[a]),l=Jt(s[a]);i+=Math.pow(c-l,2)}return Math.sqrt(i)}}class CR{constructor(e){this.expr=e}evaluate(e,t){var s;ce(this.expr.params.length===1,39044);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"VECTOR":{const i=Mp(r.value);return q.newValue({integerValue:((s=i==null?void 0:i.values)==null?void 0:s.length)??0})}case"NULL":return q.Dr();default:return q.vr()}}}const el=BigInt(-62135596800),tl=BigInt(253402300799),gu=BigInt(1e3),$s=BigInt(1e6),MR=el*gu,PR=tl*gu+BigInt(999),RR=el*$s,OR=tl*$s+BigInt(999999);function mf(n){return n>=RR&&n<=OR}function m3(n){return n>=el&&n<=tl}function nl(n,e){const t=BigInt(n);return!(t<el||t>tl)&&!(e<0||e>=1e9)&&(t!==el||e===0)&&!(t===tl&&e>999999999)}function p3(n,e){return e<0?{seconds:n-1,nanos:e+1e9}:{seconds:n,nanos:e}}function pf(n){return BigInt(n.seconds)*$s+BigInt(Math.trunc(n.nanoseconds/1e3))}class ff{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"INT":return this.toTimestamp(BigInt(r.value.integerValue));case"NULL":return q.Dr();default:return q.vr()}}}class DR extends ff{toTimestamp(e){if(!mf(e))return q.vr();let t=Number(e/$s),r=Number(e%$s*BigInt(1e3));const s=p3(t,r);return t=s.seconds,r=s.nanos,nl(t,r)?q.newValue({timestampValue:{seconds:t,nanos:r}}):q.vr()}}class VR extends ff{toTimestamp(e){if(!(function(a){return a>=MR&&a<=PR})(e))return q.vr();let t=Number(e/gu),r=Number(e%gu*BigInt(1e6));const s=p3(t,r);return t=s.seconds,r=s.nanos,nl(t,r)?q.newValue({timestampValue:{seconds:t,nanos:r}}):q.vr()}}class LR extends ff{toTimestamp(e){if(!m3(e))return q.vr();const t=Number(e);return q.newValue({timestampValue:{seconds:t,nanos:0}})}}class gf{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);const r=Ce(this.expr.params[0]).evaluate(e,t);switch(r.type){case"TIMESTAMP":break;case"NULL":return q.Dr();default:return q.vr()}const s=ef(r.value.timestampValue);return nl(s.seconds,s.nanoseconds)?this.$r(s):q.vr()}}class qR extends gf{$r(e){const t=pf(e);return mf(t)?q.newValue({integerValue:`${t.toString()}`}):q.vr()}}class zR extends gf{$r(e){const t=pf(e),r=t/BigInt(1e3),s=t%BigInt(1e3);return r>BigInt(0)||s===BigInt(0)?q.newValue({integerValue:r.toString()}):q.newValue({integerValue:(r-BigInt(1)).toString()})}}class FR extends gf{$r(e){const t=BigInt(e.seconds);return m3(t)?q.newValue({integerValue:t.toString()}):q.vr()}}class f3{constructor(e){this.expr=e}evaluate(e,t){ce(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let r=!1;const s=Ce(this.expr.params[0]).evaluate(e,t);switch(s.type){case"TIMESTAMP":break;case"NULL":r=!0;break;default:return q.vr()}const i=Ce(this.expr.params[1]).evaluate(e,t);let a;switch(i.type){case"STRING":if(a=(function(V){switch(V){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}})(i.value.stringValue),a===void 0)return q.vr();break;case"NULL":r=!0;break;default:return q.vr()}const c=Ce(this.expr.params[2]).evaluate(e,t);switch(c.type){case"INT":break;case"NULL":r=!0;break;default:return q.vr()}if(r)return q.Dr();const l=BigInt(c.value.integerValue);let d;
1679try{switch(a){case"microsecond":d=l;break;case"millisecond":d=l*BigInt(1e3);break;case"second":d=l*BigInt(1e6);break;case"minute":d=l*BigInt(6e7);break;case"hour":d=l*BigInt(36e8);break;case"day":d=l*BigInt(864e8);break;default:return q.vr()}if(a!=="microsecond"&&l!==BigInt(0)&&d/l!==BigInt(this.Kr(a)))return q.vr()}catch(N){return lr(`Error during timestamp arithmetic: ${N}`),q.vr()}const m=ef(s.value.timestampValue);if(!nl(m.seconds,m.nanoseconds))return q.vr();const p=pf(m),f=this.Wr(p,d);if(!mf(f))return q.vr();const g=Number(f/$s),x=f%$s,b=Number((x<0?x+$s:x)*BigInt(1e3)),I=x<0?g-1:g;return nl(I,b)?q.newValue({timestampValue:{seconds:I,nanos:b}}):q.vr()}Kr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class $R extends f3{Wr(e,t){return e+t}}class BR extends f3{Wr(e,t){return e-t}}function rl(n){if((n=u3(n))instanceof ia)return`fld(${n.fieldName})`;if(n instanceof aa)return`cst(${(function(t){return t===null?"null":typeof t=="number"?t.toString():typeof t=="string"?`"${t}"`:t instanceof St?`ref(${t.path})`:t instanceof An?`vec(${JSON.stringify(t)})`:JSON.stringify(t)})(n.value)})`;if(n instanceof Q)return`fn(${n.name},[${n.params.map(rl).join(",")}])`;if(n.expressionType==="ListOfExpressions")return`list([${n.Rr.map(rl).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(n,null,2)}`)}function UR(n){if(n instanceof o3)return`${n._name}(${fd(n.fields)})`;if(n instanceof c3){let e=`${n._name}(${fd(n.accumulators)})`;return n.groups.size>0&&(e+=`grouping(${fd(n.groups)})`),e}if(n instanceof l3)return`${n._name}(${fd(n.groups)})`;if(n instanceof El)return`${n._name}(${n.Vr})`;if(n instanceof Nl)return`${n._name}(${n.collectionId})`;if(n instanceof gh)return`${n._name}()`;if(n instanceof yh)return`${n._name}(${n.dr.sort()})`;if(n instanceof Sl)return`${n._name}(${rl(n.condition)})`;if(n instanceof Js)return`${n._name}(${n.limit})`;if(n instanceof Tr)return`${n._name}(${(function(t){return t.map((r=>`${rl(r.expr)}${r.direction}`)).join(",")})(n.orderings)})`;throw new Error(`Unrecognized stage ${n._name}`)}function fd(n){return`${Array.from(n.entries()).sort().map((([e,t])=>`${e}=${rl(t)}`)).join(",")}`}function Wr(n){return n.stages.map((e=>UR(e))).join("|")}function g3(n,e){return Wr(n)===Wr(e)}function Nt(n){return n instanceof dn}function Y0(n){return Nt(n)?Wr(n):Ac(n)}function y3(n){return Nt(n)?Wr(n):(function(t){return`${du($n(t))}|lt:${t.limitType}`})(n)}function xh(n,e){return n instanceof dn&&e instanceof dn?g3(n,e):!(n instanceof dn&&!(e instanceof dn)||!(n instanceof dn)&&e instanceof dn)&&TM(n,e)}function vh(n){return $r(n)?Wr(n):du(n)}function yf(n,e){return n instanceof dn&&e instanceof dn?g3(n,e):!(n instanceof dn&&!(e instanceof dn)||!(n instanceof dn)&&e instanceof dn)&&Y1(n,e)}function GR(n,e){const t=(function(s){let i=!1;const a=[];for(const c of s)if(c instanceof Tr)if(i=!0,c.orderings.some((l=>l.expr instanceof ia&&l.expr.fieldName===kr)))a.push(c);else{const l=c.orderings.map((d=>d));l.push(Od(kr).ascending()),a.push(new Tr(l,{}))}else c instanceof Js&&(i||(a.push(new Tr([Od(kr).ascending()],{})),i=!0)),a.push(c);return i||a.push(new Tr([Od(kr).ascending()],{})),a})(n.stages);if(n.userDataReader){const r=n.userDataReader.createContext(3,"toCorePipeline");t.forEach((s=>s._readUserData(r)))}return new dn(n.userDataReader.serializer,t,e)}/**
1680 * @license
1681 * Copyright 2017 Google LLC
1682 *
1683 * Licensed under the Apache License, Version 2.0 (the "License");
1684 * you may not use this file except in compliance with the License.
1685 * You may obtain a copy of the License at
1686 *
1687 *   http://www.apache.org/licenses/LICENSE-2.0
1688 *
1689 * Unless required by applicable law or agreed to in writing, software
1690 * distributed under the License is distributed on an "AS IS" BASIS,
1691 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1692 * See the License for the specific language governing permissions and
1693 * limitations under the License.
1694 */class bf{constructor(e,t,r,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&pM(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&
1694(t=Nc(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=Nc(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Tv();return this.mutations.forEach((s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=t.has(s.key)?null:c;const l=uv(a,c);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(Ne.min())})),r}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),Fe())}isEqual(e){return this.batchId===e.batchId&&Qa(this.mutations,e.mutations,((t,r)=>T0(t,r)))&&Qa(this.baseMutations,e.baseMutations,((t,r)=>T0(t,r)))}}class xf{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){ce(e.mutations.length===r.length,58842,{Qr:e.mutations.length,Gr:r.length});let s=(function(){return CM})();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new xf(e,t,r,s)}}/**
1695 * @license
1696 * Copyright 2022 Google LLC
1697 *
1698 * Licensed under the Apache License, Version 2.0 (the "License");
1699 * you may not use this file except in compliance with the License.
1700 * You may obtain a copy of the License at
1701 *
1702 *   http://www.apache.org/licenses/LICENSE-2.0
1703 *
1704 * Unless required by applicable law or agreed to in writing, software
1705 * distributed under the License is distributed on an "AS IS" BASIS,
1706 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1707 * See the License for the specific language governing permissions and
1708 * limitations under the License.
1709 */class vf{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
1710      largestBatchId: ${this.largestBatchId},
1711      mutation: ${this.mutation.toString()}
1712    }`}}/**
1713 * @license
1714 * Copyright 2017 Google LLC
1715 *
1716 * Licensed under the Apache License, Version 2.0 (the "License");
1717 * you may not use this file except in compliance with the License.
1718 * You may obtain a copy of the License at
1719 *
1720 *   http://www.apache.org/licenses/LICENSE-2.0
1721 *
1722 * Unless required by applicable law or agreed to in writing, software
1723 * distributed under the License is distributed on an "AS IS" BASIS,
1724 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1725 * See the License for the specific language governing permissions and
1726 * limitations under the License.
1727 */class Er{constructor(e,t,r,s,i=Ne.min(),a=Ne.min(),c=vt.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new Er(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Er(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Er(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Er(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1728 * @license
1729 * Copyright 2017 Google LLC
1730 *
1731 * Licensed under the Apache License, Version 2.0 (the "License");
1732 * you may not use this file except in compliance with the License.
1733 * You may obtain a copy of the License at
1734 *
1735 *   http://www.apache.org/licenses/LICENSE-2.0
1736 *
1737 * Unless required by applicable law or agreed to in writing, software
1738 * distributed under the License is distributed on an "AS IS" BASIS,
1739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1740 * See the License for the specific language governing permissions and
1741 * limitations under the License.
1742 */class b3{constructor(e){this.zr=e}}function KR(n,e){let t;if(e.document)t=FM(n.zr,e.document,!!e.hasCommittedMutations);else if(e.noDocument){const r=me.fromSegments(e.noDocument.path),s=Ki(e.noDocument.readTime);t=Et.newNoDocument(r,s),e.hasCommittedMutations&&t.setHasCommittedMutations()}else{if(!e.unknownDocument)return ye(56709);{const r=me.fromSegments(e.unknownDocument.path),s=Ki(e.unknownDocument.version);t=Et.newUnknownDocument(r,s)}}return e.readTime&&t.setReadTime((function(s){const i=new st(s[0],s[1]);return Ne.fromTimestamp(i)})(e.readTime)),t}function Q0(n,e){const t=e.key,r={prefixPath:t.getCollectionPath().popLast().toArray(),collectionGroup:t.collectionGroup,documentId:t.path.lastSegment(),readTime:yu(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())r.document=(function(i,a){return{name:Zc(i,a.key),fields:a.data.value.mapValue.fields,updateTime:co(i,a.version.toTimestamp()),createTime:co(i,a.createTime.toTimestamp())}})(n.zr,e);else if(e.isNoDocument())r.noDocument={path:t.path.toArray(),readTime:Gi(e.version)};else{if(!e.isUnknownDocument())return ye(57904,{document:e});r.unknownDocument={path:t.path.toArray(),version:Gi(e.version)}}return r}function yu(n){const e=n.toTimestamp();return[e.seconds,e.nanoseconds]}function Gi(n){const e=n.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function Ki(n){const e=new st(n.seconds,n.nanoseconds);return Ne.fromTimestamp(e)}function ji(n,e){const t=(e.baseMutations||[]).map((i=>
1742zp(n.zr,i)));for(let i=0;i<e.mutations.length-1;++i){const a=e.mutations[i];if(i+1<e.mutations.length&&e.mutations[i+1].transform!==void 0){const c=e.mutations[i+1];a.updateTransforms=c.transform.fieldTransforms,e.mutations.splice(i+1,1),++i}}const r=e.mutations.map((i=>zp(n.zr,i))),s=st.fromMillis(e.localWriteTimeMs);return new bf(e.batchId,s,t,r)}function gc(n,e){const t=Ki(e.readTime),r=e.lastLimboFreeSnapshotVersion!==void 0?Ki(e.lastLimboFreeSnapshotVersion):Ne.min();let s;return s=(function(a){return a.structuredPipeline!==void 0})(e.query)?(function(a,c){var m,p;const l=a.structuredPipeline;ce((((m=l==null?void 0:l.pipeline)==null?void 0:m.stages)??[]).length>0,1845);const d=(p=l==null?void 0:l.pipeline)==null?void 0:p.stages.map(HR);return new dn(c,d)})(e.query,n.zr):(function(a){return a.documents!==void 0})(e.query)?(function(a){const c=a.documents.length;return ce(c===1,1966,{count:c}),$n(jl(Mv(a.documents[0])))})(e.query):(function(a){return $n(Dv(a))})(e.query),new Er(s,e.targetId,"TargetPurposeListen",e.lastListenSequenceNumber,t,r,vt.fromBase64String(e.resumeToken))}function x3(n,e){const t=Gi(e.snapshotVersion),r=Gi(e.lastLimboFreeSnapshotVersion);let s;s=$r(e.target)?Vv(n.zr,e.target):Q1(e.target)?Rv(n.zr,e.target):Ov(n.zr,e.target).yt;const i=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:vh(e.target),readTime:t,resumeToken:i,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:r,query:s}}function v3(n){const e=Dv({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?hu(e,e.limit,"L"):e}function gd(n,e){return new vf(e.largestBatchId,zp(n.zr,e.overlayMutation))}function Z0(n,e){const t=e.path.lastSegment();return[n,hn(e.path.popLast()),t]}function J0(n,e,t,r){return{indexId:n,uid:e,sequenceNumber:t,readTime:Gi(r.readTime),documentKey:hn(r.documentKey.path),largestBatchId:r.largestBatchId}}function HR(n){switch(n.name){case"collection":return new El(n.args[0].referenceValue,{});case"collection_group":return new Nl(n.args[1].stringValue,{});case"database":return new gh({});case"documents":return new yh(n.args.map((e=>e.referenceValue)),{});case"where":return new Sl($p(n.args[0]),{});case"limit":{const e=n.args[0].integerValue??n.args[0].doubleValue;return new Js(typeof e=="number"?e:Number(e),{})}case"sort":return new Tr(n.args.map((e=>(function(r){var i,a;const s=(i=r.mapValue)==null?void 0:i.fields;return new cf($p(s.expression),(a=s.direction)==null?void 0:a.stringValue,"orderingFromProto")})(e))),{});default:throw new Error(`Stage type: ${n.name} not supported.`)}}function $p(n){return n.fieldReferenceValue?new ia(No("_exprFromProto",n.fieldReferenceValue),"_exprFromProto"):n.functionValue?(function(t){var r;return new Q(t.functionValue.name,((r=t.functionValue.args)==null?void 0:r.map($p))||[])})(n):aa._fromProto(n)}class WR{getBundleMetadata(e,t){return X0(e).get(t).next((r=>{if(r)return(function(i){return{id:i.bundleId,createTime:Ki(i.createTime),version:i.version}})(r)}))}saveBundleMetadata(e,t){return X0(e).put((function(s){return{bundleId:s.id,createTime:Gi(kn(s.createTime)),version:s.version}})(t))}getNamedQuery(e,t){return eb(e).get(t).next((r=>{if(r)return(function(i){return{name:i.name,query:v3(i.bundledQuery),readTime:Ki(i.readTime)}})(r)}))}saveNamedQuery(e,t){return eb(e).put((function(s){return{name:s.name,readTime:Gi(kn(s.readTime)),bundledQuery:s.bundledQuery}})(t))}}function X0(n){return Bt(n,sh)}function eb(n){return Bt(n,ih)}/**
1743 * @license
1744 * Copyright 2022 Google LLC
1745 *
1746 * Licensed under the Apache License, Version 2.0 (the "License");
1747 * you may not use this file except in compliance with the License.
1748 * You may obtain a copy of the License at
1749 *
1750 *   http://www.apache.org/licenses/LICENSE-2.0
1751 *
1752 * Unless required by applicable law or agreed to in writing, software
1753 * distributed under the License is distributed on an "AS IS" BASIS,
1754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1755 * See the License for the specific language governing permissions and
1756 * limitations under the License.
1757 */class Ih{constructor(e,t){this.serializer=e,this.userId=t}static jr(e,t){const r=t.uid||"";return new Ih(e,r)}getOverlay(e,t){return va(e).get(Z0(this.userId,t)).next((r=>r?gd(this.serializer,r):null))}getOverlays(e,t){const r=Wn();return F.forEach(t,(s=>this.getOverlay(e,s).next((i=>{i!==null&&r.set(s,i)})))).next((()=>r))}getAllOverlays(e,t){const r=Wn();return va(e).ee(((s,i)=>{const a=gd(this.serializer,i);a.largestBatchId>t&&r.set(a.getKey(),a)})).next((()=>r))}saveOverlays(e,t,r){const s=[];return r.forEach(((i,a)=>{const c=new vf(t,a);s.push(this.Hr(e,c))})),F.waitFor(s)}removeOverlaysForBatchId(e,t,r){const s=new Set;t.forEach((a=>s.add(hn(a.getCollectionPath()))));const i=[];return s.forEach((a=>{const c=IDBKeyRange.bound([this.userId,a,r],[this.userId,a,r+1],!1,!0);i.push(va(e).Z(Sp,c))})),F.waitFor(i)}getOverlaysForCollection(e,t,r){const s=Wn(),i=hn(t),a=IDBKeyRange.bound([this.userId,i,r],[this.userId,i,Number.POSITIVE_INFINITY],!0);return va(e).H(Sp,a).next((c=>{for(const l of c){const d=gd(this.serializer,l);s.set(d.getKey(),d)}return s}))}getOverlaysForCollectionGroup(e,t,r,s){const i=Wn();let a;const c=IDBKeyRange.bound([this.userId,t,r],[this.userId,t,Number.POSITIVE_INFINITY],!0);return va(e).ee({index:K4,range:c},((l,d,m)=>{const p=gd(this.serializer,d);i.size()<s||p.largestBatchId===a?(i.set(p.getKey(),p),a=p.largestBatchId):m.done()})).next((()=>i))}Hr(e,t){return va(e).put((function(s,i,a){const[c,l,d]=Z0(i,a.mutation.key);return{userId:i,collectionPath:l,documentId:d,collectionGroup:a.mutation.key.getCollectionGroup(),largestBatchId:a.largestBatchId,overlayMutation:mu(s.zr,a.mutation)}})(this.serializer,this.userId,t))}}function va(n){return Bt(n,ah)}/**
1758 * @license
1759 * Copyright 2024 Google LLC
1760 *
1761 * Licensed under the Apache License, Version 2.0 (the "License");
1762 * you may not use this file except in compliance with the License.
1763 * You may obtain a copy of the License at
1764 *
1765 *   http://www.apache.org/licenses/LICENSE-2.0
1766 *
1767 * Unless required by applicable law or agreed to in writing, software
1768 * distributed under the License is distributed on an "AS IS" BASIS,
1769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1770 * See the License for the specific language governing permissions and
1771 * limitations under the License.
1772 */class YR{Jr(e){return Bt(e,z1)}getSessionToken(e){return this.Jr(e).get("sessionToken").next((t=>{const r=t==null?void 0:t.value;return r?vt.fromUint8Array(r):vt.EMPTY_BYTE_STRING}))}setSessionToken(e,t){return this.Jr(e).put({name:"sessionToken",value:t.toUint8Array()})}}/**
1773 * @license
1774 * Copyright 2021 Google LLC
1775 *
1776 * Licensed under the Apache License, Version 2.0 (the "License");
1777 * you may not use this file except in compliance with the License.
1778 * You may obtain a copy of the License at
1779 *
1780 *   http://www.apache.org/licenses/LICENSE-2.0
1781 *
1782 * Unless required by applicable law or agreed to in writing, software
1783 * distributed under the License is distributed on an "AS IS" BASIS,
1784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1785 * See the License for the specific language governing permissions and
1786 * limitations under the License.
1787 */class Ti{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if("nullValue"in e)this.ei(t,5);else if("booleanValue"in e)this.ei(t,10),t.ti(e.booleanValue?1:0);else if("integerValue"in e)this.ei(t,15),t.ti(ht(e.integerValue));else if("doubleValue"in e){const r=ht(e.doubleValue);
1787isNaN(r)?this.ei(t,13):(this.ei(t,15),Ja(r)?t.ti(0):t.ti(r))}else if("timestampValue"in e){let r=e.timestampValue;this.ei(t,20),typeof r=="string"&&(r=es(r)),t.ni(`${r.seconds||""}`),t.ti(r.nanos||0)}else if("stringValue"in e)this.ri(e.stringValue,t),this.ii(t);else if("bytesValue"in e)this.ei(t,30),t.si(ts(e.bytesValue)),this.ii(t);else if("referenceValue"in e)this._i(e.referenceValue,t);else if("geoPointValue"in e){const r=e.geoPointValue;this.ei(t,45),t.ti(r.latitude||0),t.ti(r.longitude||0)}else"mapValue"in e?sv(e)?this.ei(t,Number.MAX_SAFE_INTEGER):$i(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):"arrayValue"in e?(this.ui(e.arrayValue,t),this.ii(t)):ye(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){const r=e.fields||{};this.ei(t,55);for(const s of Object.keys(r))this.ri(s,t),this.Zr(r[s],t)}oi(e,t){var a,c;const r=e.fields||{};this.ei(t,53);const s=Fi,i=((c=(a=r[s].arrayValue)==null?void 0:a.values)==null?void 0:c.length)||0;this.ei(t,15),t.ti(ht(i)),this.ri(s,t),this.Zr(r[s],t)}ui(e,t){const r=e.values||[];this.ei(t,50);for(const s of r)this.Zr(s,t)}_i(e,t){this.ei(t,37),me.fromName(e).path.forEach((r=>{this.ei(t,60),this.li(r,t)}))}ei(e,t){e.ti(t)}ii(e){e.ti(2)}}Ti.Ei=new Ti;/**
1788 * @license
1789 * Copyright 2021 Google LLC
1790 *
1791 * Licensed under the Apache License, Version 2.0 (the "License");
1792 * you may not use this file except in compliance with the License.
1793 * You may obtain a copy of the License at
1794 *
1795 *   http://www.apache.org/licenses/LICENSE-2.0
1796 *
1797 * Unless required by applicable law | agreed to in writing, software
1798 * distributed under the License is distributed on an "AS IS" BASIS,
1799 * WITHOUT WARRANTIES | CONDITIONS OF ANY KIND, either express | implied.
1800 * See the License for the specific language governing permissions and
1801 * limitations under the License.
1802 */const Ia=255;function QR(n){if(n===0)return 8;let e=0;return n>>4||(e+=4,n<<=4),n>>6||(e+=2,n<<=2),n>>7||(e+=1),e}function tb(n){const e=64-(function(r){let s=0;for(let i=0;i<8;++i){const a=QR(255&r[i]);if(s+=a,a!==8)break}return s})(n);return Math.ceil(e/8)}class ZR{constructor(){this.buffer=new Uint8Array(1024),this.position=0}hi(e){const t=e[Symbol.iterator]();let r=t.next();for(;!r.done;)this.Ti(r.value),r=t.next();this.Pi()}Ri(e){const t=e[Symbol.iterator]();let r=t.next();for(;!r.done;)this.Ii(r.value),r=t.next();this.Ai()}Vi(e){for(const t of e){const r=t.charCodeAt(0);if(r<128)this.Ti(r);else if(r<2048)this.Ti(960|r>>>6),this.Ti(128|63&r);else if(t<"\uD800"||"\uDBFF"<t)this.Ti(480|r>>>12),this.Ti(128|63&r>>>6),this.Ti(128|63&r);else{const s=t.codePointAt(0);this.Ti(240|s>>>18),this.Ti(128|63&s>>>12),this.Ti(128|63&s>>>6),this.Ti(128|63&s)}}this.Pi()}di(e){for(const t of e){const r=t.charCodeAt(0);if(r<128)this.Ii(r);else if(r<2048)this.Ii(960|r>>>6),this.Ii(128|63&r);else if(t<"\uD800"||"\uDBFF"<t)this.Ii(480|r>>>12),this.Ii(128|63&r>>>6),this.Ii(128|63&r);else{const s=t.codePointAt(0);this.Ii(240|s>>>18),this.Ii(128|63&s>>>12),this.Ii(128|63&s>>>6),this.Ii(128|63&s)}}this.Ai()}fi(e){const t=this.mi(e),r=tb(t);this.pi(1+r),this.buffer[this.position++]=255&r;for(let s=t.length-r;s<t.length;++s)this.buffer[this.position++]=255&t[s]}gi(e){const t=this.mi(e),r=tb(t);this.pi(1+r),this.buffer[this.position++]=~(255&r);for(let s=t.length-r;s<t.length;++s)this.buffer[this.position++]=~(255&t[s])}yi(){this.wi(Ia),this.wi(255)}bi(){this.Si(Ia),this.Si(255)}reset(){this.position=0}seed(e){this.pi(e.length),this.buffer.set(e,this.position),this.position+=e.length}Di(){return this.buffer.slice(0,this.position)}mi(e){const t=(function(i){const a=new DataView(new ArrayBuffer(8));return a.setFloat64(0,i,!1),new Uint8Array(a.buffer)})(e),r=!!(128&t[0]);t[0]^=r?255:128;for(let s=1;s<t.length;++s)t[s]^=r?255:0;return t}Ti(e){const t=255&e;t===0?(this.wi(0),this.wi(255)):t===Ia?(this.wi(Ia),this.wi(0)):this.wi(t)}Ii(e){const t=255&e;t===0?(this.Si(0),this.Si(255)):t===Ia?(this.Si(Ia),this.Si(0)):this.Si(e)}Pi(){this.wi(0),this.wi(1)}Ai(){this.Si(0),this.Si(1)}wi(e){this.pi(1),this.buffer[this.position++]=e}Si(e){this.pi(1),this.buffer[this.position++]=~e}pi(e){const t=e+this.position;if(t<=this.buffer.length)return;let r=2*this.buffer.length;r<t&&(r=t);const s=new Uint8Array(r);s.set(this.buffer),this.buffer=s}}class JR{constructor(e){this.xi=e}si(e){this.xi.hi(e)}ni(e){this.xi.Vi(e)}ti(e){this.xi.fi(e)}Xr(){this.xi.yi()}}class XR{constructor(e){this.xi=e}si(e){this.xi.Ri(e)}ni(e){this.xi.di(e)}ti(e){this.xi.gi(e)}Xr(){this.xi.bi()}}class ic{constructor(){this.xi=new ZR,this.ascending=new JR(this.xi),this.descending=new XR(this.xi)}seed(e){this.xi.seed(e)}Ci(e){return e===0?this.ascending:this.descending}Di(){return this.xi.Di()}reset(){this.xi.reset()}}/**
1803 * @license
1804 * Copyright 2022 Google LLC
1805 *
1806 * Licensed under the Apache License, Version 2.0 (the "License");
1807 * you may not use this file except in compliance with the License.
1808 * You may obtain a copy of the License at
1809 *
1810 *   http://www.apache.org/licenses/LICENSE-2.0
1811 *
1812 * Unless required by applicable law or agreed to in writing, software
1813 * distributed under the License is distributed on an "AS IS" BASIS,
1814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1815 * See the License for the specific language governing permissions and
1816 * limitations under the License.
1817 */class Ei{constructor(e,t,r,s){this.Fi=e,this.Oi=t,this.Mi=r,this.Ni=s}Li(){const e=this.Ni.length,t=e===0||this.Ni[e-1]===255?e+1:e,r=new Uint8Array(t);return r.set(this.Ni,0),t!==e?r.set([0],this.Ni.length):++r[r.length-1],new Ei(this.Fi,this.Oi,this.Mi,r)}Bi(e,t,r){return{indexId:this.Fi,uid:e,arrayValue:Dd(this.Mi),directionalValue:Dd(this.Ni),orderedDocumentKey:Dd(t),documentKey:r.path.toArray()}}Ui(e,t,r){const s=this.Bi(e,t,r);return[s.indexId,s.uid,s.arrayValue,s.directionalValue,s.orderedDocumentKey,s.documentKey]}}function xs(n,e){let t=n.Fi-e.Fi;return t!==0?t:(t=nb(n.Mi,e.Mi),t!==0?t:(t=nb(n.Ni,e.Ni),t!==0?t:me.comparator(n.Oi,e.Oi)))}function nb(n,e){for(let t=0;t<n.length&&t<e.length;++t){const r=n[t]-e[t];if(r!==0)return r}return n.length-e.length}function Dd(n){return b4()?(function(t){let r="";for(let s=0;s<t.length;s++)r+=String.fromCharCode(t[s]);return r})(n):n}function rb(n){return typeof n!="string"?n:(function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r})(n)}class sb{constructor(e){this.ki=new rt(((t,r)=>ft.comparator(t.field,r.field))),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.qi=e.orderBy,this.$i=[];for(const t of e.filters){const r=t;r.isInequality()?this.ki=this.ki.add(r):this.$i.push(r)}}get Ki(){return this.ki.size>1}Wi(e){if(ce(e.collectionGroup===this.collectionId,49279),this.Ki)return!1;const t=Tp(e);if(t!==void 0&&!this.Qi(t))return!1;const r=vi(e);let s=new Set,i=0,a=0;for(;i<r.length&&this.Qi(r[i]);++i)s=s.add(r[i].fieldPath.canonicalString());if(i===r.length)return!0;if(this.ki.size>0){const c=this.ki.getIterator().getNext();if(!s.has(c.field.canonicalString())){const l=r[i];if(!this.Gi(c,l)||!this.zi(this.qi[a++],l))return!1}++i}for(;i<r.length;++i){const c=r[i];if(a>=this.qi.length||!this.zi(this.qi[a++],c))return!1}return!0}ji(){if(this.Ki)return null;let e=new rt(ft.comparator);const t=[];for(const r of this.$i)if(!r.field.isKeyField())if(r.op==="array-contains"||r.op==="array-contains-any")t.push(new Nd(r.field,2));else{if(e.has(r.field))continue;e=e.add(r.field),t.push(new Nd(r.field,0))}for(const r of this.qi)r.field.isKeyField()||e.has(r.field)||(e=e.add(r.field),t.push(new Nd(r.field,r.dir==="asc"?0:1)));return new nu(nu.UNKNOWN_ID,this.collectionId,t,$c.empty())}Qi(e){for(const t of this.$i)if(this.Gi(t,e))return!0;return!1}Gi(e,t){if(e===void 0||!e.field.isEqual(t.fieldPath))return!1;const r=e.op==="array-contains"||e.op==="array-contains-any";return t.kind===2===r}zi(e,t){return!!e.field.isEqual(t.fieldPath)&&(t.kind===0&&e.dir==="asc"||t.kind===1&&e.dir==="desc")}}/**
1818 * @license
1819 * Copyright 2022 Google LLC
1820 *
1821 * Licensed under the Apache License, Version 2.0 (the "License");
1822 * you may not use this file except in compliance with the License.
1823 * You may obtain a copy of the License at
1824 *
1825 *   http://www.apache.org/licenses/LICENSE-2.0
1826 *
1827 * Unless required by applicable law or agreed to in writing, software
1828 * distributed under the License is distributed on an "AS IS" BASIS,
1829 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1830 * See the License for the specific language governing permissions and
1831 * limitations under the License.
1832 */function I3(n){var t,r;if(ce(n instanceof Ye||n instanceof at,20012),n instanceof Ye){if(n instanceof vv){const s=((r=(t=n.value.arrayValue)==null?void 0:t.values)==null?void 0:r.map((i=>Ye.create(n.field,"==",i))))||[];return at.create(s,"or")}return n}const e=n.filters.map((s=>I3(s)));return at.create(e,n.op)}function eO(n){if(n.getFilters().length===0)return[];const e=Gp(I3(n));return ce(_3(e),7391),Bp(e)||Up(e)?[e]:e.getFilters()}function Bp(n){return n instanceof Ye}function Up(n){return n instanceof at&&W1(n)}function _3(n){return Bp(n)||Up(n)||(function(t){if(t instanceof at&&Pp(t)){for(const r of t.getFilters())if(!Bp(r)&&!Up(r))return!1;return!0}return!1})(n)}function Gp(n){if(ce(n instanceof Ye||n instanceof at,34018),n instanceof Ye)return n;if(n.filters.length===1)return Gp(n.filters[0]);const e=n.filters.map((r=>Gp(r)));let t=at.create(e,n.op);return t=bu(t),_3(t)?t:(ce(t instanceof at,64498),ce(oo(t),40251),ce(t.filters.length>1,57927),t.filters.reduce(((r,s)=>If(r,s))))}function If(n,e){let t;return ce(n instanceof Ye||n instanceof at,38388),ce(e instanceof Ye||e instanceof at,25473),t=n instanceof Ye?e instanceof Ye?(function(s,i){return at.create([s,i],"and")}
vendor: 4,556 bytes, lines 1832-1862
1832)(n,e):ib(n,e):e instanceof Ye?ib(e,n):(function(s,i){if(ce(s.filters.length>0&&i.filters.length>0,48005),oo(s)&&oo(i))return yv(s,i.getFilters());const a=Pp(s)?s:i,c=Pp(s)?i:s,l=a.filters.map((d=>If(d,c)));return at.create(l,"or")})(n,e),bu(t)}function ib(n,e){if(oo(e))return yv(e,n.getFilters());{const t=e.filters.map((r=>If(n,r)));return at.create(t,"or")}}function bu(n){if(ce(n instanceof Ye||n instanceof at,11850),n instanceof Ye)return n;const e=n.getFilters();if(e.length===1)return bu(e[0]);if(fv(n))return n;const t=e.map((s=>bu(s))),r=[];return t.forEach((s=>{s instanceof Ye?r.push(s):s instanceof at&&(s.op===n.op?r.push(...s.filters):r.push(s))})),r.length===1?r[0]:at.create(r,n.op)}/**
1833 * @license
1834 * Copyright 2019 Google LLC
1835 *
1836 * Licensed under the Apache License, Version 2.0 (the "License");
1837 * you may not use this file except in compliance with the License.
1838 * You may obtain a copy of the License at
1839 *
1840 *   http://www.apache.org/licenses/LICENSE-2.0
1841 *
1842 * Unless required by applicable law or agreed to in writing, software
1843 * distributed under the License is distributed on an "AS IS" BASIS,
1844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1845 * See the License for the specific language governing permissions and
1846 * limitations under the License.
1847 */class tO{constructor(){this.Hi=new _f}addToCollectionParentIndex(e,t){return this.Hi.add(t),F.resolve()}getCollectionParents(e,t){return F.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return F.resolve()}deleteFieldIndex(e,t){return F.resolve()}deleteAllFieldIndexes(e){return F.resolve()}createTargetIndexes(e,t){return F.resolve()}getDocumentsMatchingTarget(e,t){return F.resolve(null)}getIndexType(e,t){return F.resolve(0)}getFieldIndexes(e,t){return F.resolve([])}getNextCollectionGroupToUpdate(e){return F.resolve(null)}getMinOffset(e,t){return F.resolve(Bn.min())}getMinOffsetFromCollectionGroup(e,t){return F.resolve(Bn.min())}updateCollectionGroup(e,t,r){return F.resolve()}updateIndexEntries(e,t){return F.resolve()}}class _f{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new rt(Ke.comparator),i=!s.has(r);return this.index[t]=s.add(r),i}has(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t];return s&&s.has(r)}getEntries(e){return(this.index[e]||new rt(Ke.comparator)).toArray()}}/**
1848 * @license
1849 * Copyright 2019 Google LLC
1850 *
1851 * Licensed under the Apache License, Version 2.0 (the "License");
1852 * you may not use this file except in compliance with the License.
1853 * You may obtain a copy of the License at
1854 *
1855 *   http://www.apache.org/licenses/LICENSE-2.0
1856 *
1857 * Unless required by applicable law or agreed to in writing, software
1858 * distributed under the License is distributed on an "AS IS" BASIS,
1859 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1860 * See the License for the specific language governing permissions and
1861 * limitations under the License.
1862 */const ab="IndexedDbIndexManager",yd=new Uint8Array(0);class nO{constructor(e,t){this.databaseId=t,this.Ji=new _f,this.Yi=new ds((r=>du(r)),((r,s)=>Y1(r,s))),this.uid=e.uid||""}addToCollectionParentIndex(e,t){if(!this.Ji.has(t)){const r=t.lastSegment(),s=t.popLast();e.addOnCommittedListener((()=>{this.Ji.add(t)}));const i={collectionId:r,parent:hn(s)};return ob(e).put(i)}return F.resolve()}getCollectionParents(e,t){const r=[],s=IDBKeyRange.bound([t,""],[P4(t),""],!1,!0);return ob(e).H(s).next((i=>{for(const a of i){if(a.collectionId!==t)break;r.push(wr(a.parent))}return r}))}addFieldIndex(e,t){const r=ac(e),s=(function(c){return{indexId:c.indexId,collectionGroup:c.collectionGroup,fields:c.fields.map((l=>[l.fieldPath.canonicalString(),l.kind]))}})(t);delete s.indexId;const i=r.add(s);if(t.indexState){const a=ka(e);return i.next((c=>{a.put(J0(c,this.uid,t.indexState.sequenceNumber,t.indexState.offset))}))}return i.next()}deleteFieldIndex(e,t){const r=ac(e),s=ka(e),i=_a(e);return r.delete(t.indexId).next((()=>s.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0)))).next((()=>i.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))))}deleteAllFieldIndexes(e){const t=ac(e),r=_a(e),s=ka(e);return t.Z().next((()=>r.Z())).next((()=>s.Z()))}createTargetIndexes(e,t){return F.forEach(this.Zi(t),(r=>this.getIndexType(e,r).next((s=>{if(s===0||s===1){const i=new sb(r).ji();if(i!=null)return this.addFieldIndex(e,i)}}))))}getDocumentsMatchingTarget(e,t){const r=_a(e);let s=!0;const i=new Map;return F.forEach(this.Zi(t),(a=>this.Xi(e,a).next((c=>{s&&(s=!!c),i.set(a,c)})))).next((()=>
1862{if(s){let a=Fe();const c=[];return F.forEach(i,((l,d)=>{se(ab,`Using index ${(function(D){return`id=${D.indexId}|cg=${D.collectionGroup}|f=${D.fields.map((T=>`${T.fieldPath}:${T.kind}`)).join(",")}`})(l)} to execute ${du(t)}`);const m=(function(D,T){const M=Tp(T);if(M===void 0)return null;for(const R of uu(D,M.fieldPath))switch(R.op){case"array-contains-any":return R.value.arrayValue.values||[];case"array-contains":return[R.value]}return null})(d,l),p=(function(D,T){const M=new Map;for(const R of vi(T))for(const _ of uu(D,R.fieldPath))switch(_.op){case"==":case"in":M.set(R.fieldPath.canonicalString(),_.value);break;case"not-in":case"!=":return M.set(R.fieldPath.canonicalString(),_.value),Array.from(M.values())}return null})(d,l),f=(function(D,T){const M=[];let R=!0;for(const _ of vi(T)){const j=_.kind===0?C0(D,_.fieldPath,D.startAt):M0(D,_.fieldPath,D.startAt);M.push(j.value),R&&(R=j.inclusive)}return new ao(M,R)})(d,l),g=(function(D,T){const M=[];let R=!0;for(const _ of vi(T)){const j=_.kind===0?M0(D,_.fieldPath,D.endAt):C0(D,_.fieldPath,D.endAt);M.push(j.value),R&&(R=j.inclusive)}return new ao(M,R)})(d,l),x=this.es(l,d,f),b=this.es(l,d,g),I=this.ts(l,d,p),N=this.ns(l.indexId,m,x,f.inclusive,b,g.inclusive,I);return F.forEach(N,(V=>r.Y(V,t.limit).next((D=>{D.forEach((T=>{const M=me.fromSegments(T.documentKey);a.has(M)||(a=a.add(M),c.push(M))}))}))))})).next((()=>c))}return F.resolve(null)}))}Zi(e){let t=this.Yi.get(e);return t||(e.filters.length===0?t=[e]:t=eO(at.create(e.filters,"and")).map((r=>Op(e.path,e.collectionGroup,e.orderBy,r.getFilters(),e.limit,e.startAt,e.endAt))),this.Yi.set(e,t),t)}ns(e,t,r,s,i,a,c){const l=(t!=null?t.length:1)*Math.max(r.length,i.length),d=l/(t!=null?t.length:1),m=[];for(let p=0;p<l;++p){const f=t?this.rs(t[p/d]):yd,g=this.ss(e,f,r[p%d],s),x=this._s(e,f,i[p%d],a),b=c.map((I=>this.ss(e,f,I,!0)));m.push(...this.createRange(g,x,b))}return m}ss(e,t,r,s){const i=new Ei(e,me.empty(),t,r);return s?i:i.Li()}_s(e,t,r,s){const i=new Ei(e,me.empty(),t,r);return s?i.Li():i}Xi(e,t){const r=new sb(t),s=t.collectionGroup!=null?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,s).next((i=>{let a=null;for(const c of i)r.Wi(c)&&(!a||c.fields.length>a.fields.length)&&(a=c);return a}))}getIndexType(e,t){let r=2;const s=this.Zi(t);return F.forEach(s,(i=>this.Xi(e,i).next((a=>{a?r!==0&&a.fields.length<(function(l){let d=new rt(ft.comparator),m=!1;for(const p of l.filters)for(const f of p.getFlattenedFilters())f.field.isKeyField()||(f.op==="array-contains"||f.op==="array-contains-any"?m=!0:d=d.add(f.field));for(const p of l.orderBy)p.field.isKeyField()||(d=d.add(p.field));return d.size+(m?1:0)})(i)&&(r=1):r=0})))).next((()=>(function(a){return a.limit!==null})(t)&&s.length>1&&r===2?1:r))}us(e,t){const r=new ic;for(const s of vi(e)){const i=t.data.field(s.fieldPath);if(i==null)return null;const a=r.Ci(s.kind);Ti.Ei.Yr(i,a)}return r.Di()}rs(e){const t=new ic;return Ti.Ei.Yr(e,t.Ci(0)),t.Di()}cs(e,t){const r=new ic;return Ti.Ei.Yr(Hc(this.databaseId,t),r.Ci((function(i){const a=vi(i);return a.length===0?0:a[a.length-1].kind})(e))),r.Di()}ts(e,t,r){if(r===null)return[];let s=[];s.push(new ic);let i=0;for(const a of vi(e)){const c=r[i++];for(const l of s)if(this.ls(t,a.fieldPath)&&Ys(c))s=this.Es(s,a,c);else{const d=l.Ci(a.kind);Ti.Ei.Yr(c,d)}}return this.hs(s)}es(e,t,r){return this.ts(e,t,r.position)}hs(e){const t=[];for(let r=0;r<e.length;++r)t[r]=e[r].Di();return t}Es(e,t,r){const s=[...e],i=[];for(const a of r.arrayValue.values||[])for(const c of s){const l=new ic;l.seed(c.Di()),Ti.Ei.Yr(a,l.Ci(t.kind)),i.push(l)}return i}ls(e,t){return!!e.filters.find((r=>r instanceof Ye&&r.field.isEqual(t)&&(r.op==="in"||r.op==="not-in")))}getFieldIndexes(e,t){const r=ac(e),s=ka(e);return(t?r.H(Np,IDBKeyRange.bound(t,t)):r.H()).next((i=>{const a=[];return F.forEach(i,(c=>s.get([c.indexId,this.uid]).next((l=>{a.push((function(m,p){const f=p?new $c(p.sequenceNumber,new Bn(Ki(p.readTime),new me(wr(p.documentKey)),p.largestBatchId)):$c.empty(),g=m.fields.map((([x,b])=>new Nd(ft.fromServerFormat(x),b)));return new nu(m.indexId,m.collectionGroup,g,f)})(c,l))})))).next((()=>a))}
1862))}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next((t=>t.length===0?null:(t.sort(((r,s)=>{const i=r.indexState.sequenceNumber-s.indexState.sequenceNumber;return i!==0?i:De(r.collectionGroup,s.collectionGroup)})),t[0].collectionGroup)))}updateCollectionGroup(e,t,r){const s=ac(e),i=ka(e);return this.Ts(e).next((a=>s.H(Np,IDBKeyRange.bound(t,t)).next((c=>F.forEach(c,(l=>i.put(J0(l.indexId,this.uid,a,r))))))))}updateIndexEntries(e,t){const r=new Map;return F.forEach(t,((s,i)=>{const a=r.get(s.collectionGroup);return(a?F.resolve(a):this.getFieldIndexes(e,s.collectionGroup)).next((c=>(r.set(s.collectionGroup,c),F.forEach(c,(l=>this.Ps(e,s,l).next((d=>{const m=this.Rs(i,l);return d.isEqual(m)?F.resolve():this.Is(e,i,l,d,m)})))))))}))}As(e,t,r,s){return _a(e).put(s.Bi(this.uid,this.cs(r,t.key),t.key))}Vs(e,t,r,s){return _a(e).delete(s.Ui(this.uid,this.cs(r,t.key),t.key))}Ps(e,t,r){const s=_a(e);let i=new rt(xs);return s.ee({index:G4,range:IDBKeyRange.only([r.indexId,this.uid,Dd(this.cs(r,t))])},((a,c)=>{i=i.add(new Ei(r.indexId,t,rb(c.arrayValue),rb(c.directionalValue)))})).next((()=>i))}Rs(e,t){let r=new rt(xs);const s=this.us(t,e);if(s==null)return r;const i=Tp(t);if(i!=null){const a=e.data.field(i.fieldPath);if(Ys(a))for(const c of a.arrayValue.values||[])r=r.add(new Ei(t.indexId,e.key,this.rs(c),s))}else r=r.add(new Ei(t.indexId,e.key,yd,s));return r}Is(e,t,r,s,i){se(ab,"Updating index entries for document '%s'",t.key);const a=[];return(function(l,d,m,p,f){const g=l.getIterator(),x=d.getIterator();let b=xa(g),I=xa(x);for(;b||I;){let N=!1,V=!1;if(b&&I){const D=m(b,I);D<0?V=!0:D>0&&(N=!0)}else b!=null?V=!0:N=!0;N?(p(I),I=xa(x)):V?(f(b),b=xa(g)):(b=xa(g),I=xa(x))}})(s,i,xs,(c=>{a.push(this.As(e,t,r,c))}),(c=>{a.push(this.Vs(e,t,r,c))})),F.waitFor(a)}Ts(e){let t=1;return ka(e).ee({index:U4,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},((r,s,i)=>{i.done(),t=s.sequenceNumber+1})).next((()=>t))}createRange(e,t,r){r=r.sort(((a,c)=>xs(a,c))).filter(((a,c,l)=>!c||xs(a,l[c-1])!==0));const s=[];
1862s.push(e);for(const a of r){const c=xs(a,e),l=xs(a,t);if(c===0)s[0]=e.Li();else if(c>0&&l<0)s.push(a),s.push(a.Li());else if(l>0)break}s.push(t);const i=[];for(let a=0;a<s.length;a+=2){if(this.ds(s[a],s[a+1]))return[];const c=s[a].Ui(this.uid,yd,me.empty()),l=s[a+1].Ui(this.uid,yd,me.empty());i.push(IDBKeyRange.bound(c,l))}return i}ds(e,t){return xs(e,t)>0}getMinOffsetFromCollectionGroup(e,t){return this.getFieldIndexes(e,t).next(cb)}getMinOffset(e,t){return F.mapArray(this.Zi(t),(r=>this.Xi(e,r).next((s=>s||ye(44426))))).next(cb)}}function ob(n){return Bt(n,Gc)}function _a(n){return Bt(n,Tc)}function ac(n){return Bt(n,q1)}function ka(n){return Bt(n,jc)}function cb(n){ce(n.length!==0,28825);let e=n[0].indexState.offset,t=e.largestBatchId;for(let r=1;r<n.length;r++){const s=n[r].indexState.offset;D1(s,e)<0&&(e=s),t<s.largestBatchId&&(t=s.largestBatchId)}return new Bn(e.readTime,e.documentKey,t)}/**
1863 * @license
1864 * Copyright 2020 Google LLC
1865 *
1866 * Licensed under the Apache License, Version 2.0 (the "License");
1867 * you may not use this file except in compliance with the License.
1868 * You may obtain a copy of the License at
1869 *
1870 *   http://www.apache.org/licenses/LICENSE-2.0
1871 *
1872 * Unless required by applicable law or agreed to in writing, software
1873 * distributed under the License is distributed on an "AS IS" BASIS,
1874 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1875 * See the License for the specific language governing permissions and
1876 * limitations under the License.
1877 */function k3(n,e,t){const r=n.store(sr),s=n.store(Xa),i=[],a=IDBKeyRange.only(t.batchId);let c=0;const l=r.ee({range:a},((m,p,f)=>(c++,f.delete())));i.push(l.next((()=>{ce(c===1,47070,{batchId:t.batchId})})));const d=[];for(const m of t.mutations){const p=F4(e,m.key.path,t.batchId);i.push(s.delete(p)),d.push(m.key)}return F.waitFor(i).next((()=>d))}function xu(n){if(!n)return 0;let e;if(n.document)e=n.document;else if(n.unknownDocument)e=n.unknownDocument;else{if(!n.noDocument)throw ye(14731);e=n.noDocument}return JSON.stringify(e).length}/**
1878 * @license
1879 * Copyright 2017 Google LLC
1880 *
1881 * Licensed under the Apache License, Version 2.0 (the "License");
1882 * you may not use this file except in compliance with the License.
1883 * You may obtain a copy of the License at
1884 *
1885 *   http://www.apache.org/licenses/LICENSE-2.0
1886 *
1887 * Unless required by applicable law or agreed to in writing, software
1888 * distributed under the License is distributed on an "AS IS" BASIS,
1889 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1890 * See the License for the specific language governing permissions and
1891 * limitations under the License.
1892 */class _h{constructor(e,t,r,s){this.userId=e,this.serializer=t,this.indexManager=r,this.referenceDelegate=s,this.fs={}}static jr(e,t,r,s){ce(e.uid!=="",64387);const i=e.isAuthenticated()?e.uid:"";return new _h(i,t,r,s)}checkEmpty(e){let t=!0;const r=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return vs(e).ee({index:Ni,range:r},((s,i,a)=>{t=!1,a.done()})).next((()=>t))}addMutationBatch(e,t,r,s){const i=Pa(e),a=vs(e);return a.add({}).next((c=>{ce(typeof c=="number",49019);const l=new bf(c,t,r,s),d=(function(g,x,b){const I=b.baseMutations.map((V=>mu(g.zr,V))),N=b.mutations.map((V=>mu(g.zr,V)));return{userId:x,batchId:b.batchId,localWriteTimeMs:b.localWriteTime.toMillis(),baseMutations:I,mutations:N}})(this.serializer,this.userId,l),m=[];let p=new rt(((f,g)=>De(f.canonicalString(),g.canonicalString())));for(const f of s){const g=F4(this.userId,f.key.path,c);p=p.add(f.key.path.popLast()),m.push(a.put(d)),m.push(i.put(g,RC))}return p.forEach((f=>{m.push(this.indexManager.addToCollectionParentIndex(e,f))})),e.addOnCommittedListener((()=>{this.fs[c]=l.keys()})),F.waitFor(m).next((()=>l))}))}lookupMutationBatch(e,t){return vs(e).get(t).next((r=>r?(ce(r.userId===this.userId,48,"Unexpected user for mutation batch",{userId:r.userId,batchId:t}),ji(this.serializer,r)):null))}ps(e,t){return this.fs[t]?F.resolve(this.fs[t]):this.lookupMutationBatch(e,t).next((r=>{if(r){const s=r.keys();return this.fs[t]=s,s}return null}))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=IDBKeyRange.lowerBound([this.userId,r]);let i=null;return vs(e).ee({index:Ni,range:s},((a,c,l)=>{c.userId===this.userId&&(ce(c.batchId>
vendor: 8,306 bytes, lines 1892-1937
1892=r,47524,{gs:r}),i=ji(this.serializer,c)),l.done()})).next((()=>i))}getHighestUnacknowledgedBatchId(e){const t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let r=Ai;return vs(e).ee({index:Ni,range:t,reverse:!0},((s,i,a)=>{r=i.batchId,a.done()})).next((()=>r))}getAllMutationBatches(e){const t=IDBKeyRange.bound([this.userId,Ai],[this.userId,Number.POSITIVE_INFINITY]);return vs(e).H(Ni,t).next((r=>r.map((s=>ji(this.serializer,s)))))}getAllMutationBatchesAffectingDocumentKey(e,t){const r=Sd(this.userId,t.path),s=IDBKeyRange.lowerBound(r),i=[];return Pa(e).ee({range:s},((a,c,l)=>{const[d,m,p]=a,f=wr(m);if(d===this.userId&&t.path.isEqual(f))return vs(e).get(p).next((g=>{if(!g)throw ye(61480,{ys:a,batchId:p});ce(g.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:g.userId,batchId:p}),i.push(ji(this.serializer,g))}));l.done()})).next((()=>i))}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new rt(De);const s=[];return t.forEach((i=>{const a=Sd(this.userId,i.path),c=IDBKeyRange.lowerBound(a),l=Pa(e).ee({range:c},((d,m,p)=>{const[f,g,x]=d,b=wr(g);f===this.userId&&i.path.isEqual(b)?r=r.add(x):p.done()}));s.push(l)})),F.waitFor(s).next((()=>this.ws(e,r)))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1,i=Sd(this.userId,r),a=IDBKeyRange.lowerBound(i);let c=new rt(De);return Pa(e).ee({range:a},((l,d,m)=>{const[p,f,g]=l,x=wr(f);p===this.userId&&r.isPrefixOf(x)?x.length===s&&(c=c.add(g)):m.done()})).next((()=>this.ws(e,c)))}ws(e,t){const r=[],s=[];return t.forEach((i=>{s.push(vs(e).get(i).next((a=>{if(a===null)throw ye(35274,{batchId:i});ce(a.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:a.userId,batchId:i}),r.push(ji(this.serializer,a))})))})),F.waitFor(s).next((()=>r))}removeMutationBatch(e,t){return k3(e.le,this.userId,t).next((r=>(e.addOnCommittedListener((()=>{this.bs(t.batchId)})),F.forEach(r,(s=>this.referenceDelegate.markPotentiallyOrphaned(e,s))))))}bs(e){delete this.fs[e]}performConsistencyCheck(e){return this.checkEmpty(e).next((t=>{if(!t)return F.resolve();const r=IDBKeyRange.lowerBound((function(a){return[a]})(this.userId)),s=[];return Pa(e).ee({range:r},((i,a,c)=>{if(i[0]===this.userId){const l=wr(i[1]);s.push(l)}else c.done()})).next((()=>{ce(s.length===0,56720,{vs:s.map((i=>i.canonicalString()))})}))}))}containsKey(e,t){return w3(e,this.userId,t)}Ss(e){return j3(e).get(this.userId).next((t=>t||{userId:this.userId,lastAcknowledgedBatchId:Ai,lastStreamToken:""}))}}function w3(n,e,t){const r=Sd(e,t.path),s=r[1],i=IDBKeyRange.lowerBound(r);let a=!1;return Pa(n).ee({range:i,X:!0},((c,l,d)=>{const[m,p,f]=c;m===e&&p===s&&(a=!0),d.done()})).next((()=>a))}function vs(n){return Bt(n,sr)}function Pa(n){return Bt(n,Xa)}function j3(n){return Bt(n,Bc)}/**
1893 * @license
1894 * Copyright 2017 Google LLC
1895 *
1896 * Licensed under the Apache License, Version 2.0 (the "License");
1897 * you may not use this file except in compliance with the License.
1898 * You may obtain a copy of the License at
1899 *
1900 *   http://www.apache.org/licenses/LICENSE-2.0
1901 *
1902 * Unless required by applicable law or agreed to in writing, software
1903 * distributed under the License is distributed on an "AS IS" BASIS,
1904 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905 * See the License for the specific language governing permissions and
1906 * limitations under the License.
1907 */class rs{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new rs(0)}static Cs(){return new rs(-1)}}/**
1908 * @license
1909 * Copyright 2017 Google LLC
1910 *
1911 * Licensed under the Apache License, Version 2.0 (the "License");
1912 * you may not use this file except in compliance with the License.
1913 * You may obtain a copy of the License at
1914 *
1915 *   http://www.apache.org/licenses/LICENSE-2.0
1916 *
1917 * Unless required by applicable law or agreed to in writing, software
1918 * distributed under the License is distributed on an "AS IS" BASIS,
1919 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1920 * See the License for the specific language governing permissions and
1921 * limitations under the License.
1922 */class rO{constructor(e,t){this.referenceDelegate=e,this.serializer=t}allocateTargetId(e){return this.Fs(e).next((t=>{const r=new rs(t.highestTargetId);return t.highestTargetId=r.next(),this.Os(e,t).next((()=>t.highestTargetId))}))}getLastRemoteSnapshotVersion(e){return this.Fs(e).next((t=>Ne.fromTimestamp(new st(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))))}getHighestSequenceNumber(e){return this.Fs(e).next((t=>t.highestListenSequenceNumber))}setTargetsMetadata(e,t,r){return this.Fs(e).next((s=>(s.highestListenSequenceNumber=t,r&&(s.lastRemoteSnapshotVersion=r.toTimestamp()),t>s.highestListenSequenceNumber&&(s.highestListenSequenceNumber=t),this.Os(e,s))))}addTargetData(e,t){return this.Ms(e,t).next((()=>this.Fs(e).next((r=>(r.targetCount+=1,this.Ns(t,r),this.Os(e,r))))))}updateTargetData(e,t){return this.Ms(e,t)}removeTargetData(e,t){return this.removeMatchingKeysForTargetId(e,t.targetId).next((()=>wa(e).delete(t.targetId))).next((()=>this.Fs(e))).next((r=>(ce(r.targetCount>0,8065),r.targetCount-=1,this.Os(e,r))))}removeTargets(e,t,r){let s=0;const i=[];return wa(e).ee(((a,c)=>{const l=gc(this.serializer,c);l.sequenceNumber<=t&&r.get(l.targetId)===null&&(s++,i.push(this.removeTargetData(e,l)))})).next((()=>F.waitFor(i))).next((()=>s))}forEachTarget(e,t){return wa(e).ee(((r,s)=>{const i=gc(this.serializer,s);t(i)}))}Fs(e){return lb(e).get(iu).next((t=>(ce(t!==null,2888),t)))}Os(e,t){return lb(e).put(iu,t)}Ms(e,t){return wa(e).put(x3(this.serializer,t))}Ns(e,t){let r=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,r=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,r=!0),r}getTargetCount(e){return this.Fs(e).next((t=>t.targetCount))}getTargetData(e,t){const r=vh(t),s=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]);let i=null;return wa(e).ee({range:s,index:B4},((a,c,l)=>{const d=gc(this.serializer,c);yf(t,d.target)&&(i=d,l.done())})).next((()=>i))}addMatchingKeys(e,t,r){const s=[],i=Ns(e);return t.forEach((a=>{const c=hn(a.path);s.push(i.put({targetId:r,path:c})),s.push(this.referenceDelegate.addReference(e,r,a))})),F.waitFor(s)}removeMatchingKeys(e,t,r){const s=Ns(e);return F.forEach(t,(i=>{const a=hn(i.path);return F.waitFor([s.delete([r,a]),this.referenceDelegate.removeReference(e,r,i)])}))}removeMatchingKeysForTargetId(e,t){const r=Ns(e),s=IDBKeyRange.bound([t],[t+1],!1,!0);return r.delete(s)}getMatchingKeysForTargetId(e,t){const r=IDBKeyRange.bound([t],[t+1],!1,!0),s=Ns(e);let i=Fe();return s.ee({range:r,X:!0},((a,c,l)=>{const d=wr(a[1]),m=new me(d);i=i.add(m)})).next((()=>i))}containsKey(e,t){const r=hn(t.path),s=IDBKeyRange.bound([r],[P4(r)],!1,!0);let i=0;return Ns(e).ee({index:L1,X:!0,range:s},(([a,c],l,d)=>{a!==0&&(i++,d.done())})).next((()=>i>0))}dt(e,t){return wa(e).get(t).next((r=>r?gc(this.serializer,r):null))}}function wa(n){return Bt(n,eo)}function lb(n){return Bt(n,Ci)}function Ns(n){return Bt(n,to)}/**
1923 * @license
1924 * Copyright 2020 Google LLC
1925 *
1926 * Licensed under the Apache License, Version 2.0 (the "License");
1927 * you may not use this file except in compliance with the License.
1928 * You may obtain a copy of the License at
1929 *
1930 *   http://www.apache.org/licenses/LICENSE-2.0
1931 *
1932 * Unless required by applicable law or agreed to in writing, software
1933 * distributed under the License is distributed on an "AS IS" BASIS,
1934 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1935 * See the License for the specific language governing permissions and
1936 * limitations under the License.
1937 */class sO{constructor(e,t){this.db=e,this.garbageCollector=Yv(this,t)}lr(e){const t=this.Ls(e);return this.db.getTargetCache().getTargetCount(e).next((r=>t.next((s=>r+s))))}Ls(e){let t=0;return this.Er(e,(r=>{t++})).next((()=>t))}forEachTarget(e,t){return this.db.getTargetCache().forEachTarget(e,t)}Er(e,t){return this.Bs(e,((r,s)=>t(s)))}addReference(e,t,r){return bd(e,r)}removeReference(e,t,r){return bd(e,r)}removeTargets(e,t,r){return this.db.getTargetCache().removeTargets(e,t,r)}markPotentiallyOrphaned(e,t){return bd(e,t)}Us(e,t){return(function(s,i){let a=!1;return j3(s).te((c=>
1937w3(s,c,i).next((l=>(l&&(a=!0),F.resolve(!l)))))).next((()=>a))})(e,t)}removeOrphanedDocuments(e,t){const r=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[];let i=0;return this.Bs(e,((a,c)=>{if(c<=t){const l=this.Us(e,a).next((d=>{if(!d)return i++,r.getEntry(e,a).next((()=>(r.removeEntry(a,Ne.min()),Ns(e).delete((function(p){return[0,hn(p.path)]})(a)))))}));s.push(l)}})).next((()=>F.waitFor(s))).next((()=>r.apply(e))).next((()=>i))}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,r)}updateLimboDocument(e,t){return bd(e,t)}Bs(e,t){const r=Ns(e);let s,i=Nn.ce;return r.ee({index:L1},(([a,c],{path:l,sequenceNumber:d})=>{a===0?(i!==Nn.ce&&t(new me(wr(s)),i),i=d,s=l):i=Nn.ce})).next((()=>{i!==Nn.ce&&t(new me(wr(s)),i)}))}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}}function bd(n,e){return Ns(n).put((function(r,s){return{targetId:0,path:hn(r.path),sequenceNumber:s}})(e,n.currentSequenceNumber))}// Copyright 2024 Google LLC* @license
1938function T3(n,e){var r;let t=e;for(const s of n.stages)t=iO({serializer:n.serializer,serverTimestampBehavior:(r=n.listenOptions)==null?void 0:r.serverTimestampBehavior},s,t);return t}function kh(n,e){return T3(n,[e]).length>0}function E3(n,e){return Nt(n)?kh(n,e):hh(n,e)}function iO(n,e,t){if(e instanceof El)return(function(s,i,a){return a.filter((c=>c.isFoundDocument()&&`/${c.key.getCollectionPath().canonicalString()}`===i.Vr))})(0,e,t);if(e instanceof Sl)return(function(s,i,a){return a.filter((c=>{const l=Pc(Ce(i.condition).evaluate(s,c));return l!==void 0&&Jn(l,Mn)}))})(n,e,t);if(e instanceof Nl)return(function(s,i,a){return a.filter((c=>c.isFoundDocument()&&c.key.getCollectionPath().lastSegment()===i.collectionId))})(0,e,t);if(e instanceof gh)return(function(s,i,a){return a.filter((c=>c.isFoundDocument()))})(0,0,t);if(e instanceof yh)return(function(s,i,a){return a.filter((c=>c.isFoundDocument()&&i.mr.has(c.key.path.toStringWithLeadingSlash())))})(0,e,t);if(e instanceof Js)return(function(s,i,a){return a.slice(0,i.limit)})(0,e,t);if(e instanceof Tr)return(function(s,i,a){const c=i.orderings.map((l=>({ks:Ce(l.expr),direction:l.direction})));return[...a].sort(((l,d)=>{for(const{ks:m,direction:p}of c){const f=Pc(m.evaluate(s,l)),g=Pc(m.evaluate(s,d)),x=fn(f??Ar,g??Ar);if(x!==0)return p==="ascending"?x:-x}return 0}))})(n,e,t);throw new Error(`Unknown stage: ${e._name}`)}function Kp(n){const e=(function(r){for(let s=r.stages.length-1;s>=0;s--){const i=r.stages[s];if(i instanceof Tr)return i.orderings}throw new Error("Pipeline must contain at least one Sort stage")})(n);return(t,r)=>{for(const s of e){const i=Pc(Ce(s.expr).evaluate({serializer:n.serializer},t)),a=Pc(Ce(s.expr).evaluate({serializer:n.serializer},r)),c=fn(i||Ar,a||Ar);if(c!==0)return s.direction==="ascending"?c:-c}return 0}}function Pm(n){for(let e=n.stages.length-1;e>=0;e--){const t=n.stages[e];if(t instanceof Js)return{limit:t.limit}}}/**
1939 * @license
1940 * Copyright 2017 Google LLC
1941 *
1942 * Licensed under the Apache License, Version 2.0 (the "License");
1943 * you may not use this file except in compliance with the License.
1944 * You may obtain a copy of the License at
1945 *
1946 *   http://www.apache.org/licenses/LICENSE-2.0
1947 *
1948 * Unless required by applicable law or agreed to in writing, software
1949 * distributed under the License is distributed on an "AS IS" BASIS,
1950 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1951 * See the License for the specific language governing permissions and
1952 * limitations under the License.
1953 */class N3{constructor(){this.changes=new ds((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Et.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?F.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}
vendor: 7,861 bytes, lines 1953-2013
1953assertNotApplied(){}}/**
1954 * @license
1955 * Copyright 2017 Google LLC
1956 *
1957 * Licensed under the Apache License, Version 2.0 (the "License");
1958 * you may not use this file except in compliance with the License.
1959 * You may obtain a copy of the License at
1960 *
1961 *   http://www.apache.org/licenses/LICENSE-2.0
1962 *
1963 * Unless required by applicable law or agreed to in writing, software
1964 * distributed under the License is distributed on an "AS IS" BASIS,
1965 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1966 * See the License for the specific language governing permissions and
1967 * limitations under the License.
1968 */class aO{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,t,r){return Is(e).put(r)}removeEntry(e,t,r){return Is(e).delete((function(i,a){const c=i.path.toArray();return[c.slice(0,c.length-2),c[c.length-2],yu(a),c[c.length-1]]})(t,r))}updateMetadata(e,t){return this.getMetadata(e).next((r=>(r.byteSize+=t,this.qs(e,r))))}getEntry(e,t){let r=Et.newInvalidDocument(t);return Is(e).ee({index:Ad,range:IDBKeyRange.only(oc(t))},((s,i)=>{r=this.$s(t,i)})).next((()=>r))}Ks(e,t){let r={size:0,document:Et.newInvalidDocument(t)};return Is(e).ee({index:Ad,range:IDBKeyRange.only(oc(t))},((s,i)=>{r={document:this.$s(t,i),size:xu(i)}})).next((()=>r))}getEntries(e,t){let r=Ft();return this.Ws(e,t,((s,i)=>{const a=this.$s(s,i);r=r.insert(s,a)})).next((()=>r))}getAllEntries(e){let t=Ft();return Is(e).ee(((r,s)=>{const i=this.$s(me.fromSegments(s.prefixPath.concat(s.collectionGroup,s.documentId)),s);t=t.insert(i.key,i)})).next((()=>t))}Qs(e,t){let r=Ft(),s=new ut(me.comparator);return this.Ws(e,t,((i,a)=>{const c=this.$s(i,a);r=r.insert(i,c),s=s.insert(i,xu(a))})).next((()=>({documents:r,Gs:s})))}Ws(e,t,r){if(t.isEmpty())return F.resolve();let s=new rt(hb);t.forEach((l=>s=s.add(l)));const i=IDBKeyRange.bound(oc(s.first()),oc(s.last())),a=s.getIterator();let c=a.getNext();return Is(e).ee({index:Ad,range:i},((l,d,m)=>{const p=me.fromSegments([...d.prefixPath,d.collectionGroup,d.documentId]);for(;c&&hb(c,p)<0;)r(c,null),c=a.getNext();c&&c.isEqual(p)&&(r(c,d),c=a.hasNext()?a.getNext():null),c?m.j(oc(c)):m.done()})).next((()=>{for(;c;)r(c,null),c=a.hasNext()?a.getNext():null}))}getDocumentsMatchingQuery(e,t,r,s,i){const a=Nt(t)?Ke.fromString(Al(t)):t.path,c=[a.popLast().toArray(),a.lastSegment(),yu(r.readTime),r.documentKey.path.isEmpty()?"":r.documentKey.path.lastSegment()],l=[a.popLast().toArray(),a.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Is(e).H(IDBKeyRange.bound(c,l,!0)).next((d=>{i==null||i.incrementDocumentReadCount(d.length);let m=Ft();for(const p of d){const f=this.$s(me.fromSegments(p.prefixPath.concat(p.collectionGroup,p.documentId)),p);f.isFoundDocument()&&(E3(t,f)||s.has(f.key))&&(m=m.insert(f.key,f))}return m}))}getAllFromCollectionGroup(e,t,r,s){let i=Ft();const a=ub(t,r),c=ub(t,Bn.max());return Is(e).ee({index:$4,range:IDBKeyRange.bound(a,c,!0)},((l,d,m)=>{const p=this.$s(me.fromSegments(d.prefixPath.concat(d.collectionGroup,d.documentId)),d);i=i.insert(p.key,p),i.size===s&&m.done()})).next((()=>i))}newChangeBuffer(e){return new oO(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next((t=>t.byteSize))}getMetadata(e){return db(e).get(Ep).next((t=>(ce(!!t,20021),t)))}qs(e,t){return db(e).put(Ep,t)}$s(e,t){if(t){const r=KR(this.serializer,t);if(!(r.isNoDocument()&&r.version.isEqual(Ne.min())))return r}return Et.newInvalidDocument(e)}}function S3(n){return new aO(n)}class oO extends N3{constructor(e,t){super(),this.zs=e,this.trackRemovals=t,this.js=new ds((r=>r.toString()),((r,s)=>r.isEqual(s)))}applyChanges(e){const t=[];let r=0,s=new rt(((i,a)=>De(i.canonicalString(),a.canonicalString())));return this.changes.forEach(((i,a)=>{const c=this.js.get(i);if(t.push(this.zs.removeEntry(e,i,c.readTime)),a.isValidDocument()){const l=Q0(this.zs.serializer,a);s=s.add(i.path.popLast());const d=xu(l);r+=d-c.size,t.push(this.zs.addEntry(e,i,l))}else if(r-=c.size,this.trackRemovals){const l=Q0(this.zs.serializer,a.convertToNoDocument(Ne.min()));t.push(this.zs.addEntry(e,i,l))}})),s.forEach((i=>{t.push(this.zs.indexManager.addToCollectionParentIndex(e,i))})),t.push(this.zs.updateMetadata(e,r)),F.waitFor(t)}getFromCache(e,t){return this.zs.Ks(e,t).next((r=>(this.js.set(t,{size:r.size,readTime:r.document.readTime}),r.document)))}getAllFromCache(e,t){return this.zs.Qs(e,t).next((({documents:r,Gs:s})=>(s.forEach(((i,a)=>{this.js.set(i,{size:a,readTime:r.get(i).readTime})})),r)))}}function db(n){return Bt(n,Uc)}function Is(n){return Bt(n,su)}function oc(n){const e=n.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function ub(n,e){const t=e.documentKey.path.toArray();return[n,yu(e.readTime),t.slice(0,t.length-2),t.length>0?t[t.length-1]:""]}function hb(n,e){const t=n.path.toArray(),r=e.path.toArray();let s=0;for(let i=0;i<t.length-2&&i<r.length-2;++i)if(s=De(t[i],r[i]),s)return s;return s=De(t.length,r.length),s||(s=De(t[t.length-2],r[r.length-2]),s||De(t[t.length-1],r[r.length-1]))}/**
1969 * @license
1970 * Copyright 2017 Google LLC
1971 *
1972 * Licensed under the Apache License, Version 2.0 (the "License");
1973 * you may not use this file except in compliance with the License.
1974 * You may obtain a copy of the License at
1975 *
1976 *   http://www.apache.org/licenses/LICENSE-2.0
1977 *
1978 * Unless required by applicable law or agreed to in writing, software
1979 * distributed under the License is distributed on an "AS IS" BASIS,
1980 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1981 * See the License for the specific language governing permissions and
1982 * limitations under the License.
1983 *//**
1984 * @license
1985 * Copyright 2022 Google LLC
1986 *
1987 * Licensed under the Apache License, Version 2.0 (the "License");
1988 * you may not use this file except in compliance with the License.
1989 * You may obtain a copy of the License at
1990 *
1991 *   http://www.apache.org/licenses/LICENSE-2.0
1992 *
1993 * Unless required by applicable law or agreed to in writing, software
1994 * distributed under the License is distributed on an "AS IS" BASIS,
1995 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1996 * See the License for the specific language governing permissions and
1997 * limitations under the License.
1998 */class cO{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
1999 * @license
2000 * Copyright 2017 Google LLC
2001 *
2002 * Licensed under the Apache License, Version 2.0 (the "License");
2003 * you may not use this file except in compliance with the License.
2004 * You may obtain a copy of the License at
2005 *
2006 *   http://www.apache.org/licenses/LICENSE-2.0
2007 *
2008 * Unless required by applicable law or agreed to in writing, software
2009 * distributed under the License is distributed on an "AS IS" BASIS,
2010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2011 * See the License for the specific language governing permissions and
2012 * limitations under the License.
2013 */class A3{constructor(e,t,r,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next((s=>(r=s,this.remoteDocumentCache.getEntry(e,t)))).next((s=>(r!==null&&Nc(r.mutation,s,Qn.empty(),st.now()),s)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((r=>this.getLocalViewOfDocuments(e,r,Fe()).next((()=>r))))}getLocalViewOfDocuments(e,t,r=Fe()){const s=Wn();return this.populateOverlays(e,s,t).next((()=>this.computeViews(e,t,s,r).next((i=>{let a=wi();return i.forEach(((c,l)=>{a=a.insert(c,l.overlayedDocument)})),a}))))}getOverlayedDocuments(e,t){const r=Wn();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,Fe())))}populateOverlays(e,t,r){const s=[];return r.forEach((i=>{t.has(i)||s.push(i)})),this.documentOverlayCache.getOverlays(e,s).next((i=>
2013{i.forEach(((a,c)=>{t.set(a,c)}))}))}computeViews(e,t,r,s){let i=Ft();const a=Cc(),c=(function(){return Cc()})();return t.forEach(((l,d)=>{const m=r.get(d.key);s.has(d.key)&&(m===void 0||m.mutation instanceof ci)?i=i.insert(d.key,d):m!==void 0?(a.set(d.key,m.mutation.getFieldMask()),Nc(m.mutation,d,m.mutation.getFieldMask(),st.now())):a.set(d.key,Qn.empty())})),this.recalculateAndSaveOverlays(e,i).next((l=>(l.forEach(((d,m)=>a.set(d,m))),t.forEach(((d,m)=>c.set(d,new cO(m,a.get(d)??null)))),c)))}recalculateAndSaveOverlays(e,t){const r=Cc();let s=new ut(((a,c)=>a-c)),i=Fe();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((a=>{for(const c of a)c.keys().forEach((l=>{const d=t.get(l);if(d===null)return;let m=r.get(l)||Qn.empty();m=c.applyToLocalView(d,m),r.set(l,m);const p=(s.get(c.batchId)||Fe()).add(l);s=s.insert(c.batchId,p)}))})).next((()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,m=l.value,p=Tv();m.forEach((f=>{if(!i.has(f)){const g=uv(t.get(f),r.get(f));g!==null&&p.set(f,g),i=i.add(f)}})),a.push(this.documentOverlayCache.saveOverlays(e,d,p))}return F.waitFor(a)})).next((()=>r))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((r=>this.recalculateAndSaveOverlays(e,r)))}getDocumentsMatchingQuery(e,t,r,s){return Nt(t)?this.getDocumentsMatchingPipeline(e,t,r,s):wM(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):_v(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,s):this.getDocumentsMatchingCollectionQuery(e,t,r,s)}getNextDocuments(e,t,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,s).next((i=>{const a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):F.resolve(Wn());let c=Za,l=i;return a.next((d=>F.forEach(d,((m,p)=>(c<p.largestBatchId&&(c=p.largestBatchId),i.get(m)?F.resolve():this.remoteDocumentCache.getEntry(e,m).next((f=>{l=l.insert(m,f)}))))).next((()=>this.populateOverlays(e,d,i))).next((()=>this.computeViews(e,l,d,Fe()))).next((m=>({batchId:c,changes:jv(m)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new me(t)).next((r=>{let s=wi();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s}))}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=wi();return this.indexManager.getCollectionParents(e,i).next((c=>
2013F.forEach(c,(l=>{const d=(function(p,f){return new wl(f,null,p.explicitOrderBy.slice(),p.filters.slice(),p.limit,p.limitType,p.startAt,p.endAt)})(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next((m=>{m.forEach(((p,f)=>{a=a.insert(p,f)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s)))).next((a=>this.retrieveMatchingLocalDocuments(i,a,(c=>hh(t,c)))))}getDocumentsMatchingPipeline(e,t,r,s){if(Hr(t)==="collection_group"){const i=df(t);let a=wi();return this.indexManager.getCollectionParents(e,i).next((c=>F.forEach(c,(l=>{const d=(function(p,f){const g=p.stages.map((x=>x instanceof Nl?new El(f.canonicalString(),{}):x));return new dn(p.serializer,g)})(t,l.child(i));return this.getDocumentsMatchingPipeline(e,d,r,s).next((m=>{m.forEach(((p,f)=>{a=a.insert(p,f)}))}))})).next((()=>a))))}{let i;return this.getOverlaysForPipeline(e,t,r.largestBatchId).next((a=>{switch(i=a,Hr(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s);case"documents":let c=Fe();for(const l of fu(t))c=c.add(me.fromPath(l));return this.remoteDocumentCache.getEntries(e,c);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new de("invalid-argument",`Invalid pipeline source to execute offline: ${Wr(t)}`)}})).next((a=>this.retrieveMatchingLocalDocuments(i,a,(c=>kh(t,c)))))}}retrieveMatchingLocalDocuments(e,t,r){e.forEach(((i,a)=>{const c=a.getKey();t.get(c)===null&&(t=t.insert(c,Et.newInvalidDocument(c)))}));let s=wi();return t.forEach(((i,a)=>{const c=e.get(i);c!==void 0&&Nc(c.mutation,a,Qn.empty(),st.now()),r(a)&&(s=s.insert(i,a))})),s}getOverlaysForPipeline(e,t,r){switch(Hr(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,Ke.fromString(Al(t)),r);case"collection_group":throw new de("invalid-argument",`Unexpected collection group pipeline: ${Wr(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,fu(t).map((s=>me.fromPath(s))));case"database":return this.documentOverlayCache.getAllOverlays(e,r);default:throw new de("invalid-argument",`Failed to get overlays for pipeline: ${Wr(t)}`)}}}/**
2014 * @license
2015 * Copyright 2020 Google LLC
2016 *
2017 * Licensed under the Apache License, Version 2.0 (the "License");
2018 * you may not use this file except in compliance with the License.
2019 * You may obtain a copy of the License at
2020 *
2021 *   http://www.apache.org/licenses/LICENSE-2.0
2022 *
2023 * Unless required by applicable law or agreed to in writing, software
2024 * distributed under the License is distributed on an "AS IS" BASIS,
2025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2026 * See the License for the specific language governing permissions and
2027 * limitations under the License.
2028 */class lO{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return F.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,(function(s){return{id:s.id,version:s.version,createTime:kn(s.createTime)}})(t)),F.resolve()}getNamedQuery(e,t){return F.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,(function(s){return{name:s.name,query:v3(s.bundledQuery),readTime:kn(s.readTime)}})(t)),F.resolve()}}/**
2029 * @license
2030 * Copyright 2022 Google LLC
2031 *
2032 * Licensed under the Apache License, Version 2.0 (the "License");
2033 * you may not use this file except in compliance with the License.
2034 * You may obtain a copy of the License at
2035 *
2036 *   http://www.apache.org/licenses/LICENSE-2.0
2037 *
2038 * Unless required by applicable law or agreed to in writing, software
2039 * distributed under the License is distributed on an "AS IS" BASIS,
2040 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2041 * See the License for the specific language governing permissions and
2042 * limitations under the License.
2043 */class dO{constructor(){this.overlays=new ut(me.comparator),this.Ys=new Map}getOverlay(e,t){return F.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Wn();return F.forEach(t,(s=>this.getOverlay(e,s).next((i=>{i!==null&&r.set(s,i)})))).next((()=>r))}getAllOverlays(e,t){const r=Wn();return this.overlays.forEach(((s,i)=>{i.largestBatchId>t&&r.set(s,i)})),F.resolve(r)}saveOverlays(e,t,r){return r.forEach(((s,i)=>{this.Hr(e,t,i)})),F.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Ys.get(r);return s!==void 0&&(s.forEach((i=>this.overlays=this.overlays.remove(i))),this.Ys.delete(r)),F.resolve()}getOverlaysForCollection(e,t,r){const s=Wn(),i=t.length+1,a=new me(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return F.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new ut(((d,m)=>d-m));const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let m=i.get(d.largestBatchId);m===null&&(m=Wn(),i=i.insert(d.largestBatchId,m)),m.set(d.getKey(),d)}}const c=Wn(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach(((d,m)=>c.set(d,m))),!(c.size()>=s)););return F.resolve(c)}Hr(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Ys.get(s.largestBatchId).delete(r.key);this.Ys.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new vf(t,r));let i=this.Ys.get(t);i===void 0&&(i=Fe(),this.Ys.set(t,i)),this.Ys.set(t,i.add(r.key))}}/**
2044 * @license
2045 * Copyright 2024 Google LLC
2046 *
2047 * Licensed under the Apache License, Version 2.0 (the "License");
2048 * you may not use this file except in compliance with the License.
2049 * You may obtain a copy of the License at
2050 *
2051 *   http://www.apache.org/licenses/LICENSE-2.0
2052 *
2053 * Unless required by applicable law or agreed to in writing, software
2054 * distributed under the License is distributed on an "AS IS" BASIS,
2055 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2056 * See the License for the specific language governing permissions and
2057 * limitations under the License.
2058 */class uO{constructor(){this.sessionToken=vt.EMPTY_BYTE_STRING}getSessionToken(e){return F.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,F.resolve()}}/**
2059 * @license
2060 * Copyright 2017 Google LLC
2061 *
2062 * Licensed under the Apache License, Version 2.0 (the "License");
2063 * you may not use this file except in compliance with the License.
2064 * You may obtain a copy of the License at
2065 *
2066 *   http://www.apache.org/licenses/LICENSE-2.0
2067 *
2068 * Unless required by applicable law or agreed to in writing, software
2069 * distributed under the License is distributed on an "AS IS" BASIS,
2070 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2071 * See the License for the specific language governing permissions and
2072 * limitations under the License.
2073 */class kf{constructor(){this.Zs=new rt(Gt.Xs),this.e_=new rt(Gt.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){const r=new Gt(e,t);this.Zs=this.Zs.add(r),this.e_=this.e_.add(r)}n_(e,t){e.forEach((r=>this.addReference(r,t)))}removeReference(e,t){this.r_(new Gt(e,t))}i_(e,t){e.forEach((r=>this.removeReference(r,t)))}s_(e){const t=new me(new Ke([])),r=new Gt(t,e),s=new Gt(t,e+1),i=[];return this.e_.forEachInRange([r,s],(a=>{this.r_(a),i.push(a.key)})),i}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){const t=new me(new Ke([])),r=new Gt(t,e),s=new Gt(t,e+1);let i=Fe();return this.e_.forEachInRange([r,s],(a=>{i=i.add(a.key)})),i}containsKey(e){const t=new Gt(e,0),r=this.Zs.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class Gt{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return me.comparator(e.key,t.key)||De(e.a_,t.a_)}static t_(e,t){return De(e.a_,t.a_)||me.comparator(e.key,t.key)}}/**
2074 * @license
2075 * Copyright 2017 Google LLC
2076 *
2077 * Licensed under the Apache License, Version 2.0 (the "License");
2078 * you may not use this file except in compliance with the License.
2079 * You may obtain a copy of the License at
2080 *
2081 *   http://www.apache.org/licenses/LICENSE-2.0
2082 *
2083 * Unless required by applicable law or agreed to in writing, software
2084 * distributed under the License is distributed on an "AS IS" BASIS,
2085 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2086 * See the License for the specific language governing permissions and
2087 * limitations under the License.
2088 */class hO{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new rt(Gt.Xs)}checkEmpty(e){return F.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new bf(i,t,r,s);this.mutationQueue.push(a);for(const c of s)this.u_=this.u_.add(new Gt(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return F.resolve(a)}lookupMutationBatch(e,t){return F.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.l_(r),i=s<0?0:s;return F.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return F.resolve(this.mutationQueue.length===0?Ai:this.gs-1)}getAllMutationBatches(e){return F.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new Gt(t,0),s=new Gt(t,Number.POSITIVE_INFINITY),i=[];return this.u_.forEachInRange([r,s],(a=>{const c=this.c_(a.a_);i.push(c)})),F.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new rt(De);return t.forEach((s=>{const i=new Gt(s,0),a=new Gt(s,Number.POSITIVE_INFINITY);this.u_.forEachInRange([i,a],(c=>{r=r.add(c.a_)}))})),F.resolve(this.E_(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;me.isDocumentKey(i)||(i=i.child(""));const a=new Gt(new me(i),0);let c=new rt(De);return this.u_.forEachWhile((l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(l.a_)),!0)}),a),F.resolve(this.E_(c))}E_(e){const t=[];return e.forEach((r=>{const s=this.c_(r);s!==null&&t.push(s)})),t}removeMutationBatch(e,t){ce(this.h_(t.batchId,"removed")===0,55003),this.mutation
vendor: 7,630 bytes, lines 2088-2133
2088Queue.shift();let r=this.u_;return F.forEach(t.mutations,(s=>{const i=new Gt(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.u_=r}))}bs(e){}containsKey(e,t){const r=new Gt(t,0),s=this.u_.firstAfterOrEqual(r);return F.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,F.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){const t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2089 * @license
2090 * Copyright 2017 Google LLC
2091 *
2092 * Licensed under the Apache License, Version 2.0 (the "License");
2093 * you may not use this file except in compliance with the License.
2094 * You may obtain a copy of the License at
2095 *
2096 *   http://www.apache.org/licenses/LICENSE-2.0
2097 *
2098 * Unless required by applicable law or agreed to in writing, software
2099 * distributed under the License is distributed on an "AS IS" BASIS,
2100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2101 * See the License for the specific language governing permissions and
2102 * limitations under the License.
2103 */class mO{constructor(e){this.T_=e,this.docs=(function(){return new ut(me.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,s=this.docs.get(r),i=s?s.size:0,a=this.T_(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const r=this.docs.get(t);return F.resolve(r?r.document.mutableCopy():Et.newInvalidDocument(t))}getEntries(e,t){let r=Ft();return t.forEach((s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Et.newInvalidDocument(s))})),F.resolve(r)}getAllEntries(e){let t=Ft();return this.docs.forEach(((r,s)=>{t=t.insert(r,s.document)})),F.resolve(t)}getDocumentsMatchingQuery(e,t,r,s){let i,a;Nt(t)?(i=Ke.fromString(Al(t)),a=m=>kh(t,m)):(i=t.path,a=m=>hh(t,m));let c=Ft();const l=new me(i.child("__id-9223372036854775808__")),d=this.docs.getIteratorFrom(l);for(;d.hasNext();){const{key:m,value:{document:p}}=d.getNext();if(!i.isPrefixOf(m.path))break;m.path.length>i.length+1||D1(D4(p),r)<=0||(s.has(p.key)||a(p))&&(c=c.insert(p.key,p.mutableCopy()))}return F.resolve(c)}getAllFromCollectionGroup(e,t,r,s){ye(9500)}P_(e,t){return F.forEach(this.docs,(r=>t(r)))}newChangeBuffer(e){return new pO(this)}getSize(e){return F.resolve(this.size)}}class pO extends N3{constructor(e){super(),this.zs=e}applyChanges(e){const t=[];return this.changes.forEach(((r,s)=>{s.isValidDocument()?t.push(this.zs.addEntry(e,s)):this.zs.removeEntry(r)})),F.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}}/**
2104 * @license
2105 * Copyright 2017 Google LLC
2106 *
2107 * Licensed under the Apache License, Version 2.0 (the "License");
2108 * you may not use this file except in compliance with the License.
2109 * You may obtain a copy of the License at
2110 *
2111 *   http://www.apache.org/licenses/LICENSE-2.0
2112 *
2113 * Unless required by applicable law or agreed to in writing, software
2114 * distributed under the License is distributed on an "AS IS" BASIS,
2115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116 * See the License for the specific language governing permissions and
2117 * limitations under the License.
2118 */class fO{constructor(e){this.persistence=e,this.R_=new ds((t=>vh(t)),yf),this.lastRemoteSnapshotVersion=Ne.min(),this.highestTargetId=0,this.I_=0,this.A_=new kf,this.targetCount=0,this.V_=rs.xs()}forEachTarget(e,t){return this.R_.forEach(((r,s)=>t(s))),F.resolve()}getLastRemoteSnapshotVersion(e){return F.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return F.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),F.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.I_&&(this.I_=t),F.resolve()}Ms(e){this.R_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.V_=new rs(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,F.resolve()}updateTargetData(e,t){return this.Ms(t),F.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),this.targetCount-=1,F.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.R_.forEach(((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.R_.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)})),F.waitFor(i).next((()=>s))}getTargetCount(e){return F.resolve(this.targetCount)}getTargetData(e,t){const r=this.R_.get(t)||null;return F.resolve(r)}addMatchingKeys(e,t,r){return this.A_.n_(t,r),F.resolve()}removeMatchingKeys(e,t,r){this.A_.i_(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach((a=>{i.push(s.markPotentiallyOrphaned(e,a))})),F.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),F.resolve()}getMatchingKeysForTargetId(e,t){const r=this.A_.o_(t);return F.resolve(r)}containsKey(e,t){return F.resolve(this.A_.containsKey(t))}}/**
2119 * @license
2120 * Copyright 2017 Google LLC
2121 *
2122 * Licensed under the Apache License, Version 2.0 (the "License");
2123 * you may not use this file except in compliance with the License.
2124 * You may obtain a copy of the License at
2125 *
2126 *   http://www.apache.org/licenses/LICENSE-2.0
2127 *
2128 * Unless required by applicable law or agreed to in writing, software
2129 * distributed under the License is distributed on an "AS IS" BASIS,
2130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2131 * See the License for the specific language governing permissions and
2132 * limitations under the License.
2133 */class wf{constructor(e,t){this.d_={},this.overlays={},this.f_=new Nn(0),this.m_=!1,this.m_=!0,this.p_=new uO,this.referenceDelegate=e(this),this.g_=new fO(this),this.indexManager=new tO,this.remoteDocumentCache=(function(s){return new mO(s)})((r=>this.referenceDelegate.y_(r))),this.serializer=new b3(t),this.w_=new lO(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new dO,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.d_[e.toKey()];return r||(r=new hO(t,this.referenceDelegate),this.d_[e.toKey()]=r),r}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,r){se("MemoryPersistence","Starting transaction:",e);const s=new gO(this.f_.next());return this.referenceDelegate.b_(),r(s).next((i=>this.referenceDelegate.v_(s).next((()=>i)))).toPromise().then((i=>(s.raiseOnCommittedEvent(),i)))}S_(e,t){return F.or(Object.values(this.d_).map((r=>()=>r.containsKey(e,t))))}}class gO extends L4{constructor(e){super(),this.currentSequenceNumber=e}}class wh{constructor(e){this.persistence=e,this.D_=new kf,this.x_=null}static C_(e){return new wh(e)}get F_(){if(this.x_)return this.x_;throw ye(60996)}addReference(e,t,r){return this.D_.addReference(r,t),this.F_.delete(r.toString()),F.resolve()}removeReference(e,t,r){return this.D_.removeReference(r,t),this.F_.add(r.toString()),F.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),F.resolve()}
2133removeTarget(e,t){this.D_.s_(t.targetId).forEach((s=>this.F_.add(s.toString())));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next((s=>{s.forEach((i=>this.F_.add(i.toString())))})).next((()=>r.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return F.forEach(this.F_,(r=>{const s=me.fromPath(r);return this.O_(e,s).next((i=>{i||t.removeEntry(s,Ne.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((r=>{r?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return F.or([()=>F.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}}class vu{constructor(e,t){this.persistence=e,this.M_=new ds((r=>hn(r.path)),((r,s)=>r.isEqual(s))),this.garbageCollector=Yv(this,t)}static C_(e,t){return new vu(e,t)}b_(){}v_(e){return F.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){const t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((r=>t.next((s=>r+s))))}Ls(e){let t=0;return this.Er(e,(r=>{t++})).next((()=>t))}Er(e,t){return F.forEach(this.M_,((r,s)=>this.Us(e,r,s).next((i=>i?F.resolve():t(s)))))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.P_(e,(a=>this.Us(e,a,t).next((c=>{c||(r++,i.removeEntry(a,Ne.min()))})))).next((()=>i.apply(e))).next((()=>r))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),F.resolve()}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.M_.set(r,e.currentSequenceNumber),F.resolve()}removeReference(e,t,r){return this.M_.set(r,e.currentSequenceNumber),F.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),F.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Cd(e.data.value)),t}Us(e,t,r){return F.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.M_.get(t);return F.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
2134 * @license
2135 * Copyright 2020 Google LLC
2136 *
2137 * Licensed under the Apache License, Version 2.0 (the "License");
2138 * you may not use this file except in compliance with the License.
2139 * You may obtain a copy of the License at
2140 *
2141 *   http://www.apache.org/licenses/LICENSE-2.0
2142 *
2143 * Unless required by applicable law or agreed to in writing, software
2144 * distributed under the License is distributed on an "AS IS" BASIS,
2145 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2146 * See the License for the specific language governing permissions and
2147 * limitations under the License.
2148 */class yO{constructor(e){this.serializer=e}U(e,t,r,s){const i=new nh("createOrUpgrade",t);r<1&&s>=1&&((function(l){l.createObjectStore(_l)})(e),(function(l){l.createObjectStore(Bc,{keyPath:PC}),l.createObjectStore(sr,{keyPath:b0,autoIncrement:!0}).createIndex(Ni,x0,{unique:!0}),l.createObjectStore(Xa)})(e),mb(e),(function(l){l.createObjectStore(Ii)})(e));let a=F.resolve();return r<3&&s>=3&&(r!==0&&((function(l){l.deleteObjectStore(to),l.deleteObjectStore(eo),l.deleteObjectStore(Ci)})(e),mb(e)),a=a.next((()=>(function(l){const d=l.store(Ci),m={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:Ne.min().toTimestamp(),targetCount:0};return d.put(iu,m)})(i)))),r<4&&s>=4&&(r!==0&&(a=a.next((()=>(function(l,d){return d.store(sr).H().next((p=>{l.deleteObjectStore(sr),l.createObjectStore(sr,{keyPath:b0,autoIncrement:!0}).createIndex(Ni,x0,{unique:!0});const f=d.store(sr),g=p.map((x=>f.put(x)));return F.waitFor(g)}))})(e,i)))),a=a.next((()=>{(function(l){l.createObjectStore(no,{keyPath:$C})})(e)}))),r<5&&s>=5&&(a=a.next((()=>this.N_(i)))),r<6&&s>=6&&(a=a.next((()=>((function(l){l.createObjectStore(Uc)})(e),this.L_(i))))),r<7&&s>=7&&(a=a.next((()=>this.B_(i)))),r<8&&s>=8&&(a=a.next((()=>this.U_(e,i)))),r<9&&s>=9&&(a=a.next((()=>{(function(l){l.objectStoreNames.contains("remoteDocumentChanges")&&l.deleteObjectStore("remoteDocumentChanges")}
2148)(e)}))),r<10&&s>=10&&(a=a.next((()=>this.k_(i)))),r<11&&s>=11&&(a=a.next((()=>{(function(l){l.createObjectStore(sh,{keyPath:BC})})(e),(function(l){l.createObjectStore(ih,{keyPath:UC})})(e)}))),r<12&&s>=12&&(a=a.next((()=>{(function(l){const d=l.createObjectStore(ah,{keyPath:ZC});d.createIndex(Sp,JC,{unique:!1}),d.createIndex(K4,XC,{unique:!1})})(e)}))),r<13&&s>=13&&(a=a.next((()=>(function(l){const d=l.createObjectStore(su,{keyPath:OC});d.createIndex(Ad,DC),d.createIndex($4,VC)})(e))).next((()=>this.q_(e,i))).next((()=>e.deleteObjectStore(Ii)))),r<14&&s>=14&&(a=a.next((()=>this.K_(e,i)))),r<15&&s>=15&&(a=a.next((()=>(function(l){l.createObjectStore(q1,{keyPath:GC,autoIncrement:!0}).createIndex(Np,KC,{unique:!1}),l.createObjectStore(jc,{keyPath:HC}).createIndex(U4,WC,{unique:!1}),l.createObjectStore(Tc,{keyPath:YC}).createIndex(G4,QC,{unique:!1})})(e)))),r<16&&s>=16&&(a=a.next((()=>{t.objectStore(jc).clear()})).next((()=>{t.objectStore(Tc).clear()}))),r<17&&s>=17&&(a=a.next((()=>{(function(l){l.createObjectStore(z1,{keyPath:eM})})(e)}))),r<18&&s>=18&&b4()&&(a=a.next((()=>{t.objectStore(jc).clear()})).next((()=>{t.objectStore(Tc).clear()}))),a}L_(e){let t=0;return e.store(Ii).ee(((r,s)=>{t+=xu(s)})).next((()=>{const r={byteSize:t};return e.store(Uc).put(Ep,r)}))}N_(e){const t=e.store(Bc),r=e.store(sr);return t.H().next((s=>F.forEach(s,(i=>{const a=IDBKeyRange.bound([i.userId,Ai],[i.userId,i.lastAcknowledgedBatchId]);return r.H(Ni,a).next((c=>
vendor: 7,871 bytes, line 2148
2148F.forEach(c,(l=>{ce(l.userId===i.userId,18650,"Cannot process batch from unexpected user",{batchId:l.batchId});const d=ji(this.serializer,l);return k3(e,i.userId,d).next((()=>{}))}))))}))))}B_(e){const t=e.store(to),r=e.store(Ii);return e.store(Ci).get(iu).next((s=>{const i=[];return r.ee(((a,c)=>{const l=new Ke(a),d=(function(p){return[0,hn(p)]})(l);i.push(t.get(d).next((m=>m?F.resolve():(p=>t.put({targetId:0,path:hn(p),sequenceNumber:s.highestListenSequenceNumber}))(l))))})).next((()=>F.waitFor(i)))}))}U_(e,t){e.createObjectStore(Gc,{keyPath:FC});const r=t.store(Gc),s=new _f,i=a=>{if(s.add(a)){const c=a.lastSegment(),l=a.popLast();return r.put({collectionId:c,parent:hn(l)})}};return t.store(Ii).ee({X:!0},((a,c)=>{const l=new Ke(a);return i(l.popLast())})).next((()=>t.store(Xa).ee({X:!0},(([a,c,l],d)=>{const m=wr(c);return i(m.popLast())}))))}k_(e){const t=e.store(eo);return t.ee(((r,s)=>{const i=gc(this.serializer,s),a=x3(this.serializer,i);return t.put(a)}))}q_(e,t){const r=t.store(Ii),s=[];return r.ee(((i,a)=>{const c=t.store(su),l=(function(p){return p.document?new me(Ke.fromString(p.document.name).popFirst(5)):p.noDocument?me.fromSegments(p.noDocument.path):p.unknownDocument?me.fromSegments(p.unknownDocument.path):ye(36783)})(a).path.toArray(),d={prefixPath:l.slice(0,l.length-2),collectionGroup:l[l.length-2],documentId:l[l.length-1],readTime:a.readTime||[0,0],unknownDocument:a.unknownDocument,noDocument:a.noDocument,document:a.document,hasCommittedMutations:!!a.hasCommittedMutations};s.push(c.put(d))})).next((()=>F.waitFor(s)))}K_(e,t){const r=t.store(sr),s=S3(this.serializer),i=new wf(wh.C_,this.serializer.zr);return r.H().next((a=>{const c=new Map;return a.forEach((l=>{let d=c.get(l.userId)??Fe();ji(this.serializer,l).keys().forEach((m=>d=d.add(m))),c.set(l.userId,d)})),F.forEach(c,((l,d)=>{const m=new cn(d),p=Ih.jr(this.serializer,m),f=i.getIndexManager(m),g=_h.jr(m,this.serializer,f,i.referenceDelegate);return new A3(s,g,p,f).recalculateAndSaveOverlaysForDocumentKeys(new Ap(t,Nn.ce),l).next()}))}))}}function mb(n){n.createObjectStore(to,{keyPath:qC}).createIndex(L1,zC,{unique:!0}),n.createObjectStore(eo,{keyPath:"targetId"}).createIndex(B4,LC,{unique:!0}),n.createObjectStore(Ci)}const _s="IndexedDbPersistence",Rm=18e5,Om=5e3,Dm="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",bO="main";class jf{constructor(e,t,r,s,i,a,c,l,d,m,p=18){if(this.allowTabSynchronization=e,this.persistenceKey=t,this.clientId=r,this.Tn=i,this.window=a,this.document=c,this.W_=d,this.Q_=m,this.G_=p,this.f_=null,this.m_=!1,this.isPrimary=!1,this.networkEnabled=!0,this.z_=null,this.inForeground=!1,this.j_=null,this.H_=null,this.J_=Number.NEGATIVE_INFINITY,this.Y_=f=>Promise.resolve(),!jf.C())throw new de(J.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new sO(this,s),this.Z_=t+bO,this.serializer=new b3(l),this.X_=new zs(this.Z_,this.G_,new yO(this.serializer)),this.p_=new YR,this.g_=new rO(this.referenceDelegate,this.serializer),this.remoteDocumentCache=S3(this.serializer),this.w_=new WR,this.window&&this.window.localStorage?this.eo=this.window.localStorage:(this.eo=null,m===!1&&Rt(_s,"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.no().then((()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new de(J.FAILED_PRECONDITION,Dm);return this.ro(),this.io(),this.so(),this.runTransaction("getHighestListenSequenceNumber","readonly",(e=>this.g_.getHighestSequenceNumber(e)))})).then((e=>{this.f_=new Nn(e,this.W_)})).then((()=>{this.m_=!0})).catch((e=>(this.X_&&this.X_.close(),Promise.reject(e))))}_o(e){return this.Y_=async t=>{if(this.started)return e(t)},e(this.isPrimary)}setDatabaseDeletedListener(e){this.X_.q((async t=>{t.newVersion===null&&await e()}))}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.Tn.enqueueAndForget((async()=>{this.started&&await this.no()})))}no(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(e=>xd(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next((()=>{if(this.isPrimary)return this.oo(e).next((t=>{t||(this.isPrimary=!1,this.Tn.enqueueRetryable((()=>this.Y_(!1))))}))})).next((()=>this.ao(e))).next((t=>this.isPrimary&&!t?this.uo(e).next((()=>!1)):!!t&&this.co(e).next((()=>!0)))))).catch((e=>{if(oi(e))return se(_s,"Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return se(_s,"Releasing owner lease after error during lease refresh",e),!1})).then((e=>{this.isPrimary!==e&&this.Tn.enqueueRetryable((()=>this.Y_(e))),this.isPrimary=e}))}oo(e){return cc(e).get(ba).next((t=>F.resolve(this.lo(t))))}Eo(e){return xd(e).delete(this.clientId)}async ho(){if(this.isPrimary&&!this.To(this.J_,Rm)){this.J_=Date.now();const e=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(t=>{const r=Bt(t,no);return r.H().next((s=>{const i=this.Po(s,Rm),a=s.filter((c=>i.indexOf(c)===-1));return F.forEach(a,(c=>r.delete(c.clientId))).next((()=>a))}))})).catch((()=>[]));if(this.eo)for(const t of e)this.eo.removeItem(this.Ro(t.clientId))}}so(){this.H_=this.Tn.enqueueAfterDelay("client_metadata_refresh",4e3,(()=>this.no().then((()=>this.ho())).then((()=>this.so()))))}lo(e){return!!e&&e.ownerId===this.clientId}ao(e){return this.Q_?F.resolve(!0):cc(e).get(ba).next((t=>{if(t!==null&&this.To(t.leaseTimestampMs,Om)&&!this.Io(t.ownerId)){if(this.lo(t)&&this.networkEnabled)return!0;if(!this.lo(t)){if(!t.allowTabSynchronization)throw new de(J.FAILED_PRECONDITION,Dm);return!1}}return!(!this.networkEnabled||!this.inForeground)||xd(e).H().next((r=>this.Po(r,Om).find((s=>{if(this.clientId!==s.clientId){const i=!this.networkEnabled&&s.networkEnabled,a=!this.inForeground&&s.inForeground,c=this.networkEnabled===s.networkEnabled;if(i||a&&c)return!0}return!1}))===void 0))})).next((t=>(this.isPrimary!==t&&se(_s,`Client ${t?"is":"is not"} eligible for a primary lease.`),t)))}async shutdown(){this.m_=!1,this.Ao(),this.H_&&(this.H_.cancel(),this.H_=null),this.Vo(),this.fo(),await this.X_.runTransaction("shutdown","readwrite",[_l,no],(e=>{const t=new Ap(e,Nn.ce);return this.uo(t).next((()=>this.Eo(t)))})),this.X_.close(),this.mo()}Po(e,t){return e.filter((r=>this.To(r.updateTimeMs,t)&&!this.Io(r.clientId)))}po(){return this.runTransaction("getActiveClients","readonly",(e=>xd(e).H().next((t=>this.Po(t,Rm).map((r=>r.clientId))))))}get started(){return this.m_}getGlobalsCache(){return this.p_}getMutationQueue(e,t){return _h.jr(e,this.serializer,t,this.referenceDelegate)}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new nO(e,this.serializer.zr.databaseId)}getDocumentOverlayCache(e){return Ih.jr(this.serializer,e)}getBundleCache(){return this.w_}runTransaction(e,t,r){se(_s,"Starting transaction:",e);const s=t==="readonly"?"readonly":"readwrite",i=(function(l){return l===18?rM:l===17?Q4:l===16?nM:l===15?F1:l===14?Y4:l===13?W4:l===12?tM:l===11?H4:void ye(60245)})(this.G_);let a;return this.X_.runTransaction(e,s,i,(c=>(a=new Ap(c,this.f_?this.f_.next():Nn.ce),t==="readwrite-primary"?this.oo(a).next((l=>!!l||this.ao(a))).next((l=>{if(!l)throw Rt(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.Tn.enqueueRetryable((()=>this.Y_(!1))),new de(J.FAILED_PRECONDITION,V4);return r(a)})).next((l=>this.co(a).next((()=>
2148l)))):this.yo(a).next((()=>r(a)))))).then((c=>(a.raiseOnCommittedEvent(),c)))}yo(e){return cc(e).get(ba).next((t=>{if(t!==null&&this.To(t.leaseTimestampMs,Om)&&!this.Io(t.ownerId)&&!this.lo(t)&&!(this.Q_||this.allowTabSynchronization&&t.allowTabSynchronization))throw new de(J.FAILED_PRECONDITION,Dm)}))}co(e){const t={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return cc(e).put(ba,t)}static C(){return zs.C()}uo(e){const t=cc(e);return t.get(ba).next((r=>this.lo(r)?(se(_s,"Releasing primary lease."),t.delete(ba)):F.resolve()))}To(e,t){const r=Date.now();return!(e<r-t)&&(!(e>r)||(Rt(`Detected an update time that is in the future: ${e} > ${r}`),!1))}ro(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.j_=()=>{this.Tn.enqueueAndForget((()=>(this.inForeground=this.document.visibilityState==="visible",this.no())))},this.document.addEventListener("visibilitychange",this.j_),this.inForeground=this.document.visibilityState==="visible")}Vo(){this.j_&&(this.document.removeEventListener("visibilitychange",this.j_),this.j_=null)}io(){var e;typeof((e=this.window)==null?void 0:e.addEventListener)=="function"&&(this.z_=()=>{this.Ao();const t=/(?:Version|Mobile)\/1[456]/;y4()&&(navigator.appVersion.match(t)||navigator.userAgent.match(t))&&this.Tn.enterRestrictedMode(!0),this.Tn.enqueueAndForget((()=>this.shutdown()))},this.window.addEventListener("pagehide",this.z_))}fo(){this.z_&&(this.window.removeEventListener("pagehide",this.z_),this.z_=null)}Io(e){var t;try{const r=((t=this.eo)==null?void 0:t.getItem(this.Ro(e)))!==null;return se(_s,`Client '${e}' ${r?"is":"is not"} zombied in LocalStorage`),r}catch(r){return Rt(_s,"Failed to get zombied client id.",r),!1}}Ao(){if(this.eo)try{this.eo.setItem(this.Ro(this.clientId),String(Date.now()))}catch(e){Rt("Failed to set zombie client id.",e)}}mo(){if(this.eo)try{this.eo.removeItem(this.Ro(this.clientId))}catch{}}Ro(e){return`firestore_zombie_${this.persistenceKey}_${e}`}}function cc(n){return Bt(n,_l)}function xd(n){return Bt(n,no)}function C3(n,e){let t=n.projectId;return n.isDefaultDatabase||(t+="."+n.database),"firestore/"+e+"/"+t+"/"}/**
2149 * @license
2150 * Copyright 2017 Google LLC
2151 *
2152 * Licensed under the Apache License, Version 2.0 (the "License");
2153 * you may not use this file except in compliance with the License.
2154 * You may obtain a copy of the License at
2155 *
2156 *   http://www.apache.org/licenses/LICENSE-2.0
2157 *
2158 * Unless required by applicable law or agreed to in writing, software
2159 * distributed under the License is distributed on an "AS IS" BASIS,
2160 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2161 * See the License for the specific language governing permissions and
2162 * limitations under the License.
2163 */class Tf{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.wo=r,this.bo=s}static vo(e,t){let r=Fe(),s=Fe();for(const i of t.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new Tf(e,t.fromCache,r,s)}}/**
2164 * @license
2165 * Copyright 2017 Google LLC
2166 *
2167 * Licensed under the Apache License, Version 2.0 (the "License");
2168 * you may not use this file except in compliance with the License.
2169 * You may obtain a copy of the License at
2170 *
2171 *   http://www.apache.org/licenses/LICENSE-2.0
2172 *
2173 * Unless required by applicable law or agreed to in writing, software
2174 * distributed under the License is distributed on an "AS IS" BASIS,
2175 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2176 * See the License for the specific language governing permissions and
2177 * limitations under the License.
2178 */function xO(n,e){return me.comparator(n.key,e.key)}/**
2179 * @license
2180 * Copyright 2023 Google LLC
2181 *
2182 * Licensed under the Apache License, Version 2.0 (the "License");
2183 * you may not use this file except in compliance with the License.
2184 * You may obtain a copy of the License at
2185 *
2186 *   http://www.apache.org/licenses/LICENSE-2.0
2187 *
2188 * Unless required by applicable law or agreed to in writing, software
2189 * distributed under the License is distributed on an "AS IS" BASIS,
2190 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2191 * See the License for the specific language governing permissions and
2192 * limitations under the License.
2193 */class vO{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2194 * @license
2195 * Copyright 2019 Google LLC
2196 *
2197 * Licensed under the Apache License, Version 2.0 (the "License");
2198 * you may not use this file except in compliance with the License.
2199 * You may obtain a copy of the License at
2200 *
2201 *   http://www.apache.org/licenses/LICENSE-2.0
2202 *
2203 * Unless required by applicable law or agreed to in writing, software
2204 * distributed under the License is distributed on an "AS IS" BASIS,
2205 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2206 * See the License for the specific language governing permissions and
2207 * limitations under the License.
2208 */class M3{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=(function(){return y4()?8:q4($t())>0?6:4})()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.Oo(e,t).next((a=>{i.result=a})).next((()=>{if(!i.result)return this.Mo(e,t,s,r).next((a=>{i.result=a}))})).next((()=>{if(i.result)return;const a=new vO;return this.No(e,t,a).next((c=>{if(i.result=c,this.Do)return this.Lo(e,t,a,c.size)}))})).next((()=>i.result))}Lo(e,t,r,s){return Nt(t)?F.resolve():r.documentReadCount<this.xo?(Aa()<=He.DEBUG&&se("QueryEngine","SDK will not create cache indexes for query:",Ac(t),"since it only creates cache indexes for collection contains","more than or equal to",this.xo,"documents"),F.resolve()):(Aa()<=He.DEBUG&&se("QueryEngine","Query:",Ac(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Co*s?(Aa()<=He.DEBUG&&se("QueryEngine","The SDK decides to create cache indexes for query:",Ac(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,$n(t))):F.resolve())}Oo(e,t){if(Nt(t))return F.resolve(null);let r=t;if(P0(r))return F.resolve(null);let s=$n(r);return this.indexManager.getIndexType(e,s).next((i=>i===0?null:(r.limit!==null&&i===1&&(r=hu(r,null,"F"),s=$n(r)),this.indexManager.getDocumentsMatchingTarget(e,s).next((a=>{const c=Fe(...a);return this.Fo.getDocuments(e,c).next((l=>this.indexManager.getMinOffset(e,s).next((d=>{const m=this.Bo(r,l);return this.Uo(r,m,c,d.readTime)?this.Oo(e,hu(r,null,"F")):this.ko(e,m,r,d)}))))})))))}Mo(e,t,r,s){return(Nt(t)?(function(a){for(const c of a.stages){if(c instanceof Js||c instanceof W0)return!1;if(c instanceof Sl){if(c.condition instanceof i3&&c.condition._expr.name==="exists"&&c.condition._expr.params[0]instanceof ia&&c.condition._expr.params[0].fieldName===kr)continue;return!1}}return!0})(t):P0(t))||s.isEqual(Ne.min())?F.resolve(null):this.Fo.getDocuments(e,r).next((i=>{const a=this.Bo(t,i);return this.Uo(t,a,r,s)?F.resolve(null):(Aa()<=He.DEBUG&&se("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Y0(t)),this.ko(e,a,t,O4(s,Za)).next((c=>c)))}))}Bo(e,t){let r,s;return Nt(e)?(r=new rt(xO),s=i=>kh(e,i)):(r=new rt(Z1(e)),s=i=>hh(e,i)),t.forEach(((i,a)=>{s(a)&&(r=r.add(a))})),r}Uo(e,t,r,s){if(Nt(e))return(function(c){return c.stages.some((l=>l instanceof Js||l instanceof W0))})(e);if(e.limit===null)return!1;if(r.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}No(e,t,r){return Aa()<=He.DEBUG&&se("QueryEngine","Using full collection scan to execute query:",Y0(t)),this.Fo.getDocumentsMatchingQuery(e,t,Bn.min(),r)}ko(e,t,r,s){return this.Fo.getDocumentsMatchingQuery(e,r,s).next((i=>(t.forEach((a=>{i=i.insert(a.key,a)})),i)))}}/**
2209 * @license
2210 * Copyright 2020 Google LLC
2211 *
2212 * Licensed under the Apache License, Version 2.0 (the "License");
2213 * you may not use this file except in compliance with the License.
2214 * You may obtain a copy of the License at
2215 *
2216 *   http://www.apache.org/licenses/LICENSE-2.0
2217 *
2218 * Unless required by applicable law or agreed to in writing, software
2219 * distributed under the License is distributed on an "AS IS" BASIS,
2220 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2221 * See the License for the specific language governing permissions and
2222 * limitations under the License.
2223 */const Ef="LocalStore",IO=3e8;class _O{constructor(e,t,r,s){this.persistence=e,this.qo=t,this.serializer=s,this.$o=new ut(De),this.Ko=new ds((i=>vh(i)),yf),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(r)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutation
2223Queue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new A3(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.$o)))}}function P3(n,e,t,r){return new _O(n,e,t,r)}async function R3(n,e){const t=_e(n);return await t.persistence.runTransaction("Handle user change","readonly",(r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next((i=>(s=i,t.Go(e),t.mutationQueue.getAllMutationBatches(r)))).next((i=>{const a=[],c=[];let l=Fe();for(const d of s){a.push(d.batchId);for(const m of d.mutations)l=l.add(m.key)}for(const d of i){c.push(d.batchId);for(const m of d.mutations)l=l.add(m.key)}return t.localDocuments.getDocuments(r,l).next((d=>({zo:d,removedBatchIds:a,addedBatchIds:c})))}))}))}function kO(n,e){const t=_e(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",(r=>{const s=e.batch.keys(),i=t.Qo.newChangeBuffer({trackRemovals:!0});return(function(c,l,d,m){const p=d.batch,f=p.keys();let g=F.resolve();return f.forEach((x=>{g=g.next((()=>m.getEntry(l,x))).next((b=>{const I=d.docVersions.get(x);ce(I!==null,48541),b.version.compareTo(I)<0&&(p.applyToRemoteDocument(b,d),b.isValidDocument()&&(b.setReadTime(d.commitVersion),m.addEntry(b)))}))})),g.next((()=>c.mutationQueue.removeMutationBatch(l,p)))})(t,r,e,i).next((()=>i.apply(r))).next((()=>t.mutationQueue.performConsistencyCheck(r))).next((()=>t.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId))).next((()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,(function(c){let l=Fe();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l})(e)))).next((()=>t.localDocuments.getDocuments(r,s)))}))}function O3(n){const e=_e(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.g_.getLastRemoteSnapshotVersion(t)))}function wO(n,e){const t=_e(n),r=e.snapshotVersion;let s=t.$o;return t.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{const a=t.Qo.newChangeBuffer({trackRemovals:!0});s=t.$o;const c=[];
2223e.targetChanges.forEach(((m,p)=>{const f=s.get(p);if(!f)return;c.push(t.g_.removeMatchingKeys(i,m.removedDocuments,p).next((()=>t.g_.addMatchingKeys(i,m.addedDocuments,p))));let g=f.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(p)!==null?g=g.withResumeToken(vt.EMPTY_BYTE_STRING,Ne.min()).withLastLimboFreeSnapshotVersion(Ne.min()):m.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(m.resumeToken,r)),s=s.insert(p,g),(function(b,I,N){return b.resumeToken.approximateByteSize()===0||I.snapshotVersion.toMicroseconds()-b.snapshotVersion.toMicroseconds()>=IO?!0:N.addedDocuments.size+N.modifiedDocuments.size+N.removedDocuments.size>0})(f,g,m)&&c.push(t.g_.updateTargetData(i,g))}));let l=Ft(),d=Fe();if(e.documentUpdates.forEach((m=>{e.resolvedLimboDocuments.has(m)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(i,m))})),c.push(jO(i,a,e.documentUpdates).next((m=>{l=m.jo,d=m.Ho}))),!r.isEqual(Ne.min())){const m=t.g_.getLastRemoteSnapshotVersion(i).next((p=>t.g_.setTargetsMetadata(i,i.currentSequenceNumber,r)));c.push(m)}return F.waitFor(c).next((()=>a.apply(i))).next((()=>t.localDocuments.getLocalViewOfDocuments(i,l,d))).next((()=>l))})).then((i=>(t.$o=s,i)))}function jO(n,e,t){let r=Fe(),s=Fe();return t.forEach((i=>r=r.add(i))),e.getEntries(n,r).next((i=>{let a=Ft();return t.forEach(((c,l)=>{const d=i.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),l.isNoDocument()&&l.version.isEqual(Ne.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):se(Ef,"Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)})),{jo:a,Ho:s}}))}function TO(n,e){const t=_e(n);return t.persistence.runTransaction("Get next mutation batch","readonly",(r=>(e===void 0&&(e=Ai),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e))))}function Iu(n,e){const t=_e(n);return t.persistence.runTransaction("Allocate target","readwrite",(r=>{let s;return t.g_.getTargetData(r,e).next((i=>i?(s=i,F.resolve(s)):t.g_.allocateTargetId(r).next((a=>(s=new Er(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.g_.addTargetData(r,s).next((()=>s)))))))})).then((r=>{const s=t.$o.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.$o=t.$o.insert(r.targetId,r),t.Ko.set(e,r.targetId)),r}))}async function lo(n,e,t){const r=_e(n),s=r.$o.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,(a=>r.persistence.referenceDelegate.removeTarget(a,s)))}catch(a){if(!oi(a))throw a;se(Ef,`Failed to update sequence numbers for target ${e}: ${a}`)}r.$o=r.$o.remove(e),r.Ko.delete(s.target)}function Hp(n,e,t){const r=_e(n);let s=Ne.min(),i=Fe();return r.persistence.runTransaction("Execute query","readwrite",(a=>(function(l,d,m){const p=_e(l),f=p.Ko.get(m);return f!==void 0?F.resolve(p.$o.get(f)):p.g_.getTargetData(d,m)})(r,a,Nt(e)?e:$n(e)).next((c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.g_.getMatchingKeysForTargetId(a,c.targetId).next((l=>{i=l}))})).next((()=>r.qo.getDocumentsMatchingQuery(a,e,t?s:Ne.min(),t?i:Fe()))).next((c=>(V3(r,c),{documents:c,Jo:i})))))}function D3(n,e){const t=_e(n),r=_e(t.g_),s=t.$o.get(e);return s?Promise.resolve(s.target??null):t.persistence.runTransaction("Get target data","readonly",(i=>r.dt(i,e).next((a=>(a==null?void 0:a.target)??null))))}function Wp(n,e){const t=_e(n),r=t.Wo.get(e)||Ne.min();return t.persistence.runTransaction("Get new document changes","readonly",(s=>t.Qo.getAllFromCollectionGroup(s,e,O4(r,Za),Number.MAX_SAFE_INTEGER))).then((s=>(V3(t,s),s)))}function V3(n,e){e.forEach(((t,r)=>{const s=r.key.getCollectionGroup(),i=n.Wo.get(s)||Ne.min();r.readTime.compareTo(i)>0&&n.Wo.set(s,r.readTime)}))}/**
2224 * @license
2225 * Copyright 2019 Google LLC
2226 *
2227 * Licensed under the Apache License, Version 2.0 (the "License");
2228 * you may not use this file except in compliance with the License.
2229 * You may obtain a copy of the License at
2230 *
2231 *   http://www.apache.org/licenses/LICENSE-2.0
2232 *
2233 * Unless required by applicable law or agreed to in writing, softw
2233are
2234 * distributed under the License is distributed on an "AS IS" BASIS,
2235 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2236 * See the License for the specific language governing permissions and
2237 * limitations under the License.
2238 */const L3="firestore_clients";function pb(n,e){return`${L3}_${n}_${e}`}const q3="firestore_mutations";function fb(n,e,t){let r=`${q3}_${n}_${t}`;return e.isAuthenticated()&&(r+=`_${e.uid}`),r}const z3="firestore_targets";function Vm(n,e){return`${z3}_${n}_${e}`}/**
2239 * @license
2240 * Copyright 2018 Google LLC
2241 *
2242 * Licensed under the Apache License, Version 2.0 (the "License");
2243 * you may not use this file except in compliance with the License.
2244 * You may obtain a copy of the License at
2245 *
2246 *   http://www.apache.org/licenses/LICENSE-2.0
2247 *
2248 * Unless required by applicable law or agreed to in writing, software
2249 * distributed under the License is distributed on an "AS IS" BASIS,
2250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2251 * See the License for the specific language governing permissions and
2252 * limitations under the License.
2253 */const Ir="SharedClientState";class _u{constructor(e,t,r,s){this.user=e,this.batchId=t,this.state=r,this.error=s}static ea(e,t,r){const s=JSON.parse(r);let i,a=typeof s=="object"&&["pending","acknowledged","rejected"].indexOf(s.state)!==-1&&(s.error===void 0||typeof s.error=="object");return a&&s.error&&(a=typeof s.error.message=="string"&&typeof s.error.code=="string",a&&(i=new de(s.error.code,s.error.message))),a?new _u(e,t,s.state,i):(Rt(Ir,`Failed to parse mutation state for ID '${t}': ${r}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class Rc{constructor(e,t,r){this.targetId=e,this.state=t,this.error=r}static ea(e,t){const r=JSON.parse(t);let s,i=typeof r=="object"&&["not-current","current","rejected"].indexOf(r.state)!==-1&&(r.error===void 0||typeof r.error=="object");return i&&r.error&&(i=typeof r.error.message=="string"&&typeof r.error.code=="string",i&&(s=new de(r.error.code,r.error.message))),i?new Rc(e,r.state,s):(Rt(Ir,`Failed to parse target state for ID '${e}': ${t}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class ku{constructor(e,t){this.clientId=e,this.activeTargetIds=t}static ea(e,t){const r=JSON.parse(t);let s=typeof r=="object"&&r.activeTargetIds instanceof Array,i=J1();for(let a=0;s&&a<r.activeTargetIds.length;++a)s=z4(r.activeTargetIds[a]),i=i.add(r.activeTargetIds[a]);return s?new ku(e,i):(Rt(Ir,`Failed to parse client data for instance '${e}': ${t}`),null)}}class Nf{constructor(e,t){this.clientId=e,this.onlineState=t}static ea(e){const t=JSON.parse(e);return typeof t=="object"&&["Unknown","Online","Offline"].indexOf(t.onlineState)!==-1&&typeof t.clientId=="string"?new Nf(t.clientId,t.onlineState):(Rt(Ir,`Failed to parse online state: ${e}`),null)}}class Yp{constructor(){this.activeTargetIds=J1()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Lm{constructor(e,t,r,s,i){this.window=e,this.Tn=t,this.persistenceKey=r,this.ia=s,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.sa=this._a.bind(this),this.oa=new ut(De),this.started=!1,this.aa=[];const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.ua=pb(this.persistenceKey,this.ia),this.ca=(function(l){return`firestore_sequence_number_${l}`})(this.persistenceKey),this.oa=this.oa.insert(this.ia,new Yp),this.la=new RegExp(`^${L3}_${a}_([^_]*)$`),this.Ea=new RegExp(`^${q3}_${a}_(\\d+)(?:_(.*))?$`),this.ha=new RegExp(`^${z3}_${a}_(\\d+)$`),this.Ta=(function(l){return`firestore_online_state_${l}`})(this.persistenceKey),this.Pa=(function(l){return`firestore_bundle_loaded_v2_${l}`})(this.persistenceKey),this.window.addEventListener("storage",this.sa)}static C(e){return!(!e||!e.localStorage)}async start(){const e=await this.syncEngine.po();for(const r of e){if(r===this.ia)continue;const s=this.getItem(pb(this.persistenceKey,r));if(s){const i=ku.ea(r,s);i&&(this.oa=this.oa.insert(i.clientId,i))}}this.Ra();const t=this.storage.getItem(this.Ta);if(t){const r=this.Ia(t);r&&this.Aa(r)}for(const r of this.aa)this._a(r);this.aa=[],this.window.addEventListener("pagehide",(()=>this.shutdown())),this.started=!0}writeSequenceNumber(e){this.setItem(this.ca,JSON.stringify(e))}getAllActiveQueryTargets(){return this.Va(this.oa)}isActiveQueryTarget(e){let t=!1;
2253return this.oa.forEach(((r,s)=>{s.activeTargetIds.has(e)&&(t=!0)})),t}addPendingMutation(e){this.da(e,"pending")}updateMutationState(e,t,r){this.da(e,t,r),this.fa(e)}addLocalQueryTarget(e,t=!0){let r="not-current";if(this.isActiveQueryTarget(e)){const s=this.storage.getItem(Vm(this.persistenceKey,e));if(s){const i=Rc.ea(e,s);i&&(r=i.state)}}return t&&this.ma.na(e),this.Ra(),r}removeLocalQueryTarget(e){this.ma.ra(e),this.Ra()}isLocalQueryTarget(e){return this.ma.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(Vm(this.persistenceKey,e))}updateQueryState(e,t,r){this.pa(e,t,r)}handleUserChange(e,t,r){t.forEach((s=>{this.fa(s)})),this.currentUser=e,r.forEach((s=>{this.addPendingMutation(s)}))}setOnlineState(e){this.ga(e)}notifyBundleLoaded(e){this.ya(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.sa),this.removeItem(this.ua),this.started=!1)}getItem(e){const t=this.storage.getItem(e);return se(Ir,"READ",e,t),t}setItem(e,t){se(Ir,"SET",e,t),this.storage.setItem(e,t)}removeItem(e){se(Ir,"REMOVE",e),this.storage.removeItem(e)}_a(e){const t=e;if(t.storageArea===this.storage){if(se(Ir,"EVENT",t.key,t.newValue),t.key===this.ua)return void Rt("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Tn.enqueueRetryable((async()=>{if(this.started){if(t.key!==null){if(this.la.test(t.key)){if(t.newValue==null){const r=this.wa(t.key);return this.ba(r,null)}{const r=this.va(t.key,t.newValue);if(r)return this.ba(r.clientId,r)}}else if(this.Ea.test(t.key)){if(t.newValue!==null){const r=this.Sa(t.key,t.newValue);if(r)return this.Da(r)}}else if(this.ha.test(t.key)){if(t.newValue!==null){const r=this.xa(t.key,t.newValue);if(r)return this.Ca(r)}}else if(t.key===this.Ta){if(t.newValue!==null){const r=this.Ia(t.newValue);if(r)return this.Aa(r)}}else if(t.key===this.ca){const r=(function(i){let a=Nn.ce;if(i!=null)try{const c=JSON.parse(i);ce(typeof c=="number",30636,{Fa:i}),a=c}catch(c){Rt(Ir,"Failed to read sequence number from WebStorage",c)}return a})(t.newValue);r!==Nn.ce&&this.sequenceNumberHandler(r)}else if(t.key===this.Pa){const r=this.Oa(t.newValue);await Promise.all(r.map((s=>this.syncEngine.Ma(s))))}}}else this.aa.push(t)}))}}get ma(){return this.oa.get(this.ia)}Ra(){this.setItem(this.ua,this.ma.ta())}da(e,t,r){const s=new _u(this.currentUser,e,t,r),i=fb(this.persistenceKey,this.currentUser,e);this.setItem(i,s.ta())}fa(e){const t=fb(this.persistenceKey,this.currentUser,e);this.removeItem(t)}ga(e){const t={clientId:this.ia,onlineState:e};this.storage.setItem(this.Ta,JSON.stringify(t))}pa(e,t,r){const s=Vm(this.persistenceKey,e),i=new Rc(e,t,r);this.setItem(s,i.ta())}ya(e){const t=JSON.stringify(Array.from(e));this.setItem(this.Pa,t)}wa(e){const t=this.la.exec(e);return t?t[1]:null}va(e,t){const r=this.wa(e);return ku.ea(r,t)}Sa(e,t){const r=this.Ea.exec(e),s=Number(r[1]),i=r[2]!==void 0?r[2]:null;return _u.ea(new cn(i),s,t)}xa(e,t){const r=this.ha.exec(e),s=Number(r[1]);return Rc.ea(s,t)}Ia(e){return Nf.ea(e)}Oa(e){return JSON.parse(e)}async Da(e){if(e.user.uid===this.currentUser.uid)return this.syncEngine.Na(e.batchId,e.state,e.error);se(Ir,`Ignoring mutation for non-active user ${e.user.uid}`)}Ca(e){return this.syncEngine.La(e.targetId,e.state,e.error)}ba(e,t){const r=t?this.oa.insert(e,t):this.oa.remove(e),s=this.Va(this.oa),i=this.Va(r),a=[],c=[];return i.forEach((l=>{s.has(l)||a.push(l)})),s.forEach((l=>{i.has(l)||c.push(l)})),this.syncEngine.Ba(a,c).then((()=>{this.oa=r}))}Aa(e){this.oa.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}Va(e){let t=J1();return e.forEach(((r,s)=>{t=t.unionWith(s.activeTargetIds)})),t}}class F3{constructor(){this.Ua=new Yp,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||"not-current"}updateQueryState(e,t,r){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new Yp,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2254 * @license
2255 * Copyright 2020 Google LLC
2256 *
2257 * Licensed under the Apache License, Version 2.0 (the "License");
2258 * you may not use this file except in compliance with the License.
2259 * You may obtain a copy of the License at
2260 *
2261 *   http://www.apache.org/licenses/LICENSE-2.0
2262 *
2263 * Unless required by applicable law or agreed to in writing, software
2264 * distributed under the License is distributed on an "AS IS" BASIS,
2265 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2266 * See the License for the specific language governing permissions and
2267 * limitations under the License.
2268 */function $3(){return typeof window<"u"?window:null}function Vd(){return typeof document<"u"?document:null}/**
2269 * @license
2270 * Copyright 2018 Google LLC
2271 *
2272 * Licensed under the Apache License, Version 2.0 (the "License");
2273 * you may not use this file except in compliance with the License.
2274 * You may obtain a copy of the License at
2275 *
2276 *   http://www.apache.org/licenses/LICENSE-2.0
2277 *
2278 * Unless required by applicable law or agreed to in writing, software
2279 * distributed under the License is distributed on an "AS IS" BASIS,
2280 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2281 * See the License for the specific language governing permissions and
2282 * limitations under the License.
2283 */class EO{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa("Unknown"),this.$a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.$a=null,this.Ga("Backend didn't respond within 10 seconds."),this.Qa("Offline"),Promise.resolve()))))}za(e){this.state==="Online"?this.Qa("Unknown"):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa("Offline")))}set(e){this.ja(),this.qa=0,e==="Online"&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){const t=`Could not reach Cloud Firestore backend. ${e}
2284This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(Rt(t),this.Ka=!1):se("OnlineStateTracker",t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}}/**
2285 * @license
2286 * Copyright 2017 Google LLC
2287 *
2288 * Licensed under the Apache License, Version 2.0 (the "License");
2289 * you may not use this file except in compliance with the License.
2290 * You may obtain a copy of the License at
2291 *
2292 *   http://www.apache.org/licenses/LICENSE-2.0
2293 *
2294 * Unless required by applicable law or agreed to in writing, software
2295 * distributed under the License is distributed on an "AS IS" BASIS,
2296 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2297 * See the License for the specific language governing permissions and
2298 * limitations under the License.
2299 */const Dr="RemoteStore";class NO{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new rs(1e3),this.eu=new rs(1001),this.tu=new Set,this.nu=[],this.ru=i,this.ru.bt((a=>{r.enqueueAndForget((async()=>{oa(this)&&(se(Dr,"Restarting streams for network reachability change."),await(async function(l){const d=_e(l);d.tu.add(4),await Ml(d),d.iu.set("Unknown"),d.tu.delete(4),await jh(d)})(this))}))})),this.iu=new EO(r,s)}}async function jh(n){if(oa(n))for(const e of n.nu)await e(!0)}async function Ml(n){for(const e of n.nu)await e(!1)}function Qp(n,e){return n.Ya.get(e)||void 0}function Th(n,e){const t=_e(n),r=Qp(t,e.targetId);if(r!==void 0&&t.Ja.has(r))return;const s=(function(c,l){const d=Qp(c,l);d!==void 0&&c.Za.delete(d);const m=(function(f,g){return g%2!=0?f.eu.next():f.Xa.next()})(c,l);return c.Ya.set(l,m),c.Za.set(m,l),m})(t,e.targetId);se(Dr,"remoteStoreListen mapping SDK target ID to remote",e.targetId,s);const i=new Er(e.target,s,e.purpose,e.sequenceNumber,e.snapshotVersion,e.lastLimboFreeSnapshotVersion,e.resumeToken);t.Ja.set(s,i),Cf(t)?Af(t):Mo(t).Fn()&&Sf(t,i)}function uo(n,e){const t=_e(n),r=Mo(t),s=Qp(t,e);se(Dr,"remoteStoreUnlisten removing mapping of SDK target ID to remote",e,s),t.Ja.delete(s),t.Ya.delete(e),t.Za.delete(s),r.Fn()&&B3(t,s),t.Ja.size===0&&(r.Fn()?r.Nn():oa(t)&&t.iu.set("Unknown"))}function Sf(n,e){if(n.su.We(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ne.min())>0){const t=n.Za.get(e.targetId);if(t===void 0)return void se(Dr,"SDK target ID not found for remote ID: "+e.targetId);const r=n.remoteSyncer.getRemoteKeysForTarget(t).size;e=e.withExpectedCount(r)}Mo(n).jn(e)}function B3(n,e){n.su.We(e),Mo(n).Hn(e)}function Af(n){n.su=new DM({getRemoteKeysForTarget:e=>{const t=n.Za.get(e);return t!==void 0?n.remoteSyncer.getRemoteKeysForTarget(t):Fe()},dt:e=>n.Ja.get(e)||null,Tt:()=>n.datastore.serializer.databaseId}),Mo(n).start(),n.iu.Wa()}function Cf(n){return oa(n)&&!Mo(n).Cn()&&n.Ja.size>0}function oa(n){return _e(n).tu.size===0}function U3(n){n.su=void 0}async function SO(n){n.iu.set("Online")}async function AO(n){n.Ja.forEach(((e,t)=>{Sf(n,e)}))}async function CO(n,e){U3(n),Cf(n)?(n.iu.za(e),Af(n)):n.iu.set("Unknown")}async function MO(n,e,t){if(n.iu.set("Online"),e instanceof Nv&&e.state===2&&e.cause)try{await(async function(s,i){const a=i.cause;for(const c of i.targetIds){if(s.Ja.has(c)){const l=s.Za.get(c);l!==void 0&&(await s.remoteSyncer.rejectListen(l,a),s.Ya.delete(l),s.Za.delete(c)),s.Ja.delete(c)}s.su.removeTarget(c)}})(n,e)}catch(r){se(Dr,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await wu(n,r)}else if(e instanceof Pd?n.su.et(e):e instanceof Ev?n.su.ot(e):n.su.rt(e),!t.isEqual(Ne.min()))try{const r=await O3(n.localStore);t.compareTo(r)>=0&&await(function(i,a){const c=i.su.Rt(a);
2299c.targetChanges.forEach(((d,m)=>{if(d.resumeToken.approximateByteSize()>0){const p=i.Ja.get(m);p&&i.Ja.set(m,p.withResumeToken(d.resumeToken,a))}})),c.targetMismatches.forEach(((d,m)=>{const p=i.Ja.get(d);if(!p)return;i.Ja.set(d,p.withResumeToken(vt.EMPTY_BYTE_STRING,p.snapshotVersion)),B3(i,d);const f=new Er(p.target,d,m,p.sequenceNumber);Sf(i,f)}));const l=(function(m,p){const f=new Map;p.targetChanges.forEach(((x,b)=>{const I=m.Za.get(b);I!==void 0&&f.set(I,x)}));let g=new ut(De);return p.targetMismatches.forEach(((x,b)=>{const I=m.Za.get(x);I!==void 0&&(g=g.insert(I,b))})),new To(p.snapshotVersion,f,g,p.documentUpdates,p.augmentedDocumentUpdates,p.resolvedLimboDocuments)})(i,c);return i.remoteSyncer.applyRemoteEvent(l)})(n,t)}catch(r){se(Dr,"Failed to raise snapshot:",r),await wu(n,r)}}async function wu(n,e,t){if(!oi(e))throw e;n.tu.add(1),await Ml(n),n.iu.set("Offline"),t||(t=()=>O3(n.localStore)),n.asyncQueue.enqueueRetryable((async()=>{se(Dr,"Retrying IndexedDB access"),await t(),n.tu.delete(1),await jh(n)}))}function G3(n,e){return e().catch((t=>wu(n,t,e)))}async function Co(n){const e=_e(n),t=ei(e);let r=e.Ha.length>0?e.Ha[e.Ha.length-1].batchId:Ai;for(;PO(e);)try{const s=await TO(e.localStore,r);if(s===null){e.Ha.length===0&&t.Nn();break}r=s.batchId,RO(e,s)}catch(s){await wu(e,s)}K3(e)&&H3(e)}function PO(n){return oa(n)&&n.Ha.length<10}function RO(n,e){n.Ha.push(e);const t=ei(n);t.Fn()&&t.Jn&&t.Yn(e.mutations)}function K3(n){return oa(n)&&!ei(n).Cn()&&n.Ha.length>0}function H3(n){ei(n).start()}async function OO(n){ei(n).er()}async function DO(n){const e=ei(n);for(const t of n.Ha)e.Yn(t.mutations)}async function VO(n,e,t){const r=n.Ha.shift(),s=xf.from(r,e,t);await G3(n,(()=>n.remoteSyncer.applySuccessfulWrite(s))),await Co(n)}async function LO(n,e){e&&ei(n).Jn&&await(async function(r,s){if((function(a){return SM(a)&&a!==J.ABORTED})(s.code)){const i=r.Ha.shift();ei(r).Mn(),await G3(r,(()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s))),await Co(r)}})(n,e),K3(n)&&H3(n)}async function gb(n,e){const t=_e(n);t.asyncQueue.verifyOperationInProgress(),se(Dr,"RemoteStore received new credentials");const r=oa(t);t.tu.add(3),await Ml(t),r&&t.iu.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.tu.delete(3),await jh(t)}async function Zp(n,e){const t=_e(n);e?(t.tu.delete(2),await jh(t)):e||(t.tu.add(2),await Ml(t),t.iu.set("Unknown"))}function Mo(n){return n._u||(n._u=(function(t,r,s){const i=_e(t);return i.nr(),new tP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(n.datastore,n.asyncQueue,{Qt:SO.bind(null,n),zt:AO.bind(null,n),Ht:CO.bind(null,n),zn:MO.bind(null,n)}),n.nu.push((async e=>{e?(n._u.Mn(),Cf(n)?Af(n):n.iu.set("Unknown")):(await n._u.stop(),U3(n))}))),n._u}function ei(n){return n.ou||(n.ou=(function(t,r,s){const i=_e(t);return i.nr(),new nP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(n.datastore,n.asyncQueue,{Qt:()=>Promise.resolve(),zt:OO.bind(null,n),Ht:LO.bind(null,n),Zn:DO.bind(null,n),Xn:VO.bind(null,n)}),n.nu.push((async e=>{e?(n.ou.Mn(),await Co(n)):(await n.ou.stop(),n.Ha.length>0&&(se(Dr,`Stopping write stream with ${n.Ha.length} pending writes`),n.Ha=[]))}))),n.ou}/**
2300 * @license
2301 * Copyright 2017 Google LLC
2302 *
2303 * Licensed under the Apache License, Version 2.0 (the "License");
2304 * you may not use this file except in compliance with the License.
2305 * You may obtain a copy of the License at
2306 *
2307 *   http://www.apache.org/licenses/LICENSE-2.0
2308 *
2309 * Unless required by applicable law or agreed to in writing, software
2310 * distributed under the License is distributed on an "AS IS" BASIS,
2311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2312 * See the License for the specific language governing permissions and
2313 * limitations under the License.
2314 */class Mf{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Nr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((a=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const a=Date.now()+r,c=new Mf(e,t,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new de(J.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>
2314this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Pf(n,e){if(Rt("AsyncQueue",`${e}: ${n}`),oi(n))return new de(J.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2315 * @license
2316 * Copyright 2017 Google LLC
2317 *
2318 * Licensed under the Apache License, Version 2.0 (the "License");
2319 * you may not use this file except in compliance with the License.
2320 * You may obtain a copy of the License at
2321 *
2322 *   http://www.apache.org/licenses/LICENSE-2.0
2323 *
2324 * Unless required by applicable law or agreed to in writing, software
2325 * distributed under the License is distributed on an "AS IS" BASIS,
2326 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2327 * See the License for the specific language governing permissions and
2328 * limitations under the License.
2329 */class Ri{static emptySet(e){return new Ri(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||me.comparator(t.key,r.key):(t,r)=>me.comparator(t.key,r.key),this.keyedMap=wi(),this.sortedSet=new ut(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,r)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Ri)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
2330  `+e.join(`  
2331`)+`
2332)`}copy(e,t){const r=new Ri;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
2333 * @license
2334 * Copyright 2017 Google LLC
2335 *
2336 * Licensed under the Apache License, Version 2.0 (the "License");
2337 * you may not use this file except in compliance with the License.
2338 * You may obtain a copy of the License at
2339 *
2340 *   http://www.apache.org/licenses/LICENSE-2.0
2341 *
2342 * Unless required by applicable law or agreed to in writing, software
2343 * distributed under the License is distributed on an "AS IS" BASIS,
2344 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2345 * See the License for the specific language governing permissions and
2346 * limitations under the License.
2347 */class yb{constructor(){this.au=new ut(me.comparator)}track(e){const t=e.doc.key,r=this.au.get(t);r?e.type!==0&&r.type===3?this.au=this.au.insert(t,e):e.type===3&&r.type!==1?this.au=this.au.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.au=this.au.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.au=this.au.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.au=this.au.remove(t):e.type===1&&r.type===2?this.au=this.au.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.au=this.au.insert(t,{type:2,doc:e.doc}):ye(63341,{ft:e,uu:r}):this.au=this.au.insert(t,e)}cu(){const e=[];return this.au.inorderTraversal(((t,r)=>{e.push(r)})),e}}class ho{constructor(e,t,r,s,i,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach((c=>{a.push({type:0,doc:c})})),new ho(e,t,Ri.emptySet(t),a,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&xh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
2348 * @license
2349 * Copyright 2017 Google LLC
2350 *
2351 * Licensed under the Apache License, Version 2.0 (the "License");
2352 * you may not use this file except in compliance with the License.
2353 * You may obtain a copy of the License at
2354 *
2355 *   http://www.apache.org/licenses/LICENSE-2.0
2356 *
2357 * Unless required by applicable law or agreed to in writing, software
2358 * distributed under the License is distributed on an "AS IS" BASIS,
2359 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2360 * See the License for the specific language governing permissions and
2361 * limitations under the License.
2362 */class qO{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some((e=>e.Tu()))}}class zO{constructor(){this.queries=bb(),this.onlineState="Unknown",this.Pu=new Set}terminate(){(function(t,r){const s=_e(t),i=s.queries;s.queries=bb(),i.forEach(((a,c)=>{for(const l of c.Eu)l.onError(r)}))})(this,new de(J.ABORTED,"Firestore shutting down"))}}function bb(){return new ds((n=>y3(n)),xh)}async function Rf(n,e){const t=_e(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.hu()&&e.Tu()&&(r=2):(i=new qO,r=e.Tu()?0:1);try{switch(r){case 0:i.lu=await t.onListen(s,!0);break;case 1:i.lu=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=Pf(a,`Initialization of query '${Nt(e.query)?Wr(e.query):Ac(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.Eu.push(e),e.Ru(t.onlineState),i.lu&&e.Iu(i.lu)&&Df(t)}async function Of(n,e){const t=_e(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.Eu.indexOf(e);a>=0&&(i.Eu.splice(a,1),i.Eu.length===0?s=e.Tu()?0:1:!i.hu()&&e.Tu()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function FO(n,e){const t=_e(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.Eu)c.Iu(s)&&(r=!0);a.lu=s}}r&&Df(t)}function $O(n,e,t){const r=_e(n),s=r.queries.get(e);if(s)for(const i of s.Eu)i.onError(t);r.queries.delete(e)}function Df(n){n.Pu.forEach((e=>{e.next()}))}var Jp;(function(n){n.Default="default",n.Cache="cache"})(Jp||(Jp={}));class Vf{constructor(e,t,r){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState="Unknown",this.options=r||{}}Iu(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new ho(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache||!this.Tu())return!0;const r=t!=="Offline";return(!this.options.waitForSyncWhenOnline||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}fu(e){if(e.docChanges.length>0)return!0;const t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}pu(e){e=ho.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==Jp.Cache}}/**
2363 * @license
2364 * Copyright 2017 Google LLC
2365 *
2366 * Licensed under the Apache License, Version 2.0 (the "License");
2367 * you may not use this file except in compliance with the License.
2368 * You may obtain a copy of the License at
2369 *
2370 *   http://www.apache.org/licenses/LICENSE-2.0
2371 *
2372 * Unless required by applicable law or agreed to in writing, software
2373 * distributed under the License is distributed on an "AS IS" BASIS,
2374 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2375 * See the License for the specific language governing permissions and
2376 * limitations under the License.
2377 */class W3{constructor(e){this.key=e}}class Y3{constructor(e){this.key=e}}class BO{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=Fe(),this.mutatedKeys=Fe(),this.Lu=Nt(e)?Kp(e):Z1(e),this.Bu=new Ri(this.Lu)}get Uu(){return this.Ou}ku(e,t){const r=t?t.qu:new yb,s=t?t.Bu:this.Bu;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const[l,d]=this.$u(this.query,s);e.inorderTraversal(((p,f)=>{const g=s.get(p),x=E3(this.query,f)?f:null,b=!!g&&this.mutatedKeys.has(g.key),I=!!x&&(x.hasLocalMutations||this.mutatedKeys.has(x.key)&&x.hasCommittedMutations);let N=!1;g&&x?g.data.isEqual(x.data)?b!==I&&(r.track({type:3,doc:x}),N=!0):this.Ku(g,x)||(r.track({type:2,doc:x}),N=!0,(l&&this.Lu(x,l)>0||d&&this.Lu(x,d)<0)&&(c=!0)):!g&&x?(r.track({type:0,doc:x}),N=!0):g&&!x&&(r.track({type:1,doc:g}),N=!0,(l||d)&&(c=!0)),N&&(x?(a=a.add(x),i=I?i.add(p):i.delete(p)):(a=a.delete(p),i=i.delete(p)))}));const m=this.Wu(this.query);if(m)if(Nt(this.query)){const p=[];a.forEach((x=>p.push(x)));const f=T3(this.query,p);let g=new Ri(Kp(this.query));for(const x of f)g=g.add(x);a.forEach((x=>{g.has(x.key)||(i=i.delete(x.key),r.track({type:1,doc:x}))})),a=g}else{const p=this.Qu(this.query);for(;a.size>m;){const f=p==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}}return{Bu:a,qu:r,Uo:c,mutatedKeys:i}}Wu(e){var t;return Nt(e)?(t=Pm(e))==null?void 0:t.limit:e.limit||void 0}Qu(e){if(Nt(e)){const t=Pm(e);return t&&t.limit<0?"L":"F"}return e.limitType}$u(e,t){var r;if(Nt(e)){const s=(r=Pm(e))==null?void 0:r.limit;return[t.size===s?t.last():null,null]}return[e.limitType==="F"&&t.size===this.Wu(this.query)?t.last():null,e.limitType==="L"&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}
2377applyChanges(e,t,r,s){const i=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;const a=e.qu.cu();a.sort(((m,p)=>(function(g,x){const b=I=>{switch(I){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ye(20277,{ft:I})}};return b(g)-b(x)})(m.type,p.type)||this.Lu(m.doc,p.doc))),this.Gu(r),s=s??!1;const c=t&&!s?this.zu():[],l=this.Nu.size===0&&this.current&&!s?1:0,d=l!==this.Mu;return this.Mu=l,a.length!==0||d?{snapshot:new ho(this.query,e.Bu,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),ju:c}:{ju:c}}Ru(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new yb,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach((t=>this.Ou=this.Ou.add(t))),e.modifiedDocuments.forEach((t=>{})),e.removedDocuments.forEach((t=>this.Ou=this.Ou.delete(t))),this.current=e.current)}zu(){if(!this.current)return[];const e=this.Nu;this.Nu=Fe(),this.Bu.forEach((r=>{this.Hu(r.key)&&(this.Nu=this.Nu.add(r.key))}));const t=[];return e.forEach((r=>{this.Nu.has(r)||t.push(new Y3(r))})),this.Nu.forEach((r=>{e.has(r)||t.push(new W3(r))})),t}Ju(e){this.Ou=e.Jo,this.Nu=Fe();const t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return ho.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,this.Mu===0,this.hasCachedResults)}}const Po="SyncEngine";class UO{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class GO{constructor(e){this.key=e,this.Zu=!1}}class KO{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Xu={},this.ec=new ds((c=>y3(c)),xh),this.tc=new Map,this.nc=new Set,this.rc=new ut(me.comparator),this.sc=new Map,this._c=new kf,this.oc={},this.ac=new Map,this.uc=rs.Cs(),this.onlineState="Unknown",this.cc=void 0}get isPrimaryClient(){return this.cc===!0}}async function HO(n,e,t=!0){const r=Eh(n);let s;const i=r.ec.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Yu()):s=await Q3(r,e,t,!0),s}async function WO(n,e){const t=Eh(n);await Q3(t,e,!0,!1)}async function Q3(n,e,t,r){const s=await Iu(n.localStore,Nt(e)?e:$n(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await Lf(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&Th(n.remoteStore,s),c}async function Lf(n,e,t,r,s){n.lc=(p,f,g)=>(async function(b,I,N,V){let D=I.view.ku(N);D.Uo&&(D=await Hp(b.localStore,I.query,!1).then((({documents:_})=>I.view.ku(_,D))));const T=V&&V.targetChanges.get(I.targetId),M=V&&V.targetMismatches.get(I.targetId)!=null,R=I.view.applyChanges(D,b.isPrimaryClient,T,M);return Xp(b,I.targetId,R.ju),R.snapshot})(n,p,f,g);const i=await Hp(n.localStore,e,!0),a=new BO(e,i.Jo),c=a.ku(i.documents),l=Tl.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(c,n.isPrimaryClient,l);Xp(n,t,d.ju);const m=new UO(e,t,a);return n.ec.set(e,m),n.tc.has(t)?n.tc.get(t).push(e):n.tc.set(t,[e]),d.snapshot}async function YO(n,e,t){const r=_e(n),s=r.ec.get(e),i=r.tc.get(s.targetId);if(i.length>1)return r.tc.set(s.targetId,i.filter((a=>!xh(a,e)))),void r.ec.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedCl
2377ientState.isActiveQueryTarget(s.targetId)||await lo(r.localStore,s.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(s.targetId),t&&uo(r.remoteStore,s.targetId),mo(r,s.targetId)})).catch(ai)):(mo(r,s.targetId),await lo(r.localStore,s.targetId,!0))}async function QO(n,e){const t=_e(n),r=t.ec.get(e),s=t.tc.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),uo(t.remoteStore,r.targetId))}async function ZO(n,e,t){const r=$f(n);try{const s=await(function(a,c){const l=_e(a),d=st.now(),m=c.reduce(((g,x)=>g.add(x.key)),Fe());let p,f;return l.persistence.runTransaction("Locally write mutations","readwrite",(g=>{let x=Ft(),b=Fe();return l.Qo.getEntries(g,m).next((I=>{x=I,x.forEach(((N,V)=>{V.isValidDocument()||(b=b.add(N))}))})).next((()=>l.localDocuments.getOverlayedDocuments(g,x))).next((I=>{p=I;const N=[];for(const V of c){const D=fM(V,p.get(V.key).overlayedDocument);D!=null&&N.push(new ci(V.key,D,av(D.value.mapValue),Sn.exists(!0)))}return l.mutationQueue.addMutationBatch(g,d,N,c)})).next((I=>{f=I;const N=I.applyToLocalDocumentSet(p,b);return l.documentOverlayCache.saveOverlays(g,I.batchId,N)}))})).then((()=>({batchId:f.batchId,changes:jv(p)})))})(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),(function(a,c,l){let d=a.oc[a.currentUser.toKey()];d||(d=new ut(De)),d=d.insert(c,l),a.oc[a.currentUser.toKey()]=d})(r,s.batchId,t),await di(r,s.changes),await Co(r.remoteStore)}catch(s){const i=Pf(s,"Failed to persist write");t.reject(i)}}async function Z3(n,e){const t=_e(n);try{const r=await wO(t.localStore,e);
2377e.targetChanges.forEach(((s,i)=>{const a=t.sc.get(i);a&&(ce(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?a.Zu=!0:s.modifiedDocuments.size>0?ce(a.Zu,14607):s.removedDocuments.size>0&&(ce(a.Zu,42227),a.Zu=!1))})),await di(t,r,e)}catch(r){await ai(r)}}function xb(n,e,t){const r=_e(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.ec.forEach(((i,a)=>{const c=a.view.Ru(e);c.snapshot&&s.push(c.snapshot)})),(function(a,c){const l=_e(a);l.onlineState=c;let d=!1;l.queries.forEach(((m,p)=>{for(const f of p.Eu)f.Ru(c)&&(d=!0)})),d&&Df(l)})(r.eventManager,e),s.length&&r.Xu.zn(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function JO(n,e,t){const r=_e(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.sc.get(e),i=s&&s.key;if(i){let a=new ut(me.comparator);a=a.insert(i,Et.newNoDocument(i,Ne.min()));const c=Fe().add(i),l=new To(Ne.min(),new Map,new ut(De),a,Ft(),c);await Z3(r,l),r.rc=r.rc.remove(i),r.sc.delete(e),Ff(r)}else await lo(r.localStore,e,!1).then((()=>mo(r,e,t))).catch(ai)}async function XO(n,e){const t=_e(n),r=e.batch.batchId;try{const s=await kO(t.localStore,e);zf(t,r,null),qf(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await di(t,s)}catch(s){await ai(s)}}async function eD(n,e,t){const r=_e(n);try{const s=await(function(a,c){const l=_e(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",(d=>{let m;return l.mutationQueue.lookupMutationBatch(d,c).next((p=>(ce(p!==null,37113),m=p.keys(),l.mutationQueue.removeMutationBatch(d,p)))).next((()=>l.mutationQueue.performConsistencyCheck(d))).next((()=>l.documentOverlayCache.removeOverlaysForBatchId(d,m,c))).next((()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,m))).next((()=>l.localDocuments.getDocuments(d,m)))}))})(r.localStore,e);zf(r,e,t),qf(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await di(r,s)}catch(s){await ai(s)}}function qf(n,e){(n.ac.get(e)||[]).forEach((t=>{t.resolve()})),n.ac.delete(e)}function zf(n,e,t){const r=_e(n);let s=r.oc[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.oc[r.currentUser.toKey()]=s}}function mo(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.tc.get(e))n.ec.delete(r),t&&n.Xu.Ec(r,t);n.tc.delete(e),n.isPrimaryClient&&n._c.s_(e).forEach((r=>{n._c.containsKey(r)||J3(n,r)}))}function J3(n,e){n.nc.delete(e.path.canonicalString());const t=n.rc.get(e);t!==null&&(uo(n.remoteStore,t),n.rc=n.rc.remove(e),n.sc.delete(t),Ff(n))}function Xp(n,e,t){for(const r of t)r instanceof W3?(n._c.addReference(r.key,e),tD(n,r)):r instanceof Y3?(se(Po,"Document no longer in limbo: "+r.key),n._c.removeReference(r.key,e),n._c.containsKey(r.key)||J3(n,r.key)):ye(19791,{hc:r})}function tD(n,e){const t=e.key,r=t.path.canonicalString();n.rc.get(t)||n.nc.has(r)||(se(Po,"New document in limbo: "+t),n.nc.add(r),Ff(n))}function Ff(n){for(;n.nc.size>0&&n.rc.size<n.maxConcurrentLimboResolutions;){const e=n.nc.values().next().value;n.nc.delete(e);const t=new me(Ke.fromString(e)),r=n.uc.next();n.sc.set(r,new GO(t)),n.rc=n.rc.insert(t,r),Th(n.remoteStore,new Er($n(jl(t.path)),r,"TargetPurposeLimboResolution",Nn.ce))}}async function di(n,e,t){const r=_e(n),s=[],i=[],a=[];r.ec.isEmpty()||(r.ec.forEach(((c,l)=>{a.push(r.lc(l,e,t).then((d=>{var m;if((d||t)&&r.isPrimaryClient){const p=d?!d.fromCache:(m=t==null?void 0:t.targetChanges.get(l.targetId))==null?void 0:m.current;
2377r.sharedClientState.updateQueryState(l.targetId,p?"current":"not-current")}if(d){s.push(d);const p=Tf.vo(l.targetId,d);i.push(p)}})))})),await Promise.all(a),r.Xu.zn(s),await(async function(l,d){const m=_e(l);try{await m.persistence.runTransaction("notifyLocalViewChanges","readwrite",(p=>F.forEach(d,(f=>F.forEach(f.wo,(g=>m.persistence.referenceDelegate.addReference(p,f.targetId,g))).next((()=>F.forEach(f.bo,(g=>m.persistence.referenceDelegate.removeReference(p,f.targetId,g)))))))))}catch(p){if(!oi(p))throw p;se(Ef,"Failed to update sequence numbers: "+p)}for(const p of d){const f=p.targetId;if(!p.fromCache){const g=m.$o.get(f),x=g.snapshotVersion,b=g.withLastLimboFreeSnapshotVersion(x);m.$o=m.$o.insert(f,b)}}})(r.localStore,i))}async function nD(n,e){const t=_e(n);if(!t.currentUser.isEqual(e)){se(Po,"User change. New user:",e.toKey());const r=await R3(t.localStore,e);t.currentUser=e,(function(i,a){i.ac.forEach((c=>{c.forEach((l=>{l.reject(new de(J.CANCELLED,a))}))})),i.ac.clear()})(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await di(t,r.zo)}}function rD(n,e){const t=_e(n),r=t.sc.get(e);if(r&&r.Zu)return Fe().add(r.key);{let s=Fe();const i=t.tc.get(e);if(!i)return s;for(const a of i??[]){const c=t.ec.get(a);s=s.unionWith(c.view.Uu)}return s}}async function sD(n,e){const t=_e(n),r=await Hp(t.localStore,e.query,!0),s=e.view.Ju(r);return t.isPrimaryClient&&Xp(t,e.targetId,s.ju),s}async function iD(n,e){const t=_e(n);return Wp(t.localStore,e).then((r=>di(t,r)))}async function aD(n,e,t,r){const s=_e(n),i=await(function(c,l){const d=_e(c),m=_e(d.mutationQueue);return d.persistence.runTransaction("Lookup mutation documents","readonly",(p=>m.ps(p,l).next((f=>f?d.localDocuments.getDocuments(p,f):F.resolve(null)))))})(s.localStore,e);i!==null?(t==="pending"?await Co(s.remoteStore):t==="acknowledged"||t==="rejected"?(zf(s,e,r||null),qf(s,e),(function(c,l){_e(_e(c).mutationQueue).bs(l)})(s.localStore,e)):ye(6720,"Unknown batchState",{Tc:t}),await di(s,i)):se(Po,"Cannot apply mutation batch with id: "+e)}async function oD(n,e){const t=_e(n);if(Eh(t),$f(t),e===!0&&t.cc!==!0){const r=t.sharedClientState.getAllActiveQueryTargets(),s=await vb(t,r.toArray());t.cc=!0,await Zp(t.remoteStore,!0);for(const i of s)Th(t.remoteStore,i)}else if(e===!1&&t.cc!==!1){const r=[];let s=Promise.resolve();t.tc.forEach(((i,a)=>{t.sharedClientState.isLocalQueryTarget(a)?r.push(a):s=s.then((()=>
2377(mo(t,a),lo(t.localStore,a,!0)))),uo(t.remoteStore,a)})),await s,await vb(t,r),(function(a){const c=_e(a);c.sc.forEach(((l,d)=>{uo(c.remoteStore,d)})),c._c.__(),c.sc=new Map,c.rc=new ut(me.comparator)})(t),t.cc=!1,await Zp(t.remoteStore,!1)}}async function vb(n,e,t){const r=_e(n),s=[],i=[];for(const a of e){let c;const l=r.tc.get(a);if(l&&l.length!==0){c=await Iu(r.localStore,Nt(l[0])?l[0]:$n(l[0]));for(const d of l){const m=r.ec.get(d),p=await sD(r,m);p.snapshot&&i.push(p.snapshot)}}else{const d=await D3(r.localStore,a);c=await Iu(r.localStore,d),await Lf(r,X3(d),a,!1,c.resumeToken)}s.push(c)}return r.Xu.zn(i),s}function X3(n){return $r(n)?n:Iv(n.path,n.collectionGroup,n.orderBy,n.filters,n.limit,"F",n.startAt,n.endAt)}function cD(n){return(function(t){return _e(_e(t).persistence).po()})(_e(n).localStore)}async function lD(n,e,t,r){const s=_e(n);if(s.cc)return void se(Po,"Ignoring unexpected query state notification.");const i=s.tc.get(e);if(i&&i.length>0)switch(t){case"current":case"not-current":{let a;if(Nt(i[0]))switch(Hr(i[0])){case"collection_group":case"collection":a=await Wp(s.localStore,d3(i[0]));break;case"documents":a=await(function(d,m){const p=_e(d),f=Fe(...fu(m).map((g=>me.fromPath(g))));return p.persistence.runTransaction("Get documents for pipeline","readonly",(g=>p.Qo.getEntries(g,f))).then((g=>g))})(s.localStore,i[0]);break;default:lr(""),a=wi()}else a=await Wp(s.localStore,(function(d){return d.collectionGroup||(d.path.length%2==1?d.path.lastSegment():d.path.get(d.path.length-2))})(i[0]));const c=To.createSynthesizedRemoteEventForCurrentChange(e,t==="current",vt.EMPTY_BYTE_STRING);await di(s,a,c);break}case"rejected":await lo(s.localStore,e,!0),mo(s,e,r);break;default:ye(64155,t)}}async function dD(n,e,t){const r=Eh(n);if(r.cc){for(const s of e){if(r.tc.has(s)&&r.sharedClientState.isActiveQueryTarget(s)){se(Po,"Adding an already active target "+s);continue}const i=await D3(r.localStore,s),a=await Iu(r.localStore,i);await Lf(r,X3(i),a.targetId,!1,a.resumeToken),Th(r.remoteStore,a)}for(const s of t)r.tc.has(s)&&await lo(r.localStore,s,!1).then((()=>{uo(r.remoteStore,s),mo(r,s)})).catch(ai)}}function Eh(n){const e=_e(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Z3.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=rD.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=JO.bind(null,e),e.Xu.zn=FO.bind(null,e.eventManager),e.Xu.Ec=$O.bind(null,e.eventManager),e}function $f(n){const e=_e(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=XO.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=eD.bind(null,e),e}class sl{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=mh(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return P3(this.persistence,new M3,e.initialUser,this.serializer)}Ic(e){return new wf(wh.C_,this.serializer)}Rc(e){return new F3}async terminate(){var e,t;(e=this.gcScheduler)==null||e.stop(),(t=this.indexBackfillerScheduler)==null||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}sl.provider={build:()=>new sl};class uD extends sl{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){ce(this.persistence.referenceDelegate instanceof vu,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new Wv(r,e.asyncQueue,t)}Ic(e){const t=this.cacheSizeBytes!==void 0?ln.withCacheSize(this.cacheSizeBytes):ln.DEFAULT;return new wf((r=>vu.C_(r,t)),this.serializer)}}class eI extends sl{constructor(e,t,r){super(),this.fc=e,this.cacheSizeBytes=t,this.forceOwnership=r,this.kind="persistent",this.synchronizeTabs=!1}async initialize(e){await super.initialize(e),await this.fc.initialize(this,e),await $f(this.fc.syncEngine),await Co(this.fc.remoteStore),await this.persistence._o((()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve())))}Ac(e){return P3(this.persistence,new M3,e.initialUser,this.serializer)}Vc(e,t){const r=this.persistence.referenceDelegate.garbageCollector;return new Wv(r,e.asyncQueue,t)}dc(e,t){const r=new AC(t,this.persistence);return new SC(e.asyncQueue,r)}Ic(e){const t=C3(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),r=this.cacheSizeBytes!==void 0?ln.withCacheSize(this.cacheSizeBytes):ln.DEFAULT;return new jf(this.synchronizeTabs,t,e.clientId,r,e.asyncQueue,$3(),Vd(),this.serializer,this.sharedCl
2377ientState,!!this.forceOwnership)}Rc(e){return new F3}}class hD extends eI{constructor(e,t){super(e,t,!1),this.fc=e,this.cacheSizeBytes=t,this.synchronizeTabs=!0}async initialize(e){await super.initialize(e);const t=this.fc.syncEngine;this.sharedClientState instanceof Lm&&(this.sharedClientState.syncEngine={Na:aD.bind(null,t),La:lD.bind(null,t),Ba:dD.bind(null,t),po:cD.bind(null,t),Ma:iD.bind(null,t)},await this.sharedClientState.start()),await this.persistence._o((async r=>{await oD(this.fc.syncEngine,r),this.gcScheduler&&(r&&!this.gcScheduler.started?this.gcScheduler.start():r||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(r&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():r||this.indexBackfillerScheduler.stop())}))}Rc(e){const t=$3();if(!Lm.C(t))throw new de(J.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const r=C3(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Lm(t,e.asyncQueue,r,e.clientId,e.initialUser)}}class il{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>xb(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=nD.bind(null,this.syncEngine),await Zp(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new zO})()}createDatastore(e){const t=mh(e.databaseInfo.databaseId),r=eP(e.databaseInfo);return iP(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return(function(r,s,i,a,c){return new NO(r,s,i,a,c)})(this.localStore,this.datastore,e.asyncQueue,(t=>xb(this.syncEngine,t,0)),(function(){return z0.C()?new z0:new QM})())}createSyncEngine(e,t){return(function(s,i,a,c,l,d,m){const p=new KO(s,i,a,c,l,d);return m&&(p.cc=!0),p})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await(async function(s){const i=_e(s);se(Dr,"RemoteStore shutting down."),i.tu.add(5),await Ml(i),i.ru.shutdown(),i.iu.set("Unknown")})(this.remoteStore),(e=this.datastore)==null||e.terminate(),(t=this.eventManager)==null||t.terminate()}}il.provider={build:()=>new il};/**
2378 * @license
2379 * Copyright 2020 Google LLC
2380 *
2381 * Licensed under the Apache License, Version 2.0 (the "License");
2382 * you may not use this file except in compliance with the License.
2383 * You may obtain a copy of the License at
2384 *
2385 *   http://www.apache.org/licenses/LICENSE-2.0
2386 *
2387 * Unless required by applicable law or agreed to in writing, software
2388 * distributed under the License is distributed on an "AS IS" BASIS,
2389 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2390 * See the License for the specific language governing permissions and
2391 * limitations under the License.
2392 *//**
2393 * @license
2394 * Copyright 2017 Google LLC
2395 *
2396 * Licensed under the Apache License, Version 2.0 (the "License");
2397 * you may not use this file except in compliance with the License.
2398 * You may obtain a copy of the License at
2399 *
2400 *   http://www.apache.org/licenses/LICENSE-2.0
2401 *
2402 * Unless required by applicable law or agreed to in writing, software
2403 * distributed under the License is distributed on an "AS IS" BASIS,
2404 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2405 * See the License for the specific language governing permissions and
2406 * limitations under the License.
2407 */class Bf{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):Rt("Uncaught Error in snapshot listener:",e.toString()))}gc(){this.muted=!0}mc(e,t){setTimeout((()=>{this.muted||e(t)}),0)}}/**
2408 * @license
2409 * Copyright 2017 Google LLC
2410 *
2411 * Licensed under the Apache License, Version 2.0 (the "License");
2412 * you may not use this file except in compliance with the License.
2413 * You may obtain a copy of the License at
2414 *
2415 *   http://www.apache.org/licenses/LICENSE-2.0
2416 *
2417 * Unless required by applicable law or agreed to in writing, software
2418 * distributed under the License is distributed on an "AS IS" BASIS,
2419 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2420 * See the License for the specific language governing permissions and
2421 * limitations under the License.
2422 */const ti="FirestoreClient";class mD{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this._databaseInfo=s,this.user=cn.UNAUTHENTICATED,this.clientId=O1.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,(async a=>{se(ti,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a})),this.appCheckCredentials.start(r,(a=>(se(ti,"Received new app check token=",a),this.appCheckCredentialListener(a,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Nr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=Pf(t,"Failed to shutdown persistence");e.reject(r)}})),e.promise}}async function qm(n,e){n.asyncQueue.verifyOperationInProgress(),se(ti,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener((async s=>{r.isEqual(s)||(await R3(e.localStore,s),r=s)})),e.persistence.setDatabaseDeletedListener((()=>n.terminate())),n._offlineComponents=e}async function Ib(n,e){n.asyncQueue.verifyOperationInProgress();const t=await pD(n);se(ti,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener((r=>gb(e.remoteStore,r))),n.setAppCheckTokenChangeListener(((r,s)=>gb(e.remoteStore,s))),n._onlineComponents=e}async function pD(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){se(ti,"Using user provided OfflineComponentProvider");try{await qm(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!(function(s){return s.name==="FirebaseError"?s.code===J.FAILED_PRECONDITION||s.code===J.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11})(t))throw t;lr("Error using user provided cache. Falling back to memory cache: "+t),await qm(n,new sl)}}else se(ti,"Using default OfflineComponentProvider"),await qm(n,new uD(void 0));return n._offlineComponents}async function tI(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(se(ti,"Using user provided OnlineComponentProvider"),await Ib(n,n._uninitializedComponentsProvider._online)):(se(ti,"Using default OnlineComponentProvider"),await Ib(n,new il))),n._onlineComponents}function fD(n){return tI(n).then((e=>e.syncEngine))}async function ju(n){const e=await tI(n),t=e.eventManager;return t.onListen=HO.bind(null,e.syncEngine),t.onUnlisten=YO.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=WO.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=QO.bind(null,e.syncEngine),t}function gD(n,e,t,r){const s=new Bf(r),i=new Vf(e,s,t);return n.asyncQueue.enqueueAndForget((async()=>Rf(await ju(n),i))),()=>{s.gc(),n.asyncQueue.enqueueAndForget((async()=>Of(await ju(n),i)))}}function yD(n,e,t={}){const r=new Nr;return n.asyncQueue.enqueueAndForget((async()=>(function(i,a,c,l,d){const m=new Bf({next:f=>{m.gc(),a.enqueueAndForget((()=>
2422Of(i,p)));const g=f.docs.has(c);!g&&f.fromCache?d.reject(new de(J.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&l&&l.source==="server"?d.reject(new de(J.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):d.resolve(f)},error:f=>d.reject(f)}),p=new Vf(jl(c.path),m,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return Rf(i,p)})(await ju(n),n.asyncQueue,e,t,r))),r.promise}function bD(n,e,t={}){const r=new Nr;return n.asyncQueue.enqueueAndForget((async()=>(function(i,a,c,l,d){const m=new Bf({next:f=>{m.gc(),a.enqueueAndForget((()=>Of(i,p))),f.fromCache&&l.source==="server"?d.reject(new de(J.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):d.resolve(f)},error:f=>d.reject(f)}),p=new Vf(c instanceof Mc?GR(c):c,m,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return Rf(i,p)})(await ju(n),n.asyncQueue,e,t,r))),r.promise}function xD(n,e){const t=new Nr;return n.asyncQueue.enqueueAndForget((async()=>ZO(await fD(n),e,t))),t.promise}/**
2423 * @license
2424 * Copyright 2020 Google LLC
2425 *
2426 * Licensed under the Apache License, Version 2.0 (the "License");
2427 * you may not use this file except in compliance with the License.
2428 * You may obtain a copy of the License at
2429 *
2430 *   http://www.apache.org/licenses/LICENSE-2.0
2431 *
2432 * Unless required by applicable law or agreed to in writing, software
2433 * distributed under the License is distributed on an "AS IS" BASIS,
2434 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2435 * See the License for the specific language governing permissions and
2436 * limitations under the License.
2437 */const _b="AsyncQueue";class kb{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new Uv(this,"async_queue_retry"),this.jc=()=>{const r=Vd();r&&se(_b,"Visibility state changed to "+r.visibilityState),this.xn.gn()},this.Hc=e;const t=Vd();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;const t=Vd();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));const t=new Nr;return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!oi(e))throw e;se(_b,"Operation failed with retryable error: "+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){const t=this.Hc.then((()=>(this.Qc=!0,e().catch((r=>{throw this.Wc=r,this.Qc=!1,Rt("INTERNAL UNHANDLED ERROR: ",wb(r)),r})).then((r=>(this.Qc=!1,r))))));return this.Hc=t,t}enqueueAfterDelay(e,t,r){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);const s=Mf.createAndSchedule(this,e,t,r,(i=>this.Xc(i)));return this.Kc.push(s),s}Jc(){this.Wc&&ye(47125,{el:wb(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(const t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((t,r)=>t.targetTimeMs-r.targetTimeMs));for(const t of this.Kc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){const t=this.Kc.indexOf(e);this.Kc.splice(t,1)}}function wb(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
2438`+n.stack),e}class Hi extends rf{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new kb,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new kb(e),this._firestoreClient=void 0,await e}}}function vD(n,e,t){t||(t=ou);const r=M1(n,"firestore");if(r.isInitialized(t)){const s=r.getImmediate({identifier:t}),i=r.getOptions(t);if(Jr(i,e))return s;throw new de(J.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new de(J.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
2438if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Hv)throw new de(J.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&xl(e.host)&&v4(e.host),r.initialize({options:e,instanceIdentifier:t})}function Nh(n){if(n._terminated)throw new de(J.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||ID(n),n._firestoreClient}function ID(n){var r,s,i,a;const e=n._freezeSettings(),t=oP(n._databaseId,((r=n._app)==null?void 0:r.options.appId)||"",n._persistenceKey,(s=n._app)==null?void 0:s.options.apiKey,e);n._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((a=e.localCache)!=null&&a._onlineComponentProvider)&&(n._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),n._firestoreClient=new mD(n._authCredentials,n._appCheckCredentials,n._queue,t,n._componentsProvider&&(function(l){const d=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(d),_online:d}})(n._componentsProvider))}/**
2439 * @license
2440 * Copyright 2020 Google LLC
2441 *
2442 * Licensed under the Apache License, Version 2.0 (the "License");
2443 * you may not use this file except in compliance with the License.
2444 * You may obtain a copy of the License at
2445 *
2446 *   http://www.apache.org/licenses/LICENSE-2.0
2447 *
2448 * Unless required by applicable law or agreed to in writing, software
2449 * distributed under the License is distributed on an "AS IS" BASIS,
2450 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2451 * See the License for the specific language governing permissions and
2452 * limitations under the License.
2453 */class _D{convertValue(e,t="none"){switch(qt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ht(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(ts(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw ye(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return na(e,((s,i)=>{r[s]=this.convertValue(i,t)})),r}convertVectorValue(e){var r,s,i;const t=(i=(s=(r=e.fields)==null?void 0:r[Fi].arrayValue)==null?void 0:s.values)==null?void 0:i.map((a=>ht(a.doubleValue)));return new An(t)}convertGeoPoint(e){return new Cr(ht(e.latitude),ht(e.longitude))}convertArray(e,t){return(e.values||[]).map((r=>this.convertValue(r,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const r=kl(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(ro(e));default:return null}}convertTimestamp(e){const t=es(e);return new st(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=Ke.fromString(e);ce(zv(r),9688,{name:e});const s=new zi(r.get(1),r.get(3)),i=new me(r.popFirst(5));return s.isEqual(t)||Rt(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}/**
2454 * @license
2455 * Copyright 2024 Google LLC
2456 *
2457 * Licensed under the Apache License, Version 2.0 (the "License");
2458 * you may not use this file except in compliance with the License.
2459 * You may obtain a copy of the License at
2460 *
2461 *   http://www.apache.org/licenses/LICENSE-2.0
2462 *
2463 * Unless required by applicable law or agreed to in writing, software
2464 * distributed under the License is distributed on an "AS IS" BASIS,
2465 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2466 * See the License for the specific language governing permissions and
2467 * limitations under the License.
2468 */class Uf extends _D{constructor(e){super(),this.firestore=e}convertBytes(e){return new Yn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);
2468return new St(this.firestore,null,t)}}const jb="@firebase/firestore",Tb="4.16.0";/**
2469 * @license
2470 * Copyright 2017 Google LLC
2471 *
2472 * Licensed under the Apache License, Version 2.0 (the "License");
2473 * you may not use this file except in compliance with the License.
2474 * You may obtain a copy of the License at
2475 *
2476 *   http://www.apache.org/licenses/LICENSE-2.0
2477 *
2478 * Unless required by applicable law or agreed to in writing, software
2479 * distributed under the License is distributed on an "AS IS" BASIS,
2480 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2481 * See the License for the specific language governing permissions and
2482 * limitations under the License.
2483 */function Eb(n){return(function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1})(n,["next","error","complete"])}/**
2484 * @license
2485 * Copyright 2020 Google LLC
2486 *
2487 * Licensed under the Apache License, Version 2.0 (the "License");
2488 * you may not use this file except in compliance with the License.
2489 * You may obtain a copy of the License at
2490 *
2491 *   http://www.apache.org/licenses/LICENSE-2.0
2492 *
2493 * Unless required by applicable law or agreed to in writing, software
2494 * distributed under the License is distributed on an "AS IS" BASIS,
2495 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2496 * See the License for the specific language governing permissions and
2497 * limitations under the License.
2498 */class nI{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new St(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new kD(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const t=this._document.data.field(No("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class kD extends nI{data(){return super.data()}}/**
2499 * @license
2500 * Copyright 2020 Google LLC
2501 *
2502 * Licensed under the Apache License, Version 2.0 (the "License");
2503 * you may not use this file except in compliance with the License.
2504 * You may obtain a copy of the License at
2505 *
2506 *   http://www.apache.org/licenses/LICENSE-2.0
2507 *
2508 * Unless required by applicable law or agreed to in writing, software
2509 * distributed under the License is distributed on an "AS IS" BASIS,
2510 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2511 * See the License for the specific language governing permissions and
2512 * limitations under the License.
2513 */function rI(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new de(J.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Gf{}class sI extends Gf{}function Sh(n,e,...t){let r=[];e instanceof Gf&&r.push(e),r=r.concat(t),(function(i){const a=i.filter((l=>l instanceof Hf)).length,c=i.filter((l=>l instanceof Ah)).length;if(a>1||a>0&&c>0)throw new de(J.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(r);for(const s of r)n=s._apply(n);return n}class Ah extends sI{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new Ah(e,t,r)}_apply(e){const t=this._parse(e);return iI(e._query,t),new li(e.firestore,e.converter,Dp(e._query,t))}_parse(e){const t=Zv(e.firestore);return(function(i,a,c,l,d,m,p){let f;if(d.isKeyField()){if(m==="array-contains"||m==="array-contains-any")throw new de(J.INVALID_ARGUMENT,`Invalid Query. You can't perform '${m}' queries on documentId().`);if(m==="in"||m==="not-in"){Sb(p,m);const x=[];for(const b of p)x.push(Nb(l,i,b));f={arrayValue:{values:x}}}else f=Nb(l,i,p)}else m!=="in"&&m!=="not-in"&&m!=="array-contains-any"||Sb(p,m),f=fP(c,a,p,m==="in"||m==="not-in");return Ye.create(d,m,f)})(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function Kf(n,e,t){const r=e,s=No("where",n);return Ah._create(s,r,t)}class Hf extends Gf{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Hf(e,t)}_parse(e){const t=this._queryConstraints.map((r=>r._parse(e))).filter((r=>r.getFilters().length>0));return t.length===1?t[0]:at.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:((function(s,i){let a=s;const c=i.getFlattenedFilters();for(const l of c)iI(a,l),a=Dp(a,l)})(e._query,t),new li(e.firestore,e.converter,Dp(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}
2513class Wf extends sI{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new Wf(e,t,r)}_apply(e){return new li(e.firestore,e.converter,hu(e._query,this._limit,this._limitType))}}function wD(n){return Wf._create("limit",n,"F")}function Nb(n,e,t){if(typeof(t=Cn(t))=="string"){if(t==="")throw new de(J.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!_v(e)&&t.indexOf("/")!==-1)throw new de(J.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(Ke.fromString(t));if(!me.isDocumentKey(r))throw new de(J.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Hc(n,new me(r))}if(t instanceof St)return Hc(n,t._key);throw new de(J.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${th(t)}.`)}function Sb(n,e){if(!Array.isArray(n)||n.length===0)throw new de(J.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function iI(n,e){const t=(function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.op;return null})(n.filters,(function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(t!==null)throw t===e.op?new de(J.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new de(J.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function jD(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}class TD{constructor(e){let t;this.kind="persistent",e!=null&&e.tabManager?(e.tabManager._initialize(e),t=e.tabManager):(t=AD(void 0),t._initialize(e)),this._onlineComponentProvider=t._onlineComponentProvider,this._offlineComponentProvider=t._offlineComponentProvider}toJSON(){return{kind:this.kind}}}function ED(n){return new TD(n)}class ND{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=il.provider,this._offlineComponentProvider={build:t=>new eI(t,e==null?void 0:e.cacheSizeBytes,this.forceOwnership)}}}class SD{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=il.provider,this._offlineComponentProvider={build:t=>new hD(t,e==null?void 0:e.cacheSizeBytes)}}}function AD(n){return new ND(n==null?void 0:n.forceOwnership)}function CD(){return new SD}class yc{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Oi extends nI{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Ld(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(No("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new de(J.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Oi._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}}Oi._jsonSchemaVersion="firestore/documentSnapshot/1.0",Oi._jsonSchema={type:Lt("string",Oi._jsonSchemaVersion),bundleSource:Lt("string","DocumentSnapshot"),bundleName:Lt("string"),bundle:Lt("string")};class Ld extends Oi{data(e={}){return super.data(e)}}class Di{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new yc(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((r=>{e.call(t,new Ld(this._firestore,this._userDataWriter,r.key,r,new yc(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new de(J.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=(function(s,i){if
2513(s._snapshot.oldDocs.isEmpty()){let a=0;return s._snapshot.docChanges.map((c=>{Nt(s._snapshot.query)?Kp(s._snapshot.query):Z1(s.query._query);const l=new Ld(s._firestore,s._userDataWriter,c.doc.key,c.doc,new yc(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}}))}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter((c=>i||c.type!==3)).map((c=>{const l=new Ld(s._firestore,s._userDataWriter,c.doc.key,c.doc,new yc(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,m=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),m=a.indexOf(c.doc.key)),{type:MD(c.type),doc:l,oldIndex:d,newIndex:m}}))}})(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new de(J.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Di._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=O1.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],r=[],s=[];return this.docs.forEach((i=>{i._document!==null&&(t.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function MD(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ye(61501,{type:n})}}/**
2514 * @license
2515 * Copyright 2022 Google LLC
2516 *
2517 * Licensed under the Apache License, Version 2.0 (the "License");
2518 * you may not use this file except in compliance with the License.
2519 * You may obtain a copy of the License at
2520 *
2521 *   http://www.apache.org/licenses/LICENSE-2.0
2522 *
2523 * Unless required by applicable law or agreed to in writing, software
2524 * distributed under the License is distributed on an "AS IS" BASIS,
2525 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2526 * See the License for the specific language governing permissions and
2527 * limitations under the License.
2528 */Di._jsonSchemaVersion="firestore/querySnapshot/1.0",Di._jsonSchema={type:Lt("string",Di._jsonSchemaVersion),bundleSource:Lt("string","QuerySnapshot"),bundleName:Lt("string"),bundle:Lt("string")};/**
2529 * @license
2530 * Copyright 2020 Google LLC
2531 *
2532 * Licensed under the Apache License, Version 2.0 (the "License");
2533 * you may not use this file except in compliance with the License.
2534 * You may obtain a copy of the License at
2535 *
2536 *   http://www.apache.org/licenses/LICENSE-2.0
2537 *
2538 * Unless required by applicable law or agreed to in writing, software
2539 * distributed under the License is distributed on an "AS IS" BASIS,
2540 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2541 * See the License for the specific language governing permissions and
2542 * limitations under the License.
2543 */function PD(n){n=Sr(n,St);const e=Sr(n.firestore,Hi),t=Nh(e);return yD(t,n._key).then((r=>cI(e,n,r)))}function Pl(n){n=Sr(n,li);const e=Sr(n.firestore,Hi),t=Nh(e),r=new Uf(e);return rI(n._query),bD(t,n._query).then((s=>new Di(e,r,n,s)))}function Ch(n,e,t){n=Sr(n,St);const r=Sr(n.firestore,Hi),s=jD(n.converter,e,t),i=Zv(r);return oI(r,[pP(i,"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Sn.none())])}function RD(n){return oI(Sr(n.firestore,Hi),[new uh(n._key,Sn.none())])}function aI(n,...e){var d,m,p;n=Cn(n);let t={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Eb(e[r])||(t=e[r++]);const s={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(Eb(e[r])){const f=e[r];e[r]=(d=f.next)==null?void 0:d.bind(f),e[r+1]=(m=f.error)==null?void 0:m.bind(f),e[r+2]=(p=f.complete)==null?void 0:p.bind(f)}let i,a,c;if(n instanceof St)a=Sr(n.firestore,Hi),c=jl(n._key.path),i={next:f=>{e[r]&&e[r](cI(a,n,f))},error:e[r+1],complete:e[r+2]};else{const f=Sr(n,li);a=Sr(f.firestore,Hi),c=f._query;const g=new Uf(a);i={next:x=>{e[r]&&e[r](new Di(a,g,f,x))},error:e[r+1],complete:e[r+2]},rI(n._query)}const l=Nh(a);return gD(l,c,s,i)}function oI(n,e){const t=Nh(n);return xD(t,e)}function cI(n,e,t){const r=t.docs.get(e._key),s=new Uf(n);return new Oi(n,s,e._key,r,new yc(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){fC(ko),Ya(new Li("firestore",((r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new Hi(new bC(r.getProvider("auth-internal")),new IC(a,r.getProvider("app-check-internal")),oM(a,s),a);return i={useFetchStreams:t,...i},c._setSettings(i),c}),"PUBLIC").setMultipleInstances(!0)),Ls(jb,Tb,e),Ls(jb,Tb,"esm2020")})();function lI(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const OD=lI,dI=new yl("auth","Firebase",lI());/**
2544 * @license
2545 * Copyright 2020 Google LLC
2546 *
2547 * Licensed under the Apache License, Version 2.0 (the "License");
2548 * you may not use this file except in compliance with the License.
2549 * You may obtain a copy of the License at
2550 *
2551 *   http://www.apache.org/licenses/LICENSE-2.0
2552 *
2553 * Unless required by applicable law or agreed to in writing, software
2554 * distributed under the License is distributed on an "AS IS" BASIS,
2555 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2556 * See the License for the specific language governing permissions and
2557 * limitations under the License.
2558 */const Tu=new A1("@firebase/auth");function DD(n,...e){Tu.logLevel<=He.WARN&&Tu.warn(`Auth (${ko}): ${n}`,...e)}function qd(n,...e){Tu.logLevel<=He.ERROR&&Tu.error(`Auth (${ko}): ${n}`,...e)}/**
2559 * @license
2560 * Copyright 2020 Google LLC
2561 *
2562 * Licensed under the Apache License, Version 2.0 (the "License");
2563 * you may not use this file except in compliance with the License.
2564 * You may obtain a copy of the License at
2565 *
2566 *   http://www.apache.org/licenses/LICENSE-2.0
2567 *
2568 * Unless required by applicable law or agreed to in writing, software
2569 * distributed under the License is distributed on an "AS IS" BASIS,
2570 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2571 * See the License for the specific language governing permissions and
2572 * limitations under the License.
2573 */function ss(n,...e){throw Yf(n,...e)}function Mr(n,...e){return Yf(n,...e)}function uI(n,e,t){const r={...OD(),[e]:t};return new yl("auth","Firebase",r).create(e,{appName:n.name})}function Bs(n){return uI(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Yf(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return dI.create(n,...e)}function Ve(n,e,...t){if(!n)throw Yf(e,...t)}function Br(n){const e="INTERNAL ASSERTION FAILED: "+n;throw qd(e),new Error(e)}function is(n,e){n||Br(e)}/**
2574 * @license
2575 * Copyright 2020 Google LLC
2576 *
2577 * Licensed under the Apache License, Version 2.0 (the "License");
2578 * you may not use this file except in compliance with the License.
2579 * You may obtain a copy of the License at
2580 *
2581 *   http://www.apache.org/licenses/LICENSE-2.0
2582 *
2583 * Unless required by applicable law or agreed to in writing, software
2584 * distributed under the License is distributed on an "AS IS" BASIS,
2585 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2586 * See the License for the specific language governing permissions and
2587 * limitations under the License.
2588 */function e1(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.href)||""}function VD(){return Ab()==="http:"||Ab()==="https:"}function Ab(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.protocol)||null}/**
2589 * @license
2590 * Copyright 2020 Google LLC
2591 *
2592 * Licensed under the Apache License, Version 2.0 (the "License");
2593 * you may not use this file except in compliance with the License.
2594 * You may obtain a copy of the License at
2595 *
2596 *   http://www.apache.org/licenses/LICENSE-2.0
2597 *
2598 * Unless required by applicable law or agreed to in writing, software
2599 * distributed under the License is distributed on an "AS IS" BASIS,
2600 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2601 * See the License for the specific language governing permissions and
2602 * limitations under the License.
2603 */function LD(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(VD()||VS()||"connection"in navigator)?navigator.onLine:!0}function qD(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
2604 * @license
2605 * Copyright 2020 Google LLC
2606 *
2607 * Licensed under the Apache License, Version 2.0 (the "License");
2608 * you may not use this file except in compliance with the License.
2609 * You may obtain a copy of the License at
2610 *
2611 *   http://www.apache.org/licenses/LICENSE-2.0
2612 *
2613 * Unless required by applicable law or agreed to in writing, software
2614 * distributed under the License is distributed on an "AS IS" BASIS,
2615 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2616 * See the License for the specific language governing permissions and
2617 * limitations under the License.
2618 */class Rl{constructor(e,t){this.shortDelay=e,this.longDelay=t,is(t>
2618e,"Short delay should be less than long delay!"),this.isMobile=OS()||LS()}get(){return LD()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2619 * @license
2620 * Copyright 2020 Google LLC
2621 *
2622 * Licensed under the Apache License, Version 2.0 (the "License");
2623 * you may not use this file except in compliance with the License.
2624 * You may obtain a copy of the License at
2625 *
2626 *   http://www.apache.org/licenses/LICENSE-2.0
2627 *
2628 * Unless required by applicable law or agreed to in writing, software
2629 * distributed under the License is distributed on an "AS IS" BASIS,
2630 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631 * See the License for the specific language governing permissions and
2632 * limitations under the License.
2633 */function Qf(n,e){is(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
2634 * @license
2635 * Copyright 2020 Google LLC
2636 *
2637 * Licensed under the Apache License, Version 2.0 (the "License");
2638 * you may not use this file except in compliance with the License.
2639 * You may obtain a copy of the License at
2640 *
2641 *   http://www.apache.org/licenses/LICENSE-2.0
2642 *
2643 * Unless required by applicable law or agreed to in writing, software
2644 * distributed under the License is distributed on an "AS IS" BASIS,
2645 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2646 * See the License for the specific language governing permissions and
2647 * limitations under the License.
2648 */class hI{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Br("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Br("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Br("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2649 * @license
2650 * Copyright 2020 Google LLC
2651 *
2652 * Licensed under the Apache License, Version 2.0 (the "License");
2653 * you may not use this file except in compliance with the License.
2654 * You may obtain a copy of the License at
2655 *
2656 *   http://www.apache.org/licenses/LICENSE-2.0
2657 *
2658 * Unless required by applicable law or agreed to in writing, software
2659 * distributed under the License is distributed on an "AS IS" BASIS,
2660 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2661 * See the License for the specific language governing permissions and
2662 * limitations under the License.
2663 */const zD={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-rec
2663aptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2664 * @license
2665 * Copyright 2020 Google LLC
2666 *
2667 * Licensed under the Apache License, Version 2.0 (the "License");
2668 * you may not use this file except in compliance with the License.
2669 * You may obtain a copy of the License at
2670 *
2671 *   http://www.apache.org/licenses/LICENSE-2.0
2672 *
2673 * Unless required by applicable law or agreed to in writing, software
2674 * distributed under the License is distributed on an "AS IS" BASIS,
2675 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2676 * See the License for the specific language governing permissions and
2677 * limitations under the License.
2678 */const FD=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$D=new Rl(3e4,6e4);function Mh(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function Ro(n,e,t,r,s={}){return mI(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=bl({...a,key:n.config.apiKey}).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const d={method:e,headers:l,...i};return DS()||(d.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&xl(n.emulatorConfig.host)&&(d.credentials="include"),hI.fetch()(await fI(n,n.config.apiHost,t,c),d)})}async function mI(n,e,t){n._canInitEmulator=!1;const r={...zD,...e};try{const s=new BD(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw vd(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw vd(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw vd(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw vd(n,"user-disabled",a);const m=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw uI(n,m,d);ss(n,m)}}catch(s){if(s instanceof ls)throw s;ss(n,"network-request-failed",{message:String(s)})}}async function pI(n,e,t,r,s={}){const i=await Ro(n,e,t,r,s);return"mfaPendingCredential"in i&&ss(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function fI(n,e,t,r){const s=`${e}${t}?${r}`,i=n,a=i.config.emulator?Qf(n.config,s):`${n.config.apiScheme}://${s}`;return FD.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(a).toString():a}class BD{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Mr(this.auth,"network-request-failed")),$D.get())})}}function vd(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=Mr(n,e,r);return s.customData._tokenResponse=t,s}/**
2679 * @license
2680 * Copyright 2020 Google LLC
2681 *
2682 * Licensed under the Apache License, Version 2.0 (the "License");
2683 * you may not use this file except in compliance with the License.
2684 * You may obtain a copy of the License at
2685 *
2686 *   http://www.apache.org/licenses/LICENSE-2.0
2687 *
2688 * Unless required by applicable law or agreed to in writing, software
2689 * distributed under the License is distributed on an "AS IS" BASIS,
2690 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2691 * See the License for the specific language governing permissions and
2692 * limitations under the License.
2693 */async function UD(n,e){return Ro(n,"POST","/v1/accounts:delete",e)}async function Eu(n,e){return Ro(n,"POST","/v1/accounts:lookup",e)}/**
2694 * @license
2695 * Copyright 2020 Google LLC
2696 *
2697 * Licensed under the Apache License, Version 2.0 (the "License");
2698 * you may not use this file except in compliance with the License.
2699 * You may obtain a copy of the License at
2700 *
2701 *   http://www.apache.org/licenses/LICENSE-2.0
2702 *
2703 * Unless required by applicable law or agreed to in writing, software
2704 * distributed under the License is distributed on an "AS IS" BASIS,
2705 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2706 * See the License for the specific language governing permissions and
2707 * limitations under the License.
2708 */function Oc(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function GD(n,e=!1){const t=Cn(n),r=await t.getIdToken(e),s=Zf(r);Ve(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Oc(zm(s.auth_time)),issuedAtTime:Oc(zm(s.iat)),expirationTime:Oc(zm(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function zm(n){return Number(n)*1e3}function Zf(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return qd("JWT malformed, contained fewer than 3 sections"),null;try{const s=h4(t);return s?JSON.parse(s):(qd("Failed to decode base64 JWT payload"),null)}catch(s){return qd("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Cb(n){const e=Zf(n);return Ve(e,"internal-error"),Ve(typeof e.exp<"u","internal-error"),Ve(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2709 * @license
2710 * Copyright 2020 Google LLC
2711 *
2712 * Licensed under the Apache License, Version 2.0 (the "License");
2713 * you may not use this file except in compliance with the License.
2714 * You may obtain a copy of the License at
2715 *
2716 *   http://www.apache.org/licenses/LICENSE-2.0
2717 *
2718 * Unless required by applicable law or agreed to in writing, software
2719 * distributed under the License is distributed on an "AS IS" BASIS,
2720 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2721 * See the License for the specific language governing permissions and
2722 * limitations under the License.
2723 */async function al(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof ls&&KD(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function KD({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
2724 * @license
2725 * Copyright 2020 Google LLC
2726 *
2727 * Licensed under the Apache License, Version 2.0 (the "License");
2728 * you may not use this file except in compliance with the License.
2729 * You may obtain a copy of the License at
2730 *
2731 *   http://www.apache.org/licenses/LICENSE-2.0
2732 *
2733 * Unless required by applicable law or agreed to in writing, software
2734 * distributed under the License is distributed on an "AS IS" BASIS,
2735 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2736 * See the License for the specific language governing permissions and
2737 * limitations under the License.
2738 */class HD{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2739 * @license
2740 * Copyright 2020 Google LLC
2741 *
2742 * Licensed under the Apache License, Version 2.0 (the "License");
2743 * you may not use this file except in compliance with the License.
2744 * You may obtain a copy of the License at
2745 *
2746 *   http://www.apache.org/licenses/LICENSE-2.0
2747 *
2748 * Unless required by applicable law or agreed to in writing, softw
2748are
2749 * distributed under the License is distributed on an "AS IS" BASIS,
2750 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2751 * See the License for the specific language governing permissions and
2752 * limitations under the License.
2753 */class t1{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Oc(this.lastLoginAt),this.creationTime=Oc(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2754 * @license
2755 * Copyright 2019 Google LLC
2756 *
2757 * Licensed under the Apache License, Version 2.0 (the "License");
2758 * you may not use this file except in compliance with the License.
2759 * You may obtain a copy of the License at
2760 *
2761 *   http://www.apache.org/licenses/LICENSE-2.0
2762 *
2763 * Unless required by applicable law or agreed to in writing, software
2764 * distributed under the License is distributed on an "AS IS" BASIS,
2765 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2766 * See the License for the specific language governing permissions and
2767 * limitations under the License.
2768 */async function Nu(n){var p;const e=n.auth,t=await n.getIdToken(),r=await al(n,Eu(e,{idToken:t}));Ve(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const i=(p=s.providerUserInfo)!=null&&p.length?gI(s.providerUserInfo):[],a=YD(n.providerData,i),c=n.isAnonymous,l=!(n.email&&s.passwordHash)&&!(a!=null&&a.length),d=c?l:!1,m={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new t1(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(n,m)}async function WD(n){const e=Cn(n);await Nu(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function YD(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function gI(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/**
2769 * @license
2770 * Copyright 2020 Google LLC
2771 *
2772 * Licensed under the Apache License, Version 2.0 (the "License");
2773 * you may not use this file except in compliance with the License.
2774 * You may obtain a copy of the License at
2775 *
2776 *   http://www.apache.org/licenses/LICENSE-2.0
2777 *
2778 * Unless required by applicable law or agreed to in writing, software
2779 * distributed under the License is distributed on an "AS IS" BASIS,
2780 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2781 * See the License for the specific language governing permissions and
2782 * limitations under the License.
2783 */async function QD(n,e){const t=await mI(n,{},async()=>{const r=bl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=await fI(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:c,body:r};return n.emulatorConfig&&xl(n.emulatorConfig.host)&&(l.credentials="include"),hI.fetch()(a,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function ZD(n,e){return Ro(n,"POST","/v2/accounts:revokeToken",Mh(n,e))}/**
2784 * @license
2785 * Copyright 2020 Google LLC
2786 *
2787 * Licensed under the Apache License, Version 2.0 (the "License");
2788 * you may not use this file except in compliance with the License.
2789 * You may obtain a copy of the License at
2790 *
2791 *   http://www.apache.org/licenses/LICENSE-2.0
2792 *
2793 * Unless required by applicable law or agreed to in writing, software
2794 * distributed under the License is distributed on an "AS IS" BASIS,
2795 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2796 * See the License for the specific language governing permissions and
2797 * limitations under the License.
2798 */class Fa{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ve(e.idToken,"internal-error"),Ve(typeof e.idToken<"u","internal-error"),Ve(typeof e.refreshToken<"u","internal-error");
2798const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Cb(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Ve(e.length!==0,"internal-error");const t=Cb(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(Ve(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await QD(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,a=new Fa;return r&&(Ve(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(Ve(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(Ve(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Fa,this.toJSON())}_performRefresh(){return Br("not implemented")}}/**
2799 * @license
2800 * Copyright 2020 Google LLC
2801 *
2802 * Licensed under the Apache License, Version 2.0 (the "License");
2803 * you may not use this file except in compliance with the License.
2804 * You may obtain a copy of the License at
2805 *
2806 *   http://www.apache.org/licenses/LICENSE-2.0
2807 *
2808 * Unless required by applicable law or agreed to in writing, software
2809 * distributed under the License is distributed on an "AS IS" BASIS,
2810 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2811 * See the License for the specific language governing permissions and
2812 * limitations under the License.
2813 */function ks(n,e){Ve(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class or{constructor({uid:e,auth:t,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new HD(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new t1(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await al(this,this.stsTokenManager.getToken(this.auth,e));return Ve(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return GD(this,e)}reload(){return WD(this)}_assign(e){this!==e&&(Ve(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new or({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){Ve(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Nu(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(ar(this.auth.app))return Promise.reject(Bs(this.auth));const e=await this.getIdToken();return await al(this,UD(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
2813nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const r=t.displayName??void 0,s=t.email??void 0,i=t.phoneNumber??void 0,a=t.photoURL??void 0,c=t.tenantId??void 0,l=t._redirectEventId??void 0,d=t.createdAt??void 0,m=t.lastLoginAt??void 0,{uid:p,emailVerified:f,isAnonymous:g,providerData:x,stsTokenManager:b}=t;Ve(p&&b,e,"internal-error");const I=Fa.fromJSON(this.name,b);Ve(typeof p=="string",e,"internal-error"),ks(r,e.name),ks(s,e.name),Ve(typeof f=="boolean",e,"internal-error"),Ve(typeof g=="boolean",e,"internal-error"),ks(i,e.name),ks(a,e.name),ks(c,e.name),ks(l,e.name),ks(d,e.name),ks(m,e.name);const N=new or({uid:p,auth:e,email:s,emailVerified:f,displayName:r,isAnonymous:g,photoURL:a,phoneNumber:i,tenantId:c,stsTokenManager:I,createdAt:d,lastLoginAt:m});return x&&Array.isArray(x)&&(N.providerData=x.map(V=>({...V}))),l&&(N._redirectEventId=l),N}static async _fromIdTokenResponse(e,t,r=!1){const s=new Fa;s.updateFromServerResponse(t);const i=new or({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Nu(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];Ve(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?gI(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),c=new Fa;c.updateFromIdToken(r);const l=new or({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new t1(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
2814 * @license
2815 * Copyright 2020 Google LLC
2816 *
2817 * Licensed under the Apache License, Version 2.0 (the "License");
2818 * you may not use this file except in compliance with the License.
2819 * You may obtain a copy of the License at
2820 *
2821 *   http://www.apache.org/licenses/LICENSE-2.0
2822 *
2823 * Unless required by applicable law or agreed to in writing, software
2824 * distributed under the License is distributed on an "AS IS" BASIS,
2825 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2826 * See the License for the specific language governing permissions and
2827 * limitations under the License.
2828 */const Mb=new Map;function Ur(n){is(n instanceof Function,"Expected a class definition");let e=Mb.get(n);return e?(is(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Mb.set(n,e),e)}/**
2829 * @license
2830 * Copyright 2019 Google LLC
2831 *
2832 * Licensed under the Apache License, Version 2.0 (the "License");
2833 * you may not use this file except in compliance with the License.
2834 * You may obtain a copy of the License at
2835 *
2836 *   http://www.apache.org/licenses/LICENSE-2.0
2837 *
2838 * Unless required by applicable law or agreed to in writing, software
2839 * distributed under the License is distributed on an "AS IS" BASIS,
2840 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2841 * See the License for the specific language governing permissions and
2842 * limitations under the License.
2843 */class yI{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}yI.type="NONE";const Pb=yI;/**
2844 * @license
2845 * Copyright 2019 Google LLC
2846 *
2847 * Licensed under the Apache License, Version 2.0 (the "License");
2848 * you may not use this file except in compliance with the License.
2849 * You may obtain a copy of the License at
2850 *
2851 *   http://www.apache.org/licenses/LICENSE-2.0
2852 *
2853 * Unless required by applicable law or agreed to in writing, softw
2853are
2854 * distributed under the License is distributed on an "AS IS" BASIS,
2855 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2856 * See the License for the specific language governing permissions and
2857 * limitations under the License.
2858 */function zd(n,e,t){return`firebase:${n}:${e}:${t}`}class $a{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=zd(this.userKey,s.apiKey,i),this.fullPersistenceKey=zd("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Eu(this.auth,{idToken:e}).catch(()=>{});return t?or._fromGetAccountInfoResponse(this.auth,t,e):null}return or._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new $a(Ur(Pb),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||Ur(Pb);const a=zd(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const m=await d._get(a);if(m){let p;if(typeof m=="string"){const f=await Eu(e,{idToken:m}).catch(()=>{});if(!f)break;p=await or._fromGetAccountInfoResponse(e,f,m)}else p=or._fromJSON(e,m);d!==i&&(c=p),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new $a(i,e,r):(i=l[0],c&&await i._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new $a(i,e,r))}}/**
2859 * @license
2860 * Copyright 2020 Google LLC
2861 *
2862 * Licensed under the Apache License, Version 2.0 (the "License");
2863 * you may not use this file except in compliance with the License.
2864 * You may obtain a copy of the License at
2865 *
2866 *   http://www.apache.org/licenses/LICENSE-2.0
2867 *
2868 * Unless required by applicable law or agreed to in writing, software
2869 * distributed under the License is distributed on an "AS IS" BASIS,
2870 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2871 * See the License for the specific language governing permissions and
2872 * limitations under the License.
2873 */function Rb(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(II(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(bI(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(kI(e))return"Blackberry";if(wI(e))return"Webos";if(xI(e))return"Safari";if((e.includes("chrome/")||vI(e))&&!e.includes("edge/"))return"Chrome";if(_I(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function bI(n=$t()){return/firefox\//i.test(n)}function xI(n=$t()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vI(n=$t()){return/crios\//i.test(n)}function II(n=$t()){return/iemobile/i.test(n)}function _I(n=$t()){return/android/i.test(n)}function kI(n=$t()){return/blackberry/i.test(n)}function wI(n=$t()){return/webos/i.test(n)}function Jf(n=$t()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function JD(n=$t()){var e;return Jf(n)&&!!((e=window.navigator)!=null&&e.standalone)}function XD(){return qS()&&document.documentMode===10}function jI(n=$t()){return Jf(n)||_I(n)||wI(n)||kI(n)||/windows phone/i.test(n)||II(n)}/**
2874 * @license
2875 * Copyright 2020 Google LLC
2876 *
2877 * Licensed under the Apache License, Version 2.0 (the "License");
2878 * you may not use this file except in compliance with the License.
2879 * You may obtain a copy of the License at
2880 *
2881 *   http://www.apache.org/licenses/LICENSE-2.0
2882 *
2883 * Unless required by applicable law or agreed to in writing, software
2884 * distributed under the License is distributed on an "AS IS" BASIS,
2885 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2886 * See the License for the specific language governing permissions and
2887 * limitations under the License.
2888 */function TI(n,e=[]){let t;switch(n){case"Browser":t=Rb($t());break;case"Worker":t=`${Rb($t())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${ko}/${r}`}/**
2889 * @license
2890 * Copyright 2022 Google LLC
2891 *
2892 * Licensed under the Apache License, Version 2.0 (the "License");
2893 * you may not use this file except in compliance with the License.
2894 * You may obtain a copy of the License at
2895 *
2896 *   http://www.apache.org/licenses/LICENSE-2.0
2897 *
2898 * Unless required by applicable law or agreed to in writing, software
2899 * distributed under the License is distributed on an "AS IS" BASIS,
2900 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2901 * See the License for the specific language governing permissions and
2902 * limitations under the License.
2903 */class eV{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,c)=>{try{const l=e(i);a(l)}catch(l){c(l)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
2904 * @license
2905 * Copyright 2023 Google LLC
2906 *
2907 * Licensed under the Apache License, Version 2.0 (the "License");
2908 * you may not use this file except in compliance with the License.
2909 * You may obtain a copy of the License at
2910 *
2911 *   http://www.apache.org/licenses/LICENSE-2.0
2912 *
2913 * Unless required by applicable law or agreed to in writing, software
2914 * distributed under the License is distributed on an "AS IS" BASIS,
2915 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2916 * See the License for the specific language governing permissions and
2917 * limitations under the License.
2918 */async function tV(n,e={}){return Ro(n,"GET","/v2/passwordPolicy",Mh(n,e))}/**
2919 * @license
2920 * Copyright 2023 Google LLC
2921 *
2922 * Licensed under the Apache License, Version 2.0 (the "License");
2923 * you may not use this file except in compliance with the License.
2924 * You may obtain a copy of the License at
2925 *
2926 *   http://www.apache.org/licenses/LICENSE-2.0
2927 *
2928 * Unless required by applicable law or agreed to in writing, software
2929 * distributed under the License is distributed on an "AS IS" BASIS,
2930 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2931 * See the License for the specific language governing permissions and
2932 * limitations under the License.
2933 */const nV=6;class rV{constructor(e){var r;const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??nV,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&
2933(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
2934 * @license
2935 * Copyright 2020 Google LLC
2936 *
2937 * Licensed under the Apache License, Version 2.0 (the "License");
2938 * you may not use this file except in compliance with the License.
2939 * You may obtain a copy of the License at
2940 *
2941 *   http://www.apache.org/licenses/LICENSE-2.0
2942 *
2943 * Unless required by applicable law or agreed to in writing, software
2944 * distributed under the License is distributed on an "AS IS" BASIS,
2945 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2946 * See the License for the specific language governing permissions and
2947 * limitations under the License.
2948 */class sV{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ob(this),this.idTokenSubscription=new Ob(this),this.beforeStateQueue=new eV(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=dI,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Ur(t)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await $a.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Eu(this,{idToken:e}),r=await or._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if(ar(this.app)){const a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let r=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(i=this.redirectUser)==null?void 0:i._redirectEventId,c=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);
2948if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(a){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Ve(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Nu(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=qD()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(ar(this.app))return Promise.reject(Bs(this));const t=e?Cn(e):null;return t&&Ve(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Ve(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return ar(this.app)?Promise.reject(Bs(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return ar(this.app)?Promise.reject(Bs(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ur(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await tV(this),t=new rV(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new yl("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await ZD(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Ur(e)||this._popupRedirectResolver;Ve(t,this,"argument-error"),this.redirectPersistenceManager=await $a.create(this,[Ur(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)==null?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((t=this.currentUser)==null?void 0:t.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ve(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,s);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Ve(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=TI(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;if(ar(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((t=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:t.getToken());return e!=null&&e.error&&DD(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function Ph(n){return Cn(n)}class Ob{constructor(e){this.auth=e,this.observer=null,this.addObserver=GS(t=>this.observer=t)}get next(){return Ve(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
2949 * @license
2950 * Copyright 2020 Google LLC
2951 *
2952 * Licensed under the Apache License, Version 2.0 (the "License");
2953 * you may not use this file except in compliance with the License.
2954 * You may obtain a copy of the License at
2955 *
2956 *   http://www.apache.org/licenses/LICENSE-2.0
2957 *
2958 * Unless required by applicable law or agreed to in writing, software
2959 * distributed under the License is distributed on an "AS IS" BASIS,
2960 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2961 * See the License for the specific language governing permissions and
2962 * limitations under the License.
2963 */let Xf={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function iV(n){Xf=n}function aV(n){return Xf.loadJS(n)}function oV(){return Xf.gapiScript}function cV(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/**
2964 * @license
2965 * Copyright 2020 Google LLC
2966 *
2967 * Licensed under the Apache License, Version 2.0 (the "License");
2968 * you may not use this file except in compliance with the License.
2969 * You may obtain a copy of the License at
2970 *
2971 *   http://www.apache.org/licenses/LICENSE-2.0
2972 *
2973 * Unless required by applicable law or agreed to in writing, software
2974 * distributed under the License is distributed on an "AS IS" BASIS,
2975 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2976 * See the License for the specific language governing permissions and
2977 * limitations under the License.
2978 */function lV(n,e){const t=M1(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Jr(i,e??{}))return s;ss(s,"already-initialized")}return t.initialize({options:e})}function dV(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(Ur);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function uV(n,e,t){const r=Ph(n);
2978Ve(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=EI(e),{host:a,port:c}=hV(e),l=c===null?"":`:${c}`,d={url:`${i}//${a}${l}/`},m=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Ve(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ve(Jr(d,r.config.emulator)&&Jr(m,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=m,r.settings.appVerificationDisabledForTesting=!0,xl(a)?v4(`${i}//${a}${l}`):mV()}function EI(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function hV(n){const e=EI(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:Db(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:Db(a)}}}function Db(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function mV(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
2979 * @license
2980 * Copyright 2020 Google LLC
2981 *
2982 * Licensed under the Apache License, Version 2.0 (the "License");
2983 * you may not use this file except in compliance with the License.
2984 * You may obtain a copy of the License at
2985 *
2986 *   http://www.apache.org/licenses/LICENSE-2.0
2987 *
2988 * Unless required by applicable law or agreed to in writing, software
2989 * distributed under the License is distributed on an "AS IS" BASIS,
2990 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2991 * See the License for the specific language governing permissions and
2992 * limitations under the License.
2993 */class NI{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Br("not implemented")}_getIdTokenResponse(e){return Br("not implemented")}_linkToIdToken(e,t){return Br("not implemented")}_getReauthenticationResolver(e){return Br("not implemented")}}/**
2994 * @license
2995 * Copyright 2020 Google LLC
2996 *
2997 * Licensed under the Apache License, Version 2.0 (the "License");
2998 * you may not use this file except in compliance with the License.
2999 * You may obtain a copy of the License at
3000 *
3001 *   http://www.apache.org/licenses/LICENSE-2.0
3002 *
3003 * Unless required by applicable law or agreed to in writing, software
3004 * distributed under the License is distributed on an "AS IS" BASIS,
3005 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3006 * See the License for the specific language governing permissions and
3007 * limitations under the License.
3008 */async function Ba(n,e){return pI(n,"POST","/v1/accounts:signInWithIdp",Mh(n,e))}/**
3009 * @license
3010 * Copyright 2020 Google LLC
3011 *
3012 * Licensed under the Apache License, Version 2.0 (the "License");
3013 * you may not use this file except in compliance with the License.
3014 * You may obtain a copy of the License at
3015 *
3016 *   http://www.apache.org/licenses/LICENSE-2.0
3017 *
3018 * Unless required by applicable law or agreed to in writing, software
3019 * distributed under the License is distributed on an "AS IS" BASIS,
3020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3021 * See the License for the specific language governing permissions and
3022 * limitations under the License.
3023 */const pV="http://localhost";class Wi extends NI{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Wi(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&
3023(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):ss("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=t;if(!r||!s)return null;const a=new Wi(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return Ba(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Ba(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ba(e,t)}buildRequest(){const e={requestUri:pV,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=bl(t)}return e}}/**
3024 * @license
3025 * Copyright 2020 Google LLC
3026 *
3027 * Licensed under the Apache License, Version 2.0 (the "License");
3028 * you may not use this file except in compliance with the License.
3029 * You may obtain a copy of the License at
3030 *
3031 *   http://www.apache.org/licenses/LICENSE-2.0
3032 *
3033 * Unless required by applicable law or agreed to in writing, software
3034 * distributed under the License is distributed on an "AS IS" BASIS,
3035 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3036 * See the License for the specific language governing permissions and
3037 * limitations under the License.
3038 */class SI{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
3039 * @license
3040 * Copyright 2019 Google LLC
3041 *
3042 * Licensed under the Apache License, Version 2.0 (the "License");
3043 * you may not use this file except in compliance with the License.
3044 * You may obtain a copy of the License at
3045 *
3046 *   http://www.apache.org/licenses/LICENSE-2.0
3047 *
3048 * Unless required by applicable law or agreed to in writing, software
3049 * distributed under the License is distributed on an "AS IS" BASIS,
3050 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3051 * See the License for the specific language governing permissions and
3052 * limitations under the License.
3053 */class Ol extends SI{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
3054 * @license
3055 * Copyright 2020 Google LLC
3056 *
3057 * Licensed under the Apache License, Version 2.0 (the "License");
3058 * you may not use this file except in compliance with the License.
3059 * You may obtain a copy of the License at
3060 *
3061 *   http://www.apache.org/licenses/LICENSE-2.0
3062 *
3063 * Unless required by applicable law or agreed to in writing, software
3064 * distributed under the License is distributed on an "AS IS" BASIS,
3065 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3066 * See the License for the specific language governing permissions and
3067 * limitations under the License.
3068 */class Ss extends Ol{constructor(){super("facebook.com")}static credential(e){return Wi._fromParams({providerId:Ss.PROVIDER_ID,signInMethod:Ss.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ss.credentialFromTaggedObject(e)}static credentialFromError(e){return Ss.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Ss.credential(e.oauthAccessToken)}catch{return null}}}Ss.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ss.PROVIDER_ID="facebook.com";/**
3069 * @license
3070 * Copyright 2020 Google LLC
3071 *
3072 * Licensed under the Apache License, Version 2.0 (the "License");
3073 * you may not use this file except in compliance with the License.
3074 * You may obtain a copy of the License at
3075 *
3076 *   http://www.apache.org/licenses/LICENSE-2.0
3077 *
3078 * Unless required by applicable law or agreed to in writing, software
3079 * distributed under the License is distributed on an "AS IS" BASIS,
3080 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3081 * See the License for the specific language governing permissions and
3082 * limitations under the License.
3083 */class As extends Ol{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Wi._fromParams({providerId:As.PROVIDER_ID,signInMethod:As.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return As.credentialFromTaggedObject(e)}static credentialFromError(e){return As.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return As.credential(t,r)}catch{return null}}}As.GOOGLE_SIGN_IN_METHOD="google.com";As.PROVIDER_ID="google.com";/**
3084 * @license
3085 * Copyright 2020 Google LLC
3086 *
3087 * Licensed under the Apache License, Version 2.0 (the "License");
3088 * you may not use this file except in compliance with the License.
3089 * You may obtain a copy of the License at
3090 *
3091 *   http://www.apache.org/licenses/LICENSE-2.0
3092 *
3093 * Unless required by applicable law or agreed to in writing, software
3094 * distributed under the License is distributed on an "AS IS" BASIS,
3095 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3096 * See the License for the specific language governing permissions and
3097 * limitations under the License.
3098 */class Cs extends Ol{constructor(){super("github.com")}static credential(e){return Wi._fromParams({providerId:Cs.PROVIDER_ID,signInMethod:Cs.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Cs.credentialFromTaggedObject(e)}static credentialFromError(e){return Cs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Cs.credential(e.oauthAccessToken)}catch{return null}}}Cs.GITHUB_SIGN_IN_METHOD="github.com";Cs.PROVIDER_ID="github.com";/**
3099 * @license
3100 * Copyright 2020 Google LLC
3101 *
3102 * Licensed under the Apache License, Version 2.0 (the "License");
3103 * you may not use this file except in compliance with the License.
3104 * You may obtain a copy of the License at
3105 *
3106 *   http://www.apache.org/licenses/LICENSE-2.0
3107 *
3108 * Unless required by applicable law or agreed to in writing, software
3109 * distributed under the License is distributed on an "AS IS" BASIS,
3110 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3111 * See the License for the specific language governing permissions and
3112 * limitations under the License.
3113 */class Ms extends Ol{constructor(){super("twitter.com")}static credential(e,t){return Wi._fromParams({providerId:Ms.PROVIDER_ID,signInMethod:Ms.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Ms.credentialFromTaggedObject(e)}static credentialFromError(e){return Ms.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Ms.credential(t,r)}catch{return null}}}Ms.TWITTER_SIGN_IN_METHOD="twitter.com";Ms.PROVIDER_ID="twitter.com";/**
3114 * @license
3115 * Copyright 2020 Google LLC
3116 *
3117 * Licensed under the Apache License, Version 2.0 (the "License");
3118 * you may not use this file except in compliance with the License.
3119 * You may obtain a copy of the License at
3120 *
3121 *   http://www.apache.org/licenses/LICENSE-2.0
3122 *
3123 * Unless required by applicable law or agreed to in writing, software
3124 * distributed under the License is distributed on an "AS IS" BASIS,
3125 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3126 * See the License for the specific language governing permissions and
3127 * limitations under the License.
3128 */async function fV(n,e){return pI(n,"POST","/v1/accounts:signUp",Mh(n,e))}/**
3129 * @license
3130 * Copyright 2020 Google LLC
3131 *
3132 * Licensed under the Apache License, Version 2.0 (the "License");
3133 * you may not use this file except in compliance with the License.
3134 * You may obtain a copy of the License at
3135 *
3136 *   http://www.apache.org/licenses/LICENSE-2.0
3137 *
3138 * Unless required by applicable law or agreed to in writing, software
3139 * distributed under the License is distributed on an "AS IS" BASIS,
3140 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3141 * See the License for the specific language governing permissions and
3142 * limitations under the License.
3143 */class ni{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await or._fromIdTokenResponse(e,r,s),a=Vb(r);return new ni({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Vb(r);return new ni({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Vb(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
3144 * @license
3145 * Copyright 2020 Google LLC
3146 *
3147 * Licensed under the Apache License, Version 2.0 (the "License");
3148 * you may not use this file except in compliance with the License.
3149 * You may obtain a copy of the License at
3150 *
3151 *   http://www.apache.org/licenses/LICENSE-2.0
3152 *
3153 * Unless required by applicable law or agreed to in writing, software
3154 * distributed under the License is distributed on an "AS IS" BASIS,
3155 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3156 * See the License for the specific language governing permissions and
3157 * limitations under the License.
3158 */async function gV(n){var s;if(ar(n.app))return Promise.reject(Bs(n));const e=Ph(n);if(await e._initializationPromise,(s=e.currentUser)!=null&&s.isAnonymous)return new ni({user:e.currentUser,providerId:null,operationType:"signIn"});const t=await fV(e,{returnSecureToken:!0}),r=await ni._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(r.user),r}/**
3159 * @license
3160 * Copyright 2020 Google LLC
3161 *
3162 * Licensed under the Apache License, Version 2.0 (the "License");
3163 * you may not use this file except in compliance with the License.
3164 * You may obtain a copy of the License at
3165 *
3166 *   http://www.apache.org/licenses/LICENSE-2.0
3167 *
3168 * Unless required by applicable law or agreed to in writing, software
3169 * distributed under the License is distributed on an "AS IS" BASIS,
3170 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3171 * See the License for the specific language governing permissions and
3172 * limitations under the License.
3173 */class Su extends ls{constructor(e,t,r,s){super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Su.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new Su(e,t,r,s)}}function AI(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Su._fromErrorAndOperation(n,i,e,r):i})}async function yV(n,e,t=!1){const r=await al(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return ni._forOperation(n,"link",r)}/**
3174 * @license
3175 * Copyright 2019 Google LLC
3176 *
3177 * Licensed under the Apache License, Version 2.0 (the "License");
3178 * you may not use this file except in compliance with the License.
3179 * You may obtain a copy of the License at
3180 *
3181 *   http://www.apache.org/licenses/LICENSE-2.0
3182 *
3183 * Unless required by applicable law or agreed to in writing, software
3184 * distributed under the License is distributed on an "AS IS" BASIS,
3185 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3186 * See the License for the specific language governing permissions and
3187 * limitations under the License.
3188 */async function bV(n,e,t=!1){const{auth:r}=n;if(ar(r.app))return Promise.reject(Bs(r));const s="reauthenticate";try{const i=await al(n,AI(r,s,e,n),t);Ve(i.idToken,r,"internal-error");const a=Zf(i.idToken);Ve(a,r,"internal-error");const{sub:c}=a;return Ve(n.uid===c,r,"user-mismatch"),ni._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&ss(r,"user-mismatch"),i}}/**
3189 * @license
3190 * Copyright 2020 Google LLC
3191 *
3192 * Licensed under the Apache License, Version 2.0 (the "License");
3193 * you may not use this file except in compliance with the License.
3194 * You may obtain a copy of the License at
3195 *
3196 *   http://www.apache.org/licenses/LICENSE-2.0
3197 *
3198 * Unless required by applicable law or agreed to in writing, software
3199 * distributed under the License is distributed on an "AS IS" BASIS,
3200 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3201 * See the License for the specific language governing permissions and
3202 * limitations under the License.
3203 */async function xV(n,e,t=!1){if(ar(n.app))return Promise.reject(Bs(n));const r="signIn",s=await AI(n,r,e),i=await ni._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}function vV(n,e,t,r){return Cn(n).onIdTokenChanged(e,t,r)}function IV(n,e,t){return Cn(n).beforeAuthStateChanged(e,t)}function _V(n,e,t,r){return Cn(n).onAuthStateChanged(e,t,r)}const Au="__sak";/**
3204 * @license
3205 * Copyright 2019 Google LLC
3206 *
3207 * Licensed under the Apache License, Version 2.0 (the "License");
3208 * you may not use this file except in compliance with the License.
3209 * You may obtain a copy of the License at
3210 *
3211 *   http://www.apache.org/licenses/LICENSE-2.0
3212 *
3213 * Unless required by applicable law or agreed to in writing, software
3214 * distributed under the License is distributed on an "AS IS" BASIS,
3215 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3216 * See the License for the specific language governing permissions and
3217 * limitations under the License.
3218 */class CI{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Au,"1"),this.storage.removeItem(Au),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
3219 * @license
3220 * Copyright 2020 Google LLC
3221 *
3222 * Licensed under the Apache License, Version 2.0 (the "License");
3223 * you may not use this file except in compliance with the License.
3224 * You may obtain a copy of the License at
3225 *
3226 *   http://www.apache.org/licenses/LICENSE-2.0
3227 *
3228 * Unless required by applicable law or agreed to in writing, software
3229 * distributed under the License is distributed on an "AS IS" BASIS,
3230 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3231 * See the License for the specific language governing permissions and
3232 * limitations under the License.
3233 */const kV=1e3,wV=10;class MI extends CI{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=jI(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);XD()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,wV):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},kV)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
3233ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}MI.type="LOCAL";const jV=MI;/**
3234 * @license
3235 * Copyright 2020 Google LLC
3236 *
3237 * Licensed under the Apache License, Version 2.0 (the "License");
3238 * you may not use this file except in compliance with the License.
3239 * You may obtain a copy of the License at
3240 *
3241 *   http://www.apache.org/licenses/LICENSE-2.0
3242 *
3243 * Unless required by applicable law or agreed to in writing, software
3244 * distributed under the License is distributed on an "AS IS" BASIS,
3245 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3246 * See the License for the specific language governing permissions and
3247 * limitations under the License.
3248 */class PI extends CI{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}PI.type="SESSION";const RI=PI;/**
3249 * @license
3250 * Copyright 2019 Google LLC
3251 *
3252 * Licensed under the Apache License, Version 2.0 (the "License");
3253 * you may not use this file except in compliance with the License.
3254 * You may obtain a copy of the License at
3255 *
3256 *   http://www.apache.org/licenses/LICENSE-2.0
3257 *
3258 * Unless required by applicable law or agreed to in writing, software
3259 * distributed under the License is distributed on an "AS IS" BASIS,
3260 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3261 * See the License for the specific language governing permissions and
3262 * limitations under the License.
3263 */function TV(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
3264 * @license
3265 * Copyright 2019 Google LLC
3266 *
3267 * Licensed under the Apache License, Version 2.0 (the "License");
3268 * you may not use this file except in compliance with the License.
3269 * You may obtain a copy of the License at
3270 *
3271 *   http://www.apache.org/licenses/LICENSE-2.0
3272 *
3273 * Unless required by applicable law or agreed to in writing, software
3274 * distributed under the License is distributed on an "AS IS" BASIS,
3275 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3276 * See the License for the specific language governing permissions and
3277 * limitations under the License.
3278 */class Rh{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new Rh(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,a=this.handlersMap[s];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(t.origin,i)),l=await TV(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Rh.receivers=[];/**
3279 * @license
3280 * Copyright 2020 Google LLC
3281 *
3282 * Licensed under the Apache License, Version 2.0 (the "License");
3283 * you may not use this file except in compliance with the License.
3284 * You may obtain a copy of the License at
3285 *
3286 *   http://www.apache.org/licenses/LICENSE-2.0
3287 *
3288 * Unless required by applicable law or agreed to in writing, software
3289 * distributed under the License is distributed on an "AS IS" BASIS,
3290 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3291 * See the License for the specific language governing permissions and
3292 * limitations under the License.
3293 */function eg(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
3294 * @license
3295 * Copyright 2019 Google LLC
3296 *
3297 * Licensed under the Apache License, Version 2.0 (the "License");
3298 * you may not use this file except in compliance with the License.
3299 * You may obtain a copy of the License at
3300 *
3301 *   http://www.apache.org/licenses/LICENSE-2.0
3302 *
3303 * Unless required by applicable law or agreed to in writing, software
3304 * distributed under the License is distributed on an "AS IS" BASIS,
3305 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3306 * See the License for the specific language governing permissions and
3307 * limitations under the License.
3308 */class EV{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,a;return new Promise((c,l)=>{const d=eg("",20);s.port1.start();const m=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(p){const f=p;if(f.data.eventId===d)switch(f.data.status){case"ack":clearTimeout(m),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(f.data.response);break;default:clearTimeout(m),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
3309 * @license
3310 * Copyright 2020 Google LLC
3311 *
3312 * Licensed under the Apache License, Version 2.0 (the "License");
3313 * you may not use this file except in compliance with the License.
3314 * You may obtain a copy of the License at
3315 *
3316 *   http://www.apache.org/licenses/LICENSE-2.0
3317 *
3318 * Unless required by applicable law or agreed to in writing, software
3319 * distributed under the License is distributed on an "AS IS" BASIS,
3320 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3321 * See the License for the specific language governing permissions and
3322 * limitations under the License.
3323 */function Pr(){return window}function NV(n){Pr().location.href=n}/**
3324 * @license
3325 * Copyright 2020 Google LLC.
3326 *
3327 * Licensed under the Apache License, Version 2.0 (the "License");
3328 * you may not use this file except in compliance with the License.
3329 * You may obtain a copy of the License at
3330 *
3331 *   http://www.apache.org/licenses/LICENSE-2.0
3332 *
3333 * Unless required by applicable law or agreed to in writing, software
3334 * distributed under the License is distributed on an "AS IS" BASIS,
3335 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3336 * See the License for the specific language governing permissions and
3337 * limitations under the License.
3338 */function OI(){return typeof Pr().WorkerGlobalScope<"u"&&typeof Pr().importScripts=="function"}async function SV(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function AV(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)==null?void 0:n.controller)||null}function CV(){return OI()?self:null}/**
3339 * @license
3340 * Copyright 2019 Google LLC
3341 *
3342 * Licensed under the Apache License, Version 2.0 (the "License");
3343 * you may not use this file except in compliance with the License.
3344 * You may obtain a copy of the License at
3345 *
3346 *   http://www.apache.org/licenses/LICENSE-2.0
3347 *
3348 * Unless required by applicable law or agreed to in writing, software
3349 * distributed under the License is distributed on an "AS IS" BASIS,
3350 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3351 * See the License for the specific language governing permissions and
3352 * limitations under the License.
3353 */const DI="firebaseLocalStorageDb",MV=1,Cu="firebaseLocalStorage",VI="fbase_key";class Dl{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Oh(n,e){return n.transaction([Cu],e?"readwrite":"readonly").objectStore(Cu)}function PV(){const n=indexedDB.deleteDatabase(DI);return new Dl(n).toPromise()}function LI(){const n=indexedDB.open(DI,MV);return new Promise((e,t)=>
3353{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Cu,{keyPath:VI})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Cu)?e(r):(r.close(),await PV(),e(await LI()))})})}async function Lb(n,e,t){const r=Oh(n,!0).put({[VI]:e,value:t});return new Dl(r).toPromise()}async function RV(n,e){const t=Oh(n,!1).get(e),r=await new Dl(t).toPromise();return r===void 0?null:r.value}function qb(n,e){const t=Oh(n,!0).delete(e);return new Dl(t).toPromise()}const OV=800,DV=3;class qI{constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=LI(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>DV)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return OI()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Rh._getInstance(CV()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var t,r;if(this.activeServiceWorker=await SV(),!this.activeServiceWorker)return;this.sender=new EV(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(t=e[0])!=null&&t.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||AV()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await Lb(e,Au,"1"),await qb(e,Au)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Lb(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>RV(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>qb(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Oh(s,!1).getAll();return new Dl(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),OV)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
3353ject.keys(this.listeners).length===0&&this.stopPolling()}}qI.type="LOCAL";const VV=qI;new Rl(3e4,6e4);/**
3354 * @license
3355 * Copyright 2021 Google LLC
3356 *
3357 * Licensed under the Apache License, Version 2.0 (the "License");
3358 * you may not use this file except in compliance with the License.
3359 * You may obtain a copy of the License at
3360 *
3361 *   http://www.apache.org/licenses/LICENSE-2.0
3362 *
3363 * Unless required by applicable law or agreed to in writing, software
3364 * distributed under the License is distributed on an "AS IS" BASIS,
3365 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3366 * See the License for the specific language governing permissions and
3367 * limitations under the License.
3368 */function LV(n,e){return e?Ur(e):(Ve(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
3369 * @license
3370 * Copyright 2019 Google LLC
3371 *
3372 * Licensed under the Apache License, Version 2.0 (the "License");
3373 * you may not use this file except in compliance with the License.
3374 * You may obtain a copy of the License at
3375 *
3376 *   http://www.apache.org/licenses/LICENSE-2.0
3377 *
3378 * Unless required by applicable law or agreed to in writing, software
3379 * distributed under the License is distributed on an "AS IS" BASIS,
3380 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3381 * See the License for the specific language governing permissions and
3382 * limitations under the License.
3383 */class tg extends NI{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ba(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ba(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ba(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function qV(n){return xV(n.auth,new tg(n),n.bypassAuthState)}function zV(n){const{auth:e,user:t}=n;return Ve(t,e,"internal-error"),bV(t,new tg(n),n.bypassAuthState)}async function FV(n){const{auth:e,user:t}=n;return Ve(t,e,"internal-error"),yV(t,new tg(n),n.bypassAuthState)}/**
3384 * @license
3385 * Copyright 2020 Google LLC
3386 *
3387 * Licensed under the Apache License, Version 2.0 (the "License");
3388 * you may not use this file except in compliance with the License.
3389 * You may obtain a copy of the License at
3390 *
3391 *   http://www.apache.org/licenses/LICENSE-2.0
3392 *
3393 * Unless required by applicable law or agreed to in writing, software
3394 * distributed under the License is distributed on an "AS IS" BASIS,
3395 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3396 * See the License for the specific language governing permissions and
3397 * limitations under the License.
3398 */class zI{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:a,type:c}=e;if(a){this.reject(a);return}const l={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return qV;case"linkViaPopup":case"linkViaRedirect":return FV;case"reauthViaPopup":case"reauthViaRedirect":return zV;default:ss(this.auth,"internal-error")}}resolve(e){is(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){is(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
3399 * @license
3400 * Copyright 2020 Google LLC
3401 *
3402 * Licensed under the Apache License, Version 2.0 (the "License");
3403 * you may not use this file except in compliance with the License.
3404 * You may obtain a copy of the License at
3405 *
3406 *   http://www.apache.org/licenses/LICENSE-2.0
3407 *
3408 * Unless required by applicable law or agreed to in writing, software
3409 * distributed under the License is distributed on an "AS IS" BASIS,
3410 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3411 * See the License for the specific language governing permissions and
3412 * limitations under the License.
3413 */const $V=new Rl(2e3,1e4);class Da extends zI{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Da.currentPopupAction&&Da.currentPopupAction.cancel(),Da.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ve(e,this.auth,"internal-error"),e}async onExecution(){is(this.filter.length===1,"Popup operations only handle one event");const e=eg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Mr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(Mr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Da.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if((r=(t=this.authWindow)==null?void 0:t.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Mr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,$V.get())};e()}}Da.currentPopupAction=null;/**
3414 * @license
3415 * Copyright 2020 Google LLC
3416 *
3417 * Licensed under the Apache License, Version 2.0 (the "License");
3418 * you may not use this file except in compliance with the License.
3419 * You may obtain a copy of the License at
3420 *
3421 *   http://www.apache.org/licenses/LICENSE-2.0
3422 *
3423 * Unless required by applicable law or agreed to in writing, software
3424 * distributed under the License is distributed on an "AS IS" BASIS,
3425 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3426 * See the License for the specific language governing permissions and
3427 * limitations under the License.
3428 */const BV="pendingRedirect",Fd=new Map;class UV extends zI{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Fd.get(this.auth._key());if(!e){try{const r=await GV(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Fd.set(this.auth._key(),e)}return this.bypassAuthState||Fd.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function GV(n,e){const t=WV(e),r=HV(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function KV(n,e){Fd.set(n._key(),e)}function HV(n){return Ur(n._redirectPersistence)}function WV(n){return zd(BV,n.config.apiKey,n.name)}async function YV(n,e,t=!1){if(ar(n.app))return Promise.reject(Bs(n));const r=Ph(n),s=LV(r,e),a=await new UV(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
3429 * @license
3430 * Copyright 2020 Google LLC
3431 *
3432 * Licensed under the Apache License, Version 2.0 (the "License");
3433 * you may not use this file except in compliance with the License.
3434 * You may obtain a copy of the License at
3435 *
3436 *   http://www.apache.org/licenses/LICENSE-2.0
3437 *
3438 * Unless required by applicable law or agreed to in writing, softw
3438are
3439 * distributed under the License is distributed on an "AS IS" BASIS,
3440 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3441 * See the License for the specific language governing permissions and
3442 * limitations under the License.
3443 */const QV=600*1e3;class ZV{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!JV(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!FI(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";t.onError(Mr(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=QV&&this.cachedEventUids.clear(),this.cachedEventUids.has(zb(e))}saveEventToCache(e){this.cachedEventUids.add(zb(e)),this.lastProcessedEventTime=Date.now()}}function zb(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function FI({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function JV(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return FI(n);default:return!1}}/**
3444 * @license
3445 * Copyright 2020 Google LLC
3446 *
3447 * Licensed under the Apache License, Version 2.0 (the "License");
3448 * you may not use this file except in compliance with the License.
3449 * You may obtain a copy of the License at
3450 *
3451 *   http://www.apache.org/licenses/LICENSE-2.0
3452 *
3453 * Unless required by applicable law or agreed to in writing, software
3454 * distributed under the License is distributed on an "AS IS" BASIS,
3455 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3456 * See the License for the specific language governing permissions and
3457 * limitations under the License.
3458 */async function XV(n,e={}){return Ro(n,"GET","/v1/projects",e)}/**
3459 * @license
3460 * Copyright 2020 Google LLC
3461 *
3462 * Licensed under the Apache License, Version 2.0 (the "License");
3463 * you may not use this file except in compliance with the License.
3464 * You may obtain a copy of the License at
3465 *
3466 *   http://www.apache.org/licenses/LICENSE-2.0
3467 *
3468 * Unless required by applicable law or agreed to in writing, software
3469 * distributed under the License is distributed on an "AS IS" BASIS,
3470 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3471 * See the License for the specific language governing permissions and
3472 * limitations under the License.
3473 */const eL=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,tL=/^https?/;async function nL(n){if(n.config.emulator)return;const{authorizedDomains:e}=await XV(n);for(const t of e)try{if(rL(t))return}catch{}ss(n,"unauthorized-domain")}function rL(n){const e=e1(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!tL.test(t))return!1;if(eL.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3474 * @license
3475 * Copyright 2020 Google LLC.
3476 *
3477 * Licensed under the Apache License, Version 2.0 (the "License");
3478 * you may not use this file except in compliance with the License.
3479 * You may obtain a copy of the License at
3480 *
3481 *   http://www.apache.org/licenses/LICENSE-2.0
3482 *
3483 * Unless required by applicable law or agreed to in writing, softw
3483are
3484 * distributed under the License is distributed on an "AS IS" BASIS,
3485 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3486 * See the License for the specific language governing permissions and
3487 * limitations under the License.
3488 */const sL=new Rl(3e4,6e4);function Fb(){const n=Pr().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function iL(n){return new Promise((e,t)=>{var s,i,a;function r(){Fb(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Fb(),t(Mr(n,"network-request-failed"))},timeout:sL.get()})}if((i=(s=Pr().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((a=Pr().gapi)!=null&&a.load)r();else{const c=cV("iframefcb");return Pr()[c]=()=>{gapi.load?r():t(Mr(n,"network-request-failed"))},aV(`${oV()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw $d=null,e})}let $d=null;function aL(n){return $d=$d||iL(n),$d}/**
3489 * @license
3490 * Copyright 2020 Google LLC.
3491 *
3492 * Licensed under the Apache License, Version 2.0 (the "License");
3493 * you may not use this file except in compliance with the License.
3494 * You may obtain a copy of the License at
3495 *
3496 *   http://www.apache.org/licenses/LICENSE-2.0
3497 *
3498 * Unless required by applicable law or agreed to in writing, software
3499 * distributed under the License is distributed on an "AS IS" BASIS,
3500 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3501 * See the License for the specific language governing permissions and
3502 * limitations under the License.
3503 */const oL=new Rl(5e3,15e3),cL="__/auth/iframe",lL="emulator/auth/iframe",dL={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},uL=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function hL(n){const e=n.config;Ve(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Qf(e,lL):`https://${n.config.authDomain}/${cL}`,r={apiKey:e.apiKey,appName:n.name,v:ko},s=uL.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${bl(r).slice(1)}`}async function mL(n){const e=await aL(n),t=Pr().gapi;return Ve(t,n,"internal-error"),e.open({where:document.body,url:hL(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:dL,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=Mr(n,"network-request-failed"),c=Pr().setTimeout(()=>{i(a)},oL.get());function l(){Pr().clearTimeout(c),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
3504 * @license
3505 * Copyright 2020 Google LLC.
3506 *
3507 * Licensed under the Apache License, Version 2.0 (the "License");
3508 * you may not use this file except in compliance with the License.
3509 * You may obtain a copy of the License at
3510 *
3511 *   http://www.apache.org/licenses/LICENSE-2.0
3512 *
3513 * Unless required by applicable law or agreed to in writing, software
3514 * distributed under the License is distributed on an "AS IS" BASIS,
3515 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3516 * See the License for the specific language governing permissions and
3517 * limitations under the License.
3518 */const pL={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},fL=500,gL=600,yL="_blank",bL="http://localhost";class $b{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function xL(n,e,t,r=fL,s=gL){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l={...pL,width:r.toString(),height:s.toString(),top:i,left:a},d=$t().toLowerCase();t&&(c=vI(d)?yL:t),bI(d)&&(e=e||bL,l.scrollbars="yes");const m=Object.entries(l).reduce((f,[g,x])=>`${f}${g}=${x},`,"");if(JD(d)&&c!=="_self")return vL(e||"",c),new $b(null);const p=window.open(e||"",c,m);Ve(p,n,"popup-blocked");try{p.focus()}catch{}return new $b(p)}function vL(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
3518r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
3519 * @license
3520 * Copyright 2021 Google LLC
3521 *
3522 * Licensed under the Apache License, Version 2.0 (the "License");
3523 * you may not use this file except in compliance with the License.
3524 * You may obtain a copy of the License at
3525 *
3526 *   http://www.apache.org/licenses/LICENSE-2.0
3527 *
3528 * Unless required by applicable law or agreed to in writing, software
3529 * distributed under the License is distributed on an "AS IS" BASIS,
3530 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3531 * See the License for the specific language governing permissions and
3532 * limitations under the License.
3533 */const IL="__/auth/handler",_L="emulator/auth/handler",kL=encodeURIComponent("fac");async function Bb(n,e,t,r,s,i){Ve(n.config.authDomain,n,"auth-domain-config-required"),Ve(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:ko,eventId:s};if(e instanceof SI){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",US(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[m,p]of Object.entries({}))a[m]=p}if(e instanceof Ol){const m=e.getScopes().filter(p=>p!=="");m.length>0&&(a.scopes=m.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const m of Object.keys(c))c[m]===void 0&&delete c[m];const l=await n._getAppCheckToken(),d=l?`#${kL}=${encodeURIComponent(l)}`:"";return`${wL(n)}?${bl(c).slice(1)}${d}`}function wL({config:n}){return n.emulator?Qf(n,_L):`https://${n.authDomain}/${IL}`}/**
3534 * @license
3535 * Copyright 2020 Google LLC
3536 *
3537 * Licensed under the Apache License, Version 2.0 (the "License");
3538 * you may not use this file except in compliance with the License.
3539 * You may obtain a copy of the License at
3540 *
3541 *   http://www.apache.org/licenses/LICENSE-2.0
3542 *
3543 * Unless required by applicable law or agreed to in writing, software
3544 * distributed under the License is distributed on an "AS IS" BASIS,
3545 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3546 * See the License for the specific language governing permissions and
3547 * limitations under the License.
3548 */const Fm="webStorageSupport";class jL{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=RI,this._completeRedirectFn=YV,this._overrideRedirectResult=KV}async _openPopup(e,t,r,s){var a;is((a=this.eventManagers[e._key()])==null?void 0:a.manager,"_initialize() not called before _openPopup()");const i=await Bb(e,t,r,e1(),s);return xL(e,i,eg())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await Bb(e,t,r,e1(),s);return NV(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(is(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await mL(e),r=new ZV(e);return t.register("authEvent",s=>(Ve(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Fm,{type:Fm},s=>{var a;const i=(a=s==null?void 0:s[0])==null?void 0:a[Fm];i!==void 0&&t(!!i),ss(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=nL(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return jI()||xI()||Jf()}}const TL=jL;var Ub="@firebase/auth",Gb="1.13.3";/**
3549 * @license
3550 * Copyright 2020 Google LLC
3551 *
3552 * Licensed under the Apache License, Version 2.0 (the "License");
3553 * you may not use this file except in compliance with the License.
3554 * You may obtain a copy of the License at
3555 *
3556 *   http://www.apache.org/licenses/LICENSE-2.0
3557 *
3558 * Unless required by applicable law or agreed to in writing, softw
3558are
3559 * distributed under the License is distributed on an "AS IS" BASIS,
3560 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3561 * See the License for the specific language governing permissions and
3562 * limitations under the License.
3563 */class EL{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Ve(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3564 * @license
3565 * Copyright 2020 Google LLC
3566 *
3567 * Licensed under the Apache License, Version 2.0 (the "License");
3568 * you may not use this file except in compliance with the License.
3569 * You may obtain a copy of the License at
3570 *
3571 *   http://www.apache.org/licenses/LICENSE-2.0
3572 *
3573 * Unless required by applicable law or agreed to in writing, software
3574 * distributed under the License is distributed on an "AS IS" BASIS,
3575 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3576 * See the License for the specific language governing permissions and
3577 * limitations under the License.
3578 */function NL(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function SL(n){Ya(new Li("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;Ve(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:TI(n)},d=new sV(r,s,i,l);return dV(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),Ya(new Li("auth-internal",e=>{const t=Ph(e.getProvider("auth").getImmediate());return(r=>new EL(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ls(Ub,Gb,NL(n)),Ls(Ub,Gb,"esm2020")}/**
3579 * @license
3580 * Copyright 2021 Google LLC
3581 *
3582 * Licensed under the Apache License, Version 2.0 (the "License");
3583 * you may not use this file except in compliance with the License.
3584 * You may obtain a copy of the License at
3585 *
3586 *   http://www.apache.org/licenses/LICENSE-2.0
3587 *
3588 * Unless required by applicable law or agreed to in writing, software
3589 * distributed under the License is distributed on an "AS IS" BASIS,
3590 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3591 * See the License for the specific language governing permissions and
3592 * limitations under the License.
3593 */const AL=300,CL=f4("authIdTokenMaxAge")||AL;let Kb=null;const ML=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>CL)return;const s=t==null?void 0:t.token;Kb!==s&&(Kb=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function PL(n=KA()){const e=M1(n,"auth");if(e.isInitialized())return e.getImmediate();const t=lV(n,{popupRedirectResolver:TL,persistence:[VV,jV,RI]}),r=f4("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=ML(i.toString());IV(t,a,()=>a(t.currentUser)),vV(t,c=>a(c))}}const s=PS("auth");return s&&uV(t,`http://${s}`),t}function RL(){var n;return((n=document.getElementsByTagName("head"))==null?void 0:n[0])??document}iV({loadJS(n){return new Promise((e,t)=>
3593{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=Mr("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",RL().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});SL("Browser");const OL={VITE_FIREBASE_API_KEY:"AIzaSyCNbLqYLAo9CmNlqxTMiLwfyjZXkpAQ8RY",VITE_FIREBASE_APP_ID:"1:229114731683:web:e031c034bfa50ae9ce7316",VITE_FIREBASE_AUTH_DOMAIN:"shirat-learning.firebaseapp.com",VITE_FIREBASE_MESSAGING_SENDER_ID:"229114731683",VITE_FIREBASE_PROJECT_ID:"shirat-learning",VITE_FIREBASE_STORAGE_BUCKET:"shirat-learning.firebasestorage.app"},ja=OL,$I={apiKey:ja.VITE_FIREBASE_API_KEY,authDomain:ja.VITE_FIREBASE_AUTH_DOMAIN,projectId:ja.VITE_FIREBASE_PROJECT_ID,storageBucket:ja.VITE_FIREBASE_STORAGE_BUCKET,messagingSenderId:ja.VITE_FIREBASE_MESSAGING_SENDER_ID,appId:ja.VITE_FIREBASE_APP_ID},BI=typeof window<"u"&&!0;let Mu=null,$m=null;function DL(){return $m||(Mu??(Mu=P1($I)),$m=vD(Mu,{localCache:ED({tabManager:CD()})})),$m}let We=!1;async function VL(n=4e3){if(!BI)return!1;try{await Promise.race([UI(),new Promise((e,t)=>setTimeout(()=>t(new Error("timeout")),n))]),We=!0}catch{We=!1}return We}let Hb=null;function UI(){return BI?(Hb??(Hb=new Promise((n,e)=>{Mu??(Mu=P1($I));const t=PL(Mu);_V(t,r=>{r&&n()}
3593),gV(t).catch(e)})),Hb):Promise.reject(new Error("firestore-disabled"))}async function Gn(){return await UI(),DL()}async function po(n){return(await Pl(Eo(await Gn(),n))).docs.map(t=>t.data())}async function LL(n,e,t){if(t.length===0)return[];const r=await Gn(),s=[];for(let a=0;a<t.length;a+=30)s.push(t.slice(a,a+30));const i=new Map;for(const a of s){const c=await Pl(Sh(Eo(r,n),Kf(e,"array-contains-any",a)));for(const l of c.docs)i.set(l.id,l.data())}return[...i.values()]}async function GI(n,e,t){if(t.length===0)return[];const r=await Gn(),s=[];for(let a=0;a<t.length;a+=30)s.push(t.slice(a,a+30));const i=[];for(const a of s){const c=await Pl(Sh(Eo(r,n),Kf(e,"in",a)));for(const l of c.docs)i.push(l.data())}return i}async function ng(n,e,t){return(await Pl(Sh(Eo(await Gn(),n),Kf(e,"==",t)))).docs.map(s=>s.data())}async function Dh(n,e){const t=await PD(ra(await Gn(),n,e));return t.exists()?t.data():null}async function Rr(n,e,t){await Ch(ra(await Gn(),n,e),t)}async function qL(n,e){await RD(ra(await Gn(),n,e))}async function Bm(n){return(await Pl(Sh(Eo(await Gn(),n),wD(1)))).empty}async function Um(n,e){const t=await Gn();return aI(Eo(t,n),r=>e(r.docs.map(s=>s.data())))}async function zL(n,e,t){const r=await Gn();return aI(ra(r,n,e),s=>t(s.exists()?s.data():null))}async function FL(n,e,t,r){await Ch(ra(await Gn(),n,e),{[t]:r3(r)},{merge:!0})}async function $L(n,e,t,r){r.length!==0&&await Ch(ra(await Gn(),n,e),{[t]:r3(...r)},{merge:!0})}async function BL(n,e,t,r){await Ch(ra(await Gn(),n,e),{[t]:vP(r)},{merge:!0})}async function Vh(n){We?await Rr("notifications",n.id,n):JI(n)}function rg(n,e,t){Rr(n,e,t).catch(r=>console.error("[firestore-mirror]",n,e,r))}async function UL(){if(We){if(await Bm("practiceTracks"))for(const n of Nx)await Rr("practiceTracks",n.id,n);if(await Bm("announcements"))for(const n of Sx)await Rr("announcements",n.id,n);if(await Bm("lessons"))for(const n of Ex)await Rr("lessons",n.id,n);await XL(),await QI()}}const Pe=(n,e=150)=>new Promise(t=>setTimeout(()=>t(structuredClone(n)),e)),KI="shirat-mock-sessions";function n1(){try{return JSON.parse(localStorage.getItem(KI)??"[]")}catch{return[]}}const HI="shirat-mock-authored";function Dc(){try{const n=localStorage.getItem(HI);if(n)return JSON.parse(n)}catch{}return structuredClone(G_)}function GL(n){localStorage.setItem(HI,JSON.stringify(n))}const Bd="shirat-mock-assets",KL=[{id:"asset-seed-1",organizationId:"org-shirat",kind:"audio",title:"צליל פסנתר — דו אמצעי",fileName:"C4.mp3",mimeType:"audio/mpeg",sizeBytes:78718,url:"https://tonejs.github.io/audio/salamander/C4.mp3",createdBy:"u-amit",createdAt:new Date(Date.now()-3*864e5).toISOString(),tags:["פסנתר","דוגמה"]}];function Id(){try{const n=localStorage.getItem(Bd);if(n)return JSON.parse(n)}catch{}return structuredClone(KL)}const Gr={list:n=>{const e=Array.isArray(n)?{kinds:n}:n??{};return Pe(Id().filter(t=>!e.kinds||e.kinds.includes(t.kind)).filter(t=>!e.groupId||(t.groupIds??[]).includes(e.groupId)).sort((t,r)=>r.createdAt.localeCompare(t.createdAt)))},save:n=>{const e=Id(),t=e.findIndex(r=>
3593r.id===n.id);return t>=0?e[t]=n:e.unshift(n),localStorage.setItem(Bd,JSON.stringify(e)),Pe(n)},setGroups:(n,e)=>{const t=Id(),r=t.find(s=>s.id===n);return r?(r.groupIds=e,localStorage.setItem(Bd,JSON.stringify(t)),Pe(r)):Pe(null)},delete:async n=>Dc().some(t=>(t.draft.assetIds??[]).includes(n)||t.versions.some(r=>(r.activity.assetIds??[]).includes(n)))?Pe({deleted:!1,referenced:!0}):(localStorage.setItem(Bd,JSON.stringify(Id().filter(t=>t.id!==n))),Pe({deleted:!0,referenced:!1}))},Ua={listAuthored:()=>Pe([...Dc()].sort((n,e)=>e.updatedAt.localeCompare(n.updatedAt))),getAuthored:async n=>Pe(Dc().find(e=>e.id===n)??null),saveAuthored:n=>{const e=Dc(),t=e.findIndex(r=>r.id===n.id);return t>=0?e[t]=n:e.unshift(n),GL(e),Pe(n)}},gt={listSessions:n=>Pe([...n1(),...Tx].filter(e=>e.musicianId===n).sort((e,t)=>t.startedAt.localeCompare(e.startedAt))),listActivities:()=>Pe([...U_,...Dc().map(rS).filter(n=>n!==null)]),saveSession:n=>{const e=n1();return e.unshift(n),localStorage.setItem(KI,JSON.stringify(e)),Pe(n)}},Gm="shirat-mock-placement",Km="shirat-mock-teacher-signals";function Wt(n,e){try{const t=localStorage.getItem(n);return t?JSON.parse(t):structuredClone(e)}catch{return structuredClone(e)}}const sg={get:n=>Pe(Wt(Gm,{})[n]??null),save:(n,e)=>{const t=Wt(Gm,{});return t[n]=e,localStorage.setItem(Gm,JSON.stringify(t)),Pe(void 0)}},r1={list:n=>Pe(Wt(Km,{})[n]??[]),save:(n,e)=>{const t=Wt(Km,{});return t[n]=e,localStorage.setItem(Km,JSON.stringify(t)),Pe(void 0)}},ca={listObjectiveProgress:async n=>{const e=[...n1(),...Tx].filter(s=>s.musicianId===n),t=await sg.get(n),r=await r1.list(n);return Z_({sessions:e,...t?{baselines:t}:{},overrides:r,now:new Date})}},WI="shirat-mock-notifications-read";async function Wb(n){if(We){const e=await Dh("notifRead",n);return new Set((e==null?void 0:e.ids)??[])}return new Set(Wt(`${WI}:${n}`,[]))}async function HL(n,e){localStorage.setItem(`${WI}:${n}`,JSON.stringify(e)),We&&await $L("notifRead",n,"ids",e)}const ol={list:async n=>{const e=await Wb(n);return(We?await ng("notifications","userId",n):[...Wt(a1,[]),...K_].filter(r=>r.userId===n)).map(r=>e.has(r.id)?{...r,read:!0}:r).sort((r,s)=>s.createdAt.localeCompare(r.createdAt))},markAllRead:async n=>{const e=await ol.list(n),t=await Wb(n);e.forEach(r=>t.add(r.id)),await HL(n,[...t])}},Vl={listStudents:()=>Pe(H_)},YI="shirat-mock-users";let cl=null,fo=null;function Vr(){return cl||Wt(YI,[])}function ll(n){localStorage.setItem(YI,JSON.stringify(n)),We&&(cl=n)}function dl(n){We&&rg("users",n.id,n)}function s1(n){We&&rg("registrations",n.id,n)}async function QI(){We&&(cl=await po("users"),fo=await po("registrations"))}const go=["#7c5cff","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"],WL={createMusician:n=>{const e=Vr(),t={id:`u-${crypto.randomUUID().slice(0,8)}`,organizationId:"org-public",displayName:n.displayName.trim(),roles:["musician"],instruments:[n.instrument],avatarColor:go[e.length%go.length]??"#7c5cff"};return e.push(t),ll(e),dl(t),Pe(t)},findById:n=>Vr().find(e=>e.id===n)??null},YL={importToGroup:async(n,e)=>{We&&await pt.get();const t=Vr(),r=new Set,s=[],i=[];for(const a of e){const c=a.trim();if(!c)continue;const l=c.toLowerCase();if(r.has(l))continue;r.add(l);const d={id:`u-${crypto.randomUUID().slice(0,8)}`,organizationId:"org-public",displayName:c,roles:["musician"],instruments:["voice"],avatarColor:go[(t.length+s.length)%go.length]??"#7c5cff"};s.push(d),t.push(d),i.push({groupId:n,userId:d.id})}ll(t),Du(i,[]);for(const a of s)dl(a);return Pe({created:s.length},50)}},ZI="shirat-mock-registrations";function Lh(){return fo||Wt(ZI,[])}function i1(n){localStorage.setItem(ZI,JSON.stringify(n)),We&&(fo=n)}async function bc(){return We&&(fo=await po("registrations")),Lh()}function QL(n){const e=Vr(),t=`u-${crypto.randomUUID().slice(0,8)}`,r=wS(n,t,e.length);return e.push(r),ll(e),dl(r),Du([{groupId:n.groupId,userId:t}],[]),JI({id:crypto.randomUUID(),userId:t,kind:"system",title:"ברוכים הבאים לשירת הלויים! 🎵",body:"החשבון שלך אושר. אפשר להתחיל ללמוד ולתרגל — נתחיל במבחן מיון קצר.",createdAt:new Date().toISOString(),read:!1}),t}const Ts={submit:async n=>{const e=await bc(),t={...n,id:`reg-${crypto.randomUUID().slice(0,8)}`,status:"pending",submittedAt:new Date().toISOString()};return e.unshift(t),i1(e),s1(t),t},list:async()=>[...await bc()].sort((n,e)=>e.submittedAt.localeCompare(n.submittedAt)),listByStatus:async n=>(await bc()).filter(e=>e.status===n),get:async n=>(await bc()).find(e=>e.id===n)??null,approve:async(n,e)=>{We&&await pt.get();const t=Lh(),r=t.find(s=>
3593s.id===n);return r?(r.status!=="approved"&&(r.userId=QL(r),r.status="approved",r.reviewedAt=new Date().toISOString(),r.reviewedBy=e,i1(t),s1(r)),Pe(r,50)):Pe(null)},reject:(n,e,t)=>Hm(n,"rejected",e,t),requestChanges:(n,e,t)=>Hm(n,"changes_requested",e,t),approveMany:async(n,e)=>{let t=0;for(const r of n){const s=await Ts.approve(r,e);(s==null?void 0:s.status)==="approved"&&t++}return t},rejectMany:async(n,e)=>{for(const t of n)await Hm(t,"rejected",e);return n.length}};function Hm(n,e,t,r){const s=Lh(),i=s.find(a=>a.id===n);return i?(i.status=e,i.reviewedAt=new Date().toISOString(),i.reviewedBy=t,r&&(i.reviewerNote=r),i1(s),s1(i),Pe(i,50)):Pe(null)}const ZL={loginWithCredentials:async(n,e)=>{const t=n.trim().toLowerCase();We&&(await QI(),await bc());const r=[...xo,...Ax,...Vr()].find(i=>{var a;return((a=i.email)==null?void 0:a.toLowerCase())===t});if(r){const i=aS(r.id);return Pe((i?e===i:e==="1234")?{ok:!0,userId:r.id}:{ok:!1,reason:"invalid"})}const s=Lh().find(i=>i.email.toLowerCase()===t);return!s||s.password!==e?Pe({ok:!1,reason:"invalid"}):s.status==="rejected"?Pe({ok:!1,reason:"rejected"}):s.status!=="approved"||!s.userId?Pe({ok:!1,reason:"pending"}):Pe({ok:!0,userId:s.userId})}},Wm="shirat-mock-active-path",Pu={getActivePathId:n=>Pe(Wt(Wm,{})[n]??null),setActivePath:(n,e)=>{const t=Wt(Wm,{});return e===null?delete t[n]:t[n]=e,localStorage.setItem(Wm,JSON.stringify(t)),Pe(void 0)}},Ym="shirat-mock-goals",JL={weeklyMinutesTarget:120,focusCategories:[]},Ru={get:n=>Pe(Wt(Ym,{})[n]??JL),save:(n,e)=>{const t=Wt(Ym,{});return t[n]=e,localStorage.setItem(Ym,JSON.stringify(t)),Pe(e)}},a1="shirat-mock-notifications";function JI(n){const e=Wt(a1,[]);e.unshift(n),localStorage.setItem(a1,JSON.stringify(e))}const XI="shirat-mock-lessons";function Qm(){return Wt(XI,Ex)}const Ud="lessons",Zm=(n,e)=>e.date.localeCompare(n.date),Oo={list:async n=>(We?await po(Ud):Qm()).filter(t=>!n||t.teacherId===n).sort(Zm),listForGroups:async n=>We?(await GI(Ud,"groupId",n)).sort(Zm):Pe(Qm().filter(e=>n.includes(e.groupId)).sort(Zm)),save:async(n,e)=>{if(We)await Rr(Ud,n.id,n);else{const t=Qm();t.unshift(n),localStorage.setItem(XI,JSON.stringify(t))}for(const t of e)await Vh({id:crypto.randomUUID(),userId:t,kind:"assignment",title:`שיעורי בית — ${n.groupName}`,body:n.note,createdAt:n.date,read:!1});return n}},o1="shirat-mock-practice-tracks";function Ta(){return Wt(o1,Nx)}const _i="practiceTracks",Ea=(n,e)=>e.updatedAt.localeCompare(n.updatedAt),yo={list:async()=>We?(await po(_i)).sort(Ea):Pe([...Ta()].sort(Ea)),listForGroups:async n=>We?(await LL(_i,"groupIds",n)).sort(Ea):Pe(Ta().filter(e=>e.groupIds.some(t=>n.includes(t))).sort(Ea)),listPublished:async()=>We?(await ng(_i,"publishedToFreePractice",!0)).sort(Ea):Pe(Ta().filter(n=>n.publishedToFreePractice).sort(Ea)),get:async n=>We?Dh(_i,n):Pe(Ta().find(e=>e.id===n)??null),save:async(n,e=[])=>{if(We)await Rr(_i,n.id,n);else{const t=Ta(),r=t.findIndex(s=>s.id===n.id);r>=0?t[r]=n:t.unshift(n),localStorage.setItem(o1,JSON.stringify(t))}for(const t of e)await Vh({id:crypto.randomUUID(),userId:t,kind:"assignment",title:`תרגול חדש בקורס — ${n.title}`,body:n.title,createdAt:n.updatedAt,read:!1});return n},delete:async n=>{We?await qL(_i,n):localStorage.setItem(o1,JSON.stringify(Ta().filter(e=>e.id!==n)))}},e7="shirat-mock-announcements";function Jm(){return Wt(e7,Sx)}const Xm="announcements",ep=(n,e)=>e.createdAt.localeCompare(n.createdAt),Ou={list:async n=>{const e=We?await po(Xm):Jm();return Pe(e.filter(t=>!n||t.teacherId===n).sort(ep),0)},listForGroups:async n=>We?(await GI(Xm,"groupId",n)).sort(ep):Pe(Jm().filter(e=>n.includes(e.groupId)).sort(ep)),save:async(n,e)=>{if(We)await Rr(Xm,n.id,n);else{const t=Jm();t.unshift(n),localStorage.setItem(e7,JSON.stringify(t))}for(const t of e)await Vh({id:crypto.randomUUID(),userId:t,kind:"teacher_note",title:`הודעה — ${n.groupName}`,body:n.title?`${n.title}: ${n.body}`:n.body,createdAt:n.createdAt,read:!1});return n}},ig="shirat-mock-academic",Zn={coll:"meta",id:"academic"};let Yi=null;async function XL(){if(!We)return;let n=await Dh(Zn.coll,Zn.id);n||(n=structuredClone(Xd),await Rr(Zn.coll,Zn.id,n)),Yi=n}
3593function xr(){if(Yi)return structuredClone(Yi);try{const n=localStorage.getItem(ig);if(n){const e=JSON.parse(n);if(e.source===Xd.source)return e}}catch{}return structuredClone(Xd)}function Na(n){const e={...n,updatedAt:new Date().toISOString()};return localStorage.setItem(ig,JSON.stringify(e)),We&&(Yi=e,rg(Zn.coll,Zn.id,e)),e}function Du(n,e){const t=xr(),r=(a,c)=>a.some(l=>l.groupId===c.groupId&&l.userId===c.userId),s=n.filter(a=>!r(t.memberships,a)),i={...t,memberships:[...t.memberships.filter(a=>!e.some(c=>c.groupId===a.groupId&&c.userId===a.userId)),...s]};if(localStorage.setItem(ig,JSON.stringify(i)),We){Yi=i;for(const a of s)FL(Zn.coll,Zn.id,"memberships",a).catch(c=>console.error("[membership-add]",c));for(const a of e)BL(Zn.coll,Zn.id,"memberships",a).catch(c=>console.error("[membership-remove]",c))}}function t7(n,e){return n.groups.filter(r=>r.parentGroupId===e).map(r=>r.id).flatMap(r=>[r,...t7(n,r)])}const pt={get:async()=>{if(We){const n=await Dh(Zn.coll,Zn.id);return n&&(Yi=n),n??xr()}return Pe(xr())},replace:n=>Pe(Na(n),50),saveGroup:n=>{const e=xr(),t=e.groups.findIndex(r=>
3593r.id===n.id);return t>=0?e.groups[t]=n:e.groups.push(n),Pe(Na(e),50)},deleteGroup:n=>{const e=xr(),t=new Set([n,...t7(e,n)]),r={...e,groups:e.groups.filter(s=>!t.has(s.id)),schedule:e.schedule.filter(s=>!t.has(s.groupId)),memberships:e.memberships.filter(s=>!t.has(s.groupId))};return Pe(Na(r),50)},addMembership:n=>(Du([n],[]),Pe(xr(),50)),removeMembership:n=>(Du([],[n]),Pe(xr(),50)),createTeacher:n=>{const e=xr(),t=Vr(),r=`u-${crypto.randomUUID().slice(0,8)}`,s=n.canAuthor?["teacher","content_author"]:["teacher"],i={id:r,organizationId:"org-shirat",displayName:n.name.trim(),roles:s,instruments:[],avatarColor:go[t.length%go.length]??"#f59e0b",...n.email?{email:n.email}:{},...n.phone?{phone:n.phone}:{}};t.push(i),ll(t),dl(i);const a={id:`t-${crypto.randomUUID().slice(0,8)}`,name:n.name.trim(),subjects:n.subjects,userId:r,active:!0,...n.email?{email:n.email}:{},...n.phone?{phone:n.phone}:{},...n.canAuthor?{canAuthor:!0}:{}};return e.teachers.push(a),Na(e),Pe(a,50)},saveTeacher:n=>{const e=xr(),t=e.teachers.findIndex(r=>
3593r.id===n.id);if(t>=0?e.teachers[t]=n:e.teachers.push(n),n.userId){const r=Vr(),s=r.find(i=>i.id===n.userId);s&&(s.displayName=n.name,s.roles=n.canAuthor?["teacher","content_author"]:["teacher"],ll(r),dl(s))}return Pe(Na(e),50)},assignTeacherToGroups:(n,e)=>{const t=xr(),r=new Set(e);for(const s of t.groups){const i=s.teacherIds.includes(n);r.has(s.id)&&!i?s.teacherIds.push(n):!r.has(s.id)&&i&&(s.teacherIds=s.teacherIds.filter(a=>a!==n))}return Pe(Na(t),50)}},tp="shirat-mock-recommendations",c1="recommendations",n7={latestFor:async n=>(We?await ng(c1,"musicianId",n):Wt(tp,[]).filter(t=>t.musicianId===n)).sort((t,r)=>r.createdAt.localeCompare(t.createdAt))[0]??null,save:async n=>{if(We)await Rr(c1,n.id,n);else{const e=Wt(tp,[]);e.unshift(n),localStorage.setItem(tp,JSON.stringify(e))}return await Vh({id:crypto.randomUUID(),userId:n.musicianId,kind:"assignment",title:`${n.teacherName} ממליץ/ה על תרגול`,body:n.note,createdAt:n.createdAt,read:!1}),n}};let Yb=!1;async function eq(n){if(!We||Yb)return;Yb=!0;const e=[];e.push(await zL("meta","academic",r=>{r&&r.source===Xd.source&&(Yi=r),n([["academic"],["group-lessons"],["teacher-students"],["students"]])})),e.push(await Um("users",r=>{cl=r,n([["students"],["teacher-students"]])})),e.push(await Um("registrations",r=>{fo=r,n([["registrations"]])}));const t=[["announcements",[["announcements"]]],[Ud,[["lessons"],["group-lessons"]]],[_i,[["practice-tracks"]]],[c1,[["teacher-recommendation"]]],["notifications",[["notifications"]]],["notifRead",[["notifications"]]]];for(const[r,s]of t)e.push(await Um(r,()=>n(s)))}const Be=ul()($u(n=>({session:null,signInAs:e=>{const t=[...xo,...Ax,...Vr()].find(s=>s.id===e);if(!t)throw new Error(`Unknown persona: ${e}`);const r=t.roles[0];if(!r)throw new Error(`Persona has no roles: ${e}`);n({session:{user:t,activeRole:r}})},signInAsGuest:()=>n({session:{user:{id:`guest-${crypto.randomUUID()}`,organizationId:"org-shirat",displayName:"אורח",roles:["musician"],instruments:[],avatarColor:"#1f6a81",isGuest:!0},activeRole:"musician"}}),signOut:()=>n({session:null})}),{name:"shirat-auth"})),r7=ul()($u((n,e)=>({done:[],complete:t=>n({done:[...new Set([...e().done,t])]})}),{name:"shirat-pwreset"}));function qh(n){return!!n.mustChangePassword&&!r7.getState().done.includes(n.id)}function Yr(n){switch(n){case"musician":return"/student";case"teacher":return"/teacher";case"admin":return"/admin";case"content_author":return"/studio"}}const tq={app:{name:"שירת הלויים",tagline:"בית הספר הגבוה למוסיקה",welcomeTitle:"ברוכים הבאים למערכת הלמידה של שירת הלויים"},errorBoundary:{title:"משהו השתבש",body:"אירעה תקלה זמנית במסך הזה. שאר הנתונים שלכם נשמרים — אפשר לרענן או לחזור לדף הבית ולהמשיך.",reload:"רענון",home:"לדף הבית"},common:{loading:"טוען…",save:"שמירה",cancel:"ביטול",edit:"עריכה",delete:"מחיקה",create:"יצירה",search:"חיפוש",comingSoon:"בקרוב",placeholderNote:"מסך זה ייבנה באבן הדרך הבאה. הניווט, ההרשאות והמבנה כבר פעילים.",minutes:"דקות",viewAll:"הצגת הכול",signOut:"התנתקות",toggleTheme:"החלפת ערכת נושא",viewAs:"תצוגה כ־",openMenu:"פתיחת תפריט",closeMenu:"סגירת תפריט"},auth:{title:"ברוכים הבאים",subtitle:"בחרו דמות כדי להיכנס (מצב פיתוח — נתוני דוגמה)",signInAs:"כניסה בתור",roleMusician:"תלמיד/ה",roleTeacher:"מורה",roleAdmin:"מנהל/ת",mockBadge:"סביבת פיתוח · נתוני דוגמה",joinCta:"חדשים כאן? הצטרפו כתלמיד/ה עצמאי/ת",joinTitle:"נעים להכיר! 🎵",joinSubtitle:"כמה פרטים ומתחילים לנגן",joinName:"איך קוראים לך?",joinInstrument:"הכלי העיקרי שלך",joinSubmit:"יאללה, מתחילים",backToLogin:"חזרה לכניסה",instruments:["פסנתר","גיטרה","שירה","תופים","הפקה מוסיקלית","כלי נשיפה","כלי מיתר","חלילית"],loginTitle:"כניסה למערכת",loginSubtitle:"תלמידי שירת הלויים — התחברו עם המייל והסיסמה",emailLabel:"אימייל",passwordLabel:"סיסמה",loginSubmit:"כניסה",loginInvalid:"אימייל או סיסמה שגויים",loginPending:"ההרשמה שלך התקבלה וממתינה לאישור ההנהלה. נעדכן אותך כשהחשבון יופעל.",loginRejected:"ההרשמה לא אושרה. לפרטים ניתן לפנות למזכירות שירת הלויים.",registerCta:"עדיין לא נרשמתם? הרשמה לתלמידים חדשים",guestCta:"כניסה כאורח — תרגול חופשי",guestHint:"רוצים רק להתנסות? היכנסו ותרגלו בלי הרשמה",orDivider:"או",devPickerToggle:"כניסת פיתוח (בחירת דמות)",changePwTitle:"בחירת סיסמה חדשה",changePwSubtitle:"זו הכניסה הראשונה שלכם. יש להחליף את הסיסמה הראשונית (1234) בסיסמה אישית.",newPassword:"סיסמה חדשה",confirmPassword:"אימות סיסמה",changePwSubmit:"שמירת סיסמה וכניסה",changePwTooShort:"הסיסמה חייבת להכיל לפחות 6 תווים",changePwSameAsInitial:"יש לבחור סיסמה השונה מהסיסמה הראשונית",changePwMismatch:"הסיסמאות אינן תואמות"},register:{title:"הרשמה לשירת הלויים",subtitle:"בית הספר הגבוה למוסיקה — הרשמת תלמידים חדשים",stepOf:"שלב {n} מתוך {total}",steps:["פרטים אישיים","רקע מוסיקלי","שיוך אקדמי","סיכום ושליחה"],firstName:"שם פרטי",lastName:"שם משפחה",hebrewFullName:"שם מלא בעברית",phone:"טלפון נייד",phonePlaceholder:"05X-XXXXXXX",email:"אימייל",password:"סיסמה",confirmPassword:"אימות סיסמה",primaryInstrument:"כלי נגינה עיקרי",secondaryInstrument:"כלי נגינה נוסף (רשות)",musicalBackgroun
3593d:"רקע מוסיקלי",musicalBackgroundPlaceholder:"ספרו בקצרה על הניסיון המוסיקלי שלכם",yearsExperience:"שנות ניסיון",previousStudies:"לימודי מוסיקה קודמים (רשות)",none:"ללא",genderTrack:"מסלול",trackMen:"מסלול גברים",trackWomen:"מסלול נשים",learningTrack:"קבוצת לימוד",pickGroup:"בחרו את הקבוצה המתאימה",selectGroupFirst:"בחרו קודם מסלול",city:"עיר מגורים",dateOfBirth:"תאריך לידה (רשות)",notes:"הערות (רשות)",reviewTitle:"בדקו את הפרטים לפני השליחה",next:"המשך",back:"חזרה",submit:"שליחת ההרשמה",submitting:"שולח…",required:"שדה חובה",invalidEmail:"כתובת אימייל לא תקינה",invalidPhone:"מספר טלפון לא תקין",passwordShort:"הסיסמה חייבת להכיל לפחות 6 תווים",passwordsMismatch:"הסיסמאות אינן תואמות",successTitle:"ההרשמה התקבלה! 🎵",successBody:"ההרשמה שלך התקבלה. החשבון יופעל לאחר אישור ההנהלה — נעדכן אותך במייל ובטלפון.",successCta:"חזרה לדף הכניסה",haveAccount:"כבר יש לכם חשבון? כניסה"},approvals:{title:"אישורי תלמידים",subtitle:"הרשמות חדשות הממתינות לאישור ההנהלה",search:"חיפוש לפי שם, מייל או טלפון",filterStatus:"סינון לפי סטטוס",sortBy:"מיון",sortNewest:"מהחדש לישן",sortOldest:"מהישן לחדש",sortName:"לפי שם",all:"הכול",colName:"שם",colPhone:"טלפון",colEmail:"אימייל",colInstrument:"כלי",colTrack:"מסלול",colGroup:"קבוצה",colDate:"תאריך הרשמה",colStatus:"סטטוס",statusPending:"ממתין לאישור",statusApproved:"אושר",statusRejected:"נדחה",statusChanges:"נדרשים תיקונים",approve:"אישור",reject:"דחייה",requestChanges:"בקשת תיקונים",viewDetails:"פרטים מלאים",approveSelected:"אישור הנבחרים",rejectSelected:"דחיית הנבחרים",approveAll:"אישור כל הממתינים",exportPending:"ייצוא הממתינים (JSON)",selectedCount:"{n} נבחרו",empty:"אין הרשמות בסטטוס זה",approvedToast:"{n} תלמידים אושרו — הם יכולים להתחבר עכשיו",rejectedToast:"{n} הרשמות נדחו",approvedOneToast:"התלמיד/ה אושר/ה — אפשר להתחבר עכשיו",detailTitle:"פרטי ההרשמה",detailPersonal:"פרטים אישיים",detailMusic:"רקע מוסיקלי",detailAcademic:"שיוך אקדמי",close:"סגירה",reviewNotePrompt:"הערה לתלמיד/ה (רשות):"},studentImport:{title:"ייבוא תלמידים",subtitle:"הוספת מספר תלמידים לקבוצה בבת אחת",pickGroup:"בחירת קבוצה",noGroups:"אין קבוצות זמינות לייבוא",namesLabel:"שמות התלמידים (שם אחד בכל שורה)",namesPlaceholder:`ישראל ישראלי
3594חנה כהן
3595דוד לוי`,lineCount:"{n} שמות",importButton:"ייבוא",importing:"מייבא…",successBanner:"נוצרו {n} תלמידים בקבוצה"},teachersAdmin:{title:"ניהול מורים",subtitle:"יצירת מורים, שיוך לקבוצות והרשאות — חשבונות מורה נוצרים על-ידי ההנהלה בלבד",addTeacher:"מורה חדש/ה",editTeacher:"עריכת מורה",nameLabel:"שם המורה",subjectsLabel:"תחומי הוראה",subjectsHint:"לחצו להוספה או הסרה",emailLabel:"אימייל",phoneLabel:"טלפון",canAuthor:"הרשאת יצירת תוכן",canAuthorHint:"המורה יוכל/תוכל גם ליצור ולערוך פעילויות בסטודיו התוכן",assignGroupsTitle:"שיוך לקבוצות",assignGroupsHint:"הקבוצות שהמורה מלמד/ת בהן",save:"שמירה",cancel:"ביטול",deactivate:"השבתת חשבון",reactivate:"הפעלה מחדש",statusActive:"פעיל",statusInactive:"מושבת",groupsLabel:"קבוצות",noGroups:"לא משויך לקבוצות",empty:"אין מורים עדיין — הוסיפו את הראשון",createdToast:"המורה נוצר/ה — אפשר לשייך לקבוצות",savedToast:"הפרטים נשמרו",subjectSuggestions:["פסנתר","שירה","פיתוח שמיעה","תיאוריה","הרמוניה","מקצב","הרכבים","הלחנה"],deactivateConfirm:"להשבית את החשבון של {name}? ההיסטוריה תישמר אך לא ניתן יהיה לשייך או להתחבר"},placement:{cardTitle:"בואו נכיר אתכם 🎯",cardBody:"מבחן מיון קצר יעזור לקואוצ׳ר להתאים לכם תרגול מדויק לרמה שלכם",start:"התחלת מבחן המיון",doneToast:"מבחן המיון הושלם! הקואוצ׳ר מכיר אתכם עכשיו"},roles:{musician:"תלמיד/ה",teacher:"מורה",admin:"ניהול",content_author:"סטודיו תוכן"},nav:{student:{dashboard:"ראשי",learn:"לימוד",practice:"תרגול חופשי",journey:"תהליך הלמידה",courses:"הקורסים שלי",history:"היסטוריית תרגול",goals:"יעדים",progress:"התקדמות",profile:"פרופיל",notifications:"הודעות",settings:"הגדרות"},teacher:{dashboard:"ראשי",quickCapture:"תיעוד שיעור",homework:"שיעורי בית",students:"התלמידים שלי",assignment:"הקצאת תרגול",announce:"הודעות",content:"ספריית תוכן"},admin:{dashboard:"ראשי",approvals:"אישורי תלמידים",groups:"קבוצות",teachers:"מורים",students:"תלמידים",studentImport:"ייבוא תלמידים",practiceTracks:"תרגולים בנושא",permissions:"הרשאות",library:"ספריית תוכן",analytics:"אנליטיקה"},studio:{dashboard:"סטודיו תוכן",activities:"פעילויות תרגול",questions:"שאלות",audio:"אודיו",scores:"תווים",videos:"וידאו",attachments:"קבצים מצורפים",knowledge:"בסיס הידע"}},studio:{activitiesTitle:"פעילויות תרגול",activitiesSubtitle:"יצירה ועריכה של פעילויות עבור התלמידים",newActivity:"פעילות חדשה",chooseType:"בחרו סוג פעילות",empty:"עוד אין פעילויות — צרו את הראשונה!",editorTitle:"עריכת פעילות",fieldTitle:"שם הפעילות",fieldDescription:"תיאור לתלמידים",fieldMinutes:"משך משוער (דקות)",saveDraft:"שמירת טיוטה",publish:"פרסום",published:"מפורסם",draft:"טיוטה",archived:"בארכיון",unpublishedChanges:"שינויים שטרם פורסמו",archive:"העברה לארכיון",restore:"שחזור מהארכיון",preview:"תצוגה מקדימה",closePreview:"סגירת התצוגה המקדימה",previewHint:"כך התלמידים יחוו את הפעילות — נסו אותה!",versionsTitle:"היסטוריית גרסאות",versionLabel:"גרסה {n}
3595",noVersions:"טרם פורסמו גרסאות",savedToast:"הטיוטה נשמרה",importJson:"ייבוא JSON",fromTemplate:"יצירה מתבנית מוכנה",fromTemplateHint:"תבניות מהמנועים החינוכיים — קליק אחד ופעילות מוכנה לעריכה ופרסום",levelBadge:"רמה {n}",importDone:"ייובאו {n} פעילויות בהצלחה",importFailed:"הייבוא נכשל — ודאו שהקובץ בפורמט הנכון",publishedToast:"הגרסה פורסמה! התלמידים רואים אותה עכשיו",fixErrors:"יש לתקן את השגיאות לפני פרסום",lastUpdated:"עודכן",version:"גרסה",types:{ear_interval:"זיהוי מרווחים",rhythm_tap:"הקשת מקצב",rhythm_echo:"הד וזיכרון קצבי",sight_reading:"קריאת תווים — מנוע מלא",theory_chord_build:"בניית אקורדים",ear_chord_quality:"זיהוי סוגי אקורדים",ear_scale_recognition:"זיהוי סולמות ומודוסים",ear_cadence:"זיהוי קדנצות",sight_note_id:"זיהוי תווים בחמשה",piano_scale_play:"נגינת סולמות וארפג׳יו",theory_matching:"משחק התאמה",repertoire_record:"הקלטת ביצוע",score_label:"ניתוח קטע — לחיצה על תיבה",piano_locate:"איתור צליל על המקלדת",notation_build:"בנייה על החמשה — מנוע מלא",theory_organize:"ארגון ומיון — מנוע מלא",sight_read_interval:"קריאת מרווחים — מנוע מלא",sight_read_key:"חתימות מפתח — מנוע מלא",sight_read_accidental:"קריאת סימני היתק — מנוע מלא",sight_read_melody:"קריאת מלודיה — מנוע מלא",theory_spell:"כתיב תיאורטי — מנוע מלא",notation_select:"בחירה על החמשה — מנוע מלא",theory_function:"הרמוניה פונקציונלית — מנוע מלא",ear_interval_quality:"איכות מרווח בשמיעה — מנוע מלא",rhythm_dictation:"הכתבה רתמית — מנוע מלא",melody_dictation:"הכתבה מלודית — מנוע מלא"},fields:{intervals:"המרווחים בתרגול",questionCount:"מספר שאלות",direction:"כיוון ההשמעה",directionAscending:"עולה",directionDescending:"יורד",directionHarmonic:"הרמוני (יחד)",chords:"האקורדים בתרגול",options:"האפשרויות בתרגול",rootRangeLow:"צליל נמוך (MIDI)",rootRangeHigh:"צליל גבוה (MIDI)",bpm:"קצב (BPM)",beatsPerBar:"פעימות בתיבה",bars:"מספר תיבות",pattern:"תבנית המקצב (לחצו להוספת/הסרת הקשה)",rounds:"מספר סבבים",toleranceMs:"סובלנות תזמון (אלפיות שנייה)",clef:"מפתח",clefTreble:"מפתח סול",clefBass:"מפתח פה",displayMode:"אופן הצגה",displayGrid:"רשת חזותית",displayNotation:"תווים בחמשה",source:"מקור לתרגול (סולם / מודוס / אקורד)",playMode:"אופן הנגינה",modeScale:"סולם (מדרגות)",modeArpeggio:"ארפג׳יו (אקורד פרוס)",rootNote:"צליל יסוד (MIDI)",matchingItems:"הפריטים במשחק",promptField:"תצוגת הסמל",promptSymbol:"סמל מוסיקלי",promptEnglish:"שם באנגלית",referenceAsset:"ביצוע לדוגמה (רשות)",referenceNone:"ללא",minSeconds:"משך מינימלי (שניות)",excerpt:"הקטע בתווים (תיבות מופרדות ב-|, צליל כמו c4:q)",questionPrompt:"שאלה {n}",questionMeasure:"תיבת התשובה (1 ומעלה)",addQuestion:"הוספת שאלה",removeQuestion:"הסרה",locateMode:"סוג האיתור",locatePitch:"צליל",locateDegree:"מדרגה בסולם",anyOctave:"לקבל כל אוקטבה של הצליל",patternIds:"תבניות המקצב בתרגול",echoMode:"סוג התרגול",echoModeEcho:"הד — הקשה מיידית",echoModeMemory:"זיכרון — תיבה שקטה לפני ההקשה",srMode:"מצב תרגול",srModeName:"שם הצליל",srModeClick:"איתור על המקלדת",srModeSequence:"קריאת רצף",srModeExtreme:"הצליל הקיצוני",srSequenceLength:"אורך הרצף",srTimedSeconds:"זמן לשאלה (שניות, 0 = ללא)",adaptive:"התאמה אישית",adaptiveHint:"הרמה עולה ויורדת לפי הביצועים",clefAlto:"מפתח דו (אלט)",clefTenor:"מפתח דו (טנור)",mode:"מצב בנייה",modeBuildScale:"בניית סולם",modeBuildChord:"איות אקורד",modeBuildInterval:"הצבת מרווח",modeCompleteScale:"השלמת סולם",modeMissingNote:"תו חסר",sourceId:"סולם/אקורד",intervalSemitones:"מרווח (חצאי-טונים)",lowMidi:"צליל נמוך (MIDI)",highMidi:"צליל גבוה (MIDI)",completeCount:"כמה תווים להשלים",organizeMode:"מצב",organizeModeClassify:"מיון לקטגוריות",organizeModeOrder:"סידור ברצף",organizeSampleSize:"כמה פריטים להציג",organizeContentNote:"הקטגוריות/הסדר מוגדרים בתבנית או בקובץ ה-JSON",intervalPresentation:"אופן הצגה",presentationMelodic:"מלודי (זה אחר זה)",presentationHarmonic:"הרמוני (יחד)",presentationMixed:"מעורב",keyIds:"הסולמות בתרגול",accidentalType:"סוג הסימנים",accidentalTypeSharps:"דיאזים",accidentalTypeFlats:"במולים",accidentalTypeBoth:"דיאזים ובמולים",keyId:"סולם המלודיה",note
3595Count:"מספר צלילים במלודיה",spellMode:"סוג התרגיל",spellModeScale:"איות סולם",spellModeChord:"איות אקורד",selectMode:"סוג התרגיל",selectModeWrong:"איתור טעות",selectModeExtreme:"צליל קיצון",extreme:"איזה קיצון",extremeHighest:"הגבוה ביותר",extremeLowest:"הנמוך ביותר",functionMode:"סוג התרגיל",functionModeFunction:"זיהוי תפקוד",functionModeNumeral:"זיהוי דרגה",presentation:"אופן ההשמעה",optionCount:"מספר אפשרויות",maxPlays:"מספר האזנות מרבי",dictationMode:"סוג ההכתבה",dictationModeFull:"זיהוי המנגינה",dictationModeBlank:"השלמת תו חסר"},assets:{upload:"העלאת קובץ",empty:"עוד אין קבצים בספרייה",uploadTooLarge:"הקובץ גדול מדי למצב הפיתוח (עד 800KB); במערכת המלאה יועלה לאחסון ענן",unsupportedType:"סוג קובץ לא נתמך",deleteBlocked:"לא ניתן למחוק — הקובץ מקושר לפעילות",deleted:"הקובץ נמחק",attachTitle:"קבצים מצורפים לפעילות",attachHint:"בחרו קבצים מהספרייה שהפעילות תשתמש בהם",noneInLibrary:"הספרייה ריקה — העלו קבצים בדף האודיו/תווים",scopeFilterAll:"כל הקבוצות",scopeShared:"משותף לכולם",scopeLabel:"שיוך לקבוצות",scopeHint:"שיוך קובץ לקבוצה מציג אותו בהקשר שלה. קבצים ללא שיוך משותפים לכל בית הספר",scopeSave:"שמירת השיוך",scopeSaved:"השיוך עודכן",scopedToCount:"משויך ל-{n} קבוצות",storageNote:"קבצי אודיו כבדים יאוחסנו באחסון ענן ייעודי — כאן נשמרת רק מטא-דאטה של השיוך",kinds:{audio:"אודיו",midi:"MIDI",musicxml:"MusicXML",pdf:"PDF",image:"תמונה"}},errors:{titleRequired:"חובה לתת שם לפעילות",minutesRange:"משך התרגול חייב להיות בין 1 ל־60 דקות",unknownType:"סוג פעילות לא מוכר",invalidParam:"ערך לא תקין"}},coach:{reasonWeakObjective:"הקואוצ׳ר בחר להתמקד ב״{objective}״ — שם יש הכי הרבה מקום לשיפור",reasonFirstSteps:"צעדים ראשונים — נכיר את הכלים דרך שתי פעילויות קצרות",reasonGoalFocus:"לפי המטרה שהצבתם — התמקדות ב״{objective}״ 💪",reasonPathStep:"הצעד הבא במסלול ״{path}״ — {objective}",reasonReview:"ריענון! שלטתם ב״{objective}״ — נוודא שזה נשאר חד ✨"},journey:{title:"תהליך הלמידה",subtitle:"מסלולי למידה מובנים — צעד אחר צעד למוסיקאות",stepsOf:"{done} מתוך {total} צעדים",active:"המסלול הפעיל שלכם",startPath:"התחלת המסלול",leavePath:"עזיבת המסלול",pathDone:"המסלול הושלם! 🏆",stepDone:"הושלם",stepCurrent:"הצעד הנוכחי",stepLocked:"בהמשך",homeCardTitle:"המסלול שלי",homeCardCta:"להמשך המסע"},goals:{title:"היעדים שלי",subtitle:"כמה תרצו לתרגל, ובמה להתמקד",weeklyTarget:"יעד דקות שבועי",weeklyProgress:"ההתקדמות השבוע",minutesOf:"{n} מתוך {target} דקות",goalReached:"היעד השבועי הושג! 🎉",focusTitle:"תחומי מיקוד",focusHint:"הקואוצ׳ר ייתן עדיפות לתחומים שתבחרו",save:"שמירת היעדים",savedToast:"היעדים נשמרו — הקואוצ׳ר מעודכן"},practice:{activityOf:"פעילות {current} מתוך {total}",approxMinutes:"כ־{n} דקות",studioTitle:"תרגול חופשי",pathsTitle:"מסלולי תרגול",exploreTitle:"תרגול חופשי לפי נושא",speed:{label:"מהירות",normal:"רגיל",slow:"איטי",slower:"איטי מאוד"},studioSubtitle:"בחרו נושא וצללו פנימה — אין גבולות",categories:{ear_training:"פיתוח שמיעה",rhythm:"מקצב",piano:"פסנתר",theory:"תיאוריה",sight_reading:"קריאת תווים",singing:"שירה",performance:"ביצוע"},sight:{prompt:"איזה צליל רשום בחמשה?",howTo:["הביטו בתו שמופיע על החמשה","בחרו את שם הצליל מבין הכפתורים","אחרי הבחירה הצליל גם יישמע — חברו את העין לאוזן"]},sightRead:{howTo:["הביטו בתווים שעל החמשה","ענו לפי מצב התרגיל — שם הצליל, לחיצה על המקלדת, רצף או הצליל הקיצוני","אחרי כל תשובה הצליל יישמע — חברו עין לאוזן"],clickPrompt:"לחצו על {name} במקלדת",sequencePrompt:"קראו את הרצף ובחרו את הצלילים לפי הסדר",extremeHigh:"איזה תו הוא הגבוה ביותר?",extremeLow:"איזה תו הוא הנמוך ביותר?",noteN:"תו {n}",levelUp:"יופי! עולים רמה 🎉",levelDown:"נרגיע רגע — יורדים רמה"},intervalRead:{title:"קריאת מרווחים",prompt:"איזה מרווח בין שני הצלילים?",howTo:["התבוננו בשני הצלילים על החמשה","מדדו את המרחק ביניהם — כמה מדרגות","בחרו את שם המרווח מהכפתורים","אחרי הבחירה נעבור הלאה"]},keyRead:{prompt:"איזו חתימת מפתח מוצגת?",howTo:["התבוננו בסימנים שאחרי המפתח — דיאזים (♯) או במולים (♭)","ספרו כמה יש","מעגל הקווינטות קובע איזה סולם","בחרו את הסולם מהכפתורים"]},accidentalRead:{prompt:"איזה צליל מוצג (כולל הסימן)?",howTo:["התבוננו בתו ובסימן שלפניו — דיאז (♯) או במול (♭)","בחרו את הסימן, ואז את שם הצליל","שקילות אנהרמונית מתקבלת (למשל דו♯ = רה♭)","אחרי הבחירה נעבור הלאה"],natural:"♮",sharp:"♯",flat:"♭"},melodyRead:{prompt:"נגנו את המלודיה לפי הסדר על הפסנתר",howTo:["התבוננו במלודיה על החמשה — שימו לב לחתימת המפתח","לחצו ״האזינו״ כדי לשמוע אותה — הגבהים והמקצב","נגנו את הצלילים לפי הסדר על המקלדת; לחיצה נכונה מוריקה","המקצב מוצג ונשמע כעזר קריאה — בשלב זה מנוקדים הגבהים"],playedOf:"{current} מתוך {total} צלילים"},spell:{scalePrompt:"אַיֵּת את סולם {name} מהיסוד ומעלה",chordPrompt:"אַיֵּת את ה{name}",howTo:["קראו איזה סולם או אקורד לאיית","בחרו סימן (♮/♯/♭) ואז לחצו על שם הצליל — הצליל יתווסף לרצף","״ביטול״ מסיר את הצליל האחרון; שקילות אנהרמונית מתקבלת (דו♯ = רה♭)","כשתשלימו את כל הצלילים התשובה תיבדק ותתנגן"],builtOf:"{current} מתוך {total} צלילים",empty:"בחרו את הצלילים לפי הסדר…",undo:"ביטול"},select:{wrongPrompt:"לחצו על הצליל השגוי בסולם",highestPrompt:"לחצו על הצליל הגבוה ביותר",lowestPrompt:"לחצו על הצליל הנמוך ביותר",howTo:["התבוננו בצלילים על החמשה","לחצו על הצליל שעונה על השאלה","הצליל המבוקש יסומן בירוק; אם טעיתם, גם הצליל שבחרתם יסומן באדום"]},func:{numeralPrompt:"איזו דרגה (I–vii°) האקורד בסולם {name}?",functionPrompt:"מהו תפקוד האקורד בסולם {name}?",howTo:["לחצו ״האזינו״ כדי לשמוע קודם את הטוניקה ואז את האקורד","התבוננו באקורד על החמשה ביחס לסולם המצוין","בחרו את הדרגה או את התפקוד מהכפתורים"],tonic:"טוניקה",subdominant:"סובדומיננטה",dominant:"דומיננטה"},inversion:{prompt:"באיזה היפוך נמצא אקורד {name}?",howTo:["התבוננו באקורד על החמשה — מהו הצליל התחתון (הבס)?","לחצו ״האזינו״ כדי לשמוע את האקורד","זהו איזה צליל של האקורד נמצא בבס: יסוד, שלישי, חמישי או שביעי"],options:{root:"מצב יסוד",first:"היפוך ראשון",second:"היפוך שני",third:"היפוך שלישי"}},build:{title:"בנייה על החמשה",howTo:["קראו את המשימה שמעל החמשה","לחצו על החמשה במקום שבו הצליל יושב — התו יתווסף","לפני ההצבה אפשר לבחור ♯ ♭ או ♮; ״ביטול״ מסיר את התו האחרון","סיימתם? לחצו ״בדיקה״"],buildScale:"בנו את סולם {name} כלפי מעלה מהצליל הנתון",completeScale:"השלימו את המשך סולם {name}",missingNote:"חסר תו בסולם {name} — הציבו אותו במקומו",buildChord:"אייתו את אקורד {name} מעל צליל היסוד",buildInterval:"הציבו את הצליל {semis} חצאי-טונים מעל הנתון",placeNote:"הציבו את הצליל {name}
3595 על החמשה",natural:"♮",sharp:"♯",flat:"♭",clear:"ניקוי",undo:"ביטול",check:"בדיקה",placed:"הוצבו {n} תווים"},organize:{title:"ארגון ומיון",classifyHowTo:["בחרו פריט מהמאגר","לחצו על הקטגוריה שאליה הוא שייך","אפשר להחזיר פריט בלחיצה עליו","מיינתם הכול? לחצו ״בדיקה״"],orderHowTo:["לחצו על הפריטים לפי הסדר הנכון — מהראשון לאחרון","כל בחירה מתווספת לרצף","״ביטול״ מסיר את האחרון","סיימתם? לחצו ״בדיקה״"],pool:"מאגר הפריטים",yourOrder:"הסדר שלכם",undo:"ביטול",clear:"ניקוי",check:"בדיקה",remaining:"נותרו {n}"},earHowTo:["לחצו על כפתור ההשמעה הגדול והאזינו בריכוז","בחרו מבין הכפתורים את מה ששמעתם (אפשר האזנה חוזרת)","טעיתם? התשובה הנכונה תסומן בירוק — כדאי להאזין שוב לפני ההמשך"],pianoPlay:{prompt:"נגנו את {name} לפי הסדר על הפסנתר",playedOf:"{current} מתוך {total} צלילים"},matching:{instruction:"התאימו כל סמל לשם העברי שלו — הקישו סמל ואז את התשובה",promptsTitle:"הסמלים",answersTitle:"התשובות"},score:{clickHint:"הקישו על התיבה המתאימה בתווים",measureN:"תיבה {n}"},record:{hint:"הקליטו את הביצוע, האזינו לו ודרגו את עצמכם",start:"התחלת הקלטה",stop:"עצירת הקלטה",elapsed:"משך",again:"הקלטה מחדש",playReference:"האזנה לביצוע לדוגמה",playMine:"האזנה להקלטה שלי",ratePrompt:"איך היה הביצוע?",save:"שמירת הביצוע",micFailed:"לא ניתן לגשת למיקרופון. בדקו הרשאות ונסו שוב"},game:{score:"ניקוד",streak:"רצף",lives:"חיים",timeLeft:"זמן נותר",achievementsTitle:"הישגים"},start:"התחלה",comingSoonActivity:"סוג פעילות זה יופעל בקרוב",estimatedMinutes:"כ־{n} דקות",questionOf:"שאלה {current} מתוך {total}",playInterval:"השמעת המרווח",playAgain:"האזנה חוזרת",whichInterval:"איזה מרווח שמעתם?",listen:"האזינו",whichEntity:"מה שמעתם?",chordPlay:{block:"צלילים יחד",arpeggio:"פריטה",title:"אופן השמעה"},next:"להמשך",finishRun:"לסיכום",summaryTitle:"כל הכבוד! סיימתם את התרגול",summaryScore:"דיוק ממוצע",saveAndReturn:"שמירה וחזרה לדף הראשי",quit:"יציאה מהתרגול",quitConfirm:"לצאת באמצע? מה שתרגלתם עד עכשיו יישמר.",explain:{open:"הסבר / הרחבה",heading:"הרחבה בנושא",close:"סגירה",tipLabel:"טיפ לתרגול",why:"רוצים להבין למה? להסבר"},theory:{buildPrompt:"בנו {chord} מהצליל המסומן",rootHint:"הצליל הכתום הוא צליל היסוד — השלימו את יתר צלילי האקורד",check:"בדיקה",howTo:["הצליל הכתום על המקלדת הוא צליל היסוד — הוא כבר נתון","לחצו על קלידים להשלמת צלילי האקורד (כל לחיצה נשמעת)","סיימתם? לחצו ״בדיקה״ — הצלילים הנכונים יסומנו והאקורד יתנגן"]},locate:{findPitch:"מצאו את הצליל {name}",findDegree:"המדרגה ה-{degree} של {scale} מהצליל המסומן",howTo:["קראו את השאלה שמעל המקלדת","לחצו על הקליד שלדעתכם עונה עליה — כל לחיצה נשמעת ונחשבת כתשובה","הקליד הנכון יסומן בירוק ואם טעיתם גם הקליד שלכם יסומן באדום"]},pianoPlayHowTo:["לחצו ״האזינו״ כדי לשמוע את הרצף קודם","נגנו את הצלילים לפי הסדר על המקלדת — מתחילים מהצליל הכתום","לחיצה נכונה מוריקה; המשיכו עד סוף הרצף"],matchingHowTo:["הקישו על סמל, ואז על השם המתאים לו בעמודה השנייה","נוצר צמד ממוספר — לחיצה נוספת מבטלת","התאמתם הכול? לחצו ״בדיקה״"],recordHowTo:["האזינו לביצוע לדוגמה (כשקיים)","לחצו ״התחלת הקלטה״, נגנו או שירו, ועצרו בסיום","האזינו לעצמכם, דרגו בכוכבים ושמרו"],scoreHowTo:["קראו את השאלה שמעל התווים","התבוננו בתיבות — כל תיבה היא כפתור","לחצו על התיבה שעונה על השאלה"],intervalQuality:{prompt:"איזה מרווח שמעתם?",howTo:["לחצו על כפתור ההשמעה כדי לשמוע את המרווח","בחרו אם המרווח קטן או גדול","במרווח מלודי (בזה אחר זה) — בחרו גם אם עלה או ירד","אפשר להאזין שוב לפני שבוחרים"],qualityTitle:"איכות המרווח",directionTitle:"כיוון המרווח",minor:"קטן",major:"גדול",up:"עולה",down:"יורד"},dictation:{prompt:"איזה מקצב שמעתם?",howTo:["לחצו ״האזנה למקצב״ — עקבו אחר מחוון הפעימות: ספירת פתיחה של תיבה ואז המקצב עצמו","ספרו את הפעימות בלב והשוו למה ששמעתם","בחרו את הרישום התואם מבין האפשרויות","מספר ההאזנות מוגבל — כמו בהכתבה בכיתה"],play:"האזנה למקצב",playsUsed:"האזנות: {used}/{max}",countIn:"ספירת פתיחה",theRhythm:"המקצב"},melodyDict:{prompt:"איזו מנגינה שמעתם?",promptBlank:"איזה תו חסר?",play:"האזנה למנגינה",howTo:["לחצו ״האזנה למנגינה״ כדי לשמוע את רצף הצלילים","במצב השלמה — התו החסר מסומן □","בחרו את התשובה הנכונה","מספר ההאזנות מוגבל"]},feedback:{correct:"נכון! 🎉",incorrectInterval:"לא מדויק. המרווח הנכון: {expected}
3595",incorrectEntity:"לא מדויק. התשובה הנכונה: {expected}",chordIncorrect:"כמעט! הצלילים הנכונים של {chord} מסומנים בירוק — הקשיבו לו",rhythmGreat:"מדויק מאוד! 💪",rhythmOk:"לא רע! סטייה ממוצעת: {ms} אלפיות שנייה",rhythmRetry:"שווה עוד ניסיון — הקשיבו טוב לקליק ונסו שוב",sequenceIncorrect:"כמעט! הרצף הנכון של {expected} מסומן — האזינו ונסו שוב",sequencePartial:"כמעט! {n} צלילים נכונים ברצף",matchingIncorrect:"כמעט! {n} התאמות שגויות — התשובה הנכונה מסומנת בירוק",selfAssessed:"הביצוע נשמר! דירוג עצמי: {rating}/5",wrongMeasure:"לא בדיוק — התשובה נמצאת בתיבה {measure}",buildPartial:"כמעט! {n} מתוך {total} תווים נכונים",organizePartial:"כמעט! {n} מתוך {total} נכונים",incorrectAccidental:"לא מדויק. הצליל הנכון: {name}",selectIncorrect:"לא מדויק — הצליל המבוקש מסומן בירוק",selectIncorrectWrong:"לא מדויק — הצליל השגוי מסומן בירוק",intervalQuality:"לא מדויק. המרווח: {label}",dictationIncorrect:"לא מדויק — הרישום הנכון מסומן בירוק"},rhythm:{roundOf:"סבב {current} מתוך {total}",instruction:"הקישו את התבנית יחד עם הקליק",howToTitle:"איך מתרגלים?",step1grid:"המשבצות הכהות למעלה הן ההקשות — קראו את התבנית",step1notation:"קראו את המקצב מהתווים שלמעלה",step2:'לחצו "התחלת סבב" והאזינו לספירת פתיחה של 4 קליקים',step3:'כשמופיע "עכשיו!" — הקישו את התבנית על המשטח (או במקש הרווח), יחד עם הקליק',startRound:"התחלת סבב",countIn:"ספירת פתיחה… הקשיבו לקליקים",countInPad:"1 · 2 · 3 · 4",tapNow:"עכשיו! הקישו את התבנית",tapPad:"משטח הקשה",bpm:"{bpm} פעימות לדקה"},echo:{listen:"האזינו",silent:"תיבה שקטה… זכרו את התבנית",yourTurn:"עכשיו תורכם — הקישו את התבנית",howTo:{listen:"האזינו לתבנית המושמעת עם קליקים מוטעמים על גבי פעימה קבועה",echo:"מיד אחרי ספירת פתיחה של תיבה אחת — הקישו את התבנית ששמעתם",memory:"תיבה שקטה אחת תעבור בלי קליקים — זכרו את התבנית, ואז הקישו אותה",tap:"הקישו על המשטח (או במקש הרווח) יחד עם הקליק"}}},history:{subtitle:"כל התרגולים שלכם, מהחדש לישן",emptyTitle:"עוד אין תרגולים — הכול מתחיל בצעד הראשון",emptyCta:"לתרגול הראשון",abandoned:"הופסק באמצע"},admin:{homeSubtitle:"ניהול בית הספר — הכול במקום אחד",add:"הוספה",edit:"עריכה",remove:"מחיקה",saveItem:"שמירה",cancel:"ביטול",emptyCollection:"אין רשומות עדיין — הוסיפו את הראשונה",permissionsSubtitle:"מי רואה ועושה מה — נאכף בשכבת הנתונים (RLS), לא במסכים",knowledgeSubtitle:"הידע המוסיקלי של הפלטפורמה — ישויות, שמות וקשרים",knowledgeCount:"{n} ישויות",relationsLabel:"קשרים",knowledgeImport:"בדיקת ייבוא ידע (JSON)",knowledgeImportTitle:"תצוגה מקדימה של ייבוא בסיס הידע",knowledgeImportHint:"העלו את קובץ הייצוא של פרויקט בסיס-הידע. הבדיקה מדווחת מה ייקלט מול הפלטפורמה — היישום בפועל יופעל כשפורמט הייצוא יאושר",knowledgeImportReady:"תקין לייבוא · {adds} חדשים · {updates} עדכונים · {unchanged} ללא שינוי",knowledgeImportConflicts:"{n} התנגשויות",knowledgeImportErrors:"המסמך נדחה — {n} שגיאות:",knowledgeImportWarnings:"{n} אזהרות — כדאי לעיין",analyticsSubtitle:"תמונת מצב חיה של הלמידה",statStudents:"תלמידים",statWeeklyMinutes:"דקות תרגול השבוע (כולם)",statActiveThisWeek:"תרגלו השבוע",statActivities:"פעילויות זמינות",statPublished:"תכנים שפורסמו",statLessons:"שיעורים שתועדו",permCan:"✓",permCant:"—",exportJson:"ייצוא JSON",studentsSubtitle:"רישום התלמידים — ניתן לייבא מקובץ הייצוא של SUMIT",fieldName:"שם",fieldInstrument:"כלי עיקרי",fieldEmail
3595:"אימייל",fieldPhone:"טלפון",importJsonList:"ייבוא רשימה (JSON)",importedRows:"ייובאו {n} רשומות בהצלחה",importRowsFailed:"הייבוא נכשל — ודאו שהקובץ הוא מערך JSON תקין",permissionRows:["תרגול וצפייה בהתקדמות אישית","צפייה בנתוני תלמידים משויכים","תיעוד שיעורים והמלצות תרגול","יצירה ועריכה של תוכן","פרסום תוכן לתלמידים","ניהול קבוצות, תלמידים ומשתמשים"],knowledgeKinds:{pitch:"צלילים",interval:"מרווחים",scale:"סולמות",mode:"מודוסים",chord:"אקורדים",rhythm_pattern:"תבניות מקצב",cadence:"קדנצות",key:"סולמות-טונליות",time_signature:"משקלים",concept:"מושגים"}},capture:{title:"תיעוד שיעור / שיעורי בית",subtitle:"בוחרים קבוצה ונושאים — התלמידים מקבלים את התרגול והודעה",pickGroup:"לאיזו קבוצה?",noGroups:"אינכם משובצים לקבוצות עדיין — פנו למנהל המערכת",notifiedMembers:"ההודעה נשלחה ל-{n} תלמידים בקבוצה",pickTopics:"מה תרגלתם? בחרו נושאים",topicsHint:"רק נושאים שיש להם תרגילים במערכת — כל נושא מביא סט תרגילים",noTopicsChosen:"בחרו נושא אחד או יותר",otherTopicLabel:"נושא אחר (חופשי)",otherTopicPlaceholder:"למשל: קטע מהרפרטואר, נושא שאין לו עדיין תרגיל…",exerciseSet:"סט התרגילים שיישלח",noExercises:"לנושאים שנבחרו אין עדיין תרגילים — יישלח כהערה בלבד",record:"הקלטת הערה קולית",recording:"מקליט… לחצו לסיום",recorded:"הערה קולית נשמרה ✓",recordFailed:"אין גישה למיקרופון — אפשר להמשיך בלי הקלטה",save:"שליחה לקבוצה",savedToast:"נשלח! התלמידים בקבוצה קיבלו את התרגול והודעה",toAssignment:"רוצים לבחור תרגילים ספציפיים או לבנות תרגול לקורס? מעבר להקצאת תרגול",homeworkTitle:"שיעורים ושיעורי בית",homeworkEmpty:"עוד לא תיעדתם שיעורים — זה לוקח פחות מדקה",topicsLabel:"נושאים",practiceLabel:"תרגול מומלץ"},assignment:{title:"הקצאת תרגול",subtitle:"בוחרים קבוצה, נושאים ויעד — התלמידים מקבלים סט תרגילים והודעה",pickGroup:"לאיזו קבוצה?",noGroups:"אינכם משובצים לקבוצות עדיין — פנו למנהל המערכת",target:"למי לשלוח?",targetGroup:"לכל הקבוצה",targetStudents:"לתלמידים נבחרים",pickStudents:"בחרו תלמידים",pickTopics:"אילו נושאים לתרגל?",topicsHint:"כל נושא מביא איתו סט תרגילים מוכן",exerciseSet:"סט התרגילים שיישלח",noExercises:"בחרו נושא אחד לפחות",noteLabel:"מילה אישית (אופציונלי)",notePlaceholder:"למשל: לקראת המופע — חמש דקות ביום יעשו פלא",send:"שליחת ההקצאה",sentToast:"ההקצאה נשלחה! 🎯",sentToGroup:"נשלח ל-{n} תלמידים בקבוצה",sentToStudents:"נשלח ל-{n} תלמידים נבחרים",fromTeacher:"המורה {name} ממליץ/ה",startCta:"לתרגול המומלץ"},announce:{title:"הודעות לקורס",subtitle:"שליחת הודעה לכל תלמידי הקבוצה",pickGroup:"לאיזו קבוצה?",noGroups:"אינכם משובצים לקבוצות עדיין — פנו למנהל המערכת",titleLabel:"כותרת (אופציונלי)",bodyLabel:"תוכן ההודעה",placeholder:"כתבו הודעה לתלמידי הקבוצה…",send:"שליחת הודעה",sent:"ההודעה נשלחה לכל תלמידי הקבוצה 🎵",recent:"הודעות אחרונות",studentTitle:"הודעות מהמרצה",empty:"אין הודעות חדשות",by:"מאת {name}"},tracks:{modeOneOff:"שליחה חד־פעמית",modeTrack:"בניית תרגול לקורס",builderHint:"הרכיבו סט תרגילים קבוע לקורס — התלמידים יראו אותו תחת ״הקורסים שלי״",pickTopics:"בחרו נושאים",topicsHint:"כל נושא מביא סט תרגילים מוכן — אפשר לערוך את הרשימה אחר כך",pickExercises:"בחירת תרגילים",pickExercisesHint:"פותחים תחום, בוחרים נושא, ומסמנים את התרגילים הרצויים — עד רמת התרגיל הבודד",selectAllExercises:"בחירת כל התרגילים בנושא",autoFill:"מילוי תרגילים לפי הנושאים",exercisesTitle:"התרגילים בתרגול (לפי הסדר)",empty:"בחרו נושאים ולחצו ״מילוי תרגילים״",moveUp:"הזזה למעלה",moveDown:"הזזה למטה",remove:"הסרה",titleLabel:"שם התרגול",save:"שמירת התרגול",saved:"התרגול נשמר ונשלח לתלמידי הקבוצה",courseTracksTitle:"תרגולים של הקורס",courseTracksSubtitle:"סטים שהמרצה הרכיב עבור הקורס",myTracksTitle:"התרגולים שיצרתי",assignedToGroups:"שובץ ל־{n} קבוצות",trackCount:"{n} תרגילים",practiceTrack:"תרגול הסט",freePracticeTitle:"תרגול בנושא",adminTitle:"תרגולים בנושא",adminSubtitle:"יצירת סדרות תרגול לפי נושא ורמה — לשיבוץ לקבוצות או לפרסום בתרגול חופשי",newTrack:"תרגול חדש",levelLabel:"רמה (אופציונלי)",levelPlaceholder:"למשל: שנה א׳",assignGroups:"שיבוץ לקבוצות (אופציונלי)",publish:"פרסום ב״תרגול חופשי״ לכל התלמידים",existingTracks:"תרגולים קיימים",noTracks:"עדיין לא נוצרו תרגולים",deleteTrack:"מחיקה",publishedBadge:"תרגול חופשי",scopeHint:"אפשר לשבץ לקבוצות, לפרסם לתרגול חופשי, או שניהם",lessonLabel:"שיוך למפגש (אופציונלי)",lessonNone:"ללא שיוך למפגש",meeting:"מפגש {n}",generalMaterial:"חומרי הקורס"},teacherStudents:{title:"התלמידים שלי",subtitle:"בוחרים קבוצה — ורואים את התלמידים שבה",pickGroup:"בחרו קבוצה",noGroups:"אינכם משובצים לקבוצות עדיין — פנו למנהל המערכת",inGroup:"תלמידי {group}",noStudents:"אין תלמידים משויכים לקבוצה זו",assignToGroup:"הקצאת תרגול לקבוצה",lastPractice:"תרגול אחרון: {when}",detailProgress:"שליטה ביעדים",detailSessions:"תרגולים אחרונים",focusTitle:"הכוונת הקואוצ׳ר",focusHint:"סמנו יעד שדורש חיזוק — הקואוצ׳ר ייתן לו עדיפות אצל התלמיד",focusButton:"בקשו מיקוד",unfocusButton:"הסרת המיקוד",focusActive:"הקואוצ׳ר ממקד את {name} ביעד זה"},teacherHome:{question:"מה תרצו לעשות היום?",actions:{capture:"תיעוד השיעור של היום",captureDesc:"רשמו בדקה מה למדתם היום עם הקבוצה",createPractice:"יצירת תרגול",createPracticeDesc:"הרכיבו תרגול והקצו אותו לתלמידים",reviewStudents:"סקירת תלמידים",reviewStudents
3595Desc:"מי תרגל השבוע, מי צריך עידוד",uploadMaterial:"העלאת חומר",uploadMaterialDesc:"תווים, הקלטות וקבצים לספריית התוכן",viewProgress:"צפייה בהתקדמות",viewProgressDesc:"תמונת ההתקדמות של כל הקבוצות"},studentsGlance:"התלמידים שלי במבט",minutesThisWeek:"דקות השבוע",noPracticeYet:"טרם תרגלו"},home:{pathsTitle:"עוד דרכים לתרגל",exploreTitle:"גלו מוסיקה",exploreDesc:"תרגול חופשי בכל נושא — בלי גבולות הסמסטר",courseCardTitle:"תרגול מהקורס",fromLesson:"מהשיעור האחרון: {topic}",journeyToday:"המסע של היום",journeyEmpty:"עוד לא תרגלתם היום — הצליל הראשון מחכה 🎵",practicedToday:"{n} דקות תרגול היום",progressTitle:"בדרך למוסיקאים טובים יותר",achievements:"הישגים אחרונים",teacherMessage:"הודעה מ{name}"},courses:{title:"הקורסים שלי",subtitle:"הקבוצות והקורסים שלכם בשירת הלויים",teacher:"מורה: {name}",currentTopic:"נלמד לאחרונה",practiceCta:"תרגול מהשיעור",empty:"אינכם משויכים לקבוצות כרגע — אפשר לתרגל חופשי בכל נושא",noLessonYet:"עוד לא תועד שיעור בקבוצה זו",pastYears:"שנים קודמות",otherCourses:"קורסים נוספים",enterGroup:"כניסה לקבוצה",exercisesTitle:"תרגילי הקבוצה",exercisesSubtitle:"כל התרגילים שהוקצו לקבוצה — לחצו לתרגול",practiceAll:"תרגול כל התרגילים",practiceOne:"לתרגול",backToCourses:"חזרה לקבוצות",noExercises:"עוד לא שובצו תרגילים לקבוצה זו"},learn:{navTitle:"לימוד",subtitle:"לומדים · מתרגלים · שאלות חזרה",homeSubtitle:"הקורסים הדיגיטליים שלכם — בחרו קורס כדי להתחיל",backToCourses:"לרשימת הקורסים",lessonsProgress:"{done}/{total} שיעורים",units:"יחידות",unitN:"יחידה {n}",submitQuiz:"בדיקת התשובות",lessons:"שיעורים",comingSoon:"בקרוב",lessonComplete:"הושלם",startLesson:"התחלת השיעור",continueLesson:"המשך",minutesShort:"{n} דק׳",phaseLearn:"לומדים",phasePractice:"מתרגלים",phaseMaster:"שאלות חזרה",tipLabel:"טיפ",mistakeLabel:"טעות נפוצה",exampleLabel:"דוגמה",toPractice:"המשך לתרגול",toMaster:"המשך לשאלות חזרה",practiceIntro:"תרגלו מיד את מה שלמדתם — התרגול משובץ כאן בשיעור.",noPractice:"בשיעור זה אין תרגול — אפשר להמשיך לשאלות החזרה.",quizTitle:"שאלות חזרה",explainTitle:"הסבר",quizResult:"עניתם נכון על {n} מתוך {total}",passed:"כל הכבוד! השלמתם את השיעור 🎉",notPassed:"כמעט! חזרו על החומר ונסו שוב",retry:"לניסיון נוסף",reviewLesson:"חזרה על השיעור",nextLesson:"לשיעור הבא",backToCourse:"חזרה לקורס",playNotation:"השמע",relatedTitle:"העמקה — נושאים קשורים",knowledgeTitle:"מושגים בשיעור"},progressPage:{subtitle:"תמונת השליטה שלכם, מחושבת מהתרגול בפועל",pillarsTitle:"התקדמות לפי שני רכיבי התרגול",pillarCourses:"תרגול לפי קורסים",pillarCoursesHint:"שיעורי בית וחזרות",pillarFree:"תרגול חופשי",pillarFreeHint:"מסלולים ותרגול לפי נושא",pillarSessions:"{n} תרגולים",pillarCta:"המשך תרגול",statsTitle:"מספרים של מוסיקאים",totalMinutes:"סה״כ דקות תרגול",totalSessions:"תרגולים",avgScore:"דיוק ממוצע",confidence:"מבוסס על {n} מדידות",teacherPinned:"המורה ביקש/ה מיקוד כאן",masteryTitle:"תמונת השליטה שלכם",statusStrong:"שליטה טובה",statusMedium:"בדרך הנכונה",statusWeak:"כדאי לחזק",statusUnpracticed:"עוד לא תורגל",greensReinforcement:"כל הכבוד! {n} תחומים כבר בירוק 💚",practiceNowTitle:"כדאי לתרגל עכשיו",practiceNowHint:"התחומים שהכי ירוויחו מכמה דקות תרגול היום",practiceNowCta:"לתרגול עכשיו",allStrong:"איזה יופי! כל התחומים במצב טוב — המשיכו לנגן 🎵",weeklyGoalTitle:"היעד השבועי שלי",editGoals:"עריכת היעדים ותחומי המיקוד",recentTitle:"התרגולים האחרונים",allHistory:"לכל היסטוריית התרגול"},profile:{subtitle:"תעודת הזהות המוסיקלית שלכם",organization:"לומדים ב",independent:"לומד/ת עצמאי/ת",instruments:"כלים",memberSince:"איתנו מאז",strengths:"נקודות חוזק",focusNow:"בעבודה עכשיו",retakePlacement:"מבחן מיון מחדש",groupsTitle:"הקבוצות שלי",noGroups:"לא משויכים לקבוצות כרגע — התרגול החופשי פתוח תמיד",pastYearsTitle:"שנים קודמות",scheduleTitle:"מערכת השעות השבועית",scheduleSyncNote:"נתוני דוגמה — יסונכרן אוטומטית ממערכות בית הספר",teacherLabel:"מורה: {name}"},academicAdmin:{groupsTitle:"קבוצות",groupsSubtitle:"המבנה האקדמי — קבוצות, תתי-קבוצות, מורים ותלמידים",sampleNotice:"נתוני דוגמה — המבנה האמיתי ייובא ממערכות בית הספר",yearFilter:"שנת לימודים",addGroup:"קבוצה חדשה",addSubGroup:"תת-קבוצה חדשה",editGroup:"עריכה",deleteGroup:"מחיקה",deleteConfirm:'למחוק את "{name}"? יימחקו גם תתי-הקבוצות והשיוכים שלה',nameLabel:"שם הקבוצה",colorLabel:"צבע הקבוצה",teachersLabel:"מורים משובצים",save:"שמירה",cancel:"ביטול",membersTitle:"תלמידים בקבוצה",noMembers:"אין תלמידים משויכים עדיין",addMember:"שיוך תלמיד/ה",removeMember:"הסרה",subGroupsTitle:"תתי-קבוצות",noSubGroups:"אין תתי-קבוצות — אפשר להוסיף הקבצה מכא×
3595Ÿ",scheduleTitle:"מערכת שעות",noSchedule:"אין שיבוץ עדיין",membersCount:"{n} תלמידים",teachersShort:"מורים: {names}",backToGroups:"חזרה לכל הקבוצות",importBtn:"ייבוא מבנה (JSON)",exportBtn:"ייצוא מבנה (JSON)",importOk:"המבנה יובא בהצלחה",importWarnings:"{n} אזהרות — כדאי לעיין",importFailed:"הייבוא נדחה — שגיאות במבנה:",days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},notifications:{subtitle:"כל העדכונים במקום אחד",markAllRead:"סימון הכול כנקרא",empty:"אין התראות — הכול רגוע 🎵"},settings:{subtitle:"העדפות אישיות",appearance:"מראה",themeLight:"בהיר",themeDark:"כהה",account:"חשבון",signOut:"התנתקות",devTools:"כלי פיתוח (מצב דוגמה)",resetData:"איפוס נתוני הדוגמה המקומיים",resetDone:"הנתונים אופסו — טוענים מחדש…",version:"גרסה"},studentDashboard:{greetingMorning:"בוקר טוב",greetingAfternoon:"צהריים טובים",greetingEvening:"ערב טוב",streak:"רצף ימי תרגול",weeklyMinutes:"דקות תרגול השבוע",weeklyGoal:"מתוך היעד השבועי",nextPractice:"התרגול הבא שלך",startPractice:"התחלת תרגול",recentSessions:"תרגולים אחרונים",noSessions:"עוד לא תרגלת — זה הזמן להתחיל!",notifications:"התראות",days:"ימים"},curriculum:{navTitle:"תכנית הלימודים",homeTitle:"תכנית הלימודים",homeSubtitle:"כל תחומי הידע — בחרו תחום כדי לראות את הקורסים והנושאים",home:"תכנית הלימודים",coursesCount:"{n} קורסים",topicsCount:"{n} נושאים",beginnersGroup:"מתחילים (שנה א׳)",advancedGroup:"מתקדמים (שנים ב׳–ג׳)",otherGroup:"נוסף",track:"מסלול",year:"שנה",covered:"נלמד",inPrep:"בהכנה",topicsTitle:"נושאי הקורס",goalsTitle:"מטרות הקורס",courseContentTitle:"תכנית הלימודים של הקורס",courseContentSubtitle:"תוכן לימודי מובנה לקורס זה — מדריכים ותרגילים לפי נושא",openCourseTopics:"פתחו את נושאי הקורס",tabLearn:"לומדים",tabPractice:"מתרגלים",guideInPrep:"מדריך בהכנה",guideInPrepBody:"תוכן הלימוד לנושא זה ייכתב בשלב הבא. בינתיים אפשר לעבור ללשונית ״מתרגלים״.",practiceInPrep:"תרגול בהכנה",practiceInPrepBody:"עדיין אין תרגילים פעילים לנושא זה. חזרו בקרוב.",practiceIntro:"תרגילים לנושא זה ברמה הנוכחית:",startPractice:"התחל תרגול",nextTopic:"הנושא הבא",prevTopic:"הנושא הקודם",levelBeginner:"מתחילים",levelIntermediate:"בינוני",levelAdvanced:"מתקדם",levelMastery:"מומחיות",emptyCourses:"אין קורסים בתחום זה עדיין.",emptyTopics:"אין נושאים בקורס זה עדיין."}},u=tq,ag="he";function X(n,e){return n.replace(/\{(\w+)\}/g,(t,r)=>r in e?String(e[r]):t)}function Zt(n){return new Intl.NumberFormat(ag).format(n)}function nq(n){return new Intl.DateTimeFormat(ag,{day:"numeric",month:"long"}).format(new Date(n))}function mr(n,e=new Date){const t=Math.round((new Date(e.toDateString()).getTime()-new Date(new Date(n).toDateString()).getTime())/864e5);return new Intl.RelativeTimeFormat(ag,{numeric:"auto"}).format(-t,"day")}/**
3596 * @license lucide-react v0.469.0 - ISC
3597 *
3598 * This source code is licensed under the ISC license.
3599 * See the LICENSE file in the root directory of this source tree.
3600 */const rq=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s7=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
3601 * @license lucide-react v0.469.0 - ISC
3602 *
3603 * This source code is licensed under the ISC license.
3604 * See the LICENSE file in the root directory of this source tree.
3605 */var sq={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
3606 * @license lucide-react v0.469.0 - ISC
3607 *
3608 * This source code is licensed under the ISC license.
3609 * See the LICENSE file in the root directory of this source tree.
3610 */const iq=E.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...c},l)=>E.createElement("svg",{ref:l,...sq,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:s7("lucide",s),...c},[...a.map(([d,m])=>E.createElement(d,m)),...Array.isArray(i)?i:[i]]));/**
3611 * @license lucide-react v0.469.0 - ISC
3612 *
3613 * This source code is licensed under the ISC license.
3614 * See the LICENSE file in the root directory of this source tree.
3615 */const ae=(n,e)=>{const t=E.forwardRef(({className:r,...s},i)=>E.createElement(iq,{ref:i,iconNode:e,className:s7(`lucide-${rq(n)}`,r),...s}));return t.displayName=`${n}`,t};/**
3616 * @license lucide-react v0.469.0 - ISC
3617 *
3618 * This source code is licensed under the ISC license.
3619 * See the LICENSE file in the root directory of this source tree.
3620 */const aq=ae("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
3621 * @license lucide-react v0.469.0 - ISC
3622 *
3623 * This source code is licensed under the ISC license.
3624 * See the LICENSE file in the root directory of this source tree.
3625 */const oq=ae("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
3626 * @license lucide-react v0.469.0 - ISC
3627 *
3628 * This source code is licensed under the ISC license.
3629 * See the LICENSE file in the root directory of this source tree.
3630 */const cq=ae("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
3631 * @license lucide-react v0.469.0 - ISC
3632 *
3633 * This source code is licensed under the ISC license.
3634 * See the LICENSE file in the root directory of this source tree.
3635 */const lq=ae("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
3636 * @license lucide-react v0.469.0 - ISC
3637 *
3638 * This source code is licensed under the ISC license.
3639 * See the LICENSE file in the root directory of this source tree.
3640 */const og=ae("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
3641 * @license lucide-react v0.469.0 - ISC
3642 *
3643 * This source code is licensed under the ISC license.
3644 * See the LICENSE file in the root directory of this source tree.
3645 */const dq=ae("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
3646 * @license lucide-react v0.469.0 - ISC
3647 *
3648 * This source code is licensed under the ISC license.
3649 * See the LICENSE file in the root directory of this source tree.
3650 */const Vu=ae("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
3651 * @license lucide-react v0.469.0 - ISC
3652 *
3653 * This source code is licensed under the ISC license.
3654 * See the LICENSE file in the root directory of this source tree.
3655 */const i7=ae("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
3656 * @license lucide-react v0.469.0 - ISC
3657 *
3658 * This source code is licensed under the ISC license.
3659 * See the LICENSE file in the root directory of this source tree.
3660 */const uq=ae("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/**
3661 * @license lucide-react v0.469.0 - ISC
3662 *
3663 * This source code is licensed under the ISC license.
3664 * See the LICENSE file in the root directory of this source tree.
3665 */const dr=ae("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
3666 * @license lucide-react v0.469.0 - ISC
3667 *
3668 * This source code is licensed under the ISC license.
3669 * See the LICENSE file in the root directory of this source tree.
3670 */const hq=ae("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
3671 * @license lucide-react v0.469.0 - ISC
3672 *
3673 * This source code is licensed under the ISC license.
3674 * See the LICENSE file in the root directory of this source tree.
3675 */const mq=ae("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
3676 * @license lucide-react v0.469.0 - ISC
3677 *
3678 * This source code is licensed under the ISC license.
3679 * See the LICENSE file in the root directory of this source tree.
3680 */const Us=ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
3681 * @license lucide-react v0.469.0 - ISC
3682 *
3683 * This source code is licensed under the ISC license.
3684 * See the LICENSE file in the root directory of this source tree.
3685 */const Qb=ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
3686 * @license lucide-react v0.469.0 - ISC
3687 *
3688 * This source code is licensed under the ISC license.
3689 * See the LICENSE file in the root directory of this source tree.
3690 */const ui=ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
3691 * @license lucide-react v0.469.0 - ISC
3692 *
3693 * This source code is licensed under the ISC license.
3694 * See the LICENSE file in the root directory of this source tree.
3695 */const pq=ae("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
3696 * @license lucide-react v0.469.0 - ISC
3697 *
3698 * This source code is licensed under the ISC license.
3699 * See the LICENSE file in the root directory of this source tree.
3700 */const Xn=ae("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
3701 * @license lucide-react v0.469.0 - ISC
3702 *
3703 * This source code is licensed under the ISC license.
3704 * See the LICENSE file in the root directory of this source tree.
3705 */const fq=ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
3706 * @license lucide-react v0.469.0 - ISC
3707 *
3708 * This source code is licensed under the ISC license.
3709 * See the LICENSE file in the root directory of this source tree.
3710 */const a7=ae("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
3711 * @license lucide-react v0.469.0 - ISC
3712 *
3713 * This source code is licensed under the ISC license.
3714 * See the LICENSE file in the root directory of this source tree.
3715 */const o7=ae("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
3716 * @license lucide-react v0.469.0 - ISC
3717 *
3718 * This source code is licensed under the ISC license.
3719 * See the LICENSE file in the root directory of this source tree.
3720 */const Ll=ae("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
3721 * @license lucide-react v0.469.0 - ISC
3722 *
3723 * This source code is licensed under the ISC license.
3724 * See the LICENSE file in the root directory of this source tree.
3725 */const gq=ae("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
3726 * @license lucide-react v0.469.0 - ISC
3727 *
3728 * This source code is licensed under the ISC license.
3729 * See the LICENSE file in the root directory of this source tree.
3730 */const c7=ae("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
3731 * @license lucide-react v0.469.0 - ISC
3732 *
3733 * This source code is licensed under the ISC license.
3734 * See the LICENSE file in the root directory of this source tree.
3735 */const l7=ae("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/**
3736 * @license lucide-react v0.469.0 - ISC
3737 *
3738 * This source code is licensed under the ISC license.
3739 * See the LICENSE file in the root directory of this source tree.
3740 */const d7=ae("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/**
3741 * @license lucide-react v0.469.0 - ISC
3742 *
3743 * This source code is licensed under the ISC license.
3744 * See the LICENSE file in the root directory of this source tree.
3745 */const yq=ae("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/**
3746 * @license lucide-react v0.469.0 - ISC
3747 *
3748 * This source code is licensed under the ISC license.
3749 * See the LICENSE file in the root directory of this source tree.
3750 */const u7=ae("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
3751 * @license lucide-react v0.469.0 - ISC
3752 *
3753 * This source code is licensed under the ISC license.
3754 * See the LICENSE file in the root directory of this source tree.
3755 */const bq=ae("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
3756 * @license lucide-react v0.469.0 - ISC
3757 *
3758 * This source code is licensed under the ISC license.
3759 * See the LICENSE file in the root directory of this source tree.
3760 */const xq=ae("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
3761 * @license lucide-react v0.469.0 - ISC
3762 *
3763 * This source code is licensed under the ISC license.
3764 * See the LICENSE file in the root directory of this source tree.
3765 */const vq=ae("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/**
3766 * @license lucide-react v0.469.0 - ISC
3767 *
3768 * This source code is licensed under the ISC license.
3769 * See the LICENSE file in the root directory of this source tree.
3770 */const Iq=ae("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/**
3771 * @license lucide-react v0.469.0 - ISC
3772 *
3773 * This source code is licensed under the ISC license.
3774 * See the LICENSE file in the root directory of this source tree.
3775 */const cg=ae("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/**
3776 * @license lucide-react v0.469.0 - ISC
3777 *
3778 * This source code is licensed under the ISC license.
3779 * See the LICENSE file in the root directory of this source tree.
3780 */const _q=ae("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
3781 * @license lucide-react v0.469.0 - ISC
3782 *
3783 * This source code is licensed under the ISC license.
3784 * See the LICENSE file in the root directory of this source tree.
3785 */const kq=ae("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
3786 * @license lucide-react v0.469.0 - ISC
3787 *
3788 * This source code is licensed under the ISC license.
3789 * See the LICENSE file in the root directory of this source tree.
3790 */const wq=ae("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
3791 * @license lucide-react v0.469.0 - ISC
3792 *
3793 * This source code is licensed under the ISC license.
3794 * See the LICENSE file in the root directory of this source tree.
3795 */const zh=ae("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
3796 * @license lucide-react v0.469.0 - ISC
3797 *
3798 * This source code is licensed under the ISC license.
3799 * See the LICENSE file in the root directory of this source tree.
3800 */const h7=ae("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
3801 * @license lucide-react v0.469.0 - ISC
3802 *
3803 * This source code is licensed under the ISC license.
3804 * See the LICENSE file in the root directory of this source tree.
3805 */const Zb=ae("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
3806 * @license lucide-react v0.469.0 - ISC
3807 *
3808 * This source code is licensed under the ISC license.
3809 * See the LICENSE file in the root directory of this source tree.
3810 */const jq=ae("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
3811 * @license lucide-react v0.469.0 - ISC
3812 *
3813 * This source code is licensed under the ISC license.
3814 * See the LICENSE file in the root directory of this source tree.
3815 */const as=ae("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
3816 * @license lucide-react v0.469.0 - ISC
3817 *
3818 * This source code is licensed under the ISC license.
3819 * See the LICENSE file in the root directory of this source tree.
3820 */const _d=ae("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
3821 * @license lucide-react v0.469.0 - ISC
3822 *
3823 * This source code is licensed under the ISC license.
3824 * See the LICENSE file in the root directory of this source tree.
3825 */const Tq=ae("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
3826 * @license lucide-react v0.469.0 - ISC
3827 *
3828 * This source code is licensed under the ISC license.
3829 * See the LICENSE file in the root directory of this source tree.
3830 */const Jb=ae("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/**
3831 * @license lucide-react v0.469.0 - ISC
3832 *
3833 * This source code is licensed under the ISC license.
3834 * See the LICENSE file in the root directory of this source tree.
3835 */const lg=ae("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
3836 * @license lucide-react v0.469.0 - ISC
3837 *
3838 * This source code is licensed under the ISC license.
3839 * See the LICENSE file in the root directory of this source tree.
3840 */const Xb=ae("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/**
3841 * @license lucide-react v0.469.0 - ISC
3842 *
3843 * This source code is licensed under the ISC license.
3844 * See the LICENSE file in the root directory of this source tree.
3845 */const Lu=ae("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
3846 * @license lucide-react v0.469.0 - ISC
3847 *
3848 * This source code is licensed under the ISC license.
3849 * See the LICENSE file in the root directory of this source tree.
3850 */const Qi=ae("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/**
3851 * @license lucide-react v0.469.0 - ISC
3852 *
3853 * This source code is licensed under the ISC license.
3854 * See the LICENSE file in the root directory of this source tree.
3855 */const Eq=ae("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/**
3856 * @license lucide-react v0.469.0 - ISC
3857 *
3858 * This source code is licensed under the ISC license.
3859 * See the LICENSE file in the root directory of this source tree.
3860 */const m7=ae("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
3861 * @license lucide-react v0.469.0 - ISC
3862 *
3863 * This source code is licensed under the ISC license.
3864 * See the LICENSE file in the root directory of this source tree.
3865 */const Nq=ae("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
3866 * @license lucide-react v0.469.0 - ISC
3867 *
3868 * This source code is licensed under the ISC license.
3869 * See the LICENSE file in the root directory of this source tree.
3870 */const qu=ae("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
3871 * @license lucide-react v0.469.0 - ISC
3872 *
3873 * This source code is licensed under the ISC license.
3874 * See the LICENSE file in the root directory of this source tree.
3875 */const Sq=ae("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
3876 * @license lucide-react v0.469.0 - ISC
3877 *
3878 * This source code is licensed under the ISC license.
3879 * See the LICENSE file in the root directory of this source tree.
3880 */const Fh=ae("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
3881 * @license lucide-react v0.469.0 - ISC
3882 *
3883 * This source code is licensed under the ISC license.
3884 * See the LICENSE file in the root directory of this source tree.
3885 */const Aq=ae("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/**
3886 * @license lucide-react v0.469.0 - ISC
3887 *
3888 * This source code is licensed under the ISC license.
3889 * See the LICENSE file in the root directory of this source tree.
3890 */const Cq=ae("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
3891 * @license lucide-react v0.469.0 - ISC
3892 *
3893 * This source code is licensed under the ISC license.
3894 * See the LICENSE file in the root directory of this source tree.
3895 */const Mq=ae("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/**
3896 * @license lucide-react v0.469.0 - ISC
3897 *
3898 * This source code is licensed under the ISC license.
3899 * See the LICENSE file in the root directory of this source tree.
3900 */const ql=ae("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
3901 * @license lucide-react v0.469.0 - ISC
3902 *
3903 * This source code is licensed under the ISC license.
3904 * See the LICENSE file in the root directory of this source tree.
3905 */const p7=ae("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
3906 * @license lucide-react v0.469.0 - ISC
3907 *
3908 * This source code is licensed under the ISC license.
3909 * See the LICENSE file in the root directory of this source tree.
3910 */const dg=ae("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/**
3911 * @license lucide-react v0.469.0 - ISC
3912 *
3913 * This source code is licensed under the ISC license.
3914 * See the LICENSE file in the root directory of this source tree.
3915 */const Pq=ae("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
3916 * @license lucide-react v0.469.0 - ISC
3917 *
3918 * This source code is licensed under the ISC license.
3919 * See the LICENSE file in the root directory of this source tree.
3920 */const bo=ae("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
3921 * @license lucide-react v0.469.0 - ISC
3922 *
3923 * This source code is licensed under the ISC license.
3924 * See the LICENSE file in the root directory of this source tree.
3925 */const Rq=ae("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.48
39256",key:"1pkts6"}]]);/**
3926 * @license lucide-react v0.469.0 - ISC
3927 *
3928 * This source code is licensed under the ISC license.
3929 * See the LICENSE file in the root directory of this source tree.
3930 */const Oq=ae("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/**
3931 * @license lucide-react v0.469.0 - ISC
3932 *
3933 * This source code is licensed under the ISC license.
3934 * See the LICENSE file in the root directory of this source tree.
3935 */const ug=ae("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
3936 * @license lucide-react v0.469.0 - ISC
3937 *
3938 * This source code is licensed under the ISC license.
3939 * See the LICENSE file in the root directory of this source tree.
3940 */const hg=ae("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
3941 * @license lucide-react v0.469.0 - ISC
3942 *
3943 * This source code is licensed under the ISC license.
3944 * See the LICENSE file in the root directory of this source tree.
3945 */const Dq=ae("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/**
3946 * @license lucide-react v0.469.0 - ISC
3947 *
3948 * This source code is licensed under the ISC license.
3949 * See the LICENSE file in the root directory of this source tree.
3950 */const Xt=ae("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
3951 * @license lucide-react v0.469.0 - ISC
3952 *
3953 * This source code is licensed under the ISC license.
3954 * See the LICENSE file in the root directory of this source tree.
3955 */const Zi=ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
3956 * @license lucide-react v0.469.0 - ISC
3957 *
3958 * This source code is licensed under the ISC license.
3959 * See the LICENSE file in the root directory of this source tree.
3960 */const Vq=ae("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
3961 * @license lucide-react v0.469.0 - ISC
3962 *
3963 * This source code is licensed under the ISC license.
3964 * See the LICENSE file in the root directory of this source tree.
3965 */const zu=ae("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
3966 * @license lucide-react v0.469.0 - ISC
3967 *
3968 * This source code is licensed under the ISC license.
3969 * See the LICENSE file in the root directory of this source tree.
3970 */const $h=ae("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
3971 * @license lucide-react v0.469.0 - ISC
3972 *
3973 * This source code is licensed under the ISC license.
3974 * See the LICENSE file in the root directory of this source tree.
3975 */const f7=ae("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
3976 * @license lucide-react v0.469.0 - ISC
3977 *
3978 * This source code is licensed under the ISC license.
3979 * See the LICENSE file in the root directory of this source tree.
3980 */const Lq=ae("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
3981 * @license lucide-react v0.469.0 - ISC
3982 *
3983 * This source code is licensed under the ISC license.
3984 * See the LICENSE file in the root directory of this source tree.
3985 */const g7=ae("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
3985y:"oel41y"}]]);/**
3986 * @license lucide-react v0.469.0 - ISC
3987 *
3988 * This source code is licensed under the ISC license.
3989 * See the LICENSE file in the root directory of this source tree.
3990 */const qq=ae("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
3991 * @license lucide-react v0.469.0 - ISC
3992 *
3993 * This source code is licensed under the ISC license.
3994 * See the LICENSE file in the root directory of this source tree.
3995 */const y7=ae("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
3996 * @license lucide-react v0.469.0 - ISC
3997 *
3998 * This source code is licensed under the ISC license.
3999 * See the LICENSE file in the root directory of this source tree.
4000 */const b7=ae("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
4001 * @license lucide-react v0.469.0 - ISC
4002 *
4003 * This source code is licensed under the ISC license.
4004 * See the LICENSE file in the root directory of this source tree.
4005 */const zq=ae("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
4006 * @license lucide-react v0.469.0 - ISC
4007 *
4008 * This source code is licensed under the ISC license.
4009 * See the LICENSE file in the root directory of this source tree.
4010 */const x7=ae("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
4011 * @license lucide-react v0.469.0 - ISC
4012 *
4013 * This source code is licensed under the ISC license.
4014 * See the LICENSE file in the root directory of this source tree.
4015 */const Bh=ae("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
4016 * @license lucide-react v0.469.0 - ISC
4017 *
4018 * This source code is licensed under the ISC license.
4019 * See the LICENSE file in the root directory of this source tree.
4020 */const Uh=ae("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
4021 * @license lucide-react v0.469.0 - ISC
4022 *
4023 * This source code is licensed under the ISC license.
4024 * See the LICENSE file in the root directory of this source tree.
4025 */const mg=ae("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
4026 * @license lucide-react v0.469.0 - ISC
4027 *
4028 * This source code is licensed under the ISC license.
4029 * See the LICENSE file in the root directory of this source tree.
4030 */const Ji=ae("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
4031 * @license lucide-react v0.469.0 - ISC
4032 *
4033 * This source code is licensed under the ISC license.
4034 * See the LICENSE file in the root directory of this source tree.
4035 */const v7=ae("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
4036 * @license lucide-react v0.469.0 - ISC
4037 *
4038 * This source code is licensed under the ISC license.
4039 * See the LICENSE file in the root directory of this source tree.
4040 */const Fq=ae("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}
4040],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
4041 * @license lucide-react v0.469.0 - ISC
4042 *
4043 * This source code is licensed under the ISC license.
4044 * See the LICENSE file in the root directory of this source tree.
4045 */const Gh=ae("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
4046 * @license lucide-react v0.469.0 - ISC
4047 *
4048 * This source code is licensed under the ISC license.
4049 * See the LICENSE file in the root directory of this source tree.
4050 */const zl=ae("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
4051 * @license lucide-react v0.469.0 - ISC
4052 *
4053 * This source code is licensed under the ISC license.
4054 * See the LICENSE file in the root directory of this source tree.
4055 */const $q=ae("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
4056 * @license lucide-react v0.469.0 - ISC
4057 *
4058 * This source code is licensed under the ISC license.
4059 * See the LICENSE file in the root directory of this source tree.
4060 */const pg=ae("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
4061 * @license lucide-react v0.469.0 - ISC
4062 *
4063 * This source code is licensed under the ISC license.
4064 * See the LICENSE file in the root directory of this source tree.
4065 */const Bq=ae("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
4066 * @license lucide-react v0.469.0 - ISC
4067 *
4068 * This source code is licensed under the ISC license.
4069 * See the LICENSE file in the root directory of this source tree.
4070 */const Lr=ae("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
4071 * @license lucide-react v0.469.0 - ISC
4072 *
4073 * This source code is licensed under the ISC license.
4074 * See the LICENSE file in the root directory of this source tree.
4075 */const pr=ae("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
4076 * @license lucide-react v0.469.0 - ISC
4077 *
4078 * This source code is licensed under the ISC license.
4079 * See the LICENSE file in the root directory of this source tree.
4080 */const Xi=ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ex(n){document.documentElement.dataset.theme=n}const I7=ul()($u((n,e)=>({theme:"light",toggle:()=>{const t=e().theme==="light"?"dark":"light";ex(t),n({theme:t})}}),{name:"shirat-theme",onRehydrateStorage:()=>n=>{n&&ex(n.theme)}})),xc={musician:[{label:u.nav.student.dashboard,path:"/student",icon:_d},{label:u.nav.student.learn,path:"/student/learn",icon:as},{label:u.curriculum.navTitle,path:"/student/curriculum",icon:Sq},{label:u.nav.student.practice,path:"/student/practice",icon:bo},{label:u.nav.student.courses,path:"/student/courses",icon:dr},{label:u.nav.student.progress,path:"/student/progress",icon:Ji},{label:u.nav.student.notifications,path:"/student/notifications",icon:i7},{label:u.nav.student.profile,path:"/student/profile",icon:Bq},{label:u.nav.student.settings,path:"/student/settings",icon:Lq}],teacher:[{label:u.nav.teacher.dashboard,path:"/teacher",icon:_d},{label:u.nav.teacher.quickCapture,path:"/teacher/capture",icon:ug},{label:u.nav.teacher.homework,path:"/teacher/homework",icon:a7},{label:u.nav.teacher.students,path:"/teacher/students",icon:Lr},{label:u.nav.teacher.assignment,path:"/teacher/assignment",icon:Qi},{label:u.nav.teacher.announce,path:"/teacher/announce",icon:Fh},{label:u.nav.teacher.content,path:"/teacher/content",icon:Xb}],admin:[{label:u.nav.admin.dashboard,path:"/admin",icon:_d},{label:u.nav.admin.approvals,path:"/admin/approvals",icon:$q},{label:u.nav.admin.groups,path:"/admin/groups",icon:lg},{label:u.nav.admin.teachers,path:"/admin/teachers",icon:as},{label:u.nav.admin.students,path:"/admin/students",icon:Lr},{label:u.nav.admin.studentImport,path:"/admin/student-import",icon:pg},{label:u.nav.admin.practiceTracks,path:"/admin/practice-tracks",icon:Qi},{label:u.nav.admin.permissions,path:"/admin/permissions",icon:g7},{label:u.nav.admin.library,path:"/admin/library",icon:h7},{label:u.nav.admin.analytics,path:"/admin/analytics",icon:Ji}],content_author:[{label:u.nav.studio.dashboard,path:"/studio",icon:_d},{label:u.nav.studio.activities,path:"/studio/activities",icon:bo},{label:u.nav.studio.audio,path:"/studio/audio",icon:ql},{label:u.nav.studio.scores,path:"/studio/scores",icon:cg},{label:u.nav.studio.attachments,path:"/studio/attachments",icon:Rq},{label:u.nav.studio.knowledge,path:"/studio/knowledge",icon:Xb}]},Uq={musician:xc.musician.slice(0,5),teacher:xc.teacher.slice(0,5),admin:xc.admin.slice(0,5),content_author:xc.content_author.slice(0,5)};
4080function _7(...n){return n.filter(Boolean).join(" ")}function ee({variant:n="primary",className:e,...t}){const r={primary:"bg-primary text-on-primary shadow-card hover:bg-primary-hover hover:shadow-hover",ghost:"text-text-secondary hover:bg-surface-sunken hover:text-text",soft:"bg-primary-soft text-primary hover:bg-primary hover:text-on-primary"};return o.jsx("button",{className:_7("inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-semibold","transition-all duration-150 active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-primary)]",r[n],e),...t})}function W({className:n,...e}){return o.jsx("div",{className:_7("rounded-lg border border-border bg-surface p-5 shadow-card transition-shadow duration-200",n),...e})}function tt({title:n,subtitle:e,actions:t}){return o.jsxs("header",{className:"mb-6 flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:n}),e?o.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:e}):null]}),t]})}function hi({name:n,color:e,size:t=40}){return o.jsx("span",{"aria-hidden":!0,className:"inline-flex shrink-0 items-center justify-center rounded-full font-semibold text-white",style:{backgroundColor:e,width:t,height:t,fontSize:t*.4},children:n.slice(0,1)})}function Gs({value:n,label:e}){const t=Math.round(Math.min(1,Math.max(0,n))*100);return o.jsx("div",{role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,...e?{"aria-label":e}:{},className:"h-2 w-full overflow-hidden rounded-full bg-surface-sunken",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${t}%`}})})}function Gq({title:n,icon:e=gq}){return o.jsxs("div",{children:[o.jsx(tt,{title:n}),o.jsxs(W,{className:"flex flex-col items-center gap-3 py-16 text-center",children:[o.jsx("span",{className:"flex size-14 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(e,{size:26,"aria-hidden":!0})}),o.jsx("p",{className:"text-lg font-semibold",children:u.common.comingSoon}),o.jsx("p",{className:"max-w-sm text-sm text-text-secondary",children:u.common.placeholderNote})]})]})}const Kq=["admin","teacher","content_author","musician"];function Kh(){const n=Be(b=>b.session),e=Be(b=>b.signOut),{theme:t,toggle:r}=I7(),s=A_({select:b=>b.location.pathname}),i=It(),a=()=>{e(),i({to:"/login"})};if(!n)return null;const c=xc[n.activeRole],l=Uq[n.activeRole],d=Kq.filter(b=>n.user.roles.includes(b)),p=(fe({queryKey:["notifications",n.user.id],queryFn:()=>ol.list(n.user.id)}).data??[]).filter(b=>!b.read).length,f=b=>b.path.endsWith("/notifications")&&p>0?p:0,g=b=>b.path===Yr(n.activeRole)?s===b.path:s.startsWith(b.path),x=t==="light"?p7:x7;return o.jsxs("div",{className:"flex min-h-dvh",children:[o.jsxs("aside",{className:"sticky top-0 hidden h-dvh w-64 flex-col border-e border-border bg-surface md:flex",children:[o.jsxs("div",{className:"px-5 py-5",children:[o.jsx("img",{src:"/brand/logo.png",alt:u.app.name,className:"mb-3 h-14 w-auto rounded-md bg-white p-1"}),d.length>1?o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-[11px] font-medium text-text-muted",children:u.common.viewAs}),o.jsx("div",{className:"flex rounded-lg bg-surface-sunken p-0.5 text-xs font-semibold",children:d.map(b=>o.jsx("button",{onClick:()=>void i({to:Yr(b)}),"aria-pressed":b===n.activeRole,className:`flex-1 rounded-md px-2 py-1.5 transition-colors ${b===n.activeRole?"bg-primary text-on-primary shadow-card":"text-text-secondary hover:text-primary"}`,children:u.roles[b]},b))})]}):o.jsx("p",{className:"text-xs font-medium text-text-muted",children:u.roles[n.activeRole]})]}),o.jsx("nav",{"aria-label":u.roles[n.activeRole],className:"flex-1 space-y-1 overflow-y-auto px-3",children:c.map(b=>o.jsxs(un,{to:b.path,"aria-current":g(b)?"page":void 0,className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium transition-colors ${g(b)?"bg-primary-soft text-primary":"text-text-secondary hover:bg-surface-sunken hover:text-text"}
4080`,children:[o.jsx(b.icon,{size:18,"aria-hidden":!0}),o.jsx("span",{className:"flex-1",children:b.label}),f(b)>0?o.jsx("span",{className:"min-w-5 rounded-full bg-danger px-1.5 py-0.5 text-center text-[11px] font-bold leading-none text-white",children:f(b)}):null]},b.path))}),o.jsx("div",{className:"border-t border-border p-3",children:o.jsxs("div",{className:"flex items-center gap-3 rounded-md px-2 py-2",children:[o.jsx(hi,{name:n.user.displayName,color:n.user.avatarColor,size:36}),o.jsx("span",{className:"flex-1 truncate text-sm font-medium",children:n.user.displayName}),o.jsx("button",{onClick:r,"aria-label":u.common.toggleTheme,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-text",children:o.jsx(x,{size:17,"aria-hidden":!0})}),o.jsx("button",{onClick:a,"aria-label":u.common.signOut,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-danger",children:o.jsx(qu,{size:17,"aria-hidden":!0,className:"-scale-x-100"})})]})})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("header",{className:"sticky top-0 z-10 flex items-center justify-between border-b border-border bg-surface px-4 py-3 md:hidden",children:[o.jsx("img",{src:"/brand/logo.png",alt:u.app.name,className:"h-9 w-auto rounded bg-white p-0.5"}),d.length>1?o.jsx("div",{className:"flex rounded-md bg-surface-sunken p-0.5 text-[11px] font-semibold",children:d.map(b=>o.jsx("button",{onClick:()=>void i({to:Yr(b)}),"aria-pressed":b===n.activeRole,className:`rounded px-2 py-1 transition-colors ${b===n.activeRole?"bg-primary text-on-primary":"text-text-secondary"}`,children:u.roles[b]},b))}):null,o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:r,"aria-label":u.common.toggleTheme,className:"rounded-md p-2 text-text-muted hover:text-text",children:o.jsx(x,{size:19,"aria-hidden":!0})}),o.jsx("button",{onClick:a,"aria-label":u.common.signOut,className:"rounded-md p-2 text-text-muted hover:text-danger",children:o.jsx(qu,{size:19,"aria-hidden":!0,className:"-scale-x-100"})})]})]}),o.jsx("main",{className:"page-enter mx-auto w-full max-w-5xl flex-1 px-4 py-6 pb-24 md:px-8 md:pb-8",children:o.jsx(jx,{})},s),o.jsx("nav",{"aria-label":u.roles[n.activeRole],className:"fixed inset-x-0 bottom-0 z-10 flex border-t border-border bg-surface pb-[env(safe-area-inset-bottom)] md:hidden",children:l.map(b=>o.jsxs(un,{to:b.path,"aria-current":g(b)?"page":void 0,className:`flex flex-1 flex-col items-center gap-1 py-2.5 text-[11px] font-medium ${g(b)?"text-primary":"text-text-muted"}`,children:[o.jsxs("span",{className:"relative",children:[o.jsx(b.icon,{size:20,"aria-hidden":!0}),f(b)>0?o.jsx("span",{className:"absolute -end-2 -top-1.5 min-w-4 rounded-full bg-danger px-1 text-center text-[10px] font-bold leading-tight text-white",children:f(b)}):null]}),b.label]},b.path))})]})]})}function Hq(){const n=Be(I=>I.signInAs),e=Be(I=>I.signInAsGuest),t=It(),[r,s]=E.useState(""),[i,a]=E.useState(""),[c,l]=E.useState(null),[d,m]=E.useState(!1),[p,f]=E.useState(!1),g=I=>{n(I);const N=Be.getState().session;N&&t({to:Yr(N.activeRole)})},x=async()=>{if(!(!r.trim()||!i||d)){m(!0),l(null);try{const I=await ZL.loginWithCredentials(r,i);I.ok?g(I.userId):l(I.reason==="pending"?u.auth.loginPending:I.reason==="rejected"?u.auth.loginRejected:u.auth.loginInvalid)}finally{m(!1)}}},b=xo;return o.jsxs("div",{className:"flex min-h-dvh flex-col items-center bg-bg pb-12",children:[o.jsxs("header",{className:"relative flex min-h-72 w-full flex-col items-center justify-center overflow-hidden px-4 py-12 text-center md:min-h-96",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 bg-cover",style:{backgroundImage:"url(/brand/hero-group.jpg)",backgroundPosition:"center 42%"}}),o.jsx("div",{"aria-hidden":!0,className:"absolute inset-0",style:{background:"linear-gradient(to bottom, rgb(17 69 84 / 0.82), rgb(17 69 84 / 0.62) 60%, var(--color-bg))"}}),o.jsxs("div",{className:"page-enter relative",children:[o.jsx("h1",{className:"mx-auto max-w-2xl text-3xl font-bold leading-tight text-white drop-shadow-md md:text-4xl",children:u.app.welcomeTitle}),o.jsx("p",{className:"mt-3 text-lg font-medium text-[#e3cfa4] md:text-xl",children:u.app.tagline})]})]}),o.jsx("img",{src:"/brand/logo.png",alt:u.app.name,className:"page-enter relative z-10 -mt-6 h-32 w-auto md:h-40"}),o.jsxs(W,{className:"page-enter relative mt-8 w-[calc(100%-2rem)] max-w-md",children:[o.jsx("h2",{className:"text-lg font-semibold",children:u.auth.loginTitle}),o.jsx("p",{className:"mb-5 mt-1 text-sm text-text-secondary",children:u.auth.loginSubtitle}),o.jsxs("form",{onSubmit:I=>{I.preventDefault(),x()},className:"space-y-3",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.auth.emailLabel}),o.jsx("input",{type:"email",dir:"ltr",value:r,onChange:I=>s(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm focus:border-primary"})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.auth.passwordLabel}),o.jsx("input",{type:"password",value:i,onChange:I=>a(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm focus:border-primary"})]}),c?o.jsx("p",{role:"alert",className:"rounded-md bg-danger/10 px-3 py-2 text-sm font-medium text-danger",children:c}):null,o.jsxs(ee,{type:"submit",disabled:!r.trim()||!i||d,className:"w-full",children:[o.jsx(Nq,{size:16,"aria-hidden":!0}),u.auth.loginSubmit]})]}),o.jsxs("button",{onClick:()=>void t({to:"/register"}),className:"mt-5 flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-border-strong px-4 py-3 text-sm font-semibold text-primary transition-colors hover:border-primary hover:bg-primary-soft",children:[o.jsx(pg,{size:16,"aria-hidden":!0}),u.auth.registerCta]}),o.jsxs("div",{className:"my-4 flex items-center gap-3 text-xs text-text-muted",children:[o.jsx("span",{className:"h-px flex-1 bg-border"}),u.auth.orDivider,o.jsx("span",{className:"h-px flex-1 bg-border"})]}),o.jsxs(ee,{variant:"soft",onClick:()=>{e(),t({to:"/student/practice"})},className:"w-full justify-center",children:[o.jsx(Pq,{size:16,"aria-hidden":!0}),u.auth.guestCta]}),o.jsx("p",{className:"mt-1.5 text-center text-xs text-text-muted",children:u.auth.guestHint}),o.jsxs("div",{className:"mt-5 border-t border-border pt-4",children:[o.jsx("button",{onClick:()=>f(I=>!I),className:"text-xs font-medium text-text-muted hover:text-text",children:u.auth.devPickerToggle}),p?o.jsxs("ul",{className:"mt-3 space-y-2",children:[b.map(I=>{const N=I.roles[0];return o.jsx("li",{children:o.jsxs("button",{onClick:()=>g(I.id),className:"flex w-full items-center gap-3 rounded-md border border-border px-4 py-2.5 text-start transition-colors hover:border-border-strong hover:bg-surface-sunken",children:[o.jsx(hi,{name:I.displayName,color:I.avatarColor,size:32}),o.jsxs("span",{className:"flex-1",children:[o.jsx("span",{className:"block text-sm font-semibold",children:I.displayName}),o.jsx("span",{className:"block text-xs text-text-muted",children:I.roles.map(V=>u.roles[V]).join(" · ")})]}),o.jsxs("span",{className:"rounded-full bg-primary-soft px-3 py-1 text-xs font-medium text-primary",children:[u.auth.signInAs," ",N?u.roles[N]:""]})]})},I.id)}),o.jsx("li",{children:o.jsx("button",{onClick:()=>
4080void WL.createMusician({displayName:"תלמיד/ה חדש/ה",instrument:u.auth.instruments[0]??"פסנתר"}).then(I=>g(I.id)),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-border-strong px-4 py-2.5 text-xs font-semibold text-text-secondary hover:border-primary",children:u.auth.joinCta})})]}):null]})]}),o.jsx("p",{className:"mt-6 text-xs text-text-muted",children:u.auth.mockBadge})]})}function Wq(){const n=Be(m=>m.session),e=r7(m=>m.complete),t=It(),[r,s]=E.useState(""),[i,a]=E.useState(""),[c,l]=E.useState(null),d=()=>{if(r.length<6)return l(u.auth.changePwTooShort);if(r==="1234")return l(u.auth.changePwSameAsInitial);if(r!==i)return l(u.auth.changePwMismatch);l(null),n&&(iS(n.user.id,r),e(n.user.id),t({to:Yr(n.activeRole)}))};return o.jsx("div",{className:"flex min-h-dvh flex-col items-center justify-center bg-bg px-4",children:o.jsxs(W,{className:"w-full max-w-md",children:[o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2 text-center",children:[o.jsx("span",{className:"flex size-12 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(Tq,{size:22,"aria-hidden":!0})}),o.jsx("h1",{className:"text-xl font-bold",children:u.auth.changePwTitle}),o.jsx("p",{className:"text-sm text-text-secondary",children:u.auth.changePwSubtitle})]}),o.jsxs("label",{className:"mb-3 block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.auth.newPassword}),o.jsx("input",{type:"password",value:r,onChange:m=>s(m.target.value),autoComplete:"new-password",className:"w-full rounded-md border border-border bg-surface px-3 py-2 outline-none focus:border-primary"})]}),o.jsxs("label",{className:"mb-4 block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.auth.confirmPassword}),o.jsx("input",{type:"password",value:i,onChange:m=>a(m.target.value),autoComplete:"new-password",onKeyDown:m=>m.key==="Enter"&&d(),className:"w-full rounded-md border border-border bg-surface px-3 py-2 outline-none focus:border-primary"})]}),c?o.jsx("p",{role:"alert",className:"mb-3 rounded-md bg-danger/10 px-3 py-2 text-sm font-medium text-danger",children:c}):null,o.jsx(ee,{className:"w-full justify-center",onClick:d,disabled:!r||!i,children:u.auth.changePwSubmit})]})})}const Yq={firstName:"",lastName:"",hebrewFullName:"",phone:"",email:"",password:"",confirmPassword:"",primaryInstrument:"",secondaryInstrument:"",musicalBackground:"",yearsExperience:"",previousStudies:"",genderTrack:"",trackId:"",groupId:"",city:"",dateOfBirth:"",notes:""};function Qq(n){switch(n.message){case"invalid-phone":return u.register.invalidPhone;case"passwords-mismatch":return u.register.passwordsMismatch}if(n.code==="invalid_format"&&n.format==="email")return u.register.invalidEmail;if(n.code==="too_small"){const e=n.path[0];return e==="password"||e==="confirmPassword"?u.register.passwordShort:u.register.required}return u.register.required}function Zq(n){if(n.success)return{};const e={};for(const t of n.error.issues){const r=t.path[0];typeof r=="string"&&!(r in e)&&(e[r]=Qq(t))}return e}function Tn({label:n,htmlFor:e,error:t,children:r}){return o.jsxs("label",{htmlFor:e,className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-text-secondary",children:n}),r,t?o.jsx("span",{className:"mt-1 block text-xs font-medium text-danger",children:t}):null]})}const En="w-full rounded-lg border border-border bg-surface px-3.5 py-3 text-base text-start transition-colors focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary-soft";function Vn({label:n,value:e}){return e?o.jsxs("div",{className:"flex items-start justify-between gap-4 py-2",children:[o.jsx("dt",{className:"text-sm text-text-muted",children:n}),o.jsx("dd",{className:"text-sm font-medium text-text text-end",children:e})]}):null}const np=u.register.steps.length;function Jq(){var V;const n=It(),[e,t]=E.useState(0),[r,s]=E.useState(Yq),[i,a]=E.useState({}),c=fe({queryKey:["academic"],queryFn:()=>pt.get()}),l=lt({mutationFn:D=>Ts.submit(D)}),d=(...D)=>a(T=>{const M={...T};for(const R of D)delete M[R];return M}),m=(D,T)=>{s(M=>({...M,[D]:T})),i[D]&&d(D)},p=E.useMemo(()=>{var M;const D=c.data;if(!D||!r.trackId)return[];const T=(M=cs(D,new Date))==null?void 0:M.id;return o4(D,r.trackId,T)},[c.data,r.trackId]),f=D=>{let T;if(D===0)T=IS.safeParse({firstName:r.firstName,lastName:r.lastName,hebrewFullName:r.hebrewFullName,phone:r.phone,email:r.email,password:r.password,confirmPassword:r.confirmPassword});else if(D===1)T=_S.safeParse({primaryInstrument:r.primaryInstrument,secondaryInstrument:r.secondaryInstrument||void 0,musicalBackgroun
4080d:r.musicalBackground,yearsExperience:r.yearsExperience===""?NaN:Number(r.yearsExperience),previousStudies:r.previousStudies||void 0});else if(D===2)T=kS.safeParse({genderTrack:r.genderTrack,trackId:r.trackId,groupId:r.groupId,city:r.city,dateOfBirth:r.dateOfBirth||void 0,notes:r.notes||void 0});else return!0;const M=Zq(T);return a(M),Object.keys(M).length===0},g=()=>{f(e)&&t(D=>Math.min(np-1,D+1))},x=()=>{a({}),t(D=>Math.max(0,D-1))},b=D=>{s(T=>({...T,genderTrack:D,trackId:jS[D],groupId:""})),d("genderTrack","groupId")},I=()=>{if(!f(2)||!r.genderTrack)return;const D={firstName:r.firstName.trim(),lastName:r.lastName.trim(),hebrewFullName:r.hebrewFullName.trim(),phone:r.phone.trim(),email:r.email.trim(),password:r.password,primaryInstrument:r.primaryInstrument,...r.secondaryInstrument?{secondaryInstrument:r.secondaryInstrument}:{},musicalBackground:r.musicalBackground.trim(),yearsExperience:Number(r.yearsExperience),...r.previousStudies?{previousStudies:r.previousStudies.trim()}:{},genderTrack:r.genderTrack,trackId:r.trackId,groupId:r.groupId,city:r.city.trim(),...r.dateOfBirth?{dateOfBirth:r.dateOfBirth}:{},...r.notes?{notes:r.notes.trim()}:{}};l.mutate(D)};if(l.isSuccess)return o.jsx("div",{className:"flex min-h-dvh flex-col items-center justify-center bg-bg px-4 py-12",children:o.jsxs(W,{className:"page-enter w-full max-w-lg text-center",children:[o.jsx("span",{className:"mx-auto mb-5 flex size-16 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(Oq,{size:30,"aria-hidden":!0})}),o.jsx("h1",{className:"text-2xl font-bold md:text-3xl",children:u.register.successTitle}),o.jsx("p",{className:"mx-auto mt-3 max-w-md text-base leading-relaxed text-text-secondary",children:u.register.successBody}),o.jsx(ee,{className:"mt-8 w-full",onClick:()=>void n({to:"/login"}),children:u.register.successCta})]})});const N=e===np-1;return o.jsx("div",{className:"flex min-h-dvh flex-col items-center bg-bg px-4 py-10",children:o.jsxs("div",{className:"w-full max-w-lg",children:[o.jsxs("header",{className:"mb-8 text-center",children:[o.jsx("h1",{className:"text-2xl font-bold leading-tight md:text-3xl",children:u.register.title}),o.jsx("p",{className:"mt-2 text-base text-text-secondary",children:u.register.subtitle})]}),o.jsxs("div",{className:"mb-8",children:[o.jsx("p",{className:"mb-3 text-sm font-medium text-text-muted",children:X(u.register.stepOf,{n:e+1,total:np})}),o.jsx("ol",{className:"flex items-center gap-2",children:u.register.steps.map((D,T)=>{const M=T<e,R=T===e;return o.jsxs("li",{className:"flex flex-1 flex-col items-center gap-2",children:[o.jsx("div",{className:"flex w-full items-center",children:o.jsx("span",{"aria-current":R?"step":void 0,className:`flex size-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold transition-colors ${M?"bg-primary text-on-primary":R?"bg-primary text-on-primary ring-4 ring-primary-soft":"bg-surface-sunken text-text-muted"}`,children:M?o.jsx(Us,{size:16,"aria-hidden":!0}):T+1})}),o.jsx("span",{className:`text-center text-xs font-medium ${R?"text-primary":"text-text-muted"}`,children:D})]},D)})})]}),o.jsxs(W,{className:"page-enter",children:[e===0?o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-lg font-semibold",children:u.register.steps[0]}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[o.jsx(Tn,{label:u.register.firstName,htmlFor:"firstName",error:i.firstName,children:o.jsx("input",{id:"firstName",className:En,value:r.firstName,onChange:D=>m("firstName",D.target.value)})}),o.jsx(Tn,{label:u.register.lastName,htmlFor:"lastName",error:i.lastName,children:o.jsx("input",{id:"lastName",className:En,value:r.lastName,onChange:D=>m("lastName",D.target.value)})})]}),o.jsx(Tn,{label:u.register.hebrewFullName,htmlFor:"hebrewFullName",error:i.hebrewFullName,children:o.jsx("input",{id:"hebrewFullName",className:En,value:r.hebrewFullName,onChange:D=>m("hebrewFullName",D.target.value)})}),o.jsx(Tn,{label:u.register.phone,htmlFor:"phone",error:i.phone,children:o.jsx("input",{id:"phone",type:"tel",inputMode:"tel",dir:"ltr",placeholder:u.register.ph
4080onePlaceholder,className:En,value:r.phone,onChange:D=>m("phone",D.target.value)})}),o.jsx(Tn,{label:u.register.email,htmlFor:"email",error:i.email,children:o.jsx("input",{id:"email",type:"email",inputMode:"email",dir:"ltr",className:En,value:r.email,onChange:D=>m("email",D.target.value)})}),o.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[o.jsx(Tn,{label:u.register.password,htmlFor:"password",error:i.password,children:o.jsx("input",{id:"password",type:"password",className:En,value:r.password,onChange:D=>m("password",D.target.value)})}),o.jsx(Tn,{label:u.register.confirmPassword,htmlFor:"confirmPassword",error:i.confirmPassword,children:o.jsx("input",{id:"confirmPassword",type:"password",className:En,value:r.confirmPassword,onChange:D=>m("confirmPassword",D.target.value)})})]})]}):null,e===1?o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-lg font-semibold",children:u.register.steps[1]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-text-secondary",children:u.register.primaryInstrument}),o.jsx("div",{className:"flex flex-wrap gap-2",children:u.auth.instruments.map(D=>o.jsx("button",{type:"button","aria-pressed":r.primaryInstrument===D,onClick:()=>m("primaryInstrument",D),className:`rounded-full border px-3.5 py-2 text-sm font-medium transition-colors ${r.primaryInstrument===D?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:D},D))}),i.primaryInstrument?o.jsx("span",{className:"mt-1 block text-xs font-medium text-danger",children:i.primaryInstrument}):null]}),o.jsx(Tn,{label:u.register.secondaryInstrument,htmlFor:"secondaryInstrument",children:o.jsxs("select",{id:"secondaryInstrument",className:En,value:r.secondaryInstrument,onChange:D=>m("secondaryInstrument",D.target.value),children:[o.jsx("option",{value:"",children:u.register.none}),u.auth.instruments.map(D=>o.jsx("option",{value:D,children:D},D))]})}),o.jsx(Tn,{label:u.register.musicalBackground,htmlFor:"musicalBackground",error:i.musicalBackground,children:o.jsx("textarea",{id:"musicalBackground",rows:3,placeholder:u.register.musicalBackgroundPlaceholder,className:En,value:r.musicalBackground,onChange:D=>m("musicalBackground",D.target.value)})}),o.jsx(Tn,{label:u.register.yearsExperience,htmlFor:"yearsExperience",error:i.yearsExperience,children:o.jsx("input",{id:"yearsExperience",type:"number",inputMode:"numeric",min:0,max:80,className:En,value:r.yearsExperience,onChange:D=>m("yearsExperience",D.target.value)})}),o.jsx(Tn,{label:u.register.previousStudies,htmlFor:"previousStudies",children:o.jsx("textarea",{id:"previousStudies",rows:2,className:En,value:r.previousStudies,onChange:D=>m("previousStudies",D.target.value)})})]}):null,e===2?o.jsxs("div",{className:"space-y-5",children:[o.jsx("h2",{className:"text-lg font-semibold",children:u.register.steps[2]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-2 block text-sm font-medium text-text-secondary",children:u.register.genderTrack}),o.jsx("div",{className:"grid grid-cols-2 gap-3",children:[["men",u.register.trackMen],["women",u.register.trackWomen]].map(([D,T])=>{const M=r.genderTrack===D;return o.jsx("button",{type:"button","aria-pressed":M,onClick:()=>b(D),className:`rounded-xl border-2 px-4 py-5 text-center text-base font-semibold transition-colors ${M?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:T},D)})}),i.genderTrack?o.jsx("span",{className:"mt-1 block text-xs font-medium text-danger",children:i.genderTrack}):null]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-2 block text-sm font-medium text-text-secondary",children:u.register.learningTrack}),r.trackId?o.jsx("div",{className:"grid grid-cols-1 gap-2",children:p.map(D=>{const T=r.groupId===D.id;return o.jsxs("button",{type:"button","aria-pressed":T,onClick:()=>m("groupId",D.id),className:`flex items-center gap-3 rounded-lg border px-4 py-3 text-start transition-colors ${T?"border-primary bg-primary-soft":"border-border hover:border-border-strong"}
4080`,children:[o.jsx("span",{"aria-hidden":!0,className:"size-3 shrink-0 rounded-full",style:{backgroundColor:D.color}}),o.jsx("span",{className:"flex-1 text-sm font-medium",children:D.name}),T?o.jsx(Us,{size:18,className:"text-primary","aria-hidden":!0}):null]},D.id)})}):o.jsx("p",{className:"rounded-lg border border-dashed border-border-strong px-4 py-6 text-center text-sm text-text-muted",children:u.register.selectGroupFirst}),i.groupId?o.jsx("span",{className:"mt-1 block text-xs font-medium text-danger",children:i.groupId}):null]}),o.jsx(Tn,{label:u.register.city,htmlFor:"city",error:i.city,children:o.jsx("input",{id:"city",className:En,value:r.city,onChange:D=>m("city",D.target.value)})}),o.jsx(Tn,{label:u.register.dateOfBirth,htmlFor:"dateOfBirth",children:o.jsx("input",{id:"dateOfBirth",type:"date",className:En,value:r.dateOfBirth,onChange:D=>m("dateOfBirth",D.target.value)})}),o.jsx(Tn,{label:u.register.notes,htmlFor:"notes",children:o.jsx("textarea",{id:"notes",rows:2,className:En,value:r.notes,onChange:D=>m("notes",D.target.value)})})]}):null,e===3?o.jsxs("div",{className:"space-y-6",children:[o.jsx("h2",{className:"text-lg font-semibold",children:u.register.steps[3]}),o.jsx("p",{className:"text-sm text-text-secondary",children:u.register.reviewTitle}),o.jsxs("section",{children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text",children:u.register.steps[0]}),o.jsxs("dl",{className:"divide-y divide-border",children:[o.jsx(Vn,{label:u.register.hebrewFullName,value:r.hebrewFullName||`${r.firstName} ${r.lastName}`.trim()}),o.jsx(Vn,{label:u.register.phone,value:r.phone}),o.jsx(Vn,{label:u.register.email,value:r.email})]})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text",children:u.register.steps[1]}),o.jsxs("dl",{className:"divide-y divide-border",children:[o.jsx(Vn,{label:u.register.primaryInstrument,value:r.primaryInstrument}),o.jsx(Vn,{label:u.register.secondaryInstrument,value:r.secondaryInstrument}),o.jsx(Vn,{label:u.register.musicalBackground,value:r.musicalBackground}),o.jsx(Vn,{label:u.register.yearsExperience,value:r.yearsExperience}),o.jsx(Vn,{label:u.register.previousStudies,value:r.previousStudies})]})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text",children:u.register.steps[2]}),o.jsxs("dl",{className:"divide-y divide-border",children:[o.jsx(Vn,{label:u.register.genderTrack,value:r.genderTrack==="men"?u.register.trackMen:r.genderTrack==="women"?u.register.trackWomen:""}),o.jsx(Vn,{label:u.register.learningTrack,value:((V=p.find(D=>D.id===r.groupId))==null?void 0:V.name)??""}),o.jsx(Vn,{label:u.register.city,value:r.city}),o.jsx(Vn,{label:u.register.dateOfBirth,value:r.dateOfBirth}),o.jsx(Vn,{label:u.register.notes,value:r.notes})]})]})]}):null,o.jsxs("div",{className:"mt-8 flex items-center gap-3",children:[e>0?o.jsxs(ee,{variant:"ghost",onClick:x,disabled:l.isPending,children:[o.jsx(pq,{size:18,"aria-hidden":!0}),u.register.back]}):null,o.jsx("div",{className:"ms-auto",children:N?o.jsx(ee,{onClick:I,disabled:l.isPending,children:l.isPending?u.register.submitting:u.register.submit}):o.jsxs(ee,{onClick:g,children:[u.register.next,o.jsx(ui,{size:18,"aria-hidden":!0})]})})]})]}),o.jsx("p",{className:"mt-6 text-center text-sm",children:o.jsx("button",{type:"button",onClick:()=>void n({to:"/login"}),className:"font-medium text-primary hover:underline",children:u.register.haveAccount})})]})})}function Xq(n){const e=n.parameters.objectiveId;return typeof e=="string"?e:null}function kd(n,e,t){return n.find(r=>!t.includes(r)&&Xq(r)===e.objectiveId)??n.find(r=>!t.includes(r)&&r.type===e.activityType)}function ez(n,e,t={}){var d;if(n.length===0)return null;const r=t.maxActivities??3;if(t.pathObjectiveId){const m=e.find(f=>f.objectiveId===t.pathObjectiveId),p=m&&kd(n,m,[]);if(m&&p){const f=[p],g=kd(n,m,f);return g&&f.length<r&&f.push(g),{source:"coach",activities:f,reasonKey:"coach.reason.pathStep",detail:{objective:m.objectiveTitle,path:t.pathTitle??""}}}}for(const m of t.reviewDue??[]){const p=kd(n,m,[]);if(p)return{source:"coach",activities:[p],reasonKey:"coach.reason.review",detail
4080:{objective:m.objectiveTitle}}}const s=m=>{var p;return(p=t.focusCategories)!=null&&p.includes(m.activityType)?-.2:0},i=[...e].sort((m,p)=>m.mastery+s(m)-(p.mastery+s(p))||m.objectiveId.localeCompare(p.objectiveId)),a=[];let c=null;for(const m of i){if(a.length>=r)break;const p=kd(n,m,a);p&&(a.push(p),c??(c=m))}if(a.length===0)return{source:"coach",activities:n.slice(0,Math.min(2,r)),reasonKey:"coach.reason.firstSteps"};const l=c!==null&&(((d=t.focusCategories)==null?void 0:d.includes(c.activityType))??!1);return{source:"coach",activities:a,reasonKey:l?"coach.reason.goalFocus":"coach.reason.weakObjective",...c?{detail:{objective:c.objectiveTitle}}:{}}}const tz="https://tonejs.github.io/audio/salamander";function nz(n){const e=["C","Cs","D","Ds","E","F","Fs","G","Gs","A","As","B"],t=Math.floor(n/12)-1;return`${e[n%12]}${t}.mp3`}const rz={id:"salamander-grand",kind:"pitched",samples:Object.fromEntries(Array.from({length:17},(n,e)=>48+e*3).map(n=>[n,`${tz}/${nz(n)}`]))},wd="https://tonejs.github.io/audio/drum-samples",sz={id:"acoustic-kit",kind:"percussion",samples:{click:`${wd}/acoustic-kit/hihat.mp3`,accent:`${wd}/acoustic-kit/snare.mp3`,kick:`${wd}/acoustic-kit/kick.mp3`,tom:`${wd}/acoustic-kit/tom1.mp3`}},tx={piano:rz,percussion:sz},rp=new Map;async function k7(n,e){const t=rp.get(e);if(t)return t;const r=(async()=>{const s=new AbortController,i=setTimeout(()=>s.abort(),1e4);try{const a=await fetch(e,{signal:s.signal});if(!a.ok)throw new Error(`Sample fetch failed (${a.status}): ${e}`);return await n.decodeAudioData(await a.arrayBuffer())}finally{clearTimeout(i)}})();return rp.set(e,r),r.catch(()=>rp.delete(e)),r}function w7(n,e,t,r,s,i){const a=n.createBufferSource(),c=n.createGain();if(a.buffer=e,a.playbackRate.value=r,c.gain.setValueAtTime(s,t),a.connect(c).connect(n.destination),a.start(t),i!==void 0){const l=t+i/1e3;c.gain.setValueAtTime(s,Math.max(t,l-.08)),c.gain.linearRampToValueAtTime(1e-4,l),a.stop(l+.02)}}class iz{constructor(e,t){this.ctx=e,this.buffers=t}playNote(e,t={}){let r=null;for(const a of this.buffers.keys())(r===null||Math.abs(a-e)<Math.abs(r-e))&&(r=a);if(r===null)return;const s=this.buffers.get(r);if(!s)return;const i=(t.atMs??this.ctx.currentTime*1e3)/1e3;w7(this.ctx,s,i,2**((e-r)/12),t.velocity??.85,t.durationMs)}}class az{constructor(e,t){this.ctx=e,this.buffers=t}hit(e,t,r=.9){const s=this.buffers.get(e)??this.buffers.values().next().value;s&&w7(this.ctx,s,(t??this.ctx.currentTime*1e3)/1e3,1,r)}}async function oz(n,e){const t=Object.entries(e.samples),r=await Promise.all(t.map(([,s])=>k7(n,s)));return new iz(n,new Map(t.map(([s],i)=>[Number(s),r[i]])))}async function cz(n,e){const t=Object.entries(e.samples),r=await Promise.all(t.map(([,s])=>k7(n,s)));return new az(n,new Map(t.map(([s],i)=>[s,r[i]])))}function lz(n){return 440*2**((n-69)/12)}class nx{constructor(e){this.ctx=e}playNote(e,t={}){const r=(t.atMs??this.ctx.currentTime*1e3)/1e3,s=(t.durationMs??800)/1e3,i=(t.velocity??.85)*.4,a=this.ctx.createOscillator(),c=this.ctx.createGain();a.type="triangle",a.frequency.value=lz(e),c.gain.setValueAtTime(0,r),c.gain.linearRampToValueAtTime(i,r+.02),c.gain.setValueAtTime(i,r+s-.1),c.gain.linearRampToValueAtTime(0,r+s),a.connect(c).connect(this.ctx.destination),a.start(r),a.stop(r+s)}}class rx{constructor(e){this.ctx=e}hit(e,t,r=.9){const s=(t??this.ctx.currentTime*1e3)/1e3,i=e==="accent",a=this.ctx.createOscillator(),c=this.ctx.createGain();a.type="square",a.frequency.value=i?1568:1046,c.gain.setValueAtTime(0,s),c.gain.linearRampToValueAtTime(r*(i?.3:.22),s+.003),c.gain.exponentialRampToValueAtTime(1e-4,s+.06),a.connect(c).connect(this.ctx.destination),a.start(s),a.stop(s+.08)}}const sp=900,sx=150;class dz{constructor(){L(this,"ctx",null);L(this,"pitched",new Map);L(this,"percussionLoad",null);L(this,"percussionNow",null)}context(){return this.ctx??(this.ctx=new AudioContext),this.ctx}instrument(e){let t=this.pitched.get(e);if(!t){const r=this.context(),s=tx[e];t=s.kind==="pitched"?oz(r,s).catch(()=>new nx(r)):Promise.resolve(new nx(r)),this.pitched.set(e,t)}return t}percussion(){if(!this.percussionLoad){const e=this.context(),t=tx.percussion;this.percussionLoad=cz(e,t).catch(()=>new rx(e)).then(r=>(this.percussionNow=r,r))}return this.percussionLoad}preload(e){for(const t of e)t==="piano"?this.instrument("piano"):this.percussion()}async resume(){const e=this.context();e.state==="suspended"&&await e.resume()}nowMs(){return this.context().currentTime*1e3}scheduleClick(e,t=!1){const r=this.percussionNow??new rx(this.context());this.percussionNow||this.percussion(),r.hit(t?"accent":"click",e)}playNote(e,t=900){this.resume().then(()=>this.instrument("piano").then(r=>r.playNote(e,{durationMs:t})))}async playChord(e,t=1500){await this.resume();const r=await this.instrument("piano"),s=this.nowMs()+40;for(const i of e)r.playNote(i,{atMs:s,durationMs:t});await lc(t+100)}async playSequence(e,t=420){await this.resume();const r=await this.instrument("piano"),s=this.nowMs()+40;e.forEach((i,a)=>{const c=a===e.length-1;r.playNote(i,{atMs:s+a*t,durationMs:c?t*2.2:t+180})}),await lc(e.length*t+600)}async playChordSequence(e,t=950){await this.resume();const r=await this.instrument("piano"),s=this.nowMs()+40;e.forEach((i,a)=>{const c=a===e.length-1;for(const l of i)r.playNote(l,{atMs:s+a*t,durationMs:c?t*1.8:t})}),await lc(e.length*t+700)}async playInterval(e,t,r){await this.resume();const s=await this.instrument("piano"),i=this.nowMs()+60,[a,c]=r==="descending"?[e+t,e]:[e,e+t];r==="harmonic"?(s.playNote(a,{atMs:i,durationMs:1700}),s.playNote(c,{atMs:i,durationMs:1700}),await lc(1800)):(s.playNote(a,{atMs:i,durationMs:sp+250}),s.playNote(c,{atMs:i+sp+sx,durationMs:1500}),await lc(sp*2+sx+200))}dispose(){var e;(e=this.ctx)==null||e.close(),this.ctx=null,this.pitched.clear(),this.percussionLoad=null,this.percussionNow=null}}function lc(n){return new Promise(e=>setTimeout(e,n))}let ix=null;function et(){return ix??(ix=new dz),ix}function bt(n){var e,t,r,s,i,a,c,l,d,m,p,f,g,x,b,I,N;switch(n.messageKey){case"practice.feedback.correct":return u.practice.feedback.correct;case"practice.feedback.incorrectInterval":return X(u.practice.feedback.incorrectInterval,{expected:pl(String(((e=n.detail)==null?void 0:e.expected)??""))});case"practice.feedback.rhythmGreat":return u.practice.feedback.rhythmGreat;case"practice.feedback.rhythmOk":return X(u.practice.feedback.rhythmOk,{ms:((t=n.detail)==null?void 0:t.ms)??0});case"practice.feedback.rhythmRetry":return u.practice.feedback.rhythmRetry;case"practice.feedback.chordIncorrect":return X(u.practice.feedback.chordIncorrect,{chord:((r=n.detail)==null?void 0:r.chord)??""});case"practice.feedback.incorrectEntity":return X(u.practice.feedback.incorrectEntity,{expected:((s=n.detail)==null?void 0:s.expected)??""});case"practice.feedback.sequencePartial":return X(u.practice.feedback.sequencePartial,{n:((i=n.detail)==null?void 0:i.n)??0});case"practice.feedback.sequenceIncorrect":return X(u.practice.feedback.sequenceIncorrect,{expected:((a=n.detail)==null?void 0:a.expected)??""});case"practice.feedback.selectIncorrect":return u.practice.feedback.selectIncorrect;case"practice.feedback.selectIncorrectWrong":return u.practice.feedback.selectIncorrectWrong;case"practice.feedback.matchingIncorrect":return X(u.practice.feedback.matchingIncorrect,{n:((c=n.detail)==null?void 0:c.n)??0});case"practice.feedback.selfAssessed":return X(u.practice.feedback.selfAssessed,{rating:((l=n.detail)==null?void 0:l.rating)??0});case"practice.feedback.buildPartial":return X(u.practice.feedback.buildPartial,{n:((d=n.detail)==null?void 0:d.n)??0,total:((m=n.detail)==null?void 0:m.total)??0});
4080case"practice.feedback.organizePartial":return X(u.practice.feedback.organizePartial,{n:((p=n.detail)==null?void 0:p.n)??0,total:((f=n.detail)==null?void 0:f.total)??0});case"practice.feedback.incorrectAccidental":{const V=String(((g=n.detail)==null?void 0:g.letter)??"c"),D=Number(((x=n.detail)==null?void 0:x.accidental)??0),T=D===1?"♯":D===-1?"♭":"";return X(u.practice.feedback.incorrectAccidental,{name:`${qe("pitch."+V)}${T}`})}case"practice.feedback.intervalQuality":{const V=((b=n.detail)==null?void 0:b.quality)==="minor"?u.practice.intervalQuality.minor:u.practice.intervalQuality.major,D=((I=n.detail)==null?void 0:I.direction)==="up"?` ${u.practice.intervalQuality.up}`:((N=n.detail)==null?void 0:N.direction)==="down"?` ${u.practice.intervalQuality.down}`:"";return X(u.practice.feedback.intervalQuality,{label:`${V}${D}`})}case"practice.feedback.dictationIncorrect":return u.practice.feedback.dictationIncorrect;default:return n.messageKey}}function xt({steps:n}){return o.jsxs("div",{className:"mb-5 rounded-md bg-surface-sunken px-4 py-3",children:[o.jsx("p",{className:"mb-2 text-sm font-semibold",children:u.practice.rhythm.howToTitle}),o.jsx("ol",{className:"space-y-1.5 text-sm text-text-secondary",children:n.map((e,t)=>o.jsxs("li",{className:"flex gap-2.5",children:[o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-primary-soft text-[11px] font-bold text-primary",children:t+1}),e]},t))})]})}function la({activity:n,variant:e="header"}){const[t,r]=E.useState(!1),s=SN(n);if(!s)return null;const i=e==="header"?o.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-1.5 rounded-lg bg-accent/20 px-3.5 py-2 text-sm font-bold text-primary ring-1 ring-inset ring-accent/40 transition-colors hover:bg-accent/30",children:[o.jsx(dr,{size:16,"aria-hidden":!0}),u.practice.explain.open]}):o.jsxs("button",{onClick:()=>r(!0),className:"mt-1 inline-flex items-center gap-1.5 rounded-md bg-white/70 px-3 py-1.5 text-sm font-bold text-primary underline-offset-2 transition-colors hover:bg-white dark:bg-surface/70",children:[o.jsx(Lu,{size:15,"aria-hidden":!0}),u.practice.explain.why]});return o.jsxs(o.Fragment,{children:[i,t?o.jsx("div",{className:"fixed inset-0 z-50 flex justify-center overflow-y-auto bg-black/40 p-4 sm:items-center",role:"dialog","aria-modal":"true",onClick:()=>r(!1),children:o.jsxs("div",{dir:"rtl",className:"page-enter my-auto w-full max-w-lg rounded-2xl bg-surface shadow-raised",onClick:a=>a.stopPropagation(),children:[o.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-t-2xl px-6 py-5 text-white",style:{background:"var(--gradient-brand)"},children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium tracking-wide text-white/70",children:u.practice.explain.heading}),o.jsx("h2",{className:"mt-0.5 text-xl font-bold leading-tight",children:s.title})]}),o.jsx("button",{onClick:()=>r(!1),"aria-label":u.practice.explain.close,className:"rounded-full p-1.5 text-white/80 hover:bg-white/15 hover:text-white",children:o.jsx(Xi,{size:20,"aria-hidden":!0})})]}),o.jsxs("div",{className:"space-y-5 px-6 py-5",children:[o.jsx("p",{className:"text-[15px] leading-relaxed text-text-secondary",children:s.intro}),s.sections.map((a,c)=>o.jsxs("section",{children:[o.jsxs("h3",{className:"mb-1 flex items-center gap-2 font-bold text-primary",children:[o.jsx("span",{className:"h-4 w-1 rounded-full bg-accent","aria-hidden":!0}),a.heading]}),o.jsx("p",{className:"text-[15px] leading-relaxed text-text",children:a.body})]},c)),s.tip?o.jsxs("div",{className:"flex gap-3 rounded-xl bg-primary-soft px-4 py-3",children:[o.jsx(Lu,{size:20,"aria-hidden":!0,className:"mt-0.5 shrink-0 text-primary"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-bold text-primary",children:u.practice.explain.tipLabel}),o.jsx("p",{className:"text-sm leading-relaxed text-text-secondary",children:s.tip})]})]}):null]}),o.jsx("div",{className:"border-t border-border px-6 py-3 text-end",children:o.jsx(ee,{variant:"soft",onClick:()=>r(!1),children:u.practice.explain.close})})]})}):null]})}const Sa={now:()=>new Date().toISOString(),newId:()=>crypto.randomUUID()},Qe=ul((n,e)=>({session:null,lastRunResult:null,plan:[],planIndex:0,planSource:null,begin:(t,r)=>{const s=r.activities[0];if(!s)throw new Error("Cannot begin a session without activities");let i=AN({musicianId:t,source:ON(r)},Sa);i=w2(i,s,Sa),n({session:i,lastRunResult:null,plan:r.activities,planIndex:0,planSource:r.source})},capture:t=>{const r=e().session;if(!r)throw new Error("No active session");const{state:s,evaluation:i}=CN(r,t);return n({session:s}),i},finishRun:()=>{const{session:t,plan:r,planIndex:s}=e();if(!t)throw new Error("No active session");const{state:i,result:a}=MN(t,Sa),c=r[s+1];return n(c?{session:w2(i,c,Sa),lastRunResult:a,planIndex:s+1}:{session:i,lastRunResult:a}),a},finishSession:()=>{const t=e().session;if(!t)throw new Error("No active session");const r=PN(t,Sa);return n({session:r}),j2(r)},abandon:()=>{const t=e().session;if(!t||t.status!=="in_progress")return null;const r=RN(t,Sa);return n({session:r}),r.runs.some(i=>i.captured.length>0)?j2(r):null},clear:()=>n({session:null,lastRunResult:null,plan:[],planIndex:0,planSource:null})}));function uz({activity:n,onRunComplete:e}){const t=Qe(M=>M.capture),r=E.useMemo(()=>T6.parse(n.parameters),[n]),s=E.useMemo(()=>Lj(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(!1),[d,m]=E.useState(!1),[p,f]=E.useState(null),[g,x]=E.useState(null),b=E.useRef(Date.now()),I=s[i];if(!I)return null;const N=i===s.length-1,V=async()=>
4080{if(!d){m(!0);try{await et().playInterval(I.rootMidi,ta[I.interval],r.direction),c||(l(!0),b.current=Date.now())}finally{m(!1)}}},D=M=>{if(p||!c)return;const R={questionIndex:I.index,rootMidi:I.rootMidi,expected:I.interval,answered:M,responseMs:Date.now()-b.current},_={kind:"answer",capturedAt:new Date().toISOString(),payload:R};x(M),f(t(_))},T=()=>{if(N){e();return}a(i+1),f(null),x(null),l(!1)};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("div",{className:"mb-6 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${(i+(p?1:0))/s.length*100}%`}})}),i===0&&!c?o.jsx(xt,{steps:u.practice.earHowTo}):null,o.jsxs("div",{className:"mb-6 flex flex-col items-center gap-4 py-4",children:[o.jsx("button",{onClick:()=>void V(),disabled:d,"aria-label":c?u.practice.playAgain:u.practice.playInterval,className:"flex size-24 items-center justify-center rounded-full bg-primary text-on-primary shadow-raised transition-transform hover:scale-105 disabled:opacity-60",children:d?o.jsx(pr,{size:36,"aria-hidden":!0}):o.jsx(Xt,{size:36,"aria-hidden":!0,className:"-scale-x-100"})}),o.jsx("p",{className:"text-sm text-text-secondary",children:c?u.practice.whichInterval:u.practice.playInterval})]}),o.jsx("div",{className:"mb-4 grid grid-cols-2 gap-3",children:r.intervals.map(M=>{const R=p&&M===I.interval,_=p&&g===M&&M!==I.interval;return o.jsx("button",{onClick:()=>D(M),disabled:!c||!!p,className:`rounded-md border-2 px-4 py-4 text-base font-semibold transition-colors disabled:cursor-default ${R?"border-success bg-success/10 text-success":_?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:pl(M)},M)})}),p?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${p.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(p.feedback)}),p.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:T,children:N?u.practice.finishRun:u.practice.next})]}):null]})}const hz="modulepreload",mz=function(n){return"/"+n},ax={},j7=function(e,t,r){let s=Promise.resolve();if(t&&t.length>0){let a=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),l=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));s=a(t.map(d=>{if(d=mz(d),d in ax)return;ax[d]=!0;const m=d.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const f=document.createElement("link");if(f.rel=m?"stylesheet":hz,m||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),m)return new Promise((g,x)=>{f.addEventListener("load",g),f.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return s.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return e().catch(i)})},ox=n=>!n||n==="black"||n==="#000"||n==="#000000"||n==="rgb(0, 0, 0)"||n==="rgb(0,0,0)";function T7(n){n.querySelectorAll("path, rect, line, text").forEach(e=>{const t=e,r=t.getAttribute("fill"),s=t.getAttribute("stroke");r==="none"||r==="transparent"?ox(s)&&t.setAttribute("stroke","var(--color-text)"):ox(r)&&t.setAttribute("fill","var(--color-text)")})}let cx=null;async function pz(){return cx??(cx=await j7(()=>import("./vexflow-BGyEjsgt.js"),[])),cx}function yn({notes:n,clef:e="treble",timeSignature:t,keySignature:r,width:s=460,height:i=130,highlightIndex:a}){const c=E.useRef(null),l=n.map(d=>`${(d.keys??[]).join("+")}:${d.duration}`).join(",");return E.useEffect(()=>{let d=!1;return pz().then(m=>{if(d)return;const{Accidental:p,Dot:f,Formatter:g,Renderer:x,Stave:b,StaveNote:I,Voice:N}=m,V=c.current;if(V){V.innerHTML="";try{const D=new x(V,x.Backends.SVG);D.resize(s,i);const T=D.getContext(),M=new b(6,8,s-14);if(M.addClef(e),r&&M.addKeySignature(r),t&&M.addTimeSignature(t),M.setContext(T).draw(),n.length>0){const _=n.map((w,A)=>{const O=w.duration.endsWith("d"),C=new I({clef:e==="percussion"?"treble":e,keys:w.keys??["b/4"],duration:w.duration.replace("d","")});return O&&f.buildAndAttach([C],{all:!0}
4080),r||(w.keys??[]).forEach((S,z)=>{var ne;const re=(ne=/^[a-g](##|bb|#|b|n)/i.exec(S))==null?void 0:ne[1];re&&C.addModifier(new p(re),z)}),A===a&&C.setStyle({fillStyle:"#17566b",strokeStyle:"#17566b"}),C}),j=new N({numBeats:4,beatValue:4});j.setMode(N.Mode.SOFT),j.addTickables(_),new g().joinVoices([j]).format([j],s-90),j.draw(T,M)}const R=V.querySelector("svg");R&&(R.style.maxWidth="100%",R.style.height="auto",T7(R))}catch{V.textContent="♪"}}}),()=>{d=!0}},[l,e,t,r,s,i,a]),o.jsx("div",{dir:"ltr",ref:c,className:"flex justify-center overflow-x-auto","aria-hidden":!0})}function fz({activity:n,onRunComplete:e}){const t=Qe(w=>w.capture),r=E.useMemo(()=>E6.parse(n.parameters),[n]),[s,i]=E.useState(0),[a,c]=E.useState("idle"),[l,d]=E.useState(null),[m,p]=E.useState(0),f=E.useRef(0),g=E.useRef([]),x=E.useRef([]),b=r.beatsPerBar*r.bars,I=fl(r.bpm),N=b*I,V=s===r.rounds-1;E.useEffect(()=>()=>x.current.forEach(clearTimeout),[]);const D=async()=>{const w=et();await w.resume(),g.current=[];const A=w.nowMs()+350,O=r.beatsPerBar,C=A+O*I;f.current=C;for(let z=0;z<O;z++)w.scheduleClick(A+z*I,z===0);for(let z=0;z<b;z++)w.scheduleClick(C+z*I,z%r.beatsPerBar===0);c("count_in");const S=w.nowMs();x.current.push(window.setTimeout(()=>c("tapping"),C-S),window.setTimeout(()=>T(),C+N+300-S))},T=()=>{const w={round:s,taps:g.current},A={kind:"tap",capturedAt:new Date().toISOString(),payload:w};d(t(A)),c("feedback")},M=()=>{a==="tapping"&&(g.current.push(et().nowMs()-f.current),p(w=>w+1))},R=()=>{if(V){e();return}i(s+1),d(null),c("idle")},_=Array.from({length:b*2},(w,A)=>A/2),j=w=>r.pattern.some(A=>Math.abs(A-w)<.001);return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[o.jsx("p",{className:"text-sm font-medium text-text-muted",children:X(u.practice.rhythm.roundOf,{current:s+1,total:r.rounds})}),o.jsx("p",{className:"text-sm text-text-muted",children:X(u.practice.rhythm.bpm,{bpm:r.bpm})})]}),r.displayMode==="notation"?o.jsx("div",{className:"mb-6 mt-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:y5(r.pattern,b).map(w=>({duration:w})),clef:"percussion",timeSignature:`${r.beatsPerBar}/4`,width:420,height:110})}):o.jsx("div",{dir:"ltr",className:"mb-6 mt-4 flex gap-1","aria-hidden":!0,children:_.map(w=>o.jsx("div",{className:`h-10 flex-1 rounded-sm border ${j(w)?"border-primary bg-primary":w%1===0?"border-border bg-surface-sunken":"border-border/50 bg-surface"}`},w))}),a!=="idle"?o.jsx("p",{className:"mb-4 text-center text-sm font-medium text-text-secondary","aria-live":"polite",children:a==="count_in"?u.practice.rhythm.countIn:a==="tapping"?u.practice.rhythm.tapNow:u.practice.rhythm.instruction}):null,a==="idle"?o.jsxs("div",{className:"py-2",children:[o.jsx(xt,{steps:[r.displayMode==="notation"?u.practice.rhythm.step1notation:u.practice.rhythm.step1grid,u.practice.rhythm.step2,u.practice.rhythm.step3]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs(ee,{onClick:()=>void D(),children:[o.jsx(Xt,{size:16,"aria-hidden":!0,className:"-scale-x-100"}),u.practice.rhythm.startRound]})})]}):a==="feedback"&&l?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${l.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(l.feedback)}),o.jsx(ee,{onClick:R,children:V?u.practice.finishRun:u.practice.next})]}):o.jsx("button",{onPointerDown:M,onKeyDown:w=>{(w.key===" "||w.key==="Enter")&&(w.preventDefault(),M())},"aria-label":u.practice.rhythm.tapPad,className:`block h-40 w-full touch-manipulation select-none rounded-lg border-2 text-lg font-semibold transition-colors ${a==="tapping"?"border-primary bg-primary-soft text-primary":"border-border bg-surface-sunken text-text-muted"} ${m%2?"brightness-110":""}`,children:a==="tapping"?u.practice.rhythm.tapNow:u.practice.rhythm.countInPad})]})}function gz({activity:n,onRunComplete:e}){const t=Qe(C=>C.capture),r=E.useMemo(()=>N6.parse(n.parameters),[n]),s=E.useMemo(()=>Hj(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState("idle"),[d,m]=E.useState(null),[p,f]=E.useState(0),g=E.useRef(0),x=E.useRef([]),b=E.useRef([]),I=i===r.rounds-1,N=s[i],V=Ht(N.patternId).data,D=r.beatsPerBar*r.bars,T=fl(r.bpm),M=D*T,R=r.beatsPerBar*T;E.useEffect(()=>()=>b.current.forEach(clearTimeout),[]);const _=async()=>{const C=et();await C.resume(),x.current=[];const S=C.nowMs()+350;for(let ne=0;ne<D;ne++)C.scheduleClick(S+ne*T,!1);for(const ne of V.onsets)C.scheduleClick(S+ne*T,!0);l("listen");const z=C.nowMs(),re=S+M;if(r.mode==="echo"){const ne=re,ve=ne+R;g.current=ve;for(let $=0;$<r.beatsPerBar;$++)C.scheduleClick(ne+$*T,$===0);for(let $=0;$<D;$++)C.scheduleClick(ve+$*T,!1);b.current.push(window.setTimeout(()=>l("count_in"),re-z),window.setTimeout(()=>l("tapping"),ve-z),window.setTimeout(()=>j(),ve+M+300-z))}else{const ne=re,ve=ne+R;g.current=ve;for(let $=0;$<D;$++)C.scheduleClick(ve+$*T,!1);b.current.push(window.setTimeout(()=>l("silent"),ne-z),window.setTimeout(()=>l("tapping"),ve-z),window.setTimeout(()=>j(),ve+M+300-z))}},j=()=>{const C={round:i,patternId:N.patternId,taps:x.current},S={kind:"tap",capturedAt:new Date().toISOString(),payload:C};m(t(S)),l("feedback")},w=()=>{c==="tapping"&&(x.current.push(et().nowMs()-g.current),f(C=>C+1))},A=()=>{if(I){e();return}a(i+1),m(null),l("idle")},O=()=>{switch(c){case"listen":return u.practice.echo.listen;case"count_in":return u.practice.rhythm.countIn;case"silent":return u.practice.echo.silent;case"tapping":return u.practice.echo.yourTurn;default:return u.practice.rhythm.instruction}};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[o.jsx("p",{className:"text-sm font-medium text-text-muted",children:X(u.practice.rhythm.roundOf,{current:i+1,total:r.rounds})}),o.jsx("p",{className:"text-sm text-text-muted",children:X(u.practice.rhythm.bpm,{bpm:r.bpm})})]}),c!=="idle"?o.jsx("p",{className:"mb-4 mt-4 text-center text-sm font-medium text-text-secondary","aria-live":"polite",children:O()}):null,c==="idle"?o.jsxs("div",{className:"py-2",children:[o.jsx(xt,{steps:[u.practice.echo.howTo.listen,r.mode==="memory"?u.practice.echo.howTo.memory:u.practice.echo.howTo.echo,u.practice.echo.howTo.tap]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs(ee,{onClick:()=>
4080void _(),children:[o.jsx(Xt,{size:16,"aria-hidden":!0,className:"-scale-x-100"}),u.practice.rhythm.startRound]})})]}):c==="feedback"&&d?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${d.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(d.feedback)}),o.jsx(ee,{onClick:A,children:I?u.practice.finishRun:u.practice.next})]}):o.jsx("button",{onPointerDown:w,onKeyDown:C=>{(C.key===" "||C.key==="Enter")&&(C.preventDefault(),w())},disabled:c!=="tapping","aria-label":u.practice.rhythm.tapPad,className:`block h-40 w-full touch-manipulation select-none rounded-lg border-2 text-lg font-semibold transition-colors ${c==="tapping"?"border-primary bg-primary-soft text-primary":"border-border bg-surface-sunken text-text-muted"} ${p%2?"brightness-110":""}`,children:c==="tapping"?u.practice.rhythm.tapNow:u.practice.rhythm.countInPad})]})}const lx=new Set([1,3,6,8,10]);function Fl({lowMidi:n,highMidi:e,states:t={},onPress:r,disabled:s=!1,labelForMidi:i}){const a=[];for(let d=n;d<=e;d++)lx.has(d%12)||a.push(d);const c=100/a.length,l=(d,m)=>{const p=t[d]??{};return p.correct?"bg-success border-success":p.wrong?"bg-danger border-danger":p.root?"bg-accent border-accent":p.selected?"bg-primary border-primary":m?"bg-[#17171f] border-[#17171f] hover:enabled:bg-[#33333f]":"bg-white border-border hover:enabled:bg-[#eef6f8]"};return o.jsxs("div",{dir:"ltr",className:"relative h-36 w-full select-none",role:"group","aria-label":"piano",children:[o.jsx("div",{className:"flex h-full w-full gap-px",children:a.map(d=>{var f,g;const m=t[d]??{},p=m.correct||m.wrong||m.root||m.selected?"text-white/90":"text-[#5b6b73]";return o.jsx("button",{type:"button",disabled:s,onClick:()=>r==null?void 0:r(d),"aria-pressed":!!((f=t[d])!=null&&f.selected)||!!((g=t[d])!=null&&g.root),className:`relative flex h-full flex-1 items-end justify-center rounded-b-md border pb-1.5 shadow-sm transition-colors ${l(d,!1)}`,children:i?o.jsx("span",{className:`pointer-events-none select-none text-[10px] font-semibold leading-none ${p}`,children:i(d)}):null},d)})}),(()=>{var m,p;const d=[];for(let f=n;f<=e;f++){if(!lx.has(f%12))continue;const g=a.filter(x=>x<f).length;d.push(o.jsx("button",{type:"button",disabled:s,onClick:()=>r==null?void 0:r(f),"aria-pressed":!!((m=t[f])!=null&&m.selected)||!!((p=t[f])!=null&&p.root),style:{left:`calc(${g*c}% - 3.5%)`,width:"7%"},className:`absolute top-0 z-10 h-[60%] rounded-b-md border shadow-md transition-colors ${l(f,!0)}`},f))}return d})()]})}function fg(n){if(!Kd(n))return"";const e=qe(cr(n));return(n%12+12)%12===0?`${e}${Math.floor(n/12)-1}`:e}function gg(n,e){let t=n,r=e;for(;!Kd(t);)t--;for(;!Kd(r);)r++;return[t,r]}function yz({activity:n,onRunComplete:e}){const t=Qe(T=>T.capture),r=E.useMemo(()=>A6.parse(n.parameters),[n]),s=E.useMemo(()=>tT(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState([]),[d,m]=E.useState(null),p=s[i];if(!p)return null;const f=i===s.length-1,g=M6(p.rootMidi,p.chordId),[x,b]=gg(p.rootMidi-2,p.rootMidi+14),I=T=>{d||T===p.rootMidi||(et().playNote(T,700),l(M=>M.includes(T)?M.filter(R=>R!==T):[...M,T]))},N=()=>{const T={questionIndex:p.index,rootMidi:p.rootMidi,chordId:p.chordId,selectedMidis:[p.rootMidi,...c]},M={kind:"answer",capturedAt:new Date().toISOString(),payload:T};m(t(M)),et().playChord(g)},V=()=>{if(f){e();return}a(i+1),l([]),m(null)},D={};D[p.rootMidi]={root:!0};for(const T of c)D[T]=d?g.includes(T)?{correct:!0}:{wrong:!0}:{selected:!0};if(d)for(const T of g)T!==p.rootMidi&&!c.includes(T)&&(D[T]={correct:!0});return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-5 text-lg font-bold",children:X(u.practice.theory.buildPrompt,{chord:qe(p.chordId)})}),i===0&&c.length===0&&!d?o.jsx(xt,{steps:u.practice.theory.howTo}):null,o.jsx(Fl,{lowMidi:x,highMidi:b,states:D,onPress:I,disabled:!!d,labelForMidi:fg}),o.jsx("p",{className:"mt-2 text-center text-xs text-text-muted",children:u.practice.theory.rootHint}),d?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${d.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(d.feedback)}),o.jsx(ee,{onClick:V,children:f?u.practice.finishRun:u.practice.next})]}):o.jsx("div",{className:"mt-4 flex justify-center",children:o.jsxs(ee,{onClick:N,disabled:c.length===0,children:[o.jsx(Us,{size:15,"aria-hidden":!0}),u.practice.theory.check]})})]})}const bz=[{value:1,key:"normal"},{value:1.6,key:"slow"},{value:2.4,key:"slower"}];function da(n=1){return E.useState(n)}function ua({speed:n,onChange:e}){return o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-text-muted",children:[o.jsx(jq,{size:13,"aria-hidden":!0}),u.practice.speed.label]}),o.jsx("div",{className:"flex overflow-hidden rounded-md border border-border",children:bz.map(({value:t,key:r})=>o.jsx("button",{type:"button","aria-pressed":n===t,onClick:()=>e(t),className:`px-2.5 py-1 text-xs font-semibold transition-colors ${n===t?"bg-primary text-on-primary":"bg-surface text-text-secondary hover:bg-surface-sunken"}`,children:u.practice.speed[r]},t))})]})}const xz={ear_chord_quality:(n,e,t)=>n.playChord(hl(e.correctId,e.rootMidi),Math.round(1800*t)),ear_scale_recognition:(n,e,t)=>n.playSequence(Os(e.correctId,e.rootMidi),Math.round(420*t)),ear_cadence:(n,e,t)=>n.playChordSequence(Rx(f5(e.correctId,e.rootMidi)),Math.round(950*t))},vz=ue({optionIds:Te(G()),questionCount:B(),rootMidiRange:Io([B(),B()]),objectiveId:G().optional()});function ip({activity:n,onRunComplete:e}){const t=Qe(O=>O.capture),r=E.useMemo(()=>vz.parse(n.parameters),[n]),s=E.useMemo(()=>lT(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(!1),[d,m]=E.useState(!1),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=da(),N=n.typeId==="ear_chord_quality",[V,D]=E.useState(!1),T=E.useRef(Date.now()),M=s[i];if(!M)return null;const R=i===s.length-1,_=xz[n.typeId],j=async()=>
4080{if(!(d||!_)){m(!0);try{N&&V?await et().playSequence(hl(M.correctId,M.rootMidi),Math.round(500*b)):await _(et(),M,b),c||(l(!0),T.current=Date.now())}finally{m(!1)}}},w=O=>{if(p||!c)return;const C={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:M.index,rootMidi:M.rootMidi,expectedId:M.correctId,answeredId:O}};x(O),f(t(C))},A=()=>{if(R){e();return}a(i+1),f(null),x(null),l(!1)};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("div",{className:"mb-6 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${(i+(p?1:0))/s.length*100}%`}})}),i===0&&!c?o.jsx(xt,{steps:u.practice.earHowTo}):null,o.jsxs("div",{className:"mb-6 flex flex-col items-center gap-4 py-4",children:[o.jsx("button",{onClick:()=>void j(),disabled:d,"aria-label":c?u.practice.playAgain:u.practice.listen,className:"flex size-24 items-center justify-center rounded-full bg-primary text-on-primary shadow-raised transition-transform hover:scale-105 disabled:opacity-60",children:d?o.jsx(pr,{size:36,"aria-hidden":!0}):o.jsx(Xt,{size:36,"aria-hidden":!0,className:"-scale-x-100"})}),o.jsx("p",{className:"text-sm text-text-secondary",children:c?u.practice.whichEntity:u.practice.listen}),o.jsx(ua,{speed:b,onChange:I}),N?o.jsx("div",{className:"flex items-center gap-1 rounded-full bg-surface-sunken p-1",role:"group","aria-label":u.practice.chordPlay.title,children:[["block",!1],["arpeggio",!0]].map(([O,C])=>o.jsx("button",{type:"button",onClick:()=>D(C),"aria-pressed":V===C,className:`rounded-full px-3 py-1 text-sm font-semibold transition-colors ${V===C?"bg-primary text-on-primary":"text-text-secondary hover:text-primary"}`,children:u.practice.chordPlay[O]},O))}):null]}),o.jsx("div",{className:"mb-4 grid grid-cols-2 gap-3",children:r.optionIds.map(O=>{const C=p&&O===M.correctId,S=p&&g===O&&O!==M.correctId;return o.jsx("button",{onClick:()=>w(O),disabled:!c||!!p,className:`rounded-md border-2 px-4 py-4 text-base font-semibold transition-colors disabled:cursor-default ${C?"border-success bg-success/10 text-success":S?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:qe(O)},O)})}),p?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${p.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(p.feedback)}),p.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:A,children:R?u.practice.finishRun:u.practice.next})]}):null]})}function Iz({activity:n,onRunComplete:e}){const t=Qe(N=>N.capture),r=E.useMemo(()=>P6.parse(n.parameters),[n]),s=E.useMemo(()=>mT(r,Math.random),[r]),i=E.useMemo(()=>Vt("pitch"),[]),[a,c]=E.useState(0),[l,d]=E.useState(null),[m,p]=E.useState(null),f=s[a];if(!f)return null;const g=a===s.length-1,x=cr(f.midi),b=N=>{if(l)return;const V={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:f.index,midi:f.midi,expectedPitchId:x,answeredPitchId:N}};p(N),d(t(V)),et().playNote(f.midi,900)},I=()=>{if(g){e();return}c(a+1),d(null),p(null)};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:a+1,total:s.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.sight.prompt}),a===0&&!l?o.jsx(xt,{steps:u.practice.sight.howTo}):null,o.jsx("div",{className:"mb-5 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:[{keys:[Ox(f.midi)],duration:"w"}],clef:r.clef,width:340,height:120})}),o.jsx("div",{className:"mb-4 grid grid-cols-4 gap-2 sm:grid-cols-7",children:i.map(N=>{const V=l&&N.id===x,D=l&&m===N.id&&N.id!==x;return o.jsx("button",{onClick:()=>b(N.id),disabled:!!l,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${V?"border-success bg-success/10 text-success":D?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:qe(N)},N.id)})}),l?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${l.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(l.feedback)}),o.jsx(ee,{onClick:I,children:g?u.practice.finishRun:u.practice.next})]}):null]})}function _z({activity:n,onRunComplete:e}){const t=Qe(M=>M.capture),r=E.useMemo(()=>R6.parse(n.parameters),[n]),s=E.useMemo(()=>O6(r),[r]),[i,a]=E.useState(0),[c,l]=E.useState([]),[d,m]=E.useState(null),[p,f]=da(),g=i===r.rounds-1,[x,b]=gg(r.rootMidi-2,Math.max(...s)+2),I=qe(r.sourceId),N=()=>{et().playSequence(s,Math.round(420*p))},V=M=>{if(d)return;et().playNote(M,600);const R=[...c,M];if(l(R),R.length===s.length){const _={round:i,playedMidis:R},j={kind:"answer",capturedAt:new Date().toISOString(),payload:_};m(t(j))}},D=()=>
4080{if(g){e();return}a(i+1),l([]),m(null)},T={};return T[r.rootMidi]={root:!0},c.forEach((M,R)=>{M===s[R]?T[M]={correct:!0}:T[M]={wrong:!0}}),o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.rhythm.roundOf,{current:i+1,total:r.rounds})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:X(u.practice.pianoPlay.prompt,{name:I})}),i===0&&c.length===0&&!d?o.jsx(xt,{steps:u.practice.pianoPlayHowTo}):null,o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:N,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.listen]}),o.jsx(ua,{speed:p,onChange:f})]}),o.jsx(Fl,{lowMidi:x,highMidi:b,states:T,onPress:V,disabled:!!d,labelForMidi:fg}),o.jsx("p",{className:"mt-2 text-center text-xs text-text-muted",children:X(u.practice.pianoPlay.playedOf,{current:c.length,total:s.length})}),d?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${d.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(d.feedback)}),o.jsx(ee,{onClick:D,children:g?u.practice.finishRun:u.practice.next})]}):null]})}const kz=ue({itemIds:Te(G()),promptField:Le(["symbol","name_en"]),rounds:B(),objectiveId:G().optional()});function dx(n){const e=[...n];for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),s=e[t],i=e[r];e[t]=i,e[r]=s}return e}function wz({activity:n,onRunComplete:e}){const t=Qe(_=>_.capture),r=E.useMemo(()=>kz.parse(n.parameters),[n]),[s,i]=E.useState(0),a=E.useMemo(()=>dx(r.itemIds),[r,s]),c=E.useMemo(()=>dx(r.itemIds),[r,s]),[l,d]=E.useState({}),[m,p]=E.useState(null),[f,g]=E.useState(null),x=E.useMemo(()=>{const _={};for(const[j,w]of Object.entries(l))_[w]=j;return _},[l]),b=E.useMemo(()=>Object.keys(l),[l]),I=_=>{const j=b.indexOf(_);return j===-1?null:j+1},N=s===r.rounds-1,V=r.itemIds.every(_=>_ in l),D=_=>{if(!f){if(_ in l){d(j=>{const w={...j};return delete w[_],w}),p(null);return}p(_===m?null:_)}},T=_=>{if(f)return;const j=x[_];if(j){d(w=>{const A={...w};return delete A[j],A});return}m&&(d(w=>({...w,[m]:_})),p(null))},M=()=>{if(!V||f)return;const _=r.itemIds.map(w=>({itemId:w,matchedItemId:l[w]??""})),j={kind:"answer",capturedAt:new Date().toISOString(),payload:{round:s,matches:_}};g(t(j))},R=()=>{if(N){e();return}i(s+1),d({}),p(null),g(null)};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:u.practice.rhythm.roundOf.replace("{current}",String(s+1)).replace("{total}",String(r.rounds))}),o.jsx("p",{className:"mb-4 text-sm text-text-secondary",children:u.practice.matching.instruction}),s===0&&Object.keys(l).length===0&&!f?o.jsx(xt,{steps:u.practice.matchingHowTo}):null,o.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-center text-xs font-semibold text-text-muted",children:u.practice.matching.answersTitle}),o.jsx("div",{className:"flex flex-col gap-3",children:c.map(_=>{const j=x[_],w=j?I(j):null;return o.jsxs("button",{onClick:()=>T(_),disabled:!!f,className:`relative rounded-md border-2 px-4 py-4 text-base font-semibold transition-colors disabled:cursor-default ${w?"border-primary bg-primary-soft text-primary":"border-border bg-surface hover:enabled:border-primary"}`,children:[w?o.jsx("span",{className:"absolute end-2 top-2 flex size-5 items-center justify-center rounded-full bg-primary text-xs text-on-primary",children:w}):null,e2(_)]},_)})})]}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-center text-xs font-semibold text-text-muted",children:u.practice.matching.promptsTitle}),o.jsx("div",{className:"flex flex-col gap-3",children:a.map(_=>{const j=I(_),w=m===_,A=_ in l,O=f&&l[_]===_,C=f&&A&&l[_]!==_;return o.jsxs("button",{dir:"ltr",onClick:()=>D(_),disabled:!!f,className:`relative rounded-md border-2 px-4 py-4 text-base font-semibold transition-colors disabled:cursor-default ${O?"border-success bg-success/10 text-success":C?"border-danger bg-danger/10 text-danger":w?"border-primary ring-2 ring-primary":j?"border-primary bg-primary-soft text-primary":"border-border bg-surface hover:enabled:border-primary"}`,children:[j?o.jsx("span",{className:"absolute start-2 top-2 flex size-5 items-center justify-center rounded-full bg-primary text-xs text-on-primary",children:j}):null,_T(_,r.promptField),C?o.jsx("span",{className:"mt-1 block text-xs font-medium text-text-secondary",dir:"rtl",children:e2(_)}):null]},_)})})]})]}),f?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${f.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(f.feedback)}),o.jsx(ee,{onClick:R,children:N?u.practice.finishRun:u.practice.next})]}):o.jsx(ee,{onClick:M,disabled:!V,className:"w-full",children:u.practice.theory.check})]})}async function jz(){let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{throw new Error("microphone-unavailable")}const e=new MediaRecorder(n),t=[];e.ondataavailable=s=>{s.data.size>0&&t.push(s.data)},e.start();const r=()=>
4080n.getTracks().forEach(s=>s.stop());return{stop:()=>new Promise(s=>{e.onstop=()=>{r(),s(new Blob(t,{type:e.mimeType||"audio/webm"}))},e.stop()}),cancel:()=>{e.onstop=null,e.state!=="inactive"&&e.stop(),r()}}}function ux(n){const e=new Audio(n);let t=!1;const r=()=>{t=!1};return{play:()=>new Promise(s=>{if(t){s();return}t=!0,e.onended=()=>{r(),s()},e.currentTime=0,e.play().catch(()=>{r(),s()}),e.__resolve=()=>{r(),s()}}),stop:()=>{if(!t)return;e.pause();const s=e.__resolve;r(),s==null||s()},get playing(){return t}}}async function Tz(n){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error??new Error("read-failed")),r.readAsDataURL(n)})}function Ez({activity:n,onRunComplete:e}){const t=Qe(ne=>ne.capture),r=Be(ne=>{var ve;return(ve=ne.session)==null?void 0:ve.user}),s=E.useMemo(()=>D6.parse(n.parameters),[n]),i=s.minSeconds??wT,[a,c]=E.useState("idle"),[l,d]=E.useState(0),[m,p]=E.useState(0),[f,g]=E.useState(!1),[x,b]=E.useState(!1),[I,N]=E.useState(null),V=E.useRef(null),D=E.useRef(null),T=E.useRef(0),M=E.useRef(null),R=E.useRef(null);E.useEffect(()=>()=>{var ne;R.current&&clearInterval(R.current),(ne=V.current)==null||ne.cancel(),M.current&&URL.revokeObjectURL(M.current)},[]);const _=()=>{R.current&&clearInterval(R.current),R.current=null},j=()=>{M.current&&(URL.revokeObjectURL(M.current),M.current=null),D.current=null},w=()=>{s.referenceAssetId&&(async()=>{const ve=(await Gr.list(["audio"])).find($=>$.id===s.referenceAssetId);ve&&ux(ve.url).play()})()},A=async()=>{g(!1),j();try{V.current=await jz()}catch{g(!0),c("idle");return}d(0),c("recording");const ne=Date.now();R.current=setInterval(()=>{d(Math.floor((Date.now()-ne)/1e3))},250)},O=async()=>{_();const ne=V.current;if(!ne)return;const ve=await ne.stop();V.current=null,T.current=l,D.current=ve,M.current=URL.createObjectURL(ve),c("recorded")},C=()=>{M.current&&ux(M.current).play()},S=()=>{j(),p(0),c("idle")},z=async()=>{const ne=D.current;if(!ne||m===0||!r)return;b(!0);const ve=await Tz(ne),$={id:crypto.randomUUID(),organizationId:r.organizationId,kind:"audio",title:`${n.title} — ${new Date().toLocaleDateString("he-IL")}`,fileName:"performance.webm",mimeType:ne.type,sizeBytes:ne.size,url:ve,createdBy:r.id,createdAt:new Date().toISOString(),tags:["הקלטת ביצוע"]};await Gr.save($);const oe={kind:"self_report",capturedAt:new Date().toISOString(),payload:{rating:m,durationSec:T.current,recordingAssetId:$.id}};N(t(oe)),b(!1)},re=a==="recorded"&&m>0&&!x;return o.jsxs(W,{className:"mx-auto max-w-xl text-center",children:[o.jsx("h2",{className:"mb-1 text-lg font-bold",children:n.title}),o.jsx("p",{className:"mb-5 text-sm text-text-muted",children:u.practice.record.hint}),a==="idle"&&!I?o.jsx("div",{className:"text-start",children:o.jsx(xt,{steps:u.practice.recordHowTo})}):null,s.referenceAssetId?o.jsx("div",{className:"mb-5",children:o.jsxs(ee,{variant:"ghost",onClick:w,children:[o.jsx(Xt,{size:15,"aria-hidden":!0}),u.practice.record.playReference]})}):null,f?o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{role:"alert",className:"text-sm font-medium text-danger",children:u.practice.record.micFailed}),o.jsxs(ee,{onClick:()=>void A(),children:[o.jsx(zu,{size:15,"aria-hidden":!0}),u.practice.record.start]})]}):I?o.jsxs("div",{role:"status",className:"mt-2 flex items-center justify-between gap-3 rounded-md bg-primary-soft px-4 py-3 text-primary",children:[o.jsx("span",{className:"font-semibold",children:bt(I.feedback)}),o.jsx(ee,{onClick:e,children:u.practice.finishRun})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col items-center gap-2",children:a==="recording"?o.jsxs(o.Fragment,{children:[o.jsxs(ee,{variant:"soft",onClick:()=>void O(),disabled:l<i,children:[o.jsx(b7,{size:15,"aria-hidden":!0}),u.practice.record.stop]}),o.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-danger",children:[o.jsx("span",{className:"inline-block size-3 animate-pulse rounded-full bg-danger","aria-hidden":!0}),u.practice.record.elapsed,": ",l,"s"]})]}):a==="recorded"?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[o.jsxs(ee,{variant:"ghost",onClick:C,children:[o.jsx(Xt,{size:15,"aria-hidden":!0}),u.practice.record.playMine]}),o.jsxs(ee,{variant:"ghost",onClick:S,children:[o.jsx(zu,{size:15,"aria-hidden":!0}),u.practice.record.again]})]}):o.jsxs(ee,{onClick:()=>void A(),children:[o.jsx(ql,{size:15,"aria-hidden":!0}),u.practice.record.start]})}),a==="recorded"?o.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[o.jsx("p",{className:"mb-3 text-sm font-medium text-text-secondary",children:u.practice.record.ratePrompt}),o.jsx("div",{className:"mb-5 flex justify-center gap-1.5",children:[1,2,3,4,5].map(ne=>{const ve=ne<=m;return o.jsx("button",{type:"button","aria-label":String(ne),"aria-pressed":ve,onClick:()=>p(ne),className:"rounded-full p-1 transition-colors",children:o.jsx(zq,{size:28,className:ve?"text-primary":"text-border-strong",fill:ve?"currentColor":"none","aria-hidden":!0})},ne)})}),o.jsxs(ee,{onClick:()=>void z(),disabled:!re,children:[o.jsx($h,{size:15,"aria-hidden":!0}),u.practice.record.save]})]}):null]})]})}function Nz({activity:n,onRunComplete:e}){const t=Qe(b=>b.capture),r=E.useMemo(()=>V6.parse(n.parameters),[n]),s=E.useMemo(()=>N1(r.excerpt),[r]),[i,a]=E.useState(0),[c,l]=E.useState(null),[d,m]=E.useState(null),p=r.questions[i];if(!p)return null;const f=i===r.questions.length-1,g=b=>{if(c)return;const I={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:i,expectedMeasure:p.correctMeasure,answeredMeasure:b}};m(b),l(t(I))},x=()=>
4080{if(f){e();return}a(i+1),l(null),m(null)};return o.jsxs(W,{className:"mx-auto max-w-2xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:r.questions.length})}),o.jsx("h2",{className:"mb-1 text-lg font-bold",children:p.prompt}),o.jsx("p",{className:"mb-4 text-xs text-text-muted",children:u.practice.score.clickHint}),i===0&&!c?o.jsx(xt,{steps:u.practice.scoreHowTo}):null,o.jsx("div",{dir:"ltr",className:"mb-4 grid grid-cols-2 gap-2 sm:grid-cols-4",children:s.map((b,I)=>{const N=c&&I===p.correctMeasure,V=c&&d===I&&I!==p.correctMeasure;return o.jsxs("button",{onClick:()=>g(I),disabled:!!c,"aria-label":X(u.practice.score.measureN,{n:I+1}),className:`rounded-md border-2 bg-white p-1 transition-colors disabled:cursor-default dark:bg-surface-sunken ${N?"border-success":V?"border-danger":"border-border hover:enabled:border-primary"}`,children:[o.jsx(yn,{notes:b,clef:r.clef??"treble",width:150,height:95}),o.jsx("span",{className:"block pb-1 text-center text-[11px] font-semibold text-text-muted",children:X(u.practice.score.measureN,{n:I+1})})]},I)})}),c?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${c.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(c.feedback)}),o.jsx(ee,{onClick:x,children:f?u.practice.finishRun:u.practice.next})]}):null]})}function Sz({activity:n,onRunComplete:e}){const t=Qe(N=>N.capture),r=E.useMemo(()=>L6.parse(n.parameters),[n]),s=E.useMemo(()=>MT(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(null),[d,m]=E.useState(null),p=s[i];if(!p)return null;const f=i===s.length-1,g=N=>{if(d)return;et().playNote(N,700);const V={questionIndex:p.index,mode:p.mode,targetMidi:p.targetMidi,answeredMidi:N,anyOctave:!!r.anyOctave},D={kind:"answer",capturedAt:new Date().toISOString(),payload:V};l(N),m(t(D))},x=()=>{if(f){e();return}a(i+1),l(null),m(null)},b=p.mode==="pitch"?X(u.practice.locate.findPitch,{name:qe(cr(p.targetMidi))}):X(u.practice.locate.findDegree,{degree:p.degree??1,scale:qe(r.scaleId??"scale.major")}),I={};if(p.mode==="degree"&&p.rootMidi!==void 0&&(I[p.rootMidi]={root:!0}),d&&c!==null){const N=I[c]??{};if(I[c]=d.feedback.correct?{...N,correct:!0}:{...N,wrong:!0},!d.feedback.correct){const V=I[p.targetMidi]??{};I[p.targetMidi]={...V,correct:!0}}}return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-5 text-lg font-bold",children:b}),i===0&&!d?o.jsx(xt,{steps:u.practice.locate.howTo}):null,o.jsx(Fl,{lowMidi:r.lowMidi,highMidi:r.highMidi,states:I,onPress:g,disabled:!!d}),d?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${d.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(d.feedback)}),o.jsx(ee,{onClick:x,children:f?u.practice.finishRun:u.practice.next})]}):null]})}function Az({activity:n,onRunComplete:e}){const t=Qe(Y=>Y.capture),r=E.useMemo(()=>z6.parse(n.parameters),[n]),s=E.useMemo(()=>Vt("pitch"),[]),i=E.useMemo(()=>ur("sight_reading").length,[]),[a,c]=E.useState(r.level??1),[l,d]=E.useState(()=>n2(r,Math.random)),[m,p]=E.useState(0),[f,g]=E.useState(null),[x,b]=E.useState([]),[I,N]=E.useState(null),[V,D]=E.useState(null),[T,M]=E.useState([]),[R,_]=E.useState(r.timedSeconds??0),j=l[m],w=m===l.length-1,A=(r.timedSeconds??0)>0,O=E.useRef(!1);if(O.current=f!==null,E.useEffect(()=>{if(!A||!j||f)return;_(r.timedSeconds??0);const Y=Date.now(),xe=(r.timedSeconds??0)*1e3,Ae=window.setInterval(()=>{const Ze=Math.max(0,xe-(Date.now()-Y));_(Math.ceil(Ze/1e3)),Ze<=0&&(window.clearInterval(Ae),O.current||z())},200);return()=>window.clearInterval(Ae)},[m,A,j,f]),!j)return null;const C=Y=>Y.mode==="sequence"?Y.midis:Y.mode==="extreme"?[Y.extreme==="lowest"?Math.min(...Y.midis):Math.max(...Y.midis)]:[Y.midis[0]],S=Y=>{if(f)return;const xe=C(j),Ae={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:j.index,mode:j.mode,expectedMidis:xe,...Y.answeredMidis?{answeredMidis:Y.answeredMidis}:{},...Y.answeredPitchIds?{answeredPitchIds:Y.answeredPitchIds}:{}}},Ze=t(Ae);return g(Ze),b(Yt=>[...Yt,Ze.score]),Ze};function z(){j.mode==="sequence"?S({answeredPitchIds:[]}):S({answeredMidis:[]})}const re=Y=>{if(f)return;const xe=j.midis[0],Ae=xe-xe%12+(Cz(Y)??xe%12);D(Ae),S({answeredMidis:[Ae]}),et().playNote(xe,900)},ne=Y=>{f||(D(Y),S({answeredMidis:[Y]}),et().playNote(Y,700))},ve=Y=>{if(f)return;const xe=[...T,Y];M(xe),xe.length===j.midis.length&&(S({answeredPitchIds:xe}),et().playSequence(j.midis))},$=()=>M(Y=>Y.slice(0,-1)),oe=Y=>{if(f)return;const xe=j.midis[Y];D(xe),S({answeredMidis:[xe]}),et().playNote(xe,700)},ie=()=>{if(w){e();return}let Y=a,xe=null;if(r.adaptive&&i>0){const Ae=qr({recentScores:x,currentLevel:a,maxLevel:i,objectiveId:r.objectiveId});if(Ae.action==="level_up"||Ae.action==="level_down"){Y=Ae.nextLevel;const Ze=hr("sight_reading",n.parameters,Y),Yt=l.length-(m+1),hs=n2({...Ze,questionCount:Math.max(1,Yt)},Math.random);xe=[...l.slice(0,m+1),...hs.map(($l,Xh)=>({...$l,index:m+1+Xh}))],N(Ae.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),b([])}}Y!==a&&c(Y),xe&&d(xe),p(m+1),g(null),D(null),M([])},Ie=j.midis.map(Y=>({keys:[Ox(Y)],duration:"q"})),Ee=m===0&&!f&&x.length===0;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[o.jsx("p",{className:"text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:m+1,total:l.length})}),A&&!f?o.jsx("span",{className:"rounded-full bg-primary-soft px-2.5 py-0.5 text-sm font-bold text-primary tabular-nums",children:R}):null]}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:Mz(j)}),Ee?o.jsx(xt,{steps:u.practice.sightRead.howTo}):null,I?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:I}):null,A&&!f?o.jsx("div",{className:"mb-3 h-1.5 w-full overflow-hidden rounded-full bg-surface-sunken",children:o.jsx("div",{className:"h-full bg-primary transition-[width] duration-200 ease-linear",style:{width:`${r.timedSeconds??1?R/(r.timedSeconds??1)*100:0}%`}})}):null,j.mode!=="click_note"?o.jsx("div",{className:"mb-5 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:Ie,clef:r.clef,width:340,height:120})}):null,j.mode==="name_note"?o.jsx(hx,{options:s,disabled:!!f,expectedPitchId:f?cr(j.midis[0]):null,answeredPitchId:V!==null?cr(V):null,onPick:re}):null,j.mode==="click_note"?o.jsx(Fl,{lowMidi:r.lowMidi-1,highMidi:r.highMidi+1,states:Pz(j,f,V),onPress:ne,disabled:!!f}):null,j.mode==="sequence"?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-3 flex min-h-9 flex-wrap items-center gap-2",children:[T.map((Y,xe)=>o.jsxs("span",{className:"rounded-md bg-primary-soft px-2.5 py-1 text-sm font-bold text-primary",children:[xe+1,". ",qe(Y)]},xe)),T.length>0&&!f?o.jsxs("button",{type:"button",onClick:$,className:"ms-auto flex items-center gap-1 text-sm text-text-muted hover:text-primary",children:[o.jsx(Gh,{size:14,"aria-hidden":!0}),u.admin.cancel]}):null]}),o.jsx(hx,{options:s,disabled:!!f,expectedPitchId:null,answeredPitchId:null,onPick:ve})]}):null,j.mode==="extreme"?o.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:j.midis.map((Y,xe)=>{const Ae=j.extreme==="lowest"?Math.min(...j.midis):Math.max(...j.midis),Ze=f&&Y===Ae,Yt=f&&V===Y&&Y
4080!==Ae;return o.jsx("button",{onClick:()=>oe(xe),disabled:!!f,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${Ze?"border-success bg-success/10 text-success":Yt?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:X(u.practice.sightRead.noteN,{n:xe+1})},xe)})}):null,f?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${f.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(f.feedback)}),o.jsx(ee,{onClick:ie,children:w?u.practice.finishRun:u.practice.next})]}):null]})}function Cz(n){for(let e=60;e<72;e++)try{if(cr(e)===n)return e%12}catch{}return null}function Mz(n){return n.mode==="click_note"&&n.targetPitchId?X(u.practice.sightRead.clickPrompt,{name:qe(n.targetPitchId)}):n.mode==="sequence"?u.practice.sightRead.sequencePrompt:n.mode==="extreme"?n.extreme==="lowest"?u.practice.sightRead.extremeLow:u.practice.sightRead.extremeHigh:u.practice.sight.prompt}function Pz(n,e,t){if(!e)return{};const r={};return r[n.midis[0]]={correct:!0},t!==null&&t!==n.midis[0]&&(r[t]={wrong:!0}),r}function hx({options:n,disabled:e,expectedPitchId:t,answeredPitchId:r,onPick:s}){return o.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-7",children:n.map(i=>{const a=t&&i.id===t,c=t&&r===i.id&&i.id!==t;return o.jsx("button",{onClick:()=>s(i.id),disabled:e,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${a?"border-success bg-success/10 text-success":c?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:qe(i)},i.id)})})}let mx=null;async function Rz(){return mx??(mx=await j7(()=>import("./vexflow-BGyEjsgt.js"),[])),mx}const Oz={fixed:"var(--color-text)",placed:"var(--color-primary)",correct:"var(--color-success)",wrong:"var(--color-danger)",expected:"var(--color-success)"};function E7({clef:n,notes:e,accidental:t=0,interactive:r=!0,onPlace:s,onSelectNote:i,labelForMidi:a,width:c=480,height:l=200}){const d=E.useRef(null),m=E.useRef(null),[p,f]=E.useState(null),[g,x]=E.useState([]),b=60,I=E.useMemo(()=>e.map(M=>`${M.midi}:${M.role}`).join(","),[e]);E.useEffect(()=>{let M=!1;return Rz().then(R=>{if(M)return;const{Accidental:_,Formatter:j,Renderer:w,Stave:A,StaveNote:O,Voice:C}=R,S=d.current;if(S){S.innerHTML="";try{const z=new w(S,w.Backends.SVG);z.resize(c,l);const re=z.getContext(),ne=new A(6,b,c-14);ne.addClef(n),ne.setContext(re).draw();const ve=ne.getSpacingBetweenLines();if(m.current={yLine0:ne.getYForLine(0),spacing:ve,staveLeft:ne.getNoteStartX(),staveRight:ne.getNoteEndX()},e.length>0){const oe=e.map(Ee=>{var Yt;const Y=Ku(Ee.midi),xe=new O({clef:n,keys:[Y],duration:"q"}),Ae=(Yt=/^[a-g](##|bb|#|b|n)/i.exec(Y))==null?void 0:Yt[1];Ae&&xe.addModifier(new _(Ae),0);const Ze=Oz[Ee.role];return xe.setStyle({fillStyle:Ze,strokeStyle:Ze}),xe}),ie=new C({numBeats:oe.length,beatValue:4});ie.setMode(C.Mode.SOFT),ie.addTickables(oe);const Ie=Math.min(c-90,Math.max(1,oe.length)*48);new j().joinVoices([ie]).format([ie],Ie),ie.draw(re,ne),x(oe.map(Ee=>Ee.getAbsoluteX()))}else x([]);const $=S.querySelector("svg");$&&T7($)}catch{S.textContent="♪"}}}),()=>{M=!0}},[I,n,c,l,e]);const N=M=>{const R=m.current;if(!R)return null;const _=(M-R.yLine0)/R.spacing;if(_<-4||_>8)return null;const j=j5(n,_);return qx(j)},V=M=>M.clientY-M.currentTarget.getBoundingClientRect().top,D=M=>{if(!r)return;const R=N(V(M));if(R===null){f(null);return}const _=m.current,j=T5(n,R);f({y:_.yLine0+j*_.spacing,midi:R+t})},T=M=>{if(!r||!s)return;const R=N(V(M));R!==null&&s(R+t)};return o.jsx("div",{dir:"ltr",className:"flex justify-center overflow-x-auto",children:o.jsxs("div",{className:"relative",style:{width:c,height:l},children:[o.jsx("div",{ref:d,className:"absolute inset-0","aria-hidden":!0}),i?o.jsx("div",{className:"absolute inset-0",children:g.map((M,R)=>{const _=R===0?0:(g[R-1]+M)/2,j=R===g.length-1?c:(M+g[R+1])/2;return o.jsx("button",{type:"button",onClick:()=>i(R),className:"absolute top-0 h-full cursor-pointer rounded hover:bg-primary/10",style:{left:_,width:Math.max(0,j-_)},"aria-label":`note ${R+1}`},R)})}):null,r&&!i?o.jsx("div",{className:"absolute inset-0 cursor-crosshair",onMouseMove:D,onMouseLeave:()=>f(null),onClick:T,role:"presentation",children:p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-primary/60",style:{to
4080p:p.y}}),a?o.jsx("span",{className:"pointer-events-none absolute rounded bg-primary px-1.5 py-0.5 text-xs font-bold text-on-primary",style:{top:p.y-10,insetInlineEnd:8},children:a(p.midi)}):null]}):null}):null]})})}function Dz({activity:n,onRunComplete:e}){const t=Qe(z=>z.capture),r=E.useMemo(()=>F6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("notation_build").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>r2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState([]),[g,x]=E.useState(0),[b,I]=E.useState(null),[N,V]=E.useState([]),[D,T]=E.useState(null),M=c[d],R=d===c.length-1;if(!M)return null;const _=z=>{b||(f(re=>[...re,z]),et().playNote(z,500))},j=()=>{if(b)return;const z={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:M.index,expectedMidis:M.expectedMidis,answeredMidis:p,ordered:M.ordered}},re=t(z);I(re),V(ne=>[...ne,re.score])},w=()=>{if(R){e();return}let z=i,re=null;if(r.adaptive&&s>0){const ne=qr({recentScores:N,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(ne.action==="level_up"||ne.action==="level_down"){z=ne.nextLevel;const ve=hr("notation_build",n.parameters,z),$=c.length-(d+1),oe=r2({...ve,questionCount:Math.max(1,$)},Math.random);re=[...c.slice(0,d+1),...oe.map((ie,Ie)=>({...ie,index:d+1+Ie}))],T(ne.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),V([])}}z!==i&&a(z),re&&l(re),m(d+1),f([]),x(0),I(null)},A=M.givenMidis.map(z=>({midi:z,role:"fixed"})),O=b?Lz(M.expectedMidis,p,M.ordered):p.map(z=>({midi:z,role:"placed"})),C=[...A,...O],S=d===0&&!b&&p.length===0;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:qz(M)}),S?o.jsx(xt,{steps:u.practice.build.howTo}):null,D?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:D}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(E7,{clef:M.clef,notes:C,accidental:g,interactive:!b,onPlace:_,labelForMidi:$z})}),b?null:o.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"flex overflow-hidden rounded-md border border-border",children:Vz.map(({value:z,key:re})=>o.jsx("button",{type:"button","aria-pressed":g===z,onClick:()=>x(z),className:`px-3 py-1.5 text-base font-bold transition-colors ${g===z?"bg-primary text-on-primary":"bg-surface text-text-secondary hover:bg-surface-sunken"}`,children:u.practice.build[re]},z))}),o.jsxs("button",{type:"button",onClick:()=>f(z=>z.slice(0,-1)),disabled:p.length===0,className:"flex items-center gap-1 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-text-secondary hover:border-primary hover:text-primary disabled:opacity-50",children:[o.jsx(Gh,{size:14,"aria-hidden":!0}),u.practice.build.undo]}),o.jsxs("button",{type:"button",onClick:()=>f([]),disabled:p.length===0,className:"flex items-center gap-1 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-text-secondary hover:border-primary hover:text-primary disabled:opacity-50",children:[o.jsx(u7,{size:14,"aria-hidden":!0}),u.practice.build.clear]}),o.jsx("span",{className:"ms-auto text-xs text-text-muted",children:X(u.practice.build.placed,{n:p.length})}),o.jsx(ee,{onClick:j,disabled:p.length===0,children:u.practice.build.check})]}),b?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${b.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(b.feedback)}),o.jsx(ee,{onClick:w,children:R?u.practice.finishRun:u.practice.next})]}):null]})}const Vz=[{value:-1,key:"flat"},{value:0,key:"natural"},{value:1,key:"sharp"}];function Lz(n,e,t){const r=[];if(t){e.forEach((i,a)=>r.push({midi:i,role:i===n[a]?"correct":"wrong"}));for(let i=e.length;i<n.length;i++)r.push({midi:n[i],role:"expected"});return r}const s=[...n];for(const i of e){const a=s.indexOf(i);a>=0?(s.splice(a,1),r.push({midi:i,role:"correct"})):r.push({midi:i,role:"wrong"})}for(const i of s)r.push({midi:i,role:"expected"});return r}function qz(n){const e=n.promptDetail??{},r=u.practice.build[zz(n.promptKey)]??"";return X(r,e)}function zz(n){return n.split(".").pop()??n}const Fz={[-1]:"♭",0:"",1:"♯"};function $z(n){const e=Ks(n);return`${qe(`pitch.${e.letter}`)}${Fz[e.accidental]??""}${e.octave}`}function Bz({activity:n,onRunComplete:e}){const t=Qe(ie=>ie.capture),r=E.useMemo(()=>B6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("theory_organize").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>i2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState({}),[g,x]=E.useState([]),[b,I]=E.useState(null),[N,V]=E.useState(null),[D,T]=E.useState([]),[M,R]=E.useState(null),_=c[d],j=d===c.length-1;if(!_)return null;const w=ie=>{var Ie;return((Ie=_.items.find(Ee=>Ee.id===ie))==null?void 0:Ie.label)??ie},A=_.mode==="classify"?Object.keys(p):g,O=_.items.filter(ie=>!A.includes(ie.id)),C=A.length===_.items.length,S=ie=>{N||!b||(f(Ie=>({...Ie,[b]:ie})),I(null))},z=ie=>{N||f(Ie=>{const Ee={...Ie};return delete Ee[ie],Ee})},re=ie=>{N||x(Ie=>[...Ie,ie])},ne=()=>{if(N)return;const ie=_.mode==="classify"?{questionIndex:_.index,mode:"classify",placement:p,answerBucket:_.answerBucket}:{questionIndex:_.index,mode:"order",sequence:g,answerOrder:_.answerOrder},Ie={kind:"answer",capturedAt:new Date().toISOString(),payload:ie},Ee=t(Ie);V(Ee),T(Y=>[...Y,Ee.score])},ve=()=>{if(j){e();return}let ie=i,Ie=null;if(r.adaptive&&s>0){const Ee=qr({recentScores:D,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(Ee.action==="level_up"||Ee.action==="level_down"){ie=Ee.nextLevel;const Y=hr("theory_organize",n.parameters,ie),xe=c.length-(d+1),Ae=i2({...Y,questionCount:Math.max(1,xe)},Math.random);Ie=[...c.slice(0,d+1),...Ae.map((Ze,Yt)=>({...Ze,index:d+1+Yt}))],R(Ee.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),T([])}}ie!==i&&a(ie),Ie&&l(Ie),m(d+1),f({}),x([]),I(null),V(null)},$=ie=>ie===null?"border-border bg-surface":ie?"border-success bg-success/10 text-success":"border-danger bg-danger/10 text-danger",oe=d===0&&!N&&A.length===0;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.organize.title}),oe?o.jsx(xt,{steps:_.mode==="classify"?u.practice.organize.classifyHowTo:u.practice.organize.orderHowTo}):null,M?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:M}):null,_.mode==="classify"?o.jsx("div",{className:`mb-4 grid gap-3 ${_.buckets.length>2?"sm:grid-cols-3":"sm:grid-cols-2"}`,children:_.buckets.map(ie=>{const Ie=Object.entries(p).filter(([,Ee])=>Ee===ie.id).map(([Ee])=>Ee);return o.jsxs("button",{type:"button",onClick:()=>S(ie.id),disabled:!!N||!b,className:"flex min-h-24 flex-col gap-2 rounded-lg border-2 border-dashed border-border p-3 text-start transition-colors enabled:hover:border-primary disabled:cursor-default",children:[o.jsx("span",{className:"text-sm font-bold text-text-secondary",children:ie.label}),o.jsx("span",{className:"flex flex-wrap gap-1.5",children:Ie.map(Ee=>{const Y=N?_.answerBucket[Ee]===ie.id:null;return o.jsx("span",{onClick:xe=>{xe.stopPropagation(),z(Ee)},className:`rounded-md border px-2.5 py-1 text-sm font-medium ${$(Y)}`,children:w(Ee)},Ee)})})]},ie.id)})}):null,_.mode==="order"?o.jsxs("div",{className:"mb-4",children:[o.jsx("p",{className:"mb-1.5 text-sm font-medium text-text-secondary",children:u.practice.organize.yourOrder}),o.jsx("div",{className:"flex min-h-11 flex-wrap items-center gap-2 rounded-lg border border-border bg-surface-sunken p-2",children:g.map((ie,Ie)=>{const Ee=N?_.answerOrder[Ie]===ie:null;return o.jsxs("span",{className:`flex items-center gap-1 rounded-md border px-2.5 py-1 text-sm font-medium ${$(Ee)}`,children:[o.jsxs("span",{className:"text-xs opacity-70",children:[Ie+1,"."]}),w(ie)]},`${ie}-${Ie}`)})})]}):null,N?null:o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-1.5 text-sm font-medium text-text-secondary",children:u.practice.organize.pool}),o.jsxs("div",{className:"mb-4 flex flex-wrap gap-2",children:[O.map(ie=>{const Ie=b===ie.id;return o.jsx("button",{type:"button","aria-pressed":Ie,onClick:()=>_.mode==="classify"?I(Ie?null:ie.id):re(ie.id),className:`rounded-md border-2 px-3 py-2 text-sm font-semibold transition-colors ${Ie?"border-primary bg-primary text-on-primary":"border-border bg-surface text-text-secondary hover:border-primary hover:text-primary"}`,children:ie.label},ie.id)}),O.length===0?o.jsx("span",{className:"text-sm text-text-muted",children:X(u.practice.organize.remaining,{n:0})}):null]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>_.mode==="order"?x(ie=>ie.slice(0,-1)):f({}),disabled:A.length===0,className:"flex items-center gap-1 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-text-secondary hover:border-primary hover:text-primary disabled:opacity-50",children:[_.mode==="order"?o.jsx(Gh,{size:14,"aria-hidden":!0}):o.jsx(u7,{size:14,"aria-hidden":!0}),_.mode==="order"?u.practice.organize.undo:u.practice.organize.clear]}),o.jsx("span",{className:"ms-auto text-xs text-text-muted",children:X(u.practice.organize.remaining,{n:O.length})}),o.jsx(ee,{onClick:ne,disabled:!C,children:u.practice.organize.check})]})]}),N?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${N.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(N.feedback)}),o.jsx(ee,{onClick:ve,children:j?u.practice.finishRun:u.practice.next})]}):null]})}function Uz({activity:n,onRunComplete:e}){const t=Qe(w=>w.capture),r=E.useMemo(()=>U6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("sight_read_interval").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>o2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=E.useState([]),[N,V]=E.useState(null),D=c[d],T=d===c.length-1;if(!D)return null;const M=r.intervals,R=w=>{if(g)return;f(w);const A={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:D.index,expectedSymbol:D.intervalSymbol,answeredSymbol:w}},O=t(A);x(O),I(C=>[...C,O.score]),et().playSequence(D.midis,480)},_=()=>{if(T){e();return}let w=i,A=null;if(r.adaptive&&s>0){const O=qr({recentScores:b,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(O.action==="level_up"||O.action==="level_down"){w=O.nextLevel;const C=hr("sight_read_interval",n.parameters,w),S=c.length-(d+1),z=o2({...C,questionCount:Math.max(1,S)},Math.random);A=[...c.slice(0,d+1),...z.map((re,ne)=>({...re,index:d+1+ne}))],V(O.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),I([])}}w!==i&&a(w),A&&l(A),m(d+1),f(null),x(null)},j=d===0&&!g;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.intervalRead.prompt}),j?o.jsx(xt,{steps:u.practice.intervalRead.howTo}):null,N?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:N}):null,o.jsx("div",{className:"mb-5 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:aE(D),clef:D.clef,width:320,height:130})}),o.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:M.map(w=>{const A=g&&w===D.intervalSymbol,O=g&&p===w&&w!==D.intervalSymbol;return o.jsx("button",{onClick:()=>R(w),disabled:!!g,className:`rounded-md border-2 px-2 py-3 text-sm font-bold transition-colors disabled:cursor-default ${A?"border-success bg-success/10 text-success":O?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:pl(w)},w)})}),g?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${g.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(g.feedback)}),o.jsx(ee,{onClick:_,children:T?u.practice.finishRun:u.practice.next})]}):null]})}function Gz({activity:n,onRunComplete:e}){const t=Qe(w=>w.capture),r=E.useMemo(()=>G6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("sight_read_key").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>c2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=E.useState([]),[N,V]=E.useState(null),D=c[d],T=d===c.length-1;if(!D)return null;const M=r.keyIds,R=w=>{if(g)return;f(w);const A={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:D.index,expectedKeyId:D.keyId,answeredKeyId:w}},O=t(A);x(O),I(C=>[...C,O.score])},_=()=>{if(T){e();return}let w=i,A=null;if(r.adaptive&&s>0){const O=qr({recentScores:b,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(O.action==="level_up"||O.action==="level_down"){w=O.nextLevel;const C=hr("sight_read_key",n.parameters,w),S=c.length-(d+1),z=c2({...C,questionCount:Math.max(1,S)},Math.random);A=[...c.slice(0,d+1),...z.map((re,ne)=>({...re,index:d+1+ne}))],V(O.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),I([])}}w!==i&&a(w),A&&l(A),m(d+1),f(null),x(null)},j=d===0&&!g;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.keyRead.prompt}),j?o.jsx(xt,{steps:u.practice.keyRead.howTo}):null,N?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:N}):null,o.jsx("div",{className:"mb-5 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:[],clef:D.clef,keySignature:D.vexSignature,width:300,height:130})}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:M.map(w=>{const A=g&&w===D.keyId,O=g&&p===w&&w!==D.keyId;return o.jsx("button",{onClick:()=>R(w),disabled:!!g,className:`rounded-md border-2 px-2 py-3 text-sm font-bold transition-colors disabled:cursor-default ${A?"border-success bg-success/10 text-success":O?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:qe(w)},w)})}),g?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${g.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(g.feedback)}),o.jsx(ee,{onClick:_,children:T?u.practice.finishRun:u.practice.next})]}):null]})}function Kz({activity:n,onRunComplete:e}){const t=Qe(C=>C.capture),r=E.useMemo(()=>K6.parse(n.parameters),[n]),s=E.useMemo(()=>Vt("pitch").map(C=>({letter:C.data.letter,label:qe(C)})),[]),i=E.useMemo(()=>ur("sight_read_accidental").length,[]),[a,c]=E.useState(r.level??1),[l,d]=E.useState(()=>l2(r,Math.random)),[m,p]=E.useState(0),[f,g]=E.useState(1),[x,b]=E.useState(null),[I,N]=E.useState(null),[V,D]=E.useState([]),[T,M]=E.useState(null),R=l[m],_=m===l.length-1;if(!R)return null;const j=Math.floor(R.midi/12)-1,w=C=>{if(I)return;const S=cp({letter:C,octave:j,accidental:f});b(S);const z={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:R.index,expectedMidi:R.midi,answeredMidi:S,expectedLetter:R.letter,expectedAccidental:R.accidental}},re=t(z);N(re),D(ne=>[...ne,re.score]),et().playNote(R.midi,800)},A=()=>{if(_){e();return}let C=a,S=null;if(r.adaptive&&i>0){const z=qr({recentScores:V,currentLevel:a,maxLevel:i,objectiveId:r.objectiveId});if(z.action==="level_up"||z.action==="level_down"){C=z.nextLevel;const re=hr("sight_read_accidental",n.parameters,C),ne=l.length-(m+1),ve=l2({...re,questionCount:Math.max(1,ne)},Math.random);S
4080=[...l.slice(0,m+1),...ve.map(($,oe)=>({...$,index:m+1+oe}))],M(z.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),D([])}}C!==a&&c(C),S&&d(S),p(m+1),g(1),b(null),N(null)},O=m===0&&!I;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:m+1,total:l.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.accidentalRead.prompt}),O?o.jsx(xt,{steps:u.practice.accidentalRead.howTo}):null,T?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:T}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:[{keys:[R.vexKey],duration:"q"}],clef:R.clef,width:300,height:130})}),o.jsx("div",{className:"mb-3 flex justify-center",children:o.jsx("div",{className:"flex overflow-hidden rounded-md border border-border",children:Hz.map(({value:C,key:S})=>o.jsx("button",{type:"button","aria-pressed":f===C,disabled:!!I,onClick:()=>g(C),className:`px-4 py-1.5 text-lg font-bold transition-colors disabled:opacity-60 ${f===C?"bg-primary text-on-primary":"bg-surface text-text-secondary hover:bg-surface-sunken"}`,children:u.practice.accidentalRead[S]},C))})}),o.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-7",children:s.map(({letter:C,label:S})=>{const z=cp({letter:C,octave:j,accidental:f}),re=I&&z===R.midi,ne=I&&x===z&&z!==R.midi;return o.jsx("button",{onClick:()=>w(C),disabled:!!I,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${re?"border-success bg-success/10 text-success":ne?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:S},C)})}),I?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${I.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(I.feedback)}),I.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:A,children:_?u.practice.finishRun:u.practice.next})]}):null]})}const Hz=[{value:-1,key:"flat"},{value:0,key:"natural"},{value:1,key:"sharp"}];function Wz({activity:n,onRunComplete:e}){const t=Qe(re=>re.capture),r=E.useMemo(()=>H6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("sight_read_melody").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>u2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState([]),[g,x]=E.useState(null),[b,I]=E.useState([]),[N,V]=E.useState(null),[D,T]=da(),M=c[d],R=d===c.length-1;if(!M)return null;const _=M.midis,[j,w]=gg(Math.min(..._)-2,Math.max(..._)+2),A=()=>{et().playSequence(_,Math.round(420*D))},O=re=>{if(g)return;et().playNote(re,600);const ne=[...p,re];if(f(ne),ne.length===_.length){const ve={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:M.index,playedMidis:ne,expectedMidis:_}},$=t(ve);x($),I(oe=>[...oe,$.score])}},C=()=>{if(R){e();return}let re=i,ne=null;if(r.adaptive&&s>0){const ve=qr({recentScores:b,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(ve.action==="level_up"||ve.action==="level_down"){re=ve.nextLevel;const $=hr("sight_read_melody",n.parameters,re),oe=c.length-(d+1),ie=u2({...$,questionCount:Math.max(1,oe)},Math.random);ne=[...c.slice(0,d+1),...ie.map((Ie,Ee)=>({...Ie,index:d+1+Ee}))],V(ve.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),I([])}}re!==i&&a(re),ne&&l(ne),m(d+1),f([]),x(null)},S=d===0&&p.length===0&&!g,z={};return p.forEach((re,ne)=>{z[re]=re===_[ne]?{correct:!0}:{wrong:!0}}),o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.melodyRead.prompt}),S?o.jsx(xt,{steps:u.practice.melodyRead.howTo}):null,N?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:N}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:M.notes,clef:M.clef,keySignature:M.keySignature,width:440,height:140})}),o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:A,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.listen]}),o.jsx(ua,{speed:D,onChange:T})]}),o.jsx(Fl,{lowMidi:j,highMidi:w,states:z,onPress:O,disabled:!!g,labelForMidi:fg}),o.jsx("p",{className:"mt-2 text-center text-xs text-text-muted",children:X(u.practice.melodyRead.playedOf,{current:p.length,total:_.length})}),g?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${g.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(g.feedback)}),o.jsx(ee,{onClick:C,children:R?u.practice.finishRun:u.practice.next})]}):null]})}const Yz=[{value:-1,key:"flat"},{value:0,key:"natural"},{value:1,key:"sharp"}],Qz={[-1]:"♭",0:"",1:"♯"},Zz=n=>(n%12+12)%12;function Jz({activity:n,onRunComplete:e}){const t=Qe(z=>z.capture),r=E.useMemo(()=>W6.parse(n.parameters),[n]),s=E.useMemo(()=>Vt("pitch").map(z=>({letter:z.data.letter,pitchClass:z.data.pitchClass,label:qe(z)})),[]),i=E.useMemo(()=>ur("theory_spell").length,[]),[a,c]=E.useState(r.level??1),[l,d]=E.useState(()=>m2(r,Math.random)),[m,p]=E.useState(0),[f,g]=E.useState(0),[x,b]=E.useState([]),[I,N]=E.useState(null),[V,D]=E.useState([]),[T,M]=E.useState(null),R=l[m],_=m===l.length-1;if(!R)return null;const j=R.targetPcs.length,w=(z,re)=>{if(I)return;const ne=Zz(z+f),ve=[...x,{pc:ne,label:`${re}${Qz[f]??""}`}];if(b(ve),et().playNote(60+ne,500),ve.length===j){const $={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:R.index,playedPcs:ve.map(ie=>ie.pc),expectedPcs:R.targetPcs,promptName:R.promptName}},oe=t($);N(oe),D(ie=>[...ie,oe.score]),et().playSequence(R.targetMidis)}},A=()=>{I||b(z=>z.slice(0,-1))},O=()=>{if(_){e();return}
4080let z=a,re=null;if(r.adaptive&&i>0){const ne=qr({recentScores:V,currentLevel:a,maxLevel:i,objectiveId:r.objectiveId});if(ne.action==="level_up"||ne.action==="level_down"){z=ne.nextLevel;const ve=hr("theory_spell",n.parameters,z),$=l.length-(m+1),oe=m2({...ve,questionCount:Math.max(1,$)},Math.random);re=[...l.slice(0,m+1),...oe.map((ie,Ie)=>({...ie,index:m+1+Ie}))],M(ne.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),D([])}}z!==a&&c(z),re&&d(re),p(m+1),g(0),b([]),N(null)},C=m===0&&x.length===0&&!I,S=R.mode==="spell_scale"?X(u.practice.spell.scalePrompt,{name:R.promptName}):X(u.practice.spell.chordPrompt,{name:R.promptName});return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:m+1,total:l.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:S}),C?o.jsx(xt,{steps:u.practice.spell.howTo}):null,T?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:T}):null,o.jsx("div",{dir:"ltr",className:"mb-4 flex min-h-12 flex-wrap items-center gap-2 rounded-md border border-border bg-surface-sunken p-2",children:x.length===0?o.jsx("span",{className:"px-2 text-sm text-text-muted",children:u.practice.spell.empty}):x.map((z,re)=>o.jsx("span",{className:"rounded-md bg-primary px-3 py-1.5 text-base font-bold text-on-primary",children:z.label},re))}),o.jsxs("div",{className:"mb-3 flex items-center justify-center gap-3",children:[o.jsx("div",{className:"flex overflow-hidden rounded-md border border-border",children:Yz.map(({value:z,key:re})=>o.jsx("button",{type:"button","aria-pressed":f===z,disabled:!!I,onClick:()=>g(z),className:`px-4 py-1.5 text-lg font-bold transition-colors disabled:opacity-60 ${f===z?"bg-primary text-on-primary":"bg-surface text-text-secondary hover:bg-surface-sunken"}`,children:u.practice.accidentalRead[re]},z))}),o.jsxs(ee,{variant:"ghost",onClick:A,disabled:!!I||x.length===0,children:[o.jsx(Gh,{size:15,"aria-hidden":!0}),u.practice.spell.undo]})]}),o.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-7",children:s.map(({letter:z,pitchClass:re,label:ne})=>o.jsx("button",{onClick:()=>w(re,ne),disabled:!!I,className:"rounded-md border-2 border-border bg-surface px-2 py-3 text-base font-bold transition-colors hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60",children:ne},z))}),o.jsx("p",{className:"mt-2 text-center text-xs text-text-muted",children:X(u.practice.spell.builtOf,{current:x.length,total:j})}),I?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${I.feedback.correct?"bg-success/10 text-success":"bg-primary-soft text-primary"}`,children:[o.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[o.jsx(pr,{size:15,"aria-hidden":!0}),bt(I.feedback)]}),o.jsx(ee,{onClick:O,children:_?u.practice.finishRun:u.practice.next})]}):null]})}function Xz({activity:n,onRunComplete:e}){const t=Qe(A=>A.capture),r=E.useMemo(()=>Y6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("notation_select").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>p2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=E.useState([]),[N,V]=E.useState(null),D=c[d],T=d===c.length-1;if(!D)return null;const M=A=>{if(g)return;f(A);const O={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:D.index,selectedIndex:A,correctIndex:D.correctIndex}},C=t(O);x(C),I(S=>[...S,C.score])},R=()=>{if(T){e();return}let A=i,O=null;if(r.adaptive&&s>0){const C=qr({recentScores:b,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(C.action==="level_up"||C.action==="level_down"){A=C.nextLevel;const S=hr("notation_select",n.parameters,A),z=c.length-(d+1),re=p2({...S,questionCount:Math.max(1,z)},Math.random);O=[...c.slice(0,d+1),...re.map((ne,ve)=>({...ne,index:d+1+ve}))],V(C.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),I([])}}A!==i&&a(A),O&&l(O),m(d+1),f(null),x(null)},_=D.mode==="find_wrong"?u.practice.select.wrongPrompt:D.extreme==="lowest"?u.practice.select.lowestPrompt:u.practice.select.highestPrompt,j=D.notes.map((A,O)=>{let C="fixed";return g&&(O===D.correctIndex?C="correct":O===p&&(C="wrong")),{midi:A.midi,role:C}}),w=d===0&&!g;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:_}),w?o.jsx(xt,{steps:u.practice.select.howTo}):null,N?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:N}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(E7,{clef:D.clef,notes:j,interactive:!1,onSelectNote:g?void 0:M,width:440,height:180})}),g?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${g.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(g.feedback)}),g.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:R,children:T?u.practice.finishRun:u.practice.next})]}):null]})}function eF({activity:n,onRunComplete:e}){const t=Qe(z=>z.capture),r=E.useMemo(()=>Z6.parse(n.parameters),[n]),s=E.useMemo(()=>ur("theory_function").length,[]),[i,a]=E.useState(r.level??1),[c,l]=E.useState(()=>g2(r,Math.random)),[d,m]=E.useState(0),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=E.useState([]),[N,V]=E.useState(null),[D,T]=da(),M=c[d],R=d===c.length-1;if(!M)return null;const _=M.mode==="numeral"?Q6.map(z=>({id:z,label:z})):UE.map(z=>({id:z,label:u.practice.func[z]})),j=z=>{var re;return((re=_.find(ne=>ne.id===z))==null?void 0:re.label)??z},w=()=>{et().playChordSequence(Rx([M.tonicMidis,M.chordMidis]),Math.round(950*D))},A=z=>{if(g)return;f(z);const re={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:M.index,answeredId:z,correctId:M.correctId,correctLabel:j(M.correctId)}},ne=t(re);x(ne),I(ve=>[...ve,ne.score]),et().playChord(M.chordMidis)},O=()=>{if(R){e();return}let z=i,re=null;if(r.adaptive&&s>0){const ne=qr({recentScores:b,currentLevel:i,maxLevel:s,objectiveId:r.objectiveId});if(ne.action==="level_up"||ne.action==="level_down"){z=ne.nextLevel;const ve=hr("theory_function",n.parameters,z),$=c.length-(d+1),oe=g2({...ve,questionCount:Math.max(1,$)},Math.random);re=[...c.slice(0,d+1),...oe.map((ie,Ie)=>({...ie,index:d+1+Ie}))],V(ne.action==="level_up"?u.practice.sightRead.levelUp:u.practice.sightRead.levelDown),I([])}}z!==i&&a(z),re&&l(re),m(d+1),f(null),x(null)},C=M.mode==="numeral"?X(u.practice.func.numeralPrompt,{name:M.keyName}):X(u.practice.func.functionPrompt,{name:M.keyName}),S=d===0&&!g;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:d+1,total:c.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:C}),S?o.jsx(xt,{steps:u.practice.func.howTo}):null,N?o.jsx("p",{className:"mb-3 rounded-md bg-accent/10 px-3 py-2 text-sm font-semibold text-accent",children:N}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:[{keys:M.chordVexKeys,duration:"w"}],clef:"treble",width:300,height:140})}),o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:w,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.listen]}),o.jsx(ua,{speed:D,onChange:T})]}),o.jsx("div",{className:`grid gap-2 ${M.mode==="numeral"?"grid-cols-4 sm:grid-cols-7":"grid-cols-3"}`,children:_.map(({id:z,label:re})=>{const ne=g&&z===M.correctId,ve=g&&z===p&&z!==M.correctId;return o.jsx("button",{onClick:()=>A(z),disabled:!!g,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${ne?"border-success bg-success/10 text-success":ve?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:re},z)})}),g?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${g.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(g.feedback)}),g.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:O,children:R?u.practice.finishRun:u.practice.next})]}):null]})}function tF({activity:n,onRunComplete:e}){const t=Qe(S=>S.capture),r=E.useMemo(()=>J6.parse(n.parameters),[n]),s=E.useMemo(()=>XE(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(!1),[d,m]=E.useState(!1),[p,f]=E.useState(null),[g,x]=E.useState(null),[b,I]=E.useState(null),[N,V]=da(),D=s[i];if(!D)return null;const T=i===s.length-1,M=D.presentation==="melodic",R=async()=>
4080{if(!d){m(!0);try{M?await et().playSequence(D.midis,Math.round(550*N)):await et().playChord(D.midis,Math.round(1500*N)),l(!0)}finally{m(!1)}}},_=(S,z)=>{const re={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:D.index,presentation:D.presentation,expectedQuality:b2(D.interval),answeredQuality:S,expectedDirection:D.direction,answeredDirection:M?z:null}};I(t(re))},j=S=>{b||!c||(f(S),M?g&&_(S,g):_(S,null))},w=S=>{b||!c||(x(S),p&&_(p,S))},A=()=>{if(T){e();return}a(i+1),I(null),f(null),x(null),l(!1)},O=(S,z)=>{const re=b2(D.interval),ne=b&&S===re,ve=b&&p===S&&S!==re;return o.jsx("button",{onClick:()=>j(S),disabled:!c||!!b,"aria-pressed":p===S,className:`rounded-md border-2 px-4 py-4 text-base font-bold transition-colors disabled:cursor-default ${ne?"border-success bg-success/10 text-success":ve?"border-danger bg-danger/10 text-danger":p===S&&!b?"border-primary bg-primary-soft text-primary":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:z},S)},C=(S,z)=>{const re=b&&S===D.direction,ne=b&&g===S&&S!==D.direction;return o.jsx("button",{onClick:()=>w(S),disabled:!c||!!b,"aria-pressed":g===S,className:`rounded-md border-2 px-4 py-4 text-base font-bold transition-colors disabled:cursor-default ${re?"border-success bg-success/10 text-success":ne?"border-danger bg-danger/10 text-danger":g===S&&!b?"border-primary bg-primary-soft text-primary":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:z},S)};return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.intervalQuality.prompt}),i===0&&!c?o.jsx(xt,{steps:u.practice.intervalQuality.howTo}):null,o.jsxs("div",{className:"mb-6 flex flex-col items-center gap-3 py-2",children:[o.jsx("button",{onClick:()=>void R(),disabled:d,"aria-label":c?u.practice.playAgain:u.practice.listen,className:"flex size-20 items-center justify-center rounded-full bg-primary text-on-primary shadow-raised transition-transform hover:scale-105 disabled:opacity-60",children:d?o.jsx(pr,{size:30,"aria-hidden":!0}):o.jsx(Xt,{size:30,"aria-hidden":!0,className:"-scale-x-100"})}),o.jsx("p",{className:"text-sm text-text-secondary",children:c?u.practice.intervalQuality.prompt:u.practice.listen}),o.jsx(ua,{speed:N,onChange:V})]}),o.jsx("p",{className:"mb-1.5 text-sm font-semibold text-text-secondary",children:u.practice.intervalQuality.qualityTitle}),o.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3",children:[O("minor",u.practice.intervalQuality.minor),O("major",u.practice.intervalQuality.major)]}),M?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-1.5 text-sm font-semibold text-text-secondary",children:u.practice.intervalQuality.directionTitle}),o.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3",children:[C("up",u.practice.intervalQuality.up),C("down",u.practice.intervalQuality.down)]})]}):null,b?o.jsxs("div",{role:"status",className:`flex items-center justify-between gap-3 rounded-md px-4 py-3 ${b.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(b.feedback)}),o.jsx(ee,{onClick:A,children:T?u.practice.finishRun:u.practice.next})]}):null]})}function px({label:n,count:e,active:t,tone:r}){const s=r==="count"?"scale-125 bg-accent":"scale-125 bg-primary";return o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:e},(i,a)=>o.jsx("span",{className:`size-2.5 rounded-full transition-all duration-100 ${a===t?s:"bg-border"}`},a))}),o.jsx("span",{className:"text-[11px] font-medium text-text-muted",children:n})]})}function nF(n){return n.map(e=>({duration:e.rest?`${e.duration}r`:e.duration}))}function rF({activity:n,onRunComplete:e}){const t=Qe(w=>w.capture),r=E.useMemo(()=>X6.parse(n.parameters),[n]),s=E.useMemo(()=>oN(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(0),[d,m]=E.useState(null),[p,f]=E.useState(null),[g,x]=E.useState(null),b=E.useRef([]),I=s[i],N=()=>{b.current.forEach(w=>window.clearTimeout(w)),b.current=[]};if(E.useEffect(()=>N,[]),!I)return null;const V=i===s.length-1,D=r.maxPlays>0&&c>=r.maxPlays,T=I.bars.length*4,M=async()=>
4080{if(D)return;const w=et();await w.resume();const A=6e4/r.bpm,O=w.nowMs()+200;for(let z=0;z<4;z++)w.scheduleClick(O+z*A,z===0);const C=O+4*A;for(const z of cN(I.bars,r.bpm))w.scheduleClick(C+z,!1);l(z=>z+1),N();const S=(z,re)=>b.current.push(window.setTimeout(re,z));for(let z=0;z<4;z++)S(200+z*A,()=>x({stage:"count",beat:z}));for(let z=0;z<T;z++)S(200+(4+z)*A,()=>x({stage:"play",beat:z}));S(200+(4+T)*A,()=>x(null))},R=w=>{if(p)return;m(w);const A={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:I.index,chosenIndex:w,correctIndex:I.correctIndex}};f(t(A))},_=()=>{if(N(),x(null),V){e();return}a(i+1),l(0),m(null),f(null)},j=i===0&&c===0&&!p;return o.jsxs(W,{className:"mx-auto max-w-2xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:u.practice.dictation.prompt}),j?o.jsx(xt,{steps:u.practice.dictation.howTo}):null,o.jsxs("div",{className:"mb-5 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:()=>void M(),disabled:D,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.dictation.play]}),r.maxPlays>0?o.jsx("p",{className:"text-xs text-text-muted",children:X(u.practice.dictation.playsUsed,{used:c,max:r.maxPlays})}):null,o.jsxs("div",{className:"flex items-center gap-4","aria-hidden":!0,children:[o.jsx(px,{label:u.practice.dictation.countIn,count:4,active:(g==null?void 0:g.stage)==="count"?g.beat:-1,tone:"count"}),o.jsx("span",{className:"text-border",children:"│"}),o.jsx(px,{label:u.practice.dictation.theRhythm,count:T,active:(g==null?void 0:g.stage)==="play"?g.beat:-1,tone:"play"})]})]}),o.jsx("div",{className:"grid gap-3",children:I.options.map((w,A)=>{const O=p&&A===I.correctIndex,C=p&&d===A&&A!==I.correctIndex;return o.jsxs("button",{onClick:()=>R(A),disabled:!!p,className:`flex items-center gap-3 rounded-md border-2 bg-white p-2 transition-colors disabled:cursor-default dark:bg-surface-sunken ${O?"border-success":C?"border-danger":"border-border hover:enabled:border-primary"}`,children:[o.jsx("span",{className:"shrink-0 text-sm font-bold text-text-muted",children:A+1}),o.jsx("span",{className:"flex flex-1 items-center justify-center gap-1 overflow-x-auto",children:w.map((S,z)=>o.jsx("span",{className:"border-s border-border/60 first:border-s-0",children:o.jsx(yn,{notes:nF(S),clef:"percussion",timeSignature:z===0?"4/4":void 0,width:z===0?168:150,height:90})},z))})]},A)})}),p?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${p.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(p.feedback)}),o.jsx(ee,{onClick:_,children:V?u.practice.finishRun:u.practice.next})]}):null]})}function sF({activity:n,onRunComplete:e}){const t=Qe(_=>_.capture),r=E.useMemo(()=>e4.parse(n.parameters),[n]),s=E.useMemo(()=>yN(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(0),[d,m]=E.useState(null),[p,f]=E.useState(null),[g,x]=da(),b=s[i];if(!b)return null;const I=i===s.length-1,N=r.maxPlays>0&&c>=r.maxPlays,V=b.mode==="blank",D=async()=>{N||(await et().playSequence(b.midis,Math.round(500*g)),l(_=>_+1))},T=_=>{if(p)return;m(_);const j={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:b.index,chosenIndex:_,correctIndex:b.correctIndex}};f(t(j))},M=()=>{if(I){e();return}a(i+1),l(0),m(null),f(null)},R=i===0&&c===0&&!p;return o.jsxs(W,{className:"mx-auto max-w-2xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:V?u.practice.melodyDict.promptBlank:u.practice.melodyDict.prompt}),R?o.jsx(xt,{steps:u.practice.melodyDict.howTo}):null,V?o.jsx("div",{dir:"ltr",className:"mb-4 flex flex-wrap items-center justify-center gap-2 rounded-md bg-surface-sunken px-3 py-4",children:b.names.map((_,j)=>o.jsx("span",{className:`min-w-10 rounded-md px-3 py-2 text-center text-base font-bold ${j===b.blankIndex?"border-2 border-dashed border-primary text-primary":"bg-surface text-text-secondary"}`,children:j===b.blankIndex?"□":_},j))}):null,o.jsxs("div",{className:"mb-5 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:()=>void D(),disabled:N,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.melodyDict.play]}),o.jsx(ua,{speed:g,onChange:x}),r.maxPlays>0?o.jsx("p",{className:"text-xs text-text-muted",children:X(u.practice.dictation.playsUsed,{used:c,max:r.maxPlays})}):null]}),V?o.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:b.options.map((_,j)=>{const w=p&&j===b.correctIndex,A=p&&d===j&&j!==b.correctIndex;return o.jsx("button",{onClick:()=>T(j),disabled:!!p,className:`rounded-md border-2 px-2 py-3 text-base font-bold transition-colors disabled:cursor-default ${w?"border-success bg-success/10 text-success":A?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:_.label},j)})}):o.jsx("div",{className:"grid gap-3",children:b.options.map((_,j)=>{const w=p&&j===b.correctIndex,A=p&&d===j&&j!==b.correctIndex;return o.jsxs("button",{onClick:()=>T(j),disabled:!!p,className:`flex items-center gap-3 rounded-md border-2 bg-white p-2 transition-colors disabled:cursor-default dark:bg-surface-sunken ${w?"border-success":A?"border-danger":"border-border hover:enabled:border-primary"}`,children:[o.jsx("span",{className:"shrink-0 text-sm font-bold text-text-muted",children:j+1}),o.jsx("span",{className:"flex-1",children:o.jsx(yn,{notes:(_.vexKeys??[]).map(O=>({keys:[O],duration:"q"})),clef:"treble",width:300,height:90})})]},j)})}),p?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${p.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsx("span",{className:"font-semibold",children:bt(p.feedback)}),o.jsx(ee,{onClick:M,children:I?u.practice.finishRun:u.practice.next})]}):null]})}function iF({activity:n,onRunComplete:e}){const t=Qe(M=>M.capture),r=E.useMemo(()=>t4.parse(n.parameters),[n]),s=E.useMemo(()=>jN(r,Math.random),[r]),[i,a]=E.useState(0),[c,l]=E.useState(null),[d,m]=E.useState(null),[p,f]=da(),g=s[i],x=i===s.length-1;if(!g)return null;const b=La.filter(M=>La.indexOf(M)<g.midis.length),I=M=>u.practice.inversion.options[M]??M,N=()=>{et().playChord(g.midis,Math.round(1800*p))},V=M=>{if(d)return;l(M);const R={kind:"answer",capturedAt:new Date().toISOString(),payload:{questionIndex:g.index,answeredId:M,correctId:g.correctId,correctLabel:I(g.correctId)}};
4080m(t(R)),et().playChord(g.midis)},D=()=>{if(x){e();return}a(i+1),l(null),m(null)},T=i===0&&!d;return o.jsxs(W,{className:"mx-auto max-w-xl",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-muted",children:X(u.practice.questionOf,{current:i+1,total:s.length})}),o.jsx("h2",{className:"mb-4 text-lg font-bold",children:X(u.practice.inversion.prompt,{name:g.chordName})}),T?o.jsx(xt,{steps:u.practice.inversion.howTo}):null,o.jsx("div",{className:"mb-4 rounded-md bg-white p-2 dark:bg-surface-sunken",children:o.jsx(yn,{notes:[{keys:g.vexKeys,duration:"w"}],clef:"treble",width:300,height:150})}),o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2",children:[o.jsxs(ee,{variant:"soft",onClick:N,children:[o.jsx(pr,{size:15,"aria-hidden":!0}),u.practice.listen]}),o.jsx(ua,{speed:p,onChange:f})]}),o.jsx("div",{className:`grid gap-2 ${b.length>=4?"grid-cols-2 sm:grid-cols-4":"grid-cols-3"}`,children:b.map(M=>{const R=d&&M===g.correctId,_=d&&M===c&&M!==g.correctId;return o.jsx("button",{onClick:()=>V(M),disabled:!!d,className:`rounded-md border-2 px-2 py-3 text-sm font-bold transition-colors disabled:cursor-default ${R?"border-success bg-success/10 text-success":_?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary hover:enabled:text-primary disabled:opacity-60"}`,children:I(M)},M)})}),d?o.jsxs("div",{role:"status",className:`mt-4 flex items-center justify-between gap-3 rounded-md px-4 py-3 ${d.feedback.correct?"bg-success/10 text-success":"bg-danger/10 text-danger"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-semibold",children:bt(d.feedback)}),d.feedback.correct?null:o.jsx("div",{children:o.jsx(la,{activity:n,variant:"inline"})})]}),o.jsx(ee,{onClick:D,children:x?u.practice.finishRun:u.practice.next})]}):null]})}const N7={ear_interval:uz,rhythm_tap:fz,rhythm_echo:gz,theory_chord_build:yz,ear_chord_quality:ip,ear_scale_recognition:ip,ear_cadence:ip,sight_note_id:Iz,piano_scale_play:_z,theory_matching:wz,repertoire_record:Ez,score_label:Nz,piano_locate:Sz,sight_reading:Az,notation_build:Dz,theory_organize:Bz,sight_read_interval:Uz,sight_read_key:Gz,sight_read_accidental:Kz,sight_read_melody:Wz,theory_spell:Jz,notation_select:Xz,theory_function:eF,ear_interval_quality:tF,rhythm_dictation:rF,melody_dictation:sF,chord_inversion:iF};function S7(n){return N7[n]??null}function wn(n){return n in N7}function aF(n){var e,t,r,s,i;switch(n.reasonKey){case"coach.reason.weakObjective":return X(u.coach.reasonWeakObjective,{objective:((e=n.detail)==null?void 0:e.objective)??""});case"coach.reason.firstSteps":return u.coach.reasonFirstSteps;case"coach.reason.goalFocus":return X(u.coach.reasonGoalFocus,{objective:((t=n.detail)==null?void 0:t.objective)??""});case"coach.reason.pathStep":return X(u.coach.reasonPathStep,{path:((r=n.detail)==null?void 0:r.path)??"",objective:((s=n.detail)==null?void 0:s.objective)??""});case"coach.reason.review":return X(u.coach.reasonReview,{objective:((i=n.detail)==null?void 0:i.objective)??""});default:return n.reasonKey??""}}function oF(){var N;const n=Be(V=>V.session),e=(n==null?void 0:n.user.id)??"",t=Qe(V=>V.begin),r=It(),s=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),i=fe({queryKey:["objective-progress",e],queryFn:()=>ca.listObjectiveProgress(e),enabled:!!e}),a=fe({queryKey:["goal",e],queryFn:()=>Ru.get(e),enabled:!!e}),c=fe({queryKey:["active-path",e],queryFn:()=>Pu.getActivePathId(e),enabled:!!e}),l=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}),d=(s.data??[]).filter(V=>wn(V.typeId)),m=i.data??[],p=c.data?j6(c.data):null,f=p?k1(p,m):null,g=Oj(m,l.data??[],new Date),x=ez(d,m,{focusCategories:((N=a.data)==null?void 0:N.focusCategories)??[],pathObjectiveId:(f==null?void 0:f.currentObjectiveId)??null,pathTitle:(p==null?void 0:p.title.he)??"",reviewDue:g});if(!x)return null;const b=()=>{n&&(t(n.user.id,x),r({to:"/student/practice/session"}))},I=x.activities.reduce((V,D)=>V+D.estimatedMinutes,0);return o.jsxs("section",{className:"relative mb-6 overflow-hidden rounded-xl p-6 text-white shadow-raised md:p-8",style:{background:"var(--gradient-brand)"}
4080,children:[o.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-cover bg-center opacity-[0.18] mix-blend-luminosity",style:{backgroundImage:"url(/brand/hero-2.jpg)"}}),o.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -end-16 -top-16 size-56 rounded-full bg-white/10 blur-2xl"}),o.jsxs("p",{className:"mb-1 flex items-center gap-1.5 text-sm font-medium text-white/80",children:[o.jsx(y7,{size:14,"aria-hidden":!0}),u.studentDashboard.nextPractice]}),o.jsx("h2",{className:"text-2xl font-bold leading-snug md:text-3xl",children:x.activities.map(V=>V.title.split(" — ")[0]).join(" · ")}),o.jsx("p",{className:"mt-2 max-w-lg text-sm leading-relaxed text-white/85",children:aF(x)}),o.jsxs("div",{className:"mt-5 flex flex-wrap items-center gap-4",children:[o.jsxs("button",{onClick:b,className:"inline-flex items-center gap-2 rounded-full bg-white px-6 py-3 text-sm font-bold text-primary shadow-card transition-all duration-150 hover:shadow-hover active:scale-[0.97]",children:[o.jsx(Xt,{size:17,"aria-hidden":!0,className:"-scale-x-100"}),u.studentDashboard.startPractice]}),o.jsx("span",{className:"text-sm font-medium text-white/80",children:X(u.practice.approxMinutes,{n:Zt(I)})})]})]})}function cF(){const n=Be(m=>m.session),e=(n==null?void 0:n.user.id)??"",t=Qe(m=>m.begin),r=It(),s=fe({queryKey:["placement",e],queryFn:()=>sg.get(e),enabled:!!e}),i=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}),a=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()});if(!(s.isSuccess&&s.data===null&&i.isSuccess&&i.data.length===0)||!n)return null;const l=["act-intervals-1","act-rhythm-1"].map(m=>(a.data??[]).find(p=>p.id===m)).filter(m=>!!m&&wn(m.typeId));if(l.length===0)return null;const d=()=>{t(n.user.id,{source:"placement",activities:l}),r({to:"/student/practice/session"})};return o.jsxs(W,{className:"mb-6 flex flex-wrap items-center justify-between gap-4 border-primary/40",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[o.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl text-white",style:{background:"var(--gradient-brand)"},children:o.jsx(Bh,{size:22,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"font-bold",children:u.placement.cardTitle}),o.jsx("p",{className:"mt-0.5 text-sm text-text-secondary",children:u.placement.cardBody})]})]}),o.jsx(ee,{onClick:d,children:u.placement.start})]})}function lF(){const n=Be(d=>d.session),e=(n==null?void 0:n.user.id)??"",t=Qe(d=>d.begin),r=It(),s=fe({queryKey:["teacher-recommendation",e],queryFn:()=>n7.latestFor(e),enabled:!!e}),i=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),a=s.data;if(!a)return null;const c=(i.data??[]).filter(d=>a.activityIds.includes(d.id)&&wn(d.typeId));if(c.length===0)return null;const l=()=>{n&&(t(n.user.id,{source:"teacher",activities:c}),r({to:"/student/practice/session"}))};return o.jsx("button",{onClick:l,className:"mb-6 block w-full text-start",children:o.jsxs(W,{className:"flex items-center gap-4 border-s-4 border-s-accent hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:o.jsx(as,{size:20,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block font-semibold",children:X(u.assignment.fromTeacher,{name:a.teacherName})}),o.jsx("span",{className:"mt-0.5 block truncate text-sm text-text-secondary",children:a.note||c.map(d=>d.title.split(" — ")[0]).join(" · ")})]}),o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-sm font-semibold text-primary",children:[o.jsx(Xt,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.assignment.startCta]})]})})}function dF(){const n=Be(a=>a.session),e=(n==null?void 0:n.user.id)??"",t=fe({queryKey:["active-path",e],queryFn:()=>Pu.getActivePathId(e),enabled:!!e}),r=fe({queryKey:["objective-progress",e],queryFn:()=>ca.listObjectiveProgress(e),enabled:!!e}),s=t.data?j6(t.data):null;if(!s)return null;const i=k1(s,r.data??[]);return o.jsx(un,{to:"/student/journey",className:"block",children:o.jsxs(W,{className:"flex h-full items-center gap-4 hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(Ll,{size:20,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"block font-semibold",children:[u.journey.homeCardTitle," · ",s.title.he]}),o.jsxs("span",{className:"mt-0.5 block text-xs text-text-secondary",children:[i.currentObjectiveId?Mx(i.currentObjectiveId):u.journey.pathDone," ","· ",X(u.journey.stepsOf,{done:i.completedSteps,total:i.totalSteps})]}),o.jsx("span",{className:"mt-2 block",children:o.jsx(Gs,{value:i.percent,label:s.title.he})})]})]})})}function uF(){var g;const n=Be(x=>x.session),e=(n==null?void 0:n.user.id)??"",t=Qe(x=>x.begin),r=It(),i=fe({queryKey:["academic"],queryFn:()=>pt.get()}).data,a=i?cs(i,new Date):null,c=i&&e?Ha(i,e,a==null?void 0:a.id):[],l=fe({queryKey:["group-lessons",c.map(x=>x.id).join(",")],queryFn:()=>Oo.listForGroups(c.map(x=>x.id)),enabled:c.length>0}),d=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),m=(g=l.data)==null?void 0:g[0];if(!m)return null;const p=(d.data??[]).filter(x=>
4080m.recommendedActivityIds.includes(x.id)&&wn(x.typeId));if(p.length===0)return null;const f=()=>{n&&(t(n.user.id,{source:"course",activities:p,reasonKey:"course.reason.lastLesson",detail:{topic:m.note}}),r({to:"/student/practice/session"}))};return o.jsx("button",{onClick:f,className:"block w-full text-start",children:o.jsxs(W,{className:"flex h-full items-center gap-4 hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(dr,{size:20,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"block font-semibold",children:[u.home.courseCardTitle," · ",m.groupName]}),o.jsx("span",{className:"mt-0.5 block truncate text-xs text-text-secondary",children:X(u.home.fromLesson,{topic:m.note})})]}),o.jsx(Xt,{size:16,"aria-hidden":!0,className:"-scale-x-100 shrink-0 text-primary"})]})})}function hF(){const n=new Date().getHours();return n<12?u.studentDashboard.greetingMorning:n<18?u.studentDashboard.greetingAfternoon:u.studentDashboard.greetingEvening}function mF(){const n=Be(f=>f.session),e=(n==null?void 0:n.user.id)??"",t=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}),r=fe({queryKey:["notifications",e],queryFn:()=>ol.list(e),enabled:!!e}),s=fe({queryKey:["objective-progress",e],queryFn:()=>ca.listObjectiveProgress(e),enabled:!!e}),i=h1(t.data??[],new Date),a=new Date().toDateString(),c=(t.data??[]).filter(f=>new Date(f.startedAt).toDateString()===a),l=c.reduce((f,g)=>f+g.totalMinutes,0),d=(r.data??[]).find(f=>f.kind==="teacher_note"&&!f.read),m=(r.data??[]).filter(f=>f.kind==="milestone").slice(0,3),p=[...s.data??[]].sort((f,g)=>g.mastery-f.mastery).slice(0,3);return o.jsxs("div",{children:[o.jsxs("header",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("h1",{className:"text-2xl font-bold tracking-tight",children:[hF(),", ",(n==null?void 0:n.user.displayName.split(" ")[0])??""," 👋"]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-primary-soft px-3.5 py-1.5 text-sm font-bold text-primary",children:[o.jsx(zh,{size:16,"aria-hidden":!0,className:"text-accent"}),i," ",u.studentDashboard.days]})]}),o.jsx(cF,{}),o.jsx(oF,{}),o.jsx(lF,{}),o.jsxs("section",{className:"mb-6",children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.home.pathsTitle}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(dF,{}),o.jsx(uF,{}),o.jsx(un,{to:"/student/practice",className:"block",children:o.jsxs(W,{className:"flex h-full items-center gap-4 hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-white",style:{background:"var(--gradient-brand)"},children:o.jsx(Ll,{size:20,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block font-semibold",children:u.home.exploreTitle}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-secondary",children:u.home.exploreDesc})]})]})})]})]}),d&&n?o.jsxs(W,{className:"mb-6 flex items-start gap-3 border-s-4 border-s-primary",children:[o.jsx("span",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(Aq,{size:17,"aria-hidden":!0})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold",children:d.title}),o.jsx("p",{className:"mt-0.5 text-sm text-text-secondary",children:d.body})]})]}):null,o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.home.journeyToday}),o.jsx(W,{className:"p-0",children:c.length===0?o.jsx("p",{className:"p-5 text-sm text-text-muted",children:u.home.journeyEmpty}):o.jsxs("div",{className:"divide-y divide-border",children:[o.jsx("p",{className:"px-5 py-3 text-sm font-semibold text-primary",children:X(u.home.practicedToday,{n:Zt(l)})}),c.map(f=>o.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full bg-success","aria-hidden":!0}),o.jsx("span",{className:"flex-1 truncate text-sm",children:f.runs.map(g=>g.activityTitle.split(" — ")[0]).join(" · ")}),o.jsxs("span",{className:"text-xs font-medium text-text-muted",children:[Zt(f.totalMinutes)," ",u.common.minutes]})]},f.id))]})}),m.length>0?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"mb-3 mt-6 text-sm font-semibold text-text-secondary",children:u.home.achievements}),o.jsx("div",{className:"space-y-2",children:m.map(f=>o.jsxs(W,{className:"flex items-center gap-3 p-3.5",children:[o.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent",children:o.jsx(Vu,{size:17,"aria-hidden":!0})}),o.jsx("span",{className:"text-sm font-medium",children:f.title})]},f.id))})]}):null]}),o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.home.progressTitle}),o.jsx(W,{className:"space-y-4",children:p.map(f=>o.jsxs("div",{children:[o.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium",children:[f.trend==="up"?o.jsx(Ji,{size:14,"aria-hidden":!0,
4080className:"text-success"}):f.trend==="down"?o.jsx(mg,{size:14,"aria-hidden":!0,className:"text-danger"}):null,f.objectiveTitle]}),o.jsxs("span",{className:"text-xs font-bold text-text-secondary",children:[Math.round(f.mastery*100),"%"]})]}),o.jsx(Gs,{value:f.mastery,label:f.objectiveTitle})]},f.objectiveId))}),n?o.jsxs(W,{className:"mt-4 flex items-center gap-3 p-4",children:[o.jsx(hi,{name:n.user.displayName,color:n.user.avatarColor,size:36}),o.jsxs("p",{className:"text-sm text-text-secondary",children:[o.jsx(un,{to:"/student/history",className:"font-semibold text-primary hover:underline",children:u.nav.student.history})," · ",o.jsx(un,{to:"/student/progress",className:"font-semibold text-primary hover:underline",children:u.nav.student.progress})]})]}):null]})]})]})}function A7(){const n=Be(l=>l.session),e=(n==null?void 0:n.user.id)??"",t=en(),r=fe({queryKey:["active-path",e],queryFn:()=>Pu.getActivePathId(e),enabled:!!e}),s=fe({queryKey:["objective-progress",e],queryFn:()=>ca.listObjectiveProgress(e),enabled:!!e}),i=lt({mutationFn:l=>Pu.setActivePath(e,l),onSuccess:()=>t.invalidateQueries({queryKey:["active-path",e]})}),a=s.data??[],c=l=>{const d=k1(l,a),m=r.data===l.id,p=d.currentObjectiveId===null;return o.jsxs(W,{className:m?"border-primary/50":"",children:[o.jsxs("div",{className:"mb-1 flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("h3",{className:"flex items-center gap-2 font-bold",children:[p?o.jsx(Fq,{size:17,"aria-hidden":!0,className:"text-accent"}):o.jsx(Ll,{size:17,"aria-hidden":!0,className:"text-primary"}),l.title.he,m?o.jsx("span",{className:"rounded-full bg-primary-soft px-2.5 py-0.5 text-xs font-semibold text-primary",children:u.journey.active}):null]}),o.jsx("span",{className:"text-xs font-medium text-text-muted",children:X(u.journey.stepsOf,{done:d.completedSteps,total:d.totalSteps})})]}),o.jsx("p",{className:"mb-3 text-sm text-text-secondary",children:l.description.he}),o.jsx(Gs,{value:d.percent,label:l.title.he}),o.jsx("ol",{className:"mt-4 space-y-2",children:l.steps.map((f,g)=>{const x=g<d.completedSteps?"done":f.objectiveId===d.currentObjectiveId?"current":"locked";return o.jsxs("li",{className:"flex items-center gap-2.5 text-sm",children:[o.jsx("span",{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-bold ${x==="done"?"bg-success text-white":x==="current"?"bg-primary text-on-primary":"bg-surface-sunken text-text-muted"}`,children:x==="done"?o.jsx(Us,{size:13,"aria-hidden":!0}):g+1}),o.jsx("span",{className:x==="locked"?"text-text-muted":"font-medium",children:Mx(f.objectiveId)}),x==="current"?o.jsx("span",{className:"rounded-full bg-primary-soft px-2 py-0.5 text-[11px] font-semibold text-primary",children:u.journey.stepCurrent}):null]},`${f.objectiveId}-${g}`)})}),p?o.jsx("p",{className:"mt-4 font-semibold text-accent",children:u.journey.pathDone}):m?o.jsx(ee,{variant:"ghost",className:"mt-4",onClick:()=>i.mutate(null),children:u.journey.leavePath}):o.jsxs(ee,{variant:"soft",className:"mt-4",onClick:()=>i.mutate(l.id),children:[o.jsx(wq,{size:15,"aria-hidden":!0}),u.journey.startPath,o.jsx(ui,{size:15,"aria-hidden":!0})]})]},l.id)};return o.jsx("div",{className:"space-y-4",children:w6.map(c)})}const pF={ear_training:yq,rhythm:l7,piano:Dq,theory:dr,sight_reading:cg,singing:ql,performance:dg},fF=["ear_training","rhythm","piano","theory","sight_reading","singing","performance"];function gF(){const n=Be(d=>d.session),e=Qe(d=>d.begin),t=It(),r=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()});E.useEffect(()=>{et().preload(["piano","percussion"])},[]);const s=fe({queryKey:["practice-tracks","published"],queryFn:()=>yo.listPublished()}),i=d=>{n&&(e(n.user.id,{source:"user",activities:[d]}),t({to:"/student/practice/session"}))},a=new Map((r.data??[]).map(d=>[d.id,d])),c=d=>{if(!n)return;const m=d.map(p=>a.get(p)).filter(p=>!!p&&wn(p.typeId));m.length!==0&&(e(n.user.id,{source:"user",activities:m}),t({to:"/student/practice/session"}))},l=new Map;for(const d of r.data??[])l.set(d.type,[...l.get(d.type)??[],d]);return o.jsxs("div",{children:[o.jsx(tt,{title:u.practice.studioTitle,subtitle:u.practice.studioSubtitle}),o.jsxs("section",{className:"mb-8",children:[o.jsx("h2",{className:"mb-3 text-lg font-bold tracking-tight",children:u.practice.pathsTitle}),o.jsx(A7,{})]}),(s.data??[]).length>0?o.jsxs("section",{className:"mb-8",children:[o.jsx("h2",{className:"mb-3 text-lg font-bold tracking-tight",children:u.tracks.freePracticeTitle}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:(s.data??[]).map(d=>{const m=d.exerciseIds.filter(p=>{var f;return wn(((f=a.get(p))==null?void 0:f.typeId)??"")}).length;return o.jsxs(W,{className:"flex flex-col gap-2 hover:shadow-hover",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold",children:d.title}),d.level?o.jsx("p",{className:"text-xs text-text-muted",children:d.level}):null]}),o.jsx("p",{className:"flex-1 text-xs text-text-muted",children:X(u.tracks.trackCount,{n:m})}),o.jsxs(ee,{onClick:()=>c(d.exerciseIds),className:"self-start",disabled:m===0,children:[o.jsx(Xt,{size:15,"aria-hidden":!0,
4080className:"-scale-x-100"}),u.tracks.practiceTrack]})]},d.id)})})]}):null,r.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):o.jsxs("div",{className:"space-y-8",children:[o.jsx("h2",{className:"text-lg font-bold tracking-tight",children:u.practice.exploreTitle}),fF.filter(d=>l.has(d)).map(d=>{const m=pF[d];return o.jsxs("section",{children:[o.jsxs("h2",{className:"mb-3 flex items-center gap-2.5 text-lg font-bold tracking-tight",children:[o.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg text-white shadow-card",style:{background:"var(--gradient-brand)"},children:o.jsx(m,{size:17,"aria-hidden":!0})}),u.practice.categories[d]]}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:(l.get(d)??[]).map(p=>{const f=wn(p.typeId);return o.jsxs(W,{className:`flex flex-col gap-3 ${f?"hover:shadow-hover":"opacity-60"}`,children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"truncate font-semibold",children:p.title}),o.jsx("p",{className:"text-xs text-text-muted",children:X(u.practice.estimatedMinutes,{n:p.estimatedMinutes})})]}),o.jsx("p",{className:"flex-1 text-sm text-text-secondary",children:p.description}),f?o.jsxs(ee,{onClick:()=>i(p),className:"self-start",children:[o.jsx(Xt,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.practice.start]}):o.jsx("span",{className:"self-start rounded-full bg-surface-sunken px-3 py-1.5 text-xs font-medium text-text-muted",children:u.practice.comingSoonActivity})]},p.id)})})]},d)})]})]})}function yF(){const n=It(),e=en(),t=Qe(),{session:r}=t;E.useEffect(()=>{r||n({to:"/student/practice"})},[r,n]);const s=lt({mutationFn:async()=>{const d=await gt.saveSession(t.finishSession());if(t.planSource==="placement"){const m={};for(const p of d.runs)for(const f of p.objectiveSignals??[])m[f.objectiveId]=f.signal;await sg.save(d.musicianId,m)}return d},onSuccess:async()=>{await e.invalidateQueries({queryKey:["practice-sessions"]}),await e.invalidateQueries({queryKey:["objective-progress"]}),await e.invalidateQueries({queryKey:["placement"]}),await n({to:"/student"}),t.clear()}});if(!r)return null;const i=()=>{if(!window.confirm(u.practice.quitConfirm))return;const d=t.abandon(),m=()=>{t.clear(),n({to:"/student/practice"})};d?gt.saveSession(d).then(()=>e.invalidateQueries({queryKey:["practice-sessions"]})).finally(m):m()},a=r.runs.find(d=>d.id===r.activeRunId);if(r.status==="in_progress"&&a){const d=S7(a.activity.typeId);return o.jsxs("div",{children:[o.jsx(tt,{title:a.activity.title,...t.plan.length>1?{subtitle:X(u.practice.activityOf,{current:t.planIndex+1,total:t.plan.length})}:{},actions:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(la,{activity:a.activity}),o.jsxs(ee,{variant:"ghost",onClick:i,children:[o.jsx(qu,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.practice.quit]})]})}),d?o.jsx(d,{activity:a.activity,onRunComplete:()=>t.finishRun()},a.id):o.jsx(W,{children:u.practice.comingSoonActivity})]})}const c=r.runs.flatMap(d=>d.captured),l=c.length?c.reduce((d,m)=>d+m.evaluation.score,0)/c.length:0;return o.jsx("div",{className:"mx-auto max-w-xl",children:o.jsxs(W,{className:"flex flex-col items-center gap-4 py-10 text-center",children:[o.jsx("span",{className:"flex size-16 items-center justify-center rounded-full bg-success/10 text-success",children:o.jsx(Xn,{size:32,"aria-hidden":!0})}),o.jsx("h1",{className:"text-2xl font-bold",children:u.practice.summaryTitle}),o.jsxs("p",{className:"text-4xl font-bold text-primary",children:[Math.round(l*100),"%"]}),o.jsx("p",{className:"text-sm text-text-secondary",children:u.practice.summaryScore}),o.jsx(ee,{onClick:()=>s.mutate(),disabled:s.isPending,className:"mt-2",children:s.isPending?u.common.loading:u.practice.saveAndReturn})]})})}function fx(n){return n>=.85?"bg-success/10 text-success":n>=.5?"bg-primary-soft text-primary":"bg-surface-sunken text-text-secondary"}function bF(n){const e=n.runs.map(t=>t.score).filter(t=>typeof t=="number");return e.length?e.reduce((t,r)=>t+r,0)/e.length:null}function xF(){const n=Be(s=>s.session),e=(n==null?void 0:n.user.id)??"",t=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}),r=new Map;for(const s of t.data??[]){const i=mr(s.startedAt);r.set(i,[...r.get(i)??[],s])}return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.student.history,subtitle:u.history.subtitle}),t.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):r.size===0?o.jsxs(W,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[o.jsx("span",{className:"flex size-12 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(bo,{size:22,"aria-hidden":!0})}),o.jsx("p",{className:"font-semibold",children:u.history.emptyTitle}),o.jsx(un,{to:"/student/practice",children:o.jsx(ee,{children:u.history.emptyCta})})]}):o.jsx("div",{className:"space-y-6",children:[...r.entries()].map(([s,i])=>o.jsxs("section",{children:[o.jsx("h2",{className:"mb-2 text-sm font-semibold text-text-secondary",children:s}),o.jsx("div",{className:"space-y-3",children:i.map(a=>{const c=bF(a);return o.jsxs(W,{className:"p-4",children:[o.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("span",{className:"text-sm font-semibold",children:[Zt(a.totalMinutes)," ",u.common.minutes,a.status==="abandoned"?o.jsx("span",{className:"ms-2 rounded-full bg-surface-sunken px-2 py-0.5 text-xs font-medium text-text-muted",children:u.history.abandoned}):null]}),c!==null?o.jsxs("span",{className:`rounded-full px-2.5 py-0.5 text-xs font-bold ${fx(c)}`,children:[Math.round(c*100),"%"]}):null]}),o.jsx("ul",{className:"space-y-1.5",children:a.runs.map(l=>o.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[o.jsx("span",{className:"truncate text-text-secondary",children:l.activityTitle}),o.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[o.jsxs("span",{className:"text-xs text-text-muted",children:[Zt(l.durationMinutes)," ",u.common.minutes]}),typeof l.score=="number"?o.jsxs("span",{className:`rounded-full px-2 py-0.5 text-xs font-semibold ${fx(l.score)}`,children:[Math.round(l.score*100),"%"]}):null]})]},l.id))})]},a.id)})})]},s))})]})}function Hh(n,e){const t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=n,s.click(),URL.revokeObjectURL(r)}function Wh(n){return new Promise((e,t)=>
4080{const r=new FileReader;r.onload=()=>{try{e(JSON.parse(r.result))}catch{t(new Error("invalid-json"))}},r.onerror=()=>t(new Error("read-failed")),r.readAsText(n)})}function Rn({label:n,error:e,children:t}){return o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:n}),t,e?o.jsx("span",{className:"mt-1 block text-xs text-danger",children:e}):null]})}const Yh="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-primary";function C7({label:n,value:e,onChange:t,error:r}){return o.jsx(Rn,{label:n,error:r,children:o.jsx("input",{type:"text",className:Yh,value:e,onChange:s=>t(s.target.value)})})}function vF({label:n,value:e,onChange:t,error:r}){return o.jsx(Rn,{label:n,error:r,children:o.jsx("textarea",{rows:2,className:Yh,value:e,onChange:s=>t(s.target.value)})})}function be({label:n,value:e,onChange:t,error:r,min:s,max:i,step:a}){return o.jsx(Rn,{label:n,error:r,children:o.jsx("input",{type:"number",className:Yh,value:Number.isFinite(e)?e:"",min:s,max:i,step:a??1,onChange:c=>t(c.target.valueAsNumber)})})}function ot({label:n,value:e,onChange:t,options:r,error:s}){return o.jsx(Rn,{label:n,error:s,children:o.jsx("select",{className:Yh,value:e,onChange:i=>t(i.target.value),children:r.map(i=>o.jsx("option",{value:i.value,children:i.label},i.value))})})}function Do({label:n,values:e,onChange:t,options:r,error:s}){const i=a=>t(e.includes(a)?e.filter(c=>c!==a):[...e,a]);return o.jsx(Rn,{label:n,error:s,children:o.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(a=>{const c=e.includes(a.value);return o.jsx("button",{type:"button","aria-pressed":c,onClick:()=>i(a.value),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${c?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`,children:a.label},a.value)})})})}function IF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>e({...n,...a}),i=r.rootMidiRange??[57,76];return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Do,{label:u.studio.fields.intervals,values:r.intervals??[],onChange:a=>s({intervals:a}),options:T1.map(a=>({value:a,label:pl(a)})),error:t.intervals}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??5,onChange:a=>s({questionCount:a}),min:1,max:50,error:t.questionCount}),o.jsx(ot,{label:u.studio.fields.direction,value:r.direction??"ascending",onChange:a=>s({direction:a}),options:[{value:"ascending",label:u.studio.fields.directionAscending},{value:"descending",label:u.studio.fields.directionDescending},{value:"harmonic",label:u.studio.fields.directionHarmonic}],error:t.direction}),o.jsx(be,{label:u.studio.fields.rootRangeLow,value:i[0],onChange:a=>s({rootMidiRange:[a,i[1]]}),min:21,max:108,error:t["rootMidiRange.0"]??t.rootMidiRange}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:i[1],onChange:a=>s({rootMidiRange:[i[0],a]}),min:21,max:108,error:t["rootMidiRange.1"]})]})]})}function _F({parameters:n,onChange:e,errors:t}){const r=n,s=f=>e({...n,...f}),i=r.beatsPerBar??4,a=r.bars??1,c=r.pattern??[],l=i*a,d=Array.from({length:l*2},(f,g)=>g/2),m=f=>c.some(g=>Math.abs(g-f)<.001),p=f=>s({pattern:m(f)?c.filter(g=>Math.abs(g-f)>=.001):[...c,f].sort((g,x)=>g-x)});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3",children:[o.jsx(be,{label:u.studio.fields.bpm,value:r.bpm??80,onChange:f=>s({bpm:f}),min:40,max:220,error:t.bpm}),o.jsx(be,{label:u.studio.fields.beatsPerBar,value:i,onChange:f=>s({beatsPerBar:f}),min:2,max:7,error:t.beatsPerBar}),o.jsx(be,{label:u.studio.fields.bars,value:a,onChange:f=>s({bars:f}),min:1,max:4,error:t.bars}),o.jsx(be,{label:u.studio.fields.rounds,value:r.rounds??3,onChange:f=>s({rounds:f}),min:1,max:10,error:t.rounds}),o.jsx(be,{label:u.studio.fields.toleranceMs,value:r.toleranceMs??140,onChange:f=>s({toleranceMs:f}),min:40,max:400,step:10,error:t.toleranceMs}),o.jsx(ot,{label:u.studio.fields.displayMode,value:r.displayMode??"grid",onChange:f=>
4080s({displayMode:f}),options:[{value:"grid",label:u.studio.fields.displayGrid},{value:"notation",label:u.studio.fields.displayNotation}],error:t.displayMode})]}),o.jsx(Rn,{label:u.studio.fields.pattern,error:t.pattern,children:o.jsx("div",{dir:"ltr",className:"flex gap-1",children:d.map(f=>o.jsx("button",{type:"button","aria-pressed":m(f),onClick:()=>p(f),className:`h-12 flex-1 rounded-sm border transition-colors ${m(f)?"border-primary bg-primary":f%1===0?"border-border bg-surface-sunken hover:border-primary/50":"border-border/50 bg-surface hover:border-primary/50"}`},f))})})]})}function kF({parameters:n,onChange:e,errors:t}){const r=n,s=d=>e({...n,...d}),i=r.beatsPerBar??4,a=r.patternIds??[],c=Vt("rhythm_pattern").filter(d=>d.data.beatsPerBar===i),l=d=>s({patternIds:a.includes(d)?a.filter(m=>m!==d):[...a,d]});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3",children:[o.jsx(be,{label:u.studio.fields.bpm,value:r.bpm??76,onChange:d=>s({bpm:d}),min:40,max:220,error:t.bpm}),o.jsx(be,{label:u.studio.fields.beatsPerBar,value:i,onChange:d=>s({beatsPerBar:d}),min:2,max:7,error:t.beatsPerBar}),o.jsx(be,{label:u.studio.fields.bars,value:r.bars??1,onChange:d=>s({bars:d}),min:1,max:2,error:t.bars}),o.jsx(be,{label:u.studio.fields.rounds,value:r.rounds??3,onChange:d=>s({rounds:d}),min:1,max:10,error:t.rounds}),o.jsx(be,{label:u.studio.fields.toleranceMs,value:r.toleranceMs??160,onChange:d=>s({toleranceMs:d}),min:40,max:400,step:10,error:t.toleranceMs}),o.jsx(ot,{label:u.studio.fields.echoMode,value:r.mode??"echo",onChange:d=>s({mode:d}),options:[{value:"echo",label:u.studio.fields.echoModeEcho},{value:"memory",label:u.studio.fields.echoModeMemory}],error:t.mode})]}),o.jsx(Rn,{label:u.studio.fields.patternIds,error:t.patternIds,children:o.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(d=>{const p=d.data.onsets.join(", "),f=a.includes(d.id);return o.jsxs("button",{type:"button","aria-pressed":f,onClick:()=>l(d.id),className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${f?"border-primary bg-primary-soft text-primary":"border-border bg-surface hover:border-primary/50"}`,children:[d.name.he," ",o.jsxs("span",{className:"text-text-muted",children:["[",p,"]"]})]},d.id)})})})]})}function wF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>e({...n,...a}),i=r.rootMidiRange??[55,67];return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Do,{label:u.studio.fields.chords,values:r.chordIds??[],onChange:a=>s({chordIds:a}),options:rT().map(a=>({value:a.id,label:qe(a)})),error:t.chordIds}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??5,onChange:a=>s({questionCount:a}),min:1,max:30,error:t.questionCount}),o.jsx(be,{label:u.studio.fields.rootRangeLow,value:i[0],onChange:a=>s({rootMidiRange:[a,i[1]]}),min:36,max:84,error:t["rootMidiRange.0"]??t.rootMidiRange}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:i[1],onChange:a=>s({rootMidiRange:[i[0],a]}),min:36,max:84,error:t["rootMidiRange.1"]})]})]})}function ap(n){return function({parameters:t,onChange:r,errors:s}){const i=t,a=d=>r({...t,...d}),c=i.rootMidiRange??[55,72],l=n.flatMap(d=>Vt(d));return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Do,{label:u.studio.fields.options,values:i.optionIds??[],onChange:d=>a({optionIds:d}),options:l.map(d=>({value:d.id,label:qe(d)})),error:s.optionIds}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(be,{label:u.studio.fields.questionCount,value:i.questionCount??5,onChange:d=>a({questionCount:d}),min:1,max:30,error:s.questionCount}),o.jsx(be,{label:u.studio.fields.rootRangeLow,value:c[0],onChange:d=>a({rootMidiRange:[d,c[1]]}),min:36,max:96,error:s["rootMidiRange.0"]??s.rootMidiRange}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:c[1],onChange:d=>a({rootMidiRange:[c[0],d]}),min:36,max:96,error:s["rootMidiRange.1"]})]})]})}}function jF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onCh
4080ange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass}],error:t.clef}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount}),o.jsx(be,{label:u.studio.fields.rootRangeLow,value:r.lowMidi??60,onChange:i=>s({lowMidi:i}),min:36,max:96,error:t.lowMidi??t["(root)"]}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:r.highMidi??79,onChange:i=>s({highMidi:i}),min:36,max:96,error:t.highMidi})]})}function TF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>e({...n,...a}),i=yT();return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Rn,{label:u.studio.fields.source,error:t.sourceId,children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(a=>{const c=r.sourceId===a.id;return o.jsx("button",{type:"button","aria-pressed":c,onClick:()=>s({sourceId:a.id}),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${c?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`,children:qe(a)},a.id)})})}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.playMode,value:r.mode??"scale",onChange:a=>s({mode:a}),options:[{value:"scale",label:u.studio.fields.modeScale},{value:"arpeggio",label:u.studio.fields.modeArpeggio}],error:t.mode}),o.jsx(ot,{label:u.studio.fields.direction,value:r.direction??"ascending",onChange:a=>s({direction:a}),options:[{value:"ascending",label:u.studio.fields.directionAscending},{value:"descending",label:u.studio.fields.directionDescending}],error:t.direction}),o.jsx(be,{label:u.studio.fields.rootNote,value:r.rootMidi??60,onChange:a=>s({rootMidi:a}),min:48,max:84,error:t.rootMidi}),o.jsx(be,{label:u.studio.fields.rounds,value:r.rounds??3,onChange:a=>s({rounds:a}),min:1,max:5,error:t.rounds})]})]})}function EF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>e({...n,...a}),i=Vt().filter(a=>a.symbol);return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Do,{label:u.studio.fields.matchingItems,values:r.itemIds??[],onChange:a=>s({itemIds:a}),options:i.map(a=>({value:a.id,label:`${qe(a)} (${a.symbol})`})),error:t.itemIds}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.promptField,value:r.promptField??"symbol",onChange:a=>s({promptField:a}),options:[{value:"symbol",label:u.studio.fields.promptSymbol},{value:"name_en",label:u.studio.fields.promptEnglish}],error:t.promptField}),o.jsx(be,{label:u.studio.fields.rounds,value:r.rounds??2,onChange:a=>s({rounds:a}),min:1,max:5,error:t.rounds})]})]})}function NF({parameters:n,onChange:e,errors:t}){const r=n,s=c=>e({...n,...c}),i=fe({queryKey:["assets","audio"],queryFn:()=>Gr.list(["audio"])}),a=c=>`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${c?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`;return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Rn,{label:u.studio.fields.referenceAsset,error:t.referenceAssetId,children:o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{type:"button","aria-pressed":!r.referenceAssetId,onClick:()=>s({referenceAssetId:void 0}),className:a(!r.referenceAssetId),children:u.studio.fields.referenceNone}),(i.data??[]).map(c=>{const l=r.referenceAssetId===c.id;return o.jsx("button",{type:"button","aria-pressed":l,onClick:()=>s({referenceAssetId:c.id}),className:a(l),children:c.title},c.id)})]})}),o.jsx(be,{label:u.studio.fields.minSeconds,value:r.minSeconds??5,onChange:c=>s({minSeconds:c}),min:1,max:600,error:t.minSeconds})]})}function SF({parameters:n,onChange:e,errors:t}){const r=n,s=c=>e({...n,...c}),i=r.questions??[],a=(c,l)=>s({questions:i.map((d,m)=>m===c?{...d,...l}:d)});return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Rn,{label:u.studio.fields.excerpt,error:t.excerpt??t["(root)"],children:o.jsx("textarea",{dir:"ltr",rows:2,value:r.excerpt??"",onChange:c=>s({excerpt:c.target.value}),className:"w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm focus:border-primary"})}),o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onCh
4080ange:c=>s({clef:c}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass}],error:t.clef}),i.map((c,l)=>o.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] items-end gap-3",children:[o.jsx(C7,{label:X(u.studio.fields.questionPrompt,{n:l+1}),value:c.prompt,onChange:d=>a(l,{prompt:d}),error:t[`questions.${l}.prompt`]}),o.jsx(be,{label:u.studio.fields.questionMeasure,value:c.correctMeasure+1,onChange:d=>a(l,{correctMeasure:Math.max(0,(d||1)-1)}),min:1,max:16,error:t[`questions.${l}.correctMeasure`]}),o.jsx("button",{type:"button",onClick:()=>s({questions:i.filter((d,m)=>m!==l)}),className:"mb-1 rounded-md px-3 py-2 text-sm font-medium text-text-muted hover:text-danger",children:u.studio.fields.removeQuestion})]},l)),o.jsx("button",{type:"button",onClick:()=>s({questions:[...i,{prompt:"",correctMeasure:0}]}),className:"rounded-md border border-dashed border-border-strong px-3.5 py-2 text-sm font-medium text-primary hover:border-primary",children:u.studio.fields.addQuestion})]})}function AF({parameters:n,onChange:e,errors:t}){const r=n,s=c=>e({...n,...c}),i=[...Vt("scale"),...Vt("mode")],a=r.mode??"pitch";return o.jsxs("div",{className:"space-y-4",children:[o.jsx(ot,{label:u.studio.fields.locateMode,value:a,onChange:c=>s({mode:c}),options:[{value:"pitch",label:u.studio.fields.locatePitch},{value:"degree",label:u.studio.fields.locateDegree}],error:t.mode}),a==="degree"?o.jsx(Rn,{label:u.studio.fields.source,error:t.scaleId,children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(c=>{const l=r.scaleId===c.id;return o.jsx("button",{type:"button","aria-pressed":l,onClick:()=>s({scaleId:c.id}),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${l?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`,children:qe(c)},c.id)})})}):null,o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(be,{label:u.studio.fields.rootRangeLow,value:r.lowMidi??55,onChange:c=>s({lowMidi:c}),min:36,max:84,error:t.lowMidi??t["(root)"]}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:r.highMidi??79,onChange:c=>s({highMidi:c}),min:48,max:96,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:c=>s({questionCount:c}),min:1,max:30,error:t.questionCount})]}),a==="pitch"?o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:r.anyOctave??!0,onChange:c=>s({anyOctave:c.target.checked})}),u.studio.fields.anyOctave]}):null]})}function CF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>e({...n,...a}),i=(r.mode??"name_note")==="sequence"||r.mode==="extreme";return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.srMode,value:r.mode??"name_note",onChange:a=>s({mode:a}),options:[{value:"name_note",label:u.studio.fields.srModeName},{value:"click_note",label:u.studio.fields.srModeClick},{value:"sequence",label:u.studio.fields.srModeSequence},{value:"extreme",label:u.studio.fields.srModeExtreme}],error:t.mode}),o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onChange:a=>s({clef:a}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass}],error:t.clef}),o.jsx(be,{label:u.studio.fields.rootRangeLow,value:r.lowMidi??60,onChange:a=>s({lowMidi:a}),min:36,max:96,error:t.lowMidi??t["(root)"]}),o.jsx(be,{label:u.studio.fields.rootRangeHigh,value:r.highMidi??72,onChange:a=>s({highMidi:a}),min:36,max:96,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:a=>s({questionCount:a}),min:1,max:30,error:t.questionCount}),i?o.jsx(be,{label:u.studio.fields.srSequenceLength,value:r.sequenceLength??3,onChange:a=>s({sequenceLength:a}),min:2,max:8,error:t.sequenceLength}):null,o.jsx(be,{label:u.studio.fields.srTimedSeconds,value:r.timedSeconds??0,onChange:a=>s({timedSeconds:a}),min:0,max:30,error:t.timedSeconds}),o.jsx(Rn,{label:u.studio.fields.adaptive,error:t.adaptive,children:o.jsxs("label",{className:"flex items-center gap-2 py-2 text-sm text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:r.adaptive??!1,onChange:a=>s({adaptive:a.target.checked}),className:"size-4 rounded border-border"}),u.studio.fields.adaptiveHint]})})]})}function MF({parameters:n,onChange:e,errors:t}){const r=n,s=d=>e({...n,...d}),i=r.mode??"build_interval",a=i==="build_scale"||i==="build_chord"||i==="complete_scale"||i==="missing_note",c=i==="build_interval",l=[...Vt("scale"),...Vt("chord")];return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.mode,value:i,onChange:d=>s({mode:d}),options:[{value:"build_scale",label:u.studio.fields.modeBuildScale},{value:"build_chord",label:u.studio.fields.modeBuildChord},{value:"build_interval",label:u.studio.fields.modeBuildInterval},{value:"complete_scale",label:u.studio.fields.modeCompleteScale},{value:"missing_note",label:u.studio.fields.modeMissingNote}],error:t.mode}),o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onCh
4080ange:d=>s({clef:d}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),a?o.jsx(Rn,{label:u.studio.fields.sourceId,error:t.sourceId,children:o.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(d=>{const m=r.sourceId===d.id;return o.jsx("button",{type:"button","aria-pressed":m,onClick:()=>s({sourceId:d.id}),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${m?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`,children:qe(d)},d.id)})})}):null,c?o.jsx(be,{label:u.studio.fields.intervalSemitones,value:r.intervalSemitones??4,onChange:d=>s({intervalSemitones:d}),min:1,max:24,error:t.intervalSemitones}):null,o.jsx(be,{label:u.studio.fields.lowMidi,value:r.lowMidi??60,onChange:d=>s({lowMidi:d}),min:24,max:96,error:t.lowMidi??t["(root)"]}),o.jsx(be,{label:u.studio.fields.highMidi,value:r.highMidi??72,onChange:d=>s({highMidi:d}),min:24,max:108,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:d=>s({questionCount:d}),min:1,max:30,error:t.questionCount}),i==="complete_scale"?o.jsx(be,{label:u.studio.fields.completeCount,value:r.completeCount??3,onChange:d=>s({completeCount:d}),min:1,max:6,error:t.completeCount}):null,o.jsx(Rn,{label:u.studio.fields.adaptive,error:t.adaptive,children:o.jsxs("label",{className:"flex items-center gap-2 py-2 text-sm text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:r.adaptive??!1,onChange:d=>s({adaptive:d.target.checked}),className:"size-4 rounded border-border"}),u.studio.fields.adaptiveHint]})})]})}function PF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.organizeMode,value:r.mode??"classify",onChange:i=>s({mode:i}),options:[{value:"classify",label:u.studio.fields.organizeModeClassify},{value:"order",label:u.studio.fields.organizeModeOrder}],error:t.mode}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??4,onChange:i=>s({questionCount:i}),min:1,max:20,error:t.questionCount}),o.jsx(be,{label:u.studio.fields.organizeSampleSize,value:r.sampleSize??6,onChange:i=>s({sampleSize:i}),min:2,max:12,error:t.sampleSize}),o.jsx("p",{className:"col-span-2 text-sm text-text-secondary",children:u.studio.fields.organizeContentNote})]})}const RF=["m2","M2","m3","M3","P4","TT","P5","m6","M6","m7","M7","P8"];function OF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onChange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),o.jsx(ot,{label:u.studio.fields.intervalPresentation,value:r.presentation??"melodic",onChange:i=>s({presentation:i}),options:[{value:"melodic",label:u.studio.fields.presentationMelodic},{value:"harmonic",label:u.studio.fields.presentationHarmonic},{value:"mixed",label:u.studio.fields.presentationMixed}],error:t.presentation}),o.jsx("div",{className:"col-span-2",children:o.jsx(Do,{label:u.studio.fields.intervals,values:r.intervals??[],onChange:i=>s({intervals:i}),options:RF.map(i=>({value:i,label:pl(i)})),error:t.intervals})}),o.jsx(be,{label:u.studio.fields.lowMidi,value:r.lowMidi??60,onChange:i=>s({lowMidi:i}),min:24,max:96,error:t.lowMidi??t["(root)"]}),o.jsx(be,{label:u.studio.fields.highMidi,value:r.highMidi??79,onChange:i=>s({highMidi:i}),min:24,max:108,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}function DF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onCh
4080ange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount}),o.jsx("div",{className:"col-span-2",children:o.jsx(Do,{label:u.studio.fields.keyIds,values:r.keyIds??[],onChange:i=>s({keyIds:i}),options:Vt("key").map(i=>({value:i.id,label:qe(i)})),error:t.keyIds??t["(root)"]})})]})}function VF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onChange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),o.jsx(ot,{label:u.studio.fields.accidentalType,value:r.accidentalType??"sharps",onChange:i=>s({accidentalType:i}),options:[{value:"sharps",label:u.studio.fields.accidentalTypeSharps},{value:"flats",label:u.studio.fields.accidentalTypeFlats},{value:"both",label:u.studio.fields.accidentalTypeBoth}],error:t.accidentalType}),o.jsx(be,{label:u.studio.fields.lowMidi,value:r.lowMidi??60,onChange:i=>s({lowMidi:i}),min:24,max:96,error:t.lowMidi}),o.jsx(be,{label:u.studio.fields.highMidi,value:r.highMidi??72,onChange:i=>s({highMidi:i}),min:24,max:108,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}const LF=["key.c_major","key.g_major","key.f_major","key.d_major","key.bb_major","key.a_minor","key.e_minor","key.d_minor"].map(n=>({value:n,label:qe(n)}));function qF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onChange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),o.jsx(ot,{label:u.studio.fields.keyId,value:r.keyId??"key.c_major",onChange:i=>s({keyId:i}),options:LF,error:t.keyId}),o.jsx(be,{label:u.studio.fields.lowMidi,value:r.lowMidi??60,onChange:i=>s({lowMidi:i}),min:24,max:96,error:t.lowMidi}),o.jsx(be,{label:u.studio.fields.highMidi,value:r.highMidi??72,onChange:i=>s({highMidi:i}),min:24,max:108,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.noteCount,value:r.noteCount??6,onChange:i=>s({noteCount:i}),min:3,max:16,error:t.noteCount}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??4,onChange:i=>s({questionCount:i}),min:1,max:20,error:t.questionCount})]})}function zF({parameters:n,onChange:e,errors:t}){const r=n,s=a=>{e(a==="spell_scale"?{...n,mode:a,keyIds:["key.c_major","key.g_major","key.f_major"],chordIds:void 0,rootMidis:void 0}:{...n,mode:a,chordIds:["chord.maj","chord.min"],rootMidis:[60,62,64,65,67,69],keyIds:void 0})},i=a=>e({...n,...a});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.spellMode,value:r.mode??"spell_scale",onChange:s,options:[{value:"spell_scale",label:u.studio.fields.spellModeScale},{value:"spell_chord",label:u.studio.fields.spellModeChord}],error:t.mode}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:a=>i({questionCount:a}),min:1,max:30,error:t.questionCount})]})}function FF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.selectMode,value:r.mode??"find_extreme",onChange:i=>s({mode:i}),options:[{value:"find_wrong",label:u.studio.fields.selectModeWrong},{value:"find_extreme",label:u.studio.fields.selectModeExtreme}],error:t.mode}),o.jsx(ot,{label:u.studio.fields.extreme,value:r.extreme??"highest",onChange:i=>s({extreme:i}),options:[{value:"highest",label:u.studio.fields.extremeHighest},{value:"lowest",label:u.studio.fields.extremeLowest}],error:t.extreme}),o.jsx(ot,{label:u.studio.fields.clef,value:r.clef??"treble",onCh
4080ange:i=>s({clef:i}),options:[{value:"treble",label:u.studio.fields.clefTreble},{value:"bass",label:u.studio.fields.clefBass},{value:"alto",label:u.studio.fields.clefAlto},{value:"tenor",label:u.studio.fields.clefTenor}],error:t.clef}),o.jsx(ot,{label:u.studio.fields.keyId,value:r.keyId??"key.c_major",onChange:i=>s({keyId:i}),options:["key.c_major","key.a_minor","key.g_major"].map(i=>({value:i,label:qe(i)})),error:t.keyId}),o.jsx(be,{label:u.studio.fields.noteCount,value:r.noteCount??5,onChange:i=>s({noteCount:i}),min:3,max:8,error:t.noteCount}),o.jsx(be,{label:u.studio.fields.lowMidi,value:r.lowMidi??60,onChange:i=>s({lowMidi:i}),min:24,max:96,error:t.lowMidi}),o.jsx(be,{label:u.studio.fields.highMidi,value:r.highMidi??79,onChange:i=>s({highMidi:i}),min:24,max:108,error:t.highMidi}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}function $F({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.functionMode,value:r.mode??"function",onChange:i=>s({mode:i}),options:[{value:"function",label:u.studio.fields.functionModeFunction},{value:"numeral",label:u.studio.fields.functionModeNumeral}],error:t.mode}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}function BF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.presentation,value:r.presentation??"melodic",onChange:i=>s({presentation:i}),options:[{value:"melodic",label:u.studio.fields.presentationMelodic},{value:"harmonic",label:u.studio.fields.presentationHarmonic},{value:"mixed",label:u.studio.fields.presentationMixed}],error:t.presentation}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??8,onChange:i=>s({questionCount:i}),min:1,max:50,error:t.questionCount})]})}function UF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(be,{label:u.studio.fields.bpm,value:r.bpm??70,onChange:i=>s({bpm:i}),min:40,max:160,error:t.bpm}),o.jsx(be,{label:u.studio.fields.bars,value:r.bars??2,onChange:i=>s({bars:i}),min:1,max:2,error:t.bars}),o.jsx(be,{label:u.studio.fields.optionCount,value:r.optionCount??3,onChange:i=>s({optionCount:i}),min:2,max:4,error:t.optionCount}),o.jsx(be,{label:u.studio.fields.maxPlays,value:r.maxPlays??5,onChange:i=>s({maxPlays:i}),min:0,max:20,error:t.maxPlays}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}function GF({parameters:n,onChange:e,errors:t}){const r=n,s=i=>e({...n,...i});return o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ot,{label:u.studio.fields.dictationMode,value:r.mode??"blank",onChange:i=>s({mode:i}),options:[{value:"full",label:u.studio.fields.dictationModeFull},{value:"blank",label:u.studio.fields.dictationModeBlank}],error:t.mode}),o.jsx(be,{label:u.studio.fields.noteCount,value:r.noteCount??4,onChange:i=>s({noteCount:i}),min:3,max:8,error:t.noteCount}),o.jsx(be,{label:u.studio.fields.optionCount,value:r.optionCount??3,onChange:i=>s({optionCount:i}),min:2,max:4,error:t.optionCount}),o.jsx(be,{label:u.studio.fields.maxPlays,value:r.maxPlays??5,onChange:i=>s({maxPlays:i}),min:0,max:20,error:t.maxPlays}),o.jsx(be,{label:u.studio.fields.questionCount,value:r.questionCount??6,onChange:i=>s({questionCount:i}),min:1,max:30,error:t.questionCount})]})}const M7=[{typeId:"ear_interval",type:"ear_training",modalities:["listening"],label:u.studio.types.ear_interval,Editor:IF,defaultParameters:{intervals:["m3","M3"],questionCount:5,rootMidiRange:[57,76],direction:"ascending"}},{typeId:"rhythm_tap",type:"rhythm",modalities:["listening","tapping"],label:u.studio.types.rhythm_tap,Editor:_F,defaultParameters:{bpm:80,beatsPerBar:4,bars:1,pattern:[0,1,2,3],rounds:3,toleranceMs:140}},{typeId:"rhythm_echo",type:"rhythm",modalities:["listening","tapping"],label:u.studio.types.rhythm_echo,Editor:kF,defaultParameters:{bpm:76,beatsPerBar:4,bars:1,patternIds:["rhythm_pattern.quarters_eighths"],rounds:3,toleranceMs:160,mode:"echo"}},{typeId:"theory_chord_build",type:"theory",modalities:["writing"],label:u.studio.types.theory_chord_build,Editor:wF,defaultParameters:{chordIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,67]}},{typeId:"ear_chord_quality",type:"ear_training",modalities:["listening"],label:u.studio.types.ear_chord_quality,Editor:ap(["chord"]),defaultParameters:{optionIds:["chord.maj","chord.min"],questionCount:5,rootMidiRange:[55,70]}}
4080,{typeId:"ear_scale_recognition",type:"ear_training",modalities:["listening"],label:u.studio.types.ear_scale_recognition,Editor:ap(["scale","mode"]),defaultParameters:{optionIds:["scale.major","scale.natural_minor"],questionCount:5,rootMidiRange:[55,67]}},{typeId:"ear_cadence",type:"ear_training",modalities:["listening"],label:u.studio.types.ear_cadence,Editor:ap(["cadence"]),defaultParameters:{optionIds:["cadence.authentic","cadence.plagal"],questionCount:4,rootMidiRange:[55,65]}},{typeId:"sight_note_id",type:"sight_reading",modalities:["reading"],label:u.studio.types.sight_note_id,Editor:jF,defaultParameters:{clef:"treble",lowMidi:60,highMidi:79,questionCount:8}},{typeId:"piano_scale_play",type:"piano",modalities:["playing","reading"],label:u.studio.types.piano_scale_play,Editor:TF,defaultParameters:{sourceId:"scale.major",rootMidi:60,mode:"scale",direction:"ascending",rounds:3}},{typeId:"theory_matching",type:"theory",modalities:["reading"],label:u.studio.types.theory_matching,Editor:EF,defaultParameters:{itemIds:["interval.m2","interval.M2","interval.m3","interval.M3"],promptField:"symbol",rounds:2}},{typeId:"repertoire_record",type:"performance",modalities:["playing"],label:u.studio.types.repertoire_record,Editor:NF,defaultParameters:{minSeconds:5}},{typeId:"score_label",type:"theory",modalities:["reading"],label:u.studio.types.score_label,Editor:SF,defaultParameters:{excerpt:"c4:q,e4:q,g4:h|f4:q,a4:q,f4:h|d4:q,g4:q,b4:h|c5:w",clef:"treble",questions:[{prompt:"באיזו תיבה הקטע נחתם בצליל הטוניקה?",correctMeasure:3}]}},{typeId:"piano_locate",type:"piano",modalities:["playing"],label:u.studio.types.piano_locate,Editor:AF,defaultParameters:{mode:"pitch",lowMidi:55,highMidi:79,questionCount:8,anyOctave:!0}},{typeId:"sight_reading",type:"sight_reading",modalities:["reading","playing"],label:u.studio.types.sight_reading,Editor:CF,defaultParameters:{mode:"name_note",clef:"treble",lowMidi:60,highMidi:72,questionCount:8}},{typeId:"notation_build",type:"sight_reading",modalities:["reading","writing"],label:u.studio.types.notation_build,Editor:MF,defaultParameters:{mode:"build_interval",clef:"treble",intervalSemitones:4,lowMidi:60,highMidi:72,questionCount:6}},{typeId:"theory_organize",type:"theory",modalities:["reading","writing"],label:u.studio.types.theory_organize,Editor:PF,defaultParameters:{mode:"classify",buckets:[{id:"consonant",label:{he:"קונסוננס",en:"Consonant"},itemIds:["interval.P5","interval.P4","interval.M3","interval.m3","interval.M6","interval.P8"]},{id:"dissonant",label:{he:"דיסוננס",en:"Dissonant"},itemIds:["interval.m2","interval.M2","interval.m7","interval.M7","interval.TT"]}],sampleSize:6,questionCount:4}},{typeId:"sight_read_interval",type:"sight_reading",modalities:["reading"],label:u.studio.types.sight_read_interval,Editor:OF,defaultParameters:{clef:"treble",intervals:["m3","M3","P5"],presentation:"melodic",lowMidi:60,highMidi:79,questionCount:8}},{typeId:"sight_read_key",type:"sight_reading",modalities:["reading"],label:u.studio.types.sight_read_key,Editor:DF,defaultParameters:{clef:"treble",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6}},{typeId:"sight_read_accidental",type:"sight_reading",modalities:["reading"],label:u.studio.types.sight_read_accidental,Editor:VF,defaultParameters:{clef:"treble",accidentalType:"sharps",lowMidi:60,highMidi:72,questionCount:8}},{typeId:"sight_read_melody",type:"sight_reading",modalities:["reading","playing"],label:u.studio.types.sight_read_melody,Editor:qF,defaultParameters:{clef:"treble",keyId:"key.c_major",lowMidi:60,highMidi:72,noteCount:6,questionCount:4}},{typeId:"theory_spell",type:"theory",modalities:["writing"],label:u.studio.types.theory_spell,Editor:zF,defaultParameters:{mode:"spell_scale",keyIds:["key.c_major","key.g_major","key.f_major"],questionCount:6}},{typeId:"notation_select",type:"sight_reading",modalities:["reading"],label:u.studio.types.notation_select,Editor:FF,defaultParameters:{mode:"find_extreme",extreme:"highest",clef:"treble",keyId:"key.c_major",noteCount:5,lowMidi:60,highMidi:79,questionCount:6}},{typeId:"theory_function",type:"theory",modalities:["reading"],label:u.studio.types.theory_function,Editor:$F,defaultParameters:{mode:"function",keyIds:["key.c_major","key.g_major"],degrees:[1,2,3,4,5,6,7],questionCount:6}},{typeId:"ear_interval_quality",type:"ear_training",modalities:["listening"],label:u.studio.types.ear_interval_quality,Editor:BF,defaultParameters:{intervals:["m2","M2"],presentation:"melodic",rootMidiRange:[55,74],questionCount:8}},{typeId:"rhythm_dictation",type:"rhythm",modalities:["listening","reading"],label:u.studio.types.rhythm_dictation,Editor:UF,defaultParameters:{bpm:70,bars:2,optionCount:3,maxPlays:5,questionCount:6}},{typeId:"melody_dictation",type:"ear_training",modalities:["listening","reading"],label:u.studio.types.melody_dictation,Editor:GF,defaultParameters:{mode:"blank",blankPosition:"end",keyId:"key.c_major",lowMidi:60,highMidi:67,noteCount:4,optionCount:3,maxPlays:5,questionCount:6}}];function gx(){return M7}function KF(n){return M7.find(e=>e.typeId===n)??null}function P7({item:n}){const e={draft:"bg-surface-sunken text-text-secondary",published:"bg-success/10 text-success",archived:"bg-surface-sunken text-text-muted line-through"};return o.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[o.jsx("span",{className:`rounded-full px-2.5 py-0.5 text-xs font-semibold ${e[n.status]}`,children:u.studio[n.status]}),n.status==="published"&&sS(n)?o.jsx("span",{className:"rounded-full bg-primary-soft px-2.5 py-0.5 text-xs font-medium text-primary",children:u.studio.unpublishedChanges}):null]})}function HF(){const n=Be(g=>g.session),e=It(),t=en(),[r,s]=E.useState(!1),i=E.useRef(null),[a,c]=E.useState(null),l=fe({queryKey:["authored-activities"],queryFn:()=>Ua.listAuthored()}),d=async g=>{var x;try{const b=await Wh(g);if(!Array.isArray(b))throw new Error("bad-shape");let I=0;for(const N of b)typeof(N==null?void 0:N.id)!="string"||typeof((x=N==null?void 0:N.draft)==null?void 0:x.typeId)!="string"||S1(N.draft).some(D=>D.path==="typeId")||(await Ua.saveAuthored(N),I+=1);await t.invalidateQueries({queryKey:["authored-activities"]}),await t.invalidateQueries({queryKey:["activities"]}),c(X(u.studio.importDone,{n:I}))}catch{c(u.studio.importFailed)}window.setTimeout(()=>c(null),3500)},m=async g=>{await Ua.saveAuthored(g),await t.invalidateQueries({queryKey:["authored-activities"]}),e({to:"/studio/activities/$activityId",params:{activityId:g.id}})},p=async g=>{const x=gx().find(b=>b.typeId===g);!x||!n||await m(E2({id:crypto.randomUUID(),organizationId:n.user.organizationId,createdBy:n.user.id,typeId:x.typeId,type:x.type,modalities:x.modalities,defaultParameters:structuredClone(
4080x.defaultParameters)},{now:()=>new Date().toISOString()}))},f=async g=>{if(!n)return;const x=E2({id:crypto.randomUUID(),organizationId:n.user.organizationId,createdBy:n.user.id,typeId:g.typeId,type:g.category,modalities:[...g.modalities],defaultParameters:FN(g)},{now:()=>new Date().toISOString()});await m({...x,draft:{...x.draft,title:g.title.he,description:g.description.he,estimatedMinutes:g.estimatedMinutes}})};return o.jsxs("div",{children:[o.jsx(tt,{title:u.studio.activitiesTitle,subtitle:u.studio.activitiesSubtitle,actions:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("input",{ref:i,type:"file",accept:"application/json",className:"hidden",onChange:g=>{var b;const x=(b=g.target.files)==null?void 0:b[0];x&&d(x),g.target.value=""}}),o.jsx(ee,{variant:"ghost",onClick:()=>{var g;return(g=i.current)==null?void 0:g.click()},children:u.studio.importJson}),o.jsx(ee,{variant:"ghost",onClick:()=>Hh("shirat-activities.json",l.data??[]),children:u.admin.exportJson}),o.jsxs(ee,{onClick:()=>s(g=>!g),children:[o.jsx(Zi,{size:16,"aria-hidden":!0}),u.studio.newActivity]})]})}),a?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:a}):null,r?o.jsxs(W,{className:"mb-5 space-y-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-sm font-semibold",children:u.studio.fromTemplate}),o.jsx("p",{className:"mb-3 text-xs text-text-muted",children:u.studio.fromTemplateHint}),o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:[...zN].sort((g,x)=>g.level-x.level).map(g=>o.jsxs("button",{onClick:()=>void f(g),className:"rounded-md border border-border px-3.5 py-2.5 text-start transition-colors hover:border-primary hover:bg-primary-soft/40",children:[o.jsxs("span",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:g.title.he}),o.jsx("span",{className:"shrink-0 rounded-full bg-surface-sunken px-2 py-0.5 text-[11px] font-bold text-text-secondary",children:X(u.studio.levelBadge,{n:g.level})})]}),o.jsx("span",{className:"mt-0.5 block truncate text-xs text-text-muted",children:g.description.he})]},g.id))})]}),o.jsxs("div",{className:"border-t border-border pt-4",children:[o.jsx("p",{className:"mb-3 text-sm font-medium text-text-secondary",children:u.studio.chooseType}),o.jsx("div",{className:"flex flex-wrap gap-2",children:gx().map(g=>o.jsx(ee,{variant:"soft",onClick:()=>void p(g.typeId),children:g.label},g.typeId))})]})]}):null,l.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):(l.data??[]).length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.studio.empty}):o.jsx("div",{className:"space-y-3",children:(l.data??[]).map(g=>o.jsx("button",{onClick:()=>void e({to:"/studio/activities/$activityId",params:{activityId:g.id}}),className:"block w-full text-start",children:o.jsxs(W,{className:"flex items-center gap-4 p-4 transition-colors hover:border-border-strong",children:[o.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(_q,{size:18,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-semibold",children:g.draft.title||u.studio.draft}),o.jsxs("span",{className:"block text-xs text-text-muted",children:[u.studio.types[g.draft.typeId]??g.draft.typeId," · ",u.studio.lastUpdated," ",mr(g.updatedAt),g.versions.length>0?` · ${X(u.studio.versionLabel,{n:g.versions.length})}`:""]})]}),o.jsx(P7,{item:g})]})},g.id))})]})}function R7({activity:n}){const e=Qe();E.useEffect(()=>(e.begin("preview",{source:"user",activities:[n]}),()=>e.clear()),[n]);const t=e.session,r=t==null?void 0:t.runs.find(s=>s.id===t.activeRunId);if(t&&r){const s=S7(r.activity.typeId);return s?o.jsxs("div",{children:[o.jsx("p",{className:"mb-3 text-sm text-text-secondary",children:u.studio.previewHint}),o.jsx(s,{activity:r.activity,onRunComplete:()=>e.finishRun()},r.id)]}):o.jsx(W,{children:u.practice.comingSoonActivity})}return o.jsxs(W,{className:"flex flex-col items-center gap-3 py-8 text-center",children:[o.jsx("p",{className:"font-semibold",children:u.practice.summaryTitle}),o.jsxs(ee,{variant:"soft",onClick:()=>e.begin("preview",{source:"user",activities:[n]}),children:[o.jsx(zu,{size:15,"aria-hidden":!0}),u.studio.preview]})]})}const jd={now:()=>new Date().toISOString()};function WF(){const{activityId:n}=ri({strict:!1}),e=It(),t=en(),r=fe({queryKey:["authored-activity",n],queryFn:()=>Ua.getAuthored(n)}),s=fe({queryKey:["assets","all"],queryFn:()=>Gr.list()}),[i,a]=E.useState(null),[c,l]=E.useState(!1),[d,m]=E.useState(null);E.useEffect(()=>{r.data&&a(r.data)},[r.data]);const p=E.useMemo(()=>i?S1(i.draft):[],[i]),f=E.useMemo(()=>{var _;const R={};for(const j of p)R[_=j.path]??(R[_]=u.studio.errors[j.messageKey.split(".").pop()]??u.studio.errors.invalidParam);return R},[p]),g=lt({mutationFn:R=>Ua.saveAuthored(R),onSuccess:async R=>{a(R),await t.invalidateQueries({queryKey:["authored-activities"]}),await t.invalidateQueries({queryKey:["authored-activity",n]}),await t.invalidateQueries({queryKey:["activities"]})}});if(r.isPending)return o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading});if(!i)return o.jsx(W,{children:u.studio.empty});const x=KF(i.draft.typeId),b=i.status==="archived",I=R=>{b||a(XN(i,{...i.draft,...R},jd))},N=R=>{m(R),window.setTimeout(()=>m(null),2500)},V=()=>g.mutate(i,{onSuccess:()=>N(u.studio.savedToast)}),D=()=>
4080{if(p.length>0){N(u.studio.fixErrors);return}g.mutate(eS(i,jd),{onSuccess:()=>N(u.studio.publishedToast)})},T=()=>{g.mutate(b?nS(i,jd):tS(i,jd)),b||e({to:"/studio/activities"})},M={id:r4(i),organizationId:i.organizationId,type:i.draft.type,typeId:i.draft.typeId,title:i.draft.title||u.studio.draft,description:i.draft.description,modalities:i.draft.modalities,parameters:i.draft.parameters,estimatedMinutes:i.draft.estimatedMinutes};return o.jsxs("div",{children:[o.jsx(tt,{title:i.draft.title||u.studio.editorTitle,subtitle:(x==null?void 0:x.label)??i.draft.typeId,actions:o.jsx(P7,{item:i})}),d?o.jsxs("div",{role:"status",className:"mb-4 flex items-center gap-2 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),d]}):null,o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(W,{className:"space-y-4 self-start",children:[o.jsx(C7,{label:u.studio.fieldTitle,value:i.draft.title,onChange:R=>I({title:R}),error:f.title}),o.jsx(vF,{label:u.studio.fieldDescription,value:i.draft.description,onChange:R=>I({description:R})}),o.jsx(be,{label:u.studio.fieldMinutes,value:i.draft.estimatedMinutes,onChange:R=>I({estimatedMinutes:R}),min:1,max:60,error:f.estimatedMinutes}),x?o.jsx(x.Editor,{parameters:i.draft.parameters,onChange:R=>I({parameters:R}),errors:f}):null,o.jsxs("div",{className:"border-t border-border pt-4",children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-secondary",children:u.studio.assets.attachTitle}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.studio.assets.attachHint}),(s.data??[]).length===0?o.jsx("p",{className:"text-xs text-text-muted",children:u.studio.assets.noneInLibrary}):o.jsx("div",{className:"flex flex-wrap gap-2",children:(s.data??[]).map(R=>{const _=(i.draft.assetIds??[]).includes(R.id);return o.jsxs("button",{type:"button","aria-pressed":_,disabled:b,onClick:()=>I({assetIds:_?(i.draft.assetIds??[]).filter(j=>j!==R.id):[...i.draft.assetIds??[],R.id]}),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${_?"border-primary bg-primary-soft text-primary":"border-border bg-surface text-text-secondary hover:border-border-strong"}`,children:[R.title," · ",u.studio.assets.kinds[R.kind]]},R.id)})})]}),b?o.jsx("div",{className:"border-t border-border pt-4",children:o.jsxs(ee,{variant:"soft",onClick:T,children:[o.jsx(aq,{size:15,"aria-hidden":!0}),u.studio.restore]})}):o.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border pt-4",children:[o.jsxs(ee,{onClick:V,disabled:g.isPending,children:[o.jsx($h,{size:15,"aria-hidden":!0}),u.studio.saveDraft]}),o.jsxs(ee,{variant:"soft",onClick:D,disabled:g.isPending||p.length>0,children:[o.jsx(Xn,{size:15,"aria-hidden":!0}),u.studio.publish]}),o.jsxs(ee,{variant:"ghost",onClick:()=>l(R=>!R),children:[c?o.jsx(bq,{size:15,"aria-hidden":!0}):o.jsx(xq,{size:15,"aria-hidden":!0}),c?u.studio.closePreview:u.studio.preview]}),o.jsxs(ee,{variant:"ghost",onClick:T,children:[o.jsx(oq,{size:15,"aria-hidden":!0}),u.studio.archive]})]})]}),o.jsxs("div",{className:"space-y-6",children:[c&&p.length===0?o.jsx(R7,{activity:M}):c?o.jsx(W,{className:"text-sm text-danger",children:u.studio.fixErrors}):null,o.jsxs("section",{children:[o.jsx("h2",{className:"mb-2 text-sm font-semibold text-text-secondary",children:u.studio.versionsTitle}),o.jsx(W,{className:"divide-y divide-border p-0",children:i.versions.length===0?o.jsx("p",{className:"p-4 text-sm text-text-muted",children:u.studio.noVersions}):[...i.versions].reverse().map(R=>o.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[o.jsxs("span",{className:"text-sm font-medium",children:[X(u.studio.versionLabel,{n:R.version})," · ",o.jsx("span",{className:"text-text-secondary",children:R.activity.title})]}),o.jsx("span",{className:"text-xs text-text-muted",children:nq(R.publishedAt)})]},R.version))})]})]})]})]})}const YF={mp3:"audio",wav:"audio",ogg:"audio",m4a:"audio",mid:"midi",midi:"midi",xml:"musicxml",musicxml:"musicxml",mxl:"musicxml",pdf:"pdf",png:"image",jpg:"image",jpeg:"image",webp:"image",svg:"image"};function QF(n,e){var r;if(e.startsWith("audio/"))return"audio";if(e.startsWith("image/"))return"image";if(e==="application/pdf")return"pdf";const t=((r=n.split(".").pop())==null?void 0:r.toLowerCase())??"";return YF[t]??null}const ZF={audio:vq,midi:dg,musicxml:cg,pdf:kq,image:Iq},JF=800*1024;function XF(n){return n>=1024*1024?`${(n/(1024*1024)).toFixed(1)}MB`:`${Math.max(1,Math.round(n/1024))}KB`}function dc({title:n,kinds:e}){var D;const t=Be(T=>T.session),r=en(),s=E.useRef(null),[i,a]=E.useState(null),[c,l]=E.useState(""),[d,m]=E.useState(null),f=((D=fe({queryKey:["academic"],queryFn:()=>pt.get()}).data)==null?void 0:D.groups)??[],g=E.useMemo(()=>new Map(f.map(T=>[T.id,T])),[f]),x=fe({queryKey:["assets",(e==null?void 0:e.join(","))??"all",c],queryFn:()=>Gr.list({...e?{kinds:e}:{},...c?{groupId:c}:{}})}),b=()=>
4080r.invalidateQueries({queryKey:["assets"]}),I=lt({mutationFn:async T=>{const M=QF(T.name,T.type);if(!M)throw new Error(u.studio.assets.unsupportedType);if(T.size>JF)throw new Error(u.studio.assets.uploadTooLarge);const R=await new Promise((j,w)=>{const A=new FileReader;A.onload=()=>j(A.result),A.onerror=()=>w(new Error("read failed")),A.readAsDataURL(T)}),_={id:crypto.randomUUID(),organizationId:(t==null?void 0:t.user.organizationId)??"org-shirat",kind:M,title:T.name.replace(/\.[^.]+$/,""),fileName:T.name,mimeType:T.type||"application/octet-stream",sizeBytes:T.size,url:R,createdBy:(t==null?void 0:t.user.id)??"",createdAt:new Date().toISOString(),tags:[],...c?{groupIds:[c]}:{}};return Gr.save(_)},onSuccess:()=>void b(),onError:T=>a(T instanceof Error?T.message:String(T))}),N=lt({mutationFn:T=>Gr.delete(T),onSuccess:T=>{a(T.referenced?u.studio.assets.deleteBlocked:u.studio.assets.deleted),b()}}),V=lt({mutationFn:({id:T,groupIds:M})=>Gr.setGroups(T,M),onSuccess:()=>{m(null),a(u.studio.assets.scopeSaved),b()}});return o.jsxs("div",{children:[o.jsx(tt,{title:n,actions:o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:s,type:"file",className:"hidden",onChange:T=>{var R;const M=(R=T.target.files)==null?void 0:R[0];M&&I.mutate(M),T.target.value=""}}),o.jsxs(ee,{onClick:()=>{var T;return(T=s.current)==null?void 0:T.click()},disabled:I.isPending,children:[o.jsx(zl,{size:15,"aria-hidden":!0}),u.studio.assets.upload]})]})}),f.length>0?o.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[o.jsxs("label",{htmlFor:"asset-group-filter",className:"flex items-center gap-1.5 text-sm text-text-secondary",children:[o.jsx(Zb,{size:15,"aria-hidden":!0}),u.studio.assets.scopeLabel]}),o.jsxs("select",{id:"asset-group-filter",value:c,onChange:T=>l(T.target.value),className:"rounded-md border border-border bg-surface px-3 py-1.5 text-sm focus:border-primary",children:[o.jsx("option",{value:"",children:u.studio.assets.scopeFilterAll}),f.map(T=>o.jsx("option",{value:T.id,children:T.name},T.id))]})]}):null,o.jsx("p",{className:"mb-4 text-xs text-text-muted",children:u.studio.assets.storageNote}),i?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:i}):null,x.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):(x.data??[]).length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.studio.assets.empty}):o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:(x.data??[]).map(T=>{const M=ZF[T.kind],R=(T.groupIds??[]).map(_=>g.get(_)).filter(_=>!!_);return o.jsxs(W,{className:"flex flex-col gap-2 p-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(M,{size:18,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-semibold",children:T.title}),o.jsxs("span",{className:"block text-xs text-text-muted",children:[u.studio.assets.kinds[T.kind]," · ",XF(T.sizeBytes)," ·"," ",mr(T.createdAt)]})]}),o.jsx("button",{onClick:()=>m(T),"aria-label":u.studio.assets.scopeLabel,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-primary",children:o.jsx(Zb,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>N.mutate(T.id),"aria-label":u.common.delete,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-danger",children:o.jsx(Uh,{size:16,"aria-hidden":!0})})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-1.5 ps-[52px]",children:R.length===0?o.jsx("span",{className:"text-xs text-text-muted",children:u.studio.assets.scopeShared}):R.map(_=>o.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-surface-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",children:[o.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:_.color},"aria-hidden":!0}),_.name]},_.id))})]},T.id)})}),d?o.jsx(e$,{asset:d,groups:f,pending:V.isPending,onCancel:()=>m(null),onSave:T=>V.mutate({id:d.id,groupIds:T})}):null]})}function e$({asset:n,groups:e,pending:t,onCancel:r,onSave:s}){const[i,a]=E.useState(n.groupIds??[]),c=l=>a(d=>d.includes(l)?d.filter(m=>m!==l):[...d,l]);return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"dialog","aria-modal":"true","aria-label":u.studio.assets.scopeLabel,children:o.jsxs(W,{className:"max-h-[80vh] w-full max-w-md overflow-y-auto",children:[o.jsx("h2",{className:"mb-1 text-lg font-bold",children:n.title}),o.jsx("p",{className:"mb-4 text-xs text-text-muted",children:u.studio.assets.scopeHint}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(l=>{const d=i.includes(l.id);return o.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>c(l.id),className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${d?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}
4080`,children:[o.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:l.color},"aria-hidden":!0}),l.name]},l.id)})}),o.jsxs("div",{className:"mt-5 flex gap-2",children:[o.jsx(ee,{onClick:()=>s(i),disabled:t,children:u.studio.assets.scopeSave}),o.jsx(ee,{variant:"ghost",onClick:r,children:u.academicAdmin.cancel})]})]})})}function t$(){const n=Be(R=>R.session),e=(n==null?void 0:n.user.id)??"",t=It(),r=fe({queryKey:["academic"],queryFn:()=>pt.get()}),s=r.data,i=s?cs(s,new Date):null,a=E.useMemo(()=>s&&e?Ha(s,e,i==null?void 0:i.id):[],[s,e,i==null?void 0:i.id]),c=R=>s?vc(s,R):[],l=R=>c(R).length>0,d=E.useMemo(()=>a.filter(R=>c(R.id).length>=2),[a,s]),m=E.useMemo(()=>{const R=[],_=new Set,j=A=>{_.has(A.id)||(_.add(A.id),R.push(A))},w=s==null?void 0:s.groups.find(A=>A.id==="g-m-prep-course");w&&j(w);for(const A of a){const O=c(A.id);O.length===0?j(A):O.length===1&&j(O[0])}return R},[a,s]),f=E.useMemo(()=>{const R=new Map;for(const _ of m)R.set(_.id,_);for(const _ of d)for(const j of vc(s,_.id))R.set(j.id,j);return[...R.values()]},[m,d,s]).map(R=>R.id),g=fe({queryKey:["group-lessons",f.join(",")],queryFn:()=>Oo.listForGroups(f),enabled:f.length>0}),x=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),b=fe({queryKey:["announcements"],queryFn:()=>Ou.list()}),I=s&&e&&i?Ha(s,e).filter(R=>R.academicYearId!==i.id&&!l(R.id)):[],N=Qe(R=>R.begin),V=R=>(g.data??[]).find(_=>_.groupId===R)??null,D=R=>{if(!n)return;const _=(x.data??[]).filter(j=>
4080R.recommendedActivityIds.includes(j.id)&&wn(j.typeId));_.length!==0&&(N(n.user.id,{source:"course",activities:_,reasonKey:"course.reason.lastLesson",detail:{topic:R.note}}),t({to:"/student/practice/session"}))},T=({group:R})=>{const _=V(R.id),j=s?Wa(s,R):[],w=_&&(x.data??[]).some(A=>_.recommendedActivityIds.includes(A.id)&&wn(A.typeId));return o.jsxs(W,{role:"button",tabIndex:0,onClick:()=>void t({to:"/student/courses/$groupId",params:{groupId:R.id}}),className:"flex cursor-pointer flex-col gap-3 hover:shadow-hover",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-white",style:{backgroundColor:R.color},children:o.jsx(Lr,{size:20,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"truncate font-semibold",children:R.name}),j.length>0?o.jsx("p",{className:"text-xs text-text-muted",children:X(u.courses.teacher,{name:j.join(" · ")})}):null]})]}),_?o.jsxs("div",{className:"rounded-md bg-surface-sunken px-3 py-2.5",children:[o.jsxs("p",{className:"text-xs font-medium text-text-muted",children:[u.courses.currentTopic," · ",mr(_.date)]}),o.jsx("p",{className:"mt-0.5 text-sm font-medium",children:_.note})]}):o.jsx("p",{className:"rounded-md bg-surface-sunken px-3 py-2.5 text-sm text-text-muted",children:u.courses.noLessonYet}),o.jsxs("div",{className:"mt-auto flex items-center gap-3",children:[_&&w?o.jsxs(ee,{onClick:A=>{A.stopPropagation(),D(_)},children:[o.jsx(Xt,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.courses.practiceCta]}):null,o.jsxs("span",{className:"text-sm font-medium text-primary",children:[u.courses.enterGroup," ←"]})]})]})},M=d.length>0||m.length>0;return o.jsxs("div",{children:[o.jsx(tt,{title:u.courses.title,subtitle:u.courses.subtitle}),r.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):M?o.jsxs("div",{className:"space-y-8",children:[d.map(R=>{const _=s?vc(s,R.id):[],j=new Set(_.map(A=>A.id)),w=(b.data??[]).filter(A=>A.groupId===R.id||j.has(A.groupId));return o.jsxs("section",{children:[o.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[o.jsx("span",{className:"size-3 rounded-full",style:{backgroundColor:R.color},"aria-hidden":!0}),o.jsx("h2",{className:"text-lg font-bold",children:R.name})]}),w.length>0?o.jsx("div",{className:"mb-4 space-y-2",children:w.slice(0,3).map(A=>o.jsxs("div",{className:"flex gap-2.5 rounded-lg border border-accent/30 bg-accent/10 px-3.5 py-2.5",children:[o.jsx(Fh,{size:16,"aria-hidden":!0,className:"mt-0.5 shrink-0 text-accent"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-medium",children:A.title??A.body}),A.title&&A.body?o.jsx("p",{className:"text-xs text-text-secondary",children:A.body}):null]})]},A.id))}):null,_.length>0?o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:_.map(A=>o.jsx(T,{group:A},A.id))}):o.jsx("p",{className:"text-sm text-text-muted",children:u.courses.noLessonYet})]},R.id)}),m.length>0?o.jsxs("section",{children:[d.length>0?o.jsx("h2",{className:"mb-3 text-lg font-bold",children:u.courses.otherCourses}):null,o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:m.map(R=>o.jsx(T,{group:R},R.id))})]}):null]}):o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.courses.empty}),I.length>0?o.jsxs("section",{className:"mt-8",children:[o.jsx("h2",{className:"mb-2 text-sm font-semibold text-text-secondary",children:u.courses.pastYears}),o.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(R=>{var j;const _=((j=s==null?void 0:s.years.find(w=>w.id===R.academicYearId))==null?void 0:j.name)??"";return o.jsxs("span",{className:"flex items-center gap-2 rounded-full bg-surface-sunken px-3.5 py-1.5 text-sm text-text-secondary",children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:R.color},"aria-hidden":!0}),R.name," · ",_]},R.id)})})]}):null]})}const n$=[{id:"MC-002",name:"תווים וקריאת תווים",domains:["יסודות המוסיקה","הרמוניה","ביצוע"],levels:["beginner"],guide:null,guideRef:"lesson-1-1",generators:[{jsonType:"note_id",typeId:"sight_note_id",reuseActivityId:"act-sight-1"},{jsonType:"note_id_treble",typeId:"sight_note_id",reuseActivityId:"act-note-tb-1"},{jsonType:"note_id_bass",typeId:"sight_note_id",reuseActivityId:"act-note-bs-1"},{jsonType:"note_id_ledger",typeId:"sight_note_id",reuseActivityId:"act-note-ledger-1"},{jsonType:"note_id_fluency",typeId:"sight_note_id",reuseActivityId:"act-note-fluency-1"},{jsonType:"note_reading",typeId:"sight_reading",mode:"name_note",reuseActivityId:"act-sr-name-bass"},{jsonType:"note_select",typeId:"notation_select",reuseActivityId:"act-nsel-high"},{jsonType:"accidental_id",typeId:"sight_read_accidental",reuseActivityId:"act-acc-flats"},{jsonType:"accidental_id_wide",typeId:"sight_read_accidental",reuseActivityId:"act-acc-wide"}
4080],covered:!0},{id:"MC-004",name:"מרווחים",domains:["יסודות המוסיקה"],levels:["intermediate"],guide:null,guideRef:"lesson-5-1",generators:[{jsonType:"ear_interval_basic",typeId:"ear_interval",reuseActivityId:"act-int-oct-1"},{jsonType:"ear_interval_2v3_easy",typeId:"ear_interval",reuseActivityId:"act-int-2v3-easy"},{jsonType:"ear_interval_2v3",typeId:"ear_interval",reuseActivityId:"act-int-2v3-1"},{jsonType:"ear_interval_large",typeId:"ear_interval",reuseActivityId:"act-int-large-1"},{jsonType:"ear_interval_id",typeId:"ear_interval",reuseActivityId:"act-intervals-1"},{jsonType:"ear_interval_quality",typeId:"ear_interval_quality",reuseActivityId:"act-mek-3rd-mel"},{jsonType:"sight_interval_2nd",typeId:"sight_read_interval",reuseActivityId:"act-int-sight-2nd-1"},{jsonType:"sight_interval",typeId:"sight_read_interval",reuseActivityId:"act-sri-3rds"},{jsonType:"interval_build",typeId:"notation_build",mode:"build_interval",reuseActivityId:"act-nb-3rd"}],covered:!0},{id:"MC-012",name:"משולשים ואקורדים",domains:["יסודות המוסיקה","הרמוניה","ביצוע"],levels:["advanced"],guide:null,guideRef:"hm-1-1",generators:[{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-theory-1"},{jsonType:"ear_chord_quality",typeId:"ear_chord_quality",reuseActivityId:"act-chord-quality-1"},{jsonType:"chord_notation",typeId:"notation_build",mode:"build_chord",reuseActivityId:"act-nb-chord"},{jsonType:"chord_spell",typeId:"theory_spell",mode:"spell_chord",reuseActivityId:"act-spell-triad"}],covered:!0},{id:"MC-006",name:"סולמות ודרגות",domains:["יסודות המוסיקה","הרמוניה","ביצוע"],levels:["advanced"],guide:null,guideRef:"lesson-4-1",generators:[{jsonType:"scale_spell",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-maj"},{jsonType:"ear_scale_type",typeId:"ear_scale_recognition",reuseActivityId:"act-scale-rec-1"},{jsonType:"roman_numeral",typeId:"theory_function",mode:"numeral",reuseActivityId:"act-func-num"},{jsonType:"keyboard_scale",typeId:"piano_scale_play",mode:"scale",reuseActivityId:"act-piano-scale-1"}],covered:!0},{id:"MC-013",name:"פיתוח שמיעה מלודית",domains:["יסודות המוסיקה"],levels:["advanced"],guide:null,guideRef:"sr-2-1",generators:[{jsonType:"melodic_dictation",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-start"},{jsonType:"melodic_dictation_mid",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-mid"},{jsonType:"ear_interval_id",typeId:"ear_interval",reuseActivityId:"act-intervals-1"},{jsonType:"sight_melody",typeId:"sight_read_melody",reuseActivityId:"act-mel-c"}],covered:!0},{id:"MC-028",name:"פיתוח שמיעה הרמונית",domains:["יסודות המוסיקה","הרמוניה","יצירה והלחנה","עיבוד ותזמור","אימפרוביזציה","תולדות המוסיקה","אחר"],levels:["mastery"],guide:null,guideRef:"th-5-1",generators:[{jsonType:"ear_chord_quality",typeId:"ear_chord_quality",reuseActivityId:"act-chord-quality-1"},{jsonType:"ear_cadence_id",typeId:"ear_cadence",reuseActivityId:"act-cadence-1"},{jsonType:"inversion_id",typeId:"chord_inversion",reuseActivityId:"act-inv-triad"}],covered:!0},{id:"MC-015",name:"סולפג'",domains:["יסודות המוסיקה"],levels:["advanced"],guide:null,generators:[{jsonType:"melodic_dictation",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-mc"},{jsonType:"ear_interval_id",typeId:"ear_interval",reuseActivityId:"act-intervals-1"},{jsonType:"ear_scale_type",typeId:"ear_scale_recognition",reuseActivityId:"act-scale-rec-1"}],covered:!1},{id:"MC-008",name:"מודוסים",domains:["יסודות המוסיקה","עיבוד ותזמור"],levels:["advanced"],guide:null,generators:[{jsonType:"ear_scale_type",typeId:"ear_scale_recognition",reuseActivityId:"act-scale-rec-1"},{jsonType:"scale_spell",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-min"}],covered:!1},{id:"MC-030",name:"משקלים מורכבים",domains:["יסודות המוסיקה"],levels:["intermediate"],guide:null,generators:[{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-2"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythm_tap_68",typeId:"rhythm_tap",reuseActivityId:"act-meter-68"},{jsonType:"rhythm_echo",typeId:"rhythm_echo"}],covered:!1},{id:"MC-033",name:"פוליריתמיקה",domains:["יסודות המוסיקה"],levels:["advanced"],guide:null,generators:[{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythm_echo",typeId:"rhythm_echo",reuseActivityId:"act-echo-basic-1"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-2"}],covered:!1},{id:"MC-054",name:"כתיבה ופענוח מנגינות",domains:["יסודות המוסיקה","עיבוד ותזמור"],levels:["mastery"],guide:null,guideRef:"sr-2-1",generators:[{jsonType:"melodic_dictation",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-mc"},{jsonType:"fill_blank",typeId:"melody_dictation",mode:"blank",reuseActivityId:"act-mek-mdict-mid"},{jsonType:"sight_melody",typeId:"sight_read_melody",reuseActivityId:"act-mel-c"}],covered:!0},{id:"MC-011",name:"זיהוי אקורדים משולשים (מפורק וסימולטני)",domains:["יסודות המוסיקה","הרמוניה"],levels:["intermediate"],guide:null,guideRef:"hm-1-1",generators:[{jsonType:"ear_chord_quality_easy",typeId:"ear_chord_quality",reuseActivityId:"act-chord-mm-easy"},{jsonType:"ear_chord_quality_basic",typeId:"ear_chord_quality",reuseActivityId:"act-chord-mm-1"},{jsonType:"chord_build_basic",typeId:"theory_chord_build",reuseActivityId:"act-chord-mm-build-1"},{jsonType:"ear_chord_quality",typeId:"ear_chord_quality",reuseActivityId:"act-chord-quality-1"},{jsonType:"inversion_id",typeId:"chord_inversion",reuseActivityId:"act-inv-triad"}],covered:!0},{id:"MC-051",name:"מבנה מלודי ובנייה והשלמת מנגינות",domains:["יסודות המוסיקה","אימפרוביזציה"],levels:["mastery"],guide:null,guideRef:"sr-2-1",generators:[{jsonType:"fill_blank",typeId:"melody_dictation",mode:"blank",reuseActivityId:"act-mek-mdict-mid"},{jsonType:"melodic_dictation_start",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-start"},{jsonType:"melodic_dictation_end",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-end"}],covered:!0},{id:"MC-031",name:"שמיניות: דפוסים וזוגות מול רצפים",domains:["יסודות המוסיקה"],levels:["advanced"],guide:null,generators:[{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-5"},{jsonType:"rhythm_tap_58",typeId:"rhythm_tap",reuseActivityId:"act-meter-58"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-1"},{jsonType:"rhythm_echo",typeId:"rhythm_echo"}],covered:!1},{id:"MC-010",name:"מקצבים א-סימטריים",domains:["יסודות המוסיקה","קצב","יצירה והלחנה","אחר"],levels:["intermediate"],guide:null,generators:[{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythm_tap_78",typeId:"rhythm_tap",reuseActivityId:"act-meter-78"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-2"},{jsonType:"rhythm_echo",typeId:"rhythm_echo"}],covered:!1},{id:"MC-082",name:"אלתור ריתמי",domains:["יסודות המוסיקה","ביצוע"],levels:["mastery"],guide:null,generators:[{jsonType:"rhythm_echo",typeId:"rhythm_echo"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-1"}],covered:!1},{id:"MC-042",name:"נגינה קבוצתית",domains:["יסודות המוסיקה","הרמוניה","ביצוע","אימפרוביזציה"],levels:["advanced"],guide:null,generators:[{jsonType:"keyboard_chord",typeId:"piano_scale_play",mode:"chord",reuseActivityId:"act-piano-play-1"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-theory-1"},{jsonType:"repertoire_record",typeId:"repertoire_record",reuseActivityId:"act-record-1"}],covered:!1},{id:"MC-005",name:"סולם דו מז'ור, אוקטבה",domains:["יסודות המוסיקה","הרמוניה","ביצוע","אימפרוביזציה"],levels:["intermediate"],guide:null,guideRef:"lesson-4-1",generators:[{jsonType:"keyboard_scale",typeId:"piano_scale_play",mode:"scale",reuseActivityId:"act-piano-scale-1"},{jsonType:"scale_spell_c",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-cmaj"},{jsonType:"scale_spell_g",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-g"},{jsonType:"scale_spell_f",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-f"},{jsonType:"scale_spell_d",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-d"},{jsonType:"scale_spell_bb",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-bb"},{jsonType:"scale_spell",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-maj"},{jsonType:"key_signature_basic",typeId:"sight_read_key",reuseActivityId:"act-key-basic-1"},{jsonType:"circle_of_fifths_sharps",typeId:"theory_organize",mode:"order",reuseActivityId:"act-cof-sharps"},{jsonType:"circle_of_fifths_flats",typeId:"theory_organize",mode:"order",reuseActivityId:"act-cof-flats"},{jsonType:"ear_scale_type",typeId:"ear_scale_recognition",reuseActivityId:"act-scale-rec-1"},{jsonType:"sight_melody",typeId:"sight_read_melody",reuseActivityId:"act-mel-c"}],covered:!0},{id:"MC-020",name:"משולשים ומרובעים דיאטוניים",domains:["הרמוניה"],levels:["advanced"],guide:null,guideRef:"hm-3-1",generators:[{jsonType:"roman_numeral",typeId:"theory_function",mode:"numeral",reuseActivityId:"act-func-num"},{jsonType:"chord_function",typeId:"theory_function",mode:"function",reuseActivityId:"act-func-fn"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-chord-7th"}],covered:!0},{id:"MC-007",name:"דרגות ראשיות ומשניות ותפקידיהן",domains:["הרמוניה"],levels:["advanced"],guide:null,guideRef:"th-2-1",generators:[{jsonType:"chord_function",typeId:"theory_function",mode:"function",reuseActivityId:"act-func-fn"},{jsonType:"roman_numeral",typeId:"theory_function",mode:"numeral",reuseActivityId:"act-func-num"},{jsonType:"ear_cadence_id",typeId:"ear_cadence",reuseActivityId:"act-cadence-1"}],covered:!0},{id:"MC-092",name:"מיקסטורה והקלישאה הקווית",domains:["הרמוניה","ביצוע","הפקה מוסיקלית","אחר"],levels:["advanced"],guide:null,generators:[{jsonType:"roman_numeral",typeId:"theory_function",mode:"numeral",reuseActivityId:"act-func-sharp"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-chord-7th"}],covered:!1},{id:"MC-001",name:"צלילי מנע",domains:["הרמוניה"],levels:["beginner"],guide:null,generators:[{jsonType:"chord_function",typeId:"theory_function",mode:"function",reuseActivityId:"act-func-fn"},{jsonType:"scale_spell",typeId:"theory_spell",mode:"spell_scale",reuseActivityId:"act-spell-maj"}],covered:!1},{id:"MC-060",name:"כתיבה רב-קולית",domains:["הרמוניה","ביצוע"],levels:["mastery"],guide:null,generators:[{jsonType:"chord_notation",typeId:"notation_build",mode:"build_chord",reuseActivityId:"act-nb-chord"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-chord-7th"},{jsonType:"inversion_id",typeId:"chord_inversion",reuseActivityId:"act-inv-triad"}],covered:!1},{id:"MC-041",name:"נגינת שירים מוכרים (מנגינה וליווי)",domains:["הרמוניה","ביצוע"],levels:["advanced"],guide:null,guideRef:"pn-5-1",generators:[{jsonType:"keyboard_chord",typeId:"piano_scale_play",mode:"chord",reuseActivityId:"act-piano-play-1"},{jsonType:"keyboard_scale",typeId:"piano_scale_play",mode:"scale",reuseActivityId:"act-piano-scale-1"},{jsonType:"repertoire_record",typeId:"repertoire_record",reuseActivityId:"act-record-1"}],covered:!0},{id:"MC-003",name:"ערכים ריתמיים עד שמיניות",domains:["קצב","אחר"],levels:["intermediate"],guide:null,guideRef:"lesson-3-1",generators:[{jsonType:"rhythm_tap_basic1",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-basic-1"},{jsonType:"rhythm_tap_basic2",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-basic-2"},{jsonType:"rhythm_tap_basic3",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-basic-3"},{jsonType:"rhythm_tap_rest",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-rest-1"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-2"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-3"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-1"},{jsonType:"rhythm_echo",typeId:"rhythm_echo"}],covered:!0},{id:"MC-032",name:"קואורדינציה ופוליריתמיקה",domains:["קצב"],levels:["advanced"],guide:null,generators:[{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"},{jsonType:"rhythm_echo",typeId:"rhythm_echo",reuseActivityId:"act-echo-basic-2"},{jsonType:"rhythmic_dictation",typeId:"rhythm_dictation",reuseActivityId:"act-mek-dict-2"}],covered:!1},{id:"MC-070",name:"השפעת סגנון על עיבוד",domains:["ביצוע","יצירה והלחנה","עיבוד ותזמור"],levels:["mastery"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"}],covered:!1},{id:"MC-043",name:"פרפורמנס והשגה בימתית",domains:["ביצוע"],levels:["mastery"],guide:null,generators:[{jsonType:"repertoire_record",typeId:"repertoire_record",reuseActivityId:"act-record-1"}],covered:!1},{id:"MC-061",name:"שירת בס וספירת מבנה",domains:["ביצוע"],levels:["mastery"],guide:null,generators:[{jsonType:"repertoire_record",typeId:"repertoire_record",reuseActivityId:"act-record-1"},{jsonType:"rhythm_tap",typeId:"rhythm_tap",reuseActivityId:"act-rhythm-1"}],covered:!1},{id:"MC-022",name:"פירוקי ספטאקורד והיפוכים",domains:["ביצוע"],levels:["advanced"],guide:null,guideRef:"hm-2-1",generators:[{jsonType:"inversion_id",typeId:"chord_inversion",reuseActivityId:"act-inv-7th"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-chord-7th"},{jsonType:"chord_spell",typeId:"theory_spell",mode:"spell_chord",reuseActivityId:"act-spell-7th"}],covered:!0},{id:"MC-052",name:"עקרונות יצירה והלחנה",domains:["יצירה והלחנה","עיבוד ותזמור","אחר"],levels:["mastery"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"},{jsonType:"melodic_dictation",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-mc"}],covered:!1},{id:"MC-053",name:"כתיבת טקסט",domains:["יצירה והלחנה","אחר"],levels:["mastery"],guide:null,generators:[],covered:!1},{id:"MC-040",name:"כתיבה אידיומטית לכלים",domains:["יצירה והלחנה","עיבוד ותזמור","סגנונות מוסיקליים"],levels:["advanced"],guide:null,generators:[{jsonType:"note_place",typeId:"notation_build",mode:"place_note",reuseActivityId:"act-nb-place"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-theory-1"}],covered:!1},{id:"MC-026",name:"רהרמוניזציה לשירים קיימים",domains:["עיבוד ותזמור"],levels:["mastery"],guide:null,generators:[{jsonType:"roman_numeral",typeId:"theory_function",mode:"numeral",reuseActivityId:"act-func-num"},{jsonType:"chord_build",typeId:"theory_chord_build",reuseActivityId:"act-chord-7th"}],covered:!1},{id:"MC-050",name:"הלחנת מוטיבים ושורות",domains:["עיבוד ותזמור","אימפרוביזציה"],levels:["advanced"],guide:null,generators:[{jsonType:"fill_blank",typeId:"melody_dictation",mode:"blank",reuseActivityId:"act-mek-mdict-mid"},{jsonType:"melodic_dictation",typeId:"melody_dictation",reuseActivityId:"act-mek-mdict-mc"}],covered:!1},{id:"MC-090",name:"היכרות עם ×
4080”תוכנה",domains:["הפקה מוסיקלית","אחר"],levels:["intermediate"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"}],covered:!1},{id:"MC-091",name:"הקלטה בסיסית",domains:["הפקה מוסיקלית"],levels:["intermediate"],guide:null,generators:[{jsonType:"repertoire_record",typeId:"repertoire_record",reuseActivityId:"act-record-1"}],covered:!1},{id:"MC-101",name:"באך והמוסיקה הבארוקית: פוגות, קונצ'רטי גרוסי",domains:["תולדות המוסיקה"],levels:["beginner"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"}],covered:!1},{id:"MC-101b",name:"מבוא: מהו סגנון מוסיקלי",domains:["סגנונות מוסיקליים"],levels:["mastery"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"}],covered:!1},{id:"MC-072",name:"ג'אז: הולדת הג'אז, גוספל",domains:["סגנונות מוסיקליים"],levels:["mastery"],guide:null,generators:[{jsonType:"matching",typeId:"theory_matching",reuseActivityId:"act-theory-matching-1"},{jsonType:"ear_chord_quality",typeId:"ear_chord_quality",reuseActivityId:"act-chord-quality-1"}],covered:!1}],Qh=[{id:"cc-01",name:"יסודות המוסיקה",domain:"יסודות המוסיקה",tracks:["נשים"],years:["א","ג"],academicCourseId:"c-w-year1-erev-1",goals:["לימוד מרכיבי הבסיס של שפת המוזיקה: תווים, מרווחים, אקורדים, סולמות, דרגות","פיתוח שמיעה פנימית, מלודית והרמונית","רכישת מיומנות קריאת תווים"],topics:[{conceptId:"MC-002",level:"beginner"},{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-013",level:"advanced"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-015",level:"advanced"}]},{id:"cc-02",name:"יסודות המוסיקה ב'",domain:"יסודות המוסיקה",tracks:["נשים"],years:["ב"],academicCourseId:"c-w-year1-boker-1",goals:["לימוד מרכיבי הבסיס של שפת המוזיקה: תווים, מרווחים, אקורדים, סולמות, דרגות","פיתוח שמיעה פנימית, מלודית והרמונית","רכישת מיומנות קריאת תווים"],topics:[{conceptId:"MC-002",level:"beginner"},{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-013",level:"advanced"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-015",level:"advanced"}]},{id:"cc-03",name:"יסודות המוסיקה ופיתוח שמיעה א'",domain:"יסודות המוסיקה",tracks:["גברים מרוכז","גברים ערב"],years:["א"],academicCourseId:"c-m-year1-erev-1",goals:["פיתוח יכולת זיהוי, שירה וכתיבה של מרווחים, אקורדים והיפוכיהם","שליטה במודוסים עיקריים ויישומם בשירה ובניתוח","פיתוח שמיעה ריתמית עד משקלים מורכבים וא-סימטריים","בניית מיומנויות פוליריתמיקה בקבוצה"],topics:[{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-008",level:"advanced"},{conceptId:"MC-030",level:"intermediate"},{conceptId:"MC-033",level:"advanced"}]},{id:"cc-04",name:"יסודות המוסיקה ופיתוח שמיעה ב'",domain:"יסודות המוסיקה",tracks:["גברים מרוכז","גברים ערב"],years:["א","ב"],goals:["פיתוח יכולת זיהוי, שירה וכתיבה של מרווחים, אקורדים והיפוכיהם","שליטה במודוסים עיקריים ויישומם בשירה ובניתוח","פיתוח שמיעה ריתמית עד משקלים מורכבים וא-סימטריים","בניית מיומנויות פוליריתמיקה בקבוצה"],topics:[{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-008",level:"advanced"},{conceptId:"MC-030",level:"intermediate"},{conceptId:"MC-033",level:"advanced"}]},{id:"cc-05",name:"פיתוח שמיעה",domain:"יסודות המוסיקה",tracks:["נשים"],years:["א"],goals:["חיזוק הקשר בין שמע לפיענוח תווים ובין שמע לשירה","הקניית יכולת להבין שפה מוסיקלית קלאסית ורומנטית","הבחנה בין מז'ור למינור, קונסוננס לדיסוננס","אבחנה בין משקלים זוגיים ומשולשים"],topics:[{conceptId:"MC-054",level:"mastery"},{conceptId:"MC-004",level:"intermediate"},{conceptId:"MC-011",level:"intermediate"},{conceptId:"MC-051",level:"mastery"}]},{id:"cc-06",name:"קצב ופיתוח שמיעה רתמי",domain:"יסודות המוסיקה",tracks:["גברים מרוכז"],years:["ב"],goals:["שליטה בקריאה, כתיבה וזיהוי ערכי תווים עד חלקי 16","תיפוף מקצבי יסוד ומקצבים א-סימטריים","פיתוח אוזן ריתמית: שמיעה, זיהוי וביצוע טריולות","יישום עקרונות קצב בנגינה קבוצתית ואלתור"],topics:[{conceptId:"MC-031",level:"advanced"},{conceptId:"MC-051",level:"mastery"},{conceptId:"MC-011",level:"intermediate"},{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-042",level:"advanced"}]},{id:"cc-07",name:"תאוריה ופיתוח שמיעה למתקדמים",domain:"יסודות המוסיקה",tracks:["גברים מרוכז"],years:["ג"],goals:["העמקה בתיאוריה מוסיקלית: סולמות, מרווחים, אקורדים ודרגות","פיתוח שמיעה מלודי, הרמוני וריתמי","ביסוס מושגי יסוד (מרכז טונאלי, קונסוננס/דיסוננס, סינקופה)"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-015",level:"advanced"},{conceptId:"MC-012",level:"advanced"}]},{id:"cc-08",name:"הרמוניה",domain:"הרמוניה",tracks:["נשים"],years:["א","ג"],academicCourseId:"c-w-year1-boker-5",goals:["הכרות מעמיקה עם עולם ההרמוניה וכללי הכתיבה הרב-קולית","פיתוח שמיעה - זיהוי מהלכים הרמוניים ותרגול שירת בס","זיהוי מהלכים הרמוניים בשירים דרך האזנה"],topics:[{conceptId:"MC-020",level:"advanced"},{conceptId:"MC-007",level:"advanced"},{conceptId:"MC-011",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-007",level:"advanced"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-092",level:"advanced"},{conceptId:"MC-001",level:"beginner"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-060",level:"mastery"}]},{id:"cc-09",name:"הרמוניה וכתיבה רב־קולית",domain:"הרמוניה",tracks:["גברים מרוכז"],years:["ב"],academicCourseId:"c-w-year2-boker-6",goals:["הכרות מעמיקה עם עולם ההרמוניה וכללי הכתיבה הרב-קולית","פיתוח שמיעה - זיהוי מהלכים הרמוניים ותרגול שירת בס","זיהוי מהלכים הרמוניים בשירים דרך האזנה"],topics:[{conceptId:"MC-020",level:"advanced"},{conceptId:"MC-007",level:"advanced"},{conceptId:"MC-011",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-007",level:"advanced"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-092",level:"advanced"},{conceptId:"MC-001",level:"beginner"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-060",level:"mastery"}]},{id:"cc-10",name:"הרמוניה על פסנתר א'",domain:"הרמוניה",tracks:["גברים ערב"],years:["א"],academicCourseId:"c-w-year1-erev-5",goals:["היכרות עם המקלדת וליווי בסיסי","נגינת מנגינה וליווי","היכרות בסיסית עם תווים ותאוריה בנגינה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-002",level:"beginner"}]},{id:"cc-11",name:"הרמוניה על פסנתר ב'",domain:"הרמוניה",tracks:["גברים ערב"],years:["א"],academicCourseId:"c-w-year1-erev-5",goals:["היכרות עם המקלדת וליווי בסיסי","נגינת מנגינה וליווי","היכרות בסיסית עם תווים ותאוריה בנגינה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-002",level:"beginner"}]},{id:"cc-12",name:"הרמוניה פסנתר למתחילים",domain:"הרמוניה",tracks:["גברים מרוכז"],years:["א"],academicCourseId:"c-m-winter-piano-beg-1",goals:["היכרות עם המקלדת וליווי בסיסי","נגינת מנגינה וליווי","היכרות בסיסית עם תווים ותאוריה בנגינה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-002",level:"beginner"}]},{id:"cc-13",name:"הרמוניה פסנתר למתקדמים",domain:"הרמוניה",tracks:["גברים מרוכז"],years:["א"],academicCourseId:"c-w-piano-adv-1",goals:["היכרות עם המקלדת וליווי בסיסי","נגינת מנגינה וליווי","היכרות בסיסית עם תווים ותאוריה בנגינה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-002",level:"beginner"}]},{id:"cc-14",name:"קצב ומיומנויות ביצוע",domain:"קצב",tracks:["נשים"],years:["א","ב"],academicCourseId:"c-w-year1-boker-2",goals:["פיתוח תחושת פעימה ויכולות ריתמיות","מיומנויות תיאורטיות וריתמיות בקריאה, כתיבה וביצוע","נגינה קבוצתית מבוססת תבניות ומוטיבים ריתמיים"],topics:[{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-003",level:"intermediate"},{conceptId:"MC-032",level:"advanced"}]},{id:"cc-15",name:"הרכבים",domain:"ביצוע",tracks:["נשים"],years:["א","ב","ג"],academicCourseId:"c-w-year1-boker-4",goals:["תרגול עבודה במסגרת הרכב ורכישת כלים לנגינה משותפת","היכרות עם רפרטואר מגוון ודגש על התקדמות אישית בביצוע","רכישת כלים להופעה ועמידה על במה"],topics:[{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-043",level:"mastery"}]},{id:"cc-16",name:"מיומנות ביצוע א'",domain:"ביצוע",tracks:["גברים ערב"],years:["א"],academicCourseId:"c-m-year1-erev-2",goals:["שליטה בסולמות (מז'ור, מיקסולידי, פנטטוני, בלוז)","אלתור על מבנים (בלוז, מז'ור)","טכניקה סולמית, שירת בס וספירת מבנה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-060",level:"mastery"},{conceptId:"MC-061",level:"mastery"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-022",level:"advanced"},{conceptId:"MC-006",level:"advanced"}]},{id:"cc-17",name:"מיומנות ביצוע אינסטרומנטלית",domain:"ביצוע",tracks:["גברים מרוכז"],years:["א"],academicCourseId:"c-m-year1-intensive-1",goals:["שליטה בסולמות (מז'ור, מיקסולידי, פנטטוני, בלוז)","אלתור על מבנים (בלוז, מז'ור)","טכניקה סולמית, שירת בס וספירת מבנה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-060",level:"mastery"},{conceptId:"MC-061",level:"mastery"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-022",level:"advanced"},{conceptId:"MC-006",level:"advanced"}]},{id:"cc-18",name:"מיומנות ביצוע ב'",domain:"ביצוע",tracks:["גברים ערב"],years:["א"],academicCourseId:"c-m-year1-erev-3",goals:["שליטה בסולמות (מז'ור, מיקסולידי, פנטטוני, בלוז)","אלתור על מבנים (בלוז, מז'ור)","טכניקה סולמית, שירת בס וספירת מבנה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-060",level:"mastery"},{conceptId:"MC-061",level:"mastery"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-022",level:"advanced"},{conceptId:"MC-006",level:"advanced"}]},{id:"cc-19",name:"מיומנות ביצוע מתחילים",domain:"ביצוע",tracks:["גברים מרוכז"],years:["א"],goals:["שליטה בסולמות (מז'ור, מיקסולידי, פנטטוני, בלוז)","אלתור על מבנים (בלוז, מז'ור)","טכניקה סולמית, שירת בס וספירת מבנה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-060",level:"mastery"},{conceptId:"MC-061",level:"mastery"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-022",level:"advanced"},{conceptId:"MC-006",level:"advanced"}]},{id:"cc-20",name:"מיומנות ווקאלית",domain:"ביצוע",tracks:["גברים מרוכז"],years:["א"],academicCourseId:"c-m-winter-vocal-1",goals:["שליטה בסולמות (מז'ור, מיקסולידי, פנטטוני, בלוז)","אלתור על מבנים (בלוז, מז'ור)","טכניקה סולמית, שירת בס וספירת מבנה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-060",level:"mastery"},{conceptId:"MC-061",level:"mastery"},{conceptId:"MC-082",level:"mastery"},{conceptId:"MC-006",level:"advanced"},{conceptId:"MC-022",level:"advanced"},{conceptId:"MC-006",level:"advanced"}]},{id:"cc-21",name:"פיתוח קול",domain:"ביצוע",tracks:["נשים"],years:["א","ג"],academicCourseId:"c-w-singers-3",goals:["פיתוח יכולות שירת סולו - טכניקה, מוזיקליות, הבעה והופעה","שליטה בטכניקות שירה בסגנונות שונים","יכולת הופעה על במה וסיפור סיפור דרך הקול"],topics:[{conceptId:"MC-092",level:"advanced"},{conceptId:"MC-043",level:"mastery"}]},{id:"cc-22",name:"פסנתר",domain:"ביצוע",tracks:["נשים"],years:["א","ג"],academicCourseId:"c-w-piano-adv-1",goals:["היכרות עם המקלדת וליווי בסיסי","נגינת מנגינה וליווי","היכרות בסיסית עם תווים ותאוריה בנגינה"],topics:[{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-012",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-041",level:"advanced"},{conceptId:"MC-002",level:"beginner"}]},{id:"cc-23",name:"הלחנה ויצירה",domain:"יצירה והלחנה",tracks:["נשים"],years:["ב","ג"],academicCourseId:"c-w-year1-boker-7",goals:["חשיפה לכלים ועקרונות מעולם היצירה וההלחנה","לימוד דרך שירים פופולריים, ניגונים חסידיים ויצירות קלאסיות","יצירת מרחב לכתיבת טקסטים והלחנתם עם משוב וליטוש"],topics:[{conceptId:"MC-052",level:"mastery"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-028",level:"mastery"}]},{id:"cc-24",name:"הלחנה ויצירה מודרנית",domain:"יצירה והלחנה",tracks:["גברים מרוכז"],years:["ב"],academicCourseId:"c-m-year1-intensive-meet-2",goals:["חשיפה לכלים ועקרונו
4080ת מעולם היצירה וההלחנה","לימוד דרך שירים פופולריים, ניגונים חסידיים ויצירות קלאסיות","יצירת מרחב לכתיבת טקסטים והלחנתם עם משוב וליטוש"],topics:[{conceptId:"MC-052",level:"mastery"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-028",level:"mastery"}]},{id:"cc-25",name:"עיבוד",domain:"יצירה והלחנה",tracks:["נשים"],years:["ג"],academicCourseId:"c-w-year2-erev-3",goals:["הכרת כלי הנגינה המרכיבים את הלהקה וכתיבה אידיומטית","לימוד והתנסות בעיבוד לפופ, רוק, סווינג וביג-בנד","ניתוח מבני של מרכיבים מוסיקליים (מקמים, קונטור, קצב)"],topics:[{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-040",level:"advanced"},{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-070",level:"mastery"}]},{id:"cc-26",name:"עיבוד והלחנה פוליריתמית במוסיקה מודרנית",domain:"יצירה והלחנה",tracks:["גברים מרוכז"],years:["ג"],goals:["הכרת כלי הנגינה המרכיבים את הלהקה וכתיבה אידיומטית","לימוד והתנסות בעיבוד לפופ, רוק, סווינג וביג-בנד","ניתוח מבני של מרכיבים מוסיקליים (מקמים, קונטור, קצב)"],topics:[{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-040",level:"advanced"},{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-070",level:"mastery"}]},{id:"cc-27",name:"מבוא לעיבוד ותזמור",domain:"עיבוד ותזמור",tracks:["גברים מרוכז"],years:["ב"],academicCourseId:"c-w-year3-4",goals:["הרחבת ידע הרמוני ויישומו ברהרמוניזציה לשירים ויצירות מקוריות","פיתוח פרשנות יצירתית דרך טכניקות עיבוד"],topics:[{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-026",level:"mastery"},{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-070",level:"mastery"}]},{id:"cc-28",name:"מבוא לתזמור",domain:"עיבוד ותזמור",tracks:["נשים"],years:["ב"],academicCourseId:"c-w-year3-4",goals:["היכרות עם עקרונות בסיסיים בהלחנה, עיבוד ותזמור","התנסות בטכניקות שונות של הלחנה וכתיבה מוסיקלית","פיתוח מיומנויות יצירתיות, שמיעה והבעה אישית"],topics:[{conceptId:"MC-052",level:"mastery"},{conceptId:"MC-050",level:"advanced"},{conceptId:"MC-008",level:"advanced"}]},{id:"cc-29",name:"עיבוד ותזמור – פרויקט גמר",domain:"עיבוד ותזמור",tracks:["גברים מרוכז"],years:["ג"],academicCourseId:"c-w-year3-4",goals:["כתיבה רב-קולית ותזמור נכון של SATB","כתיבה לרביעיית מיתרים","כתיבת קונטרפונקט ועיבוד מלא בהנחיה צמודה"],topics:[{conceptId:"MC-054",level:"mastery"},{conceptId:"MC-040",level:"advanced"},{conceptId:"MC-070",level:"mastery"},{conceptId:"MC-054",level:"mastery"}]},{id:"cc-30",name:"אימפרוביזציה מבוססת פוליריתמיקה",domain:"אימפרוביזציה",tracks:["גברים מרוכז"],years:["ג"],academicCourseId:"c-w-year2-boker-8",goals:["הקניית יסודות האלתור בג'אז על מבנים הרמוניים בסיסיים (12-Bar Blues, 2-5-1)","פיתוח יכולות נגינה קבוצתית ואלתור אינדיבידואלי","רכישת כלים לסולו אפקטיבי: גייד טונס, מוטיבים, פרזות, קצב","פיתוח שמיעה הרמונית ומוטוריקה אינסטרומנטלית"],topics:[{conceptId:"MC-051",level:"mastery"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-050",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-005",level:"intermediate"}]},{id:"cc-31",name:"אימפרוביזציה מתקדמת לנגנים",domain:"אימפרוביזציה",tracks:["גברים מרוכז"],years:["ב"],academicCourseId:"c-w-year1-boker-10",goals:["הקניית יסודות האלתור בג'אז על מבנים הרמוניים בסיסיים (12-Bar Blues, 2-5-1)","פיתוח יכולות נגינה קבוצתית ואלתור אינדיבידואלי","רכישת כלים לסולו אפקטיבי: גייד טונס, מוטיבים, פרזות, קצב","פיתוח שמיעה הרמונית ומוטוריקה אינסטרומנטלית"],topics:[{conceptId:"MC-051",level:"mastery"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-050",level:"advanced"},{conceptId:"MC-042",level:"advanced"},{conceptId:"MC-005",level:"intermediate"},{conceptId:"MC-005",level:"intermediate"}]},{id:"cc-32",name:"הפקה ומאסטרינג באולפן הביתי",domain:"הפקה מוסיקלית",tracks:["גברים מרוכז"],years:["ג"],academicCourseId:"c-w-year2-boker-9",goals:["היכרות עם עולם ההפקה ותוכנות ההפקה","רכישת ביטחון ועצמאות בהובלת המוסיקה של הלומדת","הבנה שטעויות הן שלב הכרחי בלמידה"],topics:[{conceptId:"MC-090",level:"intermediate"},{conceptId:"MC-091",level:"intermediate"}]},{id:"cc-33",name:"יסודות Cubase והאולפן הביתי",domain:"הפקה מוסיקלית",tracks:["גברים מרוכז"],years:["ב"],academicCourseId:"c-w-year2-boker-9",goals:["התמצאות בסיסית בתוכנת הסאונד (אבלטון/קיובייס) להפקת והקלטת מוסיקה"],topics:[{conceptId:"MC-090",level:"intermediate"},{conceptId:"MC-092",level:"advanced"}]},{id:"cc-34",name:"מבאך ועד קרליבך",domain:"תולדות המוסיקה",tracks:["רוחבי"],years:["-"],goals:["היכרות והבנה מעמיקה בהתפתחות המוסיקה מהבארוק ועד המאה ה-20","דגש על האזנה וניתוח יצירות","חשיפת הקשרים בין המוסיקה המערבית לשורשיה בתרבויות העולם"],topics:[{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-101",level:"beginner"},{conceptId:"MC-101",level:"beginner"}]},{id:"cc-35",name:"סגנונות ומאפיינים מוסיקליים",domain:"סגנונות מוסיקליים",tracks:["גברים מרוכז","גברים ערב","נשים"],years:["א","ב"],academicCourseId:"c-m-year1-erev-4",goals:["אפיון סגנון מוסיקלי דרך מרכיבי המוסיקה (מלודיה, הרמוניה, קצב, תזמור, מבנה)","הכרת סגנונות שונים בהקשר המוסיקלי וההיסטורי","ניתוח דוגמאות מרכזיות"],topics:[{conceptId:"MC-101b",level:"mastery"},{conceptId:"MC-072",level:"mastery"},{conceptId:"MC-072",level:"mastery"},{conceptId:"MC-072",level:"mastery"},{conceptId:"MC-040",level:"advanced"}]},{id:"cc-36",name:"מבוא להלחנה ויצירה",domain:"אחר",tracks:["רוחבי"],years:["-"],goals:["חשיפה לכלים ועקרונות מעולם היצירה וההלחנה","לימוד דרך שירים פופולריים, ניגונים חסידיים ויצירות קלאסיות","יצירת מרחב לכתיבת טקסטים והלחנתם עם משוב וליטוש"],topics:[{conceptId:"MC-052",level:"mastery"},{conceptId:"MC-028",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-053",level:"mastery"},{conceptId:"MC-028",level:"mastery"}]},{id:"cc-37",name:"סדנת מבוא להפקה מוסיקלית",domain:"אחר",tracks:["רוחבי"],years:["-"],goals:["התמצאות בסיסית בתוכנת הסאונד (אבלטון/קיובייס) להפקת והקלטת מוסיקה"],topics:[{conceptId:"MC-090",level:"intermediate"},{conceptId:"MC-092",level:"advanced"}]},{id:"cc-38",name:"קצב וריתמיקה",domain:"אחר",tracks:["רוחבי"],years:["-"],goals:["התוודעות לעולם הריתמי דרך האזנה, ביצוע וניתוח (מאפריקה ועד הודו)","הבנה ויישום של ערכים ריתמיים שונים","פיתוח זיהוי מקצבים סימטריים וא-סימטריים"],topics:[{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-003",level:"intermediate"},{conceptId:"MC-010",level:"intermediate"},{conceptId:"MC-010",level:"intermediate"}]}],r$={"MC-001":{sections:[{kind:"concept",icon:"🚧",heading:"מהם צלילי מנע?",body:'כשמנגנים אקורד ומעליו מנגינה, לא כל צליל בסולם "מתיישב" יפה מעל האקורד. צלילי מנע (avoid tones) הם אותם צלילים דיאטוניים שנמצאים אמנם בסולם, אבל כשהם מתנגנים כצליל מוחזק מעל האקורד הם יוצרים חיכוך חד ולא רצוי — לרוב מפני שהם במרחק חצי-טון בלבד מעל צליל מרכזי של האקורד. הם אינם "אסורים", אך הם מבקשים תנועה: האוזן מצפה שהם ימשיכו הלאה ולא יישארו תלויים באוויר.'},{kind:"example",icon:"🎯",heading:"הדוגמה הקלאסית: פה מעל אקורד דו מז'ור",body:`קחו אקורד דו מז'ור (דו־מי־סול) ונגנו מעליו את הצליל פה. פה יושב חצי-טון מעל מי, שהיא הטרצה של האקורד — הצליל שנותן לאקורד את הצבע המז'ורי שלו. החיכוך הזה בין פה למי נשמע "מלוכלך" אם פה מוחזק. לעומת זאת הצליל לה (הסיקסטה) יושב יפה מעל אותו אקורד. זו בדיוק ההבחנה שצלילי מנע מלמדים: אילו צלילים מהסולם הם צבע נעים, ואילו דורשים זהירות.`}
4080,{kind:"notation",heading:"פה (צליל מנע) מול לה (צליל נעים) מעל דו מז'ור",notation:{clef:"treble",notes:[{keys:["e/4","g/4","c/5"],duration:"q"},{keys:["f/5"],duration:"q"},{keys:["e/4","g/4","c/5"],duration:"q"},{keys:["a/5"],duration:"q"}]},body:"קודם אקורד דו מז'ור ואז פה (חיכוך חצי-טון מעל מי), ושוב האקורד ואז לה (מתמזג יפה). הקשיבו להבדל."},{kind:"tip",icon:"💡",body:'צליל מנע אינו "טעות" — הוא כלי. כצליל מעבר קצר או צליל חילוף שממשיך מיד הלאה הוא נשמע נהדר ומוסיף תנועה. הבעיה נולדת רק כשמשאירים אותו תלוי כצליל ארוך ומוחזק.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שכל צליל שנמצא בסולם מתאים כצליל מטרה לאקורד. הדיאטוניות מבטיחה שהצליל שייך לטונאליות, לא שהוא יתיישב טוב מעל כל אקורד שמתחתיו."}],quiz:[{prompt:"מדוע הצליל פה נחשב צליל מנע מעל אקורד דו מז'ור?",options:[{label:"הוא יושב חצי-טון מעל מי — הטרצה של האקורד — ויוצר חיכוך חד",correct:!0},{label:"הוא אינו שייך לסולם דו מז'ור",correct:!1},{label:"הוא הצליל הבסיסי (יסוד) של האקורד",correct:!1}],explanation:"פה רחוק רק חצי-טון ממי, הטרצה המז'ורית של האקורד. הקרבה הזו יוצרת דיסוננס חד כשפה מוחזק — לכן הוא צליל מנע, למרות שהוא דיאטוני."},{prompt:"מתי צליל מנע דווקא נשמע טוב?",options:[{label:"כשהוא צליל מעבר קצר שממשיך מיד לצליל יציב",correct:!0},{label:"כשהוא הצליל הארוך והמוחזק ביותר בתיבה",correct:!1},{label:"לעולם לא — יש להימנע ממנו תמיד",correct:!1}],explanation:"כצליל מעבר או חילוף חולף צליל המנע מוסיף תנועה וצבע. החיכוך מטריד רק כשמשאירים אותו מוחזק ותלוי."}]},"MC-008":{sections:[{kind:"concept",icon:"🎭",heading:"מהם מודוסים?",body:`מודוס הוא סולם שנוצר כשלוקחים את שבעת צלילי הסולם המז'ורי ומתחילים אותם מדרגה אחרת. אותם צלילים בדיוק — אבל מרכז טונאלי חדש. אם ננגן את הצלילים הלבנים של הפסנתר מדו עד דו נקבל מז'ור רגיל (מודוס יוני); אם נתחיל מרה ונגן עד רה — עדיין רק צלילים לבנים — נקבל דוריאני, שנשמע מינורי אך עם צבע ייחודי משלו. סדר הטונים והחצאים משתנה עם נקודת ההתחלה, ולכן כל מודוס נושא "מזג" רגשי אחר.`},{kind:"example",icon:"🌗",heading:"שבעה מודוסים, שבעה צבעים",body:`שבעת המודוסים הכנסייתיים הם: יוני (מז'ור), דוריאני, פריגי, לידי, מיקסולידי, אאולי (מינור טבעי) ולוקריאני. שלושה מהם נשמעים "מז'וריים" (יוני, לידי, מיקסולידי) ושלושה "מינוריים" (דוריאני, פריגי, אאולי); הלוקריאני הוא מקרה מיוחד ולא-יציב. ההבדל הדק בין דוריאני למינור טבעי, למשל, הוא הסקסטה: בדוריאני היא גדולה — וזה בדיוק מה שנותן לו את הצליל הפולק/ג'אז המוכר.`},{kind:"notation",heading:"מודוס דוריאני על רה — רק צלילים לבנים",notation:{clef:"treble",notes:[{keys:["d/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["f/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["a/4"],duration:"8"},{keys:["b/4"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["d/5"],duration:"8"}]},body:"רה־מי־פה־סול־לה־סי־דו־רה. שימו לב לסי הבֶּקָר (הסקסטה הגדולה) — הוא ההבדל בין דוריאני למינור טבעי."},{kind:"tip",icon:"💡",body:`הדרך המהירה לזכור מודוס: אל תלמדו שבעה סולמות חדשים בעל-פה. חשבו "אילו צלילים לבנים, מאיזו דרגה מתחילים" — או "איזה מז'ור, מאיזו דרגה". דוריאני = מהדרגה השנייה של המז'ור.`},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לחשוב שדוריאני על רה הוא "סולם רה מינור". רה מינור טבעי מכיל סי במול; דוריאני על רה מכיל סי בֶּקָר. אותה טוניקה, סקסטה שונה, מזג שונה לגמרי.'}],quiz:[{prompt:"איזה מודוס מתקבל כשמנגנים את הצלילים הלבנים מרה עד רה?",options:[{label:"דוריאני",correct:!0},{label:"פריגי",correct:!1},{label:"לידי",correct:!1}],explanation:"רה היא הדרגה השנייה של דו מז'ור. סולם על הדרגה השנייה, עם צלילי דו מז'ור, הוא המודוס הדוריאני."},{prompt:"מהו ההבדל האופייני בין דוריאני למינור טבעי (אאולי) על אותה טוניקה?",options:[{label:"בדוריאני הסקסטה גדולה, במינור הטבעי היא קטנה",correct:!0},{label:"בדוריאני הטרצה גדולה, במינור היא קטנה",correct:!1},{label:"אין ביניהם הבדל — הם שני שמות לאותו סולם",correct:!1}],explanation:"שניהם מינוריים (טרצה קטנה), אך הדוריאני נבדל בסקסטה הגדולה שלו — ומכא×
4080Ÿ צבעו המיוחד, הבהיר יותר."},{prompt:`שלושה מהמודוסים נשמעים "מז'וריים". איזו קבוצה נכונה?`,options:[{label:"יוני, לידי, מיקסולידי",correct:!0},{label:"דוריאני, פריגי, אאולי",correct:!1},{label:"לוקריאני, אאולי, יוני",correct:!1}],explanation:"יוני, לידי ומיקסולידי בנויים על טרצה גדולה ולכן צבעם מז'ורי. דוריאני, פריגי ואאולי מינוריים; הלוקריאני מקרה מיוחד ולא-יציב."}]},"MC-013":{sections:[{kind:"concept",icon:"👂",heading:"לשמוע מנגינה — לא צליל בודד",body:'פיתוח שמיעה מלודית הוא היכולת לשמוע רצף של צלילים ולזהות את היחסים ביניהם: לאן המנגינה עולה, לאן היא יורדת, ובאיזה מרחק. המפתח אינו לזהות כל צליל בנפרד אלא לתפוס את המרווחים — הצעדים והקפיצות — כתנועה יחסית. מוח מאומן לא שואל "איזה צליל זה" אלא "האם זה צעד קטן למעלה, קפיצה של קווינטה, או חזרה לצליל שכבר שמענו".'},{kind:"concept",icon:"🧭",heading:"שיטת העבודה: לעגן, לחלק, לחזור",body:'העבודה מתקדמת בשלבים. ראשית מעגנים את הטוניקה — שרים או מנגנים את צליל ה"בית" עד שהוא יושב באוזן. אחר כך מחלקים את המנגינה למרווחים קטנים ומזהים כל צעד ביחס לקודמו. לבסוף חוזרים על המקטע פעם אחר פעם, כי שמיעה מלודית נבנית מחזרתיות ומזיכרון שרירי-שמיעתי — בדיוק כמו לימוד שפה. ככל שמצטבר ניסיון, האוזן מתחילה "לנחש נכון" עוד לפני שהצליל מסתיים.'},{kind:"notation",heading:"מקטע לתרגול: צעדים וקפיצה קטנה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"דו־רה־מי (שני צעדים עולים) ואז קפיצה של טרצה למי→סול. שירו את המקטע, אז נגנו — התאם?"},{kind:"tip",icon:"💡",body:'קשרו כל מרווח לשיר מוכר: קפיצת קווינטה = פתיחת "התקווה"; אוקטבה = "Somewhere over the rainbow". עוגנים כאלה הופכים זיהוי מופשט לזיכרון קונקרטי.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לנסות לזהות שמות תווים מוחלטים במקום יחסים. רוב הלומדים אינם בעלי שמיעה אבסולוטית — והחדשות הטובות הן שלא צריך אותה. שמיעה יחסית, שמזהה מרווחים ביחס לטוניקה, נלמדת ומספיקה בהחלט."}],quiz:[{prompt:"מהו העיקרון המרכזי בפיתוח שמיעה מלודית?",options:[{label:"לזהות את היחסים והמרווחים בין הצלילים",correct:!0},{label:"לזהות את שם התו המוחלט של כל צליל",correct:!1},{label:"לזכור את משך הצלילים בלבד",correct:!1}],explanation:"שמיעה מלודית עוסקת ביחסים — צעדים וקפיצות ביחס לטוניקה — ולא בשמות מוחלטים, שדורשים שמיעה אבסולוטית נדירה."},{prompt:"מהו הצעד הראשון והמומלץ לפני זיהוי מנגינה?",options:[{label:"לעגן את הטוניקה באוזן",correct:!0},{label:"לכתוב מיד את כל התווים",correct:!1},{label:"לנגן את המנגינה מהר ככל האפשר",correct:!1}],explanation:"עיגון הטוניקה נותן נקודת ייחוס יציבה שממנה מודדים את כל שאר המרווחים; בלעדיה הזיהוי מרחף ללא עוגן."}]},"MC-015":{sections:[{kind:"concept",icon:"🎵",heading:"מהו סולפג'?",body:`סולפג' הוא שיטה לשיר מנגינות באמצעות הברות קבועות לכל דרגה בסולם: דו, רה, מי, פה, סול, לה, סי. במקום לשיר "לה־לה־לה" או שמות תווים, כל צליל מקבל הברה שמזהה את תפקידו בסולם. הברות אלו הופכות את היחסים בין הצלילים למוחשיים בקול — כך שהעין קוראת תו, האוזן שומעת אותו, והפה שר את תפקידו, הכול בבת אחת.`},{kind:"concept",icon:"🔄",heading:"דו נייד (movable-do)",body:`בשיטת ה"דו הנייד", הנפוצה בפיתוח שמיעה, "דו" הוא תמיד הטוניקה — לא משנה באיזה סולם אנחנו. בסולם סול מז'ור, הצליל סול הוא "דו"; בסולם רה מז'ור, רה הוא "דו". היתרון עצום: אותה מנגינה נשמעת ונשרת באותן הברות בכל הסולמות, וכך הלומד מתמקד ביחסים המלודיים במקום להיבלע בשמות תווים משתנים. זו הסיבה שסולפג' הוא כלי כה חזק לשירה מדף (sight-singing).`},{kind:"notation",heading:"סולם דו מז'ור עם הברות סולפג'",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"דו־רה־מי־פה־סול־לה־סי־דו. שירו בהברות סולפג' תוך כדי האזנה — כל הברה היא דרגה."},{kind:"tip",icon:"💡",body:'הצמידו לכל הברה תנועת יד (סימני קרווין/Curwen): כך הגוף "זוכר" את הגובה. השילוב של קול, עין ותנועה מקבע את היחסים הרבה מהר יותר מאשר קול לבדו.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לערבב בין דו נייד לדו קבוע. ב"דו קבוע" ההברה "דו" תמיד מציינת את הצליל C, בכל סולם. שתי השיטות תקפות — אך אין לערבבן. לפיתוח שמיעה ולשירה מדף עדיף הדו הנייד, שמדגיש תפקוד ולא גובה מוחלט.'}],quiz:[{prompt:'בשיטת ה"דו הנייד", מה תמיד מייצגת ההברה "דו"?',options:[{label:"את הטוניקה של הסולם הנוכחי",correct:!0},{label:"את הצליל C בלבד, בכל סולם",correct:!1},{label:"את הצליל הגבוה ביותר במנגינה",correct:!1}],explanation:'בדו הנייד "דו" הוא תמיד הטוניקה, ולכן אותה מנגינה נשרת באותן הברות בכל סולם — יתרון מרכזי לשירה מדף.'},{prompt:"מהו היתרון המרכזי של סולפג' לפיתוח שמיעה?",options:[{label:"הוא הופך את היחסים בין הדרגות למוחשיים בקול",correct:!0},{label:"הוא מלמד לזהות את משך הצלילים",correct:!1},{label:"הוא מחליף את הצורך לקרוא תווים כליל",correct:!1}],explanation:"כל הברה מזהה תפקיד של דרגה בסולם, כך שהיחסים המלודיים הופכים מוחשיים ונשמעים — בסיס לשירה מדף ולתפיסה טונאלית."}]},"MC-030":{sections:[{kind:"concept",icon:"🥁",heading:'מה הופך משקל ל"מורכב"?',body:`במשקל פשוט (כמו 4/4 או 3/4) כל פעימה מתחלקת לשניים. במשקל מורכב כל פעימה מתחלקת לשלושה. המספר העליון במשקל מורכב מתחלק ב-3: 6/8, 9/8 ו-12/8. אף שנראה כאילו יש שש שמיניות ב-6/8, אנחנו לא סופרים שש פעימות אלא שתי פעימות גדולות, שכל אחת מהן היא שלוש שמיניות. זו התחושה ה"מתנדנדת" והמעוגלת של שירי עריסה, ג'יגות ובלדות רבות.`},{kind:"example",icon:"🔢",heading:"6/8, 9/8, 12/8 — כמה פעימות בכל אחד",body:'הכלל פשוט: מחלקים את המספר העליון בשלוש כדי לקבל את מספר הפעימות הראשיות. 6/8 = שתי פעימות (2×3 שמיניות); 9/8 = שלוש פעימות; 12/8 = ארבע פעימות. לכן 6/8 "מרגיש" כמו שתי פעימות מתנדנדות, ולא כמו שש ספירות שוות. הפעימה הראשית מקבלת נקודת דגש, ובתוכה שלוש השמיניות זורמות כטריולה טבעית.'},{kind:"notation",heading:"תבנית 6/8 — שתי פעימות של שלוש שמיניות",notation:{clef:"treble",timeSignature:"6/8",notes:[{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"}]},body:'שש שמיניות המחולקות 3+3. ספרו "אחת־ושתיים־שלוש, שתיים־ושתיים־שלוש" והדגישו את השמינית הראשונה בכל קבוצה.'},{kind:"notation",heading:"אותו 6/8 בפעימות הראשיות: שני רבעים מנוקדים",notation:{clef:"treble",timeSignature:"6/8",notes:[{keys:["g/4"],duration:"qd"},{keys:["g/4"],duration:"qd"}]},body:"הרבע המנוקד = שלוש שמיניות. שני רבעים מנוקדים ממלאים בדיוק תיבת 6/8 — אלו שתי הפעימות הראשיות."},{kind:"tip",icon:"💡",body:'כדי להרגיש 6/8, שירו את הפתיחה של "We Are the Champions" או שיר ערש: התנועה מתגלגלת בקבוצות של שלוש. ספירה של שש שוות תשמע מכנית ותפספס את הגלגול.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לספור 6/8 כשש פעימות שוות. זו טעות התחושה הנפוצה ביותר: 6/8 הוא שתי פעימות גדולות, לא שש קטנות. אם מנגנים אותו כמו 3/4 מהיר עם דגש על כל שמינית, מאבדים את ה"נדנוד" המורכב.'}],quiz:[{prompt:"כמה פעימות ראשיות יש בתיבת 6/8?",options:[{label:"שתיים — כל אחת שלוש שמיניות",correct:!0},{label:"שש — כל שמינית פעימה נפרדת",correct:!1},{label:"שלוש — כמו 3/4",correct:!1}],explanation:"6/8 הוא משקל מורכב: מחלקים 6 בשלוש ומקבלים שתי פעימות ראשיות, שכל אחת בת שלוש שמיניות (רבע מנוקד)."},{prompt:"איזה ערך מקבל בדיוק פעימה ראשית אחת ב-6/8?",options:[{label:"רבע מנוקד (שלוש שמיניות)",correct:!0},{label:"רבע רגיל (שתי שמיניות)",correct:!1},{label:"חצי (ארבע שמיניות)",correct:!1}],explanation:"במשקל מורכב הפעימה מתחלקת לשלוש, ולכן ערכה הוא תו מנוקד. ב-6/8 הפעימה = רבע מנוקד = שלוש שמיניות."},{prompt:"מה משותף למשקלים 6/8, 9/8 ו-12/8?",options:[{label:"המספר העליון מתחלק בשלוש — כל פעימה מתחלקת לשלוש",correct:!0},{label:"לכולם יש בדיוק שתי פעימות ראשיות",correct:!1},{label:"כל פעימה בהם מתחלקת לשתיים",correct:!1}],explanation:"זהו סימן ההיכר של משקל מורכב: המונה מתחלק ב-3, ולכן כל פעימה ראשית מתחלקת לשלוש חלקים שווים."}]},"MC-010":{sections:[{kind:"concept",icon:"🌀",heading:"מה הם מקצבים א-סימטריים?",body:'מקצב א-סימטרי (או "לא-שווה") הוא משקל שבו הפעימות אינן שוות באורכן. במקום פעימות זהות כמו ב-4/4, המשקל מחלק את התיבה לקבוצות של שתיים ושלוש שמיניות המתחלפות ביניהן. כך 5/8 מתחלק לרוב ל-3+2 (או 2+3), ו-7/8 ל-2+2+3 או 3+2+2. התוצאה היא דופק "צולע" ומרתק, אופייני מאוד למוסיקה בלקנית, יוונית, טורקית ולרוק המתקדם.'},{kind:"example",icon:"👣",heading:"לספור בקבוצות, לא בשמיניות בודדות",body:'הסוד לחוש מקצב א-סימטרי הוא לא לספור חמש או שבע שמיניות שוות, אלא לחלק אותן לקבוצות ולהדגיש את ראש כל קבוצה. ב-5/8 בחלוקת 3+2 סופרים "אחת־שתיים־שלוש, אחת־שתיים" — שתי קבוצות באורך לא-שווה. הדגש החזק על ראש כל קבוצה הוא מה שנותן למקצב את הזהות שלו; שנו את החלוקה (3+2 מול 2+3) והתחושה משתנה לגמרי, למרות שמספר השמיניות זהה.'},{kind:"notation",heading:"תבנית 5/8 בחלוקת 3+2",notation:{clef:"treble",timeSignature:"5/8",notes:[{keys:["c/5"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["g/4"],duration:"8"}]},body:'חמש שמיניות בחלוקה 3+2. הצליל הגבוה (דו) מסמן את ראש כל קבוצה — הדגש. ספרו "אחת־2Ö¾3, אחת־2".'},{kind:"notation",heading:"תבנית 7/8 בחלוקת 2+2+3",notation:{clef:"treble",timeSignature:"7/8",notes:[{keys:["c/5"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"}]},body:"שבע שמיניות בחלוקה 2+2+3. הדגשים על השמינית 1, 3 ו-5. זהו הדופק הבלקני המוכר."},{kind:"tip",icon:"💡",body:'הצמידו מילים לחלוקה: ל-3+2 אפשר לומר "אפ-פל-סין, מנ-גו"; ל-2+2+3 "מנ-גו, מנ-גו, אפ-פל-סין". ההברות הטבעיות מנחילות את החלוקה הלא-שווה מהר יותר מספירה מספרית.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנסות "ליישר" את המקצב לפעימות שוות. הא-סימטריה אינה תקלה — היא הלב של המקצב. אם מנגנים 7/8 כאילו הוא 4/4 עם פעימה חסרה, מאבדים בדיוק את המתח והדחיפה שהופכים אותו למיוחד.'}],quiz:[{prompt:"כיצד מחלקים בדרך כלל תיבת 5/8?",options:[{label:"לשתי קבוצות לא-שוות, למשל 3+2",correct:!0},{label:"לחמש פעימות שוות לגמרי",correct:!1},{label:"לשתי קבוצות שוות של 2.5 שמיניות",correct:!1}],explanation:"5/8 הוא א-סימטרי: הוא מתחלק לקבוצות באורך לא-שווה, לרוב 3+2 או 2+3, והדגש על ראש כל קבוצה נותן לו את זהותו."},{prompt:"מה קובע את התחושה של מקצב א-סימטרי?",options:[{label:"החלוקה לקבוצות והדגש על ראש כל קבוצה",correct:!0},{label:"המהירות (הטמפו) בלבד",correct:!1},{label:"מספר התיבות ביצירה",correct:!1}],explanation:"אותו מספר שמיניות בחלוקה שונה (3+2 מול 2+3) נשמע אחרת לגמרי. החלוקה והדגשים הם שמעניקים למקצב את אופיו."}]},"MC-032":{sections:[{kind:"concept",icon:"🤲",heading:"שתי ידיים, שני עולמות",body:'קואורדינציה ריתמית היא היכולת של כל יד (או כל גף) לשמור על דפוס משלה, בעצמאות מלאה מהשנייה. זו אחת המיומנויות התובעניות ביותר בנגינה: המוח נוטה באופן טבעי ל"סנכרן" את הידיים, ולכן כשיד אחת מנגנת שתי פעימות ובו-זמנית היד השנייה מנגנת שלוש, נדרש אימון ממוקד כדי שכל דפוס ישמור על יציבותו. המפתח אינו כוח אלא הפרדה: ללמד כל יד את הדפוס שלה בנפרד, לאט, עד שהוא הופך אוטומטי — ×
4080•רק אז לחבר.'},{kind:"example",icon:"🔀",heading:"שלושה מול שניים — נקודת המפגש",body:'הדוגמה הקלאסית לקואורדינציה היא "שלושה מול שניים" (3:2): יד אחת מחלקת פעימה אחת לשלושה חלקים שווים, והשנייה מחלקת אותה פעימה לשניים. שתי הידיים פוגשות זו את זו רק בתחילת הפעימה, ואז מתפצלות. טריק עזר מפורסם: אמרו את המשפט "לא קשה בכלל" — ההברות נופלות בדיוק על נקודות המפגש של שני הדפוסים. ברגע שהפה מבצע את השילוב, הידיים לומדות לעקוב.'},{kind:"notation",heading:'צד ה"שלוש": שלוש שמיניות בפעימה',notation:{clef:"treble",timeSignature:"3/8",notes:[{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"}]},body:"היד הימנית: שלושה צלילים שווים הממלאים פעימה אחת. נגנו אותם לבד עד שהם יציבים לגמרי."},{kind:"notation",heading:'צד ה"שתיים": שתי שמיניות בפעימה',notation:{clef:"treble",timeSignature:"2/8",notes:[{keys:["c/4"],duration:"8"},{keys:["c/4"],duration:"8"}]},body:"היד השמאלית: שני צלילים שווים באותו משך פעימה. השילוב של שני הדפוסים הוא ה-3:2."},{kind:"tip",icon:"💡",body:"תמיד לפרק לפני שמחברים. תרגלו כל יד בנפרד עד שהיא אוטומטית, אז חברו לאט מאוד עם מטרונום איטי. הַאֵטָה קיצונית של הטמפו היא לא בזבוז זמן — היא הדרך היחידה שבה המוח מפריד באמת בין שני הדפוסים."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנסות "לחוש" את שתי הידיים כשתי מנגינות נפרדות מהרגע הראשון, במלוא המהירות. המוח מתפתה לסנכרן ואז שתי הידיים קורסות לדפוס אחד. הפתרון: ללמוד את נקודות המפגש כתבנית משולבת אחת, לאט, ולא כשני זרמים מקבילים.'}],quiz:[{prompt:'ב"שלושה מול שניים" (3:2), היכן נפגשות שתי הידיים?',options:[{label:"רק בתחילת הפעימה המשותפת",correct:!0},{label:"על כל שמינית לאורך הפעימה",correct:!1},{label:"הן לעולם אינן נפגשות",correct:!1}],explanation:"צד ה-2 וצד ה-3 מתחלקים בפעימה אחת ומתחילים יחד, אך מתפצלים מיד. נקודת המפגש היחידה היא ראש הפעימה — ומשם כל יד הולכת בקצב שלה."},{prompt:"מהי שיטת האימון היעילה ביותר לקואורדינציה בין הידיים?",options:[{label:"לתרגל כל יד בנפרד עד אוטומציה, ואז לחבר לאט מאוד",correct:!0},{label:'לנגן מהר מההתחלה כדי "לתפוס את הזרימה"',correct:!1},{label:"להתאמן רק עם היד החזקה יותר",correct:!1}],explanation:"עצמאות נבנית מהפרדה: כל דפוס חייב להיות יציב לבדו לפני החיבור, והחיבור נעשה בטמפו איטי במיוחד כדי שהמוח לא יסנכרן את הידיים בטעות."}]},"MC-033":{sections:[{kind:"concept",icon:"🎼",heading:"מהי פוליריתמיקה?",body:`פוליריתמיקה היא נגינה בו-זמנית של שני מקצבים שאינם מתחלקים זה בזה — למשל שלוש פעימות כנגד ארבע, או שתיים כנגד שלוש, באותו פרק זמן. בניגוד לחלוקה רגילה, שבה קבוצה אחת "יושבת" בתוך השנייה, בפוליריתם שני הזרמים שווי-מעמד ומתחרים על תשומת הלב. התוצאה היא מרקם עשיר ומרחף, שבו האוזן יכולה לבחור לאיזה זרם להקשיב. פוליריתמים הם לב-ליבה של מוסיקה אפריקאית מערבית, ג'אז ומינימליזם.`},{kind:"example",icon:"🧮",heading:"למצוא את המכנה המשותף",body:"הדרך לחשב ולהרגיש פוליריתם היא למצוא את המכפלה המשותפת של שני המספרים. ב-3:4, המכנה המשותף הוא 12: מחלקים פעימה אחת ל-12 יחידות זעירות, ואז זרם ה-3 נופל כל 4 יחידות (0, 4, 8) וזרם ה-4 נופל כל 3 יחידות (0, 3, 6, 9). ב-2:3 המכנה הוא 6: זרם ה-2 על 0 ו-3, זרם ה-3 על 0, 2, 4. תרגול איטי של רשת היחידות הזו הוא מה שהופך פוליריתם מבלבול לתחושה מוצקה."},{kind:"notation",heading:'זרם ה"שלוש" (תיבת 3/4)',notation:{clef:"treble",timeSignature:"3/4",n
4080otes:[{keys:["e/5"],duration:"q"},{keys:["e/5"],duration:"q"},{keys:["e/5"],duration:"q"}]},body:"שלושה רבעים שווים הממלאים תיבה. זהו צד ה-3 של פוליריתם 3:4 — נגנו אותו בנפרד תחילה."},{kind:"notation",heading:'זרם ה"ארבע" — אותו משך זמן, חלוקה אחרת',notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["a/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["a/4"],duration:"q"}]},body:"ארבעה רבעים שווים הפרוסים על אותו משך זמן שבו הזרם הקודם ניגן שלושה. יחד — 3:4."},{kind:"tip",icon:"💡",body:'לכל פוליריתם יש משפט-עזר. ל-3:4 נהוג לומר "pass the god-damn butter" — שבע ההברות נופלות בדיוק על נקודות המפגש והחלוקה של הרשת בת 12 היחידות. אמירת המשפט בקצב קבוע מלמדת את הגוף את התבנית לפני שהידיים מנסות.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לחשוב שפוליריתם 3:4 הוא רק "להאיץ" זרם אחד. שני הזרמים חייבים למלא בדיוק את אותו פרק זמן — לא אחד מהיר ואחד איטי, אלא שתי חלוקות שונות של משך זהה. אם מאבדים את הגבול המשותף בתחילת המחזור, שני הזרמים מחליקים זה מזה והתבנית מתפרקת.'}],quiz:[{prompt:"מה מייחד פוליריתם לעומת חלוקה ריתמית רגילה?",options:[{label:"שני מקצבים שאינם מתחלקים זה בזה מתנגנים באותו פרק זמן",correct:!0},{label:"מקצב אחד תמיד מהיר פי שניים מהשני",correct:!1},{label:"הוא קיים רק במשקלים א-סימטריים",correct:!1}],explanation:"בפוליריתם שני זרמים שווי-מעמד (כמו 3 מול 4) חולקים משך זמן זהה בלי שאחד יתחלק בשלמות בתוך השני — וזה מקור המתח והעושר שלו."},{prompt:"מהו המכנה המשותף שבעזרתו נוח לחשב פוליריתם 3:4?",options:[{label:"12 יחידות — זרם ה-3 כל 4, זרם ה-4 כל 3",correct:!0},{label:"7 יחידות — סכום 3 ועוד 4",correct:!1},{label:"1 יחידה — הם נופלים תמיד יחד",correct:!1}],explanation:"המכפלה המשותפת של 3 ו-4 היא 12. חלוקת הפעימה ל-12 יחידות מאפשרת למקם במדויק את שני הזרמים ולהרגיש את נקודות המפגש והפיצול."}]},"MC-050":{sections:[{kind:"concept",icon:"🌱",heading:"המוטיב — הזרע של המנגינה",body:'מוטיב הוא התא המלודי-ריתמי הקטן ביותר שיש לו זהות משלו — לרוב שניים עד ארבעה צלילים עם דמות ריתמית מובהקת. המוטיב הוא הזרע שממנו צומחת יצירה שלמה: ארבעת הצלילים הפותחים של הסימפוניה החמישית של בטהובן הם מוטיב בן ארבעה צלילים בלבד, ומהם נבנית תנועה שלמה. כשמלחינים, לא מתחילים ממנגינה ארוכה אלא ממוטיב חזק — ואז שואלים "מה אפשר לעשות איתו".'},{kind:"example",icon:"🔁",heading:"חזרה, סקוונצה, וריאציה",body:"שלוש הפעולות הבסיסיות שהופכות מוטיב לשורה מלודית הן: חזרה — לנגן את המוטיב שוב כפי שהוא, לביסוס וזיהוי; סקוונצה — לחזור על אותה תבנית מגובה אחר (למשל צעד מעלה), מה שמעניק תחושת התקדמות והתפתחות; ווריאציה — לשנות פרט אחד (הפוך כיוון, הרחב מרווח, שנה מקצב) תוך שמירה על הזיהוי. השילוב של השלוש נותן שורה שיש בה גם אחדות וגם עניין — לא מונוטוניות ולא כאוס."},{kind:"notation",heading:"מוטיב ואז סקוונצה שלו צעד מעלה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["d/4"],duration:"h"},{keys:["d/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["e/4"],duration:"h"}]},body:"תיבה 1 = המוטיב (דו־מי־רה). תיבה 2 = אותה תבנית בדיוק, צעד אחד מעלה (רה־פה־מי). זוהי סקוונצה עולה."},{kind:"tip",icon:"💡",body:"מוטיב חזק זקוק לדמות ריתמית שאפשר לזהות גם בלי הצלילים. אם תוכלו למחוא את המקצב של המוטיב וחבר יזהה מאיזו יצירה הוא — סימן שהמוטיב חזק דיו לשאת יצירה שלמה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להחליף מוטיב חדש בכל שורה מתוך פחד ממונוטוניות. עודף חומר חדש מונע מהאוזן להיאחז במשהו. חזרה וסקוונצה אינן חוסר-דמיון — הן הדבק שנותן ליצירה זהות. גיוון בא מווריאציה על אותו מוטיב, לא מנטישתו."}],quiz:[{prompt:'מהי "סקוונצה" בפיתוח מוטיב?',options:[{label:"חזרה על אותה תבנית מלודית מגובה אחר",correct:!0},{label:"ניגון המוטיב לאחור",correct:!1},{label:"האטת המוטיב לחצי מהמהירות",correct:!1}],explanation:"סקוונצה שומרת על צורת המוטיב אך מעתיקה אותה לגובה חדש (למשל צעד מעלה), ובכך יוצרת תחושת התקדמות והתפתחות תוך שמירה על הזיהוי."},{prompt:"מדוע חזרה ווריאציה עדיפות על החלפת מוטיב חדש בכל שורה?",options:[{label:"הן נותנות לאוזן עוגן מוכר ובכך יוצרות אחדות",correct:!0},{label:"הן מקצרות את משך היצירה",correct:!1},{label:"הן מייתרות את הצורך במקצב",correct:!1}],explanation:"האוזן זקוקה למשהו להיאחז בו. חזרה וסקוונצה מבססות זהות, והווריאציה מוסיפה עניין — עודף חומר חדש דווקא מפרק את התחושה של יצירה אחת שלמה."},{prompt:"מה בדרך כלל אורכו של מוטיב?",options:[{label:"שניים עד ארבעה צלילים עם דמות ריתמית מובהקת",correct:!0},{label:"תיבה שלמה של שמונה צלילים לפחות",correct:!1},{label:"משפט שלם בן שתי שורות",correct:!1}],explanation:"מוטיב הוא היחידה המלודית-ריתמית הקטנה בעלת זהות — לרוב 2–4 צלילים. דוגמה מפורסמת: ארבעת הצלילים הפותחים את הסימפוניה החמישית של בטהובן."}]},"MC-051":{sections:[{kind:"concept",icon:"❓",heading:"משפט ומענה (antecedent & consequent)",body:"מנגינות רבות בנויות כזוג שאלה-ותשובה: המשפט הראשון (antecedent) נשמע כמו שאלה — הוא עולה או נעצר על צליל לא-יציב ומשאיר תחושת ציפייה; המשפט השני (consequent) הוא התשובה — הוא חוזר על חומר דומה אך נחת על הטוניקה, ומעניק תחושת סגירה. זהו העיקרון המבני הבסיסי ביותר בבניית מנגינה: שני חצאים המשלימים זה את זה, כמו שני חצאי משפט בשפה."},{kind:"concept",icon:"⛰️",heading:"קונטור, שיא ונקודות קדנצה",body:'לכל מנגינה טובה יש קונטור — קו מתאר של עליות וירידות — ובתוכו נקודת שיא (climax) אחת, לרוב הצליל הגבוה ביותר, המופיע פעם אחת וקרוב לסוף. נקודות הקדנצה הן ה"פיסוק" של המנגינה: הקדנצה בסוף המשפט הראשון היא לרוב "פתוחה" (עוצרת על הדומיננטה, כמו פסיק), והקדנצה בסוף המשפט השני "סגורה" (על הטוניקה, כמו נקודה). כשמשלימים מנגינה חסרה, שואלים תמיד: היכן השיא, ואיזו קדנצה מתאימה לסיום.'},{kind:"notation",heading:"משפט (שאלה, עוצר על סול) ומענה (תשובה, נח על דו)",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["c/4"],duration:"q"}]},body:"תיבה 1 = המשפט: עולה ונעצר על סול (הדומיננטה) — שאלה פתוחה. תיבה 2 = המענה: יורד ונח על דו (הטוניקה) — תשובה סגורה."},{kind:"tip",icon:"💡",body:"כשמשלימים מנגינה, שמרו את הצליל הגבוה ביותר לנקודת השיא — פעם אחת בלבד, קרוב לסוף. שיא שחוזר שוב ושוב מאבד את כוחו, ומנגינה בלי שיא ברור נשמעת שטוחה וחסרת כיוון."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לסיים את המשפט הראשון על הטוניקה. אם גם החצי הראשון נח על דו, נוצרת תחושת סיום מוקדמת מדי והמנגינה "נופלת" באמצע. המשפט הפותח צריך להישאר פתוח — לרוב על הדומיננטה — כדי שהמענה יהיה לו מה לפתור.'}],quiz:[{prompt:'מה מאפיין קדנצה "פתוחה" בסוף המשפט הראשון?',options:[{label:"היא עוצרת על צליל לא-יציב (לרוב הדומיננטה) ומשאירה ציפייה",correct:!0},{label:"היא נחה על הטוניקה ונשמעת מסוימת",correct:!1},{label:"היא תמיד הצליל הגבוה ביותר במנגינה",correct:!1}],explanation:'המשפט הפותח הוא "שאלה": קדנצה פתוחה על הדומיננטה משאירה מתח וציפייה, כדי שהמענה יוכל לפתור אותה בקדנצה סגורה על הטוניקה.'},{prompt:"כמה נקודות שיא (climax) רצוי שיהיו במנגינה קצרה?",options:[{label:"אחת, לרוב הצליל הגבוה ביותר, קרוב לסוף",correct:!0},{label:"אחת בכל תיבה",correct:!1},{label:"אף אחת — כל הצלילים צריכים אותו גובה",correct:!1}],explanation:"שיא יחיד נותן למנגינה כיוון ומתח. חזרה על אותו גובה שיא שוב ושוב שוחקת את עוצמתו, ומנגינה שטוחה בלי שיא מאבדת עניין."}]},"MC-054":{sections:[{kind:"concept",icon:"✍️",heading:"שני צירים בבת אחת: גובה ומשך",body:"כתיבה ופענוח של מנגינה פירושם לתפוס בו-זמנית שני ממדים: הגובה (איזה צליל) והמשך (כמה זמן). לומדים רבים מצטיינים באחד ומזניחים את השני — שומעים את המנגינה נכון אך רושמים מקצב שגוי, או להפך. המיומנות האמיתית היא לשלב: לקרוא תו ולדעת מיד גם את שמו וגם את ערכו, ולשמוע מנגינה ולתרגם אותה לשני הצירים גם יחד. זהו הגשר בין האוזן, העין והכתב."},{kind:"concept",icon:"🔍",heading:"שיטת הפענוח: להפריד ואז לאחד",body:"כשמפענחים מנגינה שמיעתית, כדאי לעבוד בשני מעברים. במעבר הראשון מקשיבים רק למקצב — מוחאים או מתופפים את הדמות הריתמית בלי לדאוג לגובה. במעבר השני מוסיפים את הגבהים על גבי הרשת הריתמית שכבר יש בידינו. פירוק זה מוריד את העומס הקוגניטיבי: קל בהרבה לפתור בעיה אחת בכל פעם. רק אחרי ששני הצירים ברורים בנפרד, מאחדים אותם לכתיב מלא ומדויק על החמשה."},{kind:"notation",heading:"מנגינה קצרה לפענוח — גובה ומשך משולבים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["c/4"],duration:"8"},{keys:["d/4"],duration:"8"},{keys:["e/4"],duration:"h"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["f/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["d/4"],duration:"h"}]},body:"שתי תיבות ב-4/4. תיבה 1: רבע, שתי שמיניות, חצי (4 פעימות). תיבה 2: ארבע שמיניות ואז חצי (4 פעימות). פענחו קודם את המקצב, אז את הגבהים."},{kind:"tip",icon:"💡",body:"לפני שרושמים גובה, סמנו את קווי התיבה ואת הפעימות החזקות. רשת ריתמית מסודרת מונעת את הטעות הנפוצה ביותר בהכתבה — תיבה שסכום ערכיה אינו תואם את המשקל."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לרשום את הגבהים נכון אך להתעלם מסכום הערכים בתיבה. כל תיבה חייבת להסתכם בדיוק למספר הפעימות שהמשקל מכתיב. תיבה ב-4/4 שסכומה חמש פעימות היא שגיאת כתיב — גם אם כל הצלילים בגובה הנכון."}],quiz:[{prompt:"אילו שני ממדים חייבים להיתפס יחד בכתיבה ופענוח של מנגינה?",options:[{label:"הגובה (שם הצליל) והמשך (ערך הזמן)",correct:!0},{label:"עוצמה (דינמיקה) וטמפו בלבד",correct:!1},{label:"הגובה בלבד — המקצב משני",correct:!1}],explanation:"מנגינה כתובה מקודדת בו-זמנית גובה ומשך. שליטה באחד בלבד — צליל נכון בערך שגוי, או להפך — אינה פענוח מלא."},{prompt:"מהי שיטת הפענוח היעילה למנגינה שמיעתית?",options:[{label:"מעבר ראשון למקצב בלבד, מעבר שני להוספת הגבהים",correct:!0},{label:"לרשום מיד את שני הצירים בבת אחת במלוא המהירות",correct:!1},{label:"להתעלם מהמקצב ולרשום רק את שמות הצלילים",correct:!1}],explanation:"הפרדת המשימות מפחיתה עומס: קודם קובעים את הרשת הריתמית, ואז מציבים עליה את הגבהים — קל יותר לפתור ממד אחד בכל פעם ואז לאחד."}]},"MC-082":{sections:[{kind:"concept",icon:"🎤",heading:"אלתור בתוך גבולות",body:'אלתור ריתמי הוא יצירת מקצבים במקום, בזמן אמת, מעל דופק קבוע. בניגוד לתחושה שאלתור הוא "לעשות מה שרוצים", אלתור טוב חי דווקא בתוך גבולות ברורים: דופק יציב, מספר תיבות קבוע, ומאגר מוגבל של דמויות ריתמיות. הגבולות הם מה שמאפשר חופש — כשהמסגרת קבועה, האוזן והגוף פנויים לשחק בתוכה. המאלתר אינו ממציא מאפס אלא מצרף מחדש אבני-בניין מוכרות בסדר חדש.'},{kind:"example",icon:"📢",heading:"קריאה ומענה, ומילוי הגרוב",body:'שתי הצורות הבסיסיות של אלתור ריתמי הן "קריאה ומענה" (call & response) ו"מילוי" (fill). בקריאה ומענה, מוביל מנגן דמות ריתמית (הקריאה), והמאלתר עונה בדמות משלו — לרוב באותו אורך, לעיתים כהד ולעיתים כתשובה מנוגדת. ה"מילוי" הוא קטע קצר של אלתור המגשר בין שני חלקים בתוך גרוב קבוע, כמו התופף הממלא את סוף התיבה הרביעית. בשתיהן, המפתח הוא לשמור על הדופק — האלתור מרחף מעל פעימה ×
4080©××™× ×” זזה.'},{kind:"notation",heading:"קריאה (תיבה 1) ומענה (תיבה 2) על צליל אחד",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/5"],duration:"q"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"q"},{keys:["c/5"],duration:"qr"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"q"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["c/5"],duration:"q"}]},body:"צליל אחד (דו) — הכול מקצב. תיבה 1 = הקריאה (רבע, שתי שמיניות, רבע, הפסקת רבע). תיבה 2 = מענה בדמות שונה, אותו אורך. מחאו/נגנו לסירוגין."},{kind:"tip",icon:"💡",body:'התחילו עם מאגר קטן: שתי-שלוש דמויות ריתמיות בלבד. הגבלה מכוונת מאלצת יצירתיות ומונעת "קיפאון של דף לבן". רק כשהמאגר הקטן זורם, מרחיבים אותו.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לרדוף אחרי מורכבות ולאבד את הדופק. אלתור ריתמי מרשים אינו נמדד לפי כמות התווים אלא לפי היציבות מעל הפעימה. תבנית פשוטה שמתיישבת מדויק על הגרוב חזקה בהרבה משטף מהיר שמחליק מהזמן."}],quiz:[{prompt:'מהו "קריאה ומענה" (call & response) באלתור ריתמי?',options:[{label:"מוביל מנגן דמות ריתמית, והמאלתר עונה בדמות משלו באותו אורך",correct:!0},{label:"כל המנגנים מנגנים את אותה דמות בו-זמנית",correct:!1},{label:"שינוי הטמפו בכל תיבה",correct:!1}],explanation:"בקריאה ומענה יש דו-שיח: הקריאה מציבה תבנית, והמענה משיב בתבנית משלו — הד או ניגוד — לרוב באותו אורך, מעל אותו דופק קבוע."},{prompt:"מה החשוב ביותר לשמור עליו בעת אלתור ריתמי?",options:[{label:"דופק יציב שאינו זז",correct:!0},{label:"כמה שיותר תווים בכל תיבה",correct:!1},{label:"להאיץ בהדרגה לאורך האלתור",correct:!1}],explanation:"האלתור מרחף מעל פעימה קבועה. תבנית פשוטה שמתיישבת מדויק על הדופק חזקה מכל שטף מהיר שמאבד את הזמן — היציבות היא הבסיס לחופש."}]},"MC-026":{sections:[{kind:"concept",icon:"🔄",heading:"מהי רהרמוניזציה?",body:`רהרמוניזציה היא אמנות ההנחה של אקורדים חדשים מתחת למנגינה קיימת בלי לשנות את המנגינה עצמה. אותם צלילים בדיוק, אבל הרקע ההרמוני משתנה — וכך משתנה כליל התחושה הרגשית של השיר. שיר שנשמע פשוט ותמים יכול לקבל צבע נוגה, ג'אזי או מרחף רק על ידי בחירה אחרת של אקורדים. המפתח הוא שכל אקורד חדש חייב "להכיל" את צליל המנגינה באותו רגע — הצליל שהמלחין כתב הופך לצליל אקורד, נוסף (טנשן) או מעבר מוצדק.`},{kind:"example",icon:"🎨",heading:"שלושת הכלים: תחליפים, אקורדים משניים וקרובים",body:`שלוש טכניקות עומדות בבסיס הרהרמוניזציה. תחליפים (substitutions): להחליף אקורד באחר בעל תפקיד דומה — למשל תחליף רלטיבי, שבו מחליפים אקורד מז'ורי באקורד המינורי הרלטיבי שלו (דו מז'ור ↔ לה מינור), שכן הם חולקים שני צלילים משותפים. דומיננטות משניות (secondary dominants): להוסיף אקורד דומיננטי המכוון לאקורד הבא ("V של V"), ובכך ליצור משיכה זמנית וצבע. אקורדים רלטיביים וקרובים: לנצל את השכנות בין אקורדים החולקים צלילים כדי להחליף אחד באחר. בכל מקרה, הבדיקה קבועה: האם צליל המנגינה עדיין מתיישב על האקורד החדש.`},{kind:"notation",heading:"אותה מנגינה (מי מוחזק) — שני אקורדים אפשריים מתחתיו",n
4080otation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4","e/4","g/4","e/5"],duration:"h"},{keys:["a/3","c/4","e/4","e/5"],duration:"h"}]},body:"צליל המנגינה מי (e/5) נשאר קבוע. מתחתיו: קודם דו מז'ור (דו־מי־סול), ואז לה מינור (לה־דו־מי) — תחליף רלטיבי. אותה מנגינה, צבע אחר."},{kind:"tip",icon:"💡",body:"התחילו תמיד מהמנגינה, לא מהאקורדים. סמנו בכל תיבה את צליל המנגינה החזק (הארוך/המודגש), ורק אז שאלו אילו אקורדים מכילים אותו כצליל נעים. כך תמנעו התנגשויות ותשמרו על המנגינה כשמלכה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לבחור אקורד "מעניין" שאינו מכיל את צליל המנגינה, ואז לגלות חיכוך צורם. רהרמוניזציה אינה חופש מוחלט — היא רשת של אילוצים סביב המנגינה הקיימת. אקורד חדש שמתנגש עם הצליל שהאוזן כבר מכירה נשמע כטעות, לא כחידוש.'}],quiz:[{prompt:"מהו התנאי הבסיסי שכל אקורד חדש ברהרמוניזציה חייב לקיים?",options:[{label:"הוא חייב להכיל או להתיישב עם צליל המנגינה באותו רגע",correct:!0},{label:"הוא חייב להיות אקורד דומיננטי",correct:!1},{label:"הוא חייב לשנות גם את המנגינה עצמה",correct:!1}],explanation:"ברהרמוניזציה המנגינה נשארת קבועה; רק ההרמוניה משתנה. לכן כל אקורד חדש חייב להכיל את צליל המנגינה כצליל אקורד, נוסף או מעבר — אחרת נוצר חיכוך צורם."},{prompt:'מהו "תחליף רלטיבי"?',options:[{label:"החלפת אקורד מז'ורי במינורי הרלטיבי שלו, החולק עמו שני צלילים",correct:!0},{label:"ניגון האקורד בהיפוך",correct:!1},{label:"האטת קצב האקורדים לחצי",correct:!1}],explanation:"דו מז'ור ולה מינור חולקים שני צלילים (דו ומי), ולכן ניתן להחליף אחד באחר תחת אותה מנגינה — תחליף רלטיבי שמשנה צבע בלי לשבור את הזרימה."},{prompt:"מה תפקידה של דומיננטה משנית ברהרמוניזציה?",options:[{label:"ליצור משיכה זמנית לעבר האקורד הבא ולהוסיף צבע",correct:!0},{label:"לסיים את השיר בקדנצה סופית",correct:!1},{label:"להשתיק את המנגינה לרגע",correct:!1}],explanation:'דומיננטה משנית ("V של V") מכוונת זמנית לאקורד שאינו הטוניקה, ויוצרת מתח ומשיכה שמעשירים את המהלך ההרמוני מבלי לצאת מהטונאליות לצמיתות.'}]},"MC-040":{sections:[{kind:"concept",icon:"🎻",heading:'לכתוב "בשפת הכלי"',body:'כתיבה אידיומטית פירושה לכתוב לכל כלי מוסיקלי מה שיושב לו טוב ביד, בנשימה ובאופי — ולא רק מה שאפשרי בתאוריה. אותה מנגינה עשויה להישמע נהדר בכינור ולהיות כמעט בלתי-אפשרית בטרומבון, או להיפך. נגן טוב מרגיש מיד אם הקטע "נכתב על ידי מישהו שמכיר את הכלי". שני שיקולים מרכזיים מנחים כל כתיבה: הטווח (הצלילים הגבוהים והנמוכים שהכלי מסוגל לנגן) ומה שנוח ואפקטיבי בתוך הטווח הזה — כי לא כל צליל אפשרי הוא צליל שנשמע טוב או קל לביצוע.'},{kind:"example",icon:"🎺",heading:"משפחות הכלים — טווח ואופי",body:`כלי הקשת (כינור, ויולה, צ'לו, קונטרבס) מכסים יחד טווח עצום מהנמוך לגבוה, מנגנים אקורדים שבורים בקלות ומצטיינים בקו לירי מתמשך. כלי הנשיפה מעץ (חליל, אבוב, קלרינט, בסון) זריזים בריצות מהירות אך תלויים בנשימה — משפט ארוך מדי בלי מקום לנשום פשוט לא ניתן לביצוע. כלי הנשיפה ממתכת (חצוצרה, קרן, טרומבון, טובה) חזקים ומזהירים אך מתעייפים בגובה קיצוני ובמשפטים ארוכים. הפסנתר, לעומתם, שולט בפוליפוניה ובאקורדים עבים אך אינו יכול "להחזיק" צליל ולתפוח בעוצמתו כמו כלי נשיפה או קשת. כתיבה טובה מנצלת את החוזקה של כל משפחה ונמנעת מהחולשה שלה.`},{kind:"notation",heading:"קו לירי מתמשך — אידיומטי לכלי קשת",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["g/4"],duration:"h"},{keys:["c/5"],duration:"q"},{keys:["d/5"],duration:"q"},{keys:["e/5"],duration:"h"},{keys:["d/5"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"קו מלודי זורם עם צלילים ארוכים בטווח נוח — טבעי לכינור או צ'לו, שיכולים לשאת אותו ברצף. לכלי נשיפה היה צריך לתכנן כאן מקום לנשימה."},{kind:"tip",icon:"💡",body:"כתבתם לכלי נשיפה או לזמר? קראו את המשפט בקול תוך כדי נשימה. אם נגמר לכם האוויר — נגמר גם לנגן. סימון מקומות נשימה אינו קישוט, הוא תנאי לביצוע."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:`להעביר מנגינה מכלי אחד לאחר "כמו שהיא", בלי לבדוק טווח והתאמה. מה שזורח בגבול הגבוה של הכינור עלול לצנוח מתחת לטווח של הצ'לו, או להישמע מאולץ ומתוח בחצוצרה. כתיבה אידיומטית דורשת התאמה לכל כלי, לא רק העתקה.`}],quiz:[{prompt:'מה פירוש "כתיבה אידיומטית" לכלי?',options:[{label:"לכתוב מה שיושב לכלי טוב ונוח לביצוע, לא רק מה שאפשרי",correct:!0},{label:"לכתוב תמיד בטווח הגבוה ביותר של הכלי",correct:!1},{label:"לכתוב את אותו קו לכל הכלים ללא שינוי",correct:!1}],explanation:"אידיומטיות עוסקת בהתאמה לאופי הכלי — טווח נוח, יכולת טכנית ונשימה — כדי שהקטע יישמע טבעי ויהיה בר-ביצוע, ולא רק אפשרי על הנייר."},{prompt:"איזה שיקול ייחודי חייב להנחות כתיבה לכלי נשיפה ולזמרים?",options:[{label:"לתכנן מקומות נשימה — משפט ארוך מדי אינו בר-ביצוע",correct:!0},{label:"לכתוב תמיד אקורדים בני ארבעה צלילים",correct:!1},{label:"להימנע מכל צליל ארוך",correct:!1}],explanation:"כלי נשיפה וקול תלויים באוויר. בלי מקום לנשום, אפילו קו יפה הופך בלתי-אפשרי — ולכן סימון וניצול של רגעי נשימה הוא חלק מהותי מהכתיבה."},{prompt:"מהי חוזקה אופיינית של הפסנתר לעומת כלי קשת ונשיפה?",options:[{label:"פוליפוניה ואקורדים עבים במקביל",correct:!0},{label:"היכולת להחזיק צליל ולתפוח בעוצמתו",correct:!1},{label:"ביצוע גליסנדו רציף בין כל הצלילים",correct:!1}],explanation:"הפסנתר מצטיין בנגינת קולות רבים ואקורדים עבים בו-זמנית, אך אינו יכול להחזיק צליל ולהגבירו כמו כלי קשת או נשיפה — שם דווקא חולשתו."}]},"MC-052":{sections:[{kind:"concept",icon:"⚖️",heading:"אחדות מול גיוון — המתח שמחזיק יצירה",body:'בלב כל יצירה מוסיקלית טובה עומד איזון עדין בין שני כוחות מנוגדים: אחדות וגיוון. אחדות היא החזרה על חומר מוכר — מוטיב, מקצב, קו הרמוני — שנותנת לאוזן משהו להיאחז בו ותחושה שהיצירה "שלמה אחת". גיוון הוא ההיפך: חומר חדש, ניגוד, הפתעה, שמונעים שעמום. יצירה שכולה חזרה נשמעת מונוטונית; יצירה שכולה חדש נשמעת מבולבלת וחסרת זהות. אמנות ההלחנה היא לנווט בין השניים — לחזור מספיק כדי לבסס, ולגוון מספיק כדי לרתק.'},{kind:"concept",icon:"🌊",heading:"מתח ושחרור, ומבנה הצורה",body:"המוסיקה נעה כמו נשימה: היא בונה מתח ואז משחררת אותו. מתח נוצר מדיסוננס, מעלייה בגובה או בעוצמה, מהאצה או מהרמוניה לא-יציבה; שחרור מגיע עם החזרה לצליל יציב, לטוניקה, לרוגע. גל אחר גל של מתח-ושחרור הוא מה שמניע יצירה קדימה ומעניק לה דרמה. מעל הכול פורשת הצורה — המבנה הגדול שמארגן את היצירה לחלקים (למשל A-
4080B-A, שבו חלק ניגודי ממוסגר בין חזרות של רעיון פותח). הצורה היא המפה שבתוכה כל עקרונות האחדות, הגיוון והמתח מקבלים את מקומם."},{kind:"notation",heading:"מבנה A-B-A זעיר: רעיון, ניגוד, חזרה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"h"},{keys:["a/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["d/4"],duration:"h"},{keys:["c/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"h"}]},body:"תיבה 1 = A (רעיון פותח, עולה לסול). תיבה 2 = B (ניגוד, יורד). תיבה 3 = A חוזר. אחדות (A מסגר) עם גיוון (B באמצע)."},{kind:"tip",icon:"💡",body:'כשיצירה נשמעת "משעממת", לרוב חסר בה גיוון; כשהיא נשמעת "מבולבלת", לרוב חסרה בה אחדות. אבחנו איזה משני הכוחות חסר, והוסיפו את ההפוך — חזרה של רעיון קיים או חומר ניגודי חדש.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לשפוך רעיונות טובים בזה אחר זה בלי לפתח אף אחד. יצירה אינה אוסף רעיונות אלא פיתוח של מעטים. מלחין מתחיל נוטה לנטוש כל רעיון ולעבור לחדש; מלחין מנוסה לוקח רעיון אחד ומוצה ממנו את מלוא הפוטנציאל דרך חזרה, וריאציה ופיתוח."}],quiz:[{prompt:"מהם שני הכוחות המנוגדים שהאיזון ביניהם מחזיק יצירה?",options:[{label:"אחדות (חזרה) וגיוון (חומר חדש)",correct:!0},{label:"עוצמה חזקה ועוצמה חלשה בלבד",correct:!1},{label:"טמפו מהיר וטמפו איטי בלבד",correct:!1}],explanation:"אחדות נותנת לאוזן עוגן מוכר; גיוון מונע שעמום. יצירה טובה מאזנת ביניהם — מספיק חזרה כדי לבסס זהות, ומספיק חדש כדי לרתק."},{prompt:'כיצד נוצרת תחושת "מתח" במוסיקה?',options:[{label:"מדיסוננס, עלייה בגובה/בעוצמה או הרמוניה לא-יציבה",correct:!0},{label:"רק מהאטת הטמפו",correct:!1},{label:"רק מחזרה על הטוניקה",correct:!1}],explanation:"מתח נבנה מכל מה שדוחק לפתרון: דיסוננס, עלייה בגובה או בעוצמה, האצה, הרמוניה לא-יציבה. השחרור מגיע עם החזרה ליציבות ולטוניקה."},{prompt:"מה מאפיין מבנה צורה מסוג A-B-A?",options:[{label:"חלק ניגודי (B) ממוסגר בין חזרות של רעיון פותח (A)",correct:!0},{label:"שלושה רעיונות חדשים לגמרי ללא חזרה",correct:!1},{label:"חזרה זהה על אותו חלק שלוש פעמים",correct:!1}],explanation:"ב-A-B-A רעיון פותח חוזר בסוף ומסגר חלק אמצעי ניגודי — שילוב קלאסי של אחדות (מסגרת A) וגיוון (ניגוד B), אחת הצורות הבסיסיות ביותר."}]},"MC-060":{sections:[{kind:"concept",icon:"🎶",heading:"קולות עצמאיים, לא אקורדים בלבד",body:'כתיבה רב-קולית (קונטרפונקט) היא אמנות שילובם של שני קולות או יותר, שכל אחד מהם מנגינה עצמאית ובעלת ערך בפני עצמה — ובכל זאת יחד הם נשמעים כהרמוניה מלוכדת. זה שונה מהותית מ"מנגינה עם ליווי", שבו קול אחד שולט והשאר תומכים. כאן כל קול חי ונושם, יש לו קונטור משלו וכיוון משלו, והאתגר הוא לגרום לקווים העצמאיים האלה להתלכד לצליל אחד יפה בלי לאבד את עצמאותם.'},{kind:"concept",icon:"↔️",heading:"תנועה נגדית, וכללי המנע הקלאסיים",body:'הכלי החשוב ביותר לשמירה על עצמאות הקולות הוא תנועה נגדית — כשקול אחד עולה והשני יורד. תנועה נגדית מדגישה שהקולות נפרדים ומעניקה למרקם עושר ואיזון. מולה עומדים שני איסורים קלאסיים: קווינטות מקבילות ואוקטבות מקבילות — כששני קולות נעים באותו כיוון ושומרים ביניהם מרווח של קווינטה או אוקטבה. הבעיה בהן היא שהצליל "הריק" של קווינטה או אוקטבה, כשהוא נע במקביל, גורם לשני הקולות להישמע לרגע כקול אחד — ובכך נמחקת בדיוק העצמאות שכתיבה רב-קולית מבקשת לשמר.'},{kind:"notation",heading:"שני קולות בתנועה נגדית — עליון עולה, תחתון יורד",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4","e/4"],duration:"q"},{keys:["b/3","f/4"],duration:"q"},{keys:["a/3","g/4"],duration:"q"},{keys:["g/3","c/5"],duration:"q"}]}
4080,body:"הקול העליון עולה (מי־פה־סול־דו) והתחתון יורד (דו־סי־לה־סול). זו תנועה נגדית: כל קול נשמר עצמאי, והמרווחים ביניהם משתנים ולא נעים במקביל."},{kind:"tip",icon:"💡",body:'כשמלחינים שני קולות, כתבו קודם קול אחד שלם וטוב כמנגינה עצמאית, ורק אז הוסיפו את השני. שני קווים שכל אחד יפה בפני עצמו מתלכדים כמעט תמיד טוב יותר משני קווים שנכתבו רק כדי "למלא" הרמוניה.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להזיז את שני הקולות במקביל לאורך קטע שלם, ובפרט בקווינטות או אוקטבות. תנועה מקבילה מתמדת גורמת לקולות להישמע כקול אחד מעובה במקום כשני קווים חיים. גוונו את סוגי התנועה — נגדית, אלכסונית וישרה — ושמרו את התנועה המקבילה למינון מדוד."}],quiz:[{prompt:'מהי "תנועה נגדית" בין שני קולות?',options:[{label:"קול אחד עולה בעוד השני יורד",correct:!0},{label:"שני הקולות עולים יחד באותו מרווח",correct:!1},{label:"שני הקולות נשארים על אותו צליל",correct:!1}],explanation:"בתנועה נגדית הקולות נעים בכיוונים מנוגדים. זה מדגיש את עצמאותם ומעניק למרקם הרב-קולי איזון ועושר — הכלי המרכזי לשמירה על קווים נפרדים."},{prompt:"מדוע נמנעים מקווינטות ואוקטבות מקבילות בכתיבה רב-קולית?",options:[{label:"התנועה המקבילה גורמת לשני הקולות להישמע לרגע כקול אחד",correct:!0},{label:"הן צורמות ודיסוננטיות מאוד",correct:!1},{label:"הן קשות מדי לביצוע",correct:!1}],explanation:'קווינטה ואוקטבה הם מרווחים "ריקים" ומתמזגים; כשהם נעים במקביל, שני הקולות מאבדים את זהותם הנפרדת ונשמעים כקול אחד — היפוכה של המטרה הרב-קולית.'},{prompt:'במה נבדלת כתיבה רב-קולית מ"מנגינה עם ליווי"?',options:[{label:"בכתיבה רב-קולית כל קול הוא מנגינה עצמאית בעלת ערך משלה",correct:!0},{label:"בכתיבה רב-קולית יש תמיד קול אחד בלבד",correct:!1},{label:"בכתיבה רב-קולית אין הרמוניה כלל",correct:!1}],explanation:'ב"מנגינה עם ליווי" קול אחד שולט והשאר תומכים; בכתיבה רב-קולית כל קול חי ועצמאי, בעל קונטור וכיוון משלו, והם מתלכדים להרמוניה בלי לוותר על עצמאותם.'}]},"MC-070":{sections:[{kind:"concept",icon:"🎨",heading:"אותו שיר, סגנונות שונים",body:`קחו מנגינה אחת ואקורדים אחדים — ותנו אותם למעבד ג'אז, למעבד רוק ולמעבד מוסיקה חסידית. שלושתם יחזירו לכם שלושה שירים שנשמעים שונים לחלוטין, אף שהמנגינה זהה. הסגנון אינו קישוט חיצוני; הוא מכתיב את כל ההחלטות הגדולות של העיבוד — אילו כלים ינגנו, איזה מקצב יניע את השיר, ואיזו שפה הרמונית תעטוף את המנגינה. להבין כיצד סגנון מעצב עיבוד פירושו להבין שהעיבוד הוא-הוא מה שהופך צלילים "עירומים" ליצירה בעלת זהות תרבותית מוכרת.`},{kind:"example",icon:"🎷",heading:"שלושת הצירים: כלים, מקצב והרמוניה",body:"סגנון מבטא את עצמו בעיקר בשלושה צירים. ראשית, בחירת הכלים והצליל (אינסטרומנטציה): ג'אז נשען על סקסופון, פסנתר וקונטרבס מהלך; רוק על גיטרות חשמליות, בס ותופים; פופ על סינתיסייזרים ומקצבים תכנותיים. שנית, המקצב והגרוב: הסווינג המתנדנד של הג'אז שונה מהותית מהדופק הישר והדוחף של הרוק או מהאופי המעגלי של ניגון חסידי. שלישית, השפה ההרמונית: ג'אז אוהב אקורדים מורחבים ועשירים (ספטאקורדים, נונות), פופ נוטה למהלכים פשוטים וישירים, ומוסיקה מסורתית לעיתים נצמדת להרמוניה מודלית. שינוי בכל אחד משלושת הצירים מזיז את השיר לעולם סגנוני אחר."},{kind:"notation",heading:"העשרה הרמונית ג'אזית: משולש דו מול דו עם ספטה ונונה",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"h"},{keys:["c/4","e/4","g/4","b/4","d/5"],duration:"h"}]},body:"משמאל: משולש דו מז'ור פשוט (דו־מי־סול) — עיבוד פופ/עממי. מימין: אותו יסוד עם ספטה גדולה (סי) ונונה (רה) — צבע ג'אזי עשיר. אותה הרמוניה בסיסית, שני עולמות סגנוניים."},{kind:"tip",icon:"💡",body:"רוצים ללמוד עיבוד סגנוני? קחו שיר אחד שאתם אוהבים וחפשו לו כמה גרסאות כיסוי מז'אנרים שונים. השוו: מה השתנה בכלים, מה במקצב, מה בהרמוניה. פירוק כזה מלמד על סגנון יותר מכל הגדרה תיאורטית."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:`לחשוב שסגנון הוא רק "אילו כלים מנגנים". החלפת הכלים לבדה, בלי להתאים גם את המקצב ואת השפה ההרמונית, נותנת חיקוי שטחי. ג'אז שמנוגן בגרוב ישר ובאקורדים פשוטים לא יישמע ג'אזי, גם אם יש בו סקסופון. הסגנון חי בשלושת הצירים יחד.`}],quiz:[{prompt:"מהם שלושת הצירים המרכזיים שבהם סגנון מעצב עיבוד?",options:[{label:"בחירת הכלים, המקצב/הגרוב, והשפה ההרמונית",correct:!0},{label:"עוצמה, טמפו ומספר התיבות",correct:!1},{label:"שם השיר, אורכו והמילים",correct:!1}],explanation:"סגנון מתבטא באינסטרומנטציה, במקצב ובהרמוניה. שלושתם יחד — לא אחד מהם לבדו — הם שהופכים אותה מנגינה לג'אז, לרוק או לפופ."},{prompt:"איזו שפה הרמונית אופיינית במיוחד לג'אז?",options:[{label:"אקורדים מורחבים ועשירים — ספטאקורדים ונונות",correct:!0},{label:"משולשים פשוטים בלבד ללא הרחבות",correct:!1},{label:"קול אחד בלבד ללא הרמוניה",correct:!1}],explanation:"הג'אז אוהב עושר הרמוני — ספטאקורדים, נונות וטנשנים נוספים — בעוד סגנונות כפופ נוטים למהלכים פשוטים וישירים יותר. זה חלק מרכזי מהזהות הסגנונית."},{prompt:"מדוע החלפת הכלים לבדה אינה מספיקה כדי לשנות סגנון?",options:[{label:"הסגנון חי גם במקצב ובהרמוניה, לא רק בכלים",correct:!0},{label:"משום שכל הכלים נשמעים אותו דבר",correct:!1},{label:"משום שהמנגינה חייבת להשתנות תמיד",correct:!1}],explanation:"סגנון הוא שילוב של שלושה צירים. סקסופון שמנגן בגרוב ישר ובאקורדים פשוטים לא יישמע ג'אזי — צריך להתאים גם את המקצב וגם את השפה ההרמונית."}]},"MC-092":{sections:[{kind:"concept",icon:"📉",heading:"מהי קלישאה קווית?",body:`קלישאה קווית (line cliché) היא תבנית הרמונית שבה האקורד נשאר לכאורה קבוע, אך קול אחד בתוכו — לרוב הקול העליון או קול פנימי — זז בצעדים קטנים, לרוב במורד כרומטי. התוצאה מרהיבה: הבסיס יציב ומוכר, אך מעליו נשמעת תנועה עדינה ומתמשכת שיוצרת מתח מתגלגל ותחושת התקדמות. זהו אחד הטריקים האהובים בפופ, בג'אז ובבלדות — הקשיבו לפתיחות רבות של שירים איטיים ותשמעו את הקול היורד הזה מתחת לאקורד שנראה "תקוע" במקום.`},{kind:"example",icon:"🎹",heading:"הדוגמה הקלאסית: היורד הכרומטי מעל דו",body:`התבנית המפורסמת ביותר בנויה מעל אקורד דו מז'ור, כשהקול העליון יורד כרומטית: דו → סי → סי-במול → לה. כל צליל בקו היורד יוצר איכות אקורד אחרת מעל אותו בס דו: דו נותן אקורד דו רגיל; סי הופך אותו ל-Cmaj7 (עם ספטה גדולה); סי-במול ל-C7 (ספטה קטנה — צבע דומיננטי); ולה ל-C6 (סקסטה). ארבעת האקורדים חולקים בס וטרצה משותפים, וכל מה שזז הוא הקול העליון היורד. זו ה"מיקסטורה" — רצף שבו קול נע יוצר שרשרת של איכויות אקורד מתחלפות מעל יסוד קבוע.`},{kind:"notation",heading:"קלישאה קווית מעל דו: C → Cmaj7 → C7 → C6",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4","e/4","g/4","c/5"],duration:"q"},{keys:["c/4","e/4","g/4","b/4"],duration:"q"},{keys:["c/4","e/4","g/4","bb/4"],duration:"q"},{keys:["c/4","e/4","g/4","a/4"],duration:"q"}]},body:"הבס (דו), הטרצה (מי) והקווינטה (סול) נשמרים קבועים; הקול העליון יורד כרומטית: דו־סי־סי־במול־לה. כך נוצרת השרשרת דו → Cmaj7 → C7 → C6."},{kind:"tip",icon:"💡",body:"כתבו את שם האקורד המשתנה מעל כל צליל בקו היורד — C, Cmaj7, C7, C6. לראות איך צליל בודד שזז משנה את שם האקורד כולו הוא הדרך המהירה להפנים איך תנועת קול אחד יוצרת הרמוניה שלמה שמתפתחת."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לחשוב שכל אקורד בשרשרת דורש בס חדש. סוד הקלישאה הקווית הוא בדיוק ההפך: הבס נשאר קבוע, ורק קול אחד זז. אם מזיזים את כל הקולות או מחליפים בס, מאבדים את האפקט של "מקום יציב שמעליו משהו נע" — וזה בדיוק היופי של התבנית.'}],quiz:[{prompt:'מה מאפיין "קלישאה קווית" (line cliché)?',options:[{label:"הבס נשאר קבוע וקול אחד זז בצעדים קטנים, לרוב במורד כרומטי",correct:!0},{label:"כל הקולות זזים יחד לאקורד חדש לגמרי",correct:!1},{label:"המנגינה נעצרת בעוד האקורדים משתנים במהירות",correct:!1}],explanation:"בקלישאה קווית היסוד יציב וקול בודד נע (לרוב כרומטית כלפי מטה). התנועה של אותו קול יחיד היא שיוצרת את שרשרת האקורדים המתחלפת מעל בס קבוע."},{prompt:"בתבנית דו → Cmaj7 → C7 → C6, מהו הקו שיורד בקול העליון?",options:[{label:"דו → סי → סי-במול → לה",correct:!0},{label:"דו → רה → מי → פה",correct:!1},{label:"סול → פה → מי → רה",correct:!1}],explanation:"הקול העליון יורד כרומטית: דו (אקורד דו), סי (Cmaj7 — ספטה גדולה), סי-במול (C7 — ספטה קטנה) ולה 
4080(C6 — סקסטה), בעוד הבס והטרצה נשארים."},{prompt:"איזה אקורד נוצר כשהקול העליון מגיע לסי-במול מעל בס דו?",options:[{label:"C7 — אקורד דו עם ספטה קטנה",correct:!0},{label:"Cmaj7 — אקורד דו עם ספטה גדולה",correct:!1},{label:"דו מינור",correct:!1}],explanation:"סי-במול הוא הספטה הקטנה מעל דו, ולכן דו־מי־סול־סי-במול הוא C7 (אקורד דומיננטי) — הצבע השלישי בשרשרת היורדת, בין Cmaj7 ל-C6."}]},"MC-022":{sections:[{kind:"concept",icon:"🏛️",heading:"ארבעה צלילים, ארבעה סידורים",body:"אקורד ספטאקורד (אקורד מרובע) בנוי מארבעה צלילים: יסוד, טרצה, קווינטה וספטה. כשכל ארבעת הצלילים מונחים, אנחנו יכולים לבחור מי מהם יהיה הצליל התחתון (הבס) — וכל בחירה כזו נקראת היפוך. אקורד ספטאקורד, בהיותו בן ארבעה צלילים, מציע ארבעה סידורים אפשריים: מצב יסוד ושלושה היפוכים. אותם ארבעה צלילים בדיוק בכל הסידורים — מה שמשתנה הוא רק איזה צליל יושב בתחתית, וזה משנה את צבע האקורד ואת תפקידו במהלך."},{kind:"concept",icon:"🎯",heading:"הכלל: הצליל בבס קובע את שם ההיפוך",body:'הזיהוי פשוט אם זוכרים כלל אחד — הצליל שנמצא בבס (התחתון) הוא שקובע את שם ההיפוך. במצב יסוד היסוד בבס. בהיפוך ראשון הטרצה בבס. בהיפוך שני הקווינטה בבס. בהיפוך שלישי — הייחודי לאקורדים מרובעים — הספטה בבס. קחו לדוגמה את סול7 (G7): צליליו הם סול־סי־רה־פה. במצב יסוד סול בבס; בהיפוך ראשון סי בבס; בהיפוך שני רה בבס; ובהיפוך שלישי פה בבס. שאלו תמיד "איזה צליל למטה?", זהו את תפקידו באקורד, וכך תדעו מיד באיזה היפוך אתם.'},{kind:"notation",heading:"סול7 והיפוכיו — שימו לב לצליל בבס בכל אקורד",notation:{clef:"treble",notes:[{keys:["g/3","b/3","d/4","f/4"],duration:"q"},{keys:["b/3","d/4","f/4","g/4"],duration:"q"},{keys:["d/4","f/4","g/4","b/4"],duration:"q"},{keys:["f/4","g/4","b/4","d/5"],duration:"q"}]},body:"מצב יסוד (סול בבס), היפוך ראשון (סי בבס), היפוך שני (רה בבס), היפוך שלישי (פה בבס). אותם ארבעה צלילים — סול־סי־רה־פה — רק הבס משתנה."},{kind:"tip",icon:"💡",body:`לפני שמפרקים ספטאקורד לארפג'יו, שירו את ארבעת הצלילים במצב יסוד מלמטה למעלה: יסוד־טרצה־קווינטה־ספטה. כשהרצף הזה יושב באוזן, כל היפוך הוא פשוט "אותה שרשרת שמתחילה מצליל אחר" — וקל הרבה יותר לנגן ולזהות.`},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לזהות היפוך לפי הצליל העליון במקום לפי הבס. שם ההיפוך נקבע אך ורק מהצליל התחתון — לא מהצליל הגבוה ולא מהצליל שבמנגינה. אקורד שהספטה שלו בבס הוא היפוך שלישי, גם אם היסוד מופיע גבוה למעלה."}],quiz:[{prompt:"איזה צליל נמצא בבס בהיפוך הראשון של אקורד ספטאקורד?",options:[{label:"הטרצה",correct:!0},{label:"היסוד",correct:!1},{label:"הספטה",correct:!1}],explanation:"שם ההיפוך נקבע לפי הצליל בבס: מצב יסוד = יסוד בבס, היפוך ראשון = טרצה בבס, היפוך שני = קווינטה, היפוך שלישי = ספטה."},{prompt:"באקורד סול7 (סול־סי־רה־פה), איזה צליל יושב בבס בהיפוך השלישי?",options:[{label:"פה 
4080(הספטה)",correct:!0},{label:"סול (היסוד)",correct:!1},{label:"רה (הקווינטה)",correct:!1}],explanation:"ההיפוך השלישי, הייחודי לאקורדים מרובעים, מציב את הספטה בבס. בסול7 הספטה היא פה — ולכן פה בתחתית."},{prompt:"כמה היפוכים אפשריים יש לאקורד ספטאקורד, ומדוע?",options:[{label:"שלושה היפוכים (בנוסף למצב היסוד), כי יש בו ארבעה צלילים",correct:!0},{label:"שני היפוכים, כמו במשולש",correct:!1},{label:"ארבעה היפוכים בנוסף למצב היסוד",correct:!1}],explanation:"לאקורד בן ארבעה צלילים יש ארבעה סידורים אפשריים: מצב יסוד ושלושה היפוכים — כל צליל יכול לתורו לשבת בבס."}]},"MC-028":{sections:[{kind:"concept",icon:"👂",heading:"לשמוע תפקיד, לא רק צליל",body:'פיתוח שמיעה הרמונית הוא היכולת לשמוע אקורד או מהלך אקורדים ולזהות לא רק את הצלילים הבודדים, אלא את התפקיד ההרמוני — האם זהו אקורד "בית" יציב, אקורד שדוחף קדימה ומבקש פתרון, או אקורד ביניים. בעוד שמיעה מלודית עוסקת בקו אחד, שמיעה הרמונית עוסקת בצלילים המתנגנים יחד ובמתח ביניהם. מוח מאומן מפסיק לשאול "אילו צלילים" ומתחיל לשאול "לאן זה מושך" — ובכך תופס את הדרמה של ההרמוניה עצמה.'},{kind:"concept",icon:"🧭",heading:"שלוש הדרגות שמארגנות הכול: טוניקה, סאב-דומיננטה, דומיננטה",body:'הבסיס לשמיעה הרמונית הוא לזהות שלושה תפקידים מרכזיים. הטוניקה (דרגה I) היא הבית — יציבה, רגועה, נקודת המנוחה. הדומיננטה (דרגה V) היא המתח — היא דוחפת בעוצמה חזרה אל הטוניקה, וזיהוי המשיכה הזו הוא המפתח. הסאב-דומיננטה (דרגה IV) היא ביניים — היא מרחיקה מהבית אך בעדינות, לא במתח החד של הדומיננטה. כשלומדים לשמוע את שלושת התפקידים ואת התנועה ביניהם (למשל הקדנצה I–IV–V–I), ההרמוניה מפסיקה להיות "ערפל של צלילים" והופכת לסיפור עם כיוון.'},{kind:"notation",heading:"מהלך I–IV–V–I בדו מז'ור — הקשיבו לתפקיד כל אקורד",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["c/4","f/4","a/4"],duration:"q"},{keys:["b/3","d/4","g/4"],duration:"q"},{keys:["c/4","e/4","g/4"],duration:"q"}]},body:'דו (I, בית) → פה (IV, מתרחק) → סול (V, מתח שדוחף) → דו (I, פתרון). הקשיבו איך הדומיננטה "מבקשת" לחזור הביתה.'},{kind:"tip",icon:"💡",body:"לפני שמנסים לזהות אקורד בודד, זהו קודם את הבס — הצליל התחתון. תנועת הבס לבדה מגלה חלק גדול מהתפקוד ההרמוני: קפיצה של קווינטה בבס כמעט תמיד מסמנת מהלך דומיננטה–טוניקה. הבס הוא המצפן של השמיעה ההרמונית."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנסות לזהות כל צליל בנפרד בתוך אקורד במקום לתפוס את התפקיד השלם. שמיעה הרמונית אינה תרגיל בפירוק — היא זיהוי של גשטלט, של איכות ותפקוד. נסו לשמוע "יציב/מתוח/מתרחק" לפני שאתם סופרים צלילים.'}],quiz:[{prompt:"מהו התפקיד ההרמוני של אקורד הדומיננטה (V)?",options:[{label:"ליצור מתח שדוחף לפתרון חזרה אל הטוניקה",correct:!0},{label:"לשמש נקודת מנוחה יציבה",correct:!1},{label:"להישאר ניטרלי ללא כיוון",correct:!1}],explanation:"הדומיננטה היא אקורד המתח: היא מושכת בעוצמה חזרה אל הטוניקה. זיהוי המשיכה הזו הוא הליבה של שמיעה הרמונית."},{prompt:"מהו כלי העזר החזק ביותר לזיהוי תפקוד הרמוני באוזן?",options:[{label:"להקשיב לתנועת הבס — הצליל התחתון",correct:!0},{label:"לספור את מספר הצלילים בכל אקורד",correct:!1},{label:"לזהות תמיד קודם את הצליל הגבוה ביותר",correct:!1}],explanation:"תנועת הבס חושפת את התפקוד: קפיצת קווינטה בבס מסמנת דומיננטה–טוניקה. הבס הוא המצפן שמכוון את השמיעה ההרמונית."}]},"MC-031":{sections:[{kind:"concept",icon:"🎵",heading:"שתי שמיניות בכל פעימה",body:'במשקל פשוט כל פעימה (רבע) מתחלקת לשתי שמיניות שוות. שתי שמיניות ממלאות בדיוק פעימה אחת — "אחת־וֶ, שתיים־וֶ". השמינית היא לבנת-הבניין שמאפשרת למקצב לזוז מהר יותר מפעימה בסיסית, והדרך שבה אנחנו מקבצים ומחברים שמיניות היא שקובעת את התחושה הריתמית של המנגינה. הבנת חלוקת הפעימה לשמיניות היא הצעד הראשון לקרוא ולנגן כל מקצב חי ומתנועע.'},{kind:"concept",icon:"🔗",heading:"זוגות מקושרים מול רצף מתמשך",body:'לשמיניות יש שתי "אישיות" ריתמיות שכדאי להבחין ביניהן. זוגות שמיניות מקושרים — שתי שמיניות מחוברות בקורת חיבור אחת בתוך פעימה — מדגישים את הפעימה: העין והאוזן קולטות "פעימה, פעימה, פעימה", כל אחת מחולקת לשתיים. לעומתם, רצף מתמשך של שמיניות (ריצה) מחובר לאורך כמה פעימות ויוצר תחושת זרימה ותנופה קדימה, שבה הפעימות הפנימיות נבלעות בתנועה. אותו מספר שמיניות בדיוק — אך הקיבוץ קובע אם המקצב "צועד" בזוגות או "רץ" ברצף.'},{kind:"notation",heading:"זוגות שמיניות מקושרים (4/4)",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["e/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["g/4"],duration:"8"}]},body:'שמונה שמיניות = ארבע פעימות, מקובצות בזוגות של שתיים. ספרו "אחת־וֶ, שתיים־וֶ, שלוש־וֶ, ארבע־וֶ" — כל זוג מדגיש פעימה.'},{kind:"notation",heading:"אותן שמיניות כרצף רץ מתמשך (4/4)",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"8"},{keys:["d/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["f/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["a/4"],duration:"8"},{keys:["b/4"],duration:"8"},{keys:["c/5"],duration:"8"}]},body:'אותן שמונה שמיניות (ארבע פעימות), אך כרצף עולה מתמשך — התחושה היא "ריצה" זורמת קדימה, לא צעידה בזוגות.'},{kind:"tip",icon:"💡",body:'כשקוראים שמיניות, השתמשו בהברת ה"וֶ": "אחת־וֶ־שתיים־וֶ". ה"וֶ" נופל בדיוק על השמינית השנייה בכל פעימה. הברה עקבית זו שומרת על השמיניות שוות ומונעת מהן "לזחול" ולהתקצר.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנגן את השמינית השנייה בכל זוג מוקדם מדי, כך שהיא "נדבקת" לראשונה. שתי השמיניות בפעימה חייבות להיות שוות באורכן בדיוק. הנטייה לחפוז אל הפעימה הבאה מקצרת את השמינית השנייה ומעוותת את המקצב.'}],quiz:[{prompt:"כמה שמיניות ממלאות פעימת רבע אחת במשקל פשוט?",options:[{label:"שתיים, שוות באורכן",correct:!0},{label:"שלוש, שוות באורכן",correct:!1},{label:"ארבע, שוות באורכן",correct:!1}],explanation:'במשקל פשוט הרבע מתחלק לשתי שמיניות שוות — "אחת־וֶ". שלוש שמיניות בפעימה היא כבר חלוקה מורכבת.'},{prompt:"מה ההבדל בתחושה בין זוגות שמיניות מקושרים לבין רצף שמיניות מתמשך?",options:[{label:"הזוגות מדגישים את הפעימה; הרצף יוצר תחושת זרימה ותנופה",correct:!0},{label:"הזוגות מהירים יותר מהרצף",correct:!1},{label:"אין הבדל — הקיבוץ אינו משפיע",correct:!1}],explanation:'אותו מספר שמיניות, אך הקיבוץ קובע את התחושה: זוגות של שתיים "צועדים" ומדגישים כל פעימה, ורצף מתמשך "רץ" וזורם קדימה.'}]},"MC-041":{sections:[{kind:"concept",icon:"🎹",heading:"מנגינה ביד אחת, אקורדים בשנייה",body:"נגינת שיר מוכר היא לרוב חיבור של שני רבדים: מנגינה — הקו שהזמר שר — ואקורדי ליווי שתומכים בה מתחת. במודל הפשוט והנפוץ ביותר, יד ימין מנגנת את המנגינה ויד שמאל מנגנת אקורדים בסיסיים. היופי הוא שרוב השירים המוכרים בנויים על מספר קטן מאוד של אקורדים — לעיתים קרובות שלושה בלבד — ולכן ברגע שאתם שולטים באותם שלושה אקורדים, נפתח בפניכם רפרטואר עצום של שירים לנגן."},{kind:"concept",icon:"🔑",heading:"שלושת האקורדים הראשיים: I, IV, V",body:"הבסיס של אינספור שירים הוא שלושת האקורדים הראשיים של הסולם: הטוניקה (I), הסאב-דומיננטה (IV) והדומיננטה (V). בדו מז'ור אלה דו (דו־מי־סול), פה (פה־לה־דו) וסול (סול־סי־רה). שלושה אקורדים אלה מכסים את כל שבעת צלילי הסולם, ולכן כמעט כל מנגינה דיאטונית פשוטה יכולה להתלוות באחד מהם. הכלל המעשי: לכל צליל מנגינה, בחרו את האקורד הראשי שמכיל אותו — וכך תבנו ליווי שמתיישב טבעי מתחת לשיר."},{kind:"notation",heading:"מנגינה פשוטה עם אקורדי הליווי I–IV–V–I בדו מז'ור",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4","e/4","g/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["f/4","a/4","c/5"],duration:"8"},{keys:["a/4"],duration:"8"},{keys:["g/4","b/4","d/5"],duration:"8"},{keys:["d/5"],duration:"8"},{keys:["c/4","e/4","g/4"],duration:"8"},{keys:["c/5"],duration:"8"}]},body:"כל פעימה מציגה אקורד ליווי (שמינית) ואז צליל מנגינה מעליו: דו (I), פה (IV), סול (V), דו (I). האקורד מכיל תמיד את צליל המנגינה שאחריו."},{kind:"tip",icon:"💡",body:"התחילו בגרסת ליווי הפשוטה ביותר: אקורד אחד בכל תיבה, בפעימה הראשונה בלבד. כשהחיבור בין המנגינה לאקורד יציב, אפשר להעשיר — לפרק את האקורד, להוסיף בס, למקצב. אבל קודם כול, שיהיה נכון ופשוט."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להחליף אקורד על כל צליל מנגינה. אקורד אחד יכול לתמוך בכמה צלילי מנגינה — לרוב אקורד אחד לתיבה שלמה מספיק לשירים פשוטים. החלפה מהירה מדי של אקורדים הופכת את הליווי לעמוס, מבלבל וקשה לביצוע."}],quiz:[{prompt:"מהם שלושת האקורדים הראשיים שעליהם בנויים שירים פשוטים רבים?",options:[{label:"הטוניקה (I), הסאב-דומיננטה (IV) והדומיננטה (V)",correct:!0},{label:"רק אקורדים מינוריים",correct:!1},{label:"שלושה ספטאקורדים",correct:!1}],explanation:"I, IV ו-V הם שלושת האקורדים הראשיים; יחד הם מכסים את כל שבעת צלילי הסולם, ולכן די בה×
4080 לליווי כמעט כל מנגינה דיאטונית פשוטה."},{prompt:"כיצד בוחרים אקורד ליווי מתאים לצליל מנגינה?",options:[{label:"בוחרים אקורד ראשי שמכיל את צליל המנגינה",correct:!0},{label:"בוחרים אקורד אקראי בכל פעימה",correct:!1},{label:"מחליפים אקורד בכל צליל בודד",correct:!1}],explanation:"אקורד ליווי טוב מכיל את צליל המנגינה שמעליו, כך שהם מתמזגים. אקורד אחד יכול לשרת כמה צלילי מנגינה — אין צורך להחליף על כל צליל."}]},"MC-042":{sections:[{kind:"concept",icon:"🎼",heading:"להאזין החוצה, לא רק פנימה",body:'נגינה קבוצתית היא מיומנות שונה מהותית מנגינת סולו. בסולו אתם מקשיבים לעצמכם; בהרכב, האוזן חייבת להאזין החוצה — אל שאר המנגנים — לא פחות מאשר אל הנגינה שלכם. המטרה אינה שכל נגן ישמע נהדר בנפרד, אלא שכל הקולות יתמזגו לצליל אחד מלוכד. זה דורש נדיבות: לפעמים לנגן חלש יותר כדי לפנות מקום, לפעמים לוותר על "בלט" אישי למען המכלול. הרכב טוב נשמע כמו גוף אחד שנושם יחד, לא כאוסף של סולנים.'},{kind:"concept",icon:"⏱️",heading:"זמן משותף, איזון והקשבה",body:'שלושה עמודי תווך מחזיקים הרכב. הראשון הוא זמן משותף — הדופק חייב להיות משותף לכולם; במקום שכל אחד "ירגיש" את הטמפו לעצמו, ההרכב נועל יחד על אותה פעימה, לרוב מתוך הקשבה לבס ולכלי הקצב. השני הוא איזון (בלנס) — לוודא שאף קול אינו מכסה על השני, ושהמנגינה המובילה נשמעת מעל הליווי. השלישי הוא הקשבה הדדית מתמדת — לתקן בזמן אמת, לזוז יחד בעליות ובירידות של עוצמה, ולסיים משפטים באותו רגע. שלושתם נבנים רק דרך תרגול משותף, לא לבד בבית.'},{kind:"tip",icon:"💡",body:'בחזרות, נסו מדי פעם לנגן את החלק שלכם בעוצמה חלשה במיוחד ולהאזין לשאר ההרכב. תרגיל זה מאלץ אתכם לצאת מ"הבועה" של עצמכם ולשמוע כיצד החלק שלכם משתלב במכלול — הבסיס לכל נגינה קבוצתית טובה.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנגן חזק ומהיר כדי "להוביל", ובכך למשוך את כל ההרכב אחריכם או לכסות עליו. נגינה קבוצתית אינה תחרות. נגן שמאיץ או מתגבר בלי להקשיב שובר את הזמן המשותף ואת האיזון — גם אם הנגינה שלו עצמה מדויקת. ההרכב תמיד קודם לאגו.'}],quiz:[{prompt:"מהי המיומנות המרכזית שמבדילה נגינה קבוצתית מנגינת סולו?",options:[{label:"להאזין החוצה אל שאר המנגנים ולהתמזג עמם",correct:!0},{label:"לנגן חזק ככל האפשר כדי לבלוט",correct:!1},{label:"להאיץ את הטמפו כדי להוביל",correct:!1}],explanation:"בהרכב האוזן מאזינה החוצה, אל האחרים, כדי שכל הקולות יתמזגו לצליל אחד מלוכד — זו נדיבות, לא בליטה אישית."},{prompt:'מהו "זמן משותף" בהרכב?',options:[{label:"דופק אחד שכל המנגנים נועלים עליו יחד",correct:!0},{label:"כל נגן מרגיש את הטמפו שלו בנפרד",correct:!1},{label:"להאיץ בהדרגה לאורך היצירה",correct:!1}],explanation:"זמן משותף פירושו שכל ההרכב מתלכד על פעימה אחת, לרוב מתוך הקשבה לבס ולכלי הקצב — בלעדיו ההרכב מתפרק לזמנים נפרדים."}]},"MC-061":{sections:[{kind:"concept",icon:"🎸",heading:"הבס — היסוד שמניע את ההרמוניה",body:'קו הבס הוא הצליל התחתון של המרקם, ולרוב הוא היסוד של האקורד באותו רגע. לשיר את קו הבס פירושו לשיר את שרשרת היסודות של האקורדים — למשל דו־פה־סול־דו במהלך I–IV–V–I. תרגול זה חזק במיוחד לפיתוח שמיעה הרמונית, כי הבס הוא שקובע את התחושה ההרמונית: אותם צלילים עליונים מעל בס שונה נשמעים כאקורד אחר לגמרי. מי ששר בס לומד לשמוע את "השלד" של ההרמוניה, את התנועה של היסודות שמניעה את כל המהלך קדימה.'},{kind:"concept",icon:"📐",heading:"לספור מבנה: תיבות, משפטים וצורה",body:'לצד שירת הבס עומדת ספירת המבנה — היכולת לדעת תמיד "היכן אנחנו" בתוך היצירה. מוסיקה מאורגנת ביחידות: תיבות מתקבצות למשפטים (לרוב 4 או 8 תיבות), ומשפטים מתקבצים לחלקים (בית, פזמון). מוזיקאי מיומן סופר ברקע — "1, 2, 3, 4 | 2, 2, 3, 4..." — ויודע מתי מתקרב סוף המשפט ומתי נכנס חלק חדש. ספירת מבנה היא מה שמאפשר להיכנס בזמן, לצפות שינויים ולנגן עם אחרים בביטחון: הבס נותן את ה"מה" ההרמוני, והספירה נותנת את ה"מתי" המבני.'},{kind:"notation",heading:"קו בס — יסודות האקורדים במהלך I–IV–V–I (מפתח בס)",notation:{clef:"bass",timeSignature:"4/4",notes:[{keys:["c/2"],duration:"q"},{keys:["f/2"],duration:"q"},{keys:["g/2"],duration:"q"},{keys:["c/2"],duration:"q"}]},body:'ארבעה יסודות: דו (I), פה (IV), סול (V), דו (I) — צליל אחד לכל פעימה, תיבה אחת ב-4/4. שירו אותם ותרגישו את "השלד" של המהלך ההרמוני.'},{kind:"tip",icon:"💡",body:'שירו את קו הבס תוך כדי ספירה קולית של הפעימות: "דו-2-3-4, פה-2-3-4...". שילוב הבס עם הספירה מחבר בבת אחת את ה"מה" ההרמוני עם ה"מתי" המבני — שני הכלים שהופכים מאזין לשותף פעיל בהרכב.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לשיר בס נכון אך "לאבד את הספירה" ולא לדעת באיזו תיבה אתם. הרמוניה נכונה בלי מודעות למבנה מובילה לכניסות באיחור ולהיפרדות מההרכב. ספירת המבנה חייבת לרוץ ברקע כל הזמן — היא המפה, גם כשהאוזן עסוקה בבס.'}],quiz:[{prompt:"איזה צליל של האקורד שר בדרך כלל קו הבס?",options:[{label:"היסוד של האקורד",correct:!0},{label:"הצליל הגבוה ביותר במנגינה",correct:!1},{label:"הספטה של האקורד",correct:!1}],explanation:'קו הבס נושא לרוב את יסוד האקורד. שרשרת היסודות (למשל דו־פה־סול־דו) היא "השלד" ההרמוני שמניע את המהלך.'},{prompt:"מדוע שירת הבס חשובה לפיתוח שמיעה הרמונית?",options:[{label:"הבס קובע את התחושה ההרמונית — אותם צלילים עליונים מעל בס שונה הם אקורד אחר",correct:!0},{label:"הבס תמיד הצליל הרם ביותר",correct:!1},{label:"שירת הבס מחליפה את הצורך לספור מבנה",correct:!1}],explanation:"הבס הוא היסוד שקובע איזה אקורד נשמע: שנו את הבס מתחת לאותם צלילים עליונים ותקבלו אקורד אחר. שירתו מלמדת לשמוע את שלד ההרמוניה."},{prompt:"לכמה תיבות מתקבץ בדרך כלל משפט מוסיקלי?",options:[{label:"4 או 8 תיבות",correct:!0},{label:"תיבה אחת בלבד",correct:!1},{label:"13 תיבות",correct:!1}],explanation:"מוסיקה מאורגנת ביחידות: תיבות מתקבצות למשפטים של 4 או 8 תיבות, ואלה לחלקים. ספירת מבנה מאפשרת לדעת תמיד היכן אנחנו ביצירה."}]},"MC-043":{sections:[{kind:"concept",icon:"🎤",heading:"מהי נוכחות בימתית?",body:'נוכחות בימתית היא היכולת להעביר מוסיקה לקהל — לא רק לנגן נכון, אלא לתקשר. אותה יצירה בדיוק יכולה להישמע כתרגיל טכני מרוחק או כרגע חי ונושם, וההבדל אינו בתווים אלא במה שהמבַצע משדר: ריכוז, ביטחון, נכונות "לתת" משהו לאנשים שיושבים מולו. הבמה אינה חדר תרגול מוגדל — היא מצב תקשורתי. הקהל אינו שופט טכני שסופר טעויות, אלא בני אדם שבאו לחוות משהו, וכשהמבַצע זוכר זאת, הפחד מתחיל להתחלף בכוונה.'},{kind:"concept",icon:"🧘",heading:"חרדת במה — להבין ולנתב",body:'הלמות הלב, הידיים הקרות ותחושת ה"ריק" לפני עלייה לבמה הן תגובה פיזיולוגית טבעית — שחרור אדרנלין, בדיוק כמו לפני כל מאמץ חשוב. המטרה אינה "להיפטר" מהמתח אלא לנתב אותו לאנרגיה. שלושה כלים מוכחים: נשימה איטית ועמוקה שמרגיעה את מערכת העצבים; הכנה יסודית עד שהחומר "יושב בגוף" ואינו תלוי בזיכרון מודע; והסטת המיקוד מ"מה יחשבו עליי" אל "מה אני רוצה להעביר". חרדה מוגזמת כמעט תמיד נובעת מהתמקדות בעצמי; היא נחלשת ברגע שהתשומת לב עוברת אל המוסיקה ואל הקהל.'},{kind:"example",icon:"🤝",heading:"תקשורת עם הקהל",body:'ביצוע בימתי הוא דיאלוג, גם כשרק צד אחד מנגן. קשר עין, שפת גוף פתוחה, נשימה משותפת עם המוסיקה — כל אלה אומרים לקהל "אני כאן, איתכם". גם הרגעים שבין היצירות חשובים: כניסה בטוחה לבמה, השהיה קצרה לפני הצליל הראשון, ומחווה מסכמת בסוף, בונים אמון. מבַצע שמנגן "בתוך בועה" מנתק את הקהל, בעוד שמבַצע שמזמין את הקהל פנימה — ולו במבט אחד — הופך שורה של אנשים זרים לחוויה משותפת אחת.'},{kind:"tip",icon:"💡",body:"הטעות אינה הסוף. אם נופל צליל — המשיכו כאילו כלום, בלי הבעת פנים של אסון. הקהל כמעט תמיד לא שם לב לפליטה קטנה, אבל הוא בהחלט מבחין בפרצוף המבוהל שאחריה. ההתאוששות השקטה היא סימן ההיכר של מבַצע בשל."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שהכנה מוסיקלית מושלמת מספיקה לבדה, ולהזניח את ההכנה הבימתית. נגן שמעולם לא התאמן לעמוד מול קהל יגלה שהגוף מגיב אחרת לגמרי על הבמה. הפתרון הוא לחזור ולבצע מול אנשים — חברים, משפחה, הקלטה — כדי שהבמה תהפוך למוכרת ולא מאיימת."}],quiz:[{prompt:"מהי הגישה היעילה ביותר להתמודדות עם חרדת במה?",options:[{label:'לנתב את המתח לאנרגיה ולהסיט את המיקוד מ"עצמי" אל המוסיקה והקהל',correct:!0},{label:"לנסות לדכא לגמרי כל תחושת התרגשות לפני הביצוע",correct:!1},{label:"להימנע מהופעות עד שהחרדה תיעלם מעצמה",correct:!1}],explanation:'חרדת במה היא תגובה פיזיולוגית טבעית שאי אפשר "לכבות". המבַצע הבשל מנתב אותה לאנרגיה, נושם, ומסיט את הקשב מהחשש העצמי אל מה שהוא רוצה להעביר.'},{prompt:"מה עדיף לעשות כאשר נופל צליל שגוי באמצע הופעה?",options:[{label:"להמשיך בזרימה בלי להסגיר במבט או בהבעה שקרתה טעות",correct:!0},{label:"לעצור, להתנצל בפני הקהל ולחזור לתחילת הקטע",correct:!1},{label:"להראות בהבעת הפנים שהצליל היה שגוי",correct:!1}],explanation:"הקהל לרוב אינו מבחין בפליטה קטנה, אך כן מבחין בתגובת הבהלה שאחריה. התאוששות שקטה והמשך זורם הם סימן ההיכר של מבַצע מנוסה."},{prompt:"מה הופך ביצוע לתקשורת עם הקהל ולא רק לנגינה נכונה?",options:[{label:"קשר עין, שפת גוף פתוחה וכוונה להעביר משהו לקהל",correct:!0},{label:"נגינה מהירה ומורכבת ככל האפשר",correct:!1},{label:"התמקדות מלאה בתווים תוך התעלמות מהקהל",correct:!1}],explanation:"ביצוע בימתי הוא דיאלוג. קשר עין, שפת גוף וכוונה תקשורתית מזמינים את הקהל פנימה והופכים אוסף אנשים זרים לחוויה משותפת."}]},"MC-053":{sections:[{kind:"concept",icon:"✍️",heading:"מילים שהן גם מוסיקה",body:'כתיבת טקסט לשיר אינה כתיבת שירה על הנייר בלבד — היא כתיבה שנועדה להישמע, להישיר ולהתלבש על מנגינה. הטקסט הטוב נושא שני מטענים בבת אחת: משמעות (מה נאמר) ומוסיקליות (איך זה נשמע). המילים עצמן נושאות מקצב פנימי — ריבוי הברות, מקומות ההטעמה, אורך התנועות — וכל אלה חייבים לשבת בנוחות על הפעימות של הלחן. שורה שנקראת יפה בעין עלולה "להיתקע" בפה כשמנסים לשיר אותה; ולכן כותב טקסטים טוב בודק כל שורה בקול, לא רק בעין.'},{kind:"concept",icon:"🎵",heading:"מקצב המילים והתאמה ללחן",body:'לב-ליבה של כתיבת טקסט הוא ההתאמה בין הטעמת המילים להטעמת הלחן. בעברית ובכל שפה יש להברות דגש טבעי — "שָׁלוֹם" מודגש בהברה השנייה — וכשההברה המודגשת נופלת על פעימה חלשה, המילה נשמעת "עקומה" ולא טבעית. לכן כותבים לרוב מתאימים את מספר ההברות בכל שורה ואת מיקום ההטעמות כך שיזרמו עם המנגינה. פזמון קליט כמעט תמיד נשען על מקצב מילים ברור וחוזר, שהאוזן יכולה לחזות ולזכור.'},{kind:"example",icon:"🔗",heading:"חריזה ומבנה",body:"החריזה היא כלי מבני רב-עוצמה: היא מקשרת בין סופי שורות, יוצרת תחושת סגירה וצפייה, ומסייעת לזיכרון. תבניות נפוצות הן חריזה מסורגת (א-ב-א-ב) או זוגית (א-א-ב-ב), אך אין חובה לחרוז בכל שורה — חריזה כפויה מדי נשמעת מאולצת ופוגעת במשמעות. מבנה שיר טיפוסי בנוי מבתים (שמקדמים את הסיפור, לרוב עם מנגינה זהה ומילים משתנות) ומפזמון (שחוזר על עצמו, נושא את המסר המרכזי). המתח הבריא בין חופש המשמעות למשמעת החריזה והמבנה הוא שמפריד בין טקסט חובבני לטקסט שנשאר באוזן."},{kind:"tip",ic
4080on:"💡",body:'כתבו קודם את הרעש, אחר כך את המילים. נסו "לזמזם" את מקצב השורה בהברות שטות (לה-לה-לה) עד שהתחושה הריתמית מדויקת, ורק אז מלאו את התוכן במילים אמיתיות שמתאימות למקצב הזה. כך המילים משרתות את הזרימה במקום להיאבק בה.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לכתוב שורה יפה על הדף ולהניח שהיא תעבוד בשירה. אם ההברה המודגשת של מילה נופלת על פעימה חלשה, או אם השורה ארוכה מדי לנשימה אחת, היא תישבר בפה. תמיד בדקו את הטקסט בשירה בקול מול הלחן — לא בקריאה שקטה."}],quiz:[{prompt:"מהי הבחינה החשובה ביותר בכתיבת טקסט לשיר, שמבדילה אותה מכתיבת שירה רגילה?",options:[{label:"התאמת מקצב המילים והטעמתן ללחן — הטקסט נועד להישמע ולהישיר",correct:!0},{label:"שהטקסט יהיה ארוך ומורכב ככל האפשר",correct:!1},{label:"שכל שורה תסתיים במילה נדירה ומרשימה",correct:!1}],explanation:'טקסט לשיר נכתב כדי להישיר על לחן. ההברות המודגשות של המילים חייבות לשבת על הפעימות החזקות של המנגינה, אחרת המילים נשמעות "עקומות".'},{prompt:"מדוע לא כדאי לכפות חריזה על כל שורה בשיר?",options:[{label:"חריזה כפויה נשמעת מאולצת ופוגעת במשמעות",correct:!0},{label:"חריזה אסורה לחלוטין בשירים מודרניים",correct:!1},{label:"חריזה מקשה על הזיכרון של הפזמון",correct:!1}],explanation:"חריזה היא כלי מבני חזק המסייע לזיכרון ולסגירה, אך כשהיא נכפית בכל מחיר היא מאלצת בחירת מילים לא טבעית ופוגעת בתוכן. איזון בין משמעות למבנה הוא המפתח."}]},"MC-072":{sections:[{kind:"concept",icon:"🎺",heading:"היכן נולד הג'אז",body:`הג'אז נולד בתחילת המאה ה-20 בעיר ניו-אורלינס שבדרום ארצות הברית — עיר נמל רב-תרבותית שבה נפגשו מסורות מוסיקליות אפריקאיות, אירופיות וקריביות. הוא צמח בקהילה האפרו-אמריקאית מתוך שילוב של כמה זרמים קודמים: הבלוז, שהביא את התחושה הרגשית ואת "התווים הכחולים"; מוסיקת הגוספל של הכנסייה, שהביאה את הקריאה-ותשובה ואת הלהט הווקאלי; והרגטיים, שהביא את הסינקופה — ההטעמה של הפעימות ה"חלשות". השילוב הזה, יחד עם האלתור, הפך את הג'אז לשפה מוסיקלית חדשה לגמרי.`},{kind:"concept",icon:"⛪",heading:"הבלוז והגוספל — השורשים הרגשיים",body:`הבלוז והגוספל הם שני שורשים תאומים של הג'אז, ושניהם צמחו מהחוויה האפרו-אמריקאית בדרום. הגוספל הוא מוסיקת התפילה של הכנסייה השחורה — שירה קבוצתית לוהטת, בנויה על תבנית "קריאה ותשובה" (הסולן קורא, הקהילה עונה) ועל התרגשות רוחנית גואה. הבלוז, לעומתו, הוא מוסיקה חילונית ואישית, שנתנה ביטוי לכאב, לגעגוע ולחיי היום-יום. מהבלוז ירש הג'אז את "התווים הכחולים" — צלילים מונמכים מעט (בעיקר הטרצה, הקווינטה והספטה) שיוצרים את הצליל הנוגה והמתוח האופייני. שני הזרמים תרמו לג'אז את עומקו הרגשי ואת החופש הווקאלי.`},{kind:"notation",heading:'סולם הבלוז על דו — "התווים הכחולים"',notation:{clef:"treble",notes:[{keys:["c/4"],duration:"8"},{keys:["eb/4"],duration:"8"},{keys:["f/4"],duration:"8"},{keys:["f#/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["bb/4"],duration:"8"},{keys:["c/5"],duration:"8"}]},body:`סולם בלוז על דו: דו־מי במול־פה־פה דיאז־סול־סי במול־דו. המי במול והסי במול הם "תווים כחולים" — מקור הצליל הנוגה של הבלוז והג'אז.`},{kind:"tip",icon:"💡",body:`הסינקופה — הטעמה של פעימות חלשות ושל מקומות "שבין" הפעימות — היא אולי המאפיין הריתמי המזהה ביותר של הג'אז. היא ירושה ישירה מהרגטיים ומהמקצבים האפריקאיים, והיא מה שנותן לג'אז את התחושה ה"מתנדנדת" (swing) שאי אפשר לטעות בה.`},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:`לחשוב שהג'אז נולד באירופה או שהוא סוגה "קלאסית" במקורה. הג'אז הוא יצירה אמריקאית מובהקת, שצמחה מהקהילה האפרו-אמריקאית בדרום ארצות הברית, ושורשיו בבלוז, בגוספל וברגטיים — לא במוסיקה האמנותית האירופית.`}],quiz:[{prompt:"באיזו עיר מקובל לראות את ערש הולדתו של הג'אז?",options:[{label:"ניו-אורלינס",correct:!0},{label:"וינה",correct:!1},{label:"לונדון",correct:!1}],explanation:`הג'אז נולד בתחילת המאה ה-20 בניו-אורלינס — עיר נמל רב-תרבותית בדרום ארה"ב, שבה נפגשו מסורות אפריקאיות, אירופיות וקריביות בקהילה האפרו-אמריקאית.`},{prompt:"איזו תבנית מרכזית תרמה מוסיקת הגוספל לג'אז?",options:[{label:"קריאה ותשובה (call and response)",correct:!0},{label:"מבנה הסונטה הקלאסי",correct:!1},{label:"הפוגה בת ארבעה קולות",correct:!1}],explanation:`הגוספל, מוסיקת הכנסייה השחורה, בנוי על "קריאה ותשובה" — סולן קורא והקהילה עונה. תבנית זו והלהט הווקאלי שלה עברו ישירות אל שפת הג'אז.`},{prompt:`מהם "התווים הכחולים" (blue notes) שהג'אז ירש מהבלוז?`,options:[{label:"צלילים מונמכים מעט (בעיקר טרצה, קווינטה וספטה) שיוצרים צליל נוגה",correct:!0},{label:"צלילים המנוגנים תמיד בעוצמה חזקה במיוחד",correct:!1},{label:"צלילים שאפשר לנגן רק בכלי נשיפה",correct:!1}],explanation:`"תווים כחולים" הם דרגות מונמכות מעט מהסולם המז'ורי — בעיקר הטרצה, הקווינטה והספטה — והם מקור הצליל הנוגה והמתוח האופייני לבלוז ולג'אז.`}]},"MC-090":{sections:[{kind:"concept",icon:"🖥️",heading:"מהי תחנת עבודה למוסיקה (DAW)?",body:'Cubase היא תחנת עבודה דיגיטלית למוסיקה (DAW — Digital Audio Workstation): תוכנה שבה מקליטים, עורכים, ומעבדים מוסיקה במחשב. אפשר לחשוב עליה כאולפן הקלטות שלם שנדחס לתוך מסך אחד — במקום חדר מלא ציוד, יש חלון תוכנה שבו כל רכיב הוא "מסלול" (track) על ציר זמן. במרכז העבודה עומד מסך אחד ראשי, ה-Project Window, שבו רואים את כל המסלולים פרוסים משמאל לימין לאורך הזמן, וכל צליל, הקלטה או תו מופיע כ"אירוע" (event) שאפשר לגזור, להזיז ולשכפל.'},{kind:"concept",icon:"🎚️",heading:"מסלולים, סרגל התנועה ושני סוגי מסלולים",body:"העבודה בנויה סביב מסלולים המסודרים זה מתחת לזה, שכל אחד מנגן חלק אחר — תופים, בס, שירה. סרגל התנועה (Transport) הוא לוח הבקרה הבסיסי: כפתורי נגן, עצור, הקלט וחזרה, בדיוק כמו על מכשיר הקלטה. ההבחנה החשובה ביותר למתחיל היא בין שני סוגי מסלולים: מסלול אודיו (Audio) מקליט צליל ממשי — קול, גיטרה, מיקרופון — כגל קול מוקלט; ומסלול MIDI מקליט לא צליל אלא הוראות: אילו קלידים נלחצו, מתי, ובאיזו עוצמה. הוראות ה-MIDI אינן קול בעצמן — הן מפעילות כלי וירטואלי (VST) שמייצר את הצליל, ולכן אפשר לשנות אותן בקלות אחרי ההקלטה: להחליף פסנתר בכינור, לתקן תו שגוי, או להזיז אותו בזמן."},{kind:"example",icon:"🎹",heading:"למה ההבחנה בין אודיו ל-MIDI כה חשובה",body:'נניח שהקלטתם שורת פסנתר. אם הקלטתם אותה כאודיו, קיבעתם צליל פסנתר סופי — לתקן תו שגוי פירושו להקליט מחדש. אם הקלטתם אותה כ-MIDI, שמרתם רק את "מה ניגנתם", ולכן אפשר לגרור תו בודד למקומו הנכון, לשנות את עוצמתו, ואפילו להחליף את צליל הפסנתר בצליל אורגן — הכול בלי לנגן שוב. זו הסיבה שעבודת הלחנה נעשית לרוב ב-MIDI, בעוד שהקלטת שירה או כלי אקוסטי נעשית באודיו.'},{kind:"tip",icon:"💡",body:"לפני שמתחילים פרויקט, כדאי לשמור אותו בתיקייה ייעודית ולתת לו שם. Cubase שומרת קבצים נלווים רבים (הקלטות אודיו, גיבויים), וסדר בתיקיות מההתחלה חוסך בלבול גדול בהמשך."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לבלבל בין מסלול אודיו למסלול MIDI ולנסות להקליט מיקרופון על מסלול MIDI (או להפך). מיקרופון מפיק צליל ולכן דורש מסלול אודיו; מקלדת שמנגנת כלי וירטואלי מפיקה הוראות ולכן דורשת מסלול MIDI. בחירת סוג המסלול הנכון היא הצעד הראשון בכל הקלטה."}],quiz:[{prompt:"מהו ההבדל המרכזי בין מסלול אודיו למסלול MIDI?",options:[{label:"אודיו מקליט צליל ממשי; MIDI מקליט הוראות נגינה שמפעילות כלי וירטואלי",correct:!0},{label:"אודיו נועד רק לתופים ו-MIDI רק לפסנתר",correct:!1},{label:"אין ביניהם הבדל — שניהם מקליטים את אותו דבר",correct:!1}],explanation:"מסלול אודיו מקליט גל קול ממשי (מיקרופון, גיטרה). מסלול MIDI מקליט רק הוראות — אילו קלידים, מתי ובאיזו עוצמה — שמפעילות כלי וירטואלי, ולכן קל לערוך אותן אחרי ההקלטה."},{prompt:"מדוע נוח לעבוד ב-MIDI כשמלחינים?",options:[{label:"אפשר לתקן תו, לשנות עוצמה ואף להחליף את הכלי — בלי להקליט מחדש",correct:!0},{label:"MIDI תמיד נשמע איכותי יותר מאודיו מוקלט",correct:!1},{label:"MIDI אינו דורש שמירת הפרויקט",correct:!1}],explanation:'MIDI שומר את "מה ניגנת" ולא את הצליל הסופי, ולכן אפשר לגרור תו למקומו, לשנות עוצמה או להחליף פסנתר בכינור בלי לנגן שוב — גמישות שאין בהקלטת אודיו.'}]},"MC-091":{sections:[{kind:"concept",icon:"🎙️",heading:"משרשרת ההקלטה: מהמקור למחשב",body:'הקלטה בסיסית מתחילה בהבנת מסלול האות: הצליל יוצא מהמקור (קול, כלי), נלכד על ידי מיקרופון, עובר דרך כרטיס קול (audio interface) שממיר אותו לאות דיגיטלי, ומגיע לתוכנה. כל חוליה בשרשרת הזו משפיעה על התוצאה. הצעד המעשי הראשון הוא לחבר את המיקרופון לכרטיס הקול, לבחור בתוכנה את המסלול הנכון (מסלול אודיו), ולוודא שהאות אכן נכנס — שרואים את מד העוצמה "קופץ" כשמדברים או מנגנים.'},{kind:"concept",icon:"📊",heading:"עוצמת כניסה (gain) ומניעת עיוות (clipping)",body:'הכוונון החשוב ביותר בהקלטה הוא ה-gain — עוצמת הכניסה של האות. אם ה-gain נמוך מדי, ההקלטה חלשה ורועשת; אם הוא גבוה מדי, האות "נחתך" בפסגות שלו — תופעה שנקראת clipping, ונשמעת כעיוות מחוספס ולא נעים שאי אפשר לתקן בדיעבד. הכלל המעשי: כוונו את ה-gain כך שהצלילים החזקים ביותר יגיעו בערך לשלושה-רבעים מהמד ולעולם לא ייגעו באדום. עדיף להקליט מעט חלש מדי (וניתן להגביר אחר כך) מאשר חזק מדי ומעוות — כי עיוות clipping הוא נזק בלתי-הפיך.'},{kind:"example",icon:"🔁",heading:"טייקים — להקליט כמה פעמים",body:'"טייק" (take) הוא ניסיון הקלטה בודד. בעבודת אולפן כמעט אף פעם לא מסתפקים בטייק אחד: מקליטים את אותו קטע כמה פעמים, כי ביצוע אחד עשוי להיות מדויק יותר בפתיחה ואחר בסיום. אפשר לבחור את הטייק הטוב ביותר בשלמותו, או להרכיב ("comp") ביצוע מיטבי מהחלקים הטובים של כמה טייקים. עצה חשובה: לפני כל טייק כדאי לתת "ספירת כניסה" (למשל ארבע פעימות מטרונום) כדי שהמבַצע ייכנס בזמן ובטמפו הנכון.'},{kind:"tip",icon:"💡",body:'תמיד בצעו "בדיקת סאונד" (soundcheck) לפני ההקלטה האמיתית: נגנו או שירו את החלק החזק ביותר של הקטע ובדקו שהמד אינו נכנס לאדום. עדיף לגלות עיוות בבדיקה מאשר אחרי שהקלטתם ביצוע מושלם שאי אפשר להציל.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לכוון את ה-gain גבוה מדי "כדי שיישמע חזק". clipping אינו סתם רועש — הוא מעוות בלתי-הפיך: הפסגות של גל הקול נחתכות ואבודות, ואי אפשר לשחזר אותן בעריכה. עוצמה כוללת אפשר תמיד להעלות בהמשך; פסגה שנחתכה אבדה לתמיד.'}],quiz:[{prompt:"מהו clipping בהקלטה, ומדוע יש להימנע ממנו?",options:[{label:"עיוות בלתי-הפיך שנוצר כשעוצמת הכניסה גבוהה מדי והפסגות נחתכות",correct:!0},{label:"הקלטה חלשה מדי שאפשר להגביר בקלות",correct:!1},{label:"שם נרדף למחיקת מסלול",correct:!1}],explanation:'clipping מתרחש כשה-gain גבוה מדי: פסגות גל הקול "נחתכות" ונשמעות כעיוות מחוספס. הפסגות אבדו ואי אפשר לשחזרן, ולכן עדיף להקליט מעט חלש ולהגביר אחר כך.'},{prompt:'מהו "טייק" (take) בהקלטה?',options:[{label:"ניסיון הקלטה בודד; לרוב מקליטים כמה ובוחרים או מרכיבים את הטוב ביותר",correct:!0},{label:"הכלי הווירטואלי שמנגן את הצליל",correct:!1},{label:"סרגל התנועה עם כפתורי הנגן והעצור",correct:!1}],explanation:'טייק הוא ניסיון הקלטה יחיד. באולפן מקליטים כמה טייקים ובוחרים את הטו
4080ב ביותר — או מרכיבים ("comp") ביצוע מיטבי מהחלקים הטובים של כמה טייקים.'}]},"MC-101":{sections:[{kind:"concept",icon:"🎼",heading:"התקופה הבארוקית — עידן הפאר והתנועה",body:`התקופה הבארוקית משתרעת בערך על השנים 1600–1750, והיא נחתמת בשנת מותו של יוהאן סבסטיאן באך. זו תקופה של פאר, קישוט ותנועה מתמדת: המוסיקה הבארוקית אוהבת קווים רצים, דגמים החוזרים ומתפתחים, וניגודים דרמטיים בין חזק לחלש ובין סולן לתזמורת. בתקופה זו התגבשה הטונאליות המז'ורית-מינורית שאנו מכירים עד היום, ונולדו צורות מרכזיות כמו הקונצ'רטו, הסוויטה והפוגה. זהו גם עידן ה"אפקטים" — הרעיון שכל יצירה מבטאת רגש אחד שלם ומפותח.`},{kind:"concept",icon:"🕸️",heading:"קונטרפונקט, פוגה ובאסו קונטינואו",body:`שלושה מושגים הם לב-ליבה של הסגנון הבארוקי. קונטרפונקט (counterpoint) הוא אמנות שילובם של כמה קווים מלודיים עצמאיים המתנגנים בו-זמנית, כך שכל קול עומד בפני עצמו ובכל זאת הם משתלבים להרמוניה. פוגה (fugue) היא הצורה הקונטרפונקטית המשוכללת ביותר: קול אחד פותח בנושא (subject) קצר, ואז קול אחר "נכנס" עם אותו נושא בעוד הראשון ממשיך — וכך נבנה מרקם צפוף שבו הנושא נרדף ומתפתח. באסו קונטינואו (basso continuo) הוא היסוד ההרמוני של התקופה: קו בס רציף המנוגן לרוב בצ'לו או בסון, ומעליו כלי מקלדת (צ'מבלו או עוגב) שממלא את האקורדים לפי מספרים כתובים. באך היה האמן הגדול של כל שלושת אלה.`},{kind:"notation",heading:"נושא פוגה — מוטיב פתיחה קצר",notation:{clef:"treble",keySignature:"C",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["c/4"],duration:"q"}]},body:"נושא (subject) קצר וברור: דו־סול־מי־דו. בפוגה קול אחד פותח בנושא כזה, ואז קול נוסף נכנס עם אותו נושא בעוד הראשון ממשיך — כך נטווה המרקם הקונטרפונקטי."},{kind:"tip",icon:"💡",body:`להאזנה ראשונה לבאך, נסו את "פרלוד ופוגה" מתוך "הקלוויר המושווה" או את "הקונצ'רטים הברנדנבורגיים". שימו לב איך אותו נושא קצר חוזר ומופיע בקולות שונים, בגבהים שונים — זה הלב הפועם של הכתיבה הקונטרפונקטית.`},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לבלבל בין "בארוק" ל"קלאסי". התקופה הקלאסית (מוצרט, היידן) באה אחרי הבארוק ומאופיינת בפשטות, באיזון ובמלודיה מלווה — בניגוד למרקם הרב-קולי הצפוף והמקושט של הבארוק. באך הוא בארוק; מוצרט הוא קלאסי.'}],quiz:[{prompt:"בערך אילו שנים משתרעת התקופה הבארוקית, ובמות מי היא נחתמת?",options:[{label:"בערך 1600–1750, ונחתמת עם מות באך",correct:!0},{label:"בערך 1750–1820, ונחתמת עם מות בטהובן",correct:!1},{label:"בערך 1400–1500, ונחתמת עם מות פלסטרינה",correct:!1}],explanation:"התקופה הבארוקית נמשכת בערך מ-1600 עד 1750. שנת 1750, שנת מותו של יוהאן סבסטיאן באך, מקובלת כסיום התקופה."},{prompt:'מהי "פוגה" (fugue)?',options:[{label:"צורה קונטרפונקטית שבה קולות נכנסים בזה אחר זה עם אותו נושא",correct:!0},{label:"ריקוד איטי בשלושה רבעים",correct:!1},{label:"קטע לסולן אחד בלבד ללא ליווי",correct:!1}],explanation:"בפוגה קול אחד פותח בנושא (subject) קצר, ואז קולות נוספים נכנסים בזה אחר זה עם אותו נושא בעוד הקולות הקודמים ממשיכים — מרקם רב-קולי צפוף שבאך היה אמן שלו."},{prompt:'מהו "באסו קונטינואו" (basso continuo), סימן ההיכר של המוסיקה הבארוקית?',options:[{label:"קו בס רציף וכלי מקלדת שממלא מעליו את האקורדים",correct:!0},{label:"מנגינה יחידה ללא כל ליווי הרמוני",correct:!1},{label:"תזמורת סימפונית מלאה בת מאה נגנים",correct:!1}],explanation:"באסו קונטינואו הוא היסוד ההרמוני הבארוקי: קו בס רציף (צ'לו/בסון) שמעליו כלי מקלדת (צ'מבלו/עוגב) ממלא את האקורדים לפי מספרים כתובים."}]},"MC-101b":{sections:[{kind:"concept",icon:"🎨",heading:"מהו סגנון מוסיקלי?",body:`סגנון מוסיקלי הוא ה"טביעת האצבע" של סוגה, תקופה או יוצר — צירוף המאפיינים החוזרים שגורמים לנו לזהות מיד "זה ג'אז", "זה בארוק" או "זה רוק", עוד לפני שנוכל להסביר במילים מדוע. הסגנון אינו יצירה בודדת אלא הדפוס המשותף לרבות: הבחירות המוסיקליות שחוזרות שוב ושוב עד שהן הופכות למזוהות. להבין סגנון פירושו ללמוד "לפרק" את הרושם הכולל למרכיביו — ואז אפשר גם לזהות סגנון בשמיעה, וגם לכתוב ולנגן בתוכו במודע.`},{kind:"concept",icon:"🔍",heading:"המאפיינים שמגדירים סגנון",body:"ארבעה צירים עיקריים מגדירים כמעט כל סגנון. ריתמוס — האם המקצב ישר או מתנדנד (swing), פשוט או מרובה סינקופות? הרמוניה — אקורדים פשוטים ומז'וריים או הרמוניה עשירה ומורכבת עם ספטאקורדים? כלי הנגינה (אורקסטרציה) — צ'מבלו ומיתרים מרמזים על בארוק; גיטרות חשמליות ותופים על רוק; כלי נשיפה על ג'אז. וצורה ומבנה — האם היצירה בנויה כבית-פזמון של שיר פופ, כפוגה בארוקית, או כאלתור פתוח? צירוף הבחירות בארבעת הצירים האלה הוא שיוצר את הזהות הסגנונית."},{kind:"example",icon:"⚖️",heading:"אותו שיר, שני סגנונות",body:`הדרך הטובה ביותר להבין סגנון היא לקחת מנגינה אחת ולעבד אותה בשני סגנונות. אותה מנגינה יכולה להישמע כמזמור בארוקי — עם צ'מבלו, קו בס רציף וקונטרפונקט — או כשיר ג'אז — עם ספטאקורדים, מקצב מתנדנד ואלתור. הצלילים המרכזיים זהים, אבל הריתמוס, ההרמוניה, הכלים והמבנה שונים לגמרי, ולכן הרושם משתנה מקצה לקצה. זה מוכיח שהסגנון אינו במנגינה עצמה אלא ב"איך" מלבישים אותה.`},{kind:"tip",icon:"💡",body:'כשאתם מנסים לזהות סגנון בשמיעה, שאלו את עצמכם את הצירים אחד-אחד: מה קורה במקצב? מה בהרמוניה? אילו כלים? איזה מבנה? פירוק הרושם הכולל לשאלות ממוקדות הופך "זיהוי בתחושה" למיומנות מדויקת ונלמדת.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:`לזהות סגנון לפי מאפיין יחיד בלבד — למשל "יש גיטרה חשמלית, אז זה רוק". כלי בודד אינו מספיק: גיטרה חשמלית מופיעה גם בג'אז ובבלוז. הסגנון נקבע מצירוף המאפיינים — ריתמוס, הרמוניה, כלים ומבנה יחד — ולא מסימן אחד מבודד.`}],quiz:[{prompt:'מהו למעשה "סגנון מוסיקלי"?',options:[{label:"צירוף המאפיינים החוזרים המזהים סוגה, תקופה או יוצר",correct:!0},{label:"יצירה בודדת ומפורסמת אחת",correct:!1},{label:"המהירות (הטמפו) של קטע מוסיקלי",correct:!1}],explanation:"סגנון הוא הדפוס המשותף לרבות — צירוף הבחירות המוסיקליות החוזרות (ריתמוס, הרמוניה, כלים, מבנה) שגורמות לנו לזהות סוגה, תקופה או יוצר."},{prompt:"איזה מהבאים אינו אחד מהצירים העיקריים שמגדירים סגנון מוסיקלי?",options:[{label:"מחיר הכרטיס להופעה",correct:!0},{label:"ההרמוניה (סוג האקורדים)",correct:!1},{label:"כלי הנגינה (האורקסטרציה)",correct:!1}],explanation:"הצירים המגדירים סגנון הם מוסיקליים: ריתמוס, הרמוניה, כלי הנגינה, וצורה ומבנה. מחיר כרטיס אינו מאפיין מוסיקלי ואינו קובע סגנון."},{prompt:"מדוע מסוכן לזהות סגנון לפי מאפיין יחיד בלבד?",options:[{label:"מאפיין בודד (כמו כלי מסוים) עשוי להופיע בכמה סגנונות; הזהות היא בצירוף",correct:!0},{label:"לכל סגנון יש בדיוק מאפיין ייחודי אחד ויחיד",correct:!1},{label:"מאפיינים בודדים אף פעם אינם משפיעים על הסגנון",correct:!1}],explanation:"כלי או תו בודד עשוי להופיע בסגנונות רבים (גיטרה חשמלית ברוק, בג'אז ובבלוז). הסגנון נקבע מצירוף המאפיינים — ריתמוס, הרמוניה, כלים ומבנה יחד."}]}};function s$(n){return r$[n]??null}const O7=new Map(n$.map(n=>[n.id,n])),Zh=new Map(Qh.map(n=>[n.id,n])),i$=new Map(Qh.filter(n=>n.academicCourseId).map(n=>[n.academicCourseId,n]));function D7(n){return Zh.get(n)??null}function V7(n){return i$.get(n)??null}function a$(n){return O7.get(n)??null}function yg(n){const e=Zh.get(n);if(!e)return[];const t=[];for(const r of e.topics){const s=O7.get(r.conceptId);
4080s&&t.push({concept:s,level:r.level})}return t}function o$(n,e){const t=Zh.get(n);if(!t)return null;const r=t.topics.findIndex(i=>i.conceptId===e),s=r<0?void 0:t.topics[r+1];return s?s.conceptId:null}function c$(n,e){const t=Zh.get(n);if(!t)return null;const r=t.topics.findIndex(i=>i.conceptId===e),s=r<=0?void 0:t.topics[r-1];return s?s.conceptId:null}function l$(){const n=[];for(const e of Qh)n.includes(e.domain)||n.push(e.domain);return n}function L7(n){return Qh.filter(e=>e.domain===n)}function yx({items:n,onStart:e}){return o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:n.map(({track:t,exercises:r})=>o.jsxs(W,{className:"flex flex-col gap-2",children:[o.jsx("h4",{className:"font-semibold",children:t.title}),o.jsx("p",{className:"text-xs text-text-muted",children:X(u.tracks.trackCount,{n:r.length})}),o.jsxs(ee,{onClick:()=>e(r),variant:"soft",className:"self-start",disabled:r.length===0,children:[o.jsx(Xt,{size:14,"aria-hidden":!0,className:"-scale-x-100"}),u.tracks.practiceTrack]})]},t.id))})}function d$(){const{groupId:n}=ri({strict:!1}),e=Be(T=>T.session),t=Qe(T=>T.begin),r=It(),s=fe({queryKey:["academic"],queryFn:()=>pt.get()}),i=s.data,a=(i==null?void 0:i.groups.find(T=>T.id===n))??null,c=fe({queryKey:["group-lessons",n],queryFn:()=>Oo.listForGroups([n]),enabled:!!n}),l=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),d=fe({queryKey:["practice-tracks","group",n],queryFn:()=>yo.listForGroups([n]),enabled:!!n}),m=fe({queryKey:["announcements","group",n],queryFn:()=>Ou.listForGroups([n]),enabled:!!n}),p=E.useMemo(()=>new Map((l.data??[]).map(T=>[T.id,T])),[l.data]),f=T=>T.map(M=>p.get(M)).filter(M=>!!M&&wn(M.typeId)),g=E.useMemo(()=>{const T=[];for(const M of c.data??[])for(const R of M.recommendedActivityIds)T.includes(R)||T.push(R);return f(T)},[c.data,p]),x=(d.data??[]).map(T=>({track:T,exercises:f(T.exerciseIds)})),b=[...new Set(x.map(T=>T.track.lessonNumber).filter(T=>typeof T=="number"))].sort((T,M)=>T-M),I=x.filter(T=>!T.track.lessonNumber),N=T=>{!e||T.length===0||(t(e.user.id,{source:"course",activities:T,reasonKey:"course.reason.lastLesson"}),r({to:"/student/practice/session"}))};if(s.isPending)return o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading});if(!a)return o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.courses.empty});const V=i?Wa(i,a):[],D=V7(a.id);return o.jsxs("div",{children:[o.jsxs("button",{onClick:()=>void r({to:"/student/courses"}),className:"mb-4 flex items-center gap-1 text-sm text-text-muted hover:text-primary",children:[o.jsx(og,{size:15,"aria-hidden":!0}),u.courses.backToCourses]}),o.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[o.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg text-white",style:{backgroundColor:a.color},children:o.jsx(Lr,{size:22,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-xl font-bold",children:a.name}),V.length>0?o.jsx("p",{className:"text-xs text-text-muted",children:X(u.courses.teacher,{name:V.join(" · ")})}):null]})]}),D?o.jsxs(W,{className:"mb-8 flex flex-col gap-3 border-s-4 border-primary sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(dr,{size:20,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"font-semibold",children:u.curriculum.courseContentTitle}),o.jsx("p",{className:"text-xs text-text-muted",children:u.curriculum.courseContentSubtitle}),o.jsx("p",{className:"mt-0.5 text-xs text-text-muted",children:X(u.curriculum.topicsCount,{n:D.topics.length})})]})]}),o.jsxs(ee,{className:"shrink-0 self-start sm:self-center",onClick:()=>void r({to:"/student/curriculum/course/$courseId",params:{courseId:D.id}}),children:[o.jsx(dr,{size:15,"aria-hidden":!0}),u.curriculum.openCourseTopics]})]}):null,(m.data??[]).length>0?o.jsxs("section",{className:"mb-8",children:[o.jsxs("h2",{className:"mb-2 flex items-center gap-2 font-semibold",children:[o.jsx(Fh,{size:18,"aria-hidden":!0,
4080className:"text-accent"}),u.announce.studentTitle]}),o.jsx("div",{className:"space-y-2",children:(m.data??[]).map(T=>o.jsxs(W,{className:"border-s-4 border-accent",children:[T.title?o.jsx("h3",{className:"mb-0.5 font-semibold",children:T.title}):null,o.jsx("p",{className:"whitespace-pre-line text-sm text-text-secondary",children:T.body}),o.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:X(u.announce.by,{name:T.teacherName})})]},T.id))})]}):null,x.length>0?o.jsxs("section",{className:"mb-8",children:[o.jsx("h2",{className:"font-semibold",children:u.tracks.courseTracksTitle}),o.jsx("p",{className:"mb-3 text-xs text-text-muted",children:u.tracks.courseTracksSubtitle}),o.jsxs("div",{className:"space-y-5",children:[b.map(T=>o.jsxs("div",{children:[o.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-bold text-primary",children:[o.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-primary-soft text-xs",children:T}),X(u.tracks.meeting,{n:T})]}),o.jsx(yx,{items:x.filter(M=>M.track.lessonNumber===T),onStart:N})]},T)),I.length>0?o.jsxs("div",{children:[b.length>0?o.jsx("h3",{className:"mb-2 text-sm font-bold text-text-secondary",children:u.tracks.generalMaterial}):null,o.jsx(yx,{items:I,onStart:N})]}):null]})]}):null,o.jsxs("div",{className:"mb-4 flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"font-semibold",children:u.courses.exercisesTitle}),o.jsx("p",{className:"text-xs text-text-muted",children:u.courses.exercisesSubtitle})]}),g.length>0?o.jsxs(ee,{onClick:()=>N(g),children:[o.jsx(Xt,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.courses.practiceAll]}):null]}),g.length===0?o.jsx(W,{className:"py-10 text-center text-sm text-text-muted",children:u.courses.noExercises}):o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:g.map(T=>o.jsxs(W,{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"truncate font-semibold",children:T.title}),o.jsx("p",{className:"text-xs text-text-muted",children:X(u.practice.estimatedMinutes,{n:T.estimatedMinutes})})]}),o.jsx("p",{className:"flex-1 text-sm text-text-secondary",children:T.description}),o.jsxs(ee,{onClick:()=>N([T]),variant:"soft",className:"self-start",children:[o.jsx(Xt,{size:14,"aria-hidden":!0,className:"-scale-x-100"}),u.courses.practiceOne]})]},T.id))})]})}const u$={id:"course-harmony",title:"הרמוניה — יסודות",subtitle:"קורס שנה א׳ · שירת הלויים",description:"אחרי שהבנו איך מוזיקה עובדת — עכשיו בונים אותה. איך מרכיבים שילוש, מהם היפוכים, אילו אקורדים חיים בכל סולם, איך מחברים אקורדים בהולכת קולות חלקה, ומהו אקורד השביעי. לומדים עיקרון, מתרגלים, ומקבלים משוב.",trackId:"track-men"},h$=[{id:"hm-unit-1",courseId:"course-harmony",order:1,title:"בניית שילושים",summary:"שורש, טרצה וקווינטה — ואיכויות האקורד",icon:"🧱"},{id:"hm-unit-2",courseId:"course-harmony",order:2,title:"היפוכים",summary:"אותו אקורד, בס אחר: יסוד, היפוך ראשון ושני",icon:"🔄"},{id:"hm-unit-3",courseId:"course-harmony",order:3,title:"השילושים הדיאטוניים",summary:"שבעת האקורדים של הסולם ואיכות כל דרגה",icon:"🎼"},{id:"hm-unit-4",courseId:"course-harmony",order:4,title:"חיבור אקורדים והולכת קולות",summary:"מהלכים נפוצים ותנועה חלקה בין אקורדים",icon:"🔗"},{id:"hm-unit-5",courseId:"course-harmony",order:5,title:"אקורדי שביעי והרמוניזציה",summary:"הדומיננטה השביעית והלבשת אקורדים על לחן",icon:"✨"}],m$=[{id:"hm-1-1",unitId:"hm-unit-1",order:1,title:"מהו שילוש?",subtitle:"שלושה צלילים במרווחי טרצה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🧱",body:"שילוש (Triad) הוא אקורד בסיסי הבנוי משלושה צלילים: שורש, הצליל שמעליו במרחק טרצה, והצליל שמעליו שוב במרחק טרצה. שלושתם יחד — האבן הבסיסית של ההרמוניה."},{kind:"concept",heading:"שלושת התפקידים",body:'השורש (Root) נותן לאקורד את שמו. מעליו הטרצה, ומעליה הקווינטה. השם "שילוש" בא משלושת הצלילים — שורש, טרצה, קווינטה.'},{kind:"notation",heading:"שילוש דו מז׳ור — דו·מי·סול",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:"דו (שורש) · מי (טרצה) · סול (קווינטה). שלושה צלילים בקפיצות טרצה, זה על זה."},{kind:"tip",icon:"💡",body:'בכל שילוש ביסוד הצלילים "מדלגים" על הסולם: שורש, מדלגים אחד, טרצה, מדלגים אחד, קווינטה. על השורה — שלוש שורות סמוכות; ברווח — שלושה רווחים סמוכים.'}],practiceActivityIds:["act-theory-1"],quiz:[{prompt:"מאילו שלושה מרכיבים בנוי שילוש?",options:[{label:"שורש, טרצה וקווינטה",correct:!0},{label:"שורש, קווארטה ואוקטבה",correct:!1},{label:"טרצה, קווינטה וספטימה",correct:!1}],explanation:"שילוש בנוי משורש, מהטרצה שמעליו ומהקווינטה שמעליה — שלושה צלילים במרווחי טרצה."},{prompt:"שילוש דו מז׳ור בנוי מהצלילים…",options:[{label:"דו · מי · סול",correct:!0},{label:"דו · פה · לה",correct:!1},{label:"דו · רה · מי",correct:!1}],explanation:"דו (שורש), מי (טרצה מעל דו) וסול (קווינטה מעל דו). זהו שילוש הטוניקה בדו מז׳ור."}],relatedLessonIds:["hm-1-2"]},{id:"hm-1-2",unitId:"hm-unit-1",order:2,title:"מז׳ור מול מינור",subt
4080itle:"סדר הטרצות קובע את הצבע",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎨",body:"כל שילוש בנוי משתי טרצות זו על זו — אך הסדר שלהן קובע את איכות האקורד. טרצה גדולה ומעליה קטנה = מז׳ור. טרצה קטנה ומעליה גדולה = מינור."},{kind:"notation",heading:"שילוש מז׳ור — דו·מי·סול",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:"דו→מי טרצה גדולה (4 חצאי-טונים), מי→סול טרצה קטנה (3). צבע בהיר — מז׳ור."},{kind:"notation",heading:"שילוש מינור — דו·מי במול·סול",notation:{clef:"treble",notes:[{keys:["c/4","eb/4","g/4"],duration:"w"}]},body:"דו→מי במול טרצה קטנה (3), מי במול→סול טרצה גדולה (4). צבע כהה — מינור."},{kind:"tip",icon:"💡",body:"הקווינטה (דו→סול) זהה בשני האקורדים. רק הצליל האמצעי — הטרצה — זז חצי-טון, וכל הרגש מתהפך."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שמז׳ור ומינור נבדלים בקווינטה. לא — הקווינטה זהה; ההבדל היחיד הוא הטרצה (גדולה במז׳ור, קטנה במינור)."}],practiceActivityIds:["act-chord-quality-1"],quiz:[{prompt:"מה מבדיל בין שילוש מז׳ור לשילוש מינור?",options:[{label:"איכות הטרצה: גדולה במז׳ור, קטנה במינור",correct:!0},{label:"הקווינטה: גדולה במז׳ור, קטנה במינור",correct:!1},{label:"השורש שונה בכל אחד",correct:!1}],explanation:"הקווינטה זהה בשניהם; רק הטרצה משתנה — גדולה = מז׳ור, קטנה = מינור."},{prompt:"איזה שילוש הצלילים דו · מי במול · סול מייצג?",options:[{label:"דו מינור",correct:!0},{label:"דו מז׳ור",correct:!1},{label:"דו מוקטן",correct:!1}],explanation:"דו→מי במול היא טרצה קטנה, והקווינטה (דו→סול) שלמה — זהו שילוש דו מינור."}],relatedLessonIds:["hm-1-3"]},{id:"hm-1-3",unitId:"hm-unit-1",order:3,title:"מוקטן ומוגדל",subtitle:"כשגם הקווינטה משתנה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🌗",body:"מעבר למז׳ור ומינור יש שתי איכויות נוספות. שילוש מוקטן (dim): שתי טרצות קטנות זו על זו — הקווינטה מצטמצמת. שילוש מוגדל (aug): שתי טרצות גדולות — הקווינטה מתרחבת."},{kind:"notation",heading:"שילוש מוקטן — סי·רה·פה",notation:{clef:"treble",notes:[{keys:["b/3","d/4","f/4"],duration:"w"}]},body:"סי→רה טרצה קטנה, רה→פה טרצה קטנה. הקווינטה סי→פה מוקטנת (טריטון) — צליל מתוח."},{kind:"notation",heading:"שילוש מוגדל — דו·מי·סול דיאז",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g#/4"],duration:"w"}]},body:'דו→מי טרצה גדולה, מי→סול דיאז טרצה גדולה. הקווינטה דו→סול דיאז מוגדלת — צליל "מרחף".'},{kind:"tip",icon:"💡",body:"ארבע האיכויות לפי הקווינטה: מוקטן (קווינטה מוקטנת) < מינור ומז׳ור (קווינטה שלמה) < מוגדל (קווינטה מוגדלת). המוקטן והמוגדל הם המתוחים."}],practiceActivityIds:[],quiz:[{prompt:"שילוש מוקטן בנוי מ…",options:[{label:"שתי טרצות קטנות זו על זו",correct:!0},{label:"שתי טרצות גדולות זו על זו",correct:!1},{label:"טרצה גדולה ומעליה קטנה",correct:!1}],explanation:"שילוש מוקטן = טרצה קטנה + טרצה קטנה, מה שמצמצם את הקווינטה לקווינטה מוקטנת (טריטון)."},{prompt:"הצלילים דו · מי · סול דיאז יוצרים שילוש…",options:[{label:"מוגדל",correct:!0},{label:"מוקטן",correct:!1},{label:"מז׳ור",correct:!1}],explanation:"שתי טרצות גדולות (דו→מי, מי→סול דיאז) מרחיבות את הקווינטה לקווינטה מוגדלת — שילוש מוגדל."}],relatedLessonIds:["hm-2-1"]},{id:"hm-2-1",unitId:"hm-unit-2",order:1,title:"מצב יסוד",subtitle:"השורש בבס",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🏗️",body:'אקורד נמצא ב"מצב יסוד" כשהשורש הוא הצליל הנמוך ביותר (בבס). זהו המצב היציב והמוכר ביותר — שממנו נבנו כל האקורדים עד כה.'}
4080,{kind:"notation",heading:"דו מז׳ור במצב יסוד",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:"דו (השורש) למטה, ומעליו מי וסול. הבס הוא השורש — מצב יסוד."},{kind:"tip",icon:"💡",body:'אותם שלושה צלילים יכולים להסתדר בסדר אחר בלי לשנות את זהות האקורד — עדיין "דו מז׳ור". מה שקובע היפוך הוא מי בבס.'}],practiceActivityIds:["act-inv-triad"],quiz:[{prompt:"מתי אקורד נמצא במצב יסוד?",options:[{label:"כשהשורש הוא הצליל הנמוך ביותר",correct:!0},{label:"כשהקווינטה בבס",correct:!1},{label:"כשהטרצה בבס",correct:!1}],explanation:"מצב יסוד = השורש בבס. אם צליל אחר בבס — זהו היפוך."}],relatedLessonIds:["hm-2-2"]},{id:"hm-2-2",unitId:"hm-unit-2",order:2,title:"היפוך ראשון",subtitle:"הטרצה בבס",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔃",body:'בהיפוך ראשון מעבירים את השורש אוקטבה למעלה, כך שהטרצה של האקורד הופכת לצליל הנמוך (בבס). האקורד נשאר "דו מז׳ור", אך צבעו רך ופחות יציב.'},{kind:"notation",heading:"דו מז׳ור בהיפוך ראשון — מי·סול·דו",notation:{clef:"treble",notes:[{keys:["e/4","g/4","c/5"],duration:"w"}]},body:"מי (הטרצה) בבס, מעליו סול ודו. עדיין דו מז׳ור — אך הטרצה למטה."},{kind:"tip",icon:"💡",body:"היפוך ראשון נפוץ מאוד כי הבס (הטרצה) יוצר קו בס מלודי וזורם יותר ממצב יסוד. הוא מסומן בספרות המספור כ-⁶."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שהיפוך משנה את שם האקורד. לא — מי·סול·דו הוא עדיין אקורד דו מז׳ור, כי דו נשאר השורש. רק סדר הצלילים השתנה."}],practiceActivityIds:["act-inv-triad"],quiz:[{prompt:"איזה צליל נמצא בבס בהיפוך ראשון?",options:[{label:"הטרצה",correct:!0},{label:"השורש",correct:!1},{label:"הקווינטה",correct:!1}],explanation:"בהיפוך ראשון הטרצה היא הצליל הנמוך. בדו מז׳ור זה מי (מי·סול·דו)."},{prompt:"הצלילים מי · סול · דו הם…",options:[{label:"דו מז׳ור בהיפוך ראשון",correct:!0},{label:"מי מינור במצב יסוד",correct:!1},{label:"אקורד חדש שאינו דו מז׳ור",correct:!1}],explanation:"אותם צלילים של דו מז׳ור (דו·מי·סול) עם הטרצה (מי) בבס — זהו היפוך ראשון של דו מז׳ור."}],relatedLessonIds:["hm-2-3"]},{id:"hm-2-3",unitId:"hm-unit-2",order:3,title:"היפוך שני",subtitle:"הקווינטה בבס",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔁",body:'בהיפוך שני הקווינטה של האקורד היא הצליל הנמוך (בבס). האקורד נשאר "דו מז׳ור", אך הוא הכי לא-יציב מבין שלושת המצבים — ונוטה לפתור הלאה.'},{kind:"notation",heading:"דו מז׳ור בהיפוך שני — סול·דו·מי",notation:{clef:"treble",notes:[{keys:["g/4","c/5","e/5"],duration:"w"}]},body:"סול (הקווינטה) בבס, מעליו דו ומי. עדיין דו מז׳ור — אך הקווינטה למטה."},{kind:"tip",icon:"💡",body:"שלושת המצבים של דו מז׳ור: דו·מי·סול (יסוד), מי·סול·דו (היפוך ראשון), סול·דו·מי (היפוך שני). אותם צלילים — סדר שונה."}],practiceActivityIds:["act-inv-triad"],quiz:[{prompt:"איזה צליל בבס בהיפוך שני?",options:[{label:"הקווינטה",correct:!0},{label:"הטרצה",correct:!1},{label:"השורש",correct:!1}],explanation:"בהיפוך שני הקווינטה בבס. בדו מז׳ור זה סול (סול·דו·מי)."},{prompt:"איזה סדר צלילים הוא דו מז׳ור בהיפוך שני?",options:[{label:"סול · דו · מי",correct:!0},{label:"מי · סול · דו",correct:!1},{label:"דו · מי · סול",correct:!1}],explanation:"הקווינטה (סול) בבס = היפוך שני. מי·סול·דו הוא היפוך ראשון, ודו·מי·סול הוא מצב יסוד."}],relatedLessonIds:["hm-3-1"]}
4080,{id:"hm-3-1",unitId:"hm-unit-3",order:1,title:"שילוש על כל דרגה",subtitle:"שבעה אקורדים מצלילי הסולם",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎼",body:'אם בונים שילוש על כל אחת משבע דרגות הסולם — בעזרת צלילי הסולם בלבד — מקבלים שבעה אקורדים "דיאטוניים". אלה כל האקורדים ה"תושבים" של הטונאליות.'},{kind:"notation",heading:"שילוש על דרגה I ועל דרגה II",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"h"},{keys:["d/4","f/4","a/4"],duration:"h"}]},body:"I = דו·מי·סול. II = רה·פה·לה. כל שילוש בונה טרצות מצלילי דו מז׳ור בלבד."},{kind:"tip",icon:"💡",body:'כל שבעת השילושים משתמשים אך ורק בצלילי הסולם (דו·רה·מי·פה·סול·לה·סי) — בלי סימני היתק. לכן איכות כל אקורד "נכפית" על ידי הסולם.'}],practiceActivityIds:["act-func-num"],quiz:[{prompt:"מהו שילוש הדרגה II בדו מז׳ור?",options:[{label:"רה · פה · לה",correct:!0},{label:"רה · פה דיאז · לה",correct:!1},{label:"רה · מי · פה",correct:!1}],explanation:"בונים טרצות מצלילי הסולם בלבד: רה (שורש), פה (טרצה), לה (קווינטה) — רה·פה·לה."}],relatedLessonIds:["hm-3-2"]},{id:"hm-3-2",unitId:"hm-unit-3",order:2,title:"איכות כל דרגה",subtitle:"מז׳ור, מינור ומוקטן לפי הסולם",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🏷️",body:"הסולם קובע את איכות כל שילוש. בדו מז׳ור: I מז׳ור, ii מינור, iii מינור, IV מז׳ור, V מז׳ור, vi מינור, vii° מוקטן. זו תבנית קבועה בכל סולם מז׳ורי."},{kind:"concept",heading:"הסימון",body:"ספרה גדולה = אקורד מז׳ור (I, IV, V). ספרה קטנה = מינור (ii, iii, vi). ספרה קטנה עם ° = מוקטן (vii°). כך רואים מיד את איכות כל דרגה."},{kind:"notation",heading:"V מז׳ור (סול·סי·רה) מול vii° מוקטן (סי·רה·פה)",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"h"},{keys:["b/3","d/4","f/4"],duration:"h"}]},body:"V = סול·סי·רה (מז׳ור). vii° = סי·רה·פה (מוקטן — שתי טרצות קטנות)."},{kind:"tip",icon:"💡",body:"רק דרגה אחת מוקטנת בסולם המז׳ורי — vii° (הבנויה על הצליל המוביל). כל השאר מז׳ור או מינור."}],practiceActivityIds:["act-func-num"],quiz:[{prompt:"מהי איכות אקורד הדרגה vi בסולם מז׳ורי?",options:[{label:"מינור",correct:!0},{label:"מז׳ור",correct:!1},{label:"מוקטן",correct:!1}],explanation:"התבנית הקבועה: I-IV-V מז׳ור, ii-iii-vi מינור, vii° מוקטן. לכן vi הוא מינור (בדו: לה·דו·מי)."},{prompt:"איזו דרגה בסולם המז׳ורי היא היחידה שאיכותה מוקטנת?",options:[{label:"vii°",correct:!0},{label:"ii",correct:!1},{label:"V",correct:!1}],explanation:"רק vii° (הבנויה על הצליל המוביל) מוקטנת. בדו: סי·רה·פה — שתי טרצות קטנות."}],relatedLessonIds:["hm-3-3"]},{id:"hm-3-3",unitId:"hm-unit-3",order:3,title:"שלושת האקורדים המרכזיים",subtitle:"I · IV · V — עמודי התווך",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🏛️",body:"מבין שבעת הדיאטוניים, שלושה נושאים את רוב המשקל: I (טוניקה), IV (סובדומיננטה) ו-V (דומיננטה). שלושתם מז׳וריים, ויחד הם מכסים את כל שבעת צלילי הסולם."},{kind:"notation",heading:"I · IV · V בדו מז׳ור",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["f/4","a/4","c/5"],duration:"q"},{keys:["g/4","b/4","d/5"],duration:"q"}]},body:"I = דו·מי·סול, IV = פה·לה·דו, V = סול·סי·רה. שלושת עמודי התווך של ההרמוניה."},{kind:"tip",icon:"💡",body:"אינספור שירים בנויים מ-I, IV ו-V בלבד. שליטה בשלושתם נותנת מפתח ללוות רוב הלחנים הפשוטים."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"מהם שלושת האקורדים המרכזיים (הראשיים) של סולם?",options:[{label:"I, IV ו-V",correct:!0},{label:"ii, iii ו-vi",correct:!1},{label:"I, ii ו-vii°",correct:!1}
4080],explanation:"I (טוניקה), IV (סובדומיננטה) ו-V (דומיננטה) — שלושה אקורדים מז׳וריים המכסים את כל צלילי הסולם."},{prompt:"אקורד הדרגה IV בדו מז׳ור בנוי מ…",options:[{label:"פה · לה · דו",correct:!0},{label:"סול · סי · רה",correct:!1},{label:"רה · פה · לה",correct:!1}],explanation:"IV נבנה על פה: פה (שורש), לה (טרצה), דו (קווינטה) — פה·לה·דו, אקורד מז׳ור."}],relatedLessonIds:["hm-4-1"]},{id:"hm-4-1",unitId:"hm-unit-4",order:1,title:"מהלכים נפוצים",subtitle:"I–IV–V–I ו-I–vi–IV–V",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🧭",body:'אקורדים מתחברים לרצפים חוזרים ("מהלכים") ששומעים בכל מקום. הקלאסי: I–IV–V–I (בית→יציאה→מתח→בית). נפוץ מאוד גם I–vi–IV–V, שבסיס אינספור שירי פופ ובלדות.'},{kind:"notation",heading:"I–IV–V–I בדו",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["f/4","a/4","c/5"],duration:"q"},{keys:["g/4","b/4","d/5"],duration:"q"},{keys:["c/4","e/4","g/4"],duration:"q"}]},body:"דו → פה → סול → דו. המהלך ההרמוני הבסיסי ביותר בטונאליות המז׳ורית."},{kind:"notation",heading:"I–vi–IV–V בדו",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["a/3","c/4","e/4"],duration:"q"},{keys:["f/4","a/4","c/5"],duration:"q"},{keys:["g/4","b/4","d/5"],duration:"q"}]},body:"דו → לה מינור → פה → סול. vi (לה·דו·מי) מוסיף גוון מינורי רך בתוך המהלך המז׳ורי."},{kind:"tip",icon:"💡",body:'V כמעט תמיד מוביל חזרה ל-I. לכן מהלך שמסתיים ב-V (כמו I–vi–IV–V) "מבקש" לחזור לתחילתו — ולכן טוב כלולאה חוזרת.'}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"איזה אקורד מוסיף המהלך I–vi–IV–V לעומת I–IV–V?",options:[{label:"vi (לה מינור בדו)",correct:!0},{label:"ii (רה מינור)",correct:!1},{label:"vii° (סי מוקטן)",correct:!1}],explanation:"vi הוא האקורד הנוסף — בדו מז׳ור לה·דו·מי, שמכניס גוון מינורי רך למהלך."}],relatedLessonIds:["hm-4-2"]},{id:"hm-4-2",unitId:"hm-unit-4",order:2,title:"הולכת קולות חלקה",subtitle:"תנועה לצליל הקרוב וצלילים משותפים",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🪜",body:'הולכת קולות היא האופן שבו כל "קול" (צליל בתוך האקורד) נע לאקורד הבא. הכלל המרכזי: נועו לצליל הקרוב ביותר, ושמרו צלילים משותפים במקומם. כך המעבר חלק ונעים.'},{kind:"notation",heading:"I → V בהולכה חלקה (דו נשאר)",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"h"},{keys:["b/3","d/4","g/4"],duration:"h"}]},body:"דו·מי·סול → סי·רה·סול. סול משותף ונשאר; מי יורד לרה בצעד; דו יורד לסי בצעד. תנועה מינימלית."},{kind:"tip",icon:"💡",body:"שני אקורדים סמוכים לרוב חולקים צליל אחד או יותר. שמירת הצליל המשותף באותו קול היא הדרך הפשוטה ביותר לקבל חיבור חלק."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'להזיז את כל הקולות בקפיצות רחבות לאותו כיוון. זה נשמע "מגושם". עדיף שכל קול ינוע למרחק הקצר ביותר, ובכיוונים מנוגדים לבס.'}],practiceActivityIds:["act-inv-triad"],quiz:[{prompt:"מהו העיקרון המרכזי של הולכת קולות חלקה?",options:[{label:"להזיז כל קול לצליל הקרוב ולשמור צלילים משותפים",correct:!0},{label:"להזיז את כל הקולות בקפיצה רחבה זהה",correct:!1},{label:"להשאיר את כל הקולות קבועים תמיד",correct:!1}],explanation:"הולכה חלקה = תנועה מינימלית: כל קול לצליל הקרוב, וצלילים משותפים נשארים במקומם."}],relatedLessonIds:["hm-4-3"]},{id:"hm-4-3",unitId:"hm-unit-4",order:3,title:"קווינטות ואוקטבות מקבילות",
4080subtitle:"מה עדיף להימנע ממנו",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🚧",body:'כלל הולכת קולות קלאסי: להימנע משתי קווינטות (או שתי אוקטבות) רצופות שנעות באותו כיוון בין אותם שני קולות. הן מטשטשות את עצמאות הקולות ונשמעות "ריקות".'},{kind:"notation",heading:"קווינטות מקבילות — להימנע",notation:{clef:"treble",notes:[{keys:["c/4","g/4"],duration:"h"},{keys:["d/4","a/4"],duration:"h"}]},body:"דו+סול (קווינטה) → רה+לה (קווינטה), שני הקולות עלו יחד. שתי קווינטות מקבילות — הכלל הקלאסי נמנע מהן."},{kind:"tip",icon:"💡",body:"הפתרון הפשוט: הזיזו את שני הקולות בכיוונים מנוגדים, או שמרו אחד מהם במקום. כך נשמרת עצמאות הקולות."},{kind:"mistake",icon:"⚠️",heading:"הבהרה",body:"זה כלל של הרמוניה קלאסית לארבעה קולות — לא איסור מוחלט. בפופ וברוק קווינטות מקבילות נפוצות ומכוונות. בלימוד היסודות מתאמנים להימנע מהן."}],practiceActivityIds:[],quiz:[{prompt:"מדוע ההרמוניה הקלאסית נמנעת מקווינטות מקבילות?",options:[{label:"הן מטשטשות את עצמאות הקולות ונשמעות ריקות",correct:!0},{label:"הן יוצרות דיסוננס חריף מדי",correct:!1},{label:"הן משנות את הטונאליות",correct:!1}],explanation:"שתי קווינטות מקבילות מאחדות את הקולות לתנועה אחת ופוגעות בעצמאותם — לכן נמנעים מהן בהרמוניה קלאסית."}],relatedLessonIds:["hm-5-1"]},{id:"hm-5-1",unitId:"hm-unit-5",order:1,title:"הדומיננטה השביעית V7",subtitle:"טרצה נוספת מעל האקורד",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"✨",body:"אקורד שביעי נוצר כשמוסיפים טרצה רביעית מעל שילוש — צליל במרחק ספטימה (שביעית) מהשורש. החשוב מכולם: הדומיננטה השביעית (V7), הבנויה על דרגה V."},{kind:"notation",heading:"V7 בדו — סול·סי·רה·פה",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5","f/5"],duration:"w"}]},body:"סול·סי·רה (השילוש V) ועליו פה — הספטימה. ארבעה צלילים; פה מוסיף מתח חד."},{kind:"concept",heading:"למה הוא כה חזק?",body:"ה-V7 מכיל שני צלילים מתוחים: הצליל המוביל סי (רוצה לעלות לדו) והספטימה פה (רוצה לרדת למי). שניהם יחד יוצרים משיכה חזקה במיוחד אל הטוניקה."},{kind:"tip",icon:"💡",body:'סי ופה יחד הם טריטון (קווינטה מוקטנת) — לב המתח של ה-V7. הטריטון הזה "נפתח החוצה" לדו ומי בתוך אקורד הטוניקה.'}],practiceActivityIds:["act-chord-7th"],quiz:[{prompt:"מהם ארבעת הצלילים של V7 בדו מז׳ור?",options:[{label:"סול · סי · רה · פה",correct:!0},{label:"סול · סי · רה · מי",correct:!1},{label:"דו · מי · סול · סי",correct:!1}],explanation:"V7 = השילוש סול·סי·רה ועליו הספטימה פה. סול·סי·רה·פה."},{prompt:"איזה מרווח יוצרים סי ופה שבתוך ה-V7?",options:[{label:"טריטון (קווינטה מוקטנת)",correct:!0},{label:"קווינטה שלמה",correct:!1},{label:"אוקטבה",correct:!1}],explanation:"סי→פה הוא טריטון — שלושה טונים — והוא מקור המתח החזק של הדומיננטה השביעית."}],relatedLessonIds:["hm-5-2"]},{id:"hm-5-2",unitId:"hm-unit-5",order:2,title:"V7 נפתר לטוניקה",subtitle:"הטריטון מתיישב",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:"המתח של ה-V7 נפתר באופן צפוי: הצליל המוביל (סי) עולה לדו, והספטימה (פה) יורדת למי. שני הקולות המתוחים מתיישבים בתוך אקורד הטוניקה."},{kind:"notation",heading:"V7 → I בדו",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5","f/5"],duration:"h"},{keys:["c/4","c/5","e/5","g/5"],duration:"h"}]},body:'סול·סי·רה·פה → דו·דו·מי·סול. סי עולה לדו, פה יורד למי — הטריטון "נפתח" והמתח נפתר.'},{kind:"tip",icon:"💡",body:"הסיום V7→I הוא הקדנצה האותנטית החזקה ביותר, כי הספטימה מוסיפה משיכה מעבר לצליל המוביל לבדו."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לשלוח את הספטימה (פה) כלפי מעלה. הספטימה של הדומיננטה כמעט תמיד יורדת בצעד (פה→מי) — זה הפתרון הטבעי שלה."}],practiceActivityIds:["act-inv-7th"],quiz:[{prompt:"לאן נפתרת הספטימה (פה) של V7 בדו?",options:[{label:"יורדת בצעד למי",correct:!0},{label:"עולה בצעד לסול",correct:!1},{label:"נשארת על פה",correct:!1}],explanation:"הספטימה של הדומיננטה נפתרת כלפי מטה: פה→מי, בתוך אקורד הטוניקה."},{prompt:"לאן נפתר הצליל המוביל (סי) ב-V7→I?",options:[{label:"עולה לדו",correct:!0},{label:"יורד ללה",correct:!1},{label:"נשאר על סי",correct:!1}],explanation:"הצליל המוביל סי עולה חצי-טון לדו — הטוניקה — בעוד הספטימה פה יורדת למי."}],relatedLessonIds:["hm-5-3"]},{id:"hm-5-3",unitId:"hm-unit-5",order:3,title:"הרמוניזציה של לחן",subtitle:"להלביש אקורדים על מנגינה",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🧵",body:"הרמוניזציה = בחירת אקורד שיתאים לכל צליל בלחן. הכלל הפשוט: בחרו אקורד שהצליל המלודי שייך אליו. עם I, IV ו-V לבד אפשר להלביש רוב הלחנים הפשוטים בדו מז׳ור."},{kind:"concept",heading:"איזה אקורד לכל צליל?",body:"דו שייך ל-I (דו·מי·סול) ול-IV (פה·לה·דו). מי שייך ל-I. פה, לה שייכים ל-IV. סול, סי, רה שייכים ל-V. כך מתאימים אקורד לכל צליל מלודי."},{kind:"notation",heading:"הלחן דו·רה·מי מולבש ב-I·V·I",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["d/4","g/4","b/4"],duration:"q"},{keys:["c/4","e/4","g/4"],duration:"q"}]},body:"דו→I (דו·מי·סול), רה→V (רה בתוך סול·סי·רה), מי→I (דו·מי·סול). כל צליל נשען על אקורד ששייך אליו."},{kind:"tip",icon:"💡",body:"סיימו לחן על הטוניקה עם קדנצה V→I (או V7→I) — כך הסיום נשמע סגור ומשכנע. פתחו לרוב ב-I כדי לבסס את המרכז."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"אילו אקורדים ראשיים מתאימים לצליל המלודי דו בדו מז׳ור?",options:[{label:"I (דו·מי·סול) או IV (פה·לה·דו)",correct:!0},{label:"רק V (סול·סי·רה)",correct:!1},{label:"רק vii° (סי·רה·פה)",correct:!1}],explanation:"דו נמצא גם ב-I (כשורש) וגם ב-IV (כקווינטה), ולכן שני האקורדים הראשיים האלה יכולים להלביש אותו."},{prompt:"איזו קדנצה נותנת ללחן סיום סגור ומשכנע על הטוניקה?",options:[{label:"V→I (או V7→I)",correct:!0},{label:"I→V",correct:!1},{label:"IV→V",correct:!1}],explanation:"V→I (וחזק אף יותר V7→I) היא הקדנצה האותנטית — הסיום החזק והסגור ביותר על הטוניקה."}],relatedLessonIds:[]}],p$={id:"course-piano",title:"יסודות הפסנתר",subtitle:"קורס שנה א׳ · שירת הלויים",description:"הצעד הראשון אל הקלידים: להכיר את מפת המקשים, לשבת ולהניח את היד נכון, לקרוא את המפתחות ליד ימין ושמאל, לנגן מנגינה ראשונה ולהוסיף אקורד פשוט. בלי מהירות, בלי לחץ — עיקרון אחד בכל שיעור, תרגול ומשוב.",trackId:"track-men"},f$=[{id:"pn-unit-1",courseId:"course-piano",order:1,title:"מפת הקלידים",summary:"תבנית המקשים השחורים, איך מוצאים דו ושמות המקשים הלבנים",icon:"🗺️"},{id:"pn-unit-2",courseId:"course-piano",order:2,title:"יד, יציבה ואצבוע",summary:"מספרי האצבעות, יד רפויה ומעוגלת ותנוחת דו לחמש אצבעות",icon:"🖐️"},{id:"pn-unit-3",courseId:"course-piano",order:3,title:"קריאת התיווי ליד ימין ושמאל",summary:"מפתח סול = יד ימין, מפתח פה = יד שמאל, ודו המרכזי ביניהם",icon:"🎼"},{id:"pn-unit-4",courseId:"course-piano",order:4,title:"המנגינה הראשונה",summary:"מנגינה במדרגות ביד ימין, פעימה יציבה וצירוף יד שמאל",icon:"🎵"},{id:"pn-unit-5",courseId:"course-piano",order:5,title:"אקורדים ראשונים וליווי",summary:"שילוש דו, הדרגות I–IV–V כליווי ומנגינה מעל אקורד",icon:"🎹"}],g$=[{id:"pn-1-1",unitId:"pn-unit-1",order:1,title:"תבנית המקשים השחורים",subtitle:"קבוצות של שניים ושלושה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"⬛",body:"הפסנתר נראה מסובך, אבל הוא בעצם תבנית אחת שחוזרת שוב ושוב. המקשים השחורים מסודרים תמיד בקבוצות מתחלפות: קבוצה של שני שחורים, ואז קבוצה של שלושה שחורים."},{kind:"concept",heading:"זו המפה שלכם",body:"ברגע שאתם רואים קבוצות של 2 ו-3 שחורים חוזרות לאורך כל הפסנתר — אתם כבר יודעים לנווט. כל הצלילים הלבנים מוגדרים ביחס לתבנית הזו."},{kind:"tip",icon:"💡",body:"התבנית של 2 ו-3 שחורים חוזרת בכל אוקטבה. פסנתר גדול הוא פשוט אותה חבילה קטנה שחוזרת שוב ושוב."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לנסות לשנן כל מקש בנפרד. אין צורך — מספיק לזהות את קבוצות השחורים, וכל השאר נגזר מהן."}],practiceActivityIds:[],quiz:[{prompt:"איך מסודרים המקשים השחורים בפסנתר?",options:[{label:"בקבוצות מתחלפות של שניים ושלושה",correct:!0},{label:"בקבוצות קבועות של ארבעה",correct:!1},{label:"ללא סדר, באקראי",correct:!1}],explanation:"התבנית הבסיסית היא קבוצה של 2 שחורים ואז קבוצה של 3 שחורים — והיא חוזרת לאורך כל הפסנתר."}],relatedLessonIds:["pn-1-2"]},{id:"pn-1-2",unitId:"pn-unit-1",order:2,title:"איך מוצאים דו",subt
4080itle:"משמאל לזוג השחורים",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🔍",body:"הצליל דו (C) הוא המקש הלבן שנמצא בדיוק משמאל לקבוצת שני המקשים השחורים. מצאו זוג שחורים — והמקש הלבן הצמוד להם משמאל הוא דו."},{kind:"notation",heading:"זה הצליל שאנחנו מחפשים — דו",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"w"}]},body:"דו המרכזי (c/4) — נקודת העוגן הראשונה שלנו על הקלידים."},{kind:"tip",icon:"💡",body:"יש הרבה מקשי דו על הפסנתר (אחד לכל אוקטבה) — כל אחד מהם נמצא משמאל לזוג שחורים. כולם נקראים דו."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחפש דו לפי צבע או מיקום מוחלט. תמיד מחפשים אותו ביחס לזוג השחורים — זה עובד בכל פסנתר."}],practiceActivityIds:[],quiz:[{prompt:"איפה נמצא המקש דו ביחס למקשים השחורים?",options:[{label:"המקש הלבן משמאל לקבוצת שני השחורים",correct:!0},{label:"המקש הלבן משמאל לקבוצת שלושת השחורים",correct:!1},{label:"המקש השחור הראשון בקבוצה",correct:!1}],explanation:"דו הוא תמיד המקש הלבן הצמוד משמאל לזוג המקשים השחורים — כלל שעובד בכל אוקטבה."}],relatedLessonIds:["pn-1-3"]},{id:"pn-1-3",unitId:"pn-unit-1",order:3,title:"שמות המקשים הלבנים",subtitle:"דו־רה־מי־פה־סול־לה־סי",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔤",body:"מדו והלאה, המקשים הלבנים עולים בסדר קבוע: דו־רה־מי־פה־סול־לה־סי, ואז שוב דו. שבעה שמות שחוזרים על עצמם לאורך כל הפסנתר."},{kind:"notation",heading:"שבעת הלבנים מדו ומעלה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"דו־רה־מי־פה־סול־לה־סי ואז דו הבא, אוקטבה מעל."},{kind:"tip",icon:"💡",body:"דו נמצא משמאל לזוג השחורים, ופה נמצא משמאל לשלישיית השחורים. שתי נקודות עוגן אלו עוזרות למקם את כל השאר."}],practiceActivityIds:["act-piano-play-1"],quiz:[{prompt:"מהו הצליל הלבן שאחרי מי, בעלייה?",options:[{label:"פה",correct:!0},{label:"רה",correct:!1},{label:"סול",correct:!1}],explanation:"סדר הלבנים בעלייה הוא דו־רה־מי־פה־סול־לה־סי. אחרי מי בא פה (וביניהם אין מקש שחור)."},{prompt:"כמה שמות שונים יש למקשים הלבנים לפני שהם חוזרים על עצמם?",options:[{label:"שבעה",correct:!0},{label:"חמישה",correct:!1},{label:"שמונה",correct:!1}],explanation:"יש שבעה שמות — דו־רה־מי־פה־סול־לה־סי — ואז הם חוזרים מדו הבא באוקטבה."}],relatedLessonIds:["pn-2-1"]},{id:"pn-2-1",unitId:"pn-unit-2",order:1,title:"מספרי האצבעות",subtitle:"האגודל הוא 1 בשתי הידיים",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🖐️",body:"בנגינה כל אצבע מקבלת מספר: האגודל = 1, האצבע = 2, האמה = 3, הקמיצה = 4, הזרת = 5. זה נכון גם ביד ימין וגם ביד שמאל."},{kind:"concept",heading:"סימטריה בין הידיים",body:'שימו לב: האגודל תמיד 1 בשתי הידיים, לכן בשתי הידיים המספרים "פוגשים" זה את זה במרכז (שני האגודלים) והזרתות בקצוות.'},{kind:"tip",icon:"💡",body:"האצבוע (איזו אצבע מנגנת איזה צליל) אינו קישוט — אצבוע טוב הופך קטעים קשים לקלים. שווה להתרגל אליו מההתחלה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לנגן הכול באצבע אחת "החזקה". זה עובד לרגע, אבל חוסם כל התקדמות. תנו לכל אצבע את התפקיד שלה.'}],practiceActivityIds:[],quiz:[{prompt:"איזו אצבע מסומנת במספר 1?",options:[{label:"האגודל",correct:!0},{label:"הזרת",correct:!1},{label:"האמה (האצבע האמצעית)",correct:!1}],explanation:"האגודל הוא תמיד אצבע מספר 1, בשתי הידיים. הזרת היא 5."}],relatedLessonIds:["pn-2-2"]},{id:"pn-2-2",unitId:"pn-unit-2",order:2,title:"יד רפויה ומעוגלת",subtitle:"יציבה, שורש כף היד וכתפיים",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🫧",body:"היד צריכה להיות רפויה ומעוגלת, כאילו אתם מחזיקים בעדינות כדור קטן או תפוח. האצבעות מכופפות מעט, וכף היד אינה שטוחה על הקלידים."},{kind:"concept",heading:"יציבה נכונה",body:"שבו זקוף, כתפיים משוחררות, מרפקים בערך בגובה הקלידים, ושורש כף היד גמיש ולא נוקשה. גוף רגוע מייצר צליל רגוע."},{kind:"tip",icon:"💡",body:"אם היד או הכתף מתחילות לכאוב — עצרו. מתח הוא האויב מספר אחת של הפסנתרן המתחיל. נגינה טובה מרגישה קלה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'להשטיח את האצבעות ולנגן עם כף יד "קרוסה". זה גורם למתח ולצליל לא אחיד. שמרו על קימור עדין וטבעי.'}],practiceActivityIds:[],quiz:[{prompt:"איך צריכה להיראות היד על הקלידים?",options:[{label:"רפויה ומעוגלת, כאילו מחזיקים כדור קטן",correct:!0},{label:"שטוחה לגמרי על הקלידים",correct:!1},{label:"מתוחה עם אצבעות ישרות ונוקשות",correct:!1}],explanation:"יד רפויה ומעוגלת (כמו סביב תפוח) מאפשרת שליטה, מונעת מתח ומפיקה צליל אחיד."}],relatedLessonIds:["pn-2-3"]},{id:"pn-2-3",unitId:"pn-unit-2",order:3,title:"תנוחת דו לחמש אצבעות",subtitle:"יד ימין: דו=1 עד סול=5",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"✋",body:"הניחו את יד ימין כך שהאגודל (1) על דו, ואז אצבע אחר אצבע: רה=2, מי=3, פה=4, סול=5. חמש אצבעות על חמישה מקשים לבנים סמוכים — בלי לזוז."},{kind:"notation",heading:"תנוחת דו: דו־רה־מי־פה־סול",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"חמשת הצלילים של תנוחת דו: דו(1)־רה(2)־מי(3)־פה(4)־סול(5) ביד ימין."},{kind:"tip",icon:"💡",body:'בתנוחה זו כל אצבע "אחראית" על מקש אחד קבוע. זה מאפשר לנגן בלי להסתכל כל הזמן על הידיים.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להזיז את כל היד כדי להגיע לצליל שכנה. בתנוחת חמש אצבעות היד נשארת במקום — רק האצבע המתאימה יורדת."}],practiceActivityIds:["act-piano-play-1"],quiz:[{prompt:"בתנוחת דו ביד ימין, איזו אצבע מנגנת את הצליל סול?",options:[{label:"הזרת (אצבע 5)",correct:!0},{label:"האגודל (אצבע 1)",correct:!1},{label:"האמה (אצבע 3)",correct:!1}],explanation:"בתנוחת דו: דו=1, רה=2, מי=3, פה=4, סול=5. סול מנוגן בזרת (אצבע 5)."}],relatedLessonIds:["pn-3-1"]},{id:"pn-3-1",unitId:"pn-unit-3",order:1,title:"שני מפתחות, שתי ידיים",subtitle:"מפתח סול למעלה, מפתח פה למטה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎼",body:'תווי הפסנתר נכתבים על שני חמשות יחד ("המערכת הגדולה"). החמשה העליונה במפתח סול — לרוב ליד ימין; החמשה התחתונה במפתח פה — לרוב ליד שמאל.'},{kind:"notation",heading:"מפתח סול — דו המרכזי",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"w"}]},body:"דו המרכזי במפתח סול נכתב מתחת לחמשה, על קו עזר קצר."},{kind:"notation",heading:"מפתח פה — דו המרכזי",notation:{clef:"bass",notes:[{keys:["c/4"],duration:"w"}]},body:"אותו דו מרכזי (c/4) במפתח פה נכתב מעל החמשה, על קו עזר קצר."},{kind:"tip",icon:"💡",body:"שתי הידיים מנוגנות בו-זמנית מהמערכת: העין קוראת למעלה ולמטה יחד. בהתחלה מתאמנים על יד אחת בכל פעם."}],practiceActivityIds:["act-sight-1","act-sr-name-bass"],quiz:[{prompt:"איזה מפתח משמש לרוב לתווי יד שמאל בפסנתר?",options:[{label:"מפתח פה 
4080(החמשה התחתונה)",correct:!0},{label:"מפתח סול (החמשה העליונה)",correct:!1},{label:"שני המפתחות בו-זמנית ליד אחת",correct:!1}],explanation:"במערכת הגדולה: מפתח סול (עליון) ליד ימין, מפתח פה (תחתון) ליד שמאל."}],relatedLessonIds:["pn-3-2"]},{id:"pn-3-2",unitId:"pn-unit-3",order:2,title:"דו המרכזי מחבר את הידיים",subtitle:"הצליל שבין שתי החמשות",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🌉",body:"דו המרכזי (c/4) הוא הצליל שיושב בדיוק בין שתי החמשות — מתחת למפתח סול ומעל מפתח פה. הוא נקודת המפגש של שתי הידיים."},{kind:"notation",heading:"דו המרכזי ומעליו סול (יד ימין)",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["g/4"],duration:"h"}]},body:"מדו המרכזי (על קו העזר התחתון) עולים אל סול שבתוך החמשה."},{kind:"notation",heading:"דו המרכזי ומתחתיו דו נמוך (יד שמאל)",notation:{clef:"bass",notes:[{keys:["c/4"],duration:"h"},{keys:["c/3"],duration:"h"}]},body:"מדו המרכזי (c/4, על קו העזר העליון) יורדים אל דו הנמוך אוקטבה מתחת (c/3) — צליל אופייני ליד שמאל."},{kind:"tip",icon:"💡",body:"זכרו: אותו דו מרכזי נכתב בשני מקומות שונים (למטה במפתח סול, למעלה במפתח פה) — אבל על הפסנתר זהו מקש אחד ויחיד."}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"איפה ממוקם דו המרכזי במערכת הגדולה?",options:[{label:"בין שתי החמשות — מתחת למפתח סול ומעל מפתח פה",correct:!0},{label:"גבוה בתוך החמשה של מפתח סול",correct:!1},{label:"נמוך מאוד מתחת למפתח פה",correct:!1}],explanation:"דו המרכזי (c/4) יושב בין החמשות, על קו עזר קצר — נקודת המפגש של יד ימין ויד שמאל."}],relatedLessonIds:["pn-3-3"]},{id:"pn-3-3",unitId:"pn-unit-3",order:3,title:"מהתו אל המקש",subtitle:"לתרגם צליל כתוב לקליד",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:"הכישור המרכזי בשלב זה: לראות תו על החמשה, לזהות את שמו (דו, רה, מי...), ולמצוא את המקש המתאים על הפסנתר. תו → שם → מקש."},{kind:"notation",heading:"תרגמו מדרגות מדו: דו־רה־מי",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"}]},body:"שלושה תווים במדרגות מדו: קראו את השם, ואז נגנו את המקש בתנוחת דו (1־2־3)."},{kind:"tip",icon:"💡",body:'בתחילה תרגמו לאט ובקול: "זה מי — אני מנגן במקש מי". עם הזמן התרגום נעשה מיידי ואוטומטי.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להסתכל רק על הידיים ולא על התווים. המטרה הפוכה — לקרוא מהתווים ולתת לאצבעות למצוא את הדרך."}],practiceActivityIds:["act-nsel-high"],quiz:[{prompt:"מהו הסדר הנכון של תרגום תו כתוב לנגינה?",options:[{label:"לזהות את שם התו, ואז למצוא את המקש המתאים",correct:!0},{label:"לנחש מקש אקראי ולבדוק אם נשמע נכון",correct:!1},{label:"להסתכל רק על היד בלי לקרוא את התו",correct:!1}],explanation:"קוראים את התו ← מזהים את שמו ← מנגנים את המקש. זהו לב קריאת התווים בפסנתר."}],relatedLessonIds:["pn-4-1"]},{id:"pn-4-1",unitId:"pn-unit-4",order:1,title:"מנגינה במדרגות",subtitle:"יד ימין עולה ויורדת בתנוחת דו",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎵",body:"המנגינה הראשונה נעה במדרגות (צליל אחר צליל שכן) בתוך תנוחת דו. אין קפיצות — כל אצבע יורדת בתורה על המקש שלה."},{kind:"notation",heading:"מנגינה ראשונה ביד ימין",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"h"},{keys:["f/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["c/4"],duration:"h"}]},body:"עלייה מדו לסול וחזרה לדו — כולה במדרגות, בתנוחת דו (אצבעות 1 עד 5)."},{kind:"tip",icon:"💡",body:"נגנו לאט. מנגינה איטית ונקייה עדיפה על מהירה ומבולבלת. המהירות תבוא מעצמה עם הביטחון."}],practiceActivityIds:["act-piano-play-1"],quiz:[{prompt:'מהי "תנועה במדרגות" במנגינה?',options:[{label:"מעבר לצליל השכן הקרוב, בלי קפיצות",correct:!0},{label:"קפיצה רחבה בין צלילים מרוחקים",correct:!1},{label:"חזרה על אותו צליל שוב ושוב",correct:!1}],explanation:"תנועה במדרגות היא מעבר לצליל הסמוך (למשל דו→רה→מי). זו התנועה הקלה ביותר לנגן בתנוחת דו."}],relatedLessonIds:["pn-4-2"]},{id:"pn-4-2",unitId:"pn-unit-4",order:2,title:"פעימה יציבה",subtitle:"לשמור על דופק אחיד",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🥁",body:'מנגינה חיה כשהפעימה אחידה. ספרו בקול "אחת־שתיים־שלוש־ארבע" בקצב קבוע, ותנו לכל צליל את משכו המדויק — רבע על ספירה אחת, חצי על שתיים.'},{kind:"notation",heading:"ארבעה רבעים ושני חצאים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"h"},{keys:["c/4"],duration:"h"}]},body:"ארבעה רבעים (ספירה לכל אחד) ואז שני חצאים (שתי ספירות לכל אחד) — פעימה שווה לאורך כל התיבה."},{kind:"tip",icon:"💡",body:"מטרונום או ספירה בקול הם חברים, לא אויבים. פעימה יציבה איטית שווה יותר מנגינה מהירה ומקרטעת."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להאיץ בקטעים קלים ולהאט בקשים. שמרו על אותו דופק לכל אורך הקטע — גם כשקשה."}],practiceActivityIds:["act-rhythm-1"],quiz:[{prompt:"כמה ספירות נמשך צליל בעל משך של חצי (h) ב-4/4?",options:[{label:"שתי ספירות",correct:!0},{label:"ספירה אחת",correct:!1},{label:"ארבע ספירות",correct:!1}],explanation:"ב-4/4 רבע (q) נמשך ספירה אחת, וחצי (h) נמשך שתי ספירות — הוא ארוך פי שניים מרבע."}],relatedLessonIds:["pn-4-3"]},{id:"pn-4-3",unitId:"pn-unit-4",order:3,title:"צירוף יד שמאל",subtitle:"לחן בימין, צליל אחד בשמאל",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🤝",body:"הצעד הראשון לתיאום שתי ידיים: יד ימין מנגנת את המנגינה, ויד שמאל מחזיקה צליל בודד ויציב מתחתיה — למשל דו נמוך שנשאר לאורך התיבה."},{kind:"notation",heading:"יד שמאל: דו נמוך מוחזק (מפתח פה)",notation:{clef:"bass",timeSignature:"4/4",notes:[{keys:["c/3"],duration:"w"}]},body:"יד שמאל מנגנת דו נמוך (c/3) ומחזיקה אותו תיבה שלמה, בעוד יד ימין מנגנת את המנגינה מעליו."},{kind:"tip",icon:"💡",body:"התחילו לאט מאוד: נגנו קודם כל יד בנפרד עד שהיא זורמת, ורק אז חברו. תיאום נבנה בסבלנות, לא בכוח."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לנסות לחבר שתי ידיים במהירות מלאה מיד. האטו לקצב שבו שתי הידיים מדויקות — גם אם זה איטי מאוד בהתחלה."}],practiceActivityIds:["act-piano-scale-1"],quiz:[{prompt:"מהי הדרך המומלצת ללמוד קטע לשתי ידיים?",options:[{label:"לתרגל כל יד בנפרד ואז לחבר לאט",correct:!0},{label:"לחבר מיד את שתי הידיים במהירות מלאה",correct:!1},{label:"לוותר על יד שמאל לגמרי",correct:!1}],explanation:"לומדים כל יד בנפרד עד שהיא זורמת, ואז מחברים בקצב איטי. התיאום נבנה בהדרגה."}],relatedLessonIds:["pn-5-1"]},{id:"pn-5-1",unitId:"pn-unit-5",order:1,title:"שילוש דו",subt
4080itle:"דו־מי־סול ביד אחת",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎹",body:"האקורד הראשון: שילוש דו מז׳ור — שלושת הצלילים דו־מי־סול מנוגנים יחד. הם מדלגים מקש לבן אחד ביניהם (דו, מדלגים על רה, מי, מדלגים על פה, סול)."},{kind:"notation",heading:"שילוש דו — דו־מי־סול",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:"דו־מי־סול יחד: צליל מלא ויציב. ביד ימין נוח לנגנו באצבעות 1־3־5."},{kind:"tip",icon:"💡",body:'שימו לב לצורה של היד: אגודל על דו, אמה על מי, זרת על סול — "פישוק" נעים שחוזר בהרבה אקורדים.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לנגן את שלושת הצלילים בזה אחר זה במקום יחד. באקורד כל הצלילים יורדים בו-זמנית — צליל אחד עשיר."}],practiceActivityIds:["act-theory-1"],quiz:[{prompt:"מאילו צלילים בנוי שילוש דו מז׳ור?",options:[{label:"דו־מי־סול",correct:!0},{label:"דו־רה־מי",correct:!1},{label:"דו־פה־לה",correct:!1}],explanation:"שילוש דו מז׳ור בנוי מדו (שורש), מי (טרצה) וסול (קווינטה) — דו־מי־סול."}],relatedLessonIds:["pn-5-2"]},{id:"pn-5-2",unitId:"pn-unit-5",order:2,title:"שלושת אקורדי הליווי",subtitle:"I, IV ו-V בדו מז׳ור",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🎸",body:"רוב השירים הפשוטים מלווים בשלושה אקורדים בלבד: דו (I), פה (IV) וסול (V). עם שלושתם אפשר ללוות אינספור מנגינות בדו מז׳ור."},{kind:"notation",heading:"אקורד פה (IV) — פה־לה־דו",notation:{clef:"treble",notes:[{keys:["f/4","a/4","c/5"],duration:"w"}]},body:"שילוש פה מז׳ור: פה־לה־דו. הוא מרחיק מעט מהבית ומכין את הדרך לאקורד סול."},{kind:"notation",heading:"אקורד סול (V) — סול־סי־רה",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"w"}]},body:"שילוש סול מז׳ור: סול־סי־רה. יוצר מתח שנמשך לחזור לאקורד דו (I)."},{kind:"tip",icon:"💡",body:"ליד שמאל אפשר לנגן רק את הצליל השורשי של כל אקורד (דו / פה / סול) כליווי פשוט — כבר זה נשמע מלא."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"מאילו צלילים בנוי אקורד סול (V) בדו מז׳ור?",options:[{label:"סול־סי־רה",correct:!0},{label:"סול־לה־סי",correct:!1},{label:"פה־לה־דו",correct:!1}],explanation:"אקורד V בדו הוא שילוש סול מז׳ור: סול (שורש), סי (טרצה), רה (קווינטה). פה־לה־דו הוא IV."},{prompt:"אילו שלושה אקורדים מספיקים לרוב כדי ללוות שיר פשוט בדו מז׳ור?",options:[{label:"דו (I), פה (IV) וסול (V)",correct:!0},{label:"רה, מי ולה",correct:!1},{label:"רק אקורד דו",correct:!1}],explanation:"שלוש הדרגות המרכזיות — I (דו), IV (פה) ו-V (סול) — מכסות את רוב הליווי בדו מז׳ור."}],relatedLessonIds:["pn-5-3"]},{id:"pn-5-3",unitId:"pn-unit-5",order:3,title:"מנגינה מעל אקורד",subtitle:"שמאל מחזיקה, ימין שרה",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🎶",body:"הצירוף המספק הראשון: יד שמאל מחזיקה אקורד דו (I), ויד ימין מנגנת מעליו מנגינה קטנה. פתאום זה נשמע כמו מוזיקה שלמה."},{kind:"notation",heading:"יד שמאל: אקורד דו מוחזק (מפתח פה)",notation:{clef:"bass",timeSignature:"4/4",notes:[{keys:["c/3","e/3","g/3"],duration:"w"}]},body:"יד שמאל מחזיקה שילוש דו נמוך (דו־מי־סול, c/3־e/3־g/3) תיבה שלמה כבסיס יציב."},{kind:"notation",heading:"יד ימין: מנגינה קטנה מעל",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["e/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["c/4"],duration:"h"}]},body:"מעל האקורד המוחזק, יד ימין שרה מנגינה קטנה: מי־רה־דו — ונחה על הטוניקה."},{kind:"tip",icon:"💡",body:"כל צלילי המנגינה (מי, רה, דו) שייכים לאקורד דו או קרובים אליו — לכן הכול נשמע מתיישב יחד ונעים לאוזן."}],practiceActivityIds:[],quiz:[{prompt:'בצירוף "מנגינה מעל אקורד", מה עושה כל יד?',options:[{label:"שמאל מחזיקה אקורד, ימין מנגנת מנגינה מעליו",correct:!0},{label:"שתי הידיים מנגנות את אותה מנגינה בדיוק",correct:!1},{label:"ימין מחזיקה אקורד, שמאל מנגנת מנגינה גבוהה",correct:!1}],explanation:"הליווי הבסיסי: יד שמאל מחזיקה את האקורד (הבסיס ההרמוני), ויד ימין נושאת את המנגינה מעליו."}],relatedLessonIds:[]}],y$={id:"course-notation",title:"כתיב מוזיקלי דיגיטלי",subtitle:"קורס שנה א׳ · שירת הלויים",description:"ללמוד איך הכתיב המוזיקלי עובד — ורק אז לבטא את הידע בכלים דיגיטליים. לומדים מושג, מתרגלים מיד, ומקבלים משוב.",trackId:"track-men"},b$=[{id:"unit-1",courseId:"course-notation",order:1,title:"מבוא לכתיב מוזיקלי",summary:"למה יש כתיב, החמשה, מפתחות, תיבות וקווי תיבה",icon:"🎼"},{id:"unit-2",courseId:"course-notation",order:2,title:"תווים",summary:"גובה הצליל, קווי עזר, סימני היתק ואוקטבות",icon:"🎵"},{id:"unit-3",courseId:"course-notation",order:3,title:"מקצב",summary:"ערכי תווים, שתיקות, נקודות, קשתות ומשקל",icon:"🥁"},{id:"unit-4",courseId:"course-notation",order:4,title:"סולמות",
4080summary:"מז׳ור, מינור, חתימות מפתח ומעגל הקווינטות",icon:"🎹"},{id:"unit-5",courseId:"course-notation",order:5,title:"מרווחים",summary:"זיהוי, קריאה ובנייה של מרווחים",icon:"📏"},{id:"unit-6",courseId:"course-notation",order:6,title:"אקורדים",summary:"משולשים, ספטאקורדים, היפוכים וסמלי אקורד",icon:"🎶"},{id:"unit-7",courseId:"course-notation",order:7,title:"קריאת פרטיטורה",summary:"כתיב פסנתר, ריבוי קולות ומערכת כפולה",icon:"📖"},{id:"unit-8",courseId:"course-notation",order:8,title:"כתיבת מוזיקה",summary:"התלמידים מתחילים לכתוב תווים בעצמם",icon:"✍️"},{id:"unit-9",courseId:"course-notation",order:9,title:"היכרות עם MuseScore",summary:"התקנה, יצירת פרטיטורה, הזנת תווים, השמעה וייצוא",icon:"💻"},{id:"unit-10",courseId:"course-notation",order:10,title:"תהליך עבודה דיגיטלי",summary:"פרויקטים הולכים ומורכבים ב-MuseScore",icon:"🚀"}],x$=[{id:"lesson-1-1",unitId:"unit-1",order:1,title:"למה קיים כתיב מוזיקלי?",subtitle:"השפה שמאפשרת לשמור ולהעביר מוזיקה",estimatedMinutes:3,knowledgeIds:["concept.tempo"],sections:[{kind:"concept",icon:"🎯",body:"כתיב מוזיקלי הוא שפה כתובה למוזיקה. הוא מאפשר לשמור יצירה, להעביר אותה לנגן אחר, וללמד אותה — בלי להסתמך רק על הזיכרון והשמיעה."},{kind:"concept",heading:"מה הכתיב מתאר?",body:"שני דברים עיקריים: אילו צלילים מנגנים (גובה), ומתי וכמה זמן (מקצב). כל שאר הסימנים מוסיפים פרטים — עוצמה, אופי וביטוי."},{kind:"tip",icon:"💡",body:'חשבו על התווים כמו על אותיות: ברגע שמכירים אותן, אפשר "לקרוא" כל יצירה — גם כזו שלא שמעתם מעולם.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"רבים חושבים שצריך לזכור כל יצירה בעל-פה. הכתיב בדיוק משחרר מזה — קוראים מהדף."}],practiceActivityIds:[],quiz:[{prompt:"מה התפקיד המרכזי של כתיב מוזיקלי?",options:[{label:"לשמור ולהעביר מוזיקה בכתב",correct:!0},{label:"להחליף את הנגן",correct:!1},{label:"לנגן במקומנו",correct:!1}],explanation:"הכתיב הוא שפה כתובה — הוא שומר את המוזיקה ומאפשר להעביר וללמד אותה, אך הנגינה עצמה נשארת בידי הנגן."},{prompt:"אילו שני מרכיבים הכתיב מתאר בעיקר?",options:[{label:"גובה הצליל והמקצב",correct:!0},{label:"צבע ומחיר",correct:!1},{label:"שם המלחין והתאריך",correct:!1}],explanation:"הבסיס הוא גובה (אילו צלילים) ומקצב (מתי וכמה זמן). שאר הסימנים מוסיפים ביטוי."}],relatedLessonIds:["lesson-1-2"]},{id:"lesson-1-2",unitId:"unit-1",order:2,title:"החמשה",subtitle:"חמישה קווים וארבעה רווחים",estimatedMinutes:4,knowledgeIds:["pitch.c","pitch.e","pitch.g"],sections:[{kind:"concept",icon:"🎼",body:"החמשה היא חמישה קווים מקבילים וארבעה הרווחים שביניהם. ככל שהתו גבוה יותר על החמשה — כך הצליל גבוה יותר."},{kind:"notation",heading:"חמשה ריקה",notation:{clef:"treble",notes:[]},body:"זו החמשה עם מפתח סול. עדיין בלי תווים."},{kind:"notation",heading:"תווים על קווים וברווחים",notation:{clef:"treble",notes:[{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"}]},body:"תו יכול לשבת על קו (הקו עובר במרכזו) או ברווח שבין שני קווים."},{kind:"tip",icon:"💡",body:'התו יושב "על קו" אם הקו חוצה אותו, ו"ברווח" אם הוא נמצא בין שני קווים.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"סופרים את הקווים מלמעלה למטה. מקובל לספור מלמטה למעלה — הקו התחתון הוא הראשון."}],practiceActivityIds:["act-sight-1","act-note-tb-1"],quiz:[{prompt:"מכמה קווים מורכבת החמשה?",options:[{label:"חמישה",correct:!0},{label:"ארבעה",correct:!1},{label:"שישה",correct:!1}],explanation:"חמשה = חמישה קווים מקבילים, וביניהם ארבעה רווחים."},{prompt:"תו שגבוה יותר על החמשה מייצג צליל…",options:[{label:"גבוה יותר",correct:!0},{label:"נמוך יותר",correct:!1},{label:"חזק יותר",correct:!1}],explanation:"מיקום אנכי = גובה. גבוה על החמשה → צליל גבוה. עוצמה מסומנת בנפרד."}],relatedLessonIds:["lesson-1-3"]},{id:"lesson-1-3",unitId:"unit-1",order:3,title:"מפתחות",subtitle:"מה קובע את שמות הצלילים",estimatedMinutes:4,knowledgeIds:["pitch.g","pitch.f","pitch.c"],sections:[{kind:"concept",icon:"🔑",body:"המפתח בתחילת החמשה קובע אילו שמות-צלילים יושבים על הקווים והרווחים. אותו מיקום על החמשה יכול להיות צליל שונה — הכול תלוי במפתח."},{kind:"notation",heading:"מפתח סול",notation:{clef:"treble",notes:[{keys:["g/4"],duration:"w"}]},body:'מפתח סול "מלפף" את הקו של הצליל סול. מתאים לצלילים גבוהים.'},{kind:"notation",heading:"מפתח פה",notation:{clef:"bass",notes:[{keys:["f/3"],duration:"w"}]},body:"מפתח פה מסמן את הקו של הצליל פה. מתאים לצלילים נמוכים."},{kind:"tip",icon:"💡",body:"דו האמצעי (Middle C) יושב בדיוק בין שני המפתחות — מתחת למפתח סול ומעל מפתח פה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"קוראים תווים במפתח פה כאילו הם במפתח סול. שימו לב למפתח לפני שקוראים!"}],practiceActivityIds:["act-sight-1","act-sr-name-bass","act-note-bs-1"],quiz:[{prompt:"מה קובע המפתח בתחילת החמשה?",options:[{label:"את שמות הצלילים על הקווים והרווחים",correct:!0},{label:"את עוצמת הנגינה",correct:!1},{label:"את מהירות היצירה",correct:!1}],explanation:'המפתח הוא "נקודת ייחוס": הוא מקבע איזה צליל יושב על כל קו, ולכן אותו מיקום נקרא אחרת במפתח סול ובמפתח פה.'},{prompt:"לאיזה טווח מתאים מפתח פה?",options:[{label:"צלילים נמוכים",correct:!0},{label:"צלילים גבוהים",correct:!1},{label:"רק כלי הקשה",correct:!1}],explanation:"מפתח פה נועד לטווח הנמוך (יד שמאל בפסנתר, צ׳לו, בס), ומפתח סול לטווח הגבוה."}],relatedLessonIds:["lesson-1-2"]},{id:"lesson-1-4",unitId:"unit-1",order:4,title:"תיבות וקווי תיבה",subtitle:"איך מחלקים את הזמן",estimatedMinutes:3,knowledgeIds:["time_signature.4_4"],sections:[{kind:"concept",icon:"📏",body:"קו התיבה הוא קו אנכי שחוצה את החמשה ומחלק את המוזיקה ליחידות זמן שוות — תיבות. כל תיבה מכילה אותו מספר פעימות."},{kind:"concept",heading:"כיוון הקריאה",body:"קוראים תמיד משמאל לימין, תיבה אחר תיבה — גם בעברית. הזמן זורם קדימה עם המבט."},{kind:"tip",icon:"💡",body:"קו תיבה כפול בסוף מסמן את סיום הקטע."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"בגלל העברית, מנסים לקרוא תווים מימין לשמאל. הכתיב המוזיקלי תמיד משמאל לימין."}],practiceActivityIds:["act-sr-extreme"],quiz:[{prompt:"מה תפקידו של קו התיבה?",options:[{label:"לחלק את המוזיקה ליחידות זמן שוות",correct:!0},{label:"לסמן צליל גבוה",correct:!1},{label:"להחליף את המפתח",correct:!1}],explanation:"קו התיבה מחלק את הזרימה לתיבות שוות באורכן (במספר פעימות) — כך קל לקרוא ולספור."},{prompt:"באיזה כיוון קוראים כתיב מוזיקלי?",options:[{label:"משמאל לימין",correct:!0},{label:"מימין לשמאל",correct:!1},{label:"מלמעלה למטה",correct:!1}],explanation:"תמיד משמאל לימין — גם בטקסטים בעברית. הזמן המוזיקלי זורם עם המבט שמאלה-ימינה."}]},{id:"lesson-2-1",unitId:"unit-2",order:1,title:"גובה הצליל",subtitle:"למעלה = גבוה, למטה = נמוך",estimatedMinutes:3,knowledgeIds:["pitch.c","pitch.d","pitch.e"],sections:[{kind:"concept",icon:"🎵",body:"גובה הצליל נקבע לפי המיקום האנכי של התו על החמשה. ככל שהתו גבוה יותר על החמשה — הצליל גבוה יותר, וכל צליל מקבל שם: דו, רה, מי, פה, סול, לה, סי."},{kind:"notation",heading:"צלילים עולים",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"דו רה מי פה סול — כל תו גבוה מקודמו."},{kind:"tip",icon:"💡",body:"שבעת השמות חוזרים על עצמם: אחרי סי חוזרים לדו — באוקטבה הבאה."}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"תו שנמצא נמוך יותר על החמשה מייצג צליל…",options:[{label:"נמוך יותר",correct:!0},{label:"גבוה יותר",correct:!1},{label:"ארוך יותר",correct:!1}],explanation:"מיקום אנכי = גובה. נמוך על החמשה → צליל נמוך. משך הזמן מסומן בנפרד (צורת התו)."},{prompt:"כמה שמות צלילים בסיסיים יש לפני שהם חוזרים על עצמם?",options:[{label:"שבעה (דו–סי)",correct:!0},{label:"חמישה",correct:!1},{label:"שנים-עשר",correct:!1}],explanation:"שבעה שמות: דו רה מי פה סול לה סי — ואז חוזרים לדו באוקטבה שמעל."}],relatedLessonIds:["lesson-2-4"]},{id:"lesson-2-2",unitId:"unit-2",order:2,title:"קווי עזר",subtitle:"צלילים שמעל ומתחת לחמשה",estimatedMinutes:3,knowledgeIds:["pitch.c","pitch.a"],sections:[{kind:"concept",icon:"➕",body:"החמשה מכילה טווח מוגבל. צלילים גבוהים או נמוכים ממנה נכתבים על קווי עזר — קווים קצרים שמוסיפים מעל או מתחת לחמשה לפי הצורך."},{kind:"notation",heading:"דו אמצעי — קו עזר מתחת",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"w"}]},body:"דו האמצעי יושב על קו עזר אחד מתחת למפתח סול."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מבלבלים כמה קווי עזר יש. סופרים אותם אחד-אחד מהחמשה כלפי חוץ."}],practiceActivityIds:["act-sight-1","act-note-ledger-1"],quiz:[{prompt:"למה משמשים קווי עזר?",options:[{label:"לכתוב צלילים שמעל או מתחת לחמשה",correct:!0},{label:"לסמן עוצמה",correct:!1},{label:"להאריך את התו",correct:!1}],explanation:"קווי עזר מרחיבים את טווח החמשה — הם קווים קצרים שמאפשרים לכתוב צלילים גבוהים או נמוכים במיוחד."},{prompt:"היכן יושב דו האמצעי במפתח סול?",options:[{label:"על קו עזר אחד מתחת לחמשה",correct:!0},{label:"על הקו העליון",correct:!1},{label:"מחוץ לדף",correct:!1}],explanation:"דו האמצעי נמצא בדיוק קו-עזר אחד מתחת למפתח סול (וקו-עזר אחד מעל מפתח פה)."}]},{id:"lesson-2-3",unitId:"unit-2",order:3,title:"סימני היתק",subtitle:"דיאז, במול ובקאר",estimatedMinutes:4,knowledgeIds:["pitch.c","pitch.f"],sections:[{kind:"concept",icon:"♯",body:"סימני היתק משנים את גובה הצליל בחצי טון: דיאז (♯) מעלה בחצי טון, במול (♭) מוריד בחצי טון, ובקאר (♮) מבטל היתק קודם."},{kind:"notation",heading:"דו, דו♯, דו♭",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["c#/4"],duration:"q"},{keys:["cb/4"],duration:"q"}]},body:"אותו שם-צליל, שלושה גבהים שונים."},{kind:"tip",icon:"💡",body:'דו♯ ורה♭ נשמעים אותו צליל — זו "אנהרמוניה" (אותו קליד בפסנתר, שני שמות).'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"שוכחים שההיתק ממשיך עד סוף התיבה. בקאר מבטל אותו בתוך אותה תיבה."}],practiceActivityIds:["act-acc-sharps"],quiz:[{prompt:"מה עושה סימן דיאז (♯)?",options:[{label:"מעלה את הצליל בחצי טון",correct:!0},{label:"מוריד בחצי טון",correct:!1},{label:"מכפיל את המשך",correct:!1}],explanation:"דיאז מעלה בחצי טון; במול מוריד בחצי טון; בקאר מבטל היתק קודם."},{prompt:"דו♯ ורה♭ הם…",options:[{label:"אותו צליל, שני שמות (אנהרמוניה)",correct:!0},{label:"שני צלילים רחוקים",correct:!1},{label:"אותו שם בדיוק",correct:!1}],explanation:"הם נשמעים זהים ומנוגנים על אותו קליד — אך נכתבים אחרת לפי ההקשר. זו שקילות אנהרמונית."}]},{id:"lesson-2-4",unitId:"unit-2",order:4,title:"אוקטבות",subtitle:"אותו שם, גובה כפול",estimatedMinutes:3,knowledgeIds:["pitch.c"],sections:[{kind:"concept",icon:"🔁",body:'אוקטבה היא המרחק בין צליל לצליל הבא בעל אותו שם. דו ודו הבא (גבוה ממנו) נשמעים "אותו צליל" אך גבוה יותר — היחס התדרי ביניהם הוא בדיוק כפול.'},{kind:"notation",heading:"דו ודו — אוקטבה",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["c/5"],duration:"h"}]},body:"שני הצלילים נקראים דו, במרחק אוקטבה."},{kind:"tip",icon:"💡",body:"מספר האוקטבה עולה ב-1 בכל דו: דו4, דו5, דו6…"}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"שני צלילים במרחק אוקטבה…",options:[{label:"נושאים אותו שם",correct:!0},{label:"נושאים שמות שונים",correct:!1},{label:"לא קשורים",correct:!1}],explanation:"אוקטבה מחברת שני צלילים בעלי אותו שם (למשל דו–דו); הגבוה בדיוק כפול בתדר מהנמוך."},{prompt:"מתי עולה מספר האוקטבה?",options:[{label:"בכל צליל דו",correct:!0},{label:"בכל צליל סול",correct:!1},{label:"אף פעם",correct:!1}],explanation:"המספור עולה ביחידה בכל דו: אחרי סי מגיעים לדו של האוקטבה הבאה (דו4 → דו5)."}],relatedLessonIds:["lesson-2-1"]},{id:"lesson-3-1",unitId:"unit-3",order:1,title:"ערכי תווים",subtitle:"כמה זמן נמשך כל צליל",estimatedMinutes:4,knowledgeIds:["rhythm_pattern.quarters","time_signature.4_4"],sections:[{kind:"concept",icon:"🥁",body:"צורת התו קובעת את משכו. תו שלם נמשך הכי הרבה, וכל ערך קטן ממנו בחצי: שלם → חצי → רבע → שמינית."},{kind:"notation",heading:"שלם, חצי, רבע, שמינית",notation:{clef:"percussion",notes:[{duration:"w"},{duration:"h"},{duration:"q"},{duration:"8"}]},body:"מימין לשמאל בזמן: כל תו קצר מקודמו בח
4080צי."},{kind:"tip",icon:"💡",body:"ב-4/4: תו שלם = 4 פעימות, חצי = 2, רבע = 1, שמינית = חצי פעימה."}],practiceActivityIds:["act-rhythm-2","act-rhythm-basic-1"],quiz:[{prompt:"כמה פעימות נמשך תו רבע ב-4/4?",options:[{label:"פעימה אחת",correct:!0},{label:"ארבע פעימות",correct:!1},{label:"חצי פעימה",correct:!1}],explanation:"ב-4/4 הרבע הוא יחידת הפעימה — פעימה אחת. השלם = 4, החצי = 2, השמינית = חצי."},{prompt:"איזה תו ארוך יותר?",options:[{label:"חצי ארוך מרבע",correct:!0},{label:"רבע ארוך מחצי",correct:!1},{label:"שמינית ארוכה מחצי",correct:!1}],explanation:"הסדר מהארוך לקצר: שלם, חצי, רבע, שמינית. כל ערך הוא חצי מהקודם."}]},{id:"lesson-3-2",unitId:"unit-3",order:2,title:"שתיקות",subtitle:"גם השקט נכתב",estimatedMinutes:3,knowledgeIds:["rhythm_pattern.quarters"],sections:[{kind:"concept",icon:"🤫",body:"שתיקה (הפסקה) היא פרק זמן שבו לא מנגנים. לכל ערך תו יש שתיקה בעלת אותו משך: שתיקת רבע, שתיקת חצי וכן הלאה. השתיקה חלק מהמקצב בדיוק כמו הצליל."},{kind:"notation",heading:"רבע, שתיקת רבע, רבע",notation:{clef:"percussion",notes:[{duration:"q"},{duration:"qr"},{duration:"q"},{duration:"qr"}]},body:"סימני השתיקה ממלאים את הזמן בין הצלילים."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מדלגים על שתיקות במקום לספור אותן. שתיקה תופסת זמן — יש להמשיך לספור בזמנה."}],practiceActivityIds:["act-mek-dict-1","act-rhythm-basic-2"],quiz:[{prompt:"מה מייצגת שתיקה בתווים?",options:[{label:"פרק זמן שבו לא מנגנים",correct:!0},{label:"צליל חזק",correct:!1},{label:"סוף היצירה",correct:!1}],explanation:"שתיקה = שקט מתוזמן. יש לה משך מדויק (כמו לתו), ויש להמשיך לספור את הפעימות בזמנה."},{prompt:"לשתיקת רבע יש משך של…",options:[{label:"פעימה אחת",correct:!0},{label:"ארבע פעימות",correct:!1},{label:"ללא משך",correct:!1}],explanation:"לכל שתיקה משך זהה לתו באותו ערך: שתיקת רבע = פעימה אחת, בדיוק כמו תו רבע."}]},{id:"lesson-3-3",unitId:"unit-3",order:3,title:"נקודות וקשתות",subtitle:"להאריך צליל",estimatedMinutes:3,knowledgeIds:["rhythm_pattern.quarters_eighths"],sections:[{kind:"concept",icon:"⏱️",body:"נקודה מימין לתו מאריכה אותו בחצי מערכו: חצי מנוקד = חצי + רבע = 3 פעימות. קשת מחברת שני תווים בעלי אותו גובה למשך רציף אחד."},{kind:"notation",heading:"חצי מנוקד + רבע",notation:{clef:"percussion",notes:[{duration:"hd"},{duration:"q"}]},body:"החצי המנוקד נמשך 3 פעימות, ואחריו רבע — יחד תיבה שלמה ב-4/4."},{kind:"tip",icon:"💡",body:"ההבדל: נקודה מאריכה תו אחד; קשת מחברת שני תווים נפרדים לצליל אחד מתמשך."}],practiceActivityIds:["act-rhythm-2"],quiz:[{prompt:"בכמה מאריכה נקודה את התו?",options:[{label:"בחצי מערכו",correct:!0},{label:"בכפול",correct:!1},{label:"ברבע פעימה קבוע",correct:!1}],explanation:"נקודה מוסיפה מחצית מערך התו: חצי (2) מנוקד = 2 + 1 = 3 פעימות."},{prompt:"מה עושה קשת בין שני תווים באותו גובה?",options:[{label:"מחברת אותם לצליל רציף אחד",correct:!0},{label:"מנגנת אותם פעמיים",correct:!1},{label:"מקצרת אותם",correct:!1}],explanation:"קשת (בין שני צלילים זהים) מחברת את משכיהם — מנגנים פעם אחת ומחזיקים לאורך שניהם."}]},{id:"lesson-3-4",unitId:"unit-3",order:4,title:"משקל",subtitle:"מה מספרים חתימת המשקל",estimatedMinutes:4,knowledgeIds:["time_signature.4_4","time_signature.3_4"],sections:[{kind:"concept",icon:"🔢",body:"חתימת המשקל בתחילת הקטע היא שני מספרים. העליון = כמה פעימות בכל תיבה; התחתון = איזה ערך-תו מקבל פעימה (4 = רבע)."},{kind:"notation",heading:"ארבעה רבעים ב-4/4",notation:{clef:"percussion",timeSignature:"4/4",notes:[{duration:"q"},{duration:"q"},{duration:"q"},{duration:"q"}]},body:"4/4 — ארבע פעימות בתיבה, כל רבע פעימה."},{kind:"notation",heading:"שלושה רבעים ב-3/4",notation:{clef:"percussion",timeSignature:"3/4",n
4080otes:[{duration:"q"},{duration:"q"},{duration:"q"}]},body:"3/4 — שלוש פעימות בתיבה (מקצב ואלס)."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"חושבים שהמספר התחתון הוא מספר תווים. הוא מציין את ערך התו שמקבל פעימה (4 = רבע)."}],practiceActivityIds:["act-rhythm-2","act-rhythm-basic-3"],quiz:[{prompt:"מה מציין המספר העליון בחתימת המשקל?",options:[{label:"כמה פעימות בכל תיבה",correct:!0},{label:"את גובה הצליל",correct:!1},{label:"את מהירות הקטע",correct:!1}],explanation:"העליון = מספר הפעימות בתיבה. התחתון = ערך-התו שמקבל פעימה (4 = רבע). המהירות מסומנת בנפרד (טמפו)."},{prompt:"כמה פעימות בתיבה ב-3/4?",options:[{label:"שלוש",correct:!0},{label:"ארבע",correct:!1},{label:"שתיים",correct:!1}],explanation:"3/4 = שלוש פעימות בתיבה, כל אחת בערך רבע — המשקל האופייני לוואלס."}]},{id:"lesson-4-1",unitId:"unit-4",order:1,title:"סולם מז׳ור",subtitle:"רצף הטונים והחצאים",estimatedMinutes:4,knowledgeIds:["scale.major","key.c_major"],sections:[{kind:"concept",icon:"🎹",body:"סולם מז׳ור הוא רצף של שבעה צלילים בתבנית קבועה של מרחקים: טון-טון-חצי-טון-טון-טון-חצי. אותה תבנית מכל צליל פותח נותנת סולם מז׳ור."},{kind:"notation",heading:"סולם דו מז׳ור",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"8"},{keys:["d/4"],duration:"8"},{keys:["e/4"],duration:"8"},{keys:["f/4"],duration:"8"},{keys:["g/4"],duration:"8"},{keys:["a/4"],duration:"8"},{keys:["b/4"],duration:"8"},{keys:["c/5"],duration:"8"}]},body:"דו מז׳ור — כולו צלילים לבנים, בלי היתקים."},{kind:"tip",icon:"💡",body:"החצאי-טונים בסולם מז׳ור נמצאים תמיד בין המדרגות 3–4 ו-7–8 (מי-פה, סי-דו בדו מז׳ור)."}],practiceActivityIds:["act-spell-maj","act-spell-cmaj"],quiz:[{prompt:"מהי תבנית המרחקים בסולם מז׳ור?",options:[{label:"טון-טון-חצי-טון-טון-טון-חצי",correct:!0},{label:"חצי-טון-טון-חצי-טון-טון-טון",correct:!1},{label:"טון-חצי-טון-חצי-טון-טון-חצי",correct:!1}],explanation:"התבנית הקבועה של מז׳ור: W-W-H-W-W-W-H. שמירה עליה מכל צליל פותח יוצרת סולם מז׳ור תקין."},{prompt:"איזה סולם מז׳ור אין בו אף היתק?",options:[{label:"דו מז׳ור",correct:!0},{label:"סול מז׳ור",correct:!1},{label:"פה מז׳ור",correct:!1}],explanation:"דו מז׳ור בנוי כולו מצלילים טבעיים (הקלידים הלבנים). כל סולם מז׳ור אחר דורש דיאז או במול כדי לשמור על התבנית."}],relatedLessonIds:["lesson-4-3"]},{id:"lesson-4-2",unitId:"unit-4",order:2,title:"סולם מינור",subtitle:"הצבע האחר",estimatedMinutes:4,knowledgeIds:["scale.natural_minor","key.a_minor"],sections:[{kind:"concept",icon:"🌙",body:'סולם מינור טבעי נשמע "עצוב" או רך יותר. תבנית המרחקים שלו: טון-חצי-טון-טון-חצי-טון-טון. לה מינור בנוי, כמו דו מז׳ור, כולו מצלילים טבעיים.'},{kind:"notation",heading:"סולם לה מינור",notation:{clef:"treble",notes:[{keys:["a/4"],duration:"8"},{keys:["b/4"],duration:"8"},{keys:["c/5"],duration:"8"},{keys:["d/5"],duration:"8"},{keys:["e/5"],duration:"8"},{keys:["f/5"],duration:"8"},{keys:["g/5"],duration:"8"},{keys:["a/5"],duration:"8"}]},body:"לה מינור — המינור היחסי של דו מז׳ור."},{kind:"tip",icon:"💡",body:'לכל סולם מז׳ור יש "מינור יחסי" — מתחיל מהמדרגה השישית וחולק איתו את אותם צלילים (דו מז׳ור ↔ לה מינור).'}],practiceActivityIds:["act-spell-min"],quiz:[{prompt:"מהו המינור היחסי של דו מז׳ור?",options:[{label:"לה מינור",correct:!0},{label:"מי מינור",correct:!1},{label:"רה מינור",correct:!1}],explanation:"המינור היחסי מתחיל מהמדרגה השישית של המז׳ור. השישית של דו היא לה — ולכן לה מינור, החולק עם דו מז׳ור את אותם צלילים."},{prompt:"סולם מינור טבעי נבדל ממז׳ור ב…",options:[{label:"תבנית המרחקים (מיקום החצאים)",correct:!0},{label:"מספר הצלילים",correct:!1},{label:"כיוון הקריאה",correct:!1}],explanation:"בשניהם שבעה צלילים; ההבדל הוא במיקום החצאי-טונים, וזה מה שנותן למינור את צביונו."}]},{id:"lesson-4-3",unitId:"unit-4",order:3,title:"חתימות מפתח",subtitle:"הדיאזים והבמולים שבפתח",estimatedMinutes:4,knowledgeIds:["key.g_major","key.f_major"],sections:[{kind:"concept",icon:"🔑",body:"במקום לכתוב היתק ליד כל תו, מרכזים את ההיתקים הקבועים של הסולם בתחילת החמשה — חתימת המפתח. היא חלה על כל הקטע."},{kind:"notation",heading:"חתימה של סול מז׳ור",notation:{clef:"treble",keySignature:"G",notes:[]},body:"דיאז אחד (פה♯) — זו סול מז׳ור."},{kind:"notation",heading:"חתימה של פה מז׳ור",notation:{clef:"treble",keySignature:"F",notes:[]},body:"במול אחד (סי♭) — זו פה מז׳ור."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"שוכחים להחיל את החתימה לאורך כל התיבה. פה♯ בחתימה = כל צלילי פה מנוגנים כ-פה♯."}],practiceActivityIds:["act-key-first","act-spell-g","act-spell-f","act-key-basic-1"],quiz:[{prompt:"מה מסמנת חתימת המפתח?",options:[{label:"ההיתקים הקבועים של הסולם",correct:!0},{label:"את מהירות הקטע",correct:!1},{label:"את מספר הפעימות",correct:!1}],explanation:"החתימה מרכזת את הדיאזים/במולים של הסולם בתחילת החמשה, וחוסכת כתיבתם שוב ושוב."},{prompt:"כמה דיאזים בחתימה של סול מז׳ור?",options:[{label:"אחד (פה♯)",correct:!0},{label:"שניים",correct:!1},{label:"אף אחד",correct:!1}],explanation:"סול מז׳ור = דיאז אחד, פה♯. במעגל הקווינטות זו הדרגה הראשונה בצד הדיאזים אחרי דו."}],relatedLessonIds:["lesson-4-4"]},{id:"lesson-4-4",unitId:"unit-4",order:4,title:"מעגל הקווינטות",subtitle:"המפה של הסולמות",estimatedMinutes:4,knowledgeIds:["key.c_major","key.g_major","key.d_major"],sections:[{kind:"concept",icon:"🧭",body:"מעגל הקווינטות מסדר את הסולמות לפי מספר ההיתקים. כל צעד ימינה (קווינטה מעלה) מוסיף דיאז; כל צעד שמאלה (קווינטה מטה) מוסיף במול."},{kind:"concept",heading:"איך זוכרים?",body:"דו (0) → סול (1♯) → רה (2♯) → לה (3♯)… ובצד השני: דו → פה (1♭) → סי♭ (2♭)… כל שכן במעגל במרחק קווינטה."}
4080,{kind:"tip",icon:"💡",body:'המעגל עוזר גם למצוא את המינור היחסי ואת האקורדים הקרובים — כלים שכנים במעגל נשמעים "קרובים".'}],practiceActivityIds:["act-key-sharps"],quiz:[{prompt:"צעד אחד ימינה במעגל הקווינטות…",options:[{label:"מוסיף דיאז אחד",correct:!0},{label:"מוסיף במול אחד",correct:!1},{label:"מוריד אוקטבה",correct:!1}],explanation:"ימינה = קווינטה מעלה = דיאז נוסף (דו→סול→רה…). שמאלה = קווינטה מטה = במול נוסף."},{prompt:"כמה דיאזים ל-רה מז׳ור?",options:[{label:"שניים",correct:!0},{label:"אחד",correct:!1},{label:"שלושה",correct:!1}],explanation:"רה נמצאת שני צעדים ימינה מדו (דו→סול→רה), ולכן שני דיאזים: פה♯ ו-דו♯."}]},{id:"lesson-5-1",unitId:"unit-5",order:1,title:"מהו מרווח",subtitle:"המרחק בין שני צלילים",estimatedMinutes:3,knowledgeIds:["interval.M3","interval.P5"],sections:[{kind:"concept",icon:"📏",body:"מרווח הוא המרחק בין שני צלילים. סופרים אותו במדרגות: מ-דו ל-מי זו טרצה (3 מדרגות: דו-רה-מי), מ-דו ל-סול זו קווינטה (5 מדרגות)."},{kind:"notation",heading:"טרצה וקווינטה",notation:{clef:"treble",notes:[{keys:["c/4","e/4"],duration:"h"},{keys:["c/4","g/4"],duration:"h"}]},body:"משמאל טרצה (דו-מי), מימין קווינטה (דו-סול)."},{kind:"tip",icon:"💡",body:"סופרים מרווח כולל את שני הצלילים: דו→מי = דו(1) רה(2) מי(3) → טרצה."}],practiceActivityIds:["act-int-oct-1","act-sri-3rds"],quiz:[{prompt:"המרחק מ-דו ל-סול נקרא…",options:[{label:"קווינטה",correct:!0},{label:"טרצה",correct:!1},{label:"אוקטבה",correct:!1}],explanation:"דו-רה-מי-פה-סול = חמש מדרגות → קווינטה. סופרים כולל שני הצלילים."},{prompt:"כשסופרים מרווח…",options:[{label:"כוללים את שני הצלילים",correct:!0},{label:"מדלגים על הצליל הראשון",correct:!1},{label:"סופרים רק קווים",correct:!1}],explanation:"המספור כולל את צליל הפתיחה וצליל הסיום: דו→מי הוא טרצה (3), כי דו נספר כ-1."}]},{id:"lesson-5-2",unitId:"unit-5",order:2,title:"קריאת מרווחים",subtitle:"לזהות במבט",estimatedMinutes:3,knowledgeIds:["interval.m3","interval.M3","interval.P5"],sections:[{kind:"concept",icon:"👀",body:"קריאה שוטפת = לזהות מרווחים במבט, לא צליל-צליל. מרווח הרמוני (שני צלילים יחד) ומרווח מלודי (בזה אחר זה) נמדדים אותו דבר."},{kind:"notation",heading:"מרווח הרמוני",notation:{clef:"treble",notes:[{keys:["e/4","g/4"],duration:"w"}]},body:"שני צלילים יחד — טרצה (מי-סול)."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"סופרים קווים במקום מדרגות. סופרים את שמות הצלילים ביניהם, כולל הקצוות."}],practiceActivityIds:["act-int-sight-2nd-1","act-sri-harm"],quiz:[{prompt:"מרווח שני צליליו נשמעים יחד נקרא…",options:[{label:"הרמוני",correct:!0},{label:"מלודי",correct:!1},{label:"קצבי",correct:!1}],explanation:"הרמוני = יחד; מלודי = בזה אחר זה. שניהם נמדדים באותו אופן (מספר מדרגות)."},{prompt:"קריאה שוטפת של מרווחים מבוססת על…",options:[{label:"זיהוי המרחק במבט",correct:!0},{label:"שינון בעל-פה",correct:!1},{label:"ספירת פעימות",correct:!1}],explanation:'המיומנות היא לראות את המרחק בין שני התווים כ"צורה" ולזהות מיד — כמו לקרוא מילה שלמה ולא אות-אות.'}]},{id:"lesson-5-3",unitId:"unit-5",order:3,title:"בניית מרווחים",subtitle:"להציב את הצליל הנכון",estimatedMinutes:4,knowledgeIds:["interval.M3","interval.P5"],sections:[{kind:"concept",icon:"🧱",body:"לבנות מרווח = לקבל צליל נתון ולהציב מעליו את הצליל במרחק המבוקש. אחרי שמכירים את מספר המדרגות, מוסיפים היתק אם צריך כדי לקבל את האיכות (קטן/גדול/זך)."},{kind:"notation",heading:"טרצה גדולה מעל דו",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["e/4"],duration:"h"}]},body:"דו→מי — טרצה גדולה (4 חצאי-טונים)."},{kind:"tip",icon:"💡",body:"קודם קובעים את המדרגה (טרצה = שני שמות מעל), ואז מכווננים בהיתק לאיכות הנכונה."}],practiceActivityIds:["act-nb-3rd"],quiz:[{prompt:"בבניית מרווח, מה קובעים קודם?",options:[{label:"את מספר המדרגה (שם הצליל)",correct:!0},{label:"את העוצמה",correct:!1},{label:"את הטמפו",correct:!1}],explanation:"קודם המדרגה (טרצה = שני שמות מעל הנתון), ואז מכווננים היתק לאיכות (גדולה/קטנה)."},{prompt:"טרצה גדולה מכילה…",options:[{label:"ארבעה חצאי-טונים",correct:!0},{label:"שלושה חצאי-טונים",correct:!1},{label:"חמישה חצאי-טונים",correct:!1}],explanation:"טרצה גדולה = 4 חצאי-טונים (דו-מי); טרצה קטנה = 3 חצאי-טונים (דו-מי♭)."}]},{id:"lesson-5-4",unitId:"unit-5",order:4,title:"איכות המרווח",subtitle:"קטן או גדול, בשמיעה",estimatedMinutes:3,knowledgeIds:["interval.m2","interval.M2","interval.m3","interval.M3"],sections:[{kind:"concept",icon:"👂",body:"לאותו סוג מרווח יש שתי איכויות: קטן וגדול. סקונדה קטנה צפופה ומתוחה, סקונדה גדולה פתוחה יותר. האוזן מבחינה ביניהן — וגם בכיוון (עולה/יורד)."},{kind:"tip",icon:"💡",body:"ההבדל בין קטן לגדול הוא חצי-טון: סקונדה קטנה = חצי-טון, גדולה = טון שלם."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מבלבלים בין גודל (קטן/גדול) לכיוון (עולה/יורד). אלה שתי שאלות נפרדות."}],practiceActivityIds:["act-mek-2nd-mel","act-int-2v3-1"],quiz:[{prompt:"ההבדל בין סקונדה קטנה לגדולה הוא…",options:[{label:"חצי-טון",correct:!0},{label:"אוקטבה",correct:!1},{label:"כיוון הנגינה",correct:!1}],explanation:"סקונדה קטנה = חצי-טון (מי-פה), גדולה = טון שלם (דו-רה). ההפרש ביניהן חצי-טון."},{prompt:'"גדול/קטן" ו"עולה/יורד" הם…',options:[{label:"שתי שאלות נפרדות",correct:!0},{label:"אותו דבר",correct:!1},{label:"רק בהרמוני",correct:!1}],explanation:"גודל = האיכות (מספר החצאי-טונים); כיוון = אם הצליל השני גבוה או נמוך מהראשון. מזהים כל אחד בנפרד."}]},{id:"lesson-6-1",unitId:"unit-6",order:1,title:"משולשים",subtitle:"שלושה צלילים בטרצות",estimatedMinutes:4,knowledgeIds:["chord.maj","chord.min"],sections:[{kind:"concept",icon:"🎶",body:"משולש (טריאדה) הוא אקורד של שלושה צלילים הבנויים בטרצות: יסוד, טרצה מעליו וקווינטה. איכות המשולש (מז׳ורי/מינורי) נקבעת לפי סוג הטרצה התחתונה."},{kind:"notation",heading:"משולש דו מז׳ור",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:"דו-מי-סול: טרצה גדולה למטה → מז׳ורי."},{kind:"tip",icon:"💡",body:"מז׳ורי = טרצה גדולה ואז קטנה. מינורי = טרצה קטנה ואז גדולה — ההיפוך נותן את הצבע."}],practiceActivityIds:["act-theory-1","act-chord-mm-1","act-chord-mm-build-1"],quiz:[{prompt:"ממה בנוי משולש?",options:[{label:"יסוד, טרצה וקווינטה",correct:!0},{label:"שני צלילים",correct:!1},{label:"רק צלילים לבנים",correct:!1}],explanation:"משולש = שלושה צלילים בטרצות: היסוד, טרצה מעליו והקווינטה. זהו אבן הבניין של ההרמוניה."},{prompt:"מה קובע אם משולש מז׳ורי או מינורי?",options:[{label:"סוג הטרצה התחתונה",correct:!0},{label:"הקווינטה",correct:!1},{label:"העוצמה",correct:!1}],explanation:"טרצה גדולה למטה → מז׳ורי; טרצה קטנה למטה → מינורי. הקווינטה זהה בשניהם (זכה)."}],relatedLessonIds:["lesson-6-2"]},{id:"lesson-6-2",unitId:"unit-6",order:2,title:"ספטאקורדים",subtitle:"להוסיף צליל רביעי",estimatedMinutes:3,knowledgeIds:["chord.dom7","chord.maj7","chord.m7"],sections:[{kind:"concept",icon:"🎷",body:"ספטאקורד הוא משולש שהוספנו לו טרצה נוספת מעל הקווינטה — צליל רביעי במרחק ספטימה מהיסוד. זה מוסיף מתח וצבע (נפוץ בג׳אז ובפופ)."},{kind:"notation",heading:"ספטאקורד דומיננטי — סול7",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5","f/5"],duration:"w"}]},body:"סול-סי-רה-פה: משולש סול + ספטימה קטנה."},{kind:"tip",icon:"💡",body:'הספטאקורד הדומיננטי (למשל סול7 בדו מז׳ור) "מושך" חזק חזרה לטוניקה.'}],practiceActivityIds:["act-spell-7th"],quiz:[{prompt:"ספטאקורד נבנה מ…",options:[{label:"משולש + צליל רביעי בטרצה נוספת",correct:!0},{label:"שני משולשים",correct:!1},{label:"משולש בלי קווינטה",correct:!1}],explanation:"מוסיפים למשולש טרצה רביעית מעל הקווינטה — צליל במרחק ספטימה מהיסוד. מכא×
4080Ÿ השם."},{prompt:"הספטאקורד הדומיננטי נוטה…",options:[{label:"להוביל חזרה לטוניקה",correct:!0},{label:"לסיים בשקט",correct:!1},{label:"להישאר יציב",correct:!1}],explanation:"המתח שבספטאקורד הדומיננטי (V7) יוצר משיכה חזקה אל אקורד הטוניקה — הבסיס לקדנצה האותנטית."}]},{id:"lesson-6-3",unitId:"unit-6",order:3,title:"היפוכים",subtitle:"איזה צליל בבס",estimatedMinutes:3,knowledgeIds:["chord.maj"],sections:[{kind:"concept",icon:"🔄",body:"אותו אקורד יכול להישמע עם צליל אחר בבס. מצב יסוד = היסוד למטה. היפוך ראשון = הטרצה למטה. היפוך שני = הקווינטה למטה. הצלילים זהים, הסידור שונה."},{kind:"notation",heading:"דו מז׳ור — מצב יסוד והיפוך ראשון",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"h"},{keys:["e/4","g/4","c/5"],duration:"h"}]},body:"משמאל היסוד (דו למטה), מימין היפוך ראשון (מי למטה)."},{kind:"tip",icon:"💡",body:"היפוכים מאפשרים לחבר אקורדים בצורה חלקה — הבס × ×¢ בצעדים קטנים במקום בקפיצות."}],practiceActivityIds:["act-func-num"],quiz:[{prompt:"בהיפוך ראשון, איזה צליל בבס?",options:[{label:"הטרצה",correct:!0},{label:"היסוד",correct:!1},{label:"הקווינטה",correct:!1}],explanation:"מצב יסוד = יסוד בבס; היפוך ראשון = טרצה בבס; היפוך שני = קווינטה בבס. הצלילים זהים, רק הסדר משתנה."},{prompt:"היפוך משנה את…",options:[{label:"הצליל שבבס (הסידור)",correct:!0},{label:"זהות האקורד",correct:!1},{label:"מספר הצלילים",correct:!1}],explanation:"ההיפוך לא משנה אילו צלילים באקורד — רק מי מהם בתחתית. עדיין אותו אקורד."}]},{id:"lesson-6-4",unitId:"unit-6",order:4,title:"תפקוד וסמלי אקורד",subtitle:"טוניקה, סובדומיננטה, דומיננטה",estimatedMinutes:4,knowledgeIds:["cadence.authentic","chord.maj","chord.min"],sections:[{kind:"concept",icon:"🏛️",body:"בכל סולם, לאקורדים יש תפקידים: הטוניקה (I) היא הבית; הדומיננטה (V) יוצרת מתח ומושכת הביתה; הסובדומיננטה (IV) מרחיקה מהבית. שלושתם עמוד השדרה של ההרמוניה."},{kind:"notation",heading:"קדנצה: V → I בדו מז׳ור",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"h"},{keys:["c/4","e/4","g/4"],duration:"h"}]},body:"סול מז׳ור (V) פותר אל דו מז׳ור (I) — קדנצה אותנטית."},{kind:"tip",icon:"💡",body:"דרגות רומיות: אותיות גדולות למז׳ורי (I, IV, V), קטנות למינורי (ii, iii, vi)."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:'איזה אקורד הוא "הבית" של הסולם?',options:[{label:"הטוניקה (I)",correct:!0},{label:"הדומיננטה (V)",correct:!1},{label:"הסובדומיננטה (IV)",correct:!1}],explanation:"הטוניקה (I) היא מרכז הכובד — נקודת המנוחה שאליה הכול חוזר. הדומיננטה מושכת אליה."},{prompt:"המהלך V→I נקרא…",options:[{label:"קדנצה אותנטית",correct:!0},{label:"קדנצה פלגלית",correct:!1},{label:"סקוונצה",correct:!1}],explanation:'V→I הוא הפתרון החזק ביותר — קדנצה אותנטית, ה"נקודה" של המשפט ההרמוני. IV→I היא הפלגלית ("אמן").'}]},{id:"lesson-7-1",unitId:"unit-7",order:1,title:"המערכת הכפולה",subtitle:"שתי חמשות, יד ימין ויד שמאל",estimatedMinutes:4,knowledgeIds:["pitch.c","pitch.g","pitch.f"],sections:[{kind:"concept",icon:"📖",body:"כתיב הפסנתר משתמש בשתי חמשות המחוברות בסוגריים מסולסלים — המערכת הכפולה. החמשה העליונה במפתח סול (בדרך כלל יד ימין), התחתונה במפתח פה 
4080(יד שמאל)."},{kind:"notation",heading:"מפתח סול — החמשה העליונה",notation:{clef:"treble",notes:[{keys:["c/5"],duration:"q"},{keys:["e/5"],duration:"q"},{keys:["g/5"],duration:"h"}]},body:"הטווח הגבוה, המנוגן בדרך כלל ביד ימין."},{kind:"notation",heading:"מפתח פה — החמשה התחתונה",notation:{clef:"bass",notes:[{keys:["c/3"],duration:"q"},{keys:["e/3"],duration:"q"},{keys:["g/3"],duration:"h"}]},body:"הטווח הנמוך, המנוגן בדרך כלל ביד שמאל."},{kind:"tip",icon:"💡",body:"דו האמצעי מגשר בין השתיים: קו-עזר אחד מתחת למפתח סול הוא אותו צליל כמו קו-עזר אחד מעל מפתח פה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"קוראים את שתי החמשות באותו מפתח. כל חמשה במערכת הכפולה נקראת לפי המפתח שלה בנפרד."}],practiceActivityIds:["act-sr-name-bass","act-sight-1"],quiz:[{prompt:"באיזה מפתח כתובה בדרך כלל החמשה התחתונה בכתיב פסנתר?",options:[{label:"מפתח פה",correct:!0},{label:"מפתח סול",correct:!1},{label:"מפתח דו",correct:!1}],explanation:"במערכת הכפולה החמשה העליונה במפתח סול והתחתונה במפתח פה — כך מכוסה הטווח הרחב של הפסנתר בלי עודף קווי עזר."},{prompt:"מה מחבר את שתי החמשות למערכת אחת?",options:[{label:"סוגר מסולסל בתחילת השורה",correct:!0},{label:"חתימת המשקל",correct:!1},{label:"קו התיבה בלבד",correct:!1}],explanation:"סוגר מסולסל (accolade) בצד שמאל, יחד עם קווי תיבה החוצים את שתי החמשות, מסמן שהן מנוגנות בו-זמנית ככלי אחד."}],relatedLessonIds:["lesson-7-2"]},{id:"lesson-7-2",unitId:"unit-7",order:2,title:"ריבוי קולות",subtitle:"כמה קווים מלודיים על חמשה אחת",estimatedMinutes:4,knowledgeIds:["interval.M3","interval.P5"],sections:[{kind:"concept",icon:"🎭",body:"לעיתים חמשה אחת נושאת שני קולות עצמאיים בו-זמנית. מבחינים ביניהם לפי כיוון הזנב: לקול העליון זנבות כלפי מעלה, לקול התחתון זנבות כלפי מטה."},{kind:"notation",heading:"שני צלילים יחד — צליל כפול",notation:{clef:"treble",notes:[{keys:["c/4","g/4"],duration:"w"}]},body:"שני קולות שנפגשים באותה תיבה נכתבים זה מעל זה."},{kind:"tip",icon:"💡",body:"כשכל קול מקבל משך שונה — הזנבות הנפרדים הם שמונעים בלבול; קוראים כל קול כשורה עצמאית."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מנסים לצרף שני קולות עם משכים שונים לקצב אחד. כל קול נספר בנפרד — כאילו שתי מנגינות על אותה חמשה."}],practiceActivityIds:["act-sri-harm"],quiz:[{prompt:"איך מבחינים בין קול עליון לקול תחתון על חמשה אחת?",options:[{label:"לפי כיוון הזנב (מעלה/מטה)",correct:!0},{label:"לפי צבע התו",correct:!1},{label:"לפי גודל הראש",correct:!1}],explanation:"קונבנציית הזנבות מפרידה את הקולות: הקול העליון עם זנבות למעלה, התחתון עם זנבות למטה — כך העין קוראת שתי שורות עצמאיות."},{prompt:"שני קולות עצמאיים על חמשה אחת נספרים…",options:[{label:"כל אחד בנפרד",correct:!0},{label:"יחד כקצב אחד",correct:!1},{label:"רק לפי הקול העליון",correct:!1}],explanation:"כל קול הוא שורה מלודית-קצבית עצמאית עם המשכים שלו; מכבדים את המקצב של כל קול לחוד גם כשהם חולקים חמשה."}]},{id:"lesson-7-3",unitId:"unit-7",order:3,title:"סימוני עוצמה ואופי",subtitle:"דינמיקה, קרש׳נדו וטמפו",estimatedMinutes:4,knowledgeIds:["concept.dynamics","concept.tempo"],sections:[{kind:"concept",icon:"🔊",body:"הדינמיקה מציינת את עוצמת הנגינה. אותיות איטלקיות מקוצרות: p (פיאנו, חלש), f (פורטה, חזק), mp/mf (בינוני), pp/ff (קיצוני). הן מופיעות מתחת לחמשה."},{kind:"concept",heading:"שינוי הדרגתי",body:'קרש׳נדו (<) = התחזקות הדרגתית; דימינואנדו/דקרש׳נדו (>) = היחלשות הדרגתית. ה"מזלגות" נמתחים מתחת לתווים לאורך הקטע.'},{kind:"concept",heading:"טמפו",body:"מילת הטמפו בראש הקטע (Allegro מהיר, Adagio איטי) או סימון מטרונום (♩ = 120) קובעים את מהירות הפעימה."},{kind:"tip",icon:"💡",body:"ritardando (rit.) = האטה הדרגתית; a tempo = חזרה למהירות המקורית."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מבלבלים בין דינמיקה (עוצמה) לטמפו (מהירות). f הוא חזק — לא מהיר."}],practiceActivityIds:[],quiz:[{prompt:"מה מציין הסימן f מתחת לחמשה?",options:[{label:"לנגן בחוזקה (פורטה)",correct:!0},{label:"לנגן מהר",correct:!1},{label:"לנגן גבוה",correct:!1}],explanation:"f = פורטה = עוצמה חזקה. זו דינמיקה (עוצמה) ולא טמפו (מהירות); p ההפוך ממנו הוא פיאנו, חלש."},{prompt:'ה"מזלג" הנפתח (<) מתחת לתווים מסמן…',options:[{label:"קרש׳נדו — התחזקות הדרגתית",correct:!0},{label:"האטה",correct:!1},{label:"עלייה בגובה",correct:!1}],explanation:"קרש׳נדו (<) = להתחזק בהדרגה; דקרש׳נדו (>) = להיחלש בהדרגה. אלה שינויי עוצמה מתמשכים, לא שינויי גובה או מהירות."}]},{id:"lesson-7-4",unitId:"unit-7",order:4,title:"סימני ביטוי וניגון",subtitle:"לגאטו, סטקאטו וסימני חזרה",estimatedMinutes:4,knowledgeIds:["concept.legato","concept.staccato"],sections:[{kind:"concept",icon:"🎨",body:"סימני הביטוי קובעים כיצד לנגן צליל. קשת ביטוי (ליגטורה) מעל קבוצת תווים = לגאטו, ניגון מקושר ורציף. נקודה קטנה מעל/מתחת לתו = סטקאטו, ניגון קצר ומנותק."},{kind:"notation",heading:"קו מלודי מקושר",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"}]},body:"קשת ביטוי מעל הצלילים מורה לחבר אותם בזרימה אחת (לגאטו)."},{kind:"tip",icon:"💡",body:"הבחנה חשובה: קשת ביטוי (לגאטו) מחברת צלילים בגבהים שונים, ואילו קשת הארכה מחברת שני צלילים זהים למשך אחד."},{kind:"concept",heading:"סימני חזרה",body:"נקודתיים לפני קו התיבה (𝄇) מורים לחזור על הקטע. סימוני 1. ו-2. (בתי סיום) מציינים סיום שונה בפעם הראשונה ובשנייה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מפרשים כל קשת כהארכה. אם היא מעל תווים בגבהים שונים — זו קשת ביטוי (לגאטו), לא הארכה."}],practiceActivityIds:[],quiz:[{prompt:"נקודה קטנה מעל תו בודד מציינת…",options:[{label:"סטקאטו — ניגון קצר ומנותק",correct:!0},{label:"הארכת התו בחצי",correct:!1},{label:"העלאה בחצי טון",correct:!1}],explanation:"נקודת סטקאטו (מעל/מתחת לראש התו) מקצרת ומנתקת אותו. אין לבלבל עם נקודת הארכה, שמופיעה מימין לראש התו ומאריכה אותו."},{prompt:"קשת מעל תווים בגבהים שונים היא…",options:[{label:"קשת ביטוי (לגאטו)",correct:!0},{label:"קשת הארכה",correct:!1},{label:"סימן חזרה",correct:!1}],explanation:"קשת ביטוי מחברת צלילים שונים לביצוע מקושר (לגאטו); קשת הארכה מחברת רק שני צלילים זהים למשך רציף אחד."}]},{id:"lesson-8-1",unitId:"unit-8",order:1,title:"כתיבת ראש התו והזנב",subtitle:"איך מציירים תו נכון",estimatedMinutes:4,knowledgeIds:["pitch.c","pitch.g"],sections:[{kind:"concept",icon:"✍️",body:"תו מורכב מראש (עיגול), ולרוב זנב (קו אנכי) ואולי דגלים. ערך התו נקבע לפי צורתם: ראש חלול ללא זנב = שלם; ראש חלול עם זנב = חצי; ראש מלא עם זנב = רבע."},{kind:"concept",heading:"כיוון הזנב",body:"הכלל: מתחת לקו האמצעי של החמשה — הזנב כלפי מעלה מצד ימין של הראש; מעל הקו האמצעי — הזנב כלפי מטה מצד שמאל."},{kind:"notation",heading:"זנבות בכיוונים נכונים",notation:{clef:"treble",notes:[{keys:["d/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"הצליל הנמוך עם זנב למעלה, הגבוהים עם זנב למטה."},{kind:"tip",icon:"💡",body:"תו שלם מצוירים בלי זנב כלל — רק ראש חלול פתוח."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מצרפים זנב לתו שלם. תו שלם אף פעם אינו נושא זנב."}],practiceActivityIds:["act-mel-c","act-mel-g"],quiz:[{prompt:"איזה תו נכתב ללא זנב?",options:[{label:"תו שלם",correct:!0},{label:"תו רבע",correct:!1},{label:"תו שמינית",correct:!1}],explanation:"תו שלם = ראש חלול בלבד, בלי זנב. חצי = ראש חלול עם זנב; רבע = ראש מלא עם זנב; שמינית מוסיפה דגל."},{prompt:"לתו נמוך שנמצא מתחת לקו האמצעי, לאן פונה הזנב?",options:[{label:"כלפי מעלה",correct:!0},{label:"כלפי מטה",correct:!1},{label:"אין זנב",correct:!1}],explanation:"הכלל: מתחת לקו האמצעי הזנב כלפי מעלה, מעליו כלפי מטה — כך התווים נשארים קריאים ואינם חורגים מהחמשה."}],relatedLessonIds:["lesson-8-2"]},{id:"lesson-8-2",unitId:"unit-8",order:2,title:"קיבוץ שמיניות",
4080subtitle:"קורות במקום דגלים",estimatedMinutes:3,knowledgeIds:["rhythm_pattern.quarters_eighths"],sections:[{kind:"concept",icon:"🔗",body:"שמיניות (וערכים קטנים יותר) שנמצאות באותה פעימה מקובצות בקורה — קו עבה המחבר את קצות הזנבות, במקום דגל נפרד לכל תו. כך המקצב קריא ומאורגן."},{kind:"notation",heading:"ארבע שמיניות מקובצות",notation:{clef:"treble",notes:[{keys:["g/4"],duration:"8"},{keys:["a/4"],duration:"8"},{keys:["b/4"],duration:"8"},{keys:["c/5"],duration:"8"}]},body:"שתי קבוצות של שתי שמיניות — כל קבוצה בפעימה."},{kind:"tip",icon:"💡",body:"הקיבוץ נעשה לפי הפעימה: מקבצים את השמיניות שבתוך פעימה אחת, ולא חוצים גבול פעימה שלא לצורך."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מקבצים שמיניות על פני כל התיבה. הקיבוץ מכבד את גבולות הפעימה כדי שהעין תראה את המשקל."}],practiceActivityIds:["act-rhythm-2"],quiz:[{prompt:"מה מחליפה הקורה בקיבוץ שמיניות?",options:[{label:"את הדגלים הנפרדים",correct:!0},{label:"את ראשי התווים",correct:!1},{label:"את קו התיבה",correct:!1}],explanation:"הקורה מחברת את זנבות השמיניות במקום דגל לכל תו — קריאה נוחה יותר של קבוצה קצבית אחת."},{prompt:"לפי מה מקבצים שמיניות בתיבה?",options:[{label:"לפי הפעימה",correct:!0},{label:"לפי הגובה",correct:!1},{label:"באקראי",correct:!1}],explanation:"מקבצים בתוך גבולות הפעימה כדי שהעין תזהה מיד את המשקל; לרוב לא חוצים גבול פעימה ללא סיבה."}]},{id:"lesson-8-3",unitId:"unit-8",order:3,title:"טרנספוזיציה",subtitle:"להעביר מנגינה לסולם אחר",estimatedMinutes:4,knowledgeIds:["key.c_major","key.g_major","interval.P5"],sections:[{kind:"concept",icon:"🔀",body:'טרנספוזיציה = העברת קטע שלם לגובה אחר, תוך שמירה על כל המרווחים היחסיים. המנגינה נשמעת "אותו דבר" — רק גבוהה או נמוכה יותר.'},{kind:"notation",heading:"מוטיב בדו מז׳ור",notation:{clef:"treble",keySignature:"C",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["c/4"],duration:"q"}]},body:"המוטיב המקורי: דו-רה-מי-דו."},{kind:"notation",heading:"אותו מוטיב, קווינטה מעלה (סול מז׳ור)",notation:{clef:"treble",keySignature:"G",notes:[{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"סול-לה-סי-סול — אותם מרווחים, חתימה חדשה (פה♯)."},{kind:"tip",icon:"💡",body:"בטרנספוזיציה מעדכנים גם את חתימת המפתח — היעד מקבל את ההיתקים של הסולם החדש."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מעבירים את התווים בלי לעדכן חתימת מפתח או היתקים — והמרווחים משתבשים. שומרים על תבנית הסולם ביעד."}],practiceActivityIds:["act-key-first"],quiz:[{prompt:"מה נשמר בטרנספוזיציה של מנגינה?",options:[{label:"המרווחים היחסיים בין הצלילים",correct:!0},{label:"הגובה המדויק",correct:!1},{label:"המקצב בלבד",correct:!1}],explanation:"טרנספוזיציה מזיזה הכול בכמות קבועה, ולכן המרחקים בין הצלילים (המרווחים) נשמרים והמנגינה נשמעת זהה בגובה אחר."},{prompt:"בהעברת מנגינה מדו מז׳ור לסול מז׳ור צריך גם…",options:[{label:"לעדכן את חתימת המפתח (פה♯)",correct:!0},{label:"לשנות את המשקל",correct:!1},{label:"להפוך את כיוון הקריאה",correct:!1}],explanation:"הסולם החדש דורש את ההיתקים שלו; סול מז׳ור מחייב פה♯ בחתימה כדי לשמור על תבנית המז׳ור ועל המרווחים המקוריים."}],relatedLessonIds:["lesson-8-4"]},{id:"lesson-8-4",unitId:"unit-8",order:4,title:"לכתוב מנגינה שלמה",subtitle:"מרכיבים תיבה תקינה",estimatedMinutes:5,knowledgeIds:["time_signature.4_4","scale.major","key.c_major"],sections:[{kind:"concept",icon:"📝",body:"כתיבת קטע מחברת את כל מה שלמדנו: בוחרים מפתח, חתימת מפתח וחתימת משקל; ואז ממלאים כל תיבה בתווים ובשתיקות שסכום ערכיהם שווה בדיוק למשקל."},{kind:"notation",heading:"תיבה תקינה ב-4/4",notation:{clef:"treble",keySignature:"C",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"h"}]},body:"רבע + רבע + חצי = 4 פעימות. התיבה מלאה בדיוק."},{kind:"tip",icon:"💡",body:"בדיקת אמת: סכמו את ערכי כל התווים והשתיקות בתיבה — הם חייבים להשלים בדיוק את המשקל, לא פחות ולא יותר."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"תיבה שאינה מסתכמת למשקל (למשל חמש פעימות ב-4/4). כל תיבה חייבת להתמלא במדויק."}],practiceActivityIds:["act-nb-chord","act-spell-maj"],quiz:[{prompt:"מה חייב להתקיים בכל תיבה?",options:[{label:"סכום ערכי התווים והשתיקות שווה למשקל",correct:!0},{label:"לפחות תו אחד גבוה",correct:!1},{label:"מספר זוגי של תווים",correct:!1}],explanation:"התיבה מתחלקת לפי המשקל: ב-4/4 סכום כל המשכים (תווים + שתיקות) חייב להיות בדיוק ארבע פעימות."},{prompt:"מה בוחרים לפני שממלאים תיבות בתווים?",options:[{label:"מפתח, חתימת מפתח וחתימת משקל",correct:!0},{label:"רק את הטמפו",correct:!1},{label:"את מספר העמודים",correct:!1}],explanation:"המסגרת נקבעת קודם — המפתח קובע את שמות הצלילים, החתימה את הסולם, והמשקל את חלוקת הזמן — ורק אז כותבים את המנגינה."}]},{id:"lesson-9-1",unitId:"unit-9",order:1,title:"התקנה והיכרות עם הממשק",subtitle:"להוריד, לפתוח ולהתמצא",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"💻",body:"MuseScore היא תוכנת כתיבת תווים חינמית וקוד-פתוח. מורידים אותה מהאתר הרשמי musescore.org (לא לבלבל עם musescore.com — אתר שיתוף התווים), מתקינים ופותחים."},{kind:"concept",heading:"מסך הפתיחה",body:"בפתיחה מופיע מרכז הבית (Start Center): משם יוצרים פרטיטורה חדשה (New score) או פותחים קובץ קיים. קובצי MuseScore נשמרים בסיומת ‎.mscz."},{kind:"concept",heading:"אזורי המסך המרכזיים",body:"סרגל הכלים העליון (Toolbar), אזור התווים במרכז, ולוחות צד (Palettes) שמכילים סימנים לגרירה — דינמיקה, קשתות, סימני חזרה ועוד."},{kind:"tip",icon:"💡",body:"לוחות הצד נפתחים ונסגרים דרך התפריט View → Palettes (או F9). שם מוצאים כמעט כל סימן מוזיקלי."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מורידים מ-musescore.com במקום musescore.org. ‎.org הוא התוכנה החינמית; ‎.com הוא אתר לשיתוף פרטיטורות."}],practiceActivityIds:[],quiz:[{prompt:"מהיכן מורידים את תוכנת MuseScore?",options:[{label:"האתר הרשמי musescore.org",correct:!0},{label:"musescore.com",correct:!1},{label:"חנות הספרים",correct:!1}],explanation:"musescore.org הוא בית התוכנה החינמית והפתוחה; musescore.com הוא אתר קהילתי לשיתוף פרטיטורות — לא התוכנה עצמה."},{prompt:"מה מכילים לוחות הצד (Palettes)?",options:[{label:"סימנים מוזיקליים לגרירה אל התווים",correct:!0},{label:"רק את קובצי השמע",correct:!1},{label:"את היסטוריית הקבצים",correct:!1}],explanation:"ה-Palettes הם מאגר סימנים (דינמיקה, קשתות, סימני חזרה, מפתחות ועוד) שגוררים או מקליקים כדי להוסיף לפרטיטורה. פותחים אותם ב-F9."}],relatedLessonIds:["lesson-9-2"]},{id:"lesson-9-2",unitId:"unit-9",order:2,title:"יצירת פרטיטורה חדשה",subtitle:"כלי, חתימת מפתח וחתימת משקל",estimatedMinutes:5,knowledgeIds:["key.c_major","time_signature.4_4"],sections:[{kind:"concept",icon:"🆕",body:"לחיצה על New score פותחת אשף בכמה שלבים: תחילה בוחרים את הכלים (Instruments) — למשל פסנתר או קול, ומהם נגזרות החמשות והמפתחות של הפרטיטורה."},{kind:"concept",heading:"חתימת מפתח",body:"בשלב הבא בוחרים את חתימת המפתח (Key signature) — הסולם שבו כתוב הקטע, למשל דו מז׳ור (ללא היתקים) או סול מז׳ור (פה♯)."},{kind:"concept",heading:"חתימת משקל וטמפו",body:"לאחר מכן קובעים את חתימת המשקל (Time signature), למשל 4/4, ואפשר גם להגדיר טמפו התחלתי ותיבת עלייה (Anacrusis/Pickup) אם צריך."},{kind:"tip",icon:"💡",body:"אין צורך לדייק בכול מראש — כלי, חתימת מפתח ומשקל ניתנים לשינוי גם אחרי יצירת הפרטיטורה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מדלגים על בחירת הכלי ומקבלים חמשה כללית. בחירת הכלי הנכון קובעת מפתח, טווח והשמעה מתאימים."}],practiceActivityIds:["act-key-first"],quiz:[{prompt:"מה בוחרים בשלב הראשון של יצירת פרטיטורה חדשה?",options:[{label:"את הכלים (Instruments)",correct:!0},{label:"את צבע הדף",correct:!1},{label:"את פורמט הייצוא",correct:!1}],explanation:"בחירת הכלי קובעת אילו חמשות ומפתחות ייווצרו ואיזה צליל יושמע — ולכן היא השלב הראשון באשף הפרטיטורה החדשה."},{prompt:"מה קובעת חתימת המפתח שבוחרים באשף?",options:[{label:"את הסולם וההיתקים הקבועים",correct:!0},{label:"את מהירות הקטע",correct:!1},{label:"את מספר התיבות",correct:!1}],explanation:"חתימת המפתח מגדירה את הסולם ואת הדיאזים/במולים הקבועים; היא נבחרת באשף וניתנת לשינוי מאוחר יותר."}]},{id:"lesson-9-3",unitId:"unit-9",order:3,title:"הזנת תווים",subtitle:"מצב הזנה, גבהים ומשכים",estimatedMinutes:5,knowledgeIds:["pitch.c","pitch.d","pitch.e"],sections:[{kind:"concept",icon:"⌨️",body:'להזנת תווים נכנסים ל"מצב הזנת תווים" בלחיצה על N (או על כפתור העיפרון). מעכשיו כל הקשה מוסיפה תו במקום לבחור תו קיים. יוצאים מהמצב בלחיצה על Escape.'},{kind:"concept",heading:"קודם משך, אחר כך גובה",body:"הסדר החשוב: בוחרים תחילה את המשך במקש מספר — 4 = שמינית, 5 = רבע, 6 = חצי, 7 = שלם — ורק אז מקלידים את שם הצליל."},{kind:"concept",heading:"גובה באותיות",body:"הצלילים מוזנים באותיות הלועזיות של שמותיהם: C=דו, D=רה, E=מי, F=פה, G=סול, A=לה, B=סי. MuseScore בוחר את האוקטבה הקרובה ביותר לתו הקודם."},{kind:"tip",icon:"💡",body:"להזזת תו שהוזן באוקטבה: Ctrl+חץ למעלה/למטה. חצים רגילים למעלה/למטה מזיזים בחצי טון. מקש 0 מזין שתיקה במשך הנבחר."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מקלידים את הצליל לפני שבוחרים משך — והתו נכנס במשך הקודם. תמיד קובעים משך (מקש מספר) ואז גובה (אות)."}],practiceActivityIds:["act-mel-c","act-mel-g"],quiz:[{prompt:"איזה מקש מפעיל את מצב הזנת התווים ב-MuseScore?",options:[{label:"N",correct:!0},{label:"P",correct:!1},{label:"Space",correct:!1}],explanation:"N נכנס למצב הזנת תווים (Note input); Escape יוצא ממנו. במצב זה כל אות A–G מוסיפה תו חדש."},{prompt:"מהו הסדר הנכון להזנת תו?",options:[{label:"קודם משך (מקש מספר), אז גובה (אות)",correct:!0},{label:"קודם גובה, אז משך",correct:!1},{label:"הסדר לא משנה",correct:!1}],explanation:"בוחרים משך במקש מספר (5=רבע), ורק אז מקלידים את אות הצליל — כך התו נכנס בערך הנכון. אחרת הוא מקבל את המשך הקודם."},{prompt:"איזה מקש מזין שתיקה במשך הנבחר?",options:[{label:"0",correct:!0},{label:"R",correct:!1},{label:"S",correct:!1}],explanation:"במצב הזנת תווים מקש 0 מוסיף שתיקה באורך המשך שנבחר — בדיוק כמו שאות מוסיפה צליל."}],relatedLessonIds:["lesson-9-4"]},{id:"lesson-9-4",unitId:"unit-9",order:4,title:"השמעה ושמירה",subtitle:"לשמוע את מה שכתבנו",estimatedMinutes:3,knowledgeIds:["concept.tempo"],sections:[{kind:"concept",icon:"▶️",body:"לחיצה על מקש הרווח (Space) מפעילה ועוצרת את ההשמעה. הנגן מנגן את הפרטיטורה בקולות הכלים שנבחרו — כך שומעים מיד אם התווים נכונים."},{kind:"concept",heading:"ניווט בהשמעה",body:"ההשמעה מתחילה מהתו הנבחר. אפשר לשלוט בטמפו ובקולות דרך חלון ה-Play/Mixer, ולהאזין לכלי בודד או לכולם."},{kind:"concept",heading:"שמירה",body:"שומרים ב-Ctrl+S לקובץ ‎.mscz (פורמט העבודה של MuseScore, שמכיל את כל הפרטיטורה). כדאי לשמור לעיתים קרובות."},{kind:"tip",icon:"💡",body:"ההשמעה היא כלי הגהה מצוין: אם משהו נשמע לא נכון — כנראה נפלה טעות בגובה, במשך או בחתימה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מבלבלים בין ‎.mscz (קובץ העבודה שאפשר להמשיך לערוך) לבין ייצוא ל-PDF (תמונה סופית שאי אפשר לערוך)."}],practiceActivityIds:[],quiz:[{prompt:"איזה מקש מפעיל ועוצר את ההשמעה ב-MuseScore?",options:[{label:"מקש הרווח (Space)",correct:!0},{label:"Enter",correct:!1},{label:"Tab",correct:!1}],explanation:"Space מתחיל ועוצר את הנגן. ההשמעה מתחילה מהתו הנבחר ומאפשרת לבדוק בשמיעה את הכתיבה."},{prompt:"באיזה פורמט נשמר קובץ העבודה של MuseScore?",options:[{label:"‎.mscz",correct:!0},{label:"‎.pdf",correct:!1},{label:"‎.mp3",correct:!1}],explanation:"‎.mscz הוא פורמט העבודה הניתן לעריכה חוזרת; PDF ו-MP3 הם פורמטי ייצוא סופיים ולא ניתנים לעריכה מוזיקלית."}]},{id:"lesson-10-1",unitId:"unit-10",order:1,title:"עריכה ותיקון טעויות",
4080subtitle:"בחירה, מחיקה, העתקה והדבקה",estimatedMinutes:5,knowledgeIds:["pitch.c","pitch.g"],sections:[{kind:"concept",icon:"✂️",body:"לתיקון תו בוחרים אותו בקליק, ומשנים גובה בחצים למעלה/למטה (חצי טון) או Ctrl+חצים (אוקטבה). למחיקת תו (והפיכתו לשתיקה) לוחצים Delete."},{kind:"concept",heading:"העתקה והדבקה",body:"בוחרים קטע (קליק בתו הראשון + Shift+קליק בתו האחרון), מעתיקים ב-Ctrl+C ומדביקים ב-Ctrl+V במקום היעד — נוח לשכפול מוטיבים חוזרים."},{kind:"concept",heading:"ביטול פעולה",body:"Ctrl+Z מבטל את הפעולה האחרונה ו-Ctrl+Y (או Ctrl+Shift+Z) מחזיר אותה — רשת ביטחון שמאפשרת להתנסות בלי חשש."},{kind:"tip",icon:"💡",body:"טרנספוזיציה של קטע נבחר: תפריט Tools → Transpose, ושם בוחרים מרווח או סולם יעד — כל הבחירה מועברת בבת-אחת."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מוחקים תו ומצפים שהתיבה תתקצר. Delete הופך תו לשתיקה כדי לשמור על המשקל — התיבה נשארת מלאה."}],practiceActivityIds:["act-nsel-wrong","act-nsel-high"],quiz:[{prompt:"מה קורה כשלוחצים Delete על תו?",options:[{label:"התו הופך לשתיקה באותו משך",correct:!0},{label:"התיבה מתקצרת",correct:!1},{label:"כל הקטע נמחק",correct:!1}],explanation:"כדי לשמור על שלמות המשקל, מחיקת תו מחליפה אותו בשתיקה זהת-משך; התיבה נשארת מלאה בדיוק."},{prompt:"איך מעבירים קטע נבחר לסולם אחר ב-MuseScore?",options:[{label:"Tools → Transpose",correct:!0},{label:"מוחקים ומקלידים מחדש",correct:!1},{label:"משנים את צבע הדף",correct:!1}],explanation:"תפריט Tools → Transpose מעביר את כל הבחירה במרווח או אל סולם יעד בבת-אחת, תוך שמירה על המרווחים — מהיר ומדויק בהרבה מהקלדה מחדש."}],relatedLessonIds:["lesson-10-2"]},{id:"lesson-10-2",unitId:"unit-10",order:2,title:"מילים, אקורדים ודינמיקה",subtitle:"להוסיף שכבות מעל התווים",estimatedMinutes:5,knowledgeIds:["concept.dynamics"],sections:[{kind:"concept",icon:"🎤",body:"להוספת מילות שיר בוחרים את התו הראשון ולוחצים Ctrl+L; מקלידים הברה, ולחיצה על רווח מקדמת אל התו הבא, ומקף מחבר בין הברות של אותה מילה."},{kind:"concept",heading:"סמלי אקורד",body:"סמלי אקורד (למשל C, Gm7) מוסיפים ב-Ctrl+K מעל התווים — נוח למלווים בגיטרה או בפסנתר. גם כאן רווח מקדם אל המיקום הבא."},{kind:"concept",heading:"דינמיקה וסימני ביטוי",body:"דינמיקה (p, f, קרש׳נדו) וקשתות ביטוי נגררים מלוחות הצד (Palettes) אל התו הנבחר, או מתווספים בקיצורי מקשים (למשל S לקשת ביטוי)."},{kind:"tip",icon:"💡",body:"כל שכבה נצמדת לתו שאליו הוזנה — אם מזיזים או מוחקים את התו, הסימן המקושר נע או נמחק איתו."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"מקלידים מילים בלי לבחור קודם תו. הטקסט חייב להיצמד לתו — בוחרים תו, ואז Ctrl+L."}],practiceActivityIds:[],quiz:[{prompt:"איזה קיצור פותח הזנת מילות שיר ב-MuseScore?",options:[{label:"Ctrl+L",correct:!0},{label:"Ctrl+K",correct:!1},{label:"Ctrl+P",correct:!1}],explanation:"Ctrl+L מוסיף מילים (Lyrics) לתו הנבחר; Ctrl+K מוסיף סמל אקורד. רווח מקדם להברה הבאה, ומקף מחבר הברות של אותה מילה."},{prompt:"איך מוסיפים דינמיקה או קשת ביטוי?",options:[{label:"גוררים מלוחות הצד אל התו הנבחר",correct:!0},{label:"מקלידים בתוך שם הקובץ",correct:!1},{label:"רק בעת יצירת הפרטיטורה",correct:!1}],explanation:"ה-Palettes מכילים דינמיקה, קשתות וסימני ביטוי; גוררים או מקליקים אותם על תו נבחר. הם נצמדים לתו ונעים איתו."}]},{id:"lesson-10-3",unitId:"unit-10",order:3,title:"פריסת עמוד ותפקידים",subtitle:"סידור הדף וחילוץ כלים",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"📄",body:"MuseScore פורס את התיבות בשורות ובעמודים אוטומטית, אך אפשר לשלוט: מעבר שורה (System break) בקיצור Enter על תיבה נבחרת, ומעבר עמוד (Page break) דרך לוח הצד Breaks."},{kind:"concept",heading:"מרווח וגודל",body:"הגדרות Format → Page Settings ו-Format → Style שולטות בשוליים, בגודל החמשה ובמרווחים — כדי שהתווים יהיו קריאים ולא צפופים או דלילים מדי."},{kind:"concept",heading:"תפקידים (Parts)",body:'מפרטיטורה מלאה של הרכב אפשר לחלץ "תפקיד" נפרד לכל כלי (File → Parts) — דף המכיל רק את הקול של אותו נגן, מסונכרן עם הפרטיטורה.'},{kind:"tip",icon:"💡",body:"עריכה בפרטיטורה המלאה מתעדכנת אוטומטית בכל התפקידים המחולצים — אין צורך לתקן פעמיים."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'מזיזים תווים ידנית כדי "לסדר" את הדף. עדיף להשתמש במעברי שורה/עמוד ובהגדרות הסגנון — כך הפריסה נשארת נקייה ועקבית.'}],practiceActivityIds:[],quiz:[{prompt:"מה מאפשר לחלץ מפרטיטורה מלאה של הרכב?",options:[{label:"תפקיד נפרד לכל כלי (Parts)",correct:!0},{label:"קובץ שמע בלבד",correct:!1},{label:"חתימת מפתח חדשה",correct:!1}],explanation:"Parts מפיק דף נפרד ומסונכרן לכל נגן, המכיל רק את הקול שלו; שינוי בפרטיטורה המלאה מתעדכן אוטומטית בתפקידים."},{prompt:"מהי הדרך המומלצת לשלוט בפריסת הדף?",options:[{label:"מעברי שורה/עמוד והגדרות סגנון",correct:!0},{label:"הזזת כל תו ביד",correct:!1},{label:"מחיקת תיבות",correct:!1}],explanation:"מעברי שורה (System break) ומעברי עמוד יחד עם Format → Style שומרים על פריסה עקבית וקריאה, בלי לפגוע בתוכן המוזיקלי."}],relatedLessonIds:["lesson-10-4"]},{id:"lesson-10-4",unitId:"unit-10",order:4,title:"ייצוא ושיתוף",subtitle:"PDF, MusicXML וקובצי שמע",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🚀",body:"לאחר סיום העבודה מייצאים לפורמט המתאים ליעד דרך File → Export. הבחירה בפורמט תלויה במה שרוצים לעשות עם התוצר."},{kind:"concept",heading:"PDF — להדפסה וקריאה",body:'ייצוא ל-PDF יוצר קובץ תווים סופי ומדויק להדפסה או לשליחה לנגנים. הוא אינו ניתן לעריכה מוזיקלית — זו "תמונת" הפרטיטורה.'},{kind:"concept",heading:"MusicXML — להעברה בין תוכנות",body:"MusicXML הוא פורמט אוניברסלי המעביר את התוכן המוזיקלי (תווים, מקצב, מילים) בין תוכנות כתיבה שונות — כך אפשר לפתוח את היצירה גם בתוכנה אחרת."},{kind:"concept",heading:"שמע — MP3/WAV",body:"ייצוא לאודיו (MP3 או WAV) מפיק הקלטה של ההשמעה — שימושי לשיתוף מהיר של הצליל עם מי שאינו קורא תווים."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"שולחים PDF כשצריך המשך עריכה בתוכנה אחרת. להעברה עריכה בין תוכנות משתמשים ב-MusicXML, לא ב-PDF."}],practiceActivityIds:[],quiz:[{prompt:"איזה פורמט מתאים להעברת היצירה לעריכה בתוכנת תווים אחרת?",options:[{label:"MusicXML",correct:!0},{label:"PDF",correct:!1},{label:"MP3",correct:!1}],explanation:"MusicXML הוא פורמט חילופין אוניברסלי הנושא את התוכן המוזיקלי הניתן לעריכה; PDF הוא תמונה סופית, ו-MP3 הוא שמע בלבד."},{prompt:"לשיתוף הצליל עם מי שאינו קורא תווים עדיף לייצא…",options:[{label:"קובץ שמע (MP3/WAV
4080)",correct:!0},{label:"MusicXML",correct:!1},{label:"קובץ ‎.mscz",correct:!1}],explanation:"קובץ שמע מאפשר להאזין ליצירה ישירות בלי תוכנה או ידע בקריאת תווים; MusicXML ו-‎.mscz נועדו לעריכה, לא להאזנה."}]}],v$={id:"course-sight-reading",title:"קריאה מהדף",subtitle:"קורס שנה א׳ · שירת הלויים",description:"לפתח קריאה שוטפת של תווים במבט ראשון — מזיהוי צלילי עוגן, דרך תנועה בשניות ובקפיצות, ועד אסטרטגיות קריאה של מנגינה שלמה. לומדים עיקרון, מתרגלים על החמשה, ומקבלים משוב.",trackId:"track-men"},I$=[{id:"sr-unit-1",courseId:"course-sight-reading",order:1,title:"יסודות הקריאה",summary:"מהי קריאה מהדף, כיוון הקריאה, וצלילי עוגן",icon:"📖"},{id:"sr-unit-2",courseId:"course-sight-reading",order:2,title:"תנועה על החמשה",summary:"קריאה בשניות, קווים וחללים, ומנגינה פשוטה",icon:"🎵"},{id:"sr-unit-3",courseId:"course-sight-reading",order:3,title:"קפיצות ומרווחים",summary:"זיהוי טרצות וקפיצות רחבות בקריאה מהירה",icon:"📏"},{id:"sr-unit-4",courseId:"course-sight-reading",order:4,title:"מקצב בקריאה",summary:"ספירה, ערכי תווים וקריאה בקצב יציב",icon:"🥁"},{id:"sr-unit-5",courseId:"course-sight-reading",order:5,title:"מפתח פה",summary:"קריאה בבס — עוגנים ותנועה במפתח פה",icon:"🎼"},{id:"sr-unit-6",courseId:"course-sight-reading",order:6,title:"אסטרטגיות קריאה",summary:"סריקה מוקדמת, קיבוץ דפוסים והמשכיות",icon:"🎯"}],_$=[{id:"sr-1-1",unitId:"sr-unit-1",order:1,title:"מהי קריאה מהדף?",subtitle:"לנגן במבט ראשון — בלי ללמוד מראש",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:"קריאה מהדף (Sight Reading) היא היכולת לנגן או לשיר יצירה במבט ראשון — בלי לשמוע אותה קודם ובלי ללמוד אותה בעל-פה. זו אחת המיומנויות החשובות ביותר למוסיקאי."},{kind:"concept",heading:"איך זה עובד?",body:"העין סורקת את התווים והמוח מתרגם אותם מיד לצלילים ולתנועות. כמו קריאת טקסט — לא מפענחים כל אות, אלא מזהים מילים ודפוסים שלמים."},{kind:"tip",icon:"💡",body:'המטרה אינה לזהות כל תו בנפרד, אלא לזהות תנועות ודפוסים: "עולה בצעדים", "קפיצה למעלה", "חוזר לאותו צליל".'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לעצור על כל תו כדי "לפענח" אותו הורס את הזרימה. בקריאה מהדף ממשיכים הלאה בקצב יציב — גם אם פספסתם צליל.'}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"מהי קריאה מהדף?",options:[{label:"לנגן יצירה במבט ראשון, בלי ללמוד אותה מראש",correct:!0},{label:"לשנן יצירה בעל-פה עד שזוכרים אותה",correct:!1},{label:"להאזין ליצירה ולחקות אותה",correct:!1}],explanation:"קריאה מהדף = תרגום מיידי של התווים לצלילים במבט ראשון, בלי היכרות מוקדמת עם היצירה."},{prompt:"מה עדיף לעשות אם פספסתם צליל באמצע קריאה?",options:[{label:"להמשיך בקצב יציב הלאה",correct:!0},{label:"לעצור ולחזור לתקן את הצליל",correct:!1},{label:"להתחיל את היצירה מהתחלה",correct:!1}],explanation:"שמירה על הזרימה חשובה יותר מתו בודד — עוצרים לתיקון בתרגול איטי, לא בקריאה מהדף."}],relatedLessonIds:["sr-1-2"]},{id:"sr-1-2",unitId:"sr-unit-1",order:2,title:"כיוון הקריאה והחמשה",subtitle:"שמאל לימין, למעלה = גבוה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"➡️",body:"קוראים תווים משמאל לימין, בדיוק כמו טקסט במוזיקה מערבית. ככל שמתקדמים ימינה — מתקדמים בזמן."},{kind:"concept",heading:"גובה על החמשה",body:"ככל שהתו גבוה יותר על החמשה — הצליל גבוה יותר. תו נמוך על החמשה = צליל נמוך."},{kind:"notation",heading:"חמישה צלילים עולים בצעדים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"דו־רה־מי־פה־סול — כל תו גבוה מעט מקודמו, והעין רואה מדרגות עולות."},{kind:"tip",icon:"💡",body:"סדרה עולה נראית כמו מדרגות מטפסות; סדרה יורדת — מדרגות יורדות. זהו את הצורה לפני שאתם קוראים כל תו."}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"תו שנמצא גבוה יותר על החמשה מייצג צליל…",options:[{label:"גבוה יותר",correct:!0},{label:"נמוך יותר",correct:!1},{label:"ארוך יותר",correct:!1}],explanation:"גובה על החמשה = גובה הצליל. מיקום אנכי אינו קשור למשך — את המשך קובע צורת התו."},{prompt:"באיזה כיוון קוראים את התווים?",options:[{label:"משמאל לימין",correct:!0},{label:"מימין לשמאל",correct:!1},{label:"מלמעלה למטה",correct:!1}],explanation:"בכתיב המערבי הזמן מתקדם משמאל לימין, כמו קריאת טקסט."}],relatedLessonIds:["sr-1-3"]},{id:"sr-1-3",unitId:"sr-unit-1",order:3,title:"צלילי עוגן",subtitle:"סול ודו אמצעי — נקודות ייחוס",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"⚓",body:'במקום לספור כל תו מהתחלה, קוראים מהירים מסתמכים על "צלילי עוגן" — צלילים שמזהים מיד, וממהם זזים צעד-צעד.'},{kind:"concept",heading:"סול — הקו השני",body:"מפתח סול (𝄞) מסמן את הצליל סול: הספירלה שלו מתפתלת סביב הקו השני מלמטה. לכן הקו השני = סול (g/4)."},{kind:"notation",heading:"שני עוגנים: סול ודו אמצעי",notation:{clef:"treble",notes:[{keys:["g/4"],duration:"h"},{keys:["c/4"],duration:"h"}]},body:"משמאל: סול על הקו השני. מימין: דו אמצעי, יושב על קו עזר קצר מתחת לחמשה."},{kind:"tip",icon:"💡",body:"מכל עוגן אפשר לזוז: צליל אחד מעל סול הוא לה, אחד מתחת — פה. כך קוראים בלי לספור מהתחלה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"ספירה של כל תו מקו הבסיס איטית ומועדת לטעויות. עדיף לעגון בצליל מוכר ולזוז ממנו."}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"על איזה קו במפתח סול יושב הצליל סול?",options:[{label:"הקו השני מלמטה",correct:!0},{label:"הקו האמצעי (השלישי)",correct:!1},{label:"הקו התחתון",correct:!1}],explanation:"ספירלת מפתח הסול מתפתלת סביב הקו השני — לכן הוא מסמן את הצליל סול (g/4).",n
4080otation:{clef:"treble",notes:[{keys:["g/4"],duration:"w"}]}},{prompt:"איפה נמצא דו אמצעי ביחס לחמשה במפתח סול?",options:[{label:"על קו עזר מתחת לחמשה",correct:!0},{label:"על הקו התחתון של החמשה",correct:!1},{label:"מעל החמשה",correct:!1}],explanation:"דו אמצעי (c/4) נמוך מדי לחמשת מפתח הסול, ולכן נכתב על קו עזר קצר מתחתיה."}],relatedLessonIds:["sr-2-1"]},{id:"sr-2-1",unitId:"sr-unit-2",order:1,title:"תנועה בשניות",subtitle:"הצעד הקל ביותר לקריאה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"👣",body:"תנועה בשנייה = מעבר מקו לחלל הסמוך לו, או מחלל לקו הסמוך. זו התנועה הקטנה ביותר ובעלת הקריאה הקלה ביותר."},{kind:"notation",heading:"חמש שניות עולות",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"}]},body:'מי־פה־סול־לה־סי: כל תו זז מקו לחלל הסמוך ולהפך — קו⇄חלל לאורך כל הרצף. זו "הליכה" חלקה במעלה החמשה.'},{kind:"tip",icon:"💡",body:'כשרואים תבנית של קו-חלל-קו-חלל רצופה — זו תנועה בשניות. אפשר לקרוא אותה כ"עולה/יורד" בלי לזהות כל שם.'}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"תנועה בשנייה נראית על החמשה כ…",options:[{label:"מעבר מקו לחלל הסמוך (או להפך)",correct:!0},{label:"דילוג מקו לקו הבא",correct:!1},{label:"הישארות על אותו צליל",correct:!1}],explanation:"שנייה = צעד סמוך: קו→חלל צמוד. דילוג מקו לקו הוא כבר טרצה."}],relatedLessonIds:["sr-2-2"]},{id:"sr-2-2",unitId:"sr-unit-2",order:2,title:"קריאת מנגינה פשוטה",subtitle:"לצרף צלילים לשורה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎵",body:"מנגינה היא רצף צלילים. בקריאה מהדף מזהים את קו הפתיחה, ואז עוקבים אחר התנועות — שנייה מעלה, שנייה מטה, חזרה על צליל."},{kind:"notation",heading:"מנגינה קצרה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["c/4"],duration:"w"}]},body:'דו־רה־מי־רה־דו: עולה בשתי שניות ויורד חזרה. צורת "גבעה" שקל לזהות.'},{kind:"tip",icon:"💡",body:"לפני שמתחילים לנגן — סרקו את השורה בעיניים וזהו את הצורה הכללית (עולה? יורד? גל?). זה מכין את האוזן והיד."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להתחיל לנגן מיד בלי סריקה מוקדמת. שנייה של הסתכלות על הצורה חוסכת הרבה טעויות."}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"המנגינה דו־רה־מי־רה־דו יוצרת צורה של…",options:[{label:"גבעה — עולה ואז יורד לאותו צליל",correct:!0},{label:"עלייה רצופה עד הסוף",correct:!1},{label:"ירידה רצופה",correct:!1}],explanation:'שתי שניות עולות (דו→מי) ושתי שניות יורדות (מי→דו) יוצרות קשת סימטרית — "גבעה".',notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["c/4"],duration:"q"}]}},{prompt:"מה כדאי לעשות לפני שמתחילים לקרוא שורה?",options:[{label:"לסרוק את הצורה הכללית בעיניים",correct:!0},{label:"לנגן מיד את התו הראשון",correct:!1},{label:"לספור את מספר התווים",correct:!1}],explanation:"סריקה מוקדמת מזהה את הצורה (עולה/יורד/גל) ומכינה את היד והאוזן — צעד מפתח בקריאה מהדף."}],relatedLessonIds:["sr-2-3"]},{id:"sr-2-3",unitId:"sr-unit-2",order:3,title:"קווים וחללים",subtitle:"זיהוי מהיר בלי ספירה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:"במפתח סול, ארבעת החללים מלמטה למעלה מאייתים מילה: פה־לה־דו־מי (F-A-C-E). קל לזכור כי זה נשמע כמו מילה."},{kind:"notation",heading:"ארבעת החללים: פה־לה־דו־מי",notation:{clef:"treble",notes:[{keys:["f/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["c/5"],duration:"q"},{keys:["e/5"],duration:"q"}]},body:"מלמטה למעלה: פה (חלל 1), לה (חלל 2), דו (חלל 3), מי (חלל 4)."},{kind:"concept",heading:"הקווים",body:'חמשת הקווים מלמטה למעלה: מי־סול־סי־רה־פה. אלו ה"עוגנים" שביניהם יושבים החללים.'},{kind:"notation",heading:"חמשת הקווים: מי־סול־סי־רה־פה",notation:{clef:"treble",notes:[{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["d/5"],duration:"q"},{keys:["f/5"],duration:"q"}]}},{kind:"tip",icon:"💡",body:'זכרו את החללים כ"מילה" פה־לה־דו־מי, ואת הקווים כרצף מי־סול־סי־רה־פה. עם שני אלה קוראים כל תו על החמשה.'}],practiceActivityIds:["act-sight-1"],quiz:[{prompt:"אילו צלילים יושבים בארבעת החללים של מפתח סול (מלמטה למעלה)?",options:[{label:"פה־לה־דו־מי",correct:!0},{label:"מי־סול־סי־רה",correct:!1},{label:"דו־רה־מי־פה",correct:!1}],explanation:"החללים מאייתים פה־לה־דו־מי (F-A-C-E). הקווים הם מי־סול־סי־רה־פה."},{prompt:"הצליל שיושב על הקו התחתון של מפתח סול הוא…",options:[{label:"מי",correct:!0},{label:"פה",correct:!1},{label:"סול",correct:!1}],explanation:"הקווים מלמטה למעלה: מי־סול־סי־רה־פה. הקו התחתון הוא מי (e/4).",notation:{clef:"treble",notes:[{keys:["e/4"],duration:"w"}]}}],relatedLessonIds:["sr-3-1"]},{id:"sr-3-1",unitId:"sr-unit-3",order:1,title:"מהי קפיצה?",subtitle:"טרצה — דילוג מעל צליל אחד",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🦘",body:"לא כל תנועה היא צעד. קפיצה (טרצה) מדלגת מעל צליל אחד: מקו לקו הסמוך, או מחלל לחלל הסמוך."}
4080,{kind:"notation",heading:"טרצה: מקו לקו",notation:{clef:"treble",notes:[{keys:["e/4"],duration:"h"},{keys:["g/4"],duration:"h"}]},body:"מי (קו תחתון) → סול (קו שני). דילגנו מעל פה. שני קווים סמוכים = טרצה."},{kind:"notation",heading:"טרצה: מחלל לחלל",notation:{clef:"treble",notes:[{keys:["f/4"],duration:"h"},{keys:["a/4"],duration:"h"}]},body:"פה (חלל 1) → לה (חלל 2). דילגנו מעל סול. שני חללים סמוכים = טרצה."},{kind:"tip",icon:"💡",body:"שנייה = קו→חלל צמוד. טרצה = קו→קו או חלל→חלל. הבחנה מהירה בין השתיים היא מפתח לקריאה שוטפת."}],practiceActivityIds:["act-sri-3rds"],quiz:[{prompt:"תנועה מקו אחד לקו הסמוך לו (בלי החלל שביניהם) היא…",options:[{label:"טרצה (קפיצה)",correct:!0},{label:"שנייה (צעד)",correct:!1},{label:"אותו צליל",correct:!1}],explanation:"קו→קו סמוך מדלג מעל החלל שביניהם — זו טרצה. שנייה היא קו→חלל צמוד.",notation:{clef:"treble",notes:[{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"}]}}],relatedLessonIds:["sr-3-2"]},{id:"sr-3-2",unitId:"sr-unit-3",order:2,title:"זיהוי טרצות בקריאה",subtitle:'צורת "שלד סולם"',estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🪜",body:"רצף טרצות עולה נראה כמו שלבי סולם: קו-קו-קו או חלל-חלל-חלל. זיהוי הצורה מאפשר לקרוא אקורד שבור במבט אחד."},{kind:"notation",heading:"שלוש טרצות עולות על קווים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["d/5"],duration:"q"}]},body:"מי־סול־סי־רה: כולם על קווים, כל קפיצה טרצה. זהו הבסיס של אקורד שבור."},{kind:"tip",icon:"💡",body:"כשכל התווים על קווים (או כולם בחללים) ברצף — אתם קוראים טרצות. אין צורך לזהות כל שם בנפרד."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לבלבל טרצה (קו→קו) עם שנייה (קו→חלל). הביטו אם התווים "נשארים באותו סוג" (קו/חלל) — אז זו קפיצה.'}],practiceActivityIds:["act-sri-3rds"],quiz:[{prompt:"רצף שבו כל התווים יושבים על קווים עוקבים (מי־סול־סי־רה) בנוי מ…",options:[{label:"טרצות",correct:!0},{label:"שניות",correct:!1},{label:"אוקטבות",correct:!1}],explanation:"מעבר מקו לקו הסמוך הוא טרצה; רצף כזה הוא שרשרת טרצות — שלד של אקורד שבור."}],relatedLessonIds:["sr-3-3"]},{id:"sr-3-3",unitId:"sr-unit-3",order:3,title:"קפיצות רחבות",subtitle:"קוורטה, קווינטה ואוקטבה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:'קפיצות רחבות מזוהות לפי המרחק על החמשה. ככל שהמרחק גדל — הקפיצה רחבה יותר וקל יותר "למדוד" אותה בעין.'},{kind:"notation",heading:"קווינטה: דו→סול",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["g/4"],duration:"h"}]},body:"דו אמצעי → סול: מרחק של חמישה צלילים (דו־רה־מי־פה־סול). צליל פתוח ויציב."},{kind:"notation",heading:"אוקטבה: דו→דו",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["c/5"],duration:"h"}]},body:"אותו שם, גובה כפול — הקפיצה הרחבה שקל לזהות: אותו צליל, אוקטבה מעל."},{kind:"tip",icon:"💡",body:'לאוקטבה יש "טעם" מוכר — אותו צליל למעלה. השתמשו באוזן כדי לוודא שהקפיצה נכונה.'}],practiceActivityIds:["act-sri-harm"],quiz:[{prompt:"הקפיצה דו→סול (חמישה צלילים) נקראת…",options:[{label:"קווינטה",correct:!0},{label:"טרצה",correct:!1},{label:"אוקטבה",correct:!1}],explanation:"דו־רה־מי־פה־סול הם חמישה צלילים — לכן דו→סול הוא מרווח קווינטה.",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["g/4"],duration:"q"}]}},{prompt:"שני צלילים באותו שם, האחד גבוה מהשני בדיוק בגובה כפול — זו…",options:[{label:"אוקטבה",correct:!0},{label:"קווינטה",correct:!1},{label:"שנייה",correct:!1}],explanation:"אוקטבה = אותו שם צליל, שמונה צלילים מעל (דו→דו). היחס האקוסטי הוא כפול בתדר."}],relatedLessonIds:["sr-4-1"]},{id:"sr-4-1",unitId:"sr-unit-4",order:1,title:"קריאת ערכי תווים",subtitle:"שלם, חצי ורבע",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"⏱️",body:"צורת התו קובעת כמה זמן הוא נמשך. בקריאה מהדף לא קוראים רק גובה — גם משך."},{kind:"concept",heading:"שלושה ערכים בסיסיים",body:"תו שלם = 4 פעימות; תו חצי = 2 פעימות; תו רבע = פעימה אחת. במשקל 4/4 תו שלם ממלא תיבה שלמה."},{kind:"notation",heading:"תיבה של ארבעה רבעים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["g/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"ארבעה רבעים = ארבע פעימות = תיבה מלאה ב-4/4. סופרים 1־2־3־4."},{kind:"notation",heading:"תו שלם — תיבה שלמה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["g/4"],duration:"w"}]},body:"צליל אחד שנמשך את כל ארבע הפעימות."},{kind:"tip",icon:"💡",body:"ראש חלול בלי זנב = שלם; ראש חלול עם זנב = חצי; ראש מלא עם זנב = רבע. הצורה מספרת את המשך."}],practiceActivityIds:["act-rhythm-2"],quiz:[{prompt:"כמה פעימות נמשך תו רבע במשקל 4/4?",options:[{label:"פעימה אחת",correct:!0},{label:"שתי פעימות",correct:!1},{label:"ארבע פעימות",correct:!1}],explanation:"תו רבע = פעימה אחת. חצי = 2, שלם = 4. ארבעה רבעים ממלאים תיבה של 4/4."},{prompt:"כמה תווי רבע נכנסים בתיבה אחת של 4/4?",options:[{label:"ארבעה",correct:!0},{label:"שניים",correct:!1},{label:"שמונה",correct:!1}],explanation:"משקל 4/4 = ארבע פעימות בתיבה, וכל רבע הוא פעימה — לכן ארבעה רבעים."}],relatedLessonIds:["sr-4-2"]},{id:"sr-4-2",unitId:"sr-unit-4",order:2,title:"ספירה ומשקל",subtitle:"לשמור על פעימה יציבה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔢",body:"חתימת המשקל בתחילת השורה (למשל 4/4) אומרת כמה פעימות יש בתיבה. סופרים אותן בקול או בראש כדי לשמור על קצב יציב."},{kind:"concept",heading:"מה אומר 4/4?",body:"המספר העליון = כמה פעימות בתיבה (4). המספר התחתון = איזה תו מקבל פעימה (4 = רבע). כלומר: ארבע פעימות-רבע בכל תיבה."},{kind:"notation",heading:"תיבה: חצי + שני רבעים",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["e/4"],duration:"h"},{keys:["g/4"],duration:"q"},{keys:["g/4"],duration:"q"}]},body:"חצי (פעימות 1־2) ואז שני רבעים (פעימות 3, 4). סופרים 1־2־3־4 ושומרים על אחידות."},{kind:"tip",icon:"💡",body:"ספירה קבועה חשובה מדיוק כל צליל. גם אם החמצתם גובה — אל תעצרו את הפעימה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"להאיץ בתווים הקצרים ולהאט בארוכים. הפעימה נשארת קבועה — התווים רק ממלאים אותה אחרת."}],practiceActivityIds:["act-rhythm-2"],quiz:[{prompt:"במשקל 4/4, מה מציין המספר העליון (4)?",options:[{label:"מספר הפעימות בתיבה",correct:!0},{label:"מהירות הנגינה",correct:!1},{label:"מספר התיבות ביצירה",correct:!1}],explanation:"המספר העליון = כמה פעימות בכל תיבה. התחתון = איזה ערך תו מקבל פעימה (4 = רבע)."}],relatedLessonIds:["sr-4-3"]},{id:"sr-4-3",unitId:"sr-unit-4",order:3,title:"שילוב גובה ומקצב",subtitle:"לקרוא מה ומתי יחד",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🎼",body:"קריאה מהדף אמיתית משלבת את שני הצירים בבת אחת: איזה צליל (גובה) וכמה זמן (מקצב). מתחילים לאט ומחברים."},{kind:"notation",heading:"מנגינה עם מקצב מעורב",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"h"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["c/5"],duration:"w"}]},body:"דו (חצי) · מי (רבע) · סול (רבע) · דו גבוה (שלם). קפיצות של טרצות ואז אוקטבה — עם ערכים משתנים."},{kind:"tip",icon:"💡",body:"קראו קודם רק את המקצב (טפחו את הפעימות), אחר כך רק את הגבהים, ולבסוף חברו. פיצול המשימה מקל."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לנסות לקרוא הכול מיד במהירות מלאה. התחילו בטמפו איטי שמאפשר דיוק — המהירות תבוא."}],practiceActivityIds:["act-rhythm-2","act-sight-1"],quiz:[{prompt:"מהי הדרך היעילה לקרוא מהדף מנגינה שמשלבת גבהים ומקצב?",options:[{label:"לפצל — קודם מקצב, אז גבהים, ואז לחבר",correct:!0},{label:"לנגן מיד במהירות מלאה",correct:!1},{label:"להתעלם מהמקצב ולקרוא רק גבהים",correct:!1}],explanation:"פיצול המשימה (מקצב לחוד, גובה לחוד) מפחית עומס ומאפשר לחבר בהדרגה בטמפו נשלט."},{prompt:"באיזה טמפו כדאי להתחיל קריאה מהדף של קטע חדש?",options:[{label:"איטי — כזה שמאפשר דיוק ורצף",correct:!0},{label:"המהיר ביותר שאפשר",correct:!1},{label:"לא משנה",correct:!1}],explanation:"טמפו איטי שומר על רצף ודיוק; מהירות מוקדמת מדי גורמת לעצירות ולטעויות. המהירות מתפתחת אחר כך."}],relatedLessonIds:["sr-5-1"]},{id:"sr-5-1",unitId:"sr-unit-5",order:1,title:"מהו מפתח פה?",subtitle:"קריאת הצלילים הנמוכים",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🎼",body:"מפתח פה 
4080(𝄢) משמש לצלילים נמוכים — יד שמאל בפסנתר, צ׳לו, בס. אותם קווים וחללים, אך שמות הצלילים שונים ממפתח סול."},{kind:"concept",heading:'למה "מפתח פה"?',body:"שתי הנקודות של המפתח מקיפות את הקו הרביעי מלמטה — וקו זה הוא הצליל פה. משם נגזרים שאר הצלילים."},{kind:"notation",heading:"פה על הקו הרביעי",notation:{clef:"bass",notes:[{keys:["f/3"],duration:"w"}]},body:"הצליל פה (f/3) יושב על הקו הרביעי מלמטה — נקודת העוגן של מפתח פה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לקרוא מפתח פה כמו מפתח סול. אותה חמשה — אבל כל צליל "יורד" שני צלילים בשם. חובה להחליף מנטלית למפתח הנכון.'}],practiceActivityIds:["act-sr-name-bass"],quiz:[{prompt:"על איזה קו מצביע מפתח פה?",options:[{label:"הקו הרביעי מלמטה (פה)",correct:!0},{label:"הקו השני מלמטה (סול)",correct:!1},{label:"הקו האמצעי",correct:!1}],explanation:"שתי נקודות מפתח הפה מקיפות את הקו הרביעי, שהוא הצליל פה (f/3).",notation:{clef:"bass",notes:[{keys:["f/3"],duration:"w"}]}}],relatedLessonIds:["sr-5-2"]},{id:"sr-5-2",unitId:"sr-unit-5",order:2,title:"עוגנים במפתח פה",subtitle:"פה ודו אמצעי",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"⚓",body:"כמו במפתח סול — עוגנים מזרזים קריאה. במפתח פה: הצליל פה (קו רביעי) ודו אמצעי, שיושב מעל החמשה."},{kind:"notation",heading:"דו אמצעי במפתח פה",notation:{clef:"bass",notes:[{keys:["f/3"],duration:"h"},{keys:["c/4"],duration:"h"}]},body:"משמאל פה (קו 4). מימין דו אמצעי (c/4) — על קו עזר קצר מעל החמשה. שימו לב: אותו דו אמצעי שבמפתח סול יושב מתחת לחמשה."},{kind:"tip",icon:"💡",body:'דו אמצעי הוא "גשר" בין המפתחות: במפתח סול הוא מתחת לחמשה, במפתח פה מעליה. הוא הצליל המשותף שמחבר את שתי החמשות במערכת הכפולה.'}],practiceActivityIds:["act-sr-name-bass"],quiz:[{prompt:"איפה נמצא דו אמצעי במפתח פה?",options:[{label:"על קו עזר מעל החמשה",correct:!0},{label:"על קו עזר מתחת לחמשה",correct:!1},{label:"על הקו העליון של החמשה",correct:!1}],explanation:"במפתח פה דו אמצעי (c/4) גבוה מהחמשה ונכתב על קו עזר מעליה — הפוך ממיקומו במפתח סול."}],relatedLessonIds:["sr-5-3"]},{id:"sr-5-3",unitId:"sr-unit-5",order:3,title:"קווים וחללים במפתח פה",subtitle:"סול־סי־רה־פה־לה ו-לה־דו־מי־סול",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:"חמשת הקווים במפתח פה, מלמטה למעלה: סול־סי־רה־פה־לה. ארבעת החללים: לה־דו־מי־סול."},{kind:"notation",heading:"הקווים: סול־סי־רה־פה־לה",notation:{clef:"bass",notes:[{keys:["g/2"],duration:"q"},{keys:["b/2"],duration:"q"},{keys:["d/3"],duration:"q"},{keys:["f/3"],duration:"q"},{keys:["a/3"],duration:"q"}]},body:"מלמטה למעלה. הקו הרביעי (פה) הוא העוגן המוכר."},{kind:"notation",heading:"החללים: לה־דו־מי־סול",notation:{clef:"bass",notes:[{keys:["a/2"],duration:"q"},{keys:["c/3"],duration:"q"},{keys:["e/3"],duration:"q"},{keys:["g/3"],duration:"q"}]}},{kind:"tip",icon:"💡",body:'אפשר לזכור בעזרת משפט: הקווים "סול־סי־רה־פה־לה", החללים "לה־דו־מי־סול". תרגול קצר קובע אותם בזיכרון.'}],practiceActivityIds:["act-sr-name-bass"],quiz:[{prompt:"הצליל שעל הקו התחתון של מפתח פה הוא…",options:[{label:"סול",correct:!0},{label:"מי",correct:!1},{label:"פה",correct:!1}],explanation:"קווי מפתח פה מלמטה למעלה: סול־סי־רה־פה־לה. הקו התחתון הוא סול (g/2). (במפתח סול הקו התחתון הוא מי — לכן חשוב להחליף מנטלית.)",notation:{clef:"bass",notes:[{keys:["g/2"],duration:"w"}]}},{prompt:"אילו צלילים יושבים בחללים של מפתח פה 
4080(מלמטה למעלה)?",options:[{label:"לה־דו־מי־סול",correct:!0},{label:"פה־לה־דו־מי",correct:!1},{label:"סול־סי־רה־פה",correct:!1}],explanation:"חללי מפתח פה: לה־דו־מי־סול. (פה־לה־דו־מי הם החללים של מפתח סול.)"}],relatedLessonIds:["sr-6-1"]},{id:"sr-6-1",unitId:"sr-unit-6",order:1,title:"סריקה מוקדמת",subtitle:"מה בודקים לפני שמנגנים",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔍",body:'לפני הצליל הראשון, קוראים מנוסים "סורקים" את הקטע בכמה שניות — כדי לדעת למה לצפות.'},{kind:"concept",heading:"ארבעה דברים לבדוק",body:"1) המפתח (סול/פה). 2) חתימת המשקל (כמה פעימות בתיבה). 3) חתימת המפתח (דיאזים/במולים). 4) הטווח והצורה הכללית (עולה? קפיצות?)."},{kind:"tip",icon:"💡",body:"סריקה של חמש שניות חוסכת עשרות טעויות. היא מכינה את המוח לדפוסים שיבואו."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לקפוץ ישר לנגינה בלי לבדוק מפתח ומשקל. טעות במפתח הופכת את כל הקטע לשגוי."}],practiceActivityIds:["act-key-first","act-acc-flats"],quiz:[{prompt:"מה מהבאים חשוב לבדוק בסריקה מוקדמת לפני קריאה?",options:[{label:"מפתח, משקל, חתימת מפתח וטווח",correct:!0},{label:"רק את התו הראשון",correct:!1},{label:"את שם המלחין",correct:!1}],explanation:"זיהוי מוקדם של מפתח, משקל, חתימת מפתח וצורה כללית מכין לקריאה מדויקת ורציפה."}],relatedLessonIds:["sr-6-2"]},{id:"sr-6-2",unitId:"sr-unit-6",order:2,title:"קיבוץ דפוסים",subtitle:"לקרוא קבוצות, לא תו-תו",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🧩",body:"קריאה שוטפת מזהה קבוצות מוכרות — סולם עולה, אקורד שבור, חזרה על צליל — במקום לפענח כל תו בנפרד. כמו שקוראים מילה שלמה ולא אות-אות."},{kind:"notation",heading:"דפוס מוכר: סולם עולה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"}]},body:'דו־רה־מי־פה: ברגע שמזהים "סולם עולה בשניות" — קוראים את כל הקבוצה במבט אחד.'},{kind:"notation",heading:"דפוס מוכר: אקורד שבור",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"דו־מי־סול־דו: אקורד דו שבור עולה (דו־מי־סול הן טרצות, ודו העליון סוגר את האוקטבה). דפוס שחוזר בהמון יצירות."},{kind:"tip",icon:"💡",body:'ככל שמכירים יותר דפוסים (סולמות, אקורדים שבורים) — הקריאה מהירה יותר, כי קוראים "מילים" ולא "אותיות".'}],practiceActivityIds:["act-sri-3rds"],quiz:[{prompt:"הרצף דו־מי־סול־דו (אקורד שבור עולה) הוא דפוס מוכר של…",options:[{label:"אקורד שבור",correct:!0},{label:"סולם בשניות",correct:!1},{label:"חזרה על צליל",correct:!1}],explanation:"טרצות עולות רצופות (דו־מי־סול) בונות אקורד שבור — כאן אקורד דו מז׳ור, עם דו נוסף באוקטבה."}],relatedLessonIds:["sr-6-3"]},{id:"sr-6-3",unitId:"sr-unit-6",order:3,title:"המשכיות והבטה קדימה",subtitle:"העיניים לפני הידיים",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"👀",body:"בקריאה מהדף העין תמיד מקדימה את היד — קוראים את התו הבא בזמן שמנגנים את הנוכחי. זה שומר על זרימה רציפה."},{kind:"concept",heading:"הכלל הזהב",body:"לעולם לא עוצרים ולא חוזרים אחורה לתקן. טעות בודדת פחות חשובה מהמשכיות — כמו נגן בהופעה חיה."},{kind:"tip",icon:"💡",body:'אמנו "הבטה קדימה": כסו את התו שאתם מנגנים והסתכלו רק על הבא. זה מכריח את העין להקדים.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לעצור על כל שגיאה ולחזור. זה הופך קריאה מהדף ל"פענוח" איטי. ממשיכים תמיד — הדיוק משתפר עם התרגול.'}],practiceActivityIds:["act-mel-c"],quiz:[{prompt:'מהו "הכלל הזהב" של קריאה מהדף?',options:[{label:"להמשיך בזרימה בלי לעצור לתקן",correct:!0},{label:"לעצור ולתקן כל טעות מיד",correct:!1},{label:"לנגן כל תו פעמיים",correct:!1}],explanation:"שמירה על המשכיות חשובה מדיוק כל תו — עוצרים לתיקון בתרגול איטי, לא בקריאה מהדף."},{prompt:'מה המשמעות של "העין מקדימה את היד"?',options:[{label:"קוראים את התו הבא בזמן שמנגנים את הנוכחי",correct:!0},{label:"מנגנים מהר יותר מהקצב",correct:!1},{label:"מסתכלים רק על התו שמנגנים",correct:!1}],explanation:"הבטה קדימה מכינה את היד לתו הבא ושומרת על רצף — יסוד הקריאה השוטפת."}],relatedLessonIds:[]}],k$={id:"course-theory",title:"תורת המוזיקה — יסודות",subtitle:"קורס שנה א׳ · שירת הלויים",description:"לא רק לקרוא תווים — להבין איך מוזיקה עובדת: מרכז טונאלי, תפקיד הדרגות, מתח והרגעה, פונקציות הרמוניות וקדנצות. לומדים עיקרון, מתרגלים, ומקבלים משוב.",trackId:"track-men"},w$=[{id:"th-unit-1",courseId:"course-theory",order:1,title:"טונאליות ומרכז טונאלי",summary:'מהו הצליל המרכזי, תחושת "בית", ומז׳ור מול מינור',icon:"🏠"},{id:"th-unit-2",courseId:"course-theory",order:2,title:"דרגות הסולם ותפקידיהן",summary:"שבע הדרגות, שלוש המרכזיות, והדרגה המובילה",icon:"🎚️"},{id:"th-unit-3",courseId:"course-theory",order:3,title:"עיצור ודיסוננס",summary:"צלילים יציבים מול מתוחים והפתרון ביניהם",icon:"⚖️"},{id:"th-unit-4",courseId:"course-theory",order:4,title:"פונקציות הרמוניות",
4080summary:"טוניקה–סובדומיננטה–דומיננטה: מנוע התנועה",icon:"⚙️"},{id:"th-unit-5",courseId:"course-theory",order:5,title:"קדנצות",summary:"סיומים הרמוניים: אותנטית, פלגלית וחצי",icon:"🛬"}],j$=[{id:"th-1-1",unitId:"th-unit-1",order:1,title:"מהי טונאליות?",subtitle:"למוזיקה יש כוח משיכה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🧲",body:'רוב המוזיקה שאנחנו מכירים "סובבת" סביב צליל מרכזי אחד — הטוניקה. הוא מרגיש כמו "בית" שאליו הלחן שואף לחזור ולנוח.'},{kind:"concept",heading:"איך מזהים את המרכז?",body:'הטוניקה היא הצליל שבו הלחן מרגיש "גמור" ורגוע. נסו לשיר מנגינה מוכרת ולעצור — לרוב תרצו לסיים דווקא על הטוניקה.'},{kind:"tip",icon:"💡",body:'טונאליות היא כמו כוח כבידה מוזיקלי: כל הצלילים "נמשכים" אל המרכז בעוצמות שונות.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שהצליל הראשון הוא תמיד הטוניקה. לא בהכרח — הטוניקה היא צליל ההרגעה, שלרוב מגיע בסוף המשפט."}],practiceActivityIds:[],quiz:[{prompt:"מהי הטוניקה?",options:[{label:"הצליל המרכזי שאליו הלחן נמשך ונח",correct:!0},{label:"הצליל הגבוה ביותר ביצירה",correct:!1},{label:"הצליל הראשון תמיד",correct:!1}],explanation:'הטוניקה היא מרכז הכובד הטונאלי — צליל ה"בית" שבו הלחן מרגיש גמור ורגוע.'},{prompt:"איפה לרוב מרגישים הכי חזק את תחושת ההרגעה של הטוניקה?",options:[{label:"בסיום המשפט המוזיקלי",correct:!0},{label:"בצליל הראשון",correct:!1},{label:"בצליל הרם ביותר",correct:!1}],explanation:'סיום על הטוניקה נותן תחושת "הגענו הביתה" — לכן משפטים רבים נחים עליה.'}],relatedLessonIds:["th-1-2"]},{id:"th-1-2",unitId:"th-unit-1",order:2,title:"הסולם כמשפחה סביב הטוניקה",subtitle:"שבעה צלילים, מרכז אחד",estimatedMinutes:4,knowledgeIds:["scale.major"],sections:[{kind:"concept",icon:"👨‍👩‍👧",body:'סולם הוא אוסף הצלילים ה"שייכים" לטוניקה מסוימת. בדו מז׳ור: דו־רה־מי־פה־סול־לה־סי — כולם סובבים סביב דו.'},{kind:"notation",heading:"סולם דו מז׳ור — שבע דרגות אל הטוניקה",notation:{clef:"treble",timeSignature:"4/4",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"},{keys:["c/5"],duration:"q"}]},body:"העלייה מדו עד דו הבא: שבעה צלילים שונים, ואז חזרה לטוניקה אוקטבה מעל."},{kind:"tip",icon:"💡",body:'הצליל השמיני (דו הגבוה) אינו צליל חדש — הוא הטוניקה שוב, אוקטבה מעל. לכן "סולם" מרגיש שלם כשמגיעים אליו.'}],practiceActivityIds:["act-spell-maj"],quiz:[{prompt:"הצליל השמיני בסולם עולה (דו→דו) הוא…",options:[{label:"הטוניקה שוב, אוקטבה מעל",correct:!0},{label:"צליל חדש שאינו בסולם",correct:!1},{label:"הדומיננטה",correct:!1}],explanation:'הסולם בנוי משבעה צלילים; השמיני הוא חזרה על הטוניקה באוקטבה — לכן העלייה מרגישה "סגורה".'}],relatedLessonIds:["th-1-3"]},{id:"th-1-3",unitId:"th-unit-1",order:3,title:"מז׳ור ומינור — שני צבעים",subtitle:"הטרצה שקובעת את הרגש",estimatedMinutes:4,knowledgeIds:["scale.major","scale.natural_minor"],sections:[{kind:"concept",icon:"🎨",body:'אותה טוניקה יכולה להישמע "בהיר/שמח" (מז׳ור) או "כהה/עצוב" (מינור). מה שקובע הוא הצליל השלישי — הטרצה שמעל הטוניקה.'},{kind:"concept",heading:"ההבדל",body:"במז׳ור הטרצה גדולה (מרחק של שני טונים מהטוניקה); במינור הטרצה קטנה (טון וחצי). זהו ההבדל הרגשי המרכזי."},{kind:"notation",heading:"דו→מי: טרצה גדולה (מז׳ור)",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["e/4"],duration:"h"}]},body:"דו→מי = ארבעה חצאי-טונים = טרצה גדולה → צבע מז׳ורי."},{kind:"notation",heading:"דו→מי במול: טרצה קטנה (מינור)",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"h"},{keys:["eb/4"],duration:"h"}]},body:"דו→מי במול = שלושה חצאי-טונים = טרצה קטנה → צבע מינורי."},{kind:"tip",icon:"💡",body:"האזינו: אותה טוניקה (דו), רק הטרצה משתנה, והרגש מתהפך לגמרי. זה הכוח של צליל אחד."}],practiceActivityIds:["act-spell-min"],quiz:[{prompt:"איזה צליל בסולם קובע אם הוא מז׳ור או מינור?",options:[{label:"הצליל השלישי (הטרצה מעל הטוניקה)",correct:!0},{label:"הצליל החמישי",correct:!1},{label:"הטוניקה עצמה",correct:!1}],explanation:'הטרצה מעל הטוניקה: גדולה = מז׳ור (בהיר), קטנה = מינור (כהה). זהו ה"צבע" של הסולם.'},{prompt:"טרצה גדולה (כמו דו→מי) מכילה…",options:[{label:"ארבעה חצאי-טונים",correct:!0},{label:"שלושה חצאי-טונים",correct:!1},{label:"חמישה חצאי-טונים",correct:!1}],explanation:"טרצה גדולה = 4 חצאי-טונים (דו→מי). טרצה קטנה = 3 (דו→מי במול). ההבדל הוא חצי-טון אחד."}],relatedLessonIds:["th-2-1"]},{id:"th-2-1",unitId:"th-unit-2",order:1,title:"שבע הדרגות",subtitle:"לכל צליל בסולם יש מספר",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🔢",body:'כל צליל בסולם נקרא "דרגה" ומסומן במספר רומי לפי מיקומו: I (טוניקה), II, III, IV, V, VI, VII. המספר מתאר תפקיד — לא רק גובה.'},{kind:"concept",heading:"למה מספרים ולא שמות?",body:"הדרגות מאפשרות לדבר על תפקיד בלי תלות בסולם. הדרגה V בדו היא סול, ובסול היא רה — אבל התפקיד (דומיננטה) זהה."},{kind:"notation",heading:"סולם דו עם הדרגות",notation:{clef:"treble",notes:[{keys:["c/4"],duration:"q"},{keys:["d/4"],duration:"q"},{keys:["e/4"],duration:"q"},{keys:["f/4"],duration:"q"},{keys:["g/4"],duration:"q"},{keys:["a/4"],duration:"q"},{keys:["b/4"],duration:"q"}]},body:"דו=I, רה=II, מי=III, פה=IV, סול=V, לה=VI, סי=VII."},{kind:"tip",icon:"💡",body:"חשיבה בדרגות (ולא בשמות) היא סוד ההעברה בין סולמות: אותה תבנית עובדת בכל טונאליות."}],practiceActivityIds:["act-func-num"],quiz:[{prompt:"הדרגה החמישית (V) בסולם דו מז׳ור היא הצליל…",options:[{label:"סול",correct:!0},{label:"פה",correct:!1},{label:"לה",correct:!1}],explanation:"ספירה מדו: דו(I)־רה(II)־מי(III)־פה(IV)־סול(V). הדרגה החמישית היא סול — הדומיננטה."}],relatedLessonIds:["th-2-2"]},{id:"th-2-2",unitId:"th-unit-2",order:2,title:"שלוש הדרגות המרכזיות",subtitle:"טוניקה, סובדומיננטה, דומיננטה",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🏛️",body:"שלוש דרגות נושאות את רוב המשקל ההרמוני: I (טוניקה) — הבית; V (דומיננטה) — המתח; IV (סובדומיננטה) — התנועה מהבית."},{kind:"concept",heading:"התפקידים",body:"טוניקה (I) = יציבות והרגעה. דומיננטה (V) = מתח חזק שנמשך לחזור לטוניקה. סובדומיננטה (IV) = מרחיקה מהבית, מכינה את הדרך לדומיננטה."},{kind:"notation",heading:"אקורד הטוניקה (I) בדו",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"w"}]},body:'דו־מי־סול — האקורד הבנוי על הדרגה הראשונה. צליל "בית" יציב.'},{kind:"notation",heading:"אקורד הדומיננטה (V) בדו",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"w"}]},body:"סול־סי־רה — האקורד על הדרגה החמישית. יוצר מתח שנמשך חזרה לטוניקה."},{kind:"tip",icon:"💡",body:"רוב שירי העם בנויים כמעט כולם משלוש הדרגות האלה. זיהוין נותן מפתח להבנת רוב המוזיקה הטונאלית."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"איזו דרגה יוצרת את המתח החזק ביותר שנמשך לחזור לטוניקה?",options:[{label:"הדומיננטה (V)",correct:!0},{label:"הסובדומיננטה (IV)",correct:!1},{label:"הטוניקה (I)",correct:!1}],explanation:"הדומיננטה (V) נושאת את הדרגה המובילה ויוצרת משיכה חזקה אל הטוניקה — מנוע המתח וההרגעה."},{prompt:"אקורד הטוניקה בדו מז׳ור בנוי מהצלילים…",options:[{label:"דו־מי־סול",correct:!0},{label:"סול־סי־רה",correct:!1},{label:"פה־לה־דו",correct:!1}],explanation:"אקורד I בדו הוא דו־מי־סול (טוניקה, טרצה, קווינטה). סול־סי־רה הוא V, ופה־לה־דו הוא IV."}],relatedLessonIds:["th-2-3"]},{id:"th-2-3",unitId:"th-unit-2",order:3,title:"הדרגה המובילה",subtitle:"הצליל שרוצה לעלות הביתה",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🧗",body:'הדרגה השביעית (VII) במז׳ור נמצאת חצי-טון בלבד מתחת לטוניקה — ולכן נמשכת אליה בעוצמה. קוראים לה "הצליל המוביל".'},{kind:"notation",heading:"סי→דו: הצליל המוביל נפתר",notation:{clef:"treble",notes:[{keys:["b/4"],duration:"h"},{keys:["c/5"],duration:"h"}]},body:'סי (VII) → דו (I): עלייה של חצי-טון בלבד. שמעו כמה חזק סי "רוצה" להגיע לדו.'},{kind:"tip",icon:"💡",body:"הצליל המוביל הוא הסיבה שהדומיננטה (שמכילה אותו — סול־סי־רה) יוצרת מתח כה חזק אל הטוניקה."},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:"לחשוב שכל הדרגות נמשכות שווה לטוניקה. הצליל המוביל (VII) הוא בעל המשיכה החזקה ביותר בגלל מרחק חצי-הטון."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"מדוע הדרגה השביעית (הצליל המוביל) נמשכת כה חזק לטוניקה?",options:[{label:"כי היא רק חצי-טון מתחת לטוניקה",correct:!0},{label:"כי היא הצליל הגבוה בסולם",correct:!1},{label:"כי היא רחוקה מהטוניקה",correct:!1}],explanation:'המרחק הקטן (חצי-טון) יוצר "משיכה" חזקה: סי שואף לעלות לדו. זהו מקור המתח של הדומיננטה.'}],relatedLessonIds:["th-3-1"]},{id:"th-3-1",unitId:"th-unit-3",order:1,title:"עיצור ודיסוננס",subtitle:"צלילים יציבים מול מתוחים",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"⚖️",body:'כששני צלילים נשמעים יחד, הצירוף יכול להישמע יציב ונינוח (עיצור) או מתוח ו"מבקש להמשיך" (דיסוננס).'},{kind:"concept",heading:"מי עיצור ומי דיסוננס?",body:"עיצורים: אוקטבה, קווינטה, טרצות וסקסטות. דיסוננסים: סקונדות, ספטימות והטריטון (מרווח של שלושה טונים)."},{kind:"notation",heading:"קווינטה — עיצור יציב",notation:{clef:"treble",notes:[{keys:["c/4","g/4"],duration:"w"}]},body:'דו+סול יחד: צליל פתוח, יציב, "נח".'},{kind:"notation",heading:"סקונדה — דיסוננס מתוח",notation:{clef:"treble",notes:[{keys:["c/4","d/4"],duration:"w"}]},body:"דו+רה יחד: חיכוך, מתח — האוזן מצפה לפתרון."},{kind:"tip",icon:"💡",body:'דיסוננס אינו "רע" — הוא מנוע הרגש של המוזיקה. בלי מתח אין הרגעה.'}],practiceActivityIds:["act-org-cons"],quiz:[{prompt:"איזה מהמרווחים הבאים נחשב דיסוננס?",options:[{label:"סקונדה",correct:!0},{label:"קווינטה",correct:!1},{label:"אוקטבה",correct:!1}],explanation:"סקונדות, ספטימות והטריטון הם דיסוננסים (מתוחים). קווינטה ואוקטבה הם עיצורים יציבים."}],relatedLessonIds:["th-3-2"]},{id:"th-3-2",unitId:"th-unit-3",order:2,title:"פתרון הדיסוננס",subtitle:"מתח שנח על עיצור",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎯",body:'דיסוננס נוטה "להיפתר" — לנוע בצעד קטן אל עיצור סמוך. זו התנועה שיוצרת את תחושת ההרגעה.'},{kind:"notation",heading:"הצליל המוביל נפתר: סי→דו",notation:{clef:"treble",notes:[{keys:["b/4"],duration:"h"},{keys:["c/5"],duration:"h"}]},body:"סי (מתוח, נמשך למעלה) נפתר בחצי-טון לדו — הרגעה."},{kind:"notation",heading:"הספטימה נפתרת כלפי מטה: פה→מי",notation:{clef:"treble",notes:[{keys:["f/4"],duration:"h"},{keys:["e/4"],duration:"h"}]},body:"פה (הספטימה של אקורד הדומיננטה) נפתר בצעד למטה למי."},{kind:"tip",icon:"💡",body:'רוב הפתרונות הם בצעד (שנייה) — לא בקפיצה. המתח "מחליק" אל ההרגעה הקרובה.'}],practiceActivityIds:["act-org-cons"],quiz:[{prompt:"כיצד לרוב נפתר דיסוננס?",options:[{label:"בצעד קטן (שנייה) אל עיצור סמוך",correct:!0},{label:"בקפיצה רחבה כלפי מעלה",correct:!1},{label:"הוא נשאר תלוי בלי פתרון",correct:!1}],explanation:"פתרון אופייני הוא תנועה בשנייה אל צליל עיצור — כמו סי→דו או פה→מי."}],relatedLessonIds:["th-4-1"]},{id:"th-3-3",unitId:"th-unit-3",order:3,title:"מתח והרגעה כתנועה",subtitle:"הנשימה של המוזיקה",estimatedMinutes:3,knowledgeIds:[],sections:[{kind:"concept",icon:"🌊",body:"מוזיקה טונאלית נעה כל הזמן בין מתח (דיסוננס, דומיננטה) להרגעה (עיצור, טוניקה) — כמו נשימה: פנימה והחוצה."},{kind:"tip",icon:"💡",body:'כשאתם מאזינים, שאלו: "האם כאן מתח או הרגעה?" — זה מפתח להבנת המבנה הרגשי של יצירה.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לשאוף למוזיקה "עיצורית" בלבד. בלי מתח היצירה שטוחה — המתח הוא שנותן משמעות להרגעה.'}],practiceActivityIds:[],quiz:[{prompt:"מהו התיאור הטוב ביותר לתנועה הטונאלית?",options:[{label:"מעבר מתמיד בין מתח להרגעה",correct:!0},{label:"הישארות קבועה בהרגעה",correct:!1},{label:"עלייה מתמדת בגובה",correct:!1}],explanation:'המוזיקה "נושמת" בין מתח (דיסוננס/דומיננטה) להרגעה (עיצור/טוניקה) — זה מנוע הצורה.'}],relatedLessonIds:["th-4-1"]},{id:"th-4-1",unitId:"th-unit-4",order:1,title:"שלוש משפחות הפונקציה",subtitle:"טוניקה, סובדומיננטה, דומיננטה",estimatedMinutes:5,kn
4080owledgeIds:[],sections:[{kind:"concept",icon:"👪",body:'כל אקורד בסולם שייך לאחת משלוש "משפחות" תפקוד: טוניקה (הרגעה), סובדומיננטה (יציאה מהבית), דומיננטה (מתח).'},{kind:"concept",heading:"מי במשפחה?",body:"טוניקה: I (וגם vi). סובדומיננטה: IV (וגם ii). דומיננטה: V (וגם vii°). אקורדים באותה משפחה חולקים תפקיד דומה."},{kind:"tip",icon:"💡",body:"לחשוב במשפחות (T/S/D) פשוט יותר מלזכור שבעה אקורדים נפרדים — ומסביר מדוע החלפות מסוימות נשמעות טבעיות."}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"לאיזו משפחת תפקוד שייך אקורד הדרגה IV?",options:[{label:"סובדומיננטה",correct:!0},{label:"דומיננטה",correct:!1},{label:"טוניקה",correct:!1}],explanation:"IV (וגם ii) הם משפחת הסובדומיננטה — מרחיקים מהטוניקה ומכינים את הדומיננטה."}],relatedLessonIds:["th-4-2"]},{id:"th-4-2",unitId:"th-unit-4",order:2,title:"התנועה האופיינית",subtitle:"הבית → יציאה → מתח → הבית",estimatedMinutes:5,knowledgeIds:[],sections:[{kind:"concept",icon:"🧭",body:'הסדר האופייני של הפונקציות: טוניקה → סובדומיננטה → דומיננטה → טוניקה (T–S–D–T). זהו "מסע" קטן מהבית ובחזרה.'},{kind:"notation",heading:"I → IV → V → I בדו",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"q"},{keys:["f/4","a/4","c/5"],duration:"q"},{keys:["g/4","b/4","d/5"],duration:"q"},{keys:["c/4","e/4","g/4"],duration:"q"}]},body:"דו → פה → סול → דו: טוניקה, סובדומיננטה, דומיננטה, ובחזרה לטוניקה. הבסיס של אינספור שירים."},{kind:"tip",icon:"💡",body:'הדומיננטה כמעט תמיד באה אחרי הסובדומיננטה (לא לפניה) — כי היא ה"שיא" של המתח לפני החזרה הביתה.'}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"מהו הסדר האופייני של הפונקציות ההרמוניות?",options:[{label:"טוניקה → סובדומיננטה → דומיננטה → טוניקה",correct:!0},{label:"דומיננטה → סובדומיננטה → טוניקה",correct:!1},{label:"טוניקה → דומיננטה → סובדומיננטה",correct:!1}],explanation:"T–S–D–T: יוצאים מהבית (S), בונים מתח (D), וחוזרים (T). זהו מנוע התנועה ההרמונית."}],relatedLessonIds:["th-4-3"]},{id:"th-4-3",unitId:"th-unit-4",order:3,title:"הדומיננטה נפתרת לטוניקה",subtitle:"המשיכה החזקה ביותר",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🎣",body:'התנועה V → I היא המשיכה ההרמונית החזקה ביותר: הדומיננטה מכילה את הצליל המוביל, שנפתר לטוניקה, ותחושת ה"הגענו הביתה" מלאה.'},{kind:"notation",heading:"V → I בדו: סול → דו",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"h"},{keys:["c/4","e/4","g/4"],duration:"h"}]},body:"אקורד סול (V) נפתר לאקורד דו (I). הסי שבתוכו עולה לדו — פתרון הצליל המוביל."},{kind:"tip",icon:"💡",body:'רוב היצירות הטונאליות מסתיימות ב-V→I. זהו ה"נקודה" ההרמונית בסוף המשפט.'}],practiceActivityIds:["act-func-fn"],quiz:[{prompt:"מדוע V→I היא המשיכה ההרמונית החזקה ביותר?",options:[{label:"הדומיננטה מכילה את הצליל המוביל שנפתר לטוניקה",correct:!0},{label:"הדומיננטה היא האקורד הגבוה ביותר",correct:!1},{label:"הטוניקה נמצאת רחוק מהדומיננטה",correct:!1}],explanation:"הצליל המוביל (סי) שבתוך הדומיננטה נמשך חצי-טון לטוניקה (דו), ויוצר את הפתרון החזק ביותר."}],relatedLessonIds:["th-5-1"]},{id:"th-5-1",unitId:"th-unit-5",order:1,title:"קדנצה אותנטית",subtitle:"הסיום החזק: V → I",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🛬",body:'קדנצה היא "סימן פיסוק" הרמוני בסוף משפט. הקדנצה האותנטית (V → I) היא הסיום החזק והסגור ביותר — כמו נקודה.'},{kind:"notation",heading:"קדנצה אותנטית בדו",notation:{clef:"treble",notes:[{keys:["g/4","b/4","d/5"],duration:"h"},{keys:["c/4","e/4","g/4"],duration:"h"}]},body:'סול (V) → דו (I): מתח מלא ואז הרגעה מלאה. תחושת "סוף".'},{kind:"tip",icon:"💡",body:"כשה-V וה-I שניהם ביסוד (הצליל השורשי בבס) והמנגינה נחה על הטוניקה — זו קדנצה אותנטית מושלמת, הסגורה ביותר."}],practiceActivityIds:["act-cadence-1"],quiz:[{prompt:"קדנצה אותנטית בנויה מהמעבר…",options:[{label:"V → I (דומיננטה לטוניקה)",correct:!0},{label:"IV → I (סובדומיננטה לטוניקה)",correct:!1},{label:"I → V (טוניקה לדומיננטה)",correct:!1}],explanation:"הקדנצה האותנטית היא V→I — הסיום החזק והסגור. IV→I היא פלגלית; I→V (סיום על V) היא חצי-קדנצה."}],relatedLessonIds:["th-5-2"]},{id:"th-5-2",unitId:"th-unit-5",order:2,title:"קדנצה פלגלית",subtitle:"הסיום הרך: IV → I",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"🕊️",body:'הקדנצה הפלגלית (IV → I) היא סיום רך יותר מהאותנטית — פחות מתח, יותר "רוגע". מוכרת כ"קדנצת אמן" מהמסורת הכנסייתית.'},{kind:"notation",heading:"קדנצה פלגלית בדו",notation:{clef:"treble",notes:[{keys:["f/4","a/4","c/5"],duration:"h"},{keys:["c/4","e/4","g/4"],duration:"h"}]},body:"פה (IV) → דו (I): אין צליל מוביל, ולכן ההרגעה עדינה ולא דרמטית."},{kind:"tip",icon:"💡",body:'הפלגלית חסרה את הצליל המוביל (סי) של הדומיננטה — לכן היא "מרוככת". רבים משתמשים בה כסיום נוסף אחרי האותנטית.'}],practiceActivityIds:["act-cadence-1"],quiz:[{prompt:"במה שונה הקדנצה הפלגלית (IV→I) מהאותנטית (V→I)?",options:[{label:"היא רכה יותר — אין בה את הצליל המוביל של הדומיננטה",correct:!0},{label:"היא חזקה ומתוחה יותר",correct:!1},{label:"היא מסתיימת על הדומיננטה",correct:!1}],explanation:"ל-IV אין צליל מוביל (סי), ולכן ההרגעה עדינה. האותנטית (V→I) חזקה יותר בזכות פתרון הצליל המוביל."}],relatedLessonIds:["th-5-3"]},{id:"th-5-3",unitId:"th-unit-5",order:3,title:"חצי-קדנצה",subtitle:"הסיום הפתוח: עצירה על V",estimatedMinutes:4,knowledgeIds:[],sections:[{kind:"concept",icon:"❓",body:'חצי-קדנצה מסתיימת על הדומיננטה (V) — לא על הטוניקה. היא נשמעת "פתוחה", לא גמורה, כמו פסיק שמצפה להמשך.'},{kind:"notation",heading:"חצי-קדנצה בדו: I → V",notation:{clef:"treble",notes:[{keys:["c/4","e/4","g/4"],duration:"h"},{keys:["g/4","b/4","d/5"],duration:"h"}]},body:'דו (I) → סול (V): הסיום על אקורד המתח (V) משאיר את האוזן "תלויה" ומצפה להמשך.'},{kind:"tip",icon:"💡",body:'חצי-קדנצה נפוצה באמצע יצירה (סוף חלק ראשון) — היא "מבטיחה" שיבוא המשך שיפתור את המתח.'},{kind:"mistake",icon:"⚠️",heading:"טעות נפוצה",body:'לחשוב שסיום על V הוא "טעות". להפך — זו בחירה מכוונת ליצירת ציפייה והמשכיות.'}],practiceActivityIds:["act-cadence-1"],quiz:[{prompt:"על איזה אקורד מסתיימת חצי-קדנצה?",options:[{label:"על הדומיננטה (V)",correct:!0},{label:"על הטוניקה (I)",correct:!1},{label:"על הסובדומיננטה (IV)",correct:!1}],explanation:"חצי-קדנצה נחה על V ולכן נשמעת פתוחה ולא גמורה — היא מצפה להמשך שיפתור לטוניקה."},{prompt:'איזו קדנצה נותנת את תחושת ה"סוף" הסגורה ביותר?',options:[{label:"אותנטית (V→I)",correct:!0},{label:"חצי-קדנצה (→V)",correct:!1},{label:"פלגלית (IV→I)",correct:!1}],explanation:"האותנטית V→I היא הסגורה ביותר בזכות פתרון הצליל המוביל; הפלגלית רכה יותר, וחצי-קדנצה נשארת פתוחה."}],relatedLessonIds:[]}],q7=[y$,v$,k$,u$,p$],z7=[...b$,...I$,...w$,...h$,...f$],F7=[...x$,..._$,...j$,...m$,...g$];function T$(){return q7}function E$(n){return q7.find(e=>e.id===n)??null}function $7(n){return z7.filter(e=>e.courseId===n).sort((e,t)=>
4080e.order-t.order)}function N$(n){return z7.find(e=>e.id===n)??null}function B7(n){return F7.filter(e=>e.unitId===n).sort((e,t)=>e.order-t.order)}function U7(n){return F7.find(e=>e.id===n)??null}function G7(n){return $7(n).flatMap(e=>B7(e.id))}function S$(n,e){const t=G7(n),r=t.findIndex(s=>s.id===e);return r>=0&&r<t.length-1?t[r+1].id:null}const Td=n=>({lessonId:n,learned:!1,practiced:!1,masteredScore:null}),Fu=ul()($u((n,e)=>({progress:{},get:t=>e().progress[t]??Td(t),markLearned:t=>n(r=>({progress:{...r.progress,[t]:{...r.progress[t]??Td(t),learned:!0}}})),markPracticed:t=>n(r=>({progress:{...r.progress,[t]:{...r.progress[t]??Td(t),practiced:!0}}})),recordQuiz:(t,r)=>n(s=>{const i=s.progress[t]??Td(t),a=i.masteredScore===null?r:Math.max(i.masteredScore,r);return{progress:{...s.progress,[t]:{...i,learned:!0,masteredScore:a}}}})}),{name:"shirat-learning"}));function l1(n){return n.masteredScore!==null&&n.masteredScore>=.6}function A$(){const n=It(),e=Fu(r=>r.progress),t=T$();return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.learn.navTitle,subtitle:u.learn.homeSubtitle}),o.jsx("div",{className:"space-y-4",children:t.map(r=>{const s=G7(r.id),i=s.filter(c=>l1(e[c.id]??{lessonId:c.id,masteredScore:null})).length,a=s.length?Math.round(i/s.length*100):0;return o.jsx(W,{className:"p-0 hover:shadow-hover",children:o.jsxs("button",{onClick:()=>void n({to:"/student/learn/course/$courseId",params:{courseId:r.id}}),className:"flex w-full items-center gap-4 p-5 text-start",children:[o.jsx("span",{className:"flex size-14 shrink-0 items-center justify-center rounded-2xl text-white",style:{background:"var(--gradient-brand)"},children:o.jsx(as,{size:26,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"truncate text-lg font-bold",children:r.title}),o.jsx("p",{className:"truncate text-xs text-text-muted",children:r.subtitle}),o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-sunken",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${a}%`}})}),o.jsx("span",{className:"shrink-0 text-xs font-semibold text-text-muted",children:X(u.learn.lessonsProgress,{done:i,total:s.length})})]})]}),o.jsx(ui,{size:20,"aria-hidden":!0,className:"shrink-0 text-text-muted"})]})},r.id)})})]})}function C$(){const n=It(),{courseId:e}=ri({strict:!1}),t=E$(e??"course-notation"),r=Fu(i=>i.progress);if(!t)return null;const s=$7(t.id);return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsxs("button",{onClick:()=>void n({to:"/student/learn"}),className:"mb-4 flex items-center gap-1 text-sm text-text-muted hover:text-primary",children:[o.jsx(og,{size:15,"aria-hidden":!0}),u.learn.backToCourses]}),o.jsx(tt,{title:t.title,subtitle:t.subtitle}),o.jsx("p",{className:"mb-6 text-sm text-text-secondary",children:t.description}),o.jsx("div",{className:"space-y-4",children:s.map(i=>{const a=B7(i.id),c=a.filter(d=>l1(r[d.id]??{lessonId:d.id,masteredScore:null})).length,l=a.length===0;return o.jsxs(W,{className:l?"opacity-70":"",children:[o.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-surface-sunken text-2xl",children:i.icon}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs font-bold text-text-muted",children:X(u.learn.unitN,{n:i.order})}),l?o.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-0.5 text-xs font-medium text-text-muted",children:[o.jsx(m7,{size:11,"aria-hidden":!0})," ",u.learn.comingSoon]}):o.jsxs("span",{className:"rounded-full bg-primary-soft px-2 py-0.5 text-xs font-medium text-primary",children:[c,"/",a.length]})]}),o.jsx("h2",{className:"truncate font-bold",children:i.title}),o.jsx("p",{className:"truncate text-xs text-text-muted",children:i.summary})]})]}),a.length>0?o.jsx("ul",{className:"space-y-1.5",children:a.map(d=>{const m=r[d.id],p=m?l1(m):!1;return o.jsx("li",{children:o.jsxs("button",{onClick:()=>void n({to:"/student/learn/lesson/$lessonId",params:{lessonId:d.id}}),className:"flex w-full items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-start transition-colors hover:border-primary",children:[p?o.jsx(Xn,{size:18,className:"shrink-0 text-success","aria-hidden":!0}):o.jsx(fq,{size:18,className:"shrink-0 text-text-muted","aria-hidden":!0}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-semibold",children:d.title}),d.subtitle?o.jsx("span",{className:"block truncate text-xs text-text-muted",children:d.subtitle}):null]}),o.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-text-muted",children:[o.jsx(o7,{size:12,"aria-hidden":!0}),X(u.learn.minutesShort,{n:d.estimatedMinutes})]})]})},d.id)})}):null]},i.id)})})]})}function bg({notes:n,label:e,className:t=""}){const[r,s]=E.useState(!1),i=n.map(c=>(c.keys??[]).map(I5)).filter(c=>c.length>0);if(i.length===0)return null;const a=async()=>
4080{if(!r){s(!0);try{const c=et();i.some(l=>l.length>1)?await c.playChordSequence(i):await c.playSequence(i.flat())}finally{s(!1)}}};return o.jsxs("button",{type:"button",onClick:()=>void a(),disabled:r,className:`inline-flex items-center gap-1.5 rounded-full bg-accent/20 px-3 py-1 text-xs font-semibold text-primary ring-1 ring-accent/40 transition-colors hover:bg-accent/30 disabled:opacity-60 ${t}`,children:[o.jsx(pr,{size:14,"aria-hidden":!0,className:r?"animate-pulse":""}),e??u.learn.playNotation]})}function M$({s:n}){var e,t,r,s,i;if(n.kind==="notation")return o.jsxs("div",{className:"rounded-xl border border-border bg-white p-3 dark:bg-surface-sunken",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[n.heading?o.jsx("p",{className:"text-sm font-semibold",children:n.heading}):o.jsx("span",{}),o.jsx(bg,{notes:((e=n.notation)==null?void 0:e.notes)??[]})]}),o.jsx(yn,{notes:((t=n.notation)==null?void 0:t.notes)??[],clef:((r=n.notation)==null?void 0:r.clef)??"treble",keySignature:(s=n.notation)==null?void 0:s.keySignature,timeSignature:(i=n.notation)==null?void 0:i.timeSignature,width:360,height:120}),n.body?o.jsx("p",{className:"mt-1 text-center text-sm text-text-secondary",children:n.body}):null]});if(n.kind==="tip"||n.kind==="mistake"){const a=n.kind==="tip";return o.jsxs("div",{className:`flex gap-3 rounded-xl border p-3.5 ${a?"border-success/30 bg-success/10":"border-amber-500/30 bg-amber-500/10"}`,children:[o.jsx("span",{className:a?"text-success":"text-amber-600",children:a?o.jsx(Lu,{size:18,"aria-hidden":!0}):o.jsx(v7,{size:18,"aria-hidden":!0})}),o.jsxs("div",{children:[o.jsx("p",{className:`text-xs font-bold ${a?"text-success":"text-amber-600"}`,children:n.heading??(a?u.learn.tipLabel:u.learn.mistakeLabel)}),o.jsx("p",{className:"mt-0.5 text-sm",children:n.body})]})]})}return o.jsxs("div",{children:[n.heading?o.jsxs("h3",{className:"mb-1 flex items-center gap-2 font-semibold",children:[n.icon?o.jsx("span",{children:n.icon}):null,n.heading]}):null,o.jsx("p",{className:"text-[15px] leading-relaxed text-text-secondary",children:n.body})]})}function P$({questions:n,onDone:e}){const[t,r]=E.useState({}),i=Object.keys(t).length===n.length,a=n.reduce((c,l,d)=>{var m;return c+((m=l.options[t[d]??-1])!=null&&m.correct?1:0)},0);return o.jsxs("div",{className:"space-y-5",children:[n.map((c,l)=>{const d=t[l],m=d!==void 0;return o.jsxs(W,{className:"space-y-3",children:[o.jsxs("p",{className:"font-semibold",children:[l+1,". ",c.prompt]}),c.notation?o.jsxs("div",{className:"rounded-md bg-white p-2 dark:bg-surface-sunken",children:[o.jsx("div",{className:"mb-1 flex justify-end",children:o.jsx(bg,{notes:c.notation.notes})}),o.jsx(yn,{notes:c.notation.notes,clef:c.notation.clef??"treble",keySignature:c.notation.keySignature,width:280,height:110})]}):null,o.jsx("div",{className:"grid gap-2",children:c.options.map((p,f)=>{const g=d===f,x=m&&p.correct,b=m&&g&&!p.correct;return o.jsxs("button",{onClick:()=>!m&&r(I=>({...I,[l]:f})),disabled:m,className:`flex items-center justify-between rounded-lg border-2 px-3.5 py-2.5 text-start text-sm font-medium transition-colors disabled:cursor-default ${x?"border-success bg-success/10 text-success":b?"border-danger bg-danger/10 text-danger":"border-border bg-surface hover:enabled:border-primary"}`,children:[p.label,x?o.jsx(Us,{size:16,"aria-hidden":!0}):null]},f)})}),m?o.jsxs("div",{className:"rounded-md bg-primary-soft px-3 py-2 text-sm text-primary",children:[o.jsxs("span",{className:"font-bold",children:[u.learn.explainTitle,": "]}),c.explanation]}):null]},l)}),i?o.jsxs(W,{className:"flex flex-col items-center gap-2 py-5 text-center",children:[o.jsx("p",{className:"font-semibold",children:X(u.learn.quizResult,{n:a,total:n.length})}),o.jsx("p",{className:a/n.length>=.6?"text-success":"text-text-muted",children:a/n.length>=.6?u.learn.passed:u.learn.notPassed}),o.jsx(ee,{onClick:()=>e(a/n.length),children:u.learn.submitQuiz})]}):null]})}function R$(){const{lessonId:n}=ri({strict:!1}),e=It(),t=U7(n),r=t?N$(t.unitId):null,s=()=>r?void e({to:"/student/learn/course/$courseId",params:{courseId:r.courseId}}):void e({to:"/student/learn"}),i=Fu(I=>I.recordQuiz),a=Fu(I=>I.markPracticed),[c,l]=E.useState("learn"),[d,m]=E.useState(null),p=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),f=E.useMemo(()=>
4080{if(!t)return null;const I=new Map((p.data??[]).map(N=>[N.id,N]));return t.practiceActivityIds.map(N=>I.get(N)).find(Boolean)??null},[t,p.data]);if(!t)return o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.common.loading});const g=S$((r==null?void 0:r.courseId)??"course-notation",t.id),x=[{key:"learn",label:u.learn.phaseLearn,icon:dr},{key:"practice",label:u.learn.phasePractice,icon:d7},{key:"master",label:u.learn.phaseMaster,icon:as}],b=x.findIndex(I=>I.key===c);return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsxs("button",{onClick:s,className:"mb-3 flex items-center gap-1 text-sm text-text-muted hover:text-primary",children:[o.jsx(og,{size:15,"aria-hidden":!0}),u.learn.backToCourse]}),o.jsxs("p",{className:"text-xs font-medium text-text-muted",children:[r==null?void 0:r.icon," ",r==null?void 0:r.title]}),o.jsx("h1",{className:"text-xl font-bold",children:t.title}),t.subtitle?o.jsx("p",{className:"mb-4 text-sm text-text-secondary",children:t.subtitle}):null,o.jsx("div",{className:"mb-5 flex items-center gap-2",children:x.map((I,N)=>{const V=I.icon,D=N===b,T=N<b;return o.jsxs("button",{type:"button",onClick:()=>l(I.key),"aria-current":D?"step":void 0,className:`flex flex-1 items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-semibold transition-colors ${D?"bg-primary text-on-primary":T?"bg-success/15 text-success hover:bg-success/25":"bg-surface-sunken text-text-muted hover:bg-surface-sunken/60 hover:text-text-secondary"}`,children:[T?o.jsx(Xn,{size:16,"aria-hidden":!0}):o.jsx(V,{size:16,"aria-hidden":!0}),o.jsx("span",{className:"truncate",children:I.label})]},I.key)})}),c==="learn"?o.jsxs("div",{className:"space-y-4",children:[t.sections.map((I,N)=>o.jsx(M$,{s:I},N)),t.knowledgeIds.length>0?o.jsxs("p",{className:"text-xs text-text-muted",children:[u.learn.knowledgeTitle,": ",t.knowledgeIds.map(I=>qe(I)).join(" · ")]}):null,o.jsx(ee,{className:"w-full justify-center",onClick:()=>l(f?"practice":"master"),children:f?u.learn.toPractice:u.learn.toMaster})]}):null,c==="practice"?o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-text-secondary",children:f?u.learn.practiceIntro:u.learn.noPractice}),f?o.jsx(R7,{activity:f}):null,o.jsx(ee,{className:"w-full justify-center",onClick:()=>{a(t.id),l("master")},children:u.learn.toMaster})]}):null,c==="master"?d===null?o.jsx(P$,{questions:t.quiz,onDone:I=>{i(t.id,I),m(I)}}):o.jsxs(W,{className:"flex flex-col items-center gap-3 py-8 text-center",children:[o.jsx("p",{className:"text-lg font-bold",children:d>=.6?u.learn.passed:u.learn.notPassed}),o.jsxs("div",{className:"flex gap-2",children:[d>=.6&&g?o.jsx(ee,{onClick:()=>void e({to:"/student/learn/lesson/$lessonId",params:{lessonId:g}}),children:u.learn.nextLesson}):null,o.jsx(ee,{variant:"soft",onClick:()=>{m(null),l("learn")},children:d>=.6?u.learn.reviewLesson:u.learn.retry}),o.jsx(ee,{variant:"ghost",onClick:s,children:u.learn.backToCourse})]})]}):null]})}const O$={"יסודות המוסיקה":dr,הרמוניה:bo,קצב:l7,ביצוע:Mq,יצירה:ug,עיבוד:lg,אלתור:y7,הפקה:qq,"תולדות המוסיקה":Jb,סגנונות:Jb};function D$(n){return O$[n]??as}function V$(){const n=It(),e=l$();return o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsx(tt,{title:u.curriculum.homeTitle,subtitle:u.curriculum.homeSubtitle}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(t=>{const r=D$(t),s=L7(t).length;return o.jsx(W,{className:"p-0 hover:shadow-hover",children:o.jsxs("button",{onClick:()=>void n({to:"/student/curriculum/domain/$domain",params:{domain:t}}),className:"flex w-full items-center gap-4 p-5 text-start",children:[o.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-2xl text-white",style:{background:"var(--gradient-brand)"},children:o.jsx(r,{size:24,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"truncate text-lg font-bold",children:t}),o.jsx("p",{className:"text-xs text-text-muted",children:X(u.curriculum.coursesCount,{n:s})})]}
4080),o.jsx(ui,{size:20,"aria-hidden":!0,className:"shrink-0 text-text-muted"})]})},t)})})]})}function xg({items:n}){return o.jsx("nav",{"aria-label":"breadcrumb",className:"mb-3 flex flex-wrap items-center gap-1 text-sm text-text-muted",children:n.map((e,t)=>{const r=t===n.length-1;return o.jsxs("span",{className:"flex items-center gap-1",children:[e.to&&!r?o.jsx(un,{to:e.to,params:e.params,className:"hover:text-primary",children:e.label}):o.jsx("span",{className:r?"font-semibold text-text-secondary":void 0,children:e.label}),r?null:o.jsx(ui,{size:14,"aria-hidden":!0,className:"shrink-0 text-text-muted/60"})]},t)})})}function L$(n){return n.years.includes("א")?"beginners":n.years.some(e=>e==="ב"||e==="ג")?"advanced":"other"}const q$=["beginners","advanced","other"],z$={beginners:u.curriculum.beginnersGroup,advanced:u.curriculum.advancedGroup,other:u.curriculum.otherGroup};function F$(){const{domain:n}=ri({strict:!1}),e=It(),t=L7(n),r=q$.map(s=>({group:s,courses:t.filter(i=>L$(i)===s)})).filter(s=>s.courses.length>0);return o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsx(xg,{items:[{label:u.curriculum.home,to:"/student/curriculum"},{label:n}]}),o.jsx("h1",{className:"mb-5 text-2xl font-bold",children:n}),t.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.curriculum.emptyCourses}):o.jsx("div",{className:"space-y-8",children:r.map(({group:s,courses:i})=>o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:z$[s]}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:i.map(a=>o.jsx(W,{className:"p-0 hover:shadow-hover",children:o.jsxs("button",{onClick:()=>void e({to:"/student/curriculum/course/$courseId",params:{courseId:a.id}}),className:"flex w-full items-start gap-3 p-4 text-start",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold",children:a.name}),o.jsx("p",{className:"mt-0.5 text-xs text-text-muted",children:X(u.curriculum.topicsCount,{n:a.topics.length})}),o.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.tracks.map(c=>o.jsx("span",{className:"rounded-full bg-surface-sunken px-2.5 py-0.5 text-[11px] font-medium text-text-secondary",children:c},c)),a.years.map(c=>o.jsxs("span",{className:"rounded-full bg-surface-sunken px-2.5 py-0.5 text-[11px] font-medium text-text-secondary",children:[u.curriculum.year," ",c]},c))]})]}),o.jsx(ui,{size:18,"aria-hidden":!0,className:"mt-1 shrink-0 text-text-muted"})]})},a.id))})]},s))})]})}function K7(n){switch(n){case"beginner":return u.curriculum.levelBeginner;case"intermediate":return u.curriculum.levelIntermediate;case"advanced":return u.curriculum.levelAdvanced;case"mastery":return u.curriculum.levelMastery}}function H7(n){switch(n){case"beginner":return"bg-success/15 text-success";case"intermediate":return"bg-primary-soft text-primary";case"advanced":return"bg-amber-500/15 text-amber-600";case"mastery":return"bg-danger/15 text-danger"}}function $$(){const{courseId:n}=ri({strict:!1}),e=It(),t=D7(n),r=new Set,s=yg(n).filter(({concept:i})=>r.has(i.id)?!1:(r.add(i.id),!0));return t?o.jsxs("div",{className:"mx-auto max-w-3xl",children:[o.jsx(xg,{items:[{label:u.curriculum.home,to:"/student/curriculum"},{label:t.domain,to:"/student/curriculum/domain/$domain",params:{domain:t.domain}},{label:t.name}]}),o.jsx("h1",{className:"mb-1 text-2xl font-bold",children:t.name}),t.goals&&t.goals.length>0?o.jsxs(W,{className:"mb-5 mt-3 bg-primary-soft/40",children:[o.jsxs("p",{className:"mb-2 flex items-center gap-2 text-sm font-semibold text-primary",children:[o.jsx(Bh,{size:16,"aria-hidden":!0}),u.curriculum.goalsTitle]}),o.jsx("ul",{className:"space-y-1.5",children:t.goals.map((i,a)=>o.jsxs("li",{className:"flex gap-2 text-sm text-text-secondary",children:[o.jsx("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-primary/60","aria-hidden":!0}),i]},a))})]}):null,o.jsx("p",{className:"mb-5 text-sm text-text-muted",children:u.curriculum.topicsTitle}),s.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.curriculum.emptyTopics}):o.jsx("ol",{className:"space-y-3",children:s.map(({concept:i,level:a},c)=>o.jsx("li",{children:o.jsx(W,{className:"p-0 hover:shadow-hover",children:o.jsxs("button",{onClick:()=>void e({to:"/student/curriculum/course/$courseId/topic/$conceptId",params:{courseId:t.id,conceptId:i.id}}),className:"flex w-full items-center gap-4 p-4 text-start",children:[o.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-sunken text-sm font-bold text-text-muted",children:c+1}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"truncate font-semibold",children:i.name}),o.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[o.jsx("span",{className:`rounded-full px-2.5 py-0.5 text-[11px] font-semibold ${H7(a)}`,children:K7(a)}),o.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px] font-medium ${i.covered?"bg-success/12 text-success":"bg-surface-sunken text-text-muted"}`,children:[i.covered?o.jsx(Xn,{size:12,"aria-hidden":!0}):o.jsx(o7,{size:12,"aria-hidden":!0}),i.covered?u.curriculum.covered:u.curriculum.inPrep]})]})]}
4080),o.jsx(ui,{size:18,"aria-hidden":!0,className:"shrink-0 text-text-muted"})]})})},i.id))})]}):o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.common.loading})}function bx({s:n}){var e,t,r,s,i;if(n.kind==="notation")return o.jsxs("div",{className:"rounded-xl border border-border bg-white p-3 dark:bg-surface-sunken",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[n.heading?o.jsx("p",{className:"text-sm font-semibold",children:n.heading}):o.jsx("span",{}),o.jsx(bg,{notes:((e=n.notation)==null?void 0:e.notes)??[]})]}),o.jsx(yn,{notes:((t=n.notation)==null?void 0:t.notes)??[],clef:((r=n.notation)==null?void 0:r.clef)??"treble",keySignature:(s=n.notation)==null?void 0:s.keySignature,timeSignature:(i=n.notation)==null?void 0:i.timeSignature,width:360,height:120}),n.body?o.jsx("p",{className:"mt-1 text-center text-sm text-text-secondary",children:n.body}):null]});if(n.kind==="tip"||n.kind==="mistake"){const a=n.kind==="tip";return o.jsxs("div",{className:`flex gap-3 rounded-xl border p-3.5 ${a?"border-success/30 bg-success/10":"border-amber-500/30 bg-amber-500/10"}`,children:[o.jsx("span",{className:a?"text-success":"text-amber-600",children:a?o.jsx(Lu,{size:18,"aria-hidden":!0}):o.jsx(v7,{size:18,"aria-hidden":!0})}),o.jsxs("div",{children:[o.jsx("p",{className:`text-xs font-bold ${a?"text-success":"text-amber-600"}`,children:n.heading??(a?u.learn.tipLabel:u.learn.mistakeLabel)}),o.jsx("p",{className:"mt-0.5 text-sm",children:n.body})]})]})}return o.jsxs("div",{children:[n.heading?o.jsxs("h3",{className:"mb-1 flex items-center gap-2 font-semibold",children:[n.icon?o.jsx("span",{children:n.icon}):null,n.heading]}):null,o.jsx("p",{className:"text-[15px] leading-relaxed text-text-secondary",children:n.body})]})}function B$({q:n}){const[e,t]=E.useState(null);return o.jsxs("div",{className:"rounded-xl border border-border bg-surface p-4",children:[o.jsx("p",{className:"mb-2 text-sm font-semibold",children:n.prompt}),n.notation?o.jsx("div",{className:"mb-2",children:o.jsx(yn,{notes:n.notation.notes,clef:n.notation.clef??"treble",keySignature:n.notation.keySignature,timeSignature:n.notation.timeSignature,width:360,height:120})}):null,o.jsx("div",{className:"space-y-1.5",children:n.options.map((r,s)=>{const i=e===s,a=e!==null,c=a&&r.correct?"border-success/50 bg-success/10":a&&i&&!r.correct?"border-amber-500/50 bg-amber-500/10":"border-border bg-surface-sunken";return o.jsx("button",{type:"button",onClick:()=>t(s),className:`w-full rounded-lg border px-3 py-2 text-right text-sm transition-colors ${c}`,children:r.label},s)})}),e!==null?o.jsx("p",{className:"mt-2 text-xs leading-relaxed text-text-secondary",children:n.explanation}):null]})}function U$(){var D;const{courseId:n,conceptId:e}=ri({strict:!1}),t=It(),r=Be(T=>T.session),s=Qe(T=>T.begin),i=D7(n),a=a$(e),c=((D=yg(n).find(T=>T.concept.id===e))==null?void 0:D.level)??"beginner",[l,d]=E.useState("learn"),m=a!=null&&a.guideRef?U7(a.guideRef):null,p=a?s$(a.id):null,f=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),g=E.useMemo(()=>{if(!a)return[];const T=new Map((f.data??[]).map(_=>[_.id,_])),M=new Set,R=[];for(const _ of a.generators){if(!_.reuseActivityId||M.has(_.reuseActivityId))continue;const j=T.get(_.reuseActivityId);j&&wn(j.typeId)&&(M.add(_.reuseActivityId),R.push(j))}return R},[a,f.data]);if(!i||!a)return o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.common.loading});const x=o$(n,e),b=c$(n,e),I=T=>void t({to:"/student/curriculum/course/$courseId/topic/$conceptId",params:{courseId:n,conceptId:T}}),N=()=>{!r||g.length===0||(s(r.user.id,{source:"course",activities:g,detail:{topic:a.name}}),t({to:"/student/practice/session"}))},V=[{key:"learn",label:u.curriculum.tabLearn,icon:dr},{key:"practice",label:u.curriculum.tabPractice,icon:d7}];return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(xg,{items:[{label:u.curriculum.home,to:"/student/curriculum"},{label:i.domain,to:"/student/curriculum/domain/$domain",params:{domain:i.domain}},{label:i.name,to:"/student/curriculum/course/$courseId",params:{courseId:n}},{label:a.name}]}),o.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[o.jsx("h1",{className:"text-2xl font-bold",children:a.name}),o.jsx("span",{className:`rounded-full px-2.5 py-0.5 text-[11px] font-semibold ${H7(c)}`,children:K7(c)})]}),o.jsx("div",{className:"mb-5 flex items-center gap-2",children:V.map(T=>{const M=T.icon,R=T.key===l;return o.jsxs("button",{type:"button",onClick:()=>d(T.key),"aria-current":R?"step":void 0,className:`flex flex-1 items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-semibold transition-colors ${R?"bg-primary text-on-primary":"bg-surface-sunken text-text-muted hover:bg-surface-sunken/60 hover:text-text-secondary"}`,children:[o.jsx(M,{size:16,"aria-hidden":!0}),o.jsx("span",{className:"truncate",children:T.label})]},T.key)})}),l==="learn"?a.covered&&m?o.jsx("div",{className:"space-y-4",children:m.sections.map((T,M)=>o.jsx(bx,{s:T},M))}):p?o.jsxs("div",{className:"space-y-4",children:[p.sections.map((T,M)=>o.jsx(bx,{s:T},M)),p.quiz.length>0?o.jsx("div",{className:"space-y-3 pt-2",children:p.quiz.map((T,M)=>o.jsx(B$,{q:T},M))}):null]}):o.jsxs(W,{className:"space-y-1 py-8 text-center",children:[o.jsx("p",{className:"font-semibold",children:u.curriculum.guideInPrep}),o.jsx("p",{className:"text-sm text-text-muted",children:u.curriculum.guideInPrepBody})]}):null,l==="practice"?g.length>0?o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-text-secondary",children:u.curriculum.practiceIntro}),o.jsx("ul",{className:"space-y-2",children:g.map(T=>o.jsx("li",{className:"rounded-lg border border-border bg-surface px-4 py-3 text-sm font-medium",children:T.title},T.id))}),o.jsxs(ee,{className:"w-full justify-center",onClick:N,children:[o.jsx(Xt,{size:15,"aria-hidden":!0,
4080className:"-scale-x-100"}),u.curriculum.startPractice]})]}):o.jsxs(W,{className:"space-y-1 py-8 text-center",children:[o.jsx("p",{className:"font-semibold",children:u.curriculum.practiceInPrep}),o.jsx("p",{className:"text-sm text-text-muted",children:u.curriculum.practiceInPrepBody})]}):null,o.jsxs("div",{className:"sticky bottom-4 mt-8 flex items-center justify-between gap-2 rounded-xl border border-border bg-surface/95 p-2 shadow-card backdrop-blur",children:[o.jsxs(ee,{variant:"soft",disabled:!b,onClick:()=>b&&I(b),children:[u.curriculum.prevTopic," →"]}),o.jsxs(ee,{variant:"soft",disabled:!x,onClick:()=>x&&I(x),children:["← ",u.curriculum.nextTopic]})]})]})}function G$(){return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.journey.title,subtitle:u.journey.subtitle}),o.jsx(A7,{})]})}const K$=[{icon:ug,title:u.teacherHome.actions.capture,description:u.teacherHome.actions.captureDesc,to:"/teacher/capture",primary:!0},{icon:Qi,title:u.teacherHome.actions.createPractice,description:u.teacherHome.actions.createPracticeDesc,to:"/teacher/assignment"},{icon:Lr,title:u.teacherHome.actions.reviewStudents,description:u.teacherHome.actions.reviewStudentsDesc,to:"/teacher/students"},{icon:zl,title:u.teacherHome.actions.uploadMaterial,description:u.teacherHome.actions.uploadMaterialDesc,to:"/teacher/content"},{icon:Ji,title:u.teacherHome.actions.viewProgress,description:u.teacherHome.actions.viewProgressDesc,to:"/teacher/homework"}];function H$(){const n=new Date().getHours();return n<12?u.studentDashboard.greetingMorning:n<18?u.studentDashboard.greetingAfternoon:u.studentDashboard.greetingEvening}function W$(){const n=Be(t=>t.session),e=fe({queryKey:["teacher-students"],queryFn:()=>Vl.listStudents()});return o.jsxs("div",{children:[o.jsxs("header",{className:"mb-6",children:[o.jsxs("h1",{className:"text-2xl font-bold tracking-tight",children:[H$(),", ",(n==null?void 0:n.user.displayName.split(" ")[0])??""," 👋"]}),o.jsx("p",{className:"mt-1 text-text-secondary",children:u.teacherHome.question})]}),o.jsx("div",{className:"mb-8 grid gap-3 sm:grid-cols-2",children:K$.map(t=>o.jsx(un,{to:t.to,className:t.primary?"sm:col-span-2":"",children:t.primary?o.jsxs("section",{className:"relative flex items-center gap-4 overflow-hidden rounded-xl p-6 text-white shadow-raised transition-all duration-150 hover:shadow-hover active:scale-[0.99]",style:{background:"var(--gradient-brand)"},children:[o.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-white/15",children:o.jsx(t.icon,{size:24,"aria-hidden":!0})}),o.jsxs("span",{children:[o.jsx("span",{className:"block text-lg font-bold",children:t.title}),o.jsx("span",{className:"mt-0.5 block text-sm text-white/85",children:t.description})]})]}):o.jsxs(W,{className:"flex h-full items-center gap-4 hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(t.icon,{size:20,"aria-hidden":!0})}),o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block font-semibold",children:t.title}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-secondary",children:t.description})]})]})},t.to))}),o.jsxs("section",{children:[o.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-semibold text-text-secondary",children:[o.jsx(a7,{size:15,"aria-hidden":!0}),u.teacherHome.studentsGlance]}),o.jsx(W,{className:"divide-y divide-border p-0",children:(e.data??[]).slice(0,5).map(t=>o.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",children:[o.jsx(hi,{name:t.profile.displayName,color:t.profile.avatarColor,size:34}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:t.profile.displayName}),o.jsx("span",{className:"block text-xs text-text-muted",children:t.profile.instruments.join(" · ")})]}),t.weeklyMinutes>0?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-secondary",children:[t.streakDays>
4080=5?o.jsx(zh,{size:14,"aria-hidden":!0,className:"text-accent"}):null,Zt(t.weeklyMinutes)," ",u.teacherHome.minutesThisWeek]}):o.jsx("span",{className:"rounded-full bg-danger/10 px-2.5 py-1 text-xs font-medium text-danger",children:u.teacherHome.noPracticeYet})]},t.profile.id))})]})]})}const Y$=["ear_training","rhythm","piano","theory","sight_reading","singing","performance"];function Q$(){const n=Be(g=>g.session),e=(n==null?void 0:n.user.id)??"",t=en(),[r,s]=E.useState(null),[i,a]=E.useState(!1),c=fe({queryKey:["goal",e],queryFn:()=>Ru.get(e),enabled:!!e}),l=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e});E.useEffect(()=>{c.data&&!r&&s(c.data)},[c.data,r]);const d=lt({mutationFn:g=>Ru.save(e,g),onSuccess:async()=>{await t.invalidateQueries({queryKey:["goal",e]}),a(!0),window.setTimeout(()=>a(!1),2500)}});if(!r)return o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading});const m=(l.data??[]).filter(g=>Date.now()-new Date(g.startedAt).getTime()<7*864e5).reduce((g,x)=>g+x.totalMinutes,0),p=m>=r.weeklyMinutesTarget,f=g=>s({...r,focusCategories:r.focusCategories.includes(g)?r.focusCategories.filter(x=>x!==g):[...r.focusCategories,g]});return o.jsxs("div",{children:[o.jsx(tt,{title:u.goals.title,subtitle:u.goals.subtitle}),i?o.jsxs("div",{role:"status",className:"mb-4 flex items-center gap-2 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),u.goals.savedToast]}):null,o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(W,{className:"space-y-5 self-start",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.goals.weeklyTarget}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("input",{type:"range",min:30,max:300,step:15,value:r.weeklyMinutesTarget,onChange:g=>s({...r,weeklyMinutesTarget:g.target.valueAsNumber}),className:"flex-1 accent-[var(--color-primary)]","aria-label":u.goals.weeklyTarget}),o.jsx("span",{className:"w-16 text-end text-lg font-bold text-primary",children:Zt(r.weeklyMinutesTarget)})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-secondary",children:u.goals.focusTitle}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.goals.focusHint}),o.jsx("div",{className:"flex flex-wrap gap-2",children:Y$.map(g=>{const x=r.focusCategories.includes(g);return o.jsx("button",{type:"button","aria-pressed":x,onClick:()=>f(g),className:`rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors ${x?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:u.practice.categories[g]},g)})})]}),o.jsxs(ee,{onClick:()=>d.mutate(r),disabled:d.isPending,children:[o.jsx(Bh,{size:15,"aria-hidden":!0}),u.goals.save]})]}),o.jsxs(W,{className:"self-start",children:[o.jsx("h2",{className:"mb-3 font-semibold",children:u.goals.weeklyProgress}),o.jsx(Gs,{value:m/r.weeklyMinutesTarget,label:u.goals.weeklyProgress}),o.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:p?u.goals.goalReached:X(u.goals.minutesOf,{n:Zt(m),target:Zt(r.weeklyMinutesTarget)})})]})]})]})}function Z$(){const n=Be(w=>w.session),e=It(),t=en(),[r,s]=E.useState(null),[i,a]=E.useState([]),[c,l]=E.useState(""),[d,m]=E.useState(null),[p,f]=E.useState("idle"),g=E.useRef(null),x=fe({queryKey:["academic"],queryFn:()=>pt.get()}),b=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),I=x.data,N=E.useMemo(()=>{if(!I||!n)return[];const w=cs(I,new Date);return Ju(I,n.user.id,w==null?void 0:w.id)},[I,n]),V=E.useMemo(()=>I1((b.data??[]).filter(w=>
4080wn(w.typeId))),[b.data]),D=E.useMemo(()=>k6(i,V),[i,V]),T=(b.data??[]).filter(w=>D.includes(w.id)),M=w=>a(A=>A.includes(w)?A.filter(O=>O!==w):[...A,w]),R=async()=>{var w;if(p==="recording"){(w=g.current)==null||w.stop();return}try{const A=await navigator.mediaDevices.getUserMedia({audio:!0}),O=new MediaRecorder(A),C=[];O.ondataavailable=S=>C.push(S.data),O.onstop=()=>{A.getTracks().forEach(re=>re.stop());const S=new Blob(C,{type:O.mimeType||"audio/webm"}),z=new FileReader;z.onload=async()=>{const re={id:crypto.randomUUID(),organizationId:(n==null?void 0:n.user.organizationId)??"org-shirat",kind:"audio",title:`הערה קולית — ${new Date().toLocaleDateString("he-IL")}`,fileName:"voice-note.webm",mimeType:S.type,sizeBytes:S.size,url:z.result,createdBy:(n==null?void 0:n.user.id)??"",createdAt:new Date().toISOString(),tags:["הערה קולית"]};await Gr.save(re),m(re.id),f("saved")},z.readAsDataURL(S)},O.start(),g.current=O,f("recording")}catch{f("failed")}},_=lt({mutationFn:()=>{const w=N.find(S=>S.id===r);if(!w||!I||!n)throw new Error("missing group");const O=[..._1(i,V),c.trim()].filter(S=>S.length>0),C=Vi(I,w.id);return Oo.save({id:crypto.randomUUID(),groupId:w.id,groupName:w.name,teacherId:n.user.id,date:new Date().toISOString(),note:O.join(" · "),topicIds:Mj(i),recommendedActivityIds:D,...d?{audioAssetId:d}:{}},C)},onSuccess:async()=>{await t.invalidateQueries({queryKey:["lessons"]}),await t.invalidateQueries({queryKey:["group-lessons"]}),await t.invalidateQueries({queryKey:["notifications"]}),e({to:"/teacher"})}}),j=!!r&&(i.length>0||c.trim().length>2)&&!_.isPending;return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.capture.title,subtitle:u.capture.subtitle}),o.jsxs(W,{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.capture.pickGroup}),!x.isPending&&N.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.capture.noGroups}):o.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(w=>{var A;return o.jsxs("button",{type:"button","aria-pressed":r===w.id,onClick:()=>s(w.id),className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors ${r===w.id?"border-primary bg-primary text-on-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:w.color},"aria-hidden":!0}),w.name,o.jsx("span",{className:"text-xs font-normal opacity-70",children:((A=I==null?void 0:I.tracks.find(O=>O.id===w.trackId))==null?void 0:A.name)??""})]},w.id)})})]}),o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-secondary",children:u.capture.pickTopics}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.capture.topicsHint}),o.jsx("div",{className:"flex flex-wrap gap-2",children:V.map(w=>{const A=i.includes(w.objectiveId);return o.jsxs("button",{type:"button","aria-pressed":A,onClick:()=>M(w.objectiveId),className:`flex items-center gap-2 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors ${A?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[w.title.he,o.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 text-[11px] text-text-muted",children:w.activityIds.length})]},w.objectiveId)})})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.capture.otherTopicLabel}),o.jsx("input",{type:"text",value:c,onChange:w=>l(w.target.value),placeholder:u.capture.otherTopicPlaceholder,"aria-label":u.capture.otherTopicLabel,className:"w-full rounded-md border border-border bg-surface px-4 py-2.5 text-sm placeholder:text-text-muted focus:border-primary"})]}),i.length>0?o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.capture.exerciseSet}),T.length===0?o.jsx("p",{className:"text-xs text-text-muted",children:u.capture.noExercises}):o.jsx("ul",{className:"flex flex-wrap gap-1.5",children:T.map(w=>o.jsx("li",{className:"rounded-full bg-surface-sunken px-3 py-1 text-xs text-text-secondary",children:w.title},w.id))})]}):null,o.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-border pt-4",children:[o.jsxs(ee,{onClick:()=>void _.mutate(),disabled:!j,children:[o.jsx($h,{size:15,"aria-hidden":!0}),u.capture.save]}),o.jsxs(ee,{variant:p==="recording"?"soft":"ghost",onClick:()=>void R(),children:[p==="recording"?o.jsx(b7,{size:15,"aria-hidden":!0}):o.jsx(ql,{size:15,"aria-hidden":!0}),p==="recording"?u.capture.recording:u.capture.record]}),p==="saved"?o.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium text-success",children:[o.jsx(Xn,{size:15,"aria-hidden":!0}),u.capture.recorded]}):p==="failed"?o.jsx("span",{className:"text-xs text-text-muted",children:u.capture.recordFailed}):null]})]}),o.jsxs(un,{to:"/teacher/assignment",className:"mt-4 flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:[u.capture.toAssignment,o.jsx(lq,{size:15,"aria-hidden":!0})]})]})}function J$(){const n=Be(a=>
4080a.session),e=fe({queryKey:["lessons",n==null?void 0:n.user.id],queryFn:()=>Oo.list(n==null?void 0:n.user.id),enabled:!!n}),t=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),r=fe({queryKey:["practice-tracks"],queryFn:()=>yo.list()}),s=(r.data??[]).filter(a=>a.authorId===(n==null?void 0:n.user.id)),i=a=>{var c;return((c=(t.data??[]).find(l=>l.id===a))==null?void 0:c.title)??a};return o.jsxs("div",{children:[o.jsx(tt,{title:u.capture.homeworkTitle}),s.length>0?o.jsxs("section",{className:"mb-6",children:[o.jsxs("h2",{className:"mb-2 flex items-center gap-2 text-sm font-semibold text-text-secondary",children:[o.jsx(Qi,{size:16,"aria-hidden":!0}),u.tracks.myTracksTitle]}),o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:s.map(a=>o.jsxs(W,{className:"space-y-1.5",children:[o.jsx("p",{className:"font-semibold",children:a.title}),o.jsxs("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-text-muted",children:[o.jsx("span",{children:X(u.tracks.trackCount,{n:a.exerciseIds.length})}),a.lessonNumber?o.jsxs("span",{children:["· ",X(u.tracks.meeting,{n:a.lessonNumber})]}):null,a.publishedToFreePractice?o.jsxs("span",{children:["· ",u.tracks.publishedBadge]}):null]}),a.groupIds.length>0?o.jsxs("p",{className:"flex items-center gap-1 text-xs text-text-muted",children:[o.jsx(Lr,{size:12,"aria-hidden":!0}),X(u.tracks.assignedToGroups,{n:a.groupIds.length})]}):null]},a.id))})]}):null,e.isPending||r.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):(e.data??[]).length===0&&s.length===0?o.jsxs(W,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[o.jsx("span",{className:"flex size-12 items-center justify-center rounded-full bg-primary-soft text-primary",children:o.jsx(uq,{size:22,"aria-hidden":!0})}),o.jsx("p",{className:"text-sm text-text-muted",children:u.capture.homeworkEmpty}),o.jsx(un,{to:"/teacher/capture",children:o.jsx(ee,{children:u.teacherHome.actions.capture})})]}):o.jsx("div",{className:"space-y-3",children:(e.data??[]).map(a=>o.jsxs(W,{className:"space-y-2.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsx("span",{className:"font-semibold",children:a.groupName}),o.jsxs("span",{className:"flex items-center gap-2 text-xs text-text-muted",children:[a.audioAssetId?o.jsx(ql,{size:13,"aria-hidden":!0}):null,mr(a.date)]})]}),o.jsx("p",{className:"text-sm text-text-secondary",children:a.note}),a.topicIds.length>0?o.jsxs("p",{className:"text-xs text-text-muted",children:[u.capture.topicsLabel,":"," ",a.topicIds.filter(c=>pn(c)).map(c=>qe(c)).join(" · ")]}):null,a.recommendedActivityIds.length>0?o.jsxs("p",{className:"text-xs text-text-muted",children:[u.capture.practiceLabel,":"," ",a.recommendedActivityIds.map(i).join(" · ")]}):null]},a.id))})]})}function W7({authorRole:n,groupIds:e,notifyUserIds:t=[],scopeSlot:r,buildScope:s,onSaved:i}){const a=Be($=>$.session),c=en(),l=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),d=E.useMemo(()=>I1((l.data??[]).filter($=>wn($.typeId))),[l.data]),m=E.useMemo(()=>new Map((l.data??[]).map($=>[$.id,$])),[l.data]),[p,f]=E.useState([]),[g,x]=E.useState(""),[b,I]=E.useState(!1),[N,V]=E.useState(!1),[D,T]=E.useState(new Set),[M,R]=E.useState(new Set),_=E.useMemo(()=>{const $=new Map;for(const oe of d)$.set(oe.category,[...$.get(oe.category)??[],oe]);return[...$.entries()]},[d]),j=E.useMemo(()=>d.filter($=>$.activityIds.some(oe=>p.includes(oe))).map($=>$.objectiveId),[d,p]),w=s==null?void 0:s().level;E.useEffect(()=>{b||x(NN(_1(j,d),w))},[j,d,w,b]);const A=($,oe)=>{const ie=new Set($);return ie.has(oe)?ie.delete(oe):ie.add(oe),ie},O=$=>f(oe=>oe.includes($)?oe.filter(ie=>ie!==$):[...oe,$]),C=$=>f(oe=>[...oe,...$.activityIds.filter(ie=>{var Ie;return!oe.includes(ie)&&wn(((Ie=m.get(ie))==null?void 0:Ie.typeId)??"")})]),S=($,oe)=>f(ie=>{const Ie=$+oe;if(Ie<0||Ie>=ie.length)return ie;const Ee=[...ie];return[Ee[$],Ee[Ie]]=[Ee[Ie],Ee[$]],Ee}),z=$=>f(oe=>oe.filter((ie,Ie)=>Ie!==$)),re=lt({mutationFn:async()=>{if(!a)throw new Error("no session");const $=new Date().toISOString(),oe=(s==null?void 0:s())??{level:void 0,publishedToFreePractice:!1,lessonNumber:void 0},ie={id:crypto.randomUUID(),kind:n==="teacher"?"course":"standalone",title:g.trim(),objectiveIds:j,exerciseIds:p,level:oe.level,lessonNumber:oe.lessonNumber,groupIds:e,publishedToFreePractice:oe.publishedToFreePractice,authorId:a.user.id,authorName:a.user.displayName,authorRole:n,createdAt:$,updatedAt:$};return yo.save(ie,t)},onSuccess:async $=>{await c.invalidateQueries({queryKey:["practice-tracks"]}),await c.invalidateQueries({queryKey:["notifications"]}),V(!0),f([]),x(""),I(!1),i==null||i($),window.setTimeout(()=>V(!1),3e3)}}),ne=e.length>0||((s==null?void 0:s().publishedToFreePractice)??!1),ve=g.trim().length>0&&p.length>0&&ne&&!re.isPending;return o.jsxs("div",{className:"space-y-5",children:[N?o.jsxs("div",{role:"status",className:"flex items-center gap-2 rounded-md bg-success/10 px-4 py-2.5 text-sm font-medium text-success",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),u.tracks.saved]}):null,o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-secondary",children:u.tracks.pickExercises}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.tracks.pickExercisesHint}),o.jsx("div",{className:"space-y-2",children:_.map(([$,oe])=>{const ie=D.has($),Ie=oe.reduce((Ee,Y)=>Ee+Y.activityIds.filter(xe=>p.includes(xe)).length,0);return o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[o.jsxs("button",{type:"button",onClick:()=>T(Ee=>A(Ee,$)),className:"flex w-full items-center justify-between gap-2 bg-surface-sunken px-3 py-2.5 text-start",children:[o.jsx("span",{className:"font-semibold",children:u.practice.categories[$]??$}),o.jsxs("span",{className:"flex items-center gap-2",children:[Ie>0?o.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-xs font-bold text-on-primary",children:Ie}
4080):null,o.jsx(Qb,{size:17,"aria-hidden":!0,className:`text-text-muted transition-transform ${ie?"rotate-180":""}`})]})]}),ie?o.jsx("div",{className:"divide-y divide-border",children:oe.map(Ee=>{const Y=M.has(Ee.objectiveId),xe=Ee.activityIds.filter(Ae=>p.includes(Ae)).length;return o.jsxs("div",{className:"px-2 py-1.5",children:[o.jsxs("button",{type:"button",onClick:()=>R(Ae=>A(Ae,Ee.objectiveId)),className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-start hover:bg-surface-sunken",children:[o.jsx("span",{className:"text-sm font-medium",children:Ee.title.he}),o.jsxs("span",{className:"flex items-center gap-2 text-xs text-text-muted",children:[xe,"/",Ee.activityIds.length,o.jsx(Qb,{size:15,"aria-hidden":!0,className:`transition-transform ${Y?"rotate-180":""}`})]})]}),Y?o.jsxs("div",{className:"ms-3 mt-1 space-y-1 border-s-2 border-border ps-3",children:[o.jsx("button",{type:"button",onClick:()=>C(Ee),className:"text-xs font-semibold text-primary hover:underline",children:u.tracks.selectAllExercises}),Ee.activityIds.map(Ae=>{const Ze=m.get(Ae);return Ze?o.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-1 text-sm hover:bg-surface-sunken",children:[o.jsx("input",{type:"checkbox",checked:p.includes(Ae),onChange:()=>O(Ae),className:"size-4 accent-[var(--color-primary)]"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:Ze.title})]},Ae):null})]}):null]},Ee.objectiveId)})}):null]},$)})})]}),o.jsxs("div",{children:[o.jsxs("p",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-text-secondary",children:[o.jsx(Eq,{size:15,"aria-hidden":!0}),u.tracks.exercisesTitle,p.length>0?o.jsxs("span",{className:"text-xs text-text-muted",children:["(",X(u.tracks.trackCount,{n:p.length}),")"]}):null]}),p.length===0?o.jsx("p",{className:"rounded-md border border-dashed border-border px-4 py-6 text-center text-xs text-text-muted",children:u.tracks.empty}):o.jsx("ol",{className:"space-y-1.5",children:p.map(($,oe)=>{const ie=m.get($);return o.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-2",children:[o.jsx("span",{className:"w-5 text-center text-xs font-bold text-text-muted",children:oe+1}),o.jsx("span",{className:"flex-1 truncate text-sm",children:(ie==null?void 0:ie.title)??$}),o.jsx("button",{type:"button",onClick:()=>S(oe,-1),disabled:oe===0,"aria-label":u.tracks.moveUp,className:"rounded p-1 text-text-muted hover:text-primary disabled:opacity-30",children:o.jsx(dq,{size:15,"aria-hidden":!0})}),o.jsx("button",{type:"button",onClick:()=>S(oe,1),disabled:oe===p.length-1,"aria-label":u.tracks.moveDown,className:"rounded p-1 text-text-muted hover:text-primary disabled:opacity-30",children:o.jsx(cq,{size:15,"aria-hidden":!0})}),o.jsx("button",{type:"button",onClick:()=>z(oe),"aria-label":u.tracks.remove,className:"rounded p-1 text-text-muted hover:text-danger",children:o.jsx(Xi,{size:15,"aria-hidden":!0})})]},$)})})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.tracks.titleLabel}),o.jsx("input",{type:"text",value:g,onChange:$=>{x($.target.value),I(!0)},className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm focus:border-primary"})]}),r,o.jsxs(ee,{onClick:()=>void re.mutate(),disabled:!ve,children:[o.jsx($h,{size:15,"aria-hidden":!0}),u.tracks.save]})]})}function X$(){const n=Be($=>$.session),e=en(),[t,r]=E.useState(null),[s,i]=E.useState("oneOff"),[a,c]=E.useState(""),[l,d]=E.useState("group"),[m,p]=E.useState([]),[f,g]=E.useState([]),[x,b]=E.useState(""),[I,N]=E.useState(null),V=fe({queryKey:["academic"],queryFn:()=>pt.get()}),D=fe({queryKey:["teacher-students"],queryFn:()=>Vl.listStudents()}),T=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),M=V.data,R=E.useMemo(()=>{if(!M||!n)return[];const $=cs(M,new Date);return Ju(M,n.user.id,$==null?void 0:$.id)},[M,n]),_=t?V7(t):null,j=E.useMemo(()=>{if(!_)return[];const $=new Set;return yg(_.id).filter(({concept:oe})=>$.has(oe.id)?!1:($.add(oe.id),!0))},[_]),w=E.useMemo(()=>I1((T.data??[]).filter($=>wn($.typeId))),[T.data]),A=E.useMemo(()=>k6(f,w),[f,w]),O=(T.data??[]).filter($=>
4080A.includes($.id)),C=E.useMemo(()=>M&&t?Vi(M,t):[],[M,t]),S=(D.data??[]).filter($=>C.includes($.profile.id)),z=($,oe,ie)=>ie($.includes(oe)?$.filter(Ie=>Ie!==oe):[...$,oe]),re=l==="group"?C:m,ne=lt({mutationFn:async()=>{if(!n)throw new Error("no session");const $=R.find(Ie=>Ie.id===t),oe=_1(f,w).join(" · "),ie=[x.trim(),oe].filter(Ie=>Ie.length>0).join(" — ");for(const Ie of re)await n7.save({id:crypto.randomUUID(),teacherId:n.user.id,teacherName:n.user.displayName,musicianId:Ie,activityIds:A,note:ie||(($==null?void 0:$.name)??""),createdAt:new Date().toISOString()});return{n:re.length,target:l}},onSuccess:async $=>{await e.invalidateQueries({queryKey:["teacher-recommendation"]}),await e.invalidateQueries({queryKey:["notifications"]}),N($),p([]),g([]),b(""),window.setTimeout(()=>N(null),3e3)}}),ve=!!t&&re.length>0&&A.length>0&&!ne.isPending;return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.assignment.title,subtitle:u.assignment.subtitle}),I!==null?o.jsxs("div",{role:"status",className:"mb-4 flex items-center gap-2 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),X(I.target==="group"?u.assignment.sentToGroup:u.assignment.sentToStudents,{n:I.n})]}):null,o.jsxs(W,{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.assignment.pickGroup}),!V.isPending&&R.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.assignment.noGroups}):o.jsx("div",{className:"flex flex-wrap gap-2",children:R.map($=>{var oe;return o.jsxs("button",{type:"button","aria-pressed":t===$.id,onClick:()=>{r($.id),p([])},className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors ${t===$.id?"border-primary bg-primary text-on-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:$.color},"aria-hidden":!0}),$.name,o.jsx("span",{className:"text-xs font-normal opacity-70",children:((oe=M==null?void 0:M.tracks.find(ie=>ie.id===$.trackId))==null?void 0:oe.name)??""})]},$.id)})})]}),t?o.jsxs(o.Fragment,{children:[j.length>0?o.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-3",children:[o.jsxs("p",{className:"mb-2 flex items-center gap-2 text-sm font-semibold text-primary",children:[o.jsx(dr,{size:15,"aria-hidden":!0}),u.curriculum.courseContentTitle]}),_!=null&&_.goals&&_.goals.length>0?o.jsxs("div",{className:"mb-2.5 border-b border-primary/20 pb-2.5",children:[o.jsx("p",{className:"mb-1 text-xs font-semibold text-text-muted",children:u.curriculum.goalsTitle}),o.jsx("ul",{className:"space-y-1",children:_.goals.map(($,oe)=>o.jsxs("li",{className:"flex gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"mt-1.5 size-1 shrink-0 rounded-full bg-primary/60","aria-hidden":!0}),$]},oe))})]}):null,o.jsx("ol",{className:"flex flex-wrap gap-1.5",children:j.map(({concept:$},oe)=>o.jsxs("li",{className:"rounded-full bg-surface px-2.5 py-1 text-xs text-text-secondary",children:[o.jsxs("span",{className:"font-medium text-text-muted",children:[oe+1,"."]})," ",$.name]},$.id))})]}):null,o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.assignment.subtitle}),o.jsx("div",{className:"flex gap-2",children:["oneOff","track"].map($=>o.jsx("button",{type:"button","aria-pressed":s===$,onClick:()=>i($),className:`rounded-md border px-4 py-2 text-sm font-medium transition-colors ${s===$?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:$==="oneOff"?u.tracks.modeOneOff:u.tracks.modeTrack},$))}),s==="track"?o.jsx("p",{className:"mt-2 text-xs text-text-muted",children:u.tracks.builderHint}):null]}),s==="track"?o.jsx(W7,{authorRole:"teacher",groupIds:[t],notifyUserIds:C,buildScope:()=>({level:void 0,publishedToFreePractice:!1,lessonNumber:typeof a=="number"?a:void 0}),scopeSlot:o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.tracks.lessonLabel}),o.jsxs("select",{value:a,onChange:$=>c($.target.value?Number($.target.value):""),className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm focus:border-primary",children:[o.jsx("option",{value:"",children:u.tracks.lessonNone}),Array.from({length:13},($,oe)=>oe+1).map($=>o.jsx("option",{value:$,children:X(u.tracks.meeting,{n:$})},$))]})]})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.assignment.target}),o.jsx("div",{className:"flex gap-2",children:["group","students"].map($=>o.jsxs("button",{type:"button","aria-pressed":l===$,onClick:()=>d($),className:`flex items-center gap-2 rounded-md border px-4 py-2 text-sm font-medium transition-colors ${l===$?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[$==="group"?o.jsx(Lr,{size:15,"aria-hidden":!0}):null,$==="group"?`${u.assignment.targetGroup} (${C.length})`:u.assignment.targetStudents]},$))})]}),l==="students"?o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.assignment.pickStudents}),S.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.teacherStudents.noStudents}):o.jsx("div",{className:"flex flex-wrap gap-2",children:S.map($=>{const oe=m.includes($.profile.id);return o.jsxs("button",{type:"button","aria-pressed":oe,onClick:()=>z(m,$.profile.id,p),className:`flex items-center gap-2 rounded-full border py-1 pe-3.5 ps-1 text-sm font-medium transition-colors ${oe?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx(hi,{name:$.profile.displayName,color:$.profile.avatarColor,size:26}),$.profile.displayName]},$.profile.id)})})]}):null,o.jsxs("div",{children:[o.jsx("p",{className:"mb-1 text-sm font-medium text-text-secondary",children:u.assignment.pickTopics}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.assignment.topicsHint}),o.jsx("div",{className:"flex flex-wrap gap-2",children:w.map($=>{const oe=f.includes($.objectiveId);return o.jsxs("button",{type:"button","aria-pressed":oe,onClick:()=>z(f,$.objectiveId,g),className:`flex items-center gap-2 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors ${oe?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[$.title.he,o.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 text-[11px] text-text-muted",children:$.activityIds.length})]},$.objectiveId)})})]}),f.length>0?o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.assignment.exerciseSet}),O.length===0?o.jsx("p",{className:"text-xs text-text-muted",children:u.assignment.noExercises}):o.jsx("ul",{className:"flex flex-wrap gap-1.5",children:O.map($=>o.jsx("li",{className:"rounded-full bg-surface-sunken px-3 py-1 text-xs text-text-secondary",children:$.title},$.id))})]}):null,o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.assignment.noteLabel}),o.jsx("input",{type:"text",value:x,onChange:$=>b($.target.value),placeholder:u.assignment.notePlaceholder,"aria-label":u.assignment.noteLabel,className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm placeholder:text-text-muted focus:border-primary"})]}),o.jsxs(ee,{onClick:()=>void ne.mutate(),disabled:!ve,children:[o.jsx(f7,{size:15,"aria-hidden":!0,
4080className:"-scale-x-100"}),u.assignment.send]})]})]}):null]})]})}function eB(){const n=Be(I=>I.session),e=en(),[t,r]=E.useState(null),[s,i]=E.useState(""),[a,c]=E.useState(""),[l,d]=E.useState(!1),m=fe({queryKey:["academic"],queryFn:()=>pt.get()}),p=m.data,f=E.useMemo(()=>{var I;return!p||!n?[]:Ju(p,n.user.id,(I=cs(p,new Date))==null?void 0:I.id)},[p,n]),g=fe({queryKey:["announcements","group",t],queryFn:()=>Ou.listForGroups([t]),enabled:!!t}),x=lt({mutationFn:async()=>{if(!n||!p||!t)throw new Error("no target");const I=f.find(V=>V.id===t),N={id:crypto.randomUUID(),groupId:t,groupName:(I==null?void 0:I.name)??"",teacherId:n.user.id,teacherName:n.user.displayName,body:a.trim(),createdAt:new Date().toISOString(),...s.trim()?{title:s.trim()}:{}};return Ou.save(N,Vi(p,t))},onSuccess:async()=>{await e.invalidateQueries({queryKey:["announcements"]}),await e.invalidateQueries({queryKey:["notifications"]}),d(!0),i(""),c(""),window.setTimeout(()=>d(!1),3e3)}}),b=!!t&&a.trim().length>0&&!x.isPending;return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.announce.title,subtitle:u.announce.subtitle}),l?o.jsxs("div",{role:"status",className:"mb-4 flex items-center gap-2 rounded-md bg-success/10 px-4 py-2.5 text-sm font-medium text-success",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),u.announce.sent]}):null,o.jsxs(W,{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.announce.pickGroup}),!m.isPending&&f.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.announce.noGroups}):o.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(I=>o.jsxs("button",{type:"button","aria-pressed":t===I.id,onClick:()=>r(I.id),className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors ${t===I.id?"border-primary bg-primary text-on-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:I.color},"aria-hidden":!0}),I.name]},I.id))})]}),t?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.announce.titleLabel}),o.jsx("input",{type:"text",value:s,onChange:I=>i(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm focus:border-primary"})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.announce.bodyLabel}),o.jsx("textarea",{value:a,onChange:I=>c(I.target.value),rows:4,placeholder:u.announce.placeholder,className:"w-full rounded-md border border-border bg-surface px-3 py-2.5 text-sm placeholder:text-text-muted focus:border-primary"})]}),o.jsxs(ee,{onClick:()=>void x.mutate(),disabled:!b,children:[o.jsx(f7,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.announce.send]}),(g.data??[]).length>0?o.jsxs("div",{className:"border-t border-border pt-4",children:[o.jsx("p",{className:"mb-2 text-sm font-semibold text-text-secondary",children:u.announce.recent}),o.jsx("ul",{className:"space-y-2",children:(g.data??[]).slice(0,5).map(I=>o.jsxs("li",{className:"rounded-md bg-surface-sunken px-3 py-2",children:[I.title?o.jsx("p",{className:"text-sm font-semibold",children:I.title}):null,o.jsx("p",{className:"text-sm text-text-secondary",children:I.body})]},I.id))})]}):null]}):null]}),o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-text-muted",children:[o.jsx(Fh,{size:14,"aria-hidden":!0}),u.announce.subtitle]})]})}function tB(){const n=Be(p=>p.session),e=It(),[t,r]=E.useState(null),s=fe({queryKey:["academic"],queryFn:()=>pt.get()}),i=fe({queryKey:["teacher-students"],queryFn:()=>Vl.listStudents()}),a=s.data,c=E.useMemo(()=>{if(!a||!n)return[];const p=cs(a,new Date);return Ju(a,n.user.id,p==null?void 0:p.id)},[a,n]),l=c.find(p=>p.id===t)??null,d=a&&t?Vi(a,t):[],m=(i.data??[]).filter(p=>d.includes(p.profile.id));return o.jsxs("div",{children:[o.jsx(tt,{title:u.teacherStudents.title,subtitle:u.teacherStudents.subtitle}),s.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):c.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.teacherStudents.noGroups}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.teacherStudents.pickGroup}),o.jsx("div",{className:"mb-6 flex flex-wrap gap-2",children:c.map(p=>{var f;return o.jsxs("button",{type:"button","aria-pressed":t===p.id,onClick:()=>r(p.id),className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors ${t===p.id?"border-primary bg-primary text-on-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:p.color},"aria-hidden":!0}),p.name,o.jsx("span",{className:"text-xs font-normal opacity-70",children:((f=a==null?void 0:a.tracks.find(g=>g.id===p.trackId))==null?void 0:f.name)??""})]}
4080,p.id)})})]}),l?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[o.jsx("h2",{className:"text-sm font-semibold text-text-secondary",children:X(u.teacherStudents.inGroup,{group:l.name})}),o.jsxs(ee,{variant:"soft",onClick:()=>void e({to:"/teacher/assignment"}),children:[o.jsx(Qi,{size:15,"aria-hidden":!0}),u.teacherStudents.assignToGroup]})]}),m.length===0?o.jsx(W,{className:"py-10 text-center text-sm text-text-muted",children:u.teacherStudents.noStudents}):o.jsx("div",{className:"space-y-2.5",children:m.map(p=>o.jsx("button",{onClick:()=>void e({to:"/teacher/students/$studentId",params:{studentId:p.profile.id}}),className:"block w-full text-start",children:o.jsxs(W,{className:"flex items-center gap-4 p-4 hover:shadow-hover",children:[o.jsx(hi,{name:p.profile.displayName,color:p.profile.avatarColor,size:42}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block font-semibold",children:p.profile.displayName}),o.jsxs("span",{className:"block text-xs text-text-muted",children:[p.profile.instruments.join(" · "),p.lastPracticeAt?` · ${X(u.teacherStudents.lastPractice,{when:mr(p.lastPracticeAt)})}`:""]})]}),p.weeklyMinutes>0?o.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-semibold text-text-secondary",children:[p.streakDays>=5?o.jsx(zh,{size:15,"aria-hidden":!0,className:"text-accent"}):null,Zt(p.weeklyMinutes)," ",u.common.minutes]}):o.jsx("span",{className:"rounded-full bg-danger/10 px-2.5 py-1 text-xs font-medium text-danger",children:u.teacherHome.noPracticeYet}),o.jsx(ui,{size:17,"aria-hidden":!0,className:"shrink-0 text-text-muted"})]})},p.profile.id))})]}):null]})}function nB(){var d,m;const{studentId:n}=ri({strict:!1});Be(p=>p.session);const e=en(),t=fe({queryKey:["teacher-students"],queryFn:()=>Vl.listStudents()}),r=fe({queryKey:["objective-progress",n],queryFn:()=>ca.listObjectiveProgress(n)}),s=fe({queryKey:["practice-sessions",n],queryFn:()=>gt.listSessions(n)}),i=fe({queryKey:["teacher-signals",n],queryFn:()=>r1.list(n)}),a=(t.data??[]).find(p=>p.profile.id===n),c=lt({mutationFn:p=>r1.save(n,p===null?[]:[{objectiveId:p,mastery:.25}]),onSuccess:async()=>{await e.invalidateQueries({queryKey:["teacher-signals",n]}),await e.invalidateQueries({queryKey:["objective-progress",n]})}});if(!a)return o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading});const l=((m=(d=i.data)==null?void 0:d[0])==null?void 0:m.objectiveId)??null;return o.jsxs("div",{children:[o.jsx(tt,{title:a.profile.displayName,subtitle:a.profile.instruments.join(" · "),actions:o.jsx(hi,{name:a.profile.displayName,color:a.profile.avatarColor,size:44})}),o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsx("section",{className:"space-y-4",children:o.jsxs(W,{className:"space-y-4",children:[o.jsx("h2",{className:"font-semibold",children:u.teacherStudents.detailProgress}),(r.data??[]).map(p=>o.jsxs("div",{children:[o.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium",children:[p.trend==="up"?o.jsx(Ji,{size:14,"aria-hidden":!0,className:"text-success"}):p.trend==="down"?o.jsx(mg,{size:14,"aria-hidden":!0,className:"text-danger"}):null,p.objectiveTitle]}),o.jsxs("span",{className:"flex items-center gap-2",children:[l===p.objectiveId?o.jsx("span",{className:"rounded-full bg-primary-soft px-2 py-0.5 text-[11px] font-semibold text-primary",children:X(u.teacherStudents.focusActive,{name:a.profile.displayName.split(" ")[0]??""})}):null,o.jsxs("span",{className:"text-xs font-bold text-text-secondary",children:[Math.round(p.mastery*100),"%"]})]})]}),o.jsx(Gs,{value:p.mastery,label:p.objectiveTitle}),o.jsx("div",{className:"mt-1.5",children:l===p.objectiveId?o.jsx("button",{onClick:()=>c.mutate(null),className:"text-xs font-medium text-text-muted hover:text-danger",children:u.teacherStudents.unfocusButton}):o.jsxs("button",{onClick:()=>c.mutate(p.objectiveId),className:"flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:[o.jsx(Ll,{size:12,"aria-hidden":!0}),u.teacherStudents.focusButton]})})]},p.objectiveId)),o.jsx("p",{className:"text-xs text-text-muted",children:u.teacherStudents.focusHint})]})}),o.jsx("section",{children:o.jsxs(W,{className:"p-0",children:[o.jsx("h2",{className:"px-5 pt-4 font-semibold",children:u.teacherStudents.detailSessions}),o.jsxs("div",{className:"divide-y divide-border",children:[(s.data??[]).slice(0,6).map(p=>o.jsxs("div",{className:"px-5 py-3",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-text-muted",children:[o.jsx("span",{children:mr(p.startedAt)}),o.jsxs("span",{children:[Zt(p.totalMinutes)," ",u.common.minutes]})]}),o.jsx("ul",{className:"space-y-1",children:p.runs.map(f=>o.jsxs("li",{className:"flex items-center justify-between gap-2 text-sm",children:[o.jsx("span",{className:"truncate",children:f.activityTitle}),typeof f.score=="number"?o.jsxs("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs font-semibold ${f.score>=.85?"bg-success/10 text-success":f.score>=.5?"bg-primary-soft text-primary":"bg-surface-sunken text-text-secondary"}`,children:[Math.round(f.score*100),"%"]}):null]},f.id))})]}
4080,p.id)),(s.data??[]).length===0?o.jsx("p",{className:"px-5 py-6 text-sm text-text-muted",children:u.teacherHome.noPracticeYet}):null]})]})})]})]})}function uc(n){return n.samples===0?"none":n.mastery>=.75?"green":n.mastery>=.45?"yellow":"red"}const xx={green:{dot:"bg-success",chip:"bg-success/10 text-success",label:()=>u.progressPage.statusStrong},yellow:{dot:"bg-accent",chip:"bg-accent/15 text-accent",label:()=>u.progressPage.statusMedium},red:{dot:"bg-danger",chip:"bg-danger/10 text-danger",label:()=>u.progressPage.statusWeak},none:{dot:"bg-border-strong",chip:"bg-surface-sunken text-text-muted",label:()=>u.progressPage.statusUnpracticed}};function rB(n){const e=n.runs.map(t=>t.score).filter(t=>typeof t=="number");return e.length?e.reduce((t,r)=>t+r,0)/e.length:null}function sB(){var D;const n=Be(T=>T.session),e=(n==null?void 0:n.user.id)??"",t=fe({queryKey:["objective-progress",e],queryFn:()=>ca.listObjectiveProgress(e),enabled:!!e}),r=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}),s=fe({queryKey:["goal",e],queryFn:()=>Ru.get(e),enabled:!!e}),i=r.data??[],a=T=>{const M=T.reduce((_,j)=>_+j.totalMinutes,0),R=T.flatMap(_=>_.runs.map(j=>j.score)).filter(_=>typeof _=="number");return{count:T.length,minutes:M,avg:R.length?R.reduce((_,j)=>_+j,0)/R.length:null}},c=a(i.filter(T=>T.source==="assignment")),l=a(i.filter(T=>T.source==="free_choice"||T.source==="recommendation")),d=i.reduce((T,M)=>T+M.totalMinutes,0),m=i.flatMap(T=>T.runs.map(M=>M.score)).filter(T=>typeof T=="number"),p=m.length?m.reduce((T,M)=>T+M,0)/m.length:null,f=t.data??[],g=f.filter(T=>uc(T)==="green").length,x=f.filter(T=>uc(T)==="red"||uc(T)==="none").sort((T,M)=>T.samples-M.samples||T.mastery-M.mastery).slice(0,3),b=i.filter(T=>Date.now()-new Date(T.startedAt).getTime()<7*864e5).reduce((T,M)=>T+M.totalMinutes,0),I=((D=s.data)==null?void 0:D.weeklyMinutesTarget)??0,N=I>0&&b>=I,V=[...i].sort((T,M)=>new Date(M.startedAt).getTime()-new Date(T.startedAt).getTime()).slice(0,4);return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.student.progress,subtitle:u.progressPage.subtitle}),o.jsx("h2",{className:"mb-3 text-lg font-bold tracking-tight",children:u.progressPage.pillarsTitle}),o.jsx("div",{className:"mb-6 grid gap-3 sm:grid-cols-2",children:[{icon:dr,title:u.progressPage.pillarCourses,hint:u.progressPage.pillarCoursesHint,s:c,to:"/student/courses"},{icon:Ll,title:u.progressPage.pillarFree,hint:u.progressPage.pillarFreeHint,s:l,to:"/student/practice"}].map(({icon:T,title:M,hint:R,s:_,to:j})=>o.jsxs(W,{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg text-white shadow-card",style:{background:"var(--gradient-brand)"},children:o.jsx(T,{size:17,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-bold leading-tight",children:M}),o.jsx("p",{className:"text-xs text-text-muted",children:R})]})]}),o.jsxs("div",{className:"flex items-baseline gap-3",children:[o.jsx("span",{className:"text-2xl font-bold text-primary",children:_.avg===null?"—":`${Math.round(_.avg*100)}%`}),o.jsxs("span",{className:"text-xs text-text-secondary",children:[X(u.progressPage.pillarSessions,{n:_.count})," · ",Zt(_.minutes)," ",u.common.minutes]})]}),o.jsx(Gs,{value:_.avg??0,label:M}),o.jsx(un,{to:j,className:"text-sm font-medium text-primary hover:underline",children:u.progressPage.pillarCta})]},M))}),o.jsx("div",{className:"mb-6 grid grid-cols-3 gap-3",children:[{value:Zt(d),label:u.progressPage.totalMinutes},{value:String(i.length),label:u.progressPage.totalSessions},{value:p===null?"—":`${Math.round(p*100)}%`,label:u.progressPage.avgScore}].map(T=>o.jsxs(W,{className:"py-4 text-center",children:[o.jsx("p",{className:"text-2xl font-bold text-primary",children:T.value}),o.jsx("p",{className:"mt-0.5 text-xs text-text-secondary",children:T.label})]},T.label))}),o.jsxs(W,{className:"mb-6",children:[o.jsxs("h2",{className:"mb-1 flex items-center gap-2 text-lg font-bold",children:[o.jsx(bo,{size:18,"aria-hidden":!0,
4080className:"text-accent"}),u.progressPage.practiceNowTitle]}),x.length===0?o.jsx("p",{className:"text-sm font-medium text-success",children:u.progressPage.allStrong}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"mb-3 text-sm text-text-secondary",children:u.progressPage.practiceNowHint}),o.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:x.map(T=>{const M=xx[uc(T)];return o.jsxs("span",{className:`flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium ${M.chip}`,children:[o.jsx("span",{className:`size-2 rounded-full ${M.dot}`,"aria-hidden":!0}),T.objectiveTitle]},T.objectiveId)})}),o.jsx(un,{to:"/student/practice",children:o.jsxs(ee,{children:[o.jsx(bo,{size:15,"aria-hidden":!0}),u.progressPage.practiceNowCta]})})]})]}),o.jsxs(W,{className:"mb-6 space-y-5",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold",children:u.progressPage.masteryTitle}),g>0?o.jsx("p",{className:"mt-0.5 text-sm font-medium text-success",children:X(u.progressPage.greensReinforcement,{n:g})}):null]}),f.map(T=>{const M=uc(T),R=xx[M];return o.jsxs("div",{children:[o.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium",children:[o.jsx("span",{className:`size-2.5 shrink-0 rounded-full ${R.dot}`,"aria-hidden":!0}),T.trend==="up"?o.jsx(Ji,{size:14,"aria-hidden":!0,className:"shrink-0 text-success"}):T.trend==="down"?o.jsx(mg,{size:14,"aria-hidden":!0,className:"shrink-0 text-danger"}):null,o.jsx("span",{className:"truncate",children:T.objectiveTitle}),T.teacherOverride?o.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-accent/15 px-2 py-0.5 text-[11px] font-semibold text-accent",children:[o.jsx(as,{size:11,"aria-hidden":!0}),u.progressPage.teacherPinned]}):null]}),o.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs font-bold ${R.chip}`,children:M==="none"?R.label():`${Math.round(T.mastery*100)}% · ${R.label()}`})]}),o.jsx(Gs,{value:M==="none"?0:T.mastery,label:T.objectiveTitle}),T.samples>0?o.jsx("p",{className:"mt-1 text-[11px] text-text-muted",children:X(u.progressPage.confidence,{n:T.samples})}):null]},T.objectiveId)})]}),o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(W,{className:"self-start",children:[o.jsxs("h2",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx(Bh,{size:16,"aria-hidden":!0,className:"text-primary"}),u.progressPage.weeklyGoalTitle]}),I>0?o.jsxs(o.Fragment,{children:[o.jsx(Gs,{value:b/I,label:u.progressPage.weeklyGoalTitle}),o.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:N?u.goals.goalReached:X(u.goals.minutesOf,{n:Zt(b),target:Zt(I)})})]}):o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}),o.jsx(un,{to:"/student/goals",className:"mt-3 inline-block text-sm font-medium text-primary hover:underline",children:u.progressPage.editGoals})]}),o.jsxs(W,{className:"self-start",children:[o.jsx("h2",{className:"mb-3 font-semibold",children:u.progressPage.recentTitle}),V.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.history.emptyTitle}):o.jsx("ul",{className:"space-y-2.5",children:V.map(T=>{const M=rB(T);return o.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[o.jsxs("span",{className:"truncate text-text-secondary",children:[mr(T.startedAt)," · ",Zt(T.totalMinutes)," ",u.common.minutes]}),M!==null?o.jsxs("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs font-bold ${M>=.75?"bg-success/10 text-success":M>=.45?"bg-accent/15 text-accent":"bg-danger/10 text-danger"}`,children:[Math.round(M*100),"%"]}):null]},T.id)})}),o.jsx(un,{to:"/student/history",className:"mt-3 inline-block text-sm font-medium text-primary hover:underline",children:u.progressPage.allHistory})]})]})]})}const iB=n=>n==="teacher_note"?as:n==="assignment"?Qi:n==="milestone"?Vu:i7;function aB(){const n=Be(c=>c.session),e=(n==null?void 0:n.user.id)??"",t=en(),r=fe({queryKey:["notifications",e],queryFn:()=>ol.list(e),enabled:!!e}),s=lt({mutationFn:()=>ol.markAllRead(e),onSuccess:()=>
4080t.invalidateQueries({queryKey:["notifications",e]})}),i=r.data??[],a=i.some(c=>!c.read);return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.nav.student.notifications,subtitle:u.notifications.subtitle,actions:a?o.jsxs(ee,{variant:"ghost",onClick:()=>s.mutate(),children:[o.jsx(mq,{size:15,"aria-hidden":!0}),u.notifications.markAllRead]}):void 0}),r.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):i.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.notifications.empty}):o.jsx(W,{className:"divide-y divide-border p-0",children:i.map(c=>{const l=iB(c.kind);return o.jsxs("div",{className:`flex gap-3 px-5 py-4 ${c.read?"opacity-70":""}`,children:[o.jsx("span",{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full ${c.read?"bg-surface-sunken text-text-muted":"bg-primary-soft text-primary"}`,children:o.jsx(l,{size:16,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-semibold",children:c.title}),o.jsx("span",{className:"shrink-0 text-xs text-text-muted",children:mr(c.createdAt)})]}),o.jsx("p",{className:"mt-0.5 text-sm text-text-secondary",children:c.body})]})]},c.id)})})]})}function oB(){const n=Be(a=>a.session),e=(n==null?void 0:n.user.id)??"",r=fe({queryKey:["practice-sessions",e],queryFn:()=>gt.listSessions(e),enabled:!!e}).data??[],s=h1(r,new Date),i=new Set(UN({sessions:r,streakDays:s}));return o.jsxs(W,{children:[o.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-bold",children:[o.jsx(Vu,{size:18,"aria-hidden":!0,className:"text-accent"}),u.practice.game.achievementsTitle]}),o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:n4.map(a=>{const c=i.has(a.id);return o.jsxs("div",{className:c?"flex flex-col items-center gap-1.5 rounded-lg bg-accent/15 p-3 text-center":"flex flex-col items-center gap-1.5 rounded-lg bg-surface-sunken p-3 text-center opacity-50",children:[o.jsx("span",{className:c?"flex size-9 items-center justify-center rounded-full bg-accent/20 text-accent":"flex size-9 items-center justify-center rounded-full bg-border text-text-secondary",children:c?o.jsx(Vu,{size:16,"aria-hidden":!0}):o.jsx(m7,{size:16,"aria-hidden":!0})}),o.jsx("span",{className:"text-xs font-semibold leading-snug",children:a.title.he}),o.jsx("span",{className:"text-[11px] leading-snug text-text-secondary",children:a.description.he})]},a.id)})})]})}function cB(){const n=Be(N=>N.session),e=n==null?void 0:n.user,t=e?[...xo,...Vr()].find(N=>N.id===e.id)??e:void 0,r=(t==null?void 0:t.id)??"",s=fe({queryKey:["objective-progress",r],queryFn:()=>ca.listObjectiveProgress(r),enabled:!!r}),i=fe({queryKey:["practice-sessions",r],queryFn:()=>gt.listSessions(r),enabled:!!r}),a=fe({queryKey:["academic"],queryFn:()=>pt.get()});if(!t)return null;const c=B_.find(N=>N.id===t.organizationId),l=h1(i.data??[],new Date),d=[...s.data??[]].sort((N,V)=>V.mastery-N.mastery),m=d.slice(0,2),p=d.slice(-2).reverse(),f=a.data,g=f?cs(f,new Date):null,x=f?Ha(f,t.id,g==null?void 0:g.id):[],b=f&&g?Ha(f,t.id).filter(N=>N.academicYearId!==g.id):[],I=f?vS(f,t.id,g==null?void 0:g.id):[];return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.nav.student.profile,subtitle:u.profile.subtitle}),o.jsxs(W,{className:"mb-5 flex items-center gap-4",children:[o.jsx(hi,{name:t.displayName,color:t.avatarColor,size:64}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"text-xl font-bold",children:t.displayName}),o.jsx("p",{className:"text-sm text-text-secondary",children:c!=null&&c.isPublicScope?u.profile.independent:`${u.profile.organization} ${(c==null?void 0:c.name)??""}`}),x.length>0?o.jsx("p",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:x.map(N=>o.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-surface-sunken px-2.5 py-0.5 text-xs font-semibold text-text-secondary",children:[o.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:N.color},"aria-hidden":!0}),N.name]},N.id))}):null,t.instruments.length>0?o.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-text-muted",children:[o.jsx(dg,{size:14,"aria-hidden":!0}),t.instruments.join(" · ")]}):null]}),l>0?o.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-primary-soft px-3.5 py-1.5 text-sm font-bold text-primary",children:[o.jsx(zh,{size:16,"aria-hidden":!0,
4080className:"text-accent"}),l," ",u.studentDashboard.days]}):null]}),o.jsxs("div",{className:"mb-5 grid gap-4 sm:grid-cols-2",children:[o.jsxs(W,{children:[o.jsx("h3",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.profile.strengths}),o.jsx("ul",{className:"space-y-2",children:m.map(N=>o.jsxs("li",{className:"flex items-center justify-between gap-2 text-sm",children:[o.jsx("span",{className:"truncate",children:N.objectiveTitle}),o.jsxs("span",{className:"shrink-0 rounded-full bg-success/10 px-2 py-0.5 text-xs font-bold text-success",children:[Math.round(N.mastery*100),"%"]})]},N.objectiveId))})]}),o.jsxs(W,{children:[o.jsx("h3",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.profile.focusNow}),o.jsx("ul",{className:"space-y-2",children:p.map(N=>o.jsxs("li",{className:"flex items-center justify-between gap-2 text-sm",children:[o.jsx("span",{className:"truncate",children:N.objectiveTitle}),o.jsxs("span",{className:"shrink-0 rounded-full bg-primary-soft px-2 py-0.5 text-xs font-bold text-primary",children:[Math.round(N.mastery*100),"%"]})]},N.objectiveId))})]})]}),o.jsxs(W,{className:"mb-5",children:[o.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-sm font-semibold text-text-secondary",children:[o.jsx(Lr,{size:15,"aria-hidden":!0}),u.profile.groupsTitle]}),x.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.profile.noGroups}):o.jsx("ul",{className:"space-y-2.5",children:x.map(N=>o.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2 font-medium",children:[o.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{backgroundColor:N.color},"aria-hidden":!0}),o.jsx("span",{className:"truncate",children:N.name})]}),f&&Wa(f,N).length>0?o.jsx("span",{className:"shrink-0 text-xs text-text-muted",children:X(u.profile.teacherLabel,{name:Wa(f,N).join(" · ")})}):null]},N.id))}),b.length>0?o.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[o.jsx("p",{className:"mb-2 text-xs font-medium text-text-muted",children:u.profile.pastYearsTitle}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(N=>{var D;const V=((D=f==null?void 0:f.years.find(T=>T.id===N.academicYearId))==null?void 0:D.name)??"";return o.jsxs("span",{className:"rounded-full bg-surface-sunken px-2.5 py-0.5 text-xs text-text-secondary",children:[N.name," · ",V]},N.id)})})]}):null]}),I.length>0?o.jsxs(W,{className:"mb-5",children:[o.jsxs("h3",{className:"mb-1 flex items-center gap-2 text-sm font-semibold text-text-secondary",children:[o.jsx(hq,{size:15,"aria-hidden":!0}),u.profile.scheduleTitle]}),o.jsx("p",{className:"mb-3 text-[11px] text-text-muted",children:u.profile.scheduleSyncNote}),o.jsx("ul",{className:"space-y-2",children:I.map(N=>o.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg bg-surface-sunken px-3 py-2 text-sm",children:[o.jsxs("span",{className:"flex items-center gap-2 font-medium",children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:N.groupColor},"aria-hidden":!0}),u.academicAdmin.days[N.slot.dayOfWeek]," · ",N.slot.startTime,"–",N.slot.endTime]}),o.jsxs("span",{className:"text-text-secondary",children:[N.groupName,N.slot.location?` · ${N.slot.location}`:""]})]},N.slot.id))})]}):null,o.jsx(oB,{})]})}const lB=["shirat-mock-sessions","shirat-mock-authored","shirat-mock-assets","shirat-mock-placement","shirat-mock-teacher-signals","shirat-mock-goals","shirat-mock-users","shirat-mock-lessons","shirat-mock-recommendations","shirat-mock-notifications","shirat-mock-notifications-read","shirat-mock-academic","shirat-mock-admin-students","shirat-mock-active-path"];function dB(){const{theme:n,toggle:e}=I7(),t=Be(c=>c.signOut),r=It(),[s,i]=E.useState(!1),a=()=>{i(!0),lB.forEach(c=>localStorage.removeItem(c)),window.setTimeout(()=>window.location.reload(),600)};return o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsx(tt,{title:u.nav.student.settings,subtitle:u.settings.subtitle}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs(W,{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.settings.appearance}),o.jsx("div",{className:"flex gap-2",children:["light","dark"].map(c=>o.jsxs("button",{onClick:()=>n!==c&&e(),"aria-pressed":n===c,className:`flex items-center gap-2 rounded-md border px-4 py-2.5 text-sm font-medium transition-colors ${n===c?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[c==="light"?o.jsx(x7,{size:16,"aria-hidden":!0}):o.jsx(p7,{size:16,"aria-hidden":!0}),c==="light"?u.settings.themeLight:u.settings.themeDark]},c))})]}),o.jsxs(W,{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.settings.account}),o.jsxs(ee,{variant:"ghost",onClick:()=>{t(),r({to:"/login"})}
4080,children:[o.jsx(qu,{size:15,"aria-hidden":!0,className:"-scale-x-100"}),u.settings.signOut]})]}),o.jsxs(W,{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.settings.devTools}),o.jsxs(ee,{variant:"ghost",onClick:a,disabled:s,children:[o.jsx(zu,{size:15,"aria-hidden":!0}),s?u.settings.resetDone:u.settings.resetData]}),o.jsxs("p",{className:"mt-3 text-xs text-text-muted",children:[u.settings.version," 0.8.0-beta · ",u.auth.mockBadge]})]})]})]})}function uB(n){try{const e=localStorage.getItem(n.storageKey);if(e)return JSON.parse(e)}catch{}return structuredClone(n.seed)}function hB(n,e){localStorage.setItem(n.storageKey,JSON.stringify(e))}function vx({config:n,initial:e,onSave:t,onCancel:r}){const[s,i]=E.useState(e??Object.fromEntries(n.fields.map(l=>[l.key,l.type==="number"?0:""]))),a=n.fields[0],c=a?String(s[a.key]??"").trim().length>0:!1;return o.jsxs(W,{className:"mb-4 space-y-3 border-primary/40",children:[o.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:n.fields.map(l=>o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:l.label}),o.jsx("input",{type:l.type==="number"?"number":"text",value:String(s[l.key]??""),onChange:d=>i({...s,[l.key]:l.type==="number"?d.target.valueAsNumber:d.target.value}),className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]},l.key))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ee,{onClick:()=>t(s),disabled:!c,children:u.admin.saveItem}),o.jsx(ee,{variant:"ghost",onClick:r,children:u.admin.cancel})]})]})}function mB({config:n}){const[e,t]=E.useState(()=>uB(n)),[r,s]=E.useState(null),[i,a]=E.useState(!1),[c,l]=E.useState(null),d=E.useRef(null),m=g=>{t(g),hB(n,g)},p=async g=>{const x=n.mapImportRow;if(x)try{const b=await Wh(g);if(!Array.isArray(b))throw new Error("not-an-array");const I=b.map(x).filter(V=>V!==null),N=new Map(e.map(V=>[V.id,V]));for(const V of I)N.set(V.id,{...N.get(V.id),...V});m([...N.values()]),l(X(u.admin.importedRows,{n:I.length}))}catch{l(u.admin.importRowsFailed)}},f=g=>{var x;return String(g[((x=n.fields[0])==null?void 0:x.key)??"name"]??"")};return o.jsxs("div",{children:[o.jsx(tt,{title:n.title,...n.subtitle?{subtitle:n.subtitle}:{},actions:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.mapImportRow?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:d,type:"file",accept:"application/json",className:"hidden","aria-label":u.admin.importJsonList,onChange:g=>{var b;const x=(b=g.target.files)==null?void 0:b[0];x&&p(x),g.target.value=""}}),o.jsxs(ee,{variant:"ghost",onClick:()=>{var g;return(g=d.current)==null?void 0:g.click()},children:[o.jsx(zl,{size:15,"aria-hidden":!0}),u.admin.importJsonList]})]}):null,o.jsxs(ee,{onClick:()=>(a(!0),s(null)),children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.admin.add]})]})}),c?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:c}):null,i?o.jsx(vx,{config:n,initial:null,onSave:g=>{m([{id:crypto.randomUUID(),...g},...e]),a(!1)},onCancel:()=>a(!1)}):null,e.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.admin.emptyCollection}):o.jsx("div",{className:"space-y-2.5",children:e.map(g=>(r==null?void 0:r.id)===g.id?o.jsx(vx,{config:n,initial:g,onSave:x=>{m(e.map(b=>b.id===g.id?{...b,...x}:b)),s(null)},onCancel:()=>s(null)},g.id):o.jsxs(W,{className:"flex items-center gap-3 p-4",children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-semibold",children:f(g)}),n.summary?o.jsx("span",{className:"block text-xs text-text-muted",children:n.summary(g)}):null]}),o.jsx("button",{onClick:()=>(s(g),a(!1)),"aria-label":u.admin.edit,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-text",children:o.jsx(hg,{size:15,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>m(e.filter(x=>x.id!==g.id)),"aria-label":u.admin.remove,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-danger",children:o.jsx(Uh,{size:15,"aria-hidden":!0})})]},g.id))})]})}const pB={title:u.nav.admin.students,subtitle:u.admin.studentsSubtitle,storageKey:"shirat-mock-admin-students",fields:[{key:"name",label:u.admin.fieldName},{key:"instrument",label:u.admin.fieldInstrument},{key:"email",label:u.admin.fieldEmail},{key:"phone",label:u.admin.fieldPhone}],summary:n=>[n.instrument,n.email,n.phone].filter(e=>!!e).join(" · "),seed:u1.map(n=>({id:n.id,name:n.displayName,instrument:n.instruments.join(", "),email:n.email??"",phone:n.phone??""})),mapImportRow:n=>{const e=String(n.displayName??"").trim();if(!e)return null;const t=n.sumitId;return{id:t!=null?`sumit-${String(t)}`:crypto.randomUUID(),name:e,instrument:"",email:String(n.email??""),phone:String(n.phone??"")}}};function fB(){const n=[...xo,...u1,...Vr()],e=new Map;
4080for(const t of n)e.has(t.id)||e.set(t.id,t);return[...e.values()].filter(t=>t.roles.includes("musician"))}function d1({color:n}){return o.jsx("span",{"aria-hidden":!0,className:"inline-block size-3 shrink-0 rounded-full",style:{backgroundColor:n}})}function gB(){var A,O;const n=en(),e=fe({queryKey:["academic"],queryFn:()=>pt.get()}),[t,r]=E.useState(null),[s,i]=E.useState(null),[a,c]=E.useState(null),[l,d]=E.useState(null),[m,p]=E.useState([]),f=E.useRef(null),g=E.useMemo(()=>fB(),[]),x=e.data??null,b=()=>n.invalidateQueries({queryKey:["academic"]}),I=C=>{d(C),window.setTimeout(()=>d(null),3e3)},N=lt({mutationFn:C=>pt.saveGroup(C),onSuccess:()=>{b(),c(null)}}),V=lt({mutationFn:C=>pt.deleteGroup(C),onSuccess:()=>{b(),i(null)}}),D=lt({mutationFn:C=>pt.addMembership(C),onSuccess:b}),T=lt({mutationFn:C=>pt.removeMembership(C),onSuccess:b}),M=lt({mutationFn:C=>pt.replace(C),onSuccess:b});if(!x)return o.jsxs("div",{children:[o.jsx(tt,{title:u.academicAdmin.groupsTitle,subtitle:u.academicAdmin.groupsSubtitle}),o.jsx(W,{className:"py-12 text-center text-sm text-text-secondary",children:u.common.loading})]});const R=t??((A=cs(x,new Date))==null?void 0:A.id)??((O=x.years[0])==null?void 0:O.id)??"",_=()=>Hh("shirat-academic.json",x),j=async C=>{p([]);try{const S=await Wh(C),z=gS(S);if(z.ok&&z.structure){M.mutate(z.structure);const re=z.issues.filter(ne=>ne.level==="warning");I(re.length>0?`${u.academicAdmin.importOk} — ${X(u.academicAdmin.importWarnings,{n:re.length})}`:u.academicAdmin.importOk)}else p(z.issues.map(re=>re.message).slice(0,8))}catch{p([u.academicAdmin.importFailed])}},w=s?x.groups.find(C=>C.id===s)??null:null;return o.jsxs("div",{children:[o.jsx(tt,{title:u.academicAdmin.groupsTitle,subtitle:u.academicAdmin.groupsSubtitle,actions:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"sr-only",children:u.academicAdmin.yearFilter}),o.jsx("select",{"aria-label":u.academicAdmin.yearFilter,value:R,onChange:C=>r(C.target.value),className:"rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary",children:x.years.map(C=>o.jsx("option",{value:C.id,children:C.name},C.id))})]}),o.jsxs(ee,{variant:"soft",onClick:()=>{var C;return(C=f.current)==null?void 0:C.click()},children:[o.jsx(zl,{size:15,"aria-hidden":!0}),u.academicAdmin.importBtn]}),o.jsxs(ee,{variant:"ghost",onClick:_,children:[o.jsx(c7,{size:15,"aria-hidden":!0}),u.academicAdmin.exportBtn]}),o.jsx("input",{ref:f,type:"file",accept:"application/json,.json",className:"hidden","aria-label":u.academicAdmin.importBtn,onChange:C=>{var z;const S=(z=C.target.files)==null?void 0:z[0];S&&j(S),C.target.value=""}})]})}),x.source==="sample"?o.jsx(W,{className:"mb-4 border-primary/30 bg-primary-soft py-3 text-sm text-primary",children:u.academicAdmin.sampleNotice}):null,m.length>0?o.jsxs(W,{className:"mb-4 border-danger/40 bg-danger/5",children:[o.jsx("p",{className:"mb-2 text-sm font-semibold text-danger",children:u.academicAdmin.importFailed}),o.jsx("ul",{className:"space-y-1 text-xs text-danger",children:m.map((C,S)=>o.jsx("li",{children:C},S))})]}):null,l?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:l}):null,w?o.jsx(bB,{structure:x,group:w,musicians:g,onBack:()=>i(null),onOpenGroup:i,onEdit:()=>c({group:w,trackId:w.trackId,academicYearId:w.academicYearId,parentGroupId:w.parentGroupId}),onAddSubGroup:()=>c({group:null,trackId:w.trackId,academicYearId:w.academicYearId,parentGroupId:w.id}),onDelete:()=>{window.confirm(X(u.academicAdmin.deleteConfirm,{name:w.name}))&&V.mutate(w.id)},onAddMember:C=>D.mutate({groupId:w.id,userId:C}),onRemoveMember:C=>T.mutate({groupId:w.id,userId:C})}):o.jsx("div",{className:"grid gap-6 lg:grid-cols-2",children:x.tracks.map(C=>o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-lg font-bold tracking-tight",children:C.name}),o.jsxs("div",{className:"space-y-2.5",children:[o4(x,C.id,R).map(S=>o.jsx(yB,{structure:x,group:S,onOpen:()=>i(S.id)},S.id)),o.jsxs(ee,{variant:"soft",className:"w-full",onClick:()=>c({group:null,trackId:C.id,academicYearId:R,parentGroupId:void 0}),children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.academicAdmin.addGroup]})]})]},C.id))}),a?o.jsx(xB,{structure:x,context:a,saving:N.isPending,onCancel:()=>c(null),onSave:C=>{var re;const z={id:((re=a.group)==null?void 0:re.id)??`g-${crypto.randomUUID().slice(0,8)}`,name:C.name,color:C.color,teacherIds:C.teacherIds,trackId:a.trackId,academicYearId:a.academicYearId,...a.parentGroupId?{parentGroupId:a.parentGroupId}:{}};N.mutate(z)}}):null]})}function yB({structure:n,group:e,onOpen:t}){const r=Vi(n,e.id).length,s=Wa(n,e),i=vc(n,e.id).length;return o.jsx("button",{type:"button",onClick:t,className:"block w-full rounded-lg border border-border bg-surface p-4 text-start shadow-card transition-shadow hover:shadow-hover",children:o.jsxs("span",{className:"flex items-center gap-2.5",children:[o.jsx(d1,{color:e.color}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-semibold",children:e.name}),o.jsxs("span",{className:"mt-0.5 block text-xs text-text-secondary",children:[X(u.academicAdmin.membersCount,{n:r}),i>0?` · ${u.academicAdmin.subGroupsTitle} (${i})`:""]}),s.length>0?o.jsx("span",{className:"mt-0.5 block truncate text-xs text-text-secondary",children:X(u.academicAdmin.teachersShort,{names:s.join(" · ")})}):null]})]})})}function bB({structure:n,group:e,musicians:t,onBack:r,onOpenGroup:s,onEdit:i,onDelete:a,onAddSubGroup:c,onAddMember:l,onRemoveMember:d}){const[m,p]=E.useState(""),f=yS(n,e.id),g=vc(n,e.id),x=Vi(n,e.id),b=c4(n,e.id),I=V=>{var D;return((D=t.find(T=>T.id===V))==null?void 0:D.displayName)??V},N=t.filter(V=>!x.includes(V.id));return o.jsxs("div",{className:"space-y-5",children:[o.jsx("button",{type:"button",onClick:r,className:"text-sm font-medium text-primary hover:underline",children:u.academicAdmin.backToGroups}),o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsx("nav",{className:"flex flex-wrap items-center gap-1.5 text-sm","aria-label":e.name,children:f.map((V,D)=>o.jsxs("span",{className:"flex items-center gap-1.5",children:[D>0?o.jsx("span",{className:"text-text-secondary",children:"/"}):null,o.jsx(d1,{color:V.color}),V.id===e.id?o.jsx("span",{className:"font-semibold",children:V.name}):o.jsx("button",{type:"button",onClick:()=>s(V.id),className:"text-text-secondary hover:text-text hover:underline",children:V.name})]},V.id))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(ee,{variant:"ghost",onClick:i,children:[o.jsx(hg,{size:15,"aria-hidden":!0}),u.academicAdmin.editGroup]}),o.jsxs(ee,{variant:"ghost",onClick:a,children:[o.jsx(Uh,{size:15,"aria-hidden":!0}),u.academicAdmin.deleteGroup]})]})]}),o.jsxs(W,{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("h3",{className:"font-bold",children:u.academicAdmin.subGroupsTitle}),o.jsxs(ee,{variant:"soft",onClick:c,children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.academicAdmin.addSubGroup]})]}),g.length===0?o.jsx("p",{className:"text-sm text-text-secondary",children:u.academicAdmin.noSubGroups}):o.jsx("div",{className:"space-y-2",children:g.map(V=>o.jsxs("button",{type:"button",onClick:()=>s(V.id),className:"flex w-full items-center gap-2.5 rounded-md bg-surface-sunken px-3 py-2.5 text-start hover:bg-surface",children:[o.jsx(d1,{color:V.color}),o.jsx("span",{className:"flex-1 truncate text-sm font-medium",children:V.name}),o.jsx("span",{className:"text-xs text-text-secondary",children:X(u.academicAdmin.membersCount,{n:Vi(n,V.id).length})})]},V.id))})]}),o.jsxs(W,{className:"space-y-3",children:[o.jsx("h3",{className:"font-bold",children:u.academicAdmin.membersTitle}),x.length===0?o.jsx("p",{className:"text-sm text-text-secondary",children:u.academicAdmin.noMembers}):o.jsx("ul",{className:"space-y-2",children:x.map(V=>o.jsxs("li",{className:"flex items-center gap-3 rounded-md bg-surface-sunken px-3 py-2",children:[o.jsx("span",{className:"flex-1 truncate text-sm",children:I(V)}),o.jsx("button",{type:"button",onClick:()=>d(V),"aria-label":u.academicAdmin.removeMember,className:"rounded-md p-1.5 text-text-secondary hover:bg-surface hover:text-danger",children:o.jsx(Xi,{size:15,"aria-hidden":!0})})]},V))}),N.length>0?o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("select",{"aria-label":u.academicAdmin.addMember,value:m,onChange:V=>p(V.target.value),className:"min-w-48 flex-1 rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary",children:[o.jsx("option",{value:"",children:"—"}),N.map(V=>o.jsx("option",{value:V.id,children:V.displayName},V.id))]}),o.jsxs(ee,{variant:"soft",disabled:!m,onClick:()=>{m&&(l(m),p(""))},children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.academicAdmin.addMember]})]}):null]}),o.jsxs(W,{className:"space-y-3",children:[o.jsx("h3",{className:"font-bold",children:u.academicAdmin.scheduleTitle}),b.length===0?o.jsx("p",{className:"text-sm text-text-secondary",children:u.academicAdmin.noSchedule}):o.jsx("div",{className:"overflow-x-auto",children:o.jsx("table",{className:"w-full text-start text-sm",children:o.jsx("tbody",{children:b.map(({slot:V}
4080)=>o.jsxs("tr",{className:"border-b border-border last:border-0",children:[o.jsx("td",{className:"py-2 pe-3 font-medium",children:u.academicAdmin.days[V.dayOfWeek]}),o.jsxs("td",{className:"py-2 pe-3 text-text-secondary",children:[V.startTime,"–",V.endTime]}),o.jsx("td",{className:"py-2 text-text-secondary",children:V.location??""})]},V.id))})})})]})]})}function xB({structure:n,context:e,saving:t,onCancel:r,onSave:s}){var g,x,b;const[i,a]=E.useState(((g=e.group)==null?void 0:g.name)??""),[c,l]=E.useState(((x=e.group)==null?void 0:x.color)??A2[0]),[d,m]=E.useState(((b=e.group)==null?void 0:b.teacherIds)??[]),p=I=>m(N=>N.includes(I)?N.filter(V=>V!==I):[...N,I]),f=i.trim().length>0;return o.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-black/40 p-4",children:o.jsxs(W,{className:"mt-16 w-full max-w-lg space-y-4 border-primary/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-lg font-bold",children:e.group?u.academicAdmin.editGroup:u.academicAdmin.addGroup}),o.jsx("button",{type:"button",onClick:r,"aria-label":u.academicAdmin.cancel,className:"rounded-md p-1.5 text-text-secondary hover:bg-surface-sunken hover:text-text",children:o.jsx(Xi,{size:18,"aria-hidden":!0})})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.academicAdmin.nameLabel}),o.jsx("input",{type:"text",value:i,"aria-label":u.academicAdmin.nameLabel,onChange:I=>a(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-text-secondary",children:u.academicAdmin.colorLabel}),o.jsx("div",{className:"flex flex-wrap gap-2",children:A2.map(I=>o.jsx("button",{type:"button","aria-label":I,"aria-pressed":c===I,onClick:()=>l(I),className:`size-7 rounded-full transition-transform ${c===I?"ring-2 ring-primary ring-offset-2 ring-offset-surface":""}`,style:{backgroundColor:I}},I))})]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-text-secondary",children:u.academicAdmin.teachersLabel}),o.jsx("div",{className:"flex flex-wrap gap-2",children:n.teachers.map(I=>{const N=d.includes(I.id);return o.jsx("button",{type:"button","aria-pressed":N,onClick:()=>p(I.id),className:`rounded-full px-3 py-1.5 text-sm transition-colors ${N?"bg-primary text-on-primary":"bg-surface-sunken text-text-secondary hover:text-text"}`,children:I.name},I.id)})})]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[o.jsx(ee,{disabled:!f||t,onClick:()=>s({name:i.trim(),color:c,teacherIds:d}),children:u.academicAdmin.save}),o.jsx(ee,{variant:"ghost",onClick:r,children:u.academicAdmin.cancel})]})]})})}function vB(){const n=en(),[e,t]=E.useState(!1),[r,s]=E.useState(""),[i,a]=E.useState([]),[c,l]=E.useState(!0),d=fe({queryKey:["practice-tracks"],queryFn:()=>yo.list()}),m=fe({queryKey:["academic"],queryFn:()=>pt.get()}),p=E.useMemo(()=>{const b=m.data;return b?b.groups.filter(I=>!I.parentGroupId):[]},[m.data]),f=b=>a(I=>I.includes(b)?I.filter(N=>N!==b):[...I,b]),g=()=>{s(""),a([]),l(!0)},x=async b=>{await yo.delete(b),await n.invalidateQueries({queryKey:["practice-tracks"]})};return o.jsxs("div",{className:"mx-auto max-w-3xl",children:[o.jsx(tt,{title:u.tracks.adminTitle,subtitle:u.tracks.adminSubtitle}),e?o.jsxs(W,{className:"mb-6",children:[o.jsx(W7,{authorRole:"admin",groupIds:i,buildScope:()=>({level:r.trim()||void 0,publishedToFreePractice:c}),onSaved:()=>{g(),t(!1)},scopeSlot:o.jsxs("div",{className:"space-y-4 rounded-md bg-surface-sunken p-4",children:[o.jsx("p",{className:"text-xs text-text-muted",children:u.tracks.scopeHint}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.tracks.levelLabel}),o.jsx("input",{type:"text",value:r,onChange:b=>s(b.target.value),placeholder:u.tracks.levelPlaceholder,className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-text-secondary",children:u.tracks.assignGroups}),o.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(b=>{var V,D;const I=i.includes(b.id),N=((D=(V=m.data)==null?void 0:V.tracks.find(T=>T.id===b.trackId))==null?void 0:D.name)??"";return o.jsxs("button",{type:"button","aria-pressed":I,onClick:()=>f(b.id),className:`flex items-center gap-2 rounded-full border px-3 py-1 text-xs font-medium transition-colors ${I?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}
4080`,children:[o.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:b.color},"aria-hidden":!0}),b.name,o.jsx("span",{className:"opacity-60",children:N})]},b.id)})})]}),o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:c,onChange:b=>l(b.target.checked),className:"size-4 accent-[var(--color-primary)]"}),u.tracks.publish]})]})}),o.jsx("button",{onClick:()=>{g(),t(!1)},className:"mt-3 text-sm text-text-muted hover:text-primary",children:u.common.cancel})]}):o.jsxs(ee,{onClick:()=>t(!0),className:"mb-6",children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.tracks.newTrack]}),o.jsx("h2",{className:"mb-3 text-sm font-semibold text-text-secondary",children:u.tracks.existingTracks}),(d.data??[]).length===0?o.jsx(W,{className:"py-10 text-center text-sm text-text-muted",children:u.tracks.noTracks}):o.jsx("div",{className:"space-y-2",children:(d.data??[]).map(b=>o.jsxs(W,{className:"flex items-center gap-3 py-3",children:[o.jsx(Qi,{size:18,"aria-hidden":!0,className:"text-primary"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-semibold",children:b.title}),o.jsxs("p",{className:"text-xs text-text-muted",children:[X(u.tracks.trackCount,{n:b.exerciseIds.length}),b.groupIds.length>0?` · ${b.groupIds.length} קבוצות`:"",b.publishedToFreePractice?` · ${u.tracks.publishedBadge}`:""]})]}),o.jsx("button",{onClick:()=>void x(b.id),"aria-label":u.tracks.deleteTrack,className:"rounded p-1.5 text-text-muted hover:text-danger",children:o.jsx(Uh,{size:16,"aria-hidden":!0})})]},b.id))})]})}const Y7={pending:u.approvals.statusPending,approved:u.approvals.statusApproved,rejected:u.approvals.statusRejected,changes_requested:u.approvals.statusChanges},IB={pending:"bg-amber-500/10 text-amber-600",approved:"bg-green-500/10 text-green-600",rejected:"bg-red-500/10 text-red-600",changes_requested:"bg-blue-500/10 text-blue-600"},_B=["all","pending","approved","rejected","changes_requested"];function Q7({status:n}){return o.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-semibold ${IB[n]}`,children:Y7[n]})}function Ln({label:n,value:e}){return e?o.jsxs("div",{className:"flex justify-between gap-4 py-1 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:n}),o.jsx("span",{className:"text-end font-medium",children:e})]}):null}function kB({reg:n,trackName:e,groupName:t,onClose:r}){return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"dialog","aria-modal":"true","aria-label":u.approvals.detailTitle,onClick:r,children:o.jsxs(W,{className:"max-h-[85vh] w-full max-w-lg overflow-y-auto",onClick:s=>s.stopPropagation(),children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold",children:n.hebrewFullName}),o.jsx(Q7,{status:n.status})]}),o.jsx("button",{onClick:r,"aria-label":u.approvals.close,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-text",children:o.jsx(Xi,{size:18,"aria-hidden":!0})})]}),o.jsxs("section",{className:"mb-4",children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text-secondary",children:u.approvals.detailPersonal}),o.jsx(Ln,{label:u.approvals.colName,value:n.hebrewFullName}),o.jsx(Ln,{label:u.approvals.colPhone,value:n.phone}),o.jsx(Ln,{label:u.approvals.colEmail,value:n.email}),o.jsx(Ln,{label:u.approvals.colDate,value:mr(n.submittedAt)})]}),o.jsxs("section",{className:"mb-4",children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text-secondary",children:u.approvals.detailMusic}),o.jsx(Ln,{label:u.approvals.colInstrument,value:n.primaryInstrument}),o.jsx(Ln,{label:u.approvals.colInstrument,value:n.secondaryInstrument}),o.jsx(Ln,{label:u.approvals.detailMusic,value:n.musicalBackground}),o.jsx(Ln,{label:u.approvals.detailMusic,value:String(n.yearsExperience)}),o.jsx(Ln,{label:u.approvals.detailMusic,value:n.previousStudies})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"mb-1 text-sm font-semibold text-text-secondary",children:u.approvals.detailAcademic}),o.jsx(Ln,{label:u.approvals.colTrack,value:e}),o.jsx(Ln,{label:u.approvals.colGroup,value:t}),o.jsx(Ln,{label:u.approvals.detailAcademic,value:n.city}),o.jsx(Ln,{label:u.approvals.detailAcademic,value:n.notes})]}),o.jsx("div",{className:"mt-5 flex justify-end",children:o.jsx(ee,{variant:"ghost",onClick:r,children:u.approvals.close})})]})})}function wB(){var Ee;
4080const n=((Ee=Be(Y=>Y.session))==null?void 0:Ee.user.id)??"",e=en(),t=fe({queryKey:["registrations"],queryFn:()=>Ts.list()}),r=fe({queryKey:["academic"],queryFn:()=>pt.get()}),[s,i]=E.useState(""),[a,c]=E.useState("all"),[l,d]=E.useState("newest"),[m,p]=E.useState(new Set),[f,g]=E.useState(null),[x,b]=E.useState(null),I=Y=>{b(Y),window.setTimeout(()=>b(null),3500)},N=()=>{e.invalidateQueries({queryKey:["registrations"]}),e.invalidateQueries({queryKey:["academic"]}),e.invalidateQueries({queryKey:["notifications"]})},V=Y=>{var xe,Ae;return((Ae=(xe=r.data)==null?void 0:xe.tracks.find(Ze=>Ze.id===Y))==null?void 0:Ae.name)??Y},D=Y=>{var xe,Ae;return((Ae=(xe=r.data)==null?void 0:xe.groups.find(Ze=>Ze.id===Y))==null?void 0:Ae.name)??Y},T=t.data??[],M=E.useMemo(()=>{const Y=s.trim().toLowerCase(),Ae=[...T.filter(Ze=>a!=="all"&&Ze.status!==a?!1:Y?Ze.hebrewFullName.toLowerCase().includes(Y)||Ze.email.toLowerCase().includes(Y)||Ze.phone.toLowerCase().includes(Y):!0)];return Ae.sort((Ze,Yt)=>{if(l==="name")return Ze.hebrewFullName.localeCompare(Yt.hebrewFullName,"he");const hs=Ze.submittedAt.localeCompare(Yt.submittedAt);return l==="oldest"?hs:-hs}),Ae},[T,s,a,l]),R=E.useMemo(()=>T.filter(Y=>Y.status==="pending"),[T]),_=M.map(Y=>Y.id),j=_.filter(Y=>m.has(Y)),w=_.length>0&&j.length===_.length,A=Y=>{p(xe=>{const Ae=new Set(xe);return Ae.has(Y)?Ae.delete(Y):Ae.add(Y),Ae})},O=()=>{p(Y=>{const xe=new Set(Y);return w?_.forEach(Ae=>xe.delete(Ae)):_.forEach(Ae=>xe.add(Ae)),xe})},C=Y=>Y==="pending"||Y==="changes_requested",S=lt({mutationFn:Y=>Ts.approve(Y,n),onSuccess:()=>{N(),I(u.approvals.approvedOneToast)}}),z=lt({mutationFn:Y=>Ts.reject(Y,n),onSuccess:()=>{N(),I(X(u.approvals.rejectedToast,{n:1}))}}),re=lt({mutationFn:({id:Y,note:xe})=>Ts.requestChanges(Y,n,xe),onSuccess:()=>N()}),ne=lt({mutationFn:Y=>Ts.approveMany(Y,n),onSuccess:Y=>{N(),p(new Set),I(X(u.approvals.approvedToast,{n:Y}))}}),ve=lt({mutationFn:Y=>Ts.rejectMany(Y,n),onSuccess:Y=>{N(),p(new Set),I(X(u.approvals.rejectedToast,{n:Y}))}}),$=Y=>{window.confirm(u.approvals.reject)&&z.mutate(Y)},oe=Y=>{const xe=window.prompt(u.approvals.reviewNotePrompt);xe!==null&&re.mutate({id:Y,note:xe})},ie=f?T.find(Y=>Y.id===f):void 0,Ie="rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary";return o.jsxs("div",{children:[o.jsx(tt,{title:u.approvals.title,subtitle:u.approvals.subtitle}),x?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:x}):null,o.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[o.jsx("input",{type:"search",value:s,onChange:Y=>i(Y.target.value),placeholder:u.approvals.search,"aria-label":u.approvals.search,className:"min-w-[16rem] flex-1 rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"}),o.jsx("label",{className:"sr-only",htmlFor:"approvals-status",children:u.approvals.filterStatus}),o.jsx("select",{id:"approvals-status",value:a,onChange:Y=>c(Y.target.value),"aria-label":u.approvals.filterStatus,className:Ie,children:_B.map(Y=>o.jsx("option",{value:Y,children:Y==="all"?u.approvals.all:Y7[Y]},Y))}),o.jsx("label",{className:"sr-only",htmlFor:"approvals-sort",children:u.approvals.sortBy}),o.jsxs("select",{id:"approvals-sort",value:l,onChange:Y=>d(Y.target.value),"aria-label":u.approvals.sortBy,className:Ie,children:[o.jsx("option",{value:"newest",children:u.approvals.sortNewest}),o.jsx("option",{value:"oldest",children:u.approvals.sortOldest}),o.jsx("option",{value:"name",children:u.approvals.sortName})]})]}),o.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[j.length>0?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm font-medium text-text-secondary",children:X(u.approvals.selectedCount,{n:j.length})}),o.jsxs(ee,{onClick:()=>ne.mutate(j),children:[o.jsx(Us,{size:15,"aria-hidden":!0}),u.approvals.approveSelected]}),o.jsxs(ee,{variant:"soft",onClick:()=>ve.mutate(j),children:[o.jsx(Xi,{size:15,"aria-hidden":!0}),u.approvals.rejectSelected]}),o.jsx("span",{className:"mx-1 h-5 w-px bg-border","aria-hidden":!0})]}):null,o.jsxs(ee,{variant:"ghost",disabled:R.length===0,onClick:()=>ne.mutate(R.map(Y=>Y.id)),children:[o.jsx(Us,{size:15,"aria-hidden":!0}),u.approvals.approveAll]}),o.jsxs(ee,{variant:"ghost",disabled:R.length===0,onClick:()=>Hh("shirat-pending-registrations.json",R),children:[o.jsx(c7,{size:15,"aria-hidden":!0}),u.approvals.exportPending]})]}),t.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):M.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.approvals.empty}):o.jsx(W,{className:"overflow-x-auto p-0",children:o.jsxs("table",{className:"w-full text-start text-sm",children:[o.jsx("thead",{className:"border-b border-border text-text-secondary",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-3 py-3",children:o.jsx("input",{type:"checkbox",checked:w,onChange:O,"aria-label":u.approvals.all})}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colName}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colPhone}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colEmail}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colInstrument}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colTrack}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colGroup}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colDate}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold",children:u.approvals.colStatus}),o.jsx("th",{className:"px-3 py-3 text-start font-semibold","aria-label":u.approvals.viewDetails})]})}),o.jsx("tbody",{className:"divide-y divide-border",children:M.map(Y=>{const xe=C(Y.status);return o.jsxs("tr",{className:"hover:bg-surface-sunken/50",children:[o.jsx("td",{className:"px-3 py-3",children:o.jsx("input",{type:"checkbox",checked:m.has(Y.id),onChange:()=>A(Y.id),"aria-label":X(u.approvals.selectedCount,{n:1})+" "+Y.hebrewFullName})}),o.jsx("td",{className:"px-3 py-3 font-medium",children:Y.hebrewFullName}),o.jsx("td",{className:"px-3 py-3 text-text-secondary",children:Y.phone}),o.jsx("td",{className:"px-3 py-3 text-text-secondary",children:Y.email}),o.jsx("td",{className:"px-3 py-3 text-text-secondary",children:Y.primaryInstrument}),o.jsx("td",{className:"px-3 py-3 text-text-secondary",children:V(Y.trackId)}),o.jsx("td",{className:"px-3 py-3 text-text-secondary",children:D(Y.groupId)}),o.jsx("td",{className:"px-3 py-3 whitespace-nowrap text-text-secondary",children:mr(Y.submittedAt)}),o.jsx("td",{className:"px-3 py-3",children:o.jsx(Q7,{status:Y.status})}),o.jsx("td",{className:"px-3 py-3",children:o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[o.jsx("button",{onClick:()=>S.mutate(Y.id),disabled:!xe,"aria-label":u.approvals.approve,title:u.approvals.approve,className:"rounded-md p-2 text-text-muted hover:bg-green-500/10 hover:text-green-600 disabled:pointer-events-none disabled:opacity-40",children:o.jsx(Us,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>$(Y.id),disabled:!xe,"aria-label":u.approvals.reject,title:u.approvals.reject,className:"rounded-md p-2 text-text-muted hover:bg-red-500/10 hover:text-red-600 disabled:pointer-events-none disabled:opacity-40",children:o.jsx(Xi,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>oe(Y.id),disabled:!xe,"aria-label":u.approvals.requestChanges,title:u.approvals.requestChanges,className:"rounded-md p-2 text-text-muted hover:bg-blue-500/10 hover:text-blue-600 disabled:pointer-events-none disabled:opacity-40",children:o.jsx(Cq,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>g(Y.id),"aria-label":u.approvals.viewDetails,title:u.approvals.viewDetails,className:"rounded-md px-2 py-1 text-xs font-semibold text-primary hover:bg-primary-soft",children:u.approvals.viewDetails})]})})]},Y.id)})})]})}),ie?o.jsx(kB,{reg:ie,trackName:V(ie.trackId),groupName:D(ie.groupId),onClose:()=>g(null)}):null]})}function jB(){var g,x;const n=en(),e=fe({queryKey:["academic"],queryFn:()=>pt.get()}),[t,r]=E.useState(null),[s,i]=E.useState(""),[a,c]=E.useState(null),l=((g=e.data)==null?void 0:g.groups)??[],d=((x=e.data)==null?void 0:x.tracks)??[],m=E.useMemo(()=>s.split(`
4081`).map(b=>b.trim()).filter(b=>b.length>0),[s]),p=lt({mutationFn:b=>YL.importToGroup(b.groupId,b.names),onSuccess:({created:b})=>{n.invalidateQueries({queryKey:["academic"]}),n.invalidateQueries({queryKey:["teacher-students"]}),n.invalidateQueries({queryKey:["students"]}),c(X(u.studentImport.successBanner,{n:b})),i("")}}),f=!!t&&m.length>0&&!p.isPending;return o.jsxs("div",{children:[o.jsx(tt,{title:u.studentImport.title,subtitle:u.studentImport.subtitle}),a?o.jsx("div",{role:"status",className:"mb-4 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:a}):null,o.jsxs(W,{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"mb-2 text-sm font-medium text-text-secondary",children:u.studentImport.pickGroup}),!e.isPending&&l.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:u.studentImport.noGroups}):o.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(b=>{var I;return o.jsxs("button",{type:"button","aria-pressed":t===b.id,onClick:()=>r(b.id),className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors ${t===b.id?"border-primary bg-primary text-on-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:b.color},"aria-hidden":!0}),b.name,o.jsx("span",{className:"text-xs font-normal opacity-70",children:((I=d.find(N=>N.id===b.trackId))==null?void 0:I.name)??""})]},b.id)})})]}),o.jsxs("div",{children:[o.jsx("label",{htmlFor:"import-names",className:"mb-2 block text-sm font-medium text-text-secondary",children:u.studentImport.namesLabel}),o.jsx("textarea",{id:"import-names",value:s,onChange:b=>i(b.target.value),rows:10,placeholder:u.studentImport.namesPlaceholder,className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:X(u.studentImport.lineCount,{n:m.length})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsxs(ee,{disabled:!f,onClick:()=>t&&p.mutate({groupId:t,names:m}),children:[o.jsx(pg,{size:15,"aria-hidden":!0}),p.isPending?u.studentImport.importing:u.studentImport.importButton]})})]})]})}function TB(){const n=en(),e=fe({queryKey:["academic"],queryFn:()=>pt.get()}),t=e.data,[r,s]=E.useState(null),[i,a]=E.useState(null),[c,l]=E.useState(null),d=()=>n.invalidateQueries({queryKey:["academic"]}),m=b=>{l(b),window.setTimeout(()=>l(null),2500)},p=lt({mutationFn:b=>pt.createTeacher({name:b.name,subjects:b.subjects,...b.email?{email:b.email}:{},...b.phone?{phone:b.phone}:{},canAuthor:b.canAuthor}),onSuccess:()=>{s(null),m(u.teachersAdmin.createdToast),d()}}),f=lt({mutationFn:b=>pt.saveTeacher(b),onSuccess:()=>{s(null),m(u.teachersAdmin.savedToast),d()}}),g=lt({mutationFn:({teacherId:b,groupIds:I})=>pt.assignTeacherToGroups(b,I),onSuccess:()=>{a(null),m(u.teachersAdmin.savedToast),d()}}),x=(t==null?void 0:t.teachers)??[];return o.jsxs("div",{children:[o.jsx(tt,{title:u.teachersAdmin.title,subtitle:u.teachersAdmin.subtitle,actions:o.jsxs(ee,{onClick:()=>s("new"),children:[o.jsx(Zi,{size:15,"aria-hidden":!0}),u.teachersAdmin.addTeacher]})}),c?o.jsxs("div",{role:"status",className:"mb-4 flex items-center gap-2 rounded-md bg-primary-soft px-4 py-2.5 text-sm font-medium text-primary",children:[o.jsx(Xn,{size:16,"aria-hidden":!0}),c]}
4081):null,r?o.jsx(EB,{initial:r==="new"?null:r,pending:p.isPending||f.isPending,onCancel:()=>s(null),onSubmit:b=>{r==="new"?p.mutate(b):f.mutate({...r,name:b.name,subjects:b.subjects,...b.email?{email:b.email}:{},...b.phone?{phone:b.phone}:{},...b.canAuthor?{canAuthor:!0}:{canAuthor:!1}})}}):null,e.isPending?o.jsx("p",{className:"text-sm text-text-muted",children:u.common.loading}):x.length===0?o.jsx(W,{className:"py-12 text-center text-sm text-text-muted",children:u.teachersAdmin.empty}):o.jsx("div",{className:"space-y-3",children:x.map(b=>{const I=t?bS(t,b.id):[],N=b.active===!1;return o.jsxs(W,{className:`p-4 ${N?"opacity-60":""}`,children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(as,{size:18,"aria-hidden":!0})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"font-semibold",children:b.name}),o.jsx("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-semibold ${N?"bg-surface-sunken text-text-muted":"bg-success/10 text-success"}`,children:N?u.teachersAdmin.statusInactive:u.teachersAdmin.statusActive}),b.canAuthor?o.jsx("span",{className:"rounded-full bg-accent/15 px-2 py-0.5 text-[11px] font-semibold text-accent",children:u.teachersAdmin.canAuthor}):null]}),b.subjects.length>0?o.jsx("p",{className:"text-xs text-text-muted",children:b.subjects.join(" · ")}):null,o.jsxs("p",{className:"mt-0.5 text-xs text-text-secondary",children:[u.teachersAdmin.groupsLabel,":"," ",I.length>0?I.map(V=>V.name).join(" · "):u.teachersAdmin.noGroups]})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>a(b.id),"aria-label":u.teachersAdmin.assignGroupsTitle,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-primary",children:o.jsx(Lr,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>s(b),"aria-label":u.teachersAdmin.editTeacher,className:"rounded-md p-2 text-text-muted hover:bg-surface-sunken hover:text-primary",children:o.jsx(hg,{size:16,"aria-hidden":!0})}),o.jsx("button",{onClick:()=>{N?f.mutate({...b,active:!0}):window.confirm(X(u.teachersAdmin.deactivateConfirm,{name:b.name}))&&f.mutate({...b,active:!1})},"aria-label":N?u.teachersAdmin.reactivate:u.teachersAdmin.deactivate,className:`rounded-md p-2 hover:bg-surface-sunken ${N?"text-text-muted hover:text-success":"text-text-muted hover:text-danger"}`,children:o.jsx(Vq,{size:16,"aria-hidden":!0})})]})]}),i===b.id&&t?o.jsx(NB,{groups:t.groups,tracks:t.tracks,assigned:t.groups.filter(V=>V.teacherIds.includes(b.id)).map(V=>V.id),pending:g.isPending,onCancel:()=>a(null),onSave:V=>g.mutate({teacherId:b.id,groupIds:V})}):null]},b.id)})})]})}function EB({initial:n,pending:e,onSubmit:t,onCancel:r}){const[s,i]=E.useState((n==null?void 0:n.name)??""),[a,c]=E.useState((n==null?void 0:n.subjects)??[]),[l,d]=E.useState((n==null?void 0:n.email)??""),[m,p]=E.useState((n==null?void 0:n.phone)??""),[f,g]=E.useState((n==null?void 0:n.canAuthor)??!1),x=I=>c(N=>N.includes(I)?N.filter(V=>V!==I):[...N,I]),b=s.trim().length>0;return o.jsxs(W,{className:"mb-4 space-y-4 border-primary/40",children:[o.jsx("h2",{className:"font-bold",children:n?u.teachersAdmin.editTeacher:u.teachersAdmin.addTeacher}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.teachersAdmin.nameLabel}),o.jsx("input",{value:s,onChange:I=>i(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.teachersAdmin.subjectsLabel}),o.jsx("p",{className:"mb-2 text-xs text-text-muted",children:u.teachersAdmin.subjectsHint}),o.jsx("div",{className:"flex flex-wrap gap-2",children:u.teachersAdmin.subjectSuggestions.map(I=>{const N=a.includes(I);return o.jsx("button",{type:"button","aria-pressed":N,onClick:()=>x(I),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${N?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:I},I)})})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.teachersAdmin.emailLabel}
4081),o.jsx("input",{type:"email",dir:"ltr",value:l,onChange:I=>d(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm font-medium text-text-secondary",children:u.teachersAdmin.phoneLabel}),o.jsx("input",{dir:"ltr",value:m,onChange:I=>p(I.target.value),className:"w-full rounded-md border border-border bg-surface px-3 py-2 text-sm focus:border-primary"})]})]}),o.jsxs("label",{className:"flex items-start gap-2.5",children:[o.jsx("input",{type:"checkbox",checked:f,onChange:I=>g(I.target.checked),className:"mt-0.5 size-4 accent-[var(--color-primary)]"}),o.jsxs("span",{children:[o.jsx("span",{className:"block text-sm font-medium",children:u.teachersAdmin.canAuthor}),o.jsx("span",{className:"block text-xs text-text-muted",children:u.teachersAdmin.canAuthorHint})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ee,{onClick:()=>t({name:s.trim(),subjects:a,email:l.trim(),phone:m.trim(),canAuthor:f}),disabled:!b||e,children:u.teachersAdmin.save}),o.jsx(ee,{variant:"ghost",onClick:r,children:u.teachersAdmin.cancel})]})]})}function NB({groups:n,tracks:e,assigned:t,pending:r,onSave:s,onCancel:i}){const[a,c]=E.useState(t),l=m=>c(p=>p.includes(m)?p.filter(f=>f!==m):[...p,m]),d=E.useMemo(()=>e.map(m=>({track:m,groups:n.filter(p=>p.trackId===m.id)})),[e,n]);return o.jsxs("div",{className:"mt-4 border-t border-border pt-4",children:[o.jsx("p",{className:"mb-1 text-sm font-semibold",children:u.teachersAdmin.assignGroupsTitle}),o.jsx("p",{className:"mb-3 text-xs text-text-muted",children:u.teachersAdmin.assignGroupsHint}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:d.map(({track:m,groups:p})=>o.jsxs("div",{children:[o.jsx("p",{className:"mb-1.5 text-xs font-semibold text-text-secondary",children:m.name}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(f=>{const g=a.includes(f.id);return o.jsxs("button",{type:"button","aria-pressed":g,onClick:()=>l(f.id),className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${g?"border-primary bg-primary-soft text-primary":"border-border text-text-secondary hover:border-border-strong"}`,children:[o.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:f.color},"aria-hidden":!0}),f.name]},f.id)})})]},m.id))}),o.jsxs("div",{className:"mt-4 flex gap-2",children:[o.jsx(ee,{onClick:()=>s(a),disabled:r,children:u.teachersAdmin.save}),o.jsx(ee,{variant:"ghost",onClick:i,children:u.teachersAdmin.cancel})]})]})}function SB(){const n=[{to:"/admin/groups",icon:lg,label:u.nav.admin.groups},{to:"/admin/students",icon:Lr,label:u.nav.admin.students},{to:"/admin/permissions",icon:g7,label:u.nav.admin.permissions},{to:"/admin/library",icon:h7,label:u.nav.admin.library},{to:"/admin/analytics",icon:Ji,label:u.nav.admin.analytics}];return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.admin.dashboard,subtitle:u.admin.homeSubtitle}),o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:n.map(e=>o.jsx(un,{to:e.to,children:o.jsxs(W,{className:"flex h-full flex-col items-center gap-2.5 py-6 text-center hover:shadow-hover",children:[o.jsx("span",{className:"flex size-11 items-center justify-center rounded-lg bg-primary-soft text-primary",children:o.jsx(e.icon,{size:20,"aria-hidden":!0})}),o.jsx("span",{className:"text-sm font-semibold",children:e.label})]})},e.to))})]})}function AB(){const n=["musician","teacher","content_author","admin"],e=[["musician","teacher","content_author","admin"],["teacher","admin"],["teacher","admin"],["content_author","admin"],["content_author","admin"],["admin"]],t=u.admin.permissionRows.map((r,s)=>({label:r,allowed:e[s]??[]}));return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.admin.permissions,subtitle:u.admin.permissionsSubtitle}),o.jsx(W,{className:"overflow-x-auto p-0",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-border text-start",children:[o.jsx("th",{className:"px-4 py-3 text-start font-semibold",children:" "}),n.map(r=>o.jsx("th",{className:"px-4 py-3 text-center font-semibold",children:u.roles[r]},r))]})}),o.jsx("tbody",{className:"divide-y divide-border",children:t.map(r=>o.jsxs("tr",{children:[o.jsx("td",{className:"px-4 py-3",children:r.label}),n.map(s=>o.jsx("td",{className:"px-4 py-3 text-center",children:r.allowed.includes(s)?o.jsx("span",{className:"font-bold text-success",children:u.admin.permCan}):o.jsx("span",{className:"text-text-muted",children:u.admin.permCant})},s))]},r.label))})]})})]})}const Ix=u.admin.knowledgeKinds;function CB(){const n=Object.keys(Ix),e=Vt().length,t=E.useRef(null),[r,s]=E.useState(null),i=async a=>{try{const c=await Wh(a),l=Vt(),d=Ej(c,l.map(g=>g.id)),m=d.issues.filter(g=>g.level==="error").map(g=>g.message),p=d.issues.filter(g=>g.level==="warning").map(g=>g.message),f=d.document?Sj(l,d.document.entities):null;s({ok:d.ok,errors:m,warnings:p,plan:f})}catch{s({ok:!1,errors:[u.admin.importRowsFailed],warnings:[],plan:null})}};return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.studio.knowledge,subtitle:`${u.admin.knowledgeSubtitle} · ${X(u.admin.knowledgeCount,{n:e})}`,actions:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("input",{ref:t,type:"file",accept:"application/json",className:"hidden","aria-label":u.admin.knowledgeImport,onChange:a=>{var l;const c=(l=a.target.files)==null?void 0:l[0];c&&i(c),a.target.value=""}}),o.jsxs(ee,{variant:"ghost",onClick:()=>{var a;return(a=t.current)==null?void 0:a.click()},children:[o.jsx(zl,{size:15,"aria-hidden":!0}),u.admin.knowledgeImport]}),o.jsx("button",{onClick:()=>Hh("shirat-knowledge.json",Vt()),className:"rounded-md border border-border px-3.5 py-2 text-sm font-medium text-text-secondary hover:border-primary hover:text-primary",children:u.admin.exportJson})]})}),r?o.jsxs(W,{className:`mb-6 ${r.ok?"":"border-danger/40"}`,children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[o.jsx("h2",{className:"font-bold",children:u.admin.knowledgeImportTitle}),o.jsx("button",{onClick:()=>s(null),"aria-label":u.admin.cancel,className:"text-sm text-text-muted hover:text-text",children:"✕"})]}),o.jsx("p",{className:"mb-3 text-xs text-text-muted",children:u.admin.knowledgeImportHint}),r.ok&&r.plan?o.jsxs("p",{className:"text-sm font-medium text-success",children:[X(u.admin.knowledgeImportReady,{adds:r.plan.adds.length,updates:r.plan.updates.length,unchanged:r.plan.unchangedCount}),r.plan.conflicts.length>0?` · ${X(u.admin.knowledgeImportConflicts,{n:r.plan.conflicts.length})}`:""]}):o.jsxs("div",{className:"text-sm font-medium text-danger",children:[X(u.admin.knowledgeImportErrors,{n:r.errors.length}),o.jsx("ul",{className:"mt-1.5 list-disc space-y-0.5 ps-5 text-xs font-normal text-text-secondary",children:r.errors.slice(0,8).map((a,c)=>o.jsx("li",{children:a},c))})]}),r.warnings.length>0?o.jsx("p",{className:"mt-2 text-xs text-accent",children:X(u.admin.knowledgeImportWarnings,{n:r.warnings.length})}):null]}):null,o.jsx("div",{className:"space-y-6",children:n.map(a=>{const c=Vt(a);return c.length===0?null:o.jsxs("section",{children:[o.jsxs("h2",{className:"mb-2 text-sm font-semibold text-text-secondary",children:[Ix[a]," (",c.length,")"]}),o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:c.map(l=>{const d=Aj(l.id);return o.jsxs(W,{className:"p-3.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-sm font-semibold",children:qe(l)}),l.symbol?o.jsx("span",{dir:"ltr",className:"rounded bg-surface-sunken px-1.5 py-0.5 text-xs font-mono text-text-secondary",children:l.symbol}):null]}),o.jsx("p",{className:"mt-0.5 text-xs text-text-muted",children:l.name.en}),d.length>0?o.jsxs("p",{className:"mt-1.5 text-xs text-text-muted",children:[u.admin.relationsLabel,": ",d.map(m=>qe(m.object)).join(" · ")]}):null]},l.id)})})]},a)})})]})}function MB(){const n=fe({queryKey:["teacher-students"],queryFn:()=>Vl.listStudents()}),e=fe({queryKey:["activities"],queryFn:()=>gt.listActivities()}),t=fe({queryKey:["authored-activities"],queryFn:()=>Ua.listAuthored()}),r=fe({queryKey:["lessons"],queryFn:()=>Oo.list()}),s=n.data??[],i=[{label:u.admin.statStudents,value:String(s.length)},{label:u.admin.statWeeklyMinutes,value:Zt(s.reduce((a,c)=>a+c.weeklyMinutes,0))},{label:u.admin.statActiveThisWeek,value:`${s.filter(a=>a.weeklyMinutes>0).length}/${s.length}`},{label:u.admin.statActivities,value:String((e.data??[]).length)},{label:u.admin.statPublished,value:String((t.data??[]).filter(a=>a.status==="published").length)},{label:u.admin.statLessons,value:String((r.data??[]).length)}];return o.jsxs("div",{children:[o.jsx(tt,{title:u.nav.admin.analytics,subtitle:u.admin.analyticsSubtitle}),o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:i.map(a=>o.jsxs(W,{className:"py-5 text-center",children:[o.jsx("p",{className:"text-3xl font-bold text-primary",children:a.value}),o.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a.label})]},a.label))})]})}const us=C_({component:jx}),PB=Se({getParentRoute:()=>us,path:"/",beforeLoad:()=>{const n=Be.getState().session;throw n&&qh(n.user)?Kr({to:"/change-password"}):Kr({to:n?Yr(n.activeRole):"/login"})}}),RB=Se({getParentRoute:()=>us,path:"/login",beforeLoad:()=>{const n=Be.getState().session;if(n&&qh(n.user))throw Kr({to:"/change-password"});if(n)throw Kr({to:Yr(n.activeRole)})},component:Hq}),OB=Se({getParentRoute:()=>us,path:"/change-password",beforeLoad:()=>{const n=Be.getState().session;if(!n)throw Kr({to:"/login"});if(!qh(n.user))throw Kr({to:Yr(n.activeRole)})},component:Wq}),DB=Se({getParentRoute:()=>us,path:"/register",component:Jq});function Jh(n){return()=>{const e=Be.getState().session;if(!e)throw Kr({to:"/login"});if(qh(e.user))throw Kr({to:"/change-password"});if(!e.user.roles.includes(n))throw Kr({to:Yr(e.activeRole)});e.activeRole!==n&&Be.setState({session:{...e,activeRole:n}})}}const Ot=Se({getParentRoute:()=>us,id:"student-layout",beforeLoad:Jh("musician"),component:Kh}),Fr=Se({getParentRoute:()=>us,id:"teacher-layout",beforeLoad:Jh("teacher"),component:Kh}),nr=Se({getParentRoute:()=>us,id:"admin-layout",beforeLoad:Jh("admin"),component:Kh}),ws=Se({getParentRoute:()=>us,id:"studio-layout",beforeLoad:Jh("content_author"),component:Kh});function VB(n,e,t){return Se({getParentRoute:()=>n,path:e,component:()=>o.jsx(Gq,{title:t})})}const LB=us.addChildren([PB,RB,OB,DB,Ot.addChildren([Se({getParentRoute:()=>Ot,path:"/student",component:mF}),Se({getParentRoute:()=>Ot,path:"/student/practice",component:gF}),Se({getParentRoute:()=>Ot,path:"/student/practice/session",component:yF}),Se({getParentRoute:()=>Ot,path:"/student/courses",component:t$}),Se({getParentRoute:()=>Ot,path:"/student/courses/$groupId",component:d$}),Se({getParentRoute:()=>Ot,path:"/student/learn",component:A$}),Se({getParentRoute:()=>Ot,path:"/student/learn/course/$courseId",component:C$}),Se({getParentRoute:()=>Ot,path:"/student/learn/lesson/$lessonId",component:R$}),Se({getParentRoute:()=>Ot,path:"/student/curriculum",component:V$}),Se({getParentRoute:()=>Ot,path:"/student/curriculum/domain/$domain",component:F$}),Se({getParentRoute:()=>Ot,path:"/student/curriculum/course/$courseId",component:$$}),Se({getParentRoute:()=>Ot,path:"/student/curriculum/course/$courseId/topic/$conceptId",component:U$}),Se({getParentRoute:()=>Ot,path:"/student/journey",component:G$}),Se({getParentRoute:()=>Ot,path:"/student/history",component:xF}),Se({getParentRoute:()=>Ot,path:"/student/goals",component:Q$}),Se({getParentRoute:()=>Ot,path:"/student/progress",component:sB}),Se({getParentRoute:()=>Ot,path:"/student/profile",component:cB}),Se({getParentRoute:()=>Ot,path:"/student/notifications",component:aB}),Se({getParentRoute:()=>Ot,path:"/student/settings",component:dB})]),Fr.addChildren([Se({getParentRoute:()=>Fr,path:"/teacher",component:W$}),Se({getParentRoute:()=>Fr,path:"/teacher/capture",component:Z$}),Se({getParentRoute:()=>Fr,path:"/teacher/homework",component:J$}),Se({getParentRoute:()=>Fr,path:"/teacher/students",component:tB}),Se({getParentRoute:()=>Fr,path:"/teacher/students/$studentId",component:nB}),Se({getParentRoute:()=>Fr,path:"/teacher/assignment",component:X$}),Se({getParentRoute:()=>Fr,path:"/teacher/announce",component:eB}),Se({getParentRoute:()=>Fr,path:"/teacher/content",component:()=>o.jsx(dc,{title:u.nav.teacher.content})})]),nr.addChildren([Se({getParentRoute:()=>nr,path:"/admin",component:SB}),Se({getParentRoute:()=>nr,path:"/admin/approvals",component:wB}),Se({getParentRoute:()=>nr,path:"/admin/groups",component:gB}),Se({getParentRoute:()=>nr,path:"/admin/teachers",component:TB}),Se({getParentRoute:()=>nr,path:"/admin/students",component:()=>o.jsx(mB,{config:pB})}),Se({getParentRoute:()=>nr,path:"/admin/student-import",component:jB}),Se({getParentRoute:()=>nr,path:"/admin/practice-tracks",component:vB}),Se({getParentRoute:()=>nr,path:"/admin/permissions",component:AB}),Se({getParentRoute:()=>nr,path:"/admin/library",component:()=>o.jsx(dc,{title:u.nav.admin.library})}),Se({getParentRoute:()=>nr,path:"/admin/analytics",component:MB})]),ws.addChildren([VB(ws,"/studio",u.nav.studio.dashboard),Se({getParentRoute:()=>ws,path:"/studio/activities",component:HF}),Se({getParentRoute:()=>ws,path:"/studio/activities/$activityId",component:WF}),Se({getParentRoute:()=>ws,path:"/studio/audio",component:()=>o.jsx(dc,{title:u.nav.studio.audio,kinds:["audio","midi"]})}),Se({getParentRoute:()=>ws,path:"/studio/scores",component:()=>o.jsx(dc,{title:u.nav.studio.scores,kinds:["musicxml","pdf"]})}),Se({getParentRoute:()=>ws,path:"/studio/attachments",component:()=>o.jsx(dc,{title:u.nav.studio.attachments})}),Se({getParentRoute:()=>ws,path:"/studio/knowledge",component:CB})])]),qB=M_({routeTree:LB});
4081class zB extends E.Component{constructor(){super(...arguments);L(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){console.error("[ErrorBoundary]",t,r.componentStack)}render(){return this.state.error?o.jsx("div",{dir:"rtl",className:"flex min-h-dvh flex-col items-center justify-center gap-4 bg-bg px-6 text-center",children:o.jsxs("div",{className:"w-full max-w-md rounded-2xl bg-surface p-8 shadow-raised",children:[o.jsx("div",{className:"mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-danger/10 text-2xl",children:"😕"}),o.jsx("h1",{className:"mb-2 text-xl font-bold",children:u.errorBoundary.title}),o.jsx("p",{className:"mb-6 text-sm text-text-secondary",children:u.errorBoundary.body}),o.jsxs("div",{className:"flex justify-center gap-3",children:[o.jsx("button",{onClick:()=>window.location.reload(),className:"rounded-md bg-primary px-5 py-2.5 text-sm font-semibold text-on-primary transition-colors hover:bg-primary-hover",children:u.errorBoundary.reload}),o.jsx("button",{onClick:()=>{window.location.href="/"},className:"rounded-md border border-border px-5 py-2.5 text-sm font-semibold text-text-secondary transition-colors hover:border-border-strong",children:u.errorBoundary.home})]})]})}):this.props.children}}const Z7=new P_({defaultOptions:{queries:{staleTime:3e4,retry:1}}}),J7=document.getElementById("root");if(!J7)throw new Error("Missing #root element");function FB(){V_.createRoot(J7).render(o.jsx(E.StrictMode,{children:o.jsx(zB,{children:o.jsx(R_,{client:Z7,children:o.jsx(O_,{router:qB})})})}))}VL().then(async n=>{n&&(await UL(),await eq(e=>e.forEach(t=>Z7.invalidateQueries({queryKey:t}))))}).catch(()=>{}).finally(FB);

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.