PageSourceSearch

https://robwaterhouse.com/assets/FeaturedSgmWidgetHeader-Bs5pMGp9.js

js robwaterhouse.com collected 2026-10-06 21:20:34 UTC 1,017,367 bytes, 79 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/abandon-mh7Y1i2e.js","assets/client-Bai4VJA1.js","assets/account-BsVpFIrY.js","assets/account-circle-H12tK_Ll.js","assets/account-created-CaPfpwZF.js","assets/account-created-fail-CqlnDxkW.js","assets/account-deposit-B-if16sl.js","assets/account-deposit-tick-STZ9T3GJ.js","assets/account-promo-CGm6MU0E.js","assets/add-D9ceYsya.js","assets/age-restriction-CaqgKc_G.js","assets/app-store-VXCRm7E8.js","assets/attention-BBhAaYTx.js","assets/account-BAlIlHkt.js","assets/bonus-BsExbF_c.js","assets/bonus-active-pLp2uH9Q.js","assets/bonus-disabled-BLeJx1DI.js","assets/boost-DNKedkuD.js","assets/boost-active-BNONXkes.js","assets/boost-disabled-8t319T6G.js","assets/deposit-match-C2j5Qibp.js","assets/deposit-match-disabled-C23cqJza.js","assets/fixed-h4allssJ.js","assets/gt-CKr6Zq7a.js","assets/gt-dark-CFip_VjC.js","assets/gt-light-y-q5AOH3.js","assets/money-back-BHhV5VTb.js","assets/money-back-active-DcZDXHH8.js","assets/money-back-disabled-BC5IRZ-H.js","assets/new-CXWDlqqb.js","assets/promo-taElSj0X.js","assets/sgm-YlRr39Xb.js","assets/srm-BuZnKjc5.js","assets/bank-BvRR85Rs.js","assets/bet-and-watch-DM5VPRSE.js","assets/bet-referral-B1ynS3gC.js","assets/betslip-CFwDb9iv.js","assets/betstop-DcUPIRrn.js","assets/bin-EB92zIZ7.js","assets/bm-small-DSrJULrB.js","assets/bo-grp-Bkx6Mxt3.js","assets/bulk-BUZ5aFnu.js","assets/calendar-jsoeAUXG.js","assets/prism-off-Biec_XbA.js","assets/wire-off-DorAahwS.js","assets/wire-on-B1slyg8h.js","assets/down-C9f2sIjC.js","assets/right-pI0CuYD9.js","assets/up-Ct3AvMGi.js","assets/down-D1_3ShEC.js","assets/up-1I_iFOV_.js","assets/up-down-BS8wmVzG.js","assets/cash-BI3zFbBS.js","assets/chat-Kp52pkaA.js","assets/down-DKAbPloZ.js","assets/down-bold-B7sLHgsp.js","assets/left-RSyE1Z5k.js","assets/left-bold-CqOYwQov.js","assets/left-double-DGiU24VR.js","assets/right-DNfzBBDn.js","assets/right-bold-DB-44Ldz.js","assets/right-double-B8kZrAYh.js","assets/up-cXUyJ1hZ.js","assets/up-bold-4rv8hbYS.js","assets/clear-CtXpVFp-.js","assets/clear-circle-BcOh9Swb.js","assets/clock-DRIPm6gZ.js","assets/close-CZ9XJK4G.js","assets/coin-C99royVC.js","assets/comment-BJ8u_nbe.js","assets/contact-kyx6d45f.js","assets/line-Cl4SEuml.js","assets/delete-BiDJTahF.js","assets/deposit-vl0Pt1ii.js","assets/apple-pay-Cel_9f76.js","assets/google-pay-MziVMwrr.js","assets/mastercard-DBSapFva.js","assets/payid-C0f1VUyK.js","assets/payment-card-hESKkbOr.js","assets/visa-CmgH3_jM.js","assets/dl-deposit-BfRwIHxU.js","assets/dl-digital-link-DU-YPppt.js","assets/dl-digital-link-icon-DX43pGio.js","assets/dl-terminal-DaTTYUQo.js","assets/dl-withdrawal-1jCbDpwk.js","assets/download-j0VAnYyA.js","assets/drag-XQarUC1H.js","assets/dropdown-D9IeQJhQ.js","assets/duplicate-DmFEjPSz.js","assets/edit-E_zALkow.js","assets/ellipsis-BOuWLWo_.js","assets/email-M0Nn7-ml.js","assets/empty-deposit-Bi5N-Ejd.js","assets/empty-futures-BXtsEFLu.js","assets/error-circle-LRkxK-cH.js","assets/events-empty-CKmvXwDw.js","assets/expand-DjOSlrHi.js","assets/faceid-circle-DM-5noDZ.js","assets/facial-recognition-C2FL1k7K.js","assets/faq-CNLMn8YG.js","assets/fav-WxYvWbAD.js","assets/line-lByIYGQf.js","assets/solid-BAlemg3h.js","assets/feed-CYPII6a0.js","assets/filter-lkF5MlHb.js","assets/fingerprint-C6HqXrmy.js","assets/flame-BwNlHAdZ.js","assets/down-CYJFcDS0.js","assets/up-U4hv6CQo.js","assets/down-DxzvKrGh.js","assets/up-1fxo77YE.js","assets/flucs-R7nxB8wZ.js","assets/fullscreen-DSyeuAPo.js","assets/fullscreen-exit-BXB03CHJ.js","assets/geo-circle-DmkMfdPz.js","assets/geo-error-circle-BiYYxB-k.js","assets/google-play-BJMen3HM.js","assets/greyhound-FzJCDMUI.js","assets/hamburger-2k8O5VVT.js","assets/harness-ir9okhKC.js","assets/hidden-DUNJEt-c.js","assets/hierarchy-BqdW7hGj.js","assets/home-Bol7vQ1d.js","assets/info-JkkrHFh1.js","assets/barrier--2Ul6gn_.js","assets/calendar-2XfD1cfU.js","assets/career-Cxp1r3gg.js","assets/closing-speed-BFw3Eq1z.js","assets/default-DGtViAC1.js","assets/distance-gehmRAXp.js","assets/early-speed-neg-CIr04Uhx.js","assets/early-speed-pos-CTd4-XBf.js","assets/experience-B_UMOtcq.js","assets/form-jockey-down-BQfxfpDv.js","assets/form-jockey-up-DdTl5VZj.js","assets/form-trainer-DiqAJa8i.js","assets/gear-CrPY6nlb.js","assets/going-sKKennSe.js","assets/grade-D7ht0wOA.js","assets/jockey-BHQm2VpI.js","assets/maiden-CSPz8LnH.js","assets/map-position-BRESCOBR.js","assets/preparation-DP7niYhH.js","assets/profit-DAv534Zo.js","assets/trainer-B5h4hnDE.js","assets/venue-NC9BRkNY.js","assets/venue-distance-BW0whKYi.js","assets/weight-D7YvJHzl.js","assets/invisible-D3iA5ClC.js","assets/iracelogo_blue-BILztt0g.js","assets/iracelogo_white-CdmU-Zkx.js","assets/life-ring-DURuzdgn.js","assets/live-BoW5KkGV.js","assets/live-pill-ChxTm9ki.js","assets/loading-DqrxauCo.js","assets/loading-error-circle-BKDoTdgb.js","assets/loadmore-BzM8FQpq.js","assets/logout-DiMpCzOt.js","assets/logout_bo-CiVMzLdX.js","assets/maintenance-circle-ww3mnIzQ.js","assets/manage-clients-DAFHTHVM.js","assets/manual-market-Brn-dTap.js","assets/marketing-promo-DwRgwp_4.js","assets/message-CGonw_4M.js","assets/minimise-F1XVzzPZ.js","assets/minus-BidwRWyF.js","assets/money-DutxxocR.js","assets/more-B4qHBH6t.js","assets/multi-CFYeq1-4.
1js","assets/mute-DyDYmDYL.js","assets/my-bets-LaW2eaJf.js","assets/new-window-D0w_KiYY.js","assets/no-bonus-back-DwRbg6ku.js","assets/no-bonus-cash-mwnCv530.js","assets/no-boost-BeiaGCFJ.js","assets/no-deposit-match-COMS2nvF.js","assets/no-limit-set-I6Vgnw9J.js","assets/no-races-icon-C8RDzCE3.js","assets/notifiaction-circle-QyPwkuZV.js","assets/notifications-Cn2hSSmC.js","assets/pause-BHhx1wdl.js","assets/paynearme-DFSnAJWx.js","assets/pencil-DsQefyZ0.js","assets/phone-CWDybAJP.js","assets/pin-t4tfR9lC.js","assets/pip-in-Dx71KnuC.js","assets/pip-out-CPgsxQqw.js","assets/circle-C8IqlFfg.js","assets/line-BL8z9I7K.js","assets/popup-Bcu1-e3a.js","assets/portrait-D-eVRhxw.js","assets/profile-tXoc0lnz.js","assets/promo-DTlmNct0.js","assets/promo-engine-ew_huZGV.js","assets/promotionEmpty-DqkhpTh0.js","assets/pulse-CDzqBjYE.js","assets/question-DxaO6Gy9.js","assets/race-lab-live-4J-Y5LDB.js","assets/racelab-CAYkbmGe.js","assets/racelab-duo-r5BylpNq.js","assets/racelab-full-Br_Lb15W.js","assets/racelab-full-blue-Cry4-jOl.js","assets/races-empty-DWjdjlXD.js","assets/refresh-paGEKlDw.js","assets/reload-DAN3aq8O.js","assets/restore-Dr9igOIG.js","assets/resulted-C3YZNFlI.js","assets/revert-CMMtcCwz.js","assets/scratch--p1fyXkm.js","assets/search-DwGS6kpL.js","assets/search-chart-BT_92k_w.js","assets/secured-C0ZzYhFn.js","assets/settings-DHcBbugs.js","assets/sky-circle-lJv8-qAb.js","assets/sky1-D9e49rmq.js","assets/sky1-white-B3ODAtQu.js","assets/sky2-BQ-lvJcQ.js","assets/sky2-white-DL_b-404.js","assets/facebook-BiVD2uri.js","assets/instagram-lGrKB4cK.js","assets/twitter-Di79ZM8m.js","assets/whatsapp-9cMmSxCe.js","assets/youtube-DiPbVQp4.js","assets/sound-DTcPb7cq.js","assets/speedmap-lq_p43df.js","assets/speedmap-active-CqyUhqBX.js","assets/american-football-DuNo5sAu.js","assets/australian-rules-BvbhZNcO.js","assets/baseball-CfX6mQNJ.js","assets/basketball-Du2EDb8V.js","assets/betlimits-C7CPWC7E.js","assets/boxing-aQK4EsaH.js","assets/cricket-3-Sltu1n.js","assets/cycling-CUAPUfhf.js","assets/darts-DRUX0DPs.js","assets/football-DpdQRIOq.js","assets/gaelic-football-TYmh321b.js","assets/golf-CcqmhSP_.js","assets/handball-nWaDbUFO.js","assets/hurling-BXV8fIhi.js","assets/ice-hockey-DYwzHEwX.js","assets/mixed-martial-arts-Dpv62wBk.js","assets/motor-sport-BY8vb9Qw.js","assets/politics-B_qXEARl.js","assets/racing-futures-DNChmASa.js","assets/racing-promotions-BKduRxk3.js","assets/racing-specials-C0-KZXdU.js","assets/rugby-league-C6TsdL7M.js","assets/rugby-union-xi7Y4KN2.js","assets/snooker-Cg31cH5g.js","assets/sports-promotions-DTqTE8G2.js","assets/sports-specials-B8e-qG__.js","assets/surfing-DrTh__NE.js","assets/table-tennis-BJxRjZB1.js","assets/tennis--_KUbNSW.js","assets/volleyball-D9vZ9LBD.js","assets/sports-CEwhgwid.js","assets/thoroughbred-BWDgzsfw.js","assets/circle-DDN8H158.js","assets/line-DOWy_YyD.js","assets/tochid-circle-DmR9vfgK.js","assets/top-trainer-trophy-kGjRi06t.js","assets/trading-pgMB6l6Q.js","assets/upload-TXfTqNgf.js","assets/visible-CHx5wa5y.js","assets/off-lvS52LGP.js","assets/on-oVVVUGxQ.js","assets/on-white-BrgBnm51.js","assets/play-DUpDY_J-.js","assets/volume-CQva80J_.js","assets/cloudy-CuTb5r7L.js","assets/raining-D94uF-ji.js","assets/sunny-6712RVnu.js","assets/withdraw-DjsiKimC.js","assets/withdrawable-sXA3V3R2.js","assets/world-BvhWcDUr.js"])))=>i.map(i=>d[i]);
2import{V as HE,W as zE,X as KE,w as k,Y as jE,Z as WE,$ as YE,a0 as sg,O as qE,K as Ir,_ as w,j as V,I as Ee,a1 as og,a2 as ul,a3 as rd,R as _e,a4 as XE,a5 as ag,a6 as lg,a7 as Ki,a8 as QE,a9 as cg,aa as JE,ab as ug,ac as ZE,ad as eb,ae as _f}from"./client-Bai4VJA1.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"97808a5afbf047a0a6f7534b79e8c9b165448d38"};var e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="09bf14d1-2c7c-4c21-be53-2eb700a39ec2",r._sentryDebugIdIdentifier="sentry-dbid-09bf14d1-2c7c-4c21-be53-2eb700a39ec2")}catch{}})();var tb="[object String]";function nb(r){return typeof r=="string"||!HE(r)&&zE(r)&&KE(r)==tb}const rb=(r,e,t,n)=>{const i=[t,{code:e,...n||{}}];if(r?.services?.logger?.forward)return r.services.logger.forward(i,"warn","react-i18next::",!0);Vr(i[0])&&(i[0]=`react-i18next:: ${i[0]}
2`),r?.services?.logger?.warn?r.services.logger.warn(...i):console?.warn&&console.warn(...i)},Rf={},dg=(r,e,t,n)=>{Vr(t)&&Rf[t]||(Vr(t)&&(Rf[t]=new Date),rb(r,e,t,n))},fg=(r,e)=>()=>{if(r.isInitialized)e();else{const t=()=>{setTimeout(()=>{r.off("initialized",t)},0),e()};r.on("initialized",t)}},Qc=(r,e,t)=>{r.loadNamespaces(e,fg(r,t))},If=(r,e,t,n)=>{if(Vr(t)&&(t=[t]),r.options.preload&&r.options.preload.indexOf(e)>-1)return Qc(r,t,n);t.forEach(i=>{r.options.ns.indexOf(i)<0&&r.options.ns.push(i)}),r.loadLanguages(e,fg(r,n))},ib=(r,e,t={})=>!e.languages||!e.languages.length?(dg(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(r,{lng:t.lng,precheck:(n,i)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!i(n.isLanguageChangingTo,r))return!1}}),Vr=r=>typeof r=="string",sb=r=>typeof r=="object"&&r!==null,ob=k.createContext();class ab{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var lb=jE();const cb=(r,e)=>Vr(e)?e:sb(e)&&Vr(e.defaultValue)?e.defaultValue:Array.isArray(r)?r[r.length-1]:r,ub={t:cb,ready:!1},db=()=>()=>{},hg=(r,e={})=>{const{i18n:t}=e,{i18n:n,defaultNS:i}=k.useContext(ob)||{},s=t||n||YE();s&&!s.reportNamespaces&&(s.reportNamespaces=new ab),s||dg(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=k.useMemo(()=>({...WE(),...s?.options?.react,...e}),[s,e]),{useSuspense:a,keyPrefix:l}=o,c=k.useMemo(()=>{const b=i||s?.options?.defaultNS;return Vr(b)?[b]:b||["translation"]},[r,i,s]);s?.reportNamespaces?.addUsedNamespaces?.(c);const u=k.useRef(0),d=k.useCallback(b=>{if(!s)return db;const{bindI18n:_,bindI18nStore:I}=o,S=()=>{u.current+=1,b()};return _&&s.on(_,S),I&&s.store.on(I,S),()=>{_&&_.split(" ").forEach(A=>s.off(A,S)),I&&I.split(" ").forEach(A=>s.store.off(A,S))}},[s,o]),f=k.useRef(),h=k.useCallback(()=>{if(!s)return ub;const b=!!(s.isInitialized||s.initializedStoreOnce)&&c.every(L=>ib(L,s,o)),_=e.lng||s.language,I=u.current,S=f.current;if(S&&S.ready===b&&S.lng===_&&S.keyPrefix===l&&S.revision===I)return S;const R={t:s.getFixedT(_,o.nsMode==="fallback"?c:c[0],l),ready:b,lng:_,keyPrefix:l,revision:I};return f.current=R,R},[s,c,l,o,e.lng]),[p,m]=k.useState(0),{t:g,ready:y}=lb.useSyncExternalStore(d,h,h);k.useEffect(()=>{if(s&&!y&&!a){const b=()=>m(_=>_+1);e.lng?If(s,e.lng,c,b):Qc(s,c,b)}},[s,e.lng,c,y,a,p]);const v=s||{},E=k.useMemo(()=>{const b=[g,v,y];return b.t=g,b.i18n=v,b.ready=y,b},[g,v,y]);if(s&&a&&!y)throw new Promise(b=>{const _=()=>b();e.lng?If(s,e.lng,c,_):Qc(s,c,_)});return E},fb=(r,e)=>{const{odds:t}=sg();return k.useMemo(()=>{if(r>0&&e>0){if(r>e)return{prevPrice:t(r),currPrice:t(e),fluc:"down"};if(r<e)return{prevPrice:t(r),currPrice:t(e),fluc:"up"}}},[r,e])},hb=r=>{const e=qE(s=>s.time.currentTime),t=k.useMemo(()=>Ir(r),[r]),n=Ir.duration(t.diff(e)),i=k.useMemo(()=>{const s=n.asMinutes(),o=Ir(r);if(o.isAfter(Ir(e).add(1,"week")))return o.format("ddd, D MMM YYYY, h:mma");if(o.isAfter(Ir(e).add(24,"hour")))return o.format("D MMM, ddd, h:mma");if(o.isAfter(Ir(e).add(60,"minute")))return o.format("HH:mm");if(s>5&&s<60)return`${Math.floor(s)}m`;if(s<=5){const a=Math.floor(n.asSeconds()),l=Math.abs(a),c=Math.floor(l/60),u=l%60,d=a<0;return c===0?`${d?"-":""}${u}s`:`${d?"-":""}${c}m ${u}s`}return o.format("h:mm A")},[n,e,r]);return{countdown:n,localTime:t,label:i}},pb=/^\s*<svg\b([^>]*)>([\s\S]*)<\/svg>
2\s*$/,mb=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*"([^"]*)"/g,gb=/\bid="([^"]+)"/g;function yb(r){const e={};let t;for(;(t=mb.exec(r))!==null;)e[t[1]]=t[2];return e}function vb(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Eb(r){const e=r.match(pb),t=yb(e?e[1]:""),n=e?e[2]:r,i=Array.from(r.matchAll(gb),o=>o[1]),s=k.forwardRef((o,a)=>{const l=k.useId().replace(/[^a-zA-Z0-9]/g,""),c=k.useMemo(()=>{let u=n;for(const d of i){const f=vb(d),h=`${d}-${l}`;u=u.replace(new RegExp(`id="${f}"`,"g"),`id="${h}"`).replace(new RegExp(`url\\(#${f}\\)`,"g"),`url(#${h})`).replace(new RegExp(`(xlink:href|href)="#${f}"`,"g"),`$1="#${h}"`)}return u},[l]);return k.createElement("svg",{...t,...o,ref:a,dangerouslySetInnerHTML:{__html:c}})});return s.displayName="ScopedIcon",s}const bb={abandon:()=>w(()=>import("./abandon-mh7Y1i2e.js"),__vite__mapDeps([0,1])).then(r=>r.default),account:()=>w(()=>import("./account-BsVpFIrY.js"),__vite__mapDeps([2,1])).then(r=>r.default),"account-circle":()=>w(()=>import("./account-circle-H12tK_Ll.js"),__vite__mapDeps([3,1])).then(r=>r.default),"account-created":()=>w(()=>import("./account-created-CaPfpwZF.js"),__vite__mapDeps([4,1])).then(r=>r.default),"account-created-fail":()=>w(()=>import("./account-created-fail-CqlnDxkW.js"),__vite__mapDeps([5,1])).then(r=>r.default),"account-deposit":()=>w(()=>import("./account-deposit-B-if16sl.js"),__vite__mapDeps([6,1])).then(r=>r.default),"account-deposit-tick":()=>w(()=>import("./account-deposit-tick-STZ9T3GJ.js"),__vite__mapDeps([7,1])).then(r=>r.default),"account-promo":()=>w(()=>import("./account-promo-CGm6MU0E.js"),__vite__mapDeps([8,1])).then(r=>r.default),add:()=>w(()=>import("./add-D9ceYsya.js"),__vite__mapDeps([9,1])).then(r=>r.default),"age-restriction":()=>w(()=>import("./age-restriction-CaqgKc_G.js"),__vite__mapDeps([10,1])).then(r=>r.default),"app-store":()=>w(()=>import("./app-store-VXCRm7E8.js"),__vite__mapDeps([11,1])).then(r=>r.default),attention:()=>w(()=>import("./attention-BBhAaYTx.js"),__vite__mapDeps([12,1])).then(r=>r.default),"badge-account":()=>w(()=>import("./account-BAlIlHkt.js"),__vite__mapDeps([13,1])).then(r=>r.default),"badge-bonus":()=>w(()=>import("./bonus-BsExbF_c.js"),__vite__mapDeps([14,1])).then(r=>r.default),"badge-bonus-active":()=>w(()=>import("./bonus-active-pLp2uH9Q.js"),__vite__mapDeps([15,1])).then(r=>r.default),"badge-bonus-disabled":()=>w(()=>import("./bonus-disabled-BLeJx1DI.js"),__vite__mapDeps([16,1])).then(r=>r.default),"badge-boost":()=>w(()=>import("./boost-DNKedkuD.js"),__vite__mapDeps([17,1])).then(r=>r.default),"badge-boost-active":()=>w(()=>import("./boost-active-BNONXkes.js"),__vite__mapDeps([18,1])).then(r=>r.default),"badge-boost-disabled":()=>w(()=>import("./boost-disabled-8t319T6G.js"),__vite__mapDeps([19,1])).then(r=>r.default),"badge-deposit-match":()=>w(()=>import("./deposit-match-C2j5Qibp.js"),__vite__mapDeps([20,1])).then(r=>r.default),"badge-deposit-match-disabled":()=>w(()=>import("./deposit-match-disabled-C23cqJza.js"),__vite__mapDeps([21,1])).then(r=>r.default),"badge-fixed":()=>w(()=>import("./fixed-h4allssJ.js"),__vite__mapDeps([22,1])).then(r=>r.default),"badge-gt":()=>w(()=>import("./gt-CKr6Zq7a.js"),__vite__mapDeps([23,1])).then(r=>r.default),"badge-gt-dark":()=>w(()=>import("./gt-dark-CFip_VjC.js"),__vite__mapDeps([24,1])).then(r=>r.default),"badge-gt-light":()=>w(()=>import("./gt-light-y-q5AOH3.js"),__vite__mapDeps([25,1])).then(r=>r.default),"badge-money-back":()=>w(()=>import("./money-back-BHhV5VTb.js"),__vite__mapDeps([26,1])).then(r=>r.default),"badge-money-back-active":()=>w(()=>import("./money-back-active-DcZDXHH8.js"),__vite__mapDeps([27,1])).then(r=>r.default),"badge-money-back-disabled":()=>w(()=>import("./money-back-disabled-BC5IRZ-H.js"),__vite__mapDeps([28,1])).then(r=>r.default),"badge-new":()=>w(()=>import("./new-CXWDlqqb.js"),__vite__mapDeps([29,1])).then(r=>r.default),"badge-promo":()=>w(()=>import("./promo-taElSj0X.js"),__vite__mapDeps([30,1])).then(r=>r.default),"badge-sgm":()=>w(()=>import("./sgm-YlRr39Xb.js"),__vite__mapDeps([31,1])).then(r=>r.default),"badge-srm":()=>w(()=>
2import("./srm-BuZnKjc5.js"),__vite__mapDeps([32,1])).then(r=>r.default),bank:()=>w(()=>import("./bank-BvRR85Rs.js"),__vite__mapDeps([33,1])).then(r=>r.default),"bet-and-watch":()=>w(()=>import("./bet-and-watch-DM5VPRSE.js"),__vite__mapDeps([34,1])).then(r=>r.default),"bet-referral":()=>w(()=>import("./bet-referral-B1ynS3gC.js"),__vite__mapDeps([35,1])).then(r=>r.default),betslip:()=>w(()=>import("./betslip-CFwDb9iv.js"),__vite__mapDeps([36,1])).then(r=>r.default),betstop:()=>w(()=>import("./betstop-DcUPIRrn.js"),__vite__mapDeps([37,1])).then(r=>r.default),bin:()=>w(()=>import("./bin-EB92zIZ7.js"),__vite__mapDeps([38,1])).then(r=>r.default),"bm-small":()=>w(()=>import("./bm-small-DSrJULrB.js"),__vite__mapDeps([39,1])).then(r=>r.default),"bo-grp":()=>w(()=>import("./bo-grp-Bkx6Mxt3.js"),__vite__mapDeps([40,1])).then(r=>r.default),bulk:()=>w(()=>import("./bulk-BUZ5aFnu.js"),__vite__mapDeps([41,1])).then(r=>r.default),calendar:()=>w(()=>import("./calendar-jsoeAUXG.js"),__vite__mapDeps([42,1])).then(r=>r.default),"capitalbet-prism-off":()=>w(()=>import("./prism-off-Biec_XbA.js"),__vite__mapDeps([43,1])).then(r=>r.default),"capitalbet-prism-on":()=>w(()=>import("./prism-on-DdXC-Utb.js"),[]).then(r=>Eb(r.default)),"capitalbet-wire-off":()=>w(()=>import("./wire-off-DorAahwS.js"),__vite__mapDeps([44,1])).then(r=>r.default),"capitalbet-wire-on":()=>w(()=>import("./wire-on-B1slyg8h.js"),__vite__mapDeps([45,1])).then(r=>r.default),"caret-down":()=>w(()=>import("./down-C9f2sIjC.js"),__vite__mapDeps([46,1])).then(r=>r.default),"caret-right":()=>w(()=>import("./right-pI0CuYD9.js"),__vite__mapDeps([47,1])).then(r=>r.default),"caret-up":()=>w(()=>import("./up-Ct3AvMGi.js"),__vite__mapDeps([48,1])).then(r=>r.default),"carrot-stacked-down":()=>w(()=>import("./down-D1_3ShEC.js"),__vite__mapDeps([49,1])).then(r=>r.default),"carrot-stacked-up":()=>w(()=>import("./up-1I_iFOV_.js"),__vite__mapDeps([50,1])).then(r=>r.default),"carrot-stacked-up-down":()=>w(()=>import("./up-down-BS8wmVzG.js"),__vite__mapDeps([51,1])).then(r=>r.default),cash:()=>w(()=>import("./cash-BI3zFbBS.js"),__vite__mapDeps([52,1])).then(r=>r.default),chat:()=>w(()=>import("./chat-Kp52pkaA.js"),__vite__mapDeps([53,1])).then(r=>r.default),"chevron-down":()=>w(()=>import("./down-DKAbPloZ.js"),__vite__mapDeps([54,1])).then(r=>r.default),"chevron-down-bold":()=>w(()=>import("./down-bold-B7sLHgsp.js"),__vite__mapDeps([55,1])).then(r=>r.default),"chevron-left":()=>w(()=>import("./left-RSyE1Z5k.js"),__vite__mapDeps([56,1])).then(r=>r.default),"chevron-left-bold":()=>w(()=>import("./left-bold-CqOYwQov.js"),__vite__mapDeps([57,1])).then(r=>r.default),"chevron-left-double":()=>w(()=>import("./left-double-DGiU24VR.js"),__vite__mapDeps([58,1])).then(r=>r.default),"chevron-right":()=>w(()=>import("./right-DNfzBBDn.js"),__vite__mapDeps([59,1])).then(r=>r.default),"chevron-right-bold":()=>w(()=>import("./right-bold-DB-44Ldz.js"),__vite__mapDeps([60,1])).then(r=>r.default),"chevron-right-double":()=>w(()=>import("./right-double-B8kZrAYh.js"),__vite__mapDeps([61,1])).then(r=>r.default),"chevron-up":()=>w(()=>import("./up-cXUyJ1hZ.js"),__vite__mapDeps([62,1])).then(r=>r.default),"chevron-up-bold":()=>w(()=>import("./up-bold-4rv8hbYS.js"),__vite__mapDeps([63,1])).then(r=>r.default),clear:()=>w(()=>import("./clear-CtXpVFp-.js"),__vite__mapDeps([64,1])).then(r=>r.default),"clear-circle":()=>w(()=>import("./clear-circle-BcOh9Swb.js"),__vite__mapDeps([65,1])).then(r=>r.default),clock:()=>w(()=>import("./clock-DRIPm6gZ.js"),__vite__mapDeps([66,1])).then(r=>r.default),close:()=>w(()=>import("./close-CZ9XJK4G.js"),__vite__mapDeps([67,1])).then(r=>r.default),coin:()=>w(()=>import("./coin-C99royVC.js"),__vite__mapDeps([68,1])).then(r=>r.default),comment:()=>w(()=>import("./comment-BJ8u_nbe.js"),__vite__mapDeps([69,1])).then(r=>r.default),contact:()=>w(()=>import("./contact-kyx6d45f.js"),__vite__mapDeps([70,1])).then(r=>r.default),"cross-line":()=>w(()=>import("./line-Cl4SEuml.js"),__vite__mapDeps([71,1])).then(r=>r.default),delete:()=>w(()=>import("./delete-BiDJTahF.js"),__vite__mapDeps([72,1])).then(r=>r.default),deposit:()=>w(()=>import("./deposit-vl0Pt1ii.js"),__vite__mapDeps([73,1])).then(r=>r.default),"deposit-apple-pay":()=>w(()=>import("./apple-pay-Cel_9f76.js"),__vite__mapDeps([74,1])).then(r=>r.default),"deposit-google-pay":()=>w(()=>import("./google-pay-MziVMwrr.js"),__vite__mapDeps([75,1])).then(r=>r.default),"deposit-mastercard":()=>w(()=>import("./mastercard-DBSapFva.js"),__vite__mapDeps([76,1])).then(r=>r.default),"deposit-payid":()=>w(()=>import("./payid-C0f1VUyK.js"),__vite__mapDeps([77,1])).then(r=>r.default),"deposit-payment-card":()=>w(()=>import("./payment-card-hESKkbOr.js"),__vite__mapDeps([78,1])).then(r=>r.default),"deposit-visa":()=>w(()=>import("./visa-CmgH3_jM.js"),__vite__mapDeps([79,1])).then(r=>r.default),"dl-deposit":()=>w(()=>import("./dl-deposit-BfRwIHxU.js"),__vite__mapDeps([80,1])).then(r=>r.default),"dl-digital-link":()=>w(()=>import("./dl-digital-link-DU-YPppt.js"),__vite__mapDeps([81,1])).then(r=>r.default),"dl-digital-link-icon":()=>w(()=>import("./dl-digital-link-icon-DX43pGio.js"),__vite__mapDeps([82,1])).then(r=>r.default),"dl-terminal":()=>w(()=>import("./dl-terminal-DaTTYUQo.js"),__vite__mapDeps([83,1])).then(r=>r.default),"dl-withdrawal":()=>w(()=>import("./dl-withdrawal-1jCbDpwk.js"),__vite__mapDeps([84,1])).then(r=>r.default),download:()=>w(()=>import("./download-j0VAnYyA.js"),__vite__mapDeps([85,1])).then(r=>r.default),drag:()=>w(()=>import("./drag-XQarUC1H.js"),__vite__mapDeps([86,1])).then(r=>r.default),dropdown:()=>w(()=>import("./dropdown-D9IeQJhQ.js"),__vite__mapDeps([87,1])).then(r=>r.default),duplicate:()=>w(()=>import("./duplicate-DmFEjPSz.js"),__vite__mapDeps([88,1])).then(r=>r.default),edit:()=>w(()=>import("./edit-E_zALkow.js"),__vite__mapDeps([89,1])).then(r=>r.default),ellipsis:()=>w(()=>import("./ellipsis-BOuWLWo_.js"),__vite__mapDeps([90,1])).then(r=>r.default),email:()=>w(()=>import("./email-M0Nn7-ml.js"),__vite__mapDeps([91,1])).then(r=>r.default),"empty-deposit":()=>w(()=>import("./empty-deposit-Bi5N-Ejd.js"),__vite__mapDeps([92,1])).then(r=>r.default),"empty-futures":()=>w(()=>import("./empty-futures-BXtsEFLu.js"),__vite__mapDeps([93,1])).then(r=>r.default),"error-circle":()=>w(()=>import("./error-circle-LRkxK-cH.js"),__vite__mapDeps([94,1])).then(r=>r.default),"events-empty":()=>w(()=>import("./events-empty-CKmvXwDw.js"),__vite__mapDeps([95,1])).then(r=>r.default),expand:()=>w(()=>import("./expand-DjOSlrHi.js"),__vite__mapDeps([96,1])).then(r=>r.default),"faceid-circle":()=>w(()=>import("./faceid-circle-DM-5noDZ.js"),__vite__mapDeps([97,1])).then(r=>r.default),"facial-recognition":()=>w(()=>import("./facial-recognition-C2FL1k7K.js"),__vite__mapDeps([98,1])).then(r=>r.default),faq:()=>w(()=>import("./faq-CNLMn8YG.js"),__vite__mapDeps([99,1])).then(r=>r.default),fav:()=>w(()=>
2import("./fav-WxYvWbAD.js"),__vite__mapDeps([100,1])).then(r=>r.default),"favourite-line":()=>w(()=>import("./line-lByIYGQf.js"),__vite__mapDeps([101,1])).then(r=>r.default),"favourite-solid":()=>w(()=>import("./solid-BAlemg3h.js"),__vite__mapDeps([102,1])).then(r=>r.default),feed:()=>w(()=>import("./feed-CYPII6a0.js"),__vite__mapDeps([103,1])).then(r=>r.default),filter:()=>w(()=>import("./filter-lkF5MlHb.js"),__vite__mapDeps([104,1])).then(r=>r.default),fingerprint:()=>w(()=>import("./fingerprint-C6HqXrmy.js"),__vite__mapDeps([105,1])).then(r=>r.default),flame:()=>w(()=>import("./flame-BwNlHAdZ.js"),__vite__mapDeps([106,1])).then(r=>r.default),"fluc-angle-down":()=>w(()=>import("./down-CYJFcDS0.js"),__vite__mapDeps([107,1])).then(r=>r.default),"fluc-angle-up":()=>w(()=>import("./up-U4hv6CQo.js"),__vite__mapDeps([108,1])).then(r=>r.default),"fluc-straight-down":()=>w(()=>import("./down-DxzvKrGh.js"),__vite__mapDeps([109,1])).then(r=>r.default),"fluc-straight-up":()=>w(()=>import("./up-1fxo77YE.js"),__vite__mapDeps([110,1])).then(r=>r.default),flucs:()=>w(()=>import("./flucs-R7nxB8wZ.js"),__vite__mapDeps([111,1])).then(r=>r.default),fullscreen:()=>w(()=>import("./fullscreen-DSyeuAPo.js"),__vite__mapDeps([112,1])).then(r=>r.default),"fullscreen-exit":()=>w(()=>import("./fullscreen-exit-BXB03CHJ.js"),__vite__mapDeps([113,1])).then(r=>r.default),"geo-circle":()=>w(()=>import("./geo-circle-DmkMfdPz.js"),__vite__mapDeps([114,1])).then(r=>r.default),"geo-error-circle":()=>w(()=>import("./geo-error-circle-BiYYxB-k.js"),__vite__mapDeps([115,1])).then(r=>r.default),"google-play":()=>w(()=>import("./google-play-BJMen3HM.js"),__vite__mapDeps([116,1])).then(r=>r.default),greyhound:()=>w(()=>import("./greyhound-FzJCDMUI.js"),__vite__mapDeps([117,1])).then(r=>r.default),hamburger:()=>w(()=>import("./hamburger-2k8O5VVT.js"),__vite__mapDeps([118,1])).then(r=>r.default),harness:()=>w(()=>import("./harness-ir9okhKC.js"),__vite__mapDeps([119,1])).then(r=>r.default),hidden:()=>w(()=>import("./hidden-DUNJEt-c.js"),__vite__mapDeps([120,1])).then(r=>r.default),hierarchy:()=>w(()=>import("./hierarchy-BqdW7hGj.js"),__vite__mapDeps([121,1])).then(r=>r.default),home:()=>w(()=>import("./home-Bol7vQ1d.js"),__vite__mapDeps([122,1])).then(r=>r.default),info:()=>w(()=>import("./info-JkkrHFh1.js"),__vite__mapDeps([123,1])).then(r=>r.default),"insights-barrier":()=>w(()=>import("./barrier--2Ul6gn_.js"),__vite__mapDeps([124,1])).then(r=>r.default),"insights-calendar":()=>w(()=>import("./calendar-2XfD1cfU.js"),__vite__mapDeps([125,1])).then(r=>r.default),"insights-career":()=>w(()=>import("./career-Cxp1r3gg.js"),__vite__mapDeps([126,1])).then(r=>r.default),"insights-closing-speed":()=>w(()=>import("./closing-speed-BFw3Eq1z.js"),__vite__mapDeps([127,1])).then(r=>r.default),"insights-default":()=>w(()=>import("./default-DGtViAC1.js"),__vite__mapDeps([128,1])).then(r=>r.default),"insights-distance":()=>w(()=>import("./distance-gehmRAXp.js"),__vite__mapDeps([129,1])).then(r=>r.default),"insights-early-speed-neg":()=>w(()=>import("./early-speed-neg-CIr04Uhx.js"),__vite__mapDeps([130,1])).then(r=>r.default),"insights-early-speed-pos":()=>w(()=>import("./early-speed-pos-CTd4-XBf.js"),__vite__mapDeps([131,1])).then(r=>r.default),"insights-experience":()=>w(()=>import("./experience-B_UMOtcq.js"),__vite__mapDeps([132,1])).then(r=>r.default),"insights-form-jockey-down":()=>w(()=>import("./form-jockey-down-BQfxfpDv.js"),__vite__mapDeps([133,1])).then(r=>r.default),"insights-form-jockey-up":()=>w(()=>import("./form-jockey-up-DdTl5VZj.js"),__vite__mapDeps([134,1])).then(r=>r.default),"insights-form-trainer":()=>w(()=>import("./form-trainer-DiqAJa8i.js"),__vite__mapDeps([135,1])).then(r=>r.default),"insights-gear":()=>w(()=>import("./gear-CrPY6nlb.js"),__vite__mapDeps([136,1])).then(r=>r.default),"insights-going":()=>w(()=>import("./going-sKKennSe.js"),__vite__mapDeps([137,1])).then(r=>r.default),"insights-grade":()=>w(()=>import("./grade-D7ht0wOA.js"),__vite__mapDeps([138,1])).then(r=>r.default),"insights-jockey":()=>w(()=>import("./jockey-BHQm2VpI.js"),__vite__mapDeps([139,1])).then(r=>r.default),"insights-maiden":()=>w(()=>import("./maiden-CSPz8LnH.js"),__vite__mapDeps([140,1])).then(r=>r.default),"insights-map-position":()=>w(()=>
2import("./map-position-BRESCOBR.js"),__vite__mapDeps([141,1])).then(r=>r.default),"insights-preparation":()=>w(()=>import("./preparation-DP7niYhH.js"),__vite__mapDeps([142,1])).then(r=>r.default),"insights-profit":()=>w(()=>import("./profit-DAv534Zo.js"),__vite__mapDeps([143,1])).then(r=>r.default),"insights-trainer":()=>w(()=>import("./trainer-B5h4hnDE.js"),__vite__mapDeps([144,1])).then(r=>r.default),"insights-venue":()=>w(()=>import("./venue-NC9BRkNY.js"),__vite__mapDeps([145,1])).then(r=>r.default),"insights-venue-distance":()=>w(()=>import("./venue-distance-BW0whKYi.js"),__vite__mapDeps([146,1])).then(r=>r.default),"insights-weight":()=>w(()=>import("./weight-D7YvJHzl.js"),__vite__mapDeps([147,1])).then(r=>r.default),invisible:()=>w(()=>import("./invisible-D3iA5ClC.js"),__vite__mapDeps([148,1])).then(r=>r.default),"iracelogo-blue":()=>w(()=>import("./iracelogo_blue-BILztt0g.js"),__vite__mapDeps([149,1])).then(r=>r.default),"iracelogo-white":()=>w(()=>import("./iracelogo_white-CdmU-Zkx.js"),__vite__mapDeps([150,1])).then(r=>r.default),"life-ring":()=>w(()=>import("./life-ring-DURuzdgn.js"),__vite__mapDeps([151,1])).then(r=>r.default),live:()=>w(()=>import("./live-BoW5KkGV.js"),__vite__mapDeps([152,1])).then(r=>r.default),"live-pill":()=>w(()=>import("./live-pill-ChxTm9ki.js"),__vite__mapDeps([153,1])).then(r=>r.default),loading:()=>w(()=>import("./loading-DqrxauCo.js"),__vite__mapDeps([154,1])).then(r=>r.default),"loading-error-circle":()=>w(()=>import("./loading-error-circle-BKDoTdgb.js"),__vite__mapDeps([155,1])).then(r=>r.default),loadmore:()=>w(()=>import("./loadmore-BzM8FQpq.js"),__vite__mapDeps([156,1])).then(r=>r.default),logout:()=>w(()=>import("./logout-DiMpCzOt.js"),__vite__mapDeps([157,1])).then(r=>r.default),"logout-bo":()=>w(()=>import("./logout_bo-CiVMzLdX.js"),__vite__mapDeps([158,1])).then(r=>r.default),"maintenance-circle":()=>w(()=>import("./maintenance-circle-ww3mnIzQ.js"),__vite__mapDeps([159,1])).then(r=>r.default),"manage-clients":()=>w(()=>import("./manage-clients-DAFHTHVM.js"),__vite__mapDeps([160,1])).then(r=>r.default),"manual-market":()=>w(()=>import("./manual-market-Brn-dTap.js"),__vite__mapDeps([161,1])).then(r=>r.default),"marketing-promo":()=>w(()=>import("./marketing-promo-DwRgwp_4.js"),__vite__mapDeps([162,1])).then(r=>r.default),message:()=>w(()=>import("./message-CGonw_4M.js"),__vite__mapDeps([163,1])).then(r=>r.default),minimise:()=>w(()=>import("./minimise-F1XVzzPZ.js"),__vite__mapDeps([164,1])).then(r=>r.default),minus:()=>w(()=>import("./minus-BidwRWyF.js"),__vite__mapDeps([165,1])).then(r=>r.default),money:()=>w(()=>import("./money-DutxxocR.js"),__vite__mapDeps([166,1])).then(r=>r.default),more:()=>w(()=>import("./more-B4qHBH6t.js"),__vite__mapDeps([167,1])).then(r=>r.default),multi:()=>w(()=>import("./multi-CFYeq1-4.js"),__vite__mapDeps([168,1])).then(r=>r.default),mute:()=>w(()=>import("./mute-DyDYmDYL.js"),__vite__mapDeps([169,1])).then(r=>r.default),"my-bets":()=>w(()=>import("./my-bets-LaW2eaJf.js"),__vite__mapDeps([170,1])).then(r=>r.default),"new-window":()=>w(()=>import("./new-window-D0w_KiYY.js"),__vite__mapDeps([171,1])).then(r=>r.default),"no-bonus-back":()=>w(()=>import("./no-bonus-back-DwRbg6ku.js"),__vite__mapDeps([172,1])).then(r=>r.default),"no-bonus-cash":()=>w(()=>import("./no-bonus-cash-mwnCv530.js"),__vite__mapDeps([173,1])).then(r=>r.default),"no-boost":()=>w(()=>import("./no-boost-BeiaGCFJ.js"),__vite__mapDeps([174,1])).then(r=>r.default),"no-deposit-match":()=>w(()=>import("./no-deposit-match-COMS2nvF.js"),__vite__mapDeps([175,1])).then(r=>r.default),"no-limit-set":()=>w(()=>import("./no-limit-set-I6Vgnw9J.js"),__vite__mapDeps([176,1])).then(r=>r.default),"no-races-icon":()=>w(()=>import("./no-races-icon-C8RDzCE3.js"),__vite__mapDeps([177,1])).then(r=>r.default),"notifiaction-circle":()=>w(()=>import("./notifiaction-circle-QyPwkuZV.js"),__vite__mapDeps([178,1])).then(r=>r.default),notifications:()=>w(()=>import("./notifications-Cn2hSSmC.js"),__vite__mapDeps([179,1])).then(r=>r.default),pause:()=>w(()=>import("./pause-BHhx1wdl.js"),__vite__mapDeps([180,1])).then(r=>r.default),paynearme:()=>w(()=>import("./paynearme-DFSnAJWx.js"),__vite__mapDeps([181,1])).then(r=>r.default),pencil:()=>w(()=>import("./pencil-DsQefyZ0.js"),__vite__mapDeps([182,1])).then(r=>r.default),phone:()=>w(()=>import("./phone-CWDybAJP.js"),__vite__mapDeps([183,1])).then(r=>r.default),pin:()=>w(()=>import("./pin-t4tfR9lC.js"),__vite__mapDeps([184,1])).then(r=>r.default),"pip-in":()=>w(()=>import("./pip-in-Dx71KnuC.js"),__vite__mapDeps([185,1])).then(r=>r.default),"pip-out":()=>w(()=>import("./pip-out-CPgsxQqw.js"),__vite__mapDeps([186,1])).then(r=>r.default),"play-circle":()=>w(()=>import("./circle-C8IqlFfg.js"),__vite__mapDeps([187,1])).then(r=>r.default),"play-line":()=>w(()=>import("./line-BL8z9I7K.js"),__vite__mapDeps([188,1])).then(r=>r.default),popup:()=>w(()=>import("./popup-Bcu1-e3a.js"),__vite__mapDeps([189,1])).then(r=>r.default),portrait:()=>w(()=>import("./portrait-D-eVRhxw.js"),__vite__mapDeps([190,1])).then(r=>r.default),profile:()=>w(()=>import("./profile-tXoc0lnz.js"),__vite__mapDeps([191,1])).then(r=>r.default),promo:()=>w(()=>import("./promo-DTlmNct0.js"),__vite__mapDeps([192,1])).then(r=>r.default),"promo-engine":()=>w(()=>import("./promo-engine-ew_huZGV.js"),__vite__mapDeps([193,1])).then(r=>r.default),"promotion-empty":()=>w(()=>import("./promotionEmpty-DqkhpTh0.js"),__vite__mapDeps([194,1])).then(r=>r.default),pulse:()=>w(()=>import("./pulse-CDzqBjYE.js"),__vite__mapDeps([195,1])).then(r=>r.default),question:()=>w(()=>import("./question-DxaO6Gy9.js"),__vite__mapDeps([196,1])).then(r=>r.default),"race-lab-live":()=>w(()=>import("./race-lab-live-4J-Y5LDB.js"),__vite__mapDeps([197,1])).then(r=>r.default),racelab:()=>w(()=>import("./racelab-CAYkbmGe.js"),__vite__mapDeps([198,1])).then(r=>r.default),"racelab-duo":()=>w(()=>import("./racelab-duo-r5BylpNq.js"),__vite__mapDeps([199,1])).then(r=>r.default),"racelab-full":()=>w(()=>import("./racelab-full-Br_Lb15W.js"),__vite__mapDeps([200,1])).then(r=>r.default),"racelab-full-blue":()=>w(()=>import("./racelab-full-blue-Cry4-jOl.js"),__vite__mapDeps([201,1])).then(r=>r.default),"races-empty":()=>w(()=>import("./races-empty-DWjdjlXD.js"),__vite__mapDeps([202,1])).then(r=>r.default),refresh:()=>w(()=>import("./refresh-paGEKlDw.js"),__vite__mapDeps([203,1])).then(r=>r.default),reload:()=>w(()=>import("./reload-DAN3aq8O.js"),__vite__mapDeps([204,1])).then(r=>r.default),restore:()=>w(()=>import("./restore-Dr9igOIG.js"),__vite__mapDeps([205,1])).then(r=>r.default),resulted:()=>w(()=>import("./resulted-C3YZNFlI.js"),__vite__mapDeps([206,1])).then(r=>r.default),revert:()=>w(()=>import("./revert-CMMtcCwz.js"),__vite__mapDeps([207,1])).then(r=>r.default),scratch:()=>w(()=>import("./scratch--p1fyXkm.js"),__vite__mapDeps([208,1])).then(r=>r.default),search:()=>w(()=>import("./search-DwGS6kpL.js"),__vite__mapDeps([209,1])).then(r=>
2r.default),"search-chart":()=>w(()=>import("./search-chart-BT_92k_w.js"),__vite__mapDeps([210,1])).then(r=>r.default),secured:()=>w(()=>import("./secured-C0ZzYhFn.js"),__vite__mapDeps([211,1])).then(r=>r.default),settings:()=>w(()=>import("./settings-DHcBbugs.js"),__vite__mapDeps([212,1])).then(r=>r.default),"sky-circle":()=>w(()=>import("./sky-circle-lJv8-qAb.js"),__vite__mapDeps([213,1])).then(r=>r.default),sky1:()=>w(()=>import("./sky1-D9e49rmq.js"),__vite__mapDeps([214,1])).then(r=>r.default),"sky1-white":()=>w(()=>import("./sky1-white-B3ODAtQu.js"),__vite__mapDeps([215,1])).then(r=>r.default),sky2:()=>w(()=>import("./sky2-BQ-lvJcQ.js"),__vite__mapDeps([216,1])).then(r=>r.default),"sky2-white":()=>w(()=>import("./sky2-white-DL_b-404.js"),__vite__mapDeps([217,1])).then(r=>r.default),"socials-facebook":()=>w(()=>import("./facebook-BiVD2uri.js"),__vite__mapDeps([218,1])).then(r=>r.default),"socials-instagram":()=>w(()=>import("./instagram-lGrKB4cK.js"),__vite__mapDeps([219,1])).then(r=>r.default),"socials-twitter":()=>w(()=>import("./twitter-Di79ZM8m.js"),__vite__mapDeps([220,1])).then(r=>r.default),"socials-whatsapp":()=>w(()=>import("./whatsapp-9cMmSxCe.js"),__vite__mapDeps([221,1])).then(r=>r.default),"socials-youtube":()=>w(()=>import("./youtube-DiPbVQp4.js"),__vite__mapDeps([222,1])).then(r=>r.default),sound:()=>w(()=>import("./sound-DTcPb7cq.js"),__vite__mapDeps([223,1])).then(r=>r.default),speedmap:()=>w(()=>import("./speedmap-lq_p43df.js"),__vite__mapDeps([224,1])).then(r=>r.default),"speedmap-active":()=>w(()=>import("./speedmap-active-CqyUhqBX.js"),__vite__mapDeps([225,1])).then(r=>r.default),"sport-american-football":()=>w(()=>import("./american-football-DuNo5sAu.js"),__vite__mapDeps([226,1])).then(r=>r.default),"sport-australian-rules":()=>w(()=>import("./australian-rules-BvbhZNcO.js"),__vite__mapDeps([227,1])).then(r=>r.default),"sport-baseball":()=>w(()=>import("./baseball-CfX6mQNJ.js"),__vite__mapDeps([228,1])).then(r=>r.default),"sport-basketball":()=>w(()=>import("./basketball-Du2EDb8V.js"),__vite__mapDeps([229,1])).then(r=>r.default),"sport-betlimits":()=>w(()=>import("./betlimits-C7CPWC7E.js"),__vite__mapDeps([230,1])).then(r=>r.default),"sport-boxing":()=>w(()=>import("./boxing-aQK4EsaH.js"),__vite__mapDeps([231,1])).then(r=>r.default),"sport-cricket":()=>w(()=>import("./cricket-3-Sltu1n.js"),__vite__mapDeps([232,1])).then(r=>r.default),"sport-cycling":()=>w(()=>import("./cycling-CUAPUfhf.js"),__vite__mapDeps([233,1])).then(r=>r.default),"sport-darts":()=>w(()=>import("./darts-DRUX0DPs.js"),__vite__mapDeps([234,1])).then(r=>r.default),"sport-football":()=>w(()=>import("./football-DpdQRIOq.js"),__vite__mapDeps([235,1])).then(r=>r.default),"sport-gaelic-football":()=>w(()=>import("./gaelic-football-TYmh321b.js"),__vite__mapDeps([236,1])).then(r=>r.default),"sport-golf":()=>w(()=>import("./golf-CcqmhSP_.js"),__vite__mapDeps([237,1])).then(r=>r.default),"sport-handball":()=>w(()=>import("./handball-nWaDbUFO.js"),__vite__mapDeps([238,1])).then(r=>r.default),"sport-hurling":()=>w(()=>import("./hurling-BXV8fIhi.js"),__vite__mapDeps([239,1])).then(r=>r.default),"sport-ice-hockey":()=>w(()=>import("./ice-hockey-DYwzHEwX.js"),__vite__mapDeps([240,1])).then(r=>r.default),"sport-mixed-martial-arts":()=>w(()=>import("./mixed-martial-arts-Dpv62wBk.js"),__vite__mapDeps([241,1])).then(r=>r.default),"sport-motor-sport":()=>w(()=>import("./motor-sport-BY8vb9Qw.js"),__vite__mapDeps([242,1])).then(r=>r.default),"sport-politics":()=>w(()=>import("./politics-B_qXEARl.js"),__vite__mapDeps([243,1])).then(r=>r.default),"sport-racing-futures":()=>w(()=>import("./racing-futures-DNChmASa.js"),__vite__mapDeps([244,1])).then(r=>r.default),"sport-racing-promotions":()=>w(()=>import("./racing-promotions-BKduRxk3.js"),__vite__mapDeps([245,1])).then(r=>r.default),"sport-racing-specials":()=>w(()=>import("./racing-specials-C0-KZXdU.js"),__vite__mapDeps([246,1])).then(r=>r.default),"sport-rugby-league":()=>w(()=>import("./rugby-league-C6TsdL7M.js"),__vite__mapDeps([247,1])).then(r=>r.default),"sport-rugby-union":()=>w(()=>import("./rugby-union-xi7Y4KN2.js"),__vite__mapDeps([248,1])).then(r=>r.default),"sport-snooker":()=>w(()=>import("./snooker-Cg31cH5g.js"),__vite__mapDeps([249,1])).then(r=>r.default),"sport-sports-promotions":()=>w(()=>import("./sports-promotions-DTqTE8G2.js"),__vite__mapDeps([250,1])).then(r=>r.default),"sport-sports-specials":()=>w(()=>import("./sports-specials-B8e-qG__.js"),__vite__mapDeps([251,1])).then(r=>r.default),"sport-surfing":()=>w(()=>import("./surfing-DrTh__NE.js"),__vite__mapDeps([252,1])).then(r=>r.default),"sport-table-tennis":()=>w(()=>import("./table-tennis-BJxRjZB1.js"),__vite__mapDeps([253,1])).then(r=>r.default),"sport-tennis":()=>w(()=>import("./tennis--_KUbNSW.js"),__vite__mapDeps([254,1])).then(r=>r.default),"sport-volleyball":()=>w(()=>import("./volleyball-D9vZ9LBD.js"),__vite__mapDeps([255,1])).then(r=>r.default),sports:()=>w(()=>import("./sports-CEwhgwid.js"),__vite__mapDeps([256,1])).then(r=>r.default),thoroughbred:()=>w(()=>import("./thoroughbred-BWDgzsfw.js"),__vite__mapDeps([257,1])).then(r=>r.default),"tick-circle":()=>w(()=>import("./circle-DDN8H158.js"),__vite__mapDeps([258,1])).then(r=>r.default),"tick-line":()=>w(()=>import("./line-DOWy_YyD.js"),__vite__mapDeps([259,1])).then(r=>r.default),"tochid-circle":()=>w(()=>import("./tochid-circle-DmR9vfgK.js"),__vite__mapDeps([260,1])).then(r=>r.default),"top-trainer-trophy":()=>w(()=>import("./top-trainer-trophy-kGjRi06t.js"),__vite__mapDeps([261,1])).then(r=>r.default),trading:()=>w(()=>import("./trading-pgMB6l6Q.js"),__vite__mapDeps([262,1])).then(r=>r.default),upload:()=>w(()=>import("./upload-TXfTqNgf.js"),__vite__mapDeps([263,1])).then(r=>r.default),visible:()=>w(()=>import("./visible-CHx5wa5y.js"),__vite__mapDeps([264,1])).then(r=>r.default),"vision-off":()=>w(()=>import("./off-lvS52LGP.js"),__vite__mapDeps([265,1])).then(r=>r.default),"vision-on":()=>w(()=>import("./on-oVVVUGxQ.js"),__vite__mapDeps([266,1])).then(r=>r.default),"vision-on-white":()=>w(()=>import("./on-white-BrgBnm51.js"),__vite__mapDeps([267,1])).then(r=>r.default),"vision-play":()=>w(()=>import("./play-DUpDY_J-.js"),__vite__mapDeps([268,1])).then(r=>r.default),volume:()=>w(()=>import("./volume-CQva80J_.js"),__vite__mapDeps([269,1])).then(r=>r.default),"weather-cloudy":()=>w(()=>import("./cloudy-CuTb5r7L.js"),__vite__mapDeps([270,1])).then(r=>r.default),"weather-raining":()=>w(()=>
2import("./raining-D94uF-ji.js"),__vite__mapDeps([271,1])).then(r=>r.default),"weather-sunny":()=>w(()=>import("./sunny-6712RVnu.js"),__vite__mapDeps([272,1])).then(r=>r.default),withdraw:()=>w(()=>import("./withdraw-DjsiKimC.js"),__vite__mapDeps([273,1])).then(r=>r.default),withdrawable:()=>w(()=>import("./withdrawable-sXA3V3R2.js"),__vite__mapDeps([274,1])).then(r=>r.default),world:()=>w(()=>import("./world-BvhWcDUr.js"),__vite__mapDeps([275,1])).then(r=>r.default)},Ws=bb,St=k.forwardRef(({name:r,className:e="",size:t="md",autoWidth:n=!1,autoHeight:i=!1,fallback:s="thoroughbred",...o},a)=>{const l=r?.replace(/ /g,"").replace(/[^a-zA-Z0-9-]/g,""),c=V.jsx("div",{className:Ee("shrink-0 inline-block",t!=="raw"&&{"h-3 w-3":t==="xs","h-4 w-4":t==="sm","h-6 w-6":t==="md","h-8 w-8":t==="lg","h-10 w-10":t==="xl","!w-auto":n,"!h-auto":i},e),"aria-hidden":"true"});if(!l||l.startsWith("data:")||l.length===0){console.warn(`Invalid icon name: ${r}, using fallback`);const f=Ws[s];if(!f)return console.error(`Fallback icon "${s}" not found`),null;const h=k.lazy(()=>f().then(p=>({default:p&&"default"in p?p.default:p})));return V.jsx(k.Suspense,{fallback:c,children:V.jsx(h,{ref:a,"data-testid":`icon_${r}_fallback`,role:"img",className:Ee("shrink-0",t!=="raw"&&{"h-3 w-3":t==="xs","h-4 w-4":t==="sm","h-6 w-6":t==="md","h-8 w-8":t==="lg","h-10 w-10":t==="xl","!w-auto":n,"!h-auto":i},e),...o})})}const u=Ws[l]??Ws[s];if(!u)return console.error(`Icon "${l}" and fallback "${s}" not found`),null;const d=k.useMemo(()=>k.lazy(()=>u().then(f=>{const h=f&&"default"in f?f.default:f;if(typeof h=="string")throw console.error(`Icon "${l}" resolved to a string instead of a component`),new Error(`Invalid icon component for "${l}"`);return{default:h}}).catch(f=>{console.error(`Failed to load icon "${l}":`,f);const h=Ws[s];if(h)return h().then(p=>({default:p&&"default"in p?p.default:p}));throw f})),[u,l,s]);return V.jsx(k.Suspense,{fallback:c,children:V.jsx(d,{ref:a,"data-testid":`icon_${r}`,role:"img",className:Ee("shrink-0",t!=="raw"&&{"h-3 w-3":t==="xs","h-4 w-4":t==="sm","h-6 w-6":t==="md","h-8 w-8":t==="lg","h-10 w-10":t==="xl","!w-auto":n,"!h-auto":i},e),...o})})});St.displayName="Icon";function dl(){return typeof window<"u"}function gr(r){return id(r)?(r.nodeName||"").toLowerCase():"#document"}function wt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Gn(r){var e;return(e=(id(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function id(r){return dl()?r instanceof Node||r instanceof wt(r).Node:!1}function Be(r){return dl()?r instanceof Element||r instanceof wt(r).Element:!1}function ot(r){return dl()?r instanceof HTMLElement||r instanceof wt(r).HTMLElement:!1}function Jc(r){return!dl()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof wt(r).ShadowRoot}function fl(r){const{overflow:e,overflowX:t,overflowY:n,display:i}=en(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&i!=="inline"&&i!=="contents"}function Tb(r){return/^(table|td|th)$/.test(gr(r))}function hl(r){try{if(r.matches(":popover-open"))return!0}catch{}try{return r.matches(":modal")}catch{return!1}}const Sb=/transform|translate|scale|rotate|perspective|filter/,Ab=/paint|layout|strict|content/,Tr=r=>!!r&&r!=="none";let $l;function sd(r){const e=Be(r)?en(r):r;return Tr(e.transform)||Tr(e.translate)||Tr(e.scale)||Tr(e.rotate)||Tr(e.perspective)||!pl()&&(Tr(e.backdropFilter)||Tr(e.filter))||Sb.test(e.willChange||"")||Ab.test(e.contain||"")}function _b(r){let e=dr(r);for(;ot(e)&&!or(e);){if(sd(e))return e;if(hl(e))return null;e=dr(e)}return null}function pl(){return $l==null&&($l=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),$l}function or(r){return/^(html|body|#document)$/.test(gr(r))}function en(r){return wt(r).getComputedStyle(r)}function ml(r){return Be(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function dr(r){if(gr(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Jc(r)&&r.host||Gn(r);return Jc(e)?e.host:e}function pg(r){const e=dr(r);return or(e)?(r.ownerDocument||r).body:ot(e)&&fl(e)?e:pg(e)}function ar(r,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=pg(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=wt(i);if(s){const a=Zc(o);
vendor: 5,544 bytes, lines 2-5
2return e.concat(o,o.visualViewport||[],fl(i)?i:[],a&&t?ar(a):[])}else return e.concat(i,ar(i,[],t))}function Zc(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}const fr=Math.min,$n=Math.max,ta=Math.round,Ys=Math.floor,Un=r=>({x:r,y:r}),Rb={left:"right",right:"left",bottom:"top",top:"bottom"};function mg(r,e,t){return $n(r,fr(e,t))}function ki(r,e){return typeof r=="function"?r(e):r}function Gr(r){return r.split("-")[0]}function Ci(r){return r.split("-")[1]}function gg(r){return r==="x"?"y":"x"}function od(r){return r==="y"?"height":"width"}function Fn(r){const e=r[0];return e==="t"||e==="b"?"y":"x"}function ad(r){return gg(Fn(r))}function Ib(r,e,t){t===void 0&&(t=!1);const n=Ci(r),i=ad(r),s=od(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=na(o)),[o,na(o)]}function Lb(r){const e=na(r);return[eu(r),e,eu(e)]}function eu(r){return r.includes("start")?r.replace("start","end"):r.replace("end","start")}const Lf=["left","right"],wf=["right","left"],wb=["top","bottom"],xb=["bottom","top"];function kb(r,e,t){switch(r){case"top":case"bottom":return t?e?wf:Lf:e?Lf:wf;case"left":case"right":return e?wb:xb;default:return[]}}function Cb(r,e,t,n){const i=Ci(r);let s=kb(Gr(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(eu)))),s}function na(r){const e=Gr(r);return Rb[e]+r.slice(e.length)}function Db(r){var e,t,n,i;return{top:(e=r.top)!=null?e:0,right:(t=r.right)!=null?t:0,bottom:(n=r.bottom)!=null?n:0,left:(i=r.left)!=null?i:0}}function yg(r){return typeof r!="number"?Db(r):{top:r,right:r,bottom:r,left:r}}function ra(r){const{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}/*!
3* tabbable 6.5.0
4* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5*/var Pb=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ia=Pb.join(","),vg=typeof Element>"u",Ai=vg?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,sa=!vg&&Element.prototype.getRootNode?function(r){var e;return r==null||(e=r.getRootNode)===null||e===void 0?void 0:e.call(r)}:function(r){return r?.ownerDocument},oa=function(e,t){var n;t===void 0&&(t=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),s=i===""||i==="true",o=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):oa(e.parentNode));return o},Ob=function(e){var t,n=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return n===""||n==="true"},Eg=function(e,t,n){if(oa(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(ia));return t&&Ai.call(e,ia)&&i.unshift(e),i=i.filter(n),i},aa=function(e,t,n){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!oa(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),l=a.length?a:o.children,c=aa(l,!0,n);n.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{var u=Ai.call(o,ia);u&&n.filter(o)&&(t||!e.includes(o))&&i.push(o);var d=o.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(o),f=!oa(d,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(o));if(d&&f){var h=aa(d===!0?o.children:d.children,!0,n);n.flatten?i.push.apply(i,h):i.push({scopeParent:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},bg=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Tg=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Ob(e))&&!bg(e)?0:e.tabIndex},Mb=function(e,t){var n=Tg(e);return n<0&&t&&!bg(e)?0:n},Nb=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Sg=function(e){return e.tagName==="INPUT"},Fb=function(e){return Sg(e)&&e.type==="hidden"},Bb=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},$b=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Ub=function(e){if(!e.name)return!0;var t=e.form||sa(e),n=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=$b(i,e.form);return!s||s===e},Vb=function(e){return Sg(e)&&e.type==="radio"},Gb=function(e){return Vb(e)&&!Ub(e)},Hb=function(e){var t,n=e&&sa(e),i=(t=n)===null||t===void 0?void 0:t.host,s=!1;if(n&&n!==e){var o,a,l;for(s=!!((o=i)!==null&&o!==void 0&&(a=o.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&i;){var c,u,d;n=sa(i),i=(c=n)===null||c===void 0?void 0:c.host,s=!!((u=i)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return s}
5,xf=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return n===0&&i===0},zb=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}var o=getComputedStyle(e),a=o.visibility;if(a==="hidden"||a==="collapse")return!0;var l=Ai.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(Ai.call(c,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var u=e;e;){var d=e.parentElement,f=sa(e);if(d&&!d.shadowRoot&&i(d)===!0)return xf(e);e.assignedSlot?e=e.assignedSlot:!d&&f!==e.ownerDocument?e=f.host:e=d}e=u}if(Hb(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return xf(e);return!1},Kb=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var i=t.children.item(n);if(i.tagName==="LEGEND")return Ai.call(t,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}t=t.parentElement}return!1},tu=function(e,t){return!(t.disabled||Fb(t)||zb(t,e)||Bb(t)||Kb(t))},nu=function(e,t){return!(Gb(t)||Tg(t)<0||!tu(e,t))},jb=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ag=function(e){var t=[],n=[];return e.forEach(function(i,s){var o=!!i.scopeParent,a=o?i.scopeParent:i,l=Mb(a,o),c=o?Ag(i.candidates):a;l===0?o?t.push.apply(t,c):t.push(a):n.push({documentOrder:s,tabIndex:l,item:i,isScope:o,content:c})}),n.sort(Nb).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},gl=function(e,t){t=t||{};var n;return t.getShadowRoot?n=aa([e],t.includeContainer,{filter:nu.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:jb}):n=Eg(e,t.includeContainer,nu.bind(null,t)),Ag(n)},Wb=function(e,t){t=t||{};var n;return t.getShadowRoot?n=aa([e],t.includeContainer,{filter:tu.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=Eg(e,t.includeContainer,tu.bind(null,t)),n},_g=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Ai.call(e,ia)===!1?!1:nu(t,e)};function ld(){const r=navigator.userAgentData;return r!=null&&r.platform?r.platform:navigator.platform}function Rg(){const r=navigator.userAgentData;return r&&Array.isArray(r.brands)?r.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function Ig(){return/apple/i.test(navigator.vendor)}function ru(){const r=/android/i;return r.test(ld())||r.test(Rg())}function Yb(){return ld().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Lg(){return Rg().includes("jsdom/")}const kf="data-floating-ui-focusable",qb="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function nr(r){let e=r.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function Et(r,e){if(!r||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(r.contains(e))return!0;if(t&&Jc(t)){let n=e;for(;n;){if(r===n)return!0;n=n.parentNode||n.host}}return!1}function Nn(r){return"composedPath"in r?r.composedPath()[0]:r.target}function Ul(r,e){if(e==null)return!1;if("composedPath"in r)return r.composedPath().includes(e);const t=r;return t.target!=null&&e.contains(t.target)}function Xb(r){return r.matches("html,body")}function bt(r){return r?.ownerDocument||document}function cd(r){return ot(r)&&r.matches(qb)}function Cf(r){return r?r.getAttribute("role")==="combobox"&&cd(r):!1}function Qb(r){if(!r||Lg())return!0;try{return r.matches(":focus-visible")}catch{return!0}}function iu(r){return r?r.hasAttribute(kf)?r:r.querySelector("["+kf+"]")||r:null}function mi(r,e,t){return t===void 0&&(t=!0),r.filter(i=>{var s;return i.parentId===e&&(!t||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...mi(r,i.id,t)])}function Df(r,e){var t;let n=[],i=(t=r.find(s=>
5s.id===e))==null?void 0:t.parentId;for(;i;){const s=r.find(o=>o.id===i);i=s?.parentId,s&&(n=n.concat(s))}return n}function Vl(r){r.preventDefault(),r.stopPropagation()}function Jb(r){return"nativeEvent"in r}function Zb(r){return r.mozInputSource===0&&r.isTrusted?!0:ru()&&r.pointerType?r.type==="click"&&r.buttons===1:r.detail===0&&!r.pointerType}function eT(r){return Lg()?!1:!ru()&&r.width===0&&r.height===0||ru()&&r.width===1&&r.height===1&&r.pressure===0&&r.detail===0&&r.pointerType==="mouse"||r.width<1&&r.height<1&&r.pressure===0&&r.detail===0&&r.pointerType==="touch"}function hs(r,e){const t=["mouse","pen"];return e||t.push("",void 0),t.includes(r)}var tT=typeof document<"u",nT=function(){},Tt=tT?k.useLayoutEffect:nT;const rT={...og};function kr(r){const e=k.useRef(r);return Tt(()=>{e.current=r}),e}const iT=rT.useInsertionEffect,sT=iT||(r=>r());function Nt(r){const e=k.useRef(()=>{});return sT(()=>{e.current=r}),k.useCallback(function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const Ns=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function wg(r,e){const t=gl(r,Ns()),n=t.length;if(n===0)return;const i=nr(bt(r)),s=t.indexOf(i),o=s===-1?e===1?0:n-1:s+e;return t[o]}function xg(r){return wg(bt(r).body,1)||r}function kg(r){return wg(bt(r).body,-1)||r}function Xi(r,e){const t=e||r.currentTarget,n=r.relatedTarget;return!n||!Et(t,n)}function oT(r){gl(r,Ns()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function Pf(r){r.querySelectorAll("[data-tabindex]").forEach(t=>{const n=t.dataset.tabindex;delete t.dataset.tabindex,n?t.setAttribute("tabindex",n):t.removeAttribute("tabindex")})}function Of(r,e,t){let{reference:n,floating:i}=r;const s=Fn(e),o=ad(e),a=od(o),l=Gr(e),c=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:n.y-i.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}const p=Ci(e);return p&&(h[o]+=f*(p==="end"?1:-1)*(t&&c?-1:1)),h}async function aT(r,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ki(e,r),p=yg(h),g=a[f?d==="floating"?"reference":"floating":d],y=ra(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(g)))==null||t?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(E))&&await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1},_=ra(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:E,strategy:l}):v);return{top:(y.top-_.top+p.top)/b.y,bottom:(_.bottom-y.bottom+p.bottom)/b.y,left:(y.left-_.left+p.left)/b.x,right:(_.right-y.right+p.right)/b.x}}const lT=50,cT=async(r,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=o.detectOverflow?o:{...o,detectOverflow:aT},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:u,y:d}=Of(c,n,l),f=n,h=0;const p={};for(let m=0;m<s.length;m++){const g=s[m];if(!g)continue;const{name:y,fn:v}=g,{x:E,y:b,data:_,reset:I}=await v({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:c,platform:a,elements:{reference:r,floating:e}});u=E??u,d=b??d,p[y]={...p[y],..._},I&&h<lT&&(h++,typeof I=="object"&&(I.placement&&(f=I.placement),I.rects&&(c=I.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):I.rects),{x:u,y:d}=Of(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},uT=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=ki(r,e)||{};if(c==null)return{};const d=yg(u),f={x:t,y:n},h=ad(i),p=od(h),m=await o.getDimensions(c),g=h==="y",y=g?"top":"left",v=g?"bottom":"right",E=g?"clientHeight":"clientWidth",b=s.reference[p]+s.reference[h]-f[h]-s.floating[p],_=f[h]-s.reference[h],I=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=I?I[E]:0;(!S||!await(o.isElement==null?void 0:o.isElement(I)))&&(S=a.floating[E]||s.floating[p]);const A=b/2-_/2,R=S/2-m[p]/2-1,L=fr(d[y],R),C=fr(d[v],R),O=S-m[p]-C,D=S/2-m[p]/2+A,P=mg(L,D,O),M=!l.arrow&&Ci(i)!=null&&D!==P&&s.reference[p]/2-(D<L?L:C)-m[p]/2<0,N=M?D<L?D-L:D-O:0;return{[h]:f[h]+N,data:{[h]:P,centerOffset:D-P-N,...M&&{alignmentOffset:N}},reset:M}}}),dT=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=ki(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const y=Gr(i),v=Fn(a),E=Gr(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=f||(E||!m?[na(a)]:Lb(a)),I=p!=="none";!f&&I&&_.push(...Cb(a,m,p,b));const S=[a,..._],A=await l.detectOverflow(e,g),R=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&R.push(A[y]),d){const P=Ib(i,o,b);R.push(A[P[0]],A[P[1]])}if(L=[...L,{placement:i,overflows:R}],!R.every(P=>P<=0)){var C,O;const P=(((C=s.flip)==null?void 0:C.index)||0)+1,M=S[P];if(M&&(!(d==="alignment"?v!==Fn(M):!1)||L.every(x=>Fn(x.placement)===v?x.overflows[0]>0:!0)))return{data:{index:P,overflows:L},reset:{placement:M}};let N=(O=L.filter(F=>F.overflows[0]<=0).sort((F,x)=>F.overflows[1]-x.overflows[1])[0])==null?void 0:O.placement;if(!N)switch(h){case"bestFit":{var D;const F=(D=L.filter(x=>{if(I){const U=Fn(x.placement);return U===v||U==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(U=>U>0).reduce((U,K)=>U+K,0)]).sort((x,U)=>x[1]-U[1])[0])==null?void 0:D[0];F&&(N=F);break}case"initialPlacement":N=a;break}if(i!==N)return{reset:{placement:N}}}return{}}}},fT=new Set(["left","top"]);async function hT(r,e){const{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Gr(t),a=Ci(t),l=Fn(t)==="y",c=fT.has(o)?-1:1,u=s&&l?-1:1,d=ki(e,r);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}
5:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const pT=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await hT(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},mT=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:n,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:E,y:b}=v;return{x:E,y:b}}},...c}=ki(r,e),u={x:t,y:n},d=await s.detectOverflow(e,c),f=Fn(i),h=gg(f);let p=u[h],m=u[f];const g=(v,E)=>mg(E+d[v==="y"?"top":"left"],E,E-d[v==="y"?"bottom":"right"]);o&&(p=g(h,p)),a&&(m=g(f,m));const y=l.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-t,y:y.y-n,enabled:{[h]:o,[f]:a}}}}}},gT=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(e){const{placement:t,rects:n,platform:i,elements:s}=e,{apply:o=()=>{},...a}=ki(r,e),l=await i.detectOverflow(e,a),c=Gr(t),u=Ci(t),d=Fn(t)==="y",{width:f,height:h}=n.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const g=h-l.top-l.bottom,y=f-l.left-l.right,v=fr(h-l[p],g),E=fr(f-l[m],y),b=e.middlewareData.shift,_=!b;let I=v,S=E;b!=null&&b.enabled.x&&(S=y),b!=null&&b.enabled.y&&(I=g),_&&!u&&(d?S=f-2*$n(l.left,l.right):I=h-2*$n(l.top,l.bottom)),await o({...e,availableWidth:S,availableHeight:I});const A=await i.getDimensions(s.floating);return f!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function Cg(r){const e=en(r);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ot(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=ta(t)!==s||ta(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function ud(r){return Be(r)?r:r.contextElement}function gi(r){const e=ud(r);if(!ot(e))return Un(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Cg(e);let o=(s?ta(t.width):t.width)/n,a=(s?ta(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const yT=Un(0);function Dg(r){const e=wt(r);
5return!pl()||!e.visualViewport?yT:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vT(r,e,t){return e===void 0&&(e=!1),!!t&&e&&t===wt(r)}function Hr(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=ud(r);let o=Un(1);e&&(n?Be(n)&&(o=gi(n)):o=gi(r));const a=vT(s,t,n)?Dg(s):Un(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s&&n){const f=wt(s),h=Be(n)?wt(n):n;let p=f,m=Zc(p);for(;m&&h!==p;){const g=gi(m),y=m.getBoundingClientRect(),v=en(m),E=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,b=y.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=E,c+=b,p=wt(m),m=Zc(p)}}return ra({width:u,height:d,x:l,y:c})}function yl(r,e){const t=ml(r).scrollLeft;return e?e.left+t:Hr(Gn(r)).left+t}function Pg(r,e){const t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-yl(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function ET(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r;const s=i==="fixed",o=Gn(n),a=e?hl(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Un(1);const u=Un(0),d=ot(n);
5if((d||!s)&&((gr(n)!=="body"||fl(o))&&(l=ml(n)),d)){const h=Hr(n);c=gi(n),u.x=h.x+n.clientLeft,u.y=h.y+n.clientTop}const f=o&&!d&&!s?Pg(o,l):Un(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:t.y*c.y-l.scrollTop*c.y+u.y+f.y}}function bT(r){return r.getClientRects?Array.from(r.getClientRects()):[]}function TT(r){const e=ml(r),t=r.ownerDocument.body,n=$n(r.scrollWidth,r.clientWidth,t.scrollWidth,t.clientWidth),i=$n(r.scrollHeight,r.clientHeight,t.scrollHeight,t.clientHeight);let s=-e.scrollLeft+yl(r);const o=-e.scrollTop;return en(t).direction==="rtl"&&(s+=$n(r.clientWidth,t.clientWidth)-n),{width:n,height:i,x:s,y:o}}const ST=25;function AT(r,e,t){t===void 0&&(t="viewport");const n=t==="layoutViewport",i=wt(r),s=Gn(r),o=i.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){const f=!pl()||e==="fixed";n?f||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,f&&(c=o.offsetLeft,u=o.offsetTop))}if(yl(s)<=0){const f=s.ownerDocument,h=f.body,p=getComputedStyle(h),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(s.clientWidth-h.clientWidth-m),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?g/2:g;y<=ST&&(a-=y)}return{width:a,height:l,x:c,y:u}}function _T(r,e){const t=Hr(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=gi(r),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function Mf(r,e,t){let n;if(e==="viewport"||e==="layoutViewport")n=AT(r,t,e);else if(e==="document")n=TT(Gn(r));else if(Be(e))n=_T(e,t);else{const i=Dg(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ra(n)}function RT(r,e){const t=e.get(r);if(t)return t;let n=ar(r,[],!1).filter(a=>Be(a)&&gr(a)!=="body"),i=null;const s=en(r).position==="fixed";let o=s?dr(r):r;for(;Be(o)&&!or(o);){const a=en(o),l=sd(o),c=i?i.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?n=n.filter(d=>d!==o):i=a,o=dr(o)}return e.set(r,n),n}function IT(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r;const o=[...t==="clippingAncestors"?hl(e)?[]:RT(e,this._c):[].concat(t),n],a=Mf(e,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const h=Mf(e,o[f],i);l=$n(h.top,l),c=fr(h.right,c),u=fr(h.bottom,u),d=$n(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function LT(r){const{width:e,height:t}=Cg(r);return{width:e,height:t}}function wT(r,e,t){const n=ot(e),i=Gn(e),s=t==="fixed",o=Hr(r,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Un(0);if((n||!s)&&((gr(e)!=="body"||fl(i))&&(a=ml(e)),n)){const f=Hr(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}!n&&i&&(l.x=yl(i));const c=i&&!n&&!s?Pg(i,a):Un(0),u=o.left+a.scrollLeft-l.x-c.x,d=o.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:o.width,height:o.height}}function Gl(r){return en(r).position==="static"}function Nf(r,e){if(!ot(r)||en(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Gn(r)===t&&(t=t.ownerDocument.body),t}function Og(r,e){const t=wt(r);if(hl(r))return t;if(!ot(r)){let i=dr(r);for(;i&&!or(i);){if(Be(i)&&!Gl(i))return i;i=dr(i)}return t}let n=Nf(r,e);for(;n&&Tb(n)&&Gl(n);)n=Nf(n,e);return n&&or(n)&&Gl(n)&&!sd(n)?t:n||_b(r)||t}const xT=async function(r){const e=this.getOffsetParent||Og,t=this.getDimensions,n=await t(r.floating);return{reference:wT(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function kT(r){return en(r).direction==="rtl"}const CT={convertOffsetParentRelativeRectToViewportRelativeRect:ET,getDocumentElement:Gn,getClippingRect:IT,getOffsetParent:Og,getElementRects:xT,getClientRects:bT,getDimensions:LT,getScale:gi,isElement:Be,isRTL:kT};function Mg(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function DT(r,e,t){let n=null,i;const s=Gn(r);function o(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function a(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),o();const f=r.getBoundingClientRect(),{left:h,top:p,width:m,height:g}=f;if(u||e(),!m||!g)return;const y=Ys(p),v=Ys(s.clientWidth-(h+m)),E=Ys(s.clientHeight-(p+g)),b=Ys(h),I={rootMargin:-y+"px "+-v+"px "+-E+"px "+-b+"px",threshold:$n(0,fr(1,d))||1};let S=!0;function A(R){const L=R[0].intersectionRatio;if(!Mg(f,r.getBoundingClientRect()))return a();if(L!==d){if(!S)return a();L?a(!1,L):i=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(A,{...I,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,I)}n.observe(r)}const l=wt(r),c=()=>a(t);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function PT(r,e,t,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=ud(r),u=i||s?[...c?ar(c):[],...e?ar(e):[]]:[];u.forEach(y=>{i&&y.addEventListener("scroll",t),s&&y.addEventListener("resize",t)});const d=c&&a?DT(c,t,s):null;let f=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=h)==null||E.observe(e)})),t()}),c&&!l&&h.observe(c),e&&h.observe(e));let p,m=l?Hr(r):null;l&&g();function g(){const y=Hr(r);m&&!Mg(m,y)&&t(),m=y,p=requestAnimationFrame(g)}return t(),()=>{var y;u.forEach(v=>{i&&v.removeEventListener("scroll",t),s&&v.removeEventListener("resize",t)}),d?.(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const OT=pT,MT=mT,NT=dT,FT=gT,Ff=uT,BT=(r,e,t)=>{const n=new Map,i=t??{},s={...CT,...i.platform,_c:n};return cT(r,e,{...i,platform:s})};var $T=typeof document<"u",UT=function(){},$o=$T?k.useLayoutEffect:UT;function la(r,e){if(r===e)return!0;
5if(typeof r!=typeof e)return!1;if(typeof r=="function"&&r.toString()===e.toString())return!0;let t,n,i;if(r&&e&&typeof r=="object"){if(Array.isArray(r)){if(t=r.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!la(r[n],e[n]))return!1;return!0}if(i=Object.keys(r),t=i.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=t;n--!==0;){const s=i[n];if(!(s==="_owner"&&r.$$typeof)&&!la(r[s],e[s]))return!1}return!0}return r!==r&&e!==e}function Ng(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Bf(r,e){const t=Ng(r);return Math.round(e*t)/t}function Hl(r){const e=k.useRef(r);return $o(()=>{e.current=r}),e}function VT(r){r===void 0&&(r={});const{placement:e="bottom",strategy:t="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=r,[u,d]=k.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=k.useState(n);la(f,n)||h(n);const[p,m]=k.useState(null),[g,y]=k.useState(null),v=k.useCallback(x=>{x!==I.current&&(I.current=x,m(x))},[]),E=k.useCallback(x=>{x!==S.current&&(S.current=x,y(x))},[]),b=s||p,_=o||g,I=k.useRef(null),S=k.useRef(null),A=k.useRef(u),R=l!=null,L=Hl(l),C=Hl(i),O=Hl(c),D=k.useCallback(()=>{if(!I.current||!S.current)return;const x={placement:e,strategy:t,middleware:f};C.current&&(x.platform=C.current),BT(I.current,S.current,x).then(U=>{const K={...U,isPositioned:O.current!==!1};P.current&&!la(A.current,K)&&(A.current=K,ul.flushSync(()=>{d(K)}))})},[f,e,t,C,O]);$o(()=>{c===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(x=>({...x,isPositioned:!1})))},[c]);const P=k.useRef(!1);$o(()=>(P.current=!0,()=>{P.current=!1}),[]),$o(()=>{if(b&&(I.current=b),_&&(S.current=_),b&&_){if(L.current)return L.current(b,_,D);D()}},[b,_,D,L,R]);const M=k.useMemo(()=>({reference:I,floating:S,setReference:v,setFloating:E}),[v,E]),N=k.useMemo(()=>({reference:b,floating:_}),[b,_]),F=k.useMemo(()=>{const x={position:t,left:0,top:0};if(!N.floating)return x;const U=Bf(N.floating,u.x),K=Bf(N.floating,u.y);return a?{...x,transform:"translate("+U+"px, "+K+"px)",...Ng(N.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:U,top:K}},[t,a,N.floating,u.x,u.y]);return k.useMemo(()=>({...u,update:D,refs:M,elements:N,floatingStyles:F}),[u,D,M,N,F])}const GT=r=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:r,fn(t){const{element:n,padding:i}=typeof r=="function"?r(t):r;return n&&e(n)?n.current!=null?Ff({element:n.current,padding:i}).fn(t):{}:n?Ff({element:n,padding:i}).fn(t):{}}}},HT=(r,e)=>{const t=OT(r);return{name:t.name,fn:t.fn,options:[r,e]}},zT=(r,e)=>{const t=MT(r);return{name:t.name,fn:t.fn,options:[r,e]}},KT=(r,e)=>{const t=NT(r);return{name:t.name,fn:t.fn,options:[r,e]}},MO=(r,e)=>{const t=FT(r);return{name:t.name,fn:t.fn,options:[r,e]}},NO=(r,e)=>{const t=GT(r);return{name:t.name,fn:t.fn,options:[r,e]}};function FO(r){const e=k.useRef(void 0),t=k.useCallback(n=>{const i=r.map(s=>{if(s!=null){if(typeof s=="function"){const o=s,a=o(n);return typeof a=="function"?a:()=>{o(null)}}return s.current=n,()=>{s.current=null}}});return()=>{i.forEach(s=>s?.())}},r);return k.useMemo(()=>r.every(n=>n==null)?null:n=>{e.current&&(e.current(),e.current=void 0),n!=null&&(e.current=t(n))},r)}const jT="data-floating-ui-focusable",$f="active",Uf="selected",WT={...og};let Vf=!1,YT=0;const Gf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+YT++;function qT(){const[r,e]=k.useState(()=>Vf?Gf():void 0);return Tt(()=>{r==null&&e(Gf())},[]),k.useEffect(()=>{Vf=!0},[]),r}const XT=WT.useId,vl=XT||qT,BO=k.forwardRef(function(e,t){const{context:{placement:n,elements:{floating:i},middlewareData:{arrow:s,shift:o}},width:a=14,height:l=7,tipRadius:c=0,strokeWidth:u=0,staticOffset:d,stroke:f,d:h,style:{transform:p,...m}={},...g}=e,y=vl(),[v,E]=k.useState(!1);if(Tt(()=>{if(!i)return;en(i).direction==="rtl"&&E(!0)},[i]),!i)return null;const[b,_]=n.split("-"),I=b==="top"||b==="bottom";let S=d;(I&&o!=null&&o.x||!I&&o!=null&&o.y)&&(S=null);const A=u*2,R=A/2,L=a/2*(c/-8+1),C=l/2*c/4,O=!!h,D=S&&_==="end"?"bottom":"top";let P=S&&_==="end"?"right":"left";S&&v&&(P=_==="end"?"left":"right");const M=s?.x!=null?S||s.x:"",N=s?.y!=null?S||s.y:"",F=h||"M0,0"+(" H"
5+a)+(" L"+(a-L)+","+(l-C))+(" Q"+a/2+","+l+" "+L+","+(l-C))+" Z",x={top:O?"rotate(180deg)":"",left:O?"rotate(90deg)":"rotate(-90deg)",bottom:O?"":"rotate(180deg)",right:O?"rotate(-90deg)":"rotate(90deg)"}[b];return V.jsxs("svg",{...g,"aria-hidden":!0,ref:t,width:O?a:a+A,height:a,viewBox:"0 0 "+a+" "+(l>a?l:a),style:{position:"absolute",pointerEvents:"none",[P]:M,[D]:N,[b]:I||O?"100%":"calc(100% - "+A/2+"px)",transform:[x,p].filter(U=>!!U).join(" "),...m},children:[A>0&&V.jsx("path",{clipPath:"url(#"+y+")",fill:"none",stroke:f,strokeWidth:A+(h?0:1),d:F}),V.jsx("path",{stroke:A&&!h?g.fill:"none",d:F}),V.jsx("clipPath",{id:y,children:V.jsx("rect",{x:-R,y:R*(O?-1:1),width:a+A,height:a})})]})});function QT(){const r=new Map;return{emit(e,t){var n;(n=r.get(e))==null||n.forEach(i=>i(t))},on(e,t){r.has(e)||r.set(e,new Set),r.get(e).add(t)},off(e,t){var n;(n=r.get(e))==null||n.delete(t)}}}const JT=k.createContext(null),ZT=k.createContext(null),dd=()=>{var r;return((r=k.useContext(JT))==null?void 0:r.id)||null},El=()=>k.useContext(ZT);function zr(r){return"data-floating-ui-"+r}function Ut(r){r.current!==-1&&(clearTimeout(r.current),r.current=-1)}const Hf=zr("safe-polygon");function zl(r,e,t){if(t&&!hs(t))return 0;if(typeof r=="number")return r;if(typeof r=="function"){const n=r();return typeof n=="number"?n:n?.[e]}return r?.[e]}function Kl(r){return typeof r=="function"?r():r}function $O(r,e){e===void 0&&(e={});const{open:t,onOpenChange:n,dataRef:i,events:s,elements:o}=r,{enabled:a=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=El(),p=dd(),m=kr(c),g=kr(l),y=kr(t),v=kr(d),E=k.useRef(),b=k.useRef(-1),_=k.useRef(),I=k.useRef(-1),S=k.useRef(!0),A=k.useRef(!1),R=k.useRef(()=>{}),L=k.useRef(!1),C=Nt(()=>{var F;const x=(F=i.current.openEvent)==null?void 0:F.type;return x?.includes("mouse")&&x!=="mousedown"});k.useEffect(()=>{if(!a)return;function F(x){let{open:U}=x;U||(Ut(b),Ut(I),S.current=!0,L.current=!1)}return s.on("openchange",F),()=>{s.off("openchange",F)}},[a,s]),k.useEffect(()=>{if(!a||!m.current||!t)return;function F(U){C()&&n(!1,U,"hover")}const x=bt(o.floating).documentElement;return x.addEventListener("mouseleave",F),()=>{x.removeEventListener("mouseleave",F)}},[o.floating,t,n,a,m,C]);const O=k.useCallback(function(F,x,U){x===void 0&&(x=!0),U===void 0&&(U="hover");const K=zl(g.current,"close",E.current);K&&!_.current?(Ut(b),b.current=window.setTimeout(()=>n(!1,F,U),K)):x&&(Ut(b),n(!1,F,U))},[g,n]),D=Nt(()=>{R.current(),_.current=void 0}),P=Nt(()=>{if(A.current){const F=bt(o.floating).body;F.style.pointerEvents="",F.removeAttribute(Hf),A.current=!1}}),M=Nt(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);k.useEffect(()=>{if(!a)return;function F(G){if(Ut(b),S.current=!1,u&&!hs(E.current)||Kl(v.current)>0&&!zl(g.current,"open"))return;const z=zl(g.current,"open",E.current);z?b.current=window.setTimeout(()=>{y.current||n(!0,G,"hover")},z):t||n(!0,G,"hover")}function x(G){if(M()){P();return}R.current();const z=bt(o.floating);if(Ut(I),L.current=!1,m.current&&i.current.floatingContext){t||Ut(b),_.current=m.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){P(),D(),M()||O(G,!0,"safe-polygon")}});const q=_.current;z.addEventListener("mousemove",q),R.current=()=>{z.removeEventListener("mousemove",q)};return}(E.current==="touch"?!Et(o.floating,G.relatedTarget):!0)&&O(G)}function U(G){M()||i.current.floatingContext&&(m.current==null||m.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){P(),D(),M()||O(G)}})(G))}function K(){Ut(b)}function H(G){M()||O(G,!1)}if(Be(o.domReference)){const G=o.domReference,z=o.floating;return t&&G.addEventListener("mouseleave",U),f&&G.addEventListener("mousemove",F,{once:!0}),G.addEventListener("mouseenter",F),G.addEventListener("mouseleave",x),z&&(z.addEventListener("mouseleave",U),z.addEventListener("mouseenter",K),z.addEventListener("mouseleave",H)),()=>{t&&G.removeEventListener("mouseleave",U),f&&G.removeEventListener("mousemove",F),G.removeEventListener("mouseenter",F),G.removeEventListener("mouseleave",x),z&&(z.removeEventListener("mouseleave",U),z.removeEventListener("mouseenter",K),z.removeEventListener("mouseleave",H))}}},[o,a,r,u,f,O,D,P,n,t,y,h,g,m,i,M,v]),Tt(()=>{var F;if(a&&t&&(F=m.current)!=null&&(F=F.__options)!=null&&F.blockPointerEvents&&C()){A.current=!0;const U=o.floating;if(Be(o.domReference)&&U){var x;const K=bt(o.floating).body;K.setAttribute(Hf,"");const H=o.domReference,G=h==null||(x=h.nodesRef.current.find(z=>z.id===p))==null||(x=x.context)==null?void 0:x.elements.floating;return G&&(G.style.pointerEvents=""),K.style.pointerEvents="none",H.style.pointerEvents="auto",U.style.pointerEvents="auto",()=>{K.style.pointerEvents="",H.style.pointerEvents="",U.style.pointerEvents=""}}}},[a,t,p,o,h,m,C]),Tt(()=>{t||(E.current=void 0,L.current=!1,D(),P())},[t,D,P]),k.useEffect(()=>()=>{D(),Ut(b),Ut(I),P()},[a,o.domReference,D,P]);const N=k.useMemo(()=>{function F(x){E.current=x.pointerType}
5return{onPointerDown:F,onPointerEnter:F,onMouseMove(x){const{nativeEvent:U}=x;function K(){!S.current&&!y.current&&n(!0,U,"hover")}u&&!hs(E.current)||t||Kl(v.current)===0||L.current&&x.movementX**2+x.movementY**2<2||(Ut(I),E.current==="touch"?K():(L.current=!0,I.current=window.setTimeout(K,Kl(v.current))))}}},[u,n,t,y,v]);return k.useMemo(()=>a?{reference:N}:{},[a,N])}let zf=0;function Jr(r,e){e===void 0&&(e={});const{preventScroll:t=!1,cancelPrevious:n=!0,sync:i=!1}=e;n&&cancelAnimationFrame(zf);const s=()=>r?.focus({preventScroll:t});i?s():zf=requestAnimationFrame(s)}function eS(r){return r?.ownerDocument||document}const yi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Kf(r){return r==="inert"?yi.inert:r==="aria-hidden"?yi["aria-hidden"]:yi.none}let qs=new WeakSet,Xs={},jl=0;const tS=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,Fg=r=>r&&(r.host||Fg(r.parentNode)),nS=(r,e)=>e.map(t=>{if(r.contains(t))return t;const n=Fg(t);return r.contains(n)?n:null}).filter(t=>t!=null);function rS(r,e,t,n){const i="data-floating-ui-inert",s=n?"inert":t?"aria-hidden":null,o=nS(e,r),a=new Set,l=new Set(o),c=[];Xs[i]||(Xs[i]=new WeakMap);const u=Xs[i];o.forEach(d),f(e),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(gr(p)!=="script")if(a.has(p))f(p);else{const m=s?p.getAttribute(s):null,g=m!==null&&m!=="false",y=Kf(s),v=(y.get(p)||0)+1,E=(u.get(p)||0)+1;y.set(p,v),u.set(p,E),c.push(p),v===1&&g&&qs.add(p),E===1&&p.setAttribute(i,""),!g&&s&&p.setAttribute(s,s==="inert"?"":"true")}})}return jl++,()=>{c.forEach(h=>{const p=Kf(s),g=(p.get(h)||0)-1,y=(u.get(h)||0)-1;p.set(h,g),u.set(h,y),g||(!qs.has(h)&&s&&h.removeAttribute(s),qs.delete(h)),y||h.removeAttribute(i)}),jl--,jl||(yi.inert=new WeakMap,yi["aria-hidden"]=new WeakMap,yi.none=new WeakMap,qs=new WeakSet,Xs={})}}function jf(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);const n=eS(r[0]).body;return rS(r.concat(Array.from(n.querySelectorAll('[aria-live],[role="status"],output'))),n,e,t)}const bl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},ca=k.forwardRef(function(e,t){const[n,i]=k.useState();Tt(()=>{Ig()&&i("button")},[]);const s={ref:t,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[zr("focus-guard")]:"",style:bl};return V.jsx("span",{...e,...s})}),Bg=k.createContext(null),Wf=zr("portal");function iS(r){r===void 0&&(r={});const{id:e,root:t}=r,n=vl(),i=$g(),[s,o]=k.useState(null),a=k.useRef(null);return Tt(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),Tt(()=>{if(!n||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=n,c.setAttribute(Wf,""),l.appendChild(c),a.current=c,o(c)},[e,n]),Tt(()=>{if(t===null||!n||a.current)return;let l=t||i?.portalNode;l&&!id(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const u=document.createElement("div");u.id=n,u.setAttribute(Wf,""),l=c||l,l.appendChild(u),a.current=u,o(u)},[e,t,n,i]),s}function sS(r){const{children:e,id:t,root:n,preserveTabOrder:i=!0}=r,s=iS({id:t,root:n}),[o,a]=k.useState(null),l=k.useRef(null),c=k.useRef(null),u=k.useRef(null),d=k.useRef(null),f=o?.modal,h=o?.open,p=!!o&&!o.modal&&o.open&&i&&!!(n||s);return k.useEffect(()=>{if(!s||!i||f)return;function m(g){s&&Xi(g)&&(g.type==="focusin"?Pf:oT)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,i,f]),k.useEffect(()=>{s&&(h||Pf(s))},[h,s]),V.jsxs(Bg.Provider,{value:k.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:s,setFocusManagerState:a}),[i,s]),children:[p&&s&&V.jsx(ca,{"data-type":"outside",ref:l,onFocus:m=>{if(Xi(m,s)){var g;(g=u.current)==null||g.focus()}else{const y=o?o.domReference:null,v=kg(y);v?.focus()}}}),p&&s&&V.jsx("span",{"aria-owns":s.id,style:bl}),s&&ul.createPortal(e,s),p&&s&&V.jsx(ca,{"data-type":"outside",ref:c,onFocus:m=>{if(Xi(m,s)){var g;
5(g=d.current)==null||g.focus()}else{const y=o?o.domReference:null,v=xg(y);v?.focus(),o?.closeOnFocusOut&&o?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const $g=()=>k.useContext(Bg);function Yf(r){return k.useMemo(()=>e=>{r.forEach(t=>{t&&(t.current=e)})},r)}const oS=20;let rr=[];function fd(){rr=rr.filter(r=>r.isConnected)}function aS(r){fd(),r&&gr(r)!=="body"&&(rr.push(r),rr.length>oS&&(rr=rr.slice(-20)))}function qf(){return fd(),rr[rr.length-1]}function lS(r){const e=Ns();return _g(r,e)?r:gl(r,e)[0]||r}function Xf(r,e){var t;if(!e.current.includes("floating")&&!((t=r.getAttribute("role"))!=null&&t.includes("dialog")))return;const n=Ns(),s=Wb(r,n).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return _g(a,n)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),o=r.getAttribute("tabindex");e.current.includes("floating")||s.length===0?o!=="0"&&r.setAttribute("tabindex","0"):(o!=="-1"||r.hasAttribute("data-tabindex")&&r.getAttribute("data-tabindex")!=="-1")&&(r.setAttribute("tabindex","-1"),r.setAttribute("data-tabindex","-1"))}const cS=k.forwardRef(function(e,t){return V.jsx("button",{...e,type:"button",ref:t,tabIndex:-1,style:bl})});function UO(r){const{context:e,children:t,disabled:n=!1,order:i=["content"],guards:s=!0,initialFocus:o=0,returnFocus:a=!0,restoreFocus:l=!1,modal:c=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:h=()=>[]}=r,{open:p,onOpenChange:m,events:g,dataRef:y,elements:{domReference:v,floating:E}}=e,b=Nt(()=>{var le;return(le=y.current.floatingContext)==null?void 0:le.nodeId}),_=Nt(h),I=typeof o=="number"&&o<0,S=Cf(v)&&I,A=tS(),R=A?s:!0,L=!R||A&&f,C=kr(i),O=kr(o),D=kr(a),P=El(),M=$g(),N=k.useRef(null),F=k.useRef(null),x=k.useRef(!1),U=k.useRef(!1),K=k.useRef(-1),H=k.useRef(-1),G=M!=null,z=iu(E),J=Nt(function(le){return le===void 0&&(le=z),le?gl(le,Ns()):[]}),q=Nt(le=>{const Te=J(le);return C.current.map(he=>v&&he==="reference"?v:z&&he==="floating"?z:Te).filter(Boolean).flat()});k.useEffect(()=>{if(n||!c)return;function le(he){if(he.key==="Tab"){Et(z,nr(bt(z)))&&J().length===0&&!S&&Vl(he);const Fe=q(),oe=Nn(he);C.current[0]==="reference"&&oe===v&&(Vl(he),he.shiftKey?Jr(Fe[Fe.length-1]):Jr(Fe[1])),C.current[1]==="floating"&&oe===z&&he.shiftKey&&(Vl(he),Jr(Fe[0]))}}const Te=bt(z);return Te.addEventListener("keydown",le),()=>{Te.removeEventListener("keydown",le)}},[n,v,z,c,C,S,J,q]),k.useEffect(()=>{if(n||!E)return;function le(Te){const he=Nn(Te),oe=J().indexOf(he);oe!==-1&&(K.current=oe)}return E.addEventListener("focusin",le),()=>{E.removeEventListener("focusin",le)}},[n,E,J]),k.useEffect(()=>{if(n||!d)return;function le(){U.current=!0,setTimeout(()=>{U.current=!1})}function Te(oe){const ce=oe.relatedTarget,Me=oe.currentTarget,Ue=Nn(oe);queueMicrotask(()=>{const xe=b(),yt=!(Et(v,ce)||Et(E,ce)||Et(ce,E)||Et(M?.portalNode,ce)||ce!=null&&ce.hasAttribute(zr("focus-guard"))||P&&(mi(P.nodesRef.current,xe).find(Qe=>{var kt,_t;return Et((kt=Qe.context)==null?void 0:kt.elements.floating,ce)||Et((_t=Qe.context)==null?void 0:_t.elements.domReference,ce)})||Df(P.nodesRef.current,xe).find(Qe=>{var kt,_t,Ct;return[(kt=Qe.context)==null?void 0:kt.elements.floating,iu((_t=Qe.context)==null?void 0:_t.elements.floating)].includes(ce)||((Ct=Qe.context)==null?void 0:Ct.elements.domReference)===ce})));if(Me===v&&z&&Xf(z,C),l&&Me!==v&&!(Ue!=null&&Ue.isConnected)&&nr(bt(z))===bt(z).body){ot(z)&&z.focus();const Qe=K.current,kt=J(),_t=kt[Qe]||kt[kt.length-1]||z;ot(_t)&&_t.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(S||!c)&&ce&&yt&&!U.current&&ce!==qf()&&(x.current=!0,m(!1,oe,"focus-out"))})}const he=!!(!P&&M);
5function Fe(){Ut(H),y.current.insideReactTree=!0,H.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}if(E&&ot(v))return v.addEventListener("focusout",Te),v.addEventListener("pointerdown",le),E.addEventListener("focusout",Te),he&&E.addEventListener("focusout",Fe,!0),()=>{v.removeEventListener("focusout",Te),v.removeEventListener("pointerdown",le),E.removeEventListener("focusout",Te),he&&E.removeEventListener("focusout",Fe,!0)}},[n,v,E,z,c,P,M,m,d,l,J,S,b,C,y]);const X=k.useRef(null),te=k.useRef(null),pe=Yf([X,M?.beforeInsideRef]),we=Yf([te,M?.afterInsideRef]);k.useEffect(()=>{var le,Te;if(n||!E)return;const he=Array.from((M==null||(le=M.portalNode)==null?void 0:le.querySelectorAll("["+zr("portal")+"]"))||[]),oe=(Te=(P?Df(P.nodesRef.current,b()):[]).find(Ue=>{var xe;return Cf(((xe=Ue.context)==null?void 0:xe.elements.domReference)||null)}))==null||(Te=Te.context)==null?void 0:Te.elements.domReference,ce=[E,oe,...he,..._(),N.current,F.current,X.current,te.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,C.current.includes("reference")||S?v:null].filter(Ue=>Ue!=null),Me=c||S?jf(ce,!L,L):jf(ce);return()=>{Me()}},[n,v,E,c,C,M,S,R,L,P,b,_]),Tt(()=>{if(n||!ot(z))return;const le=bt(z),Te=nr(le);queueMicrotask(()=>{const he=q(z),Fe=O.current,oe=(typeof Fe=="number"?he[Fe]:Fe.current)||z,ce=Et(z,Te);!I&&!ce&&p&&Jr(oe,{preventScroll:oe===z})})},[n,p,z,I,q,O]),Tt(()=>{if(n||!z)return;const le=bt(z),Te=nr(le);aS(Te);function he(ce){let{reason:Me,event:Ue,nested:xe}=ce;if(["hover","safe-polygon"].includes(Me)&&Ue.type==="mouseleave"&&(x.current=!0),Me==="outside-press")if(xe)x.current=!1;else if(Zb(Ue)||eT(Ue))x.current=!1;else{let yt=!1;document.createElement("div").focus({get preventScroll(){return yt=!0,!1}}),yt?x.current=!1:x.current=!0}}g.on("openchange",he);const Fe=le.createElement("span");Fe.setAttribute("tabindex","-1"),Fe.setAttribute("aria-hidden","true"),Object.assign(Fe.style,bl),G&&v&&v.insertAdjacentElement("afterend",Fe);function oe(){if(typeof D.current=="boolean"){const ce=v||qf();return ce&&ce.isConnected?ce:Fe}return D.current.current||Fe}return()=>{g.off("openchange",he);const ce=nr(le),Me=Et(E,ce)||P&&mi(P.nodesRef.current,b(),!1).some(xe=>{var yt;return Et((yt=xe.context)==null?void 0:yt.elements.floating,ce)}),Ue=oe();queueMicrotask(()=>{const xe=lS(Ue);D.current&&!x.current&&ot(xe)&&(!(xe!==ce&&ce!==le.body)||Me)&&xe.focus({preventScroll:!0}),Fe.remove()})}},[n,E,z,D,y,g,P,G,v,b]),k.useEffect(()=>(queueMicrotask(()=>{x.current=!1}),()=>{queueMicrotask(fd)}),[n]),Tt(()=>{if(!n&&M)return M.setFocusManagerState({modal:c,closeOnFocusOut:d,open:p,onOpenChange:m,domReference:v}),()=>{M.setFocusManagerState(null)}},[n,M,c,p,m,d,v]),Tt(()=>{n||z&&Xf(z,C)},[n,z,C]);function Ce(le){return n||!u||!c?null:V.jsx(cS,{ref:le==="start"?N:F,onClick:Te=>m(!1,Te.nativeEvent),children:typeof u=="string"?u:"Dismiss"})}const Ae=!n&&R&&(c?!S:!0)&&(G||c);return V.jsxs(V.Fragment,{children:[Ae&&V.jsx(ca,{"data-type":"inside",ref:pe,onFocus:le=>{if(c){const he=q();Jr(i[0]==="reference"?he[0]:he[he.length-1])}else if(M!=null&&M.preserveTabOrder&&M.portalNode)if(x.current=!1,Xi(le,M.portalNode)){const he=xg(v);he?.focus()}else{var Te;(Te=M.beforeOutsideRef.current)==null||Te.focus()}}}),!S&&Ce("start"),t,Ce("end"),Ae&&V.jsx(ca,{"data-type":"inside",ref:we,onFocus:le=>{if(c)Jr(q()[0]);else if(M!=null&&M.preserveTabOrder&&M.portalNode)if(d&&(x.current=!0),Xi(le,M.portalNode)){const he=kg(v);he?.focus()}else{var Te;(Te=M.afterOutsideRef.current)==null||Te.focus()}}})]})}let Qs=0;const Qf="--floating-ui-scrollbar-width";function uS(){const r=ld(),e=/iP(hone|ad|od)|iOS/.test(r)||r==="MacIntel"&&navigator.maxTouchPoints>1,t=document.body.style,i=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",s=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,a=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",t.setProperty(Qf,s+"px"),s&&(t[i]=s+"px"),e){var l,c;const u=((l=window.visualViewport)==null?void 0:l.offsetLeft)||0,d=((c=window.visualVie
5wport)==null?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(d))+"px",left:-(o-Math.floor(u))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[i]:""}),t.removeProperty(Qf),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,a))}}let Jf=()=>{};const dS=k.forwardRef(function(e,t){const{lockScroll:n=!1,...i}=e;return Tt(()=>{if(n)return Qs++,Qs===1&&(Jf=uS()),()=>{Qs--,Qs===0&&Jf()}},[n]),V.jsx("div",{ref:t,...i,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}})});function Zf(r){return ot(r.target)&&r.target.tagName==="BUTTON"}function fS(r){return ot(r.target)&&r.target.tagName==="A"}function eh(r){return cd(r)}function hS(r,e){e===void 0&&(e={});const{open:t,onOpenChange:n,dataRef:i,elements:{domReference:s}}=r,{enabled:o=!0,event:a="click",toggle:l=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:d=!0}=e,f=k.useRef(),h=k.useRef(!1),p=k.useMemo(()=>({onPointerDown(m){f.current=m.pointerType},onMouseDown(m){const g=f.current;m.button===0&&a!=="click"&&(hs(g,!0)&&c||(t&&l&&(!(i.current.openEvent&&d)||i.current.openEvent.type==="mousedown")?n(!1,m.nativeEvent,"click"):(m.preventDefault(),n(!0,m.nativeEvent,"click"))))},onClick(m){const g=f.current;if(a==="mousedown"&&f.current){f.current=void 0;return}hs(g,!0)&&c||(t&&l&&(!(i.current.openEvent&&d)||i.current.openEvent.type==="click")?n(!1,m.nativeEvent,"click"):n(!0,m.nativeEvent,"click"))},onKeyDown(m){f.current=void 0,!(m.defaultPrevented||!u||Zf(m))&&(m.key===" "&&!eh(s)&&(m.preventDefault(),h.current=!0),!fS(m)&&m.key==="Enter"&&n(!(t&&l),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||Zf(m)||eh(s)||m.key===" "&&h.current&&(h.current=!1,n(!(t&&l),m.nativeEvent,"click"))}}),[i,s,a,c,u,n,t,d,l]);return k.useMemo(()=>o?{reference:p}:{},[o,p])}const pS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},mS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},th=r=>{var e,t;return{escapeKey:typeof r=="boolean"?r:(e=r?.escapeKey)!=null?e:!1,outsidePress:typeof r=="boolean"?r:(t=r?.outsidePress)!=null?t:!0}};function gS(r,e){e===void 0&&(e={});const{open:t,onOpenChange:n,elements:i,dataRef:s}=r,{enabled:o=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=El(),g=Nt(typeof l=="function"?l:()=>!1),y=typeof l=="function"?g:l,v=k.useRef(!1),{escapeKey:E,outsidePress:b}=th(h),{escapeKey:_,outsidePress:I}=th(p),S=k.useRef(!1),A=Nt(P=>{var M;if(!t||!o||!a||P.key!=="Escape"||S.current)return;const N=(M=s.current.floatingContext)==null?void 0:M.nodeId,F=m?mi(m.nodesRef.current,N):[];if(!E&&(P.stopPropagation(),F.length>0)){let x=!0;if(F.forEach(U=>{var K;if((K=U.context)!=null&&K.open&&!U.context.dataRef.current.__escapeKeyBubbles){x=!1;return}}),!x)return}n(!1,Jb(P)?P.nativeEvent:P,"escape-key")}),R=Nt(P=>{var M;const N=()=>{var F;A(P),(F=Nn(P))==null||F.removeEventListener("keydown",N)};(M=Nn(P))==null||M.addEventListener("keydown",N)}),L=Nt(P=>{var M;const N=s.current.insideReactTree;s.current.insideReactTree=!1;const F=v.current;if(v.current=!1,c==="click"&&F||N||typeof y=="function"&&!y(P))return;const x=Nn(P),U="["+zr("inert")+"]",K=bt(i.floating).querySelectorAll(U);let H=Be(x)?x:null;for(;H&&!or(H);){const q=dr(H);if(or(q)||!Be(q))break;H=q}if(K.length&&Be(x)&&!Xb(x)&&!Et(x,i.floating)&&Array.from(K).every(q=>!Et(H,q)))return;if(ot(x)&&D){const q=or(x),X=en(x),te=/auto|scroll/,pe=q||te.test(X.overflowX),we=q||te.test(X.overflowY),Ce=pe&&x.clientWidth>0&&x.scrollWidth>x.clientWidth,Ae=we&&x.clientHeight>0&&x.scrollHeight>x.clientHeight,le=X.direction==="rtl",Te=Ae&&(le?P.offsetX<=x.offsetWidth-x.clientWidth:P.offsetX>x.clientWidth),he=Ce&&P.offsetY>x.clientHeight;if(Te||he)return}const G=(M=s.current.floatingContext)==null?void 0:M.nodeId,z=m&&mi(m.nodesRef.current,G).some(q=>{var X;return Ul(P,(X=q.context)==null?void 0:X.elements.floating)});if(Ul(P,i.floating)||Ul(P,i.domReference)||z)return;const J=m?mi(m.nodesRef.current,G):[];if(J.length>0){let q=!0;if(J.forEach(X=>{var te;
5if((te=X.context)!=null&&te.open&&!X.context.dataRef.current.__outsidePressBubbles){q=!1;return}}),!q)return}n(!1,P,"outside-press")}),C=Nt(P=>{var M;const N=()=>{var F;L(P),(F=Nn(P))==null||F.removeEventListener(c,N)};(M=Nn(P))==null||M.addEventListener(c,N)});k.useEffect(()=>{if(!t||!o)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=b;let P=-1;function M(K){n(!1,K,"ancestor-scroll")}function N(){window.clearTimeout(P),S.current=!0}function F(){P=window.setTimeout(()=>{S.current=!1},pl()?5:0)}const x=bt(i.floating);a&&(x.addEventListener("keydown",_?R:A,_),x.addEventListener("compositionstart",N),x.addEventListener("compositionend",F)),y&&x.addEventListener(c,I?C:L,I);let U=[];return f&&(Be(i.domReference)&&(U=ar(i.domReference)),Be(i.floating)&&(U=U.concat(ar(i.floating))),!Be(i.reference)&&i.reference&&i.reference.contextElement&&(U=U.concat(ar(i.reference.contextElement)))),U=U.filter(K=>{var H;return K!==((H=x.defaultView)==null?void 0:H.visualViewport)}),U.forEach(K=>{K.addEventListener("scroll",M,{passive:!0})}),()=>{a&&(x.removeEventListener("keydown",_?R:A,_),x.removeEventListener("compositionstart",N),x.removeEventListener("compositionend",F)),y&&x.removeEventListener(c,I?C:L,I),U.forEach(K=>{K.removeEventListener("scroll",M)}),window.clearTimeout(P)}},[s,i,a,y,c,t,n,f,o,E,b,A,_,R,L,I,C]),k.useEffect(()=>{s.current.insideReactTree=!1},[s,y,c]);const O=k.useMemo(()=>({onKeyDown:A,...u&&{[pS[d]]:P=>{n(!1,P.nativeEvent,"reference-press")},...d!=="click"&&{onClick(P){n(!1,P.nativeEvent,"reference-press")}}}}),[A,n,u,d]),D=k.useMemo(()=>({onKeyDown:A,onMouseDown(){v.current=!0},onMouseUp(){v.current=!0},[mS[c]]:()=>{s.current.insideReactTree=!0}}),[A,c,s]);return k.useMemo(()=>o?{reference:O,floating:D}:{},[o,O,D])}function yS(r){const{open:e=!1,onOpenChange:t,elements:n}=r,i=vl(),s=k.useRef({}),[o]=k.useState(()=>QT()),a=dd()!=null,[l,c]=k.useState(n.reference),u=Nt((h,p,m)=>{s.current.openEvent=h?p:void 0,o.emit("openchange",{open:h,event:p,reason:m,nested:a}),t?.(h,p,m)}),d=k.useMemo(()=>({setPositionReference:c}),[]),f=k.useMemo(()=>({reference:l||n.reference||null,floating:n.floating||null,domReference:n.reference}),[l,n.reference,n.floating]);return k.useMemo(()=>({dataRef:s,open:e,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[e,u,f,o,i,d])}function vS(r){r===void 0&&(r={});const{nodeId:e}=r,t=yS({...r,elements:{reference:null,floating:null,...r.elements}}),n=r.rootContext||t,i=n.elements,[s,o]=k.useState(null),[a,l]=k.useState(null),u=i?.domReference||s,d=k.useRef(null),f=El();Tt(()=>{u&&(d.current=u)},[u]);const h=VT({...r,elements:{...i,...a&&{reference:a}}}),p=k.useCallback(E=>{const b=Be(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;l(b),h.refs.setReference(b)},[h.refs]),m=k.useCallback(E=>{(Be(E)||E===null)&&(d.current=E,o(E)),(Be(h.refs.reference.current)||h.refs.reference.current===null||E!==null&&!Be(E))&&h.refs.setReference(E)},[h.refs]),g=k.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),y=k.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),v=k.useMemo(()=>({...h,...n,refs:g,elements:y,nodeId:e}),[h,g,y,e,n]);return Tt(()=>{n.dataRef.current.floatingContext=v;const E=f?.nodesRef.current.find(b=>b.id===e);E&&(E.context=v)}),k.useMemo(()=>({...h,context:v,refs:g,elements:y}),[h,g,y,v])}function Wl(){return Yb()&&Ig()}function VO(r,e){e===void 0&&(e={});const{open:t,onOpenChange:n,events:i,dataRef:s,elements:o}=r,{enabled:a=!0,visibleOnly:l=!0}=e,c=k.useRef(!1),u=k.useRef(-1),d=k.useRef(!0);k.useEffect(()=>{if(!a)return;const h=wt(o.domReference);function p(){!t&&ot(o.domReference)&&o.domReference===nr(bt(o.domReference))&&(c.current=!0)}function m(){d.current=!0}function g(){d.current=!1}return h.addEventListener("blur",p),Wl()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",g,!0)),()=>{h.removeEventListener("blur",p),Wl()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",g,!0))}},[o.domReference,t,a]),k.useEffect(()=>{if(!a)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return i.on("openchange",h),()=>{i.off("openchange",h)}},[i,a]),k.useEffect(()=>()=>{Ut(u)},[]);const f=k.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Nn(h.nativeEvent);if(l&&Be(p)){if(Wl()&&!h.relatedTarget){if(!d.current&&!cd(p))return}else if(!Qb(p))return}n(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,g=Be(p)&&p.hasAttribute(zr("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var y;const v=nr(o.domReference?o.domReference.ownerDocument:document);!p&&v===o.domReference||Et((y=s.current.floatingContext)==null?void 0:y.refs.floating.current,v)||Et(o.domReference,v)||g||n(!1,m,"focus")})}}),[s,o.domReference,n,l]);return k.useMemo(()=>a?{reference:f}:{},[a,f])}function Yl(r,e,t){const n=new Map,i=t==="item";let s=r;if(i&&r){const{[$f]:o,[Uf]:a,...l}=r;s=l}return{...t==="floating"&&{tabIndex:-1,[jT]:""},...s,...e.map(o=>{const a=o?o[t]:null;return typeof a=="function"?r?a(r):null:a}).concat(r).reduce((o,a)=>
5(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(i&&[$f,Uf].includes(c)))if(c.indexOf("on")===0){if(n.has(c)||n.set(c,[]),typeof u=="function"){var d;(d=n.get(c))==null||d.push(u),o[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=n.get(c))==null?void 0:f.map(g=>g(...p)).find(g=>g!==void 0)}}}else o[c]=u}),o),{})}}function ES(r){r===void 0&&(r=[]);const e=r.map(a=>a?.reference),t=r.map(a=>a?.floating),n=r.map(a=>a?.item),i=k.useCallback(a=>Yl(a,r,"reference"),e),s=k.useCallback(a=>Yl(a,r,"floating"),t),o=k.useCallback(a=>Yl(a,r,"item"),n);return k.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:o}),[i,s,o])}const bS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function TS(r,e){var t,n;e===void 0&&(e={});const{open:i,elements:s,floatingId:o}=r,{enabled:a=!0,role:l="dialog"}=e,c=vl(),u=((t=s.domReference)==null?void 0:t.id)||c,d=k.useMemo(()=>{var v;return((v=iu(s.floating))==null?void 0:v.id)||o},[s.floating,o]),f=(n=bS.get(l))!=null?n:l,p=dd()!=null,m=k.useMemo(()=>f==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:i?d:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,i,u,l]),g=k.useMemo(()=>{const v={id:d,...f&&{role:f}};return f==="tooltip"||l==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,l]),y=k.useCallback(v=>{let{active:E,selected:b}=v;const _={role:"option",...E&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{..._,"aria-selected":b}}return{}},[d,l]);return k.useMemo(()=>a?{reference:m,floating:g,item:y}:{},[a,m,g,y])}const SS="_tooltip_ab26y_1",AS={tooltip:SS};function Ug({children:r,renderPopup:e}){const[t,n]=k.useState(!1),{x:i,y:s,refs:o,strategy:a,context:l}=vS({open:t,onOpenChange:n,middleware:[HT(4),KT(),zT()],placement:"bottom",whileElementsMounted:PT}),{getReferenceProps:c,getFloatingProps:u}=ES([hS(l),gS(l),TS(l)]);return V.jsxs(V.Fragment,{children:[V.jsx("span",{role:"button",className:"border-none p-0 leading-none text-inherit  hover:cursor-pointer hover:opacity-80",...c({ref:o.setReference,onClick:d=>{d.preventDefault(),d.stopPropagation()}}),tabIndex:-1,children:r}),t?V.jsx(sS,{id:"bm-root-modal",children:V.jsx("div",{...u({ref:o.setFloating,className:Ee(AS.tooltip,"rounded-[0.4rem] drop-shadow-[0 4px 16px rgba(0,0,0,0.25)] text-align p-[0.5rem] max-w-[18rem] bg-bg-tooltip text-[var(--color-text-tooltip,var(--text-white))] text-xxs z-[301] after:border-x-transparent after:border-t-transparent after:border-b-[var(--color-bg-tooltip)]"),style:{position:a,top:s??"",left:i??""}}),children:e})}):null]})}const _S=()=>V.jsx(Ug,{renderPopup:V.jsx(V.Fragment,{children:"Promo available."}),children:V.jsx("div",{className:"flex flex-row items-center gap-2","data-testid":"promo_enabled",children:V.jsx(St,{name:"badge-promo",size:"sm"})})}),RS=({links:r,LinkComponent:e})=>V.jsxs("div",{className:"text-text-button-racenav-next md:text-text-secondary max-md:bg-bg-raceheader-primary flex flex-row items-center gap-2 pb-2 pl-3 pt-2 text-xs font-semibold uppercase md:mb-0 md:gap-1 md:pb-0 md:pl-0 md:pt-0",children:[V.jsx("button",{type:"button",className:"bg-bg-raceheader-dropdown flex h-6 w-6 items-center justify-center rounded-full md:hidden",onClick:()=>window.history.back(),children:V.jsx(St,{name:"chevron-right-bold",size:"xs"})}),r.map((t,n,i)=>V.jsxs(k.Fragment,{children:[t.linkOptions?V.jsx(e,{className:Ee("whitespace-nowrap text-nowrap",{truncate:i.length>2&&i.length-1===n}),...t.linkOptions,children:t.label}):V.jsx("span",{children:t.label}),n<r.length-1?V.jsx("span",{children:"/"}):null]},t.label||n))]}),IS=(r,e)=>{const t=new Array(r.length+e.length);for(let n=0;n<r.length;n++)t[n]=r[n];for(let n=0;n<e.length;
vendor: 9,786 bytes, line 5
5n++)t[r.length+n]=e[n];return t},LS=(r,e)=>({classGroupId:r,validator:e}),Vg=(r=new Map,e=null,t)=>({nextPart:r,validators:e,classGroupId:t}),ua="-",nh=[],wS="arbitrary..",xS=r=>{const e=CS(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return kS(o);const a=o.split(ua),l=a[0]===""&&a.length>1?1:0;return Gg(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=t[o];return l?c?IS(c,l):l:c||nh}return t[o]||nh}}},Gg=(r,e,t)=>{if(r.length-e===0)return t.classGroupId;const i=r[e],s=t.nextPart.get(i);if(s){const c=Gg(r,e+1,s);if(c)return c}const o=t.validators;if(o===null)return;const a=e===0?r.join(ua):r.slice(e).join(ua),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},kS=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=r.slice(1,-1),t=e.indexOf(":"),n=e.slice(0,t);return n?wS+n:void 0})(),CS=r=>{const{theme:e,classGroups:t}=r;return DS(t,e)},DS=(r,e)=>{const t=Vg();for(const n in r){const i=r[n];hd(i,t,n,e)}return t},hd=(r,e,t,n)=>{const i=r.length;for(let s=0;s<i;s++){const o=r[s];PS(o,e,t,n)}},PS=(r,e,t,n)=>{if(typeof r=="string"){OS(r,e,t);return}if(typeof r=="function"){MS(r,e,t,n);return}NS(r,e,t,n)},OS=(r,e,t)=>{const n=r===""?e:Hg(e,r);n.classGroupId=t},MS=(r,e,t,n)=>{if(FS(r)){hd(r(n),e,t,n);return}e.validators===null&&(e.validators=[]),e.validators.push(LS(t,r))},NS=(r,e,t,n)=>{const i=Object.entries(r),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];hd(l,Hg(e,a),t,n)}},Hg=(r,e)=>{let t=r;const n=e.split(ua),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=t.nextPart.get(o);a||(a=Vg(),t.nextPart.set(o,a)),t=a}return t},FS=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,BS=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),n=Object.create(null);const i=(s,o)=>{t[s]=o,e++,e>r&&(e=0,n=t,t=Object.create(null))};return{get(s){let o=t[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in t?t[s]=o:i(s,o)}}},su="!",rh=":",$S=[],ih=(r,e,t,n,i)=>({modifiers:r,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:n,isExternal:i}),US=r=>{const{prefix:e,experimentalParseClassName:t}=r;let n=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let m=0;m<u;m++){const g=i[m];if(o===0&&a===0){if(g===rh){s.push(i.slice(l,m)),l=m+1;continue}if(g==="/"){c=m;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(l);let f=d,h=!1;d.endsWith(su)?(f=d.slice(0,-1),h=!0):d.startsWith(su)&&(f=d.slice(1),h=!0);const p=c&&c>l?c-l:void 0;return ih(s,h,f,p)};if(e){const i=e+rh,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):ih($S,!1,o,void 0,!0)}if(t){const i=n;n=s=>t({className:s,parseClassName:i})}return n},VS=r=>{const e=new Map;return r.orderSensitiveModifiers.forEach((t,n)=>{e.set(t,1e6+n)}),t=>{const n=[];let i=[];for(let s=0;s<t.length;s++){const o=t[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},GS=r=>({cache:BS(r.cacheSize),parseClassName:US(r),sortModifiers:VS(r),...xS(r)}),HS=/\s+/,zS=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=r.trim().split(HS);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=t(u);if(d){l=u+(l.length>0?" "+l:l);continue}let g=!!m,y=n(g?p.substring(0,m):p);if(!y){if(!g){l=u+(l.length>0?" "+l:l);continue}if(y=n(p),!y){l=u+(l.length>0?" "+l:l);continue}g=!1}const v=f.length===0?"":f.length===1?f[0]:s(f).join(":"),E=h?v+su:v,b=E+y;if(o.indexOf(b)>-1)continue;o.push(b);const _=i(y,g);for(let I=0;I<_.length;++I){const S=_[I];o.push(E+S)}l=u+(l.length>0?" "+l:l)}return l},KS=(...r)=>{let e=0,t,n,i="";for(;e<r.length;)(t=r[e++])&&(n=zg(t))&&(i&&(i+=" "),i+=n);return i},zg=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=zg(r[n]))&&(t&&(t+=" "),t+=e);return t},jS=(r,...e)=>{let t,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),r());return t=GS(c),n=t.cache.get,i=t.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=zS(l,t);return i(l,u),u};return s=o,(...l)=>s(KS(...l))},WS=[],Ze=r=>{const e=t=>t[r]||WS;return e.isThemeGetter=!0,e},Kg=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,jg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,YS=/^\d+\/\d+$/,qS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,QS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,JS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zr=r=>YS.test(r),ge=r=>!!r&&!Number.isNaN(Number(r)),Kn=r=>!!r&&Number.isInteger(Number(r)),ql=r=>r.endsWith("%")&&ge(r.slice(0,-1)),Ln=r=>qS.test(r),eA=()=>!0,tA=r=>XS.test(r)&&!QS.test(r),Wg=()=>!1,nA=r=>JS.test(r),rA=r=>ZS.test(r),iA=r=>!ne(r)&&!re(r),sA=r=>Di(r,Xg,Wg),ne=r=>Kg.test(r),Sr=r=>Di(r,Qg,tA),Xl=r=>Di(r,uA,ge),sh=r=>Di(r,Yg,Wg),oA=r=>Di(r,qg,rA),Js=r=>Di(r,Jg,nA),re=r=>jg.test(r),Ni=r=>Pi(r,Qg),aA=r=>Pi(r,dA),oh=r=>Pi(r,Yg),lA=r=>Pi(r,Xg),cA=r=>Pi(r,qg),Zs=r=>Pi(r,Jg,!0),Di=(r,e,t)=>{const n=Kg.exec(r);return n?n[1]?e(n[1]):t(n[2]):!1},Pi=(r,e,t=!1)=>{const n=jg.exec(r);return n?n[1]?e(n[1]):t:!1},Yg=r=>r==="position"||r==="percentage",qg=r=>r==="image"||r==="url",Xg=r=>r==="length"||r==="size"||r==="bg-size",Qg=r=>r==="length",uA=r=>r==="number",dA=r=>r==="family-name",Jg=r=>r==="shadow",fA=()=>{const r=Ze("color"),e=Ze("font"),t=Ze("text"),n=Ze("font-weight"),i=Ze("tracking"),s=Ze("leading"),o=Ze("breakpoint"),a=Ze("container"),l=Ze("spacing"),c=Ze("radius"),u=Ze("shadow"),d=Ze("inset-shadow"),f=Ze("text-shadow"),h=Ze("drop-shadow"),p=Ze("blur"),m=Ze("perspective"),g=Ze("aspect"),y=Ze("ease"),v=Ze("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...b(),re,ne],I=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],A=()=>[re,ne,l],R=()=>[Zr,"full","auto",...A()],L=()=>[Kn,"none","subgrid",re,ne],C=()=>["auto",{span:["full",Kn,re,ne]},Kn,re,ne],O=()=>[Kn,"auto",re,ne],D=()=>["auto","min","max","fr",re,ne],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],N=()=>["auto",...A()],F=()=>[Zr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],x=()=>[r,re,ne],U=()=>[...b(),oh,sh,{position:[re,ne]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",lA,sA,{size:[re,ne]}],G=()=>[ql,Ni,Sr],z=()=>["","none","full",c,re,ne],J=()=>["",ge,Ni,Sr],q=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[ge,ql,oh,sh],pe=()=>["","none",p,re,ne],we=()=>["none",ge,re,ne],Ce=()=>["none",ge,re,ne],Ae=()=>[ge,re,ne],le=()=>[Zr,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ln],breakpoint:[Ln],color:[eA],container:[Ln],"drop-shadow":[Ln],ease:["in","out","in-out"],font:[iA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ln],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ln],shadow:[Ln],spacing:["px",ge],text:[Ln],"text-shadow":[Ln],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zr,ne,re,g]}],container:["container"],columns:[{columns:[ge,ne,re,a]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[Kn,"auto",re,ne]}],basis:[{basis:[Zr,"full","auto",a,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ge,Zr,"auto","initial","none",ne]}],grow:[{grow:["",ge,re,ne]}],shrink:[{shrink:["",ge,re,ne]}],order:[{order:[Kn,"first","last","none",re,ne]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":O()}
vendor: 11,029 bytes, line 5
5],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",t,Ni,Sr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,re,Xl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ql,ne]}],"font-family":[{font:[aA,ne,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,re,ne]}],"line-clamp":[{"line-clamp":[ge,"none",re,Xl]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",re,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:x()}],"text-color":[{text:x()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[ge,"from-font","auto",re,Sr]}],"text-decoration-color":[{decoration:x()}],"underline-offset":[{"underline-offset":[ge,"auto",re,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Kn,re,ne],radial:["",re,ne],conic:[Kn,re,ne]},cA,oA]}],"bg-color":[{bg:x()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:x()}],"gradient-via":[{via:x()}],"gradient-to":[{to:x()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:x()}],"border-color-x":[{"border-x":x()}],"border-color-y":[{"border-y":x()}],"border-color-s":[{"border-s":x()}],"border-color-e":[{"border-e":x()}],"border-color-t":[{"border-t":x()}],"border-color-r":[{"border-r":x()}],"border-color-b":[{"border-b":x()}],"border-color-l":[{"border-l":x()}],"divide-color":[{divide:x()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ge,re,ne]}],"outline-w":[{outline:["",ge,Ni,Sr]}],"outline-color":[{outline:x()}],shadow:[{shadow:["","none",u,Zs,Js]}],"shadow-color":[{shadow:x()}],"inset-shadow":[{"inset-shadow":["none",d,Zs,Js]}],"inset-shadow-color":[{"inset-shadow":x()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:x()}],"ring-offset-w":[{"ring-offset":[ge,Sr]}],"ring-offset-color":[{"ring-offset":x()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":x()}],"text-shadow":[{"text-shadow":["none",f,Zs,Js]}],"text-shadow-color":[{"text-shadow":x()}],opacity:[{opacity:[ge,re,ne]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":x()}],"mask-image-linear-to-color":[{"mask-linear-to":x()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":x()}],"mask-image-t-to-color":[{"mask-t-to":x()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":x()}],"mask-image-r-to-color":[{"mask-r-to":x()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":x()}],"mask-image-b-to-color":[{"mask-b-to":x()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":x()}],"mask-image-l-to-color":[{"mask-l-to":x()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":x()}],"mask-image-x-to-color":[{"mask-x-to":x()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":x()}],"mask-image-y-to-color":[{"mask-y-to":x()}],"mask-image-radial":[{"mask-radial":[re,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":x()}],"mask-image-radial-to-color":[{"mask-radial-to":x()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":x()}],"mask-image-conic-to-color":[{"mask-conic-to":x()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ne]}],filter:[{filter:["","none",re,ne]}],blur:[{blur:pe()}],brightness:[{brightness:[ge,re,ne]}],contrast:[{contrast:[ge,re,ne]}],"drop-shadow":[{"drop-shadow":["","none",h,Zs,Js]}],"drop-shadow-color":[{"drop-shadow":x()}],grayscale:[{grayscale:["",ge,re,ne]}],"hue-rotate":[{"hue-rotate":[ge,re,ne]}],invert:[{invert:["",ge,re,ne]}],saturate:[{saturate:[ge,re,ne]}],sepia:[{sepia:["",ge,re,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ne]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[ge,re,ne]}],"backdrop-contrast":[{"backdrop-contrast":[ge,re,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ge,re,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ge,re,ne]}],"backdrop-invert":[{"backdrop-invert":["",ge,re,ne]}],"backdrop-opacity":[{"backdrop-opacity":[ge,re,ne]}],"backdrop-saturate":[{"backdrop-saturate":[ge,re,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",ge,re,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ge,"initial",re,ne]}],ease:[{ease:["linear","initial",y,re,ne]}],delay:[{delay:[ge,re,ne]}],animate:[{animate:["none",v,re,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,re,ne]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[re,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:x()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:x()}
5],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",re,ne]}],fill:[{fill:["none",...x()]}],"stroke-w":[{stroke:[ge,Ni,Sr,Xl]}],stroke:[{stroke:["none",...x()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_i=jS(fA),ah=["bonus","boost","bonus-back","deposit-match"],hA={small:"xs",medium:"sm",large:"sm"},GO=k.forwardRef(function({type:e="button",className:t="",theme:n="primary",disabled:i=!1,size:s="medium",loading:o=!1,style:a,children:l,...c},u){const d=_i("flex flex-row items-center cursor-pointer justify-center gap-1 rounded-lg font-bold uppercase whitespace-nowrap",t),h=n==="deposit-match"?{...a,background:"linear-gradient(120deg, #FFF177 0%,#ED8E17 90%, #E98107 100%)"}:a,p=Ee({"text-xxs px-3 py-2":s==="small","px-4 py-3 text-xs":s==="medium","px-6 py-4 text-xs":s==="large","bg-bg-button-primary-default text-text-button-primary":!i&&n==="primary","bg-bg-button-secondary-default text-text-button-secondary":!i&&n==="secondary","bg-bg-button-success-default text-text-button-success":!i&&n==="success","bg-bg-button-brand-default text-text-button-brand":!i&&n==="brand","bg-bg-button-confirm-default text-text-button-confirm":!i&&n==="confirm","bg-bg-reward-bonus text-text-black":n==="bonus","text-text-black":n==="deposit-match","bg-bg-reward-boost text-text-black":n==="boost","bg-bg-reward-moneyback text-text-black":n==="bonus-back","bg-ui-red-normal text-white":!i&&n==="attention","border-ui-white-normal border text-white":!i&&n==="stroke","bg-core-primary border-primary border text-primary":!i&&n==="stroke-fill","bg-bg-button-odds-default text-text-button-odds-default":!i&&n==="odds","bg-bg-button-disabled-default text-text-button-disabled":(i||n==="disabled")&&!ah.includes(n),"opacity-50":ah.includes(n)&&i,relative:o},d);return V.jsx("button",{ref:u,className:p,style:h,type:e,disabled:i||o,"aria-busy":o||void 0,...c,children:o?V.jsxs(V.Fragment,{children:[V.jsx("span",{className:"invisible flex flex-row items-center gap-1",children:l}),V.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:V.jsx(St,{name:"loadmore",size:hA[s],className:"animate-spin","aria-hidden":"true"})})]}):l})});var Ql,lh;function pA(){return lh||(lh=1,Ql=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;const e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}),Ql}var eo,ch;function mA(){if(ch)return eo;ch=1;const r=pA(),{hasOwnProperty:e}=Object.prototype,{propertyIsEnumerable:t}=Object,n=(h,p,m)=>Object.defineProperty(h,p,{value:m,writable:!0,enumerable:!0,configurable:!0}),i=eo,s={concatArrays:!1,ignoreUndefined:!1},o=h=>{const p=[];for(const m in h)e.call(h,m)&&p.push(m);if(Object.getOwnPropertySymbols){const m=Object.getOwnPropertySymbols(h);for(const g of m)t.call(h,g)&&p.push(g)}return p};function a(h){return Array.isArray(h)?l(h):r(h)?c(h):h}function l(h){const p=h.slice(0,0);
5return o(h).forEach(m=>{n(p,m,a(h[m]))}),p}function c(h){const p=Object.getPrototypeOf(h)===null?Object.create(null):{};return o(h).forEach(m=>{n(p,m,a(h[m]))}),p}const u=(h,p,m,g)=>(m.forEach(y=>{typeof p[y]>"u"&&g.ignoreUndefined||(y in h&&h[y]!==Object.getPrototypeOf(h)?n(h,y,f(h[y],p[y],g)):n(h,y,a(p[y])))}),h),d=(h,p,m)=>{let g=h.slice(0,0),y=0;return[h,p].forEach(v=>{const E=[];for(let b=0;b<v.length;b++)e.call(v,b)&&(E.push(String(b)),v===h?n(g,y++,v[b]):n(g,y++,a(v[b])));g=u(g,v,o(v).filter(b=>!E.includes(b)),m)}),g};function f(h,p,m){return m.concatArrays&&Array.isArray(h)&&Array.isArray(p)?d(h,p,m):!r(p)||!r(h)?a(p):u(h,p,o(p),m)}return eo=function(...h){const p=f(a(s),this!==i&&this||{},s);let m={_:{}};for(const g of h)if(g!==void 0){if(!r(g))throw new TypeError("`"+g+"` is not an Option Object");m=f(m,{_:g},p)}return m._},eo}var gA=mA();const yA=rd(gA),vA=yA.bind({concatArrays:!0,ignoreUndefined:!0});function EA(r,e){const t=window.localStorage.getItem(r);if(t){const n=JSON.parse(t),i=JSON.parse(e),s=JSON.stringify(vA(n,i));window.localStorage.setItem(r,s)}else window.localStorage.setItem(r,e)}function ei(r,e){return new Promise((t,n)=>{try{const i=r();e?.(null,i),t(i)}catch(i){e?.(i),n(i)}})}function to(r,e,t){return Promise.all(r).then(n=>{const i=t?.(n)??null;return e?.(null,i),Promise.resolve(i)},n=>(e?.(n),Promise.reject(n)))}const no={getItem:(r,e)=>ei(()=>window.localStorage.getItem(r),e),setItem:(r,e,t)=>ei(()=>window.localStorage.setItem(r,e),t),removeItem:(r,e)=>ei(()=>window.localStorage.removeItem(r),e),mergeItem:(r,e,t)=>ei(()=>EA(r,e),t),clear:r=>ei(()=>window.localStorage.clear(),r),getAllKeys:r=>ei(()=>{const e=window.localStorage.length,t=[];for(let n=0;n<e;n+=1){const i=window.localStorage.key(n)||"";t.push(i)}return t},r),flushGetRequests:()=>{},multiGet:(r,e)=>{const t=r.map(i=>no.getItem(i));return to(t,e,i=>i.map((s,o)=>[r[o],s]))},multiSet:(r,e)=>{const t=r.map(n=>no.setItem(n[0],n[1]));return to(t,e)},multiRemove:(r,e)=>{const t=r.map(n=>no.removeItem(n));return to(t,e)},multiMerge:(r,e)=>{const t=r.map(n=>no.mergeItem(n[0],n[1]));return to(t,e)}},ps=r=>typeof r=="number"&&!isNaN(r),Or=r=>typeof r=="string",Kt=r=>typeof r=="function",Uo=r=>Or(r)||Kt(r)?r:null,ou=r=>k.isValidElement(r)||Or(r)||Kt(r)||ps(r);function bA(r,e,t){t===void 0&&(t=300);const{scrollHeight:n,style:i}=r;requestAnimationFrame(()=>{i.minHeight="initial",i.height=n+"px",i.transition=`all ${t}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(e,t)})})}function Tl(r){let{enter:e,exit:t,appendPosition:n=!1,collapse:i=!0,collapseDuration:s=300}=r;return function(o){let{children:a,position:l,preventExitTransition:c,done:u,nodeRef:d,isIn:f,playToast:h}=o;const p=n?`${e}--${l}`:e,m=n?`${t}--${l}`:t,g=k.useRef(0);return k.useLayoutEffect(()=>{const y=d.current,v=p.split(" "),E=b=>{b.target===d.current&&(h(),y.removeEventListener("animationend",E),y.removeEventListener("animationcancel",E),g.current===0&&b.type!=="animationcancel"&&y.classList.remove(...v))};y.classList.add(...v),y.addEventListener("animationend",E),y.addEventListener("animationcancel",E)},[]),k.useEffect(()=>{const y=d.current,v=()=>{y.removeEventListener("animationend",v),i?bA(y,u,s):u()};f||(c?v():(g.current=1,y.className+=` ${m}`,y.addEventListener("animationend",v)))},[f]),_e.createElement(_e.Fragment,null,a)}}function uh(r,e){return r!=null?{content:r.content,containerId:r.props.containerId,id:r.props.toastId,theme:r.props.theme,type:r.props.type,data:r.props.data||{},isLoading:r.props.isLoading,icon:r.props.icon,status:e}:{}}const It=new Map;let ms=[];const au=new Set,TA=r=>au.forEach(e=>e(r)),Zg=()=>It.size>0;function ey(r,e){var t;if(e)return!((t=It.get(e))==null||!t.isToastActive(r));let n=!1;return It.forEach(i=>{i.isToastActive(r)&&(n=!0)}),n}function ty(r,e){ou(r)&&(Zg()||ms.push({content:r,options:e}),It.forEach(t=>{t.buildToast(r,e)}))}function dh(r,e){It.forEach(t=>{e!=null&&e!=null&&e.containerId?e?.containerId===t.id&&t.toggle(r,e?.id):t.toggle(r,e?.id)})}function SA(r){const{subscribe:e,getSnapshot:t,setProps:n}=k.useRef((function(s){const o=s.containerId||1;return{subscribe(a){const l=(function(u,d,f){let h=1,p=0,m=[],g=[],y=[],v=d;const E=new Map,b=new Set,_=()=>{y=Array.from(E.values()),b.forEach(A=>A())},I=A=>{g=A==null?[]:g.filter(R=>R!==A),_()},S=A=>{const{toastId:R,onOpen:L,updateId:C,children:O}=A.props,D=C==null;A.staleId&&E.delete(A.staleId),E.set(R,A),g=[...g,A.props.toastId].filter(P=>P!==A.staleId),_(),f(uh(A,D?"added":"updated")),D&&Kt(L)&&L(k.isValidElement(O)&&O.props)};return{id:u,props:v,observe:A=>(b.add(A),()=>b.delete(A)),toggle:(A,R)=>
5{E.forEach(L=>{R!=null&&R!==L.props.toastId||Kt(L.toggle)&&L.toggle(A)})},removeToast:I,toasts:E,clearQueue:()=>{p-=m.length,m=[]},buildToast:(A,R)=>{if((G=>{let{containerId:z,toastId:J,updateId:q}=G;const X=z?z!==u:u!==1,te=E.has(J)&&q==null;return X||te})(R))return;const{toastId:L,updateId:C,data:O,staleId:D,delay:P}=R,M=()=>{I(L)},N=C==null;N&&p++;const F={...v,style:v.toastStyle,key:h++,...Object.fromEntries(Object.entries(R).filter(G=>{let[z,J]=G;return J!=null})),toastId:L,updateId:C,data:O,closeToast:M,isIn:!1,className:Uo(R.className||v.toastClassName),bodyClassName:Uo(R.bodyClassName||v.bodyClassName),progressClassName:Uo(R.progressClassName||v.progressClassName),autoClose:!R.isLoading&&(x=R.autoClose,U=v.autoClose,x===!1||ps(x)&&x>0?x:U),deleteToast(){const G=E.get(L),{onClose:z,children:J}=G.props;Kt(z)&&z(k.isValidElement(J)&&J.props),f(uh(G,"removed")),E.delete(L),p--,p<0&&(p=0),m.length>0?S(m.shift()):_()}};var x,U;F.closeButton=v.closeButton,R.closeButton===!1||ou(R.closeButton)?F.closeButton=R.closeButton:R.closeButton===!0&&(F.closeButton=!ou(v.closeButton)||v.closeButton);let K=A;k.isValidElement(A)&&!Or(A.type)?K=k.cloneElement(A,{closeToast:M,toastProps:F,data:O}):Kt(A)&&(K=A({closeToast:M,toastProps:F,data:O}));const H={content:K,props:F,staleId:D};v.limit&&v.limit>0&&p>v.limit&&N?m.push(H):ps(P)?setTimeout(()=>{S(H)},P):S(H)},setProps(A){v=A},setToggle:(A,R)=>{E.get(A).toggle=R},isToastActive:A=>g.some(R=>R===A),getSnapshot:()=>y}})(o,s,TA);It.set(o,l);const c=l.observe(a);return ms.forEach(u=>ty(u.content,u.options)),ms=[],()=>{c(),It.delete(o)}},setProps(a){var l;(l=It.get(o))==null||l.setProps(a)},getSnapshot(){var a;return(a=It.get(o))==null?void 0:a.getSnapshot()}}})(r)).current;n(r);const i=k.useSyncExternalStore(e,t,t);return{getToastToRender:function(s){if(!i)return[];const o=new Map;
5return r.newestOnTop&&i.reverse(),i.forEach(a=>{const{position:l}=a.props;o.has(l)||o.set(l,[]),o.get(l).push(a)}),Array.from(o,a=>s(a[0],a[1]))},isToastActive:ey,count:i?.length}}function AA(r){const[e,t]=k.useState(!1),[n,i]=k.useState(!1),s=k.useRef(null),o=k.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:l,closeToast:c,onClick:u,closeOnClick:d}=r;var f,h;function p(){t(!0)}function m(){t(!1)}function g(E){const b=s.current;o.canDrag&&b&&(o.didMove=!0,e&&m(),o.delta=r.draggableDirection==="x"?E.clientX-o.start:E.clientY-o.start,o.start!==E.clientX&&(o.canCloseOnClick=!1),b.style.transform=`translate3d(${r.draggableDirection==="x"?`${o.delta}px, var(--y)`:`0, calc(${o.delta}px + var(--y))`},0)`,b.style.opacity=""+(1-Math.abs(o.delta/o.removalDistance)))}function y(){document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",y);const E=s.current;if(o.canDrag&&o.didMove&&E){if(o.canDrag=!1,Math.abs(o.delta)>o.removalDistance)return i(!0),r.closeToast(),void r.collapseAll();E.style.transition="transform 0.2s, opacity 0.2s",E.style.removeProperty("transform"),E.style.removeProperty("opacity")}}(h=It.get((f={id:r.toastId,containerId:r.containerId,fn:t}).containerId||1))==null||h.setToggle(f.id,f.fn),k.useEffect(()=>{if(r.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",p),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",p),window.removeEventListener("blur",m)}},[r.pauseOnFocusLoss]);const v={onPointerDown:function(E){if(r.draggable===!0||r.draggable===E.pointerType){o.didMove=!1,document.addEventListener("pointermove",g),document.addEventListener("pointerup",y);const b=s.current;o.canCloseOnClick=!0,o.canDrag=!0,b.style.transition="none",r.draggableDirection==="x"?(o.start=E.clientX,o.removalDistance=b.offsetWidth*(r.draggablePercent/100)):(o.start=E.clientY,o.removalDistance=b.offsetHeight*(r.draggablePercent===80?1.5*r.draggablePercent:r.draggablePercent)/100)}},onPointerUp:function(E){const{top:b,bottom:_,left:I,right:S}=s.current.getBoundingClientRect();E.nativeEvent.type!=="touchend"&&r.pauseOnHover&&E.clientX>=I&&E.clientX<=S&&E.clientY>=b&&E.clientY<=_?m():p()}};return a&&l&&(v.onMouseEnter=m,r.stacked||(v.onMouseLeave=p)),d&&(v.onClick=E=>{u&&u(E),o.canCloseOnClick&&c()}),{playToast:p,pauseToast:m,isRunning:e,preventExitTransition:n,toastRef:s,eventHandlers:v}}function _A(r){let{delay:e,isRunning:t,closeToast:n,type:i="default",hide:s,className:o,style:a,controlledProgress:l,progress:c,rtl:u,isIn:d,theme:f}=r;const h=s||l&&c===0,p={...a,animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};l&&(p.transform=`scaleX(${c})`);const m=Ee("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":u}),g=Kt(o)?o({rtl:u,type:i,defaultClassName:m}):Ee(m,o),y={[l&&c>=1?"onTransitionEnd":"onAnimationEnd"]:l&&c<1?null:()=>{d&&n()}};return _e.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":h},_e.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${i}`}),_e.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:g,style:p,...y}))}let RA=1;const ny=()=>""+RA++;function IA(r){return r&&(Or(r.toastId)||ps(r.toastId))?r.toastId:ny()}function Qi(r,e){return ty(r,e),e.toastId}function da(r,e){return{...e,type:e&&e.type||r,toastId:IA(e)}}function ro(r){return(e,t)=>Qi(e,da(r,t))}function De(r,e){return Qi(r,da("default",e))}De.loading=(r,e)=>Qi(r,da("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),De.promise=function(r,e,t){let n,{pending:i,error:s,success:o}=e;i&&(n=Or(i)?De.loading(i,t):De.loading(i.render,{...t,...i}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(u,d,f)=>{if(d==null)return void De.dismiss(n);const h={type:u,...a,...t,data:f},p=Or(d)?{render:d}:d;return n?De.update(n,{...h,...p}):De(p.render,{...h,...p}),f},c=Kt(r)?r():r;return c.then(u=>l("success",o,u)).catch(u=>l("error",s,u)),c},De.success=ro("success"),De.info=ro("info"),De.error=ro("error"),De.warning=ro("warning"),De.warn=De.warning,De.dark=(r,e)=>Qi(r,da("default",{theme:"dark",...e})),De.dismiss=function(r){(function(e){var t;if(Zg()){if(e==null||Or(t=e)||ps(t))It.forEach(n=>
5{n.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const n=It.get(e.containerId);n?n.removeToast(e.id):It.forEach(i=>{i.removeToast(e.id)})}}else ms=ms.filter(n=>e!=null&&n.options.toastId!==e)})(r)},De.clearWaitingQueue=function(r){r===void 0&&(r={}),It.forEach(e=>{!e.props.limit||r.containerId&&e.id!==r.containerId||e.clearQueue()})},De.isActive=ey,De.update=function(r,e){e===void 0&&(e={});const t=((n,i)=>{var s;let{containerId:o}=i;return(s=It.get(o||1))==null?void 0:s.toasts.get(n)})(r,e);if(t){const{props:n,content:i}=t,s={delay:100,...n,...e,toastId:e.toastId||r,updateId:ny()};s.toastId!==r&&(s.staleId=r);const o=s.render||i;delete s.render,Qi(o,s)}},De.done=r=>{De.update(r,{progress:1})},De.onChange=function(r){return au.add(r),()=>{au.delete(r)}},De.play=r=>dh(!0,r),De.pause=r=>dh(!1,r);const LA=typeof window<"u"?k.useLayoutEffect:k.useEffect,io=r=>{let{theme:e,type:t,isLoading:n,...i}=r;return _e.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...i})},Jl={info:function(r){return _e.createElement(io,{...r},_e.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(r){return _e.createElement(io,{...r},_e.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(r){return _e.createElement(io,{...r},_e.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(r){return _e.createElement(io,{...r},_e.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return _e.createElement("div",{className:"Toastify__spinner"})}},wA=r=>{const{isRunning:e,preventExitTransition:t,toastRef:n,eventHandlers:i,playToast:s}=AA(r),{closeButton:o,children:a,autoClose:l,onClick:c,type:u,hideProgressBar:d,closeToast:f,transition:h,position:p,className:m,style:g,bodyClassName:y,bodyStyle:v,progressClassName:E,progressStyle:b,updateId:_,role:I,progress:S,rtl:A,toastId:R,deleteToast:L,isIn:C,isLoading:O,closeOnClick:D,theme:P}=r,M=Ee("Toastify__toast",`Toastify__toast-theme--${P}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":A},{"Toastify__toast--close-on-click":D}),N=Kt(m)?m({rtl:A,position:p,type:u,defaultClassName:M}):Ee(M,m),F=(function(H){let{theme:G,type:z,isLoading:J,icon:q}=H,X=null;const te={theme:G,type:z};return q===!1||(Kt(q)?X=q({...te,isLoading:J}):k.isValidElement(q)?X=k.cloneElement(q,te):J?X=Jl.spinner():(pe=>pe in Jl)(z)&&(X=Jl[z](te))),X})(r),x=!!S||!l,U={closeToast:f,type:u,theme:P};let K=null;return o===!1||(K=Kt(o)?o(U):k.isValidElement(o)?k.cloneElement(o,U):(function(H){let{closeToast:G,theme:z,ariaLabel:J="close"}=H;return _e.createElement("button",{className:`Toastify__close-button Toastify__close-button--${z}`,type:"button",onClick:q=>{q.stopPropagation(),G(q)},"aria-label":J},_e.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},_e.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(U)),_e.createElement(h,{isIn:C,done:L,position:p,preventExitTransition:t,nodeRef:n,playToast:s},_e.createElement("div",{id:R,onClick:c,"data-in":C,className:N,...i,style:g,ref:n},_e.createElement("div",{...C&&{role:I},className:Kt(y)?y({type:u}):Ee("Toastify__toast-body",y),style:v},F!=null&&_e.createElement("div",{className:Ee("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter"
5:!O})},F),_e.createElement("div",null,a)),K,_e.createElement(_A,{..._&&!x?{key:`pb-${_}`}:{},rtl:A,theme:P,delay:l,isRunning:e,isIn:C,closeToast:f,hide:d,type:u,style:b,className:E,controlledProgress:x,progress:S||0})))},Sl=function(r,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${r}-enter`,exit:`Toastify--animate Toastify__${r}-exit`,appendPosition:e}},xA=Tl(Sl("bounce",!0));Tl(Sl("slide",!0));const kA=Tl(Sl("zoom"));Tl(Sl("flip"));const CA={position:"top-right",transition:xA,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function HO(r){let e={...CA,...r};const t=r.stacked,[n,i]=k.useState(!0),s=k.useRef(null),{getToastToRender:o,isToastActive:a,count:l}=SA(e),{className:c,style:u,rtl:d,containerId:f}=e;function h(m){const g=Ee("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":d});return Kt(c)?c({position:m,rtl:d,defaultClassName:g}):Ee(g,Uo(c))}function p(){t&&(i(!0),De.play())}return LA(()=>{if(t){var m;const g=s.current.querySelectorAll('[data-in="true"]'),y=12,v=(m=e.position)==null?void 0:m.includes("top");let E=0,b=0;Array.from(g).reverse().forEach((_,I)=>{const S=_;S.classList.add("Toastify__toast--stacked"),I>0&&(S.dataset.collapsed=`${n}`),S.dataset.pos||(S.dataset.pos=v?"top":"bot");const A=E*(n?.2:1)+(n?0:y*I);S.style.setProperty("--y",`${v?A:-1*A}px`),S.style.setProperty("--g",`${y}`),S.style.setProperty("--s",""+(1-(n?b:0))),E+=S.offsetHeight,b+=.025})}},[n,l,t]),_e.createElement("div",{ref:s,className:"Toastify",id:f,onMouseEnter:()=>{t&&(i(!1),De.pause())},onMouseLeave:p},o((m,g)=>{const y=g.length?{...u}:{...u,pointerEvents:"none"};return _e.createElement("div",{className:h(m),style:y,key:`container-${m}`},g.map(v=>{let{content:E,props:b}=v;return _e.createElement(wA,{...b,stacked:t,collapseAll:p,isIn:a(b.toastId,b.containerId),style:b.style,key:`toast-${b.key}`},E)}))}))}const DA=()=>{const r=k.useRef(null),e={betBuilder:"!min-w-[20rem] !max-w-[90vw] lg:!min-w-[23.4375rem]",default:"!min-w-[90vw] sm:!min-w-[30rem] lg:!min-w-[39rem]"},t={lg:"!mb-[9rem] lg:!mb-[5rem]",md:"!mb-[7rem] lg:!mb-[3rem]",sm:"max-lg:!mb-[3rem]"},n={betBuilder:"bg-bg-betbuilder-main",success:"bg-bg-toast-success border-ui-green-normal border",error:"bg-bg-toast-alert border-ui-red-normal border"},i=(o,{type:a="success",marginBottom:l="sm",ActionComponent:c,zIndex:u}={},d={})=>{r.current&&s(),u&&document.documentElement.style.setProperty("--toastify-z-index",u.toString()),r.current=De(V.jsxs("div",{className:Ee("flex items-center gap-2 font-semibold sm:text-ellipsis",{"text-left text-xs sm:text-sm":a==="success"||a==="error","justify-center text-center":a==="betBuilder","justify-between":!!c}),children:[V.jsxs("div",{className:"flex items-center gap-2",children:[a==="success"&&V.jsx(St,{size:"sm",name:"tick-circle",className:"text-ui-green-normal","aria-label":"Success"}),a==="error"&&V.jsx(St,{size:"sm",name:"attention",className:"text-ui-red-normal","aria-label":"Error"}),V.jsx("span",{children:o})]}),c]}),{style:{padding:0,marginBottom:0,minHeight:"auto",borderRadius:"0.5rem"},closeButton:!1,hideProgressBar:!0,role:"toast",autoClose:2e3,position:"bottom-center",transition:kA,className:Ee("rounded-lg",a==="betBuilder"?e.betBuilder:e.default,t[l||"sm"]),bodyClassName:Ee("!px-3 lg:!px-4 !py-3 text-sm font-semibold m-auto rounded-lg flex items-center gap-2 text-text-white",n[a]),...d})},s=()=>{r.current&&(De.dismiss(r.current),r.current=null,document.documentElement.style.removeProperty("--toastify-z-index"))};return{showToast:i,hideToast:s}};var Zl={exports:{}},ec,fh;function PA(){if(fh)return ec;fh=1;var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ec=r,ec}var tc,hh;function OA(){if(hh)return tc;hh=1;var r=PA();function e(){}function t(){}return t.resetWarningCache=e,tc=function(){function n(o,a,l,c,u,d){if(d!==r){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function i(){return n}var s={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return s.PropTypes=s,s},tc}var ph;function ry(){return ph||(ph=1,Zl.exports=OA()()),Zl.exports}var Fi={exports:{}},nc={};function iy(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r))for(e=0;e<r.length;e++)r[e]&&(t=iy(r[e]))&&(n&&(n+=" "),n+=t);else for(e in r)r[e]&&(n&&(n+=" "),n+=e);return n}function mh(){for(var r,e,t=0,n="";t<arguments.length;)(r=arguments[t++])&&(e=iy(r))&&(n&&(n+=" "),n+=e);return n}const MA=Object.freeze(Object.defineProperty({__proto__:null,clsx:mh,default:mh},Symbol.toStringTag,{value:"Module"})),NA=XE(MA);var je={},jn={},gh;function Al(){if(gh)return jn;gh=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.dontSetMe=i,jn.findInArray=r,jn.int=n,jn.isFunction=e,jn.isNum=t;function r(s,o){for(let a=0,l=s.length;a<l;a++)if(o.apply(o,[s[a],a,s]))return s[a]}function e(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Function]"}function t(s){return typeof s=="number"&&!isNaN(s)}function n(s){return parseInt(s,10)}function i(s,o,a){if(s[o])return new Error("Invalid prop ".concat(o," passed to ").concat(a," - do not set this, set it on the child."))}return jn}var Wn={},yh;function FA(){if(yh)return Wn;yh=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.browserPrefixToKey=t,Wn.browserPrefixToStyle=n,Wn.default=void 0,Wn.getPrefix=e;const r=["Moz","Webkit","O","ms"];function e(){var s;let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const a=(s=window.document)===null||s===void 0||(s=s.documentElement)===null||s===void 0?void 0:s.style;if(!a||o in a)return"";for(let l=0;l<r.length;l++)if(t(o,r[l])in a)return r[l];return""}function t(s,o){return o?"".concat(o).concat(i(s)):s}function n(s,o){return o?"-".concat(o.toLowerCase(),"-").concat(s):s}function i(s){let o="",a=!0;for(let l=0;l<s.length;l++)a?(o+=s[l].toUpperCase(),a=!1):s[l]==="-"?a=!0:o+=s[l];return o}return Wn.default=e(),Wn}var vh;function pd(){if(vh)return je;
5vh=1,Object.defineProperty(je,"__esModule",{value:!0}),je.addClassName=_,je.addEvent=a,je.addUserSelectStyles=E,je.createCSSTransform=p,je.createSVGTransform=m,je.getTouch=y,je.getTouchIdentifier=v,je.getTranslation=g,je.innerHeight=d,je.innerWidth=f,je.matchesSelector=s,je.matchesSelectorAndParentsTo=o,je.offsetXYFromParent=h,je.outerHeight=c,je.outerWidth=u,je.removeClassName=I,je.removeEvent=l,je.removeUserSelectStyles=b;var r=Al(),e=n(FA());function t(S){if(typeof WeakMap!="function")return null;var A=new WeakMap,R=new WeakMap;return(t=function(L){return L?R:A})(S)}function n(S,A){if(S&&S.__esModule)return S;if(S===null||typeof S!="object"&&typeof S!="function")return{default:S};var R=t(A);if(R&&R.has(S))return R.get(S);var L={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in S)if(O!=="default"&&Object.prototype.hasOwnProperty.call(S,O)){var D=C?Object.getOwnPropertyDescriptor(S,O):null;D&&(D.get||D.set)?Object.defineProperty(L,O,D):L[O]=S[O]}return L.default=S,R&&R.set(S,L),L}let i="";function s(S,A){return i||(i=(0,r.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(R){return(0,r.isFunction)(S[R])})),(0,r.isFunction)(S[i])?S[i](A):!1}function o(S,A,R){let L=S;do{if(s(L,A))return!0;if(L===R)return!1;L=L.parentNode}while(L);return!1}function a(S,A,R,L){if(!S)return;const C={capture:!0,...L};S.addEventListener?S.addEventListener(A,R,C):S.attachEvent?S.attachEvent("on"+A,R):S["on"+A]=R}function l(S,A,R,L){if(!S)return;const C={capture:!0,...L};S.removeEventListener?S.removeEventListener(A,R,C):S.detachEvent?S.detachEvent("on"+A,R):S["on"+A]=null}function c(S){let A=S.clientHeight;const R=S.ownerDocument.defaultView.getComputedStyle(S);return A+=(0,r.int)(R.borderTopWidth),A+=(0,r.int)(R.borderBottomWidth),A}function u(S){let A=S.clientWidth;const R=S.ownerDocument.defaultView.getComputedStyle(S);return A+=(0,r.int)(R.borderLeftWidth),A+=(0,r.int)(R.borderRightWidth),A}function d(S){let A=S.clientHeight;const R=S.ownerDocument.defaultView.getComputedStyle(S);return A-=(0,r.int)(R.paddingTop),A-=(0,r.int)(R.paddingBottom),A}function f(S){let A=S.clientWidth;const R=S.ownerDocument.defaultView.getComputedStyle(S);return A-=(0,r.int)(R.paddingLeft),A-=(0,r.int)(R.paddingRight),A}function h(S,A,R){const C=A===A.ownerDocument.body?{left:0,top:0}:A.getBoundingClientRect(),O=(S.clientX+A.scrollLeft-C.left)/R,D=(S.clientY+A.scrollTop-C.top)/R;return{x:O,y:D}}function p(S,A){const R=g(S,A,"px");return{[(0,e.browserPrefixToKey)("transform",e.default)]:R}}function m(S,A){return g(S,A,"")}function g(S,A,R){let{x:L,y:C}=S,O="translate(".concat(L).concat(R,",").concat(C).concat(R,")");if(A){const D="".concat(typeof A.x=="string"?A.x:A.x+R),P="".concat(typeof A.y=="string"?A.y:A.y+R);O="translate(".concat(D,", ").concat(P,")")+O}return O}function y(S,A){return S.targetTouches&&(0,r.findInArray)(S.targetTouches,R=>A===R.identifier)||S.changedTouches&&(0,r.findInArray)(S.changedTouches,R=>A===R.identifier)}function v(S){if(S.targetTouches&&S.targetTouches[0])return S.targetTouches[0].identifier;if(S.changedTouches&&S.changedTouches[0])return S.changedTouches[0].identifier}function E(S){if(!S)return;let A=S.getElementById("react-draggable-style-el");A||(A=S.createElement("style"),A.type="text/css",A.id="react-draggable-style-el",A.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
6`,A.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
7`,S.getElementsByTagName("head")[0].appendChild(A)),S.body&&_(S.body,"react-draggable-transparent-selection")}function b(S){if(S)try{if(S.body&&I(S.body,"react-draggable-transparent-selection"),S.selection)S.selection.empty();else{const A=(S.defaultView||window).getSelection();A&&A.type!=="Caret"&&A.removeAllRanges()}}catch{}}function _(S,A){S.classList?S.classList.add(A):S.className.match(new RegExp("(?:^|\\s)".concat(A,"(?!\\S)")))||(S.className+=" ".concat(A))}function I(S,A){S.classList?S.classList.remove(A):S.className=S.className.replace(new RegExp("(?:^|\\s)".concat(A,"(?!\\S)"),"g"),"")}return je}var cn={},Eh;function sy(){if(Eh)return cn;Eh=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.canDragX=i,cn.canDragY=s,cn.createCoreData=a,cn.createDraggableData=l,cn.getBoundPosition=t,cn.getControlPosition=o,cn.snapToGri
7d=n;var r=Al(),e=pd();function t(d,f,h){if(!d.props.bounds)return[f,h];let{bounds:p}=d.props;p=typeof p=="string"?p:c(p);const m=u(d);if(typeof p=="string"){const{ownerDocument:g}=m,y=g.defaultView;let v;if(p==="parent"?v=m.parentNode:v=g.querySelector(p),!(v instanceof y.HTMLElement))throw new Error('Bounds selector "'+p+'" could not find an element.');const E=v,b=y.getComputedStyle(m),_=y.getComputedStyle(E);p={left:-m.offsetLeft+(0,r.int)(_.paddingLeft)+(0,r.int)(b.marginLeft),top:-m.offsetTop+(0,r.int)(_.paddingTop)+(0,r.int)(b.marginTop),right:(0,e.innerWidth)(E)-(0,e.outerWidth)(m)-m.offsetLeft+(0,r.int)(_.paddingRight)-(0,r.int)(b.marginRight),bottom:(0,e.innerHeight)(E)-(0,e.outerHeight)(m)-m.offsetTop+(0,r.int)(_.paddingBottom)-(0,r.int)(b.marginBottom)}}return(0,r.isNum)(p.right)&&(f=Math.min(f,p.right)),(0,r.isNum)(p.bottom)&&(h=Math.min(h,p.bottom)),(0,r.isNum)(p.left)&&(f=Math.max(f,p.left)),(0,r.isNum)(p.top)&&(h=Math.max(h,p.top)),[f,h]}function n(d,f,h){const p=Math.round(f/d[0])*d[0],m=Math.round(h/d[1])*d[1];return[p,m]}function i(d){return d.props.axis==="both"||d.props.axis==="x"}function s(d){return d.props.axis==="both"||d.props.axis==="y"}function o(d,f,h){const p=typeof f=="number"?(0,e.getTouch)(d,f):null;if(typeof f=="number"&&!p)return null;const m=u(h),g=h.props.offsetParent||m.offsetParent||m.ownerDocument.body;return(0,e.offsetXYFromParent)(p||d,g,h.props.scale)}function a(d,f,h){const p=!(0,r.isNum)(d.lastX),m=u(d);return p?{node:m,deltaX:0,deltaY:0,lastX:f,lastY:h,x:f,y:h}:{node:m,deltaX:f-d.lastX,deltaY:h-d.lastY,lastX:d.lastX,lastY:d.lastY,x:f,y:h}}function l(d,f){const h=d.props.scale;return{node:f.node,x:d.state.x+f.deltaX/h,y:d.state.y+f.deltaY/h,deltaX:f.deltaX/h,deltaY:f.deltaY/h,lastX:d.state.x,lastY:d.state.y}}function c(d){return{left:d.left,top:d.top,right:d.right,bottom:d.bottom}}function u(d){const f=d.findDOMNode();if(!f)throw new Error("<DraggableCore>: Unmounted during event!");return f}return cn}var Bi={},so={},bh;function oy(){if(bh)return so;bh=1,Object.defineProperty(so,"__esModule",{value:!0}),so.default=r;function r(){}return so}var Th;function BA(){if(Th)return Bi;Th=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=void 0;var r=c(ag()),e=a(ry()),t=a(lg()),n=pd(),i=sy(),s=Al(),o=a(oy());function a(g){return g&&g.__esModule?g:{default:g}}function l(g){if(typeof WeakMap!="function")return null;var y=new WeakMap,v=new WeakMap;return(l=function(E){return E?v:y})(g)}function c(g,y){if(g&&g.__esModule)return g;if(g===null||typeof g!="object"&&typeof g!="function")return{default:g};var v=l(y);if(v&&v.has(g))return v.get(g);var E={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in g)if(_!=="default"&&Object.prototype.hasOwnProperty.call(g,_)){var I=b?Object.getOwnPropertyDescriptor(g,_):null;I&&(I.get||I.set)?Object.defineProperty(E,_,I):E[_]=g[_]}return E.default=g,v&&v.set(g,E),E}function u(g,y,v){return y=d(y),y in g?Object.defineProperty(g,y,{value:v,enumerable:!0,configurable:!0,writable:!0}):g[y]=v,g}function d(g){var y=f(g,"string");return typeof y=="symbol"?y:String(y)}function f(g,y){if(typeof g!="object"||g===null)return g;var v=g[Symbol.toPrimitive];if(v!==void 0){var E=v.call(g,y);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(g)}const h={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let p=h.mouse,m=class extends r.Component{constructor(){super(...arguments),u(this,"dragging",!1),u(this,"lastX",NaN),u(this,"lastY",NaN),u(this,"touchIdentifier",null),u(this,"mounted",!1),u(this,"handleDragStart",y=>{if(this.props.onMouseDown(y),!this.props.allowAnyClick&&typeof y.button=="number"&&y.button!==0)return!1;const v=this.findDOMNode();if(!v||!v.ownerDocument||!v.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:E}=v;if(this.props.disabled||!(y.target instanceof E.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(y.target,this.props.handle,v)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(y.target,this.props.cancel,v))return;y.type==="touchstart"&&y.preventDefault();const b=(0,n.getTouchIdentifier)(y);this.touchIdentifier=b;const _=(0,i.getControlPosition)(y,b,this);if(_==null)return;const{x:I,y:S}=_,A=(0,i.createCoreData)(this,I,S);(0,o.default)("DraggableCore: handleDragStart: %j",A),(0,o.default)("calling",this.props.onStart),!(this.props.onStart(y,A)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(E),this.dragging=!0,this.lastX=I,this.lastY=S,(0,n.addEvent)(E,p.move,this.handleDrag),(0,n.addEvent)(E,p.stop,this.handleDragStop))}),u(this,"handleDrag",y=>{const v=(0,i.getControlPosition)(y,this.touchIdentifier,this);if(v==null)return;let{x:E,y:b}=v;if(Array.isArray(this.props.grid)){let S=E-this.lastX,A=b-this.lastY;
7if([S,A]=(0,i.snapToGrid)(this.props.grid,S,A),!S&&!A)return;E=this.lastX+S,b=this.lastY+A}const _=(0,i.createCoreData)(this,E,b);if((0,o.default)("DraggableCore: handleDrag: %j",_),this.props.onDrag(y,_)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const A=document.createEvent("MouseEvents");A.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(A)}return}this.lastX=E,this.lastY=b}),u(this,"handleDragStop",y=>{if(!this.dragging)return;const v=(0,i.getControlPosition)(y,this.touchIdentifier,this);if(v==null)return;let{x:E,y:b}=v;if(Array.isArray(this.props.grid)){let A=E-this.lastX||0,R=b-this.lastY||0;[A,R]=(0,i.snapToGrid)(this.props.grid,A,R),E=this.lastX+A,b=this.lastY+R}const _=(0,i.createCoreData)(this,E,b);if(this.props.onStop(y,_)===!1||this.mounted===!1)return!1;const S=this.findDOMNode();S&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(S.ownerDocument),(0,o.default)("DraggableCore: handleDragStop: %j",_),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,S&&((0,o.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(S.ownerDocument,p.move,this.handleDrag),(0,n.removeEvent)(S.ownerDocument,p.stop,this.handleDragStop))}),u(this,"onMouseDown",y=>(p=h.mouse,this.handleDragStart(y))),u(this,"onMouseUp",y=>(p=h.mouse,this.handleDragStop(y))),u(this,"onTouchStart",y=>(p=h.touch,this.handleDragStart(y))),u(this,"onTouchEnd",y=>(p=h.touch,this.handleDragStop(y)))}componentDidMount(){this.mounted=!0;const y=this.findDOMNode();y&&(0,n.addEvent)(y,h.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const y=this.findDOMNode();if(y){const{ownerDocument:v}=y;(0,n.removeEvent)(v,h.mouse.move,this.handleDrag),(0,n.removeEvent)(v,h.touch.move,this.handleDrag),(0,n.removeEvent)(v,h.mouse.stop,this.handleDragStop),(0,n.removeEvent)(v,h.touch.stop,this.handleDragStop),(0,n.removeEvent)(y,h.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(v)}}findDOMNode(){var y,v;return(y=this.props)!==null&&y!==void 0&&y.nodeRef?(v=this.props)===null||v===void 0||(v=v.nodeRef)===null||v===void 0?void 0:v.current:t.default.findDOMNode(this)}render(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Bi.default=m,u(m,"displayName","DraggableCore"),u(m,"propTypes",{allowAnyClick:e.default.bool,children:e.default.node.isRequired,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:function(g,y){if(g[y]&&g[y].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:e.default.arrayOf(e.default.number),handle:e.default.string,cancel:e.default.string,nodeRef:e.default.object,onStart:e.default.func,onDrag:e.default.func,onStop:e.default.func,onMouseDown:e.default.func,scale:e.default.number,className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),u(m,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Bi}var Sh;function $A(){return Sh||(Sh=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),r.default=void 0;var e=f(ag()),t=u(ry()),n=u(lg()),i=u(NA),s=pd(),o=sy(),a=Al(),l=u(BA()),c=u(oy());function u(v){return v&&v.__esModule?v:{default:v}}function d(v){if(typeof WeakMap!="function")return null;var E=new WeakMap,b=new WeakMap;return(d=function(_){return _?b:E})(v)}function f(v,E){if(v&&v.__esModule)return v;if(v===null||typeof v!="object"&&typeof v!="function")return{default:v};var b=d(E);if(b&&b.has(v))return b.get(v);var _={},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var S in v)if(S!=="default"&&Object.prototype.hasOwnProperty.call(v,S)){var A=I?Object.getOwnPropertyDescriptor(v,S):null;A&&(A.get||A.set)?Object.defineProperty(_,S,A):_[S]=v[S]}return _.default=v,b&&b.set(v,_),_}function h(){return h=Object.assign?Object.assign.bind():function(v){for(var E=1;E<arguments.length;E++){var b=arguments[E];for(var _ in b)Object.prototype.hasOwnProperty.call(b,_)&&(v[_]=b[_])}return v},h.apply(this,arguments)}function p(v,E,b){return E=m(E),E in v?Object.defineProperty(v,E,{value:b,enumerable:!0,configurable:!0,writable:!0}):v[E]=b,v}function m(v){var E=g(v,"string");return typeof E=="symbol"?E:String(E)}function g(v,E){if(typeof v!="object"||v===null)return v;var b=v[Symbol.toPrimitive];
7if(b!==void 0){var _=b.call(v,E);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(v)}class y extends e.Component{static getDerivedStateFromProps(E,b){let{position:_}=E,{prevPropsPosition:I}=b;return _&&(!I||_.x!==I.x||_.y!==I.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:_,prevPropsPosition:I}),{x:_.x,y:_.y,prevPropsPosition:{..._}}):null}constructor(E){super(E),p(this,"onDragStart",(b,_)=>{if((0,c.default)("Draggable: onDragStart: %j",_),this.props.onStart(b,(0,o.createDraggableData)(this,_))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(b,_)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",_);const I=(0,o.createDraggableData)(this,_),S={x:I.x,y:I.y,slackX:0,slackY:0};if(this.props.bounds){const{x:R,y:L}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[C,O]=(0,o.getBoundPosition)(this,S.x,S.y);S.x=C,S.y=O,S.slackX=this.state.slackX+(R-S.x),S.slackY=this.state.slackY+(L-S.y),I.x=S.x,I.y=S.y,I.deltaX=S.x-this.state.x,I.deltaY=S.y-this.state.y}if(this.props.onDrag(b,I)===!1)return!1;this.setState(S)}),p(this,"onDragStop",(b,_)=>{if(!this.state.dragging||this.props.onStop(b,(0,o.createDraggableData)(this,_))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",_);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:R,y:L}=this.props.position;S.x=R,S.y=L}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:E.position?E.position.x:E.defaultPosition.x,y:E.position?E.position.y:E.defaultPosition.y,prevPropsPosition:{...E.position},slackX:0,slackY:0,isElementSVG:!1},E.position&&!(E.onDrag||E.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var E,b;return(E=(b=this.props)===null||b===void 0||(b=b.nodeRef)===null||b===void 0?void 0:b.current)!==null&&E!==void 0?E:n.default.findDOMNode(this)}render(){const{axis:E,bounds:b,children:_,defaultPosition:I,defaultClassName:S,defaultClassNameDragging:A,defaultClassNameDragged:R,position:L,positionOffset:C,scale:O,...D}=this.props;let P={},M=null;const F=!!!L||this.state.dragging,x=L||I,U={x:(0,o.canDragX)(this)&&F?this.state.x:x.x,y:(0,o.canDragY)(this)&&F?this.state.y:x.y};this.state.isElementSVG?M=(0,s.createSVGTransform)(U,C):P=(0,s.createCSSTransform)(U,C);const K=(0,i.default)(_.props.className||"",S,{[A]:this.state.dragging,[R]:this.state.dragged});return e.createElement(l.default,h({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(_),{className:K,style:{..._.props.style,...P},transform:M}))}}
7r.default=y,p(y,"displayName","Draggable"),p(y,"propTypes",{...l.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),p(y,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(nc)),nc}var Ah;function UA(){if(Ah)return Fi.exports;Ah=1;const{default:r,DraggableCore:e}=$A();return Fi.exports=r,Fi.exports.default=r,Fi.exports.DraggableCore=e,Fi.exports}var VA=UA();const GA=rd(VA);var Ye=function(){return Ye=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ye.apply(this,arguments)},_h={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Rh={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},oo={width:"20px",height:"20px",position:"absolute",zIndex:1},HA={top:Ye(Ye({},_h),{top:"-5px"}),right:Ye(Ye({},Rh),{left:void 0,right:"-5px"}),bottom:Ye(Ye({},_h),{top:void 0,bottom:"-5px"}),left:Ye(Ye({},Rh),{left:"-5px"}),topRight:Ye(Ye({},oo),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Ye(Ye({},oo),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Ye(Ye({},oo),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Ye(Ye({},oo),{left:"-10px",top:"-10px",cursor:"nw-resize"})},zA=k.memo(function(r){var e=r.onResizeStart,t=r.direction,n=r.children,i=r.replaceStyles,s=r.className,o=k.useCallback(function(c){e(c,t)},[e,t]),a=k.useCallback(function(c){e(c,t)},[e,t]),l=k.useMemo(function(){return Ye(Ye({position:"absolute",userSelect:"none"},HA[t]),i??{})},[i,t]);return V.jsx("div",{className:s||void 0,style:l,onMouseDown:o,onTouchStart:a,children:n})}),KA=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),fn=function(){return fn=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},fn.apply(this,arguments)},jA={width:"auto",height:"auto"},ao=function(r,e,t){return Math.max(Math.min(r,t),e)},Ih=function(r,e,t){var n=Math.round(r/e);return n*e+t*(n-1)},ti=function(r,e){return new RegExp(r,"i").test(e)},lo=function(r){return!!(r.touches&&r.touches.length)},WA=function(r){return!!((r.clientX||r.clientX===0)&&(r.clientY||r.clientY===0))},Lh=function(r,e,t){t===void 0&&(t=0);var n=e.reduce(function(s,o,a){return Math.abs(o-r)<Math.abs(e[s]-r)?a:s},0),i=Math.abs(e[n]-r);return t===0||i<t?e[n]:r},rc=function(r){return r=r.toString(),r==="auto"||r.endsWith("px")||r.endsWith("%")||r.endsWith("vh")||r.endsWith("vw")||r.endsWith("vmax")||r.endsWith("vmin")?r:"".concat(r,"px")},co=function(r,e,t,n){if(r&&typeof r=="string"){if(r.endsWith("px"))return Number(r.replace("px",""));if(r.endsWith("%")){var i=Number(r.replace("%",""))/100;return e*i}if(r.endsWith("vw")){var i=Number(r.replace("vw",""))/100;return t*i}if(r.endsWith("vh")){var i=Number(r.replace("vh",""))/100;return n*i}}return r},YA=function(r,e,t,n,i,s,o){return n=co(n,r.width,e,t),i=co(i,r.he
7ight,e,t),s=co(s,r.width,e,t),o=co(o,r.height,e,t),{maxWidth:typeof n>"u"?void 0:Number(n),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof o>"u"?void 0:Number(o)}},qA=function(r){return Array.isArray(r)?r:[r,r]},XA=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],wh="__resizable_base__",QA=(function(r){KA(e,r);function e(t){var n,i,s,o,a=r.call(this,t)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var c=a.window.document.createElement("div");return c.style.width="100%",c.style.height="100%",c.style.position="absolute",c.style.transform="scale(0, 0)",c.style.left="0",c.style.flex="0 0 100%",c.classList?c.classList.add(wh):c.className+=wh,l.appendChild(c),c},a.removeBase=function(l){var c=a.parentNode;c&&c.removeChild(l)},a.state={isResizing:!1,width:(i=(n=a.propsSize)===null||n===void 0?void 0:n.width)!==null&&i!==void 0?i:"auto",height:(o=(s=a.propsSize)===null||s===void 0?void 0:s.height)!==null&&o!==void 0?o:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||jA},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=0,n=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,o=this.resizable.style.position;o!=="relative"&&(this.resizable.style.position="relative"),t=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=o}return{width:t,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var t=this,n=this.props.size,i=function(a){var l;if(typeof t.state[a]>"u"||t.state[a]==="auto")return"auto";if(t.propsSize&&t.propsSize[a]&&(!((l=t.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(t.state[a].toString().endsWith("%"))return t.state[a].toString();var c=t.getParentSize(),u=Number(t.state[a].toString().replace("px","")),d=u/c[a]*100;return"".concat(d,"%")}return rc(t.state[a])},s=n&&typeof n.width<"u"&&!this.state.isResizing?rc(n.width):i("width"),o=n&&typeof n.height<"u"&&!this.state.isResizing?rc(n.height):i("height");return{width:s,height:o}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var n=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var s={width:t.offsetWidth,height:t.offsetHeight};return n&&(this.parentNode.style.flexWrap=i),this.removeBase(t),s},e.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},e.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},e.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:t.flexBasis!=="auto"?t.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(t,n){var i=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===t&&(typeof i>"u"||i==="auto")?"auto":t},e.prototype.calculateNewMaxFromBoundary=function(t,n){var i=this.props.boundsByDirection,s=this.state.direction,o=i&&ti("left",s),a=i&&ti("top",s),l,c;if(this.props.bounds==="parent"){var u=this.parentNode;u&&(l=o?this.resizableRight-this.parentLeft:u.offsetWidth+(this.parentLeft-this.resizableLeft),c=a?this.resizableBottom-this.parentTop:u.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=o?this.resizableRight:this.window.innerWidth-this.resizableLeft,c=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=o?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),c=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(t=t&&t<l?t:l),c&&Number.isFinite(c)&&(n=n&&n<c?n:c),{maxWidth:t,maxHeight:n}},e.prototype.calculateNewSizeFromDirection=function(t,n){var i=this.props.scale||1,s=qA(this.props.resizeRatio||1),o=s[0],a=s[1],l=this.state,c=l.direction,u=l.original,d=this.props,f=d.lockAspectRatio,h=d.lockAspectRatioExtraHeight,p=d.lockAspectRatioExtraWidth,m=u.width,g=u.height,y=h||0,v=p||0;return ti("right",c)&&(m=u.width+(t-u.x)*o/i,f&&(g=(m-v)/this.ratio+y)),ti("left",c)&&(m=u.width-(t-u.x)*o/i,f&&(g=(m-v)/this.ratio+y)),ti("bottom",c)&&(g=u.height+(n-u.y)*a/i,f&&(m=(g-y)*this.ratio+v)),ti("top",c)&&(g=u.height-(n-u.y)*a/i,f&&(m=(g-y)*this.ratio+v)),{newWidth:m,newHeight:g}},e.prototype.calculateNewSizeFromAspectRatio=function(t,n,i,s){var o=this.props,a=o.lockAspectRatio,l=o.lockAspectRatioExtraHeight,c=o.lockAspectRatioExtraWidth,u=typeof s.width>"u"?10:s.width,d=typeof i.width>"u"||i.width<0?t:i.width,f=typeof s.height>"u"?10:s.height,h=typeof i.height>"u"||i.height<0?n:i.height,p=l||0,m=c||0;if(a){var g=(f-p)*this.ratio+m,y=(h-p)*this.ratio+m,v=(u-m)/this.ratio+p,E=(d-m)/this.ratio+p,b=Math.max(u,g),_=
7Math.min(d,y),I=Math.max(f,v),S=Math.min(h,E);t=ao(t,b,_),n=ao(n,I,S)}else t=ao(t,u,d),n=ao(n,f,h);return{newWidth:t,newHeight:n}},e.prototype.setBoundingClientRect=function(){var t=1/(this.props.scale||1);if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var i=n.getBoundingClientRect();this.parentLeft=i.left*t,this.parentTop=i.top*t}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*t,this.targetTop=s.top*t}if(this.resizable){var o=this.resizable.getBoundingClientRect(),a=o.left,l=o.top,c=o.right,u=o.bottom;this.resizableLeft=a*t,this.resizableRight=c*t,this.resizableTop=l*t,this.resizableBottom=u*t}},e.prototype.onResizeStart=function(t,n){if(!(!this.resizable||!this.window)){var i=0,s=0;if(t.nativeEvent&&WA(t.nativeEvent)?(i=t.nativeEvent.clientX,s=t.nativeEvent.clientY):t.nativeEvent&&lo(t.nativeEvent)&&(i=t.nativeEvent.touches[0].clientX,s=t.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var o=this.props.onResizeStart(t,n,this.resizable);if(o===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var c=this.parentNode;if(c){var u=this.window.getComputedStyle(c).flexDirection;this.flexDir=u.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:fn(fn({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:n,flexBasis:a};this.setState(d)}},e.prototype.onMouseMove=function(t){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&lo(t))try{t.preventDefault(),t.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,o=i.maxHeight,a=i.minWidth,l=i.minHeight,c=lo(t)?t.touches[0].clientX:t.clientX,u=lo(t)?t.touches[0].clientY:t.clientY,d=this.state,f=d.direction,h=d.original,p=d.width,m=d.height,g=this.getParentSize(),y=YA(g,this.window.innerWidth,this.window.innerHeight,s,o,a,l);s=y.maxWidth,o=y.maxHeight,a=y.minWidth,l=y.minHeight;var v=this.calculateNewSizeFromDirection(c,u),E=v.newHeight,b=v.newWidth,_=this.calculateNewMaxFromBoundary(s,o);this.props.snap&&this.props.snap.x&&(b=Lh(b,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(E=Lh(E,this.props.snap.y,this.props.snapGap));var I=this.calculateNewSizeFromAspectRatio(b,E,{width:_.maxWidth,height:_.maxHeight},{width:a,height:l});if(b=I.newWidth,E=I.newHeight,this.props.grid){var S=Ih(b,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),A=Ih(E,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),R=this.props.snapGap||0,L=R===0||Math.abs(S-b)<=R?S:b,C=R===0||Math.abs(A-E)<=R?A:E;b=L,E=C}var O={width:b-h.width,height:E-h.height};if(this.delta=O,p&&typeof p=="string"){if(p.endsWith("%")){var D=b/g.width*100;b="".concat(D,"%")}else if(p.endsWith("vw")){var P=b/this.window.innerWidth*100;b="".concat(P,"vw")}else if(p.endsWith("vh")){var M=b/this.window.innerHeight*100;b="".concat(M,"vh")}}if(m&&typeof m=="string"){if(m.endsWith("%")){var D=E/g.height*100;E="".concat(D,"%")}else if(m.endsWith("vw")){var P=E/this.window.innerWidth*100;E="".concat(P,"vw")}else if(m.endsWith("vh")){var M=E/this.window.innerHeight*100;E="".concat(M,"vh")}}var N={width:this.createSizeForCssProperty(b,"width"),height:this.createSizeForCssProperty(E,"height")};this.flexDir==="row"?N.flexBasis=N.width:this.flexDir==="column"&&(N.flexBasis=N.height);var F=this.state.width!==N.width,x=this.state.height!==N.height,U=this.state.flexBasis!==N.flexBasis,K=F||x||U;K&&ul.flushSync(function(){n.setState(N)}),this.props.onResize&&K&&this.props.onResize(t,f,this.resizable,O)}},e.prototype.onMouseUp=function(t){var n,i,s=this.state,o=s.isResizing,a=s.direction;s.original,!(!o||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(t,a,this.resizable,this.delta),this.props.size&&this.setState({width:(n=this.props.size.width)!==null&&n!==void 0?n:"auto",height:(i=this.props.size.height)!==null&&i!==void 0?i:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:fn(fn({},this.state.backgroundStyle),{cursor:"auto"})}))},e.prototype.updateSize=function(t){var n,i;this.setState({width:(n=t.width)!==null&&n!==void 0?n:"auto",height:(i=t.height)!==null&&i!==void 0?i:"auto"})},e.prototype.renderResizer=function(){var t=this,n=this.props,i=n.enable,s=n.handleStyles,o=n.handleClasses,a=n.handleWrapperStyle,l=n.handleWrapperClass,c=n.handleComponent;if(!i)return null;var u=Object.keys(i).map(function(d){return i[d]!==!1?V.jsx(zA,{direction:d,onResizeStart:t.onResizeStart,replaceStyles:s&&s[d],className:o&&o[d],children:c&&c[d]?c[d]:null},d):null});return V.jsx("div",{className:l,style:a,children:u})},e.prototype.render=function(){var t=this,n=Object.keys(this.props).reduce(function(o,a){return XA.indexOf(a)!==-1||(o[a]=t.props[a]),o},{}),i=fn(fn(fn({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return V.jsxs(s,fn({style:i,className:this.props.className},n,{ref:function(o){o&&(t.resizable=o)},children:[this.state.isResizing&&V.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},e.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{}
7,grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},e})(k.PureComponent);/*! *****************************************************************************
8Copyright (c) Microsoft Corporation. All rights reserved.
9Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10this file except in compliance with the License. You may obtain a copy of the
11License at http://www.apache.org/licenses/LICENSE-2.0
12
13THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16MERCHANTABLITY OR NON-INFRINGEMENT.
17
18See the Apache Version 2.0 License for specific language governing permissions
19and limitations under the License.
20***************************************************************************** */var lu=function(r,e){return lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},lu(r,e)};function JA(r,e){lu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var et=function(){return et=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},et.apply(this,arguments)};function ZA(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}var e_={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},t_=function(r){return{bottom:r,bottomLeft:r,bottomRight:r,left:r,right:r,top:r,topLeft:r,topRight:r}},KO=(function(r){JA(e,r);function e(t){var n=r.call(this,t)||this;return n.resizingPosition={x:0,y:0},n.offsetFromParent={left:0,top:0},n.resizableElement={current:null},n.originalPosition={x:0,y:0},n.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:t.maxWidth,maxHeight:t.maxHeight},n.onResizeStart=n.onResizeStart.bind(n),n.onResize=n.onResize.bind(n),n.onResizeStop=n.onResizeStop.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDrag=n.onDrag.bind(n),n.onDragStop=n.onDragStop.bind(n),n.getMaxSizesFromProps=n.getMaxSizesFromProps.bind(n),n}return e.prototype.componentDidMount=function(){this.updateOffsetFromParent();var t=this.offsetFromParent,n=t.left,i=t.top,s=this.getDraggablePosition(),o=s.x,a=s.y;this.draggable.setState({x:o-n,y:a-i}),this.forceUpdate()},e.prototype.getDraggablePosition=function(){var t=this.draggable.state,n=t.x,i=t.y;return{x:n,y:i}},e.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},e.prototype.getParentSize=function(){return this.resizable.getParentSize()},e.prototype.getMaxSizesFromProps=function(){var t=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,n=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:t,maxHeight:n}},e.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},e.prototype.getOffsetHeight=function(t){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/n;case"body":return document.body.offsetHeight/n;default:return t.offsetHeight}},e.prototype.getOffsetWidth=function(t){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/n;case"body":return document.body.offsetWidth/n;default:return t.offsetWidth}},e.prototype.onDragStart=function(t,n){this.props.onDragStart&&this.props.onDragStart(t,n);var i=this.getDraggablePosition();if(this.originalPosition=i,!!this.props.bounds){var s=this.getParent(),o=this.props.scale,a;if(this.props.bounds==="parent")a=s;else if(this.props.bounds==="body"){var l=s.getBoundingClientRect(),c=l.left,u=l.top,d=document.body.getBoundingClientRect(),f=-(c-s.offsetLeft*o-d.left)/o,h=-(u-s.offsetTop*o-d.top)/o,p=(document.body.offsetWidth-this.resizable.size.width*o)/o+f,m=(document.body.offsetHeight-this.resizable.size.height*o)/o+h;
vendor: 5,833 bytes, line 20
20return this.setState({bounds:{top:h,right:p,bottom:m,left:f}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var g=s.getBoundingClientRect(),y=g.left,v=g.top,E=-(y-s.offsetLeft*o)/o,b=-(v-s.offsetTop*o)/o,p=(window.innerWidth-this.resizable.size.width*o)/o+E,m=(window.innerHeight-this.resizable.size.height*o)/o+b;return this.setState({bounds:{top:b,right:p,bottom:m,left:E}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(s instanceof HTMLElement))){var _=a.getBoundingClientRect(),I=_.left,S=_.top,A=s.getBoundingClientRect(),R=A.left,L=A.top,C=(I-R)/o,O=S-L;if(this.resizable){this.updateOffsetFromParent();var D=this.offsetFromParent;this.setState({bounds:{top:O-D.top,right:C+(a.offsetWidth-this.resizable.size.width)-D.left/o,bottom:O+(a.offsetHeight-this.resizable.size.height)-D.top,left:C-D.left/o}})}}}},e.prototype.onDrag=function(t,n){if(this.props.onDrag){var i=this.offsetFromParent,s=i.left,o=i.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(t,et(et({},n),{x:n.x+s,y:n.y+o}));if(this.props.dragAxis==="x")return this.props.onDrag(t,et(et({},n),{x:n.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(t,et(et({},n),{x:this.originalPosition.x+s,y:n.y+o,deltaX:0}))}},e.prototype.onDragStop=function(t,n){if(this.props.onDragStop){var i=this.offsetFromParent,s=i.left,o=i.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(t,et(et({},n),{x:n.x+s,y:n.y+o}));if(this.props.dragAxis==="x")return this.props.onDragStop(t,et(et({},n),{x:n.x+s,y:this.originalPosition.y+o,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(t,et(et({},n),{x:this.originalPosition.x+s,y:n.y+o,deltaX:0}))}},e.prototype.onResizeStart=function(t,n,i){t.stopPropagation(),this.setState({resizing:!0});var s=this.props.scale,o=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+o.left,y:a.y+o.top},this.originalPosition=a,this.props.bounds){var l=this.getParent(),c=void 0;this.props.bounds==="parent"?c=l:this.props.bounds==="body"?c=document.body:this.props.bounds==="window"?c=window:typeof this.props.bounds=="string"?c=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(c=this.props.bounds);var u=this.getSelfElement();if(u instanceof Element&&(c instanceof HTMLElement||c===window)&&l instanceof HTMLElement){var d=this.getMaxSizesFromProps(),f=d.maxWidth,h=d.maxHeight,p=this.getParentSize();if(f&&typeof f=="string")if(f.endsWith("%")){var m=Number(f.replace("%",""))/100;f=p.width*m}else f.endsWith("px")&&(f=Number(f.replace("px","")));if(h&&typeof h=="string")if(h.endsWith("%")){var m=Number(h.replace("%",""))/100;h=p.height*m}else h.endsWith("px")&&(h=Number(h.replace("px","")));var g=u.getBoundingClientRect(),y=g.left,v=g.top,E=this.props.bounds==="window"?{left:0,top:0}:c.getBoundingClientRect(),b=E.left,_=E.top,I=this.getOffsetWidth(c),S=this.getOffsetHeight(c),A=n.toLowerCase().endsWith("left"),R=n.toLowerCase().endsWith("right"),L=n.startsWith("top"),C=n.startsWith("bottom");if((A||L)&&this.resizable){var O=(y-b)/s+this.resizable.size.width;this.setState({maxWidth:O>Number(f)?f:O})}if(R||this.props.lockAspectRatio&&!A&&!L){var O=I+(b-y)/s;this.setState({maxWidth:O>Number(f)?f:O})}if((L||A)&&this.resizable){var O=(v-_)/s+this.resizable.size.height;this.setState({maxHeight:O>Number(h)?h:O})}if(C||this.props.lockAspectRatio&&!L&&!A){var O=S+(_-v)/s;this.setState({maxHeight:O>Number(h)?h:O})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(t,n,i)},e.prototype.onResize=function(t,n,i,s){var o=this,a={x:this.originalPosition.x,y:this.originalPosition.y},l=-s.width,c=-s.height,u=["top","left","topLeft","bottomLeft","topRight"];u.includes(n)&&(n==="bottomLeft"?a.x+=l:(n==="topRight"||(a.x+=l),a.y+=c));var d=this.draggable.state;(a.x!==d.x||a.y!==d.y)&&ul.flushSync(function(){o.draggable.setState(a)}),this.updateOffsetFromParent();var f=this.offsetFromParent,h=this.getDraggablePosition().x+f.left,p=this.getDraggablePosition().y+f.top;this.resizingPosition={x:h,y:p},this.props.onResize&&this.props.onResize(t,n,i,s,{x:h,y:p})},e.prototype.onResizeStop=function(t,n,i,s){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),a=o.maxWidth,l=o.maxHeight;this.setState({maxWidth:a,maxHeight:l}),this.props.onResizeStop&&this.props.onResizeStop(t,n,i,s,this.resizingPosition)},e.prototype.updateSize=function(t){this.resizable&&this.resizable.updateSize({width:t.width,height:t.height})},e.prototype.updatePosition=function(t){this.draggable.setState(t)},e.prototype.updateOffsetFromParent=function(){var t=this.props.scale,n=this.getParent(),i=this.getSelfElement();if(!n||i===null)return{top:0,left:0};var s=n.getBoundingClientRect(),o=s.left,a=s.top,l=i.getBoundingClientRect(),c=this.getDraggablePosition(),u=n.scrollLeft,d=n.scrollTop;this.offsetFromParent={left:l.left-o+u-c.x*t,top:l.top-a+d-c.y*t}},e.prototype.render=function(){var t=this,n=this.props,i=n.disableDragging,s=n.style,o=n.dragHandleClassName,a=n.position,l=n.onMouseDown,c=n.onMouseUp,u=n.dragAxis,d=n.dragGrid,f=n.bounds,h=n.enableUserSelectHack,p=n.cancel,m=n.children;n.onResizeStart,n.onResize,n.onResizeStop,n.onDragStart,n.onDrag,n.onDragStop;var g=n.resizeHandleStyles,y=n.resizeHandleClasses,v=n.resizeHandleComponent,E=n.enableResizing,b=n.resizeGrid,_=n.resizeHandleWrapperClass,I=n.resizeHandleWrapperStyle,S=n.scale,A=n.allowAnyClick,R=n.dragPositionOffset,L=ZA(n,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","boun
20ds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),C=this.props.default?et({},this.props.default):void 0;delete L.default;var O=i||o?{cursor:"auto"}:{cursor:"move"},D=et(et(et({},e_),O),s),P=this.offsetFromParent,M=P.left,N=P.top,F;a&&(F={x:a.x-M,y:a.y-N});var x=this.state.resizing?void 0:F,U=this.state.resizing?"both":u;return k.createElement(GA,{ref:function(K){K&&(t.draggable=K)},handle:o?".".concat(o):void 0,defaultPosition:C,onMouseDown:l,onMouseUp:c,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:U,disabled:i,grid:d,bounds:f?this.state.bounds:void 0,position:x,enableUserSelectHack:h,cancel:p,scale:S,allowAnyClick:A,nodeRef:this.resizableElement,positionOffset:R},k.createElement(QA,et({},L,{ref:function(K){K&&(t.resizable=K,t.resizableElement.current=K.resizable)},defaultSize:C,size:this.props.size,enable:typeof E=="boolean"?t_(E):E,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:D,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:b,handleWrapperClass:_,handleWrapperStyle:I,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:g,handleClasses:y,handleComponent:v,scale:this.props.scale}),m))},e.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},e})(k.PureComponent);const Q=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},n_=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=r_},r_=Number.MAX_SAFE_INTEGER||9007199254740991;let se=(function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r})({}),$=(function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",r.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",r.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.ASSET_LIST_LOAD_ERROR="assetListLoadError",r.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",r.ASSET_LIST_PARSING_ERROR="assetListParsingError",r.INTERSTITIAL_ASSET_ITEM_ER
20ROR="interstitialAssetItemError",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.ATTACH_MEDIA_ERROR="attachMediaError",r.UNKNOWN="unknown",r})({}),T=(function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.MEDIA_ENDED="hlsMediaEnded",r.STALL_RESOLVED="hlsStallResolved",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFERED_TO_END="hlsBufferedToEnd",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r.ASSET_LIST_LOADING="hlsAssetListLoading",r.ASSET_LIST_LOADED="hlsAssetListLoaded",r.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",r.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",r.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",r.INTERSTITIAL_STARTED="hlsInterstitialStarted",r.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",r.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",r.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",r.INTERSTITIAL_ENDED="hlsInterstitialEnded",r.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",r.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",r.EVENT_CUE_ENTER="hlsEventCueEnter",r})({});var be={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ni{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class i_{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_
vendor: 4,806 bytes, line 20
20=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ni(e),this.fast_=new ni(t),this.defaultTTFB_=i,this.ttfb_=new ni(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new ni(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ni(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new ni(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function s_(r,e,t){return(e=a_(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ke(){return ke=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},ke.apply(null,arguments)}function xh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ie(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xh(Object(t),!0).forEach(function(n){s_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function o_(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function a_(r){var e=o_(r,"string");return typeof e=="symbol"?e:e+""}class nn{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=Qn,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const Qn=function(){},l_={trace:Qn,debug:Qn,log:Qn,warn:Qn,info:Qn,error:Qn};function cu(){return ke({},l_)}function c_(r,e){const t=self.console[r];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${r}] >`):Qn}function kh(r,e,t){return e[r]?e[r].bind(e):c_(r,t)}const uu=cu();function u_(r,e,t){const n=cu();if(typeof console=="object"&&r===!0||typeof r=="object"){const i=["debug","log","info","warn","error"];i.forEach(s=>{n[s]=kh(s,r,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return cu()}i.forEach(s=>{uu[s]=kh(s,r)})}else ke(uu,n);return n}const Le=uu;function hr(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function d_(r){return typeof self<"u"&&r===self.ManagedMediaSource}function ay(r,e){const t=Object.keys(r),n=Object.keys(e),i=t.length,s=n.length;return!i||!s||i===s&&!t.some(o=>n.indexOf(o)===-1)}function jt(r,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(r);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const t=r.length;let n,i,s,o="",a=0;for(;a<t;){if(n=r[a++],n===0&&e)return o;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:i=r[a++],o+=String.fromCharCode((n&31)<<6|i&63);break;case 14:i=r[a++],s=r[a++],o+=String.fromCharCode((n&15)<<12|(i&63)<<6|(s&63)<<0);break}}return o}function ht(r){let e="";for(let t=0;t<r.length;t++){let n=r[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function ly(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function f_(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ic={exports:{}},Ch;function h_(){return Ch||(Ch=1,(function(r,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,c,u){if(u=u||{}
vendor: 28,258 bytes, line 20
20,l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=a.normalizePath(d.path),a.buildURLFromParts(d)}var f=a.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=a.normalizePath(f.path),a.buildURLFromParts(f)):c;var h=a.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var p=i.exec(h.path);h.netLoc=p[1],h.path=p[2]}h.netLoc&&!h.path&&(h.path="/");var m={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(m.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)m.path=h.path,f.params||(m.params=h.params,f.query||(m.query=h.query));else{var g=h.path,y=g.substring(0,g.lastIndexOf("/")+1)+f.path;m.path=a.normalizePath(y)}return m.path===null&&(m.path=u.alwaysNormalize?a.normalizePath(f.path):f.path),a.buildURLFromParts(m)},parseURL:function(l){var c=n.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=a})()})(ic)),ic.exports}var md=h_();class gd{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Pe={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class cy{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,m_(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=t?.byteRangeEndOffset||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[Pe.AUDIO]:null,[Pe.VIDEO]:null,[Pe.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new gd),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=md.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Pe.AUDIO]=null,e[Pe.VIDEO]=null,e[Pe.AUDIOVIDEO]=null}}function We(r){return r.sn!=="initSegment"}let sc=class extends cy{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(Q(e)&&Q(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const n=Object.keys(t);if(n.length===1){const i=this._decryptdata=t[n[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=Q(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const n=Object.keys(this.levelkeys),i=n.length;if(i>1||i===1&&(t=this.levelkeys[n[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!Q(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return We(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var n;const i=t[e];i&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,i,s,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}};class p_ extends cy{constructor(e,t,n,i,s){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function uy(r,e){const t=Object.getPrototypeOf(r);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||uy(t,e)}}function m_(r,e){const t=uy(r,e);t&&(t.enumerable=!0,Object.defineProperty(r,e,t))}const Dh=Math.pow(2,32)-1,g_=[].push,dy={video:1,audio:2,id3:3,text:4};function tt(r){return String.fromCharCode.apply(null,r)}function fy(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function ue(r,e){const t=hy(r,e);return t<0?4294967296+t:t}function Ph(r,e){let t=ue(r,e);return t*=Math.pow(2,32),t+=ue(r,e+4),t}function hy(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function y_(r){const e=r.byteLength;for(let t=0;t<e;){const n=ue(r,t);if(n>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=n>1?t+n:e}return!1}function ve(r,e){const t=[];if(!e.length)return t;const n=r.byteLength;for(let i=0;i<n;){const s=ue(r,i),o=tt(r.subarray(i+4,i+8)),a=s>1?i+s:n;if(o===e[0])if(e.length===1)t.push(r.subarray(i+8,a));else{const l=ve(r.subarray(i+8,a),e.slice(1));l.length&&g_.apply(t,l)}i=a}return t}function v_(r){const e=[],t=r[0];let n=8;const i=ue(r,n);n+=4;let s=0,o=0;t===0?(s=ue(r,n),o=ue(r,n+4),n+=8):(s=Ph(r,n),o=Ph(r,n+8),n+=16),n+=2;let a=r.length+o;const l=fy(r,n);n+=2;for(let c=0;c<l;c++){let u=n;const d=ue(r,u);u+=4;const f=d&2147483647;if((d&2147483648)>>>31===1)return Le.warn("SIDX has hierarchical references (not supported)"),null;const p=ue(r,u);u+=4,e.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/i,start:a,end:a+f-1}}),a+=f,u+=4,n=u}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function py(r){const e=[],t=ve(r,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],o=ve(s,["tkhd"])[0];if(o){let a=o[0];const l=ue(o,a===0?12:20),c=ve(s,["mdia","mdhd"])[0];if(c){a=c[0];const u=ue(c,a===0?12:20),d=ve(s,["mdia","hdlr"])[0];if(d){const f=tt(d.subarray(8,12)),h={soun:Pe.AUDIO,vide:Pe.VIDEO}[f],p=ve(s,["mdia","minf","stbl","stsd"])[0],m=E_(p);h?(e[l]={timescale:u,type:h,stsd:m},e[h]=Ie({timescale:u,id:l},m)):e[l]={timescale:u,type:f,stsd:m}}}}}return ve(r,["moov","mvex","trex"]).forEach(i=>{const s=ue(i,4),o=e[s];o&&(o.default={duration:ue(i,12),flags:ue(i,20)})}),e}function E_(r){const e=r.subarray(8),t=e.subarray(86),n=tt(e.subarray(4,8));let i=n,s;const o=n==="enca"||n==="encv";if(o){const c=ve(e,[n])[0].subarray(n==="enca"?28:78);ve(c,["sinf"]).forEach(d=>{const f=ve(d,["schm"])[0];if(f){const h=tt(f.subarray(4,8));if(h==="cbcs"||h==="cenc"){const p=ve(d,["frma"])[0];p&&(i=tt(p))}}})}const a=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const l=ve(t,["avcC"])[0];l&&l.length>3&&(i+="."+fo(l[1])+fo(l[2])+fo(l[3]),s=uo(a==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=ve(e,[n])[0],c=ve(l.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=oc(c,u),u+=2;const d=c[u++];if(d&128&&(u+=2),d&64&&(u+=c[u++]),c[u++]!==4)break;u=oc(c,u);const f=c[u++];if(f===64)i+="."+fo(f);else break;if(u+=12,c[u++]!==5)break;u=oc(c,u);const h=c[u++];let p=(h&248)>>3;p===31&&(p+=1+((h&7)<<3)+((c[u]&224)>>5)),i+="."+p}break}case"hvc1":case"hev1":{const l=ve(t,["hvcC"])[0];if(l&&l.length>12){const c=l[1],u=["","A","B","C"][c>>6],d=c&31,f=ue(l,2),h=(c&32)>>5?"H":"L",p=l[12],m=l.subarray(6,12);i+="."+u+d,i+="."+b_(f).toString(16).toUpperCase(),i+="."+h+p;let g="";for(let y=m.length;y--;){const v=m[y];(v||g)&&(g="."+v.toString(16).toUpperCase()+g)}i+=g}s=uo(a=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=uo(i,t)||i;break}case"vp09":{const l=ve(t,["vpcC"])[0];if(l&&l.length>6){const c=l[4],u=l[5],d=l[6]>>4&15;i+="."+hn(c)+"."+hn(u)+"."+hn(d)}break}case"av01":{const l=ve(t,["av1C"])[0];if(l&&l.length>2){const c=l[1]>>>5,u=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,h=(l[2]&32)>>5,p=c===2&&f?h?12:10:f?10:8,m=(l[2]&16)>>4,g=(l[2]&8)>>3,y=(l[2]&4)>>2,v=l[2]&3;i+="."+c+"."+hn(u)+d+"."+hn(p)+"."+m+"."+g+y+v+"."+hn(1)+"."+hn(1)+"."+hn(1)+"."+0,s=uo("dav1",t)}break}}return{codec:i,encrypted:o,supplemental:s}}function uo(r,e){const t=ve(e,["dvvC"]),n=t.length?t[0]:ve(e,["dvcC"])[0];if(n){const i=n[2]>>1&127,s=n[2]<<5&32|n[3]>>3&31;return r+"."+hn(i)+"."+hn(s)}}function b_(r){let e=0;for(let t=0;t<32;t++)e|=(r>>t&1)<<31-t;return e>>>0}function oc(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function fo(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function hn(r){return(r<10?"0":"")+r}function T_(r,e){if(!r||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&my(r,(n,i)=>{const s=n.subarray(8,24);s.some(o=>o!==0)||(Le.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${ht(s)} -> ${ht(t)}`),n.set(t,8))})}function S_(r){const e=[];return my(r,t=>e.push(t.subarray(8,24))),e}function my(r,e){ve(r,["moov","trak"]).forEach(n=>{const i=ve(n,["mdia","minf","stbl","stsd"])[0];if(!i)return;const s=i.subarray(8);let o=ve(s,["enca"]);const a=o.length>0;a||(o=ve(s,["encv"])),o.forEach(l=>{const c=a?l.subarray(28):l.subarray(78);ve(c,["sinf"]).forEach(d=>{const f=gy(d);f&&e(f,a)})})})}function gy(r){const e=ve(r,["schm"])[0];if(e){const t=tt(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const n=ve(r,["schi","tenc"])[0];if(n)return n}}}function A_(r,e,t){const n={},i=ve(r,["moof","traf"]);for(let s=0;s<i.length;s++){const o=i[s],a=ve(o,["tfhd"])[0],l=ue(a,4),c=e[l];if(!c)continue;n[l]||(n[l]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});const u=n[l],d=ve(o,["tfdt"])[0];if(d){const E=d[0];let b=ue(d,4);E===1&&(b===Dh?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(b*=Dh+1,b+=ue(d,8))),Q(b)&&(!Q(u.start)||b<u.start)&&(u.start=b)}const f=c.default,h=ue(a,0)|f?.flags;let p=f?.duration||0;h&8&&(h&2?p=ue(a,12):p=ue(a,8));const m=ve(o,["trun"]);let g=u.start||0,y=0,v=p;for(let E=0;E<m.length;E++){const b=m[E],_=ue(b,4),I=u.sampleCount;u.sampleCount+=_;const S=b[3]&1,A=b[3]&4,R=b[2]&1,L=b[2]&2,C=b[2]&4,O=b[2]&8;let D=8,P=_;for(S&&(D+=4),A&&_&&(!(b[D+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=I),D+=4,R?(v=ue(b,D),D+=4):v=p,L&&(D+=4),O&&(D+=4),g+=v,y+=v,P--);P--;)R?(v=ue(b,D),D+=4):v=p,L&&(D+=4),C&&(b[D+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(P+1),u.keyFrameStart=g),D+=4),O&&(D+=4),g+=v,y+=v;!y&&p&&(y+=p*_)}u.duration+=y}if(!Object.keys(n).some(s=>n[s].duration)){let s=1/0,o=0;const a=ve(r,["sidx"]);for(let l=0;l<a.length;l++){const c=v_(a[l]);if(c!=null&&c.references){s=Math.min(s,c.earliestPresentationTime/c.timescale);const u=c.references.reduce((d,f)=>d+f.info.duration||0,0);o=Math.max(o,u+c.earliestPresentationTime/c.timescale)}}o&&Q(o)&&Object.keys(n).forEach(l=>{n[l].duration||(n[l].duration=o*n[l].timescale-n[l].start)})}return n}function __(r){const e={valid:null,remainder:null},t=ve(r,["moof"]);if(t.length<2)return e.remainder=r,e;const n=t[t.length-1];return e.valid=r.slice(0,n.byteOffset-8),e.remainder=r.slice(n.byteOffset-8),e}function tn(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Oh(r,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let o=!1;return ve(n,["moof"]).map(l=>{const c=l.byteOffset-8;ve(l,["traf"]).map(d=>{const f=ve(d,["tfdt"]).map(h=>{const p=h[0];let m=ue(h,4);return p===1&&(m*=Math.pow(2,32),m+=ue(h,8)),m/i})[0];return f!==void 0&&(r=f),ve(d,["tfhd"]).map(h=>{const p=ue(h,4),m=ue(h,0)&16777215,g=(m&1)!==0,y=(m&2)!==0,v=(m&8)!==0;let E=0;const b=(m&16)!==0;let _=0;const I=(m&32)!==0;let S=8;p===s&&(g&&(S+=8),y&&(S+=4),v&&(E=ue(h,S),S+=4),b&&(_=ue(h,S),S+=4),I&&(S+=4),e.type==="video"&&(o=_l(e.codec)),ve(d,["trun"]).map(A=>{const R=A[0],L=ue(A,0)&16777215,C=(L&1)!==0;let O=0;const D=(L&4)!==0,P=(L&256)!==0;let M=0;const N=(L&512)!==0;let F=0;const x=(L&1024)!==0,U=(L&2048)!==0;let K=0;const H=ue(A,4);let G=8;C&&(O=ue(A,G),G+=4),D&&(G+=4);let z=O+c;for(let J=0;J<H;J++){if(P?(M=ue(A,G),G+=4):M=E,N?(F=ue(A,G),G+=4):F=_,x&&(G+=4),U&&(R===0?K=ue(A,G):K=hy(A,G),G+=4),e.type===Pe.VIDEO){let q=0;for(;q<F;){const X=ue(n,z);if(z+=4,R_(o,n[z])){const te=n.subarray(z,z+X);yd(te,o?2:1,r+K/i,t)}z+=X,q+=X+4}}r+=M/i}}))})})}),t}function _l(r){if(!r)return!1;const e=r.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function R_(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function yd(r,e,t,n){const i=yy(r);let s=0;s+=e;let o=0,a=0,l=0;for(;s<i.length;){o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);const c=i.length-s;let u=s;if(a<c)s+=a;else if(a>c){Le.error(`Malformed SEI payload. ${a} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(i[u++]===181){const f=fy(i,u);if(u+=2,f===49){const h=ue(i,u);if(u+=4,h===1195456820){const p=i[u++];if(p===3){const m=i[u++],g=31&m,y=64&m,v=y?2+g*3:0,E=new Uint8Array(v);if(y){E[0]=m;for(let b=1;b<v;b++)E[b]=i[u++]}n.push({type:p,payloadType:o,pts:t,bytes:E})}}}}}else if(o===5&&a>16){const d=[];for(let p=0;p<16;p++){const m=i[u++].toString(16);d.push(m.length==1?"0"+m:m),(p===3||p===5||p===7||p===9)&&d.push("-")}const f=a-16,h=new Uint8Array(f);for(let p=0;p<f;p++)h[p]=i[u++];n.push({payloadType:o,pts:t,uuid:d.join(""),userData:jt(h),userDataBytes:h})}}}function yy(r){const e=r.byteLength,t=[];let n=1;for(;n<e-2;)r[n]===0&&r[n+1]===0&&r[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return r;const i=e-t.length,s=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),s[n]=r[o];return s}function I_(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,c=0;if(e===0){for(;tt(r.subarray(c,c+1))!=="\0";)t+=tt(r.subarray(c,c+1)),c+=1;for(t+=tt(r.subarray(c,c+1)),c+=1;tt(r.subarray(c,c+1))!=="\0";)n+=tt(r.subarray(c,c+1)),c+=1;n+=tt(r.subarray(c,c+1)),c+=1,i=ue(r,12),s=ue(r,16),a=ue(r,20),l=ue(r,24),c=28}else if(e===1){c+=4,i=ue(r,c),c+=4;const d=ue(r,c);c+=4;const f=ue(r,c);for(c+=4,o=2**32*d+f,n_(o)||(o=Number.MAX_SAFE_INTEGER,Le.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=ue(r,c),c+=4,l=ue(r,c),c+=4;tt(r.subarray(c,c+1))!=="\0";)t+=tt(r.subarray(c,c+1)),c+=1;for(t+=tt(r.subarray(c,c+1)),c+=1;tt(r.subarray(c,c+1))!=="\0";)n+=tt(r.subarray(c,c+1)),c+=1;n+=tt(r.subarray(c,c+1)),c+=1}const u=r.subarray(c,r.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:u}}function L_(r,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(r,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function w_(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let n,i;n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const o=new Uint8Array(4);return t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),L_([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t)}function x_(r){const e=[];if(r instanceof ArrayBuffer){const t=r.byteLength;let n=0;for(;n+32<t;){const i=new DataView(r,n),s=k_(i);e.push(s),n+=s.size}}return e}function k_(r){const e=r.getUint32(0),t=r.byteOffset,n=r.byteLength;if(n<e)return{offset:t,size:n};if(r.getUint32(4)!==1886614376)return{offset:t,size:e};const s=r.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const o=r.buffer,a=ht(new Uint8Array(o,t+12,16));let l=null,c=null,u=0;if(s===0)u=28;else{const f=r.getUint32(28);if(!f||n<32+f*16)return{offset:t,size:e};l=[];for(let h=0;h<f;h++)l.push(new Uint8Array(o,t+32+h*16,16));u=32+f*16}if(!u)return{offset:t,size:e};const d=r.getUint32(u);return e-32<d?{offset:t,size:e}:(c=new Uint8Array(o,t+u+4,d),{version:s,systemId:a,kids:l,data:c,offset:t,size:e})}const vy=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ri={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function vd(r,e){const t=Ri[e];return!!t&&!!t[r.slice(0,4)]}function gs(r,e,t=!0){return!r.split(",").some(n=>!Ed(n,e,t))}function Ed(r,e,t=!0){var n;const i=hr(t);return(n=i?.isTypeSupported(ys(r,e)))!=null?n:!1}function ys(r,e){return`${e}/mp4;codecs=${r}`}function Mh(r){if(r){const e=r.substring(0,4);return Ri.video[e]}return 2}function fa(r){const e=vy();return r.split(",").reduce((t,n)=>{const s=e&&_l(n)?9:Ri.video[n];return s?(s*2+t)/(t?3:2):(Ri.audio[n]+t)/(t?2:1)},0)}const ac={};function C_(r,e=!0){if(ac[r])return ac[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[r];for(let i=0;i<t.length;i++){var n;if(Ed(t[i],"audio",e))return ac[r]=t[i],t[i];if(t[i]==="mp3"&&(n=hr(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return r}const D_=/flac|opus|mp4a\.40\.34/i;function ha(r,e=!0){return r.replace(D_,t=>C_(t.toLowerCase(),e))}function P_(r,e){const t=[];if(r){const n=r.split(",");for(let i=0;i<n.length;i++)vd(n[i],"video")||t.push(n[i])}return e&&t.push(e),t.join(",")}function Vo(r,e){if(r&&(r.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(r)!==-1)&&(Nh(r,"audio")||Nh(r,"video")))return r;if(e){const t=e.split(",");if(t.length>1){if(r){for(let n=t.length;n--;)if(t[n].substring(0,4)===r.substring(0,4))return t[n]}return t[0]}}return e||r}function Nh(r,e){return vd(r,e)&&Ed(r,e)}function O_(r){const e=r.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function M_(r){if(r.startsWith("av01.")){const e=r.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return r}function Fh(r){const e=hr(r)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function du(r){return r.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const N_={supported:!0,powerEfficient:!0,smooth:!0},F_={supported:!1,smooth:!1,powerEfficient:!1},Ey={supported:!0,configurations:[],decodingInfoResults:[N_]};function by(r,e){return{supported:!1,configurations:e,decodingInfoResults:[F_],error:r}}function B_(r,e,t,n,i,s){const o=r.videoCodec,a=r.audioCodec?r.audioGroups:null,l=s?.audioCodec,c=s?.channels,u=c?parseInt(c):l?1/0:2;let d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((f,h)=>{if(h){const p=e.groups[h];if(!p)throw new Error(`Audio track group ${h} not found`);Object.keys(p.channels).forEach(m=>{f[m]=(f[m]||0)+p.channels[m]})}return f},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(f=>_l(f))||r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(n,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!d&&Q(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function Ty(r,e,t,n={}){const i=r.videoCodec;if(!i&&!r.audioCodec||!t)return Promise.resolve(Ey);const s=[],o=$_(r),a=o.length,l=U_(r,e,a>0),c=l.length;for(let u=a||1*c||1;u--;){const d={type:"media-source"};if(a&&(d.video=o[u%a]),c){d.audio=l[u%c];const f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}s.push(d)}if(i){const u=navigator.userAgent;if(i.split(",").some(d=>_l(d))&&vy())return Promise.resolve(by(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),s))}return Promise.all(s.map(u=>{const d=G_(u);return n[d]||(n[d]=t.decodingInfo(u))})).then(u=>({supported:!u.some(d=>!d.supported),configurations:s,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:s,decodingInfoResults:[],error:u}))}function $_(r){var e;const t=(e=r.videoCodec)==null?void 0:e.split(","),n=Sy(r),i=r.width||640,s=r.height||480,o=r.frameRate||30,a=r.videoRange.toLowerCase();return t?t.map(l=>{const c={contentType:ys(M_(l),"video"),width:i,height:s,bitrate:n,framerate:o};return a!=="sdr"&&(c.transferFunction=a),c}):[]}function U_(r,e,t){var n;const i=(n=r.audioCodec)==null?void 0:n.split(","),s=Sy(r);return i&&r.audioGroups?r.audioGroups.reduce((o,a)=>{var l;const c=a?(l=e.groups[a])==null?void 0:l.tracks:null;return c?c.reduce((u,d)=>{if(d.groupId===a){const f=parseFloat(d.channels||"");i.forEach(h=>{const p={contentType:ys(h,"audio"),bitrate:t?V_(h,s):s};f&&(p.channels=""+f),u.push(p)})}return u},o):o},[]):[]}function V_(r,e){if(e<=1)return 1;let t=128e3;return r==="ec-3"?t=768e3:r==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Sy(r){return Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)/1e3)*1e3||1}function G_(r){let e="";const{audio:t,video:n}=r;if(n){const i=du(n.contentType);e+=`${i}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const i=du(t.contentType);e+=`${n?"_":""}${i}_c${t.channels}`}return e}const fu=["NONE","TYPE-0","TYPE-1",null];function H_(r){return fu.indexOf(r)>-1}const pa=["SDR","PQ","HLG"];function z_(r){return!!r&&pa.indexOf(r)>-1}var Go={No:"",Yes:"YES",v2:"v2"};function Bh(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?Go.v2:Go.Yes:Go.No}class $h{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class vs{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Uh(this._audioGroups,e)}hasSubtitleGroup(e){return Uh(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Uh(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function K_(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function j_(r,e){let t=!1,n=[];if(r&&(t=r!=="SDR",n=[r]),e){n=e.allowedVideoRanges||pa.slice(0);const i=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&K_(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const W_=r=>{const e=new WeakSet;return(t,n)=>{if(r&&(n=r(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},Oe=(r,e)=>JSON.stringify(r,W_(e));function Y_(r,e,t,n,i){const s=Object.keys(r),o=n?.channels,a=n?.audioCodec,l=i?.videoCodec,c=o&&parseInt(o)===2;let u=!1,d=!1,f=1/0,h=1/0,p=1/0,m=1/0,g=0,y=[];const{preferHDR:v,allowedVideoRanges:E}=j_(e,i);for(let A=s.length;A--;){const R=r[s[A]];u||(u=R.channels[2]>0),f=Math.min(f,R.minHeight),h=Math.min(h,R.minFramerate),p=Math.min(p,R.minBitrate),E.filter(C=>R.videoRanges[C]>0).length>0&&(d=!0)}f=Q(f)?f:0,h=Q(h)?h:0;const b=Math.max(1080,f),_=Math.max(30,h);p=Q(p)?p:t,t=Math.max(p,t),d||(e=void 0);const I=s.length>1;return{codecSet:s.reduce((A,R)=>{const L=r[R];if(R===A)return A;if(y=d?E.filter(C=>L.videoRanges[C]>0):[],I){if(L.minBitrate>t)return un(R,`min bitrate of ${L.minBitrate} > current estimate of ${t}`),A;if(!L.hasDefaultAudio)return un(R,"no renditions with default or auto-select sound found"),A;if(a&&R.indexOf(a.substring(0,4))%5!==0)return un(R,`audio codec preference "${a}" not found`),A;if(o&&!c){if(!L.channels[o])return un(R,`no renditions with ${o}
20 channel sound found (channels options: ${Object.keys(L.channels)})`),A}else if((!a||c)&&u&&L.channels[2]===0)return un(R,"no renditions with stereo sound found"),A;if(L.minHeight>b)return un(R,`min resolution of ${L.minHeight} > maximum of ${b}`),A;if(L.minFramerate>_)return un(R,`min framerate of ${L.minFramerate} > maximum of ${_}`),A;if(!y.some(C=>L.videoRanges[C]>0))return un(R,`no variants with VIDEO-RANGE of ${Oe(y)} found`),A;if(l&&R.indexOf(l.substring(0,4))%5!==0)return un(R,`video codec preference "${l}" not found`),A;if(L.maxScore<g)return un(R,`max score of ${L.maxScore} < selected max of ${g}`),A}return A&&(fa(R)>=fa(A)||L.fragmentError>r[A].fragmentError)?A:(m=L.minIndex,g=L.maxScore,R)},void 0),videoRanges:y,preferHDR:v,minFramerate:h,minBitrate:p,minIndex:m}}function un(r,e){Le.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function Ay(r){return r.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function q_(r,e,t,n){return r.slice(t,n+1).reduce((i,s,o)=>{if(!s.codecSet)return i;const a=s.audioGroups;let l=i[s.codecSet];l||(i[s.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,s.bitrate);const c=Math.min(s.height,s.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,s.frameRate),l.minIndex=Math.min(l.minIndex,o),l.maxScore=Math.max(l.maxScore,s.score),l.fragmentError+=s.fragmentError,l.videoRanges[s.videoRange]=(l.videoRanges[s.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;const d=e.groups[u];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),i},{})}function Vh(r){if(!r)return r;const{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}=r;return{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}}function vn(r,e,t){if("attrs"in r){const n=e.indexOf(r);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(Mr(r,i,t))return n}return-1}function Mr(r,e,t){const{groupId:n,name:i,lang:s,assocLang:o,default:a}=r,l=r.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||X_(s,e.lang))&&(s===void 0||e.assocLang===o)&&(a===void 0||e.default===a)&&(l===void 0||e.forced===l)&&(!("characteristics"in r)||Q_(r.characteristics||"",e.characteristics))&&(t===void 0||t(r,e))}function X_(r,e="--"){return r.length===e.length?r===e:r.startsWith(e)||e.startsWith(r)}function Q_(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Lr(r,e){const{audioCodec:t,channels:n}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function J_(r,e,t,n,i){const s=e[n],a=e.reduce((f,h,p)=>{const m=h.uri;return(f[m]||(f[m]=[])).push(p),f},{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=s.videoRange,c=s.frameRate,u=s.codecSet.substring(0,4),d=Gh(e,n,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==u)return!1;const h=f.audioGroups,p=t.filter(m=>!h||h.indexOf(m.groupId)!==-1);return vn(r,p,i)>-1});return d>-1?d:Gh(e,n,f=>{const h=f.audioGroups,p=t.filter(m=>!h||h.indexOf(m.groupId)!==-1);return vn(r,p,i)>-1})}function Gh(r,e,t){for(let n=e;n>-1;n--)if(t(r[n]))return n;for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return-1}function ma(r,e){var t;return!!r&&r!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Z_ extends nn{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
vendor: 4,817 bytes, lines 20-30
20decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var n;const{fragCurrent:i,partCurrent:s,hls:o}=this,{autoLevelEnabled:a,media:l}=o;if(!i||!l)return;const c=performance.now(),u=s?s.stats:i.stats,d=s?s.duration:i.duration,f=c-u.loading.start,h=o.minAutoLevel,p=i.level,m=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a)return;const g=m>-1&&m!==p,y=!!t||g;if(!y&&(l.paused||!l.playbackRate||!l.readyState))return;const v=o.mainForwardBufferInfo;if(!y&&v===null)return;const E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(l.playbackRate);if(f<=Math.max(E,1e3*(d/(b*2))))return;const _=v?v.len/b:0,I=u.loading.first?u.loading.first-u.loading.start:-1,S=u.loaded&&I>-1,A=this.getBwEstimate(),R=o.levels,L=R[p],C=Math.max(u.loaded,Math.round(d*(i.bitrate||L.averageBitrate)/8));let O=S?f-I:f;O<1&&S&&(O=Math.min(f,u.loaded*8/A));const D=S?u.loaded*1e3/O:0,P=E/1e3,M=D?(C-u.loaded)/D:C*8/A+P;if(M<=_)return;const N=D?D*8:A,F=((n=t?.details||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,x=this.hls.config.abrBandWidthUpFactor;let U=Number.POSITIVE_INFINITY,K;for(K=p-1;K>h;K--){const J=R[K].maxBitrate,q=!R[K].details||F;if(U=this.getTimeToLoadFrag(P,N,d*J,q),U<Math.min(_,d+P))break}if(U>=M||U>d*10)return;S?this.bwEstimator.sample(f-Math.min(E,I),u.loaded):this.bwEstimator.sampleTTFB(f);const H=R[K].maxBitrate;this.getBwEstimate()*x>H&&this.resetEstimator(H);const G=this.findBestLevel(H,h,K,0,_,1,1);G>-1&&(K=G),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${p} is loading too slowly;
21      Fragment duration: ${i.duration.toFixed(3)}
22      Time to underbuffer: ${_.toFixed(3)} s
23      Estimated load time for current fragment: ${M.toFixed(3)} s
24      Estimated load time for down switch fragment: ${U.toFixed(3)} s
25      TTFB estimate: ${I|0} ms
26      Current BW estimate: ${Q(A)?A|0:"Unknown"} bps
27      New BW estimate: ${this.getBwEstimate()|0} bps
28      Switching to level ${K} @ ${H|0} bps`),o.nextLoadLevel=o.nextAutoLevel=K,this.clearTimer();const z=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===K&&K>0){const J=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${K>0?"and switching down":""}
29      Fragment duration: ${i.duration.toFixed(3)} s
30      Time to underbuffer: ${J.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,K>h){let q=this.findBestLevel(this.hls.levels[h].bitrate,h,K,0,J,1,1);q===-1&&(q=h),this.hls.nextLoadLevel=this.hls.nextAutoLevel=q,this.resetEstimator(this.hls.levels[q].bitrate)}}};g||M>U*2?z():this.timer=self.setInterval(z,U*1e3),o.trigger(T.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:s,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new i_(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.FRAG_LOADING,this.onFragLoading,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.FRAG_LOADING,this.onFragLoading,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(T.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const n=t.frag;
vendor: 3,236 bytes, line 30
30if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=s?s.stats:n.stats,l=o-a.loading.start,c=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&c>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(d,c),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,o=i?e+this.lastLevelLoadSec:0;return s+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.first;Q(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(T.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const o=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,s)&&o[e].loadError<=o[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}
30_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:s,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let u=s.abrBandWidthFactor,d=s.abrBandWidthUpFactor;if(c){const g=this.findBestLevel(l,o,i,c,0,u,d);if(g>=0)return this.rebufferNotice=-1,g}let f=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!c){const g=this.bitrateTestDelay;g&&(f=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-g,this.info(`bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),u=d=1)}const h=this.findBestLevel(l,o,i,c,f,u,d);if(this.rebufferNotice!==h&&(this.rebufferNotice=h,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`)),h>-1)return h;const p=n.levels[o],m=n.loadLevelObj;return m&&p?.bitrate<m.bitrate?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,o,a){var l;const c=i+s,u=this.lastLoadedFragLevel,d=u===-1?this.hls.firstLevel:u,{fragCurrent:f,partCurrent:h}=this,{levels:p,allAudioTracks:m,loadLevel:g,config:y}=this.hls;if(p.length===1)return 0;const v=p[d],E=!!((l=this.hls.latestLevelDetails)!=null&&l.live),b=g===-1||u===-1;let _,I="SDR",S=v?.frameRate||0;const{audioPreference:A,videoPreference:R}=y,L=this.audioTracksByGroup||(this.audioTracksByGroup=Ay(m));let C=-1;if(b){if(this.firstSelection!==-1)return this.firstSelection;const N=this.codecTiers||(this.codecTiers=q_(p,L,t,n)),F=Y_(N,I,e,A,R),{codecSet:x,videoRanges:U,minFramerate:K,minBitrate:H,minIndex:G,preferHDR:z}=F;C=G,_=x,I=z?U[U.length-1]:U[0],S=K,e=Math.max(e,H),this.log(`picked start tier ${Oe(F)}`)}else _=v?.codecSet,I=v?.videoRange;const O=h?h.duration:f?f.duration:0,D=this.bwEstimator.getEstimateTTFB()/1e3,P=[];for(let N=n;N>=t;N--){var M;const F=p[N],x=N>d;if(!F)continue;if(y.useMediaCapabilities&&!F.supportedResult&&!F.supportedPromise){const q=navigator.mediaCapabilities;typeof q?.decodingInfo=="function"&&B_(F,L,I,S,e,A)?(F.supportedPromise=Ty(F,L,q,this.supportedCache),F.supportedPromise.then(X=>{if(!this.hls)return;F.supportedResult=X;const te=this.hls.levels,pe=te.indexOf(F);X.error?this.warn(`MediaCapabilities decodingInfo error: "${X.error}" for level ${pe} ${Oe(X)}`):X.supported?X.decodingInfoResults.some(we=>we.smooth===!1||we.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${pe} not smooth or powerEfficient: ${Oe(X)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${pe} ${Oe(X)}`),pe>-1&&te.length>1&&(this.log(`Removing unsupported level ${pe}`),this.hls.removeLevel(pe),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(X=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${X}`)})):F.supportedResult=Ey}if((_&&F.codecSet!==_||I&&F.videoRange!==I||x&&S>F.frameRate||!x&&S>0&&S<F.frameRate||(M=F.supportedResult)!=null&&(M=M.decodingInfoResults)!=null&&M.some(q=>q.smooth===!1))&&(!b||N!==C)){P.push(N);continue}const U=F.details,K=(h?U?.partTarget:U?.averagetargetduration)||O;let H;x?H=a*e:H=o*e;const G=O&&i>=O*2&&s===0?F.averageBitrate:F.maxBitrate,z=this.getTimeToLoadFrag(D,H,G*K,U===void 0);if(H>=G&&(N===u||F.loadError===0&&F.fragmentError===0)&&(z<=D||!Q(z)||E&&!this.bitrateTestDelay||z<c)){const q=this.forcedAutoLevel;return N!==g&&(q===-1||q!==g)&&(P.length&&this.trace(`Skipped level(s) ${P.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${p[P[0]].codecs}" ${p[P[0]].videoRange}; not compatible with "${_}" ${I}`),this.info(`switch candidate:${d}->${N} adjustedbw(${Math.round(H)})-bitrate=${Math.round(H-G)} ttfb:${D.toFixed(1)} avgDuration:${K.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${z.toFixed(1)} firstSelection:${b} codecSet:${F.codecSet} videoRange:${F.videoRange} hls.loadLevel:${g}`)),b&&(this.firstSelection=N),N}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const _y={search:function(r,e){let t=0,n=r.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=r[i];const o=e(s);if(o>0)t=i+1;else if(o<0)n=i-1;else return s}return null}};function eR(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!Q(e))return null;const n=r[0].programDateTime;if(e<(n||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let s=0;s<r.length;++s){const o=r[s];if(nR(e,t,o))return o}return null}function Kr(r,e,t=0,n=0,i=.005){let s=null;if(r){s=e[1+r.sn-e[0].sn]||null;const a=r.endDTS-t;a>0&&a<15e-7&&(t+=15e-7),s&&r.level!==s.level&&s.end<=r.end&&(s=e[2+r.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!r||r.level===s.level)&&Hh(t,n,s)===0||tR(s,r,Math.min(i,n))))return s;const o=_y.search(e,Hh.bind(null,t,n));return o&&(o!==r||!s)?o:s}function tR(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return r.start<=n}return!1}function Hh(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=r?1:t.start-n>r&&t.start?-1:0}function nR(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function Ry(r,e,t){if(r&&r.startCC<=e&&r.endCC>=e){let n=r.fragments;const{fragmentHint:i}=r;i&&(n=n.concat(i));let s;return _y.search(n,o=>o.cc<e?1:o.cc>
vendor: 7,028 bytes, line 30
30e?-1:(s=o,o.end<=t?1:o.start>t?-1:0)),s||null}return null}function ga(r){switch(r.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Iy(r){return r.details.startsWith("key")}function Ly(r){return Iy(r)&&!!r.frag&&!r.frag.decryptdata}function zh(r,e){const t=ga(e);return r.default[`${t?"timeout":"error"}Retry`]}function bd(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function Kh(r){return Ie(Ie({},r),{errorRetry:null,timeoutRetry:null})}function ya(r,e,t,n){if(!r)return!1;const i=n?.code,s=e<r.maxNumRetry&&(rR(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function rR(r){return hu(r)||!!r&&(r<400||r>499)}function hu(r){return r===0&&navigator.onLine===!1}var ft={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Vt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class iR extends nn{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(T.ERROR,this.onError,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(T.ERROR,this.onError,this),e.off(T.ERROR,this.onErrorOut,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===ee.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(o=>i.indexOf(o.groupId)>=0).some(o=>{var a;return(a=o.details)==null?void 0:a.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const i=this.hls,s=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=vi();return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ft.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var o;const l=t.parent===ee.MAIN?t.level:i.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(o=o.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof s?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const l=i.loadLevelObj;if(l&&(s.type===be.AUDIO_TRACK&&l.hasAudioGroup(s.groupId)||s.type===be.SUBTITLE_TRACK&&l.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=ft.SendAlternateToPenaltyBox,t.errorAction.flags=Vt.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:ft.SendAlternateToPenaltyBox,flags:Vt.MoveAllAlternatesMatchingHDCP};return;case $.KEY_SYSTEM_SESSION_UPDATE_FAILED:case $.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case $.KEY_SYSTEM_NO_SESSION:t.errorAction={action:ft.SendAlternateToPenaltyBox,flags:Vt.MoveAllAlternatesMatchingKey};return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:if(!t.errorAction){var a;t.errorAction=this.getLevelSwitchAction(t,(a=t.level)!=null?a:i.loadLevel)}return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction=vi();return}t.type===se.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=vi())}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,i=zh(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(ya(i,s,ga(e),e.response))return{action:ft.RetryRequest,flags:Vt.None,retryConfig:i,retryCount:s};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=s),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:o}=t.config,a=zh(Iy(e)?o:s,e),l=t.levels.reduce((u,d)=>u+d.fragmentError,0);if(i&&(e.details!==$.FRAG_GAP&&i.fragmentError++,!Ly(e)&&ya(a,l,ga(e),e.response)))return{action:ft.RetryRequest,flags:Vt.None,retryConfig:a,retryCount:l};const c=this.getLevelSwitchAction(e,n);return a&&(c.retryConfig=a,c.retryCount=l),c}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,o;const c=e.details;i.loadError++,c===$.BUFFER_APPEND_ERROR&&i.fragmentError++;let u=-1;const{levels:d,loadLevel:f,minAutoLevel:h,maxAutoLevel:p}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const m=(s=e.frag)==null?void 0:s.type,y=(m===ee.AUDIO&&c===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:I})=>i.audioCodec!==I),E=e.sourceBufferName==="video"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR)&&d.some(({codecSet:I,audioCodec:S})=>i.codecSet!==I&&i.audioCodec===S),{type:b,groupId:_}=(o=e.context)!=null?o:{};for(let I=d.length;I--;){const S=(I+f)%d.length;if(S!==f&&S>=h&&S<=p&&d[S].loadError===0){var a,l;const A=d[S];if(c===$.FRAG_GAP&&m===ee.MAIN&&e.frag){const R=d[S].details;if(R){const L=Kr(e.frag,R.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else{if(b===be.AUDIO_TRACK&&A.hasAudioGroup(_)||b===be.SUBTITLE_TRACK&&A.hasSubtitleGroup(_))continue;if(m===ee.AUDIO&&(a=i.audioGroups)!=null&&a.some(R=>A.hasAudioGroup(R))||m===ee.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(R=>A.hasSubtitleGroup(R))||y&&i.audioCodec===A.audioCodec||E&&i.codecSet===A.codecSet||!y&&i.codecSet!==A.codecSet)continue}u=S;break}}if(u>-1&&n.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:ft.SendAlternateToPenaltyBox,flags:Vt.None,nextAutoLevel:u}}return{action:ft.SendAlternateToPenaltyBox,flags:Vt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case ft.DoNothing:break;case ft.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}
30" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:i}=n,s=n.nextAutoLevel;switch(i){case Vt.None:this.switchLevel(e,s);break;case Vt.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),c=t.levels[l],u=c?.attrs["HDCP-LEVEL"];if(n.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){t.maxHdcpLevel=fu[fu.indexOf(u)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Vt.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const c=this.hls.levels,u=c.length;for(let f=u;f--;)if(this.variantHasKey(c[f],l)){var o,a;this.log(`Banned key found in level ${f} (${c[f].bitrate}bps) or audio group "${(o=c[f].audioGroups)==null?void 0:o.join(",")}" (${(a=e.frag)==null?void 0:a.type} fragment) ${ht(l.keyId||[])}`),c[f].fragmentError++,c[f].loadError++,this.log(`Removing level ${f} with key error (${e.error})`),this.hls.removeLevel(f)}const d=e.frag;if(this.hls.levels.length<u)n.resolved=!0;else if(d&&d.type!==ee.MAIN){const f=d.decryptdata;f&&!l.matches(f)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=du(e.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${s} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(s))}}}function vi(r){const e={action:ft.DoNothing,flags:Vt.None};return r&&(e.resolved=!0),e}var nt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class sR{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.BUFFER_APPENDED,this.onBufferAppended,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.BUFFER_APPENDED,this.onBufferAppended,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:i}=this,s=Object.keys(i);for(let o=s.length;o--;){const a=i[s[o]];if(a?.body.type===t&&(!n||a.buffered)){const l=a.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,n,i,s){this.timeRanges&&(this.timeRanges[e]=t);const o=i?.fragment.sn||-1;Object.keys(this.fragments).forEach(a=>{const l=this.fragments[a];if(!l||o>=l.body.sn)return;if(!l.buffered&&(!l.loaded||s)){l.body.type===n&&this.removeFragment(l.body);return}const c=l.range[e];if(c){if(c.time.length===0){this.removeFragment(l.body);return}c.time.some(u=>{const d=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return d&&this.removeFragment(l.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const n=e.frag,i=ri(n),s=this.fragments[i];if(!s||s.buffered&&n.gap)return;const o=!n.relurl;Object.keys(t).forEach(a=>{const l=n.elementaryStreams[a];if(!l)return;const c=t[a],u=o||l.partial===!0;s.range[a]=this.getBufferedTimes(n,e.part,u,c)}),s.loaded=null,Object.keys(s.range).length?(this.bufferedEnd(s,n),ho(s)||this.removeParts(n.sn-1,n.type)):this.removeFragment(s.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const n=this.activePartLists[t];
vendor: 4,924 bytes, line 30
30n&&(this.activePartLists[t]=jh(n,i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=ri(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},o=e.start,a=e.end,l=e.minEndPTS||a,c=e.maxStartPTS||o;for(let u=0;u<i.length;u++){const d=i.start(u)-this.bufferPadding,f=i.end(u)+this.bufferPadding;if(c>=d&&l<=f){s.time.push({startPTS:Math.max(o,i.start(u)),endPTS:Math.min(a,i.end(u))});break}else if(o<f&&a>d){const h=Math.max(o,i.start(u)),p=Math.min(a,i.end(u));p>h&&(s.partial=!0,s.time.push({startPTS:h,endPTS:p}))}else if(a<=d)break}return s}getPartialFragment(e){let t=null,n,i,s,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(c=>{const u=l[c];u&&ho(u)&&(i=u.body.start-a,s=u.body.end+a,e>=i&&e<=s&&(n=Math.min(e-i,s-e),o<=n&&(t=u.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ho(t))}getState(e){const t=ri(e),n=this.fragments[t];return n?n.buffered?ho(n)?nt.PARTIAL:nt.OK:nt.APPENDING:nt.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let o=0;o<n.length;o++){if(i=n.start(o)-this.bufferPadding,s=n.end(o)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,i=t.part?null:t,s=ri(n);this.fragments[s]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s,type:o}=t;if(n.sn==="initSegment")return;const a=n.type;if(i){let c=this.activePartLists[a];c||(this.activePartLists[a]=c=[]),c.push(i)}this.timeRanges=s;const l=s[o];this.detectEvictedFragments(o,l,a,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ri(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let i=n.length;i--;){const s=t[n[i]];if(s?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==n||i&&!l.gap||l.start<t&&l.end>e&&(a.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=ri(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=jh(n,s=>s.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(n=>n.clearElementaryStreamInfo())}}function ho(r){var e,t,n;return r.buffered&&!!(r.body.gap||(e=r.range.video)!=null&&e.partial||(t=r.range.audio)!=null&&t.partial||(n=r.range.audiovideo)!=null&&n.partial)}function ri(r){return`${r.type}_${r.level}_${r.sn}`}function jh(r,e){return r.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var pr={cbc:0,ctr:1};class oR{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case pr.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case pr.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function aR(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?r.slice(0,e-t):r}class lR{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],o=n[2],a=n[3],l=this.invSubMix,c=l[0],u=l[1],d=l[2],f=l[3],h=new Uint32Array(256);let p=0,m=0,g=0;for(g=0;g<256;g++)g<128?h[g]=g<<1:h[g]=g<<1^283;for(g=0;g<256;g++){let y=m^m<<1^m<<2^m<<3^m<<4;y=y>>>8^y&255^99,e[p]=y,t[y]=p;const v=h[p],E=h[v],b=h[E];let _=h[y]*257^y*16843008;i[p]=_<<24|_>>>8,s[p]=_<<16|_>>>16,o[p]=_<<8|_>>>24,a[p]=_,_=b*16843009^E*65537^v*257^p*16843008,c[y]=_<<24|_>>>8,u[y]=_<<16|_>>>16,d[y]=_<<8|_>>>24,f[y]=_,p?(p=v^h[h[h[b^v]]],m^=h[h[m]]):p=m=1}}
vendor: 18,137 bytes, line 30
30expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const o=this.ksRows=(s+6+1)*4;let a,l;const c=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),d=this.sBox,f=this.rcon,h=this.invSubMix,p=h[0],m=h[1],g=h[2],y=h[3];let v,E;for(a=0;a<o;a++){if(a<s){v=c[a]=t[a];continue}E=v,a%s===0?(E=E<<8|E>>>24,E=d[E>>>24]<<24|d[E>>>16&255]<<16|d[E>>>8&255]<<8|d[E&255],E^=f[a/s|0]<<24):s>6&&a%s===4&&(E=d[E>>>24]<<24|d[E>>>16&255]<<16|d[E>>>8&255]<<8|d[E&255]),c[a]=v=(c[a-s]^E)>>>0}for(l=0;l<o;l++)a=o-l,l&3?E=c[a]:E=c[a-4],l<4||a<=4?u[l]=E:u[l]=p[d[E>>>24]]^m[d[E>>>16&255]]^g[d[E>>>8&255]]^y[d[E&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],c=a[1],u=a[2],d=a[3],f=this.uint8ArrayToUint32Array_(n);let h=f[0],p=f[1],m=f[2],g=f[3];const y=new Int32Array(e),v=new Int32Array(y.length);let E,b,_,I,S,A,R,L,C,O,D,P,M,N;const F=this.networkToHostOrderSwap;for(;t<y.length;){for(C=F(y[t]),O=F(y[t+1]),D=F(y[t+2]),P=F(y[t+3]),S=C^s[0],A=P^s[1],R=D^s[2],L=O^s[3],M=4,N=1;N<i;N++)E=l[S>>>24]^c[A>>16&255]^u[R>>8&255]^d[L&255]^s[M],b=l[A>>>24]^c[R>>16&255]^u[L>>8&255]^d[S&255]^s[M+1],_=l[R>>>24]^c[L>>16&255]^u[S>>8&255]^d[A&255]^s[M+2],I=l[L>>>24]^c[S>>16&255]^u[A>>8&255]^d[R&255]^s[M+3],S=E,A=b,R=_,L=I,M=M+4;E=o[S>>>24]<<24^o[A>>16&255]<<16^o[R>>8&255]<<8^o[L&255]^s[M],b=o[A>>>24]<<24^o[R>>16&255]<<16^o[L>>8&255]<<8^o[S&255]^s[M+1],_=o[R>>>24]<<24^o[L>>16&255]<<16^o[S>>8&255]<<8^o[A&255]^s[M+2],I=o[L>>>24]<<24^o[S>>16&255]<<16^o[A>>8&255]<<8^o[R&255]^s[M+3],v[t]=F(E^h),v[t+1]=F(I^p),v[t+2]=F(_^m),v[t+3]=F(b^g),h=C,p=O,m=D,g=P,t=t+4}return v.buffer}}class cR{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=uR(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function uR(r){switch(r){case pr.cbc:return"AES-CBC";case pr.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${r}`)}}const dR=16;class Td{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?aR(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,i){return this.useSoftware?new Promise((s,o)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,n,i);const l=this.flush();l?s(l.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,i)}softwareDecrypt(e,t,n,i){const{currentIV:s,currentResult:o,remainderData:a}=this;if(i!==pr.cbc||t.byteLength!==16)return Le.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=tn(a,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;s&&(n=s);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new lR),c.expandKey(t);const u=o;return this.currentResult=c.decrypt(l.buffer,0,n),this.currentIV=l.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,n,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,i));this.key=t,this.fastAesKey=new cR(this.subtle,t,i)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new oR(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(Le.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,n,i)))}onWebCryptoError(e,t,n,i){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,i);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%dR;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(Le.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Wh=Math.pow(2,17);class fR{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const n=e.url;if(!n)return Promise.reject(new On({type:se.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){l(qh(e));return}else e.gap=!1;const c=this.loader=s?new s(i):new o(i),u=Yh(e);e.loader=c;const d=Kh(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Wh};e.stats=c.stats;const h={onSuccess:(p,m,g,y)=>{this.resetLoader(e,c);let v=p.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(v.slice(0,16)),v=v.slice(16)),a({frag:e,part:null,payload:v,networkDetails:y})},onError:(p,m,g,y)=>{this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ie({url:n,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:p}))}};t&&(h.onProgress=(p,m,g,y)=>t({frag:e,part:null,payload:g,networkDetails:y})),c.load(u,f,h)})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(qh(e,t));return}const c=this.loader=s?new s(i):new o(i),u=Yh(e,t);e.loader=c;const d=Kh(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Wh};t.stats=c.stats,c.load(u,f,{onSuccess:(h,p,m,g)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:h.data,networkDetails:g};n(y),a(y)},onError:(h,p,m,g)=>{this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ie({url:u.url,data:void 0},h),error:new Error(`HTTP Error ${h.code} ${h.text}`),networkDetails:m,stats:g}))},onAbort:(h,p,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:h}))},onTimeout:(h,p,m)=>{this.resetLoader(e,c),l(new On({type:se.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:m,stats:h}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(n.loaded/s),l),d=(l-c)*Math.round(n.loaded/c);n.total=n.loaded+d}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Yh(r,e=null){const t=e||r,n={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(Q(i)&&Q(s)){var o;let a=i,l=s;if(r.sn==="initSegment"&&hR((o=r.decryptdata)==null?void 0:o.method)){const c=s-i;c%16&&(l=s+(16-c%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function qh(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),n={type:se.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(n.part=e),(e||r).stats.aborted=!0,new On(n)}function hR(r){return r==="AES-128"||r==="AES-256"}class On extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class wy extends nn{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Sd{constructor(e,t,n,i=0,s=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=po(),this.buffering={audio:po(),video:po(),audiovideo:po()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function po(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Xh={length:0,start:()=>0,end:()=>0};class de{static isBuffered(e,t){if(e){const n=de.getBuffered(e);for(let i=n.length;i--;)if(t>=n.start(i)&&t<=n.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=de.getBuffered(e);return de.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const i=de.bufferedRanges(e);if(i.length)return de.bufferedInfo(i,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((u,d)=>u.start-d.start||d.end-u.end);let i=-1,s=[];if(n)for(let u=0;u<e.length;u++){t>=e[u].start&&t<=e[u].end&&(i=u);const d=s.length;if(d){const f=s[d-1].end;e[u].start-f<n?e[u].end>f&&(s[d-1].end=e[u].end):s.push(e[u])}else s.push(e[u])}else s=e;let o=0,a,l=t,c=t;for(let u=0;u<s.length;u++){const d=s[u].start,f=s[u].end;if(i===-1&&t>=d&&t<=f&&(i=u),t+n>=d&&t<f)l=d,c=f,o=c-t;else if(t+n<d){a=d;break}}return{len:o,start:l||0,end:c||0,nextStart:a,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||Xh}catch(t){return Le.log("failed to get media.buffered",t),Xh}}}const xy=/\{\$([a-zA-Z0-9-_]+)\}/g;function Qh(r){return xy.test(r)}function pu(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(xy,n=>{const i=n.substring(2,n.length-1),s=t?.[i];return s===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Jh(r,e,t){let n=r.variableList;n||(r.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(i))s=o.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(o){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else i=e.NAME,s=e.VALUE;i in n?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function pR(r,e,t){const n=e.IMPORT;if(t&&n in t){let i=r.variableList;i||(r.variableList=i={}),i[n]=t[n]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const mR=/^(\d+)x(\d+)$/,Zh=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ve{constructor(e,t){typeof e=="string"&&(e=Ve.parseAttrList(e,t)),ke(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((i,s)=>(i[s.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=mR.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const i={};for(Zh.lastIndex=0;(n=Zh.exec(e))!==null;){const o=n[1].trim();let a=n[2];const l=a.indexOf('"')===0&&a.lastIndexOf('"')===a.length-1;let c=!1;if(l)a=a.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(t&&(l||c))a=pu(t,a);else if(!c&&!l)switch(o){case"CLOSED-CAPTIONS":if(a==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Le.warn(`${e}: attribute ${o} is missing quotes`)}i[o]=a}return i}}const gR="com.apple.hls.interstitial";function yR(r){return r!=="ID"&&r!=="CLASS"&&r!=="CUE"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function vR(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"||r==="SCTE35-CMD"}class ky{constructor(e,t,n=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(i=t?.tagOrder)!=null?i:n,t){const s=t.attr;for(const o in s)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==s[o]){Le.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=ke(new Ve({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=t?.endDate||new Date(this.attr["END-DATE"]);Q(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Le.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Q(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===gR}get isValid(){return!!this.id&&!this._badValueForSameId&&Q(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const ER=10;class bR{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 4,537 bytes, line 30
30StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?Q(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||ER}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function va(r,e){return r.length===e.length?!r.some((t,n)=>t!==e[n]):!1}function ep(r,e){return!r&&!e?!0:!r||!e?!1:va(r,e)}function Ei(r){return r==="AES-128"||r==="AES-256"||r==="AES-256-CTR"}function Ad(r){switch(r){case"AES-128":case"AES-256":return pr.cbc;case"AES-256-CTR":return pr.ctr;default:throw new Error(`invalid full segment method ${r}`)}}function _d(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function mu(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}function TR(r){const e=mu(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Cy(r){const e=function(n,i,s){const o=n[i];n[i]=n[s],n[s]=o};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function Dy(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",o=i[1];s?(n.splice(-1,1),t=_d(o)):t=TR(o)}}return t}const Ea=typeof self<"u"?self:void 0;var Ge={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},pt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Ho(r){switch(r){case pt.FAIRPLAY:return Ge.FAIRPLAY;case pt.PLAYREADY:return Ge.PLAYREADY;case pt.WIDEVINE:return Ge.WIDEVINE;case pt.CLEARKEY:return Ge.CLEARKEY}}function lc(r){switch(r){case Ge.FAIRPLAY:return pt.FAIRPLAY;case Ge.PLAYREADY:return pt.PLAYREADY;case Ge.WIDEVINE:return pt.WIDEVINE;case Ge.CLEARKEY:return pt.CLEARKEY}}function ji(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[Ge.FAIRPLAY,Ge.WIDEVINE,Ge.PLAYREADY,Ge.CLEARKEY].filter(i=>!!e[i]):[];return!n[Ge.WIDEVINE]&&t&&n.push(Ge.WIDEVINE),n}const Py=(function(r){return Ea!=null&&(r=Ea.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function SR(r,e,t,n){let i;switch(r){case Ge.FAIRPLAY:i=["cenc","sinf"];break;case Ge.WIDEVINE:case Ge.PLAYREADY:i=["cenc"];break;case Ge.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return AR(i,e,t,n)}function AR(r,e,t,n){return[{initDataTypes:r,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}
30`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function _R(r){var e;return!!r&&(r.sessionType==="persistent-license"||!!((e=r.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Oy(r){const e=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),o=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(o){const a=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(a){const l=_d(a).subarray(0,16);return Cy(l),l}}return null}let ii={};class lr{static clearKeyUriToKeyIdMap(){ii={}}static setKeyIdForUri(e,t){ii[e]=t}static addKeyIdForUri(e){const t=Object.keys(ii).length%Number.MAX_SAFE_INTEGER,n=new Uint8Array(16);return new DataView(n.buffer,12,4).setUint32(0,t),ii[e]=n,n}constructor(e,t,n,i=[1],s=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=i,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ei(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(ly(o)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&va(e.keyFormatVersions,this.keyFormatVersions)&&ep(e.iv,this.iv)&&ep(e.keyId,this.keyId)}isSupported(){if(this.method){if(Ei(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case pt.FAIRPLAY:case pt.WIDEVINE:case pt.PLAYREADY:case pt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Ei(this.method)){let s=this.iv;return s||(typeof e!="number"&&(Le.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),s=IR(e)),new lr(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.keyId){const s=ii[this.uri];if(s&&!va(this.keyId,s)&&lr.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const n=Dy(this.uri);if(n)switch(this.keyFormat){case pt.WIDEVINE:if(this.pssh=n,!this.keyId){const s=x_(n.buffer);if(s.length){var i;const o=s[0];this.keyId=(i=o.kids)!=null&&i.length?o.kids[0]:null}}this.keyId||(this.keyId=tp(t));break;case pt.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=w_(s,null,n),this.keyId=Oy(n);break}default:{let s=n.subarray(0,16);if(s.length!==16){const o=new Uint8Array(16);o.set(s,16-s.length),s=o}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s;s=RR(t),s||(s=tp(t),s||(s=ii[this.uri])),s&&(this.keyId=s,lr.setKeyIdForUri(this.uri,s))}return this}}function RR(r){const e=r?.[pt.WIDEVINE];return e?e.keyId:null}function tp(r){const e=r?.[pt.PLAYREADY];if(e){const t=Dy(e.uri);if(t)return Oy(t)}return null}function IR(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const np=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,rp=/#EXT-X-MEDIA:(.*)/g,LR=/^#EXT(?:INF|-X-TARGETDURATION):/m,cc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),wR=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class En{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return md.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return LR.test(e)}static parseMasterPlaylist(e,t){const n=Qh(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];if(np.lastIndex=0,!e.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let o;for(;(o=np.exec(e))!=null;)if(o[1]){var a;const c=new Ve(o[1],i),u=pu(i,o[2]),d={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:En.resolve(u,t)},f=c.decimalResolution("RESOLUTION");f&&(d.width=f.width,d.height=f.height),op(c.CODECS,d);const h=c["SUPPLEMENTAL-CODECS"];h&&(d.supplemental={},op(h,d.supplemental)),(a=d.unknownCodecs)!=null&&a.length||s.push(d),i.levels.push(d)}else if(o[3]){const c=o[3],u=o[4];switch(c){case"SESSION-DATA":{const d=new Ve(u,i),f=d["DATA-ID"];f&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[f]=d);break}case"SESSION-KEY":{const d=ip(u,t,i);d.encrypted&&d.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(d)):Le.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const d=new Ve(u,i);Jh(i,d,t)}break}case"CONTENT-STEERING":{const d=new Ve(u,i);i.contentSteering={uri:En.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=sp(u);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}
vendor: 52,487 bytes, lines 30-35
30static parseMasterPlaylistMedia(e,t,n){let i;const s={},o=n.levels,a={AUDIO:o.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:o.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(rp.lastIndex=0;(i=rp.exec(e))!==null;){const c=new Ve(i[1],n),u=c.TYPE;if(u){const d=a[u],f=s[u]||[];s[u]=f;const h=c.LANGUAGE,p=c["ASSOC-LANGUAGE"],m=c.CHANNELS,g=c.CHARACTERISTICS,y=c["INSTREAM-ID"],v={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||h||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:h,url:c.URI?En.resolve(c.URI,t):""};if(p&&(v.assocLang=p),m&&(v.channels=m),g&&(v.characteristics=g),y&&(v.instreamId=y),d!=null&&d.length){const E=En.findGroup(d,v.groupId)||d[0];ap(v,E,"audioCodec"),ap(v,E,"textCodec")}f.push(v)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){var a;const l={url:t},c=new bR(t),u=c.fragments,d=[];let f=null,h=0,p=0,m=0,g=0,y=0,v=null,E=new sc(i,l),b,_,I,S=-1,A=!1,R=null,L;if(cc.lastIndex=0,c.m3u8=e,c.hasVariableRefs=Qh(e),((a=cc.exec(e))==null?void 0:a[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(b=cc.exec(e))!==null;){A&&(A=!1,E=new sc(i,l),E.playlistOffset=m,E.setStart(m),E.sn=h,E.cc=g,y&&(E.bitrate=y),E.level=n,f&&(E.initSegment=f,f.rawProgramDateTime&&(E.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),R&&(E.setByteRange(R),R=null)));const P=b[1];if(P){E.duration=parseFloat(P);const M=(" "+b[2]).slice(1);E.title=M||null,E.tagList.push(M?["INF",P,M]:["INF",P])}else if(b[3]){if(Q(E.duration)){E.playlistOffset=m,E.setStart(m),I&&cp(E,I,c),E.sn=h,E.level=n,E.cc=g,u.push(E);const M=(" "+b[3]).slice(1);E.relurl=pu(c,M),gu(E,v,d),v=E,m+=E.duration,h++,p=0,A=!0}}else{if(b=b[0].match(wR),!b){Le.warn("No matches on slow regex match for level playlist!");continue}for(_=1;_<b.length&&b[_]===void 0;_++);const M=(" "+b[_]).slice(1),N=(" "+b[_+1]).slice(1),F=b[_+2]?(" "+b[_+2]).slice(1):null;switch(M){case"BYTERANGE":v?E.setByteRange(N,v):E.setByteRange(N);break;case"PROGRAM-DATE-TIME":E.rawProgramDateTime=N,E.tagList.push(["PROGRAM-DATE-TIME",N]),S===-1&&(S=u.length);break;case"PLAYLIST-TYPE":c.type&&wn(c,M,b),c.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?wn(c,M,b):u.length>0&&up(c,M,b),h=c.startSN=parseInt(N);break;case"SKIP":{c.skippedSegments&&wn(c,M,b);const x=new Ve(N,c),U=x.decimalInteger("SKIPPED-SEGMENTS");if(Q(U)){c.skippedSegments+=U;for(let H=U;H--;)u.push(null);h+=U}const K=x.enumeratedString("RECENTLY-REMOVED-DATERANGES");K&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(K.split("	")));break}case"TARGETDURATION":c.targetduration!==0&&wn(c,M,b),c.targetduration=Math.max(parseInt(N),1);break;case"VERSION":c.version!==null&&wn(c,M,b),c.version=parseInt(N);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||wn(c,M,b),c.live=!1;break;case"#":(N||F)&&E.tagList.push(F?[N,F]:[N]);break;case"DISCONTINUITY":g++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([M]);break;case"BITRATE":E.tagList.push([M,N]),y=parseInt(N)*1e3,Q(y)?E.bitrate=y:y=0;break;case"DATERANGE":{const x=new Ve(N,c),U=new ky(x,c.dateRanges[x.ID],c.dateRangeTagCount);c.dateRangeTagCount++,U.isValid||c.skippedSegments?c.dateRanges[U.id]=U:Le.warn(`Ignoring invalid DATERANGE tag: "${N}"`),E.tagList.push(["EXT-X-DATERANGE",N]);break}case"DEFINE":{{const x=new Ve(N,c);"IMPORT"in x?pR(c,x,o):Jh(c,x,t)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?wn(c,M,b):u.length>0&&up(c,M,b),c.startCC=g=parseInt(N);break;case"KEY":{const x=ip(N,t,c);if(x.isSupported()){if(x.method==="NONE"){I=void 0;break}I||(I={});const U=I[x.keyFormat];U!=null&&U.matches(x)||(U&&(I=ke({},I)),I[x.keyFormat]=x)}else Le.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${N}"`);break}case"START":c.startTimeOffset=sp(N);break;case"MAP":{const x=new Ve(N,c);if(E.duration){const U=new sc(i,l);lp(U,x,n,I),f=U,E.initSegment=f,f.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=f.rawProgramDateTime)}else{const U=E.byteRangeEndOffset;if(U){const K=E.byteRangeStartOffset;R=`${U-K}@${K}`}else R=null;lp(E,x,n,I),f=E,A=!0}f.cc=g;break}case"SERVER-CONTROL":{L&&wn(c,M,b),L=new Ve(N),c.canBlockReload=L.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=L.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&L.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=L.optionalFloat("PART-HOLD-BACK",0),c.holdBack=L.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&wn(c,M,b);const x=new Ve(N);c.partTarget=x.decimalFloatingPoint("PART-TARGET");break}case"PART":{let x=c.partList;x||(x=c.partList=[]);const U=p>0?x[x.length-1]:void 0,K=p++,H=new Ve(N,c),G=new p_(H,E,l,K,U);x.push(G),E.duration+=G.duration;break}case"PRELOAD-HINT":{const x=new Ve(N,c);c.preloadHint=x;break}case"RENDITION-REPORT":{const x=new Ve(N,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(x);break}default:Le.warn(`line parsed but not handled: ${b}`);break}}}v&&!v.relurl?(u.pop(),m-=v.duration,c.partList&&(c.fragmentHint=v)):c.partList&&(gu(E,v,d),E.cc=g,c.fragmentHint=E,I&&cp(E,I,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));const C=u.length,O=u[0],D=u[C-1];if(m+=c.skippedSegments*c.targetduration,m>0&&C&&D){c.averagetargetduration=m/C;const P=D.sn;c.endSN=P!=="initSegment"?P:0,c.live||(D.endList=!0),S>0&&(kR(u,S),O&&d.unshift(O))}return c.fragmentHint&&(m+=c.fragmentHint.duration),c.totalduration=m,d.length&&c.dateRangeTagCount&&O&&My(d,c),c.endCC=g,c}}function My(r,e){let t=r.length;if(!t)if(e.hasProgramDateTime){const a=e.fragments[e.fragments.length-1];r.push(a),t++}else return;const n=r[t-1],i=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let a=s.length;a--;){const l=e.dateRanges[s[a]],c=l.startDate.getTime();l.tagAnchor=n.ref;for(let u=t;u--;){var o;if(((o=r[u])==null?void 0:o.sn)<e.startSN)break;const d=xR(e,c,r,u,i);if(d!==-1){l.tagAnchor=e.fragments[d].ref;break}}}}function xR(r,e,t,n,i){const s=t[n];if(s){const a=s.programDateTime;if(e>=a||n===0){var o;const l=(((o=t[n+1])==null?void 0:o.start)||i)-s.start;if(e<=a+l*1e3){const c=t[n].sn-r.startSN;if(c<0)return-1;const u=r.fragments;if(u.length>t.length){const f=(t[n+1]||u[u.length-1]).sn-r.startSN;for(let h=f;h>c;h--){const p=u[h].programDateTime;if(e>=p&&e<p+u[h].duration*1e3)return h}}return c}}}return-1}function ip(r,e,t){var n,i;const s=new Ve(r,t),o=(n=s.METHOD)!=null?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),c=s.KEYFORMATVERSIONS,u=(i=s.KEYFORMAT)!=null?i:"identity";a&&s.IV&&!l&&Le.error(`Invalid IV: ${s.IV}`);const d=a?En.resolve(a,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new lr(o,d,u,f,l,s.KEYID)}function sp(r){const t=new Ve(r).decimalFloatingPoint("TIME-OFFSET");return Q(t)?t:null}function op(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>vd(s,n));i.length&&(e[`${n}Codec`]=i.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function ap(r,e,t){const n=e[t];n&&(r[t]=n)}function kR(r,e){let t=r[e];for(let n=e;n--;){const i=r[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function gu(r,e,t){r.rawProgramDateTime?t.push(r):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime)}function lp(r,e,t,n){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",n&&(r.levelkeys=n),r.initSegment=null}function cp(r,e,t){r.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(r)}function wn(r,e,t){r.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function up(r,e,t){r.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function uc(r,e){const t=e.startPTS;if(Q(t)){let n=0,i;e.sn>r.sn?(n=t-r.start,i=r):(n=r.start-t,i=e),i.duration!==n&&i.setDuration(n)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.setStart(r.start+(r.minEndPTS-r.start)):e.setStart(r.start+r.duration):e.setStart(Math.max(r.start-e.duration,0))}function Ny(r,e,t,n,i,s,o){n-t<=0&&(o.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let l=t,c=n;const u=e.startPTS,d=e.endPTS;if(Q(u)){const y=Math.abs(u-t);r&&y>r.totalduration?o.warn(`media timestamps and playlist times differ by ${y}s for level ${e.level} ${r.url}`):Q(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,l=Math.max(t,u),t=Math.min(t,u),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,c=Math.min(n,d),n=Math.max(n,d),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=i,e.endPTS=n,e.minEndPTS=c,e.endDTS=s;const h=e.sn;if(!r||h<r.startSN||h>r.endSN)return 0;let p;const m=h-r.startSN,g=r.fragments;for(g[m]=e,p=m;p>0;p--)uc(g[p],g[p-1]);for(p=m;p<g.length-1;p++)uc(g[p],g[p+1]);return r.fragmentHint&&uc(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,f}function CR(r,e,t){if(r===e)return;let n=null;const i=r.fragments;for(let u=i.length-1;u>=0;u--){const d=i[u].initSegment;if(d){n=d;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let s;OR(r,e,(u,d,f,h)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==u.cc){const p=u.cc-d.cc;for(let m=f;m<h.length;m++)h[m].cc+=p;e.endCC=h[h.length-1].cc}Q(u.startPTS)&&Q(u.endPTS)&&(d.setStart(d.startPTS=u.startPTS),d.startDTS=u.startDTS,d.maxStartPTS=u.maxStartPTS,d.endPTS=u.endPTS,d.endDTS=u.endDTS,d.minEndPTS=u.minEndPTS,d.setDuration(u.endPTS-u.startPTS),d.duration&&(s=d),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(d.elementaryStreams=u.elementaryStreams),d.loader=u.loader,u.hasStats&&(d.stats=u.stats),u.initSegment&&(d.initSegment=u.initSegment,n=u.initSegment)});const o=e.fragments,a=e.fragmentHint?o.concat(e.fragmentHint):o;if(n&&a.forEach(u=>{var d;u&&(!u.initSegment||u.initSegment.relurl===((d=n)==null?void 0:d.relurl))&&(u.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=o.some(u=>!u),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)o.shift();e.startSN=o[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=DR(r.dateRanges,e,t));const u=r.fragments.filter(d=>d.rawProgramDateTime);if(r.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<a.length;d++)a[d].programDateTime===null&&gu(a[d],a[d-1],u);My(u,e)}e.endCC=o[o.length-1].cc}if(!e.startCC){var l;const u=$y(r,e.startSN-1);e.startCC=(l=u?.cc)!=null?l:o[0].cc}PR(r.partList,e.partList,(u,d)=>{d.elementaryStreams=u.elementaryStreams,d.stats=u.stats}),s?Ny(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):Fy(r,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const u=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=u),e.driftEndTime=c,e.driftEnd=u}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=r.requestScheduled)}function DR(r,e,t){const{dateRanges:n,recentlyRemovedDateranges:i}=e,s=ke({},r);i&&i.forEach(l=>{delete s[l]});const a=Object.keys(s).length;return a?(Object.keys(n).forEach(l=>{const c=s[l],u=new ky(n[l].attr,c);u.isValid?(s[l]=u,c||(u.tagOrder+=a)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Oe(n[l].attr)}"`)}),s):n}function PR(r,e,t){if(r&&e){let n=0;for(let i=0,s=r.length;i<=s;i++){const o=r[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function OR(r,e,t){const n=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,s=(r.fragmentHint?1:0)+(n?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,o=e.startSN-r.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let c=i;c<=s;c++){const u=l[o+c];let d=a[c];if(n&&!d&&u&&(d=e.fragments[c]=u),u&&d){t(u,d,c,a);const f=u.relurl,h=d.relurl;if(f&&MR(f,h)){e.playlistParsingError=dp(`media sequence mismatch ${d.sn}:`,r,e,u,d);return}else if(u.cc!==d.cc){e.playlistParsingError=dp(`discontinuity sequence mismatch (${u.cc}!=${d.cc})`,r,e,u,d);return}}}}function dp(r,e,t,n,i){return new Error(`${r} ${i.url}
31Playlist starting @${e.startSN}
32${e.m3u8}
33
34Playlist starting @${t.startSN}
35${t.m3u8}`)}function Fy(r,e,t=!0){const n=e.startSN+e.skippedSegments-r.startSN,i=r.fragments,s=n>=0;let o=0;if(s&&n<i.length)o=i[n].start;else if(s&&e.startSN===r.endSN+1)o=r.fragmentEnd;else if(s&&t)o=r.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=r.fragmentStart;else return;yu(e,o)}function yu(r,e){if(e){const t=r.fragments;for(let n=r.skippedSegments;n<t.length;n++)t[n].addStart(e);r.fragmentHint&&r.fragmentHint.addStart(e)}}function By(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const n=r.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function $y(r,e,t){if(!r)return null;let n=r.fragments[e-r.startSN];return n||(n=r.fragmentHint,n&&n.sn===e)?n:e<r.startSN&&t&&t.sn===e?t:null}function fp(r,e,t){return r?Uy(r.partList,e,t):null}function Uy(r,e,t){if(r)for(let n=r.length;n--;){const i=r[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function Vy(r){r.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function MR(r,e){return r!==e&&e?hp(r)!==hp(e):!1}function hp(r){return r.replace(/\?[^?]*$/,"")}function Ji(r,e){for(let n=0,i=r.length;n<i;n++){var t;if(((t=r[n])==null?void 0:t.cc)===e)return r[n]}return null}function NR(r,e){return!!(r&&e.startCC<r.endCC&&e.endCC>r.startCC)}function pp(r,e){const t=r.start+e;r.startPTS=t,r.setStart(t),r.endPTS=t+r.duration}function Gy(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)pp(t[n],r);e.fragmentHint&&pp(e.fragmentHint,r),e.alignedSliding=!0}function FR(r,e){r&&(Hy(e,r),e.alignedSliding||ba(e,r),!e.alignedSliding&&!e.skippedSegments&&Fy(r,e,!1))}function Hy(r,e){if(!NR(e,r))return;const t=Math.min(e.endCC,r.endCC),n=Ji(e.fragments,t),i=Ji(r.fragments,t);if(!n||!i)return;Le.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=n.start-i.start;Gy(s,r)}function ba(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const o=Math.min(e.endCC,r.endCC);e.startCC<o&&r.startCC<o&&(i=Ji(n,o),s=Ji(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=Ji(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=s.programDateTime;if(!a||!l)return;const c=(l-a)/1e3-(s.start-i.start);Gy(c,r)}function Lt(r,e,t){Ft(r,e,t),r.addEventListener(e,t)}function Ft(r,e,t){r.removeEventListener(e,t)}const BR={toString:function(r){let e="";const t=r.length;for(let n=0;n<t;n++)e+=`[${r.start(n).toFixed(3)}-${r.end(n).toFixed(3)}]`;return e}},j={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Rd extends wy{constructor(e,t,n,i,s){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=j.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:a,media:l,mediaBuffer:c,state:u}=this,d=l?l.currentTime:0,f=de.bufferInfo(c||l,d,o.maxBufferHole),h=!f.len;if(this.log(`Media seeking to ${Q(d)?d.toFixed(3):d}, state: ${u}, ${h?"out of":"in"} buffer`),this.state===j.ENDED)this.resetLoadingState();else if(a){const p=o.maxFragLookUpTolerance,m=a.start-p,g=a.start+a.duration+p;if(h||g<f.start||m>f.end){const y=d>g;(d<m||y)&&(y&&a.loader&&(this.log(`Cancelling fragment load for seek (sn: ${a.sn})`),a.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const p=this.lastCurrentTime;if(d>p&&(this.lastCurrentTime=d),!this.loadingParts){const m=Math.max(f.end,d),g=this.shouldLoadParts(this.getLevelDetails(),m);g&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${m.toFixed(2)}`),this.loadingParts=g)}}this.hls.hasEnoughToStart||(this.log(`Setting ${h?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,h&&(this.startPosition=d)),h&&this.state===j.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new fR(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Td(e.config)}registerListeners(){const{hls:e}=this;e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===j.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=j.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=de.bufferedInfo(s,e.start,0));const o=e.nextStart;if(o&&o>i&&o<t.edge||this.media.currentTime<e.start)return!1;const l=t.partList;if(l!=null&&l.length){const u=l[l.length-1];return de.isBuffered(this.media,u.start+u.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;Lt(n,"seeking",this.onMediaSeeking),Lt(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===j.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Ft(i,"seeking",this.onMediaSeeking),Ft(i,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=j.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{const o=s.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(o,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const o=this.state,a=s.frag;if(this.fragContextChanged(a)){(o===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(a),this.state=j.IDLE);return}"payload"in s&&(this.log(`Loaded ${a.type} sn: ${a.sn} of ${this.playlistLabel()} ${a.level}`),this.hls.trigger(T.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(`Frag error: ${s?.message||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===nt.APPENDING){const s=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,s),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===nt.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(T.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const i=n?.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{frag:s,payload:o}=n,a=s.decryptdata;if(o&&o.byteLength>0&&a!=null&&a.key&&a.iv&&Ei(a.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),a.key.buffer,a.iv.buffer,Ad(a.method)).catch(c=>{throw i.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:s}),c}).then(c=>{const u=self.performance.now();return i.trigger(T.FRAG_DECRYPTED,{frag:s,payload:c,stats:{tstart:l,tdecrypt:u}}),n.payload=c,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==j.STOPPED&&(this.state=j.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,i;const s=e.tracks;if(s&&!t.encrypted&&((n=s.audio)!=null&&n.encrypted||(i=s.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const o=this.media,a=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${o?"attached mediaKeys: "+o.mediaKeys:"detached"})`);return this.warn(a.message),!o||o.mediaKeys?!1:(this.hls.trigger(T.ERROR,{type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,fatal:!1,error:a,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${n?BR.toString(de.getBuffered(n)):"(detached)"})`),We(e)){var i;if(e.type!==ee.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(a=>!!o[a])){this.state=j.IDLE;return}}const s=(i=this.levels)==null?void 0:i[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=j.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:i,partsLoaded:s}=e,o=!s||s.length===0||s.some(l=>!l),a=new Sd(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;this.fragCurrent=e;const o=t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((s=e.decryptdata)!=null&&s.key)){if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=j.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(T.KEY_LOADED,f),this.state===j.KEY_LOADING&&(this.state=j.IDLE),f}),this.hls.trigger(T.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(a=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(We(e)&&(!l||e.sn!==l.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${l?.sn}->${e.sn}`),this.loadingParts=f)}if(n=Math.max(e.start,n||0),this.loadingParts&&We(e)){const f=o.partList;if(f&&i){n>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(f,e,n);if(h>-1){const p=f[h];e=this.fragCurrent=p.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${p.index} (${h}/${f.length-1}) of ${this.fragInfo(e,!1,p)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=p.start+p.duration,this.state=j.FRAG_LOADING;let m;return a?m=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,p,t,i)).catch(g=>this.handleFragLoadError(g)):m=this.doFragPartsLoad(e,p,t,i).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(T.FRAG_LOADING,{frag:e,part:p,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):m}else if(!e.url||this.loadedEndOfParts(f,n))return Promise.resolve(null)}}if(We(e)&&this.loadingParts){var c;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(c=o.partList)==null?void 0:c.filter(f=>f.loaded).map(f=>`[${f.start}-${f.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+o.startSN+"-"+o.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),Q(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.FRAG_LOADING;const u=this.config.progressive&&e.type!==ee.SUBTITLE;let d;return u&&a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.fragmentLoader.load(e,i)).catch(f=>this.handleFragLoadError(f)):d=Promise.all([this.fragmentLoader.load(e,u?i:void 0),a]).then(([f])=>(!u&&i&&i(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(T.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,n,i){return new Promise((s,o)=>{var a;const l=[],c=(a=n.details)==null?void 0:a.partList,u=d=>{this.fragmentLoader.loadPart(e,d,i).then(f=>{l[d.index]=f;const h=f.part;this.hls.trigger(T.FRAG_LOADED,f);const p=fp(n.details,e.sn,d.index+1)||Uy(c,e.sn,d.index+1);if(p)u(p);else return s({frag:e,part:h,partsLoaded:l})}).catch(o)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===se.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(T.ERROR,t)}else this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.IDLE);return}const{frag:n,part:i,level:s}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o);const a=this.getLevelDetails(),c=a&&n.sn>a.endSN||this.shouldLoadParts(a,n.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(n,i,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const s=e.partList[0];if(s.fragment.type===ee.SUBTITLE)return!1;const o=s.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=o){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=a.details,c=o>-1?fp(l,s,o):null,u=c?c.fragment:$y(l,s,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:c,level:a}):null}bufferFragmentData(e,t,n,i,s){if(this.state!==j.PARSING)return;const{data1:o,data2:a}=e;let l=o;if(a&&(l=tn(o,a)),!l.length)return;const c=this.initPTS[t.cc],u=c?-c.baseTime/c.timescale:void 0,d={type:e.type,frag:t,part:n,chunkMeta:i,offset:u,parent:t.type,data:l};if(this.hls.trigger(T.BUFFER_APPENDING,d),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!de.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=de.bufferInfo(t,n,0),s=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var n;const i=this.getLoadPosition();if(!Q(i))return null;const o=this.lastCurrentTime>i||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,o)}getFwdBufferInfoAtPos(e,t,n,i){const s=de.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&(s.nextStart<=o.end||o.gap)){const a=Math.max(Math.min(s.nextStart,o.end)-t,i);return de.bufferInfo(e,t,a)}}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),s=Math.max(e-t*3,n.maxMaxBufferLength/2,i);return s>=i?(n.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=ee.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,o=n[0].start,a=s.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const d=s.initialLiveManifestSize;if(i<d)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var c;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(t);const f=this.hls.startPosition,h=this.hls.liveSyncPosition,p=l?(f!==-1&&f>=o?f:h)||l.start:e;this.log(`Setting startPosition to ${p} to match start frag at live edge. mainStart: ${f} liveSyncPosition: ${h} frag.start: ${(c=l)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=p}}else e<=o&&(l=n[0]);if(!l){const d=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,d,t)}let u=this.filterReplacedPrimary(l,t);if(!u&&l){const d=l.sn-t.startSN;u=this.filterReplacedPrimary(n[d+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===nt.OK||n===nt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,t),o&&!o.gap&&n.nextStart)){const a=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(a!==null&&n.len+a.len>=s){const l=o.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(mp(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(mp(this.config)&&e.type!==ee.SUBTITLE){const n=this.hls.interstitialsManager,i=n?.bufferingItem;if(i){const o=i.event;if(o){if(o.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&t?.live===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const s=n?.playerQueue;if(s)for(let o=s.length;o--;){const a=s[o].interstitial;if(a.appendInPlace&&e.start>=a.startTime&&e.end<=a.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let i=-1,s=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const c=e[a];if(o=o&&!c.independent,i>-1&&n<c.start)break;const u=c.loaded;u?i=-1:(s||(c.independent||o)&&c.fragment===t)&&(c.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${c.start}`),i=a),s=u}return i}loadedEndOfParts(e,t){let n;for(let i=e.length;i--;){if(n=e[i],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=eR(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const o=t[s-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Ry(e,n.cc,n.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:c}=i,u=n.partList,d=!!(this.loadingParts&&u!=null&&u.length&&l);d&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(o=o.concat(l),a=l.sn);let f;if(e<t){var h;const m=e<this.lastCurrentTime||e>t-c||(h=this.media)!=null&&h.paused||!this.startFragRequested?0:c;f=Kr(s,o,e,m)}else f=o[o.length-1];if(f){const p=f.sn-n.startSN,m=this.fragmentTracker.getState(f);if((m===nt.OK||m===nt.PARTIAL&&f.gap)&&(s=f),s&&f.sn===s.sn&&(!d||u[0].fragment.sn>f.sn||!n.live)&&f.level===s.level){const y=o[p+1];f.sn<a&&this.fragmentTracker.getState(y)!==nt.OK?f=y:f=null}}return f}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,o=!t,a=e.alignedSliding&&Q(s);if(o||!a&&!s){FR(n,e);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),l}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const i=this.timelineOffset;if(n===-1){const s=this.startTimeOffset!==null,o=s?this.startTimeOffset:e.startTimeOffset;o!==null&&Q(o)?(n=t+o,o<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${o} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+i}this.nextLoadPosition=n+i}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&We(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.IDLE)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const y=this.getCurrentContext(t.chunkMeta);y&&(t.frag=y.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var s;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const o=t.details===$.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction;if(!a){this.state=j.ERROR;return}const{action:l,flags:c,retryCount:u=0,retryConfig:d}=a,f=!!d,h=f&&l===ft.RetryRequest,p=f&&!a.resolved&&c===Vt.MoveAllAlternatesMatchingHost,m=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!h&&p&&We(i)&&!i.endList&&m&&!Ly(t))this.resetFragmentErrors(e),this.treatAsGap(i),a.resolved=!0;else if((h||p)&&u<d.maxNumRetry){var g;const y=hu((g=t.response)==null?void 0:g.code),v=bd(d,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+v,this.state=j.FRAG_LOADING_WAITING_RETRY,a.resolved=!0,y){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${d.maxNumRetry} in ${v}ms`)}else if(d)if(this.resetFragmentErrors(e),u<d.maxNumRetry)!o&&l!==ft.RemoveAlternatePermanently&&(a.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else l===ft.SendAlternateToPenaltyBox?this.state=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!hu(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=j.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.PARSED){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,t?.duration||10);const o=!s;return o&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===ee.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=de.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==j.STOPPED&&(this.state=j.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,i){const s=n.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const u=e.elementaryStreams[c];if(u){const d=u.endPTS-u.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${d})`),l||!1;const f=i?0:Ny(s,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);return this.hls.trigger(T.LEVEL_PTS_UPDATED,{details:s,level:n,drift:f,type:c,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)){var a;const l=((a=this.transmuxer)==null?void 0:a.error)===null;if((n.fragmentError===0||l&&(n.fragmentError<2||e.endList))&&this.treatAsGap(e,n),l){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=j.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(T.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===ee.MAIN?"level":"track"}fragInfo(e,t=!0,n){var i,s;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((i=t&&!n?e.startPTS:(n||e).start)!=null?i:NaN).toFixed(3)}-${((s=t&&!n?e.endPTS:(n||e).end)!=null?s:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function mp(r){return!!r.interstitialsController&&r.enableInterstitialPlayback!==!1}class zy{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=$R(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function $R(r,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++){const s=r[i];t.set(s,n),n+=s.length}return t}var dc={exports:{}},gp;function UR(){return gp||(gp=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function s(l,c,u,d,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var h=new i(u,d||l,f),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],h]:l._events[p].push(h):(l._events[p]=h,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=t?t+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,p=new Array(h);f<h;f++)p[f]=d[f].fn;return p},a.prototype.listenerCount=function(c){var u=t?t+c:c,d=this._events[u];return d?d.fn?1:d.length:0},a.prototype.emit=function(c,u,d,f,h,p){var m=t?t+c:c;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,v,E;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,d),!0;case 4:return g.fn.call(g.context,u,d,f),!0;case 5:return g.fn.call(g.context,u,d,f,h),!0;case 6:return g.fn.call(g.context,u,d,f,h,p),!0}for(E=1,v=new Array(y-1);E<y;E++)v[E-1]=arguments[E];g.fn.apply(g.context,v)}else{var b=g.length,_;for(E=0;E<b;E++)switch(g[E].once&&this.removeListener(c,g[E].fn,void 0,!0),y){case 1:g[E].fn.call(g[E].context);break;case 2:g[E].fn.call(g[E].context,u);break;case 3:g[E].fn.call(g[E].context,u,d);break;case 4:g[E].fn.call(g[E].context,u,d,f);break;default:if(!v)for(_=1,v=new Array(y-1);_<y;_++)v[_-1]=arguments[_];g[E].fn.apply(g[E].context,v)}}return!0},a.prototype.on=function(c,u,d){return s(this,c,u,d,!1)},a.prototype.once=function(c,u,d){return s(this,c,u,d,!0)},a.prototype.removeListener=function(c,u,d,f){var h=t?t+c:c;if(!this._events[h])return this;if(!u)return o(this,h),this;var p=this._events[h];if(p.fn)p.fn===u&&(!f||p.once)&&(!d||p.context===d)&&o(this,h);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==u||f&&!p[m].once||d&&p[m].context!==d)&&g.push(p[m]);g.length?this._events[h]=g.length===1?g[0]:g:o(this,h)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=t?t+c:c,this._events[u]&&o(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(dc)),dc.exports}var VR=UR(),Id=f_(VR);const Es="1.6.15",Ii={};function GR(){return typeof __HLS_WORKER_BUNDLE__=="function"}function HR(){const r=Ii[Es];if(r)return r.clientCount++,r;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return Ii[Es]=i,i}function zR(r){const e=Ii[r];if(e)return e.clientCount++,e;const t=new self.URL(r,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Ii[r]=i,i}function KR(r){const e=Ii[r||Es];if(e&&e.clientCount--===1){const{worker:n,objectURL:i}=e;delete Ii[r||Es],i&&self.URL.revokeObjectURL(i),n.terminate()}}function Ky(r,e){return e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128}function Ld(r,e){return e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128}function Rl(r,e){let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t}function bs(r,e){const t=e;let n=0;for(;Ld(r,e);){n+=10;const i=Rl(r,e+6);n+=i,Ky(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)}function jR(r,e,t,n){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],o=s>>2&15;if(o>12){const h=new Error(`invalid ADTS sampling index:${o}`);r.emit(T.ERROR,T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}const a=(s>>6&3)+1,l=e[t+3]>>6&3|(s&1)<<2,c="mp4a.40."+a,u=i[o];let d=o;(a===5||a===29)&&(d-=3);const f=[a<<3|(d&14)>>1,(d&1)<<7|l<<3];return Le.log(`manifest codec:${n}, parsed codec:${c}, channels:${l}, rate:${u} (ADTS object type:${a} sampling index:${o})`),{config:f,samplerate:u,channelCount:l,codec:c,parsedCodec:c,manifestCodec:n}}function jy(r,e){return r[e]===255&&(r[e+1]&246)===240}function Wy(r,e){return r[e+1]&1?7:9}function wd(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function WR(r,e){return e+5<r.length}function Ta(r,e){return e+1<r.length&&jy(r,e)}function YR(r,e){return WR(r,e)&&jy(r,e)&&wd(r,e)<=r.length-e}function qR(r,e){if(Ta(r,e)){const t=Wy(r,e);if(e+t>=r.length)return!1;const n=wd(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Ta(r,i)}return!1}function Yy(r,e,t,n,i){if(!r.samplerate){const s=jR(e,t,n,i);if(!s)return;ke(r,s)}}function qy(r){return 1024*9e4/r}function XR(r,e){const t=Wy(r,e);if(e+t<=r.length){const n=wd(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Xy(r,e,t,n,i){const s=qy(r.samplerate),o=n+i*s,a=XR(e,t);let l;if(a){const{frameLength:d,headerLength:f}=a,h=f+d,p=Math.max(0,t+h-e.length);p?(l=new Uint8Array(h-f),l.set(e.subarray(t+f,e.length),0)):l=e.subarray(t+f,t+h);const m={unit:l,pts:o};return p||r.samples.push(m),{sample:m,length:h,missing:p}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:c,missing:-1}}function QR(r,e){return Ld(r,e)&&Rl(r,e+6)+10<=r.length-e}function JR(r){return r instanceof ArrayBuffer?r:r.byteOffset==0&&r.byteLength==r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function fc(r,e=0,t=1/0){return ZR(r,e,t,Uint8Array)}function ZR(r,e,t,n){const i=eI(r);let s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);const o=tI(r)?r.byteOffset:0,a=(o+r.byteLength)/s,l=(o+e)/s,c=Math.floor(Math.max(0,Math.min(l,a))),u=Math.floor(Math.min(c+Math.max(t,0),a));return new n(i,c,u-c)}function eI(r){return r instanceof ArrayBuffer?r:r.buffer}function tI(r){return r&&r.buffer instanceof ArrayBuffer&&r.byteLength!==void 0&&r.byteOffset!==void 0}function nI(r){const e={key:r.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(r.size<2)return;if(r.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const n=r.data.subarray(1).indexOf(0);if(n===-1)return;const i=jt(fc(r.data,1,n)),s=r.data[2+n],o=r.data.subarray(3+n).indexOf(0);if(o===-1)return;const a=jt(fc(r.data,3+n,o));let l;return i==="-->"?l=jt(fc(r.data,4+n+o)):l=JR(r.data.subarray(4+n+o)),e.mimeType=i,e.pictureType=s,e.description=a,e.data=l,e}function rI(r){if(r.size<2)return;const e=jt(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}}function iI(r){if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=jt(r.data.subarray(t),!0);t+=n.length+1;const i=jt(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=jt(r.data.subarray(1));return{key:r.type,info:"",data:e}}function sI(r){if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=jt(r.data.subarray(t),!0);t+=n.length+1;const i=jt(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=jt(r.data);return{key:r.type,info:"",data:e}}function oI(r){return r.type==="PRIV"?rI(r):r.type[0]==="W"?sI(r):r.type==="APIC"?nI(r):iI(r)}function aI(r){const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=Rl(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}}const mo=10,lI=10;function Qy(r){let e=0;const t=[];for(;Ld(r,e);){const n=Rl(r,e+6);r[e+5]>>6&1&&(e+=mo),e+=mo;const i=e+n;for(;e+lI<i;){const s=aI(r.subarray(e)),o=oI(s);o&&t.push(o),e+=s.size+mo}Ky(r,e)&&(e+=mo)}return t}function Jy(r){return r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp"}function cI(r){if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function xd(r){const e=Qy(r);for(let t=0;t<e.length;t++){const n=e[t];if(Jy(n))return cI(n)}}
vendor: 8,326 bytes, line 35
35let Ht=(function(r){return r.audioId3="org.id3",r.dateRange="com.apple.quicktime.HLS",r.emsg="https://aomedia.org/emsg/ID3",r.misbklv="urn:misb:KLV:bin:1910.1",r})({});function yn(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class kd{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=tn(this.cachedData,e),this.cachedData=null);let n=bs(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?xd(n):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&Q(l))&&(this.basePTS=uI(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Ht.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const u=this.appendFrame(o,e,i);u?(this.frameIndex++,this.lastPTS=u.sample.pts,i+=u.length,s=i):i=c}else QR(e,i)?(n=bs(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Ht.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===c&&s!==c){const u=e.slice(s);this.cachedData?this.cachedData=tn(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:yn(),id3Track:a,textTrack:yn()}}demuxSampleAes(e,t,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:yn(),id3Track:this._id3Track,textTrack:yn()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const uI=(r,e,t)=>{if(Q(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let go=null;const dI=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],fI=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],hI=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],pI=[0,1,1,4];function Zy(r,e,t,n,i){if(t+24>e.length)return;const s=ev(e,t);if(s&&t+s.frameLength<=e.length){const o=s.samplesPerFrame*9e4/s.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+s.frameLength),pts:a,dts:a};return r.config=[],r.channelCount=s.channelCount,r.samplerate=s.sampleRate,r.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function ev(r,e){const t=r[e+1]>>3&3,n=r[e+1]>>1&3,i=r[e+2]>>4&15,s=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const o=r[e+2]>>1&1,a=r[e+3]>>6,l=t===3?3-n:n===3?3:4,c=dI[l*14+i-1]*1e3,d=fI[(t===3?0:t===2?1:2)*3+s],f=a===3?1:2,h=hI[t][n],p=pI[n],m=h*8*p,g=Math.floor(h*c/d+o)*p;if(go===null){const E=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);go=E?parseInt(E[1]):0}return!!go&&go<=87&&n===2&&c>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:d,channelCount:f,frameLength:g,samplesPerFrame:m}}}function Cd(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function tv(r,e){return e+1<r.length&&Cd(r,e)}function mI(r,e){return Cd(r,e)&&4<=r.length-e}function nv(r,e){if(e+1<r.length&&Cd(r,e)){const n=ev(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||tv(r,s)}return!1}class gI extends kd{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=bs(e,0);let i=n?.length||0;if(nv(e,i))return!1;for(let s=e.length;i<s;i++)if(qR(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return YR(e,t)}appendFrame(e,t,n){Yy(e,this.observer,t,n,e.manifestCodec);const i=Xy(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const rv=(r,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=r[e];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,i[0]=(o[0]&s[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class yI extends kd{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=iv(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=bs(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&xd(t)!==void 0&&rv(e,n)<16}}function iv(r,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],l=e[t+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+s]*2;if(t+u>e.length)return-1;const d=e[t+6]>>5;let f=0;d===2?f+=2:(d&1&&d!==1&&(f+=2),d&4&&(f+=2));const h=(e[t+6]<<8|e[t+7])>>12-f&1,m=[2,1,2,3,3,4,4,5][d]+h,g=e[t+5]>>3,y=e[t+5]&7,v=new Uint8Array([s<<6|g<<1|y>>2,(y&3)<<6|d<<3|h<<2|l>>4,l<<4&224]),E=1536/a*9e4,b=n+i*E,_=e.subarray(t,t+u);return r.config=v,r.channelCount=m,r.samplerate=a,r.samples.push({unit:_,pts:b}),u}class vI extends kd{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=bs(e,0);let n=t?.length||0;if(t&&e[n]===11&&e[n+1]===119&&xd(t)!==void 0&&rv(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(nv(e,n))return Le.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return mI(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Zy(e,t,n,this.basePTS,this.frameIndex)}}const EI=/\/emsg[-/]ID3/i;class bI{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,i){const s=this.videoTrack=yn("video",1),o=this.audioTrack=yn("audio",1),a=this.txtTrack=yn("text",1);if(this.id3Track=yn("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=py(e);if(l.video){const{id:c,timescale:u,codec:d,supplemental:f}=l.video;s.id=c,s.timescale=a.timescale=u,s.codec=d,s.supplemental=f}if(l.audio){const{id:c,timescale:u,codec:d}=l.audio;o.id=c,o.timescale=u,o.codec=d}a.id=dy.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return y_(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=tn(this.remainderData,e));const a=__(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Oh(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Oh(e,t),{videoTrack:t,audioTrack:yn(),id3Track:i,textTrack:yn()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=ve(e.samples,["emsg"]);
vendor: 4,159 bytes, line 35
35i&&i.forEach(s=>{const o=I_(s);if(EI.test(o.schemeIdUri)){const a=yp(o,t);let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=o.payload;n.samples.push({data:c,len:c.byteLength,dts:a,pts:a,type:Ht.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const a=yp(o,t);n.samples.push({data:o.payload,len:o.payload.byteLength,dts:a,pts:a,type:Ht.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function yp(r,e){return Q(r.presentationTime)?r.presentationTime/r.timeScale:e+r.presentationTimeDelta/r.timeScale}class TI{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Td(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,pr.cbc)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const o=yy(s.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)}).catch(i)}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const o=s[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}class sv{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const i=t.byteLength;let s=e.naluState||0;const o=s,a=[];let l=0,c,u,d,f=-1,h=0;for(s===-1&&(f=0,h=this.getNALuType(t,0),s=0,l=1);l<i;){if(c=t[l++],!s){s=c?0:1;continue}if(s===1){s=c?0:2;continue}if(!c)s=3;else if(c===1){if(u=l-s-1,f>=0){const p={data:t.subarray(f,u),type:h};a.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(o&&l<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),u>0&&(p.data=tn(p.data,t.subarray(0,u)),p.state=0))}l<i?(d=this.getNALuType(t,l),f=l,h=d,s=0):s=-1}else s=0}if(f>=0&&s>=0){const p={data:t.subarray(f,i),type:h,state:s};a.push(p)}if(a.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=tn(p.data,t))}return e.naluState=s,a}}class Zi{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>
vendor: 8,581 bytes, line 35
35e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const n=this.word>>>32-t;if(e>32&&Le.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class SI extends sv{parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let o=this.VideoSample,a,l=!1;n.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(c=>{var u,d;switch(c.type){case 1:{let m=!1;a=!0;const g=c.data;if(l&&g.length>4){const y=this.readSliceType(g);(y===2||y===4||y===7||y===9)&&(m=!0)}if(m){var f;(f=o)!=null&&f.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.frame=!0,o.key=m;break}case 5:a=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 6:{a=!0,yd(c.data,1,n.pts,t.samples);break}case 7:{var h,p;a=!0,l=!0;const m=c.data,g=this.readSPS(m);if(!e.sps||e.width!==g.width||e.height!==g.height||((h=e.pixelRatio)==null?void 0:h[0])!==g.pixelRatio[0]||((p=e.pixelRatio)==null?void 0:p[1])!==g.pixelRatio[1]){e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[m];const y=m.subarray(1,4);let v="avc1.";for(let E=0;E<3;E++){let b=y[E].toString(16);b.length<2&&(b="0"+b),v+=b}e.codec=v}break}case 8:a=!0,e.pps=[c.data];break;case 9:a=!0,e.audFound=!0,(d=o)!=null&&d.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:a=!0;break;default:a=!1;break}o&&a&&o.units.push(c)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Zi(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,i=8,s;for(let o=0;o<e;o++)i!==0&&(s=t.readEG(),i=(n+s+256)%256),n=i===0?n:i}readSPS(e){const t=new Zi(e);let n=0,i=0,s=0,o=0,a,l,c;const u=t.readUByte.bind(t),d=t.readBits.bind(t),f=t.readUEG.bind(t),h=t.readBoolean.bind(t),p=t.skipBits.bind(t),m=t.skipEG.bind(t),g=t.skipUEG.bind(t),y=this.skipScalingList.bind(this);u();const v=u();if(d(5),p(3),u(),g(),v===100||v===110||v===122||v===244||v===44||v===83||v===86||v===118||v===128){const A=f();if(A===3&&p(1),g(),g(),p(1),h())for(l=A!==3?8:12,c=0;c<l;c++)h()&&(c<6?y(16,t):y(64,t))}g();const E=f();if(E===0)f();else if(E===1)for(p(1),m(),m(),a=f(),c=0;c<a;c++)m();g(),p(1);const b=f(),_=f(),I=d(1);I===0&&p(1),p(1),h()&&(n=f(),i=f(),s=f(),o=f());let S=[1,1];if(h()&&h())switch(u()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((b+1)*16-n*2-i*2),height:(2-I)*(_+1)*16-(I?2:4)*(s+o),pixelRatio:S}}}class AI extends sv{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let o=this.VideoSample,a,l=!1;n.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(c=>{var u,d;switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),o.frame=!0,a=!0;break;case 16:case 17:case 18:case 21:if(a=!0,l){var f;(f=o)!=null&&f.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:a=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 39:a=!0,yd(c.data,2,n.pts,t.samples);break;case 32:a=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ke(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(a=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const h=this.readSPS(c.data);e.width=h.width,e.height=h.height,e.pixelRatio=h.pixelRatio,e.codec=h.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const p in h.params)e.params[p]=h.params[p]}this.pushParameterSet(e.sps,c.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0;break;case 34:if(a=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const h=this.readPPS(c.data);for(const p in h)e.params[p]=h[p]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:a=!0,e.audFound=!0,(d=o)!=null&&d.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:a=!1;break}o&&a&&o.units.push(c)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[n]=e[i],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Zi(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:i}}readSPS(e){const t=new Zi(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const i=t.readBits(2),s=t.readBoolean(),o=t.readBits(5),a=t.readUByte(),l=t.readUByte(),c=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),h=t.readUByte(),p=t.readUByte(),m=t.readUByte(),g=t.readUByte(),y=t.readUByte(),v=[],E=[];for(let oe=0;oe<n;oe++)v.push(t.readBoolean()),E.push(t.readBoolean());if(n>0)for(let oe=n;oe<8;oe++)t.readBits(2);for(let oe=0;oe<n;oe++)v[oe]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),E[oe]&&t.readUByte();t.readUEG();const b=t.readUEG();b==3&&t.skipBits(1);const _=t.readUEG(),I=t.readUEG(),S=t.readBoolean();let A=0,R=0,L=0,C=0;S&&(A+=t.readUEG(),R+=t.readUEG(),L+=t.readUEG(),C+=t.readUEG());const O=t.readUEG(),D=t.readUEG(),P=t.readUEG(),M=t.readBoolean();for(let oe=M?0:n;oe<=n;oe++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let ce=0;ce<4;ce++)for(let Me=0;Me<(ce===3?2:6);Me++)if(!t.readBoolean())t.readUEG();else{const xe=Math.min(64,1<<4+(ce<<1));ce>1&&t.readEG();for(let yt=0;yt<xe;yt++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const x=t.readUEG();let U=0;for(let oe=0;oe<x;oe++){let ce=!1;if(oe!==0&&(ce=t.readBoolean()),ce){oe===x&&t.readUEG(),t.readBoolean(),t.readUEG();let Me=0;for(let Ue=0;Ue<=U;Ue++){const xe=t.readBoolean();let yt=!1;xe||(yt=t.readBoolean()),(xe||yt)&&Me++}U=Me}else{const Me=t.readUEG(),Ue=t.readUEG();U=Me+Ue;for(let xe=0;xe<Me;xe++)t.readUEG(),t.readBoolean();for(let xe=0;xe<Ue;xe++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const oe=t.readUEG();for(let ce=0;ce<oe;ce++){for(let Me=0;Me<P+4;Me++)t.readBits(1);t.readBits(1)}}let H=0,G=1,z=1,J=!0,q=1,X=0;t.readBoolean(),t.readBoolean();let te=!1;if(t.readBoolean()){if(t.readBoolean()){const Qe=t.readUByte(),kt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],_t=[
vendor: 13,921 bytes, line 35
351,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Qe>0&&Qe<16?(G=kt[Qe-1],z=_t[Qe-1]):Qe===255&&(G=t.readBits(16),z=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),te=t.readBoolean(),te&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(q=t.readBits(32),X=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const _t=t.readBoolean(),Ct=t.readBoolean();let zn=!1;(_t||Ct)&&(zn=t.readBoolean(),zn&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),zn&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Gs=0;Gs<=n;Gs++){J=t.readBoolean();const Fl=J||t.readBoolean();let Hs=!1;Fl?t.readEG():Hs=t.readBoolean();const zs=Hs?1:t.readUEG()+1;if(_t)for(let br=0;br<zs;br++)t.readUEG(),t.readUEG(),zn&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ct)for(let br=0;br<zs;br++)t.readUEG(),t.readUEG(),zn&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),H=t.readUEG())}let we=_,Ce=I;if(S){let oe=1,ce=1;b===1?oe=ce=2:b==2&&(oe=2),we=_-oe*R-oe*A,Ce=I-ce*C-ce*L}const Ae=i?["A","B","C"][i]:"",le=a<<24|l<<16|c<<8|u;let Te=0;for(let oe=0;oe<32;oe++)Te=(Te|(le>>oe&1)<<31-oe)>>>0;let he=Te.toString(16);return o===1&&he==="2"&&(he="6"),{codecString:`hvc1.${Ae}${o}.${he}.${s?"H":"L"}${y}.B0`,params:{general_tier_flag:s,general_profile_idc:o,general_profile_space:i,general_profile_compatibility_flags:[a,l,c,u],general_constraint_indicator_flags:[d,f,h,p,m,g],general_level_idc:y,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:D,min_spatial_segmentation_idc:H,chroma_format_idc:b,frame_rate:{fixed:J,fps:X/q}},width:we,height:Ce,pixelRatio:[G,z]}}readPPS(e){const t=new Zi(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),s=t.readBoolean();let o=1;return s&&i?o=0:s?o=3:i&&(o=2),{parallelismType:o}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const it=188;class Jn{constructor(e,t,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(e,t){const n=Jn.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(it*5,t-it)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=it)if(e[l]===71&&(t-l===it||e[l+it]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+it*99,e.length-it)+1)),s||(s=vu(e,l)===0),s&&a>1&&(o===0&&a>2||l+it>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:dy[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Jn.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Jn.createTrack("audio",i),this._id3Track=Jn.createTrack("id3"),this._txtTrack=Jn.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,c=this._txtTrack;let u=o.pid,d=o.pesData,f=a.pid,h=l.pid,p=a.pesData,m=l.pesData,g=null,y=this.pmtParsed,v=this._pmtId,E=e.length;if(this.remainderData&&(e=tn(this.remainderData,e),E=e.length,this.remainderData=null),E<it&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};const b=Math.max(0,Jn.syncOffset(e));E-=(E-b)%it,E<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,E,e.buffer.byteLength-E));let _=0;for(let S=b;S<E;S+=it)if(e[S]===71){const A=!!(e[S+1]&64),R=vu(e,S),L=(e[S+3]&48)>>4;let C;if(L>1){if(C=S+5+e[S+4],C===S+it)continue}else C=S+4;switch(R){case u:A&&(d&&(s=si(d,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,c,s,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(C,S+it)),d.size+=S+it-C);break;case f:if(A){if(p&&(s=si(p,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(C,S+it)),p.size+=S+it-C);break;case h:A&&(m&&(s=si(m,this.logger))&&this.parseID3PES(l,s),m={data:[],size:0}),m&&(m.data.push(e.subarray(C,S+it)),m.size+=S+it-C);break;case 0:A&&(C+=e[C]+1),v=this._pmtId=_I(e,C);break;case v:{A&&(C+=e[C]+1);const O=RI(e,C,this.typeSupported,n,this.observer,this.logger);u=O.videoPid,u>0&&(o.pid=u,o.segmentCodec=O.segmentVideoCodec),f=O.audioPid,f>0&&(a.pid=f,a.segmentCodec=O.segmentAudioCodec),h=O.id3Pid,h>0&&(l.pid=h),g!==null&&!y&&(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${g}'. Backtracking to sync byte @${b} to parse all TS packets.`),g=null,S=b-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=R;break}}else _++;_>0&&Eu(this.observer,new Error(`Found ${_} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=d,a.pesData=p,l.pesData=m;const I={audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(I),I}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:s}=e,o=n.pesData,a=t.pesData,l=i.pesData;let c;if(o&&(c=si(o,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,s,c,!0),n.pesData=null)):n.pesData=o,a&&(c=si(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else a!=null&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(c=si(l,this.logger))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new TI(this.observer,this.config,t);return this.decrypt(i,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new SI:e==="hevc"&&(this.videoParser=new AI))}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const d=i.missing,f=i.sample.unit.byteLength;if(d===-1)s=tn(i.sample.unit,s);else{const h=f-d;i.sample.unit.set(s.subarray(0,d),h),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=s.length;o<a-1&&!Ta(s,o);o++);if(o!==n){let d;const f=o<a-1;if(f?d=`AAC PES did not start with ADTS header,offset:${o}`:d="No ADTS header found in AAC PES",Eu(this.observer,new Error(d),f,this.logger),!f)return}Yy(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const d=qy(e.samplerate);l=i.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,u;for(;o<a;)if(u=Xy(e,s,o,l,c),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(c++;o<a-1&&!Ta(s,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,o=0;const a=t.pts;if(a===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<i;)if(tv(n,o)){const l=Zy(e,n,o,a,s);if(l)o+=l.length,s++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let o=0,a=0,l;for(;a<s&&(l=iv(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=ke({},t,{type:this._videoTrack?Ht.emsg:Ht.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function vu(r,e){return((r[e+1]&31)<<8)+r[e+2]}function _I(r,e){return(r[e+10]&31)<<8|r[e+11]}function RI(r,e,t,n,i,s){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=(r[e+1]&15)<<8|r[e+2],l=e+3+a-4,c=(r[e+10]&15)<<8|r[e+11];for(e+=12+c;e<l;){const u=vu(r,e),d=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){hc("ADTS AAC",s);break}case 15:o.audioPid===-1&&(o.audioPid=u);break;case 21:o.id3Pid===-1&&(o.id3Pid=u);break;case 219:if(!n){hc("H.264",s);break}case 27:o.videoPid===-1&&(o.videoPid=u);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="mp3");break;case 193:if(!n){hc("AC-3",s);break}case 129:t.ac3?o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&d>0){let f=e+5,h=d;for(;h>2;){switch(r[f]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=u,o.segmentAudioCodec="ac3");break}const m=r[f+1]+2;f+=m,h-=m}}break;case 194:case 135:return Eu(i,new Error("Unsupported EC-3 in M2TS found"),void 0,s),o;case 36:o.videoPid===-1&&(o.videoPid=u,o.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=d+5}return o}function Eu(r,e,t,n){n.warn(`parsing error: ${e.message}`),r.emit(T.ERROR,T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function hc(r,e){e.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function si(r,e){let t=0,n,i,s,o,a;const l=r.data;if(!r||r.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=tn(l[0],l[1]),l.splice(1,1);if(n=l[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(i=(n[4]<<8)+n[5],i&&i>r.size-6)return null;const u=n[7];u&192&&(o=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,u&64?(a=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,o-a>60*9e4&&(e.warn(`${Math.round((o-a)/9e4)}s delta between PTS and DTS, align them`),o=a)):a=o),s=n[8];let d=s+9;if(r.size<=d)return null;r.size-=d;const f=new Uint8Array(r.size);for(let h=0,p=l.length;h<p;h++){n=l[h];let m=n.byteLength;if(d)if(d>m){d-=m;continue}else n=n.subarray(d),m-=d,d=0;f.set(n,t),t+=m}return i&&(i-=s+3),{data:f,pts:o,dts:a,len:i}}return null}class II{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Yn=Math.pow(2,32)-1;class B{static init(){B.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in B.types)B.types.hasOwnProperty(e)&&(B.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);B.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);B.STTS=B.STSC=B.STCO=s,B.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),B.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),B.S
vendor: 4,207 bytes, line 35
35MHD=new Uint8Array([0,0,0,0,0,0,0,0]),B.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);B.FTYP=B.box(B.types.ftyp,o,l,o,a),B.DINF=B.box(B.types.dinf,B.box(B.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<s;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return B.box(B.types.hdlr,B.HDLR_TYPES[e])}static mdat(e){return B.box(B.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Yn+1)),i=Math.floor(t%(Yn+1));return B.box(B.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return B.box(B.types.mdia,B.mdhd(e.timescale||0,e.duration||0),B.hdlr(e.type),B.minf(e))}static mfhd(e){return B.box(B.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?B.box(B.types.minf,B.box(B.types.smhd,B.SMHD),B.DINF,B.stbl(e)):B.box(B.types.minf,B.box(B.types.vmhd,B.VMHD),B.DINF,B.stbl(e))}static moof(e,t,n){return B.box(B.types.moof,B.mfhd(e),B.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=B.trak(e[t]);return B.box.apply(null,[B.types.moov,B.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(B.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=B.trex(e[t]);return B.box.apply(null,[B.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Yn+1)),i=Math.floor(t%(Yn+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return B.box(B.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return B.box(B.types.sdtp,n)}static stbl(e){return B.box(B.types.stbl,B.stsd(e),B.box(B.types.stts,B.STTS),B.box(B.types.stsc,B.STSC),B.box(B.types.stsz,B.STSZ),B.box(B.types.stco,B.STCO))}static avc1(e){let t=[],n=[],i,s,o;for(i=0;i<e.sps.length;i++)s=e.sps[i],o=s.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],o=s.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(s));const a=B.box(B.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return B.box(B.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,B.box(B.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),B.box(B.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return B.box(B.types.mp4a,B.audioStsd(e),B.box(B.types.esds,B.esds(e)))}static mp3(e){return B.box(B.types[".mp3"],B.audioStsd(e))}static ac3(e){return B.box(B.types["ac-3"],B.audioStsd(e),B.box(B.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return B.box(B.types.stsd,B.STSD,B.mp4a(e));if(t==="ac3"&&e.config)return B.box(B.types.stsd,B.STSD,B.ac3(e));if(t==="mp3"&&e.codec==="mp3")return B.box(B.types.stsd,B.STSD,B.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return B.box(B.types.stsd,B.STSD,B.avc1(e));if(t==="hevc"&&e.vps)return B.box(B.types.stsd,B.STSD,B.hvc1(e))}
vendor: 23,825 bytes, line 35
35else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),i=e.width||0,s=e.height||0,o=Math.floor(n/(Yn+1)),a=Math.floor(n%(Yn+1));return B.box(B.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=B.sdtp(e),i=e.id,s=Math.floor(t/(Yn+1)),o=Math.floor(t%(Yn+1));return B.box(B.types.traf,B.box(B.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),B.box(B.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),B.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,B.box(B.types.trak,B.tkhd(e),B.mdia(e))}static trex(e){const t=e.id;return B.box(B.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],i=n.length,s=12+16*i,o=new Uint8Array(s);let a,l,c,u,d,f;for(t+=8+s,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],c=l.duration,u=l.size,d=l.flags,f=l.cts,o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*a);return B.box(B.types.trun,o)}static initSegment(e){B.types||B.init();const t=B.moov(e);return tn(B.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],i=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let o=s.length;for(let p=0;p<n.length;p+=1){o+=3;for(let m=0;m<n[p].length;m+=1)o+=2+n[p][m].length}const a=new Uint8Array(o);a.set(s,0),o=s.length;const l=n.length-1;for(let p=0;p<n.length;p+=1){a.set(new Uint8Array([32+p|(p===l?128:0),0,n[p].length]),o),o+=3;for(let m=0;m<n[p].length;m+=1)a.set(new Uint8Array([n[p][m].length>>8,n[p][m].length&255]),o),o+=2,a.set(n[p][m],o),o+=n[p][m].length}const c=B.box(B.types.hvcC,a),u=e.width,d=e.height,f=e.pixelRatio[0],h=e.pixelRatio[1];return B.box(B.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,B.box(B.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),B.box(B.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&255])))}}B.types=void 0;B.HDLR_TYPES=void 0;B.STTS=void 0;B.STSC=void 0;B.STCO=void 0;B.STSZ=void 0;B.VMHD=void 0;B.SMHD=void 0;B.STSD=void 0;B.FTYP=void 0;B.DINF=void 0;const ov=9e4;function Dd(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function LI(r,e,t=1,n=!1){return Dd(r,e,1/t,n)}function $i(r,e=!1){return Dd(r,1e3,1/ov,e)}function wI(r,e=1){return Dd(r,ov,1/e)}function vp(r){const{baseTime:e,timescale:t,trackId:n}=r;return`${e/t} (${e}/${t}) trackId: ${n}`}const xI=10*1e3,kI=1024,CI=1152,DI=1536;let oi=null,pc=null;function Ep(r,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:r?2:1,isNonSync:r?0:1}}}class zo extends nn{constructor(e,t,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,oi===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);oi=o?parseInt(o[1]):0}if(pc===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);pc=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&vp(t)} > ${e&&vp(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,i=e.reduce((s,o)=>{let a=o.pts,l=a-s;return l<-4294967296&&(t=!0,a=Gt(a,n),l=a-s),l>0?s:a},n);return t&&this.debug("PTS rollover detected"),i}remux(e,t,n,i,s,o,a,l){let c,u,d,f,h,p,m=s,g=s;const y=e.pid>-1,v=t.pid>-1,E=t.samples.length,b=e.samples.length>0,_=a&&E>0||E>1;if((!y||b)&&(!v||_)||this.ISGenerated||a){if(this.ISGenerated){var S,A,R,L;const P=this.videoTrackConfig;(P&&(t.width!==P.width||t.height!==P.height||((S=t.pixelRatio)==null?void 0:S[0])!==((A=P.pixelRatio)==null?void 0:A[0])||((R=t.pixelRatio)==null?void 0:R[1])!==((L=P.pixelRatio)==null?void 0:L[1]))||!P&&_||this.nextAudioTs===null&&b)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,s,o));const C=this.isVideoContiguous;let O=-1,D;if(_&&(O=PI(t.samples),!C&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,O>0){this.warn(`Dropped ${O} out of ${E} video samples due to a missing keyframe`);const P=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(O),t.dropped+=O,g+=(t.samples[0].pts-P)/t.inputTimeScale,D=g}else O===-1&&(this.warn(`No keyframe found out of ${E} video samples`),p=!1);if(this.ISGenerated){if(b&&_){const P=this.getVideoStartPts(t.samples),N=(Gt(e.samples[0].pts,P)-P)/t.inputTimeScale;m+=Math.max(0,N),g+=Math.max(0,-N)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,s,o)),u=this.remuxAudio(e,m,this.isAudioContiguous,o,v||_||l===ee.AUDIO?g:void 0),_){const P=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,s,o)),c=this.remuxVideo(t,g,C,P)}}else _&&(c=this.remuxVideo(t,g,C,0));c&&(c.firstKeyFrame=O,c.independent=O!==-1,c.firstKeyFramePTS=D)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(h=av(n,s,this._initPTS,this._initDTS)),i.samples.length&&(f=lv(i,s,this._initPTS))),{audio:u,video:c,initSegment:d,independent:p,text:f,id3:h}}computeInitPts(e,t,n,i){const s=Math.round(n*t);let o=Gt(e,s);if(o<s+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-o)/t} ${i}`);o<s+t;)o+=8589934592;return o-s}generateIS(e,t,n,i){const s=e.samples,o=t.samples,a=this.typeSupported,l={},c=this._initPTS;let u=!c||i,d="audio/mp4",f,h,p,m=-1;if(u&&(f=h=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(d="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):B.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(m=e.id,p=e.inputTimeScale,!c||p!==c.timescale?f=h=this.computeInitPts(s[0].pts,p,n,"audio"):u=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:B.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(m=t.id,p=t.inputTimeScale,!c||p!==c.timescale){const g=this.getVideoStartPts(o),y=Gt(o[0].dts,g),v=this.computeInitPts(y,p,n,"video"),E=this.computeInitPts(g,p,n,"video");h=Math.min(h,v),f=Math.min(f,E)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(c&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${f/p} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${f/p} (${f}/${p}) trackId: ${m}`),this._initPTS={baseTime:f,timescale:p,trackId:m},this._initDTS={baseTime:h,timescale:p,trackId:m}):f=p=void 0,{tracks:l,initPTS:f,timescale:p,trackId:m}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,o=e.samples,a=[],l=o.length,c=this._initPTS,u=c.baseTime*s/c.timescale;let d=this.nextVideoTs,f=8,h=this.videoSampleDuration,p,m,g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,v=!1;if(!n||d===null){const H=u+t*s,G=o[0].pts-Gt(o[0].dts,o[0].pts);oi&&d!==null&&Math.abs(H-G-(d+u))<15e3?n=!0:d=H-G-u}const E=d+u;for(let H=0;H<l;H++){const G=o[H];G.pts=Gt(G.pts,E),G.dts=Gt(G.dts,E),G.dts<o[H>0?H-1:H].dts&&(v=!0)}v&&o.sort(function(H,G){const z=H.dts-G.dts,J=H.pts-G.pts;return z||J}),p=o[0].dts,m=o[o.length-1].dts;const b=m-p,_=b?Math.round(b/(l-1)):h||e.inputTimeScale/30;if(n){const H=p-E,G=H>_,z=H<-1;if((G||z)&&(G?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${$i(H,!0)} ms (${H}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${$i(-H,!0)} ms (${H}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!z||E>=o[0].pts||oi)){p=E;const J=o[0].pts-H;if(G)o[0].dts=p,o[0].pts=J;else{let q=!0;for(let X=0;X<o.length&&!(o[X].dts>J&&q);X++){const te=o[X].pts;if(o[X].dts-=H,o[X].pts-=H,X<o.length-1){const pe=o[X+1].pts,we=o[X].pts,Ce=pe<=we,Ae=pe<=te;q=Ce==Ae}}}this.log(`Video: Initial PTS/DTS adjusted: ${$i(J,!0)}/${$i(p,!0)}, delta: ${$i(H,!0)} ms`)}}p=Math.max(0,p);let I=0,S=0,A=p;for(let H=0;H<l;H++){const G=o[H],z=G.units,J=z.length;let q=0;for(let X=0;X<J;X++)q+=z[X].data.length;S+=q,I+=J,G.length=q,G.dts<A?(G.dts=A,A+=_/4|0||1):A=G.dts,g=Math.min(G.pts,g),y=Math.max(G.pts,y)}m=o[l-1].dts;const R=S+4*I+8;let L;try{L=new Uint8Array(R)}catch(H){this.observer.emit(T.ERROR,T.ERROR,{type:se.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:H,bytes:R,reason:`fail allocating video mdat ${R}`});return}const C=new DataView(L.buffer);C.setUint32(0,R),L.set(B.types.mdat,4);let O=!1,D=Number.POSITIVE_INFINITY,P=Number.POSITIVE_INFINITY,M=Number.NEGATIVE_INFINITY,N=Number.NEGATIVE_INFINITY;for(let H=0;H<l;H++){const G=o[H],z=G.units;let J=0;for(let te=0,pe=z.length;te<pe;te++){const we=z[te],Ce=we.data,Ae=we.data.byteLength;C.setUint32(f,Ae),f+=4,L.set(Ce,f),f+=Ae,J+=4+Ae}let q;if(H<l-1)h=o[H+1].dts-G.dts,q=o[H+1].pts-G.pts;else{const te=this.config,pe=H>0?G.dts-o[H-1].dts:_;if(q=H>0?G.pts-o[H-1].pts:_,te.stretchShortVideoTrack&&this.nextAudioTs!==null){const we=Math.floor(te.maxBufferHole*s),Ce=(i?g+i*s:this.nextAudioTs+u)-G.pts;Ce>we?(h=Ce-pe,h<0?h=pe:O=!0,this.log(`It is approximately ${Ce/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=pe}else h=pe}const X=Math.round(G.pts-G.dts);D=Math.min(D,h),M=Math.max(M,h),P=Math.min(P,q),N=Math.max(N,q),a.push(Ep(G.key,h,J,X))}if(a.length){if(oi){if(oi<70){const H=a[0].flags;H.dependsOn=2,H.isNonSync=0}}else if(pc&&N-P<M-D&&_/M<.025&&a[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let H=p;for(let G=0,z=a.length;G<z;G++){const J=H+a[G].duration,q=H+a[G].cts;if(G<z-1){const X=J+a[G+1].cts;a[G].duration=X-q}else a[G].duration=G?a[G-1].duration:_;a[G].cts=0,H=J}}}h=O||!h?_:h;const F=m+h;this.nextVideoTs=d=F-u,this.videoSampleDuration=h,this.isVideoContiguous=!0;const K={data1:B.moof(e.sequenceNumber++,p,ke(e,{samples:a})),data2:L,startPTS:(g-u)/s,endPTS:(y+h-u)/s,startDTS:(p-u)/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,K}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return CI;case"ac3":return DI;default:return kI}}remuxAudio(e,t,n,i,s){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,c=this.getSamplesPerFrame(e),u=c*l,d=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,h=[],p=s!==void 0;let m=e.samples,g=f?0:8,y=this.nextAudioTs||-1;const v=d.baseTime*o/d.timescale,E=v+t*o;if(this.isAudioContiguous=n=n||m.length&&y>0&&(i&&Math.abs(E-(y+v))<9e3||Math.abs(Gt(m[0].pts,E)-(y+v))<20*u),m.forEach(function(N){N.pts=Gt(N.pts,E)}),!n||y<0){const N=m.length;if(m=m.filter(F=>F.pts>=0),N!==m.length&&this.warn(`Removed ${m.length-N} of ${N} samples (initPTS ${v} / ${o})`),!m.length)return;s===0?y=0:i&&!p?y=Math.max(0,E-v):y=m[0].pts-v}if(e.segmentCodec==="aac"){const N=this.config.maxAudioFramesDrift;for(let F=0,x=y+v;F<m.length;F++){const U=m[F],K=U.pts,H=K-x,G=Math.abs(1e3*H/o);if(H<=-N*u&&p)F===0&&(this.warn(`Audio frame @ ${(K/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*H/o)} ms.`),this.nextAudioTs=y=K-v,x=K);else if(H>=N*u&&G<xI&&p){let z=Math.round(H/u);for(x=K-z*u;x<0&&z&&u;)z--,x+=u;F===0&&(this.nextAudioTs=y=x-v),this.warn(`Injecting ${z} audio frames @ ${((x-v)/o).toFixed(3)}s due to ${Math.round(1e3*H/o)} ms gap.`);for(let J=0;J<z;J++){let q=II.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);q||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),q=U.unit.subarray()),m.splice(F,0,{unit:q,pts:x}),x+=u,F++}}U.pts=x,x+=u}}let b=null,_=null,I,S=0,A=m.length;for(;A--;)S+=m[A].unit.byteLength;for(let N=0,F=m.length;N<F;N++){const x=m[N],U=x.unit;let K=x.pts;if(_!==null){const G=h[N-1];G.duration=Math.round((K-_)/l)}else if(n&&e.segmentCodec==="aac"&&(K=y+v),b=K,S>0){S+=g;try{I=new Uint8Array(S)}catch(G){this.observer.emit(T.ERROR,T.ERROR,{type:se.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:G,bytes:S,reason:`fail allocating audio mdat ${S}`});return}f||(new DataView(I.buffer).setUint32(0,S),I.set(B.types.mdat,4))}else return;I.set(U,g);const H=U.byteLength;g+=H,h.push(Ep(!0,c,H,0)),_=K}const R=h.length;if(!R)return;const L=h[h.length-1];y=_-v,this.nextAudioTs=y+l*L.duration;const C=f?new Uint8Array(0):B.moof(e.sequenceNumber++,b/l,ke({},e,{samples:h}));e.samples=[];const O=(b-v)/o,D=this.nextAudioTs/o,M={data1:C,data2:I,startPTS:O,endPTS:D,startDTS:O,endDTS:D,type:"audio",hasAudio:!0,hasVideo:!1,nb:R};return this.isAudioContiguous=!0,M}}function Gt(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function PI(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function av(r,e,t,n){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const l=r.samples[a];l.pts=Gt(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=Gt(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function lv(r,e,t){const n=r.samples.length;if(!n)return;const i=r.inputTimeScale;for(let o=0;o<n;o++){const a=r.samples[o];a.pts=Gt(a.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((o,a)=>o.pts-a.pts);const s=r.samples;return r.samples=[],{samples:s}}class OI extends nn{constructor(e,t,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:o}=this.initData=py(e);if(t)T_(e,t);else{const l=s||o;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}s&&(n=bp(s,Pe.AUDIO,this)),o&&(i=bp(o,Pe.VIDEO,this));const a={};s&&o?a.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:s?a.audio={container:"audio/mp4",codec:n,encrypted:s.encrypted,initSegment:e,id:"audio"}:o?a.video={container:"video/mp4",codec:i,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,n,i,s,o){var a,l;let{initPTS:c,lastEndTime:u}=this;const d={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};Q(u)||(u=this.lastEndTime=s||0);const f=t.samples;if(!f.length)return d;const h={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if((a=p)!=null&&a.length||(this.generateInitSegment(f),p=this.initData),!((l=p)!=null&&l.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const m=A_(f,p,this),g=p.audio?m[p.audio.id]:null,y=p.video?m[p.video.id]:null,v=yo(y,1/0),E=yo(g,1/0),b=yo(y,0,!0),_=yo(g,0,!0);let I=s,S=0;const A=g&&(!y||!c&&E<v||c&&c.trackId===p.audio.id),R=A?g:y;if(R){const x=R.timescale,U=R.start-s*x,K=A?p.audio.id:p.video.id;I=R.start/x,S=A?_-E:b-v,(o||!c)&&(MI(c,I,s,S)||x!==c.timescale)&&(c&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${s} ${U/x} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${I-s} (${U}/${x}) trackId: ${K}`),c=null,h.initPTS=U,h.timescale=x,h.trackId=K)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);c?(h.initPTS=c.baseTime,h.timescale=c.timescale,h.trackId=c.trackId):((!h.timescale||h.trackId===void 0||h.initPTS===void 0)&&(this.warn("Could not set initPTS"),h.initPTS=I,h.timescale=1,h.trackId=-1),this.initPTS=c={baseTime:h.initPTS,timescale:h.timescale,trackId:h.trackId});const L=I-c.baseTime/c.timescale,C=L+S;S>0?this.lastEndTime=C:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const O=!!p.audio,D=!!p.video;let P="";O&&(P+="audio"),D&&(P+="video");const M=(p.audio?p.audio.encrypted:!1)||(p.video?p.video.encrypted:!1),N={data1:f,startPTS:L,startDTS:L,endPTS:C,endDTS:C,type:P,hasAudio:O,hasVideo:D,nb:1,dropped:0,encrypted:M};d.audio=O&&!D?N:void 0,d.video=D?N:void 0;const F=y?.sampleCount;if(F){const x=y.keyFrameIndex,U=x!==-1;N.nb=F,N.dropped=x===0||this.isVideoContiguous?0:U?x:F,N.independent=U,N.firstKeyFrame=x,U&&y.keyFrameStart&&(N.firstKeyFramePTS=(y.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(d.independent=U),this.isVideoContiguous||(this.isVideoContiguous=U),N.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${x}/${F} dropped: ${N.dropped} start: ${N.firstKeyFramePTS||"NA"}`)}return d.initSegment=h,d.id3=av(n,s,c,c),i.samples.length&&(d.text=lv(i,s,c)),d}}function yo(r,e,t=!1){return r?.start!==void 0?(r.start+(t?r.duration:0))/r.timescale:e}function MI(r,e,t,n){if(r===null)return!0;const i=Math.max(n,1),s=e-r.baseTime/r.timescale;return Math.abs(s-t)>i}function bp(r,e,t){const n=r.codec;return n&&n.length>4?n:e===Pe.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?ha(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let Mn;try{Mn=self.performance.now.bind(self.performance)}catch{Mn=Date.now}const Ko=[{demux:bI,remux:OI},{demux:Jn,remux:zo},{demux:gI,remux:zo},{demux:vI,remux:zo}];Ko.splice(2,0,{demux:yI,remux:zo});class Tp{constructor(e,t,n,i,s,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=s,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=Mn();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:u,trackSwitch:d,accurateTimeOffset:f,timeOffset:h,initSegmentChange:p}=i||a,{audioCodec:m,videoCodec:g,defaultInitPts:y,duration:v,initSegmentData:E}=l,b=NI(o,t);if(b&&Ei(b.method)){const A=this.getDecrypter(),R=Ad(b.method);if(A.isSync()){let L=A.softwareDecrypt(o,b.key.buffer,b.iv.buffer,R);if(n.part>-1){const O=A.flush();L=O&&O.buffer}if(!L)return s.executeEnd=Mn(),mc(n);o=new Uint8Array(L)}else return this.asyncResult=!0,this.decryptionPromise=A.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer,R).then(L=>{const C=this.push(L,null,n);return this.decryptionPromise=null,C}),this.decryptionPromise}const _=this.needsProbing(u,d);if(_){const A=this.configureTransmuxer(o);if(A)return this.logger.warn(`[transmuxer] ${A.message}`),this.observer.emit(T.ERROR,T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:A,reason:A.message}),s.executeEnd=Mn(),mc(n)}(u||d||p||_)&&this.resetInitSegment(E,m,g,v,t),(u||p||_)&&this.resetInitialTimestamp(y),c||this.resetContiguity();const I=this.transmux(o,b,h,f,n);this.asyncResult=Ts(I);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,s.executeEnd=Mn(),I}flush(e){const t=e.transmuxing;t.executeStart=Mn();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const d=n.flush();d&&o.push(this.push(d.buffer,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c){t.executeEnd=Mn();const d=[mc(e)];return this.asyncResult?Promise.resolve(d):d}const u=l.flush(a);return Ts(u)?(this.asyncResult=!0,u.then(d=>(this.flushRemux(o,d,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===ee.MAIN?"level":"track"} ${n.level}`);const u=this.remuxer.remux(i,s,o,a,c,l,!0,this.id);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=Mn()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,s):o=this.transmuxUnencrypted(e,n,i,s),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n
vendor: 4,058 bytes, line 35
35).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i}=this;let s;for(let d=0,f=Ko.length;d<f;d++){var o;if((o=Ko[d].demux)!=null&&o.probe(e,this.logger)){s=Ko[d];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,l=this.remuxer,c=s.remux,u=s.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(n,t,i,this.logger)),(!a||!(a instanceof u))&&(this.demuxer=new u(n,t,i,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Td(this.config)),e}}function NI(r,e){let t=null;return r.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const mc=r=>({remuxResult:{},chunkMeta:r});function Ts(r){return"then"in r&&r.then instanceof Function}class FI{constructor(e,t,n,i,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=i,this.defaultInitPts=s||null}}class BI{constructor(e,t,n,i,s,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=o}}let Sp=0;class cv{constructor(e,t,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Sp++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const c=l.data,u=this.hls;if(!(!u||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case"init":{var d;const f=(d=this.workerContext)==null?void 0:d.objectURL;f&&self.URL.revokeObjectURL(f);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{u.logger[c.data.logType]&&u.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,u.trigger(c.event,c.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const c=new Error(`${l.message}  (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(l,c)=>{c=c||{},c.frag=this.frag||void 0,l===T.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(l,c)};this.observer=new Id,this.observer.on(T.FRAG_DECRYPTED,o),this.observer.on(T.ERROR,o);const a=Fh(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(s.workerPath||GR()){try{s.workerPath?(l.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=zR(s.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=HR());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:t,config:Oe(s)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new Tp(this.observer,a,s,"",t,e.logger)}return}}this.transmuxer=new Tp(this.observer,a,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Sp++;const t=this.hls.config,n=Fh(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,c
vendor: 25,052 bytes, lines 35-41
35onfig:Oe(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),KR(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,i,s,o,a,l,c,u){var d,f;c.transmuxing.start=self.performance.now();const{instanceNo:h,transmuxer:p}=this,m=o?o.start:s.start,g=s.decryptdata,y=this.frag,v=!(y&&s.cc===y.cc),E=!(y&&c.level===y.level),b=y?c.sn-y.sn:-1,_=this.part?c.part-this.part.index:-1,I=b===0&&c.id>1&&c.id===y?.stats.chunkCount,S=!E&&(b===1||b===0&&(_===1||I&&_<=0)),A=self.performance.now();(E||b||s.stats.parsing.start===0)&&(s.stats.parsing.start=A),o&&(_||!S)&&(o.stats.parsing.start=A);const R=!(y&&((d=s.initSegment)==null?void 0:d.url)===((f=y.initSegment)==null?void 0:f.url)),L=new BI(v,S,l,E,m,R);if(!S||v||R){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===ee.MAIN?"level":"track"}: ${c.level} id: ${c.id}
36        discontinuity: ${v}
37        trackSwitch: ${E}
38        contiguous: ${S}
39        accurateTimeOffset: ${l}
40        timeOffset: ${m}
41        initSegmentChange: ${R}`);const C=new FI(n,i,t,a,u);this.configureTransmuxer(C)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:h,cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:L},e instanceof ArrayBuffer?[e]:[]);else if(p){const C=p.push(e,g,c,L);Ts(C)?C.then(O=>{this.handleTransmuxComplete(O)}).catch(O=>{this.transmuxerError(O,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(C)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const i=n.flush(e);Ts(i)?i.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Ap=100;class $I extends Rd{constructor(e,t,n){super(e,t,n,"audio-stream-controller",ee.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(T.BUFFER_RESET,this.onBufferReset,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(T.FRAG_LOADING,this.onFragLoading,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(T.BUFFER_RESET,this.onBufferReset,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(T.FRAG_LOADING,this.onFragLoading,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:o}){if(n===ee.MAIN){const a=t.cc,l=this.fragCurrent;if(this.initPTS[a]={baseTime:i,timescale:s,trackId:o},this.log(`InitPTS for cc: ${a} found from main: ${i/s} (${i}/${s}) trackId: ${o}`),this.mainAnchor=t,this.state===j.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==a)&&this.syncWithAnchor(t,c?.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==a?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===j.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const i=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&i?.cc===t.cc)return;const s=(i||e).cc,o=this.getLevelDetails(),a=this.getLoadPosition(),l=Ry(o,s,a);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===j.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ap),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=j.IDLE):this.state=j.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.WAITING_TRACK:{const{levels:e,trackId:t}=this,n=e?.[t],i=n?.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=j.WAITING_INIT_PTS}break}case j.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case j.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:i,complete:s}=e,o=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=j.FRAG_LOADING;const a=i.flush().buffer,l={frag:t,part:n,payload:a,networkDetails:null};this._handleFragmentLoadProgress(l),s&&super._handleFragmentLoadComplete(l)}else o&&o.cc!==e.frag.cc&&this.syncWithAnchor(o,e.frag)}else this.state=j.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:i,trackId:s}=this,o=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(n!=null&&n[s]))return;const a=n[s],l=a.details;if(!l||this.waitForLive(a)||this.waitForCdnTuneIn(l)){this.state=j.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,Pe.AUDIO,ee.AUDIO));const u=this.getFwdBufferInfo(c,ee.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){t.trigger(T.BUFFER_EOS,{type:"audio"}),this.state=j.ENDED;return}const d=u.len,f=t.maxBufferLength,h=l.fragments,p=h[0].start,m=this.getLoadPosition(),g=this.flushing?m:u.end;if(this.switchingTrack&&i){const E=m;l.PTSKnown&&E<p&&(u.end>p||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(d>=f&&!this.switchingTrack&&g<h[h.length-1].start)return;let y=this.getNextFragment(g,l);if(y&&this.isLoopLoading(y,g)&&(y=this.getNextFragmentLoopLoading(y,l,u,ee.MAIN,f)),!y){this.bufferFlushed=!0;return}let v=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&We(y)&&!y.endList&&(!l.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===nt.OK&&(this.mainFragLoading=v=null),v&&We(v))){if(y.start>v.end){const b=this.fragmentTracker.getFragAtPos(g,ee.MAIN);b&&b.end>v.end&&(v=b,this.mainFragLoading={frag:b,targetBufferTime:null})}if(y.start>v.end)return}this.loadFragment(y,a,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new vs(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==j.STOPPED&&(this.setInterval(Ap),this.state=j.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(T.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:i}=this,{details:s,id:o,groupId:a,track:l}=t;if(!i){this.warn(`Audio tracks reset while loading track ${o} "${l.name}" of "${a}"`);return}const c=this.mainDetails;if(!c||s.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==j.STOPPED&&(this.state=j.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${l.name}" of "${a}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const u=i[o];let d=0;if(s.live||(n=u.details)!=null&&n.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(u.details){var f;d=this.alignPlaylists(s,u.details,(f=this.levelLastLoaded)==null?void 0:f.details)}s.alignedSliding||(Hy(s,c),s.alignedSliding||ba(s,c),d=s.fragmentStart)}u.details=s,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(c,d),this.hls.trigger(T.AUDIO_TRACK_UPDATED,{details:s,id:o,groupId:t.groupId}),this.state===j.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=j.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:s}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const c=l[a];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const u=c.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const d=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new cv(this.hls,ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[n.cc],p=(t=n.initSegment)==null?void 0:t.data;if(h!==void 0){const g=i?i.index:-1,y=g!==-1,v=new Sd(n.level,n.sn,n.stats.chunkCount,s.byteLength,g,y);f.push(s,p,d,"",n,i,u.totalduration,!1,v,h)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:m}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new zy,complete:!1};m.push(new Uint8Array(s)),this.state!==j.STOPPED&&(this.state=j.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===ee.MAIN&&We(t.frag)&&(this.mainFragLoading=t,this.state===j.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==ee.AUDIO){!this.audioOnly&&n.type===ee.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(We(n)){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(T.AUDIO_TRACK_SWITCHED,Ie({},s)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ee.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===be.AUDIO_TRACK&&(this.state=j.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Pe.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Pe.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:c,level:u}=a,{details:d}=u,{audio:f,text:h,id3:p,initSegment:m}=s;if(this.fragContextChanged(l)||!d){this.fragmentTracker.removeFragment(l);return}if(this.state=j.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const g=l.initSegment||l;if(this.unhandledEncryptionError(m,l))return;this._bufferInitSegment(u,m.tracks,g,o),i.trigger(T.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:n,tracks:m.tracks})}if(f){const{startPTS:g,endPTS:y,startDTS:v,endDTS:E}=f;c&&(c.elementaryStreams[Pe.AUDIO]={startPTS:g,endPTS:y,startDTS:v,endDTS:E}),l.setElementaryStreamInfo(Pe.AUDIO,g,y,v,E),this.bufferFragmentData(f,l,c,o)}if(p!=null&&(t=p.samples)!=null&&t.length){const g=ke({id:n,frag:l,details:d},p);i.trigger(T.FRAG_PARSING_METADATA,g)}if(h){const g=ke({id:n,frag:l,details:d},h);i.trigger(T.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,n,i){if(this.state!==j.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=ee.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${o}/${s.codec}]`),o&&o.split(",").length===1&&(s.levelCodec=o),this.hls.trigger(T.BUFFER_CODECS,t);const a=s.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(T.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===nt.NOT_LOADED||i===nt.PARTIAL){var s;if(!We(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=j.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==t.details.fragmentStart&&ba(t.details,o)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:i,characteristics:s,audioCodec:o,channels:a}=this.bufferedTrack;Mr({name:t,lang:n,assocLang:i,characteristics:s,audioCodec:o,channels:a},e,Lr)||(ma(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(T.AUDIO_TRACK_SWITCHED,Ie({},e))}}class Pd extends nn{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const i=t?.renditionReports;if(i){let s=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),l=a.URI||""}if(l===e){s=o;break}else l===e.substring(0,l.length)&&(s=o)}if(s!==-1){const o=i[s],a=parseInt(o["LAST-MSN"])||t.lastPartSn;let l=parseInt(o["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}const c=n&&Bh(n);return new $h(a,l>=0?l:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:i,stats:s}=t,o=self.performance.now(),a=s.loading.first?Math.max(0,o-s.loading.first):0;i.advancedDateTime=Date.now()-a;const l=this.hls.config.timelineOffset;if(l!==i.appliedTimelineOffset){const u=Math.max(l||0,0);i.appliedTimelineOffset=u,i.fragments.forEach(d=>{d.setStart(d.playlistOffset+u)})}if(i.live||n!=null&&n.live){const u="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(n),n&&i.fragments.length>0){CR(n,i,this);const v=i.playlistParsingError;if(v){this.warn(v);const E=this.hls;if(!E.config.ignorePlaylistParsingErrors){var c;const{networkDetails:b}=t;E.trigger(T.ERROR,{type:se.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:v,reason:v.message,level:t.level||void 0,parent:(c=i.fragments[0])==null?void 0:c.type,networkDetails:b,stats:s});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=s.loading.start);const d=this.hls.mainForwardBufferInfo,f=d?d.end-d.len:0,h=(i.edge-f)*1e3,p=By(i,h);if(i.requestScheduled+p<o?i.requestScheduled=o:i.requestScheduled+=p,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let m,g,y;if(i.canBlockReload&&i.endSN&&i.advanced){const v=this.hls.config.lowLatencyMode,E=i.lastPartSn,b=i.endSN,_=i.lastPartIndex,I=_!==-1,S=E===b;I?S?(g=b+1,y=v?0:_):(g=E,y=v?_+1:i.maxPartIndex):g=b+1;const A=i.age,R=A+i.ageHeader;let L=Math.min(R-i.partTarget,i.targetduration*1.5);if(L>0){if(R>i.targetduration*3)this.log(`Playlist last advanced ${A.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,y=void 0;else if(n!=null&&n.tuneInGoal&&R-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${L} with playlist age: ${i.age}`),L=0;else{const C=Math.floor(L/i.targetduration);if(g+=C,y!==void 0){const O=Math.round(L%i.targetduration/i.partTarget);y+=O}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${A.toFixed(2)}s goal: ${L} skip sn ${C} to part ${y}`)}i.tuneInGoal=L}if(m=this.getDeliveryDirectives(i,t.deliveryDirectives,g,y),v||!S){i.requestScheduled=o,this.loadingPlaylist(u,m);return}}else(i.canBlockReload||i.canSkipUntil)&&(m=this.getDeliveryDirectives(i,t.deliveryDirectives,g,y));m&&g!==void 0&&i.canBlockReload&&(i.requestScheduled=s.loading.first+Math.max(p-a*2,p/2)),this.scheduleLoading(u,m,i)}else this.clearTimer()}scheduleLoading(e,t,n){const i=n||e.details;if(!i){this.loadingPlaylist(e,t);return}const s=self.performance.now(),o=i.requestScheduled;if(s>=o){this.loadingPlaylist(e,t);return}const a=o-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),a)}getDeliveryDirectives(e,t,n,i){let s=Bh(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=Go.No),new $h(n,i,s)}checkRetry(e){const t=e.details,n=ga(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===ft.RetryRequest||!i.resolved&&s===ft.SendAlternateToPenaltyBox);if(l){var c;if(o>=a.maxNumRetry)return!1;if(n&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=bd(a,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,i.resolved=!0}return l}}function uv(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Ss(r[t].attrs,e[t].attrs))return!1;return!0}function Ss(r,e,t){const n=r["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function bu(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}class UI extends Pd{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(T.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o?.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||i?.length!==n?.length||n!=null&&n.some(a=>i?.indexOf(a)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(f=>!n||n.indexOf(f.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(f=>f.default)&&(this.selectDefaultTrack=!1),a.forEach((f,h)=>{f.id=h});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const l=this.hls.config.audioPreference;if(!s&&l){const f=vn(l,a,Lr);if(f>-1)s=a[f];else{const h=vn(l,this.tracks);s=this.tracks[h]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n?.join(",")}`),this.hls.trigger(T.AUDIO_TRACKS_UPDATED,u);const d=this.trackId;if(c!==-1&&d===-1)this.setAudioTrack(c);else if(a.length&&d===-1){var o;const f=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(f.message),this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}}onError(e,t){t.fatal||!t.context||t.context.type===be.AUDIO_TRACK&&t.context.
vendor: 7,198 bytes, lines 41-44
41id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Mr(e,i,Lr))return i;const s=vn(e,this.tracksInGroup,Lr);if(s>-1){const o=this.tracksInGroup[s];return this.setAudioTrack(s),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=J_(e,t.levels,n,o,Lr);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=vn(e,n);if(o>-1)return n[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(T.AUDIO_TRACK_SWITCHING,Ie({},i)),s))return;const o=this.switchParams(i.url,n?.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Mr(e,i,Lr)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l}=e;for(let c=0;c<t.length;c++){const u=t[c];if(Mr({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},u,Lr))return c}for(let c=0;c<t.length;c++){const u=t[c];if(Ss(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const u=t[c];if(Ss(e.attrs,u.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ma(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),o=e.details,a=o?.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${s}`),this.hls.trigger(T.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}}class VI{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(s){var n;if(i.onError(s),this.queues===null||this.tracks===null)return;const o=(n=this.tracks[e])==null?void 0:n.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
42${this.list("video")}
43${this.list("audio")}
44${this.list("audiovideo")}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],i=n?.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const _p=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,dv="HlsJsTrackRemovedError";class GI extends Error{constructor(e){super(e),this.name=dv}}class HI extends nn{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:i,mediaSource:s}=this;n&&this.log("Media source opened"),!(!i||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(T.MEDIA_ATTACHED,{media:i,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=d_(hr(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.BUFFER_RESET,this.onBufferReset,this),e.on(T.BUFFER_APPENDING,this.onBufferAppending,this),e.on(T.BUFFER_CODECS,this.onBufferCodecs,this),e.on(T.BUFFER_EOS,this.onBufferEos,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(T.FRAG_PARSED,this.onFragParsed,this),e.on(T.FRAG_CHANGED,this.onFragChanged,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;
vendor: 20,858 bytes, lines 44-46
44e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.BUFFER_RESET,this.onBufferReset,this),e.off(T.BUFFER_APPENDING,this.onBufferAppending,this),e.off(T.BUFFER_CODECS,this.onBufferCodecs,this),e.off(T.BUFFER_EOS,this.onBufferEos,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(T.FRAG_PARSED,this.onFragParsed,this),e.off(T.FRAG_CHANGED,this.onFragChanged,this),e.off(T.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const o=this.isQueued();(s||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?ke(n,i.tracks):this.sourceBuffers.forEach(s=>{const[o]=s;o&&(n[o]=ke({},this.tracks[o]),this.removeBuffer(o)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const i=hr(this.appendSource);if(i){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const o=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(o),s)this._objectUrl=n.src,this.attachTransferred();else{const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,Rp(n),zI(n,a),n.load()}catch{n.src=a}else n.src=a}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const n=this.tracks,i=t.tracks,s=i?Object.keys(i):null,o=s?s.length:0,a=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&s&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
45required tracks: ${Oe(n,(l,c)=>l==="initSegment"?void 0:c)};
46transfer tracks: ${Oe(i,(l,c)=>l==="initSegment"?void 0:c)}}`),!ay(i,n)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,c=this.details,u=Math.max(l,c?.fragments[0].start||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(n)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(T.MEDIA_DETACHING,{}),this.onMediaAttaching(T.MEDIA_ATTACHING,t),e.currentTime=u;return}this.transferData=void 0,s.forEach(l=>{const c=l,u=i[c];if(u){const d=u.buffer;if(d){const f=this.fragmentTracker,h=u.id;if(f.hasFragments(h)||f.hasParts(h)){const g=de.getBuffered(d);f.detectEvictedFragments(c,g,h,null,!0)}const p=gc(c),m=[c,d];this.sourceBuffers[p]=m,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,u)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:s,_objectUrl:o}=this;if(s){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([a])=>{a&&this.removeBuffer(a)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const a=s.readyState==="open";try{const l=s.sourceBuffers;for(let c=l.length;c--;)a&&l[c].abort(),s.removeSourceBuffer(l[c]);a&&s.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(i.removeAttribute("src"),this.appendSource&&Rp(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(T.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[gc(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new VI(this.tracks)}onBufferCodecs(e,t){var n;const i=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const o="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),a=!o&&this.sourceBufferCount&&this.media&&s.some(l=>!i[l]);if(o||a){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${s}" SourceBuffers`);return}s.forEach(l=>{var c,u;const d=t[l],{id:f,codec:h,levelCodec:p,container:m,metadata:g,supplemental:y}=d;let v=i[l];const E=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[l],b=E!=null&&E.buffer?E:v,_=b?.pendingCodec||b?.codec,I=b?.levelCodec;v||(v=i[l]={buffer:void 0,listeners:[],codec:h,supplemental:y,container:m,levelCodec:p,metadata:g,id:f});const S=Vo(_,I),A=S?.replace(_p,"$1");let R=Vo(h,p);const L=(u=R)==null?void 0:u.replace(_p,"$1");R&&S&&A!==L&&(l.slice(0,5)==="audio"&&(R=ha(R,this.appendSource)),this.log(`switching codec ${_} to ${R}`),R!==(v.pendingCodec||v.codec)&&(v.pendingCodec=R),v.container=m,this.appendChangeType(l,m,R))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((n=t.audio)==null?void 0:n.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const i=`${t};codecs=${n}`,s={label:`change-type=${i}`,execute:()=>{const o=this.tracks[e];if(o){const a=o.buffer;a!=null&&a.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),a.changeType(i),o.codec=n,o.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,i=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,ee.MAIN))==null?void 0:t.gap)===!0)return;const o={label:"block-audio",execute:()=>{var a;const l=this.tracks.video;(this.lastVideoAppendEnd>i||l!=null&&l.buffer&&de.isBuffered(l.buffer,i)||((a=this.fragmentTracker.getAppendedFrag(i,ee.MAIN))==null?void 0:a.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn("Error executing block-audio operation",a)}};this.blockedAudioAppend={op:o,frag:e},this.append(o,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:i,type:s,parent:o,frag:a,part:l,chunkMeta:c,offset:u}=t,d=c.buffering[s],{sn:f,cc:h}=a,p=self.performance.now();d.start=p;const m=a.stats.buffering,g=l?l.stats.buffering:null;m.start===0&&(m.start=p),g&&g.start===0&&(g.start=p);const y=n.audio;let v=!1;s==="audio"&&y?.container==="audio/mpeg"&&(v=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const E=n.video,b=E?.buffer;if(b&&f!=="initSegment"){const S=l||a,A=this.blockedAudioAppend;if(s==="audio"&&o!=="main"&&!this.blockedAudioAppend&&!(E.ending||E.ended)){const L=S.start+S.duration*.05,C=b.buffered,O=this.currentOp("video");!C.length&&!O?this.blockAudio(S):!O&&!de.isBuffered(b,L)&&this.lastVideoAppendEnd<L&&this.blockAudio(S)}else if(s==="video"){const R=S.end;if(A){const L=A.frag.start;(R>L||R<this.lastVideoAppendEnd||de.isBuffered(b,L))&&this.unblockAudio()}this.lastVideoAppendEnd=R}}const _=(l||a).start,I={label:`append-${s}`,execute:()=>{var S;d.executeStart=self.performance.now();const A=(S=this.tracks[s])==null?void 0:S.buffer;A&&(v?this.updateTimestampOffset(A,_,.1,s,f,h):u!==void 0&&Q(u)&&this.updateTimestampOffset(A,u,1e-6,s,f,h)),this.appendExecutor(i,s)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();d.executeEnd=d.end=S,m.first===0&&(m.first=S),g&&g.first===0&&(g.first=S);const A={};this.sourceBuffers.forEach(([R,L])=>{R&&(A[R]=de.getBuffered(L))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(T.BUFFER_APPENDED,{type:s,frag:a,part:l,chunkMeta:c,parent:a.type,timeRanges:A})},onError:S=>{var A;const R={type:se.MEDIA_ERROR,parent:a.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:a,part:l,chunkMeta:c,error:S,err:S,fatal:!1},L=(A=this.media)==null?void 0:A.error;if(S.code===DOMException.QUOTA_EXCEEDED_ERR||S.name=="QuotaExceededError"||"quota"in S)R.details=$.BUFFER_FULL_ERROR;else if(S.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!L)R.errorAction=vi(!0);else if(S.name===dv&&this.sourceBufferCount===0)R.errorAction=vi(!0);else{const C=++this.appendErrors[s];this.warn(`Failed ${C}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${L||"no media error"})`),(C>=this.hls.config.appendErrorMaxRetry||L)&&(R.fatal=!0)}this.hls.trigger(T.ERROR,R)}};this.log(`queuing "${s}" append sn: ${f}${l?" p: "+l.index:""} of ${a.type===ee.MAIN?"level":"track"} ${a.level} cc: ${h}`),this.append(I,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(T.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:n,startOffset:i,endOffset:s}=t;n?this.append(this.getFlushOp(n,i,s),n):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,i,s),o)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],o=i?i.elementaryStreams:n.elementaryStreams;o[Pe.AUDIOVIDEO]?s.push("audiovideo"):(o[Pe.AUDIO]&&s.push("audio"),o[Pe.VIDEO]&&s.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:n.stats;this.hls.trigger(T.FRAG_BUFFERED,{frag:n,part:i,stats:c,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,s).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var n;this.sourceBuffers.forEach(([o])=>{if(o){const a=this.tracks[o];(!t.type||t.type===o)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${o} buffer reached EOS`)))}});const i=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var a;return o&&!((a=this.tracks[o])!=null&&a.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if(!o||o.readyState!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(T.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(T.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===$.BUFFER_APPEND_ERROR&&t.frag){var n;const i=(n=t.errorAction)==null?void 0:n.nextAutoLevel;Q(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const i=e.config,s=n.currentTime,o=t.levelTargetDuration,a=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(Q(a)&&a>=0){const c=Math.max(a,o),u=Math.floor(s/o)*o-c;this.flushBackBuffer(s,o,u)}const l=i.frontBufferFlushThreshold;if(Q(l)&&l>0){const c=Math.max(i.maxBufferLength,l),u=Math.max(c,o),d=Math.floor(s/o)*o+u;this.flushFrontBuffer(s,o,d)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const a=de.getBuffered(s);if(a.length>0&&n>a.start(0)){var o;this.hls.trigger(T.BACK_BUFFER_REACHED,{bufferEnd:n});const l=this.tracks[i];if((o=this.details)!=null&&o.live)this.hls.trigger(T.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l!=null&&l.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(T.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:i})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const o=de.getBuffered(s),a=o.length;if(a<2)return;const l=o.start(a-1),c=o.end(a-1);if(n>l||e>=l&&e<=c)return;this.hls.trigger(T.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||n?.readyState!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart),u=Math.max(c,i);return{duration:1/0,start:c,end:u}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return Q(s)?{duration:s}:null;const o=this.media.duration,a=Q(n.duration)?n.duration:0;return i>a&&i>o||!Q(o)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:n}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(Q(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${n}.`),i.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Oe(n)}`),this.tracksReady){var i;const s=(i=this.transferData)==null?void 0:i.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const i=this.tracks[t];e[t]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(T.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const o=s,a=e[o];if(this.isPending(a)){const l=this.getTrackCodec(a,o),c=`${a.container};codecs=${l}`;a.codec=l,this.log(`creating sourceBuffer(${c})${this.currentOp(o)?" Queued":""} ${Oe(a)}`);try{const u=n.addSourceBuffer(c),d=gc(o),f=[o,u];t[d]=f,a.buffer=u}catch(u){var i;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[o],this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:c,parent:a.id});return}this.trackSourceBuffer(o,a)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let i=e.codec;n&&(t==="video"||t==="audiovideo")&&gs(n,"video")&&(i=P_(i,n));const s=Vo(i,e.levelCodec);return s?t.slice(0,5)==="audio"?ha(s,this.appendSource):s:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,o)=>{const a=o.removedRanges;a!=null&&a.length&&this.hls.trigger(T.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.currentOp(e);s&&s.onError(i)}updateTimestampOffset(e,t,n,i,s,o){const a=t-e.timestampOffset;Math.abs(a)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${o})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:i,mediaSource:s}=this,o=this.tracks[e],a=o?.buffer;if(!i||!s||!a){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=Q(i.duration)?i.duration:1/0,c=Q(s.duration)?s.duration:1/0,u=Math.max(0,t),d=Math.min(n,l,c);d>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${d}] from the ${e} SourceBuffer`),a.remove(u,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],i=n?.buffer;if(!i)throw new GI(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}
46`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,i=t.map(o=>this.appendBlocker(o));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(o=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const i=(n=this.tracks[t])==null?void 0:n.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){const i=this.tracks[e];if(!i)return;const s=i.buffer;if(!s)return;const o=n.bind(this,e);i.listeners.push({event:t,listener:o}),s.addEventListener(t,o)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(i=>{n.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}}function Rp(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function zI(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}function gc(r){return r==="audio"?1:0}class Od{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(T.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(T.MEDIA_ATTA
vendor: 3,501 bytes, line 46
46CHING,this.onMediaAttaching,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.BUFFER_CODECS,this.onBufferCodecs,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(T.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.BUFFER_CODECS,this.onBufferCodecs,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Q(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,Od.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let s=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){s=a;break}}return s}}const KI={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",
vendor: 4,253 bytes, line 46
46KEY:"k",OTHER:"o"},Ot=KI,jI={HLS:"h"},WI=jI;class Sn{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof Sn?n:new Sn(n))),this.value=e,this.params=t}}const YI="Dict";function qI(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function XI(r,e,t,n){return new Error(`failed to ${r} "${qI(e)}" as ${t}`,{cause:n})}function An(r,e,t){return XI("serialize",r,e,t)}class fv{constructor(e){this.description=e}}const Ip="Bare Item",QI="Boolean";function JI(r){if(typeof r!="boolean")throw An(r,QI);return r?"?1":"?0"}function ZI(r){return btoa(String.fromCharCode(...r))}const eL="Byte Sequence";function tL(r){if(ArrayBuffer.isView(r)===!1)throw An(r,eL);return`:${ZI(r)}:`}const nL="Integer";function rL(r){return r<-999999999999999||999999999999999<r}function hv(r){if(rL(r))throw An(r,nL);return r.toString()}function iL(r){return`@${hv(r.getTime()/1e3)}`}function pv(r,e){if(r<0)return-pv(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}const sL="Decimal";function oL(r){const e=pv(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw An(r,sL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const aL="String",lL=/[\x00-\x1f\x7f]+/;function cL(r){if(lL.test(r))throw An(r,aL);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function uL(r){return r.description||r.toString().slice(7,-1)}const dL="Token";function Lp(r){const e=uL(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw An(e,dL);return e}function Tu(r){switch(typeof r){case"number":if(!Q(r))throw An(r,Ip);return Number.isInteger(r)?hv(r):oL(r);case"string":return cL(r);case"symbol":return Lp(r);case"boolean":return JI(r);case"object":if(r instanceof Date)return iL(r);if(r instanceof Uint8Array)return tL(r);if(r instanceof fv)return Lp(r);default:throw An(r,Ip)}}const fL="Key";function Su(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw An(r,fL);return r}function Md(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${Su(e)}`:`;${Su(e)}=${Tu(t)}`).join("")}function mv(r){return r instanceof Sn?`${Tu(r.value)}${Md(r.params)}`:Tu(r)}function hL(r){return`(${r.value.map(mv).join(" ")})${Md(r.params)}`}function pL(r,e={whitespace:!0}){if(typeof r!="object"||r==null)throw An(r,YI);const t=r instanceof Map?r.entries():Object.entries(r),n=e?.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof Sn||(s=new Sn(s));let o=Su(i);return s.value===!0?o+=Md(s.params):(o+="=",Array.isArray(s.value)?o+=hL(s):o+=mv(s)),o}).join(`,${n}`)}function gv(r,e){return pL(r,e)}const dn="CMCD-Object",ze="CMCD-Request",Ar="CMCD-Session",qn="CMCD-Status",mL={br:dn,ab:dn,d:dn,ot:dn,tb:dn,tpb:dn,lb:dn,tab:dn,lab:dn,url:dn,pb:ze,bl:ze,tbl:ze,dl:ze,ltc:ze,mtp:ze,nor:ze,nrr:ze,rc:ze,sn:ze,sta:ze,su:ze,ttfb:ze,ttfbb:ze,ttlb:ze,cmsdd:ze,cmsds:ze,smrt:ze,df:ze,cs:ze,ts:ze,cid:Ar,pr:Ar,sf:Ar,sid:Ar,st:Ar,v:Ar,msd:Ar,bs:qn,bsd:qn,cdn:qn,rtp:qn,bg:qn,pt:qn,ec:qn,e:qn},gL={REQUEST:ze};function yL(r){return Object.keys(r).reduce((e,t)=>{var n;return(n=r[t])===null||n===void 0||n.forEach(i=>e[i]=t),e},{})}function vL(r,e){const t={};if(!r)return t;const n=Object.keys(r),i=e?yL(e):{};return n.reduce((s,o)=>{var a;const l=mL[o]||i[o]||gL.REQUEST,c=(a=s[l])!==null&&a!==void 0?a:s[l]={};return c[o]=r[o],s},t)}function EL(r){return["ot","sf","st","e","sta"].includes(r)}function bL(r){return typeof r=="number"?Q(r):r!=null&&r!==""&&r!==!1}const yv="event";function TL(r,e){const t=new URL(r),n=new URL(e);if(t.origin!==n.origin)return r;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}const jo=r=>Math.round(r),Au=(r,e)=>Array.isArray(r)?r.map(t=>Au(t,e)):r instanceof Sn&&typeof r.value=="string"?new Sn(Au(r.value,e),r.params):(e.baseUrl&&(r=TL(r,e.baseUrl)),e.version===1?encodeURIComponent(r):r),vo=r=>jo(r/100)*100,SL=(r,e)=>{let t=r;return e.version>=2&&(r instanceof Sn&&typeof r.value=="string"?t=new Sn([r]):typeof r=="string"&&(t=[r])),Au(t,e)},AL={br:jo,d:jo,bl:vo,dl:vo,mtp:vo,nor:SL,rtp:vo,tb:jo}
46,vv="request",Ev="response",Nd=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],_L=["e"],RL=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Il(r){return RL.test(r)}function IL(r){return Nd.includes(r)||_L.includes(r)||Il(r)}const bv=["d","dl","nor","ot","rtp","su"];function LL(r){return Nd.includes(r)||bv.includes(r)||Il(r)}const wL=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function xL(r){return Nd.includes(r)||bv.includes(r)||wL.includes(r)||Il(r)}const kL=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function CL(r){return kL.includes(r)||Il(r)}const DL={[Ev]:xL,[yv]:IL,[vv]:LL};function Tv(r,e={}){const t={};if(r==null||typeof r!="object")return t;const n=e.version||r.v||1,i=e.reportingMode||vv,s=n===1?CL:DL[i];let o=Object.keys(r).filter(s);const a=e.filter;typeof a=="function"&&(o=o.filter(a));const l=i===Ev||i===yv;l&&!o.includes("ts")&&o.push("ts"),n>1&&!o.includes("v")&&o.push("v");const c=ke({},AL,e.formatters),u={version:n,reportingMode:i,baseUrl:e.baseUrl};return o.sort().forEach(d=>{let f=r[d];const h=c[d];if(typeof h=="function"&&(f=h(f,u)),d==="v"){if(n===1)return;f=n}d=="pr"&&f===1||(l&&d==="ts"&&!Q(f)&&(f=Date.now()),bL(f)&&(EL(d)&&typeof f=="string"&&(f=new fv(f)),t[d]=f))}),t}function PL(r,e={}){const t={};if(!r)return t;const n=Tv(r,e),i=vL(n,e?.customHeaderMap);return Object.entries(i).reduce((s,[o,a])=>{const l=gv(a,{whitespace:!1});return l&&(s[o]=l),s},t)}function OL(r,e,t){return ke(r,PL(e,t))}const ML="CMCD";function NL(r,e={}){return r?gv(Tv(r,e),{whitespace:!1}):""}function FL(r,e={}){if(!r)return"";const t=NL(r,e);return encodeURIComponent(t)}function BL(r,e={}){if(!r)return"";const t=FL(r,e);return`${ML}=${t}`}const wp=/CMCD=[^&#]+/;function $L(r,e,t){const n=BL(e,t);if(!n)return r;if(wp.test(r))return r.replace(wp,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class UL{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Ot.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const{frag:s,part:o}=i,a=this.hls.levels[s.level],l=this.getObjectType(s),c={d:(o||s).duration*1e3,ot:l};(l===Ot.VIDEO||l===Ot.AUDIO||l==Ot.MUXED)&&(c.br=a.bitrate/1e3,c.tb=this.getTopBandwidth(l)/1e3,c.bl=this.getBufferLength(l));const u=o?this.getNextPart(o):this.getNextFrag(s);u!=null&&u.url&&u.url!==s.url&&(c.nor=u.url),this.apply(i,c)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;
46e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHED,this.onMediaDetached,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHED,this.onMediaDetached,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:WI.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){ke(t,this.createData());const n=t.ot===Ot.INIT||t.ot===Ot.VIDEO||t.ot===Ot.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,a)=>(i.includes(a)&&(o[a]=t[a]),o),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),OL(e.headers,t,s)):e.url=$L(e.url,t,s)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const i=e.sn-n.startSN;return n.fragments[i+1]}}getNextPart(e){var t;const{index:n,fragment:i}=e,s=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:o}=i;for(let a=s.length-1;a>=0;a--){const l=s[a];if(l.index===n&&l.fragment.sn===o)return s[a+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Ot.TIMED_TEXT;if(e.sn==="initSegment")return Ot.INIT;if(t==="audio")return Ot.AUDIO;if(t==="main")return this.hls.audioTracks.length?Ot.VIDEO:Ot.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Ot.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,o=s>-1?s+1:i.levels.length;n=i.levels.slice(0,o)}return n.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===Ot.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:de.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}}const VL=3e5;class GL extends nn{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}
vendor: 5,355 bytes, line 46
46startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(n=>n!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if(n?.action===ft.SendAlternateToPenaltyBox&&n.flags===Vt.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this._pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:c}=t.context;a&&i?o=this.getPathwayForGroupId(a,c,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!s&&i&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==o),t.details===$.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${Oe(s)} penalized: ${Oe(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>VL&&delete n[s]});for(let s=0;s<e.length;s++){const o=e[s];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,Vy(t),this.hls.trigger(T.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[a];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===be.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===be.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=s;if(t.some(u=>u.pathwayId===o))return;const c=this.getLevelsForPathway(a).map(u=>{const d=new Ve(u.attrs);d["PATHWAY-ID"]=o;const f=d.AUDIO&&`${d.AUDIO}_clone_${o}`,h=d.SUBTITLES&&`${d.SUBTITLES}_clone_${o}`;f&&(n[d.AUDIO]=f,d.AUDIO=f),h&&(i[d.SUBTITLES]=h,d.SUBTITLES=h);const p=Sv(u.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new vs({attrs:d,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:p,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g<u.audioGroups.length;g++)m.addGroupId("audio",`${u.audioGroups[g]}_clone_${o}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)m.addGroupId("text",`${u.subtitleGroups[g]}_clone_${o}`);return m});t.push(...c),xp(this.audioTracks,n,l,o),xp(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+u)}const s={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},c={onSuccess:(u,d,f,h)=>{this.log(`Loaded steering manifest: "${i}"`);const p=u.data;if(p?.VERSION!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":y}=p;if(m)try{this.uri=new self.URL(m,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||f.url),g&&this.clonePathways(g);const v={steeringManifest:p,url:i.toString()};this.hls.trigger(T.STEERING_MANIFEST_LOADED,v),y&&this.updatePathwayPriority(y)},onError:(u,d,f,h)=>
46{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${d.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let p=this.timeToLoad*1e3;if(u.code===429){const m=this.loader;if(typeof m?.getResponseHeader=="function"){const g=m.getResponseHeader("Retry-After");g&&(p=parseFloat(g)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,p)},onTimeout:(u,d,f)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function xp(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=ke({},o);return a.details=void 0,a.attrs=new Ve(a.attrs),a.url=a.attrs.URI=Sv(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});r.push(...s)})}function Sv(r,e,t,n){const{HOST:i,PARAMS:s,[t]:o}=n;let a;e&&(a=o?.[e],a&&(r=a));const l=new self.URL(r);return i&&!a&&(l.host=i),s&&Object.keys(s).sort().forEach(c=>{c&&l.searchParams.set(c,s[c])}),l.href}class bi extends nn{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=bi.CDMCleanupPromise?[bi.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:n,initData:i}=t,s=`"${t.type}" event: init data type: "${n}"`;if(this.debug(s),i!==null){if(!this.keyFormatPromise){let o=Object.keys(this.keySystemAccessPromises);o.length||(o=ji(this.config));const a=o.map(lc).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(a)}this.keyFormatPromise.then(o=>{const a=Ho(o);if(n!=="sinf"||a!==Ge.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${n}" for selected key-system ${a}`);return}let l;try{const h=tt(new Uint8Array(i)),p=_d(JSON.parse(h).sinf),m=gy(p);if(!m)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(m.subarray(8,24))}catch(h){this.warn(`${s} Failed to parse sinf: ${h}`);return}const c=ht(l),{keyIdToKeySessionPromise:u,mediaKeySessions:d}=this;let f=u[c];for(let h=0;h<d.length;h++){const p=d[h],m=p.decryptdata;if(!m.keyId)continue;const g=ht(m.keyId);if(va(l,m.keyId)||m.uri.replace(/-/g,"").indexOf(c)!==-1){if(f=u[g],!f)continue;if(m.pssh)break;delete u[g],m.pssh=new Uint8Array(i),m.keyId=l,f=u[c]=f.then(()=>this.generateRequestWithPreferredKeySession(p,n,i,"encrypted-event-key-match")),f.catch(y=>this.handleError(y));break}}f||this.handleError(new Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(o=>this.handleError(o))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
46registerListeners(){this.hls.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(T.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(T.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(T.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(T.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t?.[e];if(i)return i.licenseUrl;if(e===Ge.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t?.[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),s=t.map(o=>o.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((o,a)=>{const l=c=>{const u=c.shift();this.getMediaKeysPromise(u,i,s).then(d=>o({keySystem:u,mediaKeys:d})).catch(d=>{c.length?l(c):d instanceof Bt?a(d):a(new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return Py===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){var i;const s=SR(e,t,n,this.config.drmSystemOptions||{});let o=this.keySystemAccessPromises[e],a=(i=o)==null?void 0:i.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Oe(s)}`),a=this.requestMediaKeySystemAccess(e,s);const l=o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),a.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=l.mediaKeys=c.createMediaKeys().then(f=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(h=>h?this.setMediaKeysServerCertificate(f,e,h):f)));return d.catch(f=>{this.error(`Failed to create media-keys for "${e}"}: ${f}`)}),d})}return a.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${ht(e.keyId||[])} keyUri: ${e.uri}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=Eo(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${ht(e.decryptdata.keyId||[])}
47      } (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>lc(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const s=lc(i);s?t(s):n(new Error(`Unable to find format for key-system "${i}"`))}).catch(n)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=ji(this.config),n=e.map(Ho).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){const i=HL(e,t[n]);if(i)return i}}loadKey(e){const t=e.keyInfo.decryptdata,n=Eo(t),i=this.bannedKeyIds[n];if(i||this.getKeyStatus(t)==="internal-error"){const a=kp(i||"internal-error",t);return this.handleError(a,e.frag),Promise.reject(a)}const s=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const o=this.keyIdToKeySessionPromise[n];if(!o){const a=this.getKeySystemForKeyPromise(t).then(({keySystem:l,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(l,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:t}))))).then(l=>{const c="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,c,u,"playlist-key")});return a.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[n]=a,a}return o.catch(a=>{if(a instanceof Bt){const l=Ie({},a.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const c=new Bt(l,a.message);this.handleError(c,e.frag)}}),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Bt){t&&(e.data.frag=t);const n=e.data.decryptdata;this.error(`${e.message}${n?` (${ht(n.keyId||[])})`:""}`),this.hls.trigger(T.ERROR,e.data)}else this.error(e.message),this.hls.trigger(T.ERROR,{type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
vendor: 13,087 bytes, line 47
47getKeySystemForKeyPromise(e){const t=Eo(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=Ho(e.keyFormat),s=i?[i]:ji(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ji(this.config)),e.length===0)throw new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Oe({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>this.media?this.media.setMediaKeys(t):new Promise((s,o)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return o(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(s).catch(o)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s;const o=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(o)try{const p=o.call(this.hls,t,n,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");t=p.initDataType,n=p.initData?p.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(p){if(this.warn(p.message),this.hls&&this.hls.config.debug)throw p}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const a=Eo(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${a} URI: ${l} (init data type: ${t} length: ${n.byteLength})`);const c=new Id,u=e._onmessage=p=>{const m=e.mediaKeysSession;if(!m){c.emit("error",new Error("invalid state"));return}const{messageType:g,message:y}=p;this.log(`"${g}" message event for session "${m.sessionId}" message size: ${y.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,y).catch(v=>{c.eventNames().length?c.emit("error",v):this.handleError(v)}):g==="license-release"?e.keySystem===Ge.FAIRPLAY&&this.updateKeySession(e,mu("acknowledged")).then(()=>this.removeSession(e)).catch(v=>this.handleError(v)):this.warn(`unhandled media key message type "${g}"`)},d=(p,m)=>{m.keyStatus=p;let g;p.startsWith("usable")?c.emit("resolved"):p==="internal-error"||p==="output-restricted"||p==="output-downscaled"?g=kp(p,m.decryptdata):p==="expired"?g=new Error(`key expired (keyId: ${a})`):p==="released"?g=new Error("key released"):p==="status-pending"||this.warn(`unhandled key status change "${p}" (keyId: ${a})`),g&&(c.eventNames().length?c.emit("error",g):this.handleError(g))},f=e._onkeystatuseschange=p=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const g=this.getKeyStatuses(e);if(!Object.keys(g).some(b=>g[b]!=="status-pending"))return;if(g[a]==="expired"){this.log(`Expired key ${Oe(g)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let v=g[a];if(v)d(v,e);else{var E;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(E=e.keyStatusTimeouts)[a]||(E[a]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const _=this.getKeyStatus(e.decryptdata);if(_&&_!=="status-pending")return this.log(`No status for keyId ${a} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${_} from other session.`),d(_,e);this.log(`key status for ${a} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),v="internal-error",d(v,e)},1e3)),this.log(`No status for keyId ${a} (${Oe(g)}).`)}};Lt(e.mediaKeysSession,"message",u),Lt(e.mediaKeysSession,"keystatuseschange",f);const h=new Promise((p,m)=>{c.on("error",m),c.on("resolved",p)});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${a} URI: ${l}`)}).catch(p=>{throw new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:p,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>h).catch(p=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw p}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((n,i)=>{if(typeof i=="string"&&typeof n=="object"){const a=i;i=n,n=a}const s="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===Ge.PLAYREADY&&s.length===16){const a=ht(s);t[a]=n,Cy(s)}const o=ht(s);n==="internal-error"&&(this.bannedKeyIds[o]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${o} key-session "${e.mediaKeysSession.sessionId}"`),t[o]=n}),t}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:s},c=t.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,m)=>{o(f.data)},onError:(f,h,p,m)=>{a(new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:Ie({url:l.url,data:void 0},f)},`"${e}" certificate request failed (${s}). Status: ${f.code} (${f.text})`))},onTimeout:(f,h,p)=>{a(new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(f,h,p)=>{a(new Error("aborted"))}};i.load(l,u,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),i(e)}).catch(o=>{s(new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let u;for(let d=0,f=s.length;d<f;d++){var o,a;u=s[d];const h=(o=u.querySelector("name"))==null?void 0:o.textContent,p=(a=u.querySelector("value"))==null?void 0:a.textContent;h&&p&&e.setRequestHeader(h,p)}}const l=i.querySelector("Challenge"),c=l?.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return mu(atob(c))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{const o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,a,o,e)}catch(u){this.error(u)}i(l)}else{const l=n.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||a.status>=400&&a.status<500)s(new Bt({type:se.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const u=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==Ge.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,Lt(n,"encrypted",this.onMediaEncrypted),Lt(n,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=n.mediaKeys}onMediaDetached(){const e=this.media;e&&(Ft(e,"encrypted",this.onMediaEncrypted),Ft(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,lr.clearKeyUriToKeyIdMap();const s=i.length;bi.CDMCleanupPromise=Promise.all(i.map(o=>this.removeSession(o)).concat((n==null||(e=n.setMediaKeys(null))==null?void 0:e.catch(o=>{this.log(`Could not clear media keys: ${o}`),this.hls&&this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${o}`)})}))||Promise.resolve())).catch(o=>{this.log(`Could not close sessions and clear media keys: ${o}`),this.hls&&this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${o}`)})}).then(()=>{s&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${ht(i?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{keyStatusTimeouts:o}=e;o&&Object.keys(o).forEach(c=>self.clearTimeout(o[c]));const{drmSystemOptions:a}=this.config;return(_R(a)?new Promise((c,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(u)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}return Promise.resolve()}}bi.CDMCleanupPromise=void 0;function Eo(r){if(!r)throw new Error("Could not read keyId of undefined decryptdata");if(r.keyId===null)throw new Error("keyId is null");return ht(r.keyId)}function HL(r,e){if(r.keyId&&e.mediaKeysSession.keyStatuses.has(r.keyId))return e.mediaKeysSession.keyStatuses.get(r.keyId);if(r.matches(e.decryptdata))return e.keyStatus}class Bt extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function kp(r,e){const t=r==="output-restricted",n=t?$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Bt({type:se.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${r}"`)}class zL{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}
vendor: 6,129 bytes, line 47
47registerListeners(){this.hls.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(T.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(T.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/s,c=this.hls;if(c.trigger(T.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>c.config.fpsDroppedMonitoringThreshold*a){let u=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=u)&&(u=u-1,c.trigger(T.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function Av(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function _v(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){Le.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){Le.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function hi(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues)for(let n=r.cues.length;n--;)e&&r.cues[n].removeEventListener("enter",e),r.removeCue(r.cues[n]);t==="disabled"&&(r.mode=t)}function _u(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=jL(r.cues,e,t);for(let o=0;o<s.length;o++)(!n||n(s[o]))&&r.removeCue(s[o])}i==="disabled"&&(r.mode=i)}function KL(r,e){if(e<=r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let n=0,i=t,s;for(;n<=i;)if(s=Math.floor((i+n)/2),e<r[s].startTime)i=s-1;else if(e>r[s].startTime&&n<t)n=s+1;else return s;return r[n].startTime-e<e-r[i].startTime?n:i}function jL(r,e,t){const n=[],i=KL(r,e);if(i>-1)for(let s=i,o=r.length;s<o;s++){const a=r[s];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function Wo(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(r[t])}return e}class WL extends Pd{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const n=Wo(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(T.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const n=this.media;if(!n)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;
vendor: 9,284 bytes, line 47
47Wo(n.textTracks).forEach(o=>{hi(o)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o?.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||i?.length!==n?.length||n!=null&&n.some(o=>i?.indexOf(o)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!n||n.indexOf(u.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),o.forEach((u,d)=>{u.id=d});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!s&&a){this.selectDefaultTrack=!1;const u=vn(a,o);if(u>-1)s=o[u];else{const d=vn(a,this.tracks);s=this.tracks[d]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const c={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n?.join(",")}" group-id`),this.hls.trigger(T.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||Mr(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Ss(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Ss(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(bu(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===be.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&&Mr(e,n))return n;const i=vn(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=vn(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),o=e.details,a=o?.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${s}`),this.hls.trigger(T.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Wo(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>bu(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Q(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(T.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:c,url:u}=i;this.hls.trigger(T.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:c,url:u});const d=this.switchParams(i.url,n?.details,i.details);this.loadPlaylist(d)}}function YL(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}function es(r){let e=5381,t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return(e>>>0).toString()}const Ti=.025;let Sa=(function(r){return r[r.Point=0]="Point",r[r.Range=1]="Range",r})({});function qL(r,e,t){return`${r.identifier}-${t+1}-${es(e)}`}class XL{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return yc(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,n=yc(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=Q(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return yc(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Ti))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Sa.Range:Sa.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return QL(this)}}function yc(r,e){return r-e.start<e.duration/2&&!(Math.abs(r-(e.start+e.duration))<Ti)?e.start:e.start+e.duration}function Rv(r,e,t){const n=new self.URL(r,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function vc(r,e){for(;(t=r.assetList[++e])!=null&&t.error;)var t;return e}function QL(r){return`["${r.identifier}" ${r.cue.pre?"<pre>":r.cue.post?"<post>":""}${r.timelineStart.toFixed(2)}-${r.resumeTime.toFixed(2)}]`}function ci(r){const e=r.timelineStart,t=r.duration||0;return`["${r.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class JL{constructor(e,t,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetail
vendor: 4,234 bytes, line 47
47s=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(T.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=n,this.assetItem=i;const o=()=>{this.hasDetails=!0};s.once(T.LEVEL_LOADED,o),s.once(T.AUDIO_TRACK_LOADED,o),s.once(T.SUBTITLE_TRACK_LOADED,o),s.on(T.MEDIA_ATTACHING,(a,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(T.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,s.trigger(T.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Rv(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,s=de.bufferInfo(e,i,0);return this.getAssetTime(s.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=de.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,n){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,n){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${ci(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Cp=.033;class ZL extends nn{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 11,667 bytes, lines 47-48
47,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,n+1):n,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(s=i[n])!=null&&s.event;){var s;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let i=0;i<n.length;i++){let s=n[i];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return i}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let i=e;i<=t&&n[i];i++){const s=n[i].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var n;if(((n=t[i].event)==null?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,t){const n=e.assetList,i=n.length;if(i>1)for(let s=0;s<i;s++){const o=n[s];if(!o.error){const a=o.timelineStart;if(t===a||t>a&&(t<a+(o.duration||0)||s===i-1))return s}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const n=t.assetList,i=n[n.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:i}=n,s=this.events,o=this.parseDateRanges(i,{url:n.url},t),a=Object.keys(i),l=s?s.filter(c=>!a.includes(c.identifier)):[];o.length&&o.sort((c,u)=>{const d=c.cue.pre,f=c.cue.post,h=u.cue.pre,p=u.cue.post;if(d&&!h)return-1;if(h&&!d||f&&!p)return 1;if(p&&!f)return-1;if(!d&&!h&&!f&&!p){const m=c.startTime,g=u.startTime;if(m!==g)return m-g}return c.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=o,l.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,l)}updateSchedule(e,t=[],n=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const s=this.items,o=this.parseSchedule(i,e);(n||t.length||s?.length!==o.length||o.some((l,c)=>Math.abs(l.playout.start-s[c].playout.start)>.005||Math.abs(l.playout.end-s[c].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(t,s))}}parseDateRanges(e,t,n){const i=[],s=Object.keys(e);for(let o=0;o<s.length;o++){const a=s[o],l=e[a];if(l.isInterstitial){let c=this.eventMap[a];c?c.setDateRange(l):(c=new XL(l,t),this.eventMap[a]=c,n===!1&&(c.appendInPlace=n)),i.push(c)}}return i}parseSchedule(e,t){const n=[],i=t.main.details,s=i.live?1/0:i.edge;let o=0;if(e=e.filter(l=>!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,c=0;if(e.forEach((u,d)=>{const f=u.cue.pre,h=u.cue.post,p=e[d-1]||null,m=u.appendInPlace,g=h?s:u.startOffset,y=u.duration,v=u.timelineOccupancy===Sa.Range?y:0,E=u.resumptionOffset,b=p?.startTime===g,_=g+u.cumulativeDuration;let I=m?_+y:g+E;if(f||!h&&g<=0){const A=c;c+=v,u.timelineStart=_;const R=o;o+=y,n.push({event:u,start:_,end:I,playout:{start:R,end:o},integrated:{start:A,end:c}})}else if(g<=s){if(!b){const L=g-l;if(L>Cp){const C=l,O=c;c+=L;const D=o;o+=L;const P={previousEvent:e[d-1]||null,nextEvent:u,start:C,end:C+L,playout:{start:D,end:o},integrated:{start:O,end:c}};n.push(P)}else L>0&&p&&(p.cumulativeDuration+=L,n[n.length-1].end=g)}h&&(I=_),u.timelineStart=_;const A=c;c+=v;const R=o;o+=y,n.push({event:u,start:_,end:I,playout:{start:R,end:o},integrated:{start:A,end:c}})}else return;const S=u.resumeTime;h||S>s?l=s:l=S}),l<s){var a;const u=l,d=c,f=s-l;c+=f;const h=o;o+=f,n.push({previousEvent:((a=n[n.length-1])==null?void 0:a.event)||null,nextEvent:null,start:l,end:u+f,playout:{start:h,end:o},integrated:{start:d,end:c}})}this.setDurations(s,o,c)}else n.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,i=n.live?1/0:n.edge;let s=0,o=-1;e.forEach((a,l)=>{const c=a.cue.pre,u=a.cue.post,d=c?0:u?i:a.startTime;this.updateAssetDurations(a),o===d?a.cumulativeDuration=s:(s=0,o=d),!u&&a.snapOptions.in&&(a.resumeAnchor=Kr(null,n.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)),!a.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<Cp&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`));const h=Q(a.resumeOffset)?a.resumeOffset:a.duration;s+=h})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(n-i)>Ti?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(o=>{const a=t[o].details,l=a.edge;if(n>=l)return this.log(`"${e.identifier}" resumption ${n} past ${o} playlist end ${l}`),!1;const c=Kr(null,a.fragments,n);if(!c)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${o} playlist (${a.fragStart}-${a.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(c.start-n)<Ti+u||Math.abs(c.end-n)<Ti+u?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${o} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,i=!1,s=!1;for(let o=0;o<e.assetList.length;o++){const a=e.assetList[o],l=t+n;a.startOffset=n,a.timelineStart=l,i||(i=a.duration===null),s||(s=!!a.error);const c=a.error?0:a.duration||0;n+=c}i&&!s?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function rn(r){return`[${r.event?'"'+r.event.identifier+'"':"primary"}: ${r.start.toFixed(2)}-${r.end.toFixed(2)}]`}class ew{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let i;try{i=Rv(n,this.hls.sessionId,e.baseUrl)}catch(f){const h=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,f,n);this.hls.trigger(T.ERROR,h);return}t&&i.protocol!=="data:"&&i.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,o=s.loader,a=new o(s),l={responseType:"json",url:i.href},c=s.interstitialAssetListLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,m)=>{const g=f.data,y=g?.ASSETS;if(!Array.isArray(y)){const v=this.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,h,m);this.hls.trigger(T.ERROR,v);return}e.assetListResponse=g,this.hls.trigger(T.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:m})},onError:(f,h,p,m)=>{const g=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${f.code} ${f.text} (${h.url})`),h.url,m,p);this.hls.trigger(T.ERROR,g)},onTimeout:(f,h,p)=>{const m=this.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${h.url})`),h.url,f,p);this.hls.trigger(T.ERROR,m)}};return a.load(l,u,d),this.hls.trigger(T.ASSET_LIST_LOADING,{event:e}),a}assignAssetListError(e,t,n,i,s,o){return e.error=n,{type:se.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:n,networkDetails:o,stats:s}}}function Dp(r){var e;r==null||(e=r.play())==null||e.catch(()=>{})}function bo(r,e){return`[${r}] Advancing timeline position to ${e}`}class tw extends nn{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const i=n-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const o=i<=-.01;this.timelinePos=n,this.bufferedPos=n;const a=this.playingItem;if(!a){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(n,n-i)&&this.updateSchedule(!0),this.checkBuffer(),o&&n<a.start||n>=a.end){var l;const h=this.findItemIndex(a);let p=this.schedule.findItemIndexAtTime(n);if(p===-1&&(p=h+(o?-1:1),this.log(`seeked ${o?"back ":""}to position not covered by schedule ${n} (resolving from ${h} to ${p})`)),!this.isInterstitial(a)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!o&&p>h){const m=this.schedule.findJumpRestrictedIndex(h+1,p);if(m>h){this.setSchedulePosition(m);return}}this.setSchedulePosition(p);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(a)){const h=a.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,h))}return}const u=c.timelineStart,d=c.duration||0;if(o&&n<u||n>=u+d){var f;(f=a.event)!=null&&f.appendInPlace&&(this.clearAssetPlayers(a.event,a),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,c)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(n>=i.end){this.timelinePos=i.end;const a=this.findItemIndex(i);this.setSchedulePosition(a+1)}const s=this.playingAsset;if(!s)return;const o=s.timelineStart+(s.duration||0);n>=o&&this.setScheduleToAssetAtTime(n,s)},this.onScheduleUpdate=(n,i)=>{const s=this.schedule;if(!s)return;const o=this.playingItem,a=s.events||[],l=s.items||[],c=s.durations,u=n.map(m=>m.identifier),d=!!(a.length||u.length);(d||i)&&this.log(`INTERSTITIALS_UPDATED (${a.length}): ${a}
48Schedule: ${l.map(m=>rn(m))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let f=null,h=null;o&&(f=this.updateItem(o,this.timelinePos),this.itemsMatch(o,f)?this.playingItem=f:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const p=this.bufferingItem;if(p&&(h=this.updateItem(p,this.bufferedPos),this.itemsMatch(p,h)?this.bufferingItem=h:p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))),n.forEach(m=>{m.assetList.forEach(g=>{this.clearAssetPlayer(g.identifier,null)})}),this.playerQueue.forEach(m=>{if(m.interstitial.appendInPlace){const g=m.assetItem.timelineStart,y=m.timelineOffset-g;if(y)try{m.timelineOffset=g}catch(v){Math.abs(y)>Ti&&this.warn(`${v} ("${m.assetId}" ${m.timelineOffset}->${g})`)}}}),d||i){if(this.hls.trigger(T.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:l.slice(0),durations:c,removedIds:u}),this.isInterstitial(o)&&u.includes(o.event.identifier)){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}o&&this.trimInPlace(f,o),p&&h!==f&&this.trimInPlace(h,p),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new ew(e),this.schedule=new ZL(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;
vendor: 4,201 bytes, line 48
48e&&(e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(T.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(T.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(T.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(T.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(T.BUFFER_APPENDED,this.onBufferAppended,this),e.on(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(T.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(T.MEDIA_ENDED,this.onMediaEnded,this),e.on(T.ERROR,this.onError,this),e.on(T.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(T.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(T.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(T.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(T.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(T.BUFFER_CODECS,this.onBufferCodecs,this),e.off(T.BUFFER_APPENDED,this.onBufferAppended,this),e.off(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(T.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(T.MEDIA_ENDED,this.onMediaEnded,this),e.off(T.ERROR,this.onError,this),e.off(T.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Ft(e,"play",this.onPlay),Ft(e,"pause",this.onPause),Ft(e,"seeking",this.onSeeking),Ft(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;Lt(n,"seeking",this.onSeeking),Lt(n,"timeupdate",this.onTimeupdate),Lt(n,"play",this.onPlay),Lt(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!i){this.clearScheduleState();const s=this.findItemIndex(n);this.setSchedulePosition(s)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,n=d=>d&&e.getAssetPlayer(d.identifier),i=(d,f,h,p,m)=>{if(d){let g=d[f].start;const y=d.event;if(y){if(f==="playout"||y.timelineOccupancy!==Sa.Point){const v=n(h);v?.interstitial===y&&(g+=v.assetItem.startOffset+v[m])}}else{const v=p==="bufferedPos"?o():e[p];g+=v-d.start}return g}return 0},s=(d,f)=>{var h;
vendor: 23,383 bytes, line 48
48if(d!==0&&f!=="primary"&&(h=e.schedule)!=null&&h.length){var p;const m=e.schedule.findItemIndexAtTime(d),g=(p=e.schedule.items)==null?void 0:p[m];if(g){const y=g[f].start-g.start;return d+y}}return d},o=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?a("primary"):Math.max(d,0)},a=d=>{var f,h;return(f=e.primaryDetails)!=null&&f.live?e.primaryDetails.edge:((h=e.schedule)==null?void 0:h.durations[d])||0},l=(d,f)=>{var h,p;const m=e.effectivePlayingItem;if(m!=null&&(h=m.event)!=null&&h.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${f}"`);const g=e.effectivePlayingItem,y=e.schedule.findItemIndexAtTime(d,f),v=(p=e.schedule.items)==null?void 0:p[y],E=e.getBufferingPlayer(),b=E?.interstitial,_=b?.appendInPlace,I=g&&e.itemsMatch(g,v);if(g&&(_||I)){const S=n(e.playingAsset),A=S?.media||e.primaryMedia;if(A){const R=f==="primary"?A.currentTime:i(g,f,e.playingAsset,"timelinePos","currentTime"),L=d-R,C=(_?R:A.currentTime)+L;if(C>=0&&(!S||_||C<=S.duration)){A.currentTime=C;return}}}if(v){let S=d;if(f!=="primary"){const R=v[f].start,L=d-R;S=v.start+L}const A=!e.isInterstitial(v);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(A||v.event.appendInPlace)){const R=e.media||(_?E?.media:null);R&&(R.currentTime=S)}else if(g){const R=e.findItemIndex(g);if(y>R){const C=e.schedule.findJumpRestrictedIndex(R+1,y);if(C>R){e.setSchedulePosition(C);return}}let L=0;if(A)e.timelinePos=S,e.checkBuffer();else{const C=v.event.assetList,O=d-(v[f]||v).start;for(let D=C.length;D--;){const P=C[D];if(P.duration&&O>=P.startOffset&&O<P.startOffset+P.duration){L=D;break}}}e.setSchedulePosition(y,L)}}},c=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const f=t();return e.isInterstitial(f)?f:null},u={get bufferedEnd(){const d=t(),f=e.bufferingItem;if(f&&f===d){var h;return i(f,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-f.playout.start||((h=e.bufferingAsset)==null?void 0:h.startOffset)||0}return 0},get currentTime(){const d=c(),f=e.effectivePlayingItem;return f&&f===d?i(f,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-f.playout.start:0},set currentTime(d){const f=c(),h=e.effectivePlayingItem;h&&h===f&&l(d+h.playout.start,"playout")},get duration(){const d=c();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const f=(d=c())==null?void 0:d.event.assetList;return f?f.map(h=>e.getAssetPlayer(h.identifier)):[]},get playingIndex(){var d;const f=(d=c())==null?void 0:d.event;return f&&e.effectivePlayingAsset?f.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return c()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return o()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){l(d,"primary")},get duration(){return a("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){l(d,"integrated")},get duration(){return a("integrated")},get seekableStart(){var d;return s(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,f=d?.event;if(f&&!f.restrictions.skip){const h=e.findItemIndex(d);if(f.appendInPlace){const p=d.playout.start+d.event.duration;l(p+.001,"playout")}else e.advanceAfterAssetEnded(f,h,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const s=(t=i)==null?void 0:t.currentTime;if(!(s===void 0||!Q(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Oe(s)}`),this.detachedData=s}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var n,i;if(e.media===t)return;let s=null;const o=this.hls,a=e!==o,l=a&&e.interstitial.appendInPlace,c=(n=this.detachedData)==null?void 0:n.mediaSource;let u;if(o.media)l&&(s=o.transferMedia(),this.detachedData=s),u="Primary";else if(c){const p=this.getBufferingPlayer();p?(s=p.transferMedia(),u=`${p}`):u="detached MediaSource"}else u="detached media";if(!s){if(c)s=this.detachedData,this.log(`using detachedData: MediaSource ${Oe(s)}`);else if(!this.detachedData||o.media===t){const p=this.playerQueue;p.length>1&&p.forEach(m=>{if(a&&m.interstitial.appendInPlace!==l){const g=m.interstitial;this.clearInterstitial(m.interstitial,null),g.appendInPlace=!1,g.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${g}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=s&&"mediaSource"in s&&((i=s.mediaSource)==null?void 0:i.readyState)!=="closed",f=d&&s?s:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${a?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const h=this.schedule;if(f===s&&h){const p=a&&e.assetId===h.assetIdAtEnd;f.overrides={duration:h.duration,endOfStream:!a||p,cueRemoval:!a}}e.attachMedia(f)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,i=this.effectivePlayingItem;if(n===-1){const s=this.hls.startPosition;if(this.log(bo("checkStart",s)),this.timelinePos=s,t.length&&t[0].cue.pre){const o=e.findEventIndex(t[0].identifier);this.setSchedulePosition(o)}else if(s>=0||!this.primaryLive){const o=this.timelinePos=s>0?s:0,a=e.findItemIndexAtTime(o);this.setSchedulePosition(a)}}else if(i&&!this.playingItem){const s=e.findItemIndex(i);this.setSchedulePosition(s)}}advanceAssetBuffering(e,t){const n=e.event,i=n.findAssetIndex(t),s=vc(n,i);if(!n.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var o;const a=(o=this.schedule.items)==null?void 0:o[this.findItemIndex(e)+1];a&&this.bufferedToItem(a)}}advanceAfterAssetEnded(e,t,n){const i=vc(e,n);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const s=this.schedule.items;if(s){const o=t+1,a=s.length;if(o>=a){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.log(bo("advanceAfterAssetEnded",l)),this.timelinePos=l,e.appendInPlace&&this.advanceInPlace(l),this.checkBuffer(this.bufferedPos<l)),this.setSchedulePosition(o)}}}else{if(e.appendInPlace){const s=e.assetList[i];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const i=t.parentIdentifier,s=n.getEvent(i);if(s){const o=n.findEventIndex(i),a=n.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,o,a-1)}}setSchedulePosition(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(!i||this.playbackDisabled)return;const s=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&rn(s)}) pos: ${this.timelinePos}`);const o=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(o)){const u=o.event,d=this.playingAsset,f=d?.identifier,h=f?this.getAssetPlayer(f):null;if(h&&f&&(!this.eventItemsMatch(o,s)||t!==void 0&&f!==u.assetList[t].identifier)){var l;const p=u.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${p+1}/${u.assetList.length} ${ci(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(T.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:p,event:u,schedule:i.slice(0),scheduleIndex:e,player:h}),o!==this.playingItem){this.itemsMatch(o,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),p);return}this.retreiveMediaSource(f,s),h.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(o,s)&&(this.endedItem=o,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${rn(o)}`),u.hasPlayed=!0,this.hls.trigger(T.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){var c;this.updateSchedule();const p=(c=this.schedule)==null?void 0:c.items;if(s&&p){const m=this.findItemIndex(s);this.advanceSchedule(m,p,t,o,a)}return}}this.advanceSchedule(e,i,t,o,a)}advanceSchedule(e,t,n,i,s){const o=this.schedule;if(!o)return;const a=t[e]||null,l=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const d=u.interstitial,f=o.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const u=a.event;if(n===void 0){n=o.findAssetIndex(u,this.timelinePos);const p=vc(u,n-1);if(u.isAssetPastPlayoutLimit(p)||u.appendInPlace&&this.timelinePos===a.end){this.advanceAfterAssetEnded(u,e,n);return}n=p}const d=this.waitingItem;this.assetsBuffered(a,l)||this.setBufferingItem(a);let f=this.preloadAssets(u,n);if(this.eventItemsMatch(a,d||i)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${rn(a)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(T.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=a;const h=u.assetList[n];if(!h){this.advanceAfterAssetEnded(u,e,n||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const p=u.assetList.length;this.warn(`asset ${n+1}/${p} player destroyed ${u}`),f=this.createAssetPlayer(u,h,n),f.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,n,t,e,l),this.shouldPlay&&Dp(f.media)}else a?(this.resumePrimary(a,e,i),this.shouldPlay&&Dp(this.hls.media)):s&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(o.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var i,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${rn(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let a=this.timelinePos;(a<e.start||a>=e.end)&&(a=this.getPrimaryResumption(e,t),this.log(bo("resumePrimary",a)),this.timelinePos=a),this.attachPrimary(a,e)}if(!n)return;const o=(s=this.schedule)==null?void 0:s.items;o&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${rn(e)}`),this.hls.trigger(T.INTERSTITIALS_PRIMARY_RESUMED,{schedule:o.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(n<i.fragmentStart||n>i.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:de.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(bo("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((n=i.mainForwardBufferInfo)==null?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(T.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(T.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const n=this.hls.levels[t.level];if(!n.details)return;const i=Ie(Ie({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=Ie(Ie({},this.altSelection),{},{audio:n});return}const s=Ie(Ie({},i),{},{audio:n});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=Ie(Ie({},this.altSelection),{},{subtitles:n});return}const s=Ie(Ie({},i),{},{subtitles:n});this.mediaSelection=s}onAudioTrackSwitching(e,t){const n=Vh(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){const n=Vh(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(n)))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let i=0;i<t.length;i++){const s=t[i];if(s.cue.post){var n;const o=this.schedule.findEventIndex(s.identifier),a=(n=this.schedule.items)==null?void 0:n[o];this.isInterstitial(a)&&this.eventItemsMatch(a,this.bufferingItem)&&this.bufferedToItem(a,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(e&&i){const s=this.findItemIndex(e,t);return i[s]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(s.identifier,null)});const n=e.end+.25,i=de.bufferInfo(this.primaryMedia,n,0);(i.end>n||(i.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${rn(e)} (was ${rn(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=(t=this.schedule)==null?void 0:t.items;if(!n)return;const i=de.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,t,n){const i=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const o=this.playingItem,a=this.findItemIndex(o);let l=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var c;const u=this.findItemIndex(s),d=Math.min(u+1,t.length-1),f=t[d];if((l===-1&&s&&e>=s.end||(c=f.event)!=null&&c.appendInPlace&&e+.01>=f.start)&&(l=d),this.isInterstitial(s)){const h=s.event;if(d-a>1&&h.appendInPlace===!1||h.assetList.length===0&&h.assetListLoader)return}if(this.bufferedPos=e,l>u&&l>a)this.bufferedToItem(f);else{const h=this.primaryDetails;this.primaryLive&&h&&e>h.edge-h.targetduration&&f.start<h.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(f)&&this.preloadAssets(f.event,0)}}else n&&o&&!this.itemsMatch(o,s)&&(l===a?this.bufferedToItem(o):l===a+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{const s=this.getAssetPlayer(i.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:i,events:s}=n;if(!i||!s)return t;const o=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=a?a.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${rn(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(o){const c=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,d)=>{const f=this.getAssetPlayer(u.identifier);f&&(d===c&&f.loadSource(),f.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering());this.hls.trigger(T.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,i=n.assetList.length===0&&!n.assetListLoader,s=n.cue.once;if(i||!s){const o=this.preloadAssets(n,t);if(o!=null&&o.interstitial.appendInPlace){const a=this.primaryMedia;a&&this.bufferAssetPlayer(o,a)}}}preloadAssets(e,t){const n=e.assetUrl,i=e.assetList.length,s=i===0&&!e.assetListLoader,o=e.cue.once;if(s){const l=e.timelineStart;if(e.appendInPlace){var a;const f=this.playingItem;!this.isInterstitial(f)&&(f==null||(a=f.nextEvent)==null?void 0:a.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let c,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const f=u-l;f>0&&(c=Math.round(f*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:i} ${e}${c?` live-start: ${u} start-offset: ${c}`:""}`),n)return this.createAsset(e,0,0,l,e.duration,n);const d=this.assetListLoader.loadAssetList(e,c);d&&(e.assetListLoader=d)}else if(!o&&i){for(let c=t;c<i;c++){const u=e.assetList[c],d=this.getAssetPlayerQueueIndex(u.identifier);(d===-1||this.playerQueue[d].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}const l=e.assetList[t];if(l){const c=this.getAssetPlayer(l.identifier);return c&&c.loadSource(),c}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(i=>{this.hls.trigger(T.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,i,s,o){const a={parentIdentifier:e.identifier,identifier:qL(e,o,t),duration:s,startOffset:n,timelineStart:i,uri:o};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,n){const i=this.hls,s=i.userConfig;let o=s.videoPreference;const a=i.loadLevelObj||i.levels[i.currentLevel];(o||a)&&(o=ke({},o),a.videoCodec&&(o.videoCodec=a.videoCodec),a.videoRange&&(o.allowedVideoRanges=[a.videoRange]));const l=i.audioTracks[i.audioTrack],c=i.subtitleTracks[i.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const b=this.timelinePos-t.timelineStart;if(b>1){const _=t.duration;_&&b<_&&(u=b)}}const d=t.identifier,f=Ie(Ie({},s),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:l||s.audioPreference,subtitlePreference:c||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));const h=f.cmcd;h!=null&&h.sessionId&&h.contentId&&(f.cmcd=ke({},h,{contentId:es(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const p=new JL(this.HlsPlayerClass,f,e,t);this.playerQueue.push(p),e.assetList[n]=t;let m=!0;const g=b=>{if(b.live){var _;const A=new Error(`Interstitials MUST be VOD assets ${e}`),R={fatal:!0,type:se.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:A},L=((_=this.schedule)==null?void 0:_.findEventIndex(e.identifier))||-1;this.handleAssetItemError(R,e,L,n,A.message);return}const I=b.edge-b.fragmentStart,S=t.duration;(m||S===null||I>S)&&(m=!1,this.log(`Interstitial asset "${d}" duration change ${S} > ${I}`),t.duration=I,this.updateSchedule())};p.on(T.LEVEL_UPDATED,(b,{details:_})=>g(_)),p.on(T.LEVEL_PTS_UPDATED,(b,{details:_})=>g(_)),p.on(T.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const y=(b,_)=>{const I=this.getAssetPlayer(d);if(I&&_.tracks){I.off(T.BUFFER_CODECS,y),I.tracks=_.tracks;const S=this.primaryMedia;this.bufferingAsset===I.assetItem&&S&&!I.media&&this.bufferAssetPlayer(I,S)}};p.on(T.BUFFER_CODECS,y);const v=()=>{var b;const _=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${_}
48`),!_||!this.schedule)return;const I=this.schedule.findEventIndex(e.identifier),S=(b=this.schedule.items)==null?void 0:b[I];this.isInterstitial(S)&&this.advanceAssetBuffering(S,t)};p.on(T.BUFFERED_TO_END,v);const E=b=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const I=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,I,b)};return p.once(T.MEDIA_ENDED,E(n)),p.once(T.PLAYOUT_LIMIT_REACHED,E(1/0)),p.on(T.ERROR,(b,_)=>{if(!this.schedule)return;const I=this.getAssetPlayer(d);if(_.details===$.BUFFER_STALLED_ERROR){if(I!=null&&I.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(_,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${_.error} ${e}`)}),p.on(T.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const _=new Error(`Asset player destroyed unexpectedly ${d}`),I={fatal:!0,type:se.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:_};this.handleAssetItemError(I,e,this.schedule.findEventIndex(e.identifier),n,_.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${ci(t)}`),this.hls.trigger(T.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:p}),p}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const i=this.playerQueue[n];this.log(`clear ${i} toSegment: ${t&&rn(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(n,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,i,s){const{interstitial:o,assetItem:a,assetId:l}=e,c=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=a,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,n[i]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${ci(a)}`),this.hls.trigger(T.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:o,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var n,i;if(!this.schedule)return;const{interstitial:s,assetItem:o}=e,a=this.schedule.findEventIndex(s.identifier),l=(n=this.schedule.items)==null?void 0:n[a];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=o;const c=this.getBufferingPlayer();if(c===e)return;const u=s.appendInPlace;if(u&&c?.interstitial.appendInPlace===!1)return;const d=c?.tracks||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(u&&o!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!ay(d,e.tracks)){const f=new Error(`Asset ${ci(o)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),h={fatal:!0,type:se.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:f},p=s.findAssetIndex(o);this.handleAssetItemError(h,s,a,p,f.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const i=n.currentTime,s=t.findAssetIndex(e,i),o=e.assetList[s];if(o){const a=this.getAssetPlayer(o.identifier);if(a){const l=a.currentTime||i-o.timelineStart,c=a.duration-l;if(this.warn(`Stalled at ${l} of ${l+c} in ${a} ${e} (media.currentTime: ${i})`),l&&(c/n.playbackRate<.5||a.bufferedInPlaceToEnd(n))&&a.hls){const u=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,i,s){if(e.details===$.BUFFER_STALLED_ERROR)return;const o=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&ci(o)} ${e.error}`),!this.schedule)return;const a=o?.identifier||"",l=this.getAssetPlayerQueueIndex(a),c=this.playerQueue[l]||null,u=this.schedule.items,d=ke({},e,{fatal:!1,errorAction:vi(!0),asset:o,assetListIndex:i,event:t,schedule:u,scheduleIndex:n,player:c});if(this.hls.trigger(T.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,h=this.bufferingAsset,p=new Error(s);if(o&&(this.clearAssetPlayer(a,null),o.error=p),!t.assetList.some(m=>!m.error))t.error=p;else for(let m=i;m<t.assetList.length;m++)this.resetAssetPlayer(t.assetList[m].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):f&&f.identifier===a?this.advanceAfterAssetEnded(t,n,i):h&&h.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,h)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;let i=this.timelinePos;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${i} playing: ${rn(n)} error: ${e.error}`),i===-1&&(i=this.hls.startPosition);const o=this.updateItem(n,i);this.itemsMatch(n,o)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(i===-1){this.checkStart();return}if(!this.schedule)return;const s=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(s)}onAssetListLoaded(e,t){var n,i;const s=t.event,o=s.identifier,a=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(o)))return;const l=s.timelineStart,c=s.duration;let u=0;a.forEach((m,g)=>{const y=parseFloat(m.DURATION);this.createAsset(s,g,u,l+u,y,m.URI),u+=y}),s.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${s}`);
vendor: 5,926 bytes, line 48
48const d=this.waitingItem,f=d?.event.identifier===o;this.updateSchedule();const h=(i=this.bufferingItem)==null?void 0:i.event;if(f){var p;const m=this.schedule.findEventIndex(o),g=(p=this.schedule.items)==null?void 0:p[m];if(g){if(!this.playingItem&&this.timelinePos>g.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==m){s.error=new Error(`Interstitial ${a.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${s}`),this.log(s.error.message),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(g)}this.setSchedulePosition(m)}else if(h?.identifier===o){const m=s.assetList[0];if(m){const g=this.getAssetPlayer(m.identifier);if(h.appendInPlace){const y=this.primaryMedia;g&&y&&this.bufferAssetPlayer(g,y)}else g&&g.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case $.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Pp=500;class nw extends Rd{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",ee.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(T.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(T.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=j.IDLE,this.setInterval(Pp),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:n,success:i}=t;if(this.fragContextChanged(n)||(We(n)&&(this.fragPrevious=n),this.state=j.IDLE),!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o;const a=n.start;for(let c=0;c<s.length;c++)if(a>=s[c].start&&a<=s[c].end){o=s[c];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},s.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=s){o.shift();continue}else if(o[a].start<s)o[a].start=s;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(n,s,ee.SUBTITLE)}}onError(e,t){const n=t.frag;n?.type===ee.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&uv(this.levels,t)){this.levels=t.map(n=>new vs(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new vs(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==j.STOPPED&&this.setInterval(Pp)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:o,id:a}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=s[a];if(a>=s.length||!l)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(o.live||(n=l.details)!=null&&n.live){if(o.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const f=d.fragments[0];if(!l.details)o.hasProgramDateTime&&d.hasProgramDateTime?(ba(o,d),c=o.fragmentStart):f&&(c=f.start,yu(o,c));else{var u;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),c===0&&f&&(c=f.start,yu(o,c))}d&&!this.startFragRequested&&this.setStartPosition(d,c)}l.details=o,this.levelLastLoaded=l,a===i&&(this.hls.trigger(T.SUBTITLE_TRACK_UPDATED,{details:o,id:a,groupId:t.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===j.IDLE&&(Kr(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&Ei(i.method)){const o=performance.now();
vendor: 28,985 bytes, lines 48-59
48this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,Ad(i.method)).catch(a=>{throw s.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();s.trigger(T.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.IDLE){const{currentTrackId:e,levels:t}=this,n=t?.[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:i}=this,s=this.getLoadPosition(),o=de.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:a,len:l}=o,c=n.details,u=this.hls.maxBufferLength+c.levelTargetDuration;if(l>u)return;const d=c.fragments,f=d.length,h=c.edge;let p=null;const m=this.fragPrevious;if(a<h){const v=i.maxFragLookUpTolerance,E=a>h-v?0:v;p=Kr(m,d,Math.max(d[0].start,a),E),!p&&m&&m.start<d[0].start&&(p=d[0])}else p=d[f-1];if(p=this.filterReplacedPrimary(p,n.details),!p)return;const g=p.sn-c.startSN,y=d[g-1];if(y&&y.cc===p.cc&&this.fragmentTracker.getState(y)===nt.NOT_LOADED&&(p=y),this.fragmentTracker.getState(p)===nt.NOT_LOADED){const v=this.mapToInitFragWhenRequired(p);v&&this.loadFragment(v,n,a)}}}loadFragment(e,t,n){We(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new rw(this.tracksBuffered[this.currentTrackId]||[])}}class rw{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const iw={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Iv=r=>String.fromCharCode(iw[r]||r),sn=15,xn=100,sw={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ow={17:2,18:4,21:6,22:8,23:10,19:13,20:15},aw={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},lw={25:2,26:4,29:6,30:8,31:10,27:13,28:15},cw=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class uw{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;Le.log(`${this.time} [${e}] ${n}`)}}}const _r=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Lv{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class dw{constructor(){this.uchar=" ",this.penState=new Lv}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class fw{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Lv,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xn;t++)this.chars.push(new dw);this.logger=e}equals(e){for(let t=0;t<xn;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xn;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xn;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>xn&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xn)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Iv(e);if(this.pos>=xn){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<xn;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let n=0;n<xn;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ec{constructor(e){this.rows=[],this.currRow=sn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<sn;t++)this.rows.push(new fw(e));this.logger=e}reset(){for(let e=0;e<sn;e++)this.rows[e].clear();this.currRow=sn-1}equals(e){let t=!0;for(let n=0;n<sn;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<sn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<sn;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Oe(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<sn;a++)this.rows[a].clear();const s=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[s].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(o.rows[s+c])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,o=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Oe(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",i=-1;for(let s=0;s<sn;s++){const o=this.rows[s].getTextString();o&&(i=s+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
49`)),n}getTextAndFormat(){return this.rows}}class Op{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ec(n),this.nonDisplayedMemory=new Ec(n),this.lastOutputScreen=new Ec(n),this.currRollUpRow=this.displayedMemory.rows[sn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[sn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}this.logger.log(2,"MIDROW: "+Oe(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Mp{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=pw(),this.logger=void 0;const i=this.logger=new uw;this.channels=[null,new Op(e,t,i),new Op(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let o=!1,a=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+_r([t[n],t[n+1]])+"] -> ("+_r([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(hw(i,s,l)){To(null,null,l),this.logger.log(3,()=>"Repeated command ("+_r([i,s])+") is dropped");continue}To(i,s,this.cmdHistory),o=this.parseCmd(i,s),o||(o=this.parseMidrow(i,s)),o||(o=this.parsePAC(i,s)),o||(o=this.parseBackgroundAttributes(i,s))}else To(null,null,l);if(!o&&(a=this.parseChars(i,s),a)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!a&&this.logger.log(2,()=>"Couldn't parse cleaned data "+_r([i,s])+" orig: "+_r([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,o=this.channels[s];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+_r([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?sw[e]:aw[e]:n=o===1?ow[e]:lw[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let o;s===17?o=t+80:s===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+Iv(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes =  "+_r(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const o={};e===16||e===24?(s=Math.floor((t-32)/2),o.background=cw[s],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}To(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function To(r,e,t){t.a=r,t.b=e}function hw(r,e,t){return t.a===r&&t.b===e}function pw(){return{a:null,b:null}}var Fd=(function(){if(Ea!=null&&Ea.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const c=l.toLowerCase();return~a.indexOf(c)?c:!1}function n(a){return t(r,a)}function i(a){return t(e,a)}function s(a,...l){let c=1;for(;c<arguments.length;c++){const u=arguments[c];for(const d in u)a[d]=u[d]}return a}function o(a,l,c){const u=this,d={enumerable:!0};u.hasBeenReset=!1;let f="",h=!1,p=a,m=l,g=c,y=null,v="",E=!0,b="auto",_="start",I=50,S="middle",A=50,R="middle";Object.defineProperty(u,"id",s({},d,{get:function(){return f},set:function(L){f=""+L}})),Object.defineProperty(u,"pauseOnExit",s({},d,{get:function(){return h},set:function(L){h=!!L}})),Object.defineProperty(u,"startTime",s({},d,{get:function(){return p},set:function(L){if(typeof L!="number")throw new TypeError("Start time must be set to a number.");p=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",s({},d,{get:function(){return m},set:function(L){if(typeof L!="number")throw new TypeError("End time must be set to a number.");m=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",s({},d,{get:function(){return g},set:function(L){g=""+L,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",s({},d,{get:function(){return y},set:function(L){y=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",s({},d,{get:function(){return v},set:function(L){const C=n(L);if(C===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",s({},d,{get:function(){return E},set:function(L){E=!!L,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",s({},d,{get:function(){return b},set:function(L){if(typeof L!="number"&&L!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");b=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",s({},d,{get:function(){return _},set:function(L){const C=i(L);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");_=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",s({},d,{get:function(){return I},set:function(L){if(L<0||L>100)throw new Error("Position must be between 0 and 100.");I=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",s({},d,{get:function(){return S},set:function(L){const C=i(L);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");S=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",s({},d,{get:function(){return A},set:function(L){if(L<0||L>100)throw new Error("Size must be between 0 and 100.");A=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",s({},d,{get:function(){return R},set:function(L){const C=i(L);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");R=C,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o})();class mw{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function wv(r){function e(n,i,s,o){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(o||0)}const t=r.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class gw{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function xv(r,e,t,n){const i=n?r.split(n):[r];for(const s in i){if(typeof i[s]!="string")continue;const o=i[s].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const Ru=new Fd(0,0,""),So=Ru.align==="middle"?"middle":"center";function yw(r,e,t){const n=r;function i(){const a=wv(r);if(a===null)throw new Error("Malformed timestamp: "+n);return r=r.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,l){const c=new gw;xv(a,function(f,h){let p;switch(f){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===h){c.set(f,t[m].region);break}break;case"vertical":c.alt(f,h,["rl","lr"]);break;case"line":p=h.split(","),c.integer(f,p[0]),c.percent(f,p[0])&&c.set("snapToLines",!1),c.alt(f,p[0],["auto"]),p.length===2&&c.alt("lineAlign",p[1],["start",So,"end"]);break;case"position":p=h.split(","),c.percent(f,p[0]),p.length===2&&c.alt("positionAlign",p[1],["start",So,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,h);break;case"align":c.alt(f,h,["start",So,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let u=c.get("line","auto");u==="auto"&&Ru.line===-1&&(u=-1),l.line=u,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",So);let d=c.get("position","auto");d==="auto"&&Ru.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function o(){r=r.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);r=r.slice(3),o(),e.endTime=i(),o(),s(r,e)}function kv(r){return r.replace(/<br(?: \/)?>/gi,`
50`)}class vw{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new mw,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let s=t.buffer,o=0;for(s=kv(s);o<s.length&&s[o]!=="\r"&&s[o]!==`
51`;)++o;const a=s.slice(0,o);return s[o]==="\r"&&++o,s[o]===`
52`&&++o,t.buffer=s.slice(o),a}function i(s){xv(s,function(o,a){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();const a=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:s=n(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Fd(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{yw(s,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=s.indexOf("-->")!==-1;if(!s||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
53`),t.cue.text+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
54
55`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Ew=/\r\n|\n\r|\n|\r/g,bc=function(e,t,n=0){return e.slice(n,n+t.length)===t},bw=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Q(t)||!Q(n)||!Q(i)||!Q(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=3600*1e3*s,t};function Bd(r,e,t){return es(r.toString())+es(e.toString())+es(t)}const Tw=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(o=s)!=null&&o.new;){var o;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function Sw(r,e,t,n,i,s,o){const a=new vw,l=jt(new Uint8Array(r)).trim().replace(Ew,`
56`).split(`
57`),c=[],u=e?wI(e.baseTime,e.timescale):0;let d="00:00.000",f=0,h=0,p,m=!0;a.oncue=function(g){const y=t[n];let v=t.ccOffset;const E=(f-u)/9e4;if(y!=null&&y.new&&(h!==void 0?v=t.ccOffset=y.start:Tw(t,n,E)),E){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}v=E-t.presentationOffset}const b=g.endTime-g.startTime,_=Gt((g.startTime+v-h)*9e4,i*9e4)/9e4;g.startTime=Math.max(_,0),g.endTime=Math.max(_+b,0);const I=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(I)),g.id||(g.id=Bd(g.startTime,g.endTime,I)),g.endTime>0&&c.push(g)},a.onparsingerror=function(g){p=g},a.onflush=function(){if(p){o(p);return}s(c)},l.forEach(g=>{if(m)if(bc(g,"X-TIMESTAMP-MAP=")){m=!1,g.slice(16).split(",").forEach(y=>{bc(y,"LOCAL:")?d=y.slice(6):bc(y,"MPEGTS:")&&(f=parseInt(y.slice(7)))});try{h=bw(d)/1e3}catch(y){p=y}return}else g===""&&(m=!1);a.parse(g+`
58`)}),a.flush()}const Tc="stpp.ttml.im1t",Cv=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Dv=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Aw={left:"start",center:"center",right:"end",start:"start",end:"end"};function Np(r,e,t,n){const i=ve(new Uint8Array(r),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(a=>jt(a)),o=LI(e.baseTime,1,e.timescale);try{s.forEach(a=>t(_w(a,o)))}catch(a){n(a)}}function _w(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(s).reduce((d,f)=>(d[f]=i.getAttribute(`ttp:${f}`)||s[f],d),{}),a=i.getAttribute("xml:space")!=="preserve",l=Fp(Sc(i,"styling","style")),c=Fp(Sc(i,"layout","region")),u=Sc(i,"body","[begin]");return[].map.call(u,d=>{const f=Pv(d,a);if(!f||!d.hasAttribute("begin"))return null;const h=_c(d.getAttribute("begin"),o),p=_c(d.getAttribute("dur"),o);let m=_c(d.getAttribute("end"),o);if(h===null)throw Bp(d);if(m===null){if(p===null)throw Bp(d);m=h+p}const g=new Fd(h-e,m-e,f);g.id=Bd(g.startTime,g.endTime,g.text);const y=c[d.getAttribute("region")],v=l[d.getAttribute("style")],E=Rw(y,v,l),{textAlign:b}=E;if(b){const _=Aw[b];_&&(g.lineAlign=_),g.align=b}return ke(g,E),g}).filter(d=>d!==null)}function Sc(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function Fp(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function Pv(r,e){return[].slice.call(r.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
59`:(s=n.childNodes)!=null&&s.length?Pv(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function Rw(r,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),s.reduce((a,l)=>{const c=Ac(e,n,l)||Ac(r,n,l)||Ac(i,n,l);return c&&(a[l]=c),a},{})}function Ac(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function Bp(r){return new Error(`Could not parse ttml timestamp ${r}`)}function _c(r,e){if(!r)return null;let t=wv(r);return t===null&&(Cv.test(r)?t=Iw(r,e):Dv.test(r)&&(t=Lw(r,e))),t}function Iw(r,e){const t=Cv.exec(r),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function Lw(r,e){const t=Dv.exec(r),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class Ao{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class ww{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Up(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}}
vendor: 3,592 bytes, line 59
59,e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(T.FRAG_LOADING,this.onFragLoading,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this),e.on(T.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(T.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(T.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(T.FRAG_LOADING,this.onFragLoading,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this),e.off(T.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(T.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(T.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Ao(this,"textTrack1"),t=new Ao(this,"textTrack2"),n=new Ao(this,"textTrack3"),i=new Ao(this,"textTrack4");this.cea608Parser1=new Mp(1,e,t),this.cea608Parser2=new Mp(3,n,i)}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],c=xw(l[0],l[1],t,n);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,c/(n-t)>.5))return}if(o||s.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(T.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:o}){const{unparsedVttFrags:a}=this;n===ee.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:s,trackId:o}),a.length&&(this.unparsedVttFrags=[],a.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(T.FRAG_LOADED,l):this.hls.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if($p(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:o}=t[e],a=this.getExistingTrack(s,o);if(a)n[e]=a,hi(n[e]),Av(n[e],i);else{const l=this.createTextTrack("captions",s,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(T.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;
vendor: 21,456 bytes, line 59
59Object.keys(i).forEach(s=>{hi(i[s]),delete i[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Up(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let n=0;n<t.length;n++)hi(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Tc);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(uv(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Wo(o.textTracks):null;if(this.tracks.forEach((l,c)=>{let u;if(a){let d=null;for(let f=0;f<a.length;f++)if(a[f]&&$p(a[f],l)){d=a[f],a[f]=null;break}d&&(u=d)}if(u)hi(u);else{const d=Ov(l);u=this.createTextTrack(d,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),a!=null&&a.length){const l=a.filter(c=>c!==null).map(c=>c.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(T.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,o=this.captionsProperties[s];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:c}=t.frag,u=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&o&&(c!==a+1||c===a&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,o="stats"in t;if(s==null||!s.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===Tc?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Np(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{n.logger.log(`Failed to parse IMSC1: ${i}`),n.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:o}=this,a=s.length-1;if(!s[n.cc]&&a===-1){o.push(e);return}const l=this.hls,c=(t=n.initSegment)!=null&&t.data?tn(n.initSegment.data,new Uint8Array(i)).buffer:i;Sw(c,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,u=>{this._appendCues(u,n.level),l.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},u=>{const d=u.message==="Missing initPTS for VTT MPEGTS";d?o.push(e):this._fallbackToIMSC1(n,i),l.logger.log(`Failed to parse VTT cue: ${u}`),!(d&&a>n.cc)&&l.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:u})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Np(t,this.initPTS[e.cc],()=>{n.textCodec=Tc,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>_v(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(T.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===ee.SUBTITLE&&this.onFragLoaded(T.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=t;if(!(n.type===ee.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let s=0;s<i.length;s++){const o=i[s].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const a=this.extractCea608Data(o);this.cea608Parser1.addData(i[s].pts,a[0]),this.cea608Parser2.addData(i[s].pts,a[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!s||s==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>_u(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>_u(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(t[u].push(a),t[u].push(l))}}return t}}function Ov(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function $p(r,e){return!!r&&r.kind===Ov(e)&&bu(e,r)}function xw(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function Up(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const kw=/\s/,Cw={newCue(r,e,t,n){const i=[];let s,o,a,l,c;const u=self.VTTCue||self.TextTrackCue;for(let f=0;f<n.rows.length;f++)if(s=n.rows[f],a=!0,l=0,c="",!s.isEmpty()){var d;for(let m=0;m<s.chars.length;m++)kw.test(s.chars[m].uchar)&&a?l++:(c+=s.chars[m].uchar,a=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const h=kv(c.trim()),p=Bd(e,t,h);r!=null&&(d=r.cues)!=null&&d.getCueById(p)||(o=new u(e,t,h),o.id=p,o.line=f+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(o))}return r&&i.length&&(i.sort((f,h)=>f.line==="auto"||h.line==="auto"?0:f.line>8&&h.line>8?h.line-f.line:f.line-h.line),i.forEach(f=>_v(r,f))),i}};function Dw(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Pw=/(\d+)-(\d+)\/(\d+)/;class Vp{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Fw,this.controller=new self.AbortController,this.stats=new gd}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=Ow(e,this.controller.signal),o=e.responseType==="arraybuffer",a=o?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=l&&Q(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout),(Ts(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var f;this.response=this.loader=d;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},c-(h-i.loading.start)),!d.ok){const{status:m,statusText:g}=d;throw new Bw(g||"fetch, bad network response",m,d)}i.loading.first=h,i.total=Nw(d.headers)||i.total;const p=(f=this.callbacks)==null?void 0:f.onProgress;return p&&Q(t.highWaterMark)?this.loadProgressively(d,i,e,t.highWaterMark,p):o?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var f,h;const p=this.response;if(!p)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const m=d[a];m&&(i.loaded=i.total=m);const g={url:p.url,data:d,code:p.status},y=(f=this.callbacks)==null?void 0:f.onProgress;y&&!Q(t.highWaterMark)&&y(i,e,d,p),(h=this.callbacks)==null||h.onSuccess(g,i,e,p)}).catch(d=>{var f;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=d&&d.code||0,p=d?d.message:null;(f=this.callbacks)==null||f.onError({code:h,text:p},e,d?d.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,i=0,s){const o=new zy,a=e.body.getReader(),l=()=>a.read().then(c=>{if(c.done)return o.dataLength&&s(t,n,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=c.value,d=u.length;return t.loaded+=d,d<i||o.dataLength?(o.push(u),o.dataLength>=i&&s(t,n,o.flush().buffer,e)):s(t,n,u.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function Ow(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ke({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function Mw(r){const e=Pw.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Nw(r){const e=r.get("Content-Range");if(e){const n=Mw(e);if(Q(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function Fw(r,e){return new self.Request(r.url,e)}class Bw extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const $w=/^age:\s*[\d.]+\s*$/im;class Mv{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new gd,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{var a;(a=this.callbacks)==null||a.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=s&&Q(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const c=t.status,u=t.responseType==="text"?t.responseText:null;if(c>=200&&c<300){const p=u??t.response;if(p!=null){var o,a;n.loading.end=Math.max(self.performance.now(),n.loading.first);const m=t.responseType==="arraybuffer"?p.byteLength:p.length;n.loaded=n.total=m,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const g=(o=this.callbacks)==null?void 0:o.onProgress;g&&g(n,e,p,t);const y={url:t.responseURL,data:p,code:c};(a=this.callbacks)==null||a.onSuccess(y,n,e,t);return}}const d=s.loadPolicy.errorRetry,f=n.retry,h={url:e.url,data:void 0,code:c};if(ya(d,f,!1,h))this.retry(d);else{var l;Le.error(`${c} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:c,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ya(e,t,!0))this.retry(e);else{var n;Le.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=bd(e,n.retry),n.retry++,Le.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&$w.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Uw={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Vw=Ie(Ie({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Mv,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z_,bufferController:HI,capLevelController:Od,errorController:iR,fpsController:zL,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Py,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:Uw},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Gw()),{},{subtitleStreamController:nw,subtitleTrackController:WL,timelineController:ww,audioStreamController:$I,audioTrackController:UI,emeController:bi,cmcdController:UL,contentSteeringController:GL,interstitialsController:tw});function Gw(){return{cueHandler:Cw,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Hw(r,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=Iu(r),i=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(o=>{const a=`${o==="level"?"playlist":o}LoadPolicy`,l=e[a]===void 0,c=[];s.forEach(u=>{const d=`${o}Loading${u}`,f=e[d];if(f!==void 0&&l){c.push(d);const h=n[a].default;switch(e[a]={default:h},u){case"TimeOut":h.maxLoadTimeMs=f,h.maxTimeToFirstByteMs=f;break;case"MaxRetry":h.errorRetry.maxNumRetry=f,h.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":h.errorRetry.retryDelayMs=f,h.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=f,h.timeoutRetry.maxRetryDelayMs=f;break}}}),c.length&&t.warn(`hls.js config: "${c.join('", "')}" setting(s) are deprecated, use "${a}": ${Oe(e[a])}`)}),Ie(Ie({},n),e)}function Iu(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(Iu):Object.keys(r).reduce((e,t)=>(e[t]=Iu(r[t]),e),{}):r}function zw(r,e){const t=r.loader;t!==Vp&&t!==Mv?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):Dw()&&(r.loader=Vp,r.progressive=!0,r.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Yo=2,Kw=.1,jw=.05,Ww=100;class Yw extends wy{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(T.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;
vendor: 7,115 bytes, line 59
59e&&(e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Ww),this.mediaSource=t.mediaSource;const n=this.media=t.media;Lt(n,"playing",this.onMediaPlaying),Lt(n,"waiting",this.onMediaWaiting),Lt(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(Ft(n,"playing",this.onMediaPlaying),Ft(n,"waiting",this.onMediaWaiting),Ft(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var n,i;const s=(n=this.hls)==null?void 0:n.config;if(!s)return;const o=this.media;if(!o)return;const{seeking:a}=o,l=this.seeking&&!a,c=!this.seeking&&a,u=o.paused&&!a||o.ended||o.playbackRate===0;if(this.seeking=a,e!==t){t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(c||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(T.MEDIA_ENDED,{stalled:!1}));return}if(!de.getBuffered(o).length){this.nudgeRetry=0;return}const d=de.bufferInfo(o,e,0),f=d.nextStart||0,h=this.fragmentTracker;if(a&&h&&this.hls){const I=Gp(this.hls.inFlightFragments,e),S=d.len>Yo,A=!f||I||f-e>Yo&&!h.getPartialFragment(e);if(S||A)return;this.moved=!1}const p=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&h){if(!(d.len>0)&&!f)return;const S=Math.max(f,d.start||0)-e,R=!!(p!=null&&p.live)?p.targetduration*2:Yo,L=_o(e,h);if(S>0&&(S<=R||L)){o.paused||this._trySkipBufferHole(L);return}}const m=s.detectStallWithCurrentTimeMs,g=self.performance.now(),y=this.waiting;let v=this.stalled;if(v===null)if(y>0&&g-y<m)v=this.stalled=y;else{this.stalled=g;return}const E=g-v;if(!a&&(E>=m||y)&&this.hls){var b;if(((b=this.mediaSource)==null?void 0:b.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-(p?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(T.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const _=de.bufferInfo(o,e,s.maxBufferHole);this._tryFixBufferStall(_,E,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(T.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&i&&i.length>1&&e>i.end(0)){const s=de.bufferedInfo(de.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const o=de.timeRangesToArray(i),a=de.bufferedInfo(o,t,0).bufferedIndex;if(a>-1&&a<o.length-1){const l=de.bufferedInfo(o,e,0).bufferedIndex,c=o[a].end,u=o[a+1].start;if((l===-1||l>a)&&u-c<1&&e-c<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${c} -> ${u} buffered index: ${l}`);this.warn(d.message),this.media.currentTime+=1e-6;let f=_o(e,this.fragmentTracker);f&&"fragment"in f?f=f.fragment:f||(f=void 0);const h=de.bufferInfo(this.media,e,0);this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:f,buffer:h.len,bufferInfo:h})}}}}}_tryFixBufferStall(e,t,n){var i,s;const{fragmentTracker:o,media:a}=this,l=(i=this.hls)==null?void 0:i.config;if(!a||!o||!l)return;const c=(s=this.hls)==null?void 0:s.latestLevelDetails,u=_o(n,o);if((u||c!=null&&c.live&&n<c.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const d=e.buffered,f=this.adjacentTraversal(e,n);(d&&d.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-n<l.maxBufferHole||f))&&(t>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,i=e.nextStart;if(n&&i){const s=n.getFragAtPos(t,ee.MAIN),o=n.getFragAtPos(i,ee.MAIN);if(s&&o)return o.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:i,stalled:s}=this;if(!i&&s!==null&&n&&t){this.stallReported=!0;const o=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${Oe(e)})`);this.warn(o.message),t.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:i}=this,s=(t=this.hls)==null?void 0:t.config;if(!i||!n||!s)return 0;const o=i.currentTime,a=de.bufferInfo(i,o,0),l=o<a.start?a.start:a.nextStart;if(l&&this.hls){const u=a.len<=s.maxBufferHole,d=a.len>0&&a.len<1&&i.readyState<3,f=l-o;if(f>0&&(u||d)){if(f>s.maxBufferHole){let p=!1;if(o===0){const m=n.getAppendedFrag(0,ee.MAIN);m&&l<m.end&&(p=!0)}if(!p&&e){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||Gp(this.hls.inFlightFragments,l))return 0;let g=!1,y=e.end;for(;y<l;){const v=_o(y,n);if(v)y+=v.duration;else{g=!0;break}}if(g)return 0}}const h=Math.max(l+jw,o+Kw);if(this.warn(`skipping hole, adjusting currentTime from ${o} to ${h}`),this.moved=!0,i.currentTime=h,!(e!=null&&e.gap)){const p=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${h}`),m={type:se.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,buffer:a.len,bufferInfo:a};e&&("fragment"in e?m.part=e:m.frag=e),this.hls.trigger(T.ERROR,m)}return h}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:i}=this,s=t?.config;if(!n||!s)return 0;const o=n.currentTime;if(this.nudgeRetry++,i<s.nudgeMaxRetry){const a=o+(i+1)*s.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${o} to ${a}`);this.warn(l.message),n.currentTime=a,t.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const a=new Error(`Playhead still not moving while enough data buffered @${o} after ${s.nudgeMaxRetry} nudges`);this.error(a.message),t.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:a,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Gp(r,e){const t=Hp(r.main);if(t&&t.start<=e)return t;const n=Hp(r.audio);return n&&n.start<=e?n:null}function Hp(r){if(!r)return null;switch(r.state){case j.IDLE:case j.STOPPED:case j.ENDED:case j.ERROR:return null}return r.frag}function _o(r,e){return e.getAppendedFrag(r,ee.MAIN)||e.getPartialFragment(r)}const qw=.25;
vendor: 1,233 bytes, line 59
59function Lu(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Rc(r,e,t,n,i){let s=new r(e,t,"");try{s.value=n,i&&(s.type=i)}catch{s=new r(e,t,Oe(i?Ie({type:i},n):n))}return s}const Ro=(()=>{const r=Lu();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Xw{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(T.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(T.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;
vendor: 16,611 bytes, line 59
59e&&(e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(T.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var n;this.media=t.media,((n=t.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&hi(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const n=e[t];if(n.kind==="metadata"&&n.label==="id3")return Av(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Lu();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===Ht.emsg&&!n||!i)continue;const c=Qy(s[a].data),u=s[a].pts;let d=u+s[a].duration;d>Ro&&(d=Ro),d-u<=0&&(d=u+qw);for(let h=0;h<c.length;h++){const p=c[h];if(!Jy(p)){this.updateId3CueEnds(u,l);const m=Rc(o,u,d,p,l);m&&this.id3Track.addCue(m)}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const o=i[s];o.type===t&&o.startTime<e&&o.endTime===Ro&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(s&&(a||l)){let c;i==="audio"?c=u=>u.type===Ht.audioId3&&l:i==="video"?c=u=>u.type===Ht.emsg&&a:c=u=>u.type===Ht.audioId3&&l||u.type===Ht.emsg&&a,_u(s,t,n,c)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:i,enableDateRangeMetadataCues:s,interstitialsController:o}=this.hls.config;if(!s)return;const a=Lu();if(n&&i&&!o){const{fragmentStart:m,fragmentEnd:g}=e;let y=this.assetCue;y?(y.startTime=m,y.endTime=g):a&&(y=this.assetCue=Rc(a,m,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),y&&(y.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(y),y.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:c}=e,u=Object.keys(c);let d=this.dateRangeCuesAppended;if(l&&t){var f;if((f=l.cues)!=null&&f.length){const m=Object.keys(d).filter(g=>!u.includes(g));for(let g=m.length;g--;){var h;const y=m[g],v=(h=d[y])==null?void 0:h.cues;delete d[y],v&&Object.keys(v).forEach(E=>{const b=v[E];if(b){b.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(b)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const p=e.fragments[e.fragments.length-1];if(!(u.length===0||!Q(p?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let m=0;m<u.length;m++){const g=u[m],y=c[g],v=y.startTime,E=d[g],b=E?.cues||{};let _=E?.durationKnown||!1,I=Ro;const{duration:S,endDate:A}=y;if(A&&S!==null)I=v+S,_=!0;else if(y.endOnNext&&!_){const L=u.reduce((C,O)=>{if(O!==y.id){const D=c[O];if(D.class===y.class&&D.startDate>y.startDate&&(!C||y.startDate<C.startDate))return D}return C},null);L&&(I=L.startTime,_=!0)}const R=Object.keys(y.attr);for(let L=0;L<R.length;L++){const C=R[L];if(!yR(C))continue;const O=b[C];if(O)_&&!(E!=null&&E.durationKnown)?O.endTime=I:Math.abs(O.startTime-v)>.01&&(O.startTime=v,O.endTime=I);else if(a){let D=y.attr[C];vR(C)&&(D=ly(D));const M=Rc(a,v,I,{key:C,data:D},Ht.dateRange);M&&(M.id=g,this.id3Track.addCue(M),b[C]=M,o&&(C==="X-ASSET-LIST"||C==="X-ASSET-URL")&&M.addEventListener("enter",this.onEventCueEnter))}}d[g]={cues:b,dateRange:y,durationKnown:_}}}}}class Qw{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:o}=this.config;if(!s||o===1||!n.live)return;const a=this.targetLatency;if(a===null)return;const l=i-a,c=Math.min(this.maxLatency,a+n.targetduration);if(l<c&&l>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,o)),f=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,h=Math.min(d,Math.max(1,f));this.changeMediaPlaybackRate(t,h)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let c=a&&n||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=s!==void 0?s:o*i);const u=i;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const n=this.levelDetails;if(n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,o=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,s),a)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(T.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(T.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var n;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,i;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Jw extends Pd{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this),e.on(T.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this),e.off(T.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const n=this.hls.config.preferManagedMediaSource,i=[],s={},o={};let a=!1,l=!1,c=!1;t.levels.forEach(u=>{const d=u.attrs;let{audioCodec:f,videoCodec:h}=u;f&&(u.audioCodec=f=ha(f,n)||void 0),h&&(h=u.videoCodec=O_(h));const{width:p,height:m,unknownCodecs:g}=u,y=g?.length||0;if(a||(a=!!(p&&m)),l||(l=!!h),c||(c=!!f),y||f&&!this.isAudioSupported(f)||h&&!this.isVideoSupported(h)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:v,"FRAME-RATE":E,"HDCP-LEVEL":b,"PATHWAY-ID":_,RESOLUTION:I,"VIDEO-RANGE":S}=d,R=`${`${_||"."}-`}${u.bitrate}-${I}-${E}-${v}-${S}-${b}`;if(s[R])if(s[R].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const L=o[R]+=1;u.attrs["PATHWAY-ID"]=new Array(L+1).join(".");const C=this.createLevel(u);s[R]=C,i.push(C)}else s[R].addGroupId("audio",d.AUDIO),s[R].addGroupId("text",d.SUBTITLES);else{const L=this.createLevel(u);s[R]=L,o[R]=1,i.push(L)}}),this.filterAndSortMediaOptions(i,t,a,l,c)}createLevel(e){const t=new vs(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(i.message),t.supportedResult=by(i,[])}return t}isAudioSupported(e){return gs(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return gs(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,i,s){var o;let a=[],l=[],c=e;const u=((o=t.stats)==null?void 0:o.parsing)||{};if((n||i)&&s&&(c=c.filter(({videoCodec:v,videoRange:E,width:b,height:_})=>(!!v||!!(b&&_))&&z_(E))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let v="no level with compatible codecs found in manifest",E=v;t.levels.length&&(E=`one or more CODECS in variant not supported: ${Oe(t.levels.map(_=>_.attrs.CODECS).filter((_,I,S)=>S.indexOf(_)===I))}`,this.warn(E),v+=` (${E})`);const b=new Error(v);this.hls.trigger(T.ERROR,{type:se.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:b,reason:E})}}),u.end=performance.now();return}t.audioTracks&&(a=t.audioTracks.filter(v=>!v.audioCodec||this.isAudioSupported(v.audioCodec)),zp(a)),t.subtitles&&(l=t.subtitles,zp(l));const d=c.slice(0);c.sort((v,E)=>{if(v.attrs["HDCP-LEVEL"]!==E.attrs["HDCP-LEVEL"])return(v.attrs["HDCP-LEVEL"]||"")>(E.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&v.height!==E.height)return v.height-E.height;if(v.frameRate!==E.frameRate)return v.frameRate-E.frameRate;if(v.videoRange!==E.videoRange)return pa.indexOf(v.videoRange)-pa.indexOf(E.videoRange);if(v.videoCodec!==E.videoCodec){const b=Mh(v.videoCodec),_=Mh(E.videoCodec);if(b!==_)return _-b}if(v.uri===E.uri&&v.codecSet!==E.codecSet){const b=fa(v.codecSet),_=fa(E.codecSet);if(b!==_)return _-b}return v.averageBitrate!==E.averageBitrate?v.averageBitrate-E.averageBitrate:0});let f=d[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==d.length)){for(let v=0;v<d.length;v++)if(d[v].pathwayId===c[0].pathwayId){f=d[v];break}}this._levels=c;for(let v=0;v<c.length;v++)if(c[v]===f){var h;this._firstLevel=v;const E=f.bitrate,b=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${E}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const _=Math.min(E,this.hls.config.abrEwmaDefaultEstimateMax);_>b&&b===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=_)}break}const p=s&&!i,m=this.hls.config,g=!!(m.audioStreamController&&m.audioTrackController),y={levels:c,audioTracks:a,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:g&&!p&&a.some(v=>!!v.url)};u.end=performance.now(),this.hls.trigger(T.MANIFEST_PARSED,y)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:u,reason:u.message}),d)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&i&&s===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${n}${s?" with Pathway "+s:""}`);const l={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(T.LEVEL_SWITCHING,l);const c=o.details;if(!c||c.live){const u=this.switchParams(o.uri,i?.details,c);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),n=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===be.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,o=t.levelInfo;if(!o){var a;this.warn(`Invalid level index ${i}`),(a=t.deliveryDirectives)!=null&&a.skip&&(s.deltaUpdateFailed=!0);return}if(o===this.currentLevel||t.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let l=o.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(i,t,l)}
vendor: 4,569 bytes, line 59
59else(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],o=e.details,a=o?.age;this.log(`Loading level index ${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${n}`),this.hls.trigger(T.LEVEL_LOADING,{url:n,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const n=this._levels.filter((s,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(a=>a.level=-1)),!1));Vy(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(T.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(T.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function zp(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function Nv(){return self.SourceBuffer||self.WebKitSourceBuffer}function Fv(){if(!hr())return!1;const e=Nv();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Zw(){if(!Fv())return!1;const r=hr();return typeof r?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(ys(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(ys(e,"audio"))))}function e1(){var r;const e=Nv();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const t1=100;class n1 extends Rd{constructor(e,t,n){super(e,t,n,"stream-controller",ee.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const i=this.media,s=i?i.currentTime:null;if(s===null||!Q(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const o=this.getFwdBufferInfoAtPos(i,s,ee.MAIN,0);if(o===null||o.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${o?o.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this),e.on(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this),e.off(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}
vendor: 10,884 bytes, line 59
59startLoad(e,t){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(t1),this.level=-1,!this.startFragRequested){let s=i.startLevel;s===-1&&(i.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=i.firstAutoLevel),i.nextLoadLevel=s,this.level=i.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=j.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=j.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case j.WAITING_LEVEL:{const{levels:e,level:t}=this,n=e?.[t],i=n?.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=j.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=j.IDLE;break}break}case j.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===j.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[s]))return;const o=n[s],a=this.getMainFwdBufferInfo();if(a===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(a,l)){const m={};this.altAudio===2&&(m.type="video"),this.hls.trigger(T.BUFFER_EOS,m),this.state=j.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const c=o.details;if(!c||this.state===j.WAITING_LEVEL||this.waitForLive(o)){this.level=s,this.state=j.WAITING_LEVEL,this.startFragRequested=!1;return}const u=a.len,d=this.getMaxBufferLength(o.maxBitrate);if(u>=d)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:a.end;let h=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&h&&We(h)&&this.fragmentTracker.getState(h)!==nt.OK){var p;const g=((p=this.backtrackFragment)!=null?p:h).sn-c.startSN,y=c.fragments[g-1];y&&h.cc===y.cc&&(h=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(h&&this.isLoopLoading(h,f)){if(!h.gap){const g=this.audioOnly&&!this.altAudio?Pe.AUDIO:Pe.VIDEO,y=(g===Pe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,g,ee.MAIN)}h=this.getNextFragmentLoopLoading(h,c,a,ee.MAIN,d)}h&&(h.initSegment&&!h.initSegment.data&&!this.bitrateTest&&(h=h.initSegment),this.loadFragment(h,o,f))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);i===nt.NOT_LOADED||i===nt.PARTIAL?We(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ee.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<s.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],c=this.fragLastKbps;c&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,c=a.duration,u=Math.max(o.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case j.KEY_LOADING:case j.FRAG_LOADING:case j.FRAG_LOADING_WAITING_RETRY:case j.PARSING:case j.PARSED:this.state=j.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const n=t.media;Lt(n,"playing",this.onMediaPlaying),Lt(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(Ft(n,"playing",this.onMediaPlaying),Ft(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(T.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,i=!1;for(let s=0;s<t.levels.length;s++){const o=t.levels[s].audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,i=i||o.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&i&&!e1(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:n}=this;if(!n||this.state!==j.IDLE)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=j.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i,startFragRequested:s}=this,o=t.level,a=t.details,l=a.totalduration;if(!i){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${l}`);const c=t.levelInfo,u=this.fragCurrent;u&&(this.state===j.FRAG_LOADING||this.state===j.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let d=0;if(a.live||(n=c.details)!=null&&n.live){var f;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,c.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(c.details=a,this.levelLastLoaded=c,s||this.setStartPosition(a,d),this.hls.trigger(T.LEVEL_UPDATED,{details:a,level:o}),this.state===j.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=j.IDLE}s&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=this.getLoadPosition(),o=e.fragmentStart,a=e.edge,l=s>=o-t.maxFragLookUpTolerance&&s<=a;if(i!==null&&n.duration>i&&(s<i||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!l&&n.readyState<4||s<a-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),n.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var c;const d=de.bufferInfo(n,i,0);if(!((c=d.buffered)!=null&&c.length)){n.currentTime=i;return}if(d.start<=s){n.currentTime=i;return}const{nextStart:h}=de.bufferedInfo(d.buffered,s,0);h&&(n.currentTime=h)}else n.currentTime=i}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:s}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const a=o[n.level];if(!a){this.warn(`Level ${n.level} not found on progress`);return}const l=a.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const c=a.videoCodec,u=l.PTSKnown||!l.live,d=(t=n.initSegment)==null?void 0:t.data,f=this._getAudioCodec(a),h=this.transmuxer=this.transmuxer||new cv(this.hls,ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,m=p!==-1,g=new Sd(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,m),y=this.initPTS[n.cc];h.push(s,d,f,c,n,i,l.totalduration,u,g,y)}onAudioTrackSwitching(e,t){const n=this.hls,i=this.altAudio!==0;if(ma(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(T.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(T.AUDIO_TRACK_SWITCHED,t)}),n.trigger(T.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(T.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=ma(t.url,this.hls);if(n){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,o=!1;for(const a in n){const l=n[a];if(l.id==="main"){if(s=a,i=l,a==="video"){const c=n[a];c&&(this.videoBuffer=c.buffer)}}else o=!0}o&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t,s=n.type===ee.MAIN;if(s){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===j.PARSED&&(this.state=j.IDLE);return}const a=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),We(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const o=this.media;o&&(!this._hasEnoughToStart&&de.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.
vendor: 4,155 bytes, line 59
59KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ee.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===be.LEVEL&&(this.state=j.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=j.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Pe.AUDIO||!this.altAudio){const n=(t===Pe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,ee.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=this.timelineOffset;i&&n&&(n+=i);const s=this.getLevelDetails(),o=de.getBuffered(e),a=o.length?o.start(0):0,l=a-n,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<c||this.loadingParts&&l<2*(s?.partTarget||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),n+=l,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${a}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{const{hls:i}=this,s=n?.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=j.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=s.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),i.trigger(T.FRAG_LOADED,n),s.bitrateTest=!1}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:i,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o){this.resetWhenMissingContext(s);return}const{frag:a,part:l,level:c}=o,{video:u,text:d,id3:f,initSegment:h}=i,{details:p}=c,m=this.altAudio?void 0:i.audio;if(this.fragContextChanged(a)){this.fragmentTracker.removeFragment(a);return}if(this.state=j.PARSING,h){const g=h.tracks;if(g){const b=a.initSegment||a;if(this.unhandledEncryptionError(h,a))return;this._bufferInitSegment(c,g,b,s),n.trigger(T.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:t,tracks:g})}const y=h.initPTS,v=h.timescale,E=this.initPTS[a.cc];if(Q(y)&&(!E||E.baseTime!==y||E.timescale!==v)){const b=h.trackId;this.initPTS[a.cc]={baseTime:y,timescale:v,trackId:b},n.trigger(T.INIT_PTS_FOUND,{frag:a,id:t,initPTS:y,timescale:v,trackId:b})}}if(u&&p){m&&u.type==="audiovideo"&&this.logMuxedErr(a);const g=p.fragments[a.sn-1-p.startSN],y=a.sn===p.startSN,v=!g||a.cc>g.cc;if(i.independent!==!1){const{startPTS:E,endPTS:b,startDTS:_,endDTS:I}=u;if(l)l.elementaryStreams[u.type]={startPTS:E,endPTS:b,startDTS:_,endDTS:I};else if(u.firstKeyFrame&&u.independent&&s.id===1&&!v&&(this.couldBacktrack=!0),u.dropped&&u.independent){const S=this.getMainFwdBufferInfo(),A=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,R=u.firstKeyFramePTS?u.firstKeyFramePTS:E;if(!y&&A<R-this.config.maxBufferHole&&!v){this.backtrack(a);return}else v&&(a.gap=!0);a.setElementaryStreamInfo(u.type,a.start,b,a.start,I,!0)}
vendor: 20,132 bytes, line 59
59else y&&E-(p.appliedTimelineOffset||0)>Yo&&(a.gap=!0);a.setElementaryStreamInfo(u.type,E,b,_,I),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(u,a,l,s,y||v)}else if(y||v)a.gap=!0;else{this.backtrack(a);return}}if(m){const{startPTS:g,endPTS:y,startDTS:v,endDTS:E}=m;l&&(l.elementaryStreams[Pe.AUDIO]={startPTS:g,endPTS:y,startDTS:v,endDTS:E}),a.setElementaryStreamInfo(Pe.AUDIO,g,y,v,E),this.bufferFragmentData(m,a,l,s)}if(p&&f!=null&&f.samples.length){const g={id:t,frag:a,details:p,samples:f.samples};n.trigger(T.FRAG_PARSING_METADATA,g)}if(p&&d){const g={id:t,frag:a,details:p,samples:d.samples};n.trigger(T.FRAG_PARSING_USERDATA,g)}}logMuxedErr(e){this.warn(`${We(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,i){if(this.state!==j.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:s,video:o,audiovideo:a}=t;if(s){const c=e.audioCodec;let u=Vo(s.codec,c);u==="mp4a"&&(u="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),c&&c!==u&&this.log(`Swapping manifest audio codec "${c}" for "${u}"`),s.levelCodec=u,s.id=ee.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${u||""}/${c||""}/${s.codec}]`),delete t.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=ee.MAIN;const c=o.codec;if(c?.length===4)switch(c){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${c}]${o.codec!==c?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete t.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(T.BUFFER_CODECS,t),!this.hls)return;l.forEach(c=>{const d=t[c].initSegment;d!=null&&d.byteLength&&this.hls.trigger(T.BUFFER_APPENDING,{type:c,data:d,frag:n,part:null,chunkMeta:i,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,ee.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e?.[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=j.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(de.isBuffered(e,n)?t=this.getAppendedFrag(n):de.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(T.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(T.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Q(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Q(t)){const n=this.getLevelDetails(),i=this.currentFrag||(n?Kr(null,n.fragments,t):null);if(i){const s=i.programDateTime;if(s!==null){const o=s+(t-i.start)*1e3;return new Date(o)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class r1 extends nn{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=$.KEY_LOAD_ERROR,n,i,s){return new On({type:se.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,s=t.length;i<s;i++){const o=t[i];if(e.cc<=o.cc&&(!We(e)||!We(o)||e.sn<o.sn)||!n&&i==s-1)return this.emeController.selectKeySystemFormat(o).then(a=>{if(!this.emeController)return;o.setKeyFormat(a);const l=Ho(a);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const i=ji(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,c))}const o=s.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));const a=Ic(s);let l=this.keyIdToKeyInfo[a];if((n=l)!=null&&n.decryptdata.key)return s.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(i=l)!=null&&i.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:d}=u;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${s.keyId?" keyId: "+ht(s.keyId):""} URI: ${s.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[a]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&(i=t.initSegment)!=null&&i.data){const o=S_(t.initSegment.data);if(o.length){let a=o[0];a.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${ht(a)}`),lr.setKeyIdForUri(e.decryptdata.uri,a)):(a=lr.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${ht(a)}`)),e.decryptdata.keyId=a}}if(!e.decryptdata.keyId&&!We(t))return Promise.resolve(n);const s=this.emeController.loadKey(n);return(e.keyLoadPromise=s.then(o=>(e.mediaKeySessionContext=o,n))).catch(o=>{throw e.keyLoadPromise=null,"data"in o&&(o.data.frag=t),o})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=n.keyLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,m)=>{const{frag:g,keyInfo:y}=p,v=Ic(y.decryptdata);if(!g.decryptdata||y!==this.keyIdToKeyInfo[v])return a(this.createKeyLoadError(g,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));y.decryptdata.key=g.decryptdata.key=new Uint8Array(f.data),g.keyLoader=null,y.loader=null,o({frag:g,keyInfo:y})},onError:(f,h,p,m)=>{this.resetLoader(h),a(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),p,Ie({url:l.url,data:void 0},f)))},onTimeout:(f,h,p)=>{this.resetLoader(h),a(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(f,h,p)=>{this.resetLoader(h),a(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};s.load(l,u,d)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null);const o=Ic(n.decryptdata)||i;delete this.keyIdToKeyInfo[o],s&&s.destroy()}}function Ic(r){if(r.keyFormat!==pt.FAIRPLAY){const e=r.keyId;if(e)return ht(e)}return r.uri}function Kp(r){const{type:e}=r;switch(e){case be.AUDIO_TRACK:return ee.AUDIO;case be.SUBTITLE_TRACK:return ee.SUBTITLE;default:return ee.MAIN}}function Lc(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class i1{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(T.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(T.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,o=new s(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:be.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:o,deliveryDirectives:a,levelInfo:l}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:be.LEVEL,url:o,deliveryDirectives:a,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o,track:a}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:be.AUDIO_TRACK,url:s,deliveryDirectives:o,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o,track:a}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:be.SUBTITLE_TRACK,url:s,deliveryDirectives:o,levelOrTrack:a})}onLevelsUpdated(e,t){const n=this.loaders[be.LEVEL];if(n){const i=n.context;i&&!t.levels.some(s=>s===i.levelOrTrack)&&(n.abort(),delete this.loaders[be.LEVEL])}}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=this.hls.logger,u=i.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?c.log(`[playlist-loader]: ignore ${e.url} ongoing request`):c.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}c.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===be.MANIFEST?s=n.manifestLoadPolicy.default:s=ke({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),Q((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===be.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===be.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===be.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const u=c.partTarget,d=c.targetduration;if(u&&d){const f=Math.max(u*3,d*.8)*1e3;s=ke({},s,{maxTimeToFirstByteMs:Math.min(f,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(c,u,d,f)=>{const h=this.getInternalLoader(d);this.resetInternalLoader(d.type);const p=c.data;u.parsing.start=performance.now(),En.isMediaPlaylist(p)||d.type!==be.MANIFEST?this.handleTrackOrLevelPlaylist(c,u,d,f||null,h):this.handleMasterPlaylist(c,u,d,f)},onError:(c,u,d,f)=>{this.handleNetworkError(u,d,!1,c,f)},onTimeout:(c,u,d)=>{this.handleNetworkError(u,d,!0,void 0,c)}};i.load(e,a,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,i){const s=this.hls,o=e.data,a=Lc(e,n),l=En.parseMasterPlaylist(o,a);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,l.playlistParsingError,i,t);return}const{contentSteering:c,levels:u,sessionData:d,sessionKeys:f,startTimeOffset:h,variableList:p}=l;this.variableList=p,u.forEach(v=>{const{unknownCodecs:E}=v;if(E){const{preferManagedMediaSource:b}=this.hls.config;let{audioCodec:_,videoCodec:I}=v;for(let S=E.length;S--;){const A=E[S];gs(A,"audio",b)?(v.audioCodec=_=_?`${_},${A}`:A,Ri.audio[_.substring(0,4)]=2,E.splice(S,1)):gs(A,"video",b)&&(v.videoCodec=I=I?`${I},${A}`:A,Ri.video[I.substring(0,4)]=2,E.splice(S,1))}}});const{AUDIO:m=[],SUBTITLES:g,"CLOSED-CAPTIONS":y}=En.parseMasterPlaylistMedia(o,a,l);m.length&&!m.some(E=>!E.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ve({}),bitrate:0,url:""})),s.trigger(T.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:g,captions:y,contentSteering:c,url:a,stats:t,networkDetails:i,sessionData:d,sessionKeys:f,startTimeOffset:h,variableList:p})}handleTrackOrLevelPlaylist(e,t,n,i,s){const o=this.hls,{id:a,level:l,type:c}=n,u=Lc(e,n),d=Q(l)?l:Q(a)?a:0,f=Kp(n),h=En.parseLevelPlaylist(e.data,u,d,f,0,this.variableList);if(c===be.MANIFEST){const p={attrs:new Ve({}),bitrate:0,details:h,name:"",url:u};h.requestScheduled=t.loading.start+By(h,0),o.trigger(T.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=h,this.handlePlaylistLoaded(h,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(T.ERROR,{type:se.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===be.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let o=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===be.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===be.AUDIO_TRACK||e.type===be.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let l=$.UNKNOWN,c=!1;const u=this.getInternalLoader(e);switch(e.type){case be.MANIFEST:l=n?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,c=!0;break;case be.LEVEL:l=n?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,c=!1;break;case be.AUDIO_TRACK:l=n?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case be.SUBTITLE_TRACK:l=n?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,c=!1;break}u&&this.resetInternalLoader(e.type);const d={type:se.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:u,context:e,error:a,networkDetails:t,stats:s};if(i){const f=t?.url||e.url;d.response=Ie({url:f,data:void 0},i)}this.hls.trigger(T.ERROR,d)}handlePlaylistLoaded(e,t,n,i,s,o){const a=this.hls,{type:l,level:c,levelOrTrack:u,id:d,groupId:f,deliveryDirectives:h}=i,p=Lc(t,i),m=Kp(i);let g=typeof i.level=="number"&&m===ee.MAIN?c:void 0;const y=e.playlistParsingError;if(y){if(this.hls.logger.warn(`${y} ${e.url}`),!a.config.ignorePlaylistParsingErrors){a.trigger(T.ERROR,{type:se.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:t,context:i,level:g,parent:m,networkDetails:s,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){const v=e.playlistParsingError=new Error("No Segments found in Playlist");a.trigger(T.ERROR,{type:se.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:v,reason:v.message,response:t,context:i,level:g,parent:m,networkDetails:s,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case be.MANIFEST:case be.LEVEL:if(g){if(!u)g=0;else if(u!==a.levels[g]){const v=a.levels.indexOf(u);v>-1&&(g=v)}}a.trigger(T.LEVEL_LOADED,{details:e,levelInfo:u||a.levels[0],level:g||0,id:d||0,stats:n,networkDetails:s,deliveryDirectives:h,withoutMultiVariant:l===be.MANIFEST});break;case be.AUDIO_TRACK:a.trigger(T.AUDIO_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case be.SUBTITLE_TRACK:a.trigger(T.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}class wr{static get version(){return Es}static isMSESupported(){return Fv()}static isSupported(){return Zw()}static getMediaSource(){return hr()}static get Events(){return T}static get MetadataSchema(){return Ht}static get ErrorTypes(){return se}static get ErrorDetails(){return $}static get DefaultConfig(){return wr.defaultConfig?wr.defaultConfig:Vw}static set DefaultConfig(e){wr.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Id,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=u_(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=Hw(wr.DefaultConfig,e,t);this.userConfig=e,n.progressive&&zw(n,t);const{abrController:i,bufferController:s,capLevelController:o,errorController:a,fpsController:l}=n,c=new a(this),u=this.abrController=new i(this),d=new sR(this),f=n.interstitialsController,h=f?this.interstitialsController=new f(this,wr):null,p=this.bufferController=new s(this,d),m=this.capLevelController=new o(this),g=new l(this),y=new i1(this),v=n.contentSteeringController,E=v?new v(this):null,b=this.levelController=new Jw(this,E),_=new Xw(this),I=new r1(this.config,this.logger),S=this.streamController=new n1(this,d,I),A=this.gapController=new Yw(this,d);
vendor: 7,524 bytes, line 59
59m.setStreamController(S),g.setStreamController(S);const R=[y,b,S];h&&R.splice(1,0,h),E&&R.splice(1,0,E),this.networkControllers=R;const L=[u,p,A,m,g,_,d];this.audioTrackController=this.createController(n.audioTrackController,R);const C=n.audioStreamController;C&&R.push(this.audioStreamController=new C(this,d,I)),this.subtitleTrackController=this.createController(n.subtitleTrackController,R);const O=n.subtitleStreamController;O&&R.push(this.subtititleStreamController=new O(this,d,I)),this.createController(n.timelineController,L),I.emeController=this.emeController=this.createController(n.emeController,L),this.cmcdController=this.createController(n.cmcdController,L),this.latencyController=this.createController(Qw,L),this.coreComponents=L,R.push(c);const D=c.onErrorOut;typeof D=="function"&&this.on(T.ERROR,D,c),this.on(T.MANIFEST_LOADED,y.onManifestLoaded,y)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===T.ERROR;this.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(T.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(T.ERROR,{type:se.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,i=t?e:{media:n};this._media=n,this.trigger(T.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(T.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(T.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,n=this._url,i=this._url=md.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(T.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[ee.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[ee.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[ee.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=YL()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){H_(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;
59if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const o=e[s].attrs["HDCP-LEVEL"];if(o&&o<=n)return s}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const n=Ay(t);return Ty(e,n,navigator.mediaCapabilities)}}wr.defaultConfig=void 0;const Bv=k.createContext(null),wc={didCatch:!1,error:null};let qO=class extends k.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=wc}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(wc))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:i}=this.props;n&&t.error!==null&&s1(e.resetKeys,i)&&(this.props.onReset?.({next:i,prev:e.resetKeys,reason:"keys"}),this.setState(wc))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:i}=this.props,{didCatch:s,error:o}=this.state;let a=e;if(s){const l={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")a=t(l);else if(n)a=k.createElement(n,l);else if(i!==void 0)a=i;else throw o}return k.createElement(Bv.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},a)}};function s1(r=[],e=[]){return r.length!==e.length||r.some((t,n)=>!Object.is(t,e[n]))}function o1(r){return r!==null&&typeof r=="object"&&"didCatch"in r&&typeof r.didCatch=="boolean"&&"error"in r&&"resetErrorBoundary"in r&&typeof r.resetErrorBoundary=="function"}function a1(r){if(!o1(r))throw new Error("ErrorBoundaryContext not found")}function QO(){const r=k.useContext(Bv);a1(r);const{error:e,resetErrorBoundary:t}=r,[n,i]=k.useState({error:null,hasError:!1}),s=k.useMemo(()=>({error:e,resetBoundary:()=>{t(),i({error:null,hasError:!1})},showBoundary:o=>i({error:o,hasError:!0})}),[e,t]);if(n.hasError)throw n.error;return s}var Ui={},Vi={},jp;function l1(){return jp||(jp=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.regionAPIs=void 0,Vi.regionAPIs=new Map([["us","https://api-iam.intercom.io"],["eu","https://api-iam.eu.intercom.io"],["ap","https://api-iam.au.intercom.io"]])),Vi}var kn={},Wp;function c1(){if(Wp)return kn;Wp=1;var r=kn&&kn.__awaiter||function(o,a,l,c){function u(d){return d instanceof l?d:new l(function(f){f(d)})}return new(l||(l=Promise))(function(d,f){function h(g){try{m(c.next(g))}catch(y){f(y)}}function p(g){try{m(c.throw(g))}catch(y){f(y)}}function m(g){g.done?d(g.value):u(g.value).then(h,p)}m((c=c.apply(o,a||[])).next())})};Object.defineProperty(kn,"__esModule",{value:!0}),kn.ref=kn.init=void 0;const e="_intercom_npm_loader",t=function(){t.loaderQueue(arguments)};t.q=[],t.loaderQueue=function(o){t.q.push(o)};const n=function(o){var a,l,c=document;
59if(!c.getElementById(e)){var u=c.createElement("script");u.type="text/javascript",u.async=!0,u.id=e,u.src=o||"https://widget.intercom.io/widget/"+((a=window.intercomSettings)===null||a===void 0?void 0:a.app_id);var d=c.getElementsByTagName("script")[0];(l=d.parentNode)===null||l===void 0||l.insertBefore(u,d)}},i=()=>document.readyState==="complete"||document.readyState==="interactive",s=(...o)=>r(void 0,[...o],void 0,function*(a={}){var l=window,c=l.Intercom;l.intercomSettings&&(l.intercomSettings.installation_type="npm-package"),typeof c=="function"?(c("reattach_activator"),c("update",l.intercomSettings)):(l.Intercom=t,i()?n(a.widgetUrl):(document.addEventListener("readystatechange",function(){i()&&n(a.widgetUrl)}),l.attachEvent?l.attachEvent("onload",()=>n(a.widgetUrl)):l.addEventListener("load",()=>n(a.widgetUrl),!1)))});return kn.init=s,kn.ref=void 0,kn}var Yp;function u1(){return Yp||(Yp=1,(function(r){var e=Ui&&Ui.__rest||function(D,P){var M={};for(var N in D)Object.prototype.hasOwnProperty.call(D,N)&&P.indexOf(N)<0&&(M[N]=D[N]);if(D!=null&&typeof Object.getOwnPropertySymbols=="function")for(var F=0,N=Object.getOwnPropertySymbols(D);F<N.length;
59F++)P.indexOf(N[F])<0&&Object.prototype.propertyIsEnumerable.call(D,N[F])&&(M[N[F]]=D[N[F]]);return M};Object.defineProperty(r,"__esModule",{value:!0}),r.hideNotifications=r.onUserEmailSupplied=r.showConversation=r.showTicket=r.startChecklist=r.startSurvey=r.showNews=r.showArticle=r.startTour=r.whoami=r.getVisitorId=r.trackEvent=r.onUnreadCountChange=r.onShow=r.onHide=r.showNewMessage=r.showMessages=r.showSpace=r.show=r.hide=r.update=r.shutdown=r.boot=r.Intercom=void 0;const t=l1(),n=c1(),i=(D,...P)=>{if(typeof window!==void 0&&window.Intercom)return window.Intercom(D,...P);console.warn("Please ensure Intercom is setup and running on client-side!")},s=D=>{if(typeof D!="object"){console.warn("Intercom initialiser called with invalid parameters.");return}const{region:P="us",widgetUrl:M}=D,N=e(D,["region","widgetUrl"]);typeof window<"u"&&!n.ref&&(window.intercomSettings=Object.assign(Object.assign({},N),{api_base:t.regionAPIs.get(P)}),(0,n.init)({widgetUrl:M}))};r.Intercom=s,r.default=r.Intercom;const o=D=>i("boot",D);r.boot=o;const a=()=>i("shutdown");r.shutdown=a;const l=D=>i("update",D);r.update=l;const c=()=>i("hide");r.hide=c;const u=()=>i("show");r.show=u;const d=D=>i("showSpace",D);r.showSpace=d;const f=()=>i("showMessages");r.showMessages=f;const h=D=>i("showNewMessage",D);r.showNewMessage=h;const p=D=>i("onHide",D);r.onHide=p;const m=D=>i("onShow",D);r.onShow=m;const g=D=>i("onUnreadCountChange",D);r.onUnreadCountChange=g;const y=(...D)=>i("trackEvent",...D);r.trackEvent=y;const v=()=>i("getVisitorId");r.getVisitorId=v;const E=()=>i("whoami");r.whoami=E;const b=D=>i("startTour",D);r.startTour=b;const _=D=>i("showArticle",D);r.showArticle=_;const I=D=>i("showNews",D);r.showNews=I;const S=D=>i("startSurvey",D);r.startSurvey=S;const A=D=>i("startChecklist",D);r.startChecklist=A;const R=D=>i("showTicket",D);r.showTicket=R;const L=D=>i("showConversation",D);r.showConversation=L;const C=D=>i("onUserEmailSupplied",D);r.onUserEmailSupplied=C;const O=D=>i("hideNotifications",D);r.hideNotifications=O})(Ui)),Ui}var d1=u1();const JO=rd(d1),f1="_input_11gi3_1",h1="_icon_11gi3_21",qp={input:f1,icon:h1},ZO=k.forwardRef(function({id:e,labelSlot:t,className:n,lableClass:i="text-xs",error:s,variant:o="square",size:a="md",...l},c){return V.jsxs("div",{children:[V.jsxs("div",{className:Ee("relative flex cursor-pointer items-center","has-disabled:text-text-checkbox-disabled has-disabled:cursor-default","has-checked:text-text-checkbox-active"),children:[V.jsxs("div",{className:"relative flex items-start justify-center",children:[V.jsx("input",{type:"checkbox",id:e,ref:c,className:Ee(qp.input,"border-border-primary cursor-pointer rounded border-2 focus:ring-0",{"border-ui-red-normal":!!s,"rounded-full":o==="circle","h-4 w-4":a==="sm","h-6 w-6 ":a==="md"},n),...l}),V.jsx(St,{name:"tick-line",size:"sm",className:Ee(qp.icon,"absolute left-1/2 top-1/2 hidden -translate-x-1/2 -translate-y-1/2 transform")})]}),t&&V.jsx("label",{htmlFor:e,className:Ee("text-text-secondary ml-2",i),children:t})]}),s?V.jsx("span",{className:"text-ui-red-normal text-xxs font-semibold",children:s.message}):null]})});function Xp(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function p1(r,e,t){return e=Aa(e),(function(n,i){if(i&&(typeof i=="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s})(n)})(r,Vv()?Reflect.construct(e,t||[],Aa(r).constructor):e.apply(r,t))}function m1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function g1(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function $v(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=(function(l,c){if(l){if(typeof l=="string")return Xp(l,c);var u={}.toString.call(l).slice(8,-1);return u==="Object"&&l.constructor&&(u=l.constructor.name),u==="Map"||u==="Set"?Array.from(l):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?Xp(l,c):void 0}})(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:i}
59}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
60In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function Uv(r,e,t){return(e=(function(n){var i=(function(s,o){if(typeof s!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var l=a.call(s,o);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(s)})(n,"string");return typeof i=="symbol"?i:i+""})(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Aa(r){return Aa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Aa(r)}function y1(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&wu(r,e)}function Vv(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(Vv=function(){return!!r})()}function Qp(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,n)}return t}function Io(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qp(Object(t),!0).forEach((function(n){Uv(r,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qp(Object(t)).forEach((function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))}))}return r}function v1(r,e){if(r==null)return{};var t,n,i=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function wu(r,e){return wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},wu(r,e)}function ts(r,e){var t,n=e.replacementChars,i=e.replacement,s=e.separate,o=n,a="",l=$v(r);try{for(l.s();!(t=l.n()).done;){var c,u=t.value,d=!Object.prototype.hasOwnProperty.call(i,u)&&((c=i[o[0]])===null||c===void 0?void 0:c.test(u));(s&&u===o[0]||d)&&(o=o.slice(1),a+=u)}}catch(f){l.e(f)}finally{l.f()}return a}function Gv(r,e){var t,n=e.mask,i=e.replacement,s=e.separate,o=e.showMask,a=0,l="",c=$v(n);try{for(c.s();!(t=c.n()).done;){var u=t.value;if(!o&&r[a]===void 0)break;Object.prototype.hasOwnProperty.call(i,u)&&r[a]!==void 0?l+=r[a++]:l+=u}}catch(f){c.e(f)}finally{c.f()}if(s&&!o){for(var d=n.length-1;d>=0&&l[d]===n[d];d--);l=l.slice(0,d+1)}return l}function Hv(r,e){for(var t=e.mask,n=e.replacement,i=[],s=0;s<t.length;s++){var o,a=(o=r[s])!==null&&o!==void 0?o:t[s],l=Object.prototype.hasOwnProperty.call(n,a)?"replacement":r[s]!==void 0&&r[s]!==t[s]?"input":"mask";i.push({type:l,value:a,index:s})}return i}function Oi(r){return r.length>0?Uv({},r,/./):{}}function xu(r,e){for(var t=e.start,n=t===void 0?0:t,i=e.end,s=e.mask,o=e.replacement,a=e.separate,l=r.slice(n,i),c=s.slice(n,i),u="",d=0;d<c.length;d++){var f=Object.prototype.hasOwnProperty.call(o,c[d]);f&&l[d]!==void 0&&l[d]!==c[d]?u+=l[d]:f&&a&&(u+=c[d])}return u}function zv(r,e){var t=e.mask,n=e.replacement,i=typeof n=="string"?Oi(n):n,s=RegExp("[^".concat(Object.keys(i).join(""),"]"),"g");return Gv(ts(r,{replacementChars:t.replace(s,""),replacement:i,separate:!1}),{mask:t,replacement:i,separate:!1,showMask:!1})}function E1(r,e){var t=e.mask,n=e.replacement,i=typeof n=="string"?Oi(n):n,s=xu(r,{mask:t,replacement:i,separate:!1}),o=RegExp("[^".concat(Object.keys(i).join(""),"]"),"g");return ts(s,{replacementChars:t.replace(o,""),replacement:i,separate:!1})}function b1(r,e){var t=e.mask,n=e.replacement,i=typeof n=="string"?Oi(n):n;return Hv(zv(r,{mask:t,replacement:i}),{mask:t,replacement:i})}var T1=["[","]","\\","/","^","$",".","|","?","*","+","(",")","{","}"];function Jp(r){return T1.includes(r)?"\\".concat(r):r}function S1(r,e){for(var t=e.mask,n=e.replacement,i=typeof n=="string"?Oi(n):n,s=r==="partial"||r==="partial-inexact",o=r==="full"||r==="partial",a="",l=0;l<t.length;l++){var c=t[l];l===0&&(a="^"),s&&(a+="("),a+=Object.prototype.hasOwnProperty.call(i,c)?"".concat(o?"(?!".concat(Jp(c),")"):"","(").concat(i[c].source,")"):Jp(c),l===t.length-1&&(s&&(a+=")?".repeat(t.length)),a+="$")}return a}function A1(r,e){return new Proxy(r,{set:function(t,n,i){return n==="current"&&(i!==r.current&&(r.current!==null&&e.unregister(r.current),i!==null&&e.register(i)),t[n]=i,!0)}})}
60function _1(r,e,t){return e=As(e),(function(n,i){if(i&&(typeof i=="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s})(n)})(r,$d()?Reflect.construct(e,t||[],As(r).constructor):e.apply(r,t))}function Kv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function jv(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function R1(r,e,t){return(e=(function(n){var i=(function(s,o){if(typeof s!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var l=a.call(s,o);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(s)})(n,"string");return typeof i=="symbol"?i:i+""})(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function As(r){return As=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},As(r)}function I1(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&_s(r,e)}function $d(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return($d=function(){return!!r})()}function Zp(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,n)}return t}function em(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zp(Object(t),!0).forEach((function(n){R1(r,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Zp(Object(t)).forEach((function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))}))}return r}function L1(r,e){if(r==null)return{};var t,n,i=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function _s(r,e){return _s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},_s(r,e)}function ku(r){var e=typeof Map=="function"?new Map:void 0;return ku=function(t){if(t===null||!(function(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}})(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return(function(i,s,o){if($d())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,s);var l=new(i.bind.apply(i,a));return o&&_s(l,o.prototype),l})(t,arguments,As(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_s(n,t)},ku(r)}var ns=(function(r){function e(t){var n;return Kv(this,e),(n=_1(this,e,[t])).name="SyntheticChangeError",n}return I1(e,r),jv(e)})(ku(Error)),tm,w1=["options"],x1=["text","email","tel","search","url"],Wv=jv((function r(e){var t=e.init,n=e.tracking;Kv(this,r);var i=new WeakMap;this.register=function(s){var o;if(x1.includes(s.type)){var a=(o=s._wrapperState)!==null&&o!==void 0?o:{},l=a.initialValue,c=l===void 0?"":l,u=a.controlled,d=u!==void 0&&u,f=t({initialValue:s.value||c,controlled:d}),h=f.value,p=f.options,m={value:h,options:p,fallbackOptions:p},g={id:-1,cachedId:-1},y={value:"",selectionStart:0,selectionEnd:0},v=Object.getOwnPropertyDescriptor("_valueTracker"in s?s:HTMLInputElement.prototype,"value");Object.defineProperty(s,"value",em(em({},v),{},{set:function(I){var S;y.value=I,v==null||(S=v.set)===null||S===void 0||S.call(s,I)}})),s.value=h;var E=function(){var I=function(){var S,A;y.selectionStart=(S=s.selectionStart)!==null&&S!==void 0?S:0,y.selectionEnd=(A=s.selectionEnd)!==null&&A!==void 0?A:0,g.id=window.setTimeout(I)};g.id=window.setTimeout(I)},b=function(){window.clearTimeout(g.id),g.id=-1,g.cachedId=-1},_=function(I){try{var S,A;if(g.cachedId===g.id)throw new ns("The input selection has not been updated.");g.cachedId=g.id;var R=s.value,L=s.selectionStart,C=s.selectionEnd;if(L===null||C===null)throw new ns("The selection attributes have not been initialized.");var O,D=y.value;if(I.inputType===void 0&&(y.selectionStart=0,y.selectionEnd=D.length),L>y.selectionStart?O="insert":L<=y.selectionStart&&L<y.selectionEnd?O="deleteBackward":L===y.selectionEnd&&R.length<D.length&&(O="deleteForward"),O===void 0||(O==="deleteBackward"||O==="deleteForward")&&R.length>D.length)throw new ns("Input type detection error.");var P="",M=y.selectionStart,N=y.selectionEnd;if(O==="insert")P=R.slice(y.selectionStart,L);else{var F=D.length-R.length;M=L,N=L+F}m.value!==D?m.options=m.fallbackOptions:m.fallbackOptions=m.options;var x=m.options,U=n({inputType:O,previousValue:D,previousOptions:x,value:R,addedValue:P,changeStart:M,changeEnd:N,selectionStart:L,selectionEnd:C}),K=U.options,H=L1(U,w1);s.value=H.value,s.setSelectionRange(H.selectionStart,H.selectionEnd),m.value=H.value,m.options=K,y.selectionStart=H.selectionStart,y.selectionEnd=H.selectionEnd,(S=s._valueTracker)===null||S===void 0||(A=S.setValue)===null||A===void 0||A.call(S,D)}catch(G){if(s.value=y.value,s.setSelectionRange(y.selectionStart,y.selectionEnd),I.preventDefault(),I.stopPropagation(),G.name!=="SyntheticChangeError")throw G}};document.activeElement===s&&E(),s.addEventListener("focus",E),s.addEventListener("blur",b),s.addEventListener("input",_),i.set(s,{onFocus:E,onBlur:b,onInput:_})}},this.unregister=function(s){var o=i.get(s);o!==void 0&&(s.removeEventListener("focus",o.onFocus),s.removeEventListener("blur",o.onBlur),s.removeEventListener("input",o.onInput),i.delete(s))}}));tm=Wv,Object.defineProperty(tm.prototype,Symbol.toStringTag,{writable:!1,enumerable:!1,
60configurable:!0,value:"Input"});var nm,k1=["track","modify"];function ai(r){var e,t,n,i;return{mask:(e=r.mask)!==null&&e!==void 0?e:"",replacement:typeof r.replacement=="string"?Oi(r.replacement):(t=r.replacement)!==null&&t!==void 0?t:{},showMask:(n=r.showMask)!==null&&n!==void 0&&n,separate:(i=r.separate)!==null&&i!==void 0&&i,track:r.track,modify:r.modify}}var Yv=(function(r){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return m1(this,e),(t=p1(this,e,[{init:function(i){var s=i.initialValue,o=i.controlled,a=ai(n),l=a.mask,c=a.replacement,u=a.separate,d=a.showMask;return s=o||s?s:d?l:"",{value:s,options:{mask:l,replacement:c,separate:u}}},tracking:function(i){var s=i.inputType,o=i.previousValue,a=i.previousOptions,l=i.addedValue,c=i.changeStart,u=i.changeEnd,d=ai(n),f=d.track,h=d.modify,p=v1(d,k1),m=p.mask,g=p.replacement,y=p.showMask,v=p.separate,E=Io(Io({},s==="insert"?{inputType:s,data:l}:{inputType:s,data:null}),{},{value:o,selectionStart:c,selectionEnd:u}),b=f?.(E);if(b===!1)throw new ns("Custom tracking stop.");b===null?l="":b!==!0&&b!==void 0&&(l=b);var _=h?.(E);_?.mask!==void 0&&(m=_.mask),_?.replacement!==void 0&&(g=typeof _?.replacement=="string"?Oi(_?.replacement):_.replacement),_?.showMask!==void 0&&(y=_.showMask),_?.separate!==void 0&&(v=_.separate);var I=xu(o,Io({end:c},a)),S=xu(o,Io({start:u},a)),A=RegExp("[^".concat(Object.keys(g).join(""),"]"),"g"),R=m.replace(A,"");if(I&&(I=ts(I,{replacementChars:R,replacement:g,separate:v}),R=R.slice(I.length)),l&&(l=ts(l,{replacementChars:R,replacement:g,separate:!1}),R=R.slice(l.length)),s==="insert"&&l==="")throw new ns("The character does not match the key value of the `replacement` object.");if(v){var L=m.slice(c,u).replace(A,""),C=L.length-l.length;C<0?S=S.slice(-C):C>0&&(S=L.slice(-C)+S)}S&&(S=ts(S,{replacementChars:R,replacement:g,separate:v}));var O=Gv(I+l+S,{mask:m,replacement:g,separate:v,showMask:y}),D=(function(P){var M,N,F,x=P.inputType,U=P.value,K=P.addedValue,H=P.beforeChangeValue,G=P.mask,z=P.replacement,J=P.separate,q=Hv(U,{mask:G,replacement:z}).filter((function(Ce){var Ae=Ce.type;return Ae==="input"||J&&Ae==="replacement"})),X=(M=q[H.length+K.length-1])===null||M===void 0?void 0:M.index,te=(N=q[H.length-1])===null||N===void 0?void 0:N.index,pe=(F=q[H.length+K.length])===null||F===void 0?void 0:F.index;if(x==="insert"){if(X!==void 0)return X+1;if(pe!==void 0)return pe;if(te!==void 0)return te+1}if(x==="deleteForward"){if(pe!==void 0)return pe;if(te!==void 0)return te+1}if(x==="deleteBackward"){if(te!==void 0)return te+1;if(pe!==void 0)return pe}var we=U.split("").findIndex((function(Ce){return Object.prototype.hasOwnProperty.call(z,Ce)}));return we!==-1?we:U.length})({inputType:s,value:O,addedValue:l,beforeChangeValue:I,mask:m,replacement:g,separate:v});return{value:O,selectionStart:D,selectionEnd:D,options:{mask:m,replacement:g,separate:v}}}}])).format=function(i){return zv(i,ai(n))},t.formatToParts=function(i){return b1(i,ai(n))},t.unformat=function(i){return E1(i,ai(n))},t.generatePattern=function(i){return S1(i,ai(n))},t}return y1(e,Wv),g1(e)})();nm=Yv,Object.defineProperty(nm.prototype,Symbol.toStringTag,{writable:!1,enumerable:!1,configurable:!0,value:"Mask"});function C1(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=r.mask,t=r.replacement,n=r.showMask,i=r.separate,s=r.track,o=r.modify,a=k.useRef(null),l=k.useRef({mask:e,replacement:t,showMask:n,separate:i,track:s,modify:o});return l.current.mask=e,l.current.replacement=t,l.current.showMask=n,l.current.separate=i,l.current.track=s,l.current.modify=o,k.useMemo((function(){return A1(a,new Yv(l.current))}),[])}const Gi="DD/MM/YYYY",eM=k.forwardRef(function({className:e="",error:t,onChange:n,value:i,...s},o){const[a,l]=k.useState(i||Gi),u=C1({...{mask:Gi,replacement:{D:/\d/,M:/\d/,Y:/\d/}},showMask:!0,separate:!0});k.useImperativeHandle(o,()=>u.current),k.useEffect(()=>{l(i||Gi)},[i]);const d=p=>{l(p.target.value||Gi),n?.(p)},f=()=>{const p=a||Gi,m=g=>/\d{2}/.test(p.slice(g,g+2));return p.split("").map((g,y)=>{const v=/\d/.test(g),E=g==="/"&&(y===2&&m(0)||y===5&&m(3)),b=v||E;return V.jsx("span",{className:b?"text-text-primary":"text-text-tertiary",children:g},y)})},h=_i(Ee("border-border-primary bg-bg-inputfield-default block w-full rounded-lg border p-2 text-transparent caret-text-primary placeholder-text-tertiary",{"border-ui-red-normal":!!t},e));return V.jsxs("div",{children:[V.jsxs("div",{className:"relative",children:[i&&V.jsx("span",{className:"pointer-events-none absolute left-[calc(0.5rem+1px)] top-1/2 flex -translate-y-1/2 items-center text-sm","aria-hidden":"true",children:f()}),V.jsx("input",{ref:u,className:h,value:i,onChange:d,...s})]}),t?V.jsx("span",{className:"text-ui-red-normal text-xxs font-semibold",children:typeof t.message!="string"?JSON.stringify(t.message):t.message}):null]})}),tM=k.forwardRef(function({className:e="",error:t,type:n,value:i,withCopyButton:s,disabled:o,leftSlot:a,...l},c){const{t:u}=hg(),{showToast:d}=DA(),[f,h]=k.useState(!1),p=f?"text":n,m=_i(Ee("border-border-primary bg-bg-inputfield-default block w-full rounded-lg border truncate p-2 text-text-primary placeholder-text-tertiary",{"border-ui-red-normal":!!t,"pr-12":s,"text-text-button-disabled":o,"pl-12":!!a},e)),g=async y=>{try{await navigator.clipboard.writeText(String(y))}catch(v){console.error(v)}};return V.jsxs("div",{children:[V.jsxs("div",{className:"relative",children:[a?V.jsx("div",{className:"border-border-primary text-text-primary absolute flex h-full w-10 items-center justify-center border-r text-sm font-bold",children:a}):null,V.jsx("input",{ref:c,type:p,className:m,value:i,...l}),n==="password"?V.jsx("button",{type:"button",onClick:()=>h(y=>!y),className:"absolute right-4 top-1/2 -translate-y-1/2",children:V.jsx(St,{name:f?"hidden":"visible",size:"sm",className:"text-text-primary"})}
60):null,s?V.jsx("button",{type:"button",onClick:()=>{g(i),d(u("copiedToClipboard",{ns:"account"}))},className:"text-text-link absolute right-4 top-1/2 -translate-y-1/2 text-sm font-semibold",children:u("copy",{ns:"account"})}):null]}),t?V.jsx("span",{className:"text-ui-red-normal text-xxs font-semibold",children:typeof t.message!="string"?JSON.stringify(t.message):t.message}):null]})}),nM=k.forwardRef(function({className:e="",error:t,...n},i){return V.jsxs("div",{className:Ee("relative min-w-[6rem] sm:min-w-[8rem]","text-text-primary has-disabled:text-text-tertiary font-size-xs"),children:[V.jsx("select",{ref:i,className:Ee("border-border-primary bg-bg-inputfield-default block w-full rounded-lg border bg-none p-2 pr-7",{"border-ui-red-normal":!!t},e),...n}),t?V.jsx("span",{className:"text-ui-red-normal text-xxs font-semibold",children:typeof t.message!="string"?JSON.stringify(t.message):t.message}):null,V.jsx(St,{name:"caret-down",size:"xs",className:"absolute right-2 top-1/2 -translate-y-1/2 transform"})]})}),D1=k.forwardRef(({children:r,className:e=""},t)=>V.jsx(dS,{className:_i(Ee("z-50 bg-black/[.5]",e)),children:V.jsx("div",{className:"flex h-full w-full [&>*]:sm:m-auto",ref:t,children:r})}));D1.displayName="Modal";const rM=k.forwardRef(function({title:e,children:t,onDismiss:n,centerTitle:i=!1,titleAlignment:s="center",className:o="",closeButtonClassName:a},l){return V.jsxs("div",{className:_i(Ee("bg-core-primary text-text-primary absolute inset-0 max-h-full self-end overflow-auto rounded-t-lg p-8 px-6 sm:relative sm:w-[26rem] sm:rounded-b-lg",o)),ref:l,children:[V.jsxs("div",{className:Ee("mb-3 flex",{"justify-start":s==="left","justify-center":s==="center","justify-end":s==="right"}),children:[e&&nb(e)?V.jsx("h2",{className:Ee("text-text-primary text-lg font-bold",{"text-center":i}),children:e}):e,n?V.jsx("button",{type:"button",onClick:n,className:_i("text-text-primary bg-surface-light absolute right-4 top-4 flex h-[1.875rem] w-[1.875rem] items-center justify-center rounded-[50%]",a),children:V.jsx(St,{name:"close",size:"sm"})}):null]}),t]})}),iM=k.forwardRef(({children:r,breadcrumbs:e=[],className:t,LinkComponent:n},i)=>V.jsxs("div",{ref:i,className:Ee("relative flex h-full flex-col gap-0 md:mx-4 md:gap-4 md:pt-5",t),children:[e.length>0?V.jsx(RS,{links:e,LinkComponent:n}):null,r]}));function dt(r){this.content=r}dt.prototype={constructor:dt,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new dt(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new dt(t)},addToStart:function(r,e){return new dt([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new dt(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new dt(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=dt.from(r),r.size?new dt(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=dt.from(r),r.size?new dt(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=dt.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};dt.from=function(r){if(r instanceof dt)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new dt(e)};function qv(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;
vendor: 8,568 bytes, line 60
60return l&&l<o.length&&l<a.length&&Jv(o.charCodeAt(l-1))&&Qv(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=qv(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Xv(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,n--;return d&&f&&d<c.length&&Jv(c.charCodeAt(d-1))&&Qv(c.charCodeAt(d))&&(t++,n++),{a:t,b:n}}if(o.content.size||a.content.size){let c=Xv(o.content,a.content,t-1,n-1);if(c)return c}t-=l,n-=l}}function Qv(r){return r>=56320&&r<57344}function Jv(r){return r>=55296&&r<56320}class W{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),n,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new W(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new W(n,i)}cutByIndex(e,t){return e==t?W.empty:e==0&&t==this.content.length?this:new W(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new W(i,s)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return qv(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Xv(this,e,t,n)}findIndex(e){if(e==0)return Lo(0,e);if(e==this.size)return Lo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?Lo(t+1,s):Lo(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return W.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return W.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new W(t||e,n)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const xc={index:0,offset:0};function Lo(r,e){return xc.index=r,xc.offset=e,xc}function _a(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!_a(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!_a(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let $e=class Cu{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_a(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cu.none;if(e instanceof Cu)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};$e.none=[];class Rs extends Error{}class Z{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=e0(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new Z(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(Zv(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Z.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(W.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new Z(e,n,i)}}Z.empty=new Z(W.empty,0,0);function Zv(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Zv(s.content,e-i-1,t-i-1)))}function e0(r,e,t,n,i,s){let{index:o,offset:a}=r.findIndex(e),l=r.maybeChild(o);if(a==e||l.isText)return s&&n<=0&&i<=0&&!s.canReplace(o,o,t)?null:r.cut(0,e).append(t).append(r.cut(e));let c=e0(l.content,e-a-1,t,o==0?n-1:0,o==r.childCount-1?i-1:0,l);return c&&r.replaceChild(o,l.copy(c))}function P1(r,e,t){if(t.openStart>r.depth)throw new Rs("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Rs("Inconsistent open depths");return t0(r,e,t,0)}function t0(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=t0(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return Fr(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=O1(t,r);return Fr(s,r0(r,o,a,e,n))}else return Fr(s,Ra(r,e,n))}function n0(r,e){if(!e.type.compatibleContent(r.type))throw new Rs("Cannot join "+e.type.n
vendor: 10,316 bytes, line 60
60ame+" onto "+r.type.name)}function Du(r,e,t){let n=r.node(t);return n0(n,e.node(t)),n}function Nr(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function rs(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Nr(r.nodeAfter,n),s++));for(let a=s;a<o;a++)Nr(i.child(a),n);e&&e.depth==t&&e.textOffset&&Nr(e.nodeBefore,n)}function Fr(r,e){if(!r.type.validContent(e))throw new Rs("Invalid content for node "+r.type.name);return r.copy(e)}function r0(r,e,t,n,i){let s=r.depth>i&&Du(r,e,i+1),o=n.depth>i&&Du(t,n,i+1),a=[];return rs(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(n0(s,o),Nr(Fr(s,r0(r,e,t,n,i+1)),a)):(s&&Nr(Fr(s,Ra(r,e,i+1)),a),rs(e,t,i,a),o&&Nr(Fr(o,Ra(t,n,i+1)),a)),rs(n,null,i,a),new W(a)}function Ra(r,e,t){let n=[];if(rs(null,r,t,n),r.depth>t){let i=Du(r,e,t+1);Nr(Fr(i,Ra(r,e,t+1)),n)}return rs(e,null,t,n),new W(n)}function O1(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(W.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Is{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return $e.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ia(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(n.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Is(t,n,s)}static resolveCached(e,t){let n=rm.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else rm.set(e,n=new M1);let i=n.elts[n.i]=Is.resolve(e,t);return n.i=(n.i+1)%N1,i}}class M1{constructor(){this.elts=[],this.i=0}}const N1=12,rm=new WeakMap;class Ia{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const F1=Object.create(null);let cr=class Pu{constructor(e,t,n,i=$e.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||W.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&_a(this.attrs,t||e.defaultAttrs||F1)&&$e.sameSet(this.marks,n||$e.none)}copy(e=null){return e==this.content?this:new Pu(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Pu(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Z.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new Z(c,i.depth-o,s.depth-o)}replace(e,t,n){return P1(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Is.resolveCached(this,e)}resolveNoCache(e){return Is.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),i0(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=W.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=$e.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!$e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=W.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};cr.prototype.text=void 0;class La extends cr{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):i0(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new La(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new La(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function i0(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class jr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new B1(e,t);if(n.next==null)return jr.empty;let i=s0(n);n.next&&n.err("Unexpected trailing text");let s=K1(z1(i));return j1(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}
vendor: 4,705 bytes, lines 60-61
60matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return W.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
61`)}}jr.empty=new jr(!0);class B1{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function s0(r){let e=[];do e.push($1(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $1(r){let e=[];do e.push(U1(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function U1(r){let e=H1(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=V1(r,e);else break;return e}function im(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function V1(r,e){let t=im(r),n=t;return r.eat(",")&&(r.next!="}"?n=im(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function G1(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function H1(r){if(r.eat("(")){let e=s0(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=G1(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function z1(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();n(l,u),i(s(o.expr,l),u),l=u}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function o0(r,e){return e-r}function sm(r,e){let t=[];return n(e),t.sort(o0);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function K1(r){let e=Object.create(null);return t(sm(r,0));function t(n){let i=[];
vendor: 12,173 bytes, lines 61-62
61n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);sm(r,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[n.join(",")]=new jr(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(o0);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function j1(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function a0(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function l0(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function c0(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${n}`);for(let i in r)r[i].validate&&r[i].validate(e[i])}function u0(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Y1(r,n,e[n]);return t}let om=class d0{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=u0(e,n.attrs),this.defaultAttrs=a0(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==jr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:l0(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new cr(this,this.computeAttrs(e),W.from(t),$e.setFrom(n))}createChecked(e=null,t,n){return t=W.from(t),this.checkContent(t),new cr(this,this.computeAttrs(e),t,$e.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=W.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(W.empty,!0);return s?new cr(this,e,t.append(s),$e.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){c0(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:$e.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new d0(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function W1(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Y1{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?W1(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Ll{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=u0(e,i.attrs),this.excluded=null;let s=a0(this.attrs);this.instance=s?new $e(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $e(this,l0(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new Ll(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){c0(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class f0{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=dt.from(e.nodes),t.marks=dt.from(e.marks||{}),this.nodes=om.compile(this.spec.nodes,this),this.marks=Ll.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=jr.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?am(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:am(this,o.split(" "))}this.nodeFromJSON=i=>cr.fromJSON(this,i),this.markFromJSON=i=>$e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof om){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new La(n,n.defaultAttrs,e,$e.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function am(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function q1(r){return r.tag!=null}function X1(r){return r.style!=null}let qo=class Ou{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(q1(i))this.tags.push(i);else if(X1(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new cm(this,t,!1);return n.addAll(e,$e.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new cm(this,t,!0);return n.addAll(e,$e.none,t.from,t.to),Z.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Z1(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=um(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=um(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ou(e,Ou.schemaRules(e)))}};const h0={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Q1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},p0={ol:!0,ul:!0},Ls=1,Mu=2,is=4;function lm(r,e,t){return e!=null?(e?Ls:0)|(e==="full"?Mu:0):r&&r.whitespace=="pre"?Ls|Mu:t&~is}class wo{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=$e.none,this.match=s||(o&is?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(W.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ls)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=W.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(W.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!h0.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class cm{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=lm(null,t.preserveWhitespace,0)|(n?is:0);i?s=new wo(i.type,i.attrs,$e.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new wo(null,null,$e.none,!0,null,o):s=new wo(e.schema.topNodeType,null,$e.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Mu?"full":this.localPreserveWS||(i.options&Ls)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
62`);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;p0.hasOwnProperty(o)&&this.parser.normalizeLists&&J1(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Q1.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;
vendor: 5,227 bytes, lines 62-63
62if(h0.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
63`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(n)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$e.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):dm(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=lm(e,s,o.options);o.options&is&&o.content.length==0&&(a|=is);let l=$e.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):dm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new wo(e,t,l,i,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ls)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];
vendor: 4,256 bytes, line 63
63if(n.isTextblock&&n.defaultAttrs)return n}}}function J1(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&p0.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Z1(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function um(r){let e={};for(let t in r)e[t]=r[t];return e}function dm(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class Fs{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=xo(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){if(e.isText)return xo(t).createTextNode(e.text);let{dom:n,contentDOM:i}=Xo(xo(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Xo(xo(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:Xo(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fs(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=fm(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return fm(e.marks)}}function fm(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function xo(r){return r.document||window.document}const hm=new WeakMap;function ex(r){let e=hm.get(r);return e===void 0&&hm.set(r,e=tx(r)),e}function tx(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Xo(r,e,t,n){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=ex(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(r.createTextNode(f));else{let{dom:h,contentDOM:p}=Xo(r,f,t,n);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const m0=65535,g0=Math.pow(2,16);function nx(r,e){return r+e*g0}function pm(r){return r&m0}function rx(r){return(r-(r&m0))/g0}const y0=1,v0=2,Qo=4,E0=8;class Nu{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&E0)>0}get deletedBefore(){return(this.delInfo&(y0|Qo))>0}get deletedAfter(){return(this.delInfo&(v0|Qo))>0}get deletedAcross(){return(this.delInfo&Qo)>0}}class zt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&zt.empty)return zt.empty}recover(e){let t=0,n=pm(e);if(!this.inverted)for(let i=0;i<n;
vendor: 4,601 bytes, line 63
63i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+rx(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:u);if(n)return h;let p=e==(t<0?l:d)?null:nx(a/3,e-l),m=e==l?v0:e==d?y0:Qo;return(t<0?e!=l:e!=d)&&(m|=E0),new Nu(h,m,p)}i+=u-c}return n?e+i:new Nu(e+i,0,null)}touches(e,t){let n=0,i=pm(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+n];e(a,a+c,l,l+u),s+=u-c}}invert(){return new zt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?zt.empty:new zt(e<0?[0,-e,0]:[0,0,e])}}zt.empty=new zt([]);class ws{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ws(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new ws;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new Nu(e,i,null)}}const kc=Object.create(null);class At{getMap(){return zt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=kc[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kc)throw new RangeError("Duplicate use of step JSON ID "+e);return kc[e]=t,t.prototype.jsonID=e,t}}class Xe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Xe(e,null)}static fail(e){return new Xe(null,e)}static fromReplace(e,t,n,i){try{return Xe.ok(e.replace(t,n,i))}catch(s){if(s instanceof Rs)return Xe.fail(s.message);throw s}}}function Ud(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Ud(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return W.fromArray(n)}class ir extends At{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new Z(Ud(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return Xe.fromReplace(e,this.from,this.to,s)}invert(){return new bn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ir(t.pos,n.pos,this.mark)}merge(e){return e instanceof ir&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ir(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ir(t.from,t.to,e.markFromJSON(t.mark))}}At.jsonID("addMark",ir);class bn extends At{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}
vendor: 6,530 bytes, line 63
63apply(e){let t=e.slice(this.from,this.to),n=new Z(Ud(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Xe.fromReplace(e,this.from,this.to,n)}invert(){return new ir(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new bn(t.pos,n.pos,this.mark)}merge(e){return e instanceof bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bn(t.from,t.to,e.markFromJSON(t.mark))}}At.jsonID("removeMark",bn);class sr extends At{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Xe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Xe.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new sr(this.pos,t.marks[i]);return new sr(this.pos,this.mark)}}return new Wr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new sr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new sr(t.pos,e.markFromJSON(t.mark))}}At.jsonID("addNodeMark",sr);class Wr extends At{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Xe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Xe.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new sr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wr(t.pos,e.markFromJSON(t.mark))}}At.jsonID("removeNodeMark",Wr);class qe extends At{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Fu(e,this.from,this.to)?Xe.fail("Structure replace would overwrite content"):Xe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zt([this.from,this.to-this.from,this.slice.size])}invert(e){return new qe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&qe.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new qe(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof qe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qe(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}qe.MAP_BIAS=1;At.jsonID("replace",qe);class at extends At{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Fu(e,this.from,this.gapFrom)||Fu(e,this.gapTo,this.to)))return Xe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Xe.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Xe.fromReplace(e,this.from,this.to,n):Xe.fail("Content does not fit in gap")}getMap(){return new zt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new at(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new at(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new at(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}At.jsonID("replaceAround",at);function Fu(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function ix(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!n.isInSet(d)&&u.type.allowsMarkType(n.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,t),p=n.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:i.push(o=new bn(f,h,d[m])));a&&a.to==f?a.to=h:s.push(a=new ir(f,h,n))}}
vendor: 7,284 bytes, lines 63-64
63),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function sx(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof Ll){let c=o.marks,u;for(;u=n.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>r.step(new bn(o.from,o.to,o.style)))}function Vd(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=n.matchType(c.type);if(!d)o.push(new qe(a,u,Z.empty));else{n=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||r.step(new bn(a,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Z(W.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new qe(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!n.validEnd){let l=n.fillBefore(W.empty,!0);r.replace(a,a,new Z(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function ox(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mi(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),a=r.$from.index(n)+i,l=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!ox(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function ax(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,c=a,u=W.empty,d=0;for(let p=s,m=!1;p>t;p--)m||n.index(p)>0?(m=!0,u=W.from(n.node(p).copy(u)),d++):l--;let f=W.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=W.from(i.node(p).copy(f)),h++):c++;r.step(new at(l,c,o,a,new Z(u.append(f),d,h),u.size-d,!0))}function Gd(r,e,t=null,n=r){let i=lx(r,e),s=i&&cx(n,e);return s?i.map(mm).concat({type:e,attrs:t}).concat(s.map(mm)):null}function mm(r){return{type:r,attrs:null}}function lx(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function cx(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function ux(r,e,t){let n=W.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=W.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new at(i,s,i,s,new Z(n,0,0),t.length,!0))}function dx(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&fx(r.doc,r.mapping.slice(s).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",p=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&T0(r,o,a,s),Vd(r,r.mapping.slice(s).map(a,1),n,void 0,c===null);let u=r.mapping.slice(s),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return r.step(new at(d,f,d+1,f-1,new Z(W.from(n.create(l,null,o.marks)),0,0),1,!0)),c===!0&&b0(r,o,a,s),!1}})}function b0(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function T0(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
64`))}})}function fx(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function hx(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new at(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Z(W.from(o),0,0),1,!0))}function Vn(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=n&&n[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=n&&n[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function px(r,e,t=1,n){let i=r.doc.resolve(e),s=W.empty,o=W.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=W.from(i.node(a).copy(s));let u=n&&n[c];o=W.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}r.step(new qe(e,e,new Z(s.append(o),t,t),!0))}function yr(r,e){let t=r.resolve(e),n=t.index();return S0(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function mx(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function S0(r,e){return!!(r&&e&&!r.isLeaf&&mx(r,e))}function wl(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&S0(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function gx(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?n=!1:!u&&d&&(n=!0)}let a=r.steps.length;if(n===!1){let u=r.doc.resolve(e+t);T0(r,u.node(),u.before(),a)}o.inlineContent&&Vd(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),c=l.map(e-t);if(r.step(new qe(c,l.map(e+t,-1),Z.empty,!0)),n===!0){let u=r.doc.resolve(c);b0(r,u.node(),u.before(),r.steps.length)}return r}function yx(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function A0(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;
vendor: 5,073 bytes, line 64
64s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),c=n.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function xl(r,e,t=e,n=Z.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return _0(i,s,n)?new qe(e,t,n):new vx(i,s,n).fit()}function _0(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class vx{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=W.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=W.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new Z(s,o,a);return e>-1?new at(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new qe(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=Cc(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(W.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Cc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Z(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Cc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new Z(Wi(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new Z(Wi(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(R0(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Yi(this.placed,t,W.from(u)),this.frontier[t].match=d,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?Z.empty:new Z(Wi(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new Z(Wi(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Dc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Dc(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Dc(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Yi(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Yi(this.placed,this.depth,W.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(W.empty,!0);t.childCount&&(this.placed=Yi(this.placed,this.frontier.length,t))}}function Wi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.f
vendor: 8,567 bytes, line 64
64irstChild.copy(Wi(r.firstChild.content,e-1,t)))}function Yi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(Yi(r.lastChild.content,e-1,t)))}function Cc(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function R0(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,R0(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(W.empty,!0)))),r.copy(n)}function Dc(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!Ex(t,s.content,o)?a:null}function Ex(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function bx(r){return r.spec.defining||r.spec.definingForContent}function Tx(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(_0(i,s,n))return r.step(new qe(e,t,n));let o=L0(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=n.openStart;for(let f=n.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==n.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=bx(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=n.openStart;f>=0;f--){let h=(f+u+1)%(n.openStart+1),p=c[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let v=i.node(g-1),E=i.index(g-1);if(v.canReplaceWith(E,E,p.type,p.marks))return r.replace(i.before(g),y?s.after(g):t,new Z(I0(n.content,0,n.openStart,h),h,n.openEnd))}}let d=r.steps.length;for(let f=o.length-1;f>=0&&(r.replace(e,t,n),!(r.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function I0(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(I0(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(W.empty,!0))}return r}function Sx(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=yx(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new Z(W.from(n),0,0))}function Ax(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let o=n.sharedDepth(t),a=!1;for(let l=n.depth;l>o;l--)n.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=n.depth;l>0&&e==n.start(l);l--)e=n.before(l);for(let l=i.depth;l>0&&t==i.start(l);l--)t=i.before(l);n=r.doc.resolve(e),i=r.doc.resolve(t)}}let s=L0(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function L0(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Si extends At{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Xe.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return Xe.fromReplace(e,this.pos,this.pos+1,new Z(W.from(i),0,t.isLeaf?0:1))}getMap(){return zt.empty}invert(e){return new Si(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Si(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Si(t.pos,t.attr,t.value)}}At.jsonID("attr",Si);class xs extends At{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Xe.ok(n)}getMap(){return zt.empty}invert(e){return new xs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xs(t.attr,t.value)}}At.jsonID("docAttr",xs);let Li=class extends Error{};Li=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};Li.prototype=Object.create(Error.prototype);Li.prototype.constructor=Li;Li.prototype.name="TransformError";class _x{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ws}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Li(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let i=this.mapping.maps[n];n&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Z.empty){let i=xl(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new Z(W.from(n),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Tx(this,e,t,n),this}replaceRangeWith(e,t,n){return Sx(this,e,t,n),this}deleteRange(e,t){return Ax(this,e,t),this}lift(e,t){return ax(this,e,t),this}join(e,t=1){return gx(this,e,t),this}wrap(e,t){return ux(this,e,t),this}setBlockType(e,t=e,n,i=null){return dx(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return hx(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new Si(e,t,n)),this}setDocAttribute(e,t){return this.step(new xs(e,t)),this}addNodeMark(e,t){return this.step(new sr(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof $e)t.isInSet(n.marks)&&this.step(new Wr(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Wr(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return px(this,e,t,n),this}addMark(e,t,n){return ix(this,e,t,n),this}removeMark(e,t,n){return sx(this,e,t,n),this}clearIncompatible(e,t,n){return Vd(this,e,t,n),this}}const Pc=Object.create(null);class Se{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Rx(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Z.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?Z.empty:t),a==0&&vm(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),vm(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new fe(e):ui(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?ui(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):ui(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}
vendor: 4,098 bytes, line 64
64static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Wt(e.node(0))}static atStart(e){return ui(e,e,0,0,1)||new Wt(e)}static atEnd(e){return ui(e,e,e.content.size,e.childCount,-1)||new Wt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Pc[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Pc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return fe.between(this.$anchor,this.$head).getBookmark()}}Se.prototype.visible=!0;class Rx{constructor(e,t){this.$from=e,this.$to=t}}let gm=!1;function ym(r){!gm&&!r.parent.inlineContent&&(gm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class fe extends Se{constructor(e,t=e){ym(e),ym(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Se.near(n);let i=e.resolve(t.map(this.anchor));return new fe(i.parent.inlineContent?i:n,n)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof fe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new kl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new fe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=Se.findFrom(t,n,!0)||Se.findFrom(t,-n,!0);if(s)t=s.$head;else return Se.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(Se.findFrom(e,-n,!0)||Se.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new fe(e,t)}}Se.jsonID("text",fe);class kl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new kl(e.map(this.anchor),e.map(this.head))}resolve(e){return fe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ae extends Se{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?Se.near(s):new ae(s)}content(){return new Z(W.from(this.node),0,0)}eq(e){return e instanceof ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Hd(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ae(e.resolve(t.anchor))}static create(e,t){return new ae(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ae.prototype.visible=!1;Se.jsonID("node",ae);class Hd{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new kl(n,n):new Hd(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ae.isSelectable(n)?new ae(t):Se.near(t)}}class Wt extends Se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.empty){e.delete(0,e.doc.content.size);let n=Se.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Wt(e)}map(e){return new Wt(e)}eq(e){return e instanceof Wt}getBookmark(){return Ix}}Se.jsonID("all",Wt);const Ix={map(){return this},resolve(r){return new Wt(r)}};function ui(r,e,t,n,i,s=!1){if(e.inlineContent)return fe.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ae.isSelectable(a))return ae.create(r,t-(i<0?a.nodeSize:0))}else{let l=ui(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function vm(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof qe||i instanceof at))return;let s=r.mapping.maps[n],o;
vendor: 4,460 bytes, line 64
64s.forEach((a,l,c,u)=>{o==null&&(o=u)}),r.setSelection(Se.near(r.doc.resolve(o),t))}function Em(r,e){return!e||!r?r:r.bind(e)}class ko{constructor(e,t,n){this.name=e,this.init=Em(t.init,n),this.apply=Em(t.apply,n)}}new ko("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new ko("selection",{init(r,e){return r.selection||Se.atStart(e.doc)},apply(r){return r.selection}}),new ko("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new ko("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function w0(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=w0(i,e,{})),t[n]=i}return t}class gt{constructor(e){this.spec=e,this.props={},e.props&&w0(e.props,this,this.props),this.key=e.key?e.key.key:x0("plugin")}getState(e){return e[this.key]}}const Oc=Object.create(null);function x0(r){return r in Oc?r+"$"+ ++Oc[r]:(Oc[r]=0,r+"$")}class qt{constructor(e="key"){this.key=x0(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qr=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},k0=function(r,e,t,n){return t&&(bm(r,e,t,n,-1)||bm(r,e,t,n,1))},Lx=/^(img|br|input|textarea|hr)$/i;function bm(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:wa(r))){let o=r.parentNode;if(!o||o.nodeType!=1||zd(r)||Lx.test(r.nodeName)||r.contentEditable=="false")return!1;e=qr(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?wa(r):0}else return!1}}function wa(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function wx(r,e,t){for(let n=e==0,i=e==wa(r);n||i;){if(r==t)return!0;let s=qr(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==wa(r)}}function zd(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const C0=function(r){return r.focusNode&&k0(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function D0(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}const _n=typeof navigator<"u"?navigator:null,Tm=typeof document<"u"?document:null,vr=_n&&_n.userAgent||"",Bu=/Edge\/(\d+)/.exec(vr),P0=/MSIE \d/.exec(vr),$u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr),Bs=!!(P0||$u||Bu),O0=P0?document.documentMode:$u?+$u[1]:Bu?+Bu[1]:0,Cl=!Bs&&/gecko\/(\d+)/i.test(vr);Cl&&+(/Firefox\/(\d+)/.exec(vr)||[0,0])[1];const Uu=!Bs&&/Chrome\/(\d+)/.exec(vr),Hn=!!Uu,M0=Uu?+Uu[1]:0,Xr=!Bs&&!!_n&&/Apple Computer/.test(_n.vendor),Kd=Xr&&(/Mobile\/\w+/.test(vr)||!!_n&&_n.maxTouchPoints>2),Zt=Kd||(_n?/Mac/.test(_n.platform):!1),N0=_n?/Win/.test(_n.platform):!1,$s=/Android \d/.test(vr),jd=!!Tm&&"webkitFontSmoothing"in Tm.documentElement.style,xx=jd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kx(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,c;if(C0(t)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&ae.isSelectable(d)&&i.parent&&!(d.isInline&&wx(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new ae(o==f?a:n.resolve(f))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);d=Math.min(d,r.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,r.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=f==r.state.selection.anchor?[f,d]:[d,f],a=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=n.resolve(l);if(!c){let d=e=="pointer"||r.state.selection.head<a.pos&&!s?1:-1;c=B0(r,u,a,d)}return c}function F0(r){return r.editable?r.hasFocus():Ox(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function Wd(r,e=!1){let t=r.state.selection;if(Px(r,t),!F0(r))return;let n=r.input.mouseDown;if(!e&&Hn&&n){let i=r.domSelectionRange(),s=r.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&k0(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&n.delaySelUpdate()){r.domObserver.setCurSelection();return}}
vendor: 8,004 bytes, line 64
64if(r.domObserver.disconnectSelection(),r.cursorWrapper)Dx(r);else{let{anchor:i,head:s}=t,o,a;Sm&&!(t instanceof fe)&&(t.$from.parent.inlineContent||(o=Am(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Am(r,t.to))),r.docView.setSelection(i,s,r,e),Sm&&(o&&_m(o),a&&_m(a)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Cx(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}const Sm=Xr||Hn&&M0<63;function Am(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(Xr&&i&&i.contentEditable=="false")return Mc(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Mc(i);if(s)return Mc(s)}}function Mc(r){return r.contentEditable="true",Xr&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function _m(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function Cx(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!F0(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function Dx(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,qr(t)+1):e.collapse(t,0),!n&&!r.state.selection.visible&&Bs&&O0<=11&&(t.disabled=!0,t.disabled=!1)}function Px(r,e){if(e instanceof ae){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(Rm(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else Rm(r)}function Rm(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function B0(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||fe.between(e,t,n)}function Ox(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Vu(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Se.findFrom(s,e)}function Zn(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function Im(r,e,t){let n=r.state.selection;if(n instanceof fe)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Zn(r,new fe(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Vu(r.state,e);return i&&i instanceof ae?Zn(r,i):!1}else if(!(Zt&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(a))&&!o.contentDOM?ae.isSelectable(s)?Zn(r,new ae(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):jd?Zn(r,new fe(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof ae&&n.node.isInline)return Zn(r,new fe(e>0?n.$to:n.$from));{let i=Vu(r.state,e);return i?Zn(r,i):!1}}}function xa(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function ss(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function li(r,e){return e<0?Mx(r):Nx(r)}function Mx(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(Cl&&t.nodeType==1&&n<xa(t)&&ss(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(ss(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if($0(t))break;{let a=t.previousSibling;for(;a&&ss(a,-1);)i=t.parentNode,s=qr(a),a=a.previousSibling;if(a)t=a,n=xa(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Gu(r,t,n):i&&Gu(r,i,s)}function Nx(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=xa(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(ss(a,1))s=t,o=++n;else break}else{if($0(t))break;{let a=t.nextSibling;for(;a&&ss(a,1);)s=a.parentNode,o=qr(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=xa(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Gu(r,s,o)}function $0(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function Fx(r,e){for(;r&&e==r.childNodes.length&&!zd(r);)e=qr(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function Bx(r,e){for(;r&&!e&&!zd(r);)e=qr(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Gu(r,e,t){if(e.nodeType!=3){let s,o;(o=Fx(e,t))?(e=o,t=0):(s=Bx(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(C0(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&Wd(r)},50)}function Lm(r,e){let t=r.state.doc.resolve(e);if(!(Hn||N0)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function wm(r,e,t){let n=r.state.selection;if(n instanceof fe&&!n.empty||t.indexOf("s")>-1||Zt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Vu(r.state,e);if(o&&o instanceof ae)return Zn(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof Wt?Se.near(o,e):Se.findFrom(o,e);return a?Zn(r,a):!1}return!1}function xm(r,e){if(!(r.state.selection instanceof fe))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function km(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function $x(r){if(!Xr||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;km(r,n,"true"),setTimeout(()=>km(r,n,"false"),20)}return!1}function Ux(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function Vx(r,e){let t=e.keyCode,n=Ux(e);if(t==8||Zt&&t==72&&n=="c")return xm(r,-1)||li(r,-1);if(t==46&&!e.shiftKey||Zt&&t==68&&n=="c")return xm(r,1)||li(r,1);if(t==13||t==27)return!0;if(t==37||Zt&&t==66&&n=="c"){let i=t==37?Lm(r,r.state.selection.from)=="ltr"?-1:1:-1;return Im(r,i,n)||li(r,i)}else if(t==39||Zt&&t==70&&n=="c"){let i=t==39?Lm(r,r.state.selection.from)=="ltr"?1:-1:1;return Im(r,i,n)||li(r,i)}else{if(t==38||Zt&&t==80&&n=="c")return wm(r,-1,n)||li(r,-1);if(t==40||Zt&&t==78&&n=="c")return $x(r)||wm(r,1,n)||li(r,1);if(n==(Zt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function U0(r,e){r.someProp("transformCopied",h=>{e=h(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let h=n.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),n=h.content}
vendor: 4,746 bytes, lines 64-67
64let o=r.someProp("clipboardSerializer")||Fs.fromSchema(r.state.schema),a=j0(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=K0[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=r.someProp("clipboardTextSerializer",h=>h(e,r))||e.content.textBetween(0,e.content.size,`
65
66`);return{dom:l,text:f,slice:e}}function V0(r,e,t,n,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(n||s||!t);if(l){if(r.someProp("transformPastedText",f=>{e=f(e,s||n,r)}),s)return a=new Z(W.from(r.state.schema.text(e.replace(/\r\n?/g,`
67`))),0,0),r.someProp("transformPasted",f=>{a=f(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",f=>f(e,i,n,r));if(d)a=d;else{let f=i.marks(),{schema:h}=r.state,p=Fs.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=Kx(t),jd&&jx(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||qo.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Gx.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Wx(Cm(a,+u[1],+u[2]),u[4]);else if(a=Z.maxOpen(Hx(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Cm(a,d,f)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const Gx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Hx(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&H0(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=z0(o[o.length-1],s.length));let u=G0(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return W.from(o)}return r}function G0(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,W.from(r));return r}function H0(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=H0(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(W.from(G0(t,r,i+1))))}}function z0(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,z0(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(W.empty,!0);return r.copy(t.append(n))}function Hu(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Hu(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(W.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Cm(r,e,t){return e<r.openStart&&(r=new Z(Hu(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new Z(Hu(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const K0={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function j0(){return document.implementation.createHTMLDocument("title")}let Nc=null;function zx(r){let e=window.trustedTypes;return e?(Nc||(Nc=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Nc.createHTML(r)):r}function Kx(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=j0(),n=t.body,i=/<([a-z][^>\s]+)/i.exec(r),s;if((s=i&&K0[i[1].toLowerCase()])&&(r=s.map(o=>"<"+o+">").join("")+r+s.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=zx(r),s)for(let o=0;o<s.length;o++)n=n.querySelector(s[o])||n;for(let o=0;o<t.styleSheets.length;o++){let a=t.styleSheets[o];for(let l=0;l<a.rules.length;l++){let c=a.rules[l];if(c instanceof CSSStyleRule){let u=n.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return n}function jx(r){let e=r.querySelectorAll(Hn?"span:not([class]):not
67([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function Wx(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=W.from(l.create(n[a+1],i)),s++,o++}return new Z(i,s,o)}const an={},Yt={};function Bn(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}Yt.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!X0(r)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!($s&&Hn&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),Kd&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,D0(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Vx(r,t)?t.preventDefault():Bn(r,"key")};Yt.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Yt.keypress=(r,e)=>{let t=e;if(X0(r)||!t.charCode||t.ctrlKey&&!t.altKey||Zt&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof fe)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Us(r){return{left:r.clientX,top:r.clientY}}function Yx(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Yd(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Vs(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function qx(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ae.isSelectable(n)?(Vs(r,new ae(t)),!0):!1}function Xx(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ae&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ae.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Vs(r,ae.create(r.state.doc,i)),!0):!1}function Qx(r,e,t,n,i){return Yd(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Xx(r,t):qx(r,t))}function Jx(r,e,t,n){return Yd(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function Zx(r,e,t,n){return Yd(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||ek(r,t,n)}function ek(r,e,t){if(t.button!=0)return!1;let n=W0(r,e,!0),i=r.state.doc;return n?(Vs(r,n),n instanceof fe&&i.eq(r.state.doc)&&(r.input.mouseDown=new nk(r,n)),!0):!1}function W0(r,e,t){let n=r.state.doc;if(e==-1)return n.inlineContent?fe.create(n,0,n.content.size):null;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)return fe.create(n,a+1,a+1+o.content.size);if(t&&ae.isSelectable(o))return ae.create(n,a)}return null}function qd(r){return ka(r)}const Y0=Zt?"metaKey":"ctrlKey";an.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=qd(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&Yx(t,r.input.lastClick)&&!t[Y0]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button},r.input.mouseDown&&r.input.mouseDown.done();let o=r.posAtCoords(Us(t));o&&(s=="singleClick"?r.input.mouseDown=new tk(r,o,t,!!n):(s=="doubleClick"?Jx:Zx)(r,o.pos,o.inside,t)?t.preventDefault():Bn(r,"pointer"))};class q0{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class tk extends q0{constructor(e,t,n,i){super(e),this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Y0],this.allowDefault=n.shiftKey;let s,o;
vendor: 8,668 bytes, line 67
67if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ae&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Cl&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Bn(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Wd(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Us(e))),this.updateAllowDefault(e),this.allowDefault||!t?Bn(this.view,"pointer"):Qx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Xr&&this.mightDrag&&!this.mightDrag.node.isAtom||Hn&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vs(this.view,Se.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Bn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Bn(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class nk extends q0{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Bn(this.view,"pointer");let t=this.view.posAtCoords(Us(e)),n=t&&W0(this.view,t.inside,!1);if(!n)return;let{doc:i}=this.view.state,s=this.startSelection,[o,a]=n.from<s.from?[s.to,n.from]:[s.from,n.to];Vs(this.view,fe.create(i,o,a))}}an.touchstart=r=>{r.input.lastTouch=Date.now(),qd(r),Bn(r,"pointer")};an.touchmove=r=>{r.input.lastTouch=Date.now(),Bn(r,"pointer")};an.contextmenu=r=>qd(r);function X0(r,e){return r.composing?!0:Xr&&Math.abs(Date.now()-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const rk=$s?5e3:-1;Yt.compositionstart=Yt.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof fe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Hn&&N0&&ik(r)))r.markCursor=r.state.storedMarks||t.marks(),ka(r,!0),r.markCursor=null;else if(ka(r,!e.selection.empty),Cl&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Q0(r,rk)};function ik(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}Yt.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now(),r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.badSafariComposition?r.domObserver.forceFlush():r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Q0(r,20))};function Q0(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>ka(r),e))}function sk(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function ka(r,e=!1){if(!($s&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),sk(r),e||r.docView&&r.docView.dirty){let t=kx(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function ok(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const ks=Bs&&O0<15||Kd&&xx<604;an.copy=Yt.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=ks?null:t.clipboardData,o=n.content(),{dom:a,text:l}=U0(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):ok(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ak(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function lk(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?zu(r,n.value,null,i,e):zu(r,n.textContent,n.innerHTML,i,e)},50)}function zu(r,e,t,n,i){let s=V0(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||Z.empty)))return!0;if(!s)return!1;let o=ak(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function J0(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Yt.paste=(r,e)=>{let t=e;if(r.composing&&!$s)return;let n=ks?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&zu(r,J0(n),n.getData("text/html"),i,t)?t.preventDefault():lk(r,t)};class ck{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const uk=Zt?"altKey":"ctrlKey";function Z0(r,e){let t;return r.someProp("dragCopies",n=>{t=t||n(e)}),t!=null?!t:!e[uk]}an.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Us(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ae?i.to-1:i.to))){if(n&&n.mightDrag)o=ae.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=ae.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=U0(r,a);(!t.dataTransfer.files.length||!Hn||M0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ks?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",ks||t.dataTransfer.setData("text/plain",c),r.dragging=new ck(u,Z0(r,t),o)};an.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Yt.dragover=Yt.dragenter=(r,e)=>e.preventDefault();Yt.drop=(r,e)=>{try{dk(r,e,r.dragging)}finally{r.dragging=null}};function dk(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Us(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",h=>{s=h(s,r,!1)}):s=V0(r,J0(e.dataTransfer),ks?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Z0(r,e));if(r.someProp("handleDrop",h=>h(r,e,s||Z.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?A0(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(
vendor: 9,382 bytes, line 67
67d))return;let f=l.doc.resolve(c);if(u&&ae.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ae(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,y)=>h=y),l.setSelection(B0(r,f,l.doc.resolve(h)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}an.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&Wd(r)},20))};an.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};an.beforeinput=(r,e)=>{if(Hn&&$s&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,D0(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in Yt)an[r]=Yt[r];function Cs(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Ca{constructor(e,t){this.toDOM=e,this.spec=t||Br,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Tn(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ca&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Cs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ur{constructor(e,t){this.attrs=e,this.spec=t||Br}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new Tn(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ur&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}static is(e){return e.type instanceof ur}destroy(){}}class Xd{constructor(e,t){this.attrs=e,this.spec=t||Br}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Tn(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Xd&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}destroy(){}}class Tn{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Tn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Tn(e,e,new Ca(t,n))}static inline(e,t,n,i){return new Tn(e,t,new ur(n,i))}static node(e,t,n,i){return new Tn(e,t,new Xd(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ur}get widget(){return this.type instanceof Ca}}const di=[],Br={};class st{constructor(e,t){this.local=e.length?e:di,this.children=t.length?t:di}static create(e,t){return t.length?Da(t,e,0,Br):Rt}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==Rt||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Br)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?fk(this.children,o||[],e,t,n,i,s):o?new st(o.sort($r),di):Rt}add(e,t){return t.length?this==Rt?st.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let c=l+n,u;if(u=tE(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,Da(u,a,c+1,Br)),s+=3}});let o=eE(s?nE(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new st(o.length?this.local.concat(o).sort($r):this.local,i||this.children)}remove(e){return e.length==0||this==Rt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,a+1);c!=Rt?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new st(i,n):Rt}forChild(e,t){if(this==Rt)return this;if(t.isLeaf)return st.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof ur){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new st(i.sort($r),di);return n?new xr([a,n]):a}return n||Rt}eq(e){if(this==e)return!0;if(!(e instanceof st)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Qd(this.localsInner(e))}localsInner(e){if(this==Rt)return di;if(e.inlineContent||!this.local.some(ur.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof ur||t.push(this.local[n]);return t}forEachSet(e){e(this)}}st.empty=new st([],[]);st.removeOverlap=Qd;const Rt=st.empty;class xr{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,Br));return xr.from(n)}forChild(e,t){if(t.isLeaf)return st.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Rt&&(s instanceof xr?n=n.concat(s.members):n.push(s))}return xr.from(n)}eq(e){if(!(e instanceof xr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Qd(n?t:t.sort($r)):di}static from(e){switch(e.length){case 0:return Rt;case 1:return e[0];default:return new xr(e.every(t=>t instanceof st)?e:e.reduce((t,n)=>t.concat(n instanceof st?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function fk(r,e,t,n,i,s,o){let a=r.slice();for(let c=0,u=s;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let y=0;y<a.length;y+=3){let v=a[y+1];if(v<0||f>v+u-d)continue;let E=a[y]+u-d;h>=E?a[y+1]=f<=E?-2:-1:f>=u&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(r[c]+s),d=u-i;if(d<0||d>=n.content.size){l=!0;continue}let f=t.map(r[c+1]+s,-1),h=f-i,{index:p,offset:m}=n.content.findIndex(d),g=n.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=a[c+2].mapInner(t,g,u+1,r[c]+s+1,o);y!=Rt?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=hk(a,r,e,t,i,s,o),u=Da(c,n,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new st(e.sort($r),a)}function eE(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new Tn(i.from+e,i.to+e,i.type))}return t}function hk(r,e,t,n,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(n,i,c);d?t.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function tE(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function nE(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Da(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=tE(r,a,l+t);if(c){s=!0;let u=Da(c,a,t+l+1,n);u!=Rt&&i.push(l,l+a.nodeSize,u)}});let o=eE(s?nE(r):r,-t).sort($r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new st(o,i):Rt}function $r(r,e){return r.from-e.from||r.to-e.to}function Qd(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Dm(e,i+1,s.c
vendor: 10,496 bytes, lines 67-68
67opy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Dm(e,i,n.copy(s.from,n.to)));break}}}return e}function Dm(r,e,t){for(;e<r.length&&$r(t,r[e])>0;)e++;r.splice(e,0,t)}var mr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Pa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pk=typeof navigator<"u"&&/Mac/.test(navigator.platform),mk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var mt=0;mt<10;mt++)mr[48+mt]=mr[96+mt]=String(mt);for(var mt=1;mt<=24;mt++)mr[mt+111]="F"+mt;for(var mt=65;mt<=90;mt++)mr[mt]=String.fromCharCode(mt+32),Pa[mt]=String.fromCharCode(mt);for(var Fc in mr)Pa.hasOwnProperty(Fc)||(Pa[Fc]=mr[Fc]);function gk(r){var e=pk&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||mk&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Pa:mr)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const yk=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vk=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ek(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))yk?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function bk(r){let e=Object.create(null);for(let t in r)e[Ek(t)]=r[t];return e}function Bc(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function Tk(r){return new gt({props:{handleKeyDown:rE(r)}})}function rE(r){let e=bk(r);return function(t,n){let i=gk(n),s,o=e[Bc(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[Bc(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(vk&&n.ctrlKey&&n.altKey)&&(s=mr[n.keyCode])&&s!=i){let a=e[Bc(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const Jd=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function iE(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const sE=(r,e,t)=>{let n=iE(r,t);if(!n)return!1;let i=Zd(n);if(!i){let o=n.blockRange(),a=o&&Mi(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(pE(r,i,e,-1))return!0;if(n.parent.content.size==0&&(wi(s,"end")||ae.isSelectable(s)))for(let o=n.depth;;o--){let a=xl(r.doc,n.before(o),n.after(o),Z.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(wi(s,"end")?Se.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ae.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Sk=(r,e,t)=>{let n=iE(r,t);if(!n)return!1;let i=Zd(n);return i?oE(r,i,e):!1},Ak=(r,e,t)=>{let n=lE(r,t);if(!n)return!1;let i=ef(n);return i?oE(r,i,e):!1};function oE(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=xl(r.doc,s,l,Z.empty);if(!c||c.from!=s||c instanceof qe&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(fe.create(u.doc,s)),t(u.scrollIntoView())}return!0}function wi(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const aE=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=Zd(n)}let o=s&&s.nodeBefore;return!o||!ae.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Zd(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function lE(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const cE=(r,e,t)=>{let n=lE(r,t);if(!n)return!1;let i=ef(n);if(!i)return!1;let s=i.nodeAfter;if(pE(r,i,e,1))return!0;if(n.parent.content.size==0&&(wi(s,"start")||ae.isSelectable(s))){let o=xl(r.doc,n.before(),n.after(),Z.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(wi(s,"start")?Se.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ae.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},uE=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=ef(n)}let o=s&&s.nodeAfter;return!o||!ae.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,s.pos)).scrollIntoView()),!0)};function ef(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const _k=(r,e)=>{let t=r.selection,n=t instanceof ae,i;if(n){if(t.node.isTextblock||!yr(r.doc,t.from))return!1;i=t.from}else if(i=wl(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(ae.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Rk=(r,e)=>{let t=r.selection,n;if(t instanceof ae){if(t.node.isTextblock||!yr(r.doc,t.to))return!1;n=t.to}else if(n=wl(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},Ik=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&Mi(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},dE=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
68`).scrollIntoView()),!0)};function tf(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Lk=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=tf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Se.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},fE=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Wt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=tf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(fe.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},hE=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Vn(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&Mi(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function wk(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof ae&&e.selection.node.isBlock)return!n.parentOffset||!Vn(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let h=n.depth;;h--)if(n.node(h).isBlock){l=n.end(h)==n.pos+(n.depth-h),c=n.start(h)==n.pos-(n.depth-h),a=tf(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof fe||e.selection instanceof Wt)&&u.deleteSelection();let d=u.mapping.map(n.pos),f=Vn(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Vn(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!l&&c&&n.node(o).type!=a){let h=u.mapping.map(n.before(o)),p=u.doc.resolve(h);a&&n.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(o)),a)}return t&&t(u.scrollIntoView()),!0}}const xk=wk(),kk=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(ae.create(r.doc,i))),!0)};function Ck(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||yr(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function pE(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Ck(r,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=W.empty;for(let y=o.length-1;y>=0;y--)p=W.from(o[y].create(null,p));p=W.from(i.copy(p));let m=r.tr.step(new at(e.pos-1,h,e.pos,h,new Z(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&yr(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:Se.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Mi(d);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(d,f).scrollIntoView()),!0;if(c&&wi(s,"start",!0)&&wi(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;
vendor: 4,208 bytes, line 68
68if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=W.empty;for(let E=p.length-1;E>=0;E--)y=W.from(p[E].copy(y));let v=r.tr.step(new at(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new Z(y,p.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function mE(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(fe.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Dk=mE(-1),Pk=mE(1);function Ok(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Gd(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Pm(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function nf(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}nf(Jd,sE,aE);nf(Jd,cE,uE);nf(dE,fE,hE,xk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Mk(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return Nk(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function Nk(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new Ia(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ia(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Gd(s,t,n,e);return a?(r&&Fk(r,e,a,i,t),!0):!1}function Fk(r,e,t,n,i){let s=W.empty;for(let u=t.length-1;u>=0;u--)s=W.from(t[u].type.create(t[u].attrs,s));r.step(new at(e.start-(n?2:0),e.end,e.start,e.end,new Z(s,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==i&&(o=u+1);let a=t.length-o,l=e.start+t.length-(n?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Vn(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return r}function Bk(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?$k(e,t,r,s):Uk(e,t,s):!0:!1}}function $k(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new at(s-1,o,s,o,new Z(W.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new Ia(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=Mi(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return yr(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function Uk(r,e,t){let n=r.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,n.delete(h-1,h+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?W.empty:W.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return n.step(new at(d-(a?1:0),f+(l?1:0),d+1,f-1,new Z((a?W.empty:W.from(i.copy(W.empty))).append(l?W.empty:W.from(i.copy(W.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function Vk(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=W.from(c?r.create():null),d=new Z(W.from(r.create(null,W.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;t(e.tr.step(new at(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Dl(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;
vendor: 37,296 bytes, lines 68-71
68return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}class rf{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:i}=t,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(n).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,t),y=h(...m)(g);return a.push(y),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:n}=this,i=!1,s=e||n.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Dl({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}function ie(r,e,t){return r.config[e]===void 0&&r.parent?ie(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?ie(r.parent,e,t):null}):r.config[e]}function Pl(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function gE(r){const e=[],{nodeExtensions:t,markExtensions:n}=Pl(r),i=[...t,...n],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=ie(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=ie(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function ct(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}function ut(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=n[i]?n[i].split(" "):[],c=a.filter(u=>!l.includes(u));n[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),n[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else n[i]=s}),n},{})}function Ku(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>ut(t,n),{})}function Gk(r){return typeof r=="function"}function ye(r,e=void 0,...t){return Gk(r)?e?r.bind(e)(...t):r(...t):r}function Hk(r={}){return Object.keys(r).length===0&&r.constructor===Object}function zk(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function Om(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):zk(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function Mm(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&Hk(t)?!1:t!=null))}function yE(r,e){var t;const n=gE(r),{nodeExtensions:i,markExtensions:s}=Pl(r),o=(t=i.find(c=>ie(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=n.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=r.reduce((y,v)=>{const E=ie(v,"extendNodeSchema",d);return{...y,...E?E(c):{}}},{}),h=Mm({...f,content:ye(ie(c,"content",d)),marks:ye(ie(c,"marks",d)),group:ye(ie(c,"group",d)),inline:ye(ie(c,"inline",d)),atom:ye(ie(c,"atom",d)),selectable:ye(ie(c,"selectable",d)),draggable:ye(ie(c,"draggable",d)),code:ye(ie(c,"code",d)),whitespace:ye(ie(c,"whitespace",d)),linebreakReplacement:ye(ie(c,"linebreakReplacement",d)),defining:ye(ie(c,"defining",d)),isolating:ye(ie(c,"isolating",d)),attrs:Object.fromEntries(u.map(y=>{var v;return[y.name,{default:(v=y?.attribute)===null||v===void 0?void 0:v.default}]}))}),p=ye(ie(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Om(y,u)));const m=ie(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:Ku(y,u)}));const g=ie(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const u=n.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=r.reduce((g,y)=>{const v=ie(y,"extendMarkSchema",d);return{...g,...v?v(c):{}}},{}),h=Mm({...f,inclusive:ye(ie(c,"inclusive",d)),excludes:ye(ie(c,"excludes",d)),group:ye(ie(c,"group",d)),spanning:ye(ie(c,"spanning",d)),code:ye(ie(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var y;return[g.name,{default:(y=g?.attribute)===null||y===void 0?void 0:y.default}]}))}),p=ye(ie(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Om(g,u)));const m=ie(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Ku(g,u)})),[c.name,h]}));return new f0({topNode:o,nodes:a,marks:l})}function $c(r,e){return e.nodes[r]||e.marks[r]||null}function Nm(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function sf(r,e){const t=Fs.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Kk=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,n-s))}),t};function of(r){return Object.prototype.toString.call(r)==="[object RegExp]"}class Ol{constructor(e){this.find=e.find,this.handler=e.handler}}const jk=(r,e)=>{if(of(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function Co(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Kk(c)+s;return o.forEach(f=>{if(u)return;const h=jk(d,f.find);if(!h)return;const p=l.state.tr,m=Dl({state:l.state,transaction:p}),g={from:n-(h[0].length-s.length),to:i},{commands:y,chain:v,can:E}=new rf({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:v,can:E})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:n,to:i,text:s}),l.dispatch(p),u=!0)}),u}function Wk(r){const{editor:e,rules:t}=r,n=new gt({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=sf(W.from(u),o.schema);const{from:d}=l,f=d+u.length;Co({editor:e,from:d,to:f,text:u,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Co({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Co({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Co({editor:e,from:o.pos,to:o.pos,text:`
69`,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function Yk(r){return Object.prototype.toString.call(r).slice(8,-1)}function Do(r){return Yk(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Ml(r,e){const t={...r};return Do(r)&&Do(e)&&Object.keys(e).forEach(n=>{Do(e[n])&&Do(r[n])?t[n]=Ml(r[n],e[n]):t[n]=e[n]}),t}class Rn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(ie(this,"addOptions",{name:this.name}))),this.storage=ye(ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Rn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Rn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ye(ie(t,"addOptions",{name:t.name})),t.storage=ye(ie(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}}function qk(r){return typeof r=="number"}class Xk{constructor(e){this.find=e.find,this.handler=e.handler}}const Qk=(r,e,t)=>{if(of(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Jk(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:c,can:u}=new rf({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(n,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");Qk(y,s.find,o).forEach(E=>{if(E.index===void 0)return;const b=m+E.index+1,_=b+E[0].length,I={from:t.tr.mapping.map(b),to:t.tr.mapping.map(_)},S=s.handler({state:t,range:I,match:E,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(S)})}),d.every(h=>h!==null)}let Po=null;const Zk=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",r),t};function eC(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=Dl({state:u,transaction:m});if(!(!Jk({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new gt({view(d){const f=p=>{var m;n=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,n&&(Po=e)},h=()=>{Po&&(Po=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=n===d.dom.parentElement,a=f,!s){const h=Po;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),v=!!y;if(!m&&!g&&!v)return;if(v){let{text:_}=y;typeof _=="string"?_=_:_=sf(W.from(_),h.schema);const{from:I}=y,S=I+_.length,A=Zk(_);return l({rule:u,state:h,from:I,to:{b:S},pasteEvt:A})}const E=f.doc.content.findDiffStart(h.doc.content),b=f.doc.content.findDiffEnd(h.doc.content);if(!(!qk(E)||!b||E===b.b))return l({rule:u,state:h,from:E,to:b,pasteEvt:o})}}))}function tC(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}class pi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=pi.resolve(e),this.schema=yE(this.extensions,t),this.setupExtensions()}static resolve(e){const t=pi.sort(pi.flatten(e)),n=tC(t.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},i=ie(t,"addExtensions",n);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((n,i)=>{const s=ie(n,"priority")||100,o=ie(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:$c(t.name,this.schema)},i=ie(t,"addCommands",n);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=pi.sort([...this.extensions].reverse()),n=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:$c(o.name,this.schema)},l=[],c=ie(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&ie(o,"exitable",a)&&(u.ArrowRight=()=>Rn.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));u={...u,...m}}const d=Tk(u);l.push(d);const f=ie(o,"addInputRules",a);Nm(o,e.options.enableInputRules)&&f&&n.push(...f());const h=ie(o,"addPasteRules",a);Nm(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=ie(o,"addProseMirrorPlugins",a);if(p){const m=p();l.push(...m)}return l}).flat();return[Wk({editor:e,rules:n}),...eC({editor:e,rules:i}),...s]}get attributes(){return gE(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Pl(this.extensions);return Object.fromEntries(t.filter(n=>!!ie(n,"addNodeView")).map(n=>{const i=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e,type:ct(n.name,this.schema)},o=ie(n,"addNodeView",s);if(!o)return[];const a=(l,c,u,d,f)=>{const h=Ku(l,i);return o()({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:n,HTMLAttributes:h})};return[n.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:$c(e.name,this.schema)};e.type==="mark"&&(!((t=ye(ie(e,"keepOnSplit",n)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=ie(e,"onBeforeCreate",n),s=ie(e,"onCreate",n),o=ie(e,"onUpdate",n),a=ie(e,"onSelectionUpdate",n),l=ie(e,"onTransaction",n),c=ie(e,"onFocus",n),u=ie(e,"onBlur",n),d=ie(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class xt{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(ie(this,"addOptions",{name:this.name}))),this.storage=ye(ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new xt({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ye(ie(t,"addOptions",{name:t.name})),t.storage=ye(ie(t,"addStorage",{name:t.name,options:t.options})),t}}function nC(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
70
71`,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,c,u,d)=>{var f;l.isBlock&&c>n&&(a+=s);const h=o?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)===null||f===void 0?void 0:f.slice(Math.max(n,c)-c,i-c))}),a}function rC(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}xt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new gt({key:new qt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=rC(t);return nC(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});const iC=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),sC=(r=!1)=>({commands:e})=>e.setContent("",r),oC=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Mi(h);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},aC=r=>e=>r(e),lC=()=>({state:r,dispatch:e})=>fE(r,e),cC=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new fe(n.doc.resolve(Math.max(o-1,0)))),!0},uC=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1},dC=r=>({tr:e,state:t,dispatch:n})=>{const i=ct(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},fC=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},hC=()=>({state:r,dispatch:e})=>Jd(r,e),pC=()=>({commands:r})=>r.keyboardShortcut("Enter"),mC=()=>({state:r,dispatch:e})=>Lk(r,e);function Oa(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:of(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function vE(r,e,t={}){return r.find(n=>n.type===e&&Oa(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function Fm(r,e,t={}){return!!vE(r,e,t)}function af(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((n=i.node.marks[0])===null||n===void 0?void 0:n.attrs),!vE([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Fm([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&Fm([...r.parent.child(l).marks],e,t);)c+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Er(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}const gC=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=Er(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=af(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=fe.create(o,d.from,d.to);t.setSelection(f)}}return!0},yC=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function EE(r){return r instanceof fe}function Cr(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function vC(r,e=null){if(!e)return null;const t=Se.atStart(r),n=Se.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?fe.create(r,Cr(0,i,s),Cr(r.content.size,i,s)):fe.create(r,Cr(e,i,s),Cr(e,i,s))}function Bm(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ma(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function EC(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const bC=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ma()||Bm())&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),EC()&&!Ma()&&!Bm()&&n.dom.focus({preventScroll:!0}))})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!EE(t.state.selection))return o(),!0;const a=vC(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},TC=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),SC=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),bE=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&bE(n)}return r};function Oo(r){const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return bE(t)}function Ds(r,e,t){if(r instanceof cr||r instanceof W)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return W.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Ds("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new f0({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?qo.fromSchema(l).parseSlice(Oo(r),t.parseOptions):qo.fromSchema(l).parse(Oo(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=qo.fromSchema(e);return t.slice?s.parseSlice(Oo(r),t.parseOptions).content:s.parse(Oo(r),t.parseOptions)}return Ds("",e,t)}function AC(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof qe||i instanceof at))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),r.setSelection(Se.near(r.doc.resolve(o),t))}const _C=r=>!("type"in r),RC=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ds(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Ds(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},f=!0,h=!0;if((_C(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){const{parent:g}=n.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof W){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;n.insertText(m,u,d)}else m=a,n.replaceWith(u,d,m);t.updateSelection&&AC(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:m}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:m})}return!0},IC=()=>({state:r,dispatch:e})=>_k(r,e),LC=()=>({state:r,dispatch:e})=>Rk(r,e),wC=()=>({state:r,dispatch:e})=>sE(r,e),xC=()=>({state:r,dispatch:e})=>cE(r,e),kC=()=>({state:r,dispatch:e,tr:t})=>{try{const n=wl(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},CC=()=>({state:r,dispatch:e,tr:t})=>{try{const n=wl(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},DC=()=>({state:r,dispatch:e})=>Sk(r,e),PC=()=>({state:r,dispatch:e})=>Ak(r,e);function TE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function OC(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Ma()||TE()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}const MC=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=OC(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(n.mapping);u&&i&&n.maybeStep(u)}),!0};function lf(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?ct(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(d,f)=>{if(d.isText)return;const h=Math.max(n,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-n,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Oa(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const NC=(r,e={})=>({state:t,dispatch:n})=>{const i=ct(r,t.schema);return lf(t,i,e)?Ik(t,n):!1},FC=()=>({state:r,dispatch:e})=>hE(r,e),BC=r=>({state:e,dispatch:t})=>{const n=ct(r,e.schema);return Bk(n)(e,t)},$C=()=>({state:r,dispatch:e})=>dE(r,e);function cf(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function $m(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}const UC=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=cf(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=ct(r,n.schema)),a==="mark"&&(o=Er(r,n.schema)),i&&t.selection.ranges.forEach(l=>{n.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,$m(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(u,u+c.nodeSize,o.create($m(d.attrs,e)))})})}),!0):!1},VC=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),GC=()=>({tr:r,dispatch:e})=>{if(e){const t=new Wt(r.doc);r.setSelection(t)}return!0},HC=()=>({state:r,dispatch:e})=>aE(r,e),zC=()=>({state:r,dispatch:e})=>uE(r,e),KC=()=>({state:r,dispatch:e})=>kk(r,e),jC=()=>({state:r,dispatch:e})=>Pk(r,e),WC=()=>({state:r,dispatch:e})=>Dk(r,e);function YC(r,e,t={},n={}){return Ds(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}const qC=(r,e=!1,t={},n={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,c;const{doc:u}=s;if(t.preserveWhitespace!=="full"){const d=YC(r,i.schema,t,{errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},r,{parseOptions:t,errorOnInvalidContent:(c=n.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function SE(r,e){const t=Er(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function XC(r,e){const t=new _x(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function QC(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function JC(r,e,t){const n=[];return r.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&n.push({node:i,pos:s})}),n}function ZC(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function uf(r){return e=>ZC(e.$from,r)}function eD(r,e){const t=pi.resolve(r);return yE(t,e)}function tD(r,e){const t=eD(e),n=cr.fromJSON(t,r);return sf(n.content,t)}function nD(r,e){const t=ct(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function rD(r,e){const t=cf(typeof e=="string"?e:e.name,r.schema);return t==="node"?nD(r,e):t==="mark"?SE(r,e):{}}function iD(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function sD(r){const e=iD(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function oD(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);n.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),sD(n)}function df(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r),o=af(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}function Jo(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}function aD(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?Er(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Oa(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;r.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),v=Math.min(p,g+m.nodeSize),E=v-y;o+=E,a.push(...m.marks.map(b=>({mark:b,from:y,to:v})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Oa(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function Um(r,e){const{nodeExtensions:t}=Pl(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=ye(ie(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function AE(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!==null&&n!==void 0?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(AE(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function lD(r){return r instanceof ae}function cD(r,e,t){var n;const{selection:i}=e;let s=null;if(EE(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!==null&&n!==void 0?n:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const uD=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=Er(r,n.schema);if(i)if(o){const c=SE(n,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;n.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&t.addMark(p,m,l.create({...y.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return cD(n,t,l)},dD=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),fD=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=ct(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Pm(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Pm(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hD=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=Cr(r,0,n.content.size),s=ae.create(n,i);e.setSelection(s)}return!0},pD=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=fe.atStart(n).from,a=fe.atEnd(n).to,l=Cr(i,o,a),c=Cr(s,o,a),u=fe.create(n,l,c);e.setSelection(u)}return!0},mD=r=>({state:e,dispatch:t})=>{const n=ct(r,e.schema);return Vk(n)(e,t)};function Vm(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}const gD=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=Jo(c,a.node().type.name,a.node().attrs);if(s instanceof ae&&s.node.isBlock)return!a.parentOffset||!Vn(o,a.pos)?!1:(n&&(r&&Vm(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:QC(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Vn(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Vn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),n){if(p&&(s instanceof fe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}r&&Vm(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},yD=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=ct(r,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if
vendor: 4,293 bytes, line 71
71(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=W.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-v;A>=l.depth-3;A-=1)y=W.from(l.node(A).copy(y));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...Jo(f,l.node().type.name,l.node().attrs),...e},_=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(b))||void 0;y=y.append(W.from(a.createAndFill(null,_)||void 0));const I=l.before(l.depth-(v-1));t.replace(I,l.after(-E),new Z(y,4-v,0));let S=-1;t.doc.nodesBetween(I,t.doc.content.size,(A,R)=>{if(S>-1)return!1;A.isTextblock&&A.content.size===0&&(S=R+1)}),S>-1&&t.setSelection(fe.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Jo(f,d.type.name,d.attrs),...e},m={...Jo(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=h?[{type:a,attrs:p},{type:h,attrs:m}]:[{type:a,attrs:p}];if(!Vn(t.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:v}=n,{splittableMarks:E}=s.extensionManager,b=v||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!b||!i)return!0;const _=b.filter(I=>E.includes(I.type.name));t.ensureMarks(_)}return!0},Uc=(r,e)=>{const t=uf(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&yr(r.doc,t.pos)&&r.join(t.pos),!0},Vc=(r,e)=>{const t=uf(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&yr(r.doc,n)&&r.join(n),!0},vD=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=ct(r,o.schema),p=ct(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:v}=m,E=y.blockRange(v),b=g||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const _=uf(I=>Um(I.type.name,d))(m);if(E.depth>=1&&_&&E.depth-_.depth<=1){if(_.node.type===h)return c.liftListItem(p);if(Um(_.node.type.name,d)&&h.validContent(_.node.content)&&a)return l().command(()=>(s.setNodeMarkup(_.pos,h),!0)).command(()=>Uc(s,h)).command(()=>Vc(s,h)).run()}return!t||!b||!a?l().command(()=>u().wrapInList(h,n)?!0:c.clearNodes()).wrapInList(h,n).command(()=>Uc(s,h)).command(()=>Vc(s,h)).run():l().command(()=>{const I=u().wrapInList(h,n),S=b.filter(A=>f.includes(A.type.name));return s.ensureMarks(S),I?!0:c.clearNodes()}).wrapInList(h,n).command(()=>Uc(s,h)).command(()=>Vc(s,h)).run()},ED=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Er(r,n.schema);return aD(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},bD=(r,e,t={})=>({state:n,commands:i})=>{const s=ct(r,n.schema),o=ct(e,n.schema),a=lf(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},TD=(r,e={})=>({state:t,commands:n})=>{const i=ct(r,t.schema);return lf(t,i,e)?n.lift(i):n.wrapIn(i,e)},SD=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},AD=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},_D=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=Er(r,n.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:f,to:h}=a;const p=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,m=af(c,l,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},RD=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=cf(typeof r=="string"?r:r.name,n.schema);return a?(a==="node"&&(s=ct(r,n.schema)),a==="mark"&&(o=Er(r,n.schema)),i&&t.selection.ranges.forEac
vendor: 8,772 bytes, line 71
71h(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,h,p;t.selection.empty?n.doc.nodesBetween(c,u,(m,g)=>{s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m)}):n.doc.nodesBetween(c,u,(m,g)=>{g<c&&s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){const v=Math.max(g,c),E=Math.min(g+m.nodeSize,u);t.addMark(v,E,o.create({...y.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(m=>{o===m.type&&t.addMark(h,p,o.create({...m.attrs,...e}))}))}),!0):!1},ID=(r,e={})=>({state:t,dispatch:n})=>{const i=ct(r,t.schema);return Ok(i,e)(t,n)},LD=(r,e={})=>({state:t,dispatch:n})=>{const i=ct(r,t.schema);return Mk(i,e)(t,n)};var wD=Object.freeze({__proto__:null,blur:iC,clearContent:sC,clearNodes:oC,command:aC,createParagraphNear:lC,cut:cC,deleteCurrentNode:uC,deleteNode:dC,deleteRange:fC,deleteSelection:hC,enter:pC,exitCode:mC,extendMarkRange:gC,first:yC,focus:bC,forEach:TC,insertContent:SC,insertContentAt:RC,joinBackward:wC,joinDown:LC,joinForward:xC,joinItemBackward:kC,joinItemForward:CC,joinTextblockBackward:DC,joinTextblockForward:PC,joinUp:IC,keyboardShortcut:MC,lift:NC,liftEmptyBlock:FC,liftListItem:BC,newlineInCode:$C,resetAttributes:UC,scrollIntoView:VC,selectAll:GC,selectNodeBackward:HC,selectNodeForward:zC,selectParentNode:KC,selectTextblockEnd:jC,selectTextblockStart:WC,setContent:qC,setMark:uD,setMeta:dD,setNode:fD,setNodeSelection:hD,setTextSelection:pD,sinkListItem:mD,splitBlock:gD,splitListItem:yD,toggleList:vD,toggleMark:ED,toggleNode:bD,toggleWrap:TD,undoInputRule:SD,unsetAllMarks:AD,unsetMark:_D,updateAttributes:RD,wrapIn:ID,wrapInList:LD});xt.create({name:"commands",addCommands(){return{...wD}}});xt.create({name:"drop",addProseMirrorPlugins(){return[new gt({key:new qt("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}});xt.create({name:"editable",addProseMirrorPlugins(){return[new gt({key:new qt("editable"),props:{editable:()=>this.editor.options.editable}})]}});const xD=new qt("focusEvents");xt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new gt({key:xD,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}});xt.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:Se.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ma()||TE()?s:i},addProseMirrorPlugins(){return[new gt({key:new qt("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(m=>m.getMeta("composition")))return;const n=r.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=r.some(m=>m.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=Se.atStart(e.doc).from,c=Se.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!AE(t.doc))return;const f=t.tr,h=Dl({state:t,transaction:f}),{commands:p}=new rf({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}});xt.create({name:"paste",addProseMirrorPlugins(){return[new gt({key:new qt("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}});xt.create({name:"tabindex",addProseMirrorPlugins(){return[new gt({key:new qt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function xi(r){return new Ol({find:r.find,handler:({state:e,range:t,match:n})=>{const i=ye(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],a=n[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(df(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===r.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&s.delete(u,t.to),c>t.from&&s.delete(t.from+l,c);const f=t.from+l+o.length;s.addMark(t.from+l,f,r.type.create(i||{})),s.removeStoredMark(r.type)}}})}function kD(r){return new Ol({find:r.find,handler:({state:e,range:t,match:n})=>{const i=ye(r.getAttributes,void 0,n)||{},{tr:s}=e,o=t.from;let a=t.to;const l=r.type.create(i);if(n[1]){const c=n[0].lastIndexOf(n[1]);let u=o+c;u>a?u=a:a=u+n[1].length;const d=n[0][n[0].length-1];s.insertText(d,o+n[0].length-1),s.replaceWith(u,a,l)}else if(n[0]){const c=r.type.isInline?o:o-1;s.insert(c,r.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function ju(r){return new Ol({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=ye(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)}})}function Ps(r){return new Ol({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=ye(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Gd(l,r.type,s);if(!c)return null;if(o.wrap(l,c),r.keepMarks&&r.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=r.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(r.keepAttributes){const d=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===r.type&&yr(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,u))&&o.join(t.from-1)}})}let ln=class Wu{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(ie(this,"addOptions",{name:this.name}))),this.storage=ye(ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Wu(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Wu(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ye(ie(t,"addOptions",{name:t.name})),t.storage=ye(ie(t,"addStorage",{name:t.name,options:t.options})),t}};function Yr(r){return new Xk({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=ye(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,a=n[n.length-1],l=n[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(df(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===r.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function CD(r,e){const{selection:t}=r,{$from:n}=t;if(t instanceof ae){const s=n.index();return n.parent.canReplaceWith(s,s+1,e)}let i=n.depth;for(;i>=0;){const s=n.index(i);if(n.node(i).contentMatchAt(s).matchType(e))return!0;
71i-=1}return!1}const DD="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
71hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",PD="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Yu="numeric",qu="ascii",Xu="alpha",as="asciinumeric",qi="alphanumeric",Qu="domain",_E="emoji",OD="scheme",MD="slashscheme",Gc="whitespace";function ND(r,e){return r in e||(e[r]=[]),e[r]}function Dr(r,e,t){e[Yu]&&(e[as]=!0,e[qi]=!0),e[qu]&&(e[as]=!0,e[Xu]=!0),e[as]&&(e[qi]=!0),e[Xu]&&(e[qi]=!0),e[qi]&&(e[Qu]=!0),e[_E]&&(e[Qu]=!0);for(const n in e){const i=ND(n,t);i.indexOf(r)<0&&i.push(r)}}function FD(r,e){const t={};for(const n in e)e[n].indexOf(r)>=0&&(t[n]=!0);return t}function Mt(r=null){this.j={},this.jr=[],this.jd=null,this.t=r}Mt.groups={};Mt.prototype={accepts(){return!!this.t},go(r){const e=this,t=e.j[r];if(t)return t;for(let n=0;n<e.jr.length;n++){const i=e.jr[n][0],s=e.jr[n][1];if(s&&i.test(r))return s}return e.jd},has(r,e=!1){return e?r in this.j:!!this.go(r)},ta(r,e,t,n){for(let i=0;i<r.length;i++)this.tt(r[i],e,t,n)},tr(r,e,t,n){n=n||Mt.groups;let i;return e&&e.j?i=e:(i=new Mt(e),t&&n&&Dr(e,t,n)),this.jr.push([r,i]),i},ts(r,e,t,n){let i=this;const s=r.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(r[o]);return i.tt(r[s-1],e,t,n)},tt(r,e,t,n){n=n||Mt.groups;const i=this;if(e&&e.j)return i.j[r]=e,e;const s=e;let o,a=i.go(r);if(a?(o=new Mt,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Mt,s){if(n)if(o.t&&typeof o.t=="string"){const l=Object.assign(FD(o.t,n),t);Dr(s,l,n)}else t&&Dr(s,t,n);o.t=s}return i.j[r]=o,o}};const me=(r,e,t,n,i)=>r.ta(e,t,n,i),He=(r,e,t,n,i)=>r.tr(e,t,n,i),Gm=(r,e,t,n,i)=>r.ts(e,t,n,i),Y=(r,e,t,n,i)=>r.tt(e,t,n,i),Pn="WORD",Ju="UWORD",RE="ASCIINUMERICAL",IE="ALPHANUMERICAL",Os="LOCALHOST",Zu="TLD",ed="UTLD",Zo="SCHEME",fi="SLASH_SCHEME",ff="NUM",td="WS",hf="NL",ls="OPENBRACE",cs="CLOSEBRACE",Na="OPENBRACKET",Fa="CLOSEBRACKET",Ba="OPENPAREN",$a="CLOSEPAREN",Ua="OPENANGLEBRACKET",Va="CLOSEANGLEBRACKET",Ga="FULLWIDTHLEFTPAREN",Ha="FULLWIDTHRIGHTPAREN",za="LEFTCORNERBRACKET",Ka="RIGHTCORNERBRACKET",ja="LEFTWHITECORNERBRACKET",Wa="RIGHTWHITECORNERBRACKET",Ya="FULLWIDTHLESSTHAN",qa="FULLWIDTHGREATERTHAN",Xa="AMPERSAND",Qa="APOSTROPHE",Ja="ASTERISK",er="AT",Za="BACKSLASH",el="BACKTICK",tl="CARET",Pr="COLON",pf="COMMA",nl="DOLLAR",pn="DOT",rl="EQUALS",mf="EXCLAMATION",Jt="HYPHEN",us="PERCENT",il="PIPE",sl="PLUS",ol="POUND",ds="QUERY",gf="QUOTE",LE="FULLWIDTHMIDDLEDOT",yf="SEMI",mn="SLASH",fs="TILDE",al="UNDERSCORE",wE="EMOJI",ll="SYM";var xE=Object.freeze({__proto__:null,ALPHANUMERICAL:IE,AMPERSAND:Xa,APOSTROPHE:Qa,ASCIINUMERICAL:RE,ASTERISK:Ja,AT:er,BACKSLASH:Za,BACKTICK:el,CARET:tl,CLOSEANGLEBRACKET:Va,CLOSEBRACE:cs,CLOSEBRACKET:Fa,CLOSEPAREN:$a,COLON:Pr,COMMA:pf,DOLLAR:nl,DOT:pn,EMOJI:wE,EQUALS:rl,EXCLAMATION:mf,FULLWIDTHGREATERTHAN:qa,FULLWIDTHLEFTPAREN:Ga,FULLWIDTHLESSTHAN:Ya,FULLWIDTHMIDDLEDOT:LE,FULLWIDTHRIGHTPAREN:Ha,HYPHEN:Jt,LEFTCORNERBRACKET:za,LEFTWHITECORNERBRACKET:ja,LOCALHOST:Os,NL:hf,NUM:ff,OPENANGLEBRACKET:Ua,OPENBRACE:ls,OPENBRACKET:Na,OPENPAREN:Ba,PERCENT:us,PIPE:il,PLUS:sl,POUND:ol,QUERY:ds,QUOTE:gf,RIGHTCORNERBRACKET:Ka,RIGHTWHITECORNERBRACKET:Wa,SCHEME:Zo,SEMI:yf,SLASH:mn,SLASH_SCHEME:fi,SYM:ll,TILDE:fs,TLD:Zu,UNDERSCORE:al,UTLD:ed,UWORD:Ju,WORD:Pn,WS:td});const Cn=/[a-z]/,Hi=new RegExp("\\p{L}","u"),Hc=new RegExp("\\p{Emoji}","u"),Dn=/\d/,zc=/\s/,Hm="\r",Kc=`
72`,BD="️",$D="‍",jc="";let Mo=null,No=null;function UD(r=[]){const e={};Mt.groups=e;const t=new Mt;Mo==null&&(Mo=zm(DD)),No==null&&(No=zm(PD)),Y(t,"'",Qa),Y(t,"{",ls),Y(t,"}
72",cs),Y(t,"[",Na),Y(t,"]",Fa),Y(t,"(",Ba),Y(t,")",$a),Y(t,"<",Ua),Y(t,">",Va),Y(t,"(",Ga),Y(t,")",Ha),Y(t,"「",za),Y(t,"」",Ka),Y(t,"『",ja),Y(t,"』",Wa),Y(t,"<",Ya),Y(t,">",qa),Y(t,"&",Xa),Y(t,"*",Ja),Y(t,"@",er),Y(t,"`",el),Y(t,"^",tl),Y(t,":",Pr),Y(t,",",pf),Y(t,"$",nl),Y(t,".",pn),Y(t,"=",rl),Y(t,"!",mf),Y(t,"-",Jt),Y(t,"%",us),Y(t,"|",il),Y(t,"+",sl),Y(t,"#",ol),Y(t,"?",ds),Y(t,'"',gf),Y(t,"/",mn),Y(t,";",yf),Y(t,"~",fs),Y(t,"_",al),Y(t,"\\",Za),Y(t,"・",LE);const n=He(t,Dn,ff,{[Yu]:!0});He(n,Dn,n);const i=He(n,Cn,RE,{[as]:!0}),s=He(n,Hi,IE,{[qi]:!0}),o=He(t,Cn,Pn,{[qu]:!0});He(o,Dn,i),He(o,Cn,o),He(i,Dn,i),He(i,Cn,i);const a=He(t,Hi,Ju,{[Xu]:!0});He(a,Cn),He(a,Dn,s),He(a,Hi,a),He(s,Dn,s),He(s,Cn),He(s,Hi,s);const l=Y(t,Kc,hf,{[Gc]:!0}),c=Y(t,Hm,td,{[Gc]:!0}),u=He(t,zc,td,{[Gc]:!0});Y(t,jc,u),Y(c,Kc,l),Y(c,jc,u),He(c,zc,u),Y(u,Hm),Y(u,Kc),He(u,zc,u),Y(u,jc,u);const d=He(t,Hc,wE,{[_E]:!0});Y(d,"#"),He(d,Hc,d),Y(d,BD,d);const f=Y(d,$D);Y(f,"#"),He(f,Hc,d);const h=[[Cn,o],[Dn,i]],p=[[Cn,null],[Hi,a],[Dn,s]];for(let m=0;m<Mo.length;m++)Xn(t,Mo[m],Zu,Pn,h);for(let m=0;m<No.length;m++)Xn(t,No[m],ed,Ju,p);Dr(Zu,{tld:!0,ascii:!0},e),Dr(ed,{utld:!0,alpha:!0},e),Xn(t,"file",Zo,Pn,h),Xn(t,"mailto",Zo,Pn,h),Xn(t,"http",fi,Pn,h),Xn(t,"https",fi,Pn,h),Xn(t,"ftp",fi,Pn,h),Xn(t,"ftps",fi,Pn,h),Dr(Zo,{scheme:!0,ascii:!0},e),Dr(fi,{slashscheme:!0,ascii:!0},e),r=r.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<r.length;m++){const g=r[m][0],v=r[m][1]?{[OD]:!0}:{[MD]:!0};g.indexOf("-")>=0?v[Qu]=!0:Cn.test(g)?Dn.test(g)?v[as]=!0:v[qu]=!0:v[Yu]=!0,Gm(t,g,g,v)}return Gm(t,"localhost",Os,{ascii:!0}),t.jd=new Mt(ll),{start:t,tokens:Object.assign({groups:e},xE)}}function kE(r,e){const t=VD(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=t.length,i=[];let s=0,o=0;for(;o<n;){let a=r,l=null,c=0,u=null,d=-1,f=-1;for(;o<n&&(l=a.go(t[o]));
vendor: 11,430 bytes, lines 72-75
72)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function VD(r){const e=[],t=r.length;let n=0;for(;n<t;){let i=r.charCodeAt(n),s,o=i<55296||i>56319||n+1===t||(s=r.charCodeAt(n+1))<56320||s>57343?r[n]:r.slice(n,n+2);e.push(o),n+=o.length}return e}function Xn(r,e,t,n,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];r.j[l]?s=r.j[l]:(s=new Mt(n),s.jr=i.slice(),r.j[l]=s),r=s}return s=new Mt(t),s.jr=i.slice(),r.j[e[o-1]]=s,s}function zm(r){const e=[],t=[];let n=0,i="0123456789";for(;n<r.length;){let s=0;for(;i.indexOf(r[n+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(r.substring(n,n+s),10);o>0;o--)t.pop();n+=s}else t.push(r[n]),n++}return e}const Ms={defaultProtocol:"http",events:null,format:Km,formatHref:Km,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vf(r,e=null){let t=Object.assign({},Ms);r&&(t=Object.assign(t,r instanceof vf?r.o:r));const n=t.ignoreTags,i=[];for(let s=0;s<n.length;s++)i.push(n[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}vf.prototype={o:Ms,ignoreTags:[],defaultRender(r){return r},check(r){return this.get("validate",r.toString(),r)},get(r,e,t){const n=e!=null;let i=this.o[r];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Ms[r],typeof i=="function"&&n&&(i=i(e,t))):typeof i=="function"&&n&&(i=i(e,t.t,t)),i)},getObj(r,e,t){let n=this.o[r];return typeof n=="function"&&e!=null&&(n=n(e,t.t,t)),n},render(r){const e=r.render(this);return(this.get("render",null,r)||this.defaultRender)(e,r.t,r)}};function Km(r){return r}function CE(r,e){this.t="token",this.v=r,this.tk=e}CE.prototype={isLink:!1,toString(){return this.v},toHref(r){return this.toString()},toFormattedString(r){const e=this.toString(),t=r.get("truncate",e,this),n=r.get("format",e,this);return t&&n.length>t?n.substring(0,t)+"…":n},toFormattedHref(r){return r.get("formatHref",this.toHref(r.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(r=Ms.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(r),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(r){return{type:this.t,value:this.toFormattedString(r),isLink:this.isLink,href:this.toFormattedHref(r),start:this.startIndex(),end:this.endIndex()}},validate(r){return r.get("validate",this.toString(),this)},render(r){const e=this,t=this.toHref(r.get("defaultProtocol")),n=r.get("formatHref",t,this),i=r.get("tagName",t,e),s=this.toFormattedString(r),o={},a=r.get("className",t,e),l=r.get("target",t,e),c=r.get("rel",t,e),u=r.getObj("attributes",t,e),d=r.getObj("events",t,e);return o.href=n,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Nl(r,e){class t extends CE{constructor(i,s){super(i,s),this.t=r}}for(const n in e)t.prototype[n]=e[n];return t.t=r,t}const GD=Nl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jm=Nl("text"),HD=Nl("nl"),Fo=Nl("url",{isLink:!0,toHref(r=Ms.defaultProtocol){return this.hasProtocol()?this.v:`${r}://${this.v}`},hasProtocol(){const r=this.tk;return r.length>=2&&r[0].t!==Os&&r[1].t===Pr}}),Qt=r=>new Mt(r);function zD({groups:r}){const e=r.domain.concat([Xa,Ja,er,Za,el,tl,nl,rl,Jt,ff,us,il,sl,ol,mn,ll,fs,al]),t=[Qa,Pr,pf,pn,mf,us,ds,gf,yf,Ua,Va,ls,cs,Fa,Na,Ba,$a,Ga,Ha,za,Ka,ja,Wa,Ya,qa],n=[Xa,Qa,Ja,Za,el,tl,nl,rl,Jt,ls,cs,us,il,sl,ol,ds,mn,ll,fs,al],i=Qt(),s=Y(i,fs);me(s,n,s),me(s,r.domain,s);const o=Qt(),a=Qt(),l=Qt();me(i,r.domain,o),me(i,r.scheme,a),me(i,r.slashscheme,l),me(o,n,s),me(o,r.domain,o);const c=Y(o,er);Y(s,er,c),Y(a,er,c),Y(l,er,c);const u=Y(s,pn);me(u,n,s),me(u,r.domain,s);const d=Qt();me(c,r.domain,d),me(d,r.domain,d);const f=Y(d,pn);me(f,r.domain,d);const h=Qt(GD);me(f,r.tld,h),me(f,r.utld,h),Y(c,Os,h);const p=Y(d,Jt);Y(p,Jt,p),me(p,r.domain,d),me(h,r.domain,d),Y(h,pn,f),Y(h,Jt,p);const m=Y(o,Jt),g=Y(o,pn);Y(m,Jt,m),me(m,r.domain,o),me(g,n,s),me(g,r.domain,o);const y=Qt(Fo);me(g,r.tld,y),me(g,r.utld,y),me(y,r.domain,o),me(y,n,s),Y(y,pn,g),Y(y,Jt,m),Y(y,er,c);const v=Y(y,Pr),E=Qt(Fo);me(v,r.numeric,E);const b=Qt(Fo),_=Qt();me(b,e,b),me(b,t,_),me(_,e,b),me(_,t,_),Y(y,mn,b),Y(E,mn,b);const I=Y(a,Pr),S=Y(l,Pr),A=Y(S,mn),R=Y(A,mn);me(a,r.domain,o),Y(a,pn,g),Y(a,Jt,m),me(l,r.domain,o),Y(l,pn,g),Y(l,Jt,m),me(I,r.domain,b),Y(I,mn,b),Y(I,ds,b),me(R,r.domain,b),me(R,e,b),Y(R,mn,b);const L=[[ls,cs],[Na,Fa],[Ba,$a],[Ua,Va],[Ga,Ha],[za,Ka],[ja,Wa],[Ya,qa]];for(let C=0;C<L.length;C++){const[O,D]=L[C],P=Y(b,O);Y(_,O,P);const M=Qt(Fo);me(P,e,M);const N=Qt();me(P,t,N),Y(P,D,b),me(M,e,M),me(M,t,N),me(N,e,M),me(N,t,N),Y(M,D,b),Y(N,D,b)}return Y(i,Os,y),Y(i,hf,HD),{start:i,tokens:xE}}function KD(r,e,t){let n=t.length,i=0,s=[],o=[];for(;i<n;){let a=r,l=null,c=null,u=0,d=null,f=-1;for(;i<n&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<n&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,i++,u++;if(f<0)i-=u,i<n&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Wc(jm,e,o)),o=[]),i-=f,u-=f;const h=d.t,p=t.slice(i-u,i);s.push(Wc(h,e,p))}}return o.length>0&&s.push(Wc(jm,e,o)),s}function Wc(r,e,t){const n=t[0].s,i=t[t.length-1].e,s=e.slice(n,i);return new r(s,t)}const jD=typeof console<"u"&&console&&console.warn||(()=>{}),WD="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ne={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function YD(){return Mt.groups={},Ne.scanner=null,Ne.parser=null,Ne.tokenQueue=[],Ne.pluginQueue=[],Ne.customSchemes=[],Ne.initialized=!1,Ne}function Wm(r,e=!1){if(Ne.initialized&&jD(`linkifyjs: already initialized - will not register custom scheme "${r}" ${WD}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(r))throw new Error(`linkifyjs: incorrect scheme format.
731. Must only contain digits, lowercase ASCII letters or "-"
742. Cannot start or end with "-"
753. "-" cannot repeat`);Ne.customSchemes.push([r,e])}function qD(){Ne.scanner=UD(Ne.customSchemes);for(let r=0;r<Ne.tokenQueue.length;r++)Ne.tokenQueue[r][1]({scanner:Ne.scanner});Ne.parser=zD(Ne.scanner.tokens);for(let r=0;r<Ne.pluginQueue.length;r++)Ne.pluginQueue[r][1]({scanner:Ne.scanner,parser:Ne.parser});return Ne.initialized=!0,Ne}function Ef(r){return Ne.initialized||qD(),KD(Ne.parser.start,r,kE(Ne.scanner.start,r))}Ef.scan=kE;function DE(r,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const n=new vf(t),i=Ef(r),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&n.check(a)&&s.push(a.toFormattedObject(n))}return s}const bf="[\0-   ᠎ -\u2029  ]",XD=new RegExp(bf),QD=new RegExp(`${bf}$`),JD=new RegExp(bf,"g");function ZD(r){return r.length===1?r[0].isLink:r.length===3&&r[1].isLink?["()","[]"].includes(r[0].value+r[2].value):!1}function eP(r){return new gt({key:new qt("autolink"),appendTransaction:(e,t,n)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(n.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=n,a=XC(t.doc,[...e]);if(oD(a).forEach(({newRange:c})=>{const u=JC(n.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=n.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=n.doc.textBetween(c.from,c.to," "," ");if(!QD.test(h))return;d=u[0],f=n.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(XD).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=Ef(p).map(y=>y.toObject(r.defaultProtocol));if(!ZD(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>n.schema.marks.code?!n.doc.rangeHasMark(y.from,y.to,n.schema.marks.code):!0).filter(y=>r.validate(y.value)).filter(y=>r.shouldAutoLink(y.value)).forEach(y=>{df(y.from,y.to,n.doc).some(v=>v.mark.type===r.type)||o.addMark(y.from,y.to,r.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function tP(r){return new gt({key:new qt("handleClickLink"),props:{handleClick:(e,t,n)=>{var i,s;if(n.button!==0||!e.editable)return!1;let o=n.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;const l=rD(e.state,r.type.name),c=n.target,u=(i=c?.href)!==null&&i!==void 0?i:l.href,d=(s=c?.target)!==null&&s!==void 0?s:l.target;return c&&u?(window.open(u,d),!0):!1}}})}function nP(r){return new gt({key:new qt("handlePasteLink"),props:{handlePaste:(e,t,n)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";n.content.forEach(c=>{a+=c.textContent});const l=DE(a,{defaultProtocol:r.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!l?!1:r.editor.commands.setMark(r.type,{href:l.href})}}})}function Rr(r,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const i=typeof n=="string"?n:n.scheme;i&&t.push(i)}),!r||r.replace(JD,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const rP=Rn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(r=>{if(typeof r=="string"){Wm(r);return}Wm(r.scheme,r.optionalSlashes)})},onDestroy(){YD()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(r,e)=>!!Rr(r,e.protocols),validate:r=>!!r,shouldAutoLink:r=>!!r}},addAttributes(){return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:r=>{const e=r.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Rr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:r}){return this.options.isAllowedUri(r.href,{defaultValidate:e=>!!Rr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ut(this.options.HTMLAttributes,r),0]:["a",ut(this.options.HTMLAttributes,{...r,href:""}),0]},addCommands(){return{setLink:r=>({chain:e})=>{const{href:t}=r;return this.options.isAllowedUri(t,{defaultValidate:n=>!!Rr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,r).setMeta("preventAutolink",!0).run():!1},toggleLink:r=>({chain:e})=>{const{href:t}=r;return this.options.isAllowedUri(t,{defaultValidate:n=>!!Rr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,r,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:r})=>r().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yr({find:r=>{const e=[];
vendor: 9,073 bytes, lines 75-78
75if(r){const{protocols:t,defaultProtocol:n}=this.options,i=DE(r).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Rr(o,t),protocols:t,defaultProtocol:n}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:r=>{var e;return{href:(e=r.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const r=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&r.push(eP({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:i=>!!Rr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&r.push(tP({type:this.type})),this.options.linkOnPaste&&r.push(nP({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),r}}),iP=Rn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["u",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setUnderline:()=>({commands:r})=>r.setMark(this.name),toggleUnderline:()=>({commands:r})=>r.toggleMark(this.name),unsetUnderline:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),sP=/^\s*>\s$/,oP=ln.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:r}){return["blockquote",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setBlockquote:()=>({commands:r})=>r.wrapIn(this.name),toggleBlockquote:()=>({commands:r})=>r.toggleWrap(this.name),unsetBlockquote:()=>({commands:r})=>r.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ps({find:sP,type:this.type})]}}),aP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,cP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,uP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dP=Rn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:r=>r.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:r=>r.type.name===this.name},{style:"font-weight",getAttrs:r=>/^(bold(er)?|[5-9]\d{2,})$/.test(r)&&null}]},renderHTML({HTMLAttributes:r}){return["strong",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setBold:()=>({commands:r})=>r.setMark(this.name),toggleBold:()=>({commands:r})=>r.toggleMark(this.name),unsetBold:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[xi({find:aP,type:this.type}),xi({find:cP,type:this.type})]},addPasteRules(){return[Yr({find:lP,type:this.type}),Yr({find:uP,type:this.type})]}}),fP="listItem",Ym="textStyle",qm=/^\s*([-+*])\s$/,hP=ln.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fP,this.editor.getAttributes(Ym)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=Ps({find:qm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Ps({find:qm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ym),editor:this.editor})),[r]}}),pP=/(^|[^`])`([^`]+)`(?!`)/,mP=/(^|[^`])`([^`]+)`(?!`)/g,gP=Rn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:r}){return["code",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setCode:()=>({commands:r})=>r.setMark(this.name),toggleCode:()=>({commands:r})=>r.toggleMark(this.name),unsetCode:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[xi({find:pP,type:this.type})]},addPasteRules(){return[Yr({find:mP,type:this.type})]}}),yP=/^```([a-z]+)?[\s\n]$/,vP=/^~~~([a-z]+)?[\s\n]$/,EP=ln.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=r.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",ut(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:r,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!r||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:r})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=r,{selection:t}=e,{$from:n,empty:i}=t;if(!i||n.parent.type!==this.type)return!1;const s=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith(`
76
77`);return!s||!o?!1:r.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:n}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:n.nodeAt(a)?r.commands.command(({tr:c})=>(c.setSelection(Se.near(n.resolve(a))),!0)):r.commands.exitCode()}}},addInputRules(){return[ju({find:yP,type:this.type,getAttributes:r=>({language:r[1]})}),ju({find:vP,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new gt({key:new qt("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=r.state,l=a.text(t.replace(/\r\n?/g,`
78`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(fe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),r.dispatch(o),!0}}})]}}),bP=ln.create({name:"doc",topNode:!0,content:"block+"});function TP(r={}){return new gt({view(e){return new SP(e,r)}})}class SP{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let n=this.computeTarget(this.lastDragEvent);n==this.cursorPos?this.updateOverlay():this.setCursor(n)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;n={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;
78n={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(n.left-c)/o+"px",this.element.style.top=(n.top-u)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(!t||s)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=A0(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const AP=xt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[TP(this.options)]}});class Ke extends Se{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Ke.valid(n)?new Ke(n):Se.near(n)}content(){return Z.empty}eq(e){return e instanceof Ke&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ke(e.resolve(t.pos))}getBookmark(){return new Tf(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!_P(e)||!RP(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Ke.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Ke.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ae.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Ke.valid(a))return a}return null}}}Ke.prototype.visible=!1;Ke.findFrom=Ke.findGapCursorFrom;Se.jsonID("gapcursor",Ke);class Tf{constructor(e){this.pos=e}map(e){return new Tf(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ke.valid(t)?new Ke(t):Se.near(t)}}function PE(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function _P(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||PE(i.type))return!0;if(i.inlineContent)return!1}}return!0}function RP(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||PE(i.type))return!0;if(i.inlineContent)return!1}}return!0}function IP(){return new gt({props:{decorations:kP,createSelectionBetween(r,e,t){return e.pos==t.pos&&Ke.valid(t)?new Ke(t):null}
vendor: 3,513 bytes, lines 78-79
78,handleClick:wP,handleKeyDown:LP,handleDOMEvents:{beforeinput:xP}}})}const LP=rE({ArrowLeft:Bo("horiz",-1),ArrowRight:Bo("horiz",1),ArrowUp:Bo("vert",-1),ArrowDown:Bo("vert",1)});function Bo(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof fe){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=Ke.findGapCursorFrom(a,e,l);return c?(i&&i(n.tr.setSelection(new Ke(c))),!0):!1}}function wP(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!Ke.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&ae.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Ke(n))),!0)}function xP(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Ke))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=W.empty;for(let o=n.length-1;o>=0;o--)i=W.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new Z(i,0,0));return s.setSelection(fe.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function kP(r){if(!(r.selection instanceof Ke))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",st.create(r.doc,[Tn.widget(r.selection.head,e,{key:"gapcursor"})])}const CP=xt.create({name:"gapCursor",addProseMirrorPlugins(){return[IP()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=ye(ie(r,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),DP=ln.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",ut(this.options.HTMLAttributes,r)]},renderText(){return`
79`},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),PP=ln.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,ut(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>ju({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}}
79)\\s$`),type:this.type,getAttributes:{level:r}}))}});var cl=200,lt=function(){};lt.prototype.append=function(e){return e.length?(e=lt.from(e),!this.length&&e||e.length<cl&&this.leafAppend(e)||this.length<cl&&e.leafPrepend(this)||this.appendInner(e)):this};lt.prototype.prepend=function(e){return e.length?lt.from(e).append(this):this};lt.prototype.appendInner=function(e){return new OP(this,e)};lt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?lt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};lt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};lt.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};lt.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};lt.from=function(e){return e instanceof lt?e:e&&e.length?new OE(e):lt.empty};var OE=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=cl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=cl)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(lt);lt.empty=new OE([]);var OP=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(n,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(n,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(lt);const MP=500;class on{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new gn(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new gn(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new on(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,n,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new gn(e.mapping.maps[u],d,t),h;(h=l&&l.merge(f))&&(f=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(f),t&&(o++,t=void 0),i||(l=f)}let c=o-n.depth;return c>FP&&(a=NP(a,c),o-=c),new on(a.append(s),o)}remapping(e,t){let n=new ws;
vendor: 4,369 bytes, line 79
79return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new on(this.items.append(e.map(t=>new gn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(l+1,h));g&&a++,n.push(new gn(p,m,g))}else n.push(new gn(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new gn(s.maps[f]));let u=this.items.slice(0,i).append(c).append(n),d=new on(u,a);return d.emptyItemCount()>MP&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(n)),c=l&&l.getMap();if(n--,c&&t.appendMap(c,n),l){let u=o.selection&&o.selection.map(t.slice(n));u&&s++;let d=new gn(c.invert(),l,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&n--},this.items.length,0),new on(lt.from(i.reverse()),s)}}on.empty=new on(lt.empty,0);function NP(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class gn{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new gn(t.getMap().invert(),t,this.selection)}}}class tr{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const FP=20;function BP(r,e,t,n){let i=t.getMeta(Ur),s;if(i)return i.historyState;t.getMeta(VP)&&(r=new tr(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(Ur))return o.getMeta(Ur).redo?new tr(r.done.addTransform(t,void 0,n,ea(e)),r.undone,Xm(t.mapping.maps),r.prevTime,r.prevComposition):new tr(r.done,r.undone.addTransform(t,void 0,n,ea(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=a&&(r.prevTime<(t.time||0)-n.newGroupDelay||!$P(t,r.prevRanges)),c=o?Yc(r.prevRanges,t.mapping):Xm(t.mapping.maps);return new tr(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,ea(e)),on.empty,c,t.time,a??r.prevComposition)}else return(s=t.getMeta("rebased"))?new tr(r.done.rebased(t,s),r.undone.rebased(t,s),Yc(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new tr(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Yc(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function $P(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Xm(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Yc(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function UP(r,e,t){let n=ea(e),i=Ur.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),l=new tr(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Ur,{redo:t,historyState:l})}let qc=!1,Qm=null;function ea(r){let e=r.plugins;if(Qm!=e){qc=!1,Qm=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){qc=!0;break}}return qc}const Ur=new qt("history"),VP=new qt("closeHistory");function GP(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new gt({key:Ur,state:{init(){return new tr(on.empty,on.empty,null,0,-1)},apply(e,t,n){return BP(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?NE:n=="historyRedo"?FE:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function ME(r,e){return(t,n)=>{let i=Ur.getState(t);
vendor: 5,750 bytes, line 79
79if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=UP(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const NE=ME(!1,!0),FE=ME(!0,!0),HP=xt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>NE(r,e),redo:()=>({state:r,dispatch:e})=>FE(r,e)}},addProseMirrorPlugins(){return[GP(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),zP=ln.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",ut(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!CD(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):lD(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var l;if(a){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(fe.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(ae.create(o.doc,c.pos)):o.setSelection(fe.create(o.doc,c.pos));else{const d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(o.insert(u,d),o.setSelection(fe.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[kD({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),KP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,jP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,WP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,YP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qP=Rn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[xi({find:KP,type:this.type}),xi({find:WP,type:this.type})]},addPasteRules(){return[Yr({find:jP,type:this.type}),Yr({find:YP,type:this.type})]}}),XP=ln.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",ut(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),QP="listItem",Jm="textStyle",Zm=/^(\d+)\.\s$/,JP=ln.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",ut(this.options.HTMLAttributes,t),0]:["ol",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QP,this.editor.getAttributes(Jm)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=Ps({find:Zm,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Ps({find:Zm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Jm)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),ZP=ln.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nO=Rn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",ut(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[xi({find:eO,type:this.type})]}
79,addPasteRules(){return[Yr({find:tO,type:this.type})]}}),rO=ln.create({name:"text",group:"inline"}),iO=xt.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(dP.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(oP.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(hP.configure(this.options.bulletList)),this.options.code!==!1&&r.push(gP.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(EP.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(bP.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(AP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(CP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(DP.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(PP.configure(this.options.heading)),this.options.history!==!1&&r.push(HP.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(zP.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(qP.configure(this.options.italic)),this.options.listItem!==!1&&r.push(XP.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(JP.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(ZP.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(nO.configure(this.options.strike)),this.options.text!==!1&&r.push(rO.configure(this.options.text)),r}}),sO=r=>typeof r=="object"&&r!==null&&"type"in r&&typeof r.type=="string",oO=[iO.configure({paragraph:{HTMLAttributes:{class:"py-0.5"}},bulletList:{HTMLAttributes:{class:"list-disc ml-4"}}}),rP.configure({autolink:!0,defaultProtocol:"https",openOnClick:!0}),iP.configure({HTMLAttributes:{class:"underline"}})],sM=({data:r})=>{if(!sO(r))return null;let e;try{e=tD(r,oO)}catch(t){return console.error("[TipTapContent] failed to render document",t),null}return V.jsx("div",{dangerouslySetInnerHTML:{__html:e}})},aO="_input_zdfyj_5",lO="_label_zdfyj_12",eg={input:aO,label:lO},oM=k.forwardRef(function({className:e="",label:t,hideLabel:n=!1,...i},s){return V.jsxs("label",{className:"text-text-primary has-disabled:!text-text-tertiary flex shrink-0 flex-row items-center gap-1",children:[V.jsx("span",{className:Ee("text-xxs flex flex-row items-center whitespace-nowrap",{hidden:n}),children:t}),V.jsx("input",{type:"checkbox",className:Ee(eg.input,e),ref:s,...i}),V.jsx("span",{className:eg.label,children:"Toggle"})]})});var Re=function(){return Re=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Re.apply(this,arguments)};function Sf(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function $t(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return r.concat(s||Array.prototype.slice.call(e))}var In=function(r){return r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},cO={k:1e3,m:1e6,b:1e9},uO=function(r,e){e===void 0&&(e=".");var t=new RegExp("(\\d+(".concat(In(e),"\\d*)?)([kmb])$"),"i"),n=r.match(t);if(n){var i=n[1],s=n[3],o=cO[s.toLowerCase()];return Number(i.replace(e,"."))*o}},dO=function(r,e){e===void 0&&(e=",");var t=new RegExp(In(e),"g");return r.replace(t,"")},fO=function(r,e){var t=In(e.join("")),n=new RegExp("[^\\d".concat(t,"]"),"gi");return r.replace(n,"")},Xc=function(r){var e=r.value,t=r.groupSeparator,n=t===void 0?",":t,i=r.decimalSeparator,s=i===void 0?".":i,o=r.allowDecimals,a=o===void 0?!0:o,l=r.decimalsLimit,c=l===void 0?2:l,u=r.allowNegativeValue,d=u===void 0?!0:u,f=r.disableAbbreviations,h=f===void 0?!1:f,p=r.prefix,m=p===void 0?"":p,g=r.transformRawValue,y=g===void 0?function(K){return K}:g,v=y(e);if(v==="-")return v;var E=h?[]:["k","m","b"],b=new RegExp("((^|\\D)-\\d)|(-".concat(In(m),")")),_=b.test(v),I=RegExp("(\\d+)-?".concat(In(m))).exec(e)||[],S=I[0],A=I[1],R=m?S?v.replace(S,"").concat(A):v.replace(m,""):v,L=dO(R,n),C=fO(L,$t([n,s],E,!0)),O=C;if(!h){if(E.some(function(K){return K===C.toLowerCase().replace(s,"")}))return"";var D=uO(C,s);D&&(O=String(D))}var P=_&&d?"-":"";if(s&&O.includes(s)){var M=C.split(s),N=M[0],F=M[1],x=c&&F?F.slice(0,c):F,U=a?"".concat(s).concat(x):"";return"".concat(P).concat(N).concat(U)}return"".concat(P).concat(O)},hO=function(r,e,t){if(t!==void 0&&r.length>1){if(t===0)return r.replace(e,"");if(r.includes(e)){var n=r.split(e),i=n[0],s=n[1];if(s.length===t)return r;if(s.length>
79t)return"".concat(i).concat(e).concat(s.slice(0,t))}var o=r.length>t?new RegExp("(\\d+)(\\d{".concat(t,"})")):new RegExp("(\\d)(\\d+)"),a=r.match(o);if(a){var i=a[1],s=a[2];return"".concat(i).concat(e).concat(s)}}return r},BE=function(r,e){var t=e.groupSeparator,n=t===void 0?",":t,i=e.decimalSeparator,s=i===void 0?".":i,o=new RegExp("\\d([^".concat(In(n)).concat(In(s),"0-9]+)")),a=r.match(o);return a?a[1]:void 0},zi=function(r){var e=r.value,t=r.decimalSeparator,n=r.intlConfig,i=r.decimalScale,s=r.prefix,o=s===void 0?"":s,a=r.suffix,l=a===void 0?"":a;if(e===""||e===void 0)return"";if(e==="-")return"-";var c=new RegExp("^\\d?-".concat(o?"".concat(In(o),"?"):"","\\d")).test(e),u=t!=="."?pO(e,t,c):e;t&&t!=="-"&&u.startsWith(t)&&(u="0"+u);var d=n||{},f=d.locale,h=d.currency,p=Sf(d,["locale","currency"]),m=Re(Re({},p),{minimumFractionDigits:i||0,maximumFractionDigits:20}),g=n?new Intl.NumberFormat(f,Re(Re({},m),h&&{style:"currency",currency:h})):new Intl.NumberFormat(void 0,m),y=g.formatToParts(Number(u)),v=mO(y,r),E=BE(v,Re({},r)),b=e.slice(-1)===t?t:"",_=u.match(RegExp("\\d+\\.(\\d+)"))||[],I=_[1];return i===void 0&&I&&t&&(v.includes(t)?v=v.replace(RegExp("(\\d+)(".concat(In(t),")(\\d+)"),"g"),"$1$2".concat(I)):E&&!l?v=v.replace(E,"".concat(t).concat(I).concat(E)):v="".concat(v).concat(t).concat(I)),l&&b?"".concat(v).concat(b).concat(l):E&&b?v.replace(E,"".concat(b).concat(E)):E&&l?v.replace(E,"".concat(b).concat(l)):[v,b,l].join("")},pO=function(r,e,t){var n=r;return e&&e!=="."&&(n=n.replace(RegExp(In(e),"g"),"."),t&&e==="-"&&(n="-".concat(n.slice(1)))),n},mO=function(r,e){var t=e.prefix,n=e.groupSeparator,i=e.decimalSeparator,s=e.decimalScale,o=e.disableGroupSeparators,a=o===void 0?!1:o;return r.reduce(function(l,c,u){var d=c.type,f=c.value;return u===0&&t?d==="minusSign"?[f,t]:d==="currency"?$t($t([],l,!0),[t],!1):[t,f]:d==="currency"?t?l:$t($t([],l,!0),[f],!1):d==="group"?a?l:$t($t([],l,!0),[n!==void 0?n:f],!1):d==="decimal"?s!==void 0&&s===0?l:$t($t([],l,!0),[i!==void 0?i:f],!1):d==="fraction"?$t($t([],l,!0),[s!==void 0?f.slice(0,s):f],!1):$t($t([],l,!0),[f],!1)},[""]).join("")},gO={currencySymbol:"",groupSeparator:"",decimalSeparator:"",prefix:"",suffix:""},yO=function(r){var e=r||{},t=e.locale,n=e.currency,i=Sf(e,["locale","currency"]),s=t?new Intl.NumberFormat(t,Re(Re({},i),n&&{currency:n,style:"currency"})):new Intl.NumberFormat;return s.formatToParts(1000.1).reduce(function(o,a,l){return a.type==="currency"?l===0?Re(Re({},o),{currencySymbol:a.value,prefix:a.value}):Re(Re({},o),{currencySymbol:a.value,suffix:a.value}):a.type==="group"?Re(Re({},o),{groupSeparator:a.value}):a.type==="decimal"?Re(Re({},o),{decimalSeparator:a.value}):o},gO)},tg=function(r){return RegExp(/\d/,"gi").test(r)},vO=function(r,e,t){if(t===void 0||e===""||e===void 0||r===""||r===void 0)return r;if(!r.match(/\d/g))return"";var n=r.split(e),i=n[0],s=n[1];if(t===0)return i;var o=s||"";if(o.length<t)for(;o.length<t;)o+="0";else o=o.slice(0,t);return"".concat(i).concat(e).concat(o)},EO=function(r){var e=r.selectionStart,t=r.value,n=r.lastKeyStroke,i=r.stateValue,s=r.groupSeparator,o=e,a=t;if(i&&o){var l=t.split("");return n==="Backspace"&&i[o]===s&&(l.splice(o-1,1),o-=1),n==="Delete"&&i[o]===s&&(l.splice(o,1),o+=1),a=l.join(""),{modifiedValue:a,cursorPosition:o}}return{modifiedValue:a,cursorPosition:e}},bO=k.forwardRef(function(r,e){var t=r.allowDecimals,n=t===void 0?!0:t,i=r.allowNegativeValue,s=i===void 0?!0:i,o=r.id,a=r.name,l=r.className,c=r.customInput,u=r.decimalsLimit,d=r.defaultValue,f=r.disabled,h=f===void 0?!1:f,p=r.maxLength,m=r.value,g=r.onValueChange,y=r.fixedDecimalLength,v=r.placeholder,E=r.decimalScale,b=r.prefix,_=r.suffix,I=r.intlConfig,S=r.step,A=r.min,R=r.max,L=r.disableGroupSeparators,C=L===void 0?!1:L,O=r.disableAbbreviations,D=O===void 0?!1:O,P=r.decimalSeparator,M=r.groupSeparator,N=r.onChange,F=r.onFocus,x=r.onBlur,U=r.onKeyDown,K=r.onKeyUp,H=r.transformRawValue,G=r.formatValueOnBlur,z=G===void 0?!0:G,J=Sf(r,["allowDecimals","allowNegativeValue","id","name","className","customInput","decimalsLimit","defaultValue","disabled","maxLength","value","onValueChange","fixedDecimalLength","placeholder","decimalScale","prefix","suffix","intlConfig","step","min","max","disableGroupSeparators","disableAbbreviations","decimalSeparator","groupSeparator","onChange","onFocus","onBlur","onKeyDown","onKeyUp","transformRawValue","formatValueOnBlur"]);if(P&&tg(P))throw new Error("decimalSeparator cannot be a number");if(M&&tg(M))throw new Error("groupSeparator cannot be a number");var q=k.useMemo(function(){return yO(I)},[I]),X=P||q.decimalSeparator||"",te=M||q.groupSeparator||"";if(X&&te&&X===te&&C===!1)throw new Error("decimalSeparator cannot be the same as groupSeparator");var pe={decimalSeparator:X,groupSeparator:te,disableGroupSeparators:C,intlConfig:I,prefix:b||q.prefix,suffix:_},we={decimalSeparator:X,groupSeparator:te,allowDecimals:n,decimalsLimit:u||y||2,allowNegativeValue:s,disableAbbreviations:D,prefix:b||q.prefix,transformRawValue:H},Ce=k.useState(function(){return d!=null?zi(Re(Re({},pe),{decimalScale:E,value:String(d)}
79)):m!=null?zi(Re(Re({},pe),{decimalScale:E,value:String(m)})):""}),Ae=Ce[0],le=Ce[1],Te=k.useState(!1),he=Te[0],Fe=Te[1],oe=k.useState(0),ce=oe[0],Me=oe[1],Ue=k.useState(0),xe=Ue[0],yt=Ue[1],Qe=k.useState(null),kt=Qe[0],_t=Qe[1],Ct=k.useRef(null);k.useImperativeHandle(e,function(){return Ct.current});var zn=function(Je,Dt){Fe(!0);var vt=EO({selectionStart:Dt,value:Je,lastKeyStroke:kt,stateValue:Ae,groupSeparator:te}),Xt=vt.modifiedValue,Pt=vt.cursorPosition,rt=Xc(Re({value:Xt},we));if(!(p&&rt.replace(/-/g,"").length>p)){if(rt===""||rt==="-"||rt===X){g&&g(void 0,a,{float:null,formatted:"",value:""}),le(rt),Me(1);return}var Qr=X?rt.replace(X,"."):rt,Ks=parseFloat(Qr),Bl=zi(Re({value:rt},pe));if(Pt!=null){var js=Pt+(Bl.length-Je.length);js=js<=0?b?b.length:0:js,Me(js),yt(xe+1)}if(le(Bl),g){var GE={float:Ks,formatted:Bl,value:rt};g(rt,a,GE)}}},Gs=function(Je){var Dt=Je.target,vt=Dt.value,Xt=Dt.selectionStart;zn(vt,Xt),N&&N(Je)},Fl=function(Je){return F&&F(Je),Ae?Ae.length:0},Hs=function(Je){var Dt=Je.target.value,vt=Xc(Re({value:Dt},we));if(vt==="-"||vt===X||!vt){le(""),x&&x(Je);return}var Xt=hO(vt,X,y),Pt=vO(Xt,X,E!==void 0?E:y),rt=X?Pt.replace(X,"."):Pt,Qr=parseFloat(rt),Ks=zi(Re(Re({},pe),{value:Pt}));g&&z&&g(Pt,a,{float:Qr,formatted:Ks,value:Pt}),le(Ks),x&&x(Je)},zs=function(Je){var Dt=Je.key;if(_t(Dt),S&&(Dt==="ArrowUp"||Dt==="ArrowDown")){Je.preventDefault(),Me(Ae.length);var vt=m!=null?String(m):void 0,Xt=X&&vt?vt.replace(X,"."):vt,Pt=parseFloat(Xt??Xc(Re({value:Ae},we)))||0,rt=Dt==="ArrowUp"?Pt+S:Pt-S;if(A!==void 0&&rt<Number(A)||!s&&rt<0||R!==void 0&&rt>Number(R))return;var Qr=String(S).includes(".")?Number(String(S).split(".")[1].length):void 0;zn(String(Qr?rt.toFixed(Qr):rt).replace(".",X))}U&&U(Je)},br=function(Je){var Dt=Je.key,vt=Je.currentTarget.selectionStart;if(Dt!=="ArrowUp"&&Dt!=="ArrowDown"&&Ae!=="-"){var Xt=BE(Ae,{groupSeparator:te,decimalSeparator:X});if(Xt&&vt&&vt>Ae.length-Xt.length&&Ct.current){var Pt=Ae.length-Xt.length;Ct.current.setSelectionRange(Pt,Pt)}}K&&K(Je)};k.useEffect(function(){m==null&&d==null&&le("")},[d,m]),k.useEffect(function(){he&&Ae!=="-"&&Ct.current&&document.activeElement===Ct.current&&Ct.current.setSelectionRange(ce,ce)},[Ae,ce,Ct,he,xe]);var UE=function(){return m!=null&&Ae!=="-"&&(!X||Ae!==X)?zi(Re(Re({},pe),{decimalScale:he?void 0:E,value:String(m)})):Ae},Af=Re({type:"text",inputMode:"decimal",id:o,name:a,className:l,onChange:Gs,onBlur:Hs,onFocus:Fl,onKeyDown:zs,onKeyUp:br,placeholder:v,disabled:h,value:UE(),ref:Ct},J);if(c){var VE=c;return _e.createElement(VE,Re({},Af))}return _e.createElement("input",Re({},Af))});bO.displayName="CurrencyInput";function nd(){return nd=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},nd.apply(null,arguments)}function TO(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}const ng={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},SO=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function AO(r,e){if(!r||typeof r!="object")return r;const t={};return Object.keys(r).forEach(n=>{e.indexOf(n)>-1||(t[n]=r[n])}),t}const _O=["component","ellipsis","trimRight","className"];function rg(r,e){for(;r&&e--;)r=r.previousElementSibling;return r}const $E={basedOn:void 0,className:"",component:"div",ellipsis:"…",maxLine:1,onReflow(){},text:"",trimRight:!0,winWidth:void 0},RO=Object.keys($E);class IO extends _e.PureComponent{constructor(e){super(e),this.state={text:e.text,clamped:!1},this.units=[],this.maxLine=0,this.canvas=null}componentDidMount(){this.initCanvas(),this.reflow(this.props)}componentDidUpdate(e){e.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==e&&this.reflow(this.props)}componentWillUnmount(){this.canvas&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null)}setState(e,t){return typeof e.clamped<"u"&&(this.clamped=e.clamped),super.setState(e,t)}initCanvas(){if(this.canvas)return;const e=this.canvas=document.createElement("div");e.className=`LinesEllipsis-canvas ${this.props.className}`,e.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(ng).forEach(t=>{e.style[t]=ng[t]}),document.body.appendChild(e)}copyStyleToCanvas(){const e=window.getComputedStyle(this.target);SO.forEach(t=>{this.canvas.style[t]=e[t]})}reflow(e){const t=e.basedOn||(/^[\x00-\x7F]+$/.test(e.text)?"words":"letters");switch(t){case"words":this.units=e.text.split(/\b|(?=\W)/);break;case"letters":this.units=Array.from(e.text);break;default:throw new Error(`Unsupported options basedOn: ${t}`)}this.maxLine=+e.maxLine||1,this.canvas.innerHTML=this.units.map(o=>`<span class='LinesEllipsis-unit'>${o}</span>`).join("");const n=this.putEllipsis(this.calcIndexes()),i=n>-1,s={clamped:i,text:i?this.units.slice(0,n).join(""):e.text};this.setState(s,e.onReflow.bind(this,s))}calcIndexes(){const e=[0];let t=this.canvas.firstElementChild;if(!t)return e;let n=0,i=1,s=t.offsetTop;for(;(t=t.nextElementSibling)&&(t.offsetTop>s&&(i++,e.push(n),s=t.offsetTop),n++,!(i>this.maxLine)););return e}putEllipsis(e){if(e.length<=this.maxLine)return-1;const t=e[this.maxLine],n=this.units.slice(0,t),i=this.canvas.children[t].offsetTop;this.canvas.innerHTML=n.map((a,l)=>`<span class='LinesEllipsis-unit'>${a}</span>`).join("")+`<wbr><span class='LinesEllipsis-ellipsis'>${this.props.ellipsis}</span>`;const s=this.canvas.lastElementChild;let o=rg(s,2);for(;o&&(s.offsetTop>i||s.offsetHeight>o.offsetHeight||s.offsetTop>o.offsetTop);)this.canvas.removeChild(o),o=rg(s,2),n.pop();return n.length}isClamped(){return this.clamped}render(){const{text:e,clamped:t}=this.state,n=this.props,{component:i,ellipsis:s,trimRight:o,className:a}=n,l=TO(n,_O);return _e.createElement(i,nd({className:`LinesEllipsis ${t?"LinesEllipsis--clamped":""} ${a}`,ref:c=>this.target=c},AO(l,RO)),t&&o?e.replace(/[\s\uFEFF\xA0]+$/,""):e,_e.createElement("wbr",null),t&&_e.createElement("span",{className:"LinesEllipsis-ellipsis"},s))}}IO.defaultProps=$E;const LO=({startTime:r,urgentOnly:e,status:t})=>{const{countdown:n,localTime:i,label:s}=hb(r),o=n.asMinutes(),a=o<5;if(e&&!a)return null;
79if(t&&t==="Result")return V.jsx("span",{className:Ee("inline-flex h-4 items-center justify-center text-xs font-semibold leading-none"),children:"Resulted"});if(t&&t==="Live")return V.jsx("span",{className:Ee("inline-flex h-4 items-center justify-center rounded-sm bg-amber-300 px-1 text-xs font-semibold leading-none"),children:"Live"});const c=Ir().isSame(i,"day")?i.format("h:mma"):i.format("DD MMM h:mma");return V.jsx("span",{suppressHydrationWarning:!0,className:Ee("text-xxs inline-flex h-4 min-w-[2.875rem] items-center justify-center whitespace-nowrap rounded-sm px-1 leading-none",{"bg-bg-timer-alert text-text-timer-alert":o<5,"bg-bg-timer-upcoming text-text-timer-upcoming":o>=5&&o<60,"min-w-min !px-0 font-normal":o>=60,"font-semibold":o<60}),children:o>=60?c:s})},wO=({status:r="",startTime:e,urgentOnly:t=!1})=>V.jsx(LO,{startTime:e,urgentOnly:t,status:r}),xO={[Ki.Default]:["up","down"],[Ki.Review]:["down"],[Ki.Placing]:[],[Ki.Placed]:[]};function aM({price:r,fractionalOdds:e,eachwayReduction:t=0,stage:n,allowFlucInReviewStage:i}){const{odds:s}=sg(),o=fb(r.lastOdds,r.totalOdds),a={...xO,...i&&{[Ki.Review]:["up","down"]}},l=o&&a[n].includes(o.fluc),c=l?o.fluc==="down"?"text-ui-red-normal":"text-ui-green-normal":"text-text-primary";return V.jsxs("div",{className:"flex flex-row items-center",children:[l&&V.jsx(St,{name:`fluc-straight-${o.fluc}`,size:"xs"}),V.jsx("span",{className:`text-xs font-semibold ${c}`,children:`${s(r.totalOdds,e)}${QE(t)?` - 1/${t}`:""}`})]})}const kO=()=>V.jsx(Ug,{renderPopup:V.jsx(V.Fragment,{children:"Same Game Multi available."}),children:V.jsx("div",{children:V.jsx(St,{name:"badge-sgm",size:"md",autoHeight:!0,className:"text-bg-badge-multi"})})}),CO=({sgmAvailable:r,promoAvailable:e,reverse:t=!1})=>V.jsxs("div",{className:Ee("flex flex-row items-center gap-0.5",{"flex-row-reverse":t}),children:[r?V.jsx(kO,{}):null,e?V.jsx(_S,{}):null]});function DO({validFilters:r,selectedKeywords:e,toggleKeyword:t,searchPhrase:n,setSearchPhrase:i}){const{t:s}=hg(),{capture:o}=cg(),[a,l]=k.useState(n),c=k.useMemo(()=>JE(d=>{i(d),d.length>=2&&o(ug.LocalSearchSportsPerformed,{query:d,category:"local_search_sports_market"})},300),[i,o]);k.useEffect(()=>()=>{c.cancel()},[c]);const u=k.useCallback(d=>{const f=d.target.value;l(f),c(f)},[c]);return k.useEffect(()=>{l(n)},[n]),V.jsxs("div",{className:"flex flex-col gap-2",children:[V.jsx("div",{className:"bg-core-primary border-border-primary flex gap-1 border-t px-5 py-2 shadow-md md:rounded-lg md:border-t-0",children:V.jsxs("div",{className:"scrollbar-hide -mx-5 flex gap-1 overflow-x-auto whitespace-nowrap px-5",children:[V.jsx("button",{onClick:()=>t(""),className:`min-w-10 flex-shrink-0 cursor-pointer rounded-full border px-3 py-2 text-xs font-semibold ${e.length===0?"border-border-toggle-active bg-bg-toggle-active text-text-toggle-active":"border-border-primary bg-bg-toggle-default text-text-toggle-default"}`,children:s("popularFilter.all",{ns:"sports"})}),r.map(d=>V.jsx("button",{onClick:()=>t(`${d.key}`),className:Ee("min-w-10 flex-shrink-0 cursor-pointer whitespace-nowrap rounded-full border px-3 py-2 text-xs font-semibold capitalize",{"border-border-toggle-active bg-bg-toggle-active text-text-toggle-active":e.includes(`${d.key}`),"border-border-primary bg-bg-toggle-default text-text-toggle-default":!e.includes(`${d.key}`)}),children:ZE(d)?s("popularFilter.legs",{ns:"sports",count:d.key}):s(`popularFilter.${d.key}`,{ns:"sports"})},d.key))]})}),V.jsxs("div",{className:"bg-bg-inputfield-default border-border-primary outline-border-input-active group relative mx-2 flex flex-row items-center gap-2 overflow-hidden rounded-lg border p-3 -outline-offset-1 focus-within:outline md:mx-0",children:[V.jsx(St,{name:"search",size:"sm",className:"text-text-secondary"}),V.jsx("input",{type:"text",placeholder:s("searchable.searchPlayersAndMarkets",{ns:"sports"}),value:a,onChange:u,className:"placeholder:text-text-tertiary w-full border-none bg-transparent p-0 text-sm focus:ring-0"}),V.jsx("button",{onClick:()=>{l(""),i("")},className:`text-surface-bold hover:text-text-primary ${a.length===0?"invisible pointer-events-none":""}`,children:V.jsx(St,{name:"clear",size:"sm"})})]})]})}const lM=_e.memo(DO),ig=({event:r})=>{const{leagueName:e,sportName:t,matchName:n,startTime:i,status:s,sgmAvailable:o,promoAvailable:a}=r,[l,c,u]=eb(n);return V.jsxs("div",{className:"bg-bg-widget flex h-[5.5rem] cursor-pointer flex-col overflow-hidden rounded-t-lg",children:[V.jsxs("div",{className:Ee("relative flex h-[2.5rem] items-center justify-between gap-1 !px-3 text-white"),children:[V.jsx(St,{name:`sport-${_f.kebabCase(t)}`,size:"lg",className:"absolute -right-20 -top-20 h-[14.4625rem] w-[14.4625rem] text-white opacity-10"}),V.jsxs("div",{className:"flex h-[3rem] items-center gap-1 overflow-hidden text-white",children:[!!t&&V.jsx(St,{name:`sport-${_f.kebabCase(t)}`,size:"sm",className:"text-white"}),V.jsx("div",{className:"text-xxs truncate",children:e}),(o||a)&&V.jsxs(V.Fragment,{children:[V.jsx("div",{className:"border-text-tertiary h-3 border-l"}),V.jsx(CO,{sgmAvailable:o,promoAvailable:a})]})]}),!!i&&V.jsx(wO,{startTime:i,status:s})]}),V.jsxs("div",{className:"flex flex-col gap-1 px-3 text-sm font-semibold text-white ",children:[V.jsxs("div",{className:"flex flex-1 gap-1 overflow-hidden",children:[V.jsx("span",{className:Ee("truncate",{"line-clamp-2":!c}),children:l}),u&&V.jsx("span",{children:u})]}),c&&V.jsx("div",{className:"flex items-center overflow-hidden",children:V.jsx("span",{className:"truncate",children:c})})]})]})}
79,PO=({linkDetails:r,LinkComponent:e,...t})=>{const{capture:n}=cg();return r?V.jsx(e,{...r,onClick:i=>{r.onClick?.(i),n(ug.WidgetClicked,{category:"sport_widget",widget_type:"sports_featured_sgm",event_id:t.event.id,event_name:t.event.matchName})},children:V.jsx(ig,{LinkComponent:e,...t})}):V.jsx(ig,{LinkComponent:e,...t})},cM=k.memo(PO);export{eM as $,no as A,GO as B,ZO as C,JO as D,ry as E,sS as F,bO as G,wr as H,St as I,qO as J,QO as K,Ug as L,D1 as M,iM as N,IO as O,aM as P,HO as Q,KO as R,nM as S,sM as T,cM as U,NO as V,$O as W,VO as X,BO as Y,_S as Z,CO as _,Vr as a,MO as a0,FO as a1,lM as a2,rb as b,sb as c,ob as d,DA as e,vS as f,gS as g,ES as h,sO as i,UO as j,rM as k,wO as l,fb as m,oM as n,hS as o,TS as p,tM as q,d1 as r,dS as s,_i as t,hg as u,HT as v,dg as w,KT as x,zT as y,PT as z};

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.