@shumai-one/shumai 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{chunk-adekdctx.css → chunk-0ccg9ddn.css} +1 -1
- package/bin/chunk-0e4wawpq.js +2 -0
- package/bin/chunk-185qefn1.js +2 -0
- package/bin/chunk-1kw2mbqb.js +1 -0
- package/bin/chunk-1wm6ptdx.js +1 -0
- package/bin/chunk-1yacmegc.js +2 -0
- package/bin/chunk-2291ehh5.js +3 -0
- package/bin/chunk-2520aq8j.js +2 -0
- package/bin/chunk-29zdp63z.js +3 -0
- package/bin/chunk-2yxj593j.js +2 -0
- package/bin/chunk-32pcmaqm.js +3 -0
- package/bin/chunk-3a13dcs1.js +1 -0
- package/bin/chunk-3cyrcgm5.js +13 -0
- package/bin/chunk-3swpwb9v.js +1 -0
- package/bin/chunk-3wmcx2bv.js +2 -0
- package/bin/chunk-4r81ghg8.js +2 -0
- package/bin/chunk-4v5n0ayb.js +2 -0
- package/bin/chunk-5a8nt4me.js +1 -0
- package/bin/chunk-66hsjnw6.js +2 -0
- package/bin/chunk-6bhn1p8v.js +211 -0
- package/bin/chunk-6gg1ymer.js +2 -0
- package/bin/chunk-70c3xrgd.js +2 -0
- package/bin/chunk-7esm0hqb.js +2 -0
- package/bin/chunk-7fst8kdw.js +12 -0
- package/bin/chunk-83e12sjg.js +3 -0
- package/bin/chunk-87zxtf66.js +3 -0
- package/bin/chunk-8fmy5jtp.js +2 -0
- package/bin/chunk-8zqgaxvv.js +1 -0
- package/bin/chunk-9t1ne8xr.js +2 -0
- package/bin/chunk-a32vreya.js +2 -0
- package/bin/chunk-a3dmtt2j.js +1 -0
- package/bin/chunk-abt0azmv.js +2 -0
- package/bin/chunk-ag6p3mbf.js +2 -0
- package/bin/chunk-aqbrzx9z.js +1 -0
- package/bin/chunk-av1a8fqp.js +3 -0
- package/bin/chunk-awfwk64v.js +2 -0
- package/bin/chunk-b235azv4.js +45 -0
- package/bin/chunk-b9yrw9et.js +10 -0
- package/bin/chunk-bay038pj.js +2 -0
- package/bin/chunk-c007p0t8.js +299 -0
- package/bin/chunk-cak32x57.js +2 -0
- package/bin/chunk-ce8m4zeg.js +3 -0
- package/bin/chunk-ck8azecb.js +12 -0
- package/bin/chunk-cnxwmycy.js +6 -0
- package/bin/chunk-cqb415s6.js +5 -0
- package/bin/chunk-e2mvmq2m.js +1 -0
- package/bin/chunk-e7mqtkzn.js +2 -0
- package/bin/chunk-e99dv20z.js +3 -0
- package/bin/chunk-ea79xnn3.js +2 -0
- package/bin/chunk-ehc9adfz.js +2 -0
- package/bin/chunk-ejbvfj4r.js +1 -0
- package/bin/chunk-ekfem7kf.js +1 -0
- package/bin/chunk-etwkk0xh.js +1 -0
- package/bin/chunk-evrdd32b.js +2 -0
- package/bin/chunk-f15qyp41.js +1 -0
- package/bin/chunk-f3ehv01n.js +54 -0
- package/bin/chunk-fm6p03ad.js +2 -0
- package/bin/chunk-fxswt9hc.js +3 -0
- package/bin/chunk-fyha3r13.js +2 -0
- package/bin/chunk-g0vs7k2x.js +1 -0
- package/bin/chunk-g84z2w7v.js +16 -0
- package/bin/chunk-gk3eqd50.js +2 -0
- package/bin/chunk-h3tbf521.js +2 -0
- package/bin/chunk-h837fyed.js +2 -0
- package/bin/chunk-hfh0c082.js +2 -0
- package/bin/chunk-j20e0qsw.js +7 -0
- package/bin/chunk-j8fxp8ej.js +2 -0
- package/bin/chunk-jje8nj8h.js +3 -0
- package/bin/chunk-jy006gcv.js +7 -0
- package/bin/chunk-k7hss0bd.js +4 -0
- package/bin/chunk-m7m9d4fb.js +2 -0
- package/bin/chunk-n1jwdb0a.js +1 -0
- package/bin/chunk-p5gf1zdm.js +4 -0
- package/bin/chunk-pb1zf0vb.js +2 -0
- package/bin/chunk-pfgxggaj.js +11 -0
- package/bin/chunk-q16490pv.js +2 -0
- package/bin/chunk-q2bvyv39.js +8 -0
- package/bin/chunk-qf24e71w.js +2 -0
- package/bin/chunk-qh81zhg1.js +1 -0
- package/bin/chunk-qwp3kwbz.js +2 -0
- package/bin/chunk-qwqvt9v6.js +2 -0
- package/bin/chunk-qydeqgyj.js +5 -0
- package/bin/chunk-r7dty1tg.js +2 -0
- package/bin/chunk-rbj4fad9.js +32 -0
- package/bin/chunk-rhdxwebf.js +2 -0
- package/bin/chunk-rhh716z0.js +42 -0
- package/bin/chunk-rpywcvg1.js +3 -0
- package/bin/chunk-rza4ae5z.js +3 -0
- package/bin/chunk-sfx2588q.js +3 -0
- package/bin/chunk-sk4e6rb1.js +1 -0
- package/bin/chunk-t2n1dbgx.js +4 -0
- package/bin/chunk-tf28796q.js +2 -0
- package/bin/chunk-twdxayky.js +3 -0
- package/bin/chunk-v9b3w8q5.js +3 -0
- package/bin/chunk-v9w25rp2.js +2 -0
- package/bin/chunk-vgn5zcpv.js +3 -0
- package/bin/chunk-wfzqnpc1.js +3 -0
- package/bin/chunk-wry2hvrq.js +24 -0
- package/bin/chunk-x8f4defx.js +3 -0
- package/bin/chunk-xp59apdb.js +2 -0
- package/bin/chunk-xtf3c29c.css +1 -0
- package/bin/chunk-z3gkt8w1.js +3 -0
- package/bin/chunk-zehyn6vd.js +2 -0
- package/bin/chunk-zh6fqq44.js +1 -0
- package/bin/chunk-zmv8cg4s.js +8 -0
- package/bin/chunk-zqv0zhfb.js +3 -0
- package/bin/{pdf.worker.min-szxdj13d.mjs → pdf.worker.min-vf48er29.mjs} +14423 -13889
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +626 -460
- package/package.json +18 -18
- package/prisma/migrations/20260904022457_add_agent_id_to_assets_and_audit_logs/migration.sql +17 -0
- package/prisma/migrations/20260906081230_default_denied_tools_delete_asset/migration.sql +15 -0
- package/prisma/schema.prisma +9 -0
- package/bin/chunk-07h4b77v.js +0 -2
- package/bin/chunk-0t4n4d5w.js +0 -4
- package/bin/chunk-1611z9jg.js +0 -2
- package/bin/chunk-1phqxp6z.js +0 -3
- package/bin/chunk-23hckrrz.js +0 -2
- package/bin/chunk-30z44j1g.js +0 -2
- package/bin/chunk-3j463k1g.js +0 -1
- package/bin/chunk-4181tdds.js +0 -14
- package/bin/chunk-480jtqng.js +0 -4
- package/bin/chunk-4c3g146q.js +0 -2
- package/bin/chunk-4ca0zt5e.js +0 -1
- package/bin/chunk-4d9bgmf2.js +0 -2
- package/bin/chunk-4ev56fss.js +0 -9
- package/bin/chunk-4gk52tjq.js +0 -45
- package/bin/chunk-4mdqkj4d.js +0 -1
- package/bin/chunk-4r91fggc.js +0 -2
- package/bin/chunk-50fb1x3w.js +0 -1
- package/bin/chunk-59gj1njz.js +0 -1
- package/bin/chunk-5pr0t7fb.js +0 -2
- package/bin/chunk-5vewxmz7.js +0 -3
- package/bin/chunk-62zx96pe.js +0 -2
- package/bin/chunk-63y0eb07.js +0 -2
- package/bin/chunk-6d5xrgfx.js +0 -2
- package/bin/chunk-6gbtz5bf.js +0 -67
- package/bin/chunk-6gjg5egq.js +0 -3
- package/bin/chunk-6m4jz9s1.js +0 -44
- package/bin/chunk-6s4x525w.js +0 -2
- package/bin/chunk-6w2wmvqs.js +0 -3
- package/bin/chunk-77d23vcn.js +0 -2
- package/bin/chunk-77m5p188.js +0 -2
- package/bin/chunk-7bvx087f.js +0 -1
- package/bin/chunk-7pfjfrjg.js +0 -5
- package/bin/chunk-7q10s127.js +0 -4
- package/bin/chunk-7thx8ctx.js +0 -3
- package/bin/chunk-8t4s91gh.js +0 -2
- package/bin/chunk-98ey5p2e.js +0 -3
- package/bin/chunk-9amndcyh.js +0 -6
- package/bin/chunk-9bk23g9x.js +0 -1
- package/bin/chunk-9mkcfy43.js +0 -1
- package/bin/chunk-9t3nsq5n.js +0 -2
- package/bin/chunk-9tjq99ds.js +0 -2
- package/bin/chunk-9wm9rwh1.js +0 -2
- package/bin/chunk-ab16fyg4.js +0 -4
- package/bin/chunk-arv0g2av.js +0 -1
- package/bin/chunk-aytj4zxg.js +0 -3
- package/bin/chunk-b1ypjqgp.js +0 -2
- package/bin/chunk-bdjv0ykq.js +0 -2
- package/bin/chunk-c1k86mfa.js +0 -10
- package/bin/chunk-caa96dgd.js +0 -2
- package/bin/chunk-ce4v2yjy.js +0 -1
- package/bin/chunk-cqh60y54.js +0 -3
- package/bin/chunk-cvq7zgw7.js +0 -1
- package/bin/chunk-d9mjbtp2.js +0 -2
- package/bin/chunk-dn7sbjws.js +0 -3
- package/bin/chunk-dxyq9h8n.js +0 -3
- package/bin/chunk-e3cabksx.js +0 -3
- package/bin/chunk-egcrbj94.js +0 -2
- package/bin/chunk-ev17v1mv.js +0 -2
- package/bin/chunk-evtpwg71.js +0 -2
- package/bin/chunk-f3e0nsv2.js +0 -2
- package/bin/chunk-f40gjqpq.js +0 -2
- package/bin/chunk-fe7822ak.js +0 -299
- package/bin/chunk-g8tkhw9j.js +0 -2
- package/bin/chunk-g9r0p4t8.js +0 -2
- package/bin/chunk-gbjyh9ms.js +0 -1
- package/bin/chunk-gtbsb39v.js +0 -3
- package/bin/chunk-gytz1q13.js +0 -13
- package/bin/chunk-h0fxysxs.js +0 -7
- package/bin/chunk-h8bdvsqt.js +0 -2
- package/bin/chunk-hag024w8.js +0 -2
- package/bin/chunk-hc6w5nw4.js +0 -7
- package/bin/chunk-j69dqc48.js +0 -2
- package/bin/chunk-jbtw1zym.js +0 -8
- package/bin/chunk-jc1vb7rj.js +0 -5
- package/bin/chunk-jdv78w9r.js +0 -2
- package/bin/chunk-jjs70y9v.js +0 -3
- package/bin/chunk-jmdar2gz.js +0 -2
- package/bin/chunk-jvwz10n4.js +0 -2
- package/bin/chunk-k47md1g4.js +0 -2
- package/bin/chunk-k4v0brcb.js +0 -2
- package/bin/chunk-k6n7c07e.js +0 -1
- package/bin/chunk-kk2cstsg.js +0 -2
- package/bin/chunk-knz4h56q.js +0 -12
- package/bin/chunk-kqqtt6bd.js +0 -3
- package/bin/chunk-kvyp1t4j.js +0 -7
- package/bin/chunk-kxskpgsq.js +0 -5
- package/bin/chunk-m6srbjcs.js +0 -2
- package/bin/chunk-mcc1scxs.js +0 -12
- package/bin/chunk-mq83a0kk.js +0 -2
- package/bin/chunk-mxm8g4q0.js +0 -1
- package/bin/chunk-nhpgdqq5.js +0 -2
- package/bin/chunk-nne496aa.js +0 -2
- package/bin/chunk-nqpb0r9h.js +0 -11
- package/bin/chunk-ns0zww9g.js +0 -2
- package/bin/chunk-ps4xfp23.js +0 -2
- package/bin/chunk-pz2ec6xt.js +0 -2
- package/bin/chunk-q163k309.js +0 -2
- package/bin/chunk-q1da61ps.js +0 -1
- package/bin/chunk-qrf0ady6.js +0 -68
- package/bin/chunk-qy28f25e.js +0 -2
- package/bin/chunk-r7s4ypw1.js +0 -2
- package/bin/chunk-ran23vm9.js +0 -1
- package/bin/chunk-rfvdc4n0.js +0 -2
- package/bin/chunk-rgthkvgx.js +0 -3
- package/bin/chunk-s39n3yw3.js +0 -2
- package/bin/chunk-s7wdd0g7.js +0 -8
- package/bin/chunk-s88ha5kx.js +0 -3
- package/bin/chunk-sf91bt9m.js +0 -2
- package/bin/chunk-sjwbjf9j.js +0 -2
- package/bin/chunk-t62076pv.js +0 -1
- package/bin/chunk-tbbwss3v.js +0 -3
- package/bin/chunk-tjcc7a6y.js +0 -24
- package/bin/chunk-tp6ab26e.js +0 -2
- package/bin/chunk-v2wxk9p5.js +0 -4
- package/bin/chunk-vbk6y4hk.js +0 -2
- package/bin/chunk-vfgfg5fk.js +0 -2
- package/bin/chunk-vm6c3xx9.js +0 -2
- package/bin/chunk-vsx96mt6.js +0 -3
- package/bin/chunk-wbyw1shz.js +0 -6
- package/bin/chunk-whh2vh50.css +0 -1
- package/bin/chunk-wjkcq65s.js +0 -2
- package/bin/chunk-wkefwkfp.js +0 -41
- package/bin/chunk-x7bsnk1e.js +0 -2
- package/bin/chunk-xbhw6bpz.js +0 -3
- package/bin/chunk-xg5yrcj5.js +0 -2
- package/bin/chunk-xg9xscqz.js +0 -1
- package/bin/chunk-xw2gpcsh.js +0 -3
- package/bin/chunk-ycq8ank7.js +0 -2
- package/bin/chunk-yp9hvkc5.js +0 -73
- package/bin/chunk-ytypyfkc.js +0 -65
- package/bin/chunk-z1kjmf60.js +0 -2
- package/bin/chunk-z36bx86r.js +0 -2
- package/bin/chunk-z7hdnecp.js +0 -3
- package/bin/chunk-zeby1cq7.js +0 -2
- package/bin/chunk-zs5e8z1w.js +0 -1
- package/bin/chunk-zxnyefg5.js +0 -2
- /package/bin/{chunk-24ke0th1.css → chunk-kegybs91.css} +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import{da,Es,wt,j,D,rc,N,xt,h,fu,tn,He,O,v,u,fa,C,B,t,o,Q,L,U,ct,jn,Ms,ji,pa,qi,Hi,Gi,bu,ma,$i,vu,A,T,or,Z,Te,_e,jr,ft,vt,Nn,de,ve,E,S,pn,mn,hn,gn,Ce,Ee,Ie,he,ge,Ae,V,qr,qt,Re,Ly,Lu,Zs,a0,c0,u0,at,Tm,Mm,dr,u_,d_,rf,A_,M_,fi,uf,wb,xb,Hu,mv,Av,yv,Xi,_w,Rw,Fw,ol,kx,jx,Nf,iS,Bh,XS,IC,Wf,iE,QE,pp,mp,We,Ye,Je,Xe,et,tt,rt,nt,fe,ce,pe,ue,q,se,Rt,Tt,uo,fo,Hr,_n,Wa,ht,gt,At,G,po,wa,vd,Ht,Co,ie}from"./chunk-6bhn1p8v.js";import{To,Ca,Rr,ra,Ea}from"./chunk-3wmcx2bv.js";import{Tl}from"./chunk-k7hss0bd.js";import{ls,Wr,Sa}from"./chunk-b9yrw9et.js";import{ds,xn,jc,qc,Hc}from"./chunk-gk3eqd50.js";import{Er}from"./chunk-9t1ne8xr.js";import{Ke,w,Ne}from"./chunk-rza4ae5z.js";var Eo=w(function(AH,S4){var z0;if(typeof window<"u")z0=window;else if(typeof global<"u")z0=global;else if(typeof self<"u")z0=self;else z0={};S4.exports=z0});var ww=w(function(CH,x4){var _4=Array.prototype.slice;x4.exports=Pj;function Pj(e,n){if(!("length"in e))e=[e];e=_4.call(e);while(e.length){var i=e.shift(),s=n(i);if(s)return s;if(i.childNodes&&i.childNodes.length)e=_4.call(i.childNodes).concat(e)}}});var T4=w(function(jH,k4){k4.exports=Cf;function Cf(e,n){if(!(this instanceof Cf))return new Cf(e,n);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=n||null}Cf.prototype.nodeType=8;Cf.prototype.nodeName="#comment";Cf.prototype.toString=function(){return"[object Comment]"}});var C4=w(function(EH,A4){A4.exports=Ic;function Ic(e,n){if(!(this instanceof Ic))return new Ic(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=n||null}Ic.prototype.type="DOMTextNode";Ic.prototype.nodeType=3;Ic.prototype.nodeName="#text";Ic.prototype.toString=function(){return this.data};Ic.prototype.replaceData=function(n,i,s){var a=this.data,r=a.substring(0,n),l=a.substring(n+i,a.length);this.data=r+s+l,this.length=this.data.length}});var yw=w(function(qH,j4){j4.exports=Bj;function Bj(e){var n=this,i=e.type;if(!e.target)e.target=n;if(!n.listeners)n.listeners={};var s=n.listeners[i];if(s)return s.forEach(function(a){if(e.currentTarget=n,typeof a==="function")a(e);else a.handleEvent(e)});if(n.parentNode)n.parentNode.dispatchEvent(e)}});var vw=w(function(DH,E4){E4.exports=Lj;function Lj(e,n){var i=this;if(!i.listeners)i.listeners={};if(!i.listeners[e])i.listeners[e]=[];if(i.listeners[e].indexOf(n)===-1)i.listeners[e].push(n)}});var Sw=w(function(IH,q4){q4.exports=Hj;function Hj(e,n){var i=this;if(!i.listeners)return;if(!i.listeners[e])return;var s=i.listeners[e],a=s.indexOf(n);if(a!==-1)s.splice(a,1)}});var R4=w(function(MH,M4){M4.exports=D4;var Uj=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function D4(e){switch(e.nodeType){case 3:return xw(e.data);case 8:return"<!--"+e.data+"-->";default:return zj(e)}}function zj(e){var n=[],i=e.tagName;if(e.namespaceURI==="http://www.w3.org/1999/xhtml")i=i.toLowerCase();if(n.push("<"+i+Wj(e)+Xj(e)),Uj.indexOf(i)>-1)n.push(" />");else{if(n.push(">"),e.childNodes.length)n.push.apply(n,e.childNodes.map(D4));else if(e.textContent||e.innerText)n.push(xw(e.textContent||e.innerText));else if(e.innerHTML)n.push(e.innerHTML);n.push("</"+i+">")}return n.join("")}function Gj(e,n){var i=typeof e[n];if(n==="style"&&Object.keys(e.style).length>0)return!0;return e.hasOwnProperty(n)&&(i==="string"||i==="boolean"||i==="number")&&n!=="nodeName"&&n!=="className"&&n!=="tagName"&&n!=="textContent"&&n!=="innerText"&&n!=="namespaceURI"&&n!=="innerHTML"}function Vj(e){if(typeof e==="string")return e;var n="";return Object.keys(e).forEach(function(i){var s=e[i];i=i.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()}),n+=i+":"+s+";"}),n}function Xj(e){var n=e.dataset,i=[];for(var s in n)i.push({name:"data-"+s,value:n[s]});return i.length?I4(i):""}function I4(e){var n=[];return e.forEach(function(i){var{name:s,value:a}=i;if(s==="style")a=Vj(a);n.push(s+'="'+Kj(a)+'"')}),n.length?" "+n.join(" "):""}function Wj(e){var n=[];for(var i in e)if(Gj(e,i))n.push({name:i,value:e[i]});for(var s in e._attributes)for(var a in e._attributes[s]){var r=e._attributes[s][a],l=(r.prefix?r.prefix+":":"")+a;n.push({name:l,value:r.value})}if(e.className)n.push({name:"class",value:e.className});return n.length?I4(n):""}function xw(e){var n="";if(typeof e==="string")n=e;else if(e)n=e.toString();return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Kj(e){return xw(e).replace(/"/g,""")}});var Tw=w(function(RH,F4){var kw=ww(),$j=yw(),Yj=vw(),Qj=Sw(),Jj=R4(),O4="http://www.w3.org/1999/xhtml";F4.exports=yi;function yi(e,n,i){if(!(this instanceof yi))return new yi(e);var s=i===void 0?O4:i||null;if(this.tagName=s===O4?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=n||null,this.namespaceURI=s,this._attributes={},this.tagName==="INPUT")this.type="text"}yi.prototype.type="DOMElement";yi.prototype.nodeType=1;yi.prototype.appendChild=function(n){if(n.parentNode)n.parentNode.removeChild(n);return this.childNodes.push(n),n.parentNode=this,n};yi.prototype.replaceChild=function(n,i){if(n.parentNode)n.parentNode.removeChild(n);var s=this.childNodes.indexOf(i);return i.parentNode=null,this.childNodes[s]=n,n.parentNode=this,i};yi.prototype.removeChild=function(n){var i=this.childNodes.indexOf(n);return this.childNodes.splice(i,1),n.parentNode=null,n};yi.prototype.insertBefore=function(n,i){if(n.parentNode)n.parentNode.removeChild(n);var s=i===null||i===void 0?-1:this.childNodes.indexOf(i);if(s>-1)this.childNodes.splice(s,0,n);else this.childNodes.push(n);return n.parentNode=this,n};yi.prototype.setAttributeNS=function(n,i,s){var a=null,r=i,l=i.indexOf(":");if(l>-1)a=i.substr(0,l),r=i.substr(l+1);if(this.tagName==="INPUT"&&i==="type")this.type=s;else{var c=this._attributes[n]||(this._attributes[n]={});c[r]={value:s,prefix:a}}};yi.prototype.getAttributeNS=function(n,i){var s=this._attributes[n],a=s&&s[i]&&s[i].value;if(this.tagName==="INPUT"&&i==="type")return this.type;if(typeof a!=="string")return null;return a};yi.prototype.removeAttributeNS=function(n,i){if(!Object.prototype.hasOwnProperty.call(this._attributes,n))return;var s=this._attributes[n];if(s&&Object.prototype.hasOwnProperty.call(s,i))delete s[i]};yi.prototype.hasAttributeNS=function(n,i){var s=this._attributes[n];return!!s&&i in s};yi.prototype.setAttribute=function(n,i){return this.setAttributeNS(null,n,i)};yi.prototype.getAttribute=function(n){return this.getAttributeNS(null,n)};yi.prototype.removeAttribute=function(n){return this.removeAttributeNS(null,n)};yi.prototype.hasAttribute=function(n){return this.hasAttributeNS(null,n)};yi.prototype.removeEventListener=Qj;yi.prototype.addEventListener=Yj;yi.prototype.dispatchEvent=$j;yi.prototype.focus=function(){return};yi.prototype.toString=function(){return Jj(this)};yi.prototype.getElementsByClassName=function(n){var i=n.split(" "),s=[];return kw(this,function(a){if(a.nodeType===1){var r=a.className||"",l=r.split(" ");if(i.every(function(c){return l.indexOf(c)!==-1}))s.push(a)}}),s};yi.prototype.getElementsByTagName=function(n){n=n.toLowerCase();var i=[];return kw(this.childNodes,function(s){if(s.nodeType===1&&(n==="*"||s.tagName.toLowerCase()===n))i.push(s)}),i};yi.prototype.contains=function(n){return kw(this,function(i){return n===i})||!1}});var P4=w(function(OH,N4){var Aw=Tw();N4.exports=qo;function qo(e){if(!(this instanceof qo))return new qo;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}qo.prototype.type="DocumentFragment";qo.prototype.nodeType=11;qo.prototype.nodeName="#document-fragment";qo.prototype.appendChild=Aw.prototype.appendChild;qo.prototype.replaceChild=Aw.prototype.replaceChild;qo.prototype.removeChild=Aw.prototype.removeChild;qo.prototype.toString=function(){return this.childNodes.map(function(n){return String(n)}).join("")}});var L4=w(function(FH,B4){B4.exports=Cw;function Cw(e){}Cw.prototype.initEvent=function(n,i,s){this.type=n,this.bubbles=i,this.cancelable=s};Cw.prototype.preventDefault=function(){}});var U4=w(function(NH,H4){var Zj=ww(),eE=T4(),tE=C4(),G0=Tw(),nE=P4(),sE=L4(),aE=yw(),rE=vw(),oE=Sw();H4.exports=Vg;function Vg(){if(!(this instanceof Vg))return new Vg;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var ir=Vg.prototype;ir.createTextNode=function(n){return new tE(n,this)};ir.createElementNS=function(n,i){var s=n===null?null:String(n);return new G0(i,this,s)};ir.createElement=function(n){return new G0(n,this)};ir.createDocumentFragment=function(){return new nE(this)};ir.createEvent=function(n){return new sE(n)};ir.createComment=function(n){return new eE(n,this)};ir.getElementById=function(n){n=String(n);var i=Zj(this.childNodes,function(s){if(String(s.id)===n)return s});return i||null};ir.getElementsByClassName=G0.prototype.getElementsByClassName;ir.getElementsByTagName=G0.prototype.getElementsByTagName;ir.contains=G0.prototype.contains;ir.removeEventListener=oE;ir.addEventListener=rE;ir.dispatchEvent=aE});var G4=w(function(PH,z4){var lE=U4();z4.exports=new lE});var jw=w(function(BH,X4){var V4=typeof global<"u"?global:typeof window<"u"?window:{},cE=G4(),V0;if(typeof document<"u")V0=document;else if(V0=V4["__GLOBAL_DOCUMENT_CACHE@4"],!V0)V0=V4["__GLOBAL_DOCUMENT_CACHE@4"]=cE;X4.exports=V0});var W4=w(function(LH,kl){function Ew(){return kl.exports=Ew=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},kl.exports.__esModule=!0,kl.exports.default=kl.exports,Ew.apply(null,arguments)}kl.exports=Ew,kl.exports.__esModule=!0,kl.exports.default=kl.exports});var $4=w(function(HH,K4){K4.exports=hE;var uE=Object.prototype.toString;function hE(e){if(!e)return!1;var n=uE.call(e);return n==="[object Function]"||typeof e==="function"&&n!=="[object RegExp]"||typeof window<"u"&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}});var J4=w(function(UH,Q4){function fE(e,n){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=dE(e))||n&&e&&typeof e.length==="number"){if(i)e=i;var s=0;return function(){if(s>=e.length)return{done:!0};return{done:!1,value:e[s++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dE(e,n){if(!e)return;if(typeof e==="string")return Y4(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor)i=e.constructor.name;if(i==="Map"||i==="Set")return Array.from(e);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Y4(e,n)}function Y4(e,n){if(n==null||n>e.length)n=e.length;for(var i=0,s=Array(n);i<n;i++)s[i]=e[i];return s}var pE=function(){function e(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=e.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(s,a){if(!this.typeToInterceptorsMap_.has(s))this.typeToInterceptorsMap_.set(s,new Set);var r=this.typeToInterceptorsMap_.get(s);if(r.has(a))return!1;return r.add(a),!0},n.removeInterceptor=function(s,a){var r=this.typeToInterceptorsMap_.get(s);if(r&&r.has(a))return r.delete(a),!0;return!1},n.clearInterceptorsByType=function(s){var a=this.typeToInterceptorsMap_.get(s);if(!a)return!1;return this.typeToInterceptorsMap_.delete(s),this.typeToInterceptorsMap_.set(s,new Set),!0},n.clear=function(){if(!this.typeToInterceptorsMap_.size)return!1;return this.typeToInterceptorsMap_=new Map,!0},n.getForType=function(s){return this.typeToInterceptorsMap_.get(s)||new Set},n.execute=function(s,a){var r=this.getForType(s);for(var l=fE(r),c;!(c=l()).done;){var p=c.value;try{a=p(a)}catch(m){}}return a},e}();Q4.exports=pE});var e6=w(function(zH,Z4){var mE=function(){function e(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1}var n=e.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.maxAttempts_=1,this.delayFactor_=0.1,this.fuzzFactor_=0.1,this.initialDelay_=1000,this.enabled_=!1},n.getMaxAttempts=function(){return this.maxAttempts_},n.setMaxAttempts=function(s){this.maxAttempts_=s},n.getDelayFactor=function(){return this.delayFactor_},n.setDelayFactor=function(s){this.delayFactor_=s},n.getFuzzFactor=function(){return this.fuzzFactor_},n.setFuzzFactor=function(s){this.fuzzFactor_=s},n.getInitialDelay=function(){return this.initialDelay_},n.setInitialDelay=function(s){this.initialDelay_=s},n.createRetry=function(s){var a=s===void 0?{}:s,{maxAttempts:r,delayFactor:l,fuzzFactor:c,initialDelay:p}=a;return new gE({maxAttempts:r||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:c||this.fuzzFactor_,initialDelay:p||this.initialDelay_})},e}(),gE=function(){function e(i){this.maxAttempts_=i.maxAttempts,this.delayFactor_=i.delayFactor,this.fuzzFactor_=i.fuzzFactor,this.currentDelay_=i.initialDelay,this.currentAttempt_=1}var n=e.prototype;return n.moveToNextAttempt=function(){this.currentAttempt_++;var s=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+s},n.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},n.getCurrentDelay=function(){return this.currentDelay_},n.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},n.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},n.getCurrentFuzzedDelay=function(){var s=this.getCurrentMinPossibleDelay(),a=this.getCurrentMaxPossibleDelay();return s+Math.random()*(a-s)},e}();Z4.exports=mE});var n6=w(function(GH,t6){var bE=Eo(),wE=function(n,i){if(i===void 0)i=!1;return function(s,a,r){if(s){n(s);return}if(a.statusCode>=400&&a.statusCode<=599){var l=r;if(i)if(bE.TextDecoder){var c=yE(a.headers&&a.headers["content-type"]);try{l=new TextDecoder(c).decode(r)}catch(p){}}else l=String.fromCharCode.apply(null,new Uint8Array(r));n({cause:l});return}n(null,r)}};function yE(e){if(e===void 0)e="";return e.toLowerCase().split(";").reduce(function(n,i){var s=i.split("="),a=s[0],r=s[1];if(a.trim()==="charset")return r.trim();return n},"utf-8")}t6.exports=wE});var r6=w(function(VH,Dw){var i6=Eo(),vE=W4(),SE=$4(),s6=J4(),_E=e6();Zi.httpHandler=n6();Zi.requestInterceptorsStorage=new s6;Zi.responseInterceptorsStorage=new s6;Zi.retryManager=new _E;var xE=function(n){var i={};if(!n)return i;return n.trim().split(`
|
|
3
|
+
`).forEach(function(s){var a=s.indexOf(":"),r=s.slice(0,a).trim().toLowerCase(),l=s.slice(a+1).trim();if(typeof i[r]>"u")i[r]=l;else if(Array.isArray(i[r]))i[r].push(l);else i[r]=[i[r],l]}),i};Dw.exports=Zi;Dw.exports.default=Zi;Zi.XMLHttpRequest=i6.XMLHttpRequest||CE;Zi.XDomainRequest="withCredentials"in new Zi.XMLHttpRequest?Zi.XMLHttpRequest:i6.XDomainRequest;kE(["get","put","post","patch","head","delete"],function(e){Zi[e==="delete"?"del":e]=function(n,i,s){return i=a6(n,i,s),i.method=e.toUpperCase(),qw(i)}});function kE(e,n){for(var i=0;i<e.length;i++)n(e[i])}function TE(e){for(var n in e)if(e.hasOwnProperty(n))return!1;return!0}function a6(e,n,i){var s=e;if(SE(n)){if(i=n,typeof e==="string")s={uri:e}}else s=vE({},n,{uri:e});return s.callback=i,s}function Zi(e,n,i){return n=a6(e,n,i),qw(n)}function qw(e){if(typeof e.callback>"u")throw Error("callback argument missing");if(e.requestType&&Zi.requestInterceptorsStorage.getIsEnabled()){var n={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},i=Zi.requestInterceptorsStorage.execute(e.requestType,n);e.uri=i.uri,e.headers=i.headers,e.body=i.body,e.metadata=i.metadata,e.retry=i.retry,e.timeout=i.timeout}var s=!1,a=function(ne,oe,me){if(!s)s=!0,e.callback(ne,oe,me)};function r(){if(m.readyState===4&&!Zi.responseInterceptorsStorage.getIsEnabled())setTimeout(p,0)}function l(){var ae=void 0;if(m.response)ae=m.response;else ae=m.responseText||AE(m);if(W)try{ae=JSON.parse(ae)}catch(ne){}return ae}function c(ae){if(clearTimeout(Y),clearTimeout(e.retryTimeout),!(ae instanceof Error))ae=Error(""+(ae||"Unknown XMLHttpRequest Error"));if(ae.statusCode=0,!y&&Zi.retryManager.getIsEnabled()&&e.retry&&e.retry.shouldRetry()){e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=m,qw(e)},e.retry.getCurrentFuzzedDelay());return}if(e.requestType&&Zi.responseInterceptorsStorage.getIsEnabled()){var ne={headers:te.headers||{},body:te.body,responseUrl:m.responseURL,responseType:m.responseType},oe=Zi.responseInterceptorsStorage.execute(e.requestType,ne);te.body=oe.body,te.headers=oe.headers}return a(ae,te)}function p(){if(y)return;var ae;if(clearTimeout(Y),clearTimeout(e.retryTimeout),e.useXDR&&m.status===void 0)ae=200;else ae=m.status===1223?204:m.status;var ne=te,oe=null;if(ae!==0){if(ne={body:l(),statusCode:ae,method:I,headers:{},url:x,rawRequest:m},m.getAllResponseHeaders)ne.headers=xE(m.getAllResponseHeaders())}else oe=Error("Internal XMLHttpRequest Error");if(e.requestType&&Zi.responseInterceptorsStorage.getIsEnabled()){var me={headers:ne.headers||{},body:ne.body,responseUrl:m.responseURL,responseType:m.responseType},be=Zi.responseInterceptorsStorage.execute(e.requestType,me);ne.body=be.body,ne.headers=be.headers}return a(oe,ne,ne.body)}var m=e.xhr||null;if(!m)if(e.cors||e.useXDR)m=new Zi.XDomainRequest;else m=new Zi.XMLHttpRequest;var g,y,x=m.url=e.uri||e.url,I=m.method=e.method||"GET",M=e.body||e.data,H=m.headers=e.headers||{},X=!!e.sync,W=!1,Y,te={body:void 0,headers:{},statusCode:0,method:I,url:x,rawRequest:m};if("json"in e&&e.json!==!1){if(W=!0,H.accept||H.Accept||(H.Accept="application/json"),I!=="GET"&&I!=="HEAD")H["content-type"]||H["Content-Type"]||(H["Content-Type"]="application/json"),M=JSON.stringify(e.json===!0?M:e.json)}if(m.onreadystatechange=r,m.onload=p,m.onerror=c,m.onprogress=function(){},m.onabort=function(){y=!0,clearTimeout(e.retryTimeout)},m.ontimeout=c,m.open(I,x,!X,e.username,e.password),!X)m.withCredentials=!!e.withCredentials;if(!X&&e.timeout>0)Y=setTimeout(function(){if(y)return;y=!0,m.abort("timeout");var ae=Error("XMLHttpRequest timeout");ae.code="ETIMEDOUT",c(ae)},e.timeout);if(m.setRequestHeader){for(g in H)if(H.hasOwnProperty(g))m.setRequestHeader(g,H[g])}else if(e.headers&&!TE(e.headers))throw Error("Headers cannot be set on an XDomainRequest object");if("responseType"in e)m.responseType=e.responseType;if("beforeSend"in e&&typeof e.beforeSend==="function")e.beforeSend(m);return m.send(M||null),m}function AE(e){try{if(e.responseType==="document")return e.responseXML;var n=e.responseXML&&e.responseXML.documentElement.nodeName==="parsererror";if(e.responseType===""&&!n)return e.responseXML}catch(i){}return null}function CE(){}});var d6=w(function(XH,f6){var o6=jw(),Mw=Object.create||function(){function e(){}return function(n){if(arguments.length!==1)throw Error("Object.create shim only accepts one parameter.");return e.prototype=n,new e}}();function sr(e,n){this.name="ParsingError",this.code=e.code,this.message=n||e.message}sr.prototype=Mw(Error.prototype);sr.prototype.constructor=sr;sr.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Ow(e){function n(s,a,r,l){return(s|0)*3600+(a|0)*60+(r|0)+(l|0)/1000}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!i)return null;if(i[3])return n(i[1],i[2],i[3].replace(":",""),i[4]);else if(i[1]>59)return n(i[1],i[2],0,i[4]);else return n(0,i[1],i[2],i[4])}function W0(){this.values=Mw(null)}W0.prototype={set:function(e,n){if(!this.get(e)&&n!=="")this.values[e]=n},get:function(e,n,i){if(i)return this.has(e)?this.values[e]:n[i];return this.has(e)?this.values[e]:n},has:function(e){return e in this.values},alt:function(e,n,i){for(var s=0;s<i.length;++s)if(n===i[s]){this.set(e,n);break}},integer:function(e,n){if(/^-?\d+$/.test(n))this.set(e,parseInt(n,10))},percent:function(e,n){var i;if(i=n.match(/^([\d]{1,3})(\.[\d]*)?%$/)){if(n=parseFloat(n),n>=0&&n<=100)return this.set(e,n),!0}return!1}};function X0(e,n,i,s){var a=s?e.split(s):[e];for(var r in a){if(typeof a[r]!=="string")continue;var l=a[r].split(i);if(l.length!==2)continue;var c=l[0].trim(),p=l[1].trim();n(c,p)}}function jE(e,n,i){var s=e;function a(){var c=Ow(e);if(c===null)throw new sr(sr.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),c}function r(c,p){var m=new W0;X0(c,function(g,y){switch(g){case"region":for(var x=i.length-1;x>=0;x--)if(i[x].id===y){m.set(g,i[x].region);break}break;case"vertical":m.alt(g,y,["rl","lr"]);break;case"line":var I=y.split(","),M=I[0];if(m.integer(g,M),m.percent(g,M)&&m.set("snapToLines",!1),m.alt(g,M,["auto"]),I.length===2)m.alt("lineAlign",I[1],["start","center","end"]);break;case"position":if(I=y.split(","),m.percent(g,I[0]),I.length===2)m.alt("positionAlign",I[1],["start","center","end"]);break;case"size":m.percent(g,y);break;case"align":m.alt(g,y,["start","center","end","left","right"]);break}},/:/,/\s/),p.region=m.get("region",null),p.vertical=m.get("vertical","");try{p.line=m.get("line","auto")}catch(g){}p.lineAlign=m.get("lineAlign","start"),p.snapToLines=m.get("snapToLines",!0),p.size=m.get("size",100);try{p.align=m.get("align","center")}catch(g){p.align=m.get("align","middle")}try{p.position=m.get("position","auto")}catch(g){p.position=m.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},p.align)}p.positionAlign=m.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},p.align)}function l(){e=e.replace(/^\s+/,"")}if(l(),n.startTime=a(),l(),e.substr(0,3)!=="-->")throw new sr(sr.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s);e=e.substr(3),l(),n.endTime=a(),l(),r(e,n)}var Iw=o6.createElement&&o6.createElement("textarea"),EE={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},l6={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},qE={v:"title",lang:"lang"},c6={rt:"ruby"};function h6(e,n){function i(){if(!n)return null;function M(X){return n=n.substr(X.length),X}var H=n.match(/^([^<]*)(<[^>]*>?)?/);return M(H[1]?H[1]:H[2])}function s(M){return Iw.innerHTML=M,M=Iw.textContent,Iw.textContent="",M}function a(M,H){return!c6[H.localName]||c6[H.localName]===M.localName}function r(M,H){var X=EE[M];if(!X)return null;var W=e.document.createElement(X),Y=qE[M];if(Y&&H)W[Y]=H.trim();return W}var l=e.document.createElement("div"),c=l,p,m=[];while((p=i())!==null){if(p[0]==="<"){if(p[1]==="/"){if(m.length&&m[m.length-1]===p.substr(2).replace(">",""))m.pop(),c=c.parentNode;continue}var g=Ow(p.substr(1,p.length-2)),y;if(g){y=e.document.createProcessingInstruction("timestamp",g),c.appendChild(y);continue}var x=p.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!x)continue;if(y=r(x[1],x[3]),!y)continue;if(!a(c,y))continue;if(x[2]){var I=x[2].split(".");I.forEach(function(M){var H=/^bg_/.test(M),X=H?M.slice(3):M;if(l6.hasOwnProperty(X)){var W=H?"background-color":"color",Y=l6[X];y.style[W]=Y}}),y.className=I.join(" ")}m.push(x[1]),c.appendChild(y),c=y;continue}c.appendChild(e.document.createTextNode(s(p)))}return l}var u6=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function DE(e){for(var n=0;n<u6.length;n++){var i=u6[n];if(e>=i[0]&&e<=i[1])return!0}return!1}function IE(e){var n=[],i="",s;if(!e||!e.childNodes)return"ltr";function a(c,p){for(var m=p.childNodes.length-1;m>=0;m--)c.push(p.childNodes[m])}function r(c){if(!c||!c.length)return null;var p=c.pop(),m=p.textContent||p.innerText;if(m){var g=m.match(/^.*(\n|\r)/);if(g)return c.length=0,g[0];return m}if(p.tagName==="ruby")return r(c);if(p.childNodes)return a(c,p),r(c)}a(n,e);while(i=r(n))for(var l=0;l<i.length;l++)if(s=i.charCodeAt(l),DE(s))return"rtl";return"ltr"}function ME(e){if(typeof e.line==="number"&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;var n=e.track,i=n.textTrackList,s=0;for(var a=0;a<i.length&&i[a]!==n;a++)if(i[a].mode==="showing")s++;return++s*-1}function Wg(){}Wg.prototype.applyStyles=function(e,n){n=n||this.div;for(var i in e)if(e.hasOwnProperty(i))n.style[i]=e[i]};Wg.prototype.formatStyle=function(e,n){return e===0?0:e+n};function Xg(e,n,i){Wg.call(this),this.cue=n,this.cueDiv=h6(e,n.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:n.vertical===""?"horizontal-tb":n.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:IE(this.cueDiv),writingMode:n.vertical===""?"horizontal-tb":n.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:n.align==="middle"?"center":n.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var a=0;switch(n.positionAlign){case"start":case"line-left":a=n.position;break;case"center":a=n.position-n.size/2;break;case"end":case"line-right":a=n.position-n.size;break}if(n.vertical==="")this.applyStyles({left:this.formatStyle(a,"%"),width:this.formatStyle(n.size,"%")});else this.applyStyles({top:this.formatStyle(a,"%"),height:this.formatStyle(n.size,"%")});this.move=function(r){this.applyStyles({top:this.formatStyle(r.top,"px"),bottom:this.formatStyle(r.bottom,"px"),left:this.formatStyle(r.left,"px"),right:this.formatStyle(r.right,"px"),height:this.formatStyle(r.height,"px"),width:this.formatStyle(r.width,"px")})}}Xg.prototype=Mw(Wg.prototype);Xg.prototype.constructor=Xg;function ha(e){var n,i,s,a;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,a=e.div.offsetTop;var r=(r=e.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects();e=e.div.getBoundingClientRect(),n=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0}this.left=e.left,this.right=e.right,this.top=e.top||a,this.height=e.height||i,this.bottom=e.bottom||a+(e.height||i),this.width=e.width||s,this.lineHeight=n!==void 0?n:e.lineHeight}ha.prototype.move=function(e,n){switch(n=n!==void 0?n:this.lineHeight,e){case"+x":this.left+=n,this.right+=n;break;case"-x":this.left-=n,this.right-=n;break;case"+y":this.top+=n,this.bottom+=n;break;case"-y":this.top-=n,this.bottom-=n;break}};ha.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top};ha.prototype.overlapsAny=function(e){for(var n=0;n<e.length;n++)if(this.overlaps(e[n]))return!0;return!1};ha.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};ha.prototype.overlapsOppositeAxis=function(e,n){switch(n){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}};ha.prototype.intersectPercentage=function(e){var n=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),i=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top)),s=n*i;return s/(this.height*this.width)};ha.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}};ha.getSimpleBoxPosition=function(e){var n=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var a={left:e.left,right:e.right,top:e.top||s,height:e.height||n,bottom:e.bottom||s+(e.height||n),width:e.width||i};return a};function RE(e,n,i,s){function a(X,W){var Y,te=new ha(X),ae=1;for(var ne=0;ne<W.length;ne++){while(X.overlapsOppositeAxis(i,W[ne])||X.within(i)&&X.overlapsAny(s))X.move(W[ne]);if(X.within(i))return X;var oe=X.intersectPercentage(i);if(ae>oe)Y=new ha(X),ae=oe;X=new ha(te)}return Y||te}var r=new ha(n),l=n.cue,c=ME(l),p=[];if(l.snapToLines){var m;switch(l.vertical){case"":p=["+y","-y"],m="height";break;case"rl":p=["+x","-x"],m="width";break;case"lr":p=["-x","+x"],m="width";break}var g=r.lineHeight,y=g*Math.round(c),x=i[m]+g,I=p[0];if(Math.abs(y)>x)y=y<0?-1:1,y*=Math.ceil(x/g)*g;if(c<0)y+=l.vertical===""?i.height:i.width,p=p.reverse();r.move(I,y)}else{var M=r.lineHeight/i.height*100;switch(l.lineAlign){case"center":c-=M/2;break;case"end":c-=M;break}switch(l.vertical){case"":n.applyStyles({top:n.formatStyle(c,"%")});break;case"rl":n.applyStyles({left:n.formatStyle(c,"%")});break;case"lr":n.applyStyles({right:n.formatStyle(c,"%")});break}p=["+y","-x","+x","-y"],r=new ha(n)}var H=a(r,p);n.move(H.toCSSCompatValues(i))}function jf(){}jf.StringDecoder=function(){return{decode:function(e){if(!e)return"";if(typeof e!=="string")throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};jf.convertCueToDOMTree=function(e,n){if(!e||!n)return null;return h6(e,n)};var OE=0.05,FE="sans-serif",NE="1.5%";jf.processCues=function(e,n,i){if(!e||!n||!i)return null;while(i.firstChild)i.removeChild(i.firstChild);var s=e.document.createElement("div");s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin=NE,i.appendChild(s);function a(g){for(var y=0;y<g.length;y++)if(g[y].hasBeenReset||!g[y].displayState)return!0;return!1}if(!a(n)){for(var r=0;r<n.length;r++)s.appendChild(n[r].displayState);return}var l=[],c=ha.getSimpleBoxPosition(s),p=Math.round(c.height*OE*100)/100,m={font:p+"px "+FE};(function(){var g,y;for(var x=0;x<n.length;x++)y=n[x],g=new Xg(e,y,m),s.appendChild(g.div),RE(e,g,c,l),y.displayState=g.div,l.push(ha.getSimpleBoxPosition(g))})()};jf.Parser=function(e,n,i){if(!i)i=n,n={};if(!n)n={};this.window=e,this.vttjs=n,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]};jf.Parser.prototype={reportOrThrowError:function(e){if(e instanceof sr)this.onparsingerror&&this.onparsingerror(e);else throw e},parse:function(e){var n=this;if(e)n.buffer+=n.decoder.decode(e,{stream:!0});function i(){var g=n.buffer,y=0;while(y<g.length&&g[y]!=="\r"&&g[y]!==`
|
|
4
|
+
`)++y;var x=g.substr(0,y);if(g[y]==="\r")++y;if(g[y]===`
|
|
5
|
+
`)++y;return n.buffer=g.substr(y),x}function s(g){var y=new W0;if(X0(g,function(I,M){switch(I){case"id":y.set(I,M);break;case"width":y.percent(I,M);break;case"lines":y.integer(I,M);break;case"regionanchor":case"viewportanchor":var H=M.split(",");if(H.length!==2)break;var X=new W0;if(X.percent("x",H[0]),X.percent("y",H[1]),!X.has("x")||!X.has("y"))break;y.set(I+"X",X.get("x")),y.set(I+"Y",X.get("y"));break;case"scroll":y.alt(I,M,["up"]);break}},/=/,/\s/),y.has("id")){var x=new(n.vttjs.VTTRegion||n.window.VTTRegion);x.width=y.get("width",100),x.lines=y.get("lines",3),x.regionAnchorX=y.get("regionanchorX",0),x.regionAnchorY=y.get("regionanchorY",100),x.viewportAnchorX=y.get("viewportanchorX",0),x.viewportAnchorY=y.get("viewportanchorY",100),x.scroll=y.get("scroll",""),n.onregion&&n.onregion(x),n.regionList.push({id:y.get("id"),region:x})}}function a(g){var y=new W0;X0(g,function(x,I){switch(x){case"MPEGT":y.integer(x+"S",I);break;case"LOCA":y.set(x+"L",Ow(I));break}},/[^\d]:/,/,/),n.ontimestampmap&&n.ontimestampmap({MPEGTS:y.get("MPEGTS"),LOCAL:y.get("LOCAL")})}function r(g){if(g.match(/X-TIMESTAMP-MAP/))X0(g,function(y,x){switch(y){case"X-TIMESTAMP-MAP":a(x);break}},/=/);else X0(g,function(y,x){switch(y){case"Region":s(x);break}},/:/)}try{var l;if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;l=i();var c=l.match(/^WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new sr(sr.Errors.BadSignature);n.state="HEADER"}var p=!1;while(n.buffer){if(!/\r\n|\n/.test(n.buffer))return this;if(!p)l=i();else p=!1;switch(n.state){case"HEADER":if(/:/.test(l))r(l);else if(!l)n.state="ID";continue;case"NOTE":if(!l)n.state="ID";continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){n.state="NOTE";break}if(!l)continue;n.cue=new(n.vttjs.VTTCue||n.window.VTTCue)(0,0,"");try{n.cue.align="center"}catch(g){n.cue.align="middle"}if(n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":try{jE(l,n.cue,n.regionList)}catch(g){n.reportOrThrowError(g),n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":var m=l.indexOf("-->")!==-1;if(!l||m&&(p=!0)){n.oncue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue.text)n.cue.text+=`
|
|
6
|
+
`;n.cue.text+=l.replace(/\u2028/g,`
|
|
7
|
+
`).replace(/u2029/g,`
|
|
8
|
+
`);continue;case"BADCUE":if(!l)n.state="ID";continue}}}catch(g){if(n.reportOrThrowError(g),n.state==="CUETEXT"&&n.cue&&n.oncue)n.oncue(n.cue);n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),e.cue||e.state==="HEADER")e.buffer+=`
|
|
9
|
+
|
|
10
|
+
`,e.parse();if(e.state==="INITIAL")throw new sr(sr.Errors.BadSignature)}catch(n){e.reportOrThrowError(n)}return e.onflush&&e.onflush(),this}};f6.exports=jf});var g6=w(function(WH,m6){var PE="auto",BE={"":1,lr:1,rl:1},LE={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function HE(e){if(typeof e!=="string")return!1;var n=BE[e.toLowerCase()];return n?e.toLowerCase():!1}function Nw(e){if(typeof e!=="string")return!1;var n=LE[e.toLowerCase()];return n?e.toLowerCase():!1}function p6(e,n,i){this.hasBeenReset=!1;var s="",a=!1,r=e,l=n,c=i,p=null,m="",g=!0,y="auto",x="start",I="auto",M="auto",H=100,X="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(W){s=""+W}},pauseOnExit:{enumerable:!0,get:function(){return a},set:function(W){a=!!W}},startTime:{enumerable:!0,get:function(){return r},set:function(W){if(typeof W!=="number")throw TypeError("Start time must be set to a number.");r=W,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return l},set:function(W){if(typeof W!=="number")throw TypeError("End time must be set to a number.");l=W,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return c},set:function(W){c=""+W,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return p},set:function(W){p=W,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(W){var Y=HE(W);if(Y===!1)throw SyntaxError("Vertical: an invalid or illegal direction string was specified.");m=Y,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return g},set:function(W){g=!!W,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return y},set:function(W){if(typeof W!=="number"&&W!==PE)throw SyntaxError("Line: an invalid number or illegal string was specified.");y=W,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return x},set:function(W){var Y=Nw(W);if(!Y)console.warn("lineAlign: an invalid or illegal string was specified.");else x=Y,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return I},set:function(W){if(W<0||W>100)throw Error("Position must be between 0 and 100.");I=W,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return M},set:function(W){var Y=Nw(W);if(!Y)console.warn("positionAlign: an invalid or illegal string was specified.");else M=Y,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return H},set:function(W){if(W<0||W>100)throw Error("Size must be between 0 and 100.");H=W,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return X},set:function(W){var Y=Nw(W);if(!Y)throw SyntaxError("align: an invalid or illegal alignment string was specified.");X=Y,this.hasBeenReset=!0}}}),this.displayState=void 0}p6.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};m6.exports=p6});var w6=w(function(KH,b6){var UE={"":!0,up:!0};function zE(e){if(typeof e!=="string")return!1;var n=UE[e.toLowerCase()];return n?e.toLowerCase():!1}function K0(e){return typeof e==="number"&&(e>=0&&e<=100)}function GE(){var e=100,n=3,i=0,s=100,a=0,r=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(c){if(!K0(c))throw Error("Width must be between 0 and 100.");e=c}},lines:{enumerable:!0,get:function(){return n},set:function(c){if(typeof c!=="number")throw TypeError("Lines must be set to a number.");n=c}},regionAnchorY:{enumerable:!0,get:function(){return s},set:function(c){if(!K0(c))throw Error("RegionAnchorX must be between 0 and 100.");s=c}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(c){if(!K0(c))throw Error("RegionAnchorY must be between 0 and 100.");i=c}},viewportAnchorY:{enumerable:!0,get:function(){return r},set:function(c){if(!K0(c))throw Error("ViewportAnchorY must be between 0 and 100.");r=c}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(c){if(!K0(c))throw Error("ViewportAnchorX must be between 0 and 100.");a=c}},scroll:{enumerable:!0,get:function(){return l},set:function(c){var p=zE(c);if(p===!1)console.warn("Scroll: an invalid or illegal string was specified.");else l=p}}})}b6.exports=GE});var v6=w(function($H,y6){var Al=Eo(),Zu=y6.exports={WebVTT:d6(),VTTCue:g6(),VTTRegion:w6()};Al.vttjs=Zu;Al.WebVTT=Zu.WebVTT;var{VTTCue:VE,VTTRegion:XE}=Zu,{VTTCue:WE,VTTRegion:KE}=Al;Zu.shim=function(){Al.VTTCue=VE,Al.VTTRegion=XE};Zu.restore=function(){Al.VTTCue=WE,Al.VTTRegion=KE};if(!Al.VTTCue)Zu.shim()});var If=w(function(hq){function lq(e,n,i){if(i===void 0)i=Array.prototype;if(e&&typeof i.find==="function")return i.find.call(e,n);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var a=e[s];if(n.call(void 0,a,s,e))return a}}function Qw(e,n){if(n===void 0)n=Object;return n&&typeof n.freeze==="function"?n.freeze(e):e}function cq(e,n){if(e===null||typeof e!=="object")throw TypeError("target is not an object");for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))e[i]=n[i];return e}var I6=Qw({HTML:"text/html",isHTML:function(e){return e===I6.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),M6=Qw({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===M6.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Qg=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Yw=new RegExp("[\\-\\.0-9"+Qg.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),uq=new RegExp("^"+Qg.source+Yw.source+"*(?::"+Qg.source+Yw.source+"*)?$");hq.assign=cq;hq.find=lq;hq.freeze=Qw;hq.MIME_TYPE=I6;hq.NAMESPACE=M6;hq.nameStartChar=Qg;hq.nameChar=Yw;hq.tagNamePattern=uq});var cy=w(function(Rq){var Jw=If(),{find:Do,NAMESPACE:Q0,tagNamePattern:Mf}=Jw;function vq(e){return e!==""}function Sq(e){return e?e.split(/[\t\n\f\r ]+/).filter(vq):[]}function _q(e,n){if(!e.hasOwnProperty(n))e[n]=!0;return e}function R6(e){if(!e)return[];var n=Sq(e);return Object.keys(n.reduce(_q,{}))}function xq(e){return function(n){return e&&e.indexOf(n)!==-1}}function Z0(e,n){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))n[i]=e[i]}function Oa(e,n){var i=e.prototype;if(!(i instanceof n)){let a=function(){};var s=a;a.prototype=n.prototype,a=new a,Z0(i,a),e.prototype=i=a}if(i.constructor!=e){if(typeof e!="function")console.error("unknown Class:"+e);i.constructor=e}}var Fa={},Cr=Fa.ELEMENT_NODE=1,Rf=Fa.ATTRIBUTE_NODE=2,Y0=Fa.TEXT_NODE=3,U6=Fa.CDATA_SECTION_NODE=4,z6=Fa.ENTITY_REFERENCE_NODE=5,kq=Fa.ENTITY_NODE=6,Zw=Fa.PROCESSING_INSTRUCTION_NODE=7,ey=Fa.COMMENT_NODE=8,G6=Fa.DOCUMENT_NODE=9,V6=Fa.DOCUMENT_TYPE_NODE=10,jl=Fa.DOCUMENT_FRAGMENT_NODE=11,Tq=Fa.NOTATION_NODE=12,ea={},js={},uU=ea.INDEX_SIZE_ERR=(js[1]="Index size error",1),hU=ea.DOMSTRING_SIZE_ERR=(js[2]="DOMString size error",2),Ra=ea.HIERARCHY_REQUEST_ERR=(js[3]="Hierarchy request error",3),fU=ea.WRONG_DOCUMENT_ERR=(js[4]="Wrong document",4),O6=ea.INVALID_CHARACTER_ERR=(js[5]="Invalid character",5),dU=ea.NO_DATA_ALLOWED_ERR=(js[6]="No data allowed",6),pU=ea.NO_MODIFICATION_ALLOWED_ERR=(js[7]="No modification allowed",7),X6=ea.NOT_FOUND_ERR=(js[8]="Not found",8),mU=ea.NOT_SUPPORTED_ERR=(js[9]="Not supported",9),F6=ea.INUSE_ATTRIBUTE_ERR=(js[10]="Attribute in use",10),to=ea.INVALID_STATE_ERR=(js[11]="Invalid state",11),gU=ea.SYNTAX_ERR=(js[12]="Syntax error",12),bU=ea.INVALID_MODIFICATION_ERR=(js[13]="Invalid modification",13),wU=ea.NAMESPACE_ERR=(js[14]="Invalid namespace",14),yU=ea.INVALID_ACCESS_ERR=(js[15]="Invalid access",15);function Ln(e,n){if(n instanceof Error)var i=n;else if(i=this,Error.call(this,js[e]),this.message=js[e],Error.captureStackTrace)Error.captureStackTrace(this,Ln);if(i.code=e,n)this.message=this.message+": "+n;return i}Ln.prototype=Error.prototype;Z0(ea,Ln);function El(){}El.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,n,i){var s=!!i&&!!i.requireWellFormed;for(var a=[],r=0;r<this.length;r++)ly(this[r],a,e,n,null,s);return a.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function Of(e,n){this._node=e,this._refresh=n,ty(this)}function ty(e){var n=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==n){var i=e._refresh(e._node);if(av(e,"length",i.length),!e.$$length||i.length<e.$$length){for(var s=i.length;s in e;s++)if(Object.prototype.hasOwnProperty.call(e,s))delete e[s]}Z0(i,e),e._inc=n}}Of.prototype.item=function(e){return ty(this),this[e]||null};Oa(Of,El);function Zg(){this._nameIndex=Object.create(null)}function W6(e,n){var i=e.length;while(i--)if(e[i]===n)return i}function Aq(e,n){e._nameIndex[n.nodeName]=n}function K6(e,n){if(e._nameIndex[n.nodeName]===n)delete e._nameIndex[n.nodeName]}function N6(e,n,i,s){if(s)n[W6(n,s)]=i,K6(n,s);else n[n.length++]=i;if(Aq(n,i),e){i.ownerElement=e;var a=e.ownerDocument;if(a)s&&Q6(a,e,s),Cq(a,e,i)}}function P6(e,n,i){var s=W6(n,i);if(s>=0){var a=n.length-1;while(s<a)n[s]=n[++s];if(n.length=a,K6(n,i),e){var r=e.ownerDocument;if(r)Q6(r,e,i),i.ownerElement=null}}else throw new Ln(X6,Error(e.tagName+"@"+i))}Zg.prototype={length:0,item:El.prototype.item,getNamedItem:function(e){var n=this.length;while(n--){var i=this[n];if(i.nodeName==e)return i}},setNamedItem:function(e){var n=e.ownerElement;if(n&&n!=this._ownerElement)throw new Ln(F6);var i=this._nameIndex[e.nodeName];return N6(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var n=e.ownerElement,i;if(n&&n!=this._ownerElement)throw new Ln(F6);return i=this.getNamedItemNS(e.namespaceURI,e.localName),N6(this._ownerElement,this,e,i),i},removeNamedItem:function(e){var n=this.getNamedItem(e);return P6(this._ownerElement,this,n),n},removeNamedItemNS:function(e,n){var i=this.getNamedItemNS(e,n);return P6(this._ownerElement,this,i),i},getNamedItemNS:function(e,n){var i=this.length;while(i--){var s=this[i];if(s.localName==n&&s.namespaceURI==e)return s}return null}};function $6(){}$6.prototype={hasFeature:function(e,n){return!0},createDocument:function(e,n,i){var s=new ep;if(s.implementation=this,s.childNodes=new El,s.doctype=i||null,i)s.appendChild(i);if(n){var a=s.createElementNS(e,n);s.appendChild(a)}return s},createDocumentType:function(e,n,i){var s=new s1;return s.name=e,s.nodeName=e,s.publicId=n||"",s.systemId=i||"",s}};function ni(){}ni.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,n){return t1(this,e,n)},replaceChild:function(e,n){if(t1(this,e,n,Z6),n)this.removeChild(n)},removeChild:function(e){return J6(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return sv(this.ownerDocument||this,this,e)},normalize:function(){Cs(this,null,{enter:function(e){var n=e.firstChild;while(n){var i=n.nextSibling;if(i!==null&&i.nodeType===Y0&&n.nodeType===Y0){var s=[],a=i;while(a!==null&&a.nodeType===Y0)s.push(a.data),a=a.nextSibling;var r=n.nextSibling;while(r!==a){var l=r.nextSibling;r.parentNode=null,r.previousSibling=null,r.nextSibling=null,r=l}if(n.nextSibling=a,a!==null)a.previousSibling=n;else e.lastChild=n;n.appendData(s.join("")),i1(e.ownerDocument,e),n=a}else n=i}return!0}})},isSupported:function(e,n){return this.ownerDocument.implementation.hasFeature(e,n)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){var n=this;while(n){var i=n._nsMap;if(i){for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s}n=n.nodeType==Rf?n.ownerDocument:n.parentNode}return null},lookupNamespaceURI:function(e){var n=this;while(n){var i=n._nsMap;if(i){if(Object.prototype.hasOwnProperty.call(i,e))return i[e]}n=n.nodeType==Rf?n.ownerDocument:n.parentNode}return null},isDefaultNamespace:function(e){var n=this.lookupPrefix(e);return n==null}};function Y6(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}Z0(Fa,ni);Z0(Fa,ni.prototype);function e1(e,n){return Cs(e,null,{enter:function(i){return n(i)?Cs.STOP:!0}})===Cs.STOP}function Cs(e,n,i){var s=[{node:e,context:n,phase:Cs.ENTER}];while(s.length>0){var a=s.pop();if(a.phase===Cs.ENTER){var r=i.enter(a.node,a.context);if(r===Cs.STOP)return Cs.STOP;if(s.push({node:a.node,context:r,phase:Cs.EXIT}),r===null||r===void 0)continue;var l=a.node.lastChild;while(l)s.push({node:l,context:r,phase:Cs.ENTER}),l=l.previousSibling}else if(i.exit)i.exit(a.node,a.context)}}Cs.STOP=Symbol("walkDOM.STOP");Cs.ENTER=0;Cs.EXIT=1;function ep(){this.ownerDocument=this}function Cq(e,n,i){e&&e._inc++;var s=i.namespaceURI;if(s===Q0.XMLNS)n._nsMap[i.prefix?i.localName:""]=i.value}function Q6(e,n,i,s){e&&e._inc++;var a=i.namespaceURI;if(a===Q0.XMLNS)delete n._nsMap[i.prefix?i.localName:""]}function i1(e,n,i){if(e&&e._inc){e._inc++;var s=n.childNodes;if(i)s[s.length++]=i;else{var a=n.firstChild,r=0;while(a)s[r++]=a,a=a.nextSibling;s.length=r,delete s[s.length]}}}function J6(e,n){var{previousSibling:i,nextSibling:s}=n;if(i)i.nextSibling=s;else e.firstChild=s;if(s)s.previousSibling=i;else e.lastChild=i;return n.parentNode=null,n.previousSibling=null,n.nextSibling=null,i1(e.ownerDocument,e),n}function jq(e){return e&&(e.nodeType===ni.DOCUMENT_NODE||e.nodeType===ni.DOCUMENT_FRAGMENT_NODE||e.nodeType===ni.ELEMENT_NODE)}function Eq(e){return e&&(Io(e)||ny(e)||ql(e)||e.nodeType===ni.DOCUMENT_FRAGMENT_NODE||e.nodeType===ni.COMMENT_NODE||e.nodeType===ni.PROCESSING_INSTRUCTION_NODE)}function ql(e){return e&&e.nodeType===ni.DOCUMENT_TYPE_NODE}function Io(e){return e&&e.nodeType===ni.ELEMENT_NODE}function ny(e){return e&&e.nodeType===ni.TEXT_NODE}function B6(e,n){var i=e.childNodes||[];if(Do(i,Io)||ql(n))return!1;var s=Do(i,ql);return!(n&&s&&i.indexOf(s)>i.indexOf(n))}function L6(e,n){var i=e.childNodes||[];function s(r){return Io(r)&&r!==n}if(Do(i,s))return!1;var a=Do(i,ql);return!(n&&a&&i.indexOf(a)>i.indexOf(n))}function qq(e,n,i){if(!jq(e))throw new Ln(Ra,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new Ln(X6,"child not in parent");if(!Eq(n)||ql(n)&&e.nodeType!==ni.DOCUMENT_NODE)throw new Ln(Ra,"Unexpected node type "+n.nodeType+" for parent node type "+e.nodeType)}function Dq(e,n,i){var s=e.childNodes||[],a=n.childNodes||[];if(n.nodeType===ni.DOCUMENT_FRAGMENT_NODE){var r=a.filter(Io);if(r.length>1||Do(a,ny))throw new Ln(Ra,"More than one element or text in fragment");if(r.length===1&&!B6(e,i))throw new Ln(Ra,"Element in fragment can not be inserted before doctype")}if(Io(n)){if(!B6(e,i))throw new Ln(Ra,"Only one element can be added and only after doctype")}if(ql(n)){if(Do(s,ql))throw new Ln(Ra,"Only one doctype is allowed");var l=Do(s,Io);if(i&&s.indexOf(l)<s.indexOf(i))throw new Ln(Ra,"Doctype can only be inserted before an element");if(!i&&l)throw new Ln(Ra,"Doctype can not be appended since element is present")}}function Z6(e,n,i){var s=e.childNodes||[],a=n.childNodes||[];if(n.nodeType===ni.DOCUMENT_FRAGMENT_NODE){var r=a.filter(Io);if(r.length>1||Do(a,ny))throw new Ln(Ra,"More than one element or text in fragment");if(r.length===1&&!L6(e,i))throw new Ln(Ra,"Element in fragment can not be inserted before doctype")}if(Io(n)){if(!L6(e,i))throw new Ln(Ra,"Only one element can be added and only after doctype")}if(ql(n)){let p=function(m){return ql(m)&&m!==i};var c=p;if(Do(s,p))throw new Ln(Ra,"Only one doctype is allowed");var l=Do(s,Io);if(i&&s.indexOf(l)<s.indexOf(i))throw new Ln(Ra,"Doctype can only be inserted before an element")}}function t1(e,n,i,s){if(qq(e,n,i),e.nodeType===ni.DOCUMENT_NODE)(s||Dq)(e,n,i);var a=n.parentNode;if(a)a.removeChild(n);if(n.nodeType===jl){var r=n.firstChild;if(r==null)return n;var l=n.lastChild}else r=l=n;var c=i?i.previousSibling:e.lastChild;if(r.previousSibling=c,l.nextSibling=i,c)c.nextSibling=r;else e.firstChild=r;if(i==null)e.lastChild=l;else i.previousSibling=l;do{r.parentNode=e;var p=e.ownerDocument||e;J0(r,p)}while(r!==l&&(r=r.nextSibling));if(i1(e.ownerDocument||e,e),n.nodeType==jl)n.firstChild=n.lastChild=null;return n}function J0(e,n){if(e.ownerDocument===n)return;if(e.ownerDocument=n,e.nodeType===Cr&&e.attributes)for(var i=0;i<e.attributes.length;i++){var s=e.attributes.item(i);if(s)s.ownerDocument=n}var a=e.firstChild;while(a)J0(a,n),a=a.nextSibling}function Iq(e,n){if(n.parentNode)n.parentNode.removeChild(n);if(n.parentNode=e,n.previousSibling=e.lastChild,n.nextSibling=null,n.previousSibling)n.previousSibling.nextSibling=n;else e.firstChild=n;e.lastChild=n,i1(e.ownerDocument,e,n);var i=e.ownerDocument||e;return J0(n,i),n}ep.prototype={nodeName:"#document",nodeType:G6,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,n){if(e.nodeType==jl){var i=e.firstChild;while(i){var s=i.nextSibling;this.insertBefore(i,n),i=s}return e}if(t1(this,e,n),J0(e,this),this.documentElement===null&&e.nodeType===Cr)this.documentElement=e;return e},removeChild:function(e){if(this.documentElement==e)this.documentElement=null;return J6(this,e)},replaceChild:function(e,n){if(t1(this,e,n,Z6),J0(e,this),n)this.removeChild(n);if(Io(e))this.documentElement=e},importNode:function(e,n){return Mq(this,e,n)},getElementById:function(e){var n=null;return e1(this.documentElement,function(i){if(i.nodeType==Cr){if(i.getAttribute("id")==e)return n=i,!0}}),n},getElementsByClassName:function(e){var n=R6(e);return new Of(this,function(i){var s=[];if(n.length>0)e1(i.documentElement,function(a){if(a!==i&&a.nodeType===Cr){var r=a.getAttribute("class");if(r){var l=e===r;if(!l){var c=R6(r);l=n.every(xq(c))}if(l)s.push(a)}}});return s})},createElement:function(e){var n=new ih;n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.localName=e,n.childNodes=new El;var i=n.attributes=new Zg;return i._ownerElement=n,n},createDocumentFragment:function(){var e=new a1;return e.ownerDocument=this,e.childNodes=new El,e},createTextNode:function(e){var n=new iy;return n.ownerDocument=this,n.appendData(e),n},createComment:function(e){var n=new sy;return n.ownerDocument=this,n.appendData(e),n},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new Ln(O6,'data contains "]]>"');var n=new ay;return n.ownerDocument=this,n.appendData(e),n},createProcessingInstruction:function(e,n){var i=new oy;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=n,i},createAttribute:function(e){var n=new n1;return n.ownerDocument=this,n.name=e,n.nodeName=e,n.localName=e,n.specified=!0,n},createEntityReference:function(e){if(!Mf.test(e))throw new Ln(O6,'not a valid xml name "'+e+'"');var n=new ry;return n.ownerDocument=this,n.nodeName=e,n},createElementNS:function(e,n){var i=new ih,s=n.split(":"),a=i.attributes=new Zg;if(i.childNodes=new El,i.ownerDocument=this,i.nodeName=n,i.tagName=n,i.namespaceURI=e,s.length==2)i.prefix=s[0],i.localName=s[1];else i.localName=n;return a._ownerElement=i,i},createAttributeNS:function(e,n){var i=new n1,s=n.split(":");if(i.ownerDocument=this,i.nodeName=n,i.name=n,i.namespaceURI=e,i.specified=!0,s.length==2)i.prefix=s[0],i.localName=s[1];else i.localName=n;return i}};Oa(ep,ni);function ih(){this._nsMap={}}ih.prototype={nodeType:Cr,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var n=this.getAttributeNode(e);return n&&n.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,n){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},removeAttribute:function(e){var n=this.getAttributeNode(e);n&&this.removeAttributeNode(n)},appendChild:function(e){if(e.nodeType===jl)return this.insertBefore(e,null);else return Iq(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,n){var i=this.getAttributeNodeNS(e,n);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,n){return this.getAttributeNodeNS(e,n)!=null},getAttributeNS:function(e,n){var i=this.getAttributeNodeNS(e,n);return i&&i.value||""},setAttributeNS:function(e,n,i){var s=this.ownerDocument.createAttributeNS(e,n);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,n){return this.attributes.getNamedItemNS(e,n)},getElementsByTagName:function(e){return new Of(this,function(n){var i=[];return e1(n,function(s){if(s!==n&&s.nodeType==Cr&&(e==="*"||s.tagName==e))i.push(s)}),i})},getElementsByTagNameNS:function(e,n){return new Of(this,function(i){var s=[];return e1(i,function(a){if(a!==i&&a.nodeType===Cr&&(e==="*"||a.namespaceURI===e)&&(n==="*"||a.localName==n))s.push(a)}),s})}};ep.prototype.getElementsByTagName=ih.prototype.getElementsByTagName;ep.prototype.getElementsByTagNameNS=ih.prototype.getElementsByTagNameNS;Oa(ih,ni);function n1(){}n1.prototype.nodeType=Rf;Oa(n1,ni);function tp(){}tp.prototype={data:"",substringData:function(e,n){return this.data.substring(e,e+n)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,n){this.replaceData(e,0,n)},appendChild:function(e){throw Error(js[Ra])},deleteData:function(e,n){this.replaceData(e,n,"")},replaceData:function(e,n,i){var s=this.data.substring(0,e),a=this.data.substring(e+n);i=s+i+a,this.nodeValue=this.data=i,this.length=i.length}};Oa(tp,ni);function iy(){}iy.prototype={nodeName:"#text",nodeType:Y0,splitText:function(e){var n=this.data,i=n.substring(e);n=n.substring(0,e),this.data=this.nodeValue=n,this.length=n.length;var s=this.ownerDocument.createTextNode(i);if(this.parentNode)this.parentNode.insertBefore(s,this.nextSibling);return s}};Oa(iy,tp);function sy(){}sy.prototype={nodeName:"#comment",nodeType:ey};Oa(sy,tp);function ay(){}ay.prototype={nodeName:"#cdata-section",nodeType:U6};Oa(ay,tp);function s1(){}s1.prototype.nodeType=V6;Oa(s1,ni);function ev(){}ev.prototype.nodeType=Tq;Oa(ev,ni);function tv(){}tv.prototype.nodeType=kq;Oa(tv,ni);function ry(){}ry.prototype.nodeType=z6;Oa(ry,ni);function a1(){}a1.prototype.nodeName="#document-fragment";a1.prototype.nodeType=jl;Oa(a1,ni);function oy(){}oy.prototype.nodeType=Zw;Oa(oy,ni);function nv(){}nv.prototype.serializeToString=function(e,n,i,s){return iv.call(e,n,i,s)};ni.prototype.toString=iv;function iv(e,n,i){var s=!!i&&!!i.requireWellFormed,a=[],r=this.nodeType==9&&this.documentElement||this,{prefix:l,namespaceURI:c}=r;if(c&&l==null){var l=r.lookupPrefix(c);if(l==null)var p=[{namespace:c,prefix:null}]}return ly(this,a,e,n,p,s),a.join("")}function H6(e,n,i){var s=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if(s==="xml"&&a===Q0.XML||a===Q0.XMLNS)return!1;var r=i.length;while(r--){var l=i[r];if(l.prefix===s)return l.namespace!==a}return!0}function Jg(e,n,i,s){if(s&&!Mf.test(n))throw new Ln(to,'The attribute name "'+n+'" is not a valid XML QName');e.push(" ",n,'="',i.replace(/[<>&"\t\n\r]/g,Y6),'"')}function ly(e,n,i,s,a,r){if(!a)a=[];Cs(e,{ns:a,isHTML:i},{enter:function(l,c){var{ns:p,isHTML:m}=c;if(s)if(l=s(l),l){if(typeof l=="string")return n.push(l),null}else return null;switch(l.nodeType){case Cr:var g=l.attributes,y=g.length,x=l.tagName;m=Q0.isHTML(l.namespaceURI)||m;var I=x;if(!m&&!l.prefix&&l.namespaceURI){var M;for(var H=0;H<g.length;H++)if(g.item(H).name==="xmlns"){M=g.item(H).value;break}if(!M)for(var X=p.length-1;X>=0;X--){var W=p[X];if(W.prefix===""&&W.namespace===l.namespaceURI){M=W.namespace;break}}if(M!==l.namespaceURI)for(var X=p.length-1;X>=0;X--){var W=p[X];if(W.namespace===l.namespaceURI){if(W.prefix)I=W.prefix+":"+x;break}}}if(r&&!Mf.test(I))throw new Ln(to,'The element name "'+I+'" is not a valid XML QName');n.push("<",I);var Y=p.slice();for(var te=0;te<y;te++){var ae=g.item(te);if(ae.prefix=="xmlns")Y.push({prefix:ae.localName,namespace:ae.value});else if(ae.nodeName=="xmlns")Y.push({prefix:"",namespace:ae.value})}for(var te=0;te<y;te++){var ae=g.item(te);if(H6(ae,m,Y)){var ne=ae.prefix||"",oe=ae.namespaceURI;Jg(n,ne?"xmlns:"+ne:"xmlns",oe,r),Y.push({prefix:ne,namespace:oe})}var me=s?s(ae):ae;if(me)if(typeof me==="string")n.push(me);else Jg(n,me.name,me.value,r)}if(x===I&&H6(l,m,Y)){var be=l.prefix||"",oe=l.namespaceURI;Jg(n,be?"xmlns:"+be:"xmlns",oe,r),Y.push({prefix:be,namespace:oe})}var xe=l.firstChild;if(xe||m&&!/^(?:meta|link|img|br|hr|input)$/i.test(x)){if(n.push(">"),m&&/^script$/i.test(x)){while(xe){if(xe.data)n.push(xe.data);else ly(xe,n,m,s,Y.slice(),r);xe=xe.nextSibling}return n.push("</",x,">"),null}return{ns:Y,isHTML:m,tag:I}}else return n.push("/>"),null;case G6:case jl:return{ns:p.slice(),isHTML:m,tag:null};case Rf:return Jg(n,l.name,l.value,r),null;case Y0:return n.push(l.data.replace(/[<&>]/g,Y6)),null;case U6:if(r&&l.data.indexOf("]]>")!==-1)throw new Ln(to,'The CDATASection data contains "]]>"');return n.push("<![CDATA[",l.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case ey:if(r&&l.data.indexOf("-->")!==-1)throw new Ln(to,'The comment node data contains "-->"');return n.push("<!--",l.data,"-->"),null;case V6:if(r){if(!Mf.test(l.name))throw new Ln(to,'The doctype name "'+l.name+'" is not a valid XML Name');if(l.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(l.publicId))throw new Ln(to,"DocumentType publicId is not a valid PubidLiteral");if(l.systemId&&!/^("[^"]*"|'[^']*')$/.test(l.systemId))throw new Ln(to,"DocumentType systemId is not a valid SystemLiteral");if(l.internalSubset&&l.internalSubset.indexOf("]>")!==-1)throw new Ln(to,'DocumentType internalSubset contains "]>"')}var Oe=l.publicId,Fe=l.systemId;if(n.push("<!DOCTYPE ",l.name),Oe){if(n.push(" PUBLIC ",Oe),Fe&&Fe!=".")n.push(" ",Fe);n.push(">")}else if(Fe&&Fe!=".")n.push(" SYSTEM ",Fe,">");else{var Ue=l.internalSubset;if(Ue)n.push(" [",Ue,"]");n.push(">")}return null;case Zw:if(r){if(!Mf.test(l.target)||l.target.indexOf(":")!==-1||l.target.toLowerCase()==="xml")throw new Ln(to,'The processing instruction target "'+l.target+'" is not a valid XML NCName or is reserved');if(l.data.indexOf("?>")!==-1)throw new Ln(to,'The ProcessingInstruction data contains "?>"')}return n.push("<?",l.target," ",l.data,"?>"),null;case z6:if(r&&!Mf.test(l.nodeName))throw new Ln(to,'The entity reference name "'+l.nodeName+'" is not a valid XML Name');return n.push("&",l.nodeName,";"),null;default:return n.push("??",l.nodeName),null}},exit:function(l,c){if(c&&c.tag)n.push("</",c.tag,">")}})}function Mq(e,n,i){var s;return Cs(n,null,{enter:function(a,r){var l=a.cloneNode(!1);if(l.ownerDocument=e,l.parentNode=null,r===null)s=l;else r.appendChild(l);var c=a.nodeType===Rf||i;return c?l:null}}),s}function sv(e,n,i){var s;return Cs(n,null,{enter:function(a,r){var l=new a.constructor;for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var p=a[c];if(typeof p!="object"){if(p!=l[c])l[c]=p}}if(a.childNodes)l.childNodes=new El;l.ownerDocument=e;var m=i;switch(l.nodeType){case Cr:var g=a.attributes,y=l.attributes=new Zg,x=g.length;y._ownerElement=l;for(var I=0;I<x;I++)l.setAttributeNode(sv(e,g.item(I),!0));break;case Rf:m=!0}if(r!==null)r.appendChild(l);else s=l;return m?l:null}}),s}function av(e,n,i){e[n]=i}try{if(Object.defineProperty)Object.defineProperty(Of.prototype,"length",{get:function(){return ty(this),this.$$length}}),Object.defineProperty(ni.prototype,"textContent",{get:function(){if(this.nodeType===Cr||this.nodeType===jl){var e=[];return Cs(this,null,{enter:function(n){if(n.nodeType===Cr||n.nodeType===jl)return!0;if(n.nodeType===Zw||n.nodeType===ey)return null;e.push(n.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case Cr:case jl:while(this.firstChild)this.removeChild(this.firstChild);if(e||String(e))this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),av=function(e,n,i){e["$$"+n]=i}}catch(e){}Rq.DocumentType=s1;Rq.DOMException=Ln;Rq.DOMImplementation=$6;Rq.Element=ih;Rq.Node=ni;Rq.NodeList=El;Rq.walkDOM=Cs;Rq.XMLSerializer=nv});var lv=w(function(zq){var rv=If().freeze;zq.XML_ENTITIES=rv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});zq.HTML_ENTITIES=rv({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"\uD835\uDD05",bfr:"\uD835\uDD1F",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"\uD835\uDD39",bopf:"\uD835\uDD53",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"\uD835\uDCB7",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"\uD835\uDD20",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"\uD835\uDD54",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"\uD835\uDCBB",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"\uD835\uDD25",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"\uD835\uDD59",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"\uD835\uDCBD",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"\uD835\uDD26",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"\uD835\uDCBE",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"ȷ",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"\uD835\uDD0F",lfr:"\uD835\uDD29",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"\uD835\uDCC1",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"∓",Mscr:"ℳ",mscr:"\uD835\uDCC2",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
11
|
+
`,nexist:"∄",nexists:"∄",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"\uD835\uDD5F",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"\uD835\uDCA9",nscr:"\uD835\uDCC3",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"\uD835\uDCAA",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"\uD835\uDD61",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"⨌",Qopf:"ℚ",qopf:"\uD835\uDD62",qprime:"⁗",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"\uD835\uDD2F",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"\uD835\uDCC7",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"\uD835\uDD4A",sopf:"\uD835\uDD64",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"Ї",yicy:"ї",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"\uD835\uDD37",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"",zwnj:""});zq.entityMap=zq.HTML_ENTITIES});var dv=w(function(eD){var sp=If().NAMESPACE,uy=If().tagNamePattern,Ff=0,Rc=1,Pf=2,np=3,Bf=4,Lf=5,ip=6,r1=7;function Hf(e,n){if(this.message=e,this.locator=n,Error.captureStackTrace)Error.captureStackTrace(this,Hf)}Hf.prototype=Error();Hf.prototype.name=Hf.name;function hv(){}hv.prototype={parse:function(e,n,i){var s=this.domBuilder;s.startDocument(),Yq(n,n={}),Xq(e,n,i,s,this.errorHandler),s.endDocument()}};function Xq(e,n,i,s,a){function r(Me){if(Me>65535){Me-=65536;var yt=55296+(Me>>10),Ge=56320+(Me&1023);return String.fromCharCode(yt,Ge)}else return String.fromCharCode(Me)}function l(Me){var yt=Me.slice(1,-1);if(Object.hasOwnProperty.call(i,yt))return i[yt];else if(yt.charAt(0)==="#")return r(parseInt(yt.substr(1).replace("x","0x")));else return a.error("entity not found:"+Me),Me}function c(Me){if(Me>H){var yt=e.substring(H,Me).replace(/&#?\w+;/g,l);x&&p(H),s.characters(yt,0,Me-H),H=Me}}function p(Me,yt){while(Me>=g&&(yt=y.exec(e)))m=yt.index,g=m+yt[0].length,x.lineNumber++;x.columnNumber=Me-m+1}var m=0,g=0,y=/.*(?:\r\n?|\n)|.*$/g,x=s.locator,I=[{currentNSMap:n}],M={},H=0;while(!0){try{var X=e.indexOf("<",H);if(X<0){if(!e.substr(H).match(/^\s*$/)){var W=s.doc,Y=W.createTextNode(e.substr(H));W.appendChild(Y),s.currentElement=Y}return}if(X>H)c(X);switch(e.charAt(X+1)){case"/":var Fe=e.indexOf(">",X+3),te=e.substring(X+2,Fe).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),ae=I.pop();if(Fe<0)te=e.substring(X+2).replace(/[\s<].*/,""),a.error("end tag name: "+te+" is not complete:"+ae.tagName),Fe=X+1+te.length;else if(te.match(/\s</))te=te.replace(/[\s<].*/,""),a.error("end tag name: "+te+" maybe not complete"),Fe=X+1+te.length;else if(/[ \t\n\r]/.test(te)&&uy.test(te.split(/[ \t\n\r]/)[0]))a.error('end tag name is followed by whitespace and trailing content: "'+te+'"');var ne=ae.localNSMap,oe=ae.tagName==te,me=oe||ae.tagName&&ae.tagName.toLowerCase()==te.toLowerCase();if(me){if(s.endElement(ae.uri,ae.localName,te),ne){for(var be in ne)if(Object.prototype.hasOwnProperty.call(ne,be))s.endPrefixMapping(be)}if(!oe)a.fatalError("end tag name: "+te+" is not match the current start tagName:"+ae.tagName)}else I.push(ae);Fe++;break;case"?":x&&p(X),Fe=Jq(e,X,s);break;case"!":x&&p(X),Fe=Qq(e,X,s,a);break;default:x&&p(X);var xe=new fv,Oe=I[I.length-1].currentNSMap,Fe=Wq(e,X,xe,Oe,l,a),Ue=xe.length;if(!xe.closed&&$q(e,Fe,xe.tagName,M)){if(xe.closed=!0,!i.nbsp)a.warning("unclosed xml attribute")}if(x&&Ue){var ze=cv(x,{});for(var Le=0;Le<Ue;Le++){var qe=xe[Le];p(qe.offset),qe.locator=cv(x,{})}if(s.locator=ze,uv(xe,s,Oe))I.push(xe);s.locator=x}else if(uv(xe,s,Oe))I.push(xe);if(sp.isHTML(xe.uri)&&!xe.closed)Fe=Kq(e,Fe,xe.tagName,l,s);else Fe++}}catch(Me){if(Me instanceof Hf)throw Me;a.error("element parse error: "+Me),Fe=-1}if(Fe>H)H=Fe;else c(Math.max(X,H)+1)}}function cv(e,n){return n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber,n}function Wq(e,n,i,s,a,r){function l(I,M,H){if(i.attributeNames.hasOwnProperty(I))r.fatalError("Attribute "+I+" redefined");i.addValue(I,M.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),H)}var c,p,m=++n,g=Ff;while(!0){var y=e.charAt(m);if(g===Ff&&y==="<")throw Error("unexpected < in tag name: "+e.slice(n,m));switch(y){case"=":if(g===Rc)c=e.slice(n,m),g=np;else if(g===Pf)g=np;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(g===np||g===Rc){if(g===Rc)r.warning('attribute value must after "="'),c=e.slice(n,m);if(n=m+1,m=e.indexOf(y,n),m>0)p=e.slice(n,m),l(c,p,n-1),g=Lf;else throw Error("attribute value no end '"+y+"' match")}else if(g==Bf)p=e.slice(n,m),l(c,p,n),r.warning('attribute "'+c+'" missed start quot('+y+")!!"),n=m+1,g=Lf;else throw Error('attribute value must after "="');break;case"/":switch(g){case Ff:i.setTagName(e.slice(n,m));case Lf:case ip:case r1:g=r1,i.closed=!0;case Bf:case Rc:break;case Pf:i.closed=!0;break;default:throw Error("attribute invalid close char('/')")}break;case"":if(r.error("unexpected end of input"),g==Ff)i.setTagName(e.slice(n,m));return m;case">":switch(g){case Ff:i.setTagName(e.slice(n,m));case Lf:case ip:case r1:break;case Bf:case Rc:if(p=e.slice(n,m),p.slice(-1)==="/")i.closed=!0,p=p.slice(0,-1);case Pf:if(g===Pf)p=c;if(g==Bf)r.warning('attribute "'+p+'" missed quot(")!'),l(c,p,n);else{if(!sp.isHTML(s[""])||!p.match(/^(?:disabled|checked|selected)$/i))r.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!');l(p,p,n)}break;case np:throw Error("attribute value missed!!")}return m;case"":y=" ";default:if(y<=" ")switch(g){case Ff:i.setTagName(e.slice(n,m)),g=ip;break;case Rc:c=e.slice(n,m),g=Pf;break;case Bf:var p=e.slice(n,m);r.warning('attribute "'+p+'" missed quot(")!!'),l(c,p,n);case Lf:g=ip;break}else switch(g){case Pf:var x=i.tagName;if(!sp.isHTML(s[""])||!c.match(/^(?:disabled|checked|selected)$/i))r.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!');l(c,c,n),n=m,g=Rc;break;case Lf:r.warning('attribute space is required"'+c+'"!!');case ip:g=Rc,n=m;break;case np:g=Bf,n=m;break;case r1:throw Error("elements closed character '/' and '>' must be connected to")}}m++}}function uv(e,n,i){var s=e.tagName,a=null,y=e.length;while(y--){var r=e[y],l=r.qName,c=r.value,x=l.indexOf(":");if(x>0)var p=r.prefix=l.slice(0,x),m=l.slice(x+1),g=p==="xmlns"&&m;else m=l,p=null,g=l==="xmlns"&&"";if(r.localName=m,g!==!1){if(a==null)a={},i=Object.create(i);i[g]=a[g]=c,r.uri=sp.XMLNS,n.startPrefixMapping(g,c)}}var y=e.length;while(y--){r=e[y];var p=r.prefix;if(p){if(p==="xml")r.uri=sp.XML;if(p!=="xmlns")r.uri=i[p||""]}}var x=s.indexOf(":");if(x>0)p=e.prefix=s.slice(0,x),m=e.localName=s.slice(x+1);else p=null,m=e.localName=s;var I=e.uri=i[p||""];if(n.startElement(I,m,s,e),e.closed){if(n.endElement(I,m,s),a){for(p in a)if(Object.prototype.hasOwnProperty.call(a,p))n.endPrefixMapping(p)}}else return e.currentNSMap=i,e.localNSMap=a,!0}function Kq(e,n,i,s,a){if(/^(?:script|textarea)$/i.test(i)){var r=e.indexOf("</"+i+">",n),l=e.substring(n+1,r);if(/[&<]/.test(l)){if(/^script$/i.test(i))return a.characters(l,0,l.length),r;return l=l.replace(/&#?\w+;/g,s),a.characters(l,0,l.length),r}}return n+1}function $q(e,n,i,s){var a=s[i];if(a==null){if(a=e.lastIndexOf("</"+i+">"),a<n)a=e.lastIndexOf("</"+i);s[i]=a}return a<n}function Yq(e,n){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))n[i]=e[i]}function Qq(e,n,i,s){var a=e.charAt(n+2);switch(a){case"-":if(e.charAt(n+3)==="-"){var r=e.indexOf("-->",n+4);if(r>n)return i.comment(e,n+4,r-n-4),r+3;else return s.error("Unclosed comment"),-1}else return-1;default:if(e.substr(n+3,6)=="CDATA["){var r=e.indexOf("]]>",n+9);return i.startCDATA(),i.characters(e,n+9,r-n-9),i.endCDATA(),r+3}var l=Zq(e,n),c=l.length;if(c>1&&/!doctype/i.test(l[0][0])){var p=l[1][0],m=!1,g=!1;if(c>3){if(/^public$/i.test(l[2][0]))m=l[3][0],g=c>4&&l[4][0];else if(/^system$/i.test(l[2][0]))g=l[3][0]}var y=l[c-1];return i.startDTD(p,m,g),i.endDTD(),y.index+y[0].length}}return-1}function Jq(e,n,i){var s=e.indexOf("?>",n);if(s){var a=e.substring(n,s).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(a){var r=a[0].length;return i.processingInstruction(a[1],a[2]),s+2}else return-1}return-1}function fv(){this.attributeNames={}}fv.prototype={setTagName:function(e){if(!uy.test(e))throw Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,n,i){if(!uy.test(e))throw Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:n,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function Zq(e,n){var i,s=[],a=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;a.lastIndex=n,a.exec(e);while(i=a.exec(e))if(s.push(i),i[1])return s}eD.XMLReader=hv;eD.ParseError=Hf});var _v=w(function(cD){var iD=If(),sD=cy(),pv=lv(),wv=dv(),aD=sD.DOMImplementation,gv=iD.NAMESPACE,{ParseError:rD,XMLReader:oD}=wv;function vv(e){return e.replace(/\r[\n\u0085]/g,`
|
|
12
|
+
`).replace(/[\r\u0085\u2028]/g,`
|
|
13
|
+
`)}function Sv(e){this.options=e||{locator:{}}}Sv.prototype.parseFromString=function(e,n){var i=this.options,s=new oD,a=i.domBuilder||new ap,{errorHandler:r,locator:l}=i,c=i.xmlns||{},p=/\/x?html?$/.test(n),m=p?pv.HTML_ENTITIES:pv.XML_ENTITIES;if(l)a.setDocumentLocator(l);if(s.errorHandler=lD(r,a,l),s.domBuilder=i.domBuilder||a,p)c[""]=gv.HTML;c.xml=c.xml||gv.XML;var g=i.normalizeLineEndings||vv;if(e&&typeof e==="string")s.parse(g(e),c,m);else s.errorHandler.error("invalid doc source");return a.doc};function lD(e,n,i){if(!e){if(n instanceof ap)return n;e=n}var s={},a=e instanceof Function;i=i||{};function r(l){var c=e[l];if(!c&&a)c=e.length==2?function(p){e(l,p)}:e;s[l]=c&&function(p){c("[xmldom "+l+"]\t"+p+hy(i))}||function(){}}return r("warning"),r("error"),r("fatalError"),s}function ap(){this.cdata=!1}function Uf(e,n){n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber}ap.prototype={startDocument:function(){if(this.doc=new aD().createDocument(null,null,null),this.locator)this.doc.documentURI=this.locator.systemId},startElement:function(e,n,i,s){var a=this.doc,r=a.createElementNS(e,i||n),l=s.length;o1(this,r),this.currentElement=r,this.locator&&Uf(this.locator,r);for(var c=0;c<l;c++){var e=s.getURI(c),p=s.getValue(c),i=s.getQName(c),m=a.createAttributeNS(e,i);this.locator&&Uf(s.getLocator(c),m),m.value=m.nodeValue=p,r.setAttributeNode(m)}},endElement:function(e,n,i){var s=this.currentElement,a=s.tagName;this.currentElement=s.parentNode},startPrefixMapping:function(e,n){},endPrefixMapping:function(e){},processingInstruction:function(e,n){var i=this.doc.createProcessingInstruction(e,n);this.locator&&Uf(this.locator,i),o1(this,i)},ignorableWhitespace:function(e,n,i){},characters:function(e,n,i){if(e=bv.apply(this,arguments),e){if(this.cdata)var s=this.doc.createCDATASection(e);else var s=this.doc.createTextNode(e);if(this.currentElement)this.currentElement.appendChild(s);else if(/^\s*$/.test(e))this.doc.appendChild(s);this.locator&&Uf(this.locator,s)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){if(this.locator=e)e.lineNumber=0},comment:function(e,n,i){e=bv.apply(this,arguments);var s=this.doc.createComment(e);this.locator&&Uf(this.locator,s),o1(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,n,i){var s=this.doc.implementation;if(s&&s.createDocumentType){var a=s.createDocumentType(e,n,i);this.locator&&Uf(this.locator,a),o1(this,a),this.doc.doctype=a}},warning:function(e){console.warn("[xmldom warning]\t"+e,hy(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,hy(this.locator))},fatalError:function(e){throw new rD(e,this.locator)}};function hy(e){if(e)return`
|
|
14
|
+
@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function bv(e,n,i){if(typeof e=="string")return e.substr(n,i);else{if(e.length>=n+i||n)return new java.lang.String(e,n,i)+"";return e}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){ap.prototype[e]=function(){return null}});function o1(e,n){if(!e.currentElement)e.doc.appendChild(n);else e.currentElement.appendChild(n)}cD.__DOMHandler=ap;cD.normalizeLineEndings=vv;cD.DOMParser=Sv});var Uv=w(function(qU,Hv){var Lv=Math.pow(2,32),oI=function(e){var n=new DataView(e.buffer,e.byteOffset,e.byteLength),i;if(n.getBigUint64){if(i=n.getBigUint64(0),i<Number.MAX_SAFE_INTEGER)return Number(i);return i}return n.getUint32(0)*Lv+n.getUint32(4)};Hv.exports={getUint64:oI,MAX_UINT32:Lv}});var Vv=w(function(DU,Gv){var zv=Uv().getUint64,lI=function(e){var n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:n.getUint32(4),timescale:n.getUint32(8)},s=12;if(i.version===0)i.earliestPresentationTime=n.getUint32(s),i.firstOffset=n.getUint32(s+4),s+=8;else i.earliestPresentationTime=zv(e.subarray(s)),i.firstOffset=zv(e.subarray(s+8)),s+=16;s+=2;var a=n.getUint16(s);s+=2;for(;a>0;s+=12,a--)i.references.push({referenceType:(e[s]&128)>>>7,referencedSize:n.getUint32(s)&2147483647,subsegmentDuration:n.getUint32(s+4),startsWithSap:!!(e[s+8]&128),sapType:(e[s+8]&112)>>>4,sapDeltaTime:n.getUint32(s+8)&268435455});return i};Gv.exports=lI});var a8=w(function(tz,s8){var Sy=90000,_y,xy,f1,ky,t8,n8,i8;_y=function(e){return e*Sy};xy=function(e,n){return e*n};f1=function(e){return e/Sy};ky=function(e,n){return e/n};t8=function(e,n){return _y(ky(e,n))};n8=function(e,n){return xy(f1(e),n)};i8=function(e,n,i){return f1(i?e:e-n)};s8.exports={ONE_SECOND_IN_TS:Sy,secondsToVideoTs:_y,secondsToAudioTs:xy,videoTsToSeconds:f1,audioTsToSeconds:ky,audioTsToVideoTs:t8,videoTsToAudioTs:n8,metadataTsToSeconds:i8}});var ek=w(function(y$,Kp){C();vu();Kp.exports=function(e){function n(f,d,b,k){return new ke(f,d,b,k)}function i(){}function s(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)d+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(f){var d=f,b=f;if(f.alternate)for(;d.return;)d=d.return;else{f=d;do d=f,(d.flags&4098)!==0&&(b=d.return),f=d.return;while(f)}return d.tag===3?b:null}function r(f){if(a(f)!==f)throw Error(s(188))}function l(f){var d=f.alternate;if(!d){if(d=a(f),d===null)throw Error(s(188));return d!==f?null:f}for(var b=f,k=d;;){var z=b.return;if(z===null)break;var J=z.alternate;if(J===null){if(k=z.return,k!==null){b=k;continue}break}if(z.child===J.child){for(J=z.child;J;){if(J===b)return r(z),f;if(J===k)return r(z),d;J=J.sibling}throw Error(s(188))}if(b.return!==k.return)b=z,k=J;else{for(var re=!1,De=z.child;De;){if(De===b){re=!0,b=z,k=J;break}if(De===k){re=!0,k=z,b=J;break}De=De.sibling}if(!re){for(De=J.child;De;){if(De===b){re=!0,b=J,k=z;break}if(De===k){re=!0,k=J,b=z;break}De=De.sibling}if(!re)throw Error(s(189))}}if(b.alternate!==k)throw Error(s(190))}if(b.tag!==3)throw Error(s(188));return b.stateNode.current===b?f:d}function c(f){var d=f.tag;if(d===5||d===26||d===27||d===6)return f;for(f=f.child;f!==null;){if(d=c(f),d!==null)return d;f=f.sibling}return null}function p(f){var d=f.tag;if(d===5||d===26||d===27||d===6)return f;for(f=f.child;f!==null;){if(f.tag!==4&&(d=p(f),d!==null))return d;f=f.sibling}return null}function m(f){if(f===null||typeof f!=="object")return null;return f=P9&&f[P9]||f["@@iterator"],typeof f==="function"?f:null}function g(f){if(f==null)return null;if(typeof f==="function")return f.$$typeof===PA?null:f.displayName||f.name||null;if(typeof f==="string")return f;switch(f){case sf:return"Fragment";case P2:return"Profiler";case F9:return"StrictMode";case L2:return"Suspense";case H2:return"SuspenseList";case z2:return"Activity"}if(typeof f==="object")switch(f.$$typeof){case nf:return"Portal";case wc:return f.displayName||"Context";case N9:return(f._context.displayName||"Context")+".Consumer";case B2:var d=f.render;return f=f.displayName,f||(f=d.displayName||d.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case U2:return d=f.displayName||null,d!==null?d:g(f.type)||"Memo";case yc:d=f._payload,f=f._init;try{return g(f(d))}catch(b){}}return null}function y(f){return{current:f}}function x(f){0>lf||(f.current=$2[lf],$2[lf]=null,lf--)}function I(f,d){lf++,$2[lf]=f.current,f.current=d}function M(f){return f>>>=0,f===0?32:31-(dj(f)/pj|0)|0}function H(f){var d=f&42;if(d!==0)return d;switch(f&-f){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return f&261888;case 262144:case 524288:case 1048576:case 2097152:return f&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return f&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return f}}function X(f,d,b){var k=f.pendingLanes;if(k===0)return 0;var z=0,J=f.suspendedLanes,re=f.pingedLanes;f=f.warmLanes;var De=k&134217727;return De!==0?(k=De&~J,k!==0?z=H(k):(re&=De,re!==0?z=H(re):b||(b=De&~f,b!==0&&(z=H(b))))):(De=k&~J,De!==0?z=H(De):re!==0?z=H(re):b||(b=k&~f,b!==0&&(z=H(b)))),z===0?0:d!==0&&d!==z&&(d&J)===0&&(J=z&-z,b=d&-d,J>=b||J===32&&(b&4194048)!==0)?d:z}function W(f,d){return(f.pendingLanes&~(f.suspendedLanes&~f.pingedLanes)&d)===0}function Y(f,d){switch(f){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var f=_g;return _g<<=1,(_g&62914560)===0&&(_g=4194304),f}function ae(f){for(var d=[],b=0;31>b;b++)d.push(f);return d}function ne(f,d){f.pendingLanes|=d,d!==268435456&&(f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0)}function oe(f,d,b,k,z,J){var re=f.pendingLanes;f.pendingLanes=b,f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0,f.expiredLanes&=b,f.entangledLanes&=b,f.errorRecoveryDisabledLanes&=b,f.shellSuspendCounter=0;var{entanglements:De,expirationTimes:lt,hiddenUpdates:kt}=f;for(b=re&~b;0<b;){var Nt=31-Qa(b),It=1<<Nt;De[Nt]=0,lt[Nt]=-1;var Ut=kt[Nt];if(Ut!==null)for(kt[Nt]=null,Nt=0;Nt<Ut.length;Nt++){var kn=Ut[Nt];kn!==null&&(kn.lane&=-536870913)}b&=~It}k!==0&&me(f,k,0),J!==0&&z===0&&f.tag!==0&&(f.suspendedLanes|=J&~(re&~d))}function me(f,d,b){f.pendingLanes|=d,f.suspendedLanes&=~d;var k=31-Qa(d);f.entangledLanes|=d,f.entanglements[k]=f.entanglements[k]|1073741824|b&261930}function be(f,d){var b=f.entangledLanes|=d;for(f=f.entanglements;b;){var k=31-Qa(b),z=1<<k;z&d|f[k]&d&&(f[k]|=d),b&=~z}}function xe(f,d){var b=d&-d;return b=(b&42)!==0?1:Oe(b),(b&(f.suspendedLanes|d))!==0?0:b}function Oe(f){switch(f){case 2:f=1;break;case 8:f=4;break;case 32:f=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:f=128;break;case 268435456:f=134217728;break;default:f=0}return f}function Fe(f){return f&=-f,2<f?8<f?(f&134217727)!==0?32:268435456:8:2}function Ue(f){if(typeof yj==="function"&&vj(f),Ja&&typeof Ja.setStrictMode==="function")try{Ja.setStrictMode(D0,f)}catch(d){}}function ze(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}function Le(f){if(J2===void 0)try{throw Error()}catch(b){var d=b.stack.trim().match(/\n( *(at )?)/);J2=d&&d[1]||"",u4=-1<b.stack.indexOf(`
|
|
15
|
+
at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
16
|
+
`+J2+f+u4}function qe(f,d){if(!f||Z2)return"";Z2=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(d){var It=function(){throw Error()};if(Object.defineProperty(It.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(It,[])}catch(kn){var Ut=kn}Reflect.construct(f,[],It)}else{try{It.call()}catch(kn){Ut=kn}f.call(It.prototype)}}else{try{throw Error()}catch(kn){Ut=kn}(It=f())&&typeof It.catch==="function"&&It.catch(function(){})}}catch(kn){if(kn&&Ut&&typeof kn.stack==="string")return[kn.stack,Ut.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var z=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");z&&z.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var J=k.DetermineComponentFrameRoot(),re=J[0],De=J[1];if(re&&De){var lt=re.split(`
|
|
17
|
+
`),kt=De.split(`
|
|
18
|
+
`);for(z=k=0;k<lt.length&&!lt[k].includes("DetermineComponentFrameRoot");)k++;for(;z<kt.length&&!kt[z].includes("DetermineComponentFrameRoot");)z++;if(k===lt.length||z===kt.length)for(k=lt.length-1,z=kt.length-1;1<=k&&0<=z&<[k]!==kt[z];)z--;for(;1<=k&&0<=z;k--,z--)if(lt[k]!==kt[z]){if(k!==1||z!==1)do if(k--,z--,0>z||lt[k]!==kt[z]){var Nt=`
|
|
19
|
+
`+lt[k].replace(" at new "," at ");return f.displayName&&Nt.includes("<anonymous>")&&(Nt=Nt.replace("<anonymous>",f.displayName)),Nt}while(1<=k&&0<=z);break}}}finally{Z2=!1,Error.prepareStackTrace=b}return(b=f?f.displayName||f.name:"")?Le(b):""}function Me(f,d){switch(f.tag){case 26:case 27:case 5:return Le(f.type);case 16:return Le("Lazy");case 13:return f.child!==d&&d!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return qe(f.type,!1);case 11:return qe(f.type.render,!1);case 1:return qe(f.type,!0);case 31:return Le("Activity");default:return""}}function yt(f){try{var d="",b=null;do d+=Me(f,b),b=f,f=f.return;while(f);return d}catch(k){return`
|
|
20
|
+
Error generating stack: `+k.message+`
|
|
21
|
+
`+k.stack}}function Ge(f,d){if(typeof f==="object"&&f!==null){var b=h4.get(f);if(b!==void 0)return b;return d={value:f,source:d,stack:yt(d)},h4.set(f,d),d}return{value:f,source:d,stack:yt(d)}}function Qe(f,d){hf[ff++]=I0,hf[ff++]=kg,kg=f,I0=d}function jt(f,d,b){_r[xr++]=Ao,_r[xr++]=jo,_r[xr++]=vc,vc=f;var k=Ao;f=jo;var z=32-Qa(k)-1;k&=~(1<<z),b+=1;var J=32-Qa(d)+z;if(30<J){var re=z-z%5;J=(k&(1<<re)-1).toString(32),k>>=re,z-=re,Ao=1<<32-Qa(d)+z|b<<z|k,jo=J+f}else Ao=1<<J|b<<z|k,jo=f}function ut(f){f.return!==null&&(Qe(f,1),jt(f,1,0))}function st(f){for(;f===kg;)kg=hf[--ff],hf[ff]=null,I0=hf[--ff],hf[ff]=null;for(;f===vc;)vc=_r[--xr],_r[xr]=null,jo=_r[--xr],_r[xr]=null,Ao=_r[--xr],_r[xr]=null}function bt(f,d){_r[xr++]=Ao,_r[xr++]=jo,_r[xr++]=vc,Ao=d.id,jo=d.overflow,vc=f}function Wt(f,d){I(Sc,d),I(M0,f),I(Bs,null),f=HA(d),x(Bs),I(Bs,f)}function un(){x(Bs),x(M0),x(Sc)}function nn(f){f.memoizedState!==null&&I(Tg,f);var d=Bs.current,b=UA(d,f.type);d!==b&&(I(M0,f),I(Bs,b))}function Zt(f){M0.current===f&&(x(Bs),x(M0)),Tg.current===f&&(x(Tg),bl?Gu._currentValue=af:Gu._currentValue2=af)}function Rn(f){var d=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ki(Ge(d,f)),ew}function Jn(f,d){if(!Js)throw Error(s(175));zC(f.stateNode,f.type,f.memoizedProps,d,f)||Rn(f,!0)}function Bi(f){for(Ls=f.return;Ls;)switch(Ls.tag){case 5:case 31:case 13:kr=!1;return;case 27:case 3:kr=!0;return;default:Ls=Ls.return}}function ai(f){if(!Js||f!==Ls)return!1;if(!Bn)return Bi(f),Bn=!0,!1;var d=f.tag;if(fs?d!==3&&d!==27&&(d!==5||Q9(f.type)&&!yg(f.type,f.memoizedProps))&&Di&&Rn(f):d!==3&&(d!==5||Q9(f.type)&&!yg(f.type,f.memoizedProps))&&Di&&Rn(f),Bi(f),d===13){if(!Js)throw Error(s(316));if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));Di=KC(f)}else if(d===31){if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));Di=WC(f)}else Di=fs&&d===27?MC(f.type,Di):Ls?Y9(f.stateNode):null;return!0}function Ai(){Js&&(Di=Ls=null,Bn=!1)}function Ks(){var f=_c;return f!==null&&(Ma===null?Ma=f:Ma.push.apply(Ma,f),_c=null),f}function Ki(f){_c===null?_c=[f]:_c.push(f)}function zt(f,d,b){bl?(I(Ag,d._currentValue),d._currentValue=b):(I(Ag,d._currentValue2),d._currentValue2=b)}function Yt(f){var d=Ag.current;bl?f._currentValue=d:f._currentValue2=d,x(Ag)}function ln(f,d,b){for(;f!==null;){var k=f.alternate;if((f.childLanes&d)!==d?(f.childLanes|=d,k!==null&&(k.childLanes|=d)):k!==null&&(k.childLanes&d)!==d&&(k.childLanes|=d),f===b)break;f=f.return}}function bn(f,d,b,k){var z=f.child;z!==null&&(z.return=f);for(;z!==null;){var J=z.dependencies;if(J!==null){var re=z.child;J=J.firstContext;e:for(;J!==null;){var De=J;J=z;for(var lt=0;lt<d.length;lt++)if(De.context===d[lt]){J.lanes|=b,De=J.alternate,De!==null&&(De.lanes|=b),ln(J.return,b,f),k||(re=null);break e}J=De.next}}else if(z.tag===18){if(re=z.return,re===null)throw Error(s(341));re.lanes|=b,J=re.alternate,J!==null&&(J.lanes|=b),ln(re,b,f),re=null}else re=z.child;if(re!==null)re.return=z;else for(re=z;re!==null;){if(re===f){re=null;break}if(z=re.sibling,z!==null){z.return=re.return,re=z;break}re=re.return}z=re}}function ri(f,d,b,k){f=null;for(var z=d,J=!1;z!==null;){if(!J){if((z.flags&524288)!==0)J=!0;else if((z.flags&262144)!==0)break}if(z.tag===10){var re=z.alternate;if(re===null)throw Error(s(387));if(re=re.memoizedProps,re!==null){var De=z.type;Za(z.pendingProps.value,re.value)||(f!==null?f.push(De):f=[De])}}else if(z===Tg.current){if(re=z.alternate,re===null)throw Error(s(387));re.memoizedState.memoizedState!==z.memoizedState.memoizedState&&(f!==null?f.push(Gu):f=[Gu])}z=z.return}f!==null&&bn(d,f,b,k),d.flags|=262144}function fn(f){for(f=f.firstContext;f!==null;){var d=f.context;if(!Za(bl?d._currentValue:d._currentValue2,f.memoizedValue))return!0;f=f.next}return!1}function Si(f){Vu=f,yl=null,f=f.dependencies,f!==null&&(f.firstContext=null)}function En(f){return pr(Vu,f)}function sa(f,d){return Vu===null&&Si(f),pr(f,d)}function pr(f,d){var b=bl?d._currentValue:d._currentValue2;if(d={context:d,memoizedValue:b,next:null},yl===null){if(f===null)throw Error(s(308));yl=d,f.dependencies={lanes:0,firstContext:d},f.flags|=524288}else yl=yl.next=d;return b}function bs(){return{controller:new _j,data:new Map,refCount:0}}function ws(f){f.refCount--,f.refCount===0&&xj(kj,function(){f.controller.abort()})}function aa(){}function Li(f){f!==df&&f.next===null&&(df===null?Cg=df=f:df=df.next=f),jg=!0,tw||(tw=!0,Wl())}function ys(f,d){if(!nw&&jg){nw=!0;do{var b=!1;for(var k=Cg;k!==null;){if(!d)if(f!==0){var z=k.pendingLanes;if(z===0)var J=0;else{var re=k.suspendedLanes,De=k.pingedLanes;J=(1<<31-Qa(42|f)+1)-1,J&=z&~(re&~De),J=J&201326741?J&201326741|1:J?J|2:0}J!==0&&(b=!0,mr(k,J))}else J=Fn,J=X(k,k===hi?J:0,k.cancelPendingCommit!==null||k.timeoutHandle!==zu),(J&3)===0||W(k,J)||(b=!0,mr(k,J));k=k.next}}while(b);nw=!1}}function Vr(){Xr()}function Xr(){jg=tw=!1;var f=0;Xu!==0&&QA()&&(f=Xu);for(var d=Da(),b=null,k=Cg;k!==null;){var z=k.next,J=zn(k,d);if(J===0)k.next=null,b===null?Cg=z:b.next=z,z===null&&(df=b);else if(b=k,f!==0||(J&3)!==0)jg=!0;k=z}ps!==0&&ps!==5||ys(f,!1),Xu!==0&&(Xu=0)}function zn(f,d){for(var{suspendedLanes:b,pingedLanes:k,expirationTimes:z}=f,J=f.pendingLanes&-62914561;0<J;){var re=31-Qa(J),De=1<<re,lt=z[re];if(lt===-1){if((De&b)===0||(De&k)!==0)z[re]=Y(De,d)}else lt<=d&&(f.expiredLanes|=De);J&=~De}if(d=hi,b=Fn,b=X(f,f===d?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==zu),k=f.callbackNode,b===0||f===d&&(ti===2||ti===9)||f.cancelPendingCommit!==null)return k!==null&&k!==null&&Y2(k),f.callbackNode=null,f.callbackPriority=0;if((b&3)===0||W(f,b)){if(d=b&-b,d===f.callbackPriority)return d;switch(k!==null&&Y2(k),Fe(b)){case 2:case 8:b=bj;break;case 32:b=Q2;break;case 268435456:b=wj;break;default:b=Q2}return k=ka.bind(null,f),b=xg(b,k),f.callbackPriority=d,f.callbackNode=b,d}return k!==null&&k!==null&&Y2(k),f.callbackPriority=2,f.callbackNode=null,2}function ka(f,d){if(ps!==0&&ps!==5)return f.callbackNode=null,f.callbackPriority=0,null;var b=f.callbackNode;if(gl()&&f.callbackNode!==b)return null;var k=Fn;if(k=X(f,f===hi?k:0,f.cancelPendingCommit!==null||f.timeoutHandle!==zu),k===0)return null;return A0(f,k,d),zn(f,Da()),f.callbackNode!=null&&f.callbackNode===b?ka.bind(null,f):null}function mr(f,d){if(gl())return null;A0(f,d,!0)}function Wl(){sC?aC(function(){(Dn&6)!==0?xg(l4,Vr):Xr()}):xg(l4,Vr)}function ho(){if(Xu===0){var f=pf;f===0&&(f=vg,vg<<=1,(vg&261888)===0&&(vg=256)),Xu=f}return Xu}function Kl(f,d){if(R0===null){var b=R0=[];iw=0,pf=ho(),mf={status:"pending",value:void 0,then:function(k){b.push(k)}}}return iw++,d.then(mo,mo),d}function mo(){if(--iw===0&&R0!==null){mf!==null&&(mf.status="fulfilled");var f=R0;R0=null,pf=0,mf=null;for(var d=0;d<f.length;d++)(0,f[d])()}}function Gt(f,d){var b=[],k={status:"pending",value:null,reason:null,then:function(z){b.push(z)}};return f.then(function(){k.status="fulfilled",k.value=d;for(var z=0;z<b.length;z++)(0,b[z])(d)},function(z){k.status="rejected",k.reason=z;for(z=0;z<b.length;z++)(0,b[z])(void 0)}),k}function Qt(){var f=Wu.current;return f!==null?f:hi.pooledCache}function Zn(f,d){d===null?I(Wu,Wu.current):I(Wu,d.pool)}function es(){var f=Qt();return f===null?null:{parent:bl?Ii._currentValue:Ii._currentValue2,pool:f}}function Dt(f,d){if(Za(f,d))return!0;if(typeof f!=="object"||f===null||typeof d!=="object"||d===null)return!1;var b=Object.keys(f),k=Object.keys(d);if(b.length!==k.length)return!1;for(k=0;k<b.length;k++){var z=b[k];if(!Sj.call(d,z)||!Za(f[z],d[z]))return!1}return!0}function Pt(f){return f=f.status,f==="fulfilled"||f==="rejected"}function Kt(f,d,b){switch(b=f[b],b===void 0?f.push(d):b!==d&&(d.then(aa,aa),d=b),d.status){case"fulfilled":return d.value;case"rejected":throw f=d.reason,gi(f),f;default:if(typeof d.status==="string")d.then(aa,aa);else{if(f=hi,f!==null&&100<f.shellSuspendCounter)throw Error(s(482));f=d,f.status="pending",f.then(function(k){if(d.status==="pending"){var z=d;z.status="fulfilled",z.value=k}},function(k){if(d.status==="pending"){var z=d;z.status="rejected",z.reason=k}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw f=d.reason,gi(f),f}throw Ku=d,gf}}function $t(f){try{var d=f._init;return d(f._payload)}catch(b){if(b!==null&&typeof b==="object"&&typeof b.then==="function")throw Ku=b,gf;throw b}}function Ci(){if(Ku===null)throw Error(s(459));var f=Ku;return Ku=null,f}function gi(f){if(f===gf||f===Eg)throw Error(s(483))}function gr(f){var d=O0;return O0+=1,bf===null&&(bf=[]),Kt(bf,f,d)}function tl(f,d){d=d.props.ref,f.ref=d!==void 0?d:null}function Mh(f,d){if(d.$$typeof===FA)throw Error(s(525));throw f=Object.prototype.toString.call(d),Error(s(31,f==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":f))}function Ld(f){function d(Ze,Ve){if(f){var ot=Ze.deletions;ot===null?(Ze.deletions=[Ve],Ze.flags|=16):ot.push(Ve)}}function b(Ze,Ve){if(!f)return null;for(;Ve!==null;)d(Ze,Ve),Ve=Ve.sibling;return null}function k(Ze){for(var Ve=new Map;Ze!==null;)Ze.key!==null?Ve.set(Ze.key,Ze):Ve.set(Ze.index,Ze),Ze=Ze.sibling;return Ve}function z(Ze,Ve){return Ze=it(Ze,Ve),Ze.index=0,Ze.sibling=null,Ze}function J(Ze,Ve,ot){if(Ze.index=ot,!f)return Ze.flags|=1048576,Ve;if(ot=Ze.alternate,ot!==null)return ot=ot.index,ot<Ve?(Ze.flags|=67108866,Ve):ot;return Ze.flags|=67108866,Ve}function re(Ze){return f&&Ze.alternate===null&&(Ze.flags|=67108866),Ze}function De(Ze,Ve,ot,Mt){if(Ve===null||Ve.tag!==6)return Ve=rn(ot,Ze.mode,Mt),Ve.return=Ze,Ve;return Ve=z(Ve,ot),Ve.return=Ze,Ve}function lt(Ze,Ve,ot,Mt){var an=ot.type;if(an===sf)return Nt(Ze,Ve,ot.props.children,Mt,ot.key);if(Ve!==null&&(Ve.elementType===an||typeof an==="object"&&an!==null&&an.$$typeof===yc&&$t(an)===Ve.type))return Ve=z(Ve,ot.props),tl(Ve,ot),Ve.return=Ze,Ve;return Ve=pt(ot.type,ot.key,ot.props,null,Ze.mode,Mt),tl(Ve,ot),Ve.return=Ze,Ve}function kt(Ze,Ve,ot,Mt){if(Ve===null||Ve.tag!==4||Ve.stateNode.containerInfo!==ot.containerInfo||Ve.stateNode.implementation!==ot.implementation)return Ve=Ps(ot,Ze.mode,Mt),Ve.return=Ze,Ve;return Ve=z(Ve,ot.children||[]),Ve.return=Ze,Ve}function Nt(Ze,Ve,ot,Mt,an){if(Ve===null||Ve.tag!==7)return Ve=Vt(ot,Ze.mode,Mt,an),Ve.return=Ze,Ve;return Ve=z(Ve,ot),Ve.return=Ze,Ve}function It(Ze,Ve,ot){if(typeof Ve==="string"&&Ve!==""||typeof Ve==="number"||typeof Ve==="bigint")return Ve=rn(""+Ve,Ze.mode,ot),Ve.return=Ze,Ve;if(typeof Ve==="object"&&Ve!==null){switch(Ve.$$typeof){case bg:return ot=pt(Ve.type,Ve.key,Ve.props,null,Ze.mode,ot),tl(ot,Ve),ot.return=Ze,ot;case nf:return Ve=Ps(Ve,Ze.mode,ot),Ve.return=Ze,Ve;case yc:return Ve=$t(Ve),It(Ze,Ve,ot)}if(wg(Ve)||m(Ve))return Ve=Vt(Ve,Ze.mode,ot,null),Ve.return=Ze,Ve;if(typeof Ve.then==="function")return It(Ze,gr(Ve),ot);if(Ve.$$typeof===wc)return It(Ze,sa(Ze,Ve),ot);Mh(Ze,Ve)}return null}function Ut(Ze,Ve,ot,Mt){var an=Ve!==null?Ve.key:null;if(typeof ot==="string"&&ot!==""||typeof ot==="number"||typeof ot==="bigint")return an!==null?null:De(Ze,Ve,""+ot,Mt);if(typeof ot==="object"&&ot!==null){switch(ot.$$typeof){case bg:return ot.key===an?lt(Ze,Ve,ot,Mt):null;case nf:return ot.key===an?kt(Ze,Ve,ot,Mt):null;case yc:return ot=$t(ot),Ut(Ze,Ve,ot,Mt)}if(wg(ot)||m(ot))return an!==null?null:Nt(Ze,Ve,ot,Mt,null);if(typeof ot.then==="function")return Ut(Ze,Ve,gr(ot),Mt);if(ot.$$typeof===wc)return Ut(Ze,Ve,sa(Ze,ot),Mt);Mh(Ze,ot)}return null}function kn(Ze,Ve,ot,Mt,an){if(typeof Mt==="string"&&Mt!==""||typeof Mt==="number"||typeof Mt==="bigint")return Ze=Ze.get(ot)||null,De(Ve,Ze,""+Mt,an);if(typeof Mt==="object"&&Mt!==null){switch(Mt.$$typeof){case bg:return Ze=Ze.get(Mt.key===null?ot:Mt.key)||null,lt(Ve,Ze,Mt,an);case nf:return Ze=Ze.get(Mt.key===null?ot:Mt.key)||null,kt(Ve,Ze,Mt,an);case yc:return Mt=$t(Mt),kn(Ze,Ve,ot,Mt,an)}if(wg(Mt)||m(Mt))return Ze=Ze.get(ot)||null,Nt(Ve,Ze,Mt,an,null);if(typeof Mt.then==="function")return kn(Ze,Ve,ot,gr(Mt),an);if(Mt.$$typeof===wc)return kn(Ze,Ve,ot,sa(Ve,Mt),an);Mh(Ve,Mt)}return null}function Hs(Ze,Ve,ot,Mt){for(var an=null,Mi=null,cn=Ve,Gn=Ve=0,As=null;cn!==null&&Gn<ot.length;Gn++){cn.index>Gn?(As=cn,cn=null):As=cn.sibling;var Vn=Ut(Ze,cn,ot[Gn],Mt);if(Vn===null){cn===null&&(cn=As);break}f&&cn&&Vn.alternate===null&&d(Ze,cn),Ve=J(Vn,Ve,Gn),Mi===null?an=Vn:Mi.sibling=Vn,Mi=Vn,cn=As}if(Gn===ot.length)return b(Ze,cn),Bn&&Qe(Ze,Gn),an;if(cn===null){for(;Gn<ot.length;Gn++)cn=It(Ze,ot[Gn],Mt),cn!==null&&(Ve=J(cn,Ve,Gn),Mi===null?an=cn:Mi.sibling=cn,Mi=cn);return Bn&&Qe(Ze,Gn),an}for(cn=k(cn);Gn<ot.length;Gn++)As=kn(cn,Ze,Gn,ot[Gn],Mt),As!==null&&(f&&As.alternate!==null&&cn.delete(As.key===null?Gn:As.key),Ve=J(As,Ve,Gn),Mi===null?an=As:Mi.sibling=As,Mi=As);return f&&cn.forEach(function(Ec){return d(Ze,Ec)}),Bn&&Qe(Ze,Gn),an}function U0(Ze,Ve,ot,Mt){if(ot==null)throw Error(s(151));for(var an=null,Mi=null,cn=Ve,Gn=Ve=0,As=null,Vn=ot.next();cn!==null&&!Vn.done;Gn++,Vn=ot.next()){cn.index>Gn?(As=cn,cn=null):As=cn.sibling;var Ec=Ut(Ze,cn,Vn.value,Mt);if(Ec===null){cn===null&&(cn=As);break}f&&cn&&Ec.alternate===null&&d(Ze,cn),Ve=J(Ec,Ve,Gn),Mi===null?an=Ec:Mi.sibling=Ec,Mi=Ec,cn=As}if(Vn.done)return b(Ze,cn),Bn&&Qe(Ze,Gn),an;if(cn===null){for(;!Vn.done;Gn++,Vn=ot.next())Vn=It(Ze,Vn.value,Mt),Vn!==null&&(Ve=J(Vn,Ve,Gn),Mi===null?an=Vn:Mi.sibling=Vn,Mi=Vn);return Bn&&Qe(Ze,Gn),an}for(cn=k(cn);!Vn.done;Gn++,Vn=ot.next())Vn=kn(cn,Ze,Gn,Vn.value,Mt),Vn!==null&&(f&&Vn.alternate!==null&&cn.delete(Vn.key===null?Gn:Vn.key),Ve=J(Vn,Ve,Gn),Mi===null?an=Vn:Mi.sibling=Vn,Mi=Vn);return f&&cn.forEach(function(jj){return d(Ze,jj)}),Bn&&Qe(Ze,Gn),an}function Ju(Ze,Ve,ot,Mt){if(typeof ot==="object"&&ot!==null&&ot.type===sf&&ot.key===null&&(ot=ot.props.children),typeof ot==="object"&&ot!==null){switch(ot.$$typeof){case bg:e:{for(var an=ot.key;Ve!==null;){if(Ve.key===an){if(an=ot.type,an===sf){if(Ve.tag===7){b(Ze,Ve.sibling),Mt=z(Ve,ot.props.children),Mt.return=Ze,Ze=Mt;break e}}else if(Ve.elementType===an||typeof an==="object"&&an!==null&&an.$$typeof===yc&&$t(an)===Ve.type){b(Ze,Ve.sibling),Mt=z(Ve,ot.props),tl(Mt,ot),Mt.return=Ze,Ze=Mt;break e}b(Ze,Ve);break}else d(Ze,Ve);Ve=Ve.sibling}ot.type===sf?(Mt=Vt(ot.props.children,Ze.mode,Mt,ot.key),Mt.return=Ze,Ze=Mt):(Mt=pt(ot.type,ot.key,ot.props,null,Ze.mode,Mt),tl(Mt,ot),Mt.return=Ze,Ze=Mt)}return re(Ze);case nf:e:{for(an=ot.key;Ve!==null;){if(Ve.key===an)if(Ve.tag===4&&Ve.stateNode.containerInfo===ot.containerInfo&&Ve.stateNode.implementation===ot.implementation){b(Ze,Ve.sibling),Mt=z(Ve,ot.children||[]),Mt.return=Ze,Ze=Mt;break e}else{b(Ze,Ve);break}else d(Ze,Ve);Ve=Ve.sibling}Mt=Ps(ot,Ze.mode,Mt),Mt.return=Ze,Ze=Mt}return re(Ze);case yc:return ot=$t(ot),Ju(Ze,Ve,ot,Mt)}if(wg(ot))return Hs(Ze,Ve,ot,Mt);if(m(ot)){if(an=m(ot),typeof an!=="function")throw Error(s(150));return ot=an.call(ot),U0(Ze,Ve,ot,Mt)}if(typeof ot.then==="function")return Ju(Ze,Ve,gr(ot),Mt);if(ot.$$typeof===wc)return Ju(Ze,Ve,sa(Ze,ot),Mt);Mh(Ze,ot)}return typeof ot==="string"&&ot!==""||typeof ot==="number"||typeof ot==="bigint"?(ot=""+ot,Ve!==null&&Ve.tag===6?(b(Ze,Ve.sibling),Mt=z(Ve,ot),Mt.return=Ze,Ze=Mt):(b(Ze,Ve),Mt=rn(ot,Ze.mode,Mt),Mt.return=Ze,Ze=Mt),re(Ze)):b(Ze,Ve)}return function(Ze,Ve,ot,Mt){try{O0=0;var an=Ju(Ze,Ve,ot,Mt);return bf=null,an}catch(cn){if(cn===gf||cn===Eg)throw cn;var Mi=n(29,cn,null,Ze.mode);return Mi.lanes=Mt,Mi.return=Ze,Mi}finally{}}}function $l(){for(var f=wf,d=aw=wf=0;d<f;){var b=Tr[d];Tr[d++]=null;var k=Tr[d];Tr[d++]=null;var z=Tr[d];Tr[d++]=null;var J=Tr[d];if(Tr[d++]=null,k!==null&&z!==null){var re=k.pending;re===null?z.next=z:(z.next=re.next,re.next=z),k.pending=z}J!==0&&gm(b,z,J)}}function nl(f,d,b,k){Tr[wf++]=f,Tr[wf++]=d,Tr[wf++]=b,Tr[wf++]=k,aw|=k,f.lanes|=k,f=f.alternate,f!==null&&(f.lanes|=k)}function vs(f,d,b,k){return nl(f,d,b,k),sl(f)}function il(f,d){return nl(f,null,null,d),sl(f)}function gm(f,d,b){f.lanes|=b;var k=f.alternate;k!==null&&(k.lanes|=b);for(var z=!1,J=f.return;J!==null;)J.childLanes|=b,k=J.alternate,k!==null&&(k.childLanes|=b),J.tag===22&&(f=J.stateNode,f===null||f._visibility&1||(z=!0)),f=J,J=J.return;return f.tag===3?(J=f.stateNode,z&&d!==null&&(z=31-Qa(b),f=J.hiddenUpdates,k=f[z],k===null?f[z]=[d]:k.push(d),d.lane=b|536870912),J):null}function sl(f){if(50<H0)throw H0=0,bw=null,Error(s(185));for(var d=f.return;d!==null;)f=d,d=f.return;return f.tag===3?f.stateNode:null}function Va(f){f.updateQueue={baseState:f.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yl(f,d){f=f.updateQueue,d.updateQueue===f&&(d.updateQueue={baseState:f.baseState,firstBaseUpdate:f.firstBaseUpdate,lastBaseUpdate:f.lastBaseUpdate,shared:f.shared,callbacks:null})}function On(f){return{lane:f,tag:0,payload:null,callback:null,next:null}}function go(f,d,b){var k=f.updateQueue;if(k===null)return null;if(k=k.shared,(Dn&2)!==0){var z=k.pending;return z===null?d.next=d:(d.next=z.next,z.next=d),k.pending=d,d=sl(f),gm(f,null,b),d}return nl(f,k,d,b),sl(f)}function bo(f,d,b){if(d=d.updateQueue,d!==null&&(d=d.shared,(b&4194048)!==0)){var k=d.lanes;k&=f.pendingLanes,b|=k,d.lanes=b,be(f,b)}}function Ql(f,d){var b=f.updateQueue,k=f.alternate;if(k!==null&&(k=k.updateQueue,b===k)){var z=null,J=null;if(b=b.firstBaseUpdate,b!==null){do{var re={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};J===null?z=J=re:J=J.next=re,b=b.next}while(b!==null);J===null?z=J=d:J=J.next=d}else z=J=d;b={baseState:k.baseState,firstBaseUpdate:z,lastBaseUpdate:J,shared:k.shared,callbacks:k.callbacks},f.updateQueue=b;return}f=b.lastBaseUpdate,f===null?b.firstBaseUpdate=d:f.next=d,b.lastBaseUpdate=d}function ou(){if(rw){var f=mf;if(f!==null)throw f}}function Xa(f,d,b,k){rw=!1;var z=f.updateQueue;xc=!1;var{firstBaseUpdate:J,lastBaseUpdate:re}=z,De=z.shared.pending;if(De!==null){z.shared.pending=null;var lt=De,kt=lt.next;lt.next=null,re===null?J=kt:re.next=kt,re=lt;var Nt=f.alternate;Nt!==null&&(Nt=Nt.updateQueue,De=Nt.lastBaseUpdate,De!==re&&(De===null?Nt.firstBaseUpdate=kt:De.next=kt,Nt.lastBaseUpdate=lt))}if(J!==null){var It=z.baseState;re=0,Nt=kt=lt=null,De=J;do{var Ut=De.lane&-536870913,kn=Ut!==De.lane;if(kn?(Fn&Ut)===Ut:(k&Ut)===Ut){Ut!==0&&Ut===pf&&(rw=!0),Nt!==null&&(Nt=Nt.next={lane:0,tag:De.tag,payload:De.payload,callback:null,next:null});e:{var Hs=f,U0=De;Ut=d;var Ju=b;switch(U0.tag){case 1:if(Hs=U0.payload,typeof Hs==="function"){It=Hs.call(Ju,It,Ut);break e}It=Hs;break e;case 3:Hs.flags=Hs.flags&-65537|128;case 0:if(Hs=U0.payload,Ut=typeof Hs==="function"?Hs.call(Ju,It,Ut):Hs,Ut===null||Ut===void 0)break e;It=ua({},It,Ut);break e;case 2:xc=!0}}Ut=De.callback,Ut!==null&&(f.flags|=64,kn&&(f.flags|=8192),kn=z.callbacks,kn===null?z.callbacks=[Ut]:kn.push(Ut))}else kn={lane:Ut,tag:De.tag,payload:De.payload,callback:De.callback,next:null},Nt===null?(kt=Nt=kn,lt=It):Nt=Nt.next=kn,re|=Ut;if(De=De.next,De===null)if(De=z.shared.pending,De===null)break;else kn=De,De=kn.next,kn.next=null,z.lastBaseUpdate=kn,z.shared.pending=null}while(1);Nt===null&&(lt=It),z.baseState=lt,z.firstBaseUpdate=kt,z.lastBaseUpdate=Nt,J===null&&(z.shared.lanes=0),Tc|=re,f.lanes=re,f.memoizedState=It}}function ui(f,d){if(typeof f!=="function")throw Error(s(191,f));f.call(d)}function Hd(f,d){var b=f.callbacks;if(b!==null)for(f.callbacks=null,f=0;f<b.length;f++)ui(b[f],d)}function lu(f,d){f=_l,I(Dg,f),I(yf,d),_l=f|d.baseLanes}function Ud(){I(Dg,_l),I(yf,yf.current)}function zd(){_l=Dg.current,x(yf),x(Dg)}function wo(f){var d=f.alternate;I(Ji,Ji.current&1),I(er,f),Ar===null&&(d===null||yf.current!==null?Ar=f:d.memoizedState!==null&&(Ar=f))}function Rh(f){I(Ji,Ji.current),I(er,f),Ar===null&&(Ar=f)}function Oh(f){f.tag===22?(I(Ji,Ji.current),I(er,f),Ar===null&&(Ar=f)):br(f)}function br(){I(Ji,Ji.current),I(er,er.current)}function $s(f){x(er),Ar===f&&(Ar=null),x(Ji)}function Fh(f){for(var d=f;d!==null;){if(d.tag===13){var b=d.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||X2(b)||W2(b)))return d}else if(d.tag===19&&(d.memoizedProps.revealOrder==="forwards"||d.memoizedProps.revealOrder==="backwards"||d.memoizedProps.revealOrder==="unstable_legacy-backwards"||d.memoizedProps.revealOrder==="together")){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}function _i(){throw Error(s(321))}function Jl(f,d){if(d===null)return!1;for(var b=0;b<d.length&&b<f.length;b++)if(!Za(f[b],d[b]))return!1;return!0}function Zl(f,d,b,k,z,J){return vl=J,An=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,sn.H=f===null||f.memoizedState===null?p4:ow,Yu=!1,J=b(k,z),Yu=!1,vf&&(J=ec(d,b,k,z)),Gd(f),J}function Gd(f){sn.H=N0;var d=oi!==null&&oi.next!==null;if(vl=0,ns=oi=An=null,Ig=!1,F0=0,Sf=null,d)throw Error(s(300));f===null||rs||(f=f.dependencies,f!==null&&fn(f)&&(rs=!0))}function ec(f,d,b,k){An=f;var z=0;do{if(vf&&(Sf=null),F0=0,vf=!1,25<=z)throw Error(s(301));if(z+=1,ns=oi=null,f.updateQueue!=null){var J=f.updateQueue;J.lastEffect=null,J.events=null,J.stores=null,J.memoCache!=null&&(J.memoCache.index=0)}sn.H=m4,J=d(b,k)}while(vf);return J}function cu(){var f=sn.H,d=f.useState()[0];return d=typeof d.then==="function"?Ta(d):d,f=f.useState()[0],(oi!==null?oi.memoizedState:null)!==f&&(An.flags|=1024),d}function al(){var f=Mg!==0;return Mg=0,f}function rl(f,d,b){d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~b}function Vd(f){if(Ig){for(f=f.memoizedState;f!==null;){var d=f.queue;d!==null&&(d.pending=null),f=f.next}Ig=!1}vl=0,ns=oi=An=null,vf=!1,F0=Mg=0,Sf=null}function Ss(){var f={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ns===null?An.memoizedState=ns=f:ns=ns.next=f,ns}function Ei(){if(oi===null){var f=An.alternate;f=f!==null?f.memoizedState:null}else f=oi.next;var d=ns===null?An.memoizedState:ns.next;if(d!==null)ns=d,oi=f;else{if(f===null){if(An.alternate===null)throw Error(s(467));throw Error(s(310))}oi=f,f={memoizedState:oi.memoizedState,baseState:oi.baseState,baseQueue:oi.baseQueue,queue:oi.queue,next:null},ns===null?An.memoizedState=ns=f:ns=ns.next=f}return ns}function Nh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ta(f){var d=F0;return F0+=1,Sf===null&&(Sf=[]),f=Kt(Sf,f,d),d=An,(ns===null?d.memoizedState:ns.next)===null&&(d=d.alternate,sn.H=d===null||d.memoizedState===null?p4:ow),f}function ll(f){if(f!==null&&typeof f==="object"){if(typeof f.then==="function")return Ta(f);if(f.$$typeof===wc)return En(f)}throw Error(s(438,String(f)))}function Xd(f){var d=null,b=An.updateQueue;if(b!==null&&(d=b.memoCache),d==null){var k=An.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(d={data:k.data.map(function(z){return z.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),b===null&&(b=Nh(),An.updateQueue=b),b.memoCache=d,b=d.data[d.index],b===void 0)for(b=d.data[d.index]=Array(f),k=0;k<f;k++)b[k]=NA;return d.index++,b}function Ka(f,d){return typeof d==="function"?d(f):d}function tc(f){var d=Ei();return oa(d,oi,f)}function oa(f,d,b){var k=f.queue;if(k===null)throw Error(s(311));k.lastRenderedReducer=b;var z=f.baseQueue,J=k.pending;if(J!==null){if(z!==null){var re=z.next;z.next=J.next,J.next=re}d.baseQueue=z=J,k.pending=null}if(J=f.baseState,z===null)f.memoizedState=J;else{d=z.next;var De=re=null,lt=null,kt=d,Nt=!1;do{var It=kt.lane&-536870913;if(It!==kt.lane?(Fn&It)===It:(vl&It)===It){var Ut=kt.revertLane;if(Ut===0)lt!==null&&(lt=lt.next={lane:0,revertLane:0,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null}),It===pf&&(Nt=!0);else if((vl&Ut)===Ut){kt=kt.next,Ut===pf&&(Nt=!0);continue}else It={lane:0,revertLane:kt.revertLane,gesture:null,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},lt===null?(De=lt=It,re=J):lt=lt.next=It,An.lanes|=Ut,Tc|=Ut;It=kt.action,Yu&&b(J,It),J=kt.hasEagerState?kt.eagerState:b(J,It)}else Ut={lane:It,revertLane:kt.revertLane,gesture:kt.gesture,action:kt.action,hasEagerState:kt.hasEagerState,eagerState:kt.eagerState,next:null},lt===null?(De=lt=Ut,re=J):lt=lt.next=Ut,An.lanes|=It,Tc|=It;kt=kt.next}while(kt!==null&&kt!==d);if(lt===null?re=J:lt.next=De,!Za(J,f.memoizedState)&&(rs=!0,Nt&&(b=mf,b!==null)))throw b;f.memoizedState=J,f.baseState=re,f.baseQueue=lt,k.lastRenderedState=J}return z===null&&(k.lanes=0),[f.memoizedState,k.dispatch]}function Wd(f){var d=Ei(),b=d.queue;if(b===null)throw Error(s(311));b.lastRenderedReducer=f;var{dispatch:k,pending:z}=b,J=d.memoizedState;if(z!==null){b.pending=null;var re=z=z.next;do J=f(J,re.action),re=re.next;while(re!==z);Za(J,d.memoizedState)||(rs=!0),d.memoizedState=J,d.baseQueue===null&&(d.baseState=J),b.lastRenderedState=J}return[J,k]}function uu(f,d,b){var k=An,z=Ei(),J=Bn;if(J){if(b===void 0)throw Error(s(407));b=b()}else b=d();var re=!Za((oi||z).memoizedState,b);if(re&&(z.memoizedState=b,rs=!0),z=z.queue,Lh(cl.bind(null,k,z,f),[f]),z.getSnapshot!==d||re||ns!==null&&ns.memoizedState.tag&1){if(k.flags|=2048,ic(9,{destroy:void 0},hu.bind(null,k,z,b,d),null),hi===null)throw Error(s(349));J||(vl&127)!==0||nc(k,d,b)}return b}function nc(f,d,b){f.flags|=16384,f={getSnapshot:d,value:b},d=An.updateQueue,d===null?(d=Nh(),An.updateQueue=d,d.stores=[f]):(b=d.stores,b===null?d.stores=[f]:b.push(f))}function hu(f,d,b,k){d.value=b,d.getSnapshot=k,Ph(d)&&Kd(f)}function cl(f,d,b){return b(function(){Ph(d)&&Kd(f)})}function Ph(f){var d=f.getSnapshot;f=f.value;try{var b=d();return!Za(f,b)}catch(k){return!0}}function Kd(f){var d=il(f,2);d!==null&&xs(d,f,2)}function du(f){var d=Ss();if(typeof f==="function"){var b=f;if(f=b(),Yu){Ue(!0);try{b()}finally{Ue(!1)}}}return d.memoizedState=d.baseState=f,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:f},d}function bm(f,d,b,k){return f.baseState=b,oa(f,oi,typeof k==="function"?k:Ka)}function I2(f,d,b,k,z){if(ul(f))throw Error(s(485));if(f=d.action,f!==null){var J={payload:z,action:f,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(re){J.listeners.push(re)}};sn.T!==null?b(!0):J.isTransition=!1,k(J),b=d.pending,b===null?(J.next=d.pending=J,wm(d,J)):(J.next=b.next,d.pending=b.next=J)}}function wm(f,d){var{action:b,payload:k}=d,z=f.state;if(d.isTransition){var J=sn.T,re={};sn.T=re;try{var De=b(z,k),lt=sn.S;lt!==null&<(re,De),pu(f,d,De)}catch(kt){Yd(f,d,kt)}finally{J!==null&&re.types!==null&&(J.types=re.types),sn.T=J}}else try{J=b(z,k),pu(f,d,J)}catch(kt){Yd(f,d,kt)}}function pu(f,d,b){b!==null&&typeof b==="object"&&typeof b.then==="function"?b.then(function(k){$d(f,d,k)},function(k){return Yd(f,d,k)}):$d(f,d,b)}function $d(f,d,b){d.status="fulfilled",d.value=b,Qd(d),f.state=b,d=f.pending,d!==null&&(b=d.next,b===d?f.pending=null:(b=b.next,d.next=b,wm(f,b)))}function Yd(f,d,b){var k=f.pending;if(f.pending=null,k!==null){k=k.next;do d.status="rejected",d.reason=b,Qd(d),d=d.next;while(d!==k)}f.action=null}function Qd(f){f=f.listeners;for(var d=0;d<f.length;d++)(0,f[d])()}function ym(f,d){return d}function Jd(f,d){if(Bn){var b=hi.formState;if(b!==null){e:{var k=An;if(Bn){if(Di){var z=qC(Di,kr);if(z){Di=Y9(z),k=DC(z);break e}}Rn(k)}k=!1}k&&(d=b[0])}}b=Ss(),b.memoizedState=b.baseState=d,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ym,lastRenderedState:d},b.queue=k,b=Tu.bind(null,An,k),k.dispatch=b,k=du(!1);var J=$a.bind(null,An,!1,k.queue);return k=Ss(),z={state:d,dispatch:null,action:f,pending:null},k.queue=z,b=I2.bind(null,An,z,J,b),z.dispatch=b,k.memoizedState=f,[d,b,!1]}function vm(f){var d=Ei();return mu(d,oi,f)}function mu(f,d,b){if(d=oa(f,d,ym)[0],f=tc(Ka)[0],typeof d==="object"&&d!==null&&typeof d.then==="function")try{var k=Ta(d)}catch(re){if(re===gf)throw Eg;throw re}else k=d;d=Ei();var z=d.queue,J=z.dispatch;return b!==d.memoizedState&&(An.flags|=2048,ic(9,{destroy:void 0},gu.bind(null,z,b),null)),[k,J,f]}function gu(f,d){f.action=d}function Zd(f){var d=Ei(),b=oi;if(b!==null)return mu(d,b,f);Ei(),d=d.memoizedState,b=Ei();var k=b.queue.dispatch;return b.memoizedState=f,[d,k,!1]}function ic(f,d,b,k){return f={tag:f,create:b,deps:k,inst:d,next:null},d=An.updateQueue,d===null&&(d=Nh(),An.updateQueue=d),b=d.lastEffect,b===null?d.lastEffect=f.next=f:(k=b.next,b.next=f,f.next=k,d.lastEffect=f),f}function Sm(){return Ei().memoizedState}function wu(f,d,b,k){var z=Ss();An.flags|=f,z.memoizedState=ic(1|d,{destroy:void 0},b,k===void 0?null:k)}function yu(f,d,b,k){var z=Ei();k=k===void 0?null:k;var J=z.memoizedState.inst;oi!==null&&k!==null&&Jl(k,oi.memoizedState.deps)?z.memoizedState=ic(d,J,b,k):(An.flags|=f,z.memoizedState=ic(1|d,J,b,k))}function _m(f,d){wu(8390656,8,f,d)}function Lh(f,d){yu(2048,8,f,d)}function M2(f){An.flags|=4;var d=An.updateQueue;if(d===null)d=Nh(),An.updateQueue=d,d.events=[f];else{var b=d.events;b===null?d.events=[f]:b.push(f)}}function xm(f){var d=Ei().memoizedState;return M2({ref:d,nextImpl:f}),function(){if((Dn&2)!==0)throw Error(s(440));return d.impl.apply(void 0,arguments)}}function km(f,d){return yu(4,2,f,d)}function Am(f,d){return yu(4,4,f,d)}function Cm(f,d){if(typeof d==="function"){f=f();var b=d(f);return function(){typeof b==="function"?b():d(null)}}if(d!==null&&d!==void 0)return f=f(),d.current=f,function(){d.current=null}}function jm(f,d,b){b=b!==null&&b!==void 0?b.concat([f]):null,yu(4,4,Cm.bind(null,d,f),b)}function Su(){}function Em(f,d){var b=Ei();d=d===void 0?null:d;var k=b.memoizedState;if(d!==null&&Jl(d,k[1]))return k[0];return b.memoizedState=[f,d],f}function e0(f,d){var b=Ei();d=d===void 0?null:d;var k=b.memoizedState;if(d!==null&&Jl(d,k[1]))return k[0];if(k=f(),Yu){Ue(!0);try{f()}finally{Ue(!1)}}return b.memoizedState=[k,d],k}function sc(f,d,b){if(b===void 0||(vl&1073741824)!==0&&(Fn&261930)===0)return f.memoizedState=d;return f.memoizedState=b,f=T0(),An.lanes|=f,Tc|=f,b}function qm(f,d,b,k){if(Za(b,d))return b;if(yf.current!==null)return f=sc(f,b,k),Za(f,d)||(rs=!0),f;if((vl&42)===0||(vl&1073741824)!==0&&(Fn&261930)===0)return rs=!0,f.memoizedState=b;return f=T0(),An.lanes|=f,Tc|=f,d}function Dm(f,d,b,k,z){var J=wl();ks(J!==0&&8>J?J:8);var re=sn.T,De={};sn.T=De,$a(f,!1,d,b);try{var lt=z(),kt=sn.S;if(kt!==null&&kt(De,lt),lt!==null&&typeof lt==="object"&&typeof lt.then==="function"){var Nt=Gt(lt,k);Fs(f,d,Nt,qa(f))}else Fs(f,d,k,qa(f))}catch(It){Fs(f,d,{then:function(){},status:"rejected",reason:It},qa())}finally{ks(J),re!==null&&De.types!==null&&(re.types=De.types),sn.T=re}}function Im(f){var d=f.memoizedState;if(d!==null)return d;d={memoizedState:af,baseState:af,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:af},next:null};var b={};return d.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:b},next:null},f.memoizedState=d,f=f.alternate,f!==null&&(f.memoizedState=d),d}function t0(){return En(Gu)}function Rm(){return Ei().memoizedState}function _u(){return Ei().memoizedState}function xu(f){for(var d=f.return;d!==null;){switch(d.tag){case 24:case 3:var b=qa();f=On(b);var k=go(d,f,b);k!==null&&(xs(k,d,b),bo(k,d,b)),d={cache:bs()},f.payload=d;return}d=d.return}}function ku(f,d,b){var k=qa();b={lane:k,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},ul(f)?n0(d,b):(b=vs(f,d,b,k),b!==null&&(xs(b,f,k),Om(b,d,k)))}function Tu(f,d,b){var k=qa();Fs(f,d,b,k)}function Fs(f,d,b,k){var z={lane:k,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(ul(f))n0(d,z);else{var J=f.alternate;if(f.lanes===0&&(J===null||J.lanes===0)&&(J=d.lastRenderedReducer,J!==null))try{var re=d.lastRenderedState,De=J(re,b);if(z.hasEagerState=!0,z.eagerState=De,Za(De,re))return nl(f,d,z,0),hi===null&&$l(),!1}catch(lt){}finally{}if(b=vs(f,d,z,k),b!==null)return xs(b,f,k),Om(b,d,k),!0}return!1}function $a(f,d,b,k){if(k={lane:2,revertLane:ho(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},ul(f)){if(d)throw Error(s(479))}else d=vs(f,b,k,2),d!==null&&xs(d,f,2)}function ul(f){var d=f.alternate;return f===An||d!==null&&d===An}function n0(f,d){vf=Ig=!0;var b=f.pending;b===null?d.next=d:(d.next=b.next,b.next=d),f.pending=d}function Om(f,d,b){if((b&4194048)!==0){var k=d.lanes;k&=f.pendingLanes,b|=k,d.lanes=b,be(f,b)}}function i0(f,d,b,k){d=f.memoizedState,b=b(k,d),b=b===null||b===void 0?d:ua({},d,b),f.memoizedState=b,f.lanes===0&&(f.updateQueue.baseState=b)}function Fm(f,d,b,k,z,J,re){return f=f.stateNode,typeof f.shouldComponentUpdate==="function"?f.shouldComponentUpdate(k,J,re):d.prototype&&d.prototype.isPureReactComponent?!Dt(b,k)||!Dt(z,J):!0}function Nm(f,d,b,k){f=d.state,typeof d.componentWillReceiveProps==="function"&&d.componentWillReceiveProps(b,k),typeof d.UNSAFE_componentWillReceiveProps==="function"&&d.UNSAFE_componentWillReceiveProps(b,k),d.state!==f&&lw.enqueueReplaceState(d,d.state,null)}function Kr(f,d){var b=d;if("ref"in d){b={};for(var k in d)k!=="ref"&&(b[k]=d[k])}if(f=f.defaultProps){b===d&&(b=ua({},b));for(var z in f)b[z]===void 0&&(b[z]=f[z])}return b}function ac(f,d){try{var b=f.onUncaughtError;b(d.value,{componentStack:d.stack})}catch(k){setTimeout(function(){throw k})}}function oc(f,d,b){try{var k=f.onCaughtError;k(b.value,{componentStack:b.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(z){setTimeout(function(){throw z})}}function yo(f,d,b){return b=On(b),b.tag=3,b.payload={element:null},b.callback=function(){ac(f,d)},b}function Au(f){return f=On(f),f.tag=3,f}function vo(f,d,b,k){var z=b.type.getDerivedStateFromError;if(typeof z==="function"){var J=k.value;f.payload=function(){return z(J)},f.callback=function(){oc(d,b,k)}}var re=b.stateNode;re!==null&&typeof re.componentDidCatch==="function"&&(f.callback=function(){oc(d,b,k),typeof z!=="function"&&(Ac===null?Ac=new Set([this]):Ac.add(this));var De=k.stack;this.componentDidCatch(k.value,{componentStack:De!==null?De:""})})}function R2(f,d,b,k,z){if(b.flags|=32768,k!==null&&typeof k==="object"&&typeof k.then==="function"){if(d=b.alternate,d!==null&&ri(d,b,z,!0),b=er.current,b!==null){switch(b.tag){case 31:case 13:return Ar===null?Bu():b.alternate===null&&zi===0&&(zi=3),b.flags&=-257,b.flags|=65536,b.lanes=z,k===qg?b.flags|=16384:(d=b.updateQueue,d===null?b.updateQueue=new Set([k]):d.add(k),P(f,k,z)),!1;case 22:return b.flags|=65536,k===qg?b.flags|=16384:(d=b.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([k])},b.updateQueue=d):(b=d.retryQueue,b===null?d.retryQueue=new Set([k]):b.add(k)),P(f,k,z)),!1}throw Error(s(435,b.tag))}return P(f,k,z),Bu(),!1}if(Bn)return d=er.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=z,k!==ew&&(f=Error(s(422),{cause:k}),Ki(Ge(f,b)))):(k!==ew&&(d=Error(s(423),{cause:k}),Ki(Ge(d,b))),f=f.current.alternate,f.flags|=65536,z&=-z,f.lanes|=z,k=Ge(k,b),z=yo(f.stateNode,k,z),Ql(f,z),zi!==4&&(zi=2)),!1;var J=Error(s(520),{cause:k});if(J=Ge(J,b),B0===null?B0=[J]:B0.push(J),zi!==4&&(zi=2),d===null)return!0;k=Ge(k,b),b=d;do{switch(b.tag){case 3:return b.flags|=65536,f=z&-z,b.lanes|=f,f=yo(b.stateNode,k,f),Ql(b,f),!1;case 1:if(d=b.type,J=b.stateNode,(b.flags&128)===0&&(typeof d.getDerivedStateFromError==="function"||J!==null&&typeof J.componentDidCatch==="function"&&(Ac===null||!Ac.has(J))))return b.flags|=65536,z&=-z,b.lanes|=z,z=Au(z),vo(z,f,b,k),Ql(b,z),!1}b=b.return}while(b!==null);return!1}function ts(f,d,b,k){d.child=f===null?d4(d,null,b,k):$u(d,f.child,b,k)}function s0(f,d,b,k,z){b=b.render;var J=d.ref;if("ref"in k){var re={};for(var De in k)De!=="ref"&&(re[De]=k[De])}else re=k;if(Si(d),k=Zl(f,d,b,re,J,z),De=al(),f!==null&&!rs)return rl(f,d,z),wr(f,d,z);return Bn&&De&&ut(d),d.flags|=1,ts(f,d,k,z),d.child}function Hh(f,d,b,k,z){if(f===null){var J=b.type;if(typeof J==="function"&&!Be(J)&&J.defaultProps===void 0&&b.compare===null)return d.tag=15,d.type=J,Pm(f,d,J,k,z);return f=pt(b.type,null,k,d,d.mode,z),f.ref=d.ref,f.return=d,d.child=f}if(J=f.child,!h0(f,z)){var re=J.memoizedProps;if(b=b.compare,b=b!==null?b:Dt,b(re,k)&&f.ref===d.ref)return wr(f,d,z)}return d.flags|=1,f=it(J,k),f.ref=d.ref,f.return=d,d.child=f}function Pm(f,d,b,k,z){if(f!==null){var J=f.memoizedProps;if(Dt(J,k)&&f.ref===d.ref)if(rs=!1,d.pendingProps=k=J,h0(f,z))(f.flags&131072)!==0&&(rs=!0);else return d.lanes=f.lanes,wr(f,d,z)}return Vh(f,d,b,k,z)}function Bm(f,d,b,k){var z=k.children,J=f!==null?f.memoizedState:null;if(f===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((d.flags&128)!==0){if(J=J!==null?J.baseLanes|b:b,f!==null){k=d.child=f.child;for(z=0;k!==null;)z=z|k.lanes|k.childLanes,k=k.sibling;k=z&~J}else k=0,d.child=null;return ju(f,d,J,b,k)}if((b&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},f!==null&&Zn(d,J!==null?J.cachePool:null),J!==null?lu(d,J):Ud(),Oh(d);else return k=d.lanes=536870912,ju(f,d,J!==null?J.baseLanes|b:b,b,k)}else J!==null?(Zn(d,J.cachePool),lu(d,J),br(d),d.memoizedState=null):(f!==null&&Zn(d,null),Ud(),br(d));return ts(f,d,z,b),d.child}function Cu(f,d){return f!==null&&f.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function ju(f,d,b,k,z){var J=Qt();return J=J===null?null:{parent:bl?Ii._currentValue:Ii._currentValue2,pool:J},d.memoizedState={baseLanes:b,cachePool:J},f!==null&&Zn(d,null),Ud(),Oh(d),f!==null&&ri(f,d,k,!0),d.childLanes=z,null}function Uh(f,d){return d=Iu({mode:d.mode,children:d.children},f.mode),d.ref=f.ref,f.child=d,d.return=f,d}function zh(f,d,b){return $u(d,f.child,null,b),f=Uh(d,d.pendingProps),f.flags|=2,$s(d),d.memoizedState=null,f}function O2(f,d,b){var k=d.pendingProps,z=(d.flags&128)!==0;if(d.flags&=-129,f===null){if(Bn){if(k.mode==="hidden")return f=Uh(d,k),d.lanes=536870912,Cu(null,f);if(Rh(d),(f=Di)?(f=HC(f,kr),f!==null&&(d.memoizedState={dehydrated:f,treeContext:vc!==null?{id:Ao,overflow:jo}:null,retryLane:536870912,hydrationErrors:null},b=Qi(f),b.return=d,d.child=b,Ls=d,Di=null)):f=null,f===null)throw Rn(d);return d.lanes=536870912,null}return Uh(d,k)}var J=f.memoizedState;if(J!==null){var re=J.dehydrated;if(Rh(d),z)if(d.flags&256)d.flags&=-257,d=zh(f,d,b);else if(d.memoizedState!==null)d.child=f.child,d.flags|=128,d=null;else throw Error(s(558));else if(rs||ri(f,d,b,!1),z=(b&f.childLanes)!==0,rs||z){if(k=hi,k!==null&&(re=xe(k,b),re!==0&&re!==J.retryLane))throw J.retryLane=re,il(f,re),xs(k,f,re),cw;Bu(),d=zh(f,d,b)}else f=J.treeContext,Js&&(Di=FC(re),Ls=d,Bn=!0,_c=null,kr=!1,f!==null&&bt(d,f)),d=Uh(d,k),d.flags|=4096;return d}return f=it(f.child,{mode:k.mode,children:k.children}),f.ref=d.ref,d.child=f,f.return=d,f}function Gh(f,d){var b=d.ref;if(b===null)f!==null&&f.ref!==null&&(d.flags|=4194816);else{if(typeof b!=="function"&&typeof b!=="object")throw Error(s(284));if(f===null||f.ref!==b)d.flags|=4194816}}function Vh(f,d,b,k,z){if(Si(d),b=Zl(f,d,b,k,void 0,z),k=al(),f!==null&&!rs)return rl(f,d,z),wr(f,d,z);return Bn&&k&&ut(d),d.flags|=1,ts(f,d,b,z),d.child}function Eu(f,d,b,k,z,J){if(Si(d),d.updateQueue=null,b=ec(d,k,b,z),Gd(f),k=al(),f!==null&&!rs)return rl(f,d,J),wr(f,d,J);return Bn&&k&&ut(d),d.flags|=1,ts(f,d,b,J),d.child}function Lm(f,d,b,k,z){if(Si(d),d.stateNode===null){var J=cf,re=b.contextType;typeof re==="object"&&re!==null&&(J=En(re)),J=new b(k,J),d.memoizedState=J.state!==null&&J.state!==void 0?J.state:null,J.updater=lw,d.stateNode=J,J._reactInternals=d,J=d.stateNode,J.props=k,J.state=d.memoizedState,J.refs={},Va(d),re=b.contextType,J.context=typeof re==="object"&&re!==null?En(re):cf,J.state=d.memoizedState,re=b.getDerivedStateFromProps,typeof re==="function"&&(i0(d,b,re,k),J.state=d.memoizedState),typeof b.getDerivedStateFromProps==="function"||typeof J.getSnapshotBeforeUpdate==="function"||typeof J.UNSAFE_componentWillMount!=="function"&&typeof J.componentWillMount!=="function"||(re=J.state,typeof J.componentWillMount==="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount==="function"&&J.UNSAFE_componentWillMount(),re!==J.state&&lw.enqueueReplaceState(J,J.state,null),Xa(d,k,J,z),ou(),J.state=d.memoizedState),typeof J.componentDidMount==="function"&&(d.flags|=4194308),k=!0}else if(f===null){J=d.stateNode;var De=d.memoizedProps,lt=Kr(b,De);J.props=lt;var kt=J.context,Nt=b.contextType;re=cf,typeof Nt==="object"&&Nt!==null&&(re=En(Nt));var It=b.getDerivedStateFromProps;Nt=typeof It==="function"||typeof J.getSnapshotBeforeUpdate==="function",De=d.pendingProps!==De,Nt||typeof J.UNSAFE_componentWillReceiveProps!=="function"&&typeof J.componentWillReceiveProps!=="function"||(De||kt!==re)&&Nm(d,J,k,re),xc=!1;var Ut=d.memoizedState;J.state=Ut,Xa(d,k,J,z),ou(),kt=d.memoizedState,De||Ut!==kt||xc?(typeof It==="function"&&(i0(d,b,It,k),kt=d.memoizedState),(lt=xc||Fm(d,b,lt,k,Ut,kt,re))?(Nt||typeof J.UNSAFE_componentWillMount!=="function"&&typeof J.componentWillMount!=="function"||(typeof J.componentWillMount==="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount==="function"&&J.UNSAFE_componentWillMount()),typeof J.componentDidMount==="function"&&(d.flags|=4194308)):(typeof J.componentDidMount==="function"&&(d.flags|=4194308),d.memoizedProps=k,d.memoizedState=kt),J.props=k,J.state=kt,J.context=re,k=lt):(typeof J.componentDidMount==="function"&&(d.flags|=4194308),k=!1)}else{J=d.stateNode,Yl(f,d),re=d.memoizedProps,Nt=Kr(b,re),J.props=Nt,It=d.pendingProps,Ut=J.context,kt=b.contextType,lt=cf,typeof kt==="object"&&kt!==null&&(lt=En(kt)),De=b.getDerivedStateFromProps,(kt=typeof De==="function"||typeof J.getSnapshotBeforeUpdate==="function")||typeof J.UNSAFE_componentWillReceiveProps!=="function"&&typeof J.componentWillReceiveProps!=="function"||(re!==It||Ut!==lt)&&Nm(d,J,k,lt),xc=!1,Ut=d.memoizedState,J.state=Ut,Xa(d,k,J,z),ou();var kn=d.memoizedState;re!==It||Ut!==kn||xc||f!==null&&f.dependencies!==null&&fn(f.dependencies)?(typeof De==="function"&&(i0(d,b,De,k),kn=d.memoizedState),(Nt=xc||Fm(d,b,Nt,k,Ut,kn,lt)||f!==null&&f.dependencies!==null&&fn(f.dependencies))?(kt||typeof J.UNSAFE_componentWillUpdate!=="function"&&typeof J.componentWillUpdate!=="function"||(typeof J.componentWillUpdate==="function"&&J.componentWillUpdate(k,kn,lt),typeof J.UNSAFE_componentWillUpdate==="function"&&J.UNSAFE_componentWillUpdate(k,kn,lt)),typeof J.componentDidUpdate==="function"&&(d.flags|=4),typeof J.getSnapshotBeforeUpdate==="function"&&(d.flags|=1024)):(typeof J.componentDidUpdate!=="function"||re===f.memoizedProps&&Ut===f.memoizedState||(d.flags|=4),typeof J.getSnapshotBeforeUpdate!=="function"||re===f.memoizedProps&&Ut===f.memoizedState||(d.flags|=1024),d.memoizedProps=k,d.memoizedState=kn),J.props=k,J.state=kn,J.context=lt,k=Nt):(typeof J.componentDidUpdate!=="function"||re===f.memoizedProps&&Ut===f.memoizedState||(d.flags|=4),typeof J.getSnapshotBeforeUpdate!=="function"||re===f.memoizedProps&&Ut===f.memoizedState||(d.flags|=1024),k=!1)}return J=k,Gh(f,d),k=(d.flags&128)!==0,J||k?(J=d.stateNode,b=k&&typeof b.getDerivedStateFromError!=="function"?null:J.render(),d.flags|=1,f!==null&&k?(d.child=$u(d,f.child,null,z),d.child=$u(d,null,b,z)):ts(f,d,b,z),d.memoizedState=J.state,f=d.child):f=wr(f,d,z),f}function Hm(f,d,b,k){return Ai(),d.flags|=256,ts(f,d,b,k),d.child}function r0(f){return{baseLanes:f,cachePool:es()}}function qu(f,d,b){return f=f!==null?f.childLanes&~b:0,d&&(f|=nr),f}function Um(f,d,b){var k=d.pendingProps,z=!1,J=(d.flags&128)!==0,re;if((re=J)||(re=f!==null&&f.memoizedState===null?!1:(Ji.current&2)!==0),re&&(z=!0,d.flags&=-129),re=(d.flags&32)!==0,d.flags&=-33,f===null){if(Bn){if(z?wo(d):br(d),(f=Di)?(f=UC(f,kr),f!==null&&(d.memoizedState={dehydrated:f,treeContext:vc!==null?{id:Ao,overflow:jo}:null,retryLane:536870912,hydrationErrors:null},b=Qi(f),b.return=d,d.child=b,Ls=d,Di=null)):f=null,f===null)throw Rn(d);return W2(f)?d.lanes=32:d.lanes=536870912,null}var De=k.children;if(k=k.fallback,z)return br(d),z=d.mode,De=Iu({mode:"hidden",children:De},z),k=Vt(k,z,b,null),De.return=d,k.return=d,De.sibling=k,d.child=De,k=d.child,k.memoizedState=r0(b),k.childLanes=qu(f,re,b),d.memoizedState=uw,Cu(null,k);return wo(d),Du(d,De)}var lt=f.memoizedState;if(lt!==null&&(De=lt.dehydrated,De!==null)){if(J)d.flags&256?(wo(d),d.flags&=-257,d=o0(f,d,b)):d.memoizedState!==null?(br(d),d.child=f.child,d.flags|=128,d=null):(br(d),De=k.fallback,z=d.mode,k=Iu({mode:"visible",children:k.children},z),De=Vt(De,z,b,null),De.flags|=2,k.return=d,De.return=d,k.sibling=De,d.child=k,$u(d,f.child,null,b),k=d.child,k.memoizedState=r0(b),k.childLanes=qu(f,re,b),d.memoizedState=uw,d=Cu(null,k));else if(wo(d),W2(De))re=jC(De).digest,k=Error(s(419)),k.stack="",k.digest=re,Ki({value:k,source:null,stack:null}),d=o0(f,d,b);else if(rs||ri(f,d,b,!1),re=(b&f.childLanes)!==0,rs||re){if(re=hi,re!==null&&(k=xe(re,b),k!==0&&k!==lt.retryLane))throw lt.retryLane=k,il(f,k),xs(re,f,k),cw;X2(De)||Bu(),d=o0(f,d,b)}else X2(De)?(d.flags|=192,d.child=f.child,d=null):(f=lt.treeContext,Js&&(Di=NC(De),Ls=d,Bn=!0,_c=null,kr=!1,f!==null&&bt(d,f)),d=Du(d,k.children),d.flags|=4096);return d}if(z)return br(d),De=k.fallback,z=d.mode,lt=f.child,J=lt.sibling,k=it(lt,{mode:"hidden",children:k.children}),k.subtreeFlags=lt.subtreeFlags&65011712,J!==null?De=it(J,De):(De=Vt(De,z,b,null),De.flags|=2),De.return=d,k.return=d,k.sibling=De,d.child=k,Cu(null,k),k=d.child,De=f.child.memoizedState,De===null?De=r0(b):(z=De.cachePool,z!==null?(lt=bl?Ii._currentValue:Ii._currentValue2,z=z.parent!==lt?{parent:lt,pool:lt}:z):z=es(),De={baseLanes:De.baseLanes|b,cachePool:z}),k.memoizedState=De,k.childLanes=qu(f,re,b),d.memoizedState=uw,Cu(f.child,k);return wo(d),b=f.child,f=b.sibling,b=it(b,{mode:"visible",children:k.children}),b.return=d,b.sibling=null,f!==null&&(re=d.deletions,re===null?(d.deletions=[f],d.flags|=16):re.push(f)),d.child=b,d.memoizedState=null,b}function Du(f,d){return d=Iu({mode:"visible",children:d},f.mode),d.return=f,f.child=d}function Iu(f,d){return f=n(22,f,null,d),f.lanes=0,f}function o0(f,d,b){return $u(d,f.child,null,b),f=Du(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function zm(f,d,b){f.lanes|=d;var k=f.alternate;k!==null&&(k.lanes|=d),ln(f.return,d,b)}function l0(f,d,b,k,z,J){var re=f.memoizedState;re===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:k,tail:b,tailMode:z,treeForkCount:J}:(re.isBackwards=d,re.rendering=null,re.renderingStartTime=0,re.last=k,re.tail=b,re.tailMode=z,re.treeForkCount=J)}function Gm(f,d,b){var k=d.pendingProps,z=k.revealOrder,J=k.tail;k=k.children;var re=Ji.current,De=(re&2)!==0;if(De?(re=re&1|2,d.flags|=128):re&=1,I(Ji,re),ts(f,d,k,b),k=Bn?I0:0,!De&&f!==null&&(f.flags&128)!==0)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&zm(f,b,d);else if(f.tag===19)zm(f,b,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}switch(z){case"forwards":b=d.child;for(z=null;b!==null;)f=b.alternate,f!==null&&Fh(f)===null&&(z=b),b=b.sibling;b=z,b===null?(z=d.child,d.child=null):(z=b.sibling,b.sibling=null),l0(d,!1,z,b,J,k);break;case"backwards":case"unstable_legacy-backwards":b=null,z=d.child;for(d.child=null;z!==null;){if(f=z.alternate,f!==null&&Fh(f)===null){d.child=z;break}f=z.sibling,z.sibling=b,b=z,z=f}l0(d,!0,b,null,J,k);break;case"together":l0(d,!1,null,null,void 0,k);break;default:d.memoizedState=null}return d.child}function wr(f,d,b){if(f!==null&&(d.dependencies=f.dependencies),Tc|=d.lanes,(b&d.childLanes)===0)if(f!==null){if(ri(f,d,b,!1),(b&d.childLanes)===0)return null}else return null;if(f!==null&&d.child!==f.child)throw Error(s(153));if(d.child!==null){f=d.child,b=it(f,f.pendingProps),d.child=b;for(b.return=d;f.sibling!==null;)f=f.sibling,b=b.sibling=it(f,f.pendingProps),b.return=d;b.sibling=null}return d.child}function h0(f,d){if((f.lanes&d)!==0)return!0;return f=f.dependencies,f!==null&&fn(f)?!0:!1}function Vm(f,d,b){switch(d.tag){case 3:Wt(d,d.stateNode.containerInfo),zt(d,Ii,f.memoizedState.cache),Ai();break;case 27:case 5:nn(d);break;case 4:Wt(d,d.stateNode.containerInfo);break;case 10:zt(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,Rh(d),null;break;case 13:var k=d.memoizedState;if(k!==null){if(k.dehydrated!==null)return wo(d),d.flags|=128,null;if((b&d.child.childLanes)!==0)return Um(f,d,b);return wo(d),f=wr(f,d,b),f!==null?f.sibling:null}wo(d);break;case 19:var z=(f.flags&128)!==0;if(k=(b&d.childLanes)!==0,k||(ri(f,d,b,!1),k=(b&d.childLanes)!==0),z){if(k)return Gm(f,d,b);d.flags|=128}if(z=d.memoizedState,z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),I(Ji,Ji.current),k)break;else return null;case 22:return d.lanes=0,Bm(f,d,b,d.pendingProps);case 24:zt(d,Ii,f.memoizedState.cache)}return wr(f,d,b)}function Xm(f,d,b){if(f!==null)if(f.memoizedProps!==d.pendingProps)rs=!0;else{if(!h0(f,b)&&(d.flags&128)===0)return rs=!1,Vm(f,d,b);rs=(f.flags&131072)!==0?!0:!1}else rs=!1,Bn&&(d.flags&1048576)!==0&&jt(d,I0,d.index);switch(d.lanes=0,d.tag){case 16:e:{var k=d.pendingProps;if(f=$t(d.elementType),d.type=f,typeof f==="function")Be(f)?(k=Kr(f,k),d.tag=1,d=Lm(null,d,f,k,b)):(d.tag=0,d=Vh(null,d,f,k,b));else{if(f!==void 0&&f!==null){var z=f.$$typeof;if(z===B2){d.tag=11,d=s0(null,d,f,k,b);break e}else if(z===U2){d.tag=14,d=Hh(null,d,f,k,b);break e}}throw d=g(f)||f,Error(s(306,d,""))}}return d;case 0:return Vh(f,d,d.type,d.pendingProps,b);case 1:return k=d.type,z=Kr(k,d.pendingProps),Lm(f,d,k,z,b);case 3:e:{if(Wt(d,d.stateNode.containerInfo),f===null)throw Error(s(387));var J=d.pendingProps;z=d.memoizedState,k=z.element,Yl(f,d),Xa(d,J,null,b);var re=d.memoizedState;if(J=re.cache,zt(d,Ii,J),J!==z.cache&&bn(d,[Ii],b,!0),ou(),J=re.element,Js&&z.isDehydrated)if(z={element:J,isDehydrated:!1,cache:re.cache},d.updateQueue.baseState=z,d.memoizedState=z,d.flags&256){d=Hm(f,d,J,b);break e}else if(J!==k){k=Ge(Error(s(424)),d),Ki(k),d=Hm(f,d,J,b);break e}else for(Js&&(Di=OC(d.stateNode.containerInfo),Ls=d,Bn=!0,_c=null,kr=!0),b=d4(d,null,J,b),d.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(Ai(),J===k){d=wr(f,d,b);break e}ts(f,d,J,b)}d=d.child}return d;case 26:if(Qr)return Gh(f,d),f===null?(b=Z9(d.type,null,d.pendingProps,null))?d.memoizedState=b:Bn||(d.stateNode=lj(d.type,d.pendingProps,Sc.current,d)):d.memoizedState=Z9(d.type,f.memoizedProps,d.pendingProps,f.memoizedState),null;case 27:if(fs)return nn(d),f===null&&fs&&Bn&&(k=d.stateNode=a4(d.type,d.pendingProps,Sc.current,Bs.current,!1),Ls=d,kr=!0,Di=PC(d.type,k,Di)),ts(f,d,d.pendingProps.children,b),Gh(f,d),f===null&&(d.flags|=4194304),d.child;case 5:if(f===null&&Bn){if(aj(d.type,d.pendingProps,Bs.current),z=k=Di)k=BC(k,d.type,d.pendingProps,kr),k!==null?(d.stateNode=k,Ls=d,Di=RC(k),kr=!1,z=!0):z=!1;z||Rn(d)}return nn(d),z=d.type,J=d.pendingProps,re=f!==null?f.memoizedProps:null,k=J.children,yg(z,J)?k=null:re!==null&&yg(z,re)&&(d.flags|=32),d.memoizedState!==null&&(z=Zl(f,d,cu,null,null,b),bl?Gu._currentValue=z:Gu._currentValue2=z),Gh(f,d),ts(f,d,k,b),d.child;case 6:if(f===null&&Bn){if(rj(d.pendingProps,Bs.current),f=b=Di)b=LC(b,d.pendingProps,kr),b!==null?(d.stateNode=b,Ls=d,Di=null,f=!0):f=!1;f||Rn(d)}return null;case 13:return Um(f,d,b);case 4:return Wt(d,d.stateNode.containerInfo),k=d.pendingProps,f===null?d.child=$u(d,null,k,b):ts(f,d,k,b),d.child;case 11:return s0(f,d,d.type,d.pendingProps,b);case 7:return ts(f,d,d.pendingProps,b),d.child;case 8:return ts(f,d,d.pendingProps.children,b),d.child;case 12:return ts(f,d,d.pendingProps.children,b),d.child;case 10:return k=d.pendingProps,zt(d,d.type,k.value),ts(f,d,k.children,b),d.child;case 9:return z=d.type._context,k=d.pendingProps.children,Si(d),z=En(z),k=k(z),d.flags|=1,ts(f,d,k,b),d.child;case 14:return Hh(f,d,d.type,d.pendingProps,b);case 15:return Pm(f,d,d.type,d.pendingProps,b);case 19:return Gm(f,d,b);case 31:return O2(f,d,b);case 22:return Bm(f,d,b,d.pendingProps);case 24:return Si(d),k=En(Ii),f===null?(z=Qt(),z===null&&(z=hi,J=bs(),z.pooledCache=J,J.refCount++,J!==null&&(z.pooledCacheLanes|=b),z=J),d.memoizedState={parent:k,cache:z},Va(d),zt(d,Ii,z)):((f.lanes&b)!==0&&(Yl(f,d),Xa(d,null,null,b),ou()),z=f.memoizedState,J=d.memoizedState,z.parent!==k?(z={parent:k,cache:k},d.memoizedState=z,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=z),zt(d,Ii,k)):(k=J.cache,zt(d,Ii,k),k!==z.cache&&bn(d,[Ii],b,!0))),ts(f,d,d.pendingProps.children,b),d.child;case 29:throw d.pendingProps}throw Error(s(156,d.tag))}function Aa(f){f.flags|=4}function Yi(f){ko&&(f.flags|=8)}function Xh(f,d){if(f!==null&&f.child===d.child)return!1;if((d.flags&16)!==0)return!0;for(f=d.child;f!==null;){if((f.flags&8218)!==0||(f.subtreeFlags&8218)!==0)return!0;f=f.sibling}return!1}function Ys(f,d,b,k){if(Qs)for(b=d.child;b!==null;){if(b.tag===5||b.tag===6)G2(f,b.stateNode);else if(!(b.tag===4||fs&&b.tag===27)&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===d)break;for(;b.sibling===null;){if(b.return===null||b.return===d)return;b=b.return}b.sibling.return=b.return,b=b.sibling}else if(ko)for(var z=d.child;z!==null;){if(z.tag===5){var J=z.stateNode;b&&k&&(J=K9(J,z.type,z.memoizedProps)),G2(f,J)}else if(z.tag===6)J=z.stateNode,b&&k&&(J=$9(J,z.memoizedProps)),G2(f,J);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)J=z.child,J!==null&&(J.return=z),Ys(f,z,!0,!0);else if(z.child!==null){z.child.return=z,z=z.child;continue}}if(z===d)break;for(;z.sibling===null;){if(z.return===null||z.return===d)return;z=z.return}z.sibling.return=z.return,z=z.sibling}}function lc(f,d,b,k){var z=!1;if(ko)for(var J=d.child;J!==null;){if(J.tag===5){var re=J.stateNode;b&&k&&(re=K9(re,J.type,J.memoizedProps)),X9(f,re)}else if(J.tag===6)re=J.stateNode,b&&k&&(re=$9(re,J.memoizedProps)),X9(f,re);else if(J.tag!==4){if(J.tag===22&&J.memoizedState!==null)z=J.child,z!==null&&(z.return=J),lc(f,J,!0,!0),z=!0;else if(J.child!==null){J.child.return=J,J=J.child;continue}}if(J===d)break;for(;J.sibling===null;){if(J.return===null||J.return===d)return z;J=J.return}J.sibling.return=J.return,J=J.sibling}return z}function Wm(f,d){if(ko&&Xh(f,d)){f=d.stateNode;var b=f.containerInfo,k=V9();lc(k,d,!1,!1),f.pendingChildren=k,Aa(d),CC(b,k)}}function f0(f,d,b,k){if(Qs)f.memoizedProps!==k&&Aa(d);else if(ko){var z=f.stateNode,J=f.memoizedProps;if((f=Xh(f,d))||J!==k){var re=Bs.current;J=AC(z,b,J,k,!f,null),J===z?d.stateNode=z:(Yi(d),L9(J,b,k,re)&&Aa(d),d.stateNode=J,f&&Ys(J,d,!1,!1))}else d.stateNode=z}}function yr(f,d,b,k,z){if((f.mode&32)!==0&&(b===null?ZA(d,k):eC(d,b,k))){if(f.flags|=16777216,(z&335544128)===z||V2(d,k))if(U9(f.stateNode,d,k))f.flags|=8192;else if(ef())f.flags|=8192;else throw Ku=qg,sw}else f.flags&=-16777217}function d0(f,d){if(uj(d)){if(f.flags|=16777216,!s4(d))if(ef())f.flags|=8192;else throw Ku=qg,sw}else f.flags&=-16777217}function Wh(f,d){d!==null&&(f.flags|=4),f.flags&16384&&(d=f.tag!==22?te():536870912,f.lanes|=d,kf|=d)}function Mu(f,d){if(!Bn)switch(f.tailMode){case"hidden":d=f.tail;for(var b=null;d!==null;)d.alternate!==null&&(b=d),d=d.sibling;b===null?f.tail=null:b.sibling=null;break;case"collapsed":b=f.tail;for(var k=null;b!==null;)b.alternate!==null&&(k=b),b=b.sibling;k===null?d||f.tail===null?f.tail=null:f.tail.sibling=null:k.sibling=null}}function Kn(f){var d=f.alternate!==null&&f.alternate.child===f.child,b=0,k=0;if(d)for(var z=f.child;z!==null;)b|=z.lanes|z.childLanes,k|=z.subtreeFlags&65011712,k|=z.flags&65011712,z.return=f,z=z.sibling;else for(z=f.child;z!==null;)b|=z.lanes|z.childLanes,k|=z.subtreeFlags,k|=z.flags,z.return=f,z=z.sibling;return f.subtreeFlags|=k,f.childLanes=b,d}function F2(f,d,b){var k=d.pendingProps;switch(st(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kn(d),null;case 1:return Kn(d),null;case 3:if(b=d.stateNode,k=null,f!==null&&(k=f.memoizedState.cache),d.memoizedState.cache!==k&&(d.flags|=2048),Yt(Ii),un(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),f===null||f.child===null)ai(d)?Aa(d):f===null||f.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Ks());return Wm(f,d),Kn(d),null;case 26:if(Qr){var{type:z,memoizedState:J}=d;return f===null?(Aa(d),J!==null?(Kn(d),d0(d,J)):(Kn(d),yr(d,z,null,k,b))):J?J!==f.memoizedState?(Aa(d),Kn(d),d0(d,J)):(Kn(d),d.flags&=-16777217):(J=f.memoizedProps,Qs?J!==k&&Aa(d):f0(f,d,z,k),Kn(d),yr(d,z,J,k,b)),null}case 27:if(fs){if(Zt(d),b=Sc.current,z=d.type,f!==null&&d.stateNode!=null)Qs?f.memoizedProps!==k&&Aa(d):f0(f,d,z,k);else{if(!k){if(d.stateNode===null)throw Error(s(166));return Kn(d),null}f=Bs.current,ai(d)?Jn(d,f):(f=a4(z,k,b,f,!0),d.stateNode=f,Aa(d))}return Kn(d),null}case 5:if(Zt(d),z=d.type,f!==null&&d.stateNode!=null)f0(f,d,z,k);else{if(!k){if(d.stateNode===null)throw Error(s(166));return Kn(d),null}if(J=Bs.current,ai(d))Jn(d,J),ZC(d.stateNode,z,k,J)&&(d.flags|=64);else{var re=VA(z,k,Sc.current,J,d);Yi(d),Ys(re,d,!1,!1),d.stateNode=re,L9(re,z,k,J)&&Aa(d)}}return Kn(d),yr(d,d.type,f===null?null:f.memoizedProps,d.pendingProps,b),null;case 6:if(f&&d.stateNode!=null)b=f.memoizedProps,Qs?b!==k&&Aa(d):ko&&(b!==k?(f=Sc.current,b=Bs.current,Yi(d),d.stateNode=H9(k,f,b,d)):d.stateNode=f.stateNode);else{if(typeof k!=="string"&&d.stateNode===null)throw Error(s(166));if(f=Sc.current,b=Bs.current,ai(d)){if(!Js)throw Error(s(176));if(f=d.stateNode,b=d.memoizedProps,k=null,z=Ls,z!==null)switch(z.tag){case 27:case 5:k=z.memoizedProps}GC(f,b,d,k)||Rn(d,!0)}else Yi(d),d.stateNode=H9(k,f,b,d)}return Kn(d),null;case 31:if(b=d.memoizedState,f===null||f.memoizedState!==null){if(k=ai(d),b!==null){if(f===null){if(!k)throw Error(s(318));if(!Js)throw Error(s(556));if(f=d.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(557));VC(f,d)}else Ai(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),f=!1}else b=Ks(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=b),f=!0;if(!f){if(d.flags&256)return $s(d),d;return $s(d),null}if((d.flags&128)!==0)throw Error(s(558))}return Kn(d),null;case 13:if(k=d.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(z=ai(d),k!==null&&k.dehydrated!==null){if(f===null){if(!z)throw Error(s(318));if(!Js)throw Error(s(344));if(z=d.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(s(317));XC(z,d)}else Ai(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),z=!1}else z=Ks(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=z),z=!0;if(!z){if(d.flags&256)return $s(d),d;return $s(d),null}}if($s(d),(d.flags&128)!==0)return d.lanes=b,d;return b=k!==null,f=f!==null&&f.memoizedState!==null,b&&(k=d.child,z=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(z=k.alternate.memoizedState.cachePool.pool),J=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(J=k.memoizedState.cachePool.pool),J!==z&&(k.flags|=2048)),b!==f&&b&&(d.child.flags|=8192),Wh(d,d.updateQueue),Kn(d),null;case 4:return un(),Wm(f,d),f===null&&$A(d.stateNode.containerInfo),Kn(d),null;case 10:return Yt(d.type),Kn(d),null;case 19:if(x(Ji),k=d.memoizedState,k===null)return Kn(d),null;if(z=(d.flags&128)!==0,J=k.rendering,J===null)if(z)Mu(k,!1);else{if(zi!==0||f!==null&&(f.flags&128)!==0)for(f=d.child;f!==null;){if(J=Fh(f),J!==null){d.flags|=128,Mu(k,!1),f=J.updateQueue,d.updateQueue=f,Wh(d,f),d.subtreeFlags=0,f=b;for(b=d.child;b!==null;)Ft(b,f),b=b.sibling;return I(Ji,Ji.current&1|2),Bn&&Qe(d,k.treeForkCount),d.child}f=f.sibling}k.tail!==null&&Da()>L0&&(d.flags|=128,z=!0,Mu(k,!1),d.lanes=4194304)}else{if(!z)if(f=Fh(J),f!==null){if(d.flags|=128,z=!0,f=f.updateQueue,d.updateQueue=f,Wh(d,f),Mu(k,!0),k.tail===null&&k.tailMode==="hidden"&&!J.alternate&&!Bn)return Kn(d),null}else 2*Da()-k.renderingStartTime>L0&&b!==536870912&&(d.flags|=128,z=!0,Mu(k,!1),d.lanes=4194304);k.isBackwards?(J.sibling=d.child,d.child=J):(f=k.last,f!==null?f.sibling=J:d.child=J,k.last=J)}if(k.tail!==null)return f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Da(),f.sibling=null,b=Ji.current,I(Ji,z?b&1|2:b&1),Bn&&Qe(d,k.treeForkCount),f;return Kn(d),null;case 22:case 23:return $s(d),zd(),k=d.memoizedState!==null,f!==null?f.memoizedState!==null!==k&&(d.flags|=8192):k&&(d.flags|=8192),k?(b&536870912)!==0&&(d.flags&128)===0&&(Kn(d),d.subtreeFlags&6&&(d.flags|=8192)):Kn(d),b=d.updateQueue,b!==null&&Wh(d,b.retryQueue),b=null,f!==null&&f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),k=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(k=d.memoizedState.cachePool.pool),k!==b&&(d.flags|=2048),f!==null&&x(Wu),null;case 24:return b=null,f!==null&&(b=f.memoizedState.cache),d.memoizedState.cache!==b&&(d.flags|=2048),Yt(Ii),Kn(d),null;case 25:return null;case 30:return null}throw Error(s(156,d.tag))}function N2(f,d){switch(st(d),d.tag){case 1:return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return Yt(Ii),un(),f=d.flags,(f&65536)!==0&&(f&128)===0?(d.flags=f&-65537|128,d):null;case 26:case 27:case 5:return Zt(d),null;case 31:if(d.memoizedState!==null){if($s(d),d.alternate===null)throw Error(s(340));Ai()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 13:if($s(d),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(s(340));Ai()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return x(Ji),null;case 4:return un(),null;case 10:return Yt(d.type),null;case 22:case 23:return $s(d),zd(),f!==null&&x(Wu),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 24:return Yt(Ii),null;case 25:return null;default:return null}}function Km(f,d){switch(st(d),d.tag){case 3:Yt(Ii),un();break;case 26:case 27:case 5:Zt(d);break;case 4:un();break;case 31:d.memoizedState!==null&&$s(d);break;case 13:$s(d);break;case 19:x(Ji);break;case 10:Yt(d.type);break;case 22:case 23:$s(d),zd(),f!==null&&x(Wu);break;case 24:Yt(Ii)}}function Ru(f,d){try{var b=d.updateQueue,k=b!==null?b.lastEffect:null;if(k!==null){var z=k.next;b=z;do{if((b.tag&f)===f){k=void 0;var J=b.create,re=b.inst;k=J(),re.destroy=k}b=b.next}while(b!==z)}}catch(De){F(d,d.return,De)}}function $r(f,d,b){try{var k=d.updateQueue,z=k!==null?k.lastEffect:null;if(z!==null){var J=z.next;k=J;do{if((k.tag&f)===f){var re=k.inst,De=re.destroy;if(De!==void 0){re.destroy=void 0,z=d;var lt=b,kt=De;try{kt()}catch(Nt){F(z,lt,Nt)}}}k=k.next}while(k!==J)}}catch(Nt){F(d,d.return,Nt)}}function $m(f){var d=f.updateQueue;if(d!==null){var b=f.stateNode;try{Hd(d,b)}catch(k){F(f,f.return,k)}}}function cc(f,d,b){b.props=Kr(f.type,f.memoizedProps),b.state=f.memoizedState;try{b.componentWillUnmount()}catch(k){F(f,d,k)}}function uc(f,d){try{var b=f.ref;if(b!==null){switch(f.tag){case 26:case 27:case 5:var k=j0(f.stateNode);break;case 30:k=f.stateNode;break;default:k=f.stateNode}typeof b==="function"?f.refCleanup=b(k):b.current=k}}catch(z){F(f,d,z)}}function la(f,d){var b=f.ref,k=f.refCleanup;if(b!==null)if(typeof k==="function")try{k()}catch(z){F(f,d,z)}finally{f.refCleanup=null,f=f.alternate,f!=null&&(f.refCleanup=null)}else if(typeof b==="function")try{b(null)}catch(z){F(f,d,z)}else b.current=null}function hc(f){var{type:d,memoizedProps:b,stateNode:k}=f;try{mC(k,d,b,f)}catch(z){F(f,f.return,z)}}function wi(f,d,b){try{gC(f.stateNode,f.type,b,d,f)}catch(k){F(f,f.return,k)}}function hl(f){return f.tag===5||f.tag===3||(Qr?f.tag===26:!1)||(fs?f.tag===27&&of(f.type):!1)||f.tag===4}function Ou(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||hl(f.return))return null;f=f.return}f.sibling.return=f.return;for(f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(fs&&f.tag===27&&of(f.type))continue e;if(f.flags&2)continue e;if(f.child===null||f.tag===4)continue e;else f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function p0(f,d,b){var k=f.tag;if(k===5||k===6)f=f.stateNode,d?wC(b,f,d):dC(b,f);else if(k!==4&&(fs&&k===27&&of(f.type)&&(b=f.stateNode,d=null),f=f.child,f!==null))for(p0(f,d,b),f=f.sibling;f!==null;)p0(f,d,b),f=f.sibling}function Kh(f,d,b){var k=f.tag;if(k===5||k===6)f=f.stateNode,d?bC(b,f,d):fC(b,f);else if(k!==4&&(fs&&k===27&&of(f.type)&&(b=f.stateNode),f=f.child,f!==null))for(Kh(f,d,b),f=f.sibling;f!==null;)Kh(f,d,b),f=f.sibling}function Ym(f,d,b){f=f.containerInfo;try{W9(f,b)}catch(k){F(d,d.return,k)}}function Qm(f){var{stateNode:d,memoizedProps:b}=f;try{fj(f.type,b,d,f)}catch(k){F(f,f.return,k)}}function Jm(f,d){zA(f.containerInfo);for(Ts=d;Ts!==null;)if(f=Ts,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,Ts=d;else for(;Ts!==null;){f=Ts;var b=f.alternate;switch(d=f.flags,f.tag){case 0:if((d&4)!==0&&(d=f.updateQueue,d=d!==null?d.events:null,d!==null))for(var k=0;k<d.length;k++){var z=d[k];z.ref.impl=z.nextImpl}break;case 11:case 15:break;case 1:if((d&1024)!==0&&b!==null){d=void 0,k=f,z=b.memoizedProps,b=b.memoizedState;var J=k.stateNode;try{var re=Kr(k.type,z);d=J.getSnapshotBeforeUpdate(re,b),J.__reactInternalSnapshotBeforeUpdate=d}catch(De){F(k,k.return,De)}}break;case 3:(d&1024)!==0&&Qs&&TC(f.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((d&1024)!==0)throw Error(s(163))}if(d=f.sibling,d!==null){d.return=f.return,Ts=d;break}Ts=f.return}}function m0(f,d,b){var k=b.flags;switch(b.tag){case 0:case 11:case 15:Yr(f,b),k&4&&Ru(5,b);break;case 1:if(Yr(f,b),k&4)if(f=b.stateNode,d===null)try{f.componentDidMount()}catch(re){F(b,b.return,re)}else{var z=Kr(b.type,d.memoizedProps);d=d.memoizedState;try{f.componentDidUpdate(z,d,f.__reactInternalSnapshotBeforeUpdate)}catch(re){F(b,b.return,re)}}k&64&&$m(b),k&512&&uc(b,b.return);break;case 3:if(Yr(f,b),k&64&&(k=b.updateQueue,k!==null)){if(f=null,b.child!==null)switch(b.child.tag){case 27:case 5:f=j0(b.child.stateNode);break;case 1:f=b.child.stateNode}try{Hd(k,f)}catch(re){F(b,b.return,re)}}break;case 27:fs&&d===null&&k&4&&Qm(b);case 26:case 5:if(Yr(f,b),d===null){if(k&4)hc(b);else if(k&64){f=b.type,d=b.memoizedProps,z=b.stateNode;try{$C(z,f,d,b)}catch(re){F(b,b.return,re)}}}k&512&&uc(b,b.return);break;case 12:Yr(f,b);break;case 31:Yr(f,b),k&4&&Yh(f,b);break;case 13:Yr(f,b),k&4&&b0(f,b),k&64&&(k=b.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(b=le.bind(null,b),EC(k,b))));break;case 22:if(k=b.memoizedState!==null||Sl,!k){d=d!==null&&d.memoizedState!==null||os,z=Sl;var J=os;Sl=k,(os=d)&&!J?vr(f,b,(b.subtreeFlags&8772)!==0):Yr(f,b),Sl=z,os=J}break;case 30:break;default:Yr(f,b)}}function g0(f){var d=f.alternate;d!==null&&(f.alternate=null,g0(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&JA(d)),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function ja(f,d,b){for(b=b.child;b!==null;)$h(f,d,b),b=b.sibling}function $h(f,d,b){if(Ja&&typeof Ja.onCommitFiberUnmount==="function")try{Ja.onCommitFiberUnmount(D0,b)}catch(J){}switch(b.tag){case 26:if(Qr){os||la(b,d),ja(f,d,b),b.memoizedState?t4(b.memoizedState):b.stateNode&&i4(b.stateNode);break}case 27:if(fs){os||la(b,d);var k=cs,z=Ia;of(b.type)&&(cs=b.stateNode,Ia=!1),ja(f,d,b),r4(b.stateNode),cs=k,Ia=z;break}case 5:os||la(b,d);case 6:if(Qs){if(k=cs,z=Ia,cs=null,ja(f,d,b),cs=k,Ia=z,cs!==null)if(Ia)try{vC(cs,b.stateNode)}catch(J){F(b,d,J)}else try{yC(cs,b.stateNode)}catch(J){F(b,d,J)}}else ja(f,d,b);break;case 18:Qs&&cs!==null&&(Ia?nj(cs,b.stateNode):tj(cs,b.stateNode));break;case 4:Qs?(k=cs,z=Ia,cs=b.stateNode.containerInfo,Ia=!0,ja(f,d,b),cs=k,Ia=z):(ko&&Ym(b.stateNode,b,V9()),ja(f,d,b));break;case 0:case 11:case 14:case 15:$r(2,b,d),os||$r(4,b,d),ja(f,d,b);break;case 1:os||(la(b,d),k=b.stateNode,typeof k.componentWillUnmount==="function"&&cc(b,d,k)),ja(f,d,b);break;case 21:ja(f,d,b);break;case 22:os=(k=os)||b.memoizedState!==null,ja(f,d,b),os=k;break;default:ja(f,d,b)}}function Yh(f,d){if(Js&&d.memoizedState===null&&(f=d.alternate,f!==null&&(f=f.memoizedState,f!==null))){f=f.dehydrated;try{QC(f)}catch(b){F(d,d.return,b)}}}function b0(f,d){if(Js&&d.memoizedState===null&&(f=d.alternate,f!==null&&(f=f.memoizedState,f!==null&&(f=f.dehydrated,f!==null))))try{JC(f)}catch(b){F(d,d.return,b)}}function w0(f){switch(f.tag){case 31:case 13:case 19:var d=f.stateNode;return d===null&&(d=f.stateNode=new g4),d;case 22:return f=f.stateNode,d=f._retryCache,d===null&&(d=f._retryCache=new g4),d;default:throw Error(s(435,f.tag))}}function Qh(f,d){var b=w0(f);d.forEach(function(k){if(!b.has(k)){b.add(k);var z=we.bind(null,f,k);k.then(z,z)}})}function Ui(f,d){var b=d.deletions;if(b!==null)for(var k=0;k<b.length;k++){var z=b[k],J=f,re=d;if(Qs){var De=re;e:for(;De!==null;){switch(De.tag){case 27:if(fs){if(of(De.type)){cs=De.stateNode,Ia=!1;break e}break}case 5:cs=De.stateNode,Ia=!1;break e;case 3:case 4:cs=De.stateNode.containerInfo,Ia=!0;break e}De=De.return}if(cs===null)throw Error(s(160));$h(J,re,z),cs=null,Ia=!1}else $h(J,re,z);J=z.alternate,J!==null&&(J.return=null),z.return=null}if(d.subtreeFlags&13886)for(d=d.child;d!==null;)Zm(d,f),d=d.sibling}function Zm(f,d){var b=f.alternate,k=f.flags;switch(f.tag){case 0:case 11:case 14:case 15:Ui(d,f),_s(f),k&4&&($r(3,f,f.return),Ru(3,f),$r(5,f,f.return));break;case 1:Ui(d,f),_s(f),k&512&&(os||b===null||la(b,b.return)),k&64&&Sl&&(f=f.updateQueue,f!==null&&(k=f.callbacks,k!==null&&(b=f.shared.hiddenCallbacks,f.shared.hiddenCallbacks=b===null?k:b.concat(k))));break;case 26:if(Qr){var z=Jr;if(Ui(d,f),_s(f),k&512&&(os||b===null||la(b,b.return)),k&4){k=b!==null?b.memoizedState:null;var J=f.memoizedState;b===null?J===null?f.stateNode===null?f.stateNode=oj(z,f.type,f.memoizedProps,f):n4(z,f.type,f.stateNode):f.stateNode=e4(z,J,f.memoizedProps):k!==J?(k===null?b.stateNode!==null&&i4(b.stateNode):t4(k),J===null?n4(z,f.type,f.stateNode):e4(z,J,f.memoizedProps)):J===null&&f.stateNode!==null&&wi(f,f.memoizedProps,b.memoizedProps)}break}case 27:if(fs){Ui(d,f),_s(f),k&512&&(os||b===null||la(b,b.return)),b!==null&&k&4&&wi(f,f.memoizedProps,b.memoizedProps);break}case 5:if(Ui(d,f),_s(f),k&512&&(os||b===null||la(b,b.return)),Qs){if(f.flags&32){z=f.stateNode;try{G9(z)}catch(It){F(f,f.return,It)}}k&4&&f.stateNode!=null&&(z=f.memoizedProps,wi(f,z,b!==null?b.memoizedProps:z)),k&1024&&(hw=!0)}else ko&&f.alternate!==null&&(f.alternate.stateNode=f.stateNode);break;case 6:if(Ui(d,f),_s(f),k&4&&Qs){if(f.stateNode===null)throw Error(s(162));k=f.memoizedProps,b=b!==null?b.memoizedProps:k,z=f.stateNode;try{pC(z,b,k)}catch(It){F(f,f.return,It)}}break;case 3:if(Qr?(cj(),z=Jr,Jr=K2(d.containerInfo),Ui(d,f),Jr=z):Ui(d,f),_s(f),k&4){if(Qs&&Js&&b!==null&&b.memoizedState.isDehydrated)try{YC(d.containerInfo)}catch(It){F(f,f.return,It)}if(ko){k=d.containerInfo,b=d.pendingChildren;try{W9(k,b)}catch(It){F(f,f.return,It)}}}hw&&(hw=!1,y0(f));break;case 4:Qr?(b=Jr,Jr=K2(f.stateNode.containerInfo),Ui(d,f),_s(f),Jr=b):(Ui(d,f),_s(f)),k&4&&ko&&Ym(f.stateNode,f,f.stateNode.pendingChildren);break;case 12:Ui(d,f),_s(f);break;case 31:Ui(d,f),_s(f),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Qh(f,k)));break;case 13:Ui(d,f),_s(f),f.child.flags&8192&&f.memoizedState!==null!==(b!==null&&b.memoizedState!==null)&&(Bg=Da()),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Qh(f,k)));break;case 22:z=f.memoizedState!==null;var re=b!==null&&b.memoizedState!==null,De=Sl,lt=os;if(Sl=De||z,os=lt||re,Ui(d,f),os=lt,Sl=De,_s(f),k&8192&&(d=f.stateNode,d._visibility=z?d._visibility&-2:d._visibility|1,z&&(b===null||re||Sl||os||fl(f)),Qs)){e:if(b=null,Qs)for(d=f;;){if(d.tag===5||Qr&&d.tag===26){if(b===null){re=b=d;try{J=re.stateNode,z?SC(J):xC(re.stateNode,re.memoizedProps)}catch(It){F(re,re.return,It)}}}else if(d.tag===6){if(b===null){re=d;try{var kt=re.stateNode;z?_C(kt):kC(kt,re.memoizedProps)}catch(It){F(re,re.return,It)}}}else if(d.tag===18){if(b===null){re=d;try{var Nt=re.stateNode;z?ij(Nt):sj(re.stateNode)}catch(It){F(re,re.return,It)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===f)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break e;for(;d.sibling===null;){if(d.return===null||d.return===f)break e;b===d&&(b=null),d=d.return}b===d&&(b=null),d.sibling.return=d.return,d=d.sibling}}k&4&&(k=f.updateQueue,k!==null&&(b=k.retryQueue,b!==null&&(k.retryQueue=null,Qh(f,b))));break;case 19:Ui(d,f),_s(f),k&4&&(k=f.updateQueue,k!==null&&(f.updateQueue=null,Qh(f,k)));break;case 30:break;case 21:break;default:Ui(d,f),_s(f)}}function _s(f){var d=f.flags;if(d&2){try{for(var b,k=f.return;k!==null;){if(hl(k)){b=k;break}k=k.return}if(Qs){if(b==null)throw Error(s(160));switch(b.tag){case 27:if(fs){var z=b.stateNode,J=Ou(f);Kh(f,J,z);break}case 5:var re=b.stateNode;b.flags&32&&(G9(re),b.flags&=-33);var De=Ou(f);Kh(f,De,re);break;case 3:case 4:var lt=b.stateNode.containerInfo,kt=Ou(f);p0(f,kt,lt);break;default:throw Error(s(161))}}}catch(Nt){F(f,f.return,Nt)}f.flags&=-3}d&4096&&(f.flags&=-4097)}function y0(f){if(f.subtreeFlags&1024)for(f=f.child;f!==null;){var d=f;y0(d),d.tag===5&&d.flags&1024&&iC(d.stateNode),f=f.sibling}}function Yr(f,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)m0(f,d.alternate,d),d=d.sibling}function fl(f){for(f=f.child;f!==null;){var d=f;switch(d.tag){case 0:case 11:case 14:case 15:$r(4,d,d.return),fl(d);break;case 1:la(d,d.return);var b=d.stateNode;typeof b.componentWillUnmount==="function"&&cc(d,d.return,b),fl(d);break;case 27:fs&&r4(d.stateNode);case 26:case 5:la(d,d.return),fl(d);break;case 22:d.memoizedState===null&&fl(d);break;case 30:fl(d);break;default:fl(d)}f=f.sibling}}function vr(f,d,b){b=b&&(d.subtreeFlags&8772)!==0;for(d=d.child;d!==null;){var k=d.alternate,z=f,J=d,re=J.flags;switch(J.tag){case 0:case 11:case 15:vr(z,J,b),Ru(4,J);break;case 1:if(vr(z,J,b),k=J,z=k.stateNode,typeof z.componentDidMount==="function")try{z.componentDidMount()}catch(kt){F(k,k.return,kt)}if(k=J,z=k.updateQueue,z!==null){var De=k.stateNode;try{var lt=z.shared.hiddenCallbacks;if(lt!==null)for(z.shared.hiddenCallbacks=null,z=0;z<lt.length;z++)ui(lt[z],De)}catch(kt){F(k,k.return,kt)}}b&&re&64&&$m(J),uc(J,J.return);break;case 27:fs&&Qm(J);case 26:case 5:vr(z,J,b),b&&k===null&&re&4&&hc(J),uc(J,J.return);break;case 12:vr(z,J,b);break;case 31:vr(z,J,b),b&&re&4&&Yh(z,J);break;case 13:vr(z,J,b),b&&re&4&&b0(z,J);break;case 22:J.memoizedState===null&&vr(z,J,b),uc(J,J.return);break;case 30:break;default:vr(z,J,b)}d=d.sibling}}function v0(f,d){var b=null;f!==null&&f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),f=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(f=d.memoizedState.cachePool.pool),f!==b&&(f!=null&&f.refCount++,b!=null&&ws(b))}function S0(f,d){f=null,d.alternate!==null&&(f=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==f&&(d.refCount++,f!=null&&ws(f))}function ca(f,d,b,k){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)eg(f,d,b,k),d=d.sibling}function eg(f,d,b,k){var z=d.flags;switch(d.tag){case 0:case 11:case 15:ca(f,d,b,k),z&2048&&Ru(9,d);break;case 1:ca(f,d,b,k);break;case 3:ca(f,d,b,k),z&2048&&(f=null,d.alternate!==null&&(f=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==f&&(d.refCount++,f!=null&&ws(f)));break;case 12:if(z&2048){ca(f,d,b,k),f=d.stateNode;try{var J=d.memoizedProps,re=J.id,De=J.onPostCommit;typeof De==="function"&&De(re,d.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(lt){F(d,d.return,lt)}}else ca(f,d,b,k);break;case 31:ca(f,d,b,k);break;case 13:ca(f,d,b,k);break;case 23:break;case 22:J=d.stateNode,re=d.alternate,d.memoizedState!==null?J._visibility&2?ca(f,d,b,k):Fu(f,d):J._visibility&2?ca(f,d,b,k):(J._visibility|=2,fc(f,d,b,k,(d.subtreeFlags&10256)!==0||!1)),z&2048&&v0(re,d);break;case 24:ca(f,d,b,k),z&2048&&S0(d.alternate,d);break;default:ca(f,d,b,k)}}function fc(f,d,b,k,z){z=z&&((d.subtreeFlags&10256)!==0||!1);for(d=d.child;d!==null;){var J=f,re=d,De=b,lt=k,kt=re.flags;switch(re.tag){case 0:case 11:case 15:fc(J,re,De,lt,z),Ru(8,re);break;case 23:break;case 22:var Nt=re.stateNode;re.memoizedState!==null?Nt._visibility&2?fc(J,re,De,lt,z):Fu(J,re):(Nt._visibility|=2,fc(J,re,De,lt,z)),z&&kt&2048&&v0(re.alternate,re);break;case 24:fc(J,re,De,lt,z),z&&kt&2048&&S0(re.alternate,re);break;default:fc(J,re,De,lt,z)}d=d.sibling}}function Fu(f,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var b=f,k=d,z=k.flags;switch(k.tag){case 22:Fu(b,k),z&2048&&v0(k.alternate,k);break;case 24:Fu(b,k),z&2048&&S0(k.alternate,k);break;default:Fu(b,k)}d=d.sibling}}function dl(f,d,b){if(f.subtreeFlags&_f)for(f=f.child;f!==null;)tg(f,d,b),f=f.sibling}function tg(f,d,b){switch(f.tag){case 26:if(dl(f,d,b),f.flags&_f)if(f.memoizedState!==null)hj(b,Jr,f.memoizedState,f.memoizedProps);else{var k=f.stateNode,z=f.type;f=f.memoizedProps,((d&335544128)===d||V2(z,f))&&z9(b,k,z,f)}break;case 5:dl(f,d,b),f.flags&_f&&(k=f.stateNode,z=f.type,f=f.memoizedProps,((d&335544128)===d||V2(z,f))&&z9(b,k,z,f));break;case 3:case 4:Qr?(k=Jr,Jr=K2(f.stateNode.containerInfo),dl(f,d,b),Jr=k):dl(f,d,b);break;case 22:f.memoizedState===null&&(k=f.alternate,k!==null&&k.memoizedState!==null?(k=_f,_f=16777216,dl(f,d,b),_f=k):dl(f,d,b));break;default:dl(f,d,b)}}function ng(f){var d=f.alternate;if(d!==null&&(f=d.child,f!==null)){d.child=null;do d=f.sibling,f.sibling=null,f=d;while(f!==null)}}function Nu(f){var d=f.deletions;if((f.flags&16)!==0){if(d!==null)for(var b=0;b<d.length;b++){var k=d[b];Ts=k,sg(k,f)}ng(f)}if(f.subtreeFlags&10256)for(f=f.child;f!==null;)ig(f),f=f.sibling}function ig(f){switch(f.tag){case 0:case 11:case 15:Nu(f),f.flags&2048&&$r(9,f,f.return);break;case 3:Nu(f);break;case 12:Nu(f);break;case 22:var d=f.stateNode;f.memoizedState!==null&&d._visibility&2&&(f.return===null||f.return.tag!==13)?(d._visibility&=-3,Jh(f)):Nu(f);break;default:Nu(f)}}function Jh(f){var d=f.deletions;if((f.flags&16)!==0){if(d!==null)for(var b=0;b<d.length;b++){var k=d[b];Ts=k,sg(k,f)}ng(f)}for(f=f.child;f!==null;){switch(d=f,d.tag){case 0:case 11:case 15:$r(8,d,d.return),Jh(d);break;case 22:b=d.stateNode,b._visibility&2&&(b._visibility&=-3,Jh(d));break;default:Jh(d)}f=f.sibling}}function sg(f,d){for(;Ts!==null;){var b=Ts;switch(b.tag){case 0:case 11:case 15:$r(8,b,d);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var k=b.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:ws(b.memoizedState.cache)}if(k=b.child,k!==null)k.return=b,Ts=k;else e:for(b=f;Ts!==null;){k=Ts;var z=k.sibling,J=k.return;if(g0(k),k===b){Ts=null;break e}if(z!==null){z.return=J,Ts=z;break e}Ts=J}}}function _0(f){var d=KA(f);if(d!=null){if(typeof d.memoizedProps["data-testname"]!=="string")throw Error(s(364));return d}if(f=rC(f),f===null)throw Error(s(362));return f.stateNode.current}function Sr(f,d){var b=f.tag;switch(d.$$typeof){case Rg:if(f.type===d.value)return!0;break;case Og:e:{d=d.value,f=[f,0];for(b=0;b<f.length;){var k=f[b++],z=k.tag,J=f[b++],re=d[J];if(z!==5&&z!==26&&z!==27||!q0(k)){for(;re!=null&&Sr(k,re);)J++,re=d[J];if(J===d.length){d=!0;break e}else for(k=k.child;k!==null;)f.push(k,J),k=k.sibling}}d=!1}return d;case Fg:if((b===5||b===26||b===27)&&cC(f.stateNode,d.value))return!0;break;case Pg:if(b===5||b===6||b===26||b===27){if(f=lC(f),f!==null&&0<=f.indexOf(d.value))return!0}break;case Ng:if(b===5||b===26||b===27){if(f=f.memoizedProps["data-testname"],typeof f==="string"&&f.toLowerCase()===d.value.toLowerCase())return!0}break;default:throw Error(s(365))}return!1}function x0(f){switch(f.$$typeof){case Rg:return"<"+(g(f.value)||"Unknown")+">";case Og:return":has("+(x0(f)||"")+")";case Fg:return'[role="'+f.value+'"]';case Pg:return'"'+f.value+'"';case Ng:return'[data-testname="'+f.value+'"]';default:throw Error(s(365))}}function ag(f,d){var b=[];f=[f,0];for(var k=0;k<f.length;){var z=f[k++],J=z.tag,re=f[k++],De=d[re];if(J!==5&&J!==26&&J!==27||!q0(z)){for(;De!=null&&Sr(z,De);)re++,De=d[re];if(re===d.length)b.push(z);else for(z=z.child;z!==null;)f.push(z,re),z=z.sibling}}return b}function k0(f,d){if(!E0)throw Error(s(363));f=_0(f),f=ag(f,d),d=[],f=Array.from(f);for(var b=0;b<f.length;){var k=f[b++],z=k.tag;if(z===5||z===26||z===27)q0(k)||d.push(k.stateNode);else for(k=k.child;k!==null;)f.push(k),k=k.sibling}return d}function qa(){return(Dn&2)!==0&&Fn!==0?Fn&-Fn:sn.T!==null?ho():YA()}function T0(){if(nr===0)if((Fn&536870912)===0||Bn){var f=Sg;Sg<<=1,(Sg&3932160)===0&&(Sg=262144),nr=f}else nr=536870912;return f=er.current,f!==null&&(f.flags|=32),nr}function xs(f,d,b){if(f===hi&&(ti===2||ti===9)||f.cancelPendingCommit!==null)dc(f,0),So(f,Fn,nr,!1);if(ne(f,b),(Dn&2)===0||f!==hi)f===hi&&((Dn&2)===0&&(Qu|=b),zi===4&&So(f,Fn,nr,!1)),Li(f)}function A0(f,d,b){if((Dn&6)!==0)throw Error(s(327));var k=!b&&(d&127)===0&&(d&f.expiredLanes)===0||W(f,d),z=k?pl(f,d):_o(f,d,!0),J=k;do{if(z===0){xf&&!k&&So(f,d,0,!1);break}else{if(b=f.current.alternate,J&&!Zh(b)){z=_o(f,d,!1),J=!1;continue}if(z===2){if(J=d,f.errorRecoveryDisabledLanes&J)var re=0;else re=f.pendingLanes&-536870913,re=re!==0?re:re&536870912?536870912:0;if(re!==0){d=re;e:{var De=f;z=B0;var lt=Js&&De.current.memoizedState.isDehydrated;if(lt&&(dc(De,re).flags|=256),re=_o(De,re,!1),re!==2){if(fw&&!lt){De.errorRecoveryDisabledLanes|=J,Qu|=J,z=4;break e}J=Ma,Ma=z,J!==null&&(Ma===null?Ma=J:Ma.push.apply(Ma,J))}z=re}if(J=!1,z!==2)continue}}if(z===1){dc(f,0),So(f,d,0,!0);break}e:{switch(k=f,J=z,J){case 0:case 1:throw Error(s(345));case 4:if((d&4194048)!==d)break;case 6:So(k,d,nr,!kc);break e;case 2:Ma=null;break;case 3:case 5:break;default:throw Error(s(329))}if((d&62914560)===d&&(z=Bg+300-Da(),10<z)){if(So(k,d,nr,!kc),X(k,0,!0)!==0)break e;xl=d,k.timeoutHandle=XA(Pu.bind(null,k,b,Ma,Lg,pw,d,nr,Qu,kf,kc,J,"Throttled",-0,0),z);break e}Pu(k,b,Ma,Lg,pw,d,nr,Qu,kf,kc,J,null,-0,0)}}break}while(1);Li(f)}function Pu(f,d,b,k,z,J,re,De,lt,kt,Nt,It,Ut,kn){if(f.timeoutHandle=zu,It=d.subtreeFlags,It&8192||(It&16785408)===16785408){It=tC(),tg(d,J,It);var Hs=(J&62914560)===J?Bg-Da():(J&4194048)===J?b4-Da():0;if(Hs=nC(It,Hs),Hs!==null){xl=J,f.cancelPendingCommit=Hs(fg.bind(null,f,d,J,b,k,z,re,De,lt,Nt,It,null,Ut,kn)),So(f,J,re,!kt);return}}fg(f,d,J,b,k,z,re,De,lt)}function Zh(f){for(var d=f;;){var b=d.tag;if((b===0||b===11||b===15)&&d.flags&16384&&(b=d.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var k=0;k<b.length;k++){var z=b[k],J=z.getSnapshot;z=z.value;try{if(!Za(J(),z))return!1}catch(re){return!1}}if(b=d.child,d.subtreeFlags&16384&&b!==null)b.return=d,d=b;else{if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function So(f,d,b,k){d&=~dw,d&=~Qu,f.suspendedLanes|=d,f.pingedLanes&=~d,k&&(f.warmLanes|=d),k=f.expirationTimes;for(var z=d;0<z;){var J=31-Qa(z),re=1<<J;k[J]=-1,z&=~re}b!==0&&me(f,b,d)}function rg(){return(Dn&6)===0?(ys(0,!1),!1):!0}function C0(){if(In!==null){if(ti===0)var f=In.return;else f=In,yl=Vu=null,Vd(f),bf=null,O0=0,f=In;for(;f!==null;)Km(f.alternate,f),f=f.return;In=null}}function dc(f,d){var b=f.timeoutHandle;b!==zu&&(f.timeoutHandle=zu,WA(b)),b=f.cancelPendingCommit,b!==null&&(f.cancelPendingCommit=null,b()),xl=0,C0(),hi=f,In=b=it(f.current,null),Fn=d,ti=0,tr=null,kc=!1,xf=W(f,d),fw=!1,kf=nr=dw=Qu=Tc=zi=0,Ma=B0=null,pw=!1,(d&8)!==0&&(d|=d&32);var k=f.entangledLanes;if(k!==0)for(f=f.entanglements,k&=d;0<k;){var z=31-Qa(k),J=1<<z;d|=f[z],k&=~J}return _l=d,$l(),b}function og(f,d){An=null,sn.H=N0,d===gf||d===Eg?(d=Ci(),ti=3):d===sw?(d=Ci(),ti=4):ti=d===cw?8:d!==null&&typeof d==="object"&&typeof d.then==="function"?6:1,tr=d,In===null&&(zi=1,ac(f,Ge(d,f.current)))}function ef(){var f=er.current;return f===null?!0:(Fn&4194048)===Fn?Ar===null?!0:!1:(Fn&62914560)===Fn||(Fn&536870912)!==0?f===Ar:!1}function lg(){var f=sn.H;return sn.H=N0,f===null?N0:f}function cg(){var f=sn.A;return sn.A=Aj,f}function Bu(){zi=4,kc||(Fn&4194048)!==Fn&&er.current!==null||(xf=!0),(Tc&134217727)===0&&(Qu&134217727)===0||hi===null||So(hi,Fn,nr,!1)}function _o(f,d,b){var k=Dn;Dn|=2;var z=lg(),J=cg();if(hi!==f||Fn!==d)Lg=null,dc(f,d);d=!1;var re=zi;e:do try{if(ti!==0&&In!==null){var De=In,lt=tr;switch(ti){case 8:C0(),re=6;break e;case 3:case 2:case 9:case 6:er.current===null&&(d=!0);var kt=ti;if(ti=0,tr=null,ml(f,De,lt,kt),b&&xf){re=0;break e}break;default:kt=ti,ti=0,tr=null,ml(f,De,lt,kt)}}Xn(),re=zi;break}catch(Nt){og(f,Nt)}while(1);return d&&f.shellSuspendCounter++,yl=Vu=null,Dn=k,sn.H=z,sn.A=J,In===null&&(hi=null,Fn=0,$l()),re}function Xn(){for(;In!==null;)Ya(In)}function pl(f,d){var b=Dn;Dn|=2;var k=lg(),z=cg();hi!==f||Fn!==d?(Lg=null,L0=Da()+500,dc(f,d)):xf=W(f,d);e:do try{if(ti!==0&&In!==null){d=In;var J=tr;t:switch(ti){case 1:ti=0,tr=null,ml(f,d,J,1);break;case 2:case 9:if(Pt(J)){ti=0,tr=null,ug(d);break}d=function(){ti!==2&&ti!==9||hi!==f||(ti=7),Li(f)},J.then(d,d);break e;case 3:ti=7;break e;case 4:ti=5;break e;case 7:Pt(J)?(ti=0,tr=null,ug(d)):(ti=0,tr=null,ml(f,d,J,7));break;case 5:var re=null;switch(In.tag){case 26:re=In.memoizedState;case 5:case 27:var De=In,{type:lt,pendingProps:kt}=De;if(re?s4(re):U9(De.stateNode,lt,kt)){ti=0,tr=null;var Nt=De.sibling;if(Nt!==null)In=Nt;else{var It=De.return;It!==null?(In=It,tf(It)):In=null}break t}}ti=0,tr=null,ml(f,d,J,5);break;case 6:ti=0,tr=null,ml(f,d,J,6);break;case 8:C0(),zi=6;break e;default:throw Error(s(462))}}Ns();break}catch(Ut){og(f,Ut)}while(1);if(yl=Vu=null,sn.H=k,sn.A=z,Dn=b,In!==null)return 0;return hi=null,Fn=0,$l(),zi}function Ns(){for(;In!==null&&!mj();)Ya(In)}function Ya(f){var d=Xm(f.alternate,f,_l);f.memoizedProps=f.pendingProps,d===null?tf(f):In=d}function ug(f){var d=f,b=d.alternate;switch(d.tag){case 15:case 0:d=Eu(b,d,d.pendingProps,d.type,void 0,Fn);break;case 11:d=Eu(b,d,d.pendingProps,d.type.render,d.ref,Fn);break;case 5:Vd(d);default:Km(b,d),d=In=Ft(d,_l),d=Xm(b,d,_l)}f.memoizedProps=f.pendingProps,d===null?tf(f):In=d}function ml(f,d,b,k){yl=Vu=null,Vd(d),bf=null,O0=0;var z=d.return;try{if(R2(f,z,d,b,Fn)){zi=1,ac(f,Ge(b,f.current)),In=null;return}}catch(J){if(z!==null)throw In=z,J;zi=1,ac(f,Ge(b,f.current)),In=null;return}if(d.flags&32768){if(Bn||k===1)f=!0;else if(xf||(Fn&536870912)!==0)f=!1;else if(kc=f=!0,k===2||k===9||k===3||k===6)k=er.current,k!==null&&k.tag===13&&(k.flags|=16384);hg(d,f)}else tf(d)}function tf(f){var d=f;do{if((d.flags&32768)!==0){hg(d,kc);return}f=d.return;var b=F2(d.alternate,d,_l);if(b!==null){In=b;return}if(d=d.sibling,d!==null){In=d;return}In=d=f}while(d!==null);zi===0&&(zi=5)}function hg(f,d){do{var b=N2(f.alternate,f);if(b!==null){b.flags&=32767,In=b;return}if(b=f.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!d&&(f=f.sibling,f!==null)){In=f;return}In=f=b}while(f!==null);zi=6,In=null}function fg(f,d,b,k,z,J,re,De,lt){f.cancelPendingCommit=null;do gl();while(ps!==0);if((Dn&6)!==0)throw Error(s(327));if(d!==null){if(d===f.current)throw Error(s(177));if(J=d.lanes|d.childLanes,J|=aw,oe(f,b,J,re,De,lt),f===hi&&(In=hi=null,Fn=0),Tf=d,Cc=f,xl=b,mw=J,gw=z,w4=k,(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?(f.callbackNode=null,f.callbackPriority=0,Se(Q2,function(){return _(),null})):(f.callbackNode=null,f.callbackPriority=0),k=(d.flags&13878)!==0,(d.subtreeFlags&13878)!==0||k){k=sn.T,sn.T=null,z=wl(),ks(2),re=Dn,Dn|=4;try{Jm(f,d,b)}finally{Dn=re,ks(z),sn.T=k}}ps=1,dg(),pg(),mg()}}function dg(){if(ps===1){ps=0;var f=Cc,d=Tf,b=(d.flags&13878)!==0;if((d.subtreeFlags&13878)!==0||b){b=sn.T,sn.T=null;var k=wl();ks(2);var z=Dn;Dn|=4;try{Zm(d,f),GA(f.containerInfo)}finally{Dn=z,ks(k),sn.T=b}}f.current=d,ps=2}}function pg(){if(ps===2){ps=0;var f=Cc,d=Tf,b=(d.flags&8772)!==0;if((d.subtreeFlags&8772)!==0||b){b=sn.T,sn.T=null;var k=wl();ks(2);var z=Dn;Dn|=4;try{m0(f,d.alternate,d)}finally{Dn=z,ks(k),sn.T=b}}ps=3}}function mg(){if(ps===4||ps===3){ps=0,gj();var f=Cc,d=Tf,b=xl,k=w4;(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?ps=5:(ps=0,Tf=Cc=null,gg(f,f.pendingLanes));var z=f.pendingLanes;if(z===0&&(Ac=null),Fe(b),d=d.stateNode,Ja&&typeof Ja.onCommitFiberRoot==="function")try{Ja.onCommitFiberRoot(D0,d,void 0,(d.current.flags&128)===128)}catch(lt){}if(k!==null){d=sn.T,z=wl(),ks(2),sn.T=null;try{for(var J=f.onRecoverableError,re=0;re<k.length;re++){var De=k[re];J(De.value,{componentStack:De.stack})}}finally{sn.T=d,ks(z)}}(xl&3)!==0&&gl(),Li(f),z=f.pendingLanes,(b&261930)!==0&&(z&42)!==0?f===bw?H0++:(H0=0,bw=f):H0=0,Js&&ej(),ys(0,!1)}}function gg(f,d){(f.pooledCacheLanes&=d)===0&&(d=f.pooledCache,d!=null&&(f.pooledCache=null,ws(d)))}function gl(){return dg(),pg(),mg(),_()}function _(){if(ps!==5)return!1;var f=Cc,d=mw;mw=0;var b=Fe(xl),k=32>b?32:b;b=sn.T;var z=wl();try{ks(k),sn.T=null,k=gw,gw=null;var J=Cc,re=xl;if(ps=0,Tf=Cc=null,xl=0,(Dn&6)!==0)throw Error(s(331));var De=Dn;if(Dn|=4,ig(J.current),eg(J,J.current,re,k),Dn=De,ys(0,!1),Ja&&typeof Ja.onPostCommitFiberRoot==="function")try{Ja.onPostCommitFiberRoot(D0,J)}catch(lt){}return!0}finally{ks(z),sn.T=b,gg(f,d)}}function R(f,d,b){d=Ge(b,d),d=yo(f.stateNode,d,2),f=go(f,d,2),f!==null&&(ne(f,2),Li(f))}function F(f,d,b){if(f.tag===3)R(f,f,b);else for(;d!==null;){if(d.tag===3){R(d,f,b);break}else if(d.tag===1){var k=d.stateNode;if(typeof d.type.getDerivedStateFromError==="function"||typeof k.componentDidCatch==="function"&&(Ac===null||!Ac.has(k))){f=Ge(b,f),b=Au(2),k=go(d,b,2),k!==null&&(vo(b,k,d,f),ne(k,2),Li(k));break}}d=d.return}}function P(f,d,b){var k=f.pingCache;if(k===null){k=f.pingCache=new Cj;var z=new Set;k.set(d,z)}else z=k.get(d),z===void 0&&(z=new Set,k.set(d,z));z.has(b)||(fw=!0,z.add(b),f=K.bind(null,f,d,b),d.then(f,f))}function K(f,d,b){var k=f.pingCache;k!==null&&k.delete(d),f.pingedLanes|=f.suspendedLanes&b,f.warmLanes&=~b,hi===f&&(Fn&b)===b&&(zi===4||zi===3&&(Fn&62914560)===Fn&&300>Da()-Bg?(Dn&2)===0&&dc(f,0):dw|=b,kf===Fn&&(kf=0)),Li(f)}function ee(f,d){d===0&&(d=te()),f=il(f,d),f!==null&&(ne(f,d),Li(f))}function le(f){var d=f.memoizedState,b=0;d!==null&&(b=d.retryLane),ee(f,b)}function we(f,d){var b=0;switch(f.tag){case 31:case 13:var{stateNode:k,memoizedState:z}=f;z!==null&&(b=z.retryLane);break;case 19:k=f.stateNode;break;case 22:k=f.stateNode._retryCache;break;default:throw Error(s(314))}k!==null&&k.delete(d),ee(f,b)}function Se(f,d){return xg(f,d)}function ke(f,d,b,k){this.tag=f,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(f){return f=f.prototype,!(!f||!f.isReactComponent)}function it(f,d){var b=f.alternate;return b===null?(b=n(f.tag,d,f.key,f.mode),b.elementType=f.elementType,b.type=f.type,b.stateNode=f.stateNode,b.alternate=f,f.alternate=b):(b.pendingProps=d,b.type=f.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=f.flags&65011712,b.childLanes=f.childLanes,b.lanes=f.lanes,b.child=f.child,b.memoizedProps=f.memoizedProps,b.memoizedState=f.memoizedState,b.updateQueue=f.updateQueue,d=f.dependencies,b.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},b.sibling=f.sibling,b.index=f.index,b.ref=f.ref,b.refCleanup=f.refCleanup,b}function Ft(f,d){f.flags&=65011714;var b=f.alternate;return b===null?(f.childLanes=0,f.lanes=d,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=b.childLanes,f.lanes=b.lanes,f.child=b.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=b.memoizedProps,f.memoizedState=b.memoizedState,f.updateQueue=b.updateQueue,f.type=b.type,d=b.dependencies,f.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),f}function pt(f,d,b,k,z,J){var re=0;if(k=f,typeof f==="function")Be(f)&&(re=1);else if(typeof f==="string")re=Qr&&fs?J9(f,b,Bs.current)?26:o4(f)?27:5:Qr?J9(f,b,Bs.current)?26:5:fs?o4(f)?27:5:5;else e:switch(f){case z2:return f=n(31,b,d,z),f.elementType=z2,f.lanes=J,f;case sf:return Vt(b.children,z,J,d);case F9:re=8,z|=24;break;case P2:return f=n(12,b,d,z|2),f.elementType=P2,f.lanes=J,f;case L2:return f=n(13,b,d,z),f.elementType=L2,f.lanes=J,f;case H2:return f=n(19,b,d,z),f.elementType=H2,f.lanes=J,f;default:if(typeof f==="object"&&f!==null)switch(f.$$typeof){case wc:re=10;break e;case N9:re=9;break e;case B2:re=11;break e;case U2:re=14;break e;case yc:re=16,k=null;break e}re=29,b=Error(s(130,f===null?"null":typeof f,"")),k=null}return d=n(re,b,d,z),d.elementType=f,d.type=k,d.lanes=J,d}function Vt(f,d,b,k){return f=n(7,f,k,d),f.lanes=b,f}function rn(f,d,b){return f=n(6,f,null,d),f.lanes=b,f}function Qi(f){var d=n(18,null,null,0);return d.stateNode=f,d}function Ps(f,d,b){return d=n(4,f.children!==null?f.children:[],f.key,d),d.lanes=b,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function xo(f,d,b,k,z,J,re,De,lt){this.tag=1,this.containerInfo=f,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=zu,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ae(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ae(0),this.hiddenUpdates=ae(null),this.identifierPrefix=k,this.onUncaughtError=z,this.onCaughtError=J,this.onRecoverableError=re,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=lt,this.incompleteTransitions=new Map}function pc(f,d,b,k,z,J,re,De,lt,kt,Nt,It){return f=new xo(f,d,b,re,lt,kt,Nt,It,De),d=1,J===!0&&(d|=24),J=n(3,null,null,d),f.current=J,J.stateNode=f,d=bs(),d.refCount++,f.pooledCache=d,d.refCount++,J.memoizedState={element:k,isDehydrated:b,cache:d},Va(J),f}function mc(f){if(!f)return cf;return f=cf,f}function gc(f){var d=f._reactInternals;if(d===void 0){if(typeof f.render==="function")throw Error(s(188));throw f=Object.keys(f).join(","),Error(s(268,f))}return f=l(d),f=f!==null?c(f):null,f===null?null:j0(f.stateNode)}function bc(f,d,b,k,z,J){z=mc(z),k.context===null?k.context=z:k.pendingContext=z,k=On(d),k.payload={element:b},J=J===void 0?null:J,J!==null&&(k.callback=J),b=go(f,k,d),b!==null&&(xs(b,f,d),bo(b,f,d))}function Uu(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var b=f.retryLane;f.retryLane=b!==0&&b<d?b:d}}function ei(f,d){Uu(f,d),(f=f.alternate)&&Uu(f,d)}var Sn={},ua=Object.assign,FA=Symbol.for("react.element"),bg=Symbol.for("react.transitional.element"),nf=Symbol.for("react.portal"),sf=Symbol.for("react.fragment"),F9=Symbol.for("react.strict_mode"),P2=Symbol.for("react.profiler"),N9=Symbol.for("react.consumer"),wc=Symbol.for("react.context"),B2=Symbol.for("react.forward_ref"),L2=Symbol.for("react.suspense"),H2=Symbol.for("react.suspense_list"),U2=Symbol.for("react.memo"),yc=Symbol.for("react.lazy"),z2=Symbol.for("react.activity"),NA=Symbol.for("react.memo_cache_sentinel"),P9=Symbol.iterator,PA=Symbol.for("react.client.reference"),wg=Array.isArray,sn=Es,{rendererVersion:BA,rendererPackageName:LA,extraDevToolsConfig:B9,getPublicInstance:j0,getRootHostContext:HA,getChildHostContext:UA,prepareForCommit:zA,resetAfterCommit:GA,createInstance:VA}=e;e.cloneMutableInstance;var{appendInitialChild:G2,finalizeInitialChildren:L9,shouldSetTextContent:yg,createTextInstance:H9}=e;e.cloneMutableTextInstance;var{scheduleTimeout:XA,cancelTimeout:WA,noTimeout:zu,isPrimaryRenderer:bl}=e;e.warnsIfNotActing;var{supportsMutation:Qs,supportsPersistence:ko,supportsHydration:Js,getInstanceFromNode:KA}=e;e.beforeActiveInstanceBlur;var $A=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var{setCurrentUpdatePriority:ks,getCurrentUpdatePriority:wl,resolveUpdatePriority:YA}=e;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var{shouldAttemptEagerTransition:QA,detachDeletedInstance:JA}=e;e.requestPostPaintCallback;var{maySuspendCommit:ZA,maySuspendCommitOnUpdate:eC,maySuspendCommitInSyncRender:V2,preloadInstance:U9,startSuspendingCommit:tC,suspendInstance:z9}=e;e.suspendOnActiveViewTransition;var nC=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var{NotPendingTransition:af,HostTransitionContext:Gu,resetFormInstance:iC}=e;e.bindToConsole;var{supportsMicrotasks:sC,scheduleMicrotask:aC,supportsTestSelectors:E0,findFiberRoot:rC,getBoundingRect:oC,getTextContent:lC,isHiddenSubtree:q0,matchAccessibilityRole:cC,setFocusIfFocusable:uC,setupIntersectionObserver:hC,appendChild:fC,appendChildToContainer:dC,commitTextUpdate:pC,commitMount:mC,commitUpdate:gC,insertBefore:bC,insertInContainerBefore:wC,removeChild:yC,removeChildFromContainer:vC,resetTextContent:G9,hideInstance:SC,hideTextInstance:_C,unhideInstance:xC,unhideTextInstance:kC}=e;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var TC=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var{cloneInstance:AC,createContainerChildSet:V9,appendChildToContainerChildSet:X9,finalizeContainerChildren:CC,replaceContainerChildren:W9,cloneHiddenInstance:K9,cloneHiddenTextInstance:$9,isSuspenseInstancePending:X2,isSuspenseInstanceFallback:W2,getSuspenseInstanceFallbackErrorDetails:jC,registerSuspenseInstanceRetry:EC,canHydrateFormStateMarker:qC,isFormStateMarkerMatching:DC,getNextHydratableSibling:Y9,getNextHydratableSiblingAfterSingleton:MC,getFirstHydratableChild:RC,getFirstHydratableChildWithinContainer:OC,getFirstHydratableChildWithinActivityInstance:FC,getFirstHydratableChildWithinSuspenseInstance:NC,getFirstHydratableChildWithinSingleton:PC,canHydrateInstance:BC,canHydrateTextInstance:LC,canHydrateActivityInstance:HC,canHydrateSuspenseInstance:UC,hydrateInstance:zC,hydrateTextInstance:GC,hydrateActivityInstance:VC,hydrateSuspenseInstance:XC,getNextHydratableInstanceAfterActivityInstance:WC,getNextHydratableInstanceAfterSuspenseInstance:KC,commitHydratedInstance:$C,commitHydratedContainer:YC,commitHydratedActivityInstance:QC,commitHydratedSuspenseInstance:JC,finalizeHydratedChildren:ZC,flushHydrationEvents:ej}=e;e.clearActivityBoundary;var tj=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var{clearSuspenseBoundaryFromContainer:nj,hideDehydratedBoundary:ij,unhideDehydratedBoundary:sj,shouldDeleteUnhydratedTailInstances:Q9}=e;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var{validateHydratableInstance:aj,validateHydratableTextInstance:rj,supportsResources:Qr,isHostHoistableType:J9,getHoistableRoot:K2,getResource:Z9,acquireResource:e4,releaseResource:t4,hydrateHoistable:oj,mountHoistable:n4,unmountHoistable:i4,createHoistableInstance:lj,prepareToCommitHoistables:cj,mayResourceSuspendCommit:uj,preloadResource:s4,suspendResource:hj,supportsSingletons:fs,resolveSingletonInstance:a4,acquireSingletonInstance:fj,releaseSingletonInstance:r4,isHostSingletonType:o4,isSingletonScope:of}=e,$2=[],lf=-1,cf={},Qa=Math.clz32?Math.clz32:M,{log:dj,LN2:pj}=Math,vg=256,Sg=262144,_g=4194304,xg=ma,Y2=Hi,mj=$i,gj=Gi,Da=jn,l4=ji,bj=qi,Q2=pa,wj=Ms,yj=void 0,vj=void 0,D0=null,Ja=null,Za=typeof Object.is==="function"?Object.is:ze,c4=typeof reportError==="function"?reportError:function(f){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof f==="object"&&f!==null&&typeof f.message==="string"?String(f.message):String(f),error:f});if(!window.dispatchEvent(d))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",f);return}console.error(f)},Sj=Object.prototype.hasOwnProperty,J2,u4,Z2=!1,h4=new WeakMap,hf=[],ff=0,kg=null,I0=0,_r=[],xr=0,vc=null,Ao=1,jo="",Bs=y(null),M0=y(null),Sc=y(null),Tg=y(null),Ls=null,Di=null,Bn=!1,_c=null,kr=!1,ew=Error(s(519)),Ag=y(null),Vu=null,yl=null,_j=typeof AbortController<"u"?AbortController:function(){var f=[],d=this.signal={aborted:!1,addEventListener:function(b,k){f.push(k)}};this.abort=function(){d.aborted=!0,f.forEach(function(b){return b()})}},xj=ma,kj=pa,Ii={$$typeof:wc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Cg=null,df=null,tw=!1,jg=!1,nw=!1,Xu=0,R0=null,iw=0,pf=0,mf=null,f4=sn.S;sn.S=function(f,d){b4=Da(),typeof d==="object"&&d!==null&&typeof d.then==="function"&&Kl(f,d),f4!==null&&f4(f,d)};var Wu=y(null),gf=Error(s(460)),sw=Error(s(474)),Eg=Error(s(542)),qg={then:function(){}},Ku=null,bf=null,O0=0,$u=Ld(!0),d4=Ld(!1),Tr=[],wf=0,aw=0,xc=!1,rw=!1,yf=y(null),Dg=y(0),er=y(null),Ar=null,Ji=y(0),vl=0,An=null,oi=null,ns=null,Ig=!1,vf=!1,Yu=!1,Mg=0,F0=0,Sf=null,Tj=0,N0={readContext:En,use:ll,useCallback:_i,useContext:_i,useEffect:_i,useImperativeHandle:_i,useLayoutEffect:_i,useInsertionEffect:_i,useMemo:_i,useReducer:_i,useRef:_i,useState:_i,useDebugValue:_i,useDeferredValue:_i,useTransition:_i,useSyncExternalStore:_i,useId:_i,useHostTransitionStatus:_i,useFormState:_i,useActionState:_i,useOptimistic:_i,useMemoCache:_i,useCacheRefresh:_i};N0.useEffectEvent=_i;var p4={readContext:En,use:ll,useCallback:function(f,d){return Ss().memoizedState=[f,d===void 0?null:d],f},useContext:En,useEffect:_m,useImperativeHandle:function(f,d,b){b=b!==null&&b!==void 0?b.concat([f]):null,wu(4194308,4,Cm.bind(null,d,f),b)},useLayoutEffect:function(f,d){return wu(4194308,4,f,d)},useInsertionEffect:function(f,d){wu(4,2,f,d)},useMemo:function(f,d){var b=Ss();d=d===void 0?null:d;var k=f();if(Yu){Ue(!0);try{f()}finally{Ue(!1)}}return b.memoizedState=[k,d],k},useReducer:function(f,d,b){var k=Ss();if(b!==void 0){var z=b(d);if(Yu){Ue(!0);try{b(d)}finally{Ue(!1)}}}else z=d;return k.memoizedState=k.baseState=z,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:z},k.queue=f,f=f.dispatch=ku.bind(null,An,f),[k.memoizedState,f]},useRef:function(f){var d=Ss();return f={current:f},d.memoizedState=f},useState:function(f){f=du(f);var d=f.queue,b=Tu.bind(null,An,d);return d.dispatch=b,[f.memoizedState,b]},useDebugValue:Su,useDeferredValue:function(f,d){var b=Ss();return sc(b,f,d)},useTransition:function(){var f=du(!1);return f=Dm.bind(null,An,f.queue,!0,!1),Ss().memoizedState=f,[!1,f]},useSyncExternalStore:function(f,d,b){var k=An,z=Ss();if(Bn){if(b===void 0)throw Error(s(407));b=b()}else{if(b=d(),hi===null)throw Error(s(349));(Fn&127)!==0||nc(k,d,b)}z.memoizedState=b;var J={value:b,getSnapshot:d};return z.queue=J,_m(cl.bind(null,k,J,f),[f]),k.flags|=2048,ic(9,{destroy:void 0},hu.bind(null,k,J,b,d),null),b},useId:function(){var f=Ss(),d=hi.identifierPrefix;if(Bn){var b=jo,k=Ao;b=(k&~(1<<32-Qa(k)-1)).toString(32)+b,d="_"+d+"R_"+b,b=Mg++,0<b&&(d+="H"+b.toString(32)),d+="_"}else b=Tj++,d="_"+d+"r_"+b.toString(32)+"_";return f.memoizedState=d},useHostTransitionStatus:t0,useFormState:Jd,useActionState:Jd,useOptimistic:function(f){var d=Ss();d.memoizedState=d.baseState=f;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=b,d=$a.bind(null,An,!0,b),b.dispatch=d,[f,d]},useMemoCache:Xd,useCacheRefresh:function(){return Ss().memoizedState=xu.bind(null,An)},useEffectEvent:function(f){var d=Ss(),b={impl:f};return d.memoizedState=b,function(){if((Dn&2)!==0)throw Error(s(440));return b.impl.apply(void 0,arguments)}}},ow={readContext:En,use:ll,useCallback:Em,useContext:En,useEffect:Lh,useImperativeHandle:jm,useInsertionEffect:km,useLayoutEffect:Am,useMemo:e0,useReducer:tc,useRef:Sm,useState:function(){return tc(Ka)},useDebugValue:Su,useDeferredValue:function(f,d){var b=Ei();return qm(b,oi.memoizedState,f,d)},useTransition:function(){var f=tc(Ka)[0],d=Ei().memoizedState;return[typeof f==="boolean"?f:Ta(f),d]},useSyncExternalStore:uu,useId:Rm,useHostTransitionStatus:t0,useFormState:vm,useActionState:vm,useOptimistic:function(f,d){var b=Ei();return bm(b,oi,f,d)},useMemoCache:Xd,useCacheRefresh:_u};ow.useEffectEvent=xm;var m4={readContext:En,use:ll,useCallback:Em,useContext:En,useEffect:Lh,useImperativeHandle:jm,useInsertionEffect:km,useLayoutEffect:Am,useMemo:e0,useReducer:Wd,useRef:Sm,useState:function(){return Wd(Ka)},useDebugValue:Su,useDeferredValue:function(f,d){var b=Ei();return oi===null?sc(b,f,d):qm(b,oi.memoizedState,f,d)},useTransition:function(){var f=Wd(Ka)[0],d=Ei().memoizedState;return[typeof f==="boolean"?f:Ta(f),d]},useSyncExternalStore:uu,useId:Rm,useHostTransitionStatus:t0,useFormState:Zd,useActionState:Zd,useOptimistic:function(f,d){var b=Ei();if(oi!==null)return bm(b,oi,f,d);return b.baseState=f,[f,b.queue.dispatch]},useMemoCache:Xd,useCacheRefresh:_u};m4.useEffectEvent=xm;var lw={enqueueSetState:function(f,d,b){f=f._reactInternals;var k=qa(),z=On(k);z.payload=d,b!==void 0&&b!==null&&(z.callback=b),d=go(f,z,k),d!==null&&(xs(d,f,k),bo(d,f,k))},enqueueReplaceState:function(f,d,b){f=f._reactInternals;var k=qa(),z=On(k);z.tag=1,z.payload=d,b!==void 0&&b!==null&&(z.callback=b),d=go(f,z,k),d!==null&&(xs(d,f,k),bo(d,f,k))},enqueueForceUpdate:function(f,d){f=f._reactInternals;var b=qa(),k=On(b);k.tag=2,d!==void 0&&d!==null&&(k.callback=d),d=go(f,k,b),d!==null&&(xs(d,f,b),bo(d,f,b))}},cw=Error(s(461)),rs=!1,uw={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Sl=!1,os=!1,hw=!1,g4=typeof WeakSet==="function"?WeakSet:Set,Ts=null,cs=null,Ia=!1,Jr=null,_f=8192,Aj={getCacheForType:function(f){var d=En(Ii),b=d.data.get(f);return b===void 0&&(b=f(),d.data.set(f,b)),b},cacheSignal:function(){return En(Ii).controller.signal}},Rg=0,Og=1,Fg=2,Ng=3,Pg=4;if(typeof Symbol==="function"&&Symbol.for){var P0=Symbol.for;Rg=P0("selector.component"),Og=P0("selector.has_pseudo_class"),Fg=P0("selector.role"),Ng=P0("selector.test_id"),Pg=P0("selector.text")}var Cj=typeof WeakMap==="function"?WeakMap:Map,Dn=0,hi=null,In=null,Fn=0,ti=0,tr=null,kc=!1,xf=!1,fw=!1,_l=0,zi=0,Tc=0,Qu=0,dw=0,nr=0,kf=0,B0=null,Ma=null,pw=!1,Bg=0,b4=0,L0=1/0,Lg=null,Ac=null,ps=0,Cc=null,Tf=null,xl=0,mw=0,gw=null,w4=null,H0=0,bw=null;return Sn.attemptContinuousHydration=function(f){if(f.tag===13||f.tag===31){var d=il(f,67108864);d!==null&&xs(d,f,67108864),ei(f,67108864)}},Sn.attemptHydrationAtCurrentPriority=function(f){if(f.tag===13||f.tag===31){var d=qa();d=Oe(d);var b=il(f,d);b!==null&&xs(b,f,d),ei(f,d)}},Sn.attemptSynchronousHydration=function(f){switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var d=H(f.pendingLanes);if(d!==0){f.pendingLanes|=2;for(f.entangledLanes|=2;d;){var b=1<<31-Qa(d);f.entanglements[1]|=b,d&=~b}Li(f),(Dn&6)===0&&(L0=Da()+500,ys(0,!1))}}break;case 31:case 13:d=il(f,2),d!==null&&xs(d,f,2),rg(),ei(f,2)}},Sn.batchedUpdates=function(f,d){return f(d)},Sn.createComponentSelector=function(f){return{$$typeof:Rg,value:f}},Sn.createContainer=function(f,d,b,k,z,J,re,De,lt,kt){return pc(f,d,!1,null,b,k,J,null,re,De,lt,kt)},Sn.createHasPseudoClassSelector=function(f){return{$$typeof:Og,value:f}},Sn.createHydrationContainer=function(f,d,b,k,z,J,re,De,lt,kt,Nt,It,Ut,kn){return f=pc(b,k,!0,f,z,J,De,kn,lt,kt,Nt,It),f.context=mc(null),b=f.current,k=qa(),k=Oe(k),z=On(k),z.callback=d!==void 0&&d!==null?d:null,go(b,z,k),d=k,f.current.lanes=d,ne(f,d),Li(f),f},Sn.createPortal=function(f,d,b){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:nf,key:k==null?null:""+k,children:f,containerInfo:d,implementation:b}},Sn.createRoleSelector=function(f){return{$$typeof:Fg,value:f}},Sn.createTestNameSelector=function(f){return{$$typeof:Ng,value:f}},Sn.createTextSelector=function(f){return{$$typeof:Pg,value:f}},Sn.defaultOnCaughtError=function(f){console.error(f)},Sn.defaultOnRecoverableError=function(f){c4(f)},Sn.defaultOnUncaughtError=function(f){c4(f)},Sn.deferredUpdates=function(f){var d=sn.T,b=wl();try{return ks(32),sn.T=null,f()}finally{ks(b),sn.T=d}},Sn.discreteUpdates=function(f,d,b,k,z){var J=sn.T,re=wl();try{return ks(2),sn.T=null,f(d,b,k,z)}finally{ks(re),sn.T=J,Dn===0&&(L0=Da()+500)}},Sn.findAllNodes=k0,Sn.findBoundingRects=function(f,d){if(!E0)throw Error(s(363));d=k0(f,d),f=[];for(var b=0;b<d.length;b++)f.push(oC(d[b]));for(d=f.length-1;0<d;d--){b=f[d];for(var k=b.x,z=k+b.width,J=b.y,re=J+b.height,De=d-1;0<=De;De--)if(d!==De){var lt=f[De],kt=lt.x,Nt=kt+lt.width,It=lt.y,Ut=It+lt.height;if(k>=kt&&J>=It&&z<=Nt&&re<=Ut){f.splice(d,1);break}else if(!(k!==kt||b.width!==lt.width||Ut<J||It>re)){It>J&&(lt.height+=It-J,lt.y=J),Ut<re&&(lt.height=re-It),f.splice(d,1);break}else if(!(J!==It||b.height!==lt.height||Nt<k||kt>z)){kt>k&&(lt.width+=kt-k,lt.x=k),Nt<z&&(lt.width=z-kt),f.splice(d,1);break}}}return f},Sn.findHostInstance=gc,Sn.findHostInstanceWithNoPortals=function(f){return f=l(f),f=f!==null?p(f):null,f===null?null:j0(f.stateNode)},Sn.findHostInstanceWithWarning=function(f){return gc(f)},Sn.flushPassiveEffects=gl,Sn.flushSyncFromReconciler=function(f){var d=Dn;Dn|=1;var b=sn.T,k=wl();try{if(ks(2),sn.T=null,f)return f()}finally{ks(k),sn.T=b,Dn=d,(Dn&6)===0&&ys(0,!1)}},Sn.flushSyncWork=rg,Sn.focusWithin=function(f,d){if(!E0)throw Error(s(363));f=_0(f),d=ag(f,d),d=Array.from(d);for(f=0;f<d.length;){var b=d[f++],k=b.tag;if(!q0(b)){if((k===5||k===26||k===27)&&uC(b.stateNode))return!0;for(b=b.child;b!==null;)d.push(b),b=b.sibling}}return!1},Sn.getFindAllNodesFailureDescription=function(f,d){if(!E0)throw Error(s(363));var b=0,k=[];f=[_0(f),0];for(var z=0;z<f.length;){var J=f[z++],re=J.tag,De=f[z++],lt=d[De];if(re!==5&&re!==26&&re!==27||!q0(J)){if(Sr(J,lt)&&(k.push(x0(lt)),De++,De>b&&(b=De)),De<d.length)for(J=J.child;J!==null;)f.push(J,De),J=J.sibling}}if(b<d.length){for(f=[];b<d.length;b++)f.push(x0(d[b]));return`findAllNodes was able to match part of the selector:
|
|
22
|
+
`+(k.join(" > ")+`
|
|
23
|
+
|
|
24
|
+
No matching component was found for:
|
|
25
|
+
`)+f.join(" > ")}return null},Sn.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 27:case 5:return j0(f.child.stateNode);default:return f.child.stateNode}},Sn.injectIntoDevTools=function(){var f={bundleType:0,version:BA,rendererPackageName:LA,currentDispatcherRef:sn,reconcilerVersion:"19.2.0"};if(B9!==null&&(f.rendererConfig=B9),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)f=!0;else{try{D0=d.inject(f),Ja=d}catch(b){}f=d.checkDCE?!0:!1}}return f},Sn.isAlreadyRendering=function(){return(Dn&6)!==0},Sn.observeVisibleRects=function(f,d,b,k){if(!E0)throw Error(s(363));f=k0(f,d);var z=hC(f,b,k).disconnect;return{disconnect:function(){z()}}},Sn.shouldError=function(){return null},Sn.shouldSuspend=function(){return!1},Sn.startHostTransition=function(f,d,b,k){if(f.tag!==5)throw Error(s(476));var z=Im(f).queue;Dm(f,z,d,af,b===null?i:function(){var J=Im(f);return J.next===null&&(J=f.alternate.memoizedState),Fs(f,J.next.queue,{},qa()),b(k)})},Sn.updateContainer=function(f,d,b,k){var z=d.current,J=qa();return bc(z,J,f,d,b,k),J},Sn.updateContainerSync=function(f,d,b,k){return bc(d.current,2,f,d,b,k),2},Sn};Kp.exports.default=Kp.exports;Object.defineProperty(Kp.exports,"__esModule",{value:!0})});var wk=w(function(H$,bk){C();bk.exports=function(n,i,s){let a=v("loading"),r=v(),[l,c]=u(0),p=v(),m=v(),g=v();if(p.current!==n||m.current!==i||g.current!==s)a.current="loading",r.current=void 0,p.current=n,m.current=i,g.current=s;return He(function(){if(!n)return;var y=document.createElement("img");function x(){y.decode().catch(()=>{}).finally(()=>{a.current="loaded",r.current=y,c(Math.random())})}function I(){a.current="failed",r.current=void 0,c(Math.random())}return y.addEventListener("load",x),y.addEventListener("error",I),i&&(y.crossOrigin=i),s&&(y.referrerPolicy=s),y.src=n,function(){y.removeEventListener("load",x),y.removeEventListener("error",I)}},[n,i,s]),[r.current,a.current]}});function Cl(e){if(!e||e.length<2)return null;let n=[...e].sort((i,s)=>s.version-i.version);return{left:n[0],right:n[1]}}function y4(e,n){return Math.max(0,Math.min(e,Math.max(0,n-1)))}C();var Ej=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],as=T("maximize",Ej);var qj=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],ss=T("minimize",qj);var Dj=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Hg=T("pause",Dj);var Ij=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Dc=T("play",Ij);var Mj=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Ug=T("repeat",Mj);var Rj=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],zg=T("volume-2",Rj);var Oj=[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]],Gg=T("volume-x",Oj);C();var Fj=(e)=>o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"m9 12 2 2 4-4"})]}),Nj=(e)=>o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",...e,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"m9 12 2 2 4-4",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),v4={__CHAT__:"Generating...",__AUTOFILL__:"Autofilling metadata...",__EMBEDDING__:"Generating embeddings...",__RUNNING__:"Generating..."},xi=({teamId:e,message:n,isReply:i,hasReplies:s,isLastReply:a,getUser:r,onReply:l,isSelected:c,onSelect:p,frameRate:m,startTimecode:g,formatTimestamp:y})=>{let x=n,I=!!x.annotations&&Array.isArray(x.annotations)&&x.annotations.length>0,M=x.creator,H=!!x.sessionId&&!!x.message&&x.message in v4,X=x.message&&v4[x.message]||"Generating...",[W,Y]=u(!1),[te,ae]=u(null),{videoTimeDisplayMode:ne}=Ht(),oe=O(()=>{if(x.second===null||x.second===void 0)return"";if(y)return y(x.second);if(!m)return"";let Qe=Math.round(x.second*m);return xn(Qe,m,ne,g)},[x.second,m,ne,g,y]),{data:me}=L({queryKey:["teams",e,"me"],queryFn:async()=>{let Qe=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!Qe.ok)throw Error("Failed to fetch current member info");return await Qe.json()},enabled:!!e,staleTime:300000}),be=me?.role==="owner",xe=Q(),{mutate:Oe}=U({mutationFn:async()=>{let Qe=await A.api.comments[":commentId"].complete.$post({param:{commentId:x.id},json:{isCompleted:!x.isCompleted}});if(!Qe.ok)throw Error("Failed to update comment completion status");return await Qe.json()},onSuccess:()=>{xe.invalidateQueries({predicate:(Qe)=>Qe.queryKey.includes("comments")})}}),[Fe,Ue]=u(!1),{mutate:ze,isPending:Le}=U({mutationFn:async()=>{let Qe=await A.api.comments[":commentId"].$delete({param:{commentId:x.id}});if(!Qe.ok)throw Error("Failed to delete comment");return await Qe.json()},onSuccess:()=>{xe.invalidateQueries({predicate:(Qe)=>Qe.queryKey.includes("comments")}),Ue(!1)}}),qe=O(()=>{if(!me)return!1;if(me.role==="owner")return!0;if(x.creator?.id===me.id)return!0;return!1},[me,x.creator?.id]),Me=(Qe)=>Qe.split(/(<@[a-zA-Z0-9_-]+>)/g).map((ut,st)=>{if(ut.match(/^<@[a-zA-Z0-9_-]+>$/)){let bt=ut.slice(2,-1),Wt=x.mentions?.find((un)=>un.id===bt)||r(bt);return o("span",{className:"text-primary font-medium hover:underline cursor-pointer",children:["@",Wt?.name||"Unknown"]},st)}return t("span",{children:ut},st)}),yt=(Qe)=>Qe.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Ge=()=>{l(x)};return o("div",{onClick:p,className:`relative flex gap-4 ${i?"mt-[-1px]":"mt-3"} mr-3 group p-3 py-4 border transition-all duration-200 cursor-pointer ${i?a?"rounded-b-xl rounded-t-none":"rounded-none":s?"rounded-t-xl rounded-b-none":"rounded-xl"} ${c?"z-20 border-blue-500/40 dark:border-blue-400/40 bg-blue-500/10 dark:bg-blue-400/10 shadow-sm":"z-10 border-transparent bg-foreground/2 dark:bg-foreground/10 hover:bg-foreground/4 dark:hover:bg-foreground/15"}`,children:[o("div",{className:"flex flex-col items-center shrink-0 w-8 relative",children:[i&&t("div",{className:"absolute top-[-1rem] h-8 w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),(s&&!i||i&&!a)&&t("div",{className:"absolute top-4 bottom-[-1rem] w-0.5 bg-foreground/10 left-1/2 -translate-x-1/2 z-0"}),o(Ce,{className:"z-10 relative",children:[M?.image&&t(Ee,{src:M.image,alt:M.name||"",className:"object-cover"}),t(Ie,{className:"bg-rose-400 text-black",children:M?.name?.[0]?.toUpperCase()||"U"})]})]}),o("div",{className:"flex-1 min-w-0",children:[o("div",{className:"flex items-center justify-between w-full mb-1",children:[o("div",{className:"flex items-center gap-2",children:[t("span",{className:"font-semibold text-sm",children:M?.name||"Unknown"}),t("span",{className:"text-xs text-gray-400",children:new Date(x.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),qe&&t("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t(S,{size:"icon-xs",variant:"ghost",className:"h-6 w-6 cursor-pointer",onClick:(Qe)=>Qe.stopPropagation(),children:t(or,{className:"h-4 w-4 text-foreground/70"})})}),t(Ae,{align:"end",onClick:(Qe)=>Qe.stopPropagation(),children:o(V,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:(Qe)=>{Qe.stopPropagation(),Ue(!0)},children:[t(ve,{className:"mr-2 h-4 w-4"}),t("span",{children:at()})]})})]})})]}),o("div",{className:"flow-root mt-1",children:[x.second!==null&&x.second!==void 0&&m&&t("div",{className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-2.5 py-1 mt-[2px] mr-2 rounded-sm text-xs leading-none font-mono font-bold flex items-center gap-1",children:oe}),I&&t("div",{className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-1 py-1 mt-[2px] mr-2 rounded-sm text-xs leading-none font-bold flex items-center gap-1",title:"Contains drawing annotations",children:t(Wa,{className:"w-3.5 h-3.5"})}),H?o("div",{className:"space-y-2",children:[t(ie,{className:"h-4 w-3/4"}),t(ie,{className:"h-4 w-1/2"}),t("span",{className:"text-xs text-muted-foreground animate-pulse",children:X})]}):x.sessionId?t("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:t(po,{children:yt(x.message)})}):t("div",{className:"text-sm leading-[1.8] whitespace-pre-wrap break-words text-wrap break-all",children:Me(x.message)})]}),x.attachments&&x.attachments.length>0&&t("div",{className:"flex flex-col gap-1.5 mt-3 w-full max-w-full overflow-hidden",children:x.attachments.map((Qe)=>{let jt=Qe.url?.split("/").pop()?.split("?")[0]||"file",ut=decodeURIComponent(jt),st=wa(ut);return o("div",{className:`group relative flex items-center w-full max-w-full rounded-lg border border-border bg-card hover:bg-muted/40 transition-colors overflow-hidden ${st?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"}`,onClick:()=>{if(st)ae({url:Qe.url,name:ut});else window.open(Qe.url,"_blank","noreferrer")},children:[st?t("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-muted/40 shrink-0",children:t("img",{src:Qe.url,alt:ut,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"})}):t(Nn,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t("div",{className:"min-w-0 flex-1 overflow-hidden",children:t("p",{className:"text-xs font-medium text-foreground truncate block w-full",title:ut,children:ut})}),t("a",{href:Qe.url,target:"_blank",rel:"noreferrer",download:ut,className:"p-1 text-muted-foreground hover:text-foreground shrink-0 rounded-md hover:bg-muted transition-colors opacity-0 group-hover:opacity-100",onClick:(bt)=>bt.stopPropagation(),title:dr(),children:t(vt,{className:"w-3.5 h-3.5"})})]},Qe.id)})}),x.sessionId&&o("div",{className:"mt-3 pt-2 border-t border-foreground/5 flex items-center justify-between text-xs text-muted-foreground/60",children:[t("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground/80",children:"Created by Agent"}),be&&t(S,{variant:"outline",size:"xs",onClick:()=>Y(!0),className:"cursor-pointer border-violet-500/20 text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 hover:text-violet-700 hover:border-violet-500/30 font-semibold",children:"Logs"})]}),o("div",{className:"mt-2 flex items-center justify-between w-full",children:[t("button",{onClick:Ge,className:"text-xs font-medium text-gray-500 hover:text-blue-600 flex items-center gap-1 cursor-pointer",children:XS()}),t(pn,{children:o(mn,{children:[t(hn,{asChild:!0,children:t("button",{onClick:(Qe)=>{Qe.stopPropagation(),Oe()},className:`flex items-center justify-center p-1 rounded-full transition-colors cursor-pointer ${x.isCompleted?"text-green-500 hover:text-green-600 hover:bg-green-500/10":"text-gray-400 hover:text-green-500 hover:bg-green-500/10"}`,children:x.isCompleted?t(Nj,{className:"w-5 h-5"}):t(Fj,{className:"w-5 h-5"})})}),t(gn,{children:x.isCompleted?yv():Av()})]})})]})]}),t(Tl,{sessionId:x.sessionId,open:W,onOpenChange:Y}),t(We,{open:Fe,onOpenChange:Ue,children:o(Ye,{onClick:(Qe)=>Qe.stopPropagation(),children:[o(Je,{children:[t(et,{children:Tm()}),t(tt,{children:Mm()})]}),o(Xe,{children:[t(nt,{disabled:Le,onClick:(Qe)=>{Qe.stopPropagation(),Ue(!1)},children:Re()}),t(rt,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:Le,onClick:(Qe)=>{Qe.stopPropagation(),ze()},children:at()})]})]})}),t(fe,{open:!!te,onOpenChange:(Qe)=>!Qe&&ae(null),children:o(ce,{className:"w-auto max-w-[80vw] sm:max-w-[80vw] max-h-[80vh] p-2 sm:p-3 bg-background/95 backdrop-blur-sm border-border flex flex-col items-center justify-center overflow-hidden",onClick:(Qe)=>Qe.stopPropagation(),children:[t(pe,{className:"sr-only",children:t(ue,{children:te?.name||"Image Preview"})}),te&&o("div",{className:"flex flex-col items-center justify-center max-w-[80vw] max-h-[80vh] overflow-hidden",children:[t("img",{src:te.url,alt:te.name,className:"max-w-[80vw] max-h-[calc(80vh-2.5rem)] w-auto h-auto object-contain rounded-md"}),t("p",{className:"text-xs text-muted-foreground truncate max-w-full px-2 pt-1.5 text-center",children:te.name})]})]})})]})};C();function Bc({isOpen:e,onClose:n,onSuccess:i,children:s}){let[a,r]=u(""),[l,c]=u(""),[p,m]=u(!1),[g,y]=u(null);return o(ht,{open:e,onOpenChange:(I)=>!I&&n(),children:[t(gt,{asChild:!0,children:s}),t(At,{className:"w-80",align:"end",side:"top",children:o("form",{onSubmit:async(I)=>{I.preventDefault(),m(!0),y(null);try{let M=await A.api.identify.$post({json:{username:a,email:l}});if(!M.ok){let X=await M.json();throw Error(X.error||"Failed to identify")}let{id:H}=await M.json();localStorage.setItem("guest_user_id",H),i(H),n()}catch(M){y(M.message)}finally{m(!1)}},className:"space-y-4",children:[o("div",{className:"space-y-2",children:[t("h4",{className:"font-medium leading-none",children:M_()}),t("p",{className:"text-sm text-muted-foreground",children:iS()})]}),o("div",{className:"grid gap-2",children:[o("div",{className:"grid gap-1",children:[t(G,{htmlFor:"name",children:Xi()}),t(q,{id:"name",value:a,onChange:(I)=>r(I.target.value),placeholder:_w(),size:32,required:!0})]}),o("div",{className:"grid gap-1",children:[t(G,{htmlFor:"email",children:rf()}),t(q,{id:"email",type:"email",value:l,onChange:(I)=>c(I.target.value),placeholder:A_(),required:!0})]}),g&&t("p",{className:"text-xs text-destructive",children:g})]}),o("div",{className:"flex justify-end gap-2",children:[t(S,{type:"button",variant:"outline",size:"sm",onClick:n,children:Re()}),o(S,{type:"submit",size:"sm",disabled:p,children:[p&&t(Z,{className:"mr-2 h-3 w-3 animate-spin"}),Zs()]})]})]})})]})}C();var je=Ke(Eo()),Et=Ke(jw()),d5=Ke(r6()),Hy=Ke(v6());function Ri(){return Ri=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Ri.apply(null,arguments)}var Ef=Ke(Eo()),S6="https://example.com",$E=function(n,i){if(/^[a-z]+:/i.test(i))return i;if(/^data:/.test(n))n=Ef.default.location&&Ef.default.location.href||"";var s=/^\/\//.test(n),a=!Ef.default.location&&!/\/\//i.test(n);n=new Ef.default.URL(n,Ef.default.location||S6);var r=new URL(i,n);if(a)return r.href.slice(S6.length);else if(s)return r.href.slice(r.protocol.length);return r.href},qf=$E;var Kg=function(){function e(){this.listeners={}}var n=e.prototype;return n.on=function(s,a){if(!this.listeners[s])this.listeners[s]=[];this.listeners[s].push(a)},n.off=function(s,a){if(!this.listeners[s])return!1;var r=this.listeners[s].indexOf(a);return this.listeners[s]=this.listeners[s].slice(0),this.listeners[s].splice(r,1),r>-1},n.trigger=function(s){var a=this.listeners[s];if(!a)return;if(arguments.length===2){var r=a.length;for(var l=0;l<r;++l)a[l].call(this,arguments[1])}else{var c=Array.prototype.slice.call(arguments,1),p=a.length;for(var m=0;m<p;++m)a[m].apply(this,c)}},n.dispose=function(){this.listeners={}},n.pipe=function(s){this.on("data",function(a){s.push(a)})},e}();var Pw=Ke(Eo()),YE=function(n){return Pw.default.atob?Pw.default.atob(n):Buffer.from(n,"base64").toString("binary")};function $0(e){var n=YE(e),i=new Uint8Array(n.length);for(var s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return i}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class x6 extends Kg{constructor(){super();this.buffer=""}push(e){let n;this.buffer+=e,n=this.buffer.indexOf(`
|
|
26
|
+
`);for(;n>-1;n=this.buffer.indexOf(`
|
|
27
|
+
`))this.trigger("data",this.buffer.substring(0,n)),this.buffer=this.buffer.substring(n+1)}}var JE=String.fromCharCode(9),Bw=function(e){let n=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};if(n[1])i.length=parseInt(n[1],10);if(n[2])i.offset=parseInt(n[2],10);return i},ZE=function(){return new RegExp("(?:^|,)("+'(?:[^=]*)=(?:"[^"]*"|[^,]*)'+")")},ga=function(e){let n={};if(!e)return n;let i=e.split(ZE()),s=i.length,a;while(s--){if(i[s]==="")continue;a=/([^=]*)=(.*)/.exec(i[s]).slice(1),a[0]=a[0].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^['"](.*)['"]$/g,"$1"),n[a[0]]=a[1]}return n},_6=(e)=>{let n=e.split("x"),i={};if(n[0])i.width=parseInt(n[0],10);if(n[1])i.height=parseInt(n[1],10);return i};class k6 extends Kg{constructor(){super();this.customParsers=[],this.tagMappers=[]}push(e){let n,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((a,r)=>{let l=r(e);if(l===e)return a;return a.concat([l])},[e]).forEach((a)=>{for(let r=0;r<this.customParsers.length;r++)if(this.customParsers[r].call(this,a))return;if(a.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:a.slice(1)});return}if(a=a.replace("\r",""),n=/^#EXTM3U/.exec(a),n){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(n=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"inf"},n[1])i.duration=parseFloat(n[1]);if(n[2])i.title=n[2];this.trigger("data",i);return}if(n=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"targetduration"},n[1])i.duration=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-VERSION:([0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"version"},n[1])i.version=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"media-sequence"},n[1])i.number=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(a),n){if(i={type:"tag",tagType:"discontinuity-sequence"},n[1])i.number=parseInt(n[1],10);this.trigger("data",i);return}if(n=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"playlist-type"},n[1])i.playlistType=n[1];this.trigger("data",i);return}if(n=/^#EXT-X-BYTERANGE:(.*)?$/.exec(a),n){i=Ri(Bw(n[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(n=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(a),n){if(i={type:"tag",tagType:"allow-cache"},n[1])i.allowed=!/NO/.test(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-MAP:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"map"},n[1]){let r=ga(n[1]);if(r.URI)i.uri=r.URI;if(r.BYTERANGE)i.byterange=Bw(r.BYTERANGE)}this.trigger("data",i);return}if(n=/^#EXT-X-STREAM-INF:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"stream-inf"},n[1]){if(i.attributes=ga(n[1]),i.attributes.RESOLUTION)i.attributes.RESOLUTION=_6(i.attributes.RESOLUTION);if(i.attributes.BANDWIDTH)i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10);if(i.attributes["FRAME-RATE"])i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"]);if(i.attributes["PROGRAM-ID"])i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10)}this.trigger("data",i);return}if(n=/^#EXT-X-MEDIA:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"media"},n[1])i.attributes=ga(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-ENDLIST/.exec(a),n){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(n=/^#EXT-X-DISCONTINUITY/.exec(a),n){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(n=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"program-date-time"},n[1])i.dateTimeString=n[1],i.dateTimeObject=new Date(n[1]);this.trigger("data",i);return}if(n=/^#EXT-X-KEY:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"key"},n[1]){if(i.attributes=ga(n[1]),i.attributes.IV){if(i.attributes.IV.substring(0,2).toLowerCase()==="0x")i.attributes.IV=i.attributes.IV.substring(2);i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV)}}this.trigger("data",i);return}if(n=/^#EXT-X-START:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"start"},n[1])i.attributes=ga(n[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE);this.trigger("data",i);return}if(n=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-out-cont"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-CUE-OUT:(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-out"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-CUE-IN:?(.*)?$/.exec(a),n){if(i={type:"tag",tagType:"cue-in"},n[1])i.data=n[1];else i.data="";this.trigger("data",i);return}if(n=/^#EXT-X-SKIP:(.*)$/.exec(a),n&&n[1]){if(i={type:"tag",tagType:"skip"},i.attributes=ga(n[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS"))i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10);if(i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES"))i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(JE);this.trigger("data",i);return}if(n=/^#EXT-X-PART:(.*)$/.exec(a),n&&n[1]){if(i={type:"tag",tagType:"part"},i.attributes=ga(n[1]),["DURATION"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),["INDEPENDENT","GAP"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=/YES/.test(i.attributes[r])}),i.attributes.hasOwnProperty("BYTERANGE"))i.attributes.byterange=Bw(i.attributes.BYTERANGE);this.trigger("data",i);return}if(n=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"server-control"},i.attributes=ga(n[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=/YES/.test(i.attributes[r])}),this.trigger("data",i);return}if(n=/^#EXT-X-PART-INF:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"part-inf"},i.attributes=ga(n[1]),["PART-TARGET"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseFloat(i.attributes[r])}),this.trigger("data",i);return}if(n=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=ga(n[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(r){if(i.attributes.hasOwnProperty(r)){i.attributes[r]=parseInt(i.attributes[r],10);let l=r==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[l]=i.attributes[r],delete i.attributes[r]}}),this.trigger("data",i);return}if(n=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=ga(n[1]),["LAST-MSN","LAST-PART"].forEach(function(r){if(i.attributes.hasOwnProperty(r))i.attributes[r]=parseInt(i.attributes[r],10)}),this.trigger("data",i);return}if(n=/^#EXT-X-DATERANGE:(.*)$/.exec(a),n&&n[1]){i={type:"tag",tagType:"daterange"},i.attributes=ga(n[1]),["ID","CLASS"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=String(i.attributes[l])}),["START-DATE","END-DATE"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=new Date(i.attributes[l])}),["DURATION","PLANNED-DURATION"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=parseFloat(i.attributes[l])}),["END-ON-NEXT"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=/YES/i.test(i.attributes[l])}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(l){if(i.attributes.hasOwnProperty(l))i.attributes[l]=i.attributes[l].toString(16)});let r=/^X-([A-Z]+-)+[A-Z]+$/;for(let l in i.attributes){if(!r.test(l))continue;let c=/[0-9A-Fa-f]{6}/g.test(i.attributes[l]),p=/^\d+(\.\d+)?$/.test(i.attributes[l]);i.attributes[l]=c?i.attributes[l].toString(16):p?parseFloat(i.attributes[l]):String(i.attributes[l])}this.trigger("data",i);return}if(n=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(a),n){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(n=/^#EXT-X-I-FRAMES-ONLY/.exec(a),n){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(n=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(a),n){i={type:"tag",tagType:"content-steering"},i.attributes=ga(n[1]),this.trigger("data",i);return}if(n=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(a),n){if(i={type:"tag",tagType:"i-frame-playlist"},i.attributes=ga(n[1]),i.attributes.URI)i.uri=i.attributes.URI;if(i.attributes.BANDWIDTH)i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10);if(i.attributes.RESOLUTION)i.attributes.RESOLUTION=_6(i.attributes.RESOLUTION);if(i.attributes["AVERAGE-BANDWIDTH"])i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10);if(i.attributes["FRAME-RATE"])i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"]);this.trigger("data",i);return}if(n=/^#EXT-X-DEFINE:(.*)$/.exec(a),n){i={type:"tag",tagType:"define"},i.attributes=ga(n[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:a.slice(4)})})}addParser({expression:e,customType:n,dataParser:i,segment:s}){if(typeof i!=="function")i=(a)=>a;this.customParsers.push((a)=>{if(e.exec(a))return this.trigger("data",{type:"custom",data:i(a),customType:n,segment:s}),!0})}addTagMapper({expression:e,map:n}){let i=(s)=>{if(e.test(s))return n(s);return s};this.tagMappers.push(i)}}var eq=(e)=>e.toLowerCase().replace(/-(\w)/g,(n)=>n[1].toUpperCase()),Mc=function(e){let n={};return Object.keys(e).forEach(function(i){n[eq(i)]=e[i]}),n},Lw=function(e){let{serverControl:n,targetDuration:i,partTargetDuration:s}=e;if(!n)return;let a="#EXT-X-SERVER-CONTROL",r="holdBack",l="partHoldBack",c=i&&i*3,p=s&&s*2;if(i&&!n.hasOwnProperty(r))n[r]=c,this.trigger("info",{message:`${a} defaulting HOLD-BACK to targetDuration * 3 (${c}).`});if(c&&n[r]<c)this.trigger("warn",{message:`${a} clamping HOLD-BACK (${n[r]}) to targetDuration * 3 (${c})`}),n[r]=c;if(s&&!n.hasOwnProperty(l))n[l]=s*3,this.trigger("info",{message:`${a} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${n[l]}).`});if(s&&n[l]<p)this.trigger("warn",{message:`${a} clamping PART-HOLD-BACK (${n[l]}) to partTargetDuration * 2 (${p}).`}),n[l]=p};class Hw extends Kg{constructor(e={}){super();this.lineStream=new x6,this.parseStream=new k6,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;let n=this,i=[],s={},a,r,l=!1,c=function(){},p={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",g=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let y=0,x=0,I={};this.on("end",()=>{if(s.uri||!s.parts&&!s.preloadHints)return;if(!s.map&&a)s.map=a;if(!s.key&&r)s.key=r;if(!s.timeline&&typeof g==="number")s.timeline=g;this.manifest.preloadSegment=s}),this.parseStream.on("data",function(M){let H,X;if(n.manifest.definitions)for(let W in n.manifest.definitions){if(M.uri)M.uri=M.uri.replace(`{$${W}}`,n.manifest.definitions[W]);if(M.attributes){for(let Y in M.attributes)if(typeof M.attributes[Y]==="string")M.attributes[Y]=M.attributes[Y].replace(`{$${W}}`,n.manifest.definitions[W])}}({tag(){({version(){if(M.version)this.manifest.version=M.version},"allow-cache"(){if(this.manifest.allowCache=M.allowed,!("allowed"in M))this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0},byterange(){let W={};if("length"in M){if(s.byterange=W,W.length=M.length,!("offset"in M))M.offset=y}if("offset"in M)s.byterange=W,W.offset=M.offset;y=W.offset+W.length},endlist(){this.manifest.endList=!0},inf(){if(!("mediaSequence"in this.manifest))this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"});if(!("discontinuitySequence"in this.manifest))this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"});if(M.title)s.title=M.title;if(M.duration>0)s.duration=M.duration;if(M.duration===0)s.duration=0.01,this.trigger("info",{message:"updating zero segment duration to a small value"});this.manifest.segments=i},key(){if(!M.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(M.attributes.METHOD==="NONE"){r=null;return}if(!M.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(M.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:M.attributes};return}if(M.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:M.attributes.URI};return}if(M.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(M.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(M.attributes.METHOD==="SAMPLE-AES-CENC")this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"});if(M.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(M.attributes.KEYID&&M.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:M.attributes.KEYFORMAT,keyId:M.attributes.KEYID.substring(2)},pssh:$0(M.attributes.URI.split(",")[1])};return}if(!M.attributes.METHOD)this.trigger("warn",{message:"defaulting key method to AES-128"});if(r={method:M.attributes.METHOD||"AES-128",uri:M.attributes.URI},typeof M.attributes.IV<"u")r.iv=M.attributes.IV},"media-sequence"(){if(!isFinite(M.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+M.number});return}this.manifest.mediaSequence=M.number},"discontinuity-sequence"(){if(!isFinite(M.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+M.number});return}this.manifest.discontinuitySequence=M.number,g=M.number},"playlist-type"(){if(!/VOD|EVENT/.test(M.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+M.playlist});return}this.manifest.playlistType=M.playlistType},map(){if(a={},M.uri)a.uri=M.uri;if(M.byterange)a.byterange=M.byterange;if(r)a.key=r},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||p,!M.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!s.attributes)s.attributes={};Ri(s.attributes,M.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||p,!(M.attributes&&M.attributes.TYPE&&M.attributes["GROUP-ID"]&&M.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}let W=this.manifest.mediaGroups[M.attributes.TYPE];if(W[M.attributes["GROUP-ID"]]=W[M.attributes["GROUP-ID"]]||{},H=W[M.attributes["GROUP-ID"]],X={default:/yes/i.test(M.attributes.DEFAULT)},X.default)X.autoselect=!0;else X.autoselect=/yes/i.test(M.attributes.AUTOSELECT);if(M.attributes.LANGUAGE)X.language=M.attributes.LANGUAGE;if(M.attributes.URI)X.uri=M.attributes.URI;if(M.attributes["INSTREAM-ID"])X.instreamId=M.attributes["INSTREAM-ID"];if(M.attributes.CHARACTERISTICS)X.characteristics=M.attributes.CHARACTERISTICS;if(M.attributes.FORCED)X.forced=/yes/i.test(M.attributes.FORCED);H[M.attributes.NAME]=X},discontinuity(){g+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){if(typeof this.manifest.dateTimeString>"u")this.manifest.dateTimeString=M.dateTimeString,this.manifest.dateTimeObject=M.dateTimeObject;s.dateTimeString=M.dateTimeString,s.dateTimeObject=M.dateTimeObject;let{lastProgramDateTime:W}=this;if(this.lastProgramDateTime=new Date(M.dateTimeString).getTime(),W===null)this.manifest.segments.reduceRight((Y,te)=>(te.programDateTime=Y-te.duration*1000,te.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(M.duration)||M.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+M.duration});return}this.manifest.targetDuration=M.duration,Lw.call(this,this.manifest)},start(){if(!M.attributes||isNaN(M.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:M.attributes["TIME-OFFSET"],precise:M.attributes.PRECISE}},"cue-out"(){s.cueOut=M.data},"cue-out-cont"(){s.cueOutCont=M.data},"cue-in"(){s.cueIn=M.data},skip(){this.manifest.skip=Mc(M.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",M.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;let W=this.manifest.segments.length,Y=Mc(M.attributes);if(s.parts=s.parts||[],s.parts.push(Y),Y.byterange){if(!Y.byterange.hasOwnProperty("offset"))Y.byterange.offset=x;x=Y.byterange.offset+Y.byterange.length}let te=s.parts.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PART #${te} for segment #${W}`,M.attributes,["URI","DURATION"]),this.manifest.renditionReports)this.manifest.renditionReports.forEach((ae,ne)=>{if(!ae.hasOwnProperty("lastPart"))this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${ne} lacks required attribute(s): LAST-PART`})})},"server-control"(){let W=this.manifest.serverControl=Mc(M.attributes);if(!W.hasOwnProperty("canBlockReload"))W.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"});if(Lw.call(this,this.manifest),W.canSkipDateranges&&!W.hasOwnProperty("canSkipUntil"))this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){let W=this.manifest.segments.length,Y=Mc(M.attributes),te=Y.type&&Y.type==="PART";if(s.preloadHints=s.preloadHints||[],s.preloadHints.push(Y),Y.byterange){if(!Y.byterange.hasOwnProperty("offset")){if(Y.byterange.offset=te?x:0,te)x=Y.byterange.offset+Y.byterange.length}}let ae=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${ae} for segment #${W}`,M.attributes,["TYPE","URI"]),!Y.type)return;for(let ne=0;ne<s.preloadHints.length-1;ne++){let oe=s.preloadHints[ne];if(!oe.type)continue;if(oe.type===Y.type)this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${ae} for segment #${W} has the same TYPE ${Y.type} as preload hint #${ne}`})}},"rendition-report"(){let W=Mc(M.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(W);let Y=this.manifest.renditionReports.length-1,te=["LAST-MSN","URI"];if(l)te.push("LAST-PART");this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${Y}`,M.attributes,te)},"part-inf"(){if(this.manifest.partInf=Mc(M.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",M.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget)this.manifest.partTargetDuration=this.manifest.partInf.partTarget;Lw.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Mc(M.attributes));let W=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${W}`,M.attributes,["ID","START-DATE"]);let Y=this.manifest.dateRanges[W];if(Y.endDate&&Y.startDate&&new Date(Y.endDate)<new Date(Y.startDate))this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"});if(Y.duration&&Y.duration<0)this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"});if(Y.plannedDuration&&Y.plannedDuration<0)this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});let te=!!Y.endOnNext;if(te&&!Y.class)this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"});if(te&&(Y.duration||Y.endDate))this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"});if(Y.duration&&Y.endDate){let ne=Y.startDate.getTime()+Y.duration*1000;this.manifest.dateRanges[W].endDate=new Date(ne)}if(!I[Y.id])I[Y.id]=Y;else{for(let ne in I[Y.id])if(!!Y[ne]&&JSON.stringify(I[Y.id][ne])!==JSON.stringify(Y[ne])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}let ae=this.manifest.dateRanges.findIndex((ne)=>ne.id===Y.id);this.manifest.dateRanges[ae]=Ri(this.manifest.dateRanges[ae],Y),I[Y.id]=Ri(I[Y.id],Y),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Mc(M.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",M.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};let W=(Y,te)=>{if(Y in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${Y}`});return}this.manifest.definitions[Y]=te};if("QUERYPARAM"in M.attributes){if("NAME"in M.attributes||"IMPORT"in M.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}let Y=this.params.get(M.attributes.QUERYPARAM);if(!Y){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${M.attributes.QUERYPARAM}`});return}W(M.attributes.QUERYPARAM,decodeURIComponent(Y));return}if("NAME"in M.attributes){if("IMPORT"in M.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in M.attributes)||typeof M.attributes.VALUE!=="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${M.attributes.NAME}`});return}W(M.attributes.NAME,M.attributes.VALUE);return}if("IMPORT"in M.attributes){if(!this.mainDefinitions[M.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${M.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}W(M.attributes.IMPORT,this.mainDefinitions[M.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:M.attributes,uri:M.uri,timeline:g}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",M.attributes,["BANDWIDTH","URI"])}}[M.tagType]||c).call(n)},uri(){if(s.uri=M.uri,i.push(s),this.manifest.targetDuration&&!("duration"in s))this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration;if(r)s.key=r;if(s.timeline=g,a)s.map=a;if(x=0,this.lastProgramDateTime!==null)s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=s.duration*1000;s={}},comment(){},custom(){if(M.segment)s.custom=s.custom||{},s.custom[M.customType]=M.data;else this.manifest.custom=this.manifest.custom||{},this.manifest.custom[M.customType]=M.data}})[M.type].call(n)})}requiredCompatibilityversion(e,n){if(e<n||!e)this.trigger("warn",{message:`manifest must be at least version ${n}`})}warnOnMissingAttributes_(e,n,i){let s=[];if(i.forEach(function(a){if(!n.hasOwnProperty(a))s.push(a)}),s.length)this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.join(", ")}`})}push(e){this.lineStream.push(e)}end(){if(this.lineStream.push(`
|
|
28
|
+
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null)this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"});this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var eh=Ke(Eo()),th={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},tq=["video","audio","text"],T6=["Video","Audio","Text"],Uw=function(n){if(!n)return n;return n.replace(/avc1\.(\d+)\.(\d+)/i,function(i,s,a){var r=("00"+Number(s).toString(16)).slice(-2),l=("00"+Number(a).toString(16)).slice(-2);return"avc1."+r+"00"+l})};var eo=function(n){if(n===void 0)n="";var i=n.split(","),s=[];return i.forEach(function(a){a=a.trim();var r;if(tq.forEach(function(l){var c=th[l].exec(a.toLowerCase());if(!c||c.length<=1)return;r=l;var p=a.substring(0,c[1].length),m=a.replace(p,"");s.push({type:p,details:m,mediaType:l})}),!r)s.push({type:a,details:"",mediaType:"unknown"})}),s},A6=function(n,i){if(!n.mediaGroups.AUDIO||!i)return null;var s=n.mediaGroups.AUDIO[i];if(!s)return null;for(var a in s){var r=s[a];if(r.default&&r.playlists)return eo(r.playlists[0].attributes.CODECS)}return null};var zw=function(n){if(n===void 0)n="";return th.audio.test(n.trim().toLowerCase())},nq=function(n){if(n===void 0)n="";return th.text.test(n.trim().toLowerCase())},nh=function(n){if(!n||typeof n!=="string")return;var i=n.toLowerCase().split(",").map(function(r){return Uw(r.trim())}),s="video";if(i.length===1&&zw(i[0]))s="audio";else if(i.length===1&&nq(i[0]))s="application";var a="mp4";if(i.every(function(r){return th.mp4.test(r)}))a="mp4";else if(i.every(function(r){return th.webm.test(r)}))a="webm";else if(i.every(function(r){return th.ogg.test(r)}))a="ogg";return s+"/"+a+';codecs="'+n+'"'},Df=function(n,i){if(n===void 0)n="";if(i===void 0)i=!1;return eh.default.MediaSource&&eh.default.MediaSource.isTypeSupported&&eh.default.MediaSource.isTypeSupported(nh(n))||i&&eh.default.ManagedMediaSource&&eh.default.ManagedMediaSource.isTypeSupported&&eh.default.ManagedMediaSource.isTypeSupported(nh(n))||!1},$g=function(n){if(n===void 0)n="";return n.toLowerCase().split(",").every(function(i){i=i.trim();for(var s=0;s<T6.length;s++){var a=T6[s];if(th["muxer"+a].test(i))return!0}return!1})},Gw="mp4a.40.2",C6="avc1.4d400d";var iq=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,sq=/^application\/dash\+xml/i,Vw=function(n){if(iq.test(n))return"hls";if(sq.test(n))return"dash";if(n==="application/vnd.videojs.vhs+json")return"vhs-json";return null};var j6=Ke(Eo());var aq=function(n){return n.toString(2).length},rq=function(n){return Math.ceil(aq(n)/8)};var Ww=function(n){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(n);return n&&n.buffer instanceof ArrayBuffer},oq=function(n){return Ww(n)},Xt=function(n){if(n instanceof Uint8Array)return n;if(!Array.isArray(n)&&!oq(n)&&!(n instanceof ArrayBuffer))if(typeof n!=="number"||typeof n==="number"&&n!==n)n=0;else n=[n];return new Uint8Array(n&&n.buffer||n,n&&n.byteOffset||0,n&&n.byteLength||0)};var Us=j6.default.BigInt||Number,Xw=[Us("0x1"),Us("0x100"),Us("0x10000"),Us("0x1000000"),Us("0x100000000"),Us("0x10000000000"),Us("0x1000000000000"),Us("0x100000000000000"),Us("0x10000000000000000")],rU=function(){var e=new Uint16Array([65484]),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n[0]===255)return"big";if(n[0]===204)return"little";return"unknown"}();var Kw=function(n,i){var s=i===void 0?{}:i,a=s.signed,r=a===void 0?!1:a,l=s.le,c=l===void 0?!1:l;n=Xt(n);var p=c?"reduce":"reduceRight",m=n[p]?n[p]:Array.prototype[p],g=m.call(n,function(x,I,M){var H=c?M:Math.abs(M+1-n.length);return x+Us(I)*Xw[H]},Us(0));if(r){var y=Xw[n.length]/Us(2)-Us(1);if(g=Us(g),g>y)g-=y,g-=y,g-=Us(2)}return Number(g)},E6=function(n,i){var s=i===void 0?{}:i,a=s.le,r=a===void 0?!1:a;if(typeof n!=="bigint"&&typeof n!=="number"||typeof n==="number"&&n!==n)n=0;n=Us(n);var l=rq(n),c=new Uint8Array(new ArrayBuffer(l));for(var p=0;p<l;p++){var m=r?p:Math.abs(p+1-c.length);if(c[m]=Number(n/Xw[p]&Us(255)),n<0)c[m]=Math.abs(~c[m]),c[m]-=p===0?1:2}return c},$w=function(n){if(!n)return"";n=Array.prototype.slice.call(n);var i=String.fromCharCode.apply(null,Xt(n));try{return decodeURIComponent(escape(i))}catch(s){}return i},Yg=function(n,i){if(typeof n!=="string"&&n&&typeof n.toString==="function")n=n.toString();if(typeof n!=="string")return new Uint8Array;if(!i)n=unescape(encodeURIComponent(n));var s=new Uint8Array(n.length);for(var a=0;a<n.length;a++)s[a]=n.charCodeAt(a);return s},q6=function(){for(var n=arguments.length,i=Array(n),s=0;s<n;s++)i[s]=arguments[s];if(i=i.filter(function(c){return c&&(c.byteLength||c.length)&&typeof c!=="string"}),i.length<=1)return Xt(i[0]);var a=i.reduce(function(c,p,m){return c+(p.byteLength||p.length)},0),r=new Uint8Array(a),l=0;return i.forEach(function(c){c=Xt(c),r.set(c,l),l+=c.byteLength}),r},$n=function(n,i,s){var a=s===void 0?{}:s,r=a.offset,l=r===void 0?0:r,c=a.mask,p=c===void 0?[]:c;n=Xt(n),i=Xt(i);var m=i.every?i.every:Array.prototype.every;return i.length&&n.length-l>=i.length&&m.call(i,function(g,y){var x=p[y]?p[y]&n[l+y]:n[l+y];return g===x})};var ba=Ke(Eo());var D6=function(n,i,s){i.forEach(function(a){for(var r in n.mediaGroups[a])for(var l in n.mediaGroups[a][r]){var c=n.mediaGroups[a][r][l];s(c,a,r,l)}})};var xv=cy();var{DOMImplementation:dD,XMLSerializer:pD}=xv,fy=_v().DOMParser;/*! @name mpd-parser @version 1.4.0 @license Apache-2.0 */var kv=(e)=>!!e&&typeof e==="object",qs=(...e)=>e.reduce((n,i)=>{if(typeof i!=="object")return n;return Object.keys(i).forEach((s)=>{if(Array.isArray(n[s])&&Array.isArray(i[s]))n[s]=n[s].concat(i[s]);else if(kv(n[s])&&kv(i[s]))n[s]=qs(n[s],i[s]);else n[s]=i[s]}),n},{}),Iv=(e)=>Object.keys(e).map((n)=>e[n]),mD=(e,n)=>{let i=[];for(let s=e;s<n;s++)i.push(s);return i},Gf=(e)=>e.reduce((n,i)=>n.concat(i),[]),Mv=(e)=>{if(!e.length)return[];let n=[];for(let i=0;i<e.length;i++)n.push(e[i]);return n},gD=(e,n)=>e.reduce((i,s,a)=>{if(s[n])i.push(a);return i},[]),bD=(e,n)=>Iv(e.reduce((i,s)=>(s.forEach((a)=>{i[n(a)]=a}),i),{})),Vf={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"},rp=({baseUrl:e="",source:n="",range:i="",indexRange:s=""})=>{let a={uri:n,resolvedUri:qf(e||"",n)};if(i||s){let l=(i?i:s).split("-"),c=ba.default.BigInt?ba.default.BigInt(l[0]):parseInt(l[0],10),p=ba.default.BigInt?ba.default.BigInt(l[1]):parseInt(l[1],10);if(c<Number.MAX_SAFE_INTEGER&&typeof c==="bigint")c=Number(c);if(p<Number.MAX_SAFE_INTEGER&&typeof p==="bigint")p=Number(p);let m;if(typeof p==="bigint"||typeof c==="bigint")m=ba.default.BigInt(p)-ba.default.BigInt(c)+ba.default.BigInt(1);else m=p-c+1;if(typeof m==="bigint"&&m<Number.MAX_SAFE_INTEGER)m=Number(m);a.byterange={length:m,offset:c}}return a},wD=(e)=>{let n;if(typeof e.offset==="bigint"||typeof e.length==="bigint")n=ba.default.BigInt(e.offset)+ba.default.BigInt(e.length)-ba.default.BigInt(1);else n=e.offset+e.length-1;return`${e.offset}-${n}`},Tv=(e)=>{if(e&&typeof e!=="number")e=parseInt(e,10);if(isNaN(e))return null;return e},yD={static(e){let{duration:n,timescale:i=1,sourceDuration:s,periodDuration:a}=e,r=Tv(e.endNumber),l=n/i;if(typeof r==="number")return{start:0,end:r};if(typeof a==="number")return{start:0,end:a/l};return{start:0,end:s/l}},dynamic(e){let{NOW:n,clientOffset:i,availabilityStartTime:s,timescale:a=1,duration:r,periodStart:l=0,minimumUpdatePeriod:c=0,timeShiftBufferDepth:p=1/0}=e,m=Tv(e.endNumber),g=(n+i)/1000,y=s+l,I=g+c-y,M=Math.ceil(I*a/r),H=Math.floor((g-y-p)*a/r),X=Math.floor((g-y)*a/r);return{start:Math.max(0,H),end:typeof m==="number"?m:Math.min(M,X)}}},vD=(e)=>(n)=>{let{duration:i,timescale:s=1,periodStart:a,startNumber:r=1}=e;return{number:r+n,duration:i/s,timeline:a,time:n*i}},py=(e)=>{let{type:n,duration:i,timescale:s=1,periodDuration:a,sourceDuration:r}=e,{start:l,end:c}=yD[n](e),p=mD(l,c).map(vD(e));if(n==="static"){let m=p.length-1,g=typeof a==="number"?a:r;p[m].duration=g-i/s*m}return p},Rv=(e)=>{let{baseUrl:n,initialization:i={},sourceDuration:s,indexRange:a="",periodStart:r,presentationTime:l,number:c=0,duration:p}=e;if(!n)throw Error(Vf.NO_BASE_URL);let m=rp({baseUrl:n,source:i.sourceURL,range:i.range}),g=rp({baseUrl:n,source:n,indexRange:a});if(g.map=m,p){let y=py(e);if(y.length)g.duration=y[0].duration,g.timeline=y[0].timeline}else if(s)g.duration=s,g.timeline=r;return g.presentationTime=l||r,g.number=c,[g]},l1=(e,n,i)=>{let s=e.sidx.map?e.sidx.map:null,a=e.sidx.duration,r=e.timeline||0,l=e.sidx.byterange,c=l.offset+l.length,p=n.timescale,m=n.references.filter((X)=>X.referenceType!==1),g=[],y=e.endList?"static":"dynamic",x=e.sidx.timeline,I=x,M=e.mediaSequence||0,H;if(typeof n.firstOffset==="bigint")H=ba.default.BigInt(c)+n.firstOffset;else H=c+n.firstOffset;for(let X=0;X<m.length;X++){let W=n.references[X],{referencedSize:Y,subsegmentDuration:te}=W,ae;if(typeof H==="bigint")ae=H+ba.default.BigInt(Y)-ba.default.BigInt(1);else ae=H+Y-1;let ne=`${H}-${ae}`,me=Rv({baseUrl:i,timescale:p,timeline:r,periodStart:x,presentationTime:I,number:M,duration:te,sourceDuration:a,indexRange:ne,type:y})[0];if(s)me.map=s;if(g.push(me),typeof H==="bigint")H+=ba.default.BigInt(Y);else H+=Y;I+=te/p,M++}return e.segments=g,e},SD=["AUDIO","SUBTITLES"],_D=0.016666666666666666,Ov=(e)=>bD(e,({timeline:n})=>n).sort((n,i)=>n.timeline>i.timeline?1:-1),xD=(e,n)=>{for(let i=0;i<e.length;i++)if(e[i].attributes.NAME===n)return e[i];return null},Cv=(e)=>{let n=[];return D6(e,SD,(i,s,a,r)=>{n=n.concat(i.playlists||[])}),n},jv=({playlist:e,mediaSequence:n})=>{e.mediaSequence=n,e.segments.forEach((i,s)=>{i.number=e.mediaSequence+s})},kD=({oldPlaylists:e,newPlaylists:n,timelineStarts:i})=>{n.forEach((s)=>{s.discontinuitySequence=i.findIndex(function({timeline:p}){return p===s.timeline});let a=xD(e,s.attributes.NAME);if(!a)return;if(s.sidx)return;let r=s.segments[0],l=a.segments.findIndex(function(p){return Math.abs(p.presentationTime-r.presentationTime)<_D});if(l===-1){if(jv({playlist:s,mediaSequence:a.mediaSequence+a.segments.length}),s.segments[0].discontinuity=!0,s.discontinuityStarts.unshift(0),!a.segments.length&&s.timeline>a.timeline||a.segments.length&&s.timeline>a.segments[a.segments.length-1].timeline)s.discontinuitySequence--;return}if(a.segments[l].discontinuity&&!r.discontinuity)r.discontinuity=!0,s.discontinuityStarts.unshift(0),s.discontinuitySequence--;jv({playlist:s,mediaSequence:a.segments[l].number})})},TD=({oldManifest:e,newManifest:n})=>{let i=e.playlists.concat(Cv(e)),s=n.playlists.concat(Cv(n));return n.timelineStarts=Ov([e.timelineStarts,n.timelineStarts]),kD({oldPlaylists:i,newPlaylists:s,timelineStarts:n.timelineStarts}),n},op=(e)=>e&&e.uri+"-"+wD(e.byterange),dy=(e)=>{let n=e.reduce(function(s,a){if(!s[a.attributes.baseUrl])s[a.attributes.baseUrl]=[];return s[a.attributes.baseUrl].push(a),s},{}),i=[];return Object.values(n).forEach((s)=>{let a=Iv(s.reduce((r,l)=>{let c=l.attributes.id+(l.attributes.lang||"");if(!r[c])r[c]=l,r[c].attributes.timelineStarts=[];else{if(l.segments){if(l.segments[0])l.segments[0].discontinuity=!0;r[c].segments.push(...l.segments)}if(l.attributes.contentProtection)r[c].attributes.contentProtection=l.attributes.contentProtection}return r[c].attributes.timelineStarts.push({start:l.attributes.periodStart,timeline:l.attributes.periodStart}),r},{}));i=i.concat(a)}),i.map((s)=>(s.discontinuityStarts=gD(s.segments||[],"discontinuity"),s))},my=(e,n)=>{let i=op(e.sidx),s=i&&n[i]&&n[i].sidx;if(s)l1(e,s,e.sidx.resolvedUri);return e},AD=(e,n={})=>{if(!Object.keys(n).length)return e;for(let i in e)e[i]=my(e[i],n);return e},CD=({attributes:e,segments:n,sidx:i,mediaSequence:s,discontinuitySequence:a,discontinuityStarts:r},l)=>{let c={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,["PROGRAM-ID"]:1},uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:a,discontinuityStarts:r,timelineStarts:e.timelineStarts,mediaSequence:s,segments:n};if(e.contentProtection)c.contentProtection=e.contentProtection;if(e.serviceLocation)c.attributes.serviceLocation=e.serviceLocation;if(i)c.sidx=i;if(l)c.attributes.AUDIO="audio",c.attributes.SUBTITLES="subs";return c},jD=({attributes:e,segments:n,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:a})=>{if(typeof n>"u")n=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration;let r={NAME:e.id,BANDWIDTH:e.bandwidth,["PROGRAM-ID"]:1};if(e.codecs)r.CODECS=e.codecs;let l={attributes:r,uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:a,mediaSequence:i,segments:n};if(e.serviceLocation)l.attributes.serviceLocation=e.serviceLocation;return l},ED=(e,n={},i=!1)=>{let s,a=e.reduce((r,l)=>{let c=l.attributes.role&&l.attributes.role.value||"",p=l.attributes.lang||"",m=l.attributes.label||"main";if(p&&!l.attributes.label){let y=c?` (${c})`:"";m=`${l.attributes.lang}${y}`}if(!r[m])r[m]={language:p,autoselect:!0,default:c==="main",playlists:[],uri:""};let g=my(CD(l,i),n);if(r[m].playlists.push(g),typeof s>"u"&&c==="main")s=l,s.default=!0;return r},{});if(!s){let r=Object.keys(a)[0];a[r].default=!0}return a},qD=(e,n={})=>e.reduce((i,s)=>{let a=s.attributes.label||s.attributes.lang||"text",r=s.attributes.lang||"und";if(!i[a])i[a]={language:r,default:!1,autoselect:!1,playlists:[],uri:""};return i[a].playlists.push(my(jD(s),n)),i},{}),DD=(e)=>e.reduce((n,i)=>{if(!i)return n;return i.forEach((s)=>{let{channel:a,language:r}=s;if(n[r]={autoselect:!1,default:!1,instreamId:a,language:r},s.hasOwnProperty("aspectRatio"))n[r].aspectRatio=s.aspectRatio;if(s.hasOwnProperty("easyReader"))n[r].easyReader=s.easyReader;if(s.hasOwnProperty("3D"))n[r]["3D"]=s["3D"]}),n},{}),ID=({attributes:e,segments:n,sidx:i,discontinuityStarts:s})=>{let a={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,["PROGRAM-ID"]:1},uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:n};if(e.frameRate)a.attributes["FRAME-RATE"]=e.frameRate;if(e.qualityRanking!==void 0)a.attributes.SCORE=1/(e.qualityRanking+1);if(e.contentProtection)a.contentProtection=e.contentProtection;if(e.serviceLocation)a.attributes.serviceLocation=e.serviceLocation;if(i)a.sidx=i;return a},MD=({attributes:e})=>e.mimeType==="video/mp4"||e.mimeType==="video/webm"||e.contentType==="video",RD=({attributes:e})=>e.mimeType==="audio/mp4"||e.mimeType==="audio/webm"||e.contentType==="audio",OD=({attributes:e})=>e.mimeType==="text/vtt"||e.contentType==="text",FD=(e,n)=>{e.forEach((i)=>{if(i.mediaSequence=0,i.discontinuitySequence=n.findIndex(function({timeline:s}){return s===i.timeline}),!i.segments)return;i.segments.forEach((s,a)=>{s.number=a})})},Ev=(e)=>{if(!e)return[];return Object.keys(e).reduce((n,i)=>{let s=e[i];return n.concat(s.playlists)},[])},ND=({dashPlaylists:e,locations:n,contentSteering:i,sidxMapping:s={},previousManifest:a,eventStream:r})=>{if(!e.length)return{};let{sourceDuration:l,type:c,suggestedPresentationDelay:p,minimumUpdatePeriod:m}=e[0].attributes,g=dy(e.filter(MD)).map(ID),y=dy(e.filter(RD)),x=dy(e.filter(OD)),I=e.map((ae)=>ae.attributes.captionServices).filter(Boolean),M={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},["CLOSED-CAPTIONS"]:{},SUBTITLES:{}},uri:"",duration:l,playlists:AD(g,s)};if(m>=0)M.minimumUpdatePeriod=m*1000;if(n)M.locations=n;if(i)M.contentSteering=i;if(c==="dynamic")M.suggestedPresentationDelay=p;if(r&&r.length>0)M.eventStream=r;let H=M.playlists.length===0,X=y.length?ED(y,s,H):null,W=x.length?qD(x,s):null,Y=g.concat(Ev(X),Ev(W)),te=Y.map(({timelineStarts:ae})=>ae);if(M.timelineStarts=Ov(te),FD(Y,M.timelineStarts),X)M.mediaGroups.AUDIO.audio=X;if(W)M.mediaGroups.SUBTITLES.subs=W;if(I.length)M.mediaGroups["CLOSED-CAPTIONS"].cc=DD(I);if(a)return TD({oldManifest:a,newManifest:M});return M},PD=(e,n,i)=>{let{NOW:s,clientOffset:a,availabilityStartTime:r,timescale:l=1,periodStart:c=0,minimumUpdatePeriod:p=0}=e,m=(s+a)/1000,g=r+c,x=m+p-g;return Math.ceil((x*l-n)/i)},Fv=(e,n)=>{let{type:i,minimumUpdatePeriod:s=0,media:a="",sourceDuration:r,timescale:l=1,startNumber:c=1,periodStart:p}=e,m=[],g=-1;for(let y=0;y<n.length;y++){let x=n[y],I=x.d,M=x.r||0,H=x.t||0;if(g<0)g=H;if(H&&H>g)g=H;let X;if(M<0){let te=y+1;if(te===n.length)if(i==="dynamic"&&s>0&&a.indexOf("$Number$")>0)X=PD(e,g,I);else X=(r*l-g)/I;else X=(n[te].t-g)/I}else X=M+1;let W=c+m.length+X,Y=c+m.length;while(Y<W)m.push({number:Y,duration:I/l,time:g,timeline:p}),g+=I,Y++}return m},BD=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,LD=(e)=>(n,i,s,a)=>{if(n==="$$")return"$";if(typeof e[i]>"u")return n;let r=""+e[i];if(i==="RepresentationID")return r;if(!s)a=1;else a=parseInt(a,10);if(r.length>=a)return r;return`${Array(a-r.length+1).join("0")}${r}`},qv=(e,n)=>e.replace(BD,LD(n)),HD=(e,n)=>{if(!e.duration&&!n)return[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}];if(e.duration)return py(e);return Fv(e,n)},UD=(e,n)=>{let i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,a=rp({baseUrl:e.baseUrl,source:qv(s.sourceURL,i),range:s.range});return HD(e,n).map((l)=>{i.Number=l.number,i.Time=l.time;let c=qv(e.media||"",i),p=e.timescale||1,m=e.presentationTimeOffset||0,g=e.periodStart+(l.time-m)/p;return{uri:c,timeline:l.timeline,duration:l.duration,resolvedUri:qf(e.baseUrl||"",c),map:a,number:l.number,presentationTime:g}})},zD=(e,n)=>{let{baseUrl:i,initialization:s={}}=e,a=rp({baseUrl:i,source:s.sourceURL,range:s.range}),r=rp({baseUrl:i,source:n.media,range:n.mediaRange});return r.map=a,r},GD=(e,n)=>{let{duration:i,segmentUrls:s=[],periodStart:a}=e;if(!i&&!n||i&&n)throw Error(Vf.SEGMENT_TIME_UNSPECIFIED);let r=s.map((p)=>zD(e,p)),l;if(i)l=py(e);if(n)l=Fv(e,n);return l.map((p,m)=>{if(r[m]){let g=r[m],y=e.timescale||1,x=e.presentationTimeOffset||0;return g.timeline=p.timeline,g.duration=p.duration,g.number=p.number,g.presentationTime=a+(p.time-x)/y,g}}).filter((p)=>p)},VD=({attributes:e,segmentInfo:n})=>{let i,s;if(n.template)s=UD,i=qs(e,n.template);else if(n.base)s=Rv,i=qs(e,n.base);else if(n.list)s=GD,i=qs(e,n.list);let a={attributes:e};if(!s)return a;let r=s(i,n.segmentTimeline);if(i.duration){let{duration:l,timescale:c=1}=i;i.duration=l/c}else if(r.length)i.duration=r.reduce((l,c)=>Math.max(l,Math.ceil(c.duration)),0);else i.duration=0;if(a.attributes=i,a.segments=r,n.base&&i.indexRange)a.sidx=r[0],a.segments=[];return a},XD=(e)=>e.map(VD),ki=(e,n)=>Mv(e.childNodes).filter(({tagName:i})=>i===n),lp=(e)=>e.textContent.trim(),WD=(e)=>parseFloat(e.split("/").reduce((n,i)=>n/i)),zf=(e)=>{let c=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!c)return 0;let[p,m,g,y,x,I]=c.slice(1);return parseFloat(p||0)*31536000+parseFloat(m||0)*2592000+parseFloat(g||0)*86400+parseFloat(y||0)*3600+parseFloat(x||0)*60+parseFloat(I||0)},KD=(e)=>{if(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e))e+="Z";return Date.parse(e)},Dv={mediaPresentationDuration(e){return zf(e)},availabilityStartTime(e){return KD(e)/1000},minimumUpdatePeriod(e){return zf(e)},suggestedPresentationDelay(e){return zf(e)},type(e){return e},timeShiftBufferDepth(e){return zf(e)},start(e){return zf(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return WD(e)},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){let n=parseInt(e,10);if(isNaN(n))return zf(e);return n},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},qualityRanking(e){return parseInt(e,10)},qualityranking(e){return parseInt(e,10)},DEFAULT(e){return e}},$D={qualityranking:"qualityRanking"},us=(e)=>{if(!(e&&e.attributes))return{};return Mv(e.attributes).reduce((n,i)=>{let s=Dv[i.name]||Dv.DEFAULT,a=$D[i.name]||i.name;return n[a]=s(i.value),n},{})},YD={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},c1=(e,n)=>{if(!n.length)return e;return Gf(e.map(function(i){return n.map(function(s){let a=lp(s),r=qf(i.baseUrl,a),l=qs(us(s),{baseUrl:r});if(r!==a&&!l.serviceLocation&&i.serviceLocation)l.serviceLocation=i.serviceLocation;return l})}))},gy=(e)=>{let n=ki(e,"SegmentTemplate")[0],i=ki(e,"SegmentList")[0],s=i&&ki(i,"SegmentURL").map((y)=>qs({tag:"SegmentURL"},us(y))),a=ki(e,"SegmentBase")[0],r=i||n,l=r&&ki(r,"SegmentTimeline")[0],c=i||a||n,p=c&&ki(c,"Initialization")[0],m=n&&us(n);if(m&&p)m.initialization=p&&us(p);else if(m&&m.initialization)m.initialization={sourceURL:m.initialization};let g={template:m,segmentTimeline:l&&ki(l,"S").map((y)=>us(y)),list:i&&qs(us(i),{segmentUrls:s,initialization:us(p)}),base:a&&qs(us(a),{initialization:us(p)})};return Object.keys(g).forEach((y)=>{if(!g[y])delete g[y]}),g},QD=(e,n,i)=>(s)=>{let a=ki(s,"BaseURL"),r=c1(n,a),l=qs(e,us(s)),c=gy(s);return r.map((p)=>({segmentInfo:qs(i,c),attributes:qs(l,p)}))},JD=(e)=>e.reduce((n,i)=>{let s=us(i);if(s.schemeIdUri)s.schemeIdUri=s.schemeIdUri.toLowerCase();let a=YD[s.schemeIdUri];if(a){n[a]={attributes:s};let r=ki(i,"cenc:pssh")[0];if(r){let l=lp(r);n[a].pssh=l&&$0(l)}}return n},{}),ZD=(e)=>{if(e.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof e.value!=="string"?[]:e.value.split(";")).map((i)=>{let s,a;if(a=i,/^CC\d=/.test(i))[s,a]=i.split("=");else if(/^CC\d$/.test(i))s=i;return{channel:s,language:a}});else if(e.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof e.value!=="string"?[]:e.value.split(";")).map((i)=>{let s={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){let[a,r=""]=i.split("=");s.channel=a,s.language=i,r.split(",").forEach((l)=>{let[c,p]=l.split(":");if(c==="lang")s.language=p;else if(c==="er")s.easyReader=Number(p);else if(c==="war")s.aspectRatio=Number(p);else if(c==="3D")s["3D"]=Number(p)})}else s.language=i;if(s.channel)s.channel="SERVICE"+s.channel;return s})},eI=(e)=>Gf(ki(e.node,"EventStream").map((n)=>{let i=us(n),s=i.schemeIdUri;return ki(n,"Event").map((a)=>{let r=us(a),l=r.presentationTime||0,c=i.timescale||1,p=r.duration||0,m=l/c+e.attributes.start;return{schemeIdUri:s,value:i.value,id:r.id,start:m,end:m+p/c,messageData:lp(a)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),tI=(e,n,i)=>(s)=>{let a=us(s),r=c1(n,ki(s,"BaseURL")),l=ki(s,"Role")[0],c={role:us(l)},p=qs(e,a,c),m=ki(s,"Accessibility")[0],g=ZD(us(m));if(g)p=qs(p,{captionServices:g});let y=ki(s,"Label")[0];if(y&&y.childNodes.length){let X=y.childNodes[0].nodeValue.trim();p=qs(p,{label:X})}let x=JD(ki(s,"ContentProtection"));if(Object.keys(x).length)p=qs(p,{contentProtection:x});let I=gy(s),M=ki(s,"Representation"),H=qs(i,I);return Gf(M.map(QD(p,r,H)))},nI=(e,n)=>(i,s)=>{let a=c1(n,ki(i.node,"BaseURL")),r=qs(e,{periodStart:i.attributes.start});if(typeof i.attributes.duration==="number")r.periodDuration=i.attributes.duration;let l=ki(i.node,"AdaptationSet"),c=gy(i.node);return Gf(l.map(tI(r,a,c)))},iI=(e,n)=>{if(e.length>1)n({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"});if(!e.length)return null;let i=qs({serverURL:lp(e[0])},us(e[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},sI=({attributes:e,priorPeriodAttributes:n,mpdType:i})=>{if(typeof e.start==="number")return e.start;if(n&&typeof n.start==="number"&&typeof n.duration==="number")return n.start+n.duration;if(!n&&i==="static")return 0;return null},aI=(e,n={})=>{let{manifestUri:i="",NOW:s=Date.now(),clientOffset:a=0,eventHandler:r=function(){}}=n,l=ki(e,"Period");if(!l.length)throw Error(Vf.INVALID_NUMBER_OF_PERIOD);let c=ki(e,"Location"),p=us(e),m=c1([{baseUrl:i}],ki(e,"BaseURL")),g=ki(e,"ContentSteering");if(p.type=p.type||"static",p.sourceDuration=p.mediaPresentationDuration||0,p.NOW=s,p.clientOffset=a,c.length)p.locations=c.map(lp);let y=[];return l.forEach((x,I)=>{let M=us(x),H=y[I-1];M.start=sI({attributes:M,priorPeriodAttributes:H?H.attributes:null,mpdType:p.type}),y.push({node:x,attributes:M})}),{locations:p.locations,contentSteeringInfo:iI(g,r),representationInfo:Gf(y.map(nI(p,m))),eventStream:Gf(y.map(eI))}},Nv=(e)=>{if(e==="")throw Error(Vf.DASH_EMPTY_MANIFEST);let n=new fy,i,s;try{i=n.parseFromString(e,"application/xml"),s=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch(a){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw Error(Vf.DASH_INVALID_XML);return s},rI=(e)=>{let n=ki(e,"UTCTiming")[0];if(!n)return null;let i=us(n);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw Error(Vf.UNSUPPORTED_UTC_TIMING_SCHEME)}return i};var Pv=(e,n={})=>{let i=aI(Nv(e),n),s=XD(i.representationInfo);return ND({dashPlaylists:s,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:n.sidxMapping,previousManifest:n.previousManifest,eventStream:i.eventStream})},Bv=(e)=>rI(Nv(e));var $8=Ke(Vv());var cI=Xt([73,68,51]),uI=function(n,i){if(i===void 0)i=0;n=Xt(n);var s=n[i+5],a=n[i+6]<<21|n[i+7]<<14|n[i+8]<<7|n[i+9],r=(s&16)>>4;if(r)return a+20;return a+10},sh=function e(n,i){if(i===void 0)i=0;if(n=Xt(n),n.length-i<10||!$n(n,cI,{offset:i}))return i;return i+=uI(n,i),e(n,i)};var NU=new Uint8Array([79,112,117,115,72,101,97,100]);var Wv=function(n){if(typeof n==="string")return Yg(n);if(typeof n==="number")return n;return n},mI=function(n){if(!Array.isArray(n))return[Wv(n)];return n.map(function(i){return Wv(i)})},by,Kv=function(n){n=Xt(n);var i=[],s=0;while(n.length>s){var a=n[s],r=0,l=0;l++;var c=n[l];l++;while(c&128)r=(c&127)<<7,c=n[l],l++;r+=c&127;for(var p=0;p<by.length;p++){var m=by[p],{id:g,parser:y}=m;if(a===g){i.push(y(n.subarray(l,l+r)));break}}s+=r+l}return i};by=[{id:3,parser:function(n){var i={tag:3,id:n[0]<<8|n[1],flags:n[2],size:3,dependsOnEsId:0,ocrEsId:0,descriptors:[],url:""};if(i.flags&128)i.dependsOnEsId=n[i.size]<<8|n[i.size+1],i.size+=2;if(i.flags&64){var s=n[i.size];i.url=$w(n.subarray(i.size+1,i.size+1+s)),i.size+=s}if(i.flags&32)i.ocrEsId=n[i.size]<<8|n[i.size+1],i.size+=2;return i.descriptors=Kv(n.subarray(i.size))||[],i}},{id:4,parser:function(n){var i={tag:4,oti:n[0],streamType:n[1],bufferSize:n[2]<<16|n[3]<<8|n[4],maxBitrate:n[5]<<24|n[6]<<16|n[7]<<8|n[8],avgBitrate:n[9]<<24|n[10]<<16|n[11]<<8|n[12],descriptors:Kv(n.subarray(13))};return i}},{id:5,parser:function(n){return{tag:5,bytes:n}}},{id:6,parser:function(n){return{tag:6,bytes:n}}}];var $v=function e(n,i,s){if(s===void 0)s=!1;i=mI(i),n=Xt(n);var a=[];if(!i.length)return a;var r=0;while(r<n.length){var l=(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0,c=n.subarray(r+4,r+8);if(l===0)break;var p=r+l;if(p>n.length){if(s)break;p=n.length}var m=n.subarray(r+8,p);if($n(c,i[0]))if(i.length===1)a.push(m);else a.push.apply(a,e(m,i.slice(1),s));r=p}return a};var cp={EBML:Xt([26,69,223,163]),DocType:Xt([66,130]),Segment:Xt([24,83,128,103]),SegmentInfo:Xt([21,73,169,102]),Tracks:Xt([22,84,174,107]),Track:Xt([174]),TrackNumber:Xt([215]),DefaultDuration:Xt([35,227,131]),TrackEntry:Xt([174]),TrackType:Xt([131]),FlagDefault:Xt([136]),CodecID:Xt([134]),CodecPrivate:Xt([99,162]),VideoTrack:Xt([224]),AudioTrack:Xt([225]),Cluster:Xt([31,67,182,117]),Timestamp:Xt([231]),TimestampScale:Xt([42,215,177]),BlockGroup:Xt([160]),BlockDuration:Xt([155]),Block:Xt([161]),SimpleBlock:Xt([163])},wy=[128,64,32,16,8,4,2,1],gI=function(n){var i=1;for(var s=0;s<wy.length;s++){if(n&wy[s])break;i++}return i},u1=function(n,i,s,a){if(s===void 0)s=!0;if(a===void 0)a=!1;var r=gI(n[i]),l=n.subarray(i,i+r);if(s)l=Array.prototype.slice.call(n,i,i+r),l[0]^=wy[r-1];return{length:r,value:Kw(l,{signed:a}),bytes:l}},Yv=function e(n){if(typeof n==="string")return n.match(/.{1,2}/g).map(function(i){return e(i)});if(typeof n==="number")return E6(n);return n},bI=function(n){if(!Array.isArray(n))return[Yv(n)];return n.map(function(i){return Yv(i)})},wI=function e(n,i,s){if(s>=i.length)return i.length;var a=u1(i,s,!1);if($n(n.bytes,a.bytes))return s;var r=u1(i,s+a.length);return e(n,i,s+r.length+r.value+a.length)},yy=function e(n,i){i=bI(i),n=Xt(n);var s=[];if(!i.length)return s;var a=0;while(a<n.length){var r=u1(n,a,!1),l=u1(n,a+r.length),c=a+r.length+l.length;if(l.value===127){if(l.value=wI(r,n,c),l.value!==n.length)l.value-=c}var p=c+l.value>n.length?n.length:c+l.value,m=n.subarray(c,p);if($n(i[0],r.bytes))if(i.length===1)s.push(m);else s=s.concat(e(m,i.slice(1)));var g=r.length+l.length+m.length;a+=g}return s};var yI=Xt([0,0,0,1]),vI=Xt([0,0,1]),SI=Xt([0,0,3]),_I=function(n){var i=[],s=1;while(s<n.length-2){if($n(n.subarray(s,s+3),SI))i.push(s+2),s++;s++}if(i.length===0)return n;var a=n.length-i.length,r=new Uint8Array(a),l=0;for(s=0;s<a;l++,s++){if(l===i[0])l++,i.shift();r[s]=n[l]}return r},Qv=function(n,i,s,a){if(a===void 0)a=1/0;n=Xt(n),s=[].concat(s);var r=0,l,c=0;while(r<n.length&&(c<a||l)){var p=void 0;if($n(n.subarray(r),yI))p=4;else if($n(n.subarray(r),vI))p=3;if(!p){r++;continue}if(c++,l)return _I(n.subarray(l,r));var m=void 0;if(i==="h264")m=n[r+p]&31;else if(i==="h265")m=n[r+p]>>1&63;if(s.indexOf(m)!==-1)l=r+p;r+=p+(i==="h264"?1:2)}return n.subarray(0,0)},Jv=function(n,i,s){return Qv(n,"h264",i,s)},Zv=function(n,i,s){return Qv(n,"h265",i,s)};var ta={webm:Xt([119,101,98,109]),matroska:Xt([109,97,116,114,111,115,107,97]),flac:Xt([102,76,97,67]),ogg:Xt([79,103,103,83]),ac3:Xt([11,119]),riff:Xt([82,73,70,70]),avi:Xt([65,86,73]),wav:Xt([87,65,86,69]),"3gp":Xt([102,116,121,112,51,103]),mp4:Xt([102,116,121,112]),fmp4:Xt([115,116,121,112]),mov:Xt([102,116,121,112,113,116]),moov:Xt([109,111,111,118]),moof:Xt([109,111,111,102]),vtt:Xt([87,69,66,86,84,84])},Xf={aac:function(n){var i=sh(n);return $n(n,[255,16],{offset:i,mask:[255,22]})},mp3:function(n){var i=sh(n);return $n(n,[255,2],{offset:i,mask:[255,6]})},webm:function(n){var i=yy(n,[cp.EBML,cp.DocType])[0];return $n(i,ta.webm)},mkv:function(n){var i=yy(n,[cp.EBML,cp.DocType])[0];return $n(i,ta.matroska)},mp4:function(n){if(Xf["3gp"](n)||Xf.mov(n))return!1;if($n(n,ta.mp4,{offset:4})||$n(n,ta.fmp4,{offset:4}))return!0;if($n(n,ta.moof,{offset:4})||$n(n,ta.moov,{offset:4}))return!0},mov:function(n){return $n(n,ta.mov,{offset:4})},"3gp":function(n){return $n(n,ta["3gp"],{offset:4})},ac3:function(n){var i=sh(n);return $n(n,ta.ac3,{offset:i})},vtt:function(n){return $n(n,ta.vtt)},ts:function(n){if(n.length<189&&n.length>=1)return n[0]===71;var i=0;while(i+188<n.length&&i<188){if(n[i]===71&&n[i+188]===71)return!0;i+=1}return!1},flac:function(n){var i=sh(n);return $n(n,ta.flac,{offset:i})},ogg:function(n){return $n(n,ta.ogg)},avi:function(n){return $n(n,ta.riff)&&$n(n,ta.avi,{offset:8})},wav:function(n){return $n(n,ta.riff)&&$n(n,ta.wav,{offset:8})},h264:function(n){return Jv(n,7,3).length},h265:function(n){return Zv(n,[32,33],3).length}},vy=Object.keys(Xf).filter(function(e){return e!=="ts"&&e!=="h264"&&e!=="h265"}).concat(["ts","h264","h265"]);vy.forEach(function(e){var n=Xf[e];Xf[e]=function(i){return n(Xt(i))}});var xI=Xf,h1=function(n){n=Xt(n);for(var i=0;i<vy.length;i++){var s=vy[i];if(xI[s](n))return s}return""},e8=function(n){return $v(n,["moof"]).length>0};var Uc=Ke(a8()),Uy="8.24.0",Il={},Vc=function(e,n){if(Il[e]=Il[e]||[],n)Il[e]=Il[e].concat(n);return Il[e]},kI=function(e,n){Vc(e,n)},Y8=function(e,n){let i=Vc(e).indexOf(n);if(i<=-1)return!1;return Il[e]=Il[e].slice(),Il[e].splice(i,1),!0},TI=function(e,n){Vc(e,[].concat(n).map((i)=>{let s=(...a)=>(Y8(e,s),i(...a));return s}))},v1={prefixed:!0},b1=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],r8=b1[0],dp;for(let e=0;e<b1.length;e++)if(b1[e][1]in Et.default){dp=b1[e];break}if(dp){for(let e=0;e<dp.length;e++)v1[r8[e]]=dp[e];v1.prefixed=dp[0]!==r8[0]}var Na=[],AI=(e,n,i)=>(s,a,r)=>{let l=n.levels[a],c=new RegExp(`^(${l})$`),p=e;if(s!=="log")r.unshift(s.toUpperCase()+":");if(i)p=`%c${e}`,r.unshift(i);if(r.unshift(p+":"),Na){Na.push([].concat(r));let g=Na.length-1000;Na.splice(0,g>0?g:0)}if(!je.default.console)return;let m=je.default.console[s];if(!m&&s==="debug")m=je.default.console.info||je.default.console.log;if(!m||!l||!c.test(s))return;m[Array.isArray(r)?"apply":"call"](je.default.console,r)};function zy(e,n=":",i=""){let s="info",a;function r(...l){a("log",s,l)}return a=AI(e,r,i),r.createLogger=(l,c,p)=>{let m=c!==void 0?c:n,g=p!==void 0?p:i,y=`${e} ${m} ${l}`;return zy(y,m,g)},r.createNewLogger=(l,c,p)=>zy(l,c,p),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},r.level=(l)=>{if(typeof l==="string"){if(!r.levels.hasOwnProperty(l))throw Error(`"${l}" in not a valid log level`);s=l}return s},r.history=()=>Na?[].concat(Na):[],r.history.filter=(l)=>(Na||[]).filter((c)=>new RegExp(`.*${l}.*`).test(c[0])),r.history.clear=()=>{if(Na)Na.length=0},r.history.disable=()=>{if(Na!==null)Na.length=0,Na=null},r.history.enable=()=>{if(Na===null)Na=[]},r.error=(...l)=>a("error",s,l),r.warn=(...l)=>a("warn",s,l),r.debug=(...l)=>a("debug",s,l),r}var Cn=zy("VIDEOJS"),Q8=Cn.createLogger,CI=Object.prototype.toString,J8=function(e){return Bo(e)?Object.keys(e):[]};function Jf(e,n){J8(e).forEach((i)=>n(e[i],i))}function Z8(e,n,i=0){return J8(e).reduce((s,a)=>n(s,e[a],a),i)}function Bo(e){return!!e&&typeof e==="object"}function rd(e){return Bo(e)&&CI.call(e)==="[object Object]"&&e.constructor===Object}function li(...e){let n={};return e.forEach((i)=>{if(!i)return;Jf(i,(s,a)=>{if(!rd(s)){n[a]=s;return}if(!rd(n[a]))n[a]={};n[a]=li(n[a],s)})}),n}function e7(e={}){let n=[];for(let i in e)if(e.hasOwnProperty(i)){let s=e[i];n.push(s)}return n}function H1(e,n,i,s=!0){let a=(l)=>Object.defineProperty(e,n,{value:l,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){let l=i();return a(l),l}};if(s)r.set=a;return Object.defineProperty(e,n,r)}var jI=Object.freeze({__proto__:null,each:Jf,reduce:Z8,isObject:Bo,isPlain:rd,merge:li,values:e7,defineLazyProperty:H1}),p5=!1,t7=null,io=!1,n7,i7=!1,zc=!1,Zf=!1,Lo=!1,m5=null,U1=null,EI=Boolean(je.default.cast&&je.default.cast.framework&&je.default.cast.framework.CastReceiverContext),s7=null,S1=!1,z1=!1,_1=!1,G1=!1,x1=!1,k1=!1,T1=!1,_p=Boolean(hd()&&(("ontouchstart"in je.default)||je.default.navigator.maxTouchPoints||je.default.DocumentTouch&&je.default.document instanceof je.default.DocumentTouch)),Oc=je.default.navigator&&je.default.navigator.userAgentData;if(Oc&&Oc.platform&&Oc.brands)io=Oc.platform==="Android",zc=Boolean(Oc.brands.find((e)=>e.brand==="Microsoft Edge")),Zf=Boolean(Oc.brands.find((e)=>e.brand==="Chromium")),Lo=!zc&&Zf,m5=U1=(Oc.brands.find((e)=>e.brand==="Chromium")||{}).version||null,z1=Oc.platform==="Windows";if(!Zf){let e=je.default.navigator&&je.default.navigator.userAgent||"";p5=/iPod/i.test(e),t7=function(){let n=e.match(/OS (\d+)_/i);if(n&&n[1])return n[1];return null}(),io=/Android/i.test(e),n7=function(){let n=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!n)return null;let i=n[1]&&parseFloat(n[1]),s=n[2]&&parseFloat(n[2]);if(i&&s)return parseFloat(n[1]+"."+n[2]);else if(i)return i;return null}(),i7=/Firefox/i.test(e),zc=/Edg/i.test(e),Zf=/Chrome/i.test(e)||/CriOS/i.test(e),Lo=!zc&&Zf,m5=U1=function(){let n=e.match(/(Chrome|CriOS)\/(\d+)/);if(n&&n[2])return parseFloat(n[2]);return null}(),s7=function(){let n=/MSIE\s(\d+)\.\d/.exec(e),i=n&&parseFloat(n[1]);if(!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e))i=11;return i}(),x1=/Tizen/i.test(e),k1=/Web0S/i.test(e),T1=x1||k1,S1=/Safari/i.test(e)&&!Lo&&!io&&!zc&&!T1,z1=/Windows/i.test(e),_1=/iPad/i.test(e)||S1&&_p&&!/iPhone/i.test(e),G1=/iPhone/i.test(e)&&!_1}var na=G1||_1||p5,V1=(S1||na)&&!Lo,a7=Object.freeze({__proto__:null,get IS_IPOD(){return p5},get IOS_VERSION(){return t7},get IS_ANDROID(){return io},get ANDROID_VERSION(){return n7},get IS_FIREFOX(){return i7},get IS_EDGE(){return zc},get IS_CHROMIUM(){return Zf},get IS_CHROME(){return Lo},get CHROMIUM_VERSION(){return m5},get CHROME_VERSION(){return U1},IS_CHROMECAST_RECEIVER:EI,get IE_VERSION(){return s7},get IS_SAFARI(){return S1},get IS_WINDOWS(){return z1},get IS_IPAD(){return _1},get IS_IPHONE(){return G1},get IS_TIZEN(){return x1},get IS_WEBOS(){return k1},get IS_SMART_TV(){return T1},TOUCH_ENABLED:_p,IS_IOS:na,IS_ANY_SAFARI:V1});function o8(e){return typeof e==="string"&&Boolean(e.trim())}function qI(e){if(e.indexOf(" ")>=0)throw Error("class has illegal whitespace characters")}function hd(){return Et.default===je.default.document}function fd(e){return Bo(e)&&e.nodeType===1}function r7(){try{return je.default.parent!==je.default.self}catch(e){return!0}}function o7(e){return function(n,i){if(!o8(n))return Et.default[e](null);if(o8(i))i=Et.default.querySelector(i);let s=fd(i)?i:Et.default;return s[e]&&s[e](n)}}function on(e="div",n={},i={},s){let a=Et.default.createElement(e);if(Object.getOwnPropertyNames(n).forEach(function(r){let l=n[r];if(r==="textContent")Kc(a,l);else if(a[r]!==l||r==="tabIndex")a[r]=l}),Object.getOwnPropertyNames(i).forEach(function(r){a.setAttribute(r,i[r])}),s)g5(a,s);return a}function Kc(e,n){if(typeof e.textContent>"u")e.innerText=n;else e.textContent=n;return e}function Gy(e,n){if(n.firstChild)n.insertBefore(e,n.firstChild);else n.appendChild(e)}function bp(e,n){return qI(n),e.classList.contains(n)}function uh(e,...n){return e.classList.add(...n.reduce((i,s)=>i.concat(s.split(/\s+/)),[])),e}function X1(e,...n){if(!e)return Cn.warn("removeClass was called with an element that doesn't exist"),null;return e.classList.remove(...n.reduce((i,s)=>i.concat(s.split(/\s+/)),[])),e}function l7(e,n,i){if(typeof i==="function")i=i(e,n);if(typeof i!=="boolean")i=void 0;return n.split(/\s+/).forEach((s)=>e.classList.toggle(s,i)),e}function c7(e,n){Object.getOwnPropertyNames(n).forEach(function(i){let s=n[i];if(s===null||typeof s>"u"||s===!1)e.removeAttribute(i);else e.setAttribute(i,s===!0?"":s)})}function Nc(e){let n={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){let s=e.attributes;for(let a=s.length-1;a>=0;a--){let r=s[a].name,l=s[a].value;if(i.includes(r))l=l!==null?!0:!1;n[r]=l}}return n}function u7(e,n){return e.getAttribute(n)}function od(e,n,i){e.setAttribute(n,i)}function W1(e,n){e.removeAttribute(n)}function h7(){Et.default.body.focus(),Et.default.onselectstart=function(){return!1}}function f7(){Et.default.onselectstart=function(){return!0}}function ld(e){if(e&&e.getBoundingClientRect&&e.parentNode){let n=e.getBoundingClientRect(),i={};if(["bottom","height","left","right","top","width"].forEach((s)=>{if(n[s]!==void 0)i[s]=n[s]}),!i.height)i.height=parseFloat(cd(e,"height"));if(!i.width)i.width=parseFloat(cd(e,"width"));return i}}function xp(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};let n=e.offsetWidth,i=e.offsetHeight,s=0,a=0;while(e.offsetParent&&e!==Et.default[v1.fullscreenElement])s+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return{left:s,top:a,width:n,height:i}}function K1(e,n){let i={x:0,y:0};if(na){let g=e;while(g&&g.nodeName.toLowerCase()!=="html"){let y=cd(g,"transform");if(/^matrix/.test(y)){let x=y.slice(7,-1).split(/,\s/).map(Number);i.x+=x[4],i.y+=x[5]}else if(/^matrix3d/.test(y)){let x=y.slice(9,-1).split(/,\s/).map(Number);i.x+=x[12],i.y+=x[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&je.default.WebKitCSSMatrix){let x=je.default.getComputedStyle(g.assignedSlot.parentElement).transform,I=new je.default.WebKitCSSMatrix(x);i.x+=I.m41,i.y+=I.m42}g=g.parentNode||g.host}}let s={},a=xp(n.target),r=xp(e),{width:l,height:c}=r,p=n.offsetY-(r.top-a.top),m=n.offsetX-(r.left-a.left);if(n.changedTouches){if(m=n.changedTouches[0].pageX-r.left,p=n.changedTouches[0].pageY+r.top,na)m-=i.x,p-=i.y}return s.y=1-Math.max(0,Math.min(1,p/c)),s.x=Math.max(0,Math.min(1,m/l)),s}function d7(e){return Bo(e)&&e.nodeType===3}function $1(e){while(e.firstChild)e.removeChild(e.firstChild);return e}function p7(e){if(typeof e==="function")e=e();return(Array.isArray(e)?e:[e]).map((n)=>{if(typeof n==="function")n=n();if(fd(n)||d7(n))return n;if(typeof n==="string"&&/\S/.test(n))return Et.default.createTextNode(n)}).filter((n)=>n)}function g5(e,n){return p7(n).forEach((i)=>e.appendChild(i)),e}function m7(e,n){return g5($1(e),n)}function kp(e){if(e.button===void 0&&e.buttons===void 0)return!0;if(e.button===0&&e.buttons===void 0)return!0;if(e.type==="mouseup"&&e.button===0&&e.buttons===0)return!0;if(e.type==="mousedown"&&e.button===0&&e.buttons===0)return!0;if(e.button!==0||e.buttons!==1)return!1;return!0}var Xc=o7("querySelector"),g7=o7("querySelectorAll");function cd(e,n){if(!e||!n)return"";if(typeof je.default.getComputedStyle==="function"){let i;try{i=je.default.getComputedStyle(e)}catch(s){return""}return i?i.getPropertyValue(n)||i[n]:""}return""}function b7(e){[...Et.default.styleSheets].forEach((n)=>{try{let i=[...n.cssRules].map((a)=>a.cssText).join(""),s=Et.default.createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(i){let s=Et.default.createElement("link");s.rel="stylesheet",s.type=n.type,s.media=n.media.mediaText,s.href=n.href,e.document.head.appendChild(s)}})}var w7=Object.freeze({__proto__:null,isReal:hd,isEl:fd,isInFrame:r7,createEl:on,textContent:Kc,prependTo:Gy,hasClass:bp,addClass:uh,removeClass:X1,toggleClass:l7,setAttributes:c7,getAttributes:Nc,getAttribute:u7,setAttribute:od,removeAttribute:W1,blockTextSelection:h7,unblockTextSelection:f7,getBoundingClientRect:ld,findPosition:xp,getPointerPosition:K1,isTextNode:d7,emptyEl:$1,normalizeContent:p7,appendContent:g5,insertContent:m7,isSingleLeftClick:kp,$:Xc,$$:g7,computedStyle:cd,copyStyleSheetsToWindow:b7}),y7=!1,Vy,DI=function(){if(Vy.options.autoSetup===!1)return;let e=Array.prototype.slice.call(Et.default.getElementsByTagName("video")),n=Array.prototype.slice.call(Et.default.getElementsByTagName("audio")),i=Array.prototype.slice.call(Et.default.getElementsByTagName("video-js")),s=e.concat(n,i);if(s&&s.length>0)for(let a=0,r=s.length;a<r;a++){let l=s[a];if(l&&l.getAttribute){if(l.player===void 0){if(l.getAttribute("data-setup")!==null)Vy(l)}}else{Xy(1);break}}else if(!y7)Xy(1)};function Xy(e,n){if(!hd())return;if(n)Vy=n;je.default.setTimeout(DI,e)}function Wy(){y7=!0,je.default.removeEventListener("load",Wy)}if(hd())if(Et.default.readyState==="complete")Wy();else je.default.addEventListener("load",Wy);var v7=function(e){let n=Et.default.createElement("style");return n.className=e,n},S7=function(e,n){if(e.styleSheet)e.styleSheet.cssText=n;else e.textContent=n},va=new WeakMap,II=3,MI=II;function Mr(){return MI++}function l8(e,n){if(!va.has(e))return;let i=va.get(e);if(i.handlers[n].length===0){if(delete i.handlers[n],e.removeEventListener)e.removeEventListener(n,i.dispatcher,!1);else if(e.detachEvent)e.detachEvent("on"+n,i.dispatcher)}if(Object.getOwnPropertyNames(i.handlers).length<=0)delete i.handlers,delete i.dispatcher,delete i.disabled;if(Object.getOwnPropertyNames(i).length===0)va.delete(e)}function b5(e,n,i,s){i.forEach(function(a){e(n,a,s)})}function Y1(e){if(e.fixed_)return e;function n(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){let s=e||je.default.event;e={};let a=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(let r in s)if(!a.includes(r)){if(!(r==="returnValue"&&s.preventDefault))e[r]=s[r]}if(!e.target)e.target=e.srcElement||Et.default;if(!e.relatedTarget)e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement;if(e.preventDefault=function(){if(s.preventDefault)s.preventDefault();e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){if(s.stopPropagation)s.stopPropagation();e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=n},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){if(s.stopImmediatePropagation)s.stopImmediatePropagation();e.isImmediatePropagationStopped=n,e.stopPropagation()},e.isImmediatePropagationStopped=i,e.clientX!==null&&e.clientX!==void 0){let r=Et.default.documentElement,l=Et.default.body;e.pageX=e.clientX+(r&&r.scrollLeft||l&&l.scrollLeft||0)-(r&&r.clientLeft||l&&l.clientLeft||0),e.pageY=e.clientY+(r&&r.scrollTop||l&&l.scrollTop||0)-(r&&r.clientTop||l&&l.clientTop||0)}if(e.which=e.charCode||e.keyCode,e.button!==null&&e.button!==void 0)e.button=e.button&1?0:e.button&4?1:e.button&2?2:0}return e.fixed_=!0,e}var d1,RI=function(){if(typeof d1!=="boolean"){d1=!1;try{let e=Object.defineProperty({},"passive",{get(){d1=!0}});je.default.addEventListener("test",null,e),je.default.removeEventListener("test",null,e)}catch(e){}}return d1},OI=["touchstart","touchmove"];function lr(e,n,i){if(Array.isArray(n))return b5(lr,e,n,i);if(!va.has(e))va.set(e,{});let s=va.get(e);if(!s.handlers)s.handlers={};if(!s.handlers[n])s.handlers[n]=[];if(!i.guid)i.guid=Mr();if(s.handlers[n].push(i),!s.dispatcher)s.disabled=!1,s.dispatcher=function(a,r){if(s.disabled)return;a=Y1(a);let l=s.handlers[a.type];if(l){let c=l.slice(0);for(let p=0,m=c.length;p<m;p++)if(a.isImmediatePropagationStopped())break;else try{c[p].call(e,a,r)}catch(g){Cn.error(g)}}};if(s.handlers[n].length===1){if(e.addEventListener){let a=!1;if(RI()&&OI.indexOf(n)>-1)a={passive:!0};e.addEventListener(n,s.dispatcher,a)}else if(e.attachEvent)e.attachEvent("on"+n,s.dispatcher)}}function ia(e,n,i){if(!va.has(e))return;let s=va.get(e);if(!s.handlers)return;if(Array.isArray(n))return b5(ia,e,n,i);let a=function(l,c){s.handlers[c]=[],l8(l,c)};if(n===void 0){for(let l in s.handlers)if(Object.prototype.hasOwnProperty.call(s.handlers||{},l))a(e,l);return}let r=s.handlers[n];if(!r)return;if(!i){a(e,n);return}if(i.guid){for(let l=0;l<r.length;l++)if(r[l].guid===i.guid)r.splice(l--,1)}l8(e,n)}function dd(e,n,i){let s=va.has(e)?va.get(e):{},a=e.parentNode||e.ownerDocument;if(typeof n==="string")n={type:n,target:e};else if(!n.target)n.target=e;if(n=Y1(n),s.dispatcher)s.dispatcher.call(e,n,i);if(a&&!n.isPropagationStopped()&&n.bubbles===!0)dd.call(null,a,n,i);else if(!a&&!n.defaultPrevented&&n.target&&n.target[n.type]){if(!va.has(n.target))va.set(n.target,{});let r=va.get(n.target);if(n.target[n.type]){if(r.disabled=!0,typeof n.target[n.type]==="function")n.target[n.type]();r.disabled=!1}}return!n.defaultPrevented}function Q1(e,n,i){if(Array.isArray(n))return b5(Q1,e,n,i);let s=function(){ia(e,n,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Mr(),lr(e,n,s)}function w5(e,n,i){let s=function(){ia(e,n,s),i.apply(this,arguments)};s.guid=i.guid=i.guid||Mr(),lr(e,n,s)}var FI=Object.freeze({__proto__:null,fixEvent:Y1,on:lr,off:ia,trigger:dd,one:Q1,any:w5}),Or=30,di=function(e,n,i){if(!n.guid)n.guid=Mr();let s=n.bind(e);return s.guid=i?i+"_"+n.guid:n.guid,s},Ho=function(e,n){let i=je.default.performance.now();return function(...a){let r=je.default.performance.now();if(r-i>=n)e(...a),i=r}},_7=function(e,n,i,s=je.default){let a,r=()=>{s.clearTimeout(a),a=null},l=function(){let c=this,p=arguments,m=function(){if(a=null,m=null,!i)e.apply(c,p)};if(!a&&i)e.apply(c,p);s.clearTimeout(a),a=s.setTimeout(m,n)};return l.cancel=r,l},NI=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Or,bind_:di,throttle:Ho,debounce:_7}),up;class Ha{on(e,n){let i=this.addEventListener;this.addEventListener=()=>{},lr(this,e,n),this.addEventListener=i}off(e,n){ia(this,e,n)}one(e,n){let i=this.addEventListener;this.addEventListener=()=>{},Q1(this,e,n),this.addEventListener=i}any(e,n){let i=this.addEventListener;this.addEventListener=()=>{},w5(this,e,n),this.addEventListener=i}trigger(e){let n=e.type||e;if(typeof e==="string")e={type:n};if(e=Y1(e),this.allowedEvents_[n]&&this["on"+n])this["on"+n](e);dd(this,e)}queueTrigger(e){if(!up)up=new Map;let n=e.type||e,i=up.get(this);if(!i)i=new Map,up.set(this,i);let s=i.get(n);i.delete(n),je.default.clearTimeout(s);let a=je.default.setTimeout(()=>{if(i.delete(n),i.size===0)i=null,up.delete(this);this.trigger(e)},0);i.set(n,a)}}Ha.prototype.allowedEvents_={};Ha.prototype.addEventListener=Ha.prototype.on;Ha.prototype.removeEventListener=Ha.prototype.off;Ha.prototype.dispatchEvent=Ha.prototype.trigger;var J1=(e)=>{if(typeof e.name==="function")return e.name();if(typeof e.name==="string")return e.name;if(e.name_)return e.name_;if(e.constructor&&e.constructor.name)return e.constructor.name;return typeof e},Rl=(e)=>e instanceof Ha||!!e.eventBusEl_&&["on","one","off","trigger"].every((n)=>typeof e[n]==="function"),PI=(e,n)=>{if(Rl(e))n();else{if(!e.eventedCallbacks)e.eventedCallbacks=[];e.eventedCallbacks.push(n)}},Ky=(e)=>typeof e==="string"&&/\S/.test(e)||Array.isArray(e)&&!!e.length,A1=(e,n,i)=>{if(!e||!e.nodeName&&!Rl(e))throw Error(`Invalid target for ${J1(n)}#${i}; must be a DOM node or evented object.`)},x7=(e,n,i)=>{if(!Ky(e))throw Error(`Invalid event type for ${J1(n)}#${i}; must be a non-empty string or array.`)},k7=(e,n,i)=>{if(typeof e!=="function")throw Error(`Invalid listener for ${J1(n)}#${i}; must be a function.`)},Ty=(e,n,i)=>{let s=n.length<3||n[0]===e||n[0]===e.eventBusEl_,a,r,l;if(s){if(a=e.eventBusEl_,n.length>=3)n.shift();[r,l]=n}else a=n[0],r=n[1],l=n[2];return A1(a,e,i),x7(r,e,i),k7(l,e,i),l=di(e,l),{isTargetingSelf:s,target:a,type:r,listener:l}},ah=(e,n,i,s)=>{if(A1(e,e,n),e.nodeName)FI[n](e,i,s);else e[n](i,s)},BI={on(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ty(this,e,"on");if(ah(i,"on",s,a),!n){let r=()=>this.off(i,s,a);r.guid=a.guid;let l=()=>this.off("dispose",r);l.guid=a.guid,ah(this,"on","dispose",r),ah(i,"on","dispose",l)}},one(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ty(this,e,"one");if(n)ah(i,"one",s,a);else{let r=(...l)=>{this.off(i,s,r),a.apply(null,l)};r.guid=a.guid,ah(i,"one",s,r)}},any(...e){let{isTargetingSelf:n,target:i,type:s,listener:a}=Ty(this,e,"any");if(n)ah(i,"any",s,a);else{let r=(...l)=>{this.off(i,s,r),a.apply(null,l)};r.guid=a.guid,ah(i,"any",s,r)}},off(e,n,i){if(!e||Ky(e))ia(this.eventBusEl_,e,n);else{let s=e,a=n;if(A1(s,this,"off"),x7(a,this,"off"),k7(i,this,"off"),i=di(this,i),this.off("dispose",i),s.nodeName)ia(s,a,i),ia(s,"dispose",i);else if(Rl(s))s.off(a,i),s.off("dispose",i)}},trigger(e,n){A1(this.eventBusEl_,this,"trigger");let i=e&&typeof e!=="string"?e.type:e;if(!Ky(i))throw Error(`Invalid event type for ${J1(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return dd(this.eventBusEl_,e,n)}};function y5(e,n={}){let{eventBusKey:i}=n;if(i){if(!e[i].nodeName)throw Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=on("span",{className:"vjs-event-bus"});if(Object.assign(e,BI),e.eventedCallbacks)e.eventedCallbacks.forEach((s)=>{s()});return e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(s){if(s&&va.has(s))va.delete(s)}),je.default.setTimeout(()=>{e.eventBusEl_=null},0)}),e}var LI={state:{},setState(e){if(typeof e==="function")e=e();let n;if(Jf(e,(i,s)=>{if(this.state[s]!==i)n=n||{},n[s]={from:this.state[s],to:i};this.state[s]=i}),n&&Rl(this))this.trigger({changes:n,type:"statechanged"});return n}};function T7(e,n){if(Object.assign(e,LI),e.state=Object.assign({},e.state,n),typeof e.handleStateChanged==="function"&&Rl(e))e.on("statechanged",e.handleStateChanged);return e}var wp=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toLowerCase())},Vi=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toUpperCase())},A7=function(e,n){return Vi(e)===Vi(n)},HI=Object.freeze({__proto__:null,toLowerCase:wp,toTitleCase:Vi,titleCaseEquals:A7});class dt{constructor(e,n,i){if(!e&&this.play)this.player_=e=this;else this.player_=e;if(this.isDisposed_=!1,this.parentComponent_=null,this.options_=li({},this.options_),n=this.options_=li(this.options_,n),this.id_=n.id||n.el&&n.el.id,!this.id_){let s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Mr()}`}if(this.name_=n.name||null,n.el)this.el_=n.el;else if(n.createEl!==!1)this.el_=this.createEl();if(n.className&&this.el_)n.className.split(" ").forEach((s)=>this.addClass(s));if(["on","off","one","any","trigger"].forEach((s)=>{this[s]=void 0}),n.evented!==!1)y5(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange);if(T7(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,n.initChildren!==!1)this.initChildren();if(this.ready(i),n.reportTouchActivity!==!1)this.enableTouchActivity()}dispose(e={}){if(this.isDisposed_)return;if(this.readyQueue_)this.readyQueue_.length=0;if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_){for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n].dispose)this.children_[n].dispose()}if(this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_){if(this.el_.parentNode)if(e.restoreEl)this.el_.parentNode.replaceChild(e.restoreEl,this.el_);else this.el_.parentNode.removeChild(this.el_);this.el_=null}this.player_=null}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){if(!e)return this.options_;return this.options_=li(this.options_,e),this.options_}el(){return this.el_}createEl(e,n,i){return on(e,n,i)}localize(e,n,i=e){let s=this.player_.language&&this.player_.language(),a=this.player_.languages&&this.player_.languages(),r=a&&a[s],l=s&&s.split("-")[0],c=a&&a[l],p=i;if(r&&r[e])p=r[e];else if(c&&c[e])p=c[e];if(n)p=p.replace(/\{(\d+)\}/g,function(m,g){let y=n[g-1],x=y;if(typeof y>"u")x=m;return x});return p}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(!e)return;return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,s)=>i.concat(s),[]);let n=this;for(let i=0;i<e.length;i++)if(n=n.getChild(e[i]),!n||!n.getChild)return;return n}setIcon(e,n=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;let i="http://www.w3.org/2000/svg",s=on("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),a=Et.default.createElementNS(i,"svg");a.setAttributeNS(null,"viewBox","0 0 512 512");let r=Et.default.createElementNS(i,"use");if(a.appendChild(r),r.setAttributeNS(null,"href",`#vjs-icon-${e}`),s.appendChild(a),this.iconIsSet_)n.replaceChild(s,n.querySelector(".vjs-icon-placeholder"));else n.appendChild(s);return this.iconIsSet_=!0,s}addChild(e,n={},i=this.children_.length){let s,a;if(typeof e==="string"){a=Vi(e);let r=n.componentClass||a;n.name=a;let l=dt.getComponent(r);if(!l)throw Error(`Component ${r} does not exist`);if(typeof l!=="function")return null;s=new l(this.player_||this,n)}else s=e;if(s.parentComponent_)s.parentComponent_.removeChild(s);if(this.children_.splice(i,0,s),s.parentComponent_=this,typeof s.id==="function")this.childIndex_[s.id()]=s;if(a=a||s.name&&Vi(s.name()),a)this.childNameIndex_[a]=s,this.childNameIndex_[wp(a)]=s;if(typeof s.el==="function"&&s.el()){let r=null;if(this.children_[i+1]){if(this.children_[i+1].el_)r=this.children_[i+1].el_;else if(fd(this.children_[i+1]))r=this.children_[i+1]}this.contentEl().insertBefore(s.el(),r)}return s}removeChild(e){if(typeof e==="string")e=this.getChild(e);if(!e||!this.children_)return;let n=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){n=!0,this.children_.splice(s,1);break}if(!n)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Vi(e.name())]=null,this.childNameIndex_[wp(e.name())]=null;let i=e.el();if(i&&i.parentNode===this.contentEl())this.contentEl().removeChild(e.el())}initChildren(){let e=this.options_.children;if(e){let n=this.options_,i=(r)=>{let{name:l,opts:c}=r;if(n[l]!==void 0)c=n[l];if(c===!1)return;if(c===!0)c={};c.playerOptions=this.options_.playerOptions;let p=this.addChild(l,c);if(p)this[l]=p},s,a=dt.getComponent("Tech");if(Array.isArray(e))s=e;else s=Object.keys(e);s.concat(Object.keys(this.options_).filter(function(r){return!s.some(function(l){if(typeof l==="string")return r===l;return r===l.name})})).map((r)=>{let l,c;if(typeof r==="string")l=r,c=e[l]||this.options_[l]||{};else l=r.name,c=r;return{name:l,opts:c}}).filter((r)=>{let l=dt.getComponent(r.opts.componentClass||Vi(r.name));return l&&!a.isTech(l)}).forEach(i)}}buildCSSClass(){return""}ready(e,n=!1){if(!e)return;if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}if(n)e.call(this);else this.setTimeout(e,1)}triggerReady(){this.isReady_=!0,this.setTimeout(function(){let e=this.readyQueue_;if(this.readyQueue_=[],e&&e.length>0)e.forEach(function(n){n.call(this)},this);this.trigger("ready")},1)}$(e,n){return Xc(e,n||this.contentEl())}$$(e,n){return g7(e,n||this.contentEl())}hasClass(e){return bp(this.el_,e)}addClass(...e){uh(this.el_,...e)}removeClass(...e){X1(this.el_,...e)}toggleClass(e,n){l7(this.el_,e,n)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return u7(this.el_,e)}setAttribute(e,n){od(this.el_,e,n)}removeAttribute(e){W1(this.el_,e)}width(e,n){return this.dimension("width",e,n)}height(e,n){return this.dimension("height",e,n)}dimensions(e,n){this.width(e,!0),this.height(n)}dimension(e,n,i){if(n!==void 0){if(n===null||n!==n)n=0;if((""+n).indexOf("%")!==-1||(""+n).indexOf("px")!==-1)this.el_.style[e]=n;else if(n==="auto")this.el_.style[e]="";else this.el_.style[e]=n+"px";if(!i)this.trigger("componentresize");return}if(!this.el_)return 0;let s=this.el_.style[e],a=s.indexOf("px");if(a!==-1)return parseInt(s.slice(0,a),10);return parseInt(this.el_["offset"+Vi(e)],10)}currentDimension(e){let n=0;if(e!=="width"&&e!=="height")throw Error("currentDimension only accepts width or height value");if(n=cd(this.el_,e),n=parseFloat(n),n===0||isNaN(n)){let i=`offset${Vi(e)}`;n=this.el_[i]}return n}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){let e=this.el_.getBoundingClientRect(),n={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:n,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){if(this.player_){if(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))e.stopPropagation();this.player_.handleKeyDown(e)}}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,n=null,i=10,s=200,a;this.on("touchstart",function(l){if(l.touches.length===1)n={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=je.default.performance.now(),a=!0}),this.on("touchmove",function(l){if(l.touches.length>1)a=!1;else if(n){let c=l.touches[0].pageX-n.pageX,p=l.touches[0].pageY-n.pageY;if(Math.sqrt(c*c+p*p)>i)a=!1}});let r=function(){a=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(l){if(n=null,a===!0){if(je.default.performance.now()-e<s)l.preventDefault(),this.trigger("tap")}})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;let e=di(this.player(),this.player().reportUserActivity),n;this.on("touchstart",function(){e(),this.clearInterval(n),n=this.setInterval(e,250)});let i=function(s){e(),this.clearInterval(n)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,n){var i;return e=di(this,e),this.clearTimersOnDispose_(),i=je.default.setTimeout(()=>{if(this.setTimeoutIds_.has(i))this.setTimeoutIds_.delete(i);e()},n),this.setTimeoutIds_.add(i),i}clearTimeout(e){if(this.setTimeoutIds_.has(e))this.setTimeoutIds_.delete(e),je.default.clearTimeout(e);return e}setInterval(e,n){e=di(this,e),this.clearTimersOnDispose_();let i=je.default.setInterval(e,n);return this.setIntervalIds_.add(i),i}clearInterval(e){if(this.setIntervalIds_.has(e))this.setIntervalIds_.delete(e),je.default.clearInterval(e);return e}requestAnimationFrame(e){this.clearTimersOnDispose_();var n;return e=di(this,e),n=je.default.requestAnimationFrame(()=>{if(this.rafIds_.has(n))this.rafIds_.delete(n);e()}),this.rafIds_.add(n),n}requestNamedAnimationFrame(e,n){if(this.namedRafs_.has(e))this.cancelNamedAnimationFrame(e);this.clearTimersOnDispose_(),n=di(this,n);let i=this.requestAnimationFrame(()=>{if(n(),this.namedRafs_.has(e))this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){if(!this.namedRafs_.has(e))return;this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e)}cancelAnimationFrame(e){if(this.rafIds_.has(e))this.rafIds_.delete(e),je.default.cancelAnimationFrame(e);return e}clearTimersOnDispose_(){if(this.clearingTimersOnDispose_)return;this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,n])=>{this[e].forEach((i,s)=>this[n](s))}),this.clearingTimersOnDispose_=!1})}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function n(a){let r=je.default.getComputedStyle(a,null),l=r.getPropertyValue("visibility");return r.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function i(a){if(!n(a.parentElement))return!1;if(!n(a)||a.style.opacity==="0"||je.default.getComputedStyle(a).height==="0px"||je.default.getComputedStyle(a).width==="0px")return!1;return!0}function s(a){if(a.offsetWidth+a.offsetHeight+a.getBoundingClientRect().height+a.getBoundingClientRect().width===0)return!1;let r={x:a.getBoundingClientRect().left+a.offsetWidth/2,y:a.getBoundingClientRect().top+a.offsetHeight/2};if(r.x<0)return!1;if(r.x>(Et.default.documentElement.clientWidth||je.default.innerWidth))return!1;if(r.y<0)return!1;if(r.y>(Et.default.documentElement.clientHeight||je.default.innerHeight))return!1;let l=Et.default.elementFromPoint(r.x,r.y);while(l){if(l===a)return!0;if(l.parentNode)l=l.parentNode;else return!1}}if(!e)e=this.el();if(s(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))return!0;return!1}static registerComponent(e,n){if(typeof e!=="string"||!e)throw Error(`Illegal component name, "${e}"; must be a non-empty string.`);let i=dt.getComponent("Tech"),s=i&&i.isTech(n),a=dt===n||dt.prototype.isPrototypeOf(n.prototype);if(s||!a){let l;if(s)l="techs must be registered using Tech.registerTech()";else l="must be a Component subclass";throw Error(`Illegal component, "${e}"; ${l}.`)}if(e=Vi(e),!dt.components_)dt.components_={};let r=dt.getComponent("Player");if(e==="Player"&&r&&r.players){let l=r.players,c=Object.keys(l);if(l&&c.length>0){for(let p=0;p<c.length;p++)if(l[c[p]]!==null)throw Error("Can not register Player component after player has been created.")}}return dt.components_[e]=n,dt.components_[wp(e)]=n,n}static getComponent(e){if(!e||!dt.components_)return;return dt.components_[e]}}dt.registerComponent("Component",dt);function UI(e,n,i){if(typeof n!=="number"||n<0||n>i)throw Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${n}) is non-numeric or out of bounds (0-${i}).`)}function c8(e,n,i,s){return UI(e,s,i.length-1),i[s][n]}function Ay(e){let n;if(e===void 0||e.length===0)n={length:0,start(){throw Error("This TimeRanges object is empty")},end(){throw Error("This TimeRanges object is empty")}};else n={length:e.length,start:c8.bind(null,"start",0,e),end:c8.bind(null,"end",1,e)};if(je.default.Symbol&&je.default.Symbol.iterator)n[je.default.Symbol.iterator]=()=>(e||[]).values();return n}function no(e,n){if(Array.isArray(e))return Ay(e);else if(e===void 0||n===void 0)return Ay();return Ay([[e,n]])}var C7=function(e,n){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),a=Math.floor(e/3600),r=Math.floor(n/60%60),l=Math.floor(n/3600);if(isNaN(e)||e===1/0)a=s=i="-";return a=a>0||l>0?a+":":"",s=((a||r>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,a+s+i},v5=C7;function j7(e){v5=e}function E7(){v5=C7}function dh(e,n=e){return v5(e,n)}var zI=Object.freeze({__proto__:null,createTimeRanges:no,createTimeRange:no,setFormatTime:j7,resetFormatTime:E7,formatTime:dh});function q7(e,n){let i=0,s,a;if(!n)return 0;if(!e||!e.length)e=no(0,0);for(let r=0;r<e.length;r++){if(s=e.start(r),a=e.end(r),a>n)a=n;i+=a-s}return i/n}function Fi(e){if(e instanceof Fi)return e;if(typeof e==="number")this.code=e;else if(typeof e==="string")this.message=e;else if(Bo(e)){if(typeof e.code==="number")this.code=e.code;Object.assign(this,e)}if(!this.message)this.message=Fi.defaultMessages[this.code]||""}Fi.prototype.code=0;Fi.prototype.message="";Fi.prototype.status=null;Fi.prototype.metadata=null;Fi.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Fi.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Fi.MEDIA_ERR_CUSTOM=0;Fi.prototype.MEDIA_ERR_CUSTOM=0;Fi.MEDIA_ERR_ABORTED=1;Fi.prototype.MEDIA_ERR_ABORTED=1;Fi.MEDIA_ERR_NETWORK=2;Fi.prototype.MEDIA_ERR_NETWORK=2;Fi.MEDIA_ERR_DECODE=3;Fi.prototype.MEDIA_ERR_DECODE=3;Fi.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fi.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fi.MEDIA_ERR_ENCRYPTED=5;Fi.prototype.MEDIA_ERR_ENCRYPTED=5;function yp(e){return e!==void 0&&e!==null&&typeof e.then==="function"}function Oo(e){if(yp(e))e.then(null,(n)=>{})}var $y=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((i,s,a)=>{if(e[s])i[s]=e[s];return i},{cues:e.cues&&Array.prototype.map.call(e.cues,function(i){return{startTime:i.startTime,endTime:i.endTime,text:i.text,id:i.id}})})},GI=function(e){let n=e.$$("track"),i=Array.prototype.map.call(n,(a)=>a.track);return Array.prototype.map.call(n,function(a){let r=$y(a.track);if(a.src)r.src=a.src;return r}).concat(Array.prototype.filter.call(e.textTracks(),function(a){return i.indexOf(a)===-1}).map($y))},VI=function(e,n){return e.forEach(function(i){let s=n.addRemoteTextTrack(i).track;if(!i.src&&i.cues)i.cues.forEach((a)=>s.addCue(a))}),n.textTracks()},Yy={textTracksToJson:GI,jsonToTextTracks:VI,trackToJson:$y},Cy="vjs-modal-dialog";class ph extends dt{constructor(e,n){super(e,n);this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.close_=(i)=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=on("div",{className:`${Cy}-content`},{role:"document"}),this.descEl_=on("p",{className:`${Cy}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Kc(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Cy} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");if(this.closeable())e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.");return e}open(){if(this.opened_){if(this.options_.fillAlways)this.fill();return}let e=this.player();if(this.trigger("beforemodalopen"),this.opened_=!0,this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)this.fill();if(this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_)e.pause();this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){if(typeof e==="boolean")this[e?"open":"close"]();return this.opened_}close(){if(!this.opened_)return;let e=this.player();if(this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen)e.play();if(this.off("keydown",this.handleKeyDown_),this.hadControls_)e.controls(!0);if(this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary)this.dispose()}closeable(e){if(typeof e==="boolean"){let n=this.closeable_=!!e,i=this.getChild("closeButton");if(n&&!i){let s=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(i,"close",this.close_)}if(!n&&i)this.off(i,"close",this.close_),this.removeChild(i),i.dispose()}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){let n=this.contentEl(),{parentNode:i,nextSibling:s}=n;if(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(n),this.empty(),m7(n,e),this.trigger("modalfill"),s)i.insertBefore(n,s);else i.appendChild(n);let a=this.getChild("closeButton");if(a)i.appendChild(a.el_);this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),$1(this.contentEl()),this.trigger("modalempty")}content(e){if(typeof e<"u")this.content_=e;return this.content_}conditionalFocus_(){let e=Et.default.activeElement,n=this.player_.el_;if(this.previouslyActiveEl_=null,n.contains(e)||n===e)this.previouslyActiveEl_=e,this.focus()}conditionalBlur_(){if(this.previouslyActiveEl_)this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;let n=this.focusableEls_(),i=this.el_.querySelector(":focus"),s;for(let a=0;a<n.length;a++)if(i===n[a]){s=a;break}if(Et.default.activeElement===this.el_)s=0;if(e.shiftKey&&s===0)n[n.length-1].focus(),e.preventDefault();else if(!e.shiftKey&&s===n.length-1)n[0].focus(),e.preventDefault()}focusableEls_(){let e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(n)=>(n instanceof je.default.HTMLAnchorElement||n instanceof je.default.HTMLAreaElement)&&n.hasAttribute("href")||(n instanceof je.default.HTMLInputElement||n instanceof je.default.HTMLSelectElement||n instanceof je.default.HTMLTextAreaElement||n instanceof je.default.HTMLButtonElement)&&!n.hasAttribute("disabled")||n instanceof je.default.HTMLIFrameElement||n instanceof je.default.HTMLObjectElement||n instanceof je.default.HTMLEmbedElement||n.hasAttribute("tabindex")&&n.getAttribute("tabindex")!==-1||n.hasAttribute("contenteditable"))}}ph.prototype.options_={pauseOnOpen:!0,temporary:!0};dt.registerComponent("ModalDialog",ph);class Wc extends Ha{constructor(e=[]){super();this.tracks_=[];for(let n=0;n<e.length;n++)this.addTrack(e[n])}get length(){return this.tracks_.length}addTrack(e){let n=this.tracks_.length;if(!(""+n in this))Object.defineProperty(this,n,{get(){return this.tracks_[n]}});if(this.tracks_.indexOf(e)===-1)this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this});if(e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Rl(e))e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let n;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){if(n=this[i],n.off)n.off();this.tracks_.splice(i,1);break}if(!n)return;this.trigger({track:n,type:"removetrack",target:this})}getTrackById(e){let n=null;for(let i=0,s=this.length;i<s;i++){let a=this[i];if(a.id===e){n=a;break}}return n}}Wc.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(let e in Wc.prototype.allowedEvents_)Wc.prototype["on"+e]=null;var jy=function(e,n){for(let i=0;i<e.length;i++){if(!Object.keys(e[i]).length||n.id===e[i].id)continue;e[i].enabled=!1}};class S5 extends Wc{constructor(e=[]){for(let n=e.length-1;n>=0;n--)if(e[n].enabled){jy(e,e[n]);break}super(e);this.changing_=!1}addTrack(e){if(e.enabled)jy(this,e);if(super.addTrack(e),!e.addEventListener)return;e.enabledChange_=()=>{if(this.changing_)return;this.changing_=!0,jy(this,e),this.changing_=!1,this.trigger("change")},e.addEventListener("enabledchange",e.enabledChange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener&&e.enabledChange_)e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null}}var Ey=function(e,n){for(let i=0;i<e.length;i++){if(!Object.keys(e[i]).length||n.id===e[i].id)continue;e[i].selected=!1}};class _5 extends Wc{constructor(e=[]){for(let n=e.length-1;n>=0;n--)if(e[n].selected){Ey(e,e[n]);break}super(e);this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let n=0;n<this.length;n++)if(this[n].selected)return n;return-1},set(){}})}addTrack(e){if(e.selected)Ey(this,e);if(super.addTrack(e),!e.addEventListener)return;e.selectedChange_=()=>{if(this.changing_)return;this.changing_=!0,Ey(this,e),this.changing_=!1,this.trigger("change")},e.addEventListener("selectedchange",e.selectedChange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener&&e.selectedChange_)e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null}}class Z1 extends Wc{addTrack(e){if(super.addTrack(e),!this.queueChange_)this.queueChange_=()=>this.queueTrigger("change");if(!this.triggerSelectedlanguagechange)this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange");if(e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1)e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){if(super.removeTrack(e),e.removeEventListener){if(this.queueChange_)e.removeEventListener("modechange",this.queueChange_);if(this.selectedlanguagechange_)e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}toJSON(){return this.tracks_.map((e)=>e.toJSON())}}class D7{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let n=0,i=e.length;n<i;n++)this.addTrackElement_(e[n])}addTrackElement_(e){let n=this.trackElements_.length;if(!(""+n in this))Object.defineProperty(this,n,{get(){return this.trackElements_[n]}});if(this.trackElements_.indexOf(e)===-1)this.trackElements_.push(e)}getTrackElementByTrack_(e){let n;for(let i=0,s=this.trackElements_.length;i<s;i++)if(e===this.trackElements_[i].track){n=this.trackElements_[i];break}return n}removeTrackElement_(e){for(let n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n]){if(this.trackElements_[n].track&&typeof this.trackElements_[n].track.off==="function")this.trackElements_[n].track.off();if(typeof this.trackElements_[n].off==="function")this.trackElements_[n].off();this.trackElements_.splice(n,1);break}}}class C1{constructor(e){C1.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){let n=this.length||0,i=0,s=e.length;this.cues_=e,this.length_=e.length;let a=function(r){if(!(""+r in this))Object.defineProperty(this,""+r,{get(){return this.cues_[r]}})};if(n<s){i=n;for(;i<s;i++)a.call(this,i)}}getCueById(e){let n=null;for(let i=0,s=this.length;i<s;i++){let a=this[i];if(a.id===e){n=a;break}}return n}}var XI={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},WI={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},KI={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},u8={disabled:"disabled",hidden:"hidden",showing:"showing"};class eb extends Ha{constructor(e={}){super();let n={id:e.id||"vjs_track_"+Mr(),kind:e.kind||"",language:e.language||""},i=e.label||"";for(let s in n)Object.defineProperty(this,s,{get(){return n[s]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(s){if(s!==i)i=s,this.trigger("labelchange")}})}}var x5=function(e){return new URL(e,Et.default.baseURI)},I7=function(e){return new URL(e,Et.default.baseURI).href},k5=function(e){if(typeof e==="string"){let i=e.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return i?i[1].toLowerCase():""}return""},tb=function(e,n=je.default.location){return x5(e).origin!==n.origin},$I=Object.freeze({__proto__:null,parseUrl:x5,getAbsoluteURL:I7,getFileExtension:k5,isCrossOrigin:tb}),h8=function(e,n){let i=new je.default.WebVTT.Parser(je.default,je.default.vttjs,je.default.WebVTT.StringDecoder()),s=[];if(i.oncue=function(a){n.addCue(a)},i.onparsingerror=function(a){s.push(a)},i.onflush=function(){n.trigger({type:"loadeddata",target:n})},i.parse(e),s.length>0){if(je.default.console&&je.default.console.groupCollapsed)je.default.console.groupCollapsed(`Text Track parsing errors for ${n.src}`);if(s.forEach((a)=>Cn.error(a)),je.default.console&&je.default.console.groupEnd)je.default.console.groupEnd()}i.flush()},f8=function(e,n){let i={uri:e},s=tb(e);if(s)i.cors=s;let a=n.tech_.crossOrigin()==="use-credentials";if(a)i.withCredentials=a;d5.default(i,di(this,function(r,l,c){if(r)return Cn.error(r,l);if(n.loaded_=!0,typeof je.default.WebVTT!=="function"){if(n.tech_)n.tech_.any(["vttjsloaded","vttjserror"],(p)=>{if(p.type==="vttjserror"){Cn.error(`vttjs failed to load, stopping trying to process ${n.src}`);return}return h8(c,n)})}else h8(c,n)}))};class pd extends eb{constructor(e={}){if(!e.tech)throw Error("A tech was not provided.");let n=li(e,{kind:KI[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=u8[n.mode]||"disabled",s=n.default;if(n.kind==="metadata"||n.kind==="chapters")i="hidden";super(n);this.tech_=n.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;let a=new C1(this.cues_),r=new C1(this.activeCues_),l=!1;this.timeupdateHandler=di(this,function(p={}){if(this.tech_.isDisposed())return;if(!this.tech_.isReady_){if(p.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);return}if(this.activeCues=this.activeCues,l)this.trigger("cuechange"),l=!1;if(p.type!=="timeupdate")this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)});let c=()=>{this.stopTracking()};if(this.tech_.one("dispose",c),i!=="disabled")this.startTracking();if(Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return i},set(p){if(!u8[p])return;if(i===p)return;if(i=p,!this.preload_&&i!=="disabled"&&this.cues.length===0)f8(this.src,this);if(this.stopTracking(),i!=="disabled")this.startTracking();this.trigger("modechange")}},cues:{get(){if(!this.loaded_)return null;return a},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return r;let p=this.tech_.currentTime(),m=[];for(let g=0,y=this.cues.length;g<y;g++){let x=this.cues[g];if(x.startTime<=p&&x.endTime>=p)m.push(x)}if(l=!1,m.length!==this.activeCues_.length)l=!0;else for(let g=0;g<m.length;g++)if(this.activeCues_.indexOf(m[g])===-1)l=!0;return this.activeCues_=m,r.setCues_(this.activeCues_),r},set(){}}}),n.src){if(this.src=n.src,!this.preload_)this.loaded_=!0;if(this.preload_||n.kind!=="subtitles"&&n.kind!=="captions")f8(this.src,this)}else this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){if(this.rvf_)this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0;this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let n=e;if(!("getCueAsHTML"in n)){n=new je.default.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(let s in e)if(!(s in n))n[s]=e[s];n.id=e.id,n.originalCue_=e}let i=this.tech_.textTracks();for(let s=0;s<i.length;s++)if(i[s]!==this)i[s].removeCue(n);this.cues_.push(n),this.cues.setCues_(this.cues_)}toJSON(){return Yy.trackToJson(this)}removeCue(e){let n=this.cues_.length;while(n--){let i=this.cues_[n];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(n,1),this.cues.setCues_(this.cues_);break}}}}pd.prototype.allowedEvents_={cuechange:"cuechange"};class T5 extends eb{constructor(e={}){let n=li(e,{kind:WI[e.kind]||""});super(n);let i=!1;if(Object.defineProperty(this,"enabled",{get(){return i},set(s){if(typeof s!=="boolean"||s===i)return;i=s,this.trigger("enabledchange")}}),n.enabled)this.enabled=n.enabled;this.loaded_=!0}}class A5 extends eb{constructor(e={}){let n=li(e,{kind:XI[e.kind]||""});super(n);let i=!1;if(Object.defineProperty(this,"selected",{get(){return i},set(s){if(typeof s!=="boolean"||s===i)return;i=s,this.trigger("selectedchange")}}),n.selected)this.selected=n.selected}}class Ol extends Ha{constructor(e={}){super();let n,i=new pd(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return n}},track:{get(){return i}}}),n=Ol.NONE,i.addEventListener("loadeddata",()=>{n=Ol.LOADED,this.trigger({type:"load",target:this})})}}Ol.prototype.allowedEvents_={load:"load"};Ol.NONE=0;Ol.LOADING=1;Ol.LOADED=2;Ol.ERROR=3;var Ir={audio:{ListClass:S5,TrackClass:T5,capitalName:"Audio"},video:{ListClass:_5,TrackClass:A5,capitalName:"Video"},text:{ListClass:Z1,TrackClass:pd,capitalName:"Text"}};Object.keys(Ir).forEach(function(e){Ir[e].getterName=`${e}Tracks`,Ir[e].privateName=`${e}Tracks_`});var ud={remoteText:{ListClass:Z1,TrackClass:pd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:D7,TrackClass:Ol,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ya=Object.assign({},Ir,ud);ud.names=Object.keys(ud);Ir.names=Object.keys(Ir);ya.names=[].concat(ud.names).concat(Ir.names);function YI(e,n,i,s,a={}){let r=e.textTracks();if(a.kind=n,i)a.label=i;if(s)a.language=s;a.tech=e;let l=new ya.text.TrackClass(a);return r.addTrack(l),l}class Tn extends dt{constructor(e={},n=function(){}){e.reportTouchActivity=!1;super(null,e,n);if(this.onDurationChange_=(i)=>this.onDurationChange(i),this.trackProgress_=(i)=>this.trackProgress(i),this.trackCurrentTime_=(i)=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=(i)=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=(i)=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ya.names.forEach((i)=>{let s=ya[i];if(e&&e[s.getterName])this[s.privateName]=e[s.getterName]}),!this.featuresProgressEvents)this.manualProgressOn();if(!this.featuresTimeupdateEvents)this.manualTimeUpdatesOn();if(["Text","Audio","Video"].forEach((i)=>{if(e[`native${i}Tracks`]===!1)this[`featuresNative${i}Tracks`]=!1}),e.nativeCaptions===!1||e.nativeTextTracks===!1)this.featuresNativeTextTracks=!1;else if(e.nativeCaptions===!0||e.nativeTextTracks===!0)this.featuresNativeTextTracks=!0;if(!this.featuresNativeTextTracks)this.emulateTextTracks();if(this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new ya.text.ListClass,this.initTrackListeners(),!e.nativeControlsForTouch)this.emitTapEvents();if(this.constructor)this.name_=this.constructor.name||"Unknown Tech"}triggerSourceset(e){if(!this.isReady_)this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1));this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(di(this,function(){let n=this.bufferedPercent();if(this.bufferedPercent_!==n)this.trigger("progress");if(this.bufferedPercent_=n,n===1)this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return no(0,0)}bufferedPercent(){return q7(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){if(this.currentTimeInterval)this.stopTrackingCurrentTime();this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){if(this.clearTracks(Ir.names),this.manualProgress)this.manualProgressOff();if(this.manualTimeUpdates)this.manualTimeUpdatesOff();super.dispose()}clearTracks(e){e=[].concat(e),e.forEach((n)=>{let i=this[`${n}Tracks`]()||[],s=i.length;while(s--){let a=i[s];if(n==="text")this.removeRemoteTextTrack(a);i.removeTrack(a)}})}cleanupAutoTextTracks(){let e=this.autoRemoteTextTracks_||[],n=e.length;while(n--){let i=e[n];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){if(e!==void 0)this.error_=new Fi(e),this.trigger("error");return this.error_}played(){if(this.hasStarted_)return no(0,0);return no()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){if(this.manualTimeUpdates)this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ir.names.forEach((e)=>{let n=Ir[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[n.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(je.default.WebVTT)return;if(Et.default.body.contains(this.el())){if(!this.options_["vtt.js"]&&rd(Hy.default)&&Object.keys(Hy.default).length>0){this.trigger("vttjsloaded");return}let e=Et.default.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),je.default.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){let e=this.textTracks(),n=this.remoteTextTracks(),i=(l)=>e.addTrack(l.track),s=(l)=>e.removeTrack(l.track);n.on("addtrack",i),n.on("removetrack",s),this.addWebVttScript_();let a=()=>this.trigger("texttrackchange"),r=()=>{a();for(let l=0;l<e.length;l++){let c=e[l];if(c.removeEventListener("cuechange",a),c.mode==="showing")c.addEventListener("cuechange",a)}};r(),e.addEventListener("change",r),e.addEventListener("addtrack",r),e.addEventListener("removetrack",r),this.on("dispose",function(){n.off("addtrack",i),n.off("removetrack",s),e.removeEventListener("change",r),e.removeEventListener("addtrack",r),e.removeEventListener("removetrack",r);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",a)})}addTextTrack(e,n,i){if(!e)throw Error("TextTrack kind is required but was not provided");return YI(this,e,n,i)}createRemoteTextTrack(e){let n=li(e,{tech:this});return new ud.remoteTextEl.TrackClass(n)}addRemoteTextTrack(e={},n){let i=this.createRemoteTextTrack(e);if(typeof n!=="boolean")n=!1;if(this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),n===!1)this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track));return i}removeRemoteTextTrack(e){let n=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(n),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){let n=Mr();if(!this.isReady_||this.paused())this.queuedHanders_.add(n),this.one("playing",()=>{if(this.queuedHanders_.has(n))this.queuedHanders_.delete(n),e()});else this.requestNamedAnimationFrame(n,e);return n}cancelVideoFrameCallback(e){if(this.queuedHanders_.has(e))this.queuedHanders_.delete(e);else this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,n){return Tn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Tn||e instanceof Tn||e===Tn}static registerTech(e,n){if(!Tn.techs_)Tn.techs_={};if(!Tn.isTech(n))throw Error(`Tech ${e} must be a Tech`);if(!Tn.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!Tn.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");if(e=Vi(e),Tn.techs_[e]=n,Tn.techs_[wp(e)]=n,e!=="Tech")Tn.defaultTechOrder_.push(e);return n}static getTech(e){if(!e)return;if(Tn.techs_&&Tn.techs_[e])return Tn.techs_[e];if(e=Vi(e),je.default&&je.default.videojs&&je.default.videojs[e])return Cn.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),je.default.videojs[e]}}ya.names.forEach(function(e){let n=ya[e];Tn.prototype[n.getterName]=function(){return this[n.privateName]=this[n.privateName]||new n.ListClass,this[n.privateName]}});Tn.prototype.featuresVolumeControl=!0;Tn.prototype.featuresMuteControl=!0;Tn.prototype.featuresFullscreenResize=!1;Tn.prototype.featuresPlaybackRate=!1;Tn.prototype.featuresProgressEvents=!1;Tn.prototype.featuresSourceset=!1;Tn.prototype.featuresTimeupdateEvents=!1;Tn.prototype.featuresNativeTextTracks=!1;Tn.prototype.featuresVideoFrameCallback=!1;Tn.withSourceHandlers=function(e){e.registerSourceHandler=function(i,s){let a=e.sourceHandlers;if(!a)a=e.sourceHandlers=[];if(s===void 0)s=a.length;a.splice(s,0,i)},e.canPlayType=function(i){let s=e.sourceHandlers||[],a;for(let r=0;r<s.length;r++)if(a=s[r].canPlayType(i),a)return a;return""},e.selectSourceHandler=function(i,s){let a=e.sourceHandlers||[],r;for(let l=0;l<a.length;l++)if(r=a[l].canHandleSource(i,s),r)return a[l];return null},e.canPlaySource=function(i,s){let a=e.selectSourceHandler(i,s);if(a)return a.canHandleSource(i,s);return""},["seekable","seeking","duration"].forEach(function(i){let s=this[i];if(typeof s!=="function")return;this[i]=function(){if(this.sourceHandler_&&this.sourceHandler_[i])return this.sourceHandler_[i].apply(this.sourceHandler_,arguments);return s.apply(this,arguments)}},e.prototype),e.prototype.setSource=function(i){let s=e.selectSourceHandler(i,this.options_);if(!s)if(e.nativeSourceHandler)s=e.nativeSourceHandler;else Cn.error("No source handler found for the current source.");if(this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),s!==e.nativeSourceHandler)this.currentSource_=i;this.sourceHandler_=s.handleSource(i,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){if(this.currentSource_)this.clearTracks(["audio","video"]),this.currentSource_=null;if(this.cleanupAutoTextTracks(),this.sourceHandler_){if(this.sourceHandler_.dispose)this.sourceHandler_.dispose();this.sourceHandler_=null}}};dt.registerComponent("Tech",Tn);Tn.registerTech("Tech",Tn);Tn.defaultTechOrder_=[];var hh={},j1={},E1={};function QI(e,n){hh[e]=hh[e]||[],hh[e].push(n)}function JI(e,n,i){e.setTimeout(()=>rh(n,hh[n.type],i,e),1)}function ZI(e,n){e.forEach((i)=>i.setTech&&i.setTech(n))}function eM(e,n,i){return e.reduceRight(C5(i),n[i]())}function tM(e,n,i,s){return n[i](e.reduce(C5(i),s))}function d8(e,n,i,s=null){let a="call"+Vi(i),r=e.reduce(C5(a),s),l=r===E1,c=l?null:n[i](r);return sM(e,i,c,l),c}var nM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},iM={setCurrentTime:1,setMuted:1,setVolume:1},p8={play:1,pause:1};function C5(e){return(n,i)=>{if(n===E1)return E1;if(i[e])return i[e](n);return n}}function sM(e,n,i,s){for(let a=e.length-1;a>=0;a--){let r=e[a];if(r[n])r[n](s,i)}}function aM(e){if(j1.hasOwnProperty(e.id()))delete j1[e.id()]}function rM(e,n){let i=j1[e.id()],s=null;if(i===void 0||i===null)return s=n(e),j1[e.id()]=[[n,s]],s;for(let a=0;a<i.length;a++){let[r,l]=i[a];if(r!==n)continue;s=l}if(s===null)s=n(e),i.push([n,s]);return s}function rh(e={},n=[],i,s,a=[],r=!1){let[l,...c]=n;if(typeof l==="string")rh(e,hh[l],i,s,a,r);else if(l){let p=rM(s,l);if(!p.setSource)return a.push(p),rh(e,c,i,s,a,r);p.setSource(Object.assign({},e),function(m,g){if(m)return rh(e,c,i,s,a,r);a.push(p),rh(g,e.type===g.type?c:hh[g.type],i,s,a,r)})}else if(c.length)rh(e,c,i,s,a,r);else if(r)i(e,a);else rh(e,hh["*"],i,s,a,!0)}var oM={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},q1=function(e=""){let n=k5(e);return oM[n.toLowerCase()]||""},lM=(e,n)=>{if(!n)return"";if(e.cache_.source.src===n&&e.cache_.source.type)return e.cache_.source.type;let i=e.cache_.sources.filter((a)=>a.src===n);if(i.length)return i[0].type;let s=e.$$("source");for(let a=0;a<s.length;a++){let r=s[a];if(r.type&&r.src&&r.src===n)return r.type}return q1(n)},M7=function(e){if(Array.isArray(e)){let n=[];e.forEach(function(i){if(i=M7(i),Array.isArray(i))n=n.concat(i);else if(Bo(i))n.push(i)}),e=n}else if(typeof e==="string"&&e.trim())e=[m8({src:e})];else if(Bo(e)&&typeof e.src==="string"&&e.src&&e.src.trim())e=[m8(e)];else e=[];return e};function m8(e){if(!e.type){let n=q1(e.src);if(n)e.type=n}return e}var cM=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
29
|
+
<defs>
|
|
30
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
31
|
+
<path d="M16 10v28l22-14z"></path>
|
|
32
|
+
</symbol>
|
|
33
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-pause">
|
|
34
|
+
<path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
|
|
35
|
+
</symbol>
|
|
36
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-audio">
|
|
37
|
+
<path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
|
|
38
|
+
</symbol>
|
|
39
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-captions">
|
|
40
|
+
<path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
|
|
41
|
+
</symbol>
|
|
42
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
|
|
43
|
+
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
|
|
44
|
+
</symbol>
|
|
45
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
|
|
46
|
+
<path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
|
|
47
|
+
</symbol>
|
|
48
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
|
|
49
|
+
<path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
|
|
50
|
+
</symbol>
|
|
51
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
|
|
52
|
+
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
53
|
+
</symbol>
|
|
54
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
|
|
55
|
+
<path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
|
|
56
|
+
</symbol>
|
|
57
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
|
|
58
|
+
<path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
|
|
59
|
+
</symbol>
|
|
60
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
|
|
61
|
+
<path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
|
|
62
|
+
</symbol>
|
|
63
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
|
|
64
|
+
<path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
|
|
65
|
+
</symbol>
|
|
66
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
|
|
67
|
+
<path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
|
|
68
|
+
</symbol>
|
|
69
|
+
<symbol viewBox="0 0 24 24" id="vjs-icon-hd">
|
|
70
|
+
<path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
|
|
71
|
+
</symbol>
|
|
72
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
|
|
73
|
+
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
|
|
74
|
+
</symbol>
|
|
75
|
+
<symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
|
|
76
|
+
<path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
|
|
77
|
+
</symbol>
|
|
78
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
|
|
79
|
+
<path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
|
|
80
|
+
</symbol>
|
|
81
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
|
|
82
|
+
<path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
|
|
83
|
+
</symbol>
|
|
84
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
|
|
85
|
+
<path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
|
|
86
|
+
</symbol>
|
|
87
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-share">
|
|
88
|
+
<path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
|
|
89
|
+
</symbol>
|
|
90
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cog">
|
|
91
|
+
<path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
|
|
92
|
+
</symbol>
|
|
93
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-square">
|
|
94
|
+
<path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
|
|
95
|
+
</symbol>
|
|
96
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle">
|
|
97
|
+
<circle cx="24" cy="24" r="20"></circle>
|
|
98
|
+
</symbol>
|
|
99
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
|
|
100
|
+
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
101
|
+
</symbol>
|
|
102
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
|
|
103
|
+
<path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
|
|
104
|
+
</symbol>
|
|
105
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
|
|
106
|
+
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
|
|
107
|
+
</symbol>
|
|
108
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-replay">
|
|
109
|
+
<path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
|
|
110
|
+
</symbol>
|
|
111
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
|
|
112
|
+
<path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
|
|
113
|
+
</symbol>
|
|
114
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
|
|
115
|
+
<path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
|
|
116
|
+
</symbol>
|
|
117
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
|
|
118
|
+
<path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
|
|
119
|
+
</symbol>
|
|
120
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
|
|
121
|
+
<path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
|
|
122
|
+
</symbol>
|
|
123
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
|
|
124
|
+
<path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
|
|
125
|
+
</symbol>
|
|
126
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
|
|
127
|
+
<path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
|
|
128
|
+
</symbol>
|
|
129
|
+
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
|
|
130
|
+
<path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
|
|
131
|
+
</symbol>
|
|
132
|
+
<symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
|
|
133
|
+
<g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
|
|
134
|
+
</symbol>
|
|
135
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
|
|
136
|
+
<path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
|
|
137
|
+
</symbol>
|
|
138
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
|
|
139
|
+
<path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
|
|
140
|
+
</symbol>
|
|
141
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
|
|
142
|
+
<path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
|
|
143
|
+
</symbol>
|
|
144
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-cast">
|
|
145
|
+
<path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
|
|
146
|
+
</symbol>
|
|
147
|
+
<symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
|
|
148
|
+
<path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
|
|
149
|
+
</symbol>
|
|
150
|
+
<symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
|
|
151
|
+
<path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
|
|
152
|
+
<path fill="none" d="M-1-3h24v24H-1z"></path>
|
|
153
|
+
</symbol>
|
|
154
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
|
|
155
|
+
<path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
|
|
156
|
+
</symbol>
|
|
157
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
|
|
158
|
+
<path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
|
|
159
|
+
</symbol>
|
|
160
|
+
<symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
|
|
161
|
+
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
|
|
162
|
+
</symbol>
|
|
163
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
|
|
164
|
+
<path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
|
|
165
|
+
</symbol>
|
|
166
|
+
<symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
|
|
167
|
+
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
168
|
+
</symbol>
|
|
169
|
+
</defs>
|
|
170
|
+
</svg>`;var g8=x1?10009:k1?461:8,Kf={codes:{play:415,pause:19,ff:417,rw:412,back:g8},names:{415:"play",19:"pause",417:"ff",412:"rw",[g8]:"back"},isEventKey(e,n){if(n=n.toLowerCase(),this.names[e.keyCode]&&this.names[e.keyCode]===n)return!0;return!1},getEventName(e){if(this.names[e.keyCode])return this.names[e.keyCode];else if(this.codes[e.code]){let n=this.codes[e.code];return this.names[n]}return null}},b8=5;class R7 extends Ha{constructor(e){super();this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){if(this.isListening_)return;if(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay)this.player_.errorDisplay.on("aftermodalfill",()=>{if(this.updateFocusableComponents(),this.focusableComponents.length)if(this.focusableComponents.length>1)this.focusableComponents[1].focus();else this.focusableComponents[0].focus()})}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){let n=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(n.key)){if(this.isPaused_)return;n.preventDefault();let i=n.key.substring(5).toLowerCase();this.move(i)}else if(Kf.isEventKey(n,"play")||Kf.isEventKey(n,"pause")||Kf.isEventKey(n,"ff")||Kf.isEventKey(n,"rw")){n.preventDefault();let i=Kf.getEventName(n);this.performMediaAction_(i)}else if(Kf.isEventKey(n,"Back")&&e.target&&typeof e.target.closeable==="function"&&e.target.closeable())n.preventDefault(),e.target.close()}performMediaAction_(e){if(this.player_)switch(e){case"play":if(this.player_.paused())this.player_.play();break;case"pause":if(!this.player_.paused())this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+b8);break;case"rw":this.userSeek_(this.player_.currentTime()-b8);break}}userSeek_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){let n=e.relatedTarget,i=null,s=this.getCurrentComponent(e.target);if(n){if(i=Boolean(n.closest(".video-js")),n.classList.contains("vjs-text-track-settings")&&!this.isPaused_)this.searchForTrackSelect_()}if(!e.currentTarget.contains(e.relatedTarget)&&!i||!n){if(s&&s.name()==="CloseButton")this.refocusComponent();else if(this.pause(),s&&s.el())this.lastFocusedComponent_=s}}handlePlayerFocus_(){if(this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable())this.resume()}updateFocusableComponents(){let e=this.player_,n=[];function i(s){for(let a of s){if(a.hasOwnProperty("el_")&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el()))n.push(a);if(a.hasOwnProperty("children_")&&a.children_.length>0)i(a.children_)}}return e.children_.forEach((s)=>{if(s.hasOwnProperty("el_")){if(s.getIsFocusable&&s.getIsAvailableToBeFocused&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())){n.push(s);return}else if(s.hasOwnProperty("children_")&&s.children_.length>0)i(s.children_);else if(s.hasOwnProperty("items")&&s.items.length>0)i(s.items);else if(this.findSuitableDOMChild(s))n.push(s)}if(s.name_==="ErrorDisplay"&&s.opened_){let a=s.el_.querySelector(".vjs-errors-ok-button-container");if(a)a.querySelectorAll("button").forEach((l,c)=>{n.push({name:()=>"ModalButton"+(c+1),el:()=>l,getPositions:()=>{let p=l.getBoundingClientRect(),m={x:p.x,y:p.y,width:p.width,height:p.height,top:p.top,right:p.right,bottom:p.bottom,left:p.left},g={x:p.left+p.width/2,y:p.top+p.height/2,width:0,height:0,top:p.top+p.height/2,right:p.left+p.width/2,bottom:p.top+p.height/2,left:p.left+p.width/2};return{boundingClientRect:m,center:g}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:(p)=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=n,this.focusableComponents}findSuitableDOMChild(e){function n(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let s=0;s<i.children.length;s++){let a=i.children[s],r=n(a);if(r)return r}return null}if(e.el())return n(e.el());return null}getCurrentComponent(e){this.updateFocusableComponents();let n=e||document.activeElement;if(this.focusableComponents.length){for(let i of this.focusableComponents)if(i.el()===n)return i}}add(e){let n=[...this.focusableComponents];if(e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))n.push(e);this.focusableComponents=n,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let n=0;n<this.focusableComponents.length;n++)if(this.focusableComponents[n].name()===e.name()){this.focusableComponents.splice(n,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){if(this.focusableComponents.length>0)this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}move(e){let n=this.getCurrentComponent();if(!n)return;let i=n.getPositions(),s=this.focusableComponents.filter((r)=>r!==n&&this.isInDirection_(i.boundingClientRect,r.getPositions().boundingClientRect,e)),a=this.findBestCandidate_(i.center,s,e);if(a)this.focus(a);else this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:n})}findBestCandidate_(e,n,i){let s=1/0,a=null;for(let r of n){let l=r.getPositions().center,c=this.calculateDistance_(e,l,i);if(c<s)s=c,a=r}return a}isInDirection_(e,n,i){switch(i){case"right":return n.left>=e.right;case"left":return n.right<=e.left;case"down":return n.top>=e.bottom;case"up":return n.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){if(!this.player_.userActive())this.player_.userActive(!0);this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){if(typeof e!=="object")return;if(e.getIsAvailableToBeFocused(e.el()))e.focus();else if(this.findSuitableDOMChild(e))this.findSuitableDOMChild(e).focus()}calculateDistance_(e,n,i){let s=Math.abs(e.x-n.x),a=Math.abs(e.y-n.y),r;switch(i){case"right":case"left":r=s+a*100;break;case"up":r=a*2+s*0.5;break;case"down":r=a*5+s;break;default:r=s+a}return r}searchForTrackSelect_(){let e=this;for(let n of e.updateFocusableComponents())if(n.constructor.name==="TextTrackSelect"){e.focus(n);break}}}class O7 extends dt{constructor(e,n,i){let s=li({createEl:!1},n);super(e,s,i);if(!n.playerOptions.sources||n.playerOptions.sources.length===0)for(let a=0,r=n.playerOptions.techOrder;a<r.length;a++){let l=Vi(r[a]),c=Tn.getTech(l);if(!l)c=dt.getComponent(l);if(c&&c.isSupported()){e.loadTech_(l);break}}else e.src(n.playerOptions.sources)}}dt.registerComponent("MediaLoader",O7);class Cp extends dt{constructor(e,n){super(e,n);if(this.options_.controlText)this.controlText(this.options_.controlText);this.handleMouseOver_=(i)=>this.handleMouseOver(i),this.handleMouseOut_=(i)=>this.handleMouseOut(i),this.handleClick_=(i)=>this.handleClick(i),this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",n={},i={}){if(n=Object.assign({className:this.buildCSSClass(),tabIndex:0},n),e==="button")Cn.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`);i=Object.assign({role:"button"},i),this.tabIndex_=n.tabIndex;let s=on(e,n,i);if(!this.player_.options_.experimentalSvgIcons)s.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){if(this.controlTextEl_=on("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e)e.appendChild(this.controlTextEl_);return this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,n=this.el()){if(e===void 0)return this.controlText_||"Need Text";let i=this.localize(e);if(this.controlText_=e,Kc(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes)n.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){if(!this.enabled_){if(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u")this.el_.setAttribute("tabIndex",this.tabIndex_);this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_)}}disable(){if(this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u")this.el_.removeAttribute("tabIndex");this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){if(this.options_.clickHandler)this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.trigger("click");else super.handleKeyDown(e)}}dt.registerComponent("ClickableComponent",Cp);class D1 extends Cp{constructor(e,n){super(e,n);let{mainContent:i}=n&&n.playerOptions||{};this.isMainContent=i,this.update(),this.update_=(s)=>this.update(s),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return on("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u"){if(this.$("img"))return this.$("img").crossOrigin;else if(this.player_.tech_&&this.player_.tech_.isReady_)return this.player_.crossOrigin();return this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null}if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}if(this.$("img"))this.$("img").crossOrigin=e;return}update(e){let n=this.player().poster();if(this.setSrc(n),n)this.show();else this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}if(!this.$("img"))this.el_.appendChild(on("picture",{className:"vjs-poster",tabIndex:-1},{},on("img",{loading:this.isMainContent?"eager":"lazy",fetchPriority:this.isMainContent?"high":"auto",crossOrigin:this.crossOrigin()},{alt:""})));this.$("img").src=e}handleClick(e){if(!this.player_.controls())return;let n=this.player_.getChild("controlBar"),i=n&&n.getChild("playToggle");if(zc)(i||this.player_).focus();else if(this.player_.tech(!0))this.player_.tech(!0).focus();if(this.player_.paused())Oo(this.player_.play());else this.player_.pause()}}D1.prototype.crossorigin=D1.prototype.crossOrigin;dt.registerComponent("PosterImage",D1);var Dr="#222",w8="#ccc",uM={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function qy(e,n){let i;if(e.length===4)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else if(e.length===7)i=e.slice(1);else throw Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+n+")"}function Mo(e,n,i){try{e.style[n]=i}catch(s){return}}function y8(e){return e?`${e}px`:""}class F7 extends dt{constructor(e,n,i){super(e,n,i);let s=(r)=>this.updateDisplay(r),a=(r)=>{this.updateDisplayOverlay(),this.updateDisplay(r)};e.on("loadstart",(r)=>this.toggleDisplay(r)),e.on("useractive",s),e.on("userinactive",s),e.on("texttrackchange",s),e.on("loadedmetadata",(r)=>{this.updateDisplayOverlay(),this.preselectTrack(r)}),e.ready(di(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",a),e.on("playerresize",a);let r=je.default.screen.orientation||je.default,l=je.default.screen.orientation?"change":"orientationchange";r.addEventListener(l,a),e.on("dispose",()=>r.removeEventListener(l,a));let c=this.options_.playerOptions.tracks||[];for(let p=0;p<c.length;p++)this.player_.addRemoteTextTrack(c[p],!0);this.preselectTrack()}))}preselectTrack(){let e={captions:1,subtitles:1},n=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage,s,a,r;for(let l=0;l<n.length;l++){let c=n[l];if(i&&i.enabled&&i.language&&i.language===c.language&&c.kind in e){if(c.kind===i.kind)r=c;else if(!r)r=c}else if(i&&!i.enabled)r=null,s=null,a=null;else if(c.default){if(c.kind==="descriptions"&&!s)s=c;else if(c.kind in e&&!a)a=c}}if(r)r.mode="showing";else if(a)a.mode="showing";else if(s)s.mode="showing"}toggleDisplay(){if(this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks)this.hide();else this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){if(typeof je.default.WebVTT==="function")je.default.WebVTT.processCues(je.default,[],this.el_)}updateDisplay(){let e=this.player_.textTracks(),n=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),n){let r=[];for(let l=0;l<e.length;++l){let c=e[l];if(c.mode!=="showing")continue;r.push(c)}this.updateForTrack(r);return}let i=null,s=null,a=e.length;while(a--){let r=e[a];if(r.mode==="showing")if(r.kind==="descriptions")i=r;else s=r}if(s){if(this.getAttribute("aria-live")!=="off")this.setAttribute("aria-live","off");this.updateForTrack(s)}else if(i){if(this.getAttribute("aria-live")!=="assertive")this.setAttribute("aria-live","assertive");this.updateForTrack(i)}if(!(je.default.CSS!==void 0&&je.default.CSS.supports("inset","10px"))){let r=this.el_,l=r.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,p=this.player_.el_.getBoundingClientRect().height;if(r.style="",Mo(r,"position","relative"),Mo(r,"height",p-c+"px"),Mo(r,"top","unset"),T1)Mo(r,"bottom",p+"px");else Mo(r,"bottom","0px");if(l.length>0)l.forEach((m)=>{if(m.style.inset){let g=m.style.inset.split(" ");if(g.length===3)Object.assign(m.style,{top:g[0],right:g[1],bottom:g[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!(je.default.CSS!==void 0&&je.default.CSS.supports("inset-inline: 10px")))return;let e=this.player_.currentWidth(),n=this.player_.currentHeight(),i=e/n,s=this.player_.videoWidth()/this.player_.videoHeight(),a=0,r=0;if(Math.abs(i-s)>0.1)if(i>s)a=Math.round((e-n*s)/2);else r=Math.round((n-e/s)/2);Mo(this.el_,"insetInline",y8(a)),Mo(this.el_,"insetBlock",y8(r))}updateDisplayState(e){let n=this.player_.textTrackSettings.getValues(),i=e.activeCues,s=i.length;while(s--){let a=i[s];if(!a)continue;let r=a.displayState;if(n.color)r.firstChild.style.color=n.color;if(n.textOpacity)Mo(r.firstChild,"color",qy(n.color||"#fff",n.textOpacity));if(n.backgroundColor)r.firstChild.style.backgroundColor=n.backgroundColor;if(n.backgroundOpacity)Mo(r.firstChild,"backgroundColor",qy(n.backgroundColor||"#000",n.backgroundOpacity));if(n.windowColor)if(n.windowOpacity)Mo(r,"backgroundColor",qy(n.windowColor,n.windowOpacity));else r.style.backgroundColor=n.windowColor;if(n.edgeStyle){if(n.edgeStyle==="dropshadow")r.firstChild.style.textShadow=`2px 2px 3px ${Dr}, 2px 2px 4px ${Dr}, 2px 2px 5px ${Dr}`;else if(n.edgeStyle==="raised")r.firstChild.style.textShadow=`1px 1px ${Dr}, 2px 2px ${Dr}, 3px 3px ${Dr}`;else if(n.edgeStyle==="depressed")r.firstChild.style.textShadow=`1px 1px ${w8}, 0 1px ${w8}, -1px -1px ${Dr}, 0 -1px ${Dr}`;else if(n.edgeStyle==="uniform")r.firstChild.style.textShadow=`0 0 4px ${Dr}, 0 0 4px ${Dr}, 0 0 4px ${Dr}, 0 0 4px ${Dr}`}if(n.fontPercent&&n.fontPercent!==1){let l=je.default.parseFloat(r.style.fontSize);r.style.fontSize=l*n.fontPercent+"px",r.style.height="auto",r.style.top="auto"}if(n.fontFamily&&n.fontFamily!=="default")if(n.fontFamily==="small-caps")r.firstChild.style.fontVariant="small-caps";else r.firstChild.style.fontFamily=uM[n.fontFamily]}}updateForTrack(e){if(!Array.isArray(e))e=[e];if(typeof je.default.WebVTT!=="function"||e.every((i)=>!i.activeCues))return;let n=[];for(let i=0;i<e.length;++i){let s=e[i];for(let a=0;a<s.activeCues.length;++a)n.push(s.activeCues[a])}je.default.WebVTT.processCues(je.default,n,this.el_);for(let i=0;i<e.length;++i){let s=e[i];for(let a=0;a<s.activeCues.length;++a){let r=s.activeCues[a].displayState;if(uh(r,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:i)),s.language)od(r,"lang",s.language)}if(this.player_.textTrackSettings)this.updateDisplayState(s)}}}dt.registerComponent("TextTrackDisplay",F7);class N7 extends dt{createEl(){let e=this.player_.isAudio(),n=this.localize(e?"Audio Player":"Video Player"),i=on("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[n])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}dt.registerComponent("LoadingSpinner",N7);class zs extends Cp{createEl(e,n={},i={}){e="button",n=Object.assign({className:this.buildCSSClass()},n),i=Object.assign({type:"button"},i);let s=on(e,n,i);if(!this.player_.options_.experimentalSvgIcons)s.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));return this.createControlTextEl(s),s}addChild(e,n={}){let i=this.constructor.name;return Cn.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),dt.prototype.addChild.call(this,e,n)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}dt.registerComponent("Button",zs);class j5 extends zs{constructor(e,n){super(e,n);this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",(i)=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){let n=this.player_.play(),i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){if(Oo(n),zc)(s||this.player_).focus();else if(this.player_.tech(!0))this.player_.tech(!0).focus();return}if(!s){this.player_.tech(!0).focus();return}let a=()=>s.focus();if(yp(n))n.then(a,()=>{});else this.setTimeout(a,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}j5.prototype.controlText_="Play Video";dt.registerComponent("BigPlayButton",j5);class P7 extends zs{constructor(e,n){super(e,n);this.setIcon("cancel"),this.controlText(n&&n.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.trigger("click");else super.handleKeyDown(e)}}dt.registerComponent("CloseButton",P7);class E5 extends zs{constructor(e,n={}){super(e,n);if(n.replay=n.replay===void 0||n.replay,this.setIcon("play"),this.on(e,"play",(i)=>this.handlePlay(i)),this.on(e,"pause",(i)=>this.handlePause(i)),n.replay)this.on(e,"ended",(i)=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){if(this.player_.paused())Oo(this.player_.play());else this.player_.pause()}handleSeeked(e){if(this.removeClass("vjs-ended"),this.player_.paused())this.handlePause(e);else this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",(n)=>this.handleSeeked(n))}}E5.prototype.controlText_="Play";dt.registerComponent("PlayToggle",E5);class mh extends dt{constructor(e,n){super(e,n);this.on(e,["timeupdate","ended","seeking"],(i)=>this.update(i)),this.updateTextNode_()}createEl(){let e=this.buildCSSClass(),n=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=on("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return n.appendChild(i),this.contentEl_=on("span",{className:`${e}-display`},{role:"presentation"}),n.appendChild(this.contentEl_),n}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){if(!this.player_.options_.enableSmoothSeeking&&e.type==="seeking")return;this.updateContent(e)}updateTextNode_(e=0){if(e=dh(e),this.formattedTime_===e)return;this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let n=this.textNode_;if(n&&this.contentEl_.firstChild!==n)n=null,Cn.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");if(this.textNode_=Et.default.createTextNode(this.formattedTime_),!this.textNode_)return;if(n)this.contentEl_.replaceChild(this.textNode_,n);else this.contentEl_.appendChild(this.textNode_)})}updateContent(e){}}mh.prototype.labelText_="Time";mh.prototype.controlText_="Time";dt.registerComponent("TimeDisplay",mh);class nb extends mh{buildCSSClass(){return"vjs-current-time"}updateContent(e){let n;if(this.player_.ended())n=this.player_.duration();else if(e&&e.target&&typeof e.target.pendingSeekTime==="function"&&e.target.pendingSeekTime()!==null)n=e.target.pendingSeekTime();else n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(n)}}nb.prototype.labelText_="Current Time";nb.prototype.controlText_="Current Time";dt.registerComponent("CurrentTimeDisplay",nb);class ib extends mh{constructor(e,n){super(e,n);let i=(s)=>this.updateContent(s);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){let n=this.player_.duration();this.updateTextNode_(n)}}ib.prototype.labelText_="Duration";ib.prototype.controlText_="Duration";dt.registerComponent("DurationDisplay",ib);class B7 extends dt{createEl(){let e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),n=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return n.appendChild(i),e.appendChild(n),e}}dt.registerComponent("TimeDivider",B7);class sb extends mh{constructor(e,n){super(e,n);this.on(e,"durationchange",(i)=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){let e=super.createEl();if(this.options_.displayNegative!==!1)e.insertBefore(on("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return e}updateContent(e){if(typeof this.player_.duration()!=="number")return;let n;if(this.player_.ended())n=0;else if(this.player_.remainingTimeDisplay)n=this.player_.remainingTimeDisplay();else n=this.player_.remainingTime();this.updateTextNode_(n)}}sb.prototype.labelText_="Remaining Time";sb.prototype.controlText_="Remaining Time";dt.registerComponent("RemainingTimeDisplay",sb);class L7 extends dt{constructor(e,n){super(e,n);this.updateShowing(),this.on(this.player(),"durationchange",(i)=>this.updateShowing(i))}createEl(){let e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=on("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(on("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(Et.default.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){if(this.player().duration()===1/0)this.show();else this.hide()}}dt.registerComponent("LiveDisplay",L7);class q5 extends zs{constructor(e,n){super(e,n);if(this.updateLiveEdgeStatus(),this.player_.liveTracker)this.updateLiveEdgeStatusHandler_=(i)=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_)}createEl(){let e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=on("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){if(!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge())this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live");else this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live")}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){if(this.player_.liveTracker)this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_);this.textEl_=null,super.dispose()}}q5.prototype.controlText_="Seek to live, currently playing live";dt.registerComponent("SeekToLive",q5);function jp(e,n,i){return e=Number(e),Math.min(i,Math.max(n,isNaN(e)?n:e))}var hM=Object.freeze({__proto__:null,clamp:jp});class ab extends dt{constructor(e,n){super(e,n);this.handleMouseDown_=(i)=>this.handleMouseDown(i),this.handleMouseUp_=(i)=>this.handleMouseUp(i),this.handleKeyDown_=(i)=>this.handleKeyDown(i),this.handleClick_=(i)=>this.handleClick(i),this.handleMouseMove_=(i)=>this.handleMouseMove(i),this.update_=(i)=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){if(this.enabled())return;if(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent)this.on(this.player_,this.playerEvent,this.update);this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0}disable(){if(!this.enabled())return;let e=this.bar.el_.ownerDocument;if(this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent)this.off(this.player_,this.playerEvent,this.update);this.enabled_=!1}createEl(e,n={},i={}){return n.className=n.className+" vjs-slider",n=Object.assign({tabIndex:0},n),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,n,i)}handleMouseDown(e){let n=this.bar.el_.ownerDocument;if(e.type==="mousedown")e.preventDefault();if(e.type==="touchstart"&&!Lo)e.preventDefault();h7(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(n,"mousemove",this.handleMouseMove_),this.on(n,"mouseup",this.handleMouseUp_),this.on(n,"touchmove",this.handleMouseMove_),this.on(n,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){let n=this.bar.el_.ownerDocument;f7(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(n,"mousemove",this.handleMouseMove_),this.off(n,"mouseup",this.handleMouseUp_),this.off(n,"touchmove",this.handleMouseMove_),this.off(n,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;let e=this.getProgress();if(e===this.progress_)return e;return this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{let n=this.vertical()?"height":"width";this.bar.el().style[n]=(e*100).toFixed(2)+"%"}),e}getProgress(){return Number(jp(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){let n=K1(this.el_,e);if(this.vertical())return n.y;return n.x}handleKeyDown(e){let n=this.options_.playerOptions.spatialNavigation,i=n&&n.enabled,s=n&&n.horizontalSeek;if(i)if(s&&e.key==="ArrowLeft"||!s&&e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepBack();else if(s&&e.key==="ArrowRight"||!s&&e.key==="ArrowUp")e.preventDefault(),e.stopPropagation(),this.stepForward();else{if(this.pendingSeekTime())this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime());super.handleKeyDown(e)}else if(e.key==="ArrowLeft"||e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepBack();else if(e.key==="ArrowUp"||e.key==="ArrowRight")e.preventDefault(),e.stopPropagation(),this.stepForward();else super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;if(this.vertical_=!!e,this.vertical_)this.addClass("vjs-slider-vertical");else this.addClass("vjs-slider-horizontal")}}dt.registerComponent("Slider",ab);var Dy=(e,n)=>jp(e/n*100,0,100).toFixed(2)+"%";class H7 extends dt{constructor(e,n){super(e,n);this.partEls_=[],this.on(e,"progress",(i)=>this.update(i))}createEl(){let e=super.createEl("div",{className:"vjs-load-progress"}),n=on("span",{className:"vjs-control-text"}),i=on("span",{textContent:this.localize("Loaded")}),s=Et.default.createTextNode(": ");return this.percentageEl_=on("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(n),n.appendChild(i),n.appendChild(s),n.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{let n=this.player_.liveTracker,i=this.player_.buffered(),s=n&&n.isLive()?n.seekableEnd():this.player_.duration(),a=this.player_.bufferedEnd(),r=this.partEls_,l=Dy(a,s);if(this.percent_!==l)this.el_.style.width=l,Kc(this.percentageEl_,l),this.percent_=l;for(let c=0;c<i.length;c++){let p=i.start(c),m=i.end(c),g=r[c];if(!g)g=this.el_.appendChild(on()),r[c]=g;if(g.dataset.start===p&&g.dataset.end===m)continue;g.dataset.start=p,g.dataset.end=m,g.style.left=Dy(p,a),g.style.width=Dy(m-p,a)}for(let c=r.length;c>i.length;c--)this.el_.removeChild(r[c-1]);r.length=i.length})}}dt.registerComponent("LoadProgressBar",H7);class U7 extends dt{constructor(e,n){super(e,n);this.update=Ho(di(this,this.update),Or)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,n,i){let s=xp(this.el_),a=ld(this.player_.el()),r=e.width*n;if(!a||!s)return;let l=e.left-a.left+r,c=e.width-r+(a.right-e.right);if(!c)c=e.width-r,l=r;let p=s.width/2;if(l<p)p+=p-l;else if(c<p)p=c;if(p<0)p=0;else if(p>s.width)p=s.width;p=Math.round(p),this.el_.style.right=`-${p}px`,this.write(i)}write(e){Kc(this.el_,e)}updateTime(e,n,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let a,r=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let l=this.player_.liveTracker.liveWindow(),c=l-n*l;a=(c<1?"":"-")+dh(c,l)}else a=dh(i,r);if(this.update(e,n,a),s)s()})}}dt.registerComponent("TimeTooltip",U7);class rb extends dt{constructor(e,n){super(e,n);this.setIcon("circle"),this.update=Ho(di(this,this.update),Or)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,n,i){let s=this.getChild("timeTooltip");if(!s)return;let a=i&&i.target&&typeof i.target.pendingSeekTime==="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();s.updateTime(e,n,a)}}rb.prototype.options_={children:[]};if(!na&&!io)rb.prototype.options_.children.push("timeTooltip");dt.registerComponent("PlayProgressBar",rb);class D5 extends dt{constructor(e,n){super(e,n);this.update=Ho(di(this,this.update),Or)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,n){let i=n*this.player_.duration();this.getChild("timeTooltip").updateTime(e,n,i,()=>{this.el_.style.left=`${e.width*n}px`})}}D5.prototype.options_={children:["timeTooltip"]};dt.registerComponent("MouseTimeDisplay",D5);class ob extends ab{constructor(e,n){n=li(ob.prototype.options_,n),n.children=[...n.children];let i=e.options_.disableSeekWhileScrubbingOnMobile&&(na||io)||e.options_.disableSeekWhileScrubbingOnSTV;if(!na&&!io||i)n.children.splice(1,0,"mouseTimeDisplay");super(e,n);this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){if(this.update_=di(this,this.update),this.update=Ho(this.update_,Or),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker)this.on(this.player_.liveTracker,"liveedgechange",this.update);if(this.updateInterval=null,this.enableIntervalHandler_=(e)=>this.enableInterval_(e),this.disableIntervalHandler_=(e)=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Et.default&&"visibilityState"in Et.default)this.on(Et.default,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){if(Et.default.visibilityState==="hidden")this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e);else{if(!this.player_.ended()&&!this.player_.paused())this.enableInterval_();this.update()}}enableInterval_(){if(this.updateInterval)return;this.updateInterval=this.setInterval(this.update,Or)}disableInterval_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended")return;if(!this.updateInterval)return;this.clearInterval(this.updateInterval),this.updateInterval=null}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(Et.default.visibilityState==="hidden")return;let n=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker,a=this.player_.duration();if(s&&s.isLive())a=this.player_.liveTracker.liveCurrentTime();if(this.percent_!==n)this.el_.setAttribute("aria-valuenow",(n*100).toFixed(2)),this.percent_=n;if(this.currentTime_!==i||this.duration_!==a)this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[dh(i,a),dh(a,a)],"{1} of {2}")),this.currentTime_=i,this.duration_=a;if(this.bar)this.bar.update(ld(this.el()),this.getProgress(),e)}),n}userSeek_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive())this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){let n=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,n))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();let e=this.getCurrentTime_(),n,i=this.player_.liveTracker;if(i&&i.isLive()){if(n=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge())n=1}else n=e/this.player_.duration();return n}handleMouseDown(e){if(!kp(e))return;if(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),!this.shouldDisableSeekWhileScrubbing_)this.player_.pause();super.handleMouseDown(e)}handleMouseMove(e,n=!1){if(!kp(e)||isNaN(this.player_.duration()))return;if(!n&&!this.player_.scrubbing())this.player_.scrubbing(!0);let i,s=this.calculateDistance(e),a=this.player_.liveTracker;if(!a||!a.isLive()){if(i=s*this.player_.duration(),i===this.player_.duration())i=i-0.1}else{if(s>=0.99){a.seekToLiveEdge();return}let r=a.seekableStart(),l=a.liveCurrentTime();if(i=r+s*a.liveWindow(),i>=l)i=l;if(i<=r)i=r+0.1;if(i===1/0)return}if(this.shouldDisableSeekWhileScrubbing_)this.pendingSeekTime(i);else this.userSeek_(i);if(this.player_.options_.enableSmoothSeeking)this.update()}enable(){super.enable();let e=this.getChild("mouseTimeDisplay");if(!e)return;e.show()}disable(){super.disable();let e=this.getChild("mouseTimeDisplay");if(!e)return;e.hide()}handleMouseUp(e){if(super.handleMouseUp(e),e)e.stopPropagation();if(this.player_.scrubbing(!1),this.pendingSeekTime()!==null)this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null);if(this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying)Oo(this.player_.play());else this.update_()}handlePendingSeek_(e){if(!this.player_.paused())this.player_.pause();let n=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(n+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){if(this.shouldDisableSeekWhileScrubbing_)this.handlePendingSeek_(this.options().stepSeconds);else this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){if(this.shouldDisableSeekWhileScrubbing_)this.handlePendingSeek_(-this.options().stepSeconds);else this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){if(this.pendingSeekTime()!==null)this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null);if(this.player_.paused())this.player_.play();else this.player_.pause()}handleKeyDown(e){let n=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")if(e.preventDefault(),e.stopPropagation(),n&&n.isLive())this.userSeek_(n.liveCurrentTime());else this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();let i=parseInt(e.key,10)*0.1;if(n&&n.isLive())this.userSeek_(n.seekableStart()+n.liveWindow()*i);else this.userSeek_(this.player_.duration()*i)}else if(e.key==="PageDown")e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier);else if(e.key==="PageUp")e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier);else super.handleKeyDown(e)}dispose(){if(this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker)this.off(this.player_.liveTracker,"liveedgechange",this.update);if(this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Et.default&&"visibilityState"in Et.default)this.off(Et.default,"visibilitychange",this.toggleVisibility_);super.dispose()}}ob.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};dt.registerComponent("SeekBar",ob);class I5 extends dt{constructor(e,n){super(e,n);this.handleMouseMove=Ho(di(this,this.handleMouseMove),Or),this.throttledHandleMouseSeek=Ho(di(this,this.handleMouseSeek),Or),this.handleMouseUpHandler_=(i)=>this.handleMouseUp(i),this.handleMouseDownHandler_=(i)=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){let n=this.getChild("seekBar");if(!n)return;let i=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay");if(!i&&!s)return;let a=n.el(),r=xp(a),l=K1(a,e).x;if(l=jp(l,0,1),s)s.update(r,l);if(i)i.update(r,n.getProgress())}handleMouseSeek(e){let n=this.getChild("seekBar");if(n)n.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach((e)=>e.disable&&e.disable()),!this.enabled())return;if(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing()){let e=this.getChild("seekBar");if(this.player_.scrubbing(!1),e.videoWasPlaying)Oo(this.player_.play())}}enable(){if(this.children().forEach((e)=>e.enable&&e.enable()),this.enabled())return;this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0}removeListenersAddedOnMousedownAndTouchstart(){let e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){let n=this.el_.ownerDocument,i=this.getChild("seekBar");if(i)i.handleMouseDown(e);this.on(n,"mousemove",this.throttledHandleMouseSeek),this.on(n,"touchmove",this.throttledHandleMouseSeek),this.on(n,"mouseup",this.handleMouseUpHandler_),this.on(n,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let n=this.getChild("seekBar");if(n)n.handleMouseUp(e);this.removeListenersAddedOnMousedownAndTouchstart()}}I5.prototype.options_={children:["seekBar"]};dt.registerComponent("ProgressControl",I5);class M5 extends zs{constructor(e,n){super(e,n);this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(i)=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(i)=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}if(this.player_.isInPictureInPicture())this.player_.exitPictureInPicture();this.hide()}handlePictureInPictureEnabledChange(){if(Et.default.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in je.default)this.enable();else this.disable()}handlePictureInPictureChange(e){if(this.player_.isInPictureInPicture())this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture");else this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture");this.handlePictureInPictureEnabledChange()}handleClick(e){if(!this.player_.isInPictureInPicture())this.player_.requestPictureInPicture();else this.player_.exitPictureInPicture()}show(){if(typeof Et.default.exitPictureInPicture!=="function")return;super.show()}}M5.prototype.controlText_="Picture-in-Picture";dt.registerComponent("PictureInPictureToggle",M5);class R5 extends zs{constructor(e,n){super(e,n);if(this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",(i)=>this.handleFullscreenChange(i)),Et.default[e.fsApi_.fullscreenEnabled]===!1)this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){if(this.player_.isFullscreen())this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit");else this.controlText("Fullscreen"),this.setIcon("fullscreen-enter")}handleClick(e){if(!this.player_.isFullscreen())this.player_.requestFullscreen();else this.player_.exitFullscreen()}}R5.prototype.controlText_="Fullscreen";dt.registerComponent("FullscreenToggle",R5);var fM=function(e,n){if(n.tech_&&!n.tech_.featuresVolumeControl)e.addClass("vjs-hidden");e.on(n,"loadstart",function(){if(!n.tech_.featuresVolumeControl)e.addClass("vjs-hidden");else e.removeClass("vjs-hidden")})};class z7 extends dt{createEl(){let e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}dt.registerComponent("VolumeLevel",z7);class G7 extends dt{constructor(e,n){super(e,n);this.update=Ho(di(this,this.update),Or)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,n,i,s){if(!i){let a=ld(this.el_),r=ld(this.player_.el()),l=e.width*n;if(!r||!a)return;let c=e.left-r.left+l,p=e.width-l+(r.right-e.right),m=a.width/2;if(c<m)m+=m-c;else if(p<m)m=p;if(m<0)m=0;else if(m>a.width)m=a.width;this.el_.style.right=`-${m}px`}this.write(`${s}%`)}write(e){Kc(this.el_,e)}updateVolume(e,n,i,s,a){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{if(this.update(e,n,i,s.toFixed(0)),a)a()})}}dt.registerComponent("VolumeLevelTooltip",G7);class O5 extends dt{constructor(e,n){super(e,n);this.update=Ho(di(this,this.update),Or)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,n,i){let s=100*n;this.getChild("volumeLevelTooltip").updateVolume(e,n,i,s,()=>{if(i)this.el_.style.bottom=`${e.height*n}px`;else this.el_.style.left=`${e.width*n}px`})}}O5.prototype.options_={children:["volumeLevelTooltip"]};dt.registerComponent("MouseVolumeLevelDisplay",O5);class Ep extends ab{constructor(e,n){super(e,n);this.on("slideractive",(i)=>this.updateLastVolume_(i)),this.on(e,"volumechange",(i)=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){if(!kp(e))return;super.handleMouseDown(e)}handleMouseMove(e){let n=this.getChild("mouseVolumeLevelDisplay");if(n){let i=this.el(),s=ld(i),a=this.vertical(),r=K1(i,e);r=a?r.y:r.x,r=jp(r,0,1),n.update(s,r,a)}if(!kp(e))return;this.checkMuted(),this.player_.volume(this.calculateDistance(e))}checkMuted(){if(this.player_.muted())this.player_.muted(!1)}getPercent(){if(this.player_.muted())return 0;return this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+0.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-0.1)}updateARIAAttributes(e){let n=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",n),this.el_.setAttribute("aria-valuetext",n+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){let e=this.player_.volume();this.one("sliderinactive",()=>{if(this.player_.volume()===0)this.player_.lastVolume_(e)})}}Ep.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};if(!na&&!io)Ep.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Ep.prototype.playerEvent="volumechange";dt.registerComponent("VolumeBar",Ep);class F5 extends dt{constructor(e,n={}){if(n.vertical=n.vertical||!1,typeof n.volumeBar>"u"||rd(n.volumeBar))n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical;super(e,n);fM(this,e),this.throttledHandleMouseMove=Ho(di(this,this.handleMouseMove),Or),this.handleMouseUpHandler_=(i)=>this.handleMouseUp(i),this.on("mousedown",(i)=>this.handleMouseDown(i)),this.on("touchstart",(i)=>this.handleMouseDown(i)),this.on("mousemove",(i)=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";if(this.options_.vertical)e="vjs-volume-vertical";return super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){let n=this.el_.ownerDocument;this.on(n,"mousemove",this.throttledHandleMouseMove),this.on(n,"touchmove",this.throttledHandleMouseMove),this.on(n,"mouseup",this.handleMouseUpHandler_),this.on(n,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseMove),this.off(n,"touchmove",this.throttledHandleMouseMove),this.off(n,"mouseup",this.handleMouseUpHandler_),this.off(n,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}F5.prototype.options_={children:["volumeBar"]};dt.registerComponent("VolumeControl",F5);var dM=function(e,n){if(n.tech_&&!n.tech_.featuresMuteControl)e.addClass("vjs-hidden");e.on(n,"loadstart",function(){if(!n.tech_.featuresMuteControl)e.addClass("vjs-hidden");else e.removeClass("vjs-hidden")})};class N5 extends zs{constructor(e,n){super(e,n);dM(this,e),this.on(e,["loadstart","volumechange"],(i)=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){let n=this.player_.volume(),i=this.player_.lastVolume_();if(n===0){let s=i<0.1?0.1:i;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(this.player_.muted()?!1:!0)}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){let e=this.player_.volume(),n=3;if(this.setIcon("volume-high"),na&&this.player_.tech_&&this.player_.tech_.el_)this.player_.muted(this.player_.tech_.el_.muted);if(e===0||this.player_.muted())this.setIcon("volume-mute"),n=0;else if(e<0.33)this.setIcon("volume-low"),n=1;else if(e<0.67)this.setIcon("volume-medium"),n=2;X1(this.el_,[0,1,2,3].reduce((i,s)=>i+`${s?" ":""}vjs-vol-${s}`,"")),uh(this.el_,`vjs-vol-${n}`)}updateControlText_(){let n=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";if(this.controlText()!==n)this.controlText(n)}}N5.prototype.controlText_="Mute";dt.registerComponent("MuteToggle",N5);class P5 extends dt{constructor(e,n={}){if(typeof n.inline<"u")n.inline=n.inline;else n.inline=!0;if(typeof n.volumeControl>"u"||rd(n.volumeControl))n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline;super(e,n);this.handleKeyPressHandler_=(i)=>this.handleKeyPress(i),this.on(e,["loadstart"],(i)=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",(i)=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",(i)=>this.handleVolumeControlKeyUp(i)),this.on("keydown",(i)=>this.handleKeyPress(i)),this.on("mouseover",(i)=>this.handleMouseOver(i)),this.on("mouseout",(i)=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden"))this.addClass("vjs-hidden");if(this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden"))this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";if(!this.options_.inline)e="vjs-volume-panel-vertical";return super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){if(e.key==="Escape")this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),lr(Et.default,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ia(Et.default,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){if(e.key==="Escape")this.handleMouseOut()}}P5.prototype.options_={children:["muteToggle","volumeControl"]};dt.registerComponent("VolumePanel",P5);class B5 extends zs{constructor(e,n){super(e,n);if(this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime))this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show();else this.hide()}getSkipForwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;let n=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration(),a;if(n+this.skipTime<=s)a=n+this.skipTime;else a=s;this.player_.currentTime(a)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}B5.prototype.controlText_="Skip Forward";dt.registerComponent("SkipForward",B5);class L5 extends zs{constructor(e,n){super(e,n);if(this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime))this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show();else this.hide()}getSkipBackwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){let n=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart(),a;if(s&&n-this.skipTime<=s)a=s;else if(n>=this.skipTime)a=n-this.skipTime;else a=0;this.player_.currentTime(a)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}L5.prototype.controlText_="Skip Backward";dt.registerComponent("SkipBackward",L5);class H5 extends dt{constructor(e,n){super(e,n);if(n)this.menuButton_=n.menuButton;this.focusedChild_=-1,this.on("keydown",(i)=>this.handleKeyDown(i)),this.boundHandleBlur_=(i)=>this.handleBlur(i),this.boundHandleTapClick_=(i)=>this.handleTapClick(i)}addEventListenerForItem(e){if(!(e instanceof dt))return;this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_)}removeEventListenerForItem(e){if(!(e instanceof dt))return;this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_)}removeChild(e){if(typeof e==="string")e=this.getChild(e);this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){let n=this.addChild(e);if(n)this.addEventListenerForItem(n)}createEl(){let e=this.options_.contentElType||"ul";this.contentEl_=on(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");let n=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),lr(n,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),n}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let n=e.relatedTarget||Et.default.activeElement;if(!this.children().some((i)=>i.el()===n)){let i=this.menuButton_;if(i&&i.buttonPressed_&&n!==i.el().firstChild)i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();let n=this.children();if(!Array.isArray(n))return;let i=n.filter((s)=>s.el()===e.target)[0];if(!i)return;if(i.name()!=="CaptionSettingsMenuItem")this.menuButton_.focus()}}handleKeyDown(e){if(e.key==="ArrowLeft"||e.key==="ArrowDown")e.preventDefault(),e.stopPropagation(),this.stepForward();else if(e.key==="ArrowRight"||e.key==="ArrowUp")e.preventDefault(),e.stopPropagation(),this.stepBack()}stepForward(){let e=0;if(this.focusedChild_!==void 0)e=this.focusedChild_+1;this.focus(e)}stepBack(){let e=0;if(this.focusedChild_!==void 0)e=this.focusedChild_-1;this.focus(e)}focus(e=0){let n=this.children().slice();if(n.length&&n[0].hasClass("vjs-menu-title"))n.shift();if(n.length>0){if(e<0)e=0;else if(e>=n.length)e=n.length-1;this.focusedChild_=e,n[e].el_.focus()}}}dt.registerComponent("Menu",H5);class lb extends dt{constructor(e,n={}){super(e,n);this.menuButton_=new zs(e,n),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let i=zs.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let s=(a)=>this.handleClick(a);this.handleMenuKeyUp_=(a)=>this.handleMenuKeyUp(a),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",(a)=>this.handleKeyDown(a)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),lr(Et.default,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",(a)=>this.handleMouseLeave(a)),this.on("keydown",(a)=>this.handleSubmenuKeyDown(a))}update(){let e=this.createMenu();if(this.menu)this.menu.dispose(),this.removeChild(this.menu);if(this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_)this.hide(),this.menu.contentEl_.removeAttribute("role");else this.show(),this.menu.contentEl_.setAttribute("role","menu")}createMenu(){let e=new H5(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let n=on("li",{className:"vjs-menu-title",textContent:Vi(this.options_.title),tabIndex:-1}),i=new dt(this.player_,{el:n});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){return super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";if(this.options_.inline===!0)e+="-inline";else e+="-popup";let n=zs.prototype.buildCSSClass();return`vjs-menu-button ${e} ${n} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";if(this.options_.inline===!0)e+="-inline";else e+="-popup";return`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,n=this.menuButton_.el()){return this.menuButton_.controlText(e,n)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){if(this.buttonPressed_)this.unpressButton();else this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),ia(Et.default,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){if(e.key==="Escape"||e.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!e.key==="Tab")e.preventDefault(),this.menuButton_.focus()}else if(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)){if(!this.buttonPressed_)e.preventDefault(),this.pressButton()}}handleMenuKeyUp(e){if(e.key==="Escape"||e.key==="Tab")this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){if(e.key==="Escape"||e.key==="Tab"){if(this.buttonPressed_)this.unpressButton();if(!e.key==="Tab")e.preventDefault(),this.menuButton_.focus()}}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),na&&r7())return;this.menu.focus()}}unpressButton(){if(this.enabled_)this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false")}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}dt.registerComponent("MenuButton",lb);class cb extends lb{constructor(e,n){let i=n.tracks;super(e,n);if(this.items.length<=1)this.hide();if(!i)return;this.updateHandler_=di(this,this.update),this.cleanupHandler_=di(this,this.cleanupTrackListeners_),i.addEventListener("removetrack",this.updateHandler_),i.addEventListener("addtrack",this.updateHandler_),i.addEventListener("labelchange",this.updateHandler_),this.player_.on("ready",this.updateHandler_),this.player_.on("dispose",this.cleanupHandler_)}cleanupTrackListeners_(){if(!this.updateHandler_)return;let e=this.options_.tracks;if(e)e.removeEventListener("removetrack",this.updateHandler_),e.removeEventListener("addtrack",this.updateHandler_),e.removeEventListener("labelchange",this.updateHandler_);if(this.player_)this.player_.off("ready",this.updateHandler_),this.player_.off("dispose",this.cleanupHandler_);this.updateHandler_=null,this.cleanupHandler_=null}dispose(){this.cleanupTrackListeners_(),super.dispose()}}dt.registerComponent("TrackButton",cb);class md extends Cp{constructor(e,n){super(e,n);if(this.selectable=n.selectable,this.isSelected_=n.selected||!1,this.multiSelectable=n.multiSelectable,this.selected(this.isSelected_),this.selectable)if(this.multiSelectable)this.el_.setAttribute("role","menuitemcheckbox");else this.el_.setAttribute("role","menuitemradio");else this.el_.setAttribute("role","menuitem")}createEl(e,n,i){this.nonIconControl=!0;let s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},n),i),a=on("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});if(this.player_.options_.experimentalSvgIcons)s.appendChild(a);else s.replaceChild(a,s.querySelector(".vjs-icon-placeholder"));return s}handleKeyDown(e){if(!["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key))super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){if(this.selectable)if(e)this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0;else this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1}}dt.registerComponent("MenuItem",md);class gd extends md{constructor(e,n){let i=n.track,s=e.textTracks();n.label=i.label||i.language||"Unknown",n.selected=i.mode==="showing";super(e,n);this.track=i,this.kinds=(n.kinds||[n.kind||this.track.kind]).filter(Boolean);let a=(...l)=>{this.handleTracksChange.apply(this,l)},r=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],a),s.addEventListener("change",a),s.addEventListener("selectedlanguagechange",r),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],a),s.removeEventListener("change",a),s.removeEventListener("selectedlanguagechange",r)}),s.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof je.default.Event!=="object")try{l=new je.default.Event("change")}catch(c){}if(!l)l=Et.default.createEvent("Event"),l.initEvent("change",!0,!0);s.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){let n=this.track,i=this.player_.textTracks();if(super.handleClick(e),!i)return;for(let s=0;s<i.length;s++){let a=i[s];if(this.kinds.indexOf(a.kind)===-1)continue;if(a===n){if(a.mode!=="showing")a.mode="showing"}else if(a.mode!=="disabled")a.mode="disabled"}}handleTracksChange(e){let n=this.track.mode==="showing";if(n!==this.isSelected_)this.selected(n)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){let n=this.player_.cache_.selectedLanguage;if(n&&n.enabled&&n.language===this.track.language&&n.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}dt.registerComponent("TextTrackMenuItem",gd);class U5 extends gd{constructor(e,n){if(n.track={player:e,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},!n.kinds)n.kinds=[n.kind];if(n.label)n.track.label=n.label;else n.track.label=n.kinds.join(" and ")+" off";n.selectable=!0,n.multiSelectable=!1;super(e,n)}handleTracksChange(e){let n=this.player().textTracks(),i=!0;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(this.options_.kinds.indexOf(r.kind)>-1&&r.mode==="showing"){i=!1;break}}if(i!==this.isSelected_)this.selected(i)}handleSelectedLanguageChange(e){let n=this.player().textTracks(),i=!0;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(["captions","descriptions","subtitles"].indexOf(r.kind)>-1&&r.mode==="showing"){i=!1;break}}if(i)this.player_.cache_.selectedLanguage={enabled:!1}}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}dt.registerComponent("OffTextTrackMenuItem",U5);class gh extends cb{constructor(e,n={}){n.tracks=e.textTracks();super(e,n)}createItems(e=[],n=gd){let i;if(this.label_)i=`${this.label_} off`;e.push(new U5(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;let s=this.player_.textTracks();if(!Array.isArray(this.kinds_))this.kinds_=[this.kind_];for(let a=0;a<s.length;a++){let r=s[a];if(this.kinds_.indexOf(r.kind)>-1){let l=new n(this.player_,{track:r,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${r.kind}-menu-item`),e.push(l)}}return e}}dt.registerComponent("TextTrackButton",gh);class z5 extends md{constructor(e,n){let{track:i,cue:s}=n,a=e.currentTime();n.selectable=!0,n.multiSelectable=!1,n.label=s.text,n.selected=s.startTime<=a&&a<s.endTime;super(e,n);this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}dt.registerComponent("ChaptersTrackMenuItem",z5);class ub extends gh{constructor(e,n,i){super(e,n,i);this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach((s)=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;let n=this.findChaptersTrack();if(n!==this.track_)this.setTrack(n),super.update();else if(!this.items||n&&n.cues&&n.cues.length!==this.items.length)super.update()}setTrack(e){if(this.track_===e)return;if(!this.updateHandler_)this.updateHandler_=this.update.bind(this);if(this.track_){let n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(n)n.removeEventListener("load",this.updateHandler_);this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";let n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(n)n.addEventListener("load",this.updateHandler_);this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}findChaptersTrack(){let e=this.player_.textTracks()||[];for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.kind===this.kind_)return i}}getMenuCaption(){if(this.track_&&this.track_.label)return this.track_.label;return this.localize(Vi(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){let e=[];if(!this.track_)return e;let n=this.track_.cues;if(!n)return e;for(let i=0,s=n.length;i<s;i++){let a=n[i],r=new z5(this.player_,{track:this.track_,cue:a});e.push(r)}return e}}ub.prototype.kind_="chapters";ub.prototype.controlText_="Chapters";dt.registerComponent("ChaptersButton",ub);class hb extends gh{constructor(e,n,i){super(e,n,i);this.setIcon("audio-description");let s=e.textTracks(),a=di(this,this.handleTracksChange);s.addEventListener("change",a),this.on("dispose",function(){s.removeEventListener("change",a)})}handleTracksChange(e){let n=this.player().textTracks(),i=!1;for(let s=0,a=n.length;s<a;s++){let r=n[s];if(r.kind!==this.kind_&&r.mode==="showing"){i=!0;break}}if(i)this.disable();else this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}hb.prototype.kind_="descriptions";hb.prototype.controlText_="Descriptions";dt.registerComponent("DescriptionsButton",hb);class fb extends gh{constructor(e,n,i){super(e,n,i);this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}fb.prototype.kind_="subtitles";fb.prototype.controlText_="Subtitles";dt.registerComponent("SubtitlesButton",fb);class db extends gd{constructor(e,n){n.track={player:e,kind:n.kind,label:n.kind+" settings",selectable:!1,default:!1,mode:"disabled"},n.selectable=!1,n.name="CaptionSettingsMenuItem";super(e,n);this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+n.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}dt.registerComponent("CaptionSettingsMenuItem",db);class pb extends gh{constructor(e,n,i){super(e,n,i);this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))e.push(new db(this.player_,{kind:this.kind_})),this.hideThreshold_+=1;return super.createItems(e)}}pb.prototype.kind_="captions";pb.prototype.controlText_="Captions";dt.registerComponent("CaptionsButton",pb);class G5 extends gd{createEl(e,n,i){let s=super.createEl(e,n,i),a=s.querySelector(".vjs-menu-item-text");if(this.options_.track.kind==="captions"){if(this.player_.options_.experimentalSvgIcons)this.setIcon("captions",s);else a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0}));a.appendChild(on("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))}return s}}dt.registerComponent("SubsCapsMenuItem",G5);class mb extends gh{constructor(e,n={}){super(e,n);if(this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1)this.label_="captions",this.setIcon("captions");this.menuButton_.controlText(Vi(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings"))e.push(new db(this.player_,{kind:this.label_})),this.hideThreshold_+=1;return e=super.createItems(e,G5),e}}mb.prototype.kinds_=["captions","subtitles"];mb.prototype.controlText_="Subtitles";dt.registerComponent("SubsCapsButton",mb);class V5 extends md{constructor(e,n){let i=n.track,s=e.audioTracks();n.label=i.label||i.language||"Unknown",n.selected=i.enabled;super(e,n);this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);let a=(...r)=>{this.handleTracksChange.apply(this,r)};s.addEventListener("change",a),this.on("dispose",()=>{s.removeEventListener("change",a)})}createEl(e,n,i){let s=super.createEl(e,n,i),a=s.querySelector(".vjs-menu-item-text");if(["main-desc","descriptions","description"].indexOf(this.options_.track.kind)>=0)a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(on("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}));return s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){let n=this.player_.audioTracks();for(let i=0;i<n.length;i++){let s=n[i];if(s===this.track)continue;s.enabled=s===this.track}}}handleTracksChange(e){this.selected(this.track.enabled)}}dt.registerComponent("AudioTrackMenuItem",V5);class X5 extends cb{constructor(e,n={}){n.tracks=e.audioTracks();super(e,n);this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;let n=this.player_.audioTracks();for(let i=0;i<n.length;i++){let s=n[i];e.push(new V5(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}X5.prototype.controlText_="Audio Track";dt.registerComponent("AudioTrackButton",X5);class gb extends md{constructor(e,n){let i=n.rate,s=parseFloat(i,10);n.label=i,n.selected=s===e.playbackRate(),n.selectable=!0,n.multiSelectable=!1;super(e,n);this.label=i,this.rate=s,this.on(e,"ratechange",(a)=>this.update(a))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}gb.prototype.contentElType="button";dt.registerComponent("PlaybackRateMenuItem",gb);class W5 extends lb{constructor(e,n){super(e,n);this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(i)=>this.updateVisibility(i)),this.on(e,"ratechange",(i)=>this.updateLabel(i)),this.on(e,"playbackrateschange",(i)=>this.handlePlaybackRateschange(i))}createEl(){let e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=on("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){let e=this.playbackRates(),n=[];for(let i=e.length-1;i>=0;i--)n.push(new gb(this.player(),{rate:e[i]+"x"}));return n}handlePlaybackRateschange(e){this.update()}playbackRates(){let e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){if(this.playbackRateSupported())this.removeClass("vjs-hidden");else this.addClass("vjs-hidden")}updateLabel(e){if(this.playbackRateSupported())this.labelEl_.textContent=this.player().playbackRate()+"x"}}W5.prototype.controlText_="Playback Rate";dt.registerComponent("PlaybackRateMenuButton",W5);class K5 extends dt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",n={},i={}){if(!n.className)n.className=this.buildCSSClass();return super.createEl(e,n,i)}}dt.registerComponent("Spacer",K5);class V7 extends K5{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}dt.registerComponent("CustomControlSpacer",V7);class $5 extends dt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}$5.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};dt.registerComponent("ControlBar",$5);class Y5 extends ph{constructor(e,n){super(e,n);this.on(e,"error",(i)=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){let e=this.player().error();return e?this.localize(e.message):""}}Y5.prototype.options_=Object.assign({},ph.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});dt.registerComponent("ErrorDisplay",Y5);class Q5 extends dt{constructor(e,n={}){super(e,n);this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),on("select",{id:this.options_.id},{},this.options_.SelectOptions.map((n)=>{let i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Mr()}`)+"-"+n[1].replace(/\W+/g,""),s=on("option",{id:i,value:this.localize(n[0]),textContent:this.localize(n[1])});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),s}))}}dt.registerComponent("TextTrackSelect",Q5);class Gc extends dt{constructor(e,n={}){super(e,n);let i=on("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);let s=this.options_.selects;for(let a of s){let r=this.options_.selectConfigs[a],l=r.className,c=r.id.replace("%s",this.options_.id_),p=null,m=`vjs_select_${Mr()}`;if(this.options_.type==="colors"){p=on("span",{className:l});let y=on("label",{id:c,className:"vjs-label",textContent:this.localize(r.label)});y.setAttribute("for",m),p.appendChild(y)}let g=new Q5(e,{SelectOptions:r.options,legendId:this.options_.legendId,id:m,labelId:c});if(this.addChild(g),this.options_.type==="colors")p.appendChild(g.el()),this.el().appendChild(p)}}createEl(){return on("fieldset",{className:this.options_.className})}}dt.registerComponent("TextTrackFieldset",Gc);class J5 extends dt{constructor(e,n={}){super(e,n);let i=this.options_.textTrackComponentid,s=new Gc(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);let a=new Gc(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a);let r=new Gc(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r)}createEl(){return on("div",{className:"vjs-track-settings-colors"})}}dt.registerComponent("TextTrackSettingsColors",J5);class Z5 extends dt{constructor(e,n={}){super(e,n);let i=this.options_.textTrackComponentid,s=new Gc(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);let a=new Gc(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a);let r=new Gc(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r)}createEl(){return on("div",{className:"vjs-track-settings-font"})}}dt.registerComponent("TextTrackSettingsFont",Z5);class e3 extends dt{constructor(e,n={}){super(e,n);let i=new zs(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);let s=this.localize("Done"),a=new zs(e,{controlText:s,className:"vjs-done-button"});a.el().classList.remove("vjs-control","vjs-button"),a.el().textContent=s,this.addChild(a)}createEl(){return on("div",{className:"vjs-track-settings-controls"})}}dt.registerComponent("TrackSettingsControls",e3);var Iy="vjs-text-track-settings",v8=["#000","Black"],S8=["#00F","Blue"],_8=["#0FF","Cyan"],x8=["#0F0","Green"],k8=["#F0F","Magenta"],T8=["#F00","Red"],A8=["#FFF","White"],C8=["#FF0","Yellow"],My=["1","Opaque"],Ry=["0.5","Semi-Transparent"],j8=["0","Transparent"],Pc={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[v8,A8,T8,x8,S8,C8,k8,_8],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[My,Ry,j8],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[A8,v8,T8,x8,S8,C8,k8,_8],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:(e)=>e==="1.00"?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[My,Ry],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[j8,Ry,My],className:"vjs-window-opacity vjs-opacity"}};Pc.windowColor.options=Pc.backgroundColor.options;function X7(e,n){if(n)e=n(e);if(e&&e!=="none")return e}function pM(e,n){let i=e.options[e.options.selectedIndex].value;return X7(i,n)}function mM(e,n,i){if(!n)return;for(let s=0;s<e.options.length;s++)if(X7(e.options[s].value,i)===n){e.selectedIndex=s;break}}class W7 extends ph{constructor(e,n){n.temporary=!1;super(e,n);if(this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=on("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),n.persistTextTrackSettings===void 0)this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings;if(this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings)this.restoreSettings()}renderModalComponents(e){let n=new J5(e,{textTrackComponentid:this.id_,selectConfigs:Pc,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(n);let i=new Z5(e,{textTrackComponentid:this.id_,selectConfigs:Pc,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);let s=new e3(e);this.addChild(s)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Jf(Pc,(e)=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Z8(Pc,(e,n,i)=>{let s=pM(this.$(n.selector),n.parser);if(s!==void 0)e[i]=s;return e},{})}setValues(e){Jf(Pc,(n,i)=>{mM(this.$(n.selector),e[i],n.parser)})}setDefaults(){Jf(Pc,(e)=>{let n=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=n})}restoreSettings(){let e;try{e=JSON.parse(je.default.localStorage.getItem(Iy))}catch(n){Cn.warn(n)}if(e)this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let e=this.getValues();try{if(Object.keys(e).length)je.default.localStorage.setItem(Iy,JSON.stringify(e));else je.default.localStorage.removeItem(Iy)}catch(n){Cn.warn(n)}}updateDisplay(){let e=this.player_.getChild("textTrackDisplay");if(e)e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}dt.registerComponent("TextTrackSettings",W7);class K7 extends dt{constructor(e,n){let i=n.ResizeObserver||je.default.ResizeObserver;if(n.ResizeObserver===null)i=!1;let s=li({createEl:!i,reportTouchActivity:!1},n);super(e,s);if(this.ResizeObserver=n.ResizeObserver||je.default.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=_7(()=>{this.resizeHandler()},100,!1,this),i)this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el());else this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;let a=this.debouncedHandler_,r=this.unloadListener_=function(){ia(this,"resize",a),ia(this,"unload",r),r=null};lr(this.el_.contentWindow,"unload",r),lr(this.el_.contentWindow,"resize",a)},this.one("load",this.loadListener_)}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){if(!this.player_||!this.player_.trigger)return;this.player_.trigger("playerresize")}dispose(){if(this.debouncedHandler_)this.debouncedHandler_.cancel();if(this.resizeObserver_){if(this.player_.el())this.resizeObserver_.unobserve(this.player_.el());this.resizeObserver_.disconnect()}if(this.loadListener_)this.off("load",this.loadListener_);if(this.el_&&this.el_.contentWindow&&this.unloadListener_)this.unloadListener_.call(this.el_.contentWindow);this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}dt.registerComponent("ResizeManager",K7);var gM={trackingThreshold:20,liveTolerance:15};class $7 extends dt{constructor(e,n){let i=li(gM,n,{createEl:!1});super(e,i);this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=(s)=>this.handlePlay(s),this.handleFirstTimeupdate_=(s)=>this.handleFirstTimeupdate(s),this.handleSeeked_=(s)=>this.handleSeeked(s),this.seekToLiveEdge_=(s)=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",(s)=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){let e=this.player_.seekable();if(!e||!e.length)return;let n=Number(je.default.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(n-this.lastTime_)/1000;this.lastTime_=n,this.pastSeekEnd_=this.pastSeekEnd()+i;let s=this.liveCurrentTime(),a=this.player_.currentTime(),r=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-a)>this.options_.liveTolerance;if(!this.timeupdateSeen_||s===1/0)r=!1;if(r!==this.behindLiveEdge_)this.behindLiveEdge_=r,this.trigger("liveedgechange")}handleDurationchange(){this.toggleTracking()}toggleTracking(){if(this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold){if(this.player_.options_.liveui)this.player_.addClass("vjs-liveui");this.startTracking()}else this.player_.removeClass("vjs-liveui"),this.stopTracking()}startTracking(){if(this.isTracking())return;if(!this.timeupdateSeen_)this.timeupdateSeen_=this.player_.hasStarted();if(this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Or),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),!this.timeupdateSeen_)this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_);else this.on(this.player_,"seeked",this.handleSeeked_)}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){let e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){if(!this.isTracking())return;this.reset_(),this.trigger("liveedgechange")}seekableEnd(){let e=this.player_.seekable(),n=[],i=e?e.length:0;while(i--)n.push(e.end(i));return n.length?n.sort()[n.length-1]:1/0}seekableStart(){let e=this.player_.seekable(),n=[],i=e?e.length:0;while(i--)n.push(e.start(i));return n.length?n.sort()[0]:0}liveWindow(){let e=this.liveCurrentTime();if(e===1/0)return 0;return e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){let e=this.seekableEnd();if(this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_)this.pastSeekEnd_=0;return this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_==="number"}seekToLiveEdge(){if(this.seekedBehindLive_=!1,this.atLiveEdge())return;this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime())}dispose(){this.stopTracking(),super.dispose()}}dt.registerComponent("LiveTracker",$7);class Y7 extends dt{constructor(e,n){super(e,n);this.on("statechanged",(i)=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:on("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Mr()}`}),description:on("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Mr()}`})},on("div",{className:"vjs-title-bar"},{},e7(this.els))}updateDom_(){let e=this.player_.tech_,n=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};if(["title","description"].forEach((s)=>{let a=this.state[s],r=this.els[s],l=i[s];if($1(r),a)Kc(r,a);if(n){if(n.removeAttribute(l),a)n.setAttribute(l,r.id)}}),this.state.title||this.state.description)this.show();else this.hide()}update(e){this.setState(e)}dispose(){let e=this.player_.tech_,n=e&&e.el_;if(n)n.removeAttribute("aria-labelledby"),n.removeAttribute("aria-describedby");super.dispose(),this.els=null}}dt.registerComponent("TitleBar",Y7);var bM={initialDisplay:4000,position:[],takeFocus:!1};class Q7 extends zs{constructor(e,n){n=li(bM,n);super(e,n);this.controlText(n.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],(i)=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map((e)=>`vjs-${e}`).join(" ")}`}createEl(){let e=on("button",{},{type:"button",class:this.buildCSSClass()},on("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){if(super.show(),this.addClass("force-display"),this.options_.takeFocus)this.el().focus({preventScroll:!0});this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}dt.registerComponent("TransientButton",Q7);var Qy=(e)=>{let n=e.el();if(n.hasAttribute("src"))return e.triggerSourceset(n.src),!0;let i=e.$$("source"),s=[],a="";if(!i.length)return!1;for(let r=0;r<i.length;r++){let l=i[r].src;if(l&&s.indexOf(l)===-1)s.push(l)}if(!s.length)return!1;if(s.length===1)a=s[0];return e.triggerSourceset(a),!0},wM=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){let n=Et.default.createElement(this.nodeName.toLowerCase());n.innerHTML=e;let i=Et.default.createDocumentFragment();while(n.childNodes.length)i.appendChild(n.childNodes[0]);return this.innerText="",je.default.Element.prototype.appendChild.call(this,i),this.innerHTML}}),J7=(e,n)=>{let i={};for(let s=0;s<e.length;s++)if(i=Object.getOwnPropertyDescriptor(e[s],n),i&&i.set&&i.get)break;return i.enumerable=!0,i.configurable=!0,i},yM=(e)=>J7([e.el(),je.default.HTMLMediaElement.prototype,je.default.Element.prototype,wM],"innerHTML"),E8=function(e){let n=e.el();if(n.resetSourceWatch_)return;let i={},s=yM(e),a=(r)=>(...l)=>{let c=r.apply(n,l);return Qy(e),c};["append","appendChild","insertAdjacentHTML"].forEach((r)=>{if(!n[r])return;i[r]=n[r],n[r]=a(i[r])}),Object.defineProperty(n,"innerHTML",li(s,{set:a(s.set)})),n.resetSourceWatch_=()=>{n.resetSourceWatch_=null,Object.keys(i).forEach((r)=>{n[r]=i[r]}),Object.defineProperty(n,"innerHTML",s)},e.one("sourceset",n.resetSourceWatch_)},vM=Object.defineProperty({},"src",{get(){if(this.hasAttribute("src"))return I7(je.default.Element.prototype.getAttribute.call(this,"src"));return""},set(e){return je.default.Element.prototype.setAttribute.call(this,"src",e),e}}),SM=(e)=>J7([e.el(),je.default.HTMLMediaElement.prototype,vM],"src"),_M=function(e){if(!e.featuresSourceset)return;let n=e.el();if(n.resetSourceset_)return;let i=SM(e),{setAttribute:s,load:a}=n;if(Object.defineProperty(n,"src",li(i,{set:(r)=>{let l=i.set.call(n,r);return e.triggerSourceset(n.src),l}})),n.setAttribute=(r,l)=>{let c=s.call(n,r,l);if(/src/i.test(r))e.triggerSourceset(n.src);return c},n.load=()=>{let r=a.call(n);if(!Qy(e))e.triggerSourceset(""),E8(e);return r},n.currentSrc)e.triggerSourceset(n.currentSrc);else if(!Qy(e))E8(e);n.resetSourceset_=()=>{if(n.resetSourceset_=null,n.load=a,n.setAttribute=s,Object.defineProperty(n,"src",i),n.resetSourceWatch_)n.resetSourceWatch_()}};class Lt extends Tn{constructor(e,n){super(e,n);let i=e.source,s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3))this.setSource(i);else this.handleLateInit_(this.el_);if(e.enableSourceset)this.setupSourcesetHandling_();if(this.isScrubbing_=!1,this.el_.hasChildNodes()){let a=this.el_.childNodes,r=a.length,l=[];while(r--){let c=a[r];if(c.nodeName.toLowerCase()==="track"){if(!this.featuresNativeTextTracks)l.push(c);else if(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!s&&!this.el_.hasAttribute("crossorigin")&&tb(c.src))s=!0}}for(let c=0;c<l.length;c++)this.el_.removeChild(l[c])}if(this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s)Cn.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
+
This may prevent text tracks from loading.`);if(this.restoreMetadataTracksInIOSNativePlayer_(),(_p||G1)&&e.nativeControlsForTouch===!0)this.setControls(!0);this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){if(this.el_&&this.el_.resetSourceset_)this.el_.resetSourceset_();Lt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){_M(this)}restoreMetadataTracksInIOSNativePlayer_(){let e=this.textTracks(),n,i=()=>{n=[];for(let a=0;a<e.length;a++){let r=e[a];if(r.kind==="metadata")n.push({track:r,storedMode:r.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));let s=()=>{for(let a=0;a<n.length;a++){let r=n[a];if(r.track.mode==="disabled"&&r.track.mode!==r.storedMode)r.track.mode=r.storedMode}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)})}overrideNative_(e,n){if(n!==this[`featuresNative${e}Tracks`])return;let i=e.toLowerCase();if(this[`${i}TracksListeners_`])Object.keys(this[`${i}TracksListeners_`]).forEach((s)=>{this.el()[`${i}Tracks`].removeEventListener(s,this[`${i}TracksListeners_`][s])});this[`featuresNative${e}Tracks`]=!n,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){let n=Ir[e],i=this.el()[n.getterName],s=this[n.getterName]();if(!this[`featuresNative${n.capitalName}Tracks`]||!i||!i.addEventListener)return;let a={change:(l)=>{let c={type:"change",target:s,currentTarget:s,srcElement:s};if(s.trigger(c),e==="text")this[ud.remoteText.getterName]().trigger(c)},addtrack(l){s.addTrack(l.track)},removetrack(l){s.removeTrack(l.track)}},r=function(){let l=[];for(let c=0;c<s.length;c++){let p=!1;for(let m=0;m<i.length;m++)if(i[m]===s[c]){p=!0;break}if(!p)l.push(s[c])}while(l.length)s.removeTrack(l.shift())};this[n.getterName+"Listeners_"]=a,Object.keys(a).forEach((l)=>{let c=a[l];i.addEventListener(l,c),this.on("dispose",(p)=>i.removeEventListener(l,c))}),this.on("loadstart",r),this.on("dispose",(l)=>this.off("loadstart",r))}proxyNativeTracks_(){Ir.names.forEach((e)=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){let i=e.cloneNode(!0);if(e.parentNode)e.parentNode.insertBefore(i,e);Lt.disposeMediaElement(e),e=i}else{e=Et.default.createElement("video");let i=this.options_.tag&&Nc(this.options_.tag),s=li({},i);if(!_p||this.options_.nativeControlsForTouch!==!0)delete s.controls;c7(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}if(typeof this.options_.preload<"u")od(e,"preload",this.options_.preload);if(this.options_.disablePictureInPicture!==void 0)e.disablePictureInPicture=this.options_.disablePictureInPicture;let n=["loop","muted","playsinline","autoplay"];for(let i=0;i<n.length;i++){let s=n[i],a=this.options_[s];if(typeof a<"u"){if(a)od(e,s,s);else W1(e,s);e[s]=a}}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1,s=function(){i=!0};this.on("loadstart",s);let a=function(){if(!i)this.trigger("loadstart")};this.on("loadedmetadata",a),this.ready(function(){if(this.off("loadstart",s),this.off("loadedmetadata",a),!i)this.trigger("loadstart")});return}let n=["loadstart"];if(n.push("loadedmetadata"),e.readyState>=2)n.push("loadeddata");if(e.readyState>=3)n.push("canplay");if(e.readyState>=4)n.push("canplaythrough");this.ready(function(){n.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{if(this.isScrubbing_&&this.el_.fastSeek&&V1)this.el_.fastSeek(e);else this.el_.currentTime=e}catch(n){Cn(n,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&io&&Lo&&this.el_.currentTime===0){let e=()=>{if(this.el_.currentTime>0){if(this.el_.duration===1/0)this.trigger("durationchange");this.off("timeupdate",e)}};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;let e=function(){if(this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls())this.el_.controls=!1},n=function(){if("webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture")this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0})};this.on("webkitbeginfullscreen",n),this.on("dispose",()=>{this.off("webkitbeginfullscreen",n),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen==="function"}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Oo(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(n){this.trigger("fullscreenerror",n)}},0);else try{e.webkitEnterFullScreen()}catch(n){this.trigger("fullscreenerror",n)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)return this.el_.requestVideoFrameCallback(e);return super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys)this.el_.cancelVideoFrameCallback(e);else super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,n){if(!e)return Cn.error("Invalid source URL."),!1;let i={src:e};if(n)i.type=n;let s=on("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return Cn.error("Source URL is required to remove the source element."),!1;let n=this.el_.querySelectorAll("source");for(let i of n)if(i.src===e)return this.el_.removeChild(i),!0;return Cn.warn(`No matching source element found with src: ${e}`),!1}reset(){Lt.resetMediaElement(this.el_)}currentSrc(){if(this.currentSource_)return this.currentSource_.src;return this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,n,i){if(!this.featuresNativeTextTracks)return super.addTextTrack(e,n,i);return this.el_.addTextTrack(e,n,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);let n=Et.default.createElement("track");if(e.kind)n.kind=e.kind;if(e.label)n.label=e.label;if(e.language||e.srclang)n.srclang=e.language||e.srclang;if(e.default)n.default=e.default;if(e.id)n.id=e.id;if(e.src)n.src=e.src;return n}addRemoteTextTrack(e,n){let i=super.addRemoteTextTrack(e,n);if(this.featuresNativeTextTracks)this.el().appendChild(i);return i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){let n=this.$$("track"),i=n.length;while(i--)if(e===n[i]||e===n[i].track)this.el().removeChild(n[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality==="function")return this.el().getVideoPlaybackQuality();let e={};if(typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u")e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount;if(je.default.performance)e.creationTime=je.default.performance.now();return e}}H1(Lt,"TEST_VID",function(){if(!hd())return;let e=Et.default.createElement("video"),n=Et.default.createElement("track");return n.kind="captions",n.srclang="en",n.label="English",e.appendChild(n),e});Lt.isSupported=function(){try{Lt.TEST_VID.volume=0.5}catch(e){return!1}return!!(Lt.TEST_VID&&Lt.TEST_VID.canPlayType)};Lt.canPlayType=function(e){return Lt.TEST_VID.canPlayType(e)};Lt.canPlaySource=function(e,n){return Lt.canPlayType(e.type)};Lt.canControlVolume=function(){try{let e=Lt.TEST_VID.volume;Lt.TEST_VID.volume=e/2+0.1;let n=e!==Lt.TEST_VID.volume;if(n&&na)return je.default.setTimeout(()=>{if(Lt&&Lt.prototype)Lt.prototype.featuresVolumeControl=e!==Lt.TEST_VID.volume}),!1;return n}catch(e){return!1}};Lt.canMuteVolume=function(){try{let e=Lt.TEST_VID.muted;if(Lt.TEST_VID.muted=!e,Lt.TEST_VID.muted)od(Lt.TEST_VID,"muted","muted");else W1(Lt.TEST_VID,"muted","muted");return e!==Lt.TEST_VID.muted}catch(e){return!1}};Lt.canControlPlaybackRate=function(){if(io&&Lo&&U1<58)return!1;try{let e=Lt.TEST_VID.playbackRate;return Lt.TEST_VID.playbackRate=e/2+0.1,e!==Lt.TEST_VID.playbackRate}catch(e){return!1}};Lt.canOverrideAttributes=function(){try{let e=()=>{};Object.defineProperty(Et.default.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(Et.default.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(Et.default.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(Et.default.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0};Lt.supportsNativeTextTracks=function(){return V1||na&&Lo};Lt.supportsNativeVideoTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.videoTracks)};Lt.supportsNativeAudioTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.audioTracks)};Lt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,n]){H1(Lt.prototype,e,()=>Lt[n](),!0)});Lt.prototype.featuresVolumeControl=Lt.canControlVolume();Lt.prototype.movingMediaElementInDOM=!na;Lt.prototype.featuresFullscreenResize=!0;Lt.prototype.featuresProgressEvents=!0;Lt.prototype.featuresTimeupdateEvents=!0;Lt.prototype.featuresVideoFrameCallback=!!(Lt.TEST_VID&&Lt.TEST_VID.requestVideoFrameCallback);Lt.disposeMediaElement=function(e){if(!e)return;if(e.parentNode)e.parentNode.removeChild(e);while(e.hasChildNodes())e.removeChild(e.firstChild);if(e.removeAttribute("src"),typeof e.load==="function")(function(){try{e.load()}catch(n){}})()};Lt.resetMediaElement=function(e){if(!e)return;let n=e.querySelectorAll("source"),i=n.length;while(i--)e.removeChild(n[i]);if(e.removeAttribute("src"),typeof e.load==="function")(function(){try{e.load()}catch(s){}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Lt.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Lt.prototype["set"+Vi(e)]=function(n){if(this.el_[e]=n,n)this.el_.setAttribute(e,e);else this.el_.removeAttribute(e)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){Lt.prototype[e]=function(){return this.el_[e]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){Lt.prototype["set"+Vi(e)]=function(n){this.el_[e]=n}});["pause","load","play"].forEach(function(e){Lt.prototype[e]=function(){return this.el_[e]()}});Tn.withSourceHandlers(Lt);Lt.nativeSourceHandler={};Lt.nativeSourceHandler.canPlayType=function(e){try{return Lt.TEST_VID.canPlayType(e)}catch(n){return""}};Lt.nativeSourceHandler.canHandleSource=function(e,n){if(e.type)return Lt.nativeSourceHandler.canPlayType(e.type);else if(e.src){let i=k5(e.src);return Lt.nativeSourceHandler.canPlayType(`video/${i}`)}return""};Lt.nativeSourceHandler.handleSource=function(e,n,i){n.setSrc(e.src)};Lt.nativeSourceHandler.dispose=function(){};Lt.registerSourceHandler(Lt.nativeSourceHandler);Tn.registerTech("Html5",Lt);var Z7=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Oy={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Jy=["tiny","xsmall","small","medium","large","xlarge","huge"],w1={};Jy.forEach((e)=>{let n=e.charAt(0)==="x"?`x-${e.substring(1)}`:e;w1[e]=`vjs-layout-${n}`});var xM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Yn extends dt{constructor(e,n,i){if(e.id=e.id||n.id||`vjs_video_${Mr()}`,n=Object.assign(Yn.getTagSettings(e),n),n.initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language){let r=e.closest("[lang]");if(r)n.language=r.getAttribute("lang")}super(null,n,i);if(this.boundDocumentFullscreenChange_=(r)=>this.documentFullscreenChange_(r),this.boundFullWindowOnEscKey_=(r)=>this.fullWindowOnEscKey(r),this.boundUpdateStyleEl_=(r)=>this.updateStyleEl_(r),this.boundApplyInitTime_=(r)=>this.applyInitTime_(r),this.boundUpdateCurrentBreakpoint_=(r)=>this.updateCurrentBreakpoint_(r),this.boundHandleTechClick_=(r)=>this.handleTechClick_(r),this.boundHandleTechDoubleClick_=(r)=>this.handleTechDoubleClick_(r),this.boundHandleTechTouchStart_=(r)=>this.handleTechTouchStart_(r),this.boundHandleTechTouchMove_=(r)=>this.handleTechTouchMove_(r),this.boundHandleTechTouchEnd_=(r)=>this.handleTechTouchEnd_(r),this.boundHandleTechTap_=(r)=>this.handleTechTap_(r),this.boundUpdatePlayerHeightOnAudioOnlyMode_=(r)=>this.updatePlayerHeightOnAudioOnlyMode_(r),this.isFullscreen_=!1,this.log=Q8(this.id_),this.fsApi_=v1,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Nc(e),this.language(this.options_.language),n.languages){let r={};Object.getOwnPropertyNames(n.languages).forEach(function(l){r[l.toLowerCase()]=n.languages[l]}),this.languages_=r}else this.languages_=Yn.prototype.options_.languages;if(this.resetCache_(),this.poster_=n.poster||"",this.controls_=!!n.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay"))this.autoplay(!0);else this.autoplay(this.options_.autoplay);if(n.plugins)Object.keys(n.plugins).forEach((r)=>{if(typeof this[r]!=="function")throw Error(`plugin "${r}" does not exist`)});if(this.scrubbing_=!1,this.el_=this.createEl(),y5(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen)lr(Et.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);if(this.fluid_)this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let s=li(this.options_);if(n.plugins)Object.keys(n.plugins).forEach((r)=>{this[r](n.plugins[r])});if(n.debug)this.debug(!0);if(this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(n.playbackRates),n.experimentalSvgIcons){let l=new je.default.DOMParser().parseFromString(cM,"image/svg+xml");if(l.querySelector("parsererror"))Cn.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{let p=l.documentElement;p.style.display="none",this.el_.appendChild(p),this.addClass("vjs-svg-icons-enabled")}}if(this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls())this.addClass("vjs-controls-enabled");else this.addClass("vjs-controls-disabled");if(this.el_.setAttribute("role","region"),this.isAudio())this.el_.setAttribute("aria-label",this.localize("Audio Player"));else this.el_.setAttribute("aria-label",this.localize("Video Player"));if(this.isAudio())this.addClass("vjs-audio");if(n.spatialNavigation&&n.spatialNavigation.enabled)this.spatialNavigation=new R7(this),this.addClass("vjs-spatial-navigation-enabled");if(_p)this.addClass("vjs-touch-enabled");if(!na)this.addClass("vjs-workinghover");Yn.players[this.id_]=this;let a=Uy.split(".")[0];this.addClass(`vjs-v${a}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(r)=>this.listenForUserActivity_(r)),this.on("keydown",(r)=>this.handleKeyDown(r)),this.on("languagechange",(r)=>this.handleLanguagechange(r)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){if(this.trigger("dispose"),this.off("dispose"),ia(Et.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ia(Et.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode)this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null;if(Yn.players[this.id_]=null,this.tag&&this.tag.player)this.tag.player=null;if(this.el_&&this.el_.player)this.el_.player=null;if(this.tech_)this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_="";if(this.playerElIngest_)this.playerElIngest_=null;if(this.tag)this.tag=null;aM(this),ya.names.forEach((e)=>{let n=ya[e],i=this[n.getterName]();if(i&&i.off)i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,n,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player"),s=this.tag.tagName.toLowerCase()==="video-js";if(i)n=this.el_=e.parentNode;else if(!s)n=this.el_=super.createEl("div");let a=Nc(e);if(s){n=this.el_=e,e=this.tag=Et.default.createElement("video");while(n.children.length)e.appendChild(n.firstChild);if(!bp(n,"video-js"))uh(n,"video-js");n.appendChild(e),i=this.playerElIngest_=n,Object.keys(n).forEach((c)=>{try{e[c]=n[c]}catch(p){}})}if(e.setAttribute("tabindex","-1"),a.tabindex="-1",Lo&&z1)e.setAttribute("role","application"),a.role="application";if(e.removeAttribute("width"),e.removeAttribute("height"),"width"in a)delete a.width;if("height"in a)delete a.height;Object.getOwnPropertyNames(a).forEach(function(c){if(!(s&&c==="class"))n.setAttribute(c,a[c]);if(s)e.setAttribute(c,a[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=n.player=this,this.addClass("vjs-paused");let r=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter((c)=>a7[c]).map((c)=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...r),je.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=v7("vjs-styles-dimensions");let c=Xc(".vjs-styles-defaults"),p=Xc("head");p.insertBefore(this.styleEl_,c?c.nextSibling:p.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);let l=e.getElementsByTagName("a");for(let c=0;c<l.length;c++){let p=l.item(c);uh(p,"vjs-hidden"),p.setAttribute("hidden","hidden")}if(e.initNetworkState_=e.networkState,e.parentNode&&!i)e.parentNode.insertBefore(n,e);return Gy(e,n),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=n,n}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Cn.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}if(this.techCall_("setCrossOrigin",e),this.posterImage)this.posterImage.crossOrigin(e);return}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,n){let i=e+"_";if(n===void 0)return this[i]||0;if(n===""||n==="auto"){this[i]=void 0,this.updateStyleEl_();return}let s=parseFloat(n);if(isNaN(s)){Cn.error(`Improper value "${n}" supplied for for ${e}`);return}this[i]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;if(this.fluid_=!!e,Rl(this))this.off(["playerreset","resize"],this.boundUpdateStyleEl_);if(e)this.addClass("vjs-fluid"),this.fill(!1),PI(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)});else this.removeClass("vjs-fluid");this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;if(this.fill_=!!e,e)this.addClass("vjs-fill"),this.fluid(!1);else this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(je.default.VIDEOJS_NO_DYNAMIC_STYLE===!0){let l=typeof this.width_==="number"?this.width_:this.options_.width,c=typeof this.height_==="number"?this.height_:this.options_.height,p=this.tech_&&this.tech_.el();if(p){if(l>=0)p.width=l;if(c>=0)p.height=c}return}let e,n,i,s;if(this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto")i=this.aspectRatio_;else if(this.videoWidth()>0)i=this.videoWidth()+":"+this.videoHeight();else i="16:9";let a=i.split(":"),r=a[1]/a[0];if(this.width_!==void 0)e=this.width_;else if(this.height_!==void 0)e=this.height_/r;else e=this.videoWidth()||300;if(this.height_!==void 0)n=this.height_;else n=e*r;if(/^[^a-zA-Z]/.test(this.id()))s="dimensions-"+this.id();else s=this.id()+"-dimensions";this.addClass(s),S7(this.styleEl_,`
|
|
172
|
+
.${s} {
|
|
173
|
+
width: ${e}px;
|
|
174
|
+
height: ${n}px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
|
+
padding-top: ${r*100}%;
|
|
179
|
+
}
|
|
180
|
+
`)}loadTech_(e,n){if(this.tech_)this.unloadTech_();let i=Vi(e),s=e.charAt(0).toLowerCase()+e.slice(1);if(i!=="Html5"&&this.tag)Tn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null;this.techName_=i,this.isReady_=!1;let a=this.autoplay();if(typeof this.autoplay()==="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)a=!1;let r={source:n,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};if(ya.names.forEach((c)=>{let p=ya[c];r[p.getterName]=this[p.privateName]}),Object.assign(r,this.options_[i]),Object.assign(r,this.options_[s]),Object.assign(r,this.options_[e.toLowerCase()]),this.tag)r.tag=this.tag;if(n&&n.src===this.cache_.src&&this.cache_.currentTime>0)r.startTime=this.cache_.currentTime;let l=Tn.getTech(e);if(!l)throw Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);if(this.tech_=new l(r),this.tech_.ready(di(this,this.handleTechReady_),!0),Yy.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Z7.forEach((c)=>{this.on(this.tech_,c,(p)=>this[`handleTech${Vi(c)}_`](p))}),Object.keys(Oy).forEach((c)=>{this.on(this.tech_,c,(p)=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Oy[c]}_`].bind(this),event:p});return}this[`handleTech${Oy[c]}_`](p)})}),this.on(this.tech_,"loadstart",(c)=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",(c)=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",(c)=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",(c)=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",(c)=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",(c)=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",(c)=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",(c)=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,p)=>this.handleTechFullscreenChange_(c,p)),this.on(this.tech_,"fullscreenerror",(c,p)=>this.handleTechFullscreenError_(c,p)),this.on(this.tech_,"enterpictureinpicture",(c)=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",(c)=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",(c)=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",(c)=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",(c)=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",(c)=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls())this.addTechControlsListeners_();if(this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag))Gy(this.tech_.el(),this.el());if(this.tag)this.tag.player=null,this.tag=null}unloadTech_(){if(ya.names.forEach((e)=>{let n=ya[e];this[n.privateName]=this[n.getterName]()}),this.textTracksJson_=Yy.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_)this.poster_="",this.trigger("posterchange");this.isPosterFromTech_=!1}tech(e){if(e===void 0)Cn.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
181
|
+
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
182
|
+
`);return this.tech_}version(){return{"video.js":Uy}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){if(this.triggerReady(),this.cache_.volume)this.techCall_("setVolume",this.cache_.volume);this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){if(this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),!this.paused())this.trigger("loadstart");else this.hasStarted(!1),this.trigger("loadstart");this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!=="string")return;let n=()=>{let s=this.muted();this.muted(!0);let a=()=>{this.muted(s)};this.playTerminatedQueue_.push(a);let r=this.play();if(!yp(r))return;return r.catch((l)=>{throw a(),Error(`Rejection at manualAutoplay. Restoring muted value. ${l?l:""}`)})},i;if(e==="any"&&!this.muted()){if(i=this.play(),yp(i))i=i.catch(n)}else if(e==="muted"&&!this.muted())i=n();else i=this.play();if(!yp(i))return;return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let n=e,i="";if(typeof n!=="string")n=e.src,i=e.type;if(this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],n&&!i)i=lM(this,n);this.cache_.source=li({},e,{src:n,type:i});let s=this.cache_.sources.filter((c)=>c.src&&c.src===n),a=[],r=this.$$("source"),l=[];for(let c=0;c<r.length;c++){let p=Nc(r[c]);if(a.push(p),p.src&&p.src===n)l.push(p.src)}if(l.length&&!s.length)this.cache_.sources=a;else if(!s.length)this.cache_.sources=[this.cache_.source];this.cache_.src=n}handleTechSourceset_(e){if(!this.changingSrc_){let n=(a)=>this.updateSourceCaches_(a),i=this.currentSource().src,s=e.src;if(i&&!/^blob:/.test(i)&&/^blob:/.test(s)){if(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)n=()=>{}}if(n(s),!e.src)this.tech_.any(["sourceset","loadstart"],(a)=>{if(a.type==="sourceset")return;let r=this.techGet_("currentSrc");this.lastSource_.tech=r,this.updateSourceCaches_(r)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;if(e===this.hasStarted_)return;if(this.hasStarted_=e,this.hasStarted_)this.addClass("vjs-has-started");else this.removeClass("vjs-has-started")}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){if(this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0)this.queuedCallbacks_.forEach((e)=>e.callback(e.event)),this.queuedCallbacks_=[];this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let e=this.currentTime(),n=()=>{if(e!==this.currentTime())this.removeClass("vjs-waiting"),this.off("timeupdate",n)};this.on("timeupdate",n)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){if(this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop)this.currentTime(0),this.play();else if(!this.paused())this.pause();this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){if(!this.controls_)return;if(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)if(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click==="function")this.options_.userActions.click.call(this,e);else if(this.paused())Oo(this.play());else this.pause()}handleTechDoubleClick_(e){if(!this.controls_)return;if(!Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(i)=>i.contains(e.target))){if(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)if(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick==="function")this.options_.userActions.doubleClick.call(this,e);else if(this.isInPictureInPicture()&&!Et.default.pictureInPictureElement)this.exitPictureInPicture();else if(this.isFullscreen())this.exitFullscreen();else this.requestFullscreen()}}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){if(this.userWasActive)this.reportUserActivity()}handleTechTouchEnd_(e){if(e.cancelable)e.preventDefault()}toggleFullscreenClass_(){if(this.isFullscreen())this.addClass("vjs-fullscreen");else this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){let n=e.target.player;if(n&&n!==this)return;let i=this.el(),s=Et.default[this.fsApi_.fullscreenElement]===i;if(!s&&i.matches)s=i.matches(":"+this.fsApi_.fullscreen);this.isFullscreen(s)}handleTechFullscreenChange_(e,n){if(n){if(n.nativeIOSFullscreen)this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")});this.isFullscreen(n.isFullscreen)}}handleTechFullscreenError_(e,n){this.trigger("fullscreenerror",n)}togglePictureInPictureClass_(){if(this.isInPictureInPicture())this.addClass("vjs-picture-in-picture");else this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){let e=this.tech_.error();if(e)this.error(e)}handleTechTextData_(){let e=null;if(arguments.length>1)e=arguments[1];this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,n){this.ready(function(){if(e in iM)return tM(this.middleware_,this.tech_,e,n);else if(e in p8)return d8(this.middleware_,this.tech_,e,n);try{if(this.tech_)this.tech_[e](n)}catch(i){throw Cn(i),i}},!0)}techGet_(e){if(!this.tech_||!this.tech_.isReady_)return;if(e in nM)return eM(this.middleware_,this.tech_,e);else if(e in p8)return d8(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(n){if(this.tech_[e]===void 0)throw Cn(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,n),n;if(n.name==="TypeError")throw Cn(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,n),this.tech_.isReady_=!1,n;throw Cn(n),n}}play(){return new Promise((e)=>{this.play_(e)})}play_(e=Oo){this.playCallbacks_.push(e);let n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(V1||na);if(this.waitToPlay_)this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null;if(!this.isReady_||!n){if(this.waitToPlay_=(r)=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!n&&i)this.load();return}let s=this.techGet_("play");if(i&&this.hasClass("vjs-ended"))this.resetProgressBar_();if(s===null)this.runPlayTerminatedQueue_();else this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){let e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(n){n()})}runPlayCallbacks_(e){let n=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],n.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")===!1?!1:!0}played(){return this.techGet_("played")||no(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;if(this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e)this.addClass("vjs-scrubbing");else this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0)e=0;if(!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}if(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e))this.cache_.currentTime=Number(e)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;if(e=parseFloat(e),e<0)e=1/0;if(e!==this.cache_.duration){if(this.cache_.duration=e,e===1/0)this.addClass("vjs-live");else this.removeClass("vjs-live");if(!isNaN(e))this.trigger("durationchange")}}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");if(!e||!e.length)e=no(0,0);return e}seekable(){let e=this.techGet_("seekable");if(!e||!e.length)e=no(0,0);return e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return q7(this.buffered(),this.duration())}bufferedEnd(){let e=this.buffered(),n=this.duration(),i=e.end(e.length-1);if(i>n)i=n;return i}volume(e){let n;if(e!==void 0){if(n=Math.max(0,Math.min(1,e)),this.cache_.volume=n,this.techCall_("setVolume",n),n>0)this.lastVolume_(n);return}return n=parseFloat(this.techGet_("volume")),isNaN(n)?1:n}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){if(e!==void 0)this.techCall_("setDefaultMuted",e);return this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){let n=this.isFullscreen_;if(this.isFullscreen_=Boolean(e),this.isFullscreen_!==n&&this.fsApi_.prefixed)this.trigger("fullscreenchange");this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){if(this.isInPictureInPicture())this.exitPictureInPicture();let n=this;return new Promise((i,s)=>{function a(){n.off("fullscreenerror",l),n.off("fullscreenchange",r)}function r(){a(),i()}function l(p,m){a(),s(m)}n.one("fullscreenchange",r),n.one("fullscreenerror",l);let c=n.requestFullscreenHelper_(e);if(c)c.then(a,a),c.then(i,s)})}requestFullscreenHelper_(e){let n;if(!this.fsApi_.prefixed){if(n=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0)n=e}if(this.fsApi_.requestFullscreen){let i=this.el_[this.fsApi_.requestFullscreen](n);if(i)i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1));return i}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("enterFullScreen");else this.enterFullWindow()}exitFullscreen(){let e=this;return new Promise((n,i)=>{function s(){e.off("fullscreenerror",r),e.off("fullscreenchange",a)}function a(){s(),n()}function r(c,p){s(),i(p)}e.one("fullscreenchange",a),e.one("fullscreenerror",r);let l=e.exitFullscreenHelper_();if(l)l.then(s,s),l.then(n,i)})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let e=Et.default[this.fsApi_.exitFullscreen]();if(e)Oo(e.then(()=>this.isFullscreen(!1)));return e}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===!0)this.techCall_("exitFullScreen");else this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=Et.default.documentElement.style.overflow,lr(Et.default,"keydown",this.boundFullWindowOnEscKey_),Et.default.documentElement.style.overflow="hidden",uh(Et.default.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){if(e.key==="Escape"){if(this.isFullscreen()===!0)if(!this.isFullWindow)this.exitFullscreen();else this.exitFullWindow()}}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ia(Et.default,"keydown",this.boundFullWindowOnEscKey_),Et.default.documentElement.style.overflow=this.docOrigOverflow,X1(Et.default.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&je.default.documentPictureInPicture){let e=Et.default.createElement(this.el().tagName);if(e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage)e.appendChild(this.posterImage.el().cloneNode(!0));if(this.titleBar)e.appendChild(this.titleBar.el().cloneNode(!0));return e.appendChild(on("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),je.default.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then((n)=>(b7(n),this.el_.parentNode.insertBefore(e,this.el_),n.document.body.appendChild(this.el_),n.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:n}),n.addEventListener("pagehide",(i)=>{let s=i.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),n))}if("pictureInPictureEnabled"in Et.default&&this.disablePictureInPicture()===!1)return this.techGet_("requestPictureInPicture");return Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(je.default.documentPictureInPicture&&je.default.documentPictureInPicture.window)return je.default.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in Et.default)return Et.default.exitPictureInPicture()}handleKeyDown(e){let{userActions:n}=this.options_;if(!n||!n.hotkeys)return;if(((s)=>{let a=s.tagName.toLowerCase();if(s.isContentEditable)return!0;let r=["button","checkbox","hidden","radio","reset","submit"];if(a==="input")return r.indexOf(s.type)===-1;return["textarea"].indexOf(a)!==-1})(this.el_.ownerDocument.activeElement))return;if(typeof n.hotkeys==="function")n.hotkeys.call(this,e);else this.handleHotkeys(e)}handleHotkeys(e){let n=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=(r)=>e.key.toLowerCase()==="f",muteKey:s=(r)=>e.key.toLowerCase()==="m",playPauseKey:a=(r)=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=n;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();let r=dt.getComponent("FullscreenToggle");if(Et.default[this.fsApi_.fullscreenEnabled]!==!1)r.prototype.handleClick.call(this,e)}else if(s.call(this,e))e.preventDefault(),e.stopPropagation(),dt.getComponent("MuteToggle").prototype.handleClick.call(this,e);else if(a.call(this,e))e.preventDefault(),e.stopPropagation(),dt.getComponent("PlayToggle").prototype.handleClick.call(this,e)}canPlayType(e){let n;for(let i=0,s=this.options_.techOrder;i<s.length;i++){let a=s[i],r=Tn.getTech(a);if(!r)r=dt.getComponent(a);if(!r){Cn.error(`The "${a}" tech is undefined. Skipped browser support check for that tech.`);continue}if(r.isSupported()){if(n=r.canPlayType(e),n)return n}}return""}selectSource(e){let n=this.options_.techOrder.map((l)=>[l,Tn.getTech(l)]).filter(([l,c])=>{if(c)return c.isSupported();return Cn.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1}),i=function(l,c,p){let m;return l.some((g)=>c.some((y)=>{if(m=p(g,y),m)return!0})),m},s,a=(l)=>(c,p)=>l(p,c),r=([l,c],p)=>{if(c.canPlaySource(p,this.options_[l.toLowerCase()]))return{source:p,tech:l}};if(this.options_.sourceOrder)s=i(e,n,a(r));else s=i(n,e,r);return s||!1}handleSrc_(e,n){if(typeof e>"u")return this.cache_.src||"";if(this.resetRetryOnError_)this.resetRetryOnError_();let i=M7(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,!n)this.cache_.sources=i;if(this.updateSourceCaches_(i[0]),JI(this,i[0],(s,a)=>{if(this.middleware_=a,!n)this.cache_.sources=i;if(this.updateSourceCaches_(s),this.src_(s)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}ZI(a,this.tech_)}),i.length>1){let s=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},a=()=>{this.off("error",s)};this.one("error",s),this.one("playing",a),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",a)}}}src(e){return this.handleSrc_(e,!1)}src_(e){let n=this.selectSource([e]);if(!n)return!0;if(!A7(n.tech,this.techName_))return this.changingSrc_=!0,this.loadTech_(n.tech,n.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1;return this.ready(function(){if(this.tech_.constructor.prototype.hasOwnProperty("setSource"))this.techCall_("setSource",e);else this.techCall_("src",e.src);this.changingSrc_=!1},!0),!1}addSourceElement(e,n){if(!this.tech_)return!1;return this.tech_.addSourceElement(e,n)}removeSourceElement(e){if(!this.tech_)return!1;return this.tech_.removeSourceElement(e)}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{let e=this.play();Oo(e.then(()=>this.doReset_()))}}doReset_(){if(this.tech_)this.tech_.clearTracks("text");if(this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar)this.titleBar.update({title:void 0,description:void 0});if(Rl(this))this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:e,durationDisplay:n,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:a}=i||{};if(e)e.updateContent();if(n)n.updateContent();if(s)s.updateContent();if(a){if(a.update(),a.loadProgressBar)a.loadProgressBar.update()}}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){let e=this.currentSource(),n=[];if(Object.keys(e).length!==0)n.push(e);return this.cache_.sources||n}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let n;if(typeof e==="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay)this.options_.autoplay=e,this.manualAutoplay_(typeof e==="string"?e:"play"),n=!1;else if(!e)this.options_.autoplay=!1;else this.options_.autoplay=!0;if(n=typeof n>"u"?this.options_.autoplay:n,this.tech_)this.techCall_("setAutoplay",n)}playsinline(e){if(e!==void 0)this.techCall_("setPlaysinline",e),this.options_.playsinline=e;return this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;if(!e)e="";if(e===this.poster_)return;this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange")}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){let e=this.tech_.poster()||"";if(e!==this.poster_)this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange")}}controls(e){if(e===void 0)return!!this.controls_;if(e=!!e,this.controls_===e)return;if(this.controls_=e,this.usingNativeControls())this.techCall_("setControls",e);if(this.controls_){if(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),!this.usingNativeControls())this.addTechControlsListeners_()}else if(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),!this.usingNativeControls())this.removeTechControlsListeners_()}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;if(e=!!e,this.usingNativeControls_===e)return;if(this.usingNativeControls_=e,this.usingNativeControls_)this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols");else this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")}error(e){if(e===void 0)return this.error_||null;if(Vc("beforeerror").forEach((n)=>{let i=n(this,e);if(!(Bo(i)&&!Array.isArray(i)||typeof i==="string"||typeof i==="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){let n=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],n),this.one("loadstart",function(){this.off(["click","touchstart"],n)});return}if(e===null){if(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay)this.errorDisplay.close();return}this.error_=new Fi(e),this.addClass("vjs-error"),Cn.error(`(CODE:${this.error_.code} ${Fi.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Vc("error").forEach((n)=>n(this,this.error_));return}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e===this.userActive_)return;if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}if(this.tech_)this.tech_.one("mousemove",function(n){n.stopPropagation(),n.preventDefault()});this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}listenForUserActivity_(){let e,n,i,s=di(this,this.reportUserActivity),a=function(g){if(g.screenX!==n||g.screenY!==i)n=g.screenX,i=g.screenY,s()},r=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},l=function(g){s(),this.clearInterval(e)};this.on("mousedown",r),this.on("mousemove",a),this.on("mouseup",l),this.on("mouseleave",l);let c=this.getChild("controlBar");if(c&&!na&&!io)c.on("mouseenter",function(g){if(this.player().options_.inactivityTimeout!==0)this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(g){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout});this.on("keydown",s),this.on("keyup",s);let p,m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);let g=this.options_.inactivityTimeout;if(g<=0)return;p=this.setTimeout(function(){if(!this.userActivity_)this.userActive(!1)},g)};this.setInterval(m,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}if(this.tech_&&this.tech_.featuresPlaybackRate)return this.cache_.lastPlaybackRate||this.techGet_("playbackRate");return 1}defaultPlaybackRate(e){if(e!==void 0)return this.techCall_("setDefaultPlaybackRate",e);if(this.tech_&&this.tech_.featuresPlaybackRate)return this.techGet_("defaultPlaybackRate");return 1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){let e=this.getChild("ControlBar");if(!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight())return;this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight)}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");let e=this.children(),n=this.getChild("ControlBar"),i=n&&n.currentHeight();e.forEach((s)=>{if(s===n)return;if(s.el_&&!s.hasClass("vjs-hidden"))s.hide(),this.audioOnlyCache_.hiddenChildren.push(s)}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach((e)=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!=="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){let n=[];if(this.isInPictureInPicture())n.push(this.exitPictureInPicture());if(this.isFullscreen())n.push(this.exitFullscreen());if(this.audioPosterMode())n.push(this.audioPosterMode(!1));return Promise.all(n).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){if(typeof e!=="boolean"||e===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=e,e){if(this.audioOnlyMode())return this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()});return Promise.resolve().then(()=>{this.enablePosterModeUI_()})}return Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,n,i){if(this.tech_)return this.tech_.addTextTrack(e,n,i)}addRemoteTextTrack(e,n){if(this.tech_)return this.tech_.addRemoteTextTrack(e,n)}removeRemoteTextTrack(e={}){let{track:n}=e;if(!n)n=e;if(this.tech_)return this.tech_.removeRemoteTextTrack(n)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;if(this.language_!==String(e).toLowerCase()){if(this.language_=String(e).toLowerCase(),Rl(this))this.trigger("languagechange")}}languages(){return li(Yn.prototype.options_.languages,this.languages_)}toJSON(){let e=li(this.options_),n=e.tracks;e.tracks=[];for(let i=0;i<n.length;i++){let s=n[i];s=li(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,n){n=n||{},n.content=e||"";let i=new ph(this,n);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;let e=this.currentBreakpoint(),n=this.currentWidth();for(let i=0;i<Jy.length;i++){let s=Jy[i],a=this.breakpoints_[s];if(n<=a){if(e===s)return;if(e)this.removeClass(w1[e]);this.addClass(w1[s]),this.breakpoint_=s;break}}}removeCurrentBreakpoint_(){let e=this.currentBreakpointClass();if(this.breakpoint_="",e)this.removeClass(e)}breakpoints(e){if(e===void 0)return Object.assign(this.breakpoints_);return this.removeCurrentBreakpoint_(),this.breakpoints_=Object.assign({},xM,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_)}responsive(e){if(e===void 0)return this.responsive_;e=Boolean(e);let n=this.responsive_;if(e===n)return;if(this.responsive_=e,e)this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_();else this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_();return e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return w1[this.breakpoint_]||""}loadMedia(e,n){if(!e||typeof e!=="object")return;let i=this.crossOrigin();this.reset(),this.cache_.media=li(e);let{artist:s,artwork:a,description:r,poster:l,src:c,textTracks:p,title:m}=this.cache_.media;if(!a&&l)this.cache_.media.artwork=[{src:l,type:q1(l)}];if(i)this.crossOrigin(i);if(c)this.src(c);if(l)this.poster(l);if(Array.isArray(p))p.forEach((g)=>this.addRemoteTextTrack(g,!1));if(this.titleBar)this.titleBar.update({title:m,description:r||s||""});this.ready(n)}getMedia(){if(!this.cache_.media){let e=this.poster(),n=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),(a)=>({kind:a.kind,label:a.label,language:a.language,src:a.src})),s={src:n,textTracks:i};if(e)s.poster=e,s.artwork=[{src:s.poster,type:q1(s.poster)}];return s}return li(this.cache_.media)}static getTagSettings(e){let n={sources:[],tracks:[]},i=Nc(e),s=i["data-setup"];if(bp(e,"vjs-fill"))i.fill=!0;if(bp(e,"vjs-fluid"))i.fluid=!0;if(s!==null)try{Object.assign(i,JSON.parse(s||"{}"))}catch(a){Cn.error("data-setup",a)}if(Object.assign(n,i),e.hasChildNodes()){let a=e.childNodes;for(let r=0,l=a.length;r<l;r++){let c=a[r],p=c.nodeName.toLowerCase();if(p==="source")n.sources.push(Nc(c));else if(p==="track")n.tracks.push(Nc(c))}}return n}debug(e){if(e===void 0)return this.debugEnabled_;if(e)this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0;else this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;if(!Array.isArray(e))return;if(!e.every((n)=>typeof n==="number"))return;this.cache_.playbackRates=e,this.trigger("playbackrateschange")}}Yn.prototype.videoTracks=()=>{};Yn.prototype.audioTracks=()=>{};Yn.prototype.textTracks=()=>{};Yn.prototype.remoteTextTracks=()=>{};Yn.prototype.remoteTextTrackEls=()=>{};ya.names.forEach(function(e){let n=ya[e];Yn.prototype[n.getterName]=function(){if(this.tech_)return this.tech_[n.getterName]();return this[n.privateName]=this[n.privateName]||new n.ListClass,this[n.privateName]}});Yn.prototype.crossorigin=Yn.prototype.crossOrigin;Yn.players={};var hp=je.default.navigator;Yn.prototype.options_={techOrder:Tn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2000,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:hp&&(hp.languages&&hp.languages[0]||hp.userLanguage||hp.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};Z7.forEach(function(e){Yn.prototype[`handleTech${Vi(e)}_`]=function(){return this.trigger(e)}});dt.registerComponent("Player",Yn);var I1="plugin",ed="activePlugins_",Yf={},M1=(e)=>Yf.hasOwnProperty(e),y1=(e)=>M1(e)?Yf[e]:void 0,eS=(e,n)=>{e[ed]=e[ed]||{},e[ed][n]=!0},R1=(e,n,i)=>{let s=(i?"before":"")+"pluginsetup";e.trigger(s,n),e.trigger(s+":"+n.name,n)},kM=function(e,n){let i=function(){R1(this,{name:e,plugin:n,instance:null},!0);let s=n.apply(this,arguments);return eS(this,e),R1(this,{name:e,plugin:n,instance:s}),s};return Object.keys(n).forEach(function(s){i[s]=n[s]}),i},q8=(e,n)=>(n.prototype.name=e,function(...i){R1(this,{name:e,plugin:n,instance:null},!0);let s=new n(...[this,...i]);return this[e]=()=>s,R1(this,s.getEventHash()),s});class La{constructor(e){if(this.constructor===La)throw Error("Plugin must be sub-classed; not directly instantiated.");if(this.player=e,!this.log)this.log=this.player.log.createLogger(this.name);y5(this),delete this.trigger,T7(this,this.constructor.defaultState),eS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,n={}){return dd(this.eventBusEl_,e,this.getEventHash(n))}handleStateChanged(e){}dispose(){let{name:e,player:n}=this;this.trigger("dispose"),this.off(),n.off("dispose",this.dispose),n[ed][e]=!1,this.player=this.state=null,n[e]=q8(e,Yf[e])}static isBasic(e){let n=typeof e==="string"?y1(e):e;return typeof n==="function"&&!La.prototype.isPrototypeOf(n.prototype)}static registerPlugin(e,n){if(typeof e!=="string")throw Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(M1(e))Cn.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Yn.prototype.hasOwnProperty(e))throw Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof n!=="function")throw Error(`Illegal plugin for "${e}", must be a function, was ${typeof n}.`);if(Yf[e]=n,e!==I1)if(La.isBasic(n))Yn.prototype[e]=kM(e,n);else Yn.prototype[e]=q8(e,n);return n}static deregisterPlugin(e){if(e===I1)throw Error("Cannot de-register base plugin.");if(M1(e))delete Yf[e],delete Yn.prototype[e]}static getPlugins(e=Object.keys(Yf)){let n;return e.forEach((i)=>{let s=y1(i);if(s)n=n||{},n[i]=s}),n}static getPluginVersion(e){let n=y1(e);return n&&n.VERSION||""}}La.getPlugin=y1;La.BASE_PLUGIN_NAME=I1;La.registerPlugin(I1,La);Yn.prototype.usingPlugin=function(e){return!!this[ed]&&this[ed][e]===!0};Yn.prototype.hasPlugin=function(e){return!!M1(e)};function TM(e,n){let i=!1;return function(...s){if(!i)Cn.warn(e);return i=!0,n.apply(this,s)}}function so(e,n,i,s){return TM(`${n} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s)}var AM={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},tS=(e)=>e.indexOf("#")===0?e.slice(1):e;function $e(e,n,i){let s=$e.getPlayer(e);if(s){if(n)Cn.warn(`Player "${e}" is already initialised. Options will not be applied.`);if(i)s.ready(i);return s}let a=typeof e==="string"?Xc("#"+tS(e)):e;if(!fd(a))throw TypeError("The element or ID supplied is not valid. (videojs)");let l=("getRootNode"in a?a.getRootNode()instanceof je.default.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;if(!a.ownerDocument.defaultView||!l.contains(a))Cn.warn("The element supplied is not included in the DOM");if(n=n||{},n.restoreEl===!0)n.restoreEl=(a.parentNode&&a.parentNode.hasAttribute&&a.parentNode.hasAttribute("data-vjs-player")?a.parentNode:a).cloneNode(!0);return Vc("beforesetup").forEach((p)=>{let m=p(a,li(n));if(!Bo(m)||Array.isArray(m)){Cn.error("please return an object in beforesetup hooks");return}n=li(n,m)}),s=new(dt.getComponent("Player"))(a,n,i),Vc("setup").forEach((p)=>p(s)),s}$e.hooks_=Il;$e.hooks=Vc;$e.hook=kI;$e.hookOnce=TI;$e.removeHook=Y8;if(je.default.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&hd()){let e=Xc(".vjs-styles-defaults");if(!e){e=v7("vjs-styles-defaults");let n=Xc("head");if(n)n.insertBefore(e,n.firstChild);S7(e,`
|
|
183
|
+
.video-js {
|
|
184
|
+
width: 300px;
|
|
185
|
+
height: 150px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
189
|
+
padding-top: 56.25%
|
|
190
|
+
}
|
|
191
|
+
`)}}Xy(1,$e);$e.VERSION=Uy;$e.options=Yn.prototype.options_;$e.getPlayers=()=>Yn.players;$e.getPlayer=(e)=>{let n=Yn.players,i;if(typeof e==="string"){let s=tS(e),a=n[s];if(a)return a;i=Xc("#"+s)}else i=e;if(fd(i)){let{player:s,playerId:a}=i;if(s||n[a])return s||n[a]}};$e.getAllPlayers=()=>Object.keys(Yn.players).map((e)=>Yn.players[e]).filter(Boolean);$e.players=Yn.players;$e.getComponent=dt.getComponent;$e.registerComponent=(e,n)=>{if(Tn.isTech(n))Cn.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);return dt.registerComponent.call(dt,e,n)};$e.getTech=Tn.getTech;$e.registerTech=Tn.registerTech;$e.use=QI;Object.defineProperty($e,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty($e.middleware,"TERMINATOR",{value:E1,writeable:!1,enumerable:!0});$e.browser=a7;$e.obj=jI;$e.mergeOptions=so(9,"videojs.mergeOptions","videojs.obj.merge",li);$e.defineLazyProperty=so(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",H1);$e.bind=so(9,"videojs.bind","native Function.prototype.bind",di);$e.registerPlugin=La.registerPlugin;$e.deregisterPlugin=La.deregisterPlugin;$e.plugin=(e,n)=>(Cn.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),La.registerPlugin(e,n));$e.getPlugins=La.getPlugins;$e.getPlugin=La.getPlugin;$e.getPluginVersion=La.getPluginVersion;$e.addLanguage=function(e,n){return e=(""+e).toLowerCase(),$e.options.languages=li($e.options.languages,{[e]:n}),$e.options.languages[e]};$e.log=Cn;$e.createLogger=Q8;$e.time=zI;$e.createTimeRange=so(9,"videojs.createTimeRange","videojs.time.createTimeRanges",no);$e.createTimeRanges=so(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",no);$e.formatTime=so(9,"videojs.formatTime","videojs.time.formatTime",dh);$e.setFormatTime=so(9,"videojs.setFormatTime","videojs.time.setFormatTime",j7);$e.resetFormatTime=so(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",E7);$e.parseUrl=so(9,"videojs.parseUrl","videojs.url.parseUrl",x5);$e.isCrossOrigin=so(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",tb);$e.EventTarget=Ha;$e.any=w5;$e.on=lr;$e.one=Q1;$e.off=ia;$e.trigger=dd;$e.xhr=d5.default;$e.TrackList=Wc;$e.TextTrack=pd;$e.TextTrackList=Z1;$e.AudioTrack=T5;$e.AudioTrackList=S5;$e.VideoTrack=A5;$e.VideoTrackList=_5;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e)=>{$e[e]=function(){return Cn.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),w7[e].apply(null,arguments)}});$e.computedStyle=so(9,"videojs.computedStyle","videojs.dom.computedStyle",cd);$e.dom=w7;$e.fn=NI;$e.num=hM;$e.str=HI;$e.url=$I;$e.Error=AM;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class nS{constructor(e){let n=this;return n.id=e.id,n.label=n.id,n.width=e.width,n.height=e.height,n.bitrate=e.bandwidth,n.frameRate=e.frameRate,n.enabled_=e.enabled,Object.defineProperty(n,"enabled",{get(){return n.enabled_()},set(i){n.enabled_(i)}}),n}}class Tp extends $e.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let n=this.getQualityLevelById(e.id);if(n)return n;let i=this.levels_.length;if(n=new nS(e),!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});return this.levels_.push(n),this.trigger({qualityLevel:n,type:"addqualitylevel"}),n}removeQualityLevel(e){let n=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){if(n=this.levels_.splice(i,1)[0],this.selectedIndex_===i)this.selectedIndex_=-1;else if(this.selectedIndex_>i)this.selectedIndex_--;break}if(n)this.trigger({qualityLevel:e,type:"removequalitylevel"});return n}getQualityLevelById(e){for(let n=0,i=this.length;n<i;n++){let s=this[n];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Tp.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(let e in Tp.prototype.allowedEvents_)Tp.prototype["on"+e]=null;var sS="4.1.0",CM=function(e,n){let i=e.qualityLevels,s=new Tp,a=function(){s.dispose(),e.qualityLevels=i,e.off("dispose",a)};return e.on("dispose",a),e.qualityLevels=()=>s,e.qualityLevels.VERSION=sS,s},aS=function(e){return CM(this,$e.obj.merge({},e))};$e.registerPlugin("qualityLevels",aS);aS.VERSION=sS;/*! @name @videojs/http-streaming @version 3.17.5 @license Apache-2.0 */var Pa=qf,O1=(e,n)=>{if(n&&n.responseURL&&e!==n.responseURL)return n.responseURL;return e},Fr=(e)=>{if($e.log.debug)return $e.log.debug.bind($e,"VHS:",`${e} >`);return function(){}};function Qn(...e){let n=$e.obj||$e;return(n.merge||n.mergeOptions).apply(n,e)}function Is(...e){let n=$e.time||$e;return(n.createTimeRanges||n.createTimeRanges).apply(n,e)}function jM(e){if(e.length===0)return"Buffered Ranges are empty";let n=`Buffered Ranges:
|
|
192
|
+
`;for(let i=0;i<e.length;i++){let s=e.start(i),a=e.end(i);n+=`${s} --> ${a}. Duration (${a-s})
|
|
193
|
+
`}return n}var Fo=0.03333333333333333,No=Fo*3,rS=function(e,n){let i=[],s;if(e&&e.length){for(s=0;s<e.length;s++)if(n(e.start(s),e.end(s)))i.push([e.start(s),e.end(s)])}return Is(i)},Qf=function(e,n){return rS(e,function(i,s){return i-No<=n&&s+No>=n})},p1=function(e,n){return rS(e,function(i){return i-Fo>=n})},EM=function(e){if(e.length<2)return Is();let n=[];for(let i=1;i<e.length;i++){let s=e.end(i-1),a=e.start(i);n.push([s,a])}return Is(n)},qM=function(e,n){let i=null,s=null,a=0,r=[],l=[];if(!e||!e.length||!n||!n.length)return Is();let c=e.length;while(c--)r.push({time:e.start(c),type:"start"}),r.push({time:e.end(c),type:"end"});c=n.length;while(c--)r.push({time:n.start(c),type:"start"}),r.push({time:n.end(c),type:"end"});r.sort(function(p,m){return p.time-m.time});for(c=0;c<r.length;c++){if(r[c].type==="start"){if(a++,a===2)i=r[c].time}else if(r[c].type==="end"){if(a--,a===1)s=r[c].time}if(i!==null&&s!==null)l.push([i,s]),i=null,s=null}return Is(l)},oS=(e)=>{let n=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)n.push(e.start(i)+" => "+e.end(i));return n.join(", ")},DM=function(e,n,i=1){return((e.length?e.end(e.length-1):0)-n)/i},lh=(e)=>{let n=[];for(let i=0;i<e.length;i++)n.push({start:e.start(i),end:e.end(i)});return n},IM=function(e,n){if(e===n)return!1;if(!e&&n||!n&&e)return!0;if(e.length!==n.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==n.start(i)||e.end(i)!==n.end(i))return!0;return!1},Fy=function(e){if(!e||!e.length||!e.end)return;return e.end(e.length-1)},t3=function(e,n){let i=0;if(!e||!e.length)return i;for(let s=0;s<e.length;s++){let a=e.start(s),r=e.end(s);if(n>r)continue;if(n>a&&n<=r){i+=r-n;continue}i+=r-a}return i},n3=(e,n)=>{if(!n.preload)return n.duration;let i=0;return(n.parts||[]).forEach(function(s){i+=s.duration}),(n.preloadHints||[]).forEach(function(s){if(s.type==="PART")i+=e.partTargetDuration}),i},Zy=(e)=>(e.segments||[]).reduce((n,i,s)=>{if(i.parts)i.parts.forEach(function(a,r){n.push({duration:a.duration,segmentIndex:s,partIndex:r,part:a,segment:i})});else n.push({duration:i.duration,segmentIndex:s,partIndex:null,segment:i,part:null});return n},[]),lS=(e)=>{let n=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return n&&n.parts||[]},cS=({preloadSegment:e})=>{if(!e)return;let{parts:n,preloadHints:i}=e,s=(i||[]).reduce((a,r)=>a+(r.type==="PART"?1:0),0);return s+=n&&n.length?n.length:0,s},uS=(e,n)=>{if(n.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;let i=lS(n).length>0;if(i&&n.serverControl&&n.serverControl.partHoldBack)return n.serverControl.partHoldBack;else if(i&&n.partTargetDuration)return n.partTargetDuration*3;else if(n.serverControl&&n.serverControl.holdBack)return n.serverControl.holdBack;else if(n.targetDuration)return n.targetDuration*3;return 0},MM=function(e,n){let i=0,s=n-e.mediaSequence,a=e.segments[s];if(a){if(typeof a.start<"u")return{result:a.start,precise:!0};if(typeof a.end<"u")return{result:a.end-a.duration,precise:!0}}while(s--){if(a=e.segments[s],typeof a.end<"u")return{result:i+a.end,precise:!0};if(i+=n3(e,a),typeof a.start<"u")return{result:i+a.start,precise:!0}}return{result:i,precise:!1}},RM=function(e,n){let i=0,s,a=n-e.mediaSequence;for(;a<e.segments.length;a++){if(s=e.segments[a],typeof s.start<"u")return{result:s.start-i,precise:!0};if(i+=n3(e,s),typeof s.end<"u")return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},hS=function(e,n,i){if(typeof n>"u")n=e.mediaSequence+e.segments.length;if(n<e.mediaSequence)return 0;let s=MM(e,n);if(s.precise)return s.result;let a=RM(e,n);if(a.precise)return a.result;return s.result+i},fS=function(e,n,i){if(!e)return 0;if(typeof i!=="number")i=0;if(typeof n>"u"){if(e.totalDuration)return e.totalDuration;if(!e.endList)return je.default.Infinity}return hS(e,n,i)},vp=function({defaultDuration:e,durationList:n,startIndex:i,endIndex:s}){let a=0;if(i>s)[i,s]=[s,i];if(i<0){for(let r=i;r<Math.min(0,s);r++)a+=e;i=0}for(let r=i;r<s;r++)a+=n[r].duration;return a},dS=function(e,n,i,s){if(!e||!e.segments)return null;if(e.endList)return fS(e);if(n===null)return null;n=n||0;let a=hS(e,e.mediaSequence+e.segments.length,n);if(i)s=typeof s==="number"?s:uS(null,e),a-=s;return Math.max(0,a)},OM=function(e,n,i){let a=n||0,r=dS(e,n,!0,i);if(r===null)return Is();if(r<a)r=a;return Is(a,r)},FM=function({playlist:e,currentTime:n,startingSegmentIndex:i,startingPartIndex:s,startTime:a,exactManifestTimings:r}){let l=n-a,c=Zy(e),p=0;for(let m=0;m<c.length;m++){let g=c[m];if(i!==g.segmentIndex)continue;if(typeof s==="number"&&typeof g.partIndex==="number"&&s!==g.partIndex)continue;p=m;break}if(l<0){if(p>0)for(let m=p-1;m>=0;m--){let g=c[m];if(l+=g.duration,r){if(l<0)continue}else if(l+Fo<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a-vp({defaultDuration:e.targetDuration,durationList:c,startIndex:p,endIndex:m})}}return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n}}if(p<0){for(let m=p;m<0;m++)if(l-=e.targetDuration,l<0)return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n};p=0}for(let m=p;m<c.length;m++){let g=c[m];l-=g.duration;let y=g.duration>Fo,x=l===0,I=y&&l+Fo>=0;if(x||I){if(m!==c.length-1)continue}if(r){if(l>0)continue}else if(l-Fo>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+vp({defaultDuration:e.targetDuration,durationList:c,startIndex:p,endIndex:m})}}return{segmentIndex:c[c.length-1].segmentIndex,partIndex:c[c.length-1].partIndex,startTime:n}},pS=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},i3=function(e){return e.excludeUntil&&e.excludeUntil===1/0},bb=function(e){let n=pS(e);return!e.disabled&&!n},NM=function(e){return e.disabled},PM=function(e){for(let n=0;n<e.segments.length;n++)if(e.segments[n].key)return!0;return!1},mS=function(e,n){return n.attributes&&n.attributes[e]},BM=function(e,n,i,s=0){if(!mS("BANDWIDTH",i))return NaN;return(e*i.attributes.BANDWIDTH-s*8)/n},e5=(e,n)=>{if(e.playlists.length===1)return!0;let i=n.attributes.BANDWIDTH||Number.MAX_VALUE;return e.playlists.filter((s)=>{if(!bb(s))return!1;return(s.attributes.BANDWIDTH||0)<i}).length===0},s3=(e,n)=>{if(!e&&!n||!e&&n||e&&!n)return!1;if(e===n)return!0;if(e.id&&n.id&&e.id===n.id)return!0;if(e.resolvedUri&&n.resolvedUri&&e.resolvedUri===n.resolvedUri)return!0;if(e.uri&&n.uri&&e.uri===n.uri)return!0;return!1},D8=function(e,n){let i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},s=!1;for(let a in i){for(let r in i[a])if(s=n(i[a][r]),s)break;if(s)break}return!!s},qp=(e)=>{if(!e||!e.playlists||!e.playlists.length)return D8(e,(i)=>i.playlists&&i.playlists.length||i.uri);for(let n=0;n<e.playlists.length;n++){let i=e.playlists[n],s=i.attributes&&i.attributes.CODECS;if(s&&s.split(",").every((r)=>zw(r)))continue;if(D8(e,(r)=>s3(i,r)))continue;return!1}return!0},Ba={liveEdgeDelay:uS,duration:fS,seekable:OM,getMediaInfoForTime:FM,isEnabled:bb,isDisabled:NM,isExcluded:pS,isIncompatible:i3,playlistEnd:dS,isAes:PM,hasAttribute:mS,estimateSegmentRequestTime:BM,isLowestEnabledRendition:e5,isAudioOnly:qp,playlistMatch:s3,segmentDurationWithParts:n3},{log:gS}=$e,td=(e,n)=>`${e}-${n}`,bS=(e,n,i)=>`placeholder-uri-${e}-${n}-${i}`,LM=({onwarn:e,oninfo:n,manifestString:i,customTagParsers:s=[],customTagMappers:a=[],llhls:r})=>{let l=new Hw;if(e)l.on("warn",e);if(n)l.on("info",n);s.forEach((m)=>l.addParser(m)),a.forEach((m)=>l.addTagMapper(m)),l.push(i),l.end();let c=l.manifest;if(!r){if(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(m){if(c.hasOwnProperty(m))delete c[m]}),c.segments)c.segments.forEach(function(m){["parts","preloadHints"].forEach(function(g){if(m.hasOwnProperty(g))delete m[g]})})}if(!c.targetDuration){let m=10;if(c.segments&&c.segments.length)m=c.segments.reduce((g,y)=>Math.max(g,y.duration),0);if(e)e({message:`manifest has no targetDuration defaulting to ${m}`});c.targetDuration=m}let p=lS(c);if(p.length&&!c.partTargetDuration){let m=p.reduce((g,y)=>Math.max(g,y.duration),0);if(e)e({message:`manifest has no partTargetDuration defaulting to ${m}`}),gS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");c.partTargetDuration=m}return c},bd=(e,n)=>{if(!e.mediaGroups)return;["AUDIO","SUBTITLES"].forEach((i)=>{if(!e.mediaGroups[i])return;for(let s in e.mediaGroups[i])for(let a in e.mediaGroups[i][s]){let r=e.mediaGroups[i][s][a];n(r,i,s,a)}})},wS=({playlist:e,uri:n,id:i})=>{if(e.id=i,e.playlistErrors_=0,n)e.uri=n;e.attributes=e.attributes||{}},HM=(e)=>{let n=e.playlists.length;while(n--){let i=e.playlists[n];if(wS({playlist:i,id:td(n,i.uri)}),i.resolvedUri=Pa(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,!i.attributes.BANDWIDTH)gS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},UM=(e)=>{bd(e,(n)=>{if(n.uri)n.resolvedUri=Pa(e.uri,n.uri)})},zM=(e,n)=>{let i=td(0,n),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:je.default.location.href,resolvedUri:je.default.location.href,playlists:[{uri:n,id:i,resolvedUri:n,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[n]=s.playlists[0],s},yS=(e,n,i=bS)=>{e.uri=n;for(let a=0;a<e.playlists.length;a++)if(!e.playlists[a].uri){let r=`placeholder-uri-${a}`;e.playlists[a].uri=r}let s=qp(e);bd(e,(a,r,l,c)=>{if(!a.playlists||!a.playlists.length){if(s&&r==="AUDIO"&&!a.uri)for(let p=0;p<e.playlists.length;p++){let m=e.playlists[p];if(m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l)return}a.playlists=[Ri({},a)]}a.playlists.forEach(function(p,m){let g=i(r,l,c,p),y=td(m,g);if(p.uri)p.resolvedUri=p.resolvedUri||Pa(e.uri,p.uri);else p.uri=m===0?g:y,p.resolvedUri=p.uri;p.id=p.id||y,p.attributes=p.attributes||{},e.playlists[p.id]=p,e.playlists[p.uri]=p})}),HM(e),UM(e)};class t5{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null)return;if(!e.length)return;let[n]=e;if(n.programDateTime===void 0)return;this.offset_=n.programDateTime/1000}setPendingDateRanges(e=[]){if(!e.length)return;let[n]=e,i=n.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((s,a)=>(s.set(a.id,a),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];let e={},n=[];this.pendingDateRanges_.forEach((i,s)=>{if(this.processedDateRanges_.has(s))return;if(i.startTime=i.startDate.getTime()/1000-this.offset_,i.processDateRange=()=>this.processDateRange(i),n.push(i),!i.class)return;if(e[i.class]){let a=e[i.class].push(i);i.classListIndex=a-1}else e[i.class]=[i],i.classListIndex=0});for(let i of n){let s=e[i.class]||[];if(i.endDate)i.endTime=i.endDate.getTime()/1000-this.offset_;else if(i.endOnNext&&s[i.classListIndex+1])i.endTime=s[i.classListIndex+1].startTime;else if(i.duration)i.endTime=i.startTime+i.duration;else if(i.plannedDuration)i.endTime=i.startTime+i.plannedDuration;else i.endTime=i.startTime}return n}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,s)=>{if(i.startDate.getTime()<e)this.processedDateRanges_.delete(s)})}}var vS=22,fh=({requestType:e,request:n,error:i,parseFailure:s})=>{let a=n.status<200||n.status>299,r=n.status>=400&&n.status<=499,l={uri:n.uri,requestType:e},c=a&&!r||s;if(i&&r)l.error=Ri({},i),l.errorType=$e.Error.NetworkRequestFailed;else if(n.aborted)l.errorType=$e.Error.NetworkRequestAborted;else if(n.timedout)l.errorType=$e.Error.NetworkRequestTimeout;else if(c){let p=s?$e.Error.NetworkBodyParserFailed:$e.Error.NetworkBadStatus;l.errorType=p,l.status=n.status,l.headers=n.headers}return l},GM=Fr("CodecUtils"),SS=function(e){let n=e.attributes||{};if(n.CODECS)return eo(n.CODECS)},_S=(e,n)=>{let i=n.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},VM=(e,n)=>{if(!_S(e,n))return!0;let i=n.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(let a in s)if(!s[a].uri&&!s[a].playlists)return!0;return!1},Ap=function(e){let n={};return e.forEach(({mediaType:i,type:s,details:a})=>{n[i]=n[i]||[],n[i].push(Uw(`${s}${a}`))}),Object.keys(n).forEach(function(i){if(n[i].length>1){GM(`multiple ${i} codecs found as attributes: ${n[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),n[i]=null;return}n[i]=n[i][0]}),n},I8=function(e){let n=0;if(e.audio)n++;if(e.video)n++;return n},Sp=function(e,n){let i=n.attributes||{},s=Ap(SS(n)||[]);if(_S(e,n)&&!s.audio){if(!VM(e,n)){let a=Ap(A6(e,i.AUDIO)||[]);if(a.audio)s.audio=a.audio}}return s},{EventTarget:XM}=$e,WM=(e,n)=>{if(n.endList||!n.serverControl)return e;let i={};if(n.serverControl.canBlockReload){let{preloadSegment:s}=n,a=n.mediaSequence+n.segments.length;if(s){let r=s.parts||[],l=cS(n)-1;if(l>-1&&l!==r.length-1)i._HLS_part=l;if(l>-1||r.length)a--}i._HLS_msn=a}if(n.serverControl&&n.serverControl.canSkipUntil)i._HLS_skip=n.serverControl.canSkipDateranges?"v2":"YES";if(Object.keys(i).length){let s=new je.default.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(a){if(!i.hasOwnProperty(a))return;s.searchParams.set(a,i[a])}),e=s.toString()}return e},KM=(e,n)=>{if(!e)return n;let i=Qn(e,n);if(e.preloadHints&&!n.preloadHints)delete i.preloadHints;if(e.parts&&!n.parts)delete i.parts;else if(e.parts&&n.parts){for(let s=0;s<n.parts.length;s++)if(e.parts&&e.parts[s])i.parts[s]=Qn(e.parts[s],n.parts[s])}if(!e.skipped&&n.skipped)i.skipped=!1;if(e.preload&&!n.preload)i.preload=!1;return i},$M=(e,n,i)=>{let s=e.slice(),a=n.slice();i=i||0;let r=[],l;for(let c=0;c<a.length;c++){let p=s[c+i],m=a[c];if(p)l=p.map||l,r.push(KM(p,m));else{if(l&&!m.map)m.map=l;r.push(m)}}return r},xS=(e,n)=>{if(!e.resolvedUri&&e.uri)e.resolvedUri=Pa(n,e.uri);if(e.key&&!e.key.resolvedUri)e.key.resolvedUri=Pa(n,e.key.uri);if(e.map&&!e.map.resolvedUri)e.map.resolvedUri=Pa(n,e.map.uri);if(e.map&&e.map.key&&!e.map.key.resolvedUri)e.map.key.resolvedUri=Pa(n,e.map.key.uri);if(e.parts&&e.parts.length)e.parts.forEach((i)=>{if(i.resolvedUri)return;i.resolvedUri=Pa(n,i.uri)});if(e.preloadHints&&e.preloadHints.length)e.preloadHints.forEach((i)=>{if(i.resolvedUri)return;i.resolvedUri=Pa(n,i.uri)})},kS=function(e){let n=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let s=0;s<i.preloadHints.length;s++)if(i.preloadHints[s].type==="MAP")return n}i.duration=e.targetDuration,i.preload=!0,n.push(i)}return n},TS=(e,n)=>e===n||e.segments&&n.segments&&e.segments.length===n.segments.length&&e.endList===n.endList&&e.mediaSequence===n.mediaSequence&&e.preloadSegment===n.preloadSegment,n5=(e,n,i=TS)=>{let s=Qn(e,{}),a=s.playlists[n.id];if(!a)return null;if(i(a,n))return null;n.segments=kS(n);let r=Qn(a,n);if(r.preloadSegment&&!n.preloadSegment)delete r.preloadSegment;if(a.segments){if(n.skip){n.segments=n.segments||[];for(let l=0;l<n.skip.skippedSegments;l++)n.segments.unshift({skipped:!0})}r.segments=$M(a.segments,n.segments,n.mediaSequence-a.mediaSequence)}r.segments.forEach((l)=>{xS(l,r.resolvedUri)});for(let l=0;l<s.playlists.length;l++)if(s.playlists[l].id===n.id)s.playlists[l]=r;return s.playlists[n.id]=r,s.playlists[n.uri]=r,bd(e,(l,c,p,m)=>{if(!l.playlists)return;for(let g=0;g<l.playlists.length;g++)if(n.id===l.playlists[g].id)l.playlists[g]=r}),s},i5=(e,n)=>{let i=e.segments||[],s=i[i.length-1],a=s&&s.parts&&s.parts[s.parts.length-1],r=a&&a.duration||s&&s.duration;if(n&&r)return r*1000;return(e.partTargetDuration||e.targetDuration||10)*500},M8=(e,n,i)=>{if(!e)return;let s=[];return e.forEach((a)=>{if(!a.attributes)return;let{BANDWIDTH:r,RESOLUTION:l,CODECS:c}=a.attributes;s.push({id:a.id,bandwidth:r,resolution:l,codecs:c})}),{type:n,isLive:i,renditions:s}};class ch extends XM{constructor(e,n,i={}){super();if(!e)throw Error("A non-empty playlist URL or object is required");this.logger_=Fr("PlaylistLoader");let{withCredentials:s=!1}=i;this.src=e,this.vhs_=n,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;let a=n.options_;this.customTagParsers=a&&a.customTagParsers||[],this.customTagMappers=a&&a.customTagMappers||[],this.llhls=a&&a.llhls,this.dateRangesStorage_=new t5,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){let e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);let n=this.dateRangesStorage_.getDateRangesToProcess();if(!n.length||!this.addDateRangesToTextTrack_)return;this.addDateRangesToTextTrack_(n)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;let e=this.media(),n=Pa(this.main.uri,e.uri);if(this.llhls)n=WM(n,e);this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:n,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,s)=>{if(!this.request)return;if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}playlistRequestError(e,n,i){let{uri:s,id:a}=n;if(this.request=null,i)this.state=i;this.error={playlist:this.main.playlists[a],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:fh({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:n}){try{let i=LM({onwarn:({message:s})=>this.logger_(`m3u8-parser warn for ${e}: ${s}`),oninfo:({message:s})=>this.logger_(`m3u8-parser info for ${e}: ${s}`),manifestString:n,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});if(!i.playlists||!i.playlists.length)return i;return this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:$e.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){let n=(i)=>{let s=i.attributes||{},{width:a,height:r}=s.RESOLUTION||{};if(a&&r)return!0;let l=SS(i)||[],c=Ap(l);return Boolean(c.video)};if(e.some(n))e.forEach((i)=>{if(!n(i))i.excludeUntil=1/0})}haveMetadata({playlistString:e,playlistObject:n,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";let a={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:a});let r=n||this.parseManifest_({url:i,manifestString:e});r.lastRequest=Date.now(),wS({playlist:r,uri:i,id:s});let l=n5(this.main,r);if(this.targetDuration=r.partTargetDuration||r.targetDuration,this.pendingMedia_=null,l)this.main=l,this.media_=this.main.playlists[s];else this.trigger("playlistunchanged");this.updateMediaUpdateTimeout_(i5(this.media(),!!l)),a.parsedPlaylist=M8(this.main.playlists,a.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:a}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),je.default.clearTimeout(this.mediaUpdateTimeout),je.default.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new t5,this.off()}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,n){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);if(typeof e==="string"){if(!this.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(je.default.clearTimeout(this.finalRenditionTimeout),n){let l=(e.partTargetDuration||e.targetDuration)/2*1000||5000;this.finalRenditionTimeout=je.default.setTimeout(this.media.bind(this,e,!1),l);return}let i=this.state,s=!this.media_||e.id!==this.media_.id,a=this.main.playlists[e.id];if(a&&a.endList||e.endList&&e.segments.length){if(this.request)this.request.onreadystatechange=null,this.request.abort(),this.request=null;if(this.state="HAVE_METADATA",this.media_=e,s)if(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange");return}if(this.updateMediaUpdateTimeout_(i5(e,!0)),!s)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}if(this.media_)this.trigger("mediachanging");this.pendingMedia_=e;let r={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:r}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,c)=>{if(!this.request)return;if(e.lastRequest=Date.now(),e.resolvedUri=O1(e.resolvedUri,c),l)return this.playlistRequestError(this.request,e,i);if(this.trigger({type:"playlistrequestcomplete",metadata:r}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange")})}pause(){if(this.mediaUpdateTimeout)je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;if(this.stopRequest(),this.state==="HAVE_NOTHING")this.started=!1;if(this.state==="SWITCHING_MEDIA")if(this.media_)this.state="HAVE_METADATA";else this.state="HAVE_MAIN_MANIFEST";else if(this.state==="HAVE_CURRENT_METADATA")this.state="HAVE_METADATA"}load(e){if(this.mediaUpdateTimeout)je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let n=this.media();if(e){let i=n?(n.partTargetDuration||n.targetDuration)/2*1000:5000;this.mediaUpdateTimeout=je.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}if(n&&!n.endList)this.trigger("mediaupdatetimeout");else this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){if(this.mediaUpdateTimeout)je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;if(!this.media()||this.media().endList)return;this.mediaUpdateTimeout=je.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e)}start(){if(this.started=!0,typeof this.src==="object"){if(!this.src.uri)this.src.uri=je.default.location.href;this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}let e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,i)=>{if(!this.request)return;if(this.request=null,n){if(this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:fh({requestType:i.requestType,request:i,error:n})},this.state==="HAVE_NOTHING")this.started=!1;return this.trigger("error")}this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=O1(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});let s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=M8(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src==="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){if(this.main=e,yS(this.main,this.srcUri()),e.playlists.forEach((i)=>{i.segments=kS(i),i.segments.forEach((s)=>{xS(s,i.resolvedUri)})}),this.trigger("loadedplaylist"),!this.request)this.media(this.main.playlists[0]);return}let n=this.srcUri()||je.default.location.href;this.main=zM(e,n),this.haveMetadata({playlistObject:e,url:n,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,n){let i=this.main,s=e.ID,a=i.playlists.length;while(a--){let r=i.playlists[a];if(r.attributes["PATHWAY-ID"]===s){let{resolvedUri:l,id:c}=r;if(n){let p=this.createCloneURI_(r.resolvedUri,e),m=td(s,p),g=this.createCloneAttributes_(s,r.attributes),y=this.createClonePlaylist_(r,m,e,g);i.playlists[a]=y,i.playlists[m]=y,i.playlists[p]=y}else i.playlists.splice(a,1);delete i.playlists[c],delete i.playlists[l]}}this.updateOrDeleteCloneMedia(e,n)}updateOrDeleteCloneMedia(e,n){let i=this.main,s=e.ID;if(["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((a)=>{if(!i.mediaGroups[a]||!i.mediaGroups[a][s])return;for(let r in i.mediaGroups[a])if(r===s){for(let l in i.mediaGroups[a][r])i.mediaGroups[a][r][l].playlists.forEach((p,m)=>{let g=i.playlists[p.id],{id:y,resolvedUri:x}=g;delete i.playlists[y],delete i.playlists[x]});delete i.mediaGroups[a][r]}}),n)this.createClonedMediaGroups_(e)}addClonePathway(e,n={}){let i=this.main,s=i.playlists.length,a=this.createCloneURI_(n.resolvedUri,e),r=td(e.ID,a),l=this.createCloneAttributes_(e.ID,n.attributes),c=this.createClonePlaylist_(n,r,e,l);i.playlists[s]=c,i.playlists[r]=c,i.playlists[a]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let n=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((a)=>{if(!s.mediaGroups[a]||s.mediaGroups[a][n])return;for(let r in s.mediaGroups[a]){if(r===i)s.mediaGroups[a][n]={};else continue;for(let l in s.mediaGroups[a][r]){let c=s.mediaGroups[a][r][l];s.mediaGroups[a][n][l]=Ri({},c);let p=s.mediaGroups[a][n][l],m=this.createCloneURI_(c.resolvedUri,e);p.resolvedUri=m,p.uri=m,p.playlists=[],c.playlists.forEach((g,y)=>{let x=s.playlists[g.id],I=bS(a,n,l),M=td(n,I);if(x&&!s.playlists[M]){let H=this.createClonePlaylist_(x,M,e),X=H.resolvedUri;s.playlists[M]=H,s.playlists[X]=H}p.playlists[y]=this.createClonePlaylist_(g,M,e)})}}})}createClonePlaylist_(e,n,i,s){let a=this.createCloneURI_(e.resolvedUri,i),r={resolvedUri:a,uri:a,id:n};if(e.segments)r.segments=[];if(s)r.attributes=s;return Qn(e,r)}createCloneURI_(e,n){let i=new URL(e);i.hostname=n["URI-REPLACEMENT"].HOST;let s=n["URI-REPLACEMENT"].PARAMS;for(let a of Object.keys(s))i.searchParams.set(a,s[a]);return i.href}createCloneAttributes_(e,n){let i={["PATHWAY-ID"]:e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s)=>{if(n[s])i[s]=e}),i}getKeyIdSet(e){let n=new Set;if(!e||!e.contentProtection)return n;for(let i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){let s=e.contentProtection[i].attributes.keyId;n.add(s.toLowerCase())}return n}}var s5=function(e,n,i,s){let a=e.responseType==="arraybuffer"?e.response:e.responseText;if(!n&&a){if(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=a.byteLength||a.length,!e.bandwidth)e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1000)}if(i.headers)e.responseHeaders=i.headers;if(n&&n.code==="ETIMEDOUT")e.timedout=!0;if(!n&&!e.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0)n=Error("XHR Failed with a response of: "+(e&&(a||e.responseText)));s(n,e)},YM=(e,n)=>{if(!e||!e.size)return;let i=n;return e.forEach((s)=>{i=s(i)}),i},QM=(e,n,i,s)=>{if(!e||!e.size)return;e.forEach((a)=>{a(n,i,s)})},AS=function(){let e=function n(i,s){i=Qn({timeout:45000},i);let a=n.beforeRequest||$e.Vhs.xhr.beforeRequest,r=n._requestCallbackSet||$e.Vhs.xhr._requestCallbackSet||new Set,l=n._responseCallbackSet||$e.Vhs.xhr._responseCallbackSet;if(a&&typeof a==="function")$e.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(a);let c=$e.Vhs.xhr.original===!0?$e.xhr:$e.Vhs.xhr,p=YM(r,i);r.delete(a);let m=c(p||i,function(y,x){return QM(l,m,y,x),s5(m,y,x,s)}),g=m.abort;return m.abort=function(){return m.aborted=!0,g.apply(m,arguments)},m.uri=i.uri,m.requestType=i.requestType,m.requestTime=Date.now(),m};return e.original=!0,e},JM=function(e){let n,i=e.offset;if(typeof e.offset==="bigint"||typeof e.length==="bigint")n=je.default.BigInt(e.offset)+je.default.BigInt(e.length)-je.default.BigInt(1);else n=e.offset+e.length-1;return"bytes="+i+"-"+n},a5=function(e){let n={};if(e.byterange)n.Range=JM(e.byterange);return n},ZM=function(e,n){return e.start(n)+"-"+e.end(n)},eR=function(e,n){let i=e.toString(16);return"00".substring(0,2-i.length)+i+(n%2?" ":"")},tR=function(e){if(e>=32&&e<126)return String.fromCharCode(e);return"."},CS=function(e){let n={};return Object.keys(e).forEach((i)=>{let s=e[i];if(Ww(s))n[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength};else n[i]=s}),n},F1=function(e){let n=e.byterange||{length:1/0,offset:0};return[n.length,n.offset,e.resolvedUri].join(",")},jS=function(e){return e.resolvedUri},ES=(e)=>{let n=Array.prototype.slice.call(e),i=16,s="",a,r;for(let l=0;l<n.length/16;l++)a=n.slice(l*16,l*16+16).map(eR).join(""),r=n.slice(l*16,l*16+16).map(tR).join(""),s+=a+" "+r+`
|
|
194
|
+
`;return s},nR=({bytes:e})=>ES(e),iR=(e)=>{let n="",i;for(i=0;i<e.length;i++)n+=ZM(e,i)+" ";return n},sR=Object.freeze({__proto__:null,createTransferableMessage:CS,initSegmentId:F1,segmentKeyId:jS,hexDump:ES,tagDump:nR,textRanges:iR}),qS=0.25,aR=(e,n)=>{if(!n.dateTimeObject)return null;let i=n.videoTimingInfo.transmuxerPrependedSeconds,a=n.videoTimingInfo.transmuxedPresentationStart+i,r=e-a;return new Date(n.dateTimeObject.getTime()+r*1000)},rR=(e)=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,oR=(e,n)=>{let i;try{i=new Date(e)}catch(p){return null}if(!n||!n.segments||n.segments.length===0)return null;let s=n.segments[0];if(i<new Date(s.dateTimeObject))return null;for(let p=0;p<n.segments.length-1;p++){s=n.segments[p];let m=new Date(n.segments[p+1].dateTimeObject);if(i<m)break}let a=n.segments[n.segments.length-1],r=a.dateTimeObject,l=a.videoTimingInfo?rR(a.videoTimingInfo):a.duration+a.duration*qS,c=new Date(r.getTime()+l*1000);if(i>c)return null;if(i>new Date(r))s=a;return{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:Ba.duration(n,n.mediaSequence+n.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}},lR=(e,n)=>{if(!n||!n.segments||n.segments.length===0)return null;let i=0,s;for(let r=0;r<n.segments.length;r++)if(s=n.segments[r],i=s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationEnd:i+s.duration,e<=i)break;let a=n.segments[n.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+a.duration*qS)return null;s=a}return{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:i-s.duration,type:s.videoTimingInfo?"accurate":"estimate"}},cR=(e,n)=>{let i,s;try{i=new Date(e),s=new Date(n)}catch(l){}let a=i.getTime();return(s.getTime()-a)/1000},uR=(e)=>{if(!e.segments||e.segments.length===0)return!1;for(let n=0;n<e.segments.length;n++)if(!e.segments[n].dateTimeObject)return!1;return!0},hR=({playlist:e,time:n=void 0,callback:i})=>{if(!i)throw Error("getProgramTime: callback must be provided");if(!e||n===void 0)return i({message:"getProgramTime: playlist and time must be provided"});let s=lR(n,e);if(!s)return i({message:"valid programTime was not found"});if(s.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});let a={mediaSeconds:n},r=aR(n,s.segment);if(r)a.programDateTime=r.toISOString();return i(null,a)},DS=({programTime:e,playlist:n,retryCount:i=2,seekTo:s,pauseAfterSeek:a=!0,tech:r,callback:l})=>{if(!l)throw Error("seekToProgramTime: callback must be provided");if(typeof e>"u"||!n||!s)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!r.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!uR(n))return l({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});let c=oR(e,n);if(!c)return l({message:`${e} was not found in the stream`});let p=c.segment,m=cR(p.dateTimeObject,e);if(c.type==="estimate"){if(i===0)return l({message:`${e} is not buffered yet. Try again`});s(c.estimatedStart+m),r.one("seeked",()=>{DS({programTime:e,playlist:n,retryCount:i-1,seekTo:s,pauseAfterSeek:a,tech:r,callback:l})});return}let g=p.start+m,y=()=>l(null,r.currentTime());if(r.one("seeked",y),a)r.pause();s(g)},Ny=(e,n)=>{if(e.readyState===4)return n();return},fR=(e,n,i,s)=>{let a=[],r,l=!1,c=function(y,x,I,M){return x.abort(),l=!0,i(y,x,I,M)},p=function(y,x){if(l)return;if(y)return y.metadata=fh({requestType:s,request:x,error:y}),c(y,x,"",a);let I=x.responseText.substring(a&&a.byteLength||0,x.responseText.length);if(a=q6(a,Yg(I,!0)),r=r||sh(a),a.length<10||r&&a.length<r+2)return Ny(x,()=>c(y,x,"",a));let M=h1(a);if(M==="ts"&&a.length<188)return Ny(x,()=>c(y,x,"",a));if(!M&&a.length<376)return Ny(x,()=>c(y,x,"",a));return c(null,x,M,a)},g=n({uri:e,beforeSend(y){y.overrideMimeType("text/plain; charset=x-user-defined"),y.addEventListener("progress",function({total:x,loaded:I}){return s5(y,null,{statusCode:y.status},p)})}},function(y,x){return s5(g,y,x,p)});return g},{EventTarget:dR}=$e,R8=function(e,n){if(!TS(e,n))return!1;if(e.sidx&&n.sidx&&(e.sidx.offset!==n.sidx.offset||e.sidx.length!==n.sidx.length))return!1;else if(!e.sidx&&n.sidx||e.sidx&&!n.sidx)return!1;if(e.segments&&!n.segments||!e.segments&&n.segments)return!1;if(!e.segments&&!n.segments)return!0;for(let i=0;i<e.segments.length;i++){let s=e.segments[i],a=n.segments[i];if(s.uri!==a.uri)return!1;if(!s.byterange&&!a.byterange)continue;let r=s.byterange,l=a.byterange;if(r&&!l||!r&&l)return!1;if(r.offset!==l.offset||r.length!==l.length)return!1}return!0},pR=(e,n,i,s)=>{let a=s.attributes.NAME||i;return`placeholder-uri-${e}-${n}-${a}`},mR=({mainXml:e,srcUrl:n,clientOffset:i,sidxMapping:s,previousManifest:a})=>{let r=Pv(e,{manifestUri:n,clientOffset:i,sidxMapping:s,previousManifest:a});return yS(r,n,pR),r},gR=(e,n)=>{bd(e,(i,s,a,r)=>{if(!n.mediaGroups[s][a]||!(r in n.mediaGroups[s][a]))delete e.mediaGroups[s][a][r]})},bR=(e,n,i)=>{let s=!0,a=Qn(e,{duration:n.duration,minimumUpdatePeriod:n.minimumUpdatePeriod,timelineStarts:n.timelineStarts});for(let r=0;r<n.playlists.length;r++){let l=n.playlists[r];if(l.sidx){let p=op(l.sidx);if(i&&i[p]&&i[p].sidx)l1(l,i[p].sidx,l.sidx.resolvedUri)}let c=n5(a,l,R8);if(c)a=c,s=!1}if(bd(n,(r,l,c,p)=>{if(r.playlists&&r.playlists.length){let m=r.playlists[0].id,g=n5(a,r.playlists[0],R8);if(g){if(a=g,!(p in a.mediaGroups[l][c]))a.mediaGroups[l][c][p]=r;a.mediaGroups[l][c][p].playlists[0]=a.playlists[m],s=!1}}}),gR(a,n),n.minimumUpdatePeriod!==e.minimumUpdatePeriod)s=!1;if(s)return null;return a},wR=(e,n)=>(Boolean(!e.map&&!n.map)||Boolean(e.map&&n.map&&e.map.byterange.offset===n.map.byterange.offset&&e.map.byterange.length===n.map.byterange.length))&&e.uri===n.uri&&e.byterange.offset===n.byterange.offset&&e.byterange.length===n.byterange.length,O8=(e,n)=>{let i={};for(let s in e){let r=e[s].sidx;if(r){let l=op(r);if(!n[l])break;let c=n[l].sidxInfo;if(wR(c,r))i[l]=n[l]}}return i},yR=(e,n)=>{let s=O8(e.playlists,n);return bd(e,(a,r,l,c)=>{if(a.playlists&&a.playlists.length){let p=a.playlists;s=Qn(s,O8(p,n))}}),s};class N1 extends dR{constructor(e,n,i={},s){super();if(this.isPaused_=!0,this.mainPlaylistLoader_=s||this,!s)this.isMain_=!0;let{withCredentials:a=!1}=i;if(this.vhs_=n,this.withCredentials=a,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw Error("A non-empty playlist URL or object is required");if(this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Fr("DashPlaylistLoader"),this.isMain_)this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={};else this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,n,i){if(!this.request)return!0;if(this.request=null,e){if(this.error=typeof e==="object"&&!(e instanceof Error)?e:{status:n.status,message:"DASH request error at URL: "+n.uri,response:n.response,code:2,metadata:e.metadata},i)this.state=i;return this.trigger("error"),!0}}addSidxSegments_(e,n,i){let s=e.sidx&&op(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){je.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=je.default.setTimeout(()=>i(!1),0);return}let a=O1(e.sidx.resolvedUri),r=(c,p)=>{if(this.requestErrored_(c,p,n))return;let m=this.mainPlaylistLoader_.sidxMapping_,{requestType:g}=p,y;try{y=$8.default(Xt(p.response).subarray(8))}catch(x){x.metadata=fh({requestType:g,request:p,parseFailure:!0}),this.requestErrored_(x,p,n);return}return m[s]={sidxInfo:e.sidx,sidx:y},l1(e,y,e.sidx.resolvedUri),i(!0)},l="dash-sidx";this.request=fR(a,this.vhs_.xhr,(c,p,m,g)=>{if(c)return r(c,p);if(!m||m!=="mp4"){let I=m||"unknown";return r({status:p.status,message:`Unsupported ${I} container type for sidx segment at URL: ${a}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},p)}let{offset:y,length:x}=e.sidx.byterange;if(g.length>=x+y)return r(c,{response:g.subarray(y,y+x),status:p.status,uri:p.uri});this.request=this.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:a5({byterange:e.sidx.byterange})},r)},l)}dispose(){if(this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},je.default.clearTimeout(this.minimumUpdatePeriodTimeout_),je.default.clearTimeout(this.mediaRequest_),je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_)this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null;this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw Error("Cannot switch media playlist from "+this.state);let n=this.state;if(typeof e==="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}let i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){if(this.state="HAVE_METADATA",this.media_=e,i)this.trigger("mediachanging"),this.trigger("mediachange");return}if(!i)return;if(this.media_)this.trigger("mediachanging");this.addSidxSegments_(e,n,(s)=>{this.haveMetadata({startingState:n,playlist:e})})}haveMetadata({startingState:e,playlist:n}){if(this.state="HAVE_METADATA",this.loadedPlaylists_[n.id]=n,je.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(n.id),e==="HAVE_MAIN_MANIFEST")this.trigger("loadedmetadata");else this.trigger("mediachange")}pause(){if(this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_)this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null;if(this.stopRequest(),je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_)je.default.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null;if(this.state==="HAVE_NOTHING")this.started=!1}load(e){this.isPaused_=!1,je.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let n=this.media();if(e){let i=n?n.targetDuration/2*1000:5000;this.mediaUpdateTimeout=je.default.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}if(n&&!n.endList){if(this.isMain_&&!this.minimumUpdatePeriodTimeout_)this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_();this.trigger("mediaupdatetimeout")}else this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){je.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=je.default.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,n)=>{if(this.haveMain_(),!this.hasPendingRequest()&&!this.media_)this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){let n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,s)=>{if(i){let{requestType:r}=s;i.metadata=fh({requestType:r,request:s,error:i})}if(this.requestErrored_(i,s)){if(this.state==="HAVE_NOTHING")this.started=!1;return}this.trigger({type:"manifestrequestcomplete",metadata:n});let a=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date)this.mainLoaded_=Date.parse(s.responseHeaders.date);else this.mainLoaded_=Date.now();if(this.mainPlaylistLoader_.srcUrl=O1(this.mainPlaylistLoader_.srcUrl,s),a){this.handleMain_(),this.syncClientServerClock_(()=>e(s,a));return}return e(s,a)})}syncClientServerClock_(e){let n=Bv(this.mainPlaylistLoader_.mainXml_);if(n===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(n.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Pa(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{if(!this.request)return;if(i){let{requestType:r}=s;return this.error.metadata=fh({requestType:r,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let a;if(n.method==="HEAD")if(!s.responseHeaders||!s.responseHeaders.date)a=this.mainLoaded_;else a=Date.parse(s.responseHeaders.date);else a=Date.parse(s.responseText);this.mainPlaylistLoader_.clientOffset_=a-Date.now(),e()})}haveMain_(){if(this.state="HAVE_MAIN_MANIFEST",this.isMain_)this.trigger("loadedplaylist");else if(!this.media_)this.media(this.childPlaylist_)}handleMain_(){je.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;let e=this.mainPlaylistLoader_.main,n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:n});let i;try{i=mR({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(a){this.error=a,this.error.metadata={errorType:$e.Error.StreamingDashManifestParserError,error:a},this.trigger("error")}if(e)i=bR(e,i,this.mainPlaylistLoader_.sidxMapping_);this.mainPlaylistLoader_.main=i?i:e;let s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl)this.mainPlaylistLoader_.srcUrl=s;if(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)this.updateMinimumUpdatePeriodTimeout_();if(this.addEventStreamToMetadataTrack_(i),i){let{duration:a,endList:r}=i,l=[];i.playlists.forEach((p)=>{l.push({id:p.id,bandwidth:p.attributes.BANDWIDTH,resolution:p.attributes.RESOLUTION,codecs:p.attributes.CODECS})});let c={duration:a,isLive:!r,renditions:l};n.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:n})}return Boolean(i)}updateMinimumUpdatePeriodTimeout_(){let e=this.mainPlaylistLoader_;if(e.createMupOnMedia_)e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null;if(e.minimumUpdatePeriodTimeout_)je.default.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null;let n=e.main&&e.main.minimumUpdatePeriod;if(n===0)if(e.media())n=e.media().targetDuration*1000;else e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_);if(typeof n!=="number"||n<=0){if(n<0)this.logger_(`found invalid minimumUpdatePeriod of ${n}, not setting a timeout`);return}this.createMUPTimeout_(n)}createMUPTimeout_(e){let n=this.mainPlaylistLoader_;n.minimumUpdatePeriodTimeout_=je.default.setTimeout(()=>{n.minimumUpdatePeriodTimeout_=null,n.trigger("minimumUpdatePeriod"),n.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,n)=>{if(!n)return;if(this.media_)this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id];this.mainPlaylistLoader_.sidxMapping_=yR(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(i)=>{this.refreshMedia_(this.media().id)})})}refreshMedia_(e){if(!e)throw Error("refreshMedia_ must take a media id");if(this.media_&&this.isMain_)this.handleMain_();let n=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==n[e];if(i)this.media_=n[e];else this.trigger("playlistunchanged");if(!this.mediaUpdateTimeout){let s=()=>{if(this.media().endList)return;this.mediaUpdateTimeout=je.default.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},i5(this.media(),Boolean(i)))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){let n=this.mainPlaylistLoader_.main.eventStream.map((i)=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",n,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){let n=new Set;for(let i in e.contentProtection){let s=e.contentProtection[i].attributes["cenc:default_KID"];if(s)n.add(s.replace(/-/g,"").toLowerCase())}return n}}}var Ds={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},vR=(e)=>{let n=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n.buffer},IS=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},SR=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(n){let i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}},MS=function(e){return function(){let n=SR(e),i=IS(new Worker(n));i.objURL=n;let s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(n),s.call(this)},i}},RS=function(e){return`var browserWorkerPolyFill = ${IS.toString()};
|
|
195
|
+
browserWorkerPolyFill(self);
|
|
196
|
+
`+e},OS=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},_R=RS(OS(function(){var e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=function(){this.init=function(){var _={};this.on=function(R,F){if(!_[R])_[R]=[];_[R]=_[R].concat(F)},this.off=function(R,F){var P;if(!_[R])return!1;return P=_[R].indexOf(F),_[R]=_[R].slice(),_[R].splice(P,1),P>-1},this.trigger=function(R){var F,P,K,ee;if(F=_[R],!F)return;if(arguments.length===2){K=F.length;for(P=0;P<K;++P)F[P].call(this,arguments[1])}else{ee=[],P=arguments.length;for(P=1;P<arguments.length;++P)ee.push(arguments[P]);K=F.length;for(P=0;P<K;++P)F[P].apply(this,ee)}},this.dispose=function(){_={}}}};n.prototype.pipe=function(_){return this.on("data",function(R){_.push(R)}),this.on("done",function(R){_.flush(R)}),this.on("partialdone",function(R){_.partialFlush(R)}),this.on("endedtimeline",function(R){_.endTimeline(R)}),this.on("reset",function(R){_.reset(R)}),_},n.prototype.push=function(_){this.trigger("data",_)},n.prototype.flush=function(_){this.trigger("done",_)},n.prototype.partialFlush=function(_){this.trigger("partialdone",_)},n.prototype.endTimeline=function(_){this.trigger("endedtimeline",_)},n.prototype.reset=function(_){this.trigger("reset",_)};var i=n,s=Math.pow(2,32),a=function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F;if(R.getBigUint64){if(F=R.getBigUint64(0),F<Number.MAX_SAFE_INTEGER)return Number(F);return F}return R.getUint32(0)*s+R.getUint32(4)},r={getUint64:a,MAX_UINT32:s},l=r.MAX_UINT32,c,p,m,g,y,x,I,M,H,X,W,Y,te,ae,ne,oe,me,be,xe,Oe,Fe,Ue,ze,Le,qe,Me,yt,Ge,Qe,jt,ut,st,bt,Wt,un,nn;(function(){var _;if(ze={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},typeof Uint8Array>"u")return;for(_ in ze)if(ze.hasOwnProperty(_))ze[_]=[_.charCodeAt(0),_.charCodeAt(1),_.charCodeAt(2),_.charCodeAt(3)];Le=new Uint8Array([105,115,111,109]),Me=new Uint8Array([97,118,99,49]),qe=new Uint8Array([0,0,0,1]),yt=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]),Ge=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]),Qe={video:yt,audio:Ge},st=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ut=new Uint8Array([0,0,0,0,0,0,0,0]),bt=new Uint8Array([0,0,0,0,0,0,0,0]),Wt=bt,un=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nn=bt,jt=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])})(),c=function(_){var R=[],F=0,P,K,ee;for(P=1;P<arguments.length;P++)R.push(arguments[P]);P=R.length;while(P--)F+=R[P].byteLength;K=new Uint8Array(F+8),ee=new DataView(K.buffer,K.byteOffset,K.byteLength),ee.setUint32(0,K.byteLength),K.set(_,4);for(P=0,F=8;P<R.length;P++)K.set(R[P],F),F+=R[P].byteLength;return K},p=function(){return c(ze.dinf,c(ze.dref,st))},m=function(_){return c(ze.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,_.audioobjecttype<<3|_.samplingfrequencyindex>>>1,_.samplingfrequencyindex<<7|_.channelcount<<3,6,1,2]))},g=function(){return c(ze.ftyp,Le,qe,Le,Me)},oe=function(_){return c(ze.hdlr,Qe[_])},y=function(_){return c(ze.mdat,_)},ne=function(_){var R=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,_.duration>>>24&255,_.duration>>>16&255,_.duration>>>8&255,_.duration&255,85,196,0,0]);if(_.samplerate)R[12]=_.samplerate>>>24&255,R[13]=_.samplerate>>>16&255,R[14]=_.samplerate>>>8&255,R[15]=_.samplerate&255;return c(ze.mdhd,R)},ae=function(_){return c(ze.mdia,ne(_),oe(_.type),I(_))},x=function(_){return c(ze.mfhd,new Uint8Array([0,0,0,0,(_&4278190080)>>24,(_&16711680)>>16,(_&65280)>>8,_&255]))},I=function(_){return c(ze.minf,_.type==="video"?c(ze.vmhd,jt):c(ze.smhd,ut),p(),be(_))},M=function(_,R){var F=[],P=R.length;while(P--)F[P]=Oe(R[P]);return c.apply(null,[ze.moof,x(_)].concat(F))},H=function(_){var R=_.length,F=[];while(R--)F[R]=Y(_[R]);return c.apply(null,[ze.moov,W(4294967295)].concat(F).concat(X(_)))},X=function(_){var R=_.length,F=[];while(R--)F[R]=Fe(_[R]);return c.apply(null,[ze.mvex].concat(F))},W=function(_){var R=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(_&4278190080)>>24,(_&16711680)>>16,(_&65280)>>8,_&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 c(ze.mvhd,R)},me=function(_){var R=_.samples||[],F=new Uint8Array(4+R.length),P,K;for(K=0;K<R.length;K++)P=R[K].flags,F[K+4]=P.dependsOn<<4|P.isDependedOn<<2|P.hasRedundancy;return c(ze.sdtp,F)},be=function(_){return c(ze.stbl,xe(_),c(ze.stts,nn),c(ze.stsc,Wt),c(ze.stsz,un),c(ze.stco,bt))},function(){var _,R;xe=function(F){return c(ze.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),F.type==="video"?_(F):R(F))},_=function(F){var P=F.sps||[],K=F.pps||[],ee=[],le=[],we,Se;for(we=0;we<P.length;we++)ee.push((P[we].byteLength&65280)>>>8),ee.push(P[we].byteLength&255),ee=ee.concat(Array.prototype.slice.call(P[we]));for(we=0;we<K.length;we++)le.push((K[we].byteLength&65280)>>>8),le.push(K[we].byteLength&255),le=le.concat(Array.prototype.slice.call(K[we]));if(Se=[ze.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,(F.width&65280)>>8,F.width&255,(F.height&65280)>>8,F.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c(ze.avcC,new Uint8Array([1,F.profileIdc,F.profileCompatibility,F.levelIdc,255].concat([P.length],ee,[K.length],le))),c(ze.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],F.sarRatio){var ke=F.sarRatio[0],Be=F.sarRatio[1];Se.push(c(ze.pasp,new Uint8Array([(ke&4278190080)>>24,(ke&16711680)>>16,(ke&65280)>>8,ke&255,(Be&4278190080)>>24,(Be&16711680)>>16,(Be&65280)>>8,Be&255])))}return c.apply(null,Se)},R=function(F){return c(ze.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(F.channelcount&65280)>>8,F.channelcount&255,(F.samplesize&65280)>>8,F.samplesize&255,0,0,0,0,(F.samplerate&65280)>>8,F.samplerate&255,0,0]),m(F))}}(),te=function(_){var R=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,0,(_.duration&4278190080)>>24,(_.duration&16711680)>>16,(_.duration&65280)>>8,_.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(_.width&65280)>>8,_.width&255,0,0,(_.height&65280)>>8,_.height&255,0,0]);return c(ze.tkhd,R)},Oe=function(_){var R,F,P,K,ee,le,we;if(R=c(ze.tfhd,new Uint8Array([0,0,0,58,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),le=Math.floor(_.baseMediaDecodeTime/l),we=Math.floor(_.baseMediaDecodeTime%l),F=c(ze.tfdt,new Uint8Array([1,0,0,0,le>>>24&255,le>>>16&255,le>>>8&255,le&255,we>>>24&255,we>>>16&255,we>>>8&255,we&255])),ee=92,_.type==="audio")return P=Ue(_,ee),c(ze.traf,R,F,P);return K=me(_),P=Ue(_,K.length+ee),c(ze.traf,R,F,P,K)},Y=function(_){return _.duration=_.duration||4294967295,c(ze.trak,te(_),ae(_))},Fe=function(_){var R=new Uint8Array([0,0,0,0,(_.id&4278190080)>>24,(_.id&16711680)>>16,(_.id&65280)>>8,_.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);if(_.type!=="video")R[R.length-1]=0;return c(ze.trex,R)},function(){var _,R,F;F=function(P,K){var ee=0,le=0,we=0,Se=0;if(P.length){if(P[0].duration!==void 0)ee=1;if(P[0].size!==void 0)le=2;if(P[0].flags!==void 0)we=4;if(P[0].compositionTimeOffset!==void 0)Se=8}return[0,0,ee|le|we|Se,1,(P.length&4278190080)>>>24,(P.length&16711680)>>>16,(P.length&65280)>>>8,P.length&255,(K&4278190080)>>>24,(K&16711680)>>>16,(K&65280)>>>8,K&255]},R=function(P,K){var ee,le,we,Se,ke,Be;Se=P.samples||[],K+=20+16*Se.length,we=F(Se,K),le=new Uint8Array(we.length+Se.length*16),le.set(we),ee=we.length;for(Be=0;Be<Se.length;Be++)ke=Se[Be],le[ee++]=(ke.duration&4278190080)>>>24,le[ee++]=(ke.duration&16711680)>>>16,le[ee++]=(ke.duration&65280)>>>8,le[ee++]=ke.duration&255,le[ee++]=(ke.size&4278190080)>>>24,le[ee++]=(ke.size&16711680)>>>16,le[ee++]=(ke.size&65280)>>>8,le[ee++]=ke.size&255,le[ee++]=ke.flags.isLeading<<2|ke.flags.dependsOn,le[ee++]=ke.flags.isDependedOn<<6|ke.flags.hasRedundancy<<4|ke.flags.paddingValue<<1|ke.flags.isNonSyncSample,le[ee++]=ke.flags.degradationPriority&61440,le[ee++]=ke.flags.degradationPriority&15,le[ee++]=(ke.compositionTimeOffset&4278190080)>>>24,le[ee++]=(ke.compositionTimeOffset&16711680)>>>16,le[ee++]=(ke.compositionTimeOffset&65280)>>>8,le[ee++]=ke.compositionTimeOffset&255;return c(ze.trun,le)},_=function(P,K){var ee,le,we,Se,ke,Be;Se=P.samples||[],K+=20+8*Se.length,we=F(Se,K),ee=new Uint8Array(we.length+Se.length*8),ee.set(we),le=we.length;for(Be=0;Be<Se.length;Be++)ke=Se[Be],ee[le++]=(ke.duration&4278190080)>>>24,ee[le++]=(ke.duration&16711680)>>>16,ee[le++]=(ke.duration&65280)>>>8,ee[le++]=ke.duration&255,ee[le++]=(ke.size&4278190080)>>>24,ee[le++]=(ke.size&16711680)>>>16,ee[le++]=(ke.size&65280)>>>8,ee[le++]=ke.size&255;return c(ze.trun,ee)},Ue=function(P,K){if(P.type==="audio")return _(P,K);return R(P,K)}}();var Zt={ftyp:g,mdat:y,moof:M,moov:H,initSegment:function(_){var R=g(),F=H(_),P;return P=new Uint8Array(R.byteLength+F.byteLength),P.set(R),P.set(F,R.byteLength),P}},Rn=function(_){var R,F,P=[],K=[];K.byteLength=0,K.nalCount=0,K.duration=0,P.byteLength=0;for(R=0;R<_.length;R++)if(F=_[R],F.nalUnitType==="access_unit_delimiter_rbsp"){if(P.length)P.duration=F.dts-P.dts,K.byteLength+=P.byteLength,K.nalCount+=P.length,K.duration+=P.duration,K.push(P);P=[F],P.byteLength=F.data.byteLength,P.pts=F.pts,P.dts=F.dts}else{if(F.nalUnitType==="slice_layer_without_partitioning_rbsp_idr")P.keyFrame=!0;P.duration=F.dts-P.dts,P.byteLength+=F.data.byteLength,P.push(F)}if(K.length&&(!P.duration||P.duration<=0))P.duration=K[K.length-1].duration;return K.byteLength+=P.byteLength,K.nalCount+=P.length,K.duration+=P.duration,K.push(P),K},Jn=function(_){var R,F,P=[],K=[];P.byteLength=0,P.nalCount=0,P.duration=0,P.pts=_[0].pts,P.dts=_[0].dts,K.byteLength=0,K.nalCount=0,K.duration=0,K.pts=_[0].pts,K.dts=_[0].dts;for(R=0;R<_.length;R++)if(F=_[R],F.keyFrame){if(P.length)K.push(P),K.byteLength+=P.byteLength,K.nalCount+=P.nalCount,K.duration+=P.duration;P=[F],P.nalCount=F.length,P.byteLength=F.byteLength,P.pts=F.pts,P.dts=F.dts,P.duration=F.duration}else P.duration+=F.duration,P.nalCount+=F.length,P.byteLength+=F.byteLength,P.push(F);if(K.length&&P.duration<=0)P.duration=K[K.length-1].duration;return K.byteLength+=P.byteLength,K.nalCount+=P.nalCount,K.duration+=P.duration,K.push(P),K},Bi=function(_){var R;if(!_[0][0].keyFrame&&_.length>1)R=_.shift(),_.byteLength-=R.byteLength,_.nalCount-=R.nalCount,_[0][0].dts=R.dts,_[0][0].pts=R.pts,_[0][0].duration+=R.duration;return _},ai=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ai=function(_,R){var F=ai();if(F.dataOffset=R,F.compositionTimeOffset=_.pts-_.dts,F.duration=_.duration,F.size=4*_.length,F.size+=_.byteLength,_.keyFrame)F.flags.dependsOn=2,F.flags.isNonSyncSample=0;return F},Ks=function(_,R){var F,P,K,ee,le,we=R||0,Se=[];for(F=0;F<_.length;F++){ee=_[F];for(P=0;P<ee.length;P++)le=ee[P],K=Ai(le,we),we+=K.size,Se.push(K)}return Se},Ki=function(_){var R,F,P,K,ee,le,we=0,{byteLength:Se,nalCount:ke}=_,Be=Se+4*ke,it=new Uint8Array(Be),Ft=new DataView(it.buffer);for(R=0;R<_.length;R++){K=_[R];for(F=0;F<K.length;F++){ee=K[F];for(P=0;P<ee.length;P++)le=ee[P],Ft.setUint32(we,le.data.byteLength),we+=4,it.set(le.data,we),we+=le.data.byteLength}}return it},zt=function(_,R){var F,P=R||0,K=[];return F=Ai(_,P),K.push(F),K},Yt=function(_){var R,F,P=0,{byteLength:K,length:ee}=_,le=K+4*ee,we=new Uint8Array(le),Se=new DataView(we.buffer);for(R=0;R<_.length;R++)F=_[R],Se.setUint32(P,F.data.byteLength),P+=4,we.set(F.data,P),P+=F.data.byteLength;return we},ln={groupNalsIntoFrames:Rn,groupFramesIntoGops:Jn,extendFirstKeyFrame:Bi,generateSampleTable:Ks,concatenateNalData:Ki,generateSampleTableForFrame:zt,concatenateNalDataForFrame:Yt},bn=[33,16,5,32,164,27],ri=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],fn=function(_){var R=[];while(_--)R.push(0);return R},Si=function(_){return Object.keys(_).reduce(function(R,F){return R[F]=new Uint8Array(_[F].reduce(function(P,K){return P.concat(K)},[])),R},{})},En,sa=function(){if(!En){var _={96000:[bn,[227,64],fn(154),[56]],88200:[bn,[231],fn(170),[56]],64000:[bn,[248,192],fn(240),[56]],48000:[bn,[255,192],fn(268),[55,148,128],fn(54),[112]],44100:[bn,[255,192],fn(268),[55,163,128],fn(84),[112]],32000:[bn,[255,192],fn(268),[55,234],fn(226),[112]],24000:[bn,[255,192],fn(268),[55,255,128],fn(268),[111,112],fn(126),[224]],16000:[bn,[255,192],fn(268),[55,255,128],fn(268),[111,255],fn(269),[223,108],fn(195),[1,192]],12000:[ri,fn(268),[3,127,248],fn(268),[6,255,240],fn(268),[13,255,224],fn(268),[27,253,128],fn(259),[56]],11025:[ri,fn(268),[3,127,248],fn(268),[6,255,240],fn(268),[13,255,224],fn(268),[27,255,192],fn(268),[55,175,128],fn(108),[112]],8000:[ri,fn(268),[3,121,16],fn(47),[7]]};En=Si(_)}return En},pr=90000,bs,ws,aa,Li,ys,Vr,Xr;bs=function(_){return _*pr},ws=function(_,R){return _*R},aa=function(_){return _/pr},Li=function(_,R){return _/R},ys=function(_,R){return bs(Li(_,R))},Vr=function(_,R){return ws(aa(_),R)},Xr=function(_,R,F){return aa(F?_:_-R)};var zn={ONE_SECOND_IN_TS:pr,secondsToVideoTs:bs,secondsToAudioTs:ws,videoTsToSeconds:aa,audioTsToSeconds:Li,audioTsToVideoTs:ys,videoTsToAudioTs:Vr,metadataTsToSeconds:Xr},ka=sa,mr=zn,Wl=function(_){var R,F,P=0;for(R=0;R<_.length;R++)F=_[R],P+=F.data.byteLength;return P},ho=function(_,R,F,P){var K,ee=0,le=0,we=0,Se=0,ke,Be,it;if(!R.length)return;if(K=mr.audioTsToVideoTs(_.baseMediaDecodeTime,_.samplerate),ee=Math.ceil(mr.ONE_SECOND_IN_TS/(_.samplerate/1024)),F&&P)le=K-Math.max(F,P),we=Math.floor(le/ee),Se=we*ee;if(we<1||Se>mr.ONE_SECOND_IN_TS/2)return;if(ke=ka()[_.samplerate],!ke)ke=R[0].data;for(Be=0;Be<we;Be++)it=R[0],R.splice(0,0,{data:ke,dts:it.dts-ee,pts:it.pts-ee});return _.baseMediaDecodeTime-=Math.floor(mr.videoTsToAudioTs(Se,_.samplerate)),Se},Kl=function(_,R,F){if(R.minSegmentDts>=F)return _;return R.minSegmentDts=1/0,_.filter(function(P){if(P.dts>=F)return R.minSegmentDts=Math.min(R.minSegmentDts,P.dts),R.minSegmentPts=R.minSegmentDts,!0;return!1})},mo=function(_){var R,F,P=[];for(R=0;R<_.length;R++)F=_[R],P.push({size:F.data.byteLength,duration:1024});return P},Gt=function(_){var R,F,P=0,K=new Uint8Array(Wl(_));for(R=0;R<_.length;R++)F=_[R],K.set(F.data,P),P+=F.data.byteLength;return K},Qt={prefixWithSilence:ho,trimAdtsFramesByEarliestDts:Kl,generateSampleTable:mo,concatenateFrameData:Gt},Zn=zn.ONE_SECOND_IN_TS,es=function(_,R){if(typeof R.pts==="number"){if(_.timelineStartInfo.pts===void 0)_.timelineStartInfo.pts=R.pts;if(_.minSegmentPts===void 0)_.minSegmentPts=R.pts;else _.minSegmentPts=Math.min(_.minSegmentPts,R.pts);if(_.maxSegmentPts===void 0)_.maxSegmentPts=R.pts;else _.maxSegmentPts=Math.max(_.maxSegmentPts,R.pts)}if(typeof R.dts==="number"){if(_.timelineStartInfo.dts===void 0)_.timelineStartInfo.dts=R.dts;if(_.minSegmentDts===void 0)_.minSegmentDts=R.dts;else _.minSegmentDts=Math.min(_.minSegmentDts,R.dts);if(_.maxSegmentDts===void 0)_.maxSegmentDts=R.dts;else _.maxSegmentDts=Math.max(_.maxSegmentDts,R.dts)}},Dt=function(_){delete _.minSegmentDts,delete _.maxSegmentDts,delete _.minSegmentPts,delete _.maxSegmentPts},Pt=function(_,R){var F,P,K=_.minSegmentDts;if(!R)K-=_.timelineStartInfo.dts;if(F=_.timelineStartInfo.baseMediaDecodeTime,F+=K,F=Math.max(0,F),_.type==="audio")P=_.samplerate/Zn,F*=P,F=Math.floor(F);return F},Kt={clearDtsInfo:Dt,calculateTrackBaseMediaDecodeTime:Pt,collectDtsInfo:es},$t=4,Ci=128,gi=function(_){var R=0,F={payloadType:-1,payloadSize:0},P=0,K=0;while(R<_.byteLength){if(_[R]===Ci)break;while(_[R]===255)P+=255,R++;P+=_[R++];while(_[R]===255)K+=255,R++;if(K+=_[R++],!F.payload&&P===$t){var ee=String.fromCharCode(_[R+3],_[R+4],_[R+5],_[R+6]);if(ee==="GA94"){F.payloadType=P,F.payloadSize=K,F.payload=_.subarray(R,R+K);break}else F.payload=void 0}R+=K,P=0,K=0}return F},gr=function(_){if(_.payload[0]!==181)return null;if((_.payload[1]<<8|_.payload[2])!==49)return null;if(String.fromCharCode(_.payload[3],_.payload[4],_.payload[5],_.payload[6])!=="GA94")return null;if(_.payload[7]!==3)return null;return _.payload.subarray(8,_.payload.length-1)},tl=function(_,R){var F=[],P,K,ee,le;if(!(R[0]&64))return F;K=R[0]&31;for(P=0;P<K;P++)if(ee=P*3,le={type:R[ee+2]&3,pts:_},R[ee+2]&4)le.ccData=R[ee+3]<<8|R[ee+4],F.push(le);return F},Mh=function(_){var R=_.byteLength,F=[],P=1,K,ee;while(P<R-2)if(_[P]===0&&_[P+1]===0&&_[P+2]===3)F.push(P+2),P+=2;else P++;if(F.length===0)return _;K=R-F.length,ee=new Uint8Array(K);var le=0;for(P=0;P<K;le++,P++){if(le===F[0])le++,F.shift();ee[P]=_[le]}return ee},Ld={parseSei:gi,parseUserData:gr,parseCaptionPackets:tl,discardEmulationPreventionBytes:Mh,USER_DATA_REGISTERED_ITU_T_T35:$t},$l=i,nl=Ld,vs=function(_){if(_=_||{},vs.prototype.init.call(this),this.parse708captions_=typeof _.parse708captions==="boolean"?_.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new ui(0,0),new ui(0,1),new ui(1,0),new ui(1,1)],this.parse708captions_)this.cc708Stream_=new On({captionServices:_.captionServices});if(this.reset(),this.ccStreams_.forEach(function(R){R.on("data",this.trigger.bind(this,"data")),R.on("partialdone",this.trigger.bind(this,"partialdone")),R.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_)this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done"))};vs.prototype=new $l,vs.prototype.push=function(_){var R,F,P;if(_.nalUnitType!=="sei_rbsp")return;if(R=nl.parseSei(_.escapedRBSP),!R.payload)return;if(R.payloadType!==nl.USER_DATA_REGISTERED_ITU_T_T35)return;if(F=nl.parseUserData(R),!F)return;if(_.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(_.dts===this.latestDts_&&this.ignoreNextEqualDts_){if(this.numSameDts_--,!this.numSameDts_)this.ignoreNextEqualDts_=!1;return}if(P=nl.parseCaptionPackets(_.pts,F),this.captionPackets_=this.captionPackets_.concat(P),this.latestDts_!==_.dts)this.numSameDts_=0;this.numSameDts_++,this.latestDts_=_.dts},vs.prototype.flushCCStreams=function(_){this.ccStreams_.forEach(function(R){return _==="flush"?R.flush():R.partialFlush()},this)},vs.prototype.flushStream=function(_){if(!this.captionPackets_.length){this.flushCCStreams(_);return}this.captionPackets_.forEach(function(R,F){R.presortIndex=F}),this.captionPackets_.sort(function(R,F){if(R.pts===F.pts)return R.presortIndex-F.presortIndex;return R.pts-F.pts}),this.captionPackets_.forEach(function(R){if(R.type<2)this.dispatchCea608Packet(R);else this.dispatchCea708Packet(R)},this),this.captionPackets_.length=0,this.flushCCStreams(_)},vs.prototype.flush=function(){return this.flushStream("flush")},vs.prototype.partialFlush=function(){return this.flushStream("partialFlush")},vs.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(_){_.reset()})},vs.prototype.dispatchCea608Packet=function(_){if(this.setsTextOrXDSActive(_))this.activeCea608Channel_[_.type]=null;else if(this.setsChannel1Active(_))this.activeCea608Channel_[_.type]=0;else if(this.setsChannel2Active(_))this.activeCea608Channel_[_.type]=1;if(this.activeCea608Channel_[_.type]===null)return;this.ccStreams_[(_.type<<1)+this.activeCea608Channel_[_.type]].push(_)},vs.prototype.setsChannel1Active=function(_){return(_.ccData&30720)===4096},vs.prototype.setsChannel2Active=function(_){return(_.ccData&30720)===6144},vs.prototype.setsTextOrXDSActive=function(_){return(_.ccData&28928)===256||(_.ccData&30974)===4138||(_.ccData&30974)===6186},vs.prototype.dispatchCea708Packet=function(_){if(this.parse708captions_)this.cc708Stream_.push(_)};var il={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},gm=function(_){var R=il[_]||_;if(_&4096&&_===R)return"";return String.fromCharCode(R)},sl=function(_){return 32<=_&&_<=127||160<=_&&_<=255},Va=function(_){this.windowNum=_,this.reset()};Va.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Va.prototype.getText=function(){return this.rows.join(`
|
|
197
|
+
`)},Va.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Va.prototype.newLine=function(_){if(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow==="function")this.beforeRowOverflow(_);if(this.rows.length>0)this.rows.push(""),this.rowIdx++;while(this.rows.length>this.virtualRowCount)this.rows.shift(),this.rowIdx--},Va.prototype.isEmpty=function(){if(this.rows.length===0)return!0;else if(this.rows.length===1)return this.rows[0]==="";return!1},Va.prototype.addText=function(_){this.rows[this.rowIdx]+=_},Va.prototype.backspace=function(){if(!this.isEmpty()){var _=this.rows[this.rowIdx];this.rows[this.rowIdx]=_.substr(0,_.length-1)}};var Yl=function(_,R,F){if(this.serviceNum=_,this.text="",this.currentWindow=new Va(-1),this.windows=[],this.stream=F,typeof R==="string")this.createTextDecoder(R)};Yl.prototype.init=function(_,R){this.startPts=_;for(var F=0;F<8;F++)if(this.windows[F]=new Va(F),typeof R==="function")this.windows[F].beforeRowOverflow=R},Yl.prototype.setCurrentWindow=function(_){this.currentWindow=this.windows[_]},Yl.prototype.createTextDecoder=function(_){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(_)}catch(R){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+_+" encoding. "+R})}};var On=function(_){_=_||{},On.prototype.init.call(this);var R=this,F=_.captionServices||{},P={},K;Object.keys(F).forEach((ee)=>{if(K=F[ee],/^SERVICE/.test(ee))P[ee]=K.encoding}),this.serviceEncodings=P,this.current708Packet=null,this.services={},this.push=function(ee){if(ee.type===3)R.new708Packet(),R.add708Bytes(ee);else{if(R.current708Packet===null)R.new708Packet();R.add708Bytes(ee)}}};On.prototype=new $l,On.prototype.new708Packet=function(){if(this.current708Packet!==null)this.push708Packet();this.current708Packet={data:[],ptsVals:[]}},On.prototype.add708Bytes=function(_){var R=_.ccData,F=R>>>8,P=R&255;this.current708Packet.ptsVals.push(_.pts),this.current708Packet.data.push(F),this.current708Packet.data.push(P)},On.prototype.push708Packet=function(){var _=this.current708Packet,R=_.data,F=null,P=null,K=0,ee=R[K++];_.seq=ee>>6,_.sizeCode=ee&63;for(;K<R.length;K++){if(ee=R[K++],F=ee>>5,P=ee&31,F===7&&P>0)ee=R[K++],F=ee;if(this.pushServiceBlock(F,K,P),P>0)K+=P-1}},On.prototype.pushServiceBlock=function(_,R,F){var P,K=R,ee=this.current708Packet.data,le=this.services[_];if(!le)le=this.initService(_,K);for(;K<R+F&&K<ee.length;K++)if(P=ee[K],sl(P))K=this.handleText(K,le);else if(P===24)K=this.multiByteCharacter(K,le);else if(P===16)K=this.extendedCommands(K,le);else if(128<=P&&P<=135)K=this.setCurrentWindow(K,le);else if(152<=P&&P<=159)K=this.defineWindow(K,le);else if(P===136)K=this.clearWindows(K,le);else if(P===140)K=this.deleteWindows(K,le);else if(P===137)K=this.displayWindows(K,le);else if(P===138)K=this.hideWindows(K,le);else if(P===139)K=this.toggleWindows(K,le);else if(P===151)K=this.setWindowAttributes(K,le);else if(P===144)K=this.setPenAttributes(K,le);else if(P===145)K=this.setPenColor(K,le);else if(P===146)K=this.setPenLocation(K,le);else if(P===143)le=this.reset(K,le);else if(P===8)le.currentWindow.backspace();else if(P===12)le.currentWindow.clearText();else if(P===13)le.currentWindow.pendingNewLine=!0;else if(P===14)le.currentWindow.clearText();else if(P===141)K++},On.prototype.extendedCommands=function(_,R){var F=this.current708Packet.data,P=F[++_];if(sl(P))_=this.handleText(_,R,{isExtended:!0});return _},On.prototype.getPts=function(_){return this.current708Packet.ptsVals[Math.floor(_/2)]},On.prototype.initService=function(_,R){var P="SERVICE"+_,F=this,P,K;if(P in this.serviceEncodings)K=this.serviceEncodings[P];return this.services[_]=new Yl(_,K,F),this.services[_].init(this.getPts(R),function(ee){F.flushDisplayed(ee,F.services[_])}),this.services[_]},On.prototype.handleText=function(_,R,F){var P=F&&F.isExtended,K=F&&F.isMultiByte,ee=this.current708Packet.data,le=P?4096:0,we=ee[_],Se=ee[_+1],ke=R.currentWindow,Be,it;function Ft(pt){return pt.map((Vt)=>("0"+(Vt&255).toString(16)).slice(-2)).join("")}if(K)it=[we,Se],_++;else it=[we];if(R.textDecoder_&&!P)Be=R.textDecoder_.decode(new Uint8Array(it));else if(K){let pt=Ft(it);Be=String.fromCharCode(parseInt(pt,16))}else Be=gm(le|we);if(ke.pendingNewLine&&!ke.isEmpty())ke.newLine(this.getPts(_));return ke.pendingNewLine=!1,ke.addText(Be),_},On.prototype.multiByteCharacter=function(_,R){var F=this.current708Packet.data,P=F[_+1],K=F[_+2];if(sl(P)&&sl(K))_=this.handleText(++_,R,{isMultiByte:!0});return _},On.prototype.setCurrentWindow=function(_,R){var F=this.current708Packet.data,P=F[_],K=P&7;return R.setCurrentWindow(K),_},On.prototype.defineWindow=function(_,R){var F=this.current708Packet.data,P=F[_],K=P&7;R.setCurrentWindow(K);var ee=R.currentWindow;return P=F[++_],ee.visible=(P&32)>>5,ee.rowLock=(P&16)>>4,ee.columnLock=(P&8)>>3,ee.priority=P&7,P=F[++_],ee.relativePositioning=(P&128)>>7,ee.anchorVertical=P&127,P=F[++_],ee.anchorHorizontal=P,P=F[++_],ee.anchorPoint=(P&240)>>4,ee.rowCount=P&15,P=F[++_],ee.columnCount=P&63,P=F[++_],ee.windowStyle=(P&56)>>3,ee.penStyle=P&7,ee.virtualRowCount=ee.rowCount+1,_},On.prototype.setWindowAttributes=function(_,R){var F=this.current708Packet.data,P=F[_],K=R.currentWindow.winAttr;return P=F[++_],K.fillOpacity=(P&192)>>6,K.fillRed=(P&48)>>4,K.fillGreen=(P&12)>>2,K.fillBlue=P&3,P=F[++_],K.borderType=(P&192)>>6,K.borderRed=(P&48)>>4,K.borderGreen=(P&12)>>2,K.borderBlue=P&3,P=F[++_],K.borderType+=(P&128)>>5,K.wordWrap=(P&64)>>6,K.printDirection=(P&48)>>4,K.scrollDirection=(P&12)>>2,K.justify=P&3,P=F[++_],K.effectSpeed=(P&240)>>4,K.effectDirection=(P&12)>>2,K.displayEffect=P&3,_},On.prototype.flushDisplayed=function(_,R){var F=[];for(var P=0;P<8;P++)if(R.windows[P].visible&&!R.windows[P].isEmpty())F.push(R.windows[P].getText());R.endPts=_,R.text=F.join(`
|
|
198
|
+
|
|
199
|
+
`),this.pushCaption(R),R.startPts=_},On.prototype.pushCaption=function(_){if(_.text!=="")this.trigger("data",{startPts:_.startPts,endPts:_.endPts,text:_.text,stream:"cc708_"+_.serviceNum}),_.text="",_.startPts=_.endPts},On.prototype.displayWindows=function(_,R){var F=this.current708Packet.data,P=F[++_],K=this.getPts(_);this.flushDisplayed(K,R);for(var ee=0;ee<8;ee++)if(P&1<<ee)R.windows[ee].visible=1;return _},On.prototype.hideWindows=function(_,R){var F=this.current708Packet.data,P=F[++_],K=this.getPts(_);this.flushDisplayed(K,R);for(var ee=0;ee<8;ee++)if(P&1<<ee)R.windows[ee].visible=0;return _},On.prototype.toggleWindows=function(_,R){var F=this.current708Packet.data,P=F[++_],K=this.getPts(_);this.flushDisplayed(K,R);for(var ee=0;ee<8;ee++)if(P&1<<ee)R.windows[ee].visible^=1;return _},On.prototype.clearWindows=function(_,R){var F=this.current708Packet.data,P=F[++_],K=this.getPts(_);this.flushDisplayed(K,R);for(var ee=0;ee<8;ee++)if(P&1<<ee)R.windows[ee].clearText();return _},On.prototype.deleteWindows=function(_,R){var F=this.current708Packet.data,P=F[++_],K=this.getPts(_);this.flushDisplayed(K,R);for(var ee=0;ee<8;ee++)if(P&1<<ee)R.windows[ee].reset();return _},On.prototype.setPenAttributes=function(_,R){var F=this.current708Packet.data,P=F[_],K=R.currentWindow.penAttr;return P=F[++_],K.textTag=(P&240)>>4,K.offset=(P&12)>>2,K.penSize=P&3,P=F[++_],K.italics=(P&128)>>7,K.underline=(P&64)>>6,K.edgeType=(P&56)>>3,K.fontStyle=P&7,_},On.prototype.setPenColor=function(_,R){var F=this.current708Packet.data,P=F[_],K=R.currentWindow.penColor;return P=F[++_],K.fgOpacity=(P&192)>>6,K.fgRed=(P&48)>>4,K.fgGreen=(P&12)>>2,K.fgBlue=P&3,P=F[++_],K.bgOpacity=(P&192)>>6,K.bgRed=(P&48)>>4,K.bgGreen=(P&12)>>2,K.bgBlue=P&3,P=F[++_],K.edgeRed=(P&48)>>4,K.edgeGreen=(P&12)>>2,K.edgeBlue=P&3,_},On.prototype.setPenLocation=function(_,R){var F=this.current708Packet.data,P=F[_],K=R.currentWindow.penLoc;return R.currentWindow.pendingNewLine=!0,P=F[++_],K.row=P&15,P=F[++_],K.column=P&63,_},On.prototype.reset=function(_,R){var F=this.getPts(_);return this.flushDisplayed(F,R),this.initService(R.serviceNum,_)};var go={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},bo=function(_){if(_===null)return"";return _=go[_]||_,String.fromCharCode(_)},Ql=14,ou=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Xa=function(){var _=[],R=Ql+1;while(R--)_.push({text:"",indent:0,offset:0});return _},ui=function(_,R){ui.prototype.init.call(this),this.field_=_||0,this.dataChannel_=R||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(F){var P,K,ee,le,we;if(P=F.ccData&32639,P===this.lastControlCode_){this.lastControlCode_=null;return}if((P&61440)===4096)this.lastControlCode_=P;else if(P!==this.PADDING_)this.lastControlCode_=null;if(ee=P>>>8,le=P&255,P===this.PADDING_)return;else if(P===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(P===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(F.pts),this.flushDisplayed(F.pts),K=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=K,this.startPts_=F.pts;else if(P===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(F.pts);else if(P===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(F.pts);else if(P===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(F.pts);else if(P===this.CARRIAGE_RETURN_)this.clearFormatting(F.pts),this.flushDisplayed(F.pts),this.shiftRowsUp_(),this.startPts_=F.pts;else if(P===this.BACKSPACE_)if(this.mode_==="popOn")this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1);else this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(P===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(F.pts),this.displayed_=Xa();else if(P===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Xa();else if(P===this.RESUME_DIRECT_CAPTIONING_){if(this.mode_!=="paintOn")this.flushDisplayed(F.pts),this.displayed_=Xa();this.mode_="paintOn",this.startPts_=F.pts}else if(this.isSpecialCharacter(ee,le))ee=(ee&3)<<8,we=bo(ee|le),this[this.mode_](F.pts,we),this.column_++;else if(this.isExtCharacter(ee,le)){if(this.mode_==="popOn")this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1);else this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);ee=(ee&3)<<8,we=bo(ee|le),this[this.mode_](F.pts,we),this.column_++}else if(this.isMidRowCode(ee,le)){if(this.clearFormatting(F.pts),this[this.mode_](F.pts," "),this.column_++,(le&14)===14)this.addFormatting(F.pts,["i"]);if((le&1)===1)this.addFormatting(F.pts,["u"])}else if(this.isOffsetControlCode(ee,le)){let ke=le&3;this.nonDisplayed_[this.row_].offset=ke,this.column_+=ke}else if(this.isPAC(ee,le)){var Se=ou.indexOf(P&7968);if(this.mode_==="rollUp"){if(Se-this.rollUpRows_+1<0)Se=this.rollUpRows_-1;this.setRollUp(F.pts,Se)}if(Se!==this.row_&&Se>=0&&Se<=14)this.clearFormatting(F.pts),this.row_=Se;if(le&1&&this.formatting_.indexOf("u")===-1)this.addFormatting(F.pts,["u"]);if((P&16)===16){let ke=(P&14)>>1;this.column_=ke*4,this.nonDisplayed_[this.row_].indent+=ke}if(this.isColorPAC(le)){if((le&14)===14)this.addFormatting(F.pts,["i"])}}else if(this.isNormalChar(ee)){if(le===0)le=null;we=bo(ee),we+=bo(le),this[this.mode_](F.pts,we),this.column_+=we.length}}};ui.prototype=new $l,ui.prototype.flushDisplayed=function(_){let R=(P)=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+P+"."})},F=[];if(this.displayed_.forEach((P,K)=>{if(P&&P.text&&P.text.length){try{P.text=P.text.trim()}catch(ee){R(K)}if(P.text.length)F.push({text:P.text,line:K+1,position:10+Math.min(70,P.indent*10)+P.offset*2.5})}else if(P===void 0||P===null)R(K)}),F.length)this.trigger("data",{startPts:this.startPts_,endPts:_,content:F,stream:this.name_})},ui.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Xa(),this.nonDisplayed_=Xa(),this.lastControlCode_=null,this.column_=0,this.row_=Ql,this.rollUpRows_=2,this.formatting_=[]},ui.prototype.setConstants=function(){if(this.dataChannel_===0)this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23;else if(this.dataChannel_===1)this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31;this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},ui.prototype.isSpecialCharacter=function(_,R){return _===this.EXT_&&R>=48&&R<=63},ui.prototype.isExtCharacter=function(_,R){return(_===this.EXT_+1||_===this.EXT_+2)&&R>=32&&R<=63},ui.prototype.isMidRowCode=function(_,R){return _===this.EXT_&&R>=32&&R<=47},ui.prototype.isOffsetControlCode=function(_,R){return _===this.OFFSET_&&R>=33&&R<=35},ui.prototype.isPAC=function(_,R){return _>=this.BASE_&&_<this.BASE_+8&&R>=64&&R<=127},ui.prototype.isColorPAC=function(_){return _>=64&&_<=79||_>=96&&_<=127},ui.prototype.isNormalChar=function(_){return _>=32&&_<=127},ui.prototype.setRollUp=function(_,R){if(this.mode_!=="rollUp")this.row_=Ql,this.mode_="rollUp",this.flushDisplayed(_),this.nonDisplayed_=Xa(),this.displayed_=Xa();if(R!==void 0&&R!==this.row_)for(var F=0;F<this.rollUpRows_;F++)this.displayed_[R-F]=this.displayed_[this.row_-F],this.displayed_[this.row_-F]={text:"",indent:0,offset:0};if(R===void 0)R=this.row_;this.topRow_=R-this.rollUpRows_+1},ui.prototype.addFormatting=function(_,R){this.formatting_=this.formatting_.concat(R);var F=R.reduce(function(P,K){return P+"<"+K+">"},"");this[this.mode_](_,F)},ui.prototype.clearFormatting=function(_){if(!this.formatting_.length)return;var R=this.formatting_.reverse().reduce(function(F,P){return F+"</"+P+">"},"");this.formatting_=[],this[this.mode_](_,R)},ui.prototype.popOn=function(_,R){var F=this.nonDisplayed_[this.row_].text;F+=R,this.nonDisplayed_[this.row_].text=F},ui.prototype.rollUp=function(_,R){var F=this.displayed_[this.row_].text;F+=R,this.displayed_[this.row_].text=F},ui.prototype.shiftRowsUp_=function(){var _;for(_=0;_<this.topRow_;_++)this.displayed_[_]={text:"",indent:0,offset:0};for(_=this.row_+1;_<Ql+1;_++)this.displayed_[_]={text:"",indent:0,offset:0};for(_=this.topRow_;_<this.row_;_++)this.displayed_[_]=this.displayed_[_+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},ui.prototype.paintOn=function(_,R){var F=this.displayed_[this.row_].text;F+=R,this.displayed_[this.row_].text=F};var Hd={CaptionStream:vs,Cea608Stream:ui,Cea708Stream:On},lu={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ud=i,zd=8589934592,wo=4294967296,Rh="shared",Oh=function(_,R){var F=1;if(_>R)F=-1;while(Math.abs(R-_)>wo)_+=F*zd;return _},br=function(_){var R,F;br.prototype.init.call(this),this.type_=_||Rh,this.push=function(P){if(P.type==="metadata"){this.trigger("data",P);return}if(this.type_!==Rh&&P.type!==this.type_)return;if(F===void 0)F=P.dts;P.dts=Oh(P.dts,F),P.pts=Oh(P.pts,F),R=P.dts,this.trigger("data",P)},this.flush=function(){F=R,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){F=void 0,R=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};br.prototype=new Ud;var $s={TimestampRolloverStream:br,handleRollover:Oh},Fh=(_,R,F)=>{if(!_)return-1;var P=F;for(;P<_.length;P++)if(_[P]===R)return P;return-1},_i={typedArrayIndexOf:Fh},Jl=_i.typedArrayIndexOf,Zl={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Gd=function(_,R,F){var P,K="";for(P=R;P<F;P++)K+="%"+("00"+_[P].toString(16)).slice(-2);return K},ec=function(_,R,F){return decodeURIComponent(Gd(_,R,F))},cu=function(_,R,F){return unescape(Gd(_,R,F))},al=function(_){return _[0]<<21|_[1]<<14|_[2]<<7|_[3]},rl={APIC:function(_){var R=1,F,P,K="-->";if(_.data[0]!==Zl.Utf8)return;if(F=Jl(_.data,0,R),F<0)return;if(_.mimeType=cu(_.data,R,F),R=F+1,_.pictureType=_.data[R],R++,P=Jl(_.data,0,R),P<0)return;if(_.description=ec(_.data,R,P),R=P+1,_.mimeType===K)_.url=cu(_.data,R,_.data.length);else _.pictureData=_.data.subarray(R,_.data.length)},"T*":function(_){if(_.data[0]!==Zl.Utf8)return;_.value=ec(_.data,1,_.data.length).replace(/\0*$/,""),_.values=_.value.split("\x00")},TXXX:function(_){var R;if(_.data[0]!==Zl.Utf8)return;if(R=Jl(_.data,0,1),R===-1)return;_.description=ec(_.data,1,R),_.value=ec(_.data,R+1,_.data.length).replace(/\0*$/,""),_.data=_.value},"W*":function(_){_.url=cu(_.data,0,_.data.length).replace(/\0.*$/,"")},WXXX:function(_){var R;if(_.data[0]!==Zl.Utf8)return;if(R=Jl(_.data,0,1),R===-1)return;_.description=ec(_.data,1,R),_.url=cu(_.data,R+1,_.data.length).replace(/\0.*$/,"")},PRIV:function(_){var R;for(R=0;R<_.data.length;R++)if(_.data[R]===0){_.owner=cu(_.data,0,R);break}_.privateData=_.data.subarray(R+1),_.data=_.privateData}},Vd=function(_){var R,F,P=10,K=0,ee=[];if(_.length<10||_[0]!==73||_[1]!==68||_[2]!==51)return;K=al(_.subarray(6,10)),K+=10;var le=_[5]&64;if(le)P+=4,P+=al(_.subarray(10,14)),K-=al(_.subarray(16,20));do{if(R=al(_.subarray(P+4,P+8)),R<1)break;F=String.fromCharCode(_[P],_[P+1],_[P+2],_[P+3]);var we={id:F,data:_.subarray(P+10,P+R+10)};if(we.key=we.id,rl[we.id])rl[we.id](we);else if(we.id[0]==="T")rl["T*"](we);else if(we.id[0]==="W")rl["W*"](we);ee.push(we),P+=10,P+=R}while(P<K);return ee},Ss={parseId3Frames:Vd,parseSyncSafeInteger:al,frameParsers:rl},Ei=i,Nh=lu,Ta=Ss,ll;ll=function(_){var R={descriptor:_&&_.descriptor},F=0,P=[],K=0,ee;if(ll.prototype.init.call(this),this.dispatchType=Nh.METADATA_STREAM_TYPE.toString(16),R.descriptor)for(ee=0;ee<R.descriptor.length;ee++)this.dispatchType+=("00"+R.descriptor[ee].toString(16)).slice(-2);this.push=function(le){var we,Se,ke,Be,it,Ft;if(le.type!=="timed-metadata")return;if(le.dataAlignmentIndicator)K=0,P.length=0;if(P.length===0&&(le.data.length<10||le.data[0]!==73||le.data[1]!==68||le.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(P.push(le),K+=le.data.byteLength,P.length===1)F=Ta.parseSyncSafeInteger(le.data.subarray(6,10)),F+=10;if(K<F)return;we={data:new Uint8Array(F),frames:[],pts:P[0].pts,dts:P[0].dts};for(it=0;it<F;)we.data.set(P[0].data.subarray(0,F-it),it),it+=P[0].data.byteLength,K-=P[0].data.byteLength,P.shift();if(Se=10,we.data[5]&64)Se+=4,Se+=Ta.parseSyncSafeInteger(we.data.subarray(10,14)),F-=Ta.parseSyncSafeInteger(we.data.subarray(16,20));do{if(ke=Ta.parseSyncSafeInteger(we.data.subarray(Se+4,Se+8)),ke<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Ft=String.fromCharCode(we.data[Se],we.data[Se+1],we.data[Se+2],we.data[Se+3]),Be={id:Ft,data:we.data.subarray(Se+10,Se+ke+10)},Be.key=Be.id,Ta.frameParsers[Be.id])Ta.frameParsers[Be.id](Be);else if(Be.id[0]==="T")Ta.frameParsers["T*"](Be);else if(Be.id[0]==="W")Ta.frameParsers["W*"](Be);if(Be.owner==="com.apple.streaming.transportStreamTimestamp"){var pt=Be.data,Vt=(pt[3]&1)<<30|pt[4]<<22|pt[5]<<14|pt[6]<<6|pt[7]>>>2;if(Vt*=4,Vt+=pt[7]&3,Be.timeStamp=Vt,we.pts===void 0&&we.dts===void 0)we.pts=Be.timeStamp,we.dts=Be.timeStamp;this.trigger("timestamp",Be)}we.frames.push(Be),Se+=10,Se+=ke}while(Se<F);this.trigger("data",we)}},ll.prototype=new Ei;var Xd=ll,Ka=i,tc=Hd,oa=lu,Wd=$s.TimestampRolloverStream,uu,nc,hu,cl=188,Ph=71;uu=function(){var _=new Uint8Array(cl),R=0;uu.prototype.init.call(this),this.push=function(F){var P=0,K=cl,ee;if(R)ee=new Uint8Array(F.byteLength+R),ee.set(_.subarray(0,R)),ee.set(F,R),R=0;else ee=F;while(K<ee.byteLength){if(ee[P]===Ph&&ee[K]===Ph){this.trigger("data",ee.subarray(P,K)),P+=cl,K+=cl;continue}P++,K++}if(P<ee.byteLength)_.set(ee.subarray(P),0),R=ee.byteLength-P},this.flush=function(){if(R===cl&&_[0]===Ph)this.trigger("data",_),R=0;this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){R=0,this.trigger("reset")}},uu.prototype=new Ka,nc=function(){var _,R,F,P;nc.prototype.init.call(this),P=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,_=function(K,ee){var le=0;if(ee.payloadUnitStartIndicator)le+=K[le]+1;if(ee.type==="pat")R(K.subarray(le),ee);else F(K.subarray(le),ee)},R=function(K,ee){ee.section_number=K[7],ee.last_section_number=K[8],P.pmtPid=(K[10]&31)<<8|K[11],ee.pmtPid=P.pmtPid},F=function(K,ee){var le,we,Se,ke;if(!(K[5]&1))return;P.programMapTable={video:null,audio:null,"timed-metadata":{}},le=(K[1]&15)<<8|K[2],we=3+le-4,Se=(K[10]&15)<<8|K[11],ke=12+Se;while(ke<we){var Be=K[ke],it=(K[ke+1]&31)<<8|K[ke+2];if(Be===oa.H264_STREAM_TYPE&&P.programMapTable.video===null)P.programMapTable.video=it;else if(Be===oa.ADTS_STREAM_TYPE&&P.programMapTable.audio===null)P.programMapTable.audio=it;else if(Be===oa.METADATA_STREAM_TYPE)P.programMapTable["timed-metadata"][it]=Be;ke+=((K[ke+3]&15)<<8|K[ke+4])+5}ee.programMapTable=P.programMapTable},this.push=function(K){var ee={},le=4;if(ee.payloadUnitStartIndicator=!!(K[1]&64),ee.pid=K[1]&31,ee.pid<<=8,ee.pid|=K[2],(K[3]&48)>>>4>1)le+=K[le]+1;if(ee.pid===0)ee.type="pat",_(K.subarray(le),ee),this.trigger("data",ee);else if(ee.pid===this.pmtPid){ee.type="pmt",_(K.subarray(le),ee),this.trigger("data",ee);while(this.packetsWaitingForPmt.length)this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}else if(this.programMapTable===void 0)this.packetsWaitingForPmt.push([K,le,ee]);else this.processPes_(K,le,ee)},this.processPes_=function(K,ee,le){if(le.pid===this.programMapTable.video)le.streamType=oa.H264_STREAM_TYPE;else if(le.pid===this.programMapTable.audio)le.streamType=oa.ADTS_STREAM_TYPE;else le.streamType=this.programMapTable["timed-metadata"][le.pid];le.type="pes",le.data=K.subarray(ee),this.trigger("data",le)}},nc.prototype=new Ka,nc.STREAM_TYPES={h264:27,adts:15},hu=function(){var _=this,R=!1,F={data:[],size:0},P={data:[],size:0},K={data:[],size:0},ee,le=function(Se,ke){var Be;let it=Se[0]<<16|Se[1]<<8|Se[2];if(ke.data=new Uint8Array,it!==1)return;if(ke.packetLength=6+(Se[4]<<8|Se[5]),ke.dataAlignmentIndicator=(Se[6]&4)!==0,Be=Se[7],Be&192){if(ke.pts=(Se[9]&14)<<27|(Se[10]&255)<<20|(Se[11]&254)<<12|(Se[12]&255)<<5|(Se[13]&254)>>>3,ke.pts*=4,ke.pts+=(Se[13]&6)>>>1,ke.dts=ke.pts,Be&64)ke.dts=(Se[14]&14)<<27|(Se[15]&255)<<20|(Se[16]&254)<<12|(Se[17]&255)<<5|(Se[18]&254)>>>3,ke.dts*=4,ke.dts+=(Se[18]&6)>>>1}ke.data=Se.subarray(9+Se[8])},we=function(Se,ke,Be){var it=new Uint8Array(Se.size),Ft={type:ke},pt=0,Vt=0,rn=!1,Qi;if(!Se.data.length||Se.size<9)return;Ft.trackId=Se.data[0].pid;for(pt=0;pt<Se.data.length;pt++)Qi=Se.data[pt],it.set(Qi.data,Vt),Vt+=Qi.data.byteLength;if(le(it,Ft),rn=ke==="video"||Ft.packetLength<=Se.size,Be||rn)Se.size=0,Se.data.length=0;if(rn)_.trigger("data",Ft)};hu.prototype.init.call(this),this.push=function(Se){({pat:function(){},pes:function(){var ke,Be;switch(Se.streamType){case oa.H264_STREAM_TYPE:ke=F,Be="video";break;case oa.ADTS_STREAM_TYPE:ke=P,Be="audio";break;case oa.METADATA_STREAM_TYPE:ke=K,Be="timed-metadata";break;default:return}if(Se.payloadUnitStartIndicator)we(ke,Be,!0);ke.data.push(Se),ke.size+=Se.data.byteLength},pmt:function(){var ke={type:"metadata",tracks:[]};if(ee=Se.programMapTable,ee.video!==null)ke.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+ee.video,codec:"avc",type:"video"});if(ee.audio!==null)ke.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+ee.audio,codec:"adts",type:"audio"});R=!0,_.trigger("data",ke)}})[Se.type]()},this.reset=function(){F.size=0,F.data.length=0,P.size=0,P.data.length=0,this.trigger("reset")},this.flushStreams_=function(){we(F,"video"),we(P,"audio"),we(K,"timed-metadata")},this.flush=function(){if(!R&&ee){var Se={type:"metadata",tracks:[]};if(ee.video!==null)Se.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+ee.video,codec:"avc",type:"video"});if(ee.audio!==null)Se.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+ee.audio,codec:"adts",type:"audio"});_.trigger("data",Se)}R=!1,this.flushStreams_(),this.trigger("done")}},hu.prototype=new Ka;var Kd={PAT_PID:0,MP2T_PACKET_LENGTH:cl,TransportPacketStream:uu,TransportParseStream:nc,ElementaryStream:hu,TimestampRolloverStream:Wd,CaptionStream:tc.CaptionStream,Cea608Stream:tc.Cea608Stream,Cea708Stream:tc.Cea708Stream,MetadataStream:Xd};for(var du in oa)if(oa.hasOwnProperty(du))Kd[du]=oa[du];var bm=Kd,I2=i,wm=zn.ONE_SECOND_IN_TS,pu,$d=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350];pu=function(_){var R,F=0;pu.prototype.init.call(this),this.skipWarn_=function(P,K){this.trigger("log",{level:"warn",message:`adts skiping bytes ${P} to ${K} in frame ${F} outside syncword`})},this.push=function(P){var K=0,ee,le,we,Se,ke;if(!_)F=0;if(P.type!=="audio")return;if(R&&R.length)we=R,R=new Uint8Array(we.byteLength+P.data.byteLength),R.set(we),R.set(P.data,we.byteLength);else R=P.data;var Be;while(K+7<R.length){if(R[K]!==255||(R[K+1]&246)!==240){if(typeof Be!=="number")Be=K;K++;continue}if(typeof Be==="number")this.skipWarn_(Be,K),Be=null;if(le=(~R[K+1]&1)*2,ee=(R[K+3]&3)<<11|R[K+4]<<3|(R[K+5]&224)>>5,Se=((R[K+6]&3)+1)*1024,ke=Se*wm/$d[(R[K+2]&60)>>>2],R.byteLength-K<ee)break;this.trigger("data",{pts:P.pts+F*ke,dts:P.dts+F*ke,sampleCount:Se,audioobjecttype:(R[K+2]>>>6&3)+1,channelcount:(R[K+2]&1)<<2|(R[K+3]&192)>>>6,samplerate:$d[(R[K+2]&60)>>>2],samplingfrequencyindex:(R[K+2]&60)>>>2,samplesize:16,data:R.subarray(K+7+le,K+ee)}),F++,K+=ee}if(typeof Be==="number")this.skipWarn_(Be,K),Be=null;R=R.subarray(K)},this.flush=function(){F=0,this.trigger("done")},this.reset=function(){R=void 0,this.trigger("reset")},this.endTimeline=function(){R=void 0,this.trigger("endedtimeline")}},pu.prototype=new I2;var Yd=pu,Qd;Qd=function(_){var R=_.byteLength,F=0,P=0;this.length=function(){return 8*R},this.bitsAvailable=function(){return 8*R+P},this.loadWord=function(){var K=_.byteLength-R,ee=new Uint8Array(4),le=Math.min(4,R);if(le===0)throw Error("no bytes available");ee.set(_.subarray(K,K+le)),F=new DataView(ee.buffer).getUint32(0),P=le*8,R-=le},this.skipBits=function(K){var ee;if(P>K)F<<=K,P-=K;else K-=P,ee=Math.floor(K/8),K-=ee*8,R-=ee,this.loadWord(),F<<=K,P-=K},this.readBits=function(K){var ee=Math.min(P,K),le=F>>>32-ee;if(P-=ee,P>0)F<<=ee;else if(R>0)this.loadWord();if(ee=K-ee,ee>0)return le<<ee|this.readBits(ee);return le},this.skipLeadingZeros=function(){var K;for(K=0;K<P;++K)if((F&2147483648>>>K)!==0)return F<<=K,P-=K,K;return this.loadWord(),K+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var K=this.skipLeadingZeros();return this.readBits(K+1)-1},this.readExpGolomb=function(){var K=this.readUnsignedExpGolomb();if(1&K)return 1+K>>>1;return-1*(K>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var ym=Qd,Jd=i,vm=ym,mu,gu,Zd;gu=function(){var _=0,R,F;gu.prototype.init.call(this),this.push=function(P){var K;if(!F)F=P.data;else K=new Uint8Array(F.byteLength+P.data.byteLength),K.set(F),K.set(P.data,F.byteLength),F=K;var ee=F.byteLength;for(;_<ee-3;_++)if(F[_+2]===1){R=_+5;break}while(R<ee)switch(F[R]){case 0:if(F[R-1]!==0){R+=2;break}else if(F[R-2]!==0){R++;break}if(_+3!==R-2)this.trigger("data",F.subarray(_+3,R-2));do R++;while(F[R]!==1&&R<ee);_=R-2,R+=3;break;case 1:if(F[R-1]!==0||F[R-2]!==0){R+=3;break}this.trigger("data",F.subarray(_+3,R-2)),_=R-2,R+=3;break;default:R+=3;break}F=F.subarray(_),R-=_,_=0},this.reset=function(){F=null,_=0,this.trigger("reset")},this.flush=function(){if(F&&F.byteLength>3)this.trigger("data",F.subarray(_+3));F=null,_=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},gu.prototype=new Jd,Zd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},mu=function(){var _=new gu,R,F,P,K,ee,le,we;mu.prototype.init.call(this),R=this,this.push=function(Se){if(Se.type!=="video")return;F=Se.trackId,P=Se.pts,K=Se.dts,_.push(Se)},_.on("data",function(Se){var ke={trackId:F,pts:P,dts:K,data:Se,nalUnitTypeCode:Se[0]&31};switch(ke.nalUnitTypeCode){case 5:ke.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:ke.nalUnitType="sei_rbsp",ke.escapedRBSP=ee(Se.subarray(1));break;case 7:ke.nalUnitType="seq_parameter_set_rbsp",ke.escapedRBSP=ee(Se.subarray(1)),ke.config=le(ke.escapedRBSP);break;case 8:ke.nalUnitType="pic_parameter_set_rbsp";break;case 9:ke.nalUnitType="access_unit_delimiter_rbsp";break}R.trigger("data",ke)}),_.on("done",function(){R.trigger("done")}),_.on("partialdone",function(){R.trigger("partialdone")}),_.on("reset",function(){R.trigger("reset")}),_.on("endedtimeline",function(){R.trigger("endedtimeline")}),this.flush=function(){_.flush()},this.partialFlush=function(){_.partialFlush()},this.reset=function(){_.reset()},this.endTimeline=function(){_.endTimeline()},we=function(Se,ke){var Be=8,it=8,Ft,pt;for(Ft=0;Ft<Se;Ft++){if(it!==0)pt=ke.readExpGolomb(),it=(Be+pt+256)%256;Be=it===0?Be:it}},ee=function(Se){var ke=Se.byteLength,Be=[],it=1,Ft,pt;while(it<ke-2)if(Se[it]===0&&Se[it+1]===0&&Se[it+2]===3)Be.push(it+2),it+=2;else it++;if(Be.length===0)return Se;Ft=ke-Be.length,pt=new Uint8Array(Ft);var Vt=0;for(it=0;it<Ft;Vt++,it++){if(Vt===Be[0])Vt++,Be.shift();pt[it]=Se[Vt]}return pt},le=function(Se){var ke=0,Be=0,it=0,Ft=0,pt,Vt,rn,Qi,Ps,xo,pc,mc,gc,bc,Uu,ei=[1,1],Sn,ua;if(pt=new vm(Se),Vt=pt.readUnsignedByte(),Qi=pt.readUnsignedByte(),rn=pt.readUnsignedByte(),pt.skipUnsignedExpGolomb(),Zd[Vt]){if(Ps=pt.readUnsignedExpGolomb(),Ps===3)pt.skipBits(1);if(pt.skipUnsignedExpGolomb(),pt.skipUnsignedExpGolomb(),pt.skipBits(1),pt.readBoolean()){Uu=Ps!==3?8:12;for(ua=0;ua<Uu;ua++)if(pt.readBoolean())if(ua<6)we(16,pt);else we(64,pt)}}if(pt.skipUnsignedExpGolomb(),xo=pt.readUnsignedExpGolomb(),xo===0)pt.readUnsignedExpGolomb();else if(xo===1){pt.skipBits(1),pt.skipExpGolomb(),pt.skipExpGolomb(),pc=pt.readUnsignedExpGolomb();for(ua=0;ua<pc;ua++)pt.skipExpGolomb()}if(pt.skipUnsignedExpGolomb(),pt.skipBits(1),mc=pt.readUnsignedExpGolomb(),gc=pt.readUnsignedExpGolomb(),bc=pt.readBits(1),bc===0)pt.skipBits(1);if(pt.skipBits(1),pt.readBoolean())ke=pt.readUnsignedExpGolomb(),Be=pt.readUnsignedExpGolomb(),it=pt.readUnsignedExpGolomb(),Ft=pt.readUnsignedExpGolomb();if(pt.readBoolean()){if(pt.readBoolean()){switch(Sn=pt.readUnsignedByte(),Sn){case 1:ei=[1,1];break;case 2:ei=[12,11];break;case 3:ei=[10,11];break;case 4:ei=[16,11];break;case 5:ei=[40,33];break;case 6:ei=[24,11];break;case 7:ei=[20,11];break;case 8:ei=[32,11];break;case 9:ei=[80,33];break;case 10:ei=[18,11];break;case 11:ei=[15,11];break;case 12:ei=[64,33];break;case 13:ei=[160,99];break;case 14:ei=[4,3];break;case 15:ei=[3,2];break;case 16:ei=[2,1];break;case 255:{ei=[pt.readUnsignedByte()<<8|pt.readUnsignedByte(),pt.readUnsignedByte()<<8|pt.readUnsignedByte()];break}}if(ei)ei[0]/ei[1]}}return{profileIdc:Vt,levelIdc:rn,profileCompatibility:Qi,width:(mc+1)*16-ke*2-Be*2,height:(2-bc)*(gc+1)*16-it*2-Ft*2,sarRatio:ei}}},mu.prototype=new Jd;var ic={H264Stream:mu,NalByteStream:gu},Sm=[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350],wu=function(_,R){var F=_[R+6]<<21|_[R+7]<<14|_[R+8]<<7|_[R+9],P=_[R+5],K=(P&16)>>4;if(F=F>=0?F:0,K)return F+20;return F+10},yu=function(_,R){if(_.length-R<10||_[R]!==73||_[R+1]!==68||_[R+2]!==51)return R;return R+=wu(_,R),yu(_,R)},_m=function(_){var R=yu(_,0);return _.length>=R+2&&(_[R]&255)===255&&(_[R+1]&240)===240&&(_[R+1]&22)===16},Lh=function(_){return _[0]<<21|_[1]<<14|_[2]<<7|_[3]},M2=function(_,R,F){var P,K="";for(P=R;P<F;P++)K+="%"+("00"+_[P].toString(16)).slice(-2);return K},xm=function(_,R,F){return unescape(M2(_,R,F))},km=function(_,R){var F=(_[R+5]&224)>>5,P=_[R+4]<<3,K=_[R+3]&6144;return K|P|F},Am=function(_,R){if(_[R]===73&&_[R+1]===68&&_[R+2]===51)return"timed-metadata";else if(_[R]&!0&&(_[R+1]&240)===240)return"audio";return null},Cm=function(_){var R=0;while(R+5<_.length){if(_[R]!==255||(_[R+1]&246)!==240){R++;continue}return Sm[(_[R+2]&60)>>>2]}return null},jm=function(_){var R,F,P,K;if(R=10,_[5]&64)R+=4,R+=Lh(_.subarray(10,14));do{if(F=Lh(_.subarray(R+4,R+8)),F<1)return null;if(K=String.fromCharCode(_[R],_[R+1],_[R+2],_[R+3]),K==="PRIV"){P=_.subarray(R+10,R+F+10);for(var ee=0;ee<P.byteLength;ee++)if(P[ee]===0){var le=xm(P,0,ee);if(le==="com.apple.streaming.transportStreamTimestamp"){var we=P.subarray(ee+1),Se=(we[3]&1)<<30|we[4]<<22|we[5]<<14|we[6]<<6|we[7]>>>2;return Se*=4,Se+=we[7]&3,Se}break}}R+=10,R+=F}while(R<_.byteLength);return null},Su={isLikelyAacData:_m,parseId3TagSize:wu,parseAdtsSize:km,parseType:Am,parseSampleRate:Cm,parseAacTimestamp:jm},Em=i,e0=Su,sc;sc=function(){var _=new Uint8Array,R=0;sc.prototype.init.call(this),this.setTimestamp=function(F){R=F},this.push=function(F){var P=0,K=0,ee,le,we,Se;if(_.length)Se=_.length,_=new Uint8Array(F.byteLength+Se),_.set(_.subarray(0,Se)),_.set(F,Se);else _=F;while(_.length-K>=3){if(_[K]===73&&_[K+1]===68&&_[K+2]===51){if(_.length-K<10)break;if(P=e0.parseId3TagSize(_,K),K+P>_.length)break;le={type:"timed-metadata",data:_.subarray(K,K+P)},this.trigger("data",le),K+=P;continue}else if((_[K]&255)===255&&(_[K+1]&240)===240){if(_.length-K<7)break;if(P=e0.parseAdtsSize(_,K),K+P>_.length)break;we={type:"audio",data:_.subarray(K,K+P),pts:R,dts:R},this.trigger("data",we),K+=P;continue}K++}if(ee=_.length-K,ee>0)_=_.subarray(K);else _=new Uint8Array},this.reset=function(){_=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){_=new Uint8Array,this.trigger("endedtimeline")}},sc.prototype=new Em;var qm=sc,Dm=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Im=Dm,t0=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Rm=t0,_u=i,xu=Zt,ku=ln,Tu=Qt,Fs=Kt,$a=bm,ul=zn,n0=Yd,Om=ic.H264Stream,i0=qm,Fm=Su.isLikelyAacData,Nm=zn.ONE_SECOND_IN_TS,Kr=Im,ac=Rm,oc,yo,Au,vo,R2=function(_,R){R.stream=_,this.trigger("log",R)},ts=function(_,R){var F=Object.keys(R);for(var P=0;P<F.length;P++){var K=F[P];if(K==="headOfPipeline"||!R[K].on)continue;R[K].on("log",R2.bind(_,K))}},s0=function(_,R){var F;if(_.length!==R.length)return!1;for(F=0;F<_.length;F++)if(_[F]!==R[F])return!1;return!0},Hh=function(_,R,F,P,K,ee){var le=F-R,we=P-R,Se=K-F;return{start:{dts:_,pts:_+le},end:{dts:_+we,pts:_+Se},prependedContentDuration:ee,baseMediaDecodeTime:_}};yo=function(_,R){var F=[],P,K=0,ee=0,le=1/0;R=R||{},P=R.firstSequenceNumber||0,yo.prototype.init.call(this),this.push=function(we){if(Fs.collectDtsInfo(_,we),_)Kr.forEach(function(Se){_[Se]=we[Se]});F.push(we)},this.setEarliestDts=function(we){K=we},this.setVideoBaseMediaDecodeTime=function(we){le=we},this.setAudioAppendStart=function(we){ee=we},this.flush=function(){var we,Se,ke,Be,it,Ft,pt;if(F.length===0){this.trigger("done","AudioSegmentStream");return}if(we=Tu.trimAdtsFramesByEarliestDts(F,_,K),_.baseMediaDecodeTime=Fs.calculateTrackBaseMediaDecodeTime(_,R.keepOriginalTimestamps),pt=Tu.prefixWithSilence(_,we,ee,le),_.samples=Tu.generateSampleTable(we),ke=xu.mdat(Tu.concatenateFrameData(we)),F=[],Se=xu.moof(P,[_]),Be=new Uint8Array(Se.byteLength+ke.byteLength),P++,Be.set(Se),Be.set(ke,Se.byteLength),Fs.clearDtsInfo(_),it=Math.ceil(Nm*1024/_.samplerate),we.length)Ft=we.length*it,this.trigger("segmentTimingInfo",Hh(ul.audioTsToVideoTs(_.baseMediaDecodeTime,_.samplerate),we[0].dts,we[0].pts,we[0].dts+Ft,we[0].pts+Ft,pt||0)),this.trigger("timingInfo",{start:we[0].pts,end:we[0].pts+Ft});this.trigger("data",{track:_,boxes:Be}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Fs.clearDtsInfo(_),F=[],this.trigger("reset")}},yo.prototype=new _u,oc=function(_,R){var F,P=[],K=[],ee,le;R=R||{},F=R.firstSequenceNumber||0,oc.prototype.init.call(this),delete _.minPTS,this.gopCache_=[],this.push=function(we){if(Fs.collectDtsInfo(_,we),we.nalUnitType==="seq_parameter_set_rbsp"&&!ee)ee=we.config,_.sps=[we.data],ac.forEach(function(Se){_[Se]=ee[Se]},this);if(we.nalUnitType==="pic_parameter_set_rbsp"&&!le)le=we.data,_.pps=[we.data];P.push(we)},this.flush=function(){var we,Se,ke,Be,it,Ft,pt=0,Vt,rn;while(P.length){if(P[0].nalUnitType==="access_unit_delimiter_rbsp")break;P.shift()}if(P.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(we=ku.groupNalsIntoFrames(P),ke=ku.groupFramesIntoGops(we),!ke[0][0].keyFrame)if(Se=this.getGopForFusion_(P[0],_),Se)pt=Se.duration,ke.unshift(Se),ke.byteLength+=Se.byteLength,ke.nalCount+=Se.nalCount,ke.pts=Se.pts,ke.dts=Se.dts,ke.duration+=Se.duration;else ke=ku.extendFirstKeyFrame(ke);if(K.length){var Qi;if(R.alignGopsAtEnd)Qi=this.alignGopsAtEnd_(ke);else Qi=this.alignGopsAtStart_(ke);if(!Qi){this.gopCache_.unshift({gop:ke.pop(),pps:_.pps,sps:_.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),P=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Fs.clearDtsInfo(_),ke=Qi}Fs.collectDtsInfo(_,ke),_.samples=ku.generateSampleTable(ke),it=xu.mdat(ku.concatenateNalData(ke)),_.baseMediaDecodeTime=Fs.calculateTrackBaseMediaDecodeTime(_,R.keepOriginalTimestamps),this.trigger("processedGopsInfo",ke.map(function(Ps){return{pts:Ps.pts,dts:Ps.dts,byteLength:Ps.byteLength}})),Vt=ke[0],rn=ke[ke.length-1],this.trigger("segmentTimingInfo",Hh(_.baseMediaDecodeTime,Vt.dts,Vt.pts,rn.dts+rn.duration,rn.pts+rn.duration,pt)),this.trigger("timingInfo",{start:ke[0].pts,end:ke[ke.length-1].pts+ke[ke.length-1].duration}),this.gopCache_.unshift({gop:ke.pop(),pps:_.pps,sps:_.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),P=[],this.trigger("baseMediaDecodeTime",_.baseMediaDecodeTime),this.trigger("timelineStartInfo",_.timelineStartInfo),Be=xu.moof(F,[_]),Ft=new Uint8Array(Be.byteLength+it.byteLength),F++,Ft.set(Be),Ft.set(it,Be.byteLength),this.trigger("data",{track:_,boxes:Ft}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),P=[],this.gopCache_.length=0,K.length=0,this.trigger("reset")},this.resetStream_=function(){Fs.clearDtsInfo(_),ee=void 0,le=void 0},this.getGopForFusion_=function(we){var Se=45000,ke=1e4,Be=1/0,it,Ft,pt,Vt,rn;for(rn=0;rn<this.gopCache_.length;rn++){if(Vt=this.gopCache_[rn],pt=Vt.gop,!(_.pps&&s0(_.pps[0],Vt.pps[0]))||!(_.sps&&s0(_.sps[0],Vt.sps[0])))continue;if(pt.dts<_.timelineStartInfo.dts)continue;if(it=we.dts-pt.dts-pt.duration,it>=-ke&&it<=Se){if(!Ft||Be>it)Ft=Vt,Be=it}}if(Ft)return Ft.gop;return null},this.alignGopsAtStart_=function(we){var Se,ke,Be,it,Ft,pt,Vt,rn;Ft=we.byteLength,pt=we.nalCount,Vt=we.duration,Se=ke=0;while(Se<K.length&&ke<we.length){if(Be=K[Se],it=we[ke],Be.pts===it.pts)break;if(it.pts>Be.pts){Se++;continue}ke++,Ft-=it.byteLength,pt-=it.nalCount,Vt-=it.duration}if(ke===0)return we;if(ke===we.length)return null;return rn=we.slice(ke),rn.byteLength=Ft,rn.duration=Vt,rn.nalCount=pt,rn.pts=rn[0].pts,rn.dts=rn[0].dts,rn},this.alignGopsAtEnd_=function(we){var Se,ke,Be,it,Ft,pt;Se=K.length-1,ke=we.length-1,Ft=null,pt=!1;while(Se>=0&&ke>=0){if(Be=K[Se],it=we[ke],Be.pts===it.pts){pt=!0;break}if(Be.pts>it.pts){Se--;continue}if(Se===K.length-1)Ft=ke;ke--}if(!pt&&Ft===null)return null;var Vt;if(pt)Vt=ke;else Vt=Ft;if(Vt===0)return we;var rn=we.slice(Vt),Qi=rn.reduce(function(Ps,xo){return Ps.byteLength+=xo.byteLength,Ps.duration+=xo.duration,Ps.nalCount+=xo.nalCount,Ps},{byteLength:0,duration:0,nalCount:0});return rn.byteLength=Qi.byteLength,rn.duration=Qi.duration,rn.nalCount=Qi.nalCount,rn.pts=rn[0].pts,rn.dts=rn[0].dts,rn},this.alignGopsWith=function(we){K=we}},oc.prototype=new _u,vo=function(_,R){if(this.numberOfTracks=0,this.metadataStream=R,_=_||{},typeof _.remux<"u")this.remuxTracks=!!_.remux;else this.remuxTracks=!0;if(typeof _.keepOriginalTimestamps==="boolean")this.keepOriginalTimestamps=_.keepOriginalTimestamps;else this.keepOriginalTimestamps=!1;this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,vo.prototype.init.call(this),this.push=function(F){if(F.content||F.text)return this.pendingCaptions.push(F);if(F.frames)return this.pendingMetadata.push(F);if(this.pendingTracks.push(F.track),this.pendingBytes+=F.boxes.byteLength,F.track.type==="video")this.videoTrack=F.track,this.pendingBoxes.push(F.boxes);if(F.track.type==="audio")this.audioTrack=F.track,this.pendingBoxes.unshift(F.boxes)}},vo.prototype=new _u,vo.prototype.flush=function(_){var R=0,F={captions:[],captionStreams:{},metadata:[],info:{}},P,K,ee,le=0,we;if(this.pendingTracks.length<this.numberOfTracks){if(_!=="VideoSegmentStream"&&_!=="AudioSegmentStream")return;else if(this.remuxTracks)return;else if(this.pendingTracks.length===0){if(this.emittedTracks++,this.emittedTracks>=this.numberOfTracks)this.trigger("done"),this.emittedTracks=0;return}}if(this.videoTrack)le=this.videoTrack.timelineStartInfo.pts,ac.forEach(function(Se){F.info[Se]=this.videoTrack[Se]},this);else if(this.audioTrack)le=this.audioTrack.timelineStartInfo.pts,Kr.forEach(function(Se){F.info[Se]=this.audioTrack[Se]},this);if(this.videoTrack||this.audioTrack){if(this.pendingTracks.length===1)F.type=this.pendingTracks[0].type;else F.type="combined";this.emittedTracks+=this.pendingTracks.length,ee=xu.initSegment(this.pendingTracks),F.initSegment=new Uint8Array(ee.byteLength),F.initSegment.set(ee),F.data=new Uint8Array(this.pendingBytes);for(we=0;we<this.pendingBoxes.length;we++)F.data.set(this.pendingBoxes[we],R),R+=this.pendingBoxes[we].byteLength;for(we=0;we<this.pendingCaptions.length;we++)P=this.pendingCaptions[we],P.startTime=ul.metadataTsToSeconds(P.startPts,le,this.keepOriginalTimestamps),P.endTime=ul.metadataTsToSeconds(P.endPts,le,this.keepOriginalTimestamps),F.captionStreams[P.stream]=!0,F.captions.push(P);for(we=0;we<this.pendingMetadata.length;we++)K=this.pendingMetadata[we],K.cueTime=ul.metadataTsToSeconds(K.pts,le,this.keepOriginalTimestamps),F.metadata.push(K);F.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",F);for(we=0;we<F.captions.length;we++)P=F.captions[we],this.trigger("caption",P);for(we=0;we<F.metadata.length;we++)K=F.metadata[we],this.trigger("id3Frame",K)}if(this.emittedTracks>=this.numberOfTracks)this.trigger("done"),this.emittedTracks=0},vo.prototype.setRemux=function(_){this.remuxTracks=_},Au=function(_){var R=this,F=!0,P,K;Au.prototype.init.call(this),_=_||{},this.baseMediaDecodeTime=_.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var ee={};this.transmuxPipeline_=ee,ee.type="aac",ee.metadataStream=new $a.MetadataStream,ee.aacStream=new i0,ee.audioTimestampRolloverStream=new $a.TimestampRolloverStream("audio"),ee.timedMetadataTimestampRolloverStream=new $a.TimestampRolloverStream("timed-metadata"),ee.adtsStream=new n0,ee.coalesceStream=new vo(_,ee.metadataStream),ee.headOfPipeline=ee.aacStream,ee.aacStream.pipe(ee.audioTimestampRolloverStream).pipe(ee.adtsStream),ee.aacStream.pipe(ee.timedMetadataTimestampRolloverStream).pipe(ee.metadataStream).pipe(ee.coalesceStream),ee.metadataStream.on("timestamp",function(le){ee.aacStream.setTimestamp(le.timeStamp)}),ee.aacStream.on("data",function(le){if(le.type!=="timed-metadata"&&le.type!=="audio"||ee.audioSegmentStream)return;K=K||{timelineStartInfo:{baseMediaDecodeTime:R.baseMediaDecodeTime},codec:"adts",type:"audio"},ee.coalesceStream.numberOfTracks++,ee.audioSegmentStream=new yo(K,_),ee.audioSegmentStream.on("log",R.getLogTrigger_("audioSegmentStream")),ee.audioSegmentStream.on("timingInfo",R.trigger.bind(R,"audioTimingInfo")),ee.adtsStream.pipe(ee.audioSegmentStream).pipe(ee.coalesceStream),R.trigger("trackinfo",{hasAudio:!!K,hasVideo:!!P})}),ee.coalesceStream.on("data",this.trigger.bind(this,"data")),ee.coalesceStream.on("done",this.trigger.bind(this,"done")),ts(this,ee)},this.setupTsPipeline=function(){var ee={};this.transmuxPipeline_=ee,ee.type="ts",ee.metadataStream=new $a.MetadataStream,ee.packetStream=new $a.TransportPacketStream,ee.parseStream=new $a.TransportParseStream,ee.elementaryStream=new $a.ElementaryStream,ee.timestampRolloverStream=new $a.TimestampRolloverStream,ee.adtsStream=new n0,ee.h264Stream=new Om,ee.captionStream=new $a.CaptionStream(_),ee.coalesceStream=new vo(_,ee.metadataStream),ee.headOfPipeline=ee.packetStream,ee.packetStream.pipe(ee.parseStream).pipe(ee.elementaryStream).pipe(ee.timestampRolloverStream),ee.timestampRolloverStream.pipe(ee.h264Stream),ee.timestampRolloverStream.pipe(ee.adtsStream),ee.timestampRolloverStream.pipe(ee.metadataStream).pipe(ee.coalesceStream),ee.h264Stream.pipe(ee.captionStream).pipe(ee.coalesceStream),ee.elementaryStream.on("data",function(le){var we;if(le.type==="metadata"){we=le.tracks.length;while(we--)if(!P&&le.tracks[we].type==="video")P=le.tracks[we],P.timelineStartInfo.baseMediaDecodeTime=R.baseMediaDecodeTime;else if(!K&&le.tracks[we].type==="audio")K=le.tracks[we],K.timelineStartInfo.baseMediaDecodeTime=R.baseMediaDecodeTime;if(P&&!ee.videoSegmentStream)ee.coalesceStream.numberOfTracks++,ee.videoSegmentStream=new oc(P,_),ee.videoSegmentStream.on("log",R.getLogTrigger_("videoSegmentStream")),ee.videoSegmentStream.on("timelineStartInfo",function(Se){if(K&&!_.keepOriginalTimestamps)K.timelineStartInfo=Se,ee.audioSegmentStream.setEarliestDts(Se.dts-R.baseMediaDecodeTime)}),ee.videoSegmentStream.on("processedGopsInfo",R.trigger.bind(R,"gopInfo")),ee.videoSegmentStream.on("segmentTimingInfo",R.trigger.bind(R,"videoSegmentTimingInfo")),ee.videoSegmentStream.on("baseMediaDecodeTime",function(Se){if(K)ee.audioSegmentStream.setVideoBaseMediaDecodeTime(Se)}),ee.videoSegmentStream.on("timingInfo",R.trigger.bind(R,"videoTimingInfo")),ee.h264Stream.pipe(ee.videoSegmentStream).pipe(ee.coalesceStream);if(K&&!ee.audioSegmentStream)ee.coalesceStream.numberOfTracks++,ee.audioSegmentStream=new yo(K,_),ee.audioSegmentStream.on("log",R.getLogTrigger_("audioSegmentStream")),ee.audioSegmentStream.on("timingInfo",R.trigger.bind(R,"audioTimingInfo")),ee.audioSegmentStream.on("segmentTimingInfo",R.trigger.bind(R,"audioSegmentTimingInfo")),ee.adtsStream.pipe(ee.audioSegmentStream).pipe(ee.coalesceStream);R.trigger("trackinfo",{hasAudio:!!K,hasVideo:!!P})}}),ee.coalesceStream.on("data",this.trigger.bind(this,"data")),ee.coalesceStream.on("id3Frame",function(le){le.dispatchType=ee.metadataStream.dispatchType,R.trigger("id3Frame",le)}),ee.coalesceStream.on("caption",this.trigger.bind(this,"caption")),ee.coalesceStream.on("done",this.trigger.bind(this,"done")),ts(this,ee)},this.setBaseMediaDecodeTime=function(ee){var le=this.transmuxPipeline_;if(!_.keepOriginalTimestamps)this.baseMediaDecodeTime=ee;if(K){if(K.timelineStartInfo.dts=void 0,K.timelineStartInfo.pts=void 0,Fs.clearDtsInfo(K),le.audioTimestampRolloverStream)le.audioTimestampRolloverStream.discontinuity()}if(P){if(le.videoSegmentStream)le.videoSegmentStream.gopCache_=[];P.timelineStartInfo.dts=void 0,P.timelineStartInfo.pts=void 0,Fs.clearDtsInfo(P),le.captionStream.reset()}if(le.timestampRolloverStream)le.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(ee){if(K)this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(ee)},this.setRemux=function(ee){var le=this.transmuxPipeline_;if(_.remux=ee,le&&le.coalesceStream)le.coalesceStream.setRemux(ee)},this.alignGopsWith=function(ee){if(P&&this.transmuxPipeline_.videoSegmentStream)this.transmuxPipeline_.videoSegmentStream.alignGopsWith(ee)},this.getLogTrigger_=function(ee){var le=this;return function(we){we.stream=ee,le.trigger("log",we)}},this.push=function(ee){if(F){var le=Fm(ee);if(le&&this.transmuxPipeline_.type!=="aac")this.setupAacPipeline();else if(!le&&this.transmuxPipeline_.type!=="ts")this.setupTsPipeline();F=!1}this.transmuxPipeline_.headOfPipeline.push(ee)},this.flush=function(){F=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){if(this.transmuxPipeline_.headOfPipeline)this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream)this.transmuxPipeline_.captionStream.reset()}},Au.prototype=new _u;var Pm={Transmuxer:Au,VideoSegmentStream:oc,AudioSegmentStream:yo,AUDIO_PROPERTIES:Kr,VIDEO_PROPERTIES:ac,generateSegmentTimingInfo:Hh},Bm=function(_){return _>>>0},Cu=function(_){return("00"+_.toString(16)).slice(-2)},ju={toUnsigned:Bm,toHexString:Cu},Uh=function(_){var R="";return R+=String.fromCharCode(_[0]),R+=String.fromCharCode(_[1]),R+=String.fromCharCode(_[2]),R+=String.fromCharCode(_[3]),R},zh=Uh,O2=ju.toUnsigned,Gh=zh,Vh=function(_,R){var F=[],P,K,ee,le,we;if(!R.length)return null;for(P=0;P<_.byteLength;){if(K=O2(_[P]<<24|_[P+1]<<16|_[P+2]<<8|_[P+3]),ee=Gh(_.subarray(P+4,P+8)),le=K>1?P+K:_.byteLength,ee===R[0]){if(R.length===1)F.push(_.subarray(P+8,le));else if(we=Vh(_.subarray(P+8,le),R.slice(1)),we.length)F=F.concat(we)}P=le}return F},Eu=Vh,Lm=ju.toUnsigned,Hm=r.getUint64,r0=function(_){var R={version:_[0],flags:new Uint8Array(_.subarray(1,4))};if(R.version===1)R.baseMediaDecodeTime=Hm(_.subarray(4));else R.baseMediaDecodeTime=Lm(_[4]<<24|_[5]<<16|_[6]<<8|_[7]);return R},qu=r0,Um=function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),trackId:R.getUint32(4)},P=F.flags[2]&1,K=F.flags[2]&2,ee=F.flags[2]&8,le=F.flags[2]&16,we=F.flags[2]&32,Se=F.flags[0]&65536,ke=F.flags[0]&131072,Be;if(Be=8,P)Be+=4,F.baseDataOffset=R.getUint32(12),Be+=4;if(K)F.sampleDescriptionIndex=R.getUint32(Be),Be+=4;if(ee)F.defaultSampleDuration=R.getUint32(Be),Be+=4;if(le)F.defaultSampleSize=R.getUint32(Be),Be+=4;if(we)F.defaultSampleFlags=R.getUint32(Be);if(Se)F.durationIsEmpty=!0;if(!P&&ke)F.baseDataOffsetIsMoof=!0;return F},Du=Um,Iu=r.getUint64,o0=function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),references:[],referenceId:R.getUint32(4),timescale:R.getUint32(8)},P=12;if(F.version===0)F.earliestPresentationTime=R.getUint32(P),F.firstOffset=R.getUint32(P+4),P+=8;else F.earliestPresentationTime=Iu(_.subarray(P)),F.firstOffset=Iu(_.subarray(P+8)),P+=16;P+=2;var K=R.getUint16(P);P+=2;for(;K>0;P+=12,K--)F.references.push({referenceType:(_[P]&128)>>>7,referencedSize:R.getUint32(P)&2147483647,subsegmentDuration:R.getUint32(P+4),startsWithSap:!!(_[P+8]&128),sapType:(_[P+8]&112)>>>4,sapDeltaTime:R.getUint32(P+8)&268435455});return F},zm=o0,l0=function(_){return{isLeading:(_[0]&12)>>>2,dependsOn:_[0]&3,isDependedOn:(_[1]&192)>>>6,hasRedundancy:(_[1]&48)>>>4,paddingValue:(_[1]&14)>>>1,isNonSyncSample:_[1]&1,degradationPriority:_[2]<<8|_[3]}},Gm=l0,wr=Gm,h0=function(_){var R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),samples:[]},F=new DataView(_.buffer,_.byteOffset,_.byteLength),P=R.flags[2]&1,K=R.flags[2]&4,ee=R.flags[1]&1,le=R.flags[1]&2,we=R.flags[1]&4,Se=R.flags[1]&8,ke=F.getUint32(4),Be=8,it;if(P)R.dataOffset=F.getInt32(Be),Be+=4;if(K&&ke){if(it={flags:wr(_.subarray(Be,Be+4))},Be+=4,ee)it.duration=F.getUint32(Be),Be+=4;if(le)it.size=F.getUint32(Be),Be+=4;if(Se){if(R.version===1)it.compositionTimeOffset=F.getInt32(Be);else it.compositionTimeOffset=F.getUint32(Be);Be+=4}R.samples.push(it),ke--}while(ke--){if(it={},ee)it.duration=F.getUint32(Be),Be+=4;if(le)it.size=F.getUint32(Be),Be+=4;if(we)it.flags=wr(_.subarray(Be,Be+4)),Be+=4;if(Se){if(R.version===1)it.compositionTimeOffset=F.getInt32(Be);else it.compositionTimeOffset=F.getUint32(Be);Be+=4}R.samples.push(it)}return R},Vm=h0,Xm=r,Aa=Xm.getUint64,Yi,Xh,Ys=function(_){return new Date(_*1000-2082844800000)},lc=zh,Wm=Eu,f0=function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=[],P,K;for(P=0;P+4<_.length;P+=K){if(K=R.getUint32(P),P+=4,K<=0){F.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(_[P]&31){case 1:F.push("slice_layer_without_partitioning_rbsp");break;case 5:F.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:F.push("sei_rbsp");break;case 7:F.push("seq_parameter_set_rbsp");break;case 8:F.push("pic_parameter_set_rbsp");break;case 9:F.push("access_unit_delimiter_rbsp");break;default:F.push("UNKNOWN NAL - "+_[P]&31);break}}return F},yr={avc1:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength);return{dataReferenceIndex:R.getUint16(6),width:R.getUint16(24),height:R.getUint16(26),horizresolution:R.getUint16(28)+R.getUint16(30)/16,vertresolution:R.getUint16(32)+R.getUint16(34)/16,frameCount:R.getUint16(40),depth:R.getUint16(74),config:Yi(_.subarray(78,_.byteLength))}},avcC:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={configurationVersion:_[0],avcProfileIndication:_[1],profileCompatibility:_[2],avcLevelIndication:_[3],lengthSizeMinusOne:_[4]&3,sps:[],pps:[]},P=_[5]&31,K,ee,le,we;le=6;for(we=0;we<P;we++)ee=R.getUint16(le),le+=2,F.sps.push(new Uint8Array(_.subarray(le,le+ee))),le+=ee;K=_[le],le++;for(we=0;we<K;we++)ee=R.getUint16(le),le+=2,F.pps.push(new Uint8Array(_.subarray(le,le+ee))),le+=ee;return F},btrt:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength);return{bufferSizeDB:R.getUint32(0),maxBitrate:R.getUint32(4),avgBitrate:R.getUint32(8)}},edts:function(R){return{boxes:Yi(R)}},elst:function(R){var F=new DataView(R.buffer,R.byteOffset,R.byteLength),P={version:F.getUint8(0),flags:new Uint8Array(R.subarray(1,4)),edits:[]},K=F.getUint32(4),ee;for(ee=8;K;K--)if(P.version===0)P.edits.push({segmentDuration:F.getUint32(ee),mediaTime:F.getInt32(ee+4),mediaRate:F.getUint16(ee+8)+F.getUint16(ee+10)/65536}),ee+=12;else P.edits.push({segmentDuration:Aa(R.subarray(ee)),mediaTime:Aa(R.subarray(ee+8)),mediaRate:F.getUint16(ee+16)+F.getUint16(ee+18)/65536}),ee+=20;return P},esds:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),esId:_[6]<<8|_[7],streamPriority:_[8]&31,decoderConfig:{objectProfileIndication:_[11],streamType:_[12]>>>2&63,bufferSize:_[13]<<16|_[14]<<8|_[15],maxBitrate:_[16]<<24|_[17]<<16|_[18]<<8|_[19],avgBitrate:_[20]<<24|_[21]<<16|_[22]<<8|_[23],decoderConfigDescriptor:{tag:_[24],length:_[25],audioObjectType:_[26]>>>3&31,samplingFrequencyIndex:(_[26]&7)<<1|_[27]>>>7&1,channelConfiguration:_[27]>>>3&15}}}},ftyp:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={majorBrand:lc(_.subarray(0,4)),minorVersion:R.getUint32(4),compatibleBrands:[]},P=8;while(P<_.byteLength)F.compatibleBrands.push(lc(_.subarray(P,P+4))),P+=4;return F},dinf:function(_){return{boxes:Yi(_)}},dref:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),dataReferences:Yi(_.subarray(8))}},hdlr:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),handlerType:lc(_.subarray(8,12)),name:""},P=8;for(P=24;P<_.byteLength;P++){if(_[P]===0){P++;break}F.name+=String.fromCharCode(_[P])}return F.name=decodeURIComponent(escape(F.name)),F},mdat:function(_){return{byteLength:_.byteLength,nals:f0(_)}},mdhd:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=4,P,K={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),language:""};if(K.version===1)F+=4,K.creationTime=Ys(R.getUint32(F)),F+=8,K.modificationTime=Ys(R.getUint32(F)),F+=4,K.timescale=R.getUint32(F),F+=8,K.duration=R.getUint32(F);else K.creationTime=Ys(R.getUint32(F)),F+=4,K.modificationTime=Ys(R.getUint32(F)),F+=4,K.timescale=R.getUint32(F),F+=4,K.duration=R.getUint32(F);return F+=4,P=R.getUint16(F),K.language+=String.fromCharCode((P>>10)+96),K.language+=String.fromCharCode(((P&992)>>5)+96),K.language+=String.fromCharCode((P&31)+96),K},mdia:function(_){return{boxes:Yi(_)}},mfhd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),sequenceNumber:_[4]<<24|_[5]<<16|_[6]<<8|_[7]}},minf:function(_){return{boxes:Yi(_)}},mp4a:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={dataReferenceIndex:R.getUint16(6),channelcount:R.getUint16(16),samplesize:R.getUint16(18),samplerate:R.getUint16(24)+R.getUint16(26)/65536};if(_.byteLength>28)F.streamDescriptor=Yi(_.subarray(28))[0];return F},moof:function(_){return{boxes:Yi(_)}},moov:function(_){return{boxes:Yi(_)}},mvex:function(_){return{boxes:Yi(_)}},mvhd:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=4,P={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4))};if(P.version===1)F+=4,P.creationTime=Ys(R.getUint32(F)),F+=8,P.modificationTime=Ys(R.getUint32(F)),F+=4,P.timescale=R.getUint32(F),F+=8,P.duration=R.getUint32(F);else P.creationTime=Ys(R.getUint32(F)),F+=4,P.modificationTime=Ys(R.getUint32(F)),F+=4,P.timescale=R.getUint32(F),F+=4,P.duration=R.getUint32(F);return F+=4,P.rate=R.getUint16(F)+R.getUint16(F+2)/16,F+=4,P.volume=R.getUint8(F)+R.getUint8(F+1)/8,F+=2,F+=2,F+=8,P.matrix=new Uint32Array(_.subarray(F,F+36)),F+=36,F+=24,P.nextTrackId=R.getUint32(F),P},pdin:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),rate:R.getUint32(4),initialDelay:R.getUint32(8)}},sdtp:function(_){var R={version:_[0],flags:new Uint8Array(_.subarray(1,4)),samples:[]},F;for(F=4;F<_.byteLength;F++)R.samples.push({dependsOn:(_[F]&48)>>4,isDependedOn:(_[F]&12)>>2,hasRedundancy:_[F]&3});return R},sidx:zm,smhd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),balance:_[4]+_[5]/256}},stbl:function(_){return{boxes:Yi(_)}},ctts:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),compositionOffsets:[]},P=R.getUint32(4),K;for(K=8;P;K+=8,P--)F.compositionOffsets.push({sampleCount:R.getUint32(K),sampleOffset:R[F.version===0?"getUint32":"getInt32"](K+4)});return F},stss:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4)),syncSamples:[]},P=R.getUint32(4),K;for(K=8;P;K+=4,P--)F.syncSamples.push(R.getUint32(K));return F},stco:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),chunkOffsets:[]},P=R.getUint32(4),K;for(K=8;P;K+=4,P--)F.chunkOffsets.push(R.getUint32(K));return F},stsc:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=R.getUint32(4),P={version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleToChunks:[]},K;for(K=8;F;K+=12,F--)P.sampleToChunks.push({firstChunk:R.getUint32(K),samplesPerChunk:R.getUint32(K+4),sampleDescriptionIndex:R.getUint32(K+8)});return P},stsd:function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleDescriptions:Yi(_.subarray(8))}},stsz:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),sampleSize:R.getUint32(4),entries:[]},P;for(P=12;P<_.byteLength;P+=4)F.entries.push(R.getUint32(P));return F},stts:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F={version:_[0],flags:new Uint8Array(_.subarray(1,4)),timeToSamples:[]},P=R.getUint32(4),K;for(K=8;P;K+=8,P--)F.timeToSamples.push({sampleCount:R.getUint32(K),sampleDelta:R.getUint32(K+4)});return F},styp:function(_){return yr.ftyp(_)},tfdt:qu,tfhd:Du,tkhd:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength),F=4,P={version:R.getUint8(0),flags:new Uint8Array(_.subarray(1,4))};if(P.version===1)F+=4,P.creationTime=Ys(R.getUint32(F)),F+=8,P.modificationTime=Ys(R.getUint32(F)),F+=4,P.trackId=R.getUint32(F),F+=4,F+=8,P.duration=R.getUint32(F);else P.creationTime=Ys(R.getUint32(F)),F+=4,P.modificationTime=Ys(R.getUint32(F)),F+=4,P.trackId=R.getUint32(F),F+=4,F+=4,P.duration=R.getUint32(F);return F+=4,F+=8,P.layer=R.getUint16(F),F+=2,P.alternateGroup=R.getUint16(F),F+=2,P.volume=R.getUint8(F)+R.getUint8(F+1)/8,F+=2,F+=2,P.matrix=new Uint32Array(_.subarray(F,F+36)),F+=36,P.width=R.getUint16(F)+R.getUint16(F+2)/65536,F+=4,P.height=R.getUint16(F)+R.getUint16(F+2)/65536,P},traf:function(_){return{boxes:Yi(_)}},trak:function(_){return{boxes:Yi(_)}},trex:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),trackId:R.getUint32(4),defaultSampleDescriptionIndex:R.getUint32(8),defaultSampleDuration:R.getUint32(12),defaultSampleSize:R.getUint32(16),sampleDependsOn:_[20]&3,sampleIsDependedOn:(_[21]&192)>>6,sampleHasRedundancy:(_[21]&48)>>4,samplePaddingValue:(_[21]&14)>>1,sampleIsDifferenceSample:!!(_[21]&1),sampleDegradationPriority:R.getUint16(22)}},trun:Vm,"url ":function(_){return{version:_[0],flags:new Uint8Array(_.subarray(1,4))}},vmhd:function(_){var R=new DataView(_.buffer,_.byteOffset,_.byteLength);return{version:_[0],flags:new Uint8Array(_.subarray(1,4)),graphicsmode:R.getUint16(4),opcolor:new Uint16Array([R.getUint16(6),R.getUint16(8),R.getUint16(10)])}}};Yi=function(_){var R=0,F=[],P,K,ee,le,we,Se=new ArrayBuffer(_.length),ke=new Uint8Array(Se);for(var Be=0;Be<_.length;++Be)ke[Be]=_[Be];P=new DataView(Se);while(R<_.byteLength)K=P.getUint32(R),ee=lc(_.subarray(R+4,R+8)),le=K>1?R+K:_.byteLength,we=(yr[ee]||function(it){return{data:it}})(_.subarray(R+8,le)),we.size=K,we.type=ee,F.push(we),R=le;return F},Xh=function(_,R){var F;return R=R||0,F=Array(R*2+1).join(" "),_.map(function(P,K){return F+P.type+`
|
|
200
|
+
`+Object.keys(P).filter(function(ee){return ee!=="type"&&ee!=="boxes"}).map(function(ee){var le=F+" "+ee+": ",we=P[ee];if(we instanceof Uint8Array||we instanceof Uint32Array){var Se=Array.prototype.slice.call(new Uint8Array(we.buffer,we.byteOffset,we.byteLength)).map(function(ke){return" "+("00"+ke.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);if(!Se)return le+"<>";if(Se.length===1)return le+"<"+Se.join("").slice(1)+">";return le+`<
|
|
201
|
+
`+Se.map(function(ke){return F+" "+ke}).join(`
|
|
202
|
+
`)+`
|
|
203
|
+
`+F+" >"}return le+JSON.stringify(we,null,2).split(`
|
|
204
|
+
`).map(function(ke,Be){if(Be===0)return ke;return F+" "+ke}).join(`
|
|
205
|
+
`)}).join(`
|
|
206
|
+
`)+(P.boxes?`
|
|
207
|
+
`+Xh(P.boxes,R+1):"")}).join(`
|
|
208
|
+
`)};var d0={inspect:Yi,textify:Xh,parseType:lc,findBox:Wm,parseTraf:yr.traf,parseTfdt:yr.tfdt,parseHdlr:yr.hdlr,parseTfhd:yr.tfhd,parseTrun:yr.trun,parseSidx:yr.sidx},Wh=function(_){var R=0,F=String.fromCharCode(_[R]),P="";while(F!=="\x00")P+=F,R++,F=String.fromCharCode(_[R]);return P+=F,P},Mu={uint8ToCString:Wh},Kn=Mu.uint8ToCString,F2=r.getUint64,N2=function(_){var R=4,F=_[0],P,K,ee,le,we,Se,ke,Be;if(F===0){P=Kn(_.subarray(R)),R+=P.length,K=Kn(_.subarray(R)),R+=K.length;var it=new DataView(_.buffer);ee=it.getUint32(R),R+=4,we=it.getUint32(R),R+=4,Se=it.getUint32(R),R+=4,ke=it.getUint32(R),R+=4}else if(F===1){var it=new DataView(_.buffer);ee=it.getUint32(R),R+=4,le=F2(_.subarray(R)),R+=8,Se=it.getUint32(R),R+=4,ke=it.getUint32(R),R+=4,P=Kn(_.subarray(R)),R+=P.length,K=Kn(_.subarray(R)),R+=K.length}Be=new Uint8Array(_.subarray(R,_.byteLength));var Ft={scheme_id_uri:P,value:K,timescale:ee?ee:1,presentation_time:le,presentation_time_delta:we,event_duration:Se,id:ke,message_data:Be};return Ru(F,Ft)?Ft:void 0},Km=function(_,R,F,P){return _||_===0?_/R:P+F/R},Ru=function(_,R){var F=R.scheme_id_uri!=="\x00",P=_===0&&$r(R.presentation_time_delta)&&F,K=_===1&&$r(R.presentation_time)&&F;return!(_>1)&&P||K},$r=function(_){return _!==void 0||_!==null},$m={parseEmsgBox:N2,scaleTime:Km},cc;if(typeof window<"u")cc=window;else if(typeof e<"u")cc=e;else if(typeof self<"u")cc=self;else cc={};var uc=cc,{toUnsigned:la,toHexString:hc}=ju,wi=Eu,hl=zh,Ou=$m,p0=Du,Kh=Vm,Ym=qu,Qm=r.getUint64,Jm,m0,g0,ja,$h,Yh,b0,w0=uc,Qh=Ss.parseId3Frames;Jm=function(_){var R={},F=wi(_,["moov","trak"]);return F.reduce(function(P,K){var ee,le,we,Se,ke;if(ee=wi(K,["tkhd"])[0],!ee)return null;if(le=ee[0],we=le===0?12:20,Se=la(ee[we]<<24|ee[we+1]<<16|ee[we+2]<<8|ee[we+3]),ke=wi(K,["mdia","mdhd"])[0],!ke)return null;return le=ke[0],we=le===0?12:20,P[Se]=la(ke[we]<<24|ke[we+1]<<16|ke[we+2]<<8|ke[we+3]),P},R)},m0=function(_,R){var F=wi(R,["moof","traf"]),P=F.reduce(function(K,ee){var le=wi(ee,["tfhd"])[0],we=la(le[4]<<24|le[5]<<16|le[6]<<8|le[7]),Se=_[we]||90000,ke=wi(ee,["tfdt"])[0],Be=new DataView(ke.buffer,ke.byteOffset,ke.byteLength),it;if(ke[0]===1)it=Qm(ke.subarray(4,12));else it=Be.getUint32(4);let Ft;if(typeof it==="bigint")Ft=it/w0.BigInt(Se);else if(typeof it==="number"&&!isNaN(it))Ft=it/Se;if(Ft<Number.MAX_SAFE_INTEGER)Ft=Number(Ft);if(Ft<K)K=Ft;return K},1/0);return typeof P==="bigint"||isFinite(P)?P:0},g0=function(_,R){var F=wi(R,["moof","traf"]),P=0,K=0,ee;if(F&&F.length){var le=wi(F[0],["tfhd"])[0],we=wi(F[0],["trun"])[0],Se=wi(F[0],["tfdt"])[0];if(le){var ke=p0(le);ee=ke.trackId}if(Se){var Be=Ym(Se);P=Be.baseMediaDecodeTime}if(we){var it=Kh(we);if(it.samples&&it.samples.length)K=it.samples[0].compositionTimeOffset||0}}var Ft=_[ee]||90000;if(typeof P==="bigint")K=w0.BigInt(K),Ft=w0.BigInt(Ft);var pt=(P+K)/Ft;if(typeof pt==="bigint"&&pt<Number.MAX_SAFE_INTEGER)pt=Number(pt);return pt},ja=function(_){var R=wi(_,["moov","trak"]),F=[];return R.forEach(function(P){var K=wi(P,["mdia","hdlr"]),ee=wi(P,["tkhd"]);K.forEach(function(le,we){var Se=hl(le.subarray(8,12)),ke=ee[we],Be,it,Ft;if(Se==="vide")Be=new DataView(ke.buffer,ke.byteOffset,ke.byteLength),it=Be.getUint8(0),Ft=it===0?Be.getUint32(12):Be.getUint32(20),F.push(Ft)})}),F},Yh=function(_){var R=_[0],F=R===0?12:20;return la(_[F]<<24|_[F+1]<<16|_[F+2]<<8|_[F+3])},$h=function(_){var R=wi(_,["moov","trak"]),F=[];return R.forEach(function(P){var K={},ee=wi(P,["tkhd"])[0],le,we;if(ee)le=new DataView(ee.buffer,ee.byteOffset,ee.byteLength),we=le.getUint8(0),K.id=we===0?le.getUint32(12):le.getUint32(20);var Se=wi(P,["mdia","hdlr"])[0];if(Se){var ke=hl(Se.subarray(8,12));if(ke==="vide")K.type="video";else if(ke==="soun")K.type="audio";else K.type=ke}var Be=wi(P,["mdia","minf","stbl","stsd"])[0];if(Be){var it=Be.subarray(8);K.codec=hl(it.subarray(4,8));var Ft=wi(it,[K.codec])[0],pt,Vt;if(Ft)if(/^[asm]vc[1-9]$/i.test(K.codec))if(pt=Ft.subarray(78),Vt=hl(pt.subarray(4,8)),Vt==="avcC"&&pt.length>11)K.codec+=".",K.codec+=hc(pt[9]),K.codec+=hc(pt[10]),K.codec+=hc(pt[11]);else K.codec="avc1.4d400d";else if(/^mp4[a,v]$/i.test(K.codec))if(pt=Ft.subarray(28),Vt=hl(pt.subarray(4,8)),Vt==="esds"&&pt.length>20&&pt[19]!==0)K.codec+="."+hc(pt[19]),K.codec+="."+hc(pt[20]>>>2&63).replace(/^0/,"");else K.codec="mp4a.40.2";else K.codec=K.codec.toLowerCase()}var rn=wi(P,["mdia","mdhd"])[0];if(rn)K.timescale=Yh(rn);F.push(K)}),F},b0=function(_,R=0){var F=wi(_,["emsg"]);return F.map((P)=>{var K=Ou.parseEmsgBox(new Uint8Array(P)),ee=Qh(K.message_data);return{cueTime:Ou.scaleTime(K.presentation_time,K.timescale,K.presentation_time_delta,R),duration:Ou.scaleTime(K.event_duration,K.timescale),frames:ee}})};var Ui={findBox:wi,parseType:hl,timescale:Jm,startTime:m0,compositionStartTime:g0,videoTrackIds:ja,tracks:$h,getTimescaleFromMediaHeader:Yh,getEmsgID3:b0};let{parseTrun:Zm}=d0,{findBox:_s}=Ui;var y0=uc,Yr=function(_){var R=_s(_,["moof","traf"]),F=_s(_,["mdat"]),P=[];return F.forEach(function(K,ee){var le=R[ee];P.push({mdat:K,traf:le})}),P},fl=function(_,R,F){var P=R,K=F.defaultSampleDuration||0,ee=F.defaultSampleSize||0,le=F.trackId,we=[];return _.forEach(function(Se){var ke=Zm(Se),Be=ke.samples;Be.forEach(function(it){if(it.duration===void 0)it.duration=K;if(it.size===void 0)it.size=ee;if(it.trackId=le,it.dts=P,it.compositionTimeOffset===void 0)it.compositionTimeOffset=0;if(typeof P==="bigint")it.pts=P+y0.BigInt(it.compositionTimeOffset),P+=y0.BigInt(it.duration);else it.pts=P+it.compositionTimeOffset,P+=it.duration}),we=we.concat(Be)}),we},vr={getMdatTrafPairs:Yr,parseSamples:fl},v0=Ld.discardEmulationPreventionBytes,S0=Hd.CaptionStream,ca=Eu,eg=qu,fc=Du,{getMdatTrafPairs:Fu,parseSamples:dl}=vr,tg=function(_,R){var F=_;for(var P=0;P<R.length;P++){var K=R[P];if(F<K.size)return K;F-=K.size}return null},ng=function(_,R,F){var P=new DataView(_.buffer,_.byteOffset,_.byteLength),K={logs:[],seiNals:[]},ee,le,we,Se;for(le=0;le+4<_.length;le+=we){if(we=P.getUint32(le),le+=4,we<=0)continue;switch(_[le]&31){case 6:var ke=_.subarray(le+1,le+1+we),Be=tg(le,R);if(ee={nalUnitType:"sei_rbsp",size:we,data:ke,escapedRBSP:v0(ke),trackId:F},Be)ee.pts=Be.pts,ee.dts=Be.dts,Se=Be;else if(Se)ee.pts=Se.pts,ee.dts=Se.dts;else{K.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+le+" for trackId "+F+". See mux.js#223."});break}K.seiNals.push(ee);break}}return K},Nu=function(_,R){var F={},P=Fu(_);return P.forEach(function(K){var{mdat:ee,traf:le}=K,we=ca(le,["tfhd"]),Se=fc(we[0]),ke=Se.trackId,Be=ca(le,["tfdt"]),it=Be.length>0?eg(Be[0]).baseMediaDecodeTime:0,Ft=ca(le,["trun"]),pt,Vt;if(R===ke&&Ft.length>0){if(pt=dl(Ft,it,Se),Vt=ng(ee,pt,ke),!F[ke])F[ke]={seiNals:[],logs:[]};F[ke].seiNals=F[ke].seiNals.concat(Vt.seiNals),F[ke].logs=F[ke].logs.concat(Vt.logs)}}),F},ig=function(_,R,F){var P;if(R===null)return null;P=Nu(_,R);var K=P[R]||{};return{seiNals:K.seiNals,logs:K.logs,timescale:F}},Jh=function(){var _=!1,R,F,P,K,ee,le;this.isInitialized=function(){return _},this.init=function(we){R=new S0,_=!0,le=we?we.isPartial:!1,R.on("data",function(Se){Se.startTime=Se.startPts/K,Se.endTime=Se.endPts/K,ee.captions.push(Se),ee.captionStreams[Se.stream]=!0}),R.on("log",function(Se){ee.logs.push(Se)})},this.isNewInit=function(we,Se){if(we&&we.length===0||Se&&typeof Se==="object"&&Object.keys(Se).length===0)return!1;return P!==we[0]||K!==Se[P]},this.parse=function(we,Se,ke){var Be;if(!this.isInitialized())return null;else if(!Se||!ke)return null;else if(this.isNewInit(Se,ke))P=Se[0],K=ke[P];else if(P===null||!K)return F.push(we),null;while(F.length>0){var it=F.shift();this.parse(it,Se,ke)}if(Be=ig(we,P,K),Be&&Be.logs)ee.logs=ee.logs.concat(Be.logs);if(Be===null||!Be.seiNals){if(ee.logs.length)return{logs:ee.logs,captions:[],captionStreams:[]};return null}return this.pushNals(Be.seiNals),this.flushStream(),ee},this.pushNals=function(we){if(!this.isInitialized()||!we||we.length===0)return null;we.forEach(function(Se){R.push(Se)})},this.flushStream=function(){if(!this.isInitialized())return null;if(!le)R.flush();else R.partialFlush()},this.clearParsedCaptions=function(){ee.captions=[],ee.captionStreams={},ee.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;R.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){if(F=[],P=null,K=null,!ee)ee={captions:[],captionStreams:{},logs:[]};else this.clearParsedCaptions();this.resetCaptionStream()},this.reset()},sg=Jh;let{parseTfdt:_0}=d0,Sr=Eu,{getTimescaleFromMediaHeader:x0}=Ui,{parseSamples:ag,getMdatTrafPairs:k0}=vr;var T0=function(){let _=90000;this.init=function(R){let F=Sr(R,["moov","trak","mdia","mdhd"])[0];if(F)_=x0(F)},this.parseSegment=function(R){let F=[],P=k0(R),K=0;return P.forEach(function(ee){let{mdat:le,traf:we}=ee,Se=Sr(we,["tfdt"])[0],ke=Sr(we,["tfhd"])[0],Be=Sr(we,["trun"]);if(Se)K=_0(Se).baseMediaDecodeTime;if(Be.length&&ke){let it=ag(Be,K,ke),Ft=0;it.forEach(function(pt){let rn=new TextDecoder("utf-8"),Qi=le.slice(Ft,Ft+pt.size);if(Sr(Qi,["vtte"])[0]){Ft+=pt.size;return}Sr(Qi,["vttc"]).forEach(function(pc){let mc=Sr(pc,["payl"])[0],gc=Sr(pc,["sttg"])[0],bc=pt.pts/_,Uu=(pt.pts+pt.duration)/_,ei,Sn;if(mc)try{ei=rn.decode(mc)}catch(ua){console.error(ua)}if(gc)try{Sn=rn.decode(gc)}catch(ua){console.error(ua)}if(pt.duration&&ei)F.push({cueText:ei,start:bc,end:Uu,settings:Sn})}),Ft+=pt.size})}}),F}},xs=lu,A0=function(_){var R=_[1]&31;return R<<=8,R|=_[2],R},Pu=function(_){return!!(_[1]&64)},Zh=function(_){var R=0;if((_[3]&48)>>>4>1)R+=_[4]+1;return R},So=function(_,R){var F=A0(_);if(F===0)return"pat";else if(F===R)return"pmt";else if(R)return"pes";return null},rg=function(_){var R=Pu(_),F=4+Zh(_);if(R)F+=_[F]+1;return(_[F+10]&31)<<8|_[F+11]},C0=function(_){var R={},F=Pu(_),P=4+Zh(_);if(F)P+=_[P]+1;if(!(_[P+5]&1))return;var K,ee,le;K=(_[P+1]&15)<<8|_[P+2],ee=3+K-4,le=(_[P+10]&15)<<8|_[P+11];var we=12+le;while(we<ee){var Se=P+we;R[(_[Se+1]&31)<<8|_[Se+2]]=_[Se],we+=((_[Se+3]&15)<<8|_[Se+4])+5}return R},dc=function(_,R){var F=A0(_),P=R[F];switch(P){case xs.H264_STREAM_TYPE:return"video";case xs.ADTS_STREAM_TYPE:return"audio";case xs.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},og=function(_){var R=Pu(_);if(!R)return null;var F=4+Zh(_);if(F>=_.byteLength)return null;var P=null,K;if(K=_[F+7],K&192){if(P={},P.pts=(_[F+9]&14)<<27|(_[F+10]&255)<<20|(_[F+11]&254)<<12|(_[F+12]&255)<<5|(_[F+13]&254)>>>3,P.pts*=4,P.pts+=(_[F+13]&6)>>>1,P.dts=P.pts,K&64)P.dts=(_[F+14]&14)<<27|(_[F+15]&255)<<20|(_[F+16]&254)<<12|(_[F+17]&255)<<5|(_[F+18]&254)>>>3,P.dts*=4,P.dts+=(_[F+18]&6)>>>1}return P},ef=function(_){switch(_){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},lg=function(_){var R=4+Zh(_),F=_.subarray(R),P=0,K=0,ee=!1,le;for(;K<F.byteLength-3;K++)if(F[K+2]===1){P=K+5;break}while(P<F.byteLength)switch(F[P]){case 0:if(F[P-1]!==0){P+=2;break}else if(F[P-2]!==0){P++;break}if(K+3!==P-2){if(le=ef(F[K+3]&31),le==="slice_layer_without_partitioning_rbsp_idr")ee=!0}do P++;while(F[P]!==1&&P<F.length);K=P-2,P+=3;break;case 1:if(F[P-1]!==0||F[P-2]!==0){P+=3;break}if(le=ef(F[K+3]&31),le==="slice_layer_without_partitioning_rbsp_idr")ee=!0;K=P-2,P+=3;break;default:P+=3;break}if(F=F.subarray(K),P-=K,K=0,F&&F.byteLength>3){if(le=ef(F[K+3]&31),le==="slice_layer_without_partitioning_rbsp_idr")ee=!0}return ee},cg={parseType:So,parsePat:rg,parsePmt:C0,parsePayloadUnitStartIndicator:Pu,parsePesType:dc,parsePesTime:og,videoPacketContainsKeyFrame:lg},Bu=lu,_o=$s.handleRollover,Xn={};Xn.ts=cg,Xn.aac=Su;var pl=zn.ONE_SECOND_IN_TS,Ns=188,Ya=71,ug=function(_,R){var F=0,P=Ns,K,ee;while(P<_.byteLength){if(_[F]===Ya&&_[P]===Ya){switch(K=_.subarray(F,P),ee=Xn.ts.parseType(K,R.pid),ee){case"pat":R.pid=Xn.ts.parsePat(K);break;case"pmt":var le=Xn.ts.parsePmt(K);R.table=R.table||{},Object.keys(le).forEach(function(we){R.table[we]=le[we]});break}F+=Ns,P+=Ns;continue}F++,P++}},ml=function(_,R,F){var P=0,K=Ns,ee,le,we,Se,ke,Be=!1;while(K<=_.byteLength){if(_[P]===Ya&&(_[K]===Ya||K===_.byteLength)){switch(ee=_.subarray(P,K),le=Xn.ts.parseType(ee,R.pid),le){case"pes":if(we=Xn.ts.parsePesType(ee,R.table),Se=Xn.ts.parsePayloadUnitStartIndicator(ee),we==="audio"&&Se){if(ke=Xn.ts.parsePesTime(ee),ke)ke.type="audio",F.audio.push(ke),Be=!0}break}if(Be)break;P+=Ns,K+=Ns;continue}P++,K++}K=_.byteLength,P=K-Ns,Be=!1;while(P>=0){if(_[P]===Ya&&(_[K]===Ya||K===_.byteLength)){switch(ee=_.subarray(P,K),le=Xn.ts.parseType(ee,R.pid),le){case"pes":if(we=Xn.ts.parsePesType(ee,R.table),Se=Xn.ts.parsePayloadUnitStartIndicator(ee),we==="audio"&&Se){if(ke=Xn.ts.parsePesTime(ee),ke)ke.type="audio",F.audio.push(ke),Be=!0}break}if(Be)break;P-=Ns,K-=Ns;continue}P--,K--}},tf=function(_,R,F){var P=0,K=Ns,ee,le,we,Se,ke,Be,it,Ft,pt=!1,Vt={data:[],size:0};while(K<_.byteLength){if(_[P]===Ya&&_[K]===Ya){switch(ee=_.subarray(P,K),le=Xn.ts.parseType(ee,R.pid),le){case"pes":if(we=Xn.ts.parsePesType(ee,R.table),Se=Xn.ts.parsePayloadUnitStartIndicator(ee),we==="video"){if(Se&&!pt){if(ke=Xn.ts.parsePesTime(ee),ke)ke.type="video",F.video.push(ke),pt=!0}if(!F.firstKeyFrame){if(Se){if(Vt.size!==0){Be=new Uint8Array(Vt.size),it=0;while(Vt.data.length)Ft=Vt.data.shift(),Be.set(Ft,it),it+=Ft.byteLength;if(Xn.ts.videoPacketContainsKeyFrame(Be)){var rn=Xn.ts.parsePesTime(Be);if(rn)F.firstKeyFrame=rn,F.firstKeyFrame.type="video";else console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}Vt.size=0}}Vt.data.push(ee),Vt.size+=ee.byteLength}}break}if(pt&&F.firstKeyFrame)break;P+=Ns,K+=Ns;continue}P++,K++}K=_.byteLength,P=K-Ns,pt=!1;while(P>=0){if(_[P]===Ya&&_[K]===Ya){switch(ee=_.subarray(P,K),le=Xn.ts.parseType(ee,R.pid),le){case"pes":if(we=Xn.ts.parsePesType(ee,R.table),Se=Xn.ts.parsePayloadUnitStartIndicator(ee),we==="video"&&Se){if(ke=Xn.ts.parsePesTime(ee),ke)ke.type="video",F.video.push(ke),pt=!0}break}if(pt)break;P-=Ns,K-=Ns;continue}P--,K--}},hg=function(_,R){if(_.audio&&_.audio.length){var F=R;if(typeof F>"u"||isNaN(F))F=_.audio[0].dts;_.audio.forEach(function(ee){ee.dts=_o(ee.dts,F),ee.pts=_o(ee.pts,F),ee.dtsTime=ee.dts/pl,ee.ptsTime=ee.pts/pl})}if(_.video&&_.video.length){var P=R;if(typeof P>"u"||isNaN(P))P=_.video[0].dts;if(_.video.forEach(function(ee){ee.dts=_o(ee.dts,P),ee.pts=_o(ee.pts,P),ee.dtsTime=ee.dts/pl,ee.ptsTime=ee.pts/pl}),_.firstKeyFrame){var K=_.firstKeyFrame;K.dts=_o(K.dts,P),K.pts=_o(K.pts,P),K.dtsTime=K.dts/pl,K.ptsTime=K.pts/pl}}},fg=function(_){var R=!1,F=0,P=null,K=null,ee=0,le=0,we;while(_.length-le>=3){var Se=Xn.aac.parseType(_,le);switch(Se){case"timed-metadata":if(_.length-le<10){R=!0;break}if(ee=Xn.aac.parseId3TagSize(_,le),ee>_.length){R=!0;break}if(K===null)we=_.subarray(le,le+ee),K=Xn.aac.parseAacTimestamp(we);le+=ee;break;case"audio":if(_.length-le<7){R=!0;break}if(ee=Xn.aac.parseAdtsSize(_,le),ee>_.length){R=!0;break}if(P===null)we=_.subarray(le,le+ee),P=Xn.aac.parseSampleRate(we);F++,le+=ee;break;default:le++;break}if(R)return null}if(P===null||K===null)return null;var ke=pl/P,Be={audio:[{type:"audio",dts:K,pts:K},{type:"audio",dts:K+F*1024*ke,pts:K+F*1024*ke}]};return Be},dg=function(_){var R={pid:null,table:null},F={};ug(_,R);for(var P in R.table)if(R.table.hasOwnProperty(P)){var K=R.table[P];switch(K){case Bu.H264_STREAM_TYPE:if(F.video=[],tf(_,R,F),F.video.length===0)delete F.video;break;case Bu.ADTS_STREAM_TYPE:if(F.audio=[],ml(_,R,F),F.audio.length===0)delete F.audio;break}}return F},pg=function(_,R){var F=Xn.aac.isLikelyAacData(_),P;if(F)P=fg(_);else P=dg(_);if(!P||!P.audio&&!P.video)return null;return hg(P,R),P},mg={inspect:pg,parseAudioPes_:ml};let gg=function(_,R){R.on("data",function(F){let P=F.initSegment;F.initSegment={data:P.buffer,byteOffset:P.byteOffset,byteLength:P.byteLength};let K=F.data;F.data=K.buffer,_.postMessage({action:"data",segment:F,byteOffset:K.byteOffset,byteLength:K.byteLength},[F.data])}),R.on("done",function(F){_.postMessage({action:"done"})}),R.on("gopInfo",function(F){_.postMessage({action:"gopInfo",gopInfo:F})}),R.on("videoSegmentTimingInfo",function(F){let P={start:{decode:zn.videoTsToSeconds(F.start.dts),presentation:zn.videoTsToSeconds(F.start.pts)},end:{decode:zn.videoTsToSeconds(F.end.dts),presentation:zn.videoTsToSeconds(F.end.pts)},baseMediaDecodeTime:zn.videoTsToSeconds(F.baseMediaDecodeTime)};if(F.prependedContentDuration)P.prependedContentDuration=zn.videoTsToSeconds(F.prependedContentDuration);_.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:P})}),R.on("audioSegmentTimingInfo",function(F){let P={start:{decode:zn.videoTsToSeconds(F.start.dts),presentation:zn.videoTsToSeconds(F.start.pts)},end:{decode:zn.videoTsToSeconds(F.end.dts),presentation:zn.videoTsToSeconds(F.end.pts)},baseMediaDecodeTime:zn.videoTsToSeconds(F.baseMediaDecodeTime)};if(F.prependedContentDuration)P.prependedContentDuration=zn.videoTsToSeconds(F.prependedContentDuration);_.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:P})}),R.on("id3Frame",function(F){_.postMessage({action:"id3Frame",id3Frame:F})}),R.on("caption",function(F){_.postMessage({action:"caption",caption:F})}),R.on("trackinfo",function(F){_.postMessage({action:"trackinfo",trackInfo:F})}),R.on("audioTimingInfo",function(F){_.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:zn.videoTsToSeconds(F.start),end:zn.videoTsToSeconds(F.end)}})}),R.on("videoTimingInfo",function(F){_.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:zn.videoTsToSeconds(F.start),end:zn.videoTsToSeconds(F.end)}})}),R.on("log",function(F){_.postMessage({action:"log",log:F})})};class gl{constructor(_,R){this.options=R||{},this.self=_,this.init()}init(){if(this.transmuxer)this.transmuxer.dispose();this.transmuxer=new Pm.Transmuxer(this.options),gg(this.self,this.transmuxer)}pushMp4Captions(_){if(!this.captionParser)this.captionParser=new sg,this.captionParser.init();let R=new Uint8Array(_.data,_.byteOffset,_.byteLength),F=this.captionParser.parse(R,_.trackIds,_.timescales);this.self.postMessage({action:"mp4Captions",captions:F&&F.captions||[],logs:F&&F.logs||[],data:R.buffer},[R.buffer])}initMp4WebVttParser(_){if(!this.webVttParser)this.webVttParser=new T0;let R=new Uint8Array(_.data,_.byteOffset,_.byteLength);this.webVttParser.init(R)}getMp4WebVttText(_){if(!this.webVttParser)this.webVttParser=new T0;let R=new Uint8Array(_.data,_.byteOffset,_.byteLength),F=this.webVttParser.parseSegment(R);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:F||[],data:R.buffer},[R.buffer])}probeMp4StartTime({timescales:_,data:R}){let F=Ui.startTime(_,R);this.self.postMessage({action:"probeMp4StartTime",startTime:F,data:R},[R.buffer])}probeMp4Tracks({data:_}){let R=Ui.tracks(_);this.self.postMessage({action:"probeMp4Tracks",tracks:R,data:_},[_.buffer])}probeEmsgID3({data:_,offset:R}){let F=Ui.getEmsgID3(_,R);this.self.postMessage({action:"probeEmsgID3",id3Frames:F,emsgData:_},[_.buffer])}probeTs({data:_,baseStartTime:R}){let F=typeof R==="number"&&!isNaN(R)?R*zn.ONE_SECOND_IN_TS:void 0,P=mg.inspect(_,F),K=null;if(P){if(K={hasVideo:P.video&&P.video.length===2||!1,hasAudio:P.audio&&P.audio.length===2||!1},K.hasVideo)K.videoStart=P.video[0].ptsTime;if(K.hasAudio)K.audioStart=P.audio[0].ptsTime}this.self.postMessage({action:"probeTs",result:K,data:_},[_.buffer])}clearAllMp4Captions(){if(this.captionParser)this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){if(this.captionParser)this.captionParser.clearParsedCaptions()}push(_){let R=new Uint8Array(_.data,_.byteOffset,_.byteLength);this.transmuxer.push(R)}reset(){this.transmuxer.reset()}setTimestampOffset(_){let R=_.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(zn.secondsToVideoTs(R)))}setAudioAppendStart(_){this.transmuxer.setAudioAppendStart(Math.ceil(zn.secondsToVideoTs(_.appendStart)))}setRemux(_){this.transmuxer.setRemux(_.remux)}flush(_){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(_){this.transmuxer.alignGopsWith(_.gopsToAlignWith.slice())}}self.onmessage=function(_){if(_.data.action==="init"&&_.data.options){this.messageHandlers=new gl(self,_.data.options);return}if(!this.messageHandlers)this.messageHandlers=new gl(self);if(_.data&&_.data.action&&_.data.action!=="init"){if(this.messageHandlers[_.data.action])this.messageHandlers[_.data.action](_.data)}}}));var xR=MS(_R),kR=(e,n,i)=>{let{type:s,initSegment:a,captions:r,captionStreams:l,metadata:c,videoFrameDtsTime:p,videoFramePtsTime:m}=e.data.segment;n.buffer.push({captions:r,captionStreams:l,metadata:c});let g=e.data.segment.boxes||{data:e.data.segment.data},y={type:s,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};if(typeof p<"u")y.videoFrameDtsTime=p;if(typeof m<"u")y.videoFramePtsTime=m;i(y)},TR=({transmuxedData:e,callback:n})=>{e.buffer=[],n(e)},AR=(e,n)=>{n.gopInfo=e.data.gopInfo},FS=(e)=>{let{transmuxer:n,bytes:i,audioAppendStart:s,gopsToAlignWith:a,remux:r,onData:l,onTrackInfo:c,onAudioTimingInfo:p,onVideoTimingInfo:m,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:y,onId3:x,onCaptions:I,onDone:M,onEndedTimeline:H,onTransmuxerLog:X,isEndOfTimeline:W,segment:Y,triggerSegmentEventFn:te}=e,ae={buffer:[]},ne=W,oe=(be)=>{if(n.currentTransmux!==e)return;if(be.data.action==="data")kR(be,ae,l);if(be.data.action==="trackinfo")c(be.data.trackInfo);if(be.data.action==="gopInfo")AR(be,ae);if(be.data.action==="audioTimingInfo")p(be.data.audioTimingInfo);if(be.data.action==="videoTimingInfo")m(be.data.videoTimingInfo);if(be.data.action==="videoSegmentTimingInfo")g(be.data.videoSegmentTimingInfo);if(be.data.action==="audioSegmentTimingInfo")y(be.data.audioSegmentTimingInfo);if(be.data.action==="id3Frame")x([be.data.id3Frame],be.data.id3Frame.dispatchType);if(be.data.action==="caption")I(be.data.caption);if(be.data.action==="endedtimeline")ne=!1,H();if(be.data.action==="log")X(be.data.log);if(be.data.type!=="transmuxed")return;if(ne)return;n.onmessage=null,TR({transmuxedData:ae,callback:M}),NS(n)},me=()=>{let be={message:"Received an error message from the transmuxer worker",metadata:{errorType:$e.Error.StreamingFailedToTransmuxSegment,segmentInfo:oh({segment:Y})}};M(null,be)};if(n.onmessage=oe,n.onerror=me,s)n.postMessage({action:"setAudioAppendStart",appendStart:s});if(Array.isArray(a))n.postMessage({action:"alignGopsWith",gopsToAlignWith:a});if(typeof r<"u")n.postMessage({action:"setRemux",remux:r});if(i.byteLength){let be=i instanceof ArrayBuffer?i:i.buffer,xe=i instanceof ArrayBuffer?0:i.byteOffset;te({type:"segmenttransmuxingstart",segment:Y}),n.postMessage({action:"push",data:be,byteOffset:xe,byteLength:i.byteLength},[be])}if(W)n.postMessage({action:"endTimeline"});n.postMessage({action:"flush"})},NS=(e)=>{if(e.currentTransmux=null,e.transmuxQueue.length)if(e.currentTransmux=e.transmuxQueue.shift(),typeof e.currentTransmux==="function")e.currentTransmux();else FS(e.currentTransmux)},F8=(e,n)=>{e.postMessage({action:n}),NS(e)},PS=(e,n)=>{if(!n.currentTransmux){n.currentTransmux=e,F8(n,e);return}n.transmuxQueue.push(F8.bind(null,n,e))},CR=(e)=>{PS("reset",e)},jR=(e)=>{PS("endTimeline",e)},BS=(e)=>{if(!e.transmuxer.currentTransmux){e.transmuxer.currentTransmux=e,FS(e);return}e.transmuxer.transmuxQueue.push(e)},ER=(e)=>{let n=new xR;n.currentTransmux=null,n.transmuxQueue=[];let i=n.terminate;return n.terminate=()=>(n.currentTransmux=null,n.transmuxQueue.length=0,i.call(n)),n.postMessage({action:"init",options:e}),n},Py={reset:CR,endTimeline:jR,transmux:BS,createTransmuxer:ER},nd=function(e){let n=e.transmuxer,i=e.endAction||e.action,s=e.callback,a=Ri({},e,{endAction:null,transmuxer:null,callback:null}),r=(l)=>{if(l.data.action!==i)return;if(n.removeEventListener("message",r),l.data.data){if(l.data.data=new Uint8Array(l.data.data,e.byteOffset||0,e.byteLength||l.data.data.byteLength),e.data)e.data=l.data.data}s(l.data)};if(n.addEventListener("message",r),e.data){let l=e.data instanceof ArrayBuffer;a.byteOffset=l?0:e.data.byteOffset,a.byteLength=e.data.byteLength;let c=[l?e.data:e.data.buffer];n.postMessage(a,c)}else n.postMessage(a)},Po={FAILURE:2,TIMEOUT:-101,ABORTED:-102},LS="wvtt",r5=(e)=>{e.forEach((n)=>{n.abort()})},qR=(e)=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),DR=(e)=>{let n=e.target,s={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-n.requestTime||0};return s.bytesReceived=e.loaded,s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1000),s},a3=(e,n)=>{let{requestType:i}=n,s=fh({requestType:i,request:n,error:e});if(n.timedout)return{status:n.status,message:"HLS request timed-out at URL: "+n.uri,code:Po.TIMEOUT,xhr:n,metadata:s};if(n.aborted)return{status:n.status,message:"HLS request aborted at URL: "+n.uri,code:Po.ABORTED,xhr:n,metadata:s};if(e)return{status:n.status,message:"HLS request errored at URL: "+n.uri,code:Po.FAILURE,xhr:n,metadata:s};if(n.responseType==="arraybuffer"&&n.response.byteLength===0)return{status:n.status,message:"Empty HLS response at URL: "+n.uri,code:Po.FAILURE,xhr:n,metadata:s};return null},N8=(e,n,i,s)=>(a,r)=>{let l=r.response,c=a3(a,r);if(c)return i(c,e);if(l.byteLength!==16)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Po.FAILURE,xhr:r},e);let p=new DataView(l),m=new Uint32Array([p.getUint32(0),p.getUint32(4),p.getUint32(8),p.getUint32(12)]);for(let y=0;y<n.length;y++)n[y].bytes=m;let g={uri:r.uri};return s({type:"segmentkeyloadcomplete",segment:e,keyInfo:g}),i(null,e)},IR=(e,n)=>{if(n===LS)e.transmuxer.postMessage({action:"initMp4WebVttParser",data:e.map.bytes})},MR=(e,n,i)=>{if(n===LS)nd({action:"getMp4WebVttText",data:e.bytes,transmuxer:e.transmuxer,callback:({data:s,mp4VttCues:a})=>{e.bytes=s,i(null,e,{mp4VttCues:a})}})},HS=(e,n)=>{let i=h1(e.map.bytes);if(i!=="mp4"){let s=e.map.resolvedUri||e.map.uri,a=i||"unknown";return n({internal:!0,message:`Found unsupported ${a} container for initialization segment at URL: ${s}`,code:Po.FAILURE,metadata:{mediaType:a}})}nd({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:s,data:a})=>(e.map.bytes=a,s.forEach(function(r){if(e.map.tracks=e.map.tracks||{},e.map.tracks[r.type])return;if(e.map.tracks[r.type]=r,typeof r.id==="number"&&r.timescale)e.map.timescales=e.map.timescales||{},e.map.timescales[r.id]=r.timescale;if(r.type==="text")IR(e,r.codec)}),n(null))})},RR=({segment:e,finishProcessingFn:n,triggerSegmentEventFn:i})=>(s,a)=>{let r=a3(s,a);if(r)return n(r,e);let l=new Uint8Array(a.response);if(i({type:"segmentloaded",segment:e}),e.map.key)return e.map.encryptedBytes=l,n(null,e);e.map.bytes=l,HS(e,function(c){if(c)return c.xhr=a,c.status=a.status,n(c,e);n(null,e)})},OR=({segment:e,finishProcessingFn:n,responseType:i,triggerSegmentEventFn:s})=>(a,r)=>{let l=a3(a,r);if(l)return n(l,e);s({type:"segmentloaded",segment:e});let c=i==="arraybuffer"||!r.responseText?r.response:vR(r.responseText.substring(e.lastReachedChar||0));if(e.stats=qR(r),e.key)e.encryptedBytes=new Uint8Array(c);else e.bytes=new Uint8Array(c);return n(null,e)},FR=({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})=>{let M=e.map&&e.map.tracks||{},H=Boolean(M.audio&&M.video),X=s.bind(null,e,"audio","start"),W=s.bind(null,e,"audio","end"),Y=s.bind(null,e,"video","start"),te=s.bind(null,e,"video","end"),ae=()=>BS({bytes:n,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:H,onData:(ne)=>{ne.type=ne.type==="combined"?"video":ne.type,g(e,ne)},onTrackInfo:(ne)=>{if(i){if(H)ne.isMuxed=!0;i(e,ne)}},onAudioTimingInfo:(ne)=>{if(X&&typeof ne.start<"u")X(ne.start),X=null;if(W&&typeof ne.end<"u")W(ne.end)},onVideoTimingInfo:(ne)=>{if(Y&&typeof ne.start<"u")Y(ne.start),Y=null;if(te&&typeof ne.end<"u")te(ne.end)},onVideoSegmentTimingInfo:(ne)=>{let oe={pts:{start:ne.start.presentation,end:ne.end.presentation},dts:{start:ne.start.decode,end:ne.end.decode}};I({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:oe}),a(ne)},onAudioSegmentTimingInfo:(ne)=>{let oe={pts:{start:ne.start.pts,end:ne.end.pts},dts:{start:ne.start.dts,end:ne.end.dts}};I({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:oe}),r(ne)},onId3:(ne,oe)=>{l(e,ne,oe)},onCaptions:(ne)=>{c(e,[ne])},isEndOfTimeline:p,onEndedTimeline:()=>{m()},onTransmuxerLog:x,onDone:(ne,oe)=>{if(!y)return;ne.type=ne.type==="combined"?"video":ne.type,I({type:"segmenttransmuxingcomplete",segment:e}),y(oe,e,ne)},segment:e,triggerSegmentEventFn:I});nd({action:"probeTs",transmuxer:e.transmuxer,data:n,baseStartTime:e.baseStartTime,callback:(ne)=>{e.bytes=n=ne.data;let oe=ne.result;if(oe)i(e,{hasAudio:oe.hasAudio,hasVideo:oe.hasVideo,isMuxed:H}),i=null;ae()}})},US=({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})=>{let M=new Uint8Array(n);if(e8(M)){e.isFmp4=!0;let{tracks:H}=e.map;if(H.text&&(!H.audio||!H.video)){g(e,{data:M,type:"text"}),MR(e,H.text.codec,y);return}let W={isFmp4:!0,hasVideo:!!H.video,hasAudio:!!H.audio};if(H.audio&&H.audio.codec&&H.audio.codec!=="enca")W.audioCodec=H.audio.codec;if(H.video&&H.video.codec&&H.video.codec!=="encv")W.videoCodec=H.video.codec;if(H.video&&H.audio)W.isMuxed=!0;i(e,W);let Y=(te,ae)=>{if(g(e,{data:M,type:W.hasAudio&&!W.isMuxed?"audio":"video"}),ae&&ae.length)l(e,ae);if(te&&te.length)c(e,te);y(null,e,{})};nd({action:"probeMp4StartTime",timescales:e.map.timescales,data:M,transmuxer:e.transmuxer,callback:({data:te,startTime:ae})=>{if(n=te.buffer,e.bytes=M=te,W.hasAudio&&!W.isMuxed)s(e,"audio","start",ae);if(W.hasVideo)s(e,"video","start",ae);nd({action:"probeEmsgID3",data:M,transmuxer:e.transmuxer,offset:ae,callback:({emsgData:ne,id3Frames:oe})=>{if(n=ne.buffer,e.bytes=M=ne,!H.video||!ne.byteLength||!e.transmuxer){Y(void 0,oe);return}nd({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:M,timescales:e.map.timescales,trackIds:[H.video.id],callback:(me)=>{n=me.data.buffer,e.bytes=M=me.data,me.logs.forEach(function(be){x(Qn(be,{stream:"mp4CaptionParser"}))}),Y(me.captions,oe)}})}})}});return}if(!e.transmuxer){y(null,e,{});return}if(typeof e.container>"u")e.container=h1(M);if(e.container!=="ts"&&e.container!=="aac"){i(e,{hasAudio:!1,hasVideo:!1}),y(null,e,{});return}FR({segment:e,bytes:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})},zS=function({id:e,key:n,encryptedBytes:i,decryptionWorker:s,segment:a,doneFn:r},l){let c=(m)=>{if(m.data.source===e){s.removeEventListener("message",c);let g=m.data.decrypted;l(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};s.onerror=()=>{let g=oh({segment:a}),y={message:"An error occurred in the decryption worker",metadata:{error:Error("An error occurred in the decryption worker"),errorType:$e.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:a.key.resolvedUri||a.map.key.resolvedUri}}};r(y,a)},s.addEventListener("message",c);let p;if(n.bytes.slice)p=n.bytes.slice();else p=new Uint32Array(Array.prototype.slice.call(n.bytes));s.postMessage(CS({source:e,encrypted:i,key:p,iv:n.iv}),[i.buffer,p.buffer])},NR=({decryptionWorker:e,segment:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})=>{I({type:"segmentdecryptionstart"}),zS({id:n.requestId,key:n.key,encryptedBytes:n.encryptedBytes,decryptionWorker:e,segment:n,doneFn:y},(M)=>{n.bytes=M,I({type:"segmentdecryptioncomplete",segment:n}),US({segment:n,bytes:n.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})})},PR=({activeXhrs:e,decryptionWorker:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})=>{let M=0,H=!1;return(X,W)=>{if(H)return;if(X)return H=!0,r5(e),y(X,W);if(M+=1,M===e.length){let Y=function(){if(W.encryptedBytes)return NR({decryptionWorker:n,segment:W,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I});US({segment:W,bytes:W.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g,doneFn:y,onTransmuxerLog:x,triggerSegmentEventFn:I})};if(W.endOfAllRequests=Date.now(),W.map&&W.map.encryptedBytes&&!W.map.bytes)return I({type:"segmentdecryptionstart",segment:W}),zS({decryptionWorker:n,id:W.requestId+"-init",encryptedBytes:W.map.encryptedBytes,key:W.map.key,segment:W,doneFn:y},(te)=>{W.map.bytes=te,I({type:"segmentdecryptioncomplete",segment:W}),HS(W,(ae)=>{if(ae)return r5(e),y(ae,W);Y()})});Y()}}},BR=({loadendState:e,abortFn:n})=>(i)=>{if(i.target.aborted&&n&&!e.calledAbortFn)n(),e.calledAbortFn=!0},LR=({segment:e,progressFn:n,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:r,id3Fn:l,captionsFn:c,isEndOfTimeline:p,endedTimelineFn:m,dataFn:g})=>(y)=>{if(y.target.aborted)return;if(e.stats=Qn(e.stats,DR(y)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived)e.stats.firstBytesReceivedAt=Date.now();return n(y,e)},HR=({xhr:e,xhrOptions:n,decryptionWorker:i,segment:s,abortFn:a,progressFn:r,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:I,dataFn:M,doneFn:H,onTransmuxerLog:X,triggerSegmentEventFn:W})=>{let Y=[],te=PR({activeXhrs:Y,decryptionWorker:i,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:I,dataFn:M,doneFn:H,onTransmuxerLog:X,triggerSegmentEventFn:W});if(s.key&&!s.key.bytes){let be=[s.key];if(s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri)be.push(s.map.key);let xe=Qn(n,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Oe=N8(s,be,te,W),Fe={uri:s.key.resolvedUri};W({type:"segmentkeyloadstart",segment:s,keyInfo:Fe});let Ue=e(xe,Oe);Y.push(Ue)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){let Ue=Qn(n,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ze=N8(s,[s.map.key],te,W),Le={uri:s.map.key.resolvedUri};W({type:"segmentkeyloadstart",segment:s,keyInfo:Le});let qe=e(Ue,ze);Y.push(qe)}let xe=Qn(n,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:a5(s.map),requestType:"segment-media-initialization"}),Oe=RR({segment:s,finishProcessingFn:te,triggerSegmentEventFn:W});W({type:"segmentloadstart",segment:s});let Fe=e(xe,Oe);Y.push(Fe)}let ae=Qn(n,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:a5(s),requestType:"segment"}),ne=OR({segment:s,finishProcessingFn:te,responseType:ae.responseType,triggerSegmentEventFn:W});W({type:"segmentloadstart",segment:s});let oe=e(ae,ne);oe.addEventListener("progress",LR({segment:s,progressFn:r,trackInfoFn:l,timingInfoFn:c,videoSegmentTimingInfoFn:p,audioSegmentTimingInfoFn:m,id3Fn:g,captionsFn:y,isEndOfTimeline:x,endedTimelineFn:I,dataFn:M})),Y.push(oe);let me={};return Y.forEach((be)=>{be.addEventListener("loadend",BR({loadendState:me,abortFn:a}))}),()=>r5(Y)},m1=Fr("PlaylistSelector"),P8=function(e){if(!e||!e.playlist)return;let n=e.playlist;return JSON.stringify({id:n.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:n.attributes&&n.attributes.CODECS||""})},id=function(e,n){if(!e)return"";let i=je.default.getComputedStyle(e);if(!i)return"";return i[n]},sd=function(e,n){let i=e.slice();e.sort(function(s,a){let r=n(s,a);if(r===0)return i.indexOf(s)-i.indexOf(a);return r})},r3=function(e,n){let i,s;if(e.attributes.BANDWIDTH)i=e.attributes.BANDWIDTH;if(i=i||je.default.Number.MAX_VALUE,n.attributes.BANDWIDTH)s=n.attributes.BANDWIDTH;return s=s||je.default.Number.MAX_VALUE,i-s},UR=function(e,n){let i,s;if(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width)i=e.attributes.RESOLUTION.width;if(i=i||je.default.Number.MAX_VALUE,n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width)s=n.attributes.RESOLUTION.width;if(s=s||je.default.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&n.attributes.BANDWIDTH)return e.attributes.BANDWIDTH-n.attributes.BANDWIDTH;return i-s},GS=function(e){let{main:n,bandwidth:i,playerWidth:s,playerHeight:a,playerObjectFit:r,limitRenditionByPlayerDimensions:l,playlistController:c}=e;if(!n)return;let p={bandwidth:i,width:s,height:a,limitRenditionByPlayerDimensions:l},m=n.playlists;if(Ba.isAudioOnly(n))m=c.getAudioTrackPlaylists_(),p.audioOnly=!0;let g=m.map((me)=>{let be,xe=me.attributes&&me.attributes.RESOLUTION&&me.attributes.RESOLUTION.width,Oe=me.attributes&&me.attributes.RESOLUTION&&me.attributes.RESOLUTION.height;return be=me.attributes&&me.attributes.BANDWIDTH,be=be||je.default.Number.MAX_VALUE,{bandwidth:be,width:xe,height:Oe,playlist:me}});sd(g,(me,be)=>me.bandwidth-be.bandwidth),g=g.filter((me)=>!Ba.isIncompatible(me.playlist));let y=g.filter((me)=>Ba.isEnabled(me.playlist));if(!y.length)y=g.filter((me)=>!Ba.isDisabled(me.playlist));let x=y.filter((me)=>me.bandwidth*Ds.BANDWIDTH_VARIANCE<i),I=x[x.length-1],M=x.filter((me)=>me.bandwidth===I.bandwidth)[0];if(l===!1){let me=M||y[0]||g[0];if(me&&me.playlist){let be="sortedPlaylistReps";if(M)be="bandwidthBestRep";if(y[0])be="enabledPlaylistReps";return m1(`choosing ${P8(me)} using ${be} with options`,p),me.playlist}return m1("could not choose a playlist with options",p),null}let H=x.filter((me)=>me.width&&me.height);sd(H,(me,be)=>me.width-be.width);let X=H.filter((me)=>me.width===s&&me.height===a);I=X[X.length-1];let W=X.filter((me)=>me.bandwidth===I.bandwidth)[0],Y,te,ae;if(!W)Y=H.filter((me)=>{if(r==="cover")return me.width>s&&me.height>a;return me.width>s||me.height>a}),te=Y.filter((me)=>me.width===Y[0].width&&me.height===Y[0].height),I=te[te.length-1],ae=te.filter((me)=>me.bandwidth===I.bandwidth)[0];let ne;if(c.leastPixelDiffSelector){let me=H.map((be)=>(be.pixelDiff=Math.abs(be.width-s)+Math.abs(be.height-a),be));sd(me,(be,xe)=>{if(be.pixelDiff===xe.pixelDiff)return xe.bandwidth-be.bandwidth;return be.pixelDiff-xe.pixelDiff}),ne=me[0]}let oe=ne||ae||W||M||y[0]||g[0];if(oe&&oe.playlist){let me="sortedPlaylistReps";if(ne)me="leastPixelDiffRep";else if(ae)me="resolutionPlusOneRep";else if(W)me="resolutionBestRep";else if(M)me="bandwidthBestRep";else if(y[0])me="enabledPlaylistReps";return m1(`choosing ${P8(oe)} using ${me} with options`,p),oe.playlist}return m1("could not choose a playlist with options",p),null},B8=function(){let e=this.useDevicePixelRatio?je.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))e=this.customPixelRatio;return GS({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(id(this.tech_.el(),"width"),10)*e,playerHeight:parseInt(id(this.tech_.el(),"height"),10)*e,playerObjectFit:this.usePlayerObjectFit?id(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},zR=function(e){let n=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio?je.default.devicePixelRatio||1:1;if(!isNaN(this.customPixelRatio))s=this.customPixelRatio;if(n<0)n=this.systemBandwidth,i=this.systemBandwidth;if(this.systemBandwidth>0&&this.systemBandwidth!==i)n=e*this.systemBandwidth+(1-e)*n,i=this.systemBandwidth;return GS({main:this.playlists.main,bandwidth:n,playerWidth:parseInt(id(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(id(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?id(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},GR=function(e){let{main:n,currentTime:i,bandwidth:s,duration:a,segmentDuration:r,timeUntilRebuffer:l,currentTimeline:c,syncController:p}=e,m=n.playlists.filter((M)=>!Ba.isIncompatible(M)),g=m.filter(Ba.isEnabled);if(!g.length)g=m.filter((M)=>!Ba.isDisabled(M));let x=g.filter(Ba.hasAttribute.bind(null,"BANDWIDTH")).map((M)=>{let X=p.getSyncPoint(M,a,c,i)?1:2,Y=Ba.estimateSegmentRequestTime(r,s,M)*X-l;return{playlist:M,rebufferingImpact:Y}}),I=x.filter((M)=>M.rebufferingImpact<=0);if(sd(I,(M,H)=>r3(H.playlist,M.playlist)),I.length)return I[0];return sd(x,(M,H)=>M.rebufferingImpact-H.rebufferingImpact),x[0]||null},VR=function(){let e=this.playlists.main.playlists.filter(Ba.isEnabled);return sd(e,(i,s)=>r3(i,s)),e.filter((i)=>!!Sp(this.playlists.main,i).video)[0]||null},XR=(e)=>{let n=0,i;if(e.bytes)i=new Uint8Array(e.bytes),e.segments.forEach((s)=>{i.set(s,n),n+=s.byteLength});return i};function VS(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(n){return""}}var WR=function(e,n,i){if(!e[i]){n.trigger({type:"usage",name:"vhs-608"});let s=i;if(/^cc708_/.test(i))s="SERVICE"+i.split("_")[1];let a=n.textTracks().getTrackById(s);if(a)e[i]=a;else{let r=n.options_.vhs&&n.options_.vhs.captionServices||{},l=i,c=i,p=!1,m=r[s];if(m)l=m.label,c=m.language,p=m.default;e[i]=n.addRemoteTextTrack({kind:"captions",id:s,default:p,label:l,language:c},!1).track}}},KR=function({inbandTextTracks:e,captionArray:n,timestampOffset:i}){if(!n)return;let s=je.default.WebKitDataCue||je.default.VTTCue;n.forEach((a)=>{let r=a.stream;if(a.content)a.content.forEach((l)=>{let c=new s(a.startTime+i,a.endTime+i,l.text);c.line=l.line,c.align="left",c.position=l.position,c.positionAlign="line-left",e[r].addCue(c)});else e[r].addCue(new s(a.startTime+i,a.endTime+i,a.text))})},$R=function(e){Object.defineProperties(e.frame,{id:{get(){return $e.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get(){return $e.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get(){return $e.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})},YR=({inbandTextTracks:e,metadataArray:n,timestampOffset:i,videoDuration:s})=>{if(!n)return;let a=je.default.WebKitDataCue||je.default.VTTCue,r=e.metadataTrack_;if(!r)return;if(n.forEach((g)=>{let y=g.cueTime+i;if(typeof y!=="number"||je.default.isNaN(y)||y<0||!(y<1/0))return;if(!g.frames||!g.frames.length)return;g.frames.forEach((x)=>{let I=new a(y,y,x.value||x.url||x.data||"");I.frame=x,I.value=x,$R(I),r.addCue(I)})}),!r.cues||!r.cues.length)return;let l=r.cues,c=[];for(let g=0;g<l.length;g++)if(l[g])c.push(l[g]);let p=c.reduce((g,y)=>{let x=g[y.startTime]||[];return x.push(y),g[y.startTime]=x,g},{}),m=Object.keys(p).sort((g,y)=>Number(g)-Number(y));m.forEach((g,y)=>{let x=p[g],I=isFinite(s)?s:g,M=Number(m[y+1])||I;x.forEach((H)=>{H.endTime=M})})},QR={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},JR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),ZR=({inbandTextTracks:e,dateRanges:n})=>{let i=e.metadataTrack_;if(!i)return;let s=je.default.WebKitDataCue||je.default.VTTCue;n.forEach((a)=>{for(let r of Object.keys(a)){if(JR.has(r))continue;let l=new s(a.startTime,a.endTime,"");if(l.id=a.id,l.type="com.apple.quicktime.HLS",l.value={key:QR[r],data:a[r]},r==="scte35Out"||r==="scte35In")l.value.data=new Uint8Array(l.value.data.match(/[\da-f]{2}/gi)).buffer;i.addCue(l)}a.processDateRange()})},L8=(e,n,i)=>{if(e.metadataTrack_)return;if(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,!$e.browser.IS_ANY_SAFARI)e.metadataTrack_.inBandMetadataTrackDispatchType=n},gp=function(e,n,i){let s,a;if(!i)return;if(!i.cues)return;s=i.cues.length;while(s--)if(a=i.cues[s],a.startTime>=e&&a.endTime<=n)i.removeCue(a)},eO=function(e){let n=e.cues;if(!n)return;let i={};for(let s=n.length-1;s>=0;s--){let a=n[s],r=`${a.startTime}-${a.endTime}-${a.text}`;if(i[r])e.removeCue(a);else i[r]=a}},tO=(e,n,i)=>{if(typeof n>"u"||n===null||!e.length)return[];let s=Math.ceil((n-i+3)*Uc.ONE_SECOND_IN_TS),a;for(a=0;a<e.length;a++)if(e[a].pts>s)break;return e.slice(a)},nO=(e,n,i)=>{if(!n.length)return e;if(i)return n.slice();let s=n[0].pts,a=0;for(a;a<e.length;a++)if(e[a].pts>=s)break;return e.slice(0,a).concat(n)},iO=(e,n,i,s)=>{let a=Math.ceil((n-s)*Uc.ONE_SECOND_IN_TS),r=Math.ceil((i-s)*Uc.ONE_SECOND_IN_TS),l=e.slice(),c=e.length;while(c--)if(e[c].pts<=r)break;if(c===-1)return l;let p=c+1;while(p--)if(e[p].pts<=a)break;return p=Math.max(p,0),l.splice(p,c-p+1),l},sO=function(e,n){if(!e&&!n||!e&&n||e&&!n)return!1;if(e===n)return!0;let i=Object.keys(e).sort(),s=Object.keys(n).sort();if(i.length!==s.length)return!1;for(let a=0;a<i.length;a++){let r=i[a];if(r!==s[a])return!1;if(e[r]!==n[r])return!1}return!0},aO=function(e,n,i){n=n||[];let s=[],a=0;for(let r=0;r<n.length;r++){let l=n[r];if(e===l.timeline){if(s.push(r),a+=l.duration,a>i)return r}}if(s.length===0)return 0;return s[s.length-1]},fp=1,rO=500,H8=(e)=>typeof e==="number"&&isFinite(e),g1=0.016666666666666666,oO=(e,n,i)=>{if(e!=="main"||!n||!i)return null;if(!i.hasAudio&&!i.hasVideo)return"Neither audio nor video found in segment.";if(n.hasVideo&&!i.hasVideo)return"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.";if(!n.hasVideo&&i.hasVideo)return"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.";return null},lO=(e,n,i)=>{let s=n-Ds.BACK_BUFFER_LENGTH;if(e.length)s=Math.max(s,e.start(0));let a=n-i;return Math.min(a,s)},$f=(e)=>{let{startOfSegment:n,duration:i,segment:s,part:a,playlist:{mediaSequence:r,id:l,segments:c=[]},mediaIndex:p,partIndex:m,timeline:g}=e,y=c.length-1,x="mediaIndex/partIndex increment";if(e.getMediaInfoForTime)x=`getMediaInfoForTime (${e.getMediaInfoForTime})`;else if(e.isSyncRequest)x="getSyncSegmentCandidate (isSyncRequest)";if(e.independent)x+=` with independent ${e.independent}`;let I=typeof m==="number",M=e.segment.uri?"segment":"pre-segment",H=I?cS({preloadSegment:s})-1:0;return`${M} [${r+p}/${r+y}]`+(I?` part [${m}/${H}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(I?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${n}] duration [${i}] timeline [${g}] selected by [${x}] playlist [${l}]`},U8=(e)=>`${e}TimingInfo`,cO=({segmentTimeline:e,currentTimeline:n,startOfSegment:i,buffered:s,overrideCheck:a})=>{if(!a&&e===n)return null;if(e<n)return i;return s.length?s.end(s.length-1):i},o5=({timelineChangeController:e,currentTimeline:n,segmentTimeline:i,loaderType:s,audioDisabled:a})=>{if(n===i)return!1;if(s==="audio"){let r=e.lastTimelineChange({type:"main"});return!r||r.to!==i}if(s==="main"&&a){let r=e.pendingTimelineChange({type:"audio"});if(r&&r.to===i)return!1;return!0}return!1},uO=(e)=>{if(!e)return!1;let n=e.pendingTimelineChange({type:"audio"}),i=e.pendingTimelineChange({type:"main"}),s=n&&i,a=s&&n.to!==i.to;if(s&&n.from!==-1&&i.from!==-1&&a)return!0;return!1},hO=(e)=>{let n=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=e.timelineChangeController_.pendingTimelineChange({type:"main"});return n&&i&&n.to<i.to},Fc=(e)=>{let n=e.pendingSegment_;if(!n)return;if(o5({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:n.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&uO(e.timelineChangeController_)){if(hO(e)){e.timelineChangeController_.trigger("audioTimelineBehind");return}e.timelineChangeController_.trigger("fixBadTimelineChange")}},fO=(e)=>{let n=0;if(["video","audio"].forEach(function(i){let s=e[`${i}TimingInfo`];if(!s)return;let{start:a,end:r}=s,l;if(typeof a==="bigint"||typeof r==="bigint")l=je.default.BigInt(r)-je.default.BigInt(a);else if(typeof a==="number"&&typeof r==="number")l=r-a;if(typeof l<"u"&&l>n)n=l}),typeof n==="bigint"&&n<Number.MAX_SAFE_INTEGER)n=Number(n);return n},z8=({segmentDuration:e,maxDuration:n})=>{if(!e)return!1;return Math.round(e)>n+Fo},dO=(e,n)=>{if(n!=="hls")return null;let i=fO({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;let s=e.playlist.targetDuration,a=z8({segmentDuration:i,maxDuration:s*2}),r=z8({segmentDuration:i,maxDuration:s}),l=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.duration} and the target duration is ${s}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;if(a||r)return{severity:a?"warn":"info",message:l};return null},oh=({type:e,segment:n})=>{if(!n)return;let i=Boolean(n.key||n.map&&n.map.ke),s=Boolean(n.map&&!n.map.bytes),a=n.startOfSegment===void 0?n.start:n.startOfSegment;return{type:e||n.type,uri:n.resolvedUri||n.uri,start:a,duration:n.duration,isEncrypted:i,isMediaInitialization:s}};class P1 extends $e.EventTarget{constructor(e,n={}){super();if(!e)throw TypeError("Initialization settings are required");if(typeof e.currentTime!=="function")throw TypeError("No currentTime getter specified");if(!e.mediaSource)throw TypeError("No MediaSource specified");if(this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{if(!this.isEndOfStream_())this.ended_=!1}),this.fetchAtBuffer_=!1,this.logger_=Fr(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){if(i!==this.state_)this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange")}}),this.sourceUpdater_.on("ready",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Fc(this)}),this.sourceUpdater_.on("codecschange",(i)=>{this.trigger(Ri({type:"codecschange"},i))}),this.loaderType_==="main")this.timelineChangeController_.on("pendingtimelinechange",()=>{if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Fc(this)});if(this.loaderType_==="audio")this.timelineChangeController_.on("timelinechange",(i)=>{if(this.trigger(Ri({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_())this.processLoadQueue_();else Fc(this);if(this.hasEnoughInfoToAppend_())this.processCallQueue_();else Fc(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Py.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){if(this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_)this.transmuxer_.terminate();if(this.resetStats_(),this.checkBufferTimeout_)je.default.clearTimeout(this.checkBufferTimeout_);if(this.syncController_&&this.triggerSyncInfoUpdate_)this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_);this.off()}setAudio(e){if(this.audioDisabled_=!e,e)this.appendInitSegment_.audio=!0;else this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){if(this.pendingSegment_)this.pendingSegment_=null;this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}if(this.abort_(),this.state="READY",!this.paused())this.monitorBuffer_()}abort_(){if(this.pendingSegment_&&this.pendingSegment_.abortRequests)this.pendingSegment_.abortRequests();this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,je.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){if(this.state==="APPENDING"&&!this.pendingSegment_)return this.state="READY",!0;if(!this.pendingSegment_||this.pendingSegment_.requestId!==e)return!0;return!1}error(e){if(typeof e<"u")this.logger_("error occurred:",e),this.error_=e;return this.pendingSegment_=null,this.error_}endOfStream(){if(this.ended_=!0,this.transmuxer_)Py.reset(this.transmuxer_);this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Is();if(this.loaderType_==="main"){let{hasAudio:n,hasVideo:i,isMuxed:s}=e;if(i&&n&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,n=!1){if(!e)return null;let i=F1(e),s=this.initSegments_[i];if(n&&!s&&e.bytes)this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales};return s||e}segmentKey(e,n=!1){if(!e)return null;let i=jS(e),s=this.keyCache_[i];if(this.cacheEncryptionKeys_&&n&&!s&&e.bytes)this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes};let a={resolvedUri:(s||e).resolvedUri};if(s)a.bytes=s.bytes;return a}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!this.playlist_)return;if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT")return;this.state="READY"}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,n={}){if(!e)return;if(this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;let i=this.playlist_,s=this.pendingSegment_;if(this.playlist_=e,this.xhrOptions_=n,this.state==="INIT"){if(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main")this.syncController_.setDateTimeMappingForStart(e)}let a=null;if(i){if(i.id)a=i.id;else if(i.uri)a=i.uri}if(this.logger_(`playlist update [${a} => ${e.id||e.uri}]`),this.mediaSequenceSync_)this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
209
|
+
currentTime: ${this.currentTime_()}
|
|
210
|
+
bufferedEnd: ${Fy(this.buffered_())}
|
|
211
|
+
`,this.mediaSequenceSync_.diagnostics);if(this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){if(this.mediaIndex!==null)if(!e.endList&&typeof e.partTargetDuration==="number")this.resetLoader();else this.resyncLoader();this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}let r=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${r}]`),this.mediaIndex!==null)if(this.mediaIndex-=r,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{let l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){let c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}if(s)if(s.mediaIndex-=r,s.mediaIndex<0)s.mediaIndex=null,s.partIndex=null;else{if(s.mediaIndex>=0)s.segment=e.segments[s.mediaIndex];if(s.partIndex>=0&&s.segment.parts)s.part=s.segment.parts[s.partIndex]}this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){if(this.checkBufferTimeout_)je.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null}paused(){return this.checkBufferTimeout_===null}resetEverything(e){if(this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_)this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"})}resetLoader(){if(this.fetchAtBuffer_=!1,this.mediaSequenceSync_)this.mediaSequenceSync_.resetAppendedStatus();this.resyncLoader()}resyncLoader(){if(this.transmuxer_)Py.reset(this.transmuxer_);this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;let e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;if(this.sourceType_==="hls"&&!e)this.shouldForceTimestampOffsetAfterResync_=!0;if(this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,n,i=()=>{},s=!1){if(n===1/0)n=this.duration_();if(n<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let a=1,r=()=>{if(a--,a===0)i()};if(s||!this.audioDisabled_)a++,this.sourceUpdater_.removeAudio(e,n,r);if(s||this.loaderType_==="main")this.gopBuffer_=iO(this.gopBuffer_,e,n,this.timeMapping_),a++,this.sourceUpdater_.removeVideo(e,n,r);for(let l in this.inbandTextTracks_)gp(e,n,this.inbandTextTracks_[l]);gp(e,n,this.segmentMetadataTrack_),r()}monitorBuffer_(){if(this.checkBufferTimeout_)je.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=je.default.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){if(this.state==="READY")this.fillBuffer_();if(this.checkBufferTimeout_)je.default.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=je.default.setTimeout(this.monitorBufferTick_.bind(this),rO)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let e=this.chooseNextRequest_();if(!e)return;let n={segmentInfo:oh({type:this.loaderType_,segment:e})};if(this.trigger({type:"segmentselected",metadata:n}),typeof e.timestampOffset==="number")this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline});this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,n=this.playlist_,i=this.partIndex){if(!n||!this.mediaSource_)return!1;let s=typeof e==="number"&&n.segments[e],a=e+1===n.segments.length,r=!s||!s.parts||i+1===s.parts.length;return n.endList&&this.mediaSource_.readyState==="open"&&a&&r}chooseNextRequest_(){let e=this.buffered_(),n=Fy(e)||0,i=t3(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,a=i>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||s||a)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);let l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(l.isSyncRequest)l.mediaIndex=aO(this.currentTimeline_,r,n),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){let y=r[this.mediaIndex],x=typeof this.partIndex==="number"?this.partIndex:-1;if(l.startOfSegment=y.end?y.end:n,y.parts&&y.parts[x+1])l.mediaIndex=this.mediaIndex,l.partIndex=x+1;else l.mediaIndex=this.mediaIndex+1}else{let y,x,I,M=this.fetchAtBuffer_?n:this.currentTime_();if(this.mediaSequenceSync_)this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
212
|
+
For TargetTime: ${M}.
|
|
213
|
+
CurrentTime: ${this.currentTime_()}
|
|
214
|
+
BufferedEnd: ${n}
|
|
215
|
+
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
216
|
+
`,this.mediaSequenceSync_.diagnostics);if(this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let H=this.getSyncInfoFromMediaSequenceSync_(M);if(!H)return this.error({message:"No sync info found while using media sequence sync",metadata:{errorType:$e.Error.StreamingFailedToSelectNextSegment,error:Error("No sync info found while using media sequence sync")}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${H.start} --> ${H.end})`),y=H.segmentIndex,x=H.partIndex,I=H.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let H=Ba.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:M,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});y=H.segmentIndex,x=H.partIndex,I=H.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${M}`:`currentTime ${M}`,l.mediaIndex=y,l.startOfSegment=I,l.partIndex=x,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}let c=r[l.mediaIndex],p=c&&typeof l.partIndex==="number"&&c.parts&&c.parts[l.partIndex];if(!c||typeof l.partIndex==="number"&&!p)return null;if(typeof l.partIndex!=="number"&&c.parts)l.partIndex=0,p=c.parts[0];let m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&p&&!m&&!p.independent){if(l.partIndex===0){let y=r[l.mediaIndex-1],x=y.parts&&y.parts.length&&y.parts[y.parts.length-1];if(x&&x.independent)l.mediaIndex-=1,l.partIndex=y.parts.length-1,l.independent="previous segment"}else if(c.parts[l.partIndex-1].independent)l.partIndex-=1,l.independent="previous part"}let g=this.mediaSource_&&this.mediaSource_.readyState==="ended";if(l.mediaIndex>=r.length-1&&g&&!this.seeking_())return null;if(this.shouldForceTimestampOffsetAfterResync_)this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync");return this.generateSegmentInfo_(l)}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;let n=Math.max(e,this.mediaSequenceSync_.start);if(e!==n)this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${n}`);let i=this.mediaSequenceSync_.getSyncInfoForTime(n);if(!i)return null;if(!i.isAppended)return i;let s=this.mediaSequenceSync_.getSyncInfoForTime(i.end);if(!s)return null;if(s.isAppended)this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!");return s}generateSegmentInfo_(e){let{independent:n,playlist:i,mediaIndex:s,startOfSegment:a,isSyncRequest:r,partIndex:l,forceTimestampOffset:c,getMediaInfoForTime:p}=e,m=i.segments[s],g=typeof l==="number"&&m.parts[l],y={requestId:"segment-loader-"+Math.random(),uri:g&&g.resolvedUri||m.resolvedUri,mediaIndex:s,partIndex:g?l:null,isSyncRequest:r,startOfSegment:a,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:g&&g.duration||m.duration,segment:m,part:g,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:n},x=typeof c<"u"?c:this.isPendingTimestampOffset_;y.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:a,buffered:this.buffered_(),overrideCheck:x});let I=Fy(this.sourceUpdater_.audioBuffered());if(typeof I==="number")y.audioAppendStart=I-this.sourceUpdater_.audioTimestampOffset();if(this.sourceUpdater_.videoBuffered().length)y.gopsToAlignWith=tO(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_);return y}timestampOffsetForSegment_(e){return cO(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1000)return;let n=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,a=Ba.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),r=DM(this.buffered_(),n,this.vhs_.tech_.playbackRate())-1;if(a<=r)return;let l=GR({main:this.vhs_.playlists.main,currentTime:n,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;let p=a-r-l.rebufferingImpact,m=0.5;if(r<=Fo)m=1;if(!l.playlist||l.playlist.uri===this.playlist_.uri||p<m)return;this.bandwidth=l.playlist.attributes.BANDWIDTH*Ds.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort")}handleAbort_(e){this.logger_(`Aborting ${$f(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,n){if(this.earlyAbortWhenNeeded_(n.stats),this.checkForAbort_(n.requestId))return;this.trigger("progress")}handleTrackInfo_(e,n){let{hasAudio:i,hasVideo:s}=n,a={segmentInfo:oh({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:s}};if(this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:a}),this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.checkForIllegalMediaSwitch(n))return;if(n=n||{},!sO(this.currentMediaInfo_,n))this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=n,this.currentMediaInfo_=n,this.logger_("trackinfo update",n),this.trigger("trackinfo");if(this.checkForAbort_(e.requestId))return;if(this.pendingSegment_.trackInfo=n,this.hasEnoughInfoToAppend_())this.processCallQueue_();else Fc(this)}handleTimingInfo_(e,n,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;let a=this.pendingSegment_,r=U8(n);if(a[r]=a[r]||{},a[r][i]=s,this.logger_(`timinginfo: ${n} - ${i} - ${s}`),this.hasEnoughInfoToAppend_())this.processCallQueue_();else Fc(this)}handleCaptions_(e,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(n.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,n));return}let s=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),a={};if(n.forEach((r)=>{a[r.stream]=a[r.stream]||{startTime:1/0,captions:[],endTime:0};let l=a[r.stream];l.startTime=Math.min(l.startTime,r.startTime+s),l.endTime=Math.max(l.endTime,r.endTime+s),l.captions.push(r)}),Object.keys(a).forEach((r)=>{let{startTime:l,endTime:c,captions:p}=a[r],m=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${c} for ${r}`),WR(m,this.vhs_.tech_,r),gp(l,c,m[r]),KR({captionArray:p,inbandTextTracks:m,timestampOffset:s})}),this.transmuxer_)this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,n,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,n,i));return}this.addMetadataToTextTrack(i,n,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e)=>e()),this.metadataQueue_.caption.forEach((e)=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){let e=this.callQueue_;this.callQueue_=[],e.forEach((n)=>n())}processLoadQueue_(){let e=this.loadQueue_;this.loadQueue_=[],e.forEach((n)=>n())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;let e=this.pendingSegment_;if(!e)return!1;if(!this.getCurrentMediaInfo_())return!0;if(o5({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;let e=this.pendingSegment_,n=this.getCurrentMediaInfo_();if(!e||!n)return!1;let{hasAudio:i,hasVideo:s,isMuxed:a}=n;if(s&&!e.videoTimingInfo)return!1;if(i&&!this.audioDisabled_&&!a&&!e.audioTimingInfo)return!1;if(o5({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))return!1;return!0}handleData_(e,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Fc(this),this.callQueue_.push(this.handleData_.bind(this,e,n));return}let i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState==="closed")return;if(e.map)e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map;if(e.key)this.segmentKey(e.key,!0);if(i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[U8(n.type)].start;else{let s=this.getCurrentMediaInfo_(),a=this.loaderType_==="main"&&s&&s.hasVideo,r;if(a)r=i.videoTimingInfo.start;i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:r,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,n.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});let s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,n)}updateAppendInitSegmentStatus(e,n){if(this.loaderType_==="main"&&typeof e.timestampOffset==="number"&&!e.changedTimestampOffset)this.appendInitSegment_={audio:!0,video:!0};if(this.playlistOfLastInitSegment_[n]!==e.playlist)this.appendInitSegment_[n]=!0}getInitSegmentAndUpdateState_({type:e,initSegment:n,map:i,playlist:s}){if(i){let a=F1(i);if(this.activeInitSegmentId_===a)return null;n=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=a}if(n&&this.appendInitSegment_[e])return this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,n;return null}handleQuotaExceededError_({segmentInfo:e,type:n,bytes:i},s){let a=this.sourceUpdater_.audioBuffered(),r=this.sourceUpdater_.videoBuffered();if(a.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+lh(a).join(", "));if(r.length>1)this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+lh(r).join(", "));let l=a.length?a.start(0):0,c=a.length?a.end(a.length-1):0,p=r.length?r.start(0):0,m=r.length?r.end(r.length-1):0;if(c-l<=fp&&m-p<=fp){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${lh(a).join(", ")}, video buffer: ${lh(r).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:n,bytes:i}));let y=this.currentTime_()-fp;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${y}`),this.remove(0,y,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${fp}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=je.default.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},fp*1000)},!0)}handleAppendError_({segmentInfo:e,type:n,bytes:i},s){if(!s)return;if(s.code===vS){this.handleQuotaExceededError_({segmentInfo:e,type:n,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${n} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:$e.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:i,data:s,bytes:a}){if(!a){let l=[s],c=s.byteLength;if(i)l.unshift(i),c+=i.byteLength;a=XR({bytes:c,segments:l})}let r={segmentInfo:oh({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:r}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:n,bytes:a},this.handleAppendError_.bind(this,{segmentInfo:e,type:n,bytes:a}))}handleSegmentTimingInfo_(e,n,i){if(!this.pendingSegment_||n!==this.pendingSegment_.requestId)return;let s=this.pendingSegment_.segment,a=`${e}TimingInfo`;if(!s[a])s[a]={};s[a].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[a].transmuxedPresentationStart=i.start.presentation,s[a].transmuxedDecodeStart=i.start.decode,s[a].transmuxedPresentationEnd=i.end.presentation,s[a].transmuxedDecodeEnd=i.end.decode,s[a].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,n){let{type:i,data:s}=n;if(!s||!s.byteLength)return;if(i==="audio"&&this.audioDisabled_)return;let a=this.getInitSegmentAndUpdateState_({type:i,initSegment:n.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:a,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset==="number"){if(this.transmuxer_)this.transmuxer_.postMessage({action:"clearAllMp4Captions"})}if(!this.hasEnoughInfoToLoad_()){Fc(this),this.loadQueue_.push(()=>{let n=Ri({},e,{forceTimestampOffset:!0});Ri(e,this.generateSegmentInfo_(n)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){if(this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset))this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset});let n=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,a=e.timeline!==this.currentTimeline_&&e.timeline>0,r=i||s&&a;if(this.logger_(`Requesting
|
|
217
|
+
${VS(e.uri)}
|
|
218
|
+
${$f(e)}`),n.map&&!n.map.bytes)this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0};e.abortRequests=HR({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:n,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:r,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:c,stream:p})=>{this.logger_(`${$f(e)} logged from transmuxer stream ${p} as a ${c}: ${l}`)},triggerSegmentEventFn:({type:l,segment:c,keyInfo:p,trackInfo:m,timingInfo:g})=>{let x={segmentInfo:oh({segment:c})};if(p)x.keyInfo=p;if(m)x.trackInfo=m;if(g)x.timingInfo=g;this.trigger({type:l,metadata:x})}})}trimBackBuffer_(e){let n=lO(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);if(n>0)this.remove(0,n)}createSimplifiedSegmentObj_(e){let{segment:n,part:i}=e,s=e.segment.key||e.segment.map&&e.segment.map.key,a=e.segment.map&&!e.segment.map.bytes,r={resolvedUri:i?i.resolvedUri:n.resolvedUri,byterange:i?i.byterange:n.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:a},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===n.timeline){if(l.videoTimingInfo)r.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd;else if(l.audioTimingInfo)r.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd}if(n.key){let c=n.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(n.key),r.key.iv=c}if(n.map)r.map=this.initSegmentForMap(n.map);return r}saveTransferStats_(e){if(this.mediaRequests+=1,e)this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime}saveBandwidthRelatedStats_(e,n){if(this.pendingSegment_.byteLength=n.bytesReceived,e<g1){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${g1}`);return}let i={bandwidthInfo:{from:this.bandwidth,to:n.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=n.bandwidth,this.roundTrip=n.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,n,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,n,i));return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_)return;if(n.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Po.ABORTED)return;if(this.pause(),e.code===Po.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}let s=this.pendingSegment_;if(this.saveBandwidthRelatedStats_(s.duration,n.stats),s.endOfAllRequests=n.endOfAllRequests,i.gopInfo)this.gopBuffer_=nO(this.gopBuffer_,i.gopInfo,this.safeAppend_);this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){let n=this.syncController_.mappingForTimeline(e);if(n!==null)this.timeMapping_=n}updateMediaSecondsLoaded_(e){if(typeof e.start==="number"&&typeof e.end==="number")this.mediaSecondsLoaded+=e.end-e.start;else this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){if(e===null)return!1;if(this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset())return!0;if(!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())return!0;return!1}trueSegmentStart_({currentStart:e,playlist:n,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:a,useVideoTimingInfo:r,videoTimingInfo:l,audioTimingInfo:c}){if(typeof e<"u")return e;if(!r)return c.start;let p=n.segments[i-1];if(i===0||!p||typeof p.start>"u"||p.end!==s+a)return s;return l.start}waitForAppendsToComplete_(e){let n=this.getCurrentMediaInfo_(e);if(!n){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}let{hasAudio:i,hasVideo:s,isMuxed:a}=n,r=this.loaderType_==="main"&&s,l=!this.audioDisabled_&&i&&!a;if(e.waitingOnAppends=0,!e.hasAppendedData_){if(!e.timingInfo&&typeof e.timestampOffset==="number")this.isPendingTimestampOffset_=!0;if(e.timingInfo={start:0},e.waitingOnAppends++,!this.isPendingTimestampOffset_)this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_();this.checkAppendsDone_(e);return}if(r)e.waitingOnAppends++;if(l)e.waitingOnAppends++;if(r)this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e));if(l)this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){if(this.checkForAbort_(e.requestId))return;if(e.waitingOnAppends--,e.waitingOnAppends===0)this.handleAppendsDone_()}checkForIllegalMediaSwitch(e){let n=oO(this.loaderType_,this.getCurrentMediaInfo_(),e);if(n)return this.error({message:n,playlistExclusionDuration:1/0}),this.trigger("error"),!0;return!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!=="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let n=!1;if(e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset())this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),n=!0;if(e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset())this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),n=!0;if(n)this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:n,timingInfo:i}){if(!this.useDtsForTimestampOffset_)return i.start;if(e&&typeof e.transmuxedDecodeStart==="number")return e.transmuxedDecodeStart;if(n&&typeof n.transmuxedDecodeStart==="number")return n.transmuxedDecodeStart;return i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};let n=this.getMediaInfo_(),s=this.loaderType_==="main"&&n&&n.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;if(!s)return;e.timingInfo.end=typeof s.end==="number"?s.end:s.start+e.duration}handleAppendsDone_(){if(this.pendingSegment_){let c={segmentInfo:oh({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){if(this.state="READY",!this.paused())this.monitorBuffer_();return}let e=this.pendingSegment_;if(e.part&&e.part.syncInfo)e.part.syncInfo.markAppended();else if(e.segment.syncInfo)e.segment.syncInfo.markAppended();if(this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_)this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});let n=dO(e,this.sourceType_);if(n)if(n.severity==="warn")$e.log.warn(n.message);else this.logger_(n.message);if(this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest){if(this.trigger("syncinfoupdate"),!e.hasAppendedData_){this.logger_(`Throwing away un-appended sync request ${$f(e)}`);return}}if(this.logger_(`Appended ${$f(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline){if(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_)this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})}this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");let{segment:i,part:s}=e,a=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,r=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(a||r){this.logger_(`bad ${a?"segment":"part"} ${$f(e)}`),this.resetEverything();return}if(this.mediaIndex!==null)this.trigger("bandwidthupdate");if(this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex))this.endOfStream();if(this.trigger("appended"),e.hasAppendedData_)this.mediaAppends++;if(!this.paused())this.monitorBuffer_()}recordThroughput_(e){if(e.duration<g1){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${g1}`);return}let n=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1000);this.throughput.rate+=(s-n)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;let n=e.segment,{start:i,end:s}=n;if(!H8(i)||!H8(s))return;gp(i,s,this.segmentMetadataTrack_);let a=je.default.WebKitDataCue||je.default.VTTCue,r={custom:n.custom,dateTimeObject:n.dateTimeObject,dateTimeString:n.dateTimeString,programDateTime:n.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:s},l=JSON.stringify(r),c=new a(i,s,l);c.value=r,this.segmentMetadataTrack_.addCue(c)}}function Ml(){}var WS=function(e){if(typeof e!=="string")return e;return e.replace(/./,(n)=>n.toUpperCase())},pO=["video","audio"],l5=(e,n)=>{let i=n[`${e}Buffer`];return i&&i.updating||n.queuePending[e]},mO=(e,n)=>{for(let i=0;i<n.length;i++){let s=n[i];if(s.type==="mediaSource")return null;if(s.type===e)return i}return null},ad=(e,n)=>{if(n.queue.length===0)return;let i=0,s=n.queue[i];if(s.type==="mediaSource"){if(!n.updating()&&n.mediaSource.readyState!=="closed"){if(n.queue.shift(),s.action(n),s.doneFn)s.doneFn();ad("audio",n),ad("video",n)}return}if(e==="mediaSource")return;if(!n.ready()||n.mediaSource.readyState==="closed"||l5(e,n))return;if(s.type!==e){if(i=mO(e,n.queue),i===null)return;s=n.queue[i]}if(n.queue.splice(i,1),n.queuePending[e]=s,s.action(e,n),!s.doneFn){n.queuePending[e]=null,ad(e,n);return}},KS=(e,n)=>{let i=n[`${e}Buffer`],s=WS(e);if(!i)return;i.removeEventListener("updateend",n[`on${s}UpdateEnd_`]),i.removeEventListener("error",n[`on${s}Error_`]),n.codecs[e]=null,n[`${e}Buffer`]=null},Ro=(e,n)=>e&&n&&Array.prototype.indexOf.call(e.sourceBuffers,n)!==-1,ar={appendBuffer:(e,n,i)=>(s,a)=>{let r=a[`${s}Buffer`];if(!Ro(a.mediaSource,r))return;a.logger_(`Appending segment ${n.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{r.appendBuffer(e)}catch(l){a.logger_(`Error with code ${l.code} `+(l.code===vS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${n.mediaIndex} to ${s}Buffer`),a.queuePending[s]=null,i(l)}},remove:(e,n)=>(i,s)=>{let a=s[`${i}Buffer`];if(!Ro(s.mediaSource,a))return;s.logger_(`Removing ${e} to ${n} from ${i}Buffer`);try{a.remove(e,n)}catch(r){s.logger_(`Remove ${e} to ${n} from ${i}Buffer failed`)}},timestampOffset:(e)=>(n,i)=>{let s=i[`${n}Buffer`];if(!Ro(i.mediaSource,s))return;i.logger_(`Setting ${n}timestampOffset to ${e}`),s.timestampOffset=e},callback:(e)=>(n,i)=>{e()},endOfStream:(e)=>(n)=>{if(n.mediaSource.readyState!=="open")return;n.logger_(`Calling mediaSource endOfStream(${e||""})`);try{n.mediaSource.endOfStream(e)}catch(i){$e.log.warn("Failed to call media source endOfStream",i)}},duration:(e)=>(n)=>{n.logger_(`Setting mediaSource duration to ${e}`);try{n.mediaSource.duration=e}catch(i){$e.log.warn("Failed to set media source duration",i)}},abort:()=>(e,n)=>{if(n.mediaSource.readyState!=="open")return;let i=n[`${e}Buffer`];if(!Ro(n.mediaSource,i))return;n.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(s){$e.log.warn(`Failed to abort on ${e}Buffer`,s)}},addSourceBuffer:(e,n)=>(i)=>{let s=WS(e),a=nh(n);i.logger_(`Adding ${e}Buffer with codec ${n} to mediaSource`);let r=i.mediaSource.addSourceBuffer(a);r.addEventListener("updateend",i[`on${s}UpdateEnd_`]),r.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=n,i[`${e}Buffer`]=r},removeSourceBuffer:(e)=>(n)=>{let i=n[`${e}Buffer`];if(KS(e,n),!Ro(n.mediaSource,i))return;n.logger_(`Removing ${e}Buffer with codec ${n.codecs[e]} from mediaSource`);try{n.mediaSource.removeSourceBuffer(i)}catch(s){$e.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,s)}},changeType:(e)=>(n,i)=>{let s=i[`${n}Buffer`],a=nh(e);if(!Ro(i.mediaSource,s))return;let r=e.substring(0,e.indexOf(".")),l=i.codecs[n];if(l.substring(0,l.indexOf("."))===r)return;let p={codecsChangeInfo:{from:l,to:e}};i.trigger({type:"codecschange",metadata:p}),i.logger_(`changing ${n}Buffer codec from ${l} to ${e}`);try{s.changeType(a),i.codecs[n]=e}catch(m){p.errorType=$e.Error.StreamingCodecsChangeError,p.error=m,m.metadata=p,i.error_=m,i.trigger("error"),$e.log.warn(`Failed to changeType on ${n}Buffer`,m)}}},rr=({type:e,sourceUpdater:n,action:i,doneFn:s,name:a})=>{n.queue.push({type:e,action:i,doneFn:s,name:a}),ad(e,n)},G8=(e,n)=>(i)=>{let s=n[`${e}Buffered`](),a=jM(s);if(n.logger_(`received "updateend" event for ${e} Source Buffer: `,a),n.queuePending[e]){let r=n.queuePending[e].doneFn;if(n.queuePending[e]=null,r)r(n[`${e}Error_`])}ad(e,n)};class o3 extends $e.EventTarget{constructor(e){super();this.mediaSource=e,this.sourceopenListener_=()=>ad("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Fr("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=G8("video",this),this.onAudioUpdateEnd_=G8("audio",this),this.onVideoError_=(n)=>{this.videoError_=n},this.onAudioError_=(n)=>{this.audioError_=n},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){if(this.hasCreatedSourceBuffers())return;this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady()}triggerReady(){if(this.ready()&&!this.triggeredReady_)this.triggeredReady_=!0,this.trigger("ready")}addSourceBuffer(e,n){rr({type:"mediaSource",sourceUpdater:this,action:ar.addSourceBuffer(e,n),name:"addSourceBuffer"})}abort(e){rr({type:e,sourceUpdater:this,action:ar.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){$e.log.error("removeSourceBuffer is not supported!");return}rr({type:"mediaSource",sourceUpdater:this,action:ar.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!$e.browser.IS_FIREFOX&&je.default.MediaSource&&je.default.MediaSource.prototype&&typeof je.default.MediaSource.prototype.removeSourceBuffer==="function"}static canChangeType(){return je.default.SourceBuffer&&je.default.SourceBuffer.prototype&&typeof je.default.SourceBuffer.prototype.changeType==="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,n){if(!this.canChangeType()){$e.log.error("changeType is not supported!");return}rr({type:e,sourceUpdater:this,action:ar.changeType(n),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!=="object"||Object.keys(e).length===0)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((n)=>{let i=e[n];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(n,i);if(this.canChangeType())this.changeType(n,i)})}appendBuffer(e,n){let{segmentInfo:i,type:s,bytes:a}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,n]),this.logger_(`delayed audio append of ${a.length} until video append`);return}let r=n;if(rr({type:s,sourceUpdater:this,action:ar.appendBuffer(a,i||{mediaIndex:-1},r),doneFn:n,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;let l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach((c)=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){if(!Ro(this.mediaSource,this.audioBuffer))return Is();return this.audioBuffer.buffered?this.audioBuffer.buffered:Is()}videoBuffered(){if(!Ro(this.mediaSource,this.videoBuffer))return Is();return this.videoBuffer.buffered?this.videoBuffer.buffered:Is()}buffered(){let e=Ro(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,n=Ro(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(n&&!e)return this.audioBuffered();if(e&&!n)return this.videoBuffered();return qM(this.audioBuffered(),this.videoBuffered())}setDuration(e,n=Ml){rr({type:"mediaSource",sourceUpdater:this,action:ar.duration(e),name:"duration",doneFn:n})}endOfStream(e=null,n=Ml){if(typeof e!=="string")e=void 0;rr({type:"mediaSource",sourceUpdater:this,action:ar.endOfStream(e),name:"endOfStream",doneFn:n})}removeAudio(e,n,i=Ml){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}rr({type:"audio",sourceUpdater:this,action:ar.remove(e,n),doneFn:i,name:"remove"})}removeVideo(e,n,i=Ml){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}rr({type:"video",sourceUpdater:this,action:ar.remove(e,n),doneFn:i,name:"remove"})}updating(){if(l5("audio",this)||l5("video",this))return!0;return!1}audioTimestampOffset(e){if(typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e)rr({type:"audio",sourceUpdater:this,action:ar.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e;return this.audioTimestampOffset_}videoTimestampOffset(e){if(typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e)rr({type:"video",sourceUpdater:this,action:ar.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e;return this.videoTimestampOffset_}audioQueueCallback(e){if(!this.audioBuffer)return;rr({type:"audio",sourceUpdater:this,action:ar.callback(e),name:"callback"})}videoQueueCallback(e){if(!this.videoBuffer)return;rr({type:"video",sourceUpdater:this,action:ar.callback(e),name:"callback"})}dispose(){if(this.trigger("dispose"),pO.forEach((e)=>{if(this.abort(e),this.canRemoveSourceBuffer())this.removeSourceBuffer(e);else this[`${e}QueueCallback`](()=>KS(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_)this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_);this.off()}}var V8=(e)=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),gO=(e)=>{let n=new Uint8Array(e);return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")},X8=new Uint8Array(`
|
|
219
|
+
|
|
220
|
+
`.split("").map((e)=>e.charCodeAt(0)));class $S extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class YS extends P1{constructor(e,n={}){super(e,n);this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Is();let e=this.subtitlesTrack_.cues,n=e[0].startTime,i=e[e.length-1].startTime;return Is([[n,i]])}initSegmentForMap(e,n=!1){if(!e)return null;let i=F1(e),s=this.initSegments_[i];if(n&&!s&&e.bytes){let a=X8.byteLength+e.bytes.byteLength,r=new Uint8Array(a);r.set(e.bytes),r.set(X8,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:r}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){if(typeof e>"u")return this.subtitlesTrack_;if(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_())this.init_();return this.subtitlesTrack_}remove(e,n){gp(e,n,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(!e)return;if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){let n=()=>{if(this.state="READY",!this.paused())this.monitorBuffer_()};this.syncController_.one("timestampoffset",n),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){while(e&&e.segment.empty){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,n,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){if(e.code===Po.TIMEOUT)this.handleTimeout_();if(e.code===Po.ABORTED)this.mediaRequestsAborted+=1;else this.mediaRequestsErrored+=1;this.stopForError(e);return}let s=this.pendingSegment_,a=i.mp4VttCues&&i.mp4VttCues.length;if(a)s.mp4VttCues=i.mp4VttCues;if(this.saveBandwidthRelatedStats_(s.duration,n.stats),n.key)this.segmentKey(n.key,!0);this.state="APPENDING",this.trigger("appending");let r=s.segment;if(r.map)r.map.bytes=n.map.bytes;if(s.bytes=n.bytes,typeof je.default.WebVTT!=="function"&&typeof this.loadVttJs==="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,n,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}r.requested=!0;try{this.parseVTTCues_(s)}catch(l){this.stopForError({message:l.message,metadata:{errorType:$e.Error.StreamingVttParserError,error:l}});return}if(!a)this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_);if(s.cues.length)s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime};else s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration};if(s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach((l)=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new je.default.VTTCue(l.startTime,l.endTime,l.text):l)}),eO(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,n){let i=e&&e.type==="vtt",s=n&&n.type==="text";if(i&&s)super.handleData_(e,n)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){let n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach((i)=>{let s=i.start+n,a=i.end+n,r=new je.default.VTTCue(s,a,i.cueText);if(i.settings)i.settings.split(" ").forEach((l)=>{let c=l.split(":"),p=c[0],m=c[1];r[p]=isNaN(m)?m:Number(m)});e.cues.push(r)})}parseVTTCues_(e){let n,i=!1;if(typeof je.default.WebVTT!=="function")throw new $S;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}if(typeof je.default.TextDecoder==="function")n=new je.default.TextDecoder("utf8");else n=je.default.WebVTT.StringDecoder(),i=!0;let s=new je.default.WebVTT.Parser(je.default,je.default.vttjs,n);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=(r)=>{e.timestampmap=r},s.onparsingerror=(r)=>{$e.log.warn("Error encountered when parsing cues: "+r.message)},e.segment.map){let r=e.segment.map.bytes;if(i)r=V8(r);s.parse(r)}let a=e.bytes;if(i)a=V8(a);s.parse(a),s.flush()}updateTimeMapping_(e,n,i){let s=e.segment;if(!n)return;if(!e.cues.length){s.empty=!0;return}let{MPEGTS:a,LOCAL:r}=e.timestampmap,c=a/Uc.ONE_SECOND_IN_TS-r+n.mapping;if(e.cues.forEach((p)=>{let m=p.endTime-p.startTime,g=this.handleRollover_(p.startTime+c,n.time);p.startTime=Math.max(g,0),p.endTime=Math.max(g+m,0)}),!i.syncInfo){let p=e.cues[0].startTime,m=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(p,m-s.duration)}}}handleRollover_(e,n){if(n===null)return e;let i=e*Uc.ONE_SECOND_IN_TS,s=n*Uc.ONE_SECOND_IN_TS,a;if(s<i)a=-8589934592;else a=8589934592;while(Math.abs(i-s)>4294967296)i+=a;return i/Uc.ONE_SECOND_IN_TS}}var bO=function(e,n){let i=e.cues;for(let s=0;s<i.length;s++){let a=i[s];if(n>=a.adStartTime&&n<=a.adEndTime)return a}return null},wO=function(e,n,i=0){if(!e.segments)return;let s=i,a;for(let r=0;r<e.segments.length;r++){let l=e.segments[r];if(!a)a=bO(n,s+l.duration/2);if(a){if("cueIn"in l){a.endTime=s,a.adEndTime=s,s+=l.duration,a=null;continue}if(s<a.endTime){s+=l.duration;continue}a.endTime+=l.duration}else{if("cueOut"in l)a=new je.default.VTTCue(s,s+l.duration,l.cueOut),a.adStartTime=s,a.adEndTime=s+parseFloat(l.cueOut),n.addCue(a);if("cueOutCont"in l){let[c,p]=l.cueOutCont.split("/").map(parseFloat);a=new je.default.VTTCue(s,s+l.duration,""),a.adStartTime=s-c,a.adEndTime=a.adStartTime+p,n.addCue(a)}}s+=l.duration}};class c5{constructor({start:e,end:n,segmentIndex:i,partIndex:s=null,appended:a=!1}){this.start_=e,this.end_=n,this.segmentIndex_=i,this.partIndex_=s,this.appended_=a}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class QS{constructor(e,n=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=n}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach((e)=>e.resetAppendedStatus())}}class l3{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach((e)=>e.resetAppendStatus())}update(e,n){let{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),!this.isReliable_)return;return this.updateStorage_(s,i,this.calculateBaseTime_(i,s,n))}getSyncInfoForTime(e){for(let{segmentSyncInfo:n,partsSyncInfo:i}of this.storage_.values())if(!i.length){if(n.isInRange(e))return n}else for(let s of i)if(s.isInRange(e))return s;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,n,i){let s=new Map,a=`
|
|
221
|
+
`,r=i,l=n;this.start_=r,e.forEach((c,p)=>{let m=this.storage_.get(l),g=r,y=g+c.duration,x=Boolean(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),I=new c5({start:g,end:y,appended:x,segmentIndex:p});c.syncInfo=I;let M=r,H=(c.parts||[]).map((X,W)=>{let Y=M,te=M+X.duration,ae=Boolean(m&&m.partsSyncInfo&&m.partsSyncInfo[W]&&m.partsSyncInfo[W].isAppended),ne=new c5({start:Y,end:te,appended:ae,segmentIndex:p,partIndex:W});return M=te,a+=`Media Sequence: ${l}.${W} | Range: ${Y} --> ${te} | Appended: ${ae}
|
|
222
|
+
`,X.syncInfo=ne,ne});s.set(l,new QS(I,H)),a+=`${VS(c.resolvedUri)} | Media Sequence: ${l} | Range: ${g} --> ${y} | Appended: ${x}
|
|
223
|
+
`,l++,r=y}),this.end_=r,this.storage_=s,this.diagnostics_=a}calculateBaseTime_(e,n,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;let s=Math.min(...this.storage_.keys());if(e<s){let a=s-e,r=this.storage_.get(s).segmentSyncInfo.start;for(let l=0;l<a;l++){let c=n[l];r-=c.duration}return r}return i}isReliablePlaylist_(e,n){return e!==void 0&&e!==null&&Array.isArray(n)&&n.length}}class u5 extends l3{constructor(e){super();this.parent_=e}calculateBaseTime_(e,n,i){if(!this.storage_.size){let s=this.parent_.getSyncInfoForMediaSequence(e);if(s)return s.segmentSyncInfo.start;return 0}return super.calculateBaseTime_(e,n,i)}}var yO=86400,By=[{name:"VOD",run:(e,n,i,s,a)=>{if(i!==1/0)return{time:0,segmentIndex:0,partIndex:null};return null}},{name:"MediaSequence",run:(e,n,i,s,a,r)=>{let l=e.getMediaSequenceSync(r);if(!l)return null;if(!l.isReliable)return null;let c=l.getSyncInfoForTime(a);if(!c)return null;return{time:c.start,partIndex:c.partIndex,segmentIndex:c.segmentIndex}}},{name:"ProgramDateTime",run:(e,n,i,s,a)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let r=null,l=null,c=Zy(n);a=a||0;for(let p=0;p<c.length;p++){let m=n.endList||a===0?p:c.length-(p+1),g=c[m],y=g.segment,x=e.timelineToDatetimeMappings[y.timeline];if(!x||!y.dateTimeObject)continue;let M=y.dateTimeObject.getTime()/1000+x;if(y.parts&&typeof g.partIndex==="number")for(let X=0;X<g.partIndex;X++)M+=y.parts[X].duration;let H=Math.abs(a-M);if(l!==null&&(H===0||l<H))break;l=H,r={time:M,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return r}},{name:"Segment",run:(e,n,i,s,a)=>{let r=null,l=null;a=a||0;let c=Zy(n);for(let p=0;p<c.length;p++){let m=n.endList||a===0?p:c.length-(p+1),g=c[m],y=g.segment,x=g.part&&g.part.start||y&&y.start;if(y.timeline===s&&typeof x<"u"){let I=Math.abs(a-x);if(l!==null&&l<I)break;if(!r||l===null||l>=I)l=I,r={time:x,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}}return r}},{name:"Discontinuity",run:(e,n,i,s,a)=>{let r=null;if(a=a||0,n.discontinuityStarts&&n.discontinuityStarts.length){let l=null;for(let c=0;c<n.discontinuityStarts.length;c++){let p=n.discontinuityStarts[c],m=n.discontinuitySequence+c+1,g=e.discontinuities[m];if(g){let y=Math.abs(a-g.time);if(l!==null&&l<y)break;if(!r||l===null||l>=y)l=y,r={time:g.time,segmentIndex:p,partIndex:null}}}}return r}},{name:"Playlist",run:(e,n,i,s,a)=>{if(n.syncInfo)return{time:n.syncInfo.time,segmentIndex:n.syncInfo.mediaSequence-n.mediaSequence,partIndex:null};return null}}];class JS extends $e.EventTarget{constructor(e={}){super();this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let n=new l3,i=new u5(n),s=new u5(n);this.mediaSequenceStorage_={main:n,audio:i,vtt:s},this.logger_=Fr("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,i,s,a){if(n!==1/0)return By.find(({name:c})=>c==="VOD").run(this,e,n);let r=this.runStrategies_(e,n,i,s,a);if(!r.length)return null;for(let l of r){let{syncPoint:c,strategy:p}=l,{segmentIndex:m,time:g}=c;if(m<0)continue;let y=e.segments[m],x=g,I=x+y.duration;if(this.logger_(`Strategy: ${p}. Current time: ${s}. selected segment: ${m}. Time: [${x} -> ${I}]}`),s>=x&&s<I)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(r,{key:"time",value:s})}getExpiredTime(e,n){if(!e||!e.segments)return null;let i=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!i.length)return null;let s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});if(s.segmentIndex>0)s.time*=-1;return Math.abs(s.time+vp({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,n,i,s,a){let r=[];for(let l=0;l<By.length;l++){let c=By[l],p=c.run(this,e,n,i,s,a);if(p)p.strategy=c.name,r.push({strategy:c.name,syncPoint:p})}return r}selectSyncPoint_(e,n){let i=e[0].syncPoint,s=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let r=1;r<e.length;r++){let l=Math.abs(e[r].syncPoint[n.key]-n.value);if(l<s)s=l,i=e[r].syncPoint,a=e[r].strategy}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex==="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,n){let i=n.mediaSequence-e.mediaSequence;if(i>yO){$e.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let s=i-1;s>=0;s--){let a=e.segments[s];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+s,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){let n=e.segments[0],i=n.dateTimeObject.getTime()/1000;this.timelineToDatetimeMappings[n.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),s=e.segment;if(i){if(this.saveDiscontinuitySyncInfo_(e),!e.playlist.syncInfo)e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}}let a=s.dateTimeObject;if(s.discontinuity&&n&&a)this.timelineToDatetimeMappings[s.timeline]=-(a.getTime()/1000)}timestampOffsetForTimeline(e){if(typeof this.timelines[e]>"u")return null;return this.timelines[e].time}mappingForTimeline(e){if(typeof this.timelines[e]>"u")return null;return this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,i){let{segment:s,part:a}=e,r=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset==="number"){if(r={time:e.startOfSegment,mapping:e.startOfSegment-n.start},i)this.timelines[e.timeline]=r,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${r.time}] [mapping: ${r.mapping}]`);l=e.startOfSegment,c=n.end+r.mapping}else if(r)l=n.start+r.mapping,c=n.end+r.mapping;else return!1;if(a)a.start=l,a.end=c;if(!s.start||l<s.start)s.start=l;return s.end=c,!0}saveDiscontinuitySyncInfo_(e){let{playlist:n,segment:i}=e;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let s=0;s<n.discontinuityStarts.length;s++){let a=n.discontinuityStarts[s],r=n.discontinuitySequence+s+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[r]||this.discontinuities[r].accuracy>c){let p;if(l<0)p=i.start-vp({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a});else p=i.end+vp({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a});this.discontinuities[r]={time:p,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class ZS extends $e.EventTarget{constructor(){super();this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:i}){if(typeof n==="number"&&typeof i==="number")this.pendingTimelineChanges_[e]={type:e,from:n,to:i},this.trigger("pendingtimelinechange");return this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:i}){if(typeof n==="number"&&typeof i==="number"){this.lastTimelineChanges_[e]={type:e,from:n,to:i},delete this.pendingTimelineChanges_[e];let s={timelineChangeInfo:{from:n,to:i}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var vO=RS(OS(function(){var e=function(){function H(){this.listeners={}}var X=H.prototype;return X.on=function(Y,te){if(!this.listeners[Y])this.listeners[Y]=[];this.listeners[Y].push(te)},X.off=function(Y,te){if(!this.listeners[Y])return!1;var ae=this.listeners[Y].indexOf(te);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(ae,1),ae>-1},X.trigger=function(Y){var te=this.listeners[Y];if(!te)return;if(arguments.length===2){var ae=te.length;for(var ne=0;ne<ae;++ne)te[ne].call(this,arguments[1])}else{var oe=Array.prototype.slice.call(arguments,1),me=te.length;for(var be=0;be<me;++be)te[be].apply(this,oe)}},X.dispose=function(){this.listeners={}},X.pipe=function(Y){this.on("data",function(te){Y.push(te)})},H}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function n(H){return H.subarray(0,H.byteLength-H[H.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */let i=function(){let H=[[[],[],[],[],[]],[[],[],[],[],[]]],X=H[0],W=H[1],Y=X[4],te=W[4],ae,ne,oe,me=[],be=[],xe,Oe,Fe,Ue,ze,Le;for(ae=0;ae<256;ae++)be[(me[ae]=ae<<1^(ae>>7)*283)^ae]=ae;for(ne=oe=0;!Y[ne];ne^=xe||1,oe=be[oe]||1){Ue=oe^oe<<1^oe<<2^oe<<3^oe<<4,Ue=Ue>>8^Ue&255^99,Y[ne]=Ue,te[Ue]=ne,Fe=me[Oe=me[xe=me[ne]]],Le=Fe*16843009^Oe*65537^xe*257^ne*16843008,ze=me[Ue]*257^Ue*16843008;for(ae=0;ae<4;ae++)X[ae][ne]=ze=ze<<24^ze>>>8,W[ae][Ue]=Le=Le<<24^Le>>>8}for(ae=0;ae<5;ae++)X[ae]=X[ae].slice(0),W[ae]=W[ae].slice(0);return H},s=null;class a{constructor(H){if(!s)s=i();this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];let X,W,Y,te=this._tables[0][4],ae=this._tables[1],ne=H.length,oe=1;if(ne!==4&&ne!==6&&ne!==8)throw Error("Invalid aes key size");let me=H.slice(0),be=[];this._key=[me,be];for(X=ne;X<4*ne+28;X++){if(Y=me[X-1],X%ne===0||ne===8&&X%ne===4){if(Y=te[Y>>>24]<<24^te[Y>>16&255]<<16^te[Y>>8&255]<<8^te[Y&255],X%ne===0)Y=Y<<8^Y>>>24^oe<<24,oe=oe<<1^(oe>>7)*283}me[X]=me[X-ne]^Y}for(W=0;X;W++,X--)if(Y=me[W&3?X:X-4],X<=4||W<4)be[W]=Y;else be[W]=ae[0][te[Y>>>24]]^ae[1][te[Y>>16&255]]^ae[2][te[Y>>8&255]]^ae[3][te[Y&255]]}decrypt(H,X,W,Y,te,ae){let ne=this._key[1],oe=H^ne[0],me=Y^ne[1],be=W^ne[2],xe=X^ne[3],Oe,Fe,Ue,ze=ne.length/4-2,Le,qe=4,Me=this._tables[1],yt=Me[0],Ge=Me[1],Qe=Me[2],jt=Me[3],ut=Me[4];for(Le=0;Le<ze;Le++)Oe=yt[oe>>>24]^Ge[me>>16&255]^Qe[be>>8&255]^jt[xe&255]^ne[qe],Fe=yt[me>>>24]^Ge[be>>16&255]^Qe[xe>>8&255]^jt[oe&255]^ne[qe+1],Ue=yt[be>>>24]^Ge[xe>>16&255]^Qe[oe>>8&255]^jt[me&255]^ne[qe+2],xe=yt[xe>>>24]^Ge[oe>>16&255]^Qe[me>>8&255]^jt[be&255]^ne[qe+3],qe+=4,oe=Oe,me=Fe,be=Ue;for(Le=0;Le<4;Le++)te[(3&-Le)+ae]=ut[oe>>>24]<<24^ut[me>>16&255]<<16^ut[be>>8&255]<<8^ut[xe&255]^ne[qe++],Oe=oe,oe=me,me=be,be=xe,xe=Oe}}class r extends e{constructor(){super(e);this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){if(this.jobs.shift()(),this.jobs.length)this.timeout_=setTimeout(this.processJob_.bind(this),this.delay);else this.timeout_=null}push(H){if(this.jobs.push(H),!this.timeout_)this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}}let l=function(H){return H<<24|(H&65280)<<8|(H&16711680)>>8|H>>>24},c=function(H,X,W){let Y=new Int32Array(H.buffer,H.byteOffset,H.byteLength>>2),te=new a(Array.prototype.slice.call(X)),ae=new Uint8Array(H.byteLength),ne=new Int32Array(ae.buffer),oe,me,be,xe,Oe,Fe,Ue,ze,Le;oe=W[0],me=W[1],be=W[2],xe=W[3];for(Le=0;Le<Y.length;Le+=4)Oe=l(Y[Le]),Fe=l(Y[Le+1]),Ue=l(Y[Le+2]),ze=l(Y[Le+3]),te.decrypt(Oe,Fe,Ue,ze,ne,Le),ne[Le]=l(ne[Le]^oe),ne[Le+1]=l(ne[Le+1]^me),ne[Le+2]=l(ne[Le+2]^be),ne[Le+3]=l(ne[Le+3]^xe),oe=Oe,me=Fe,be=Ue,xe=ze;return ae};class p{constructor(H,X,W,Y){let te=p.STEP,ae=new Int32Array(H.buffer),ne=new Uint8Array(H.byteLength),oe=0;this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(ae.subarray(oe,oe+te),X,W,ne));for(oe=te;oe<ae.length;oe+=te)W=new Uint32Array([l(ae[oe-4]),l(ae[oe-3]),l(ae[oe-2]),l(ae[oe-1])]),this.asyncStream_.push(this.decryptChunk_(ae.subarray(oe,oe+te),X,W,ne));this.asyncStream_.push(function(){Y(null,n(ne))})}static get STEP(){return 32000}decryptChunk_(H,X,W,Y){return function(){let te=c(H,X,W);Y.set(te,H.byteOffset)}}}var m=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g;if(typeof window<"u")g=window;else if(typeof m<"u")g=m;else if(typeof self<"u")g=self;else g={};var y=g,x=function(X){if(ArrayBuffer.isView==="function")return ArrayBuffer.isView(X);return X&&X.buffer instanceof ArrayBuffer},I=y.BigInt||Number;I("0x1"),I("0x100"),I("0x10000"),I("0x1000000"),I("0x100000000"),I("0x10000000000"),I("0x1000000000000"),I("0x100000000000000"),I("0x10000000000000000"),function(){var H=new Uint16Array([65484]),X=new Uint8Array(H.buffer,H.byteOffset,H.byteLength);if(X[0]===255)return"big";if(X[0]===204)return"little";return"unknown"}();let M=function(H){let X={};return Object.keys(H).forEach((W)=>{let Y=H[W];if(x(Y))X[W]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength};else X[W]=Y}),X};self.onmessage=function(H){let X=H.data,W=new Uint8Array(X.encrypted.bytes,X.encrypted.byteOffset,X.encrypted.byteLength),Y=new Uint32Array(X.key.bytes,X.key.byteOffset,X.key.byteLength/4),te=new Uint32Array(X.iv.bytes,X.iv.byteOffset,X.iv.byteLength/4);new p(W,Y,te,function(ae,ne){self.postMessage(M({source:X.source,decrypted:ne}),[ne.buffer])})}})),SO=MS(vO),_O=(e)=>{let n=e.default?"main":"alternative";if(e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0)n="main-desc";return n},e_=(e,n)=>{if(e.abort(),e.pause(),n&&n.activePlaylistLoader)n.activePlaylistLoader.pause(),n.activePlaylistLoader=null},h5=(e,n)=>{n.activePlaylistLoader=e,e.load()},xO=(e,n)=>()=>{let{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:a}}=n,r=a.activeTrack(),l=a.getActiveGroup(),{activePlaylistLoader:c,lastGroup_:p}=a;if(l&&p&&l.id===p.id)return;if(a.lastGroup_=l,a.lastTrack_=r,e_(i,a),!l||l.isMainPlaylist)return;if(!l.playlistLoader){if(c)s.resetEverything();return}i.resyncLoader(),h5(l.playlistLoader,a)},kO=(e,n)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=n;s.lastGroup_=null,i.abort(),i.pause()},TO=(e,n)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:a},mediaTypes:{[e]:r}}=n,l=r.activeTrack(),c=r.getActiveGroup(),{activePlaylistLoader:p,lastTrack_:m}=r;if(m&&l&&m.id===l.id)return;if(r.lastGroup_=c,r.lastTrack_=l,e_(s,r),!c)return;if(c.isMainPlaylist){if(!l||!m||l.id===m.id)return;let g=n.vhs.playlistController_,y=g.selectPlaylist();if(g.media()===y)return;r.logger_(`track change. Switching main audio from ${m.id} to ${l.id}`),i.pause(),a.resetEverything(),g.fastQualityChange_(y);return}if(e==="AUDIO"){if(!c.playlistLoader){a.setAudio(!0),a.resetEverything();return}s.setAudio(!0),a.setAudio(!1)}if(p===c.playlistLoader){h5(c.playlistLoader,r);return}if(s.track)s.track(l);s.resetEverything(),h5(c.playlistLoader,r)},B1={AUDIO:(e,n)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:s}=n,a=i.activeTrack(),r=i.activeGroup(),l=(r.filter((p)=>p.default)[0]||r[0]).id,c=i.tracks[l];if(a===c){s({error:{message:"Problem encountered loading the default audio track."}});return}$e.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(let p in i.tracks)i.tracks[p].enabled=i.tracks[p]===c;i.onTrackChanged()},SUBTITLES:(e,n)=>()=>{let{mediaTypes:{[e]:i}}=n;$e.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let s=i.activeTrack();if(s)s.mode="disabled";i.onTrackChanged()}},W8={AUDIO:(e,n,i)=>{if(!n)return;let{tech:s,requestOptions:a,segmentLoaders:{[e]:r}}=i;n.on("loadedmetadata",()=>{let l=n.media();if(r.playlist(l,a),!s.paused()||l.endList&&s.preload()!=="none")r.load()}),n.on("loadedplaylist",()=>{if(r.playlist(n.media(),a),!s.paused())r.load()}),n.on("error",B1[e](e,i))},SUBTITLES:(e,n,i)=>{let{tech:s,requestOptions:a,segmentLoaders:{[e]:r},mediaTypes:{[e]:l}}=i;n.on("loadedmetadata",()=>{let c=n.media();if(r.playlist(c,a),r.track(l.activeTrack()),!s.paused()||c.endList&&s.preload()!=="none")r.load()}),n.on("loadedplaylist",()=>{if(r.playlist(n.media(),a),!s.paused())r.load()}),n.on("error",B1[e](e,i))}},AO={AUDIO:(e,n)=>{let{vhs:i,sourceType:s,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:l},mediaTypes:{[e]:{groups:c,tracks:p,logger_:m}},mainPlaylistLoader:g}=n,y=qp(g.main);if(!l[e]||Object.keys(l[e]).length===0){if(l[e]={main:{default:{default:!0}}},y)l[e].main.default.playlists=g.main.playlists}for(let x in l[e]){if(!c[x])c[x]=[];for(let I in l[e][x]){let M=l[e][x][I],H;if(y)m(`AUDIO group '${x}' label '${I}' is a main playlist`),M.isMainPlaylist=!0,H=null;else if(s==="vhs-json"&&M.playlists)H=new ch(M.playlists[0],i,r);else if(M.resolvedUri)H=new ch(M.resolvedUri,i,r);else if(M.playlists&&s==="dash")H=new N1(M.playlists[0],i,r,g);else H=null;if(M=Qn({id:I,playlistLoader:H},M),W8[e](e,M.playlistLoader,n),c[x].push(M),typeof p[I]>"u"){let X=new $e.AudioTrack({id:I,kind:_O(M),enabled:!1,language:M.language,default:M.default,label:I});p[I]=X}}}a.on("error",B1[e](e,n))},SUBTITLES:(e,n)=>{let{tech:i,vhs:s,sourceType:a,segmentLoaders:{[e]:r},requestOptions:l,main:{mediaGroups:c},mediaTypes:{[e]:{groups:p,tracks:m}},mainPlaylistLoader:g}=n;for(let y in c[e]){if(!p[y])p[y]=[];for(let x in c[e][y]){if(!s.options_.useForcedSubtitles&&c[e][y][x].forced)continue;let I=c[e][y][x],M;if(a==="hls")M=new ch(I.resolvedUri,s,l);else if(a==="dash"){if(!I.playlists.filter((X)=>X.excludeUntil!==1/0).length)return;M=new N1(I.playlists[0],s,l,g)}else if(a==="vhs-json")M=new ch(I.playlists?I.playlists[0]:I.resolvedUri,s,l);if(I=Qn({id:x,playlistLoader:M},I),W8[e](e,I.playlistLoader,n),p[y].push(I),typeof m[x]>"u"){let H=i.addRemoteTextTrack({id:x,kind:"subtitles",default:I.default&&I.autoselect,language:I.language,label:x},!1).track;m[x]=H}}}r.on("error",B1[e](e,n))},"CLOSED-CAPTIONS":(e,n)=>{let{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:a,tracks:r}}}=n;for(let l in s[e]){if(!a[l])a[l]=[];for(let c in s[e][l]){let p=s[e][l][c];if(!/^(?:CC|SERVICE)/.test(p.instreamId))continue;let m=i.options_.vhs&&i.options_.vhs.captionServices||{},g={label:c,language:p.language,instreamId:p.instreamId,default:p.default&&p.autoselect};if(m[g.instreamId])g=Qn(g,m[g.instreamId]);if(g.default===void 0)delete g.default;if(a[l].push(Qn({id:c},p)),typeof r[c]>"u"){let y=i.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;r[c]=y}}}}},t_=(e,n)=>{for(let i=0;i<e.length;i++){if(s3(n,e[i]))return!0;if(e[i].playlists&&t_(e[i].playlists,n))return!0}return!1},CO=(e,n)=>(i)=>{let{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:a}}}=n,r=s.media();if(!r)return null;let l=null;if(r.attributes[e])l=a[r.attributes[e]];let c=Object.keys(a);if(!l){if(e==="AUDIO"&&c.length>1&&qp(n.main))for(let p=0;p<c.length;p++){let m=a[c[p]];if(t_(m,r)){l=m;break}}else if(a.main)l=a.main;else if(c.length===1)l=a[c[0]]}if(typeof i>"u")return l;if(i===null||!l)return null;return l.filter((p)=>p.id===i.id)[0]||null},jO={AUDIO:(e,n)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=n;for(let s in i)if(i[s].enabled)return i[s];return null},SUBTITLES:(e,n)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=n;for(let s in i)if(i[s].mode==="showing"||i[s].mode==="hidden")return i[s];return null}},EO=(e,{mediaTypes:n})=>()=>{let i=n[e].activeTrack();if(!i)return null;return n[e].activeGroup(i)},qO=(e)=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((m)=>{AO[m](m,e)});let{mediaTypes:n,mainPlaylistLoader:i,tech:s,vhs:a,segmentLoaders:{["AUDIO"]:r,main:l}}=e;["AUDIO","SUBTITLES"].forEach((m)=>{n[m].activeGroup=CO(m,e),n[m].activeTrack=jO[m](m,e),n[m].onGroupChanged=xO(m,e),n[m].onGroupChanging=kO(m,e),n[m].onTrackChanged=TO(m,e),n[m].getActiveGroup=EO(m,e)});let c=n.AUDIO.activeGroup();if(c){let m=(c.filter((y)=>y.default)[0]||c[0]).id;if(n.AUDIO.tracks[m].enabled=!0,n.AUDIO.onGroupChanged(),n.AUDIO.onTrackChanged(),!n.AUDIO.getActiveGroup().playlistLoader)l.setAudio(!0);else l.setAudio(!1),r.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach((m)=>n[m].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach((m)=>n[m].onGroupChanging())});let p=()=>{n.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",p),s.remoteTextTracks().addEventListener("change",n.SUBTITLES.onTrackChanged),a.on("dispose",()=>{s.audioTracks().removeEventListener("change",p),s.remoteTextTracks().removeEventListener("change",n.SUBTITLES.onTrackChanged)}),s.clearTracks("audio");for(let m in n.AUDIO.tracks)s.audioTracks().addTrack(n.AUDIO.tracks[m])},DO=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((n)=>{e[n]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ml,activeTrack:Ml,getActiveGroup:Ml,onGroupChanged:Ml,onTrackChanged:Ml,lastTrack_:null,logger_:Fr(`MediaGroups[${n}]`)}}),e};class f5{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){if(e===1)this.version_=e}set ttl(e){this.ttl_=e||300}set reloadUri(e){if(e)this.reloadUri_=Pa(this.reloadUri_,e)}set priority(e){if(e&&e.length)this.priority_=e}set pathwayClones(e){if(e&&e.length)this.pathwayClones_=new Map(e.map((n)=>[n.ID,n]))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class n_ extends $e.EventTarget{constructor(e,n){super();this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new f5,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Fr("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";let i=n.serverUri||n.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}if(this.steeringManifest.reloadUri=Pa(e,i),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart)this.trigger("content-steering")}requestSteeringManifest(e){let n=this.steeringManifest.reloadUri;if(!n)return;let i=e?n:this.getRequestURI(n);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}let s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(a,r)=>{if(a){if(r.status===410){this.logger_(`manifest request 410 ${a}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(r.status===429){let p=r.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${a}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${a}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){let m={errorType:$e.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(l);let c={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){let n=new je.default.URL(e),i=new je.default.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let n=JSON.parse(je.default.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){let n=new je.default.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){let a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,i)}if(s){let a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,s)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}if(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,!this.availablePathways_.size)this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose();let i=((s)=>{for(let a of s)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);if(this.currentPathway!==i)this.currentPathway=i,this.trigger("content-steering")}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let n=(s)=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){let s=this.setProxyServerUrl_(e);if(!n(s))return s}let i=this.setSteeringParams_(e);if(!n(i))return i;return null}startTTLTimeout_(e=this.steeringManifest.ttl){let n=e*1000;this.ttlTimeout_=je.default.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){je.default.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){if(this.request_)this.request_.abort();this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new f5}addAvailablePathway(e){if(e)this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(Pa(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}var IO=(e,n)=>{let i=null;return(...s)=>{clearTimeout(i),i=setTimeout(()=>{e.apply(null,s)},n)}},MO=10,Dl,RO=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],OO=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},FO=function({currentPlaylist:e,buffered:n,currentTime:i,nextPlaylist:s,bufferLowWaterLine:a,bufferHighWaterLine:r,duration:l,bufferBasedABR:c,log:p}){if(!s)return $e.log.warn("We received no playlist to switch to. Please check your stream."),!1;let m=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return p(`${m} as current playlist is not set`),!0;if(s.id===e.id)return!1;let g=Boolean(Qf(n,i).length);if(!e.endList){if(!g&&typeof e.partTargetDuration==="number")return p(`not ${m} as current playlist is live llhls, but currentTime isn't in buffered.`),!1;return p(`${m} as current playlist is live`),!0}let y=t3(n,i),x=c?Ds.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ds.MAX_BUFFER_LOW_WATER_LINE;if(l<x)return p(`${m} as duration < max low water line (${l} < ${x})`),!0;let I=s.attributes.BANDWIDTH,M=e.attributes.BANDWIDTH;if(I<M&&(!c||y<r)){let H=`${m} as next bandwidth < current bandwidth (${I} < ${M})`;if(c)H+=` and forwardBuffer < bufferHighWaterLine (${y} < ${r})`;return p(H),!0}if((!c||I>M)&&y>=a){let H=`${m} as forwardBuffer >= bufferLowWaterLine (${y} >= ${a})`;if(c)H+=` and next bandwidth > current bandwidth (${I} > ${M})`;return p(H),!0}return p(`not ${m} as no switching criteria met`),!1};class i_ extends $e.EventTarget{constructor(e){super();this.fastQualityChange_=IO(this.fastQualityChange_.bind(this),100);let{src:n,withCredentials:i,tech:s,bandwidth:a,externVhs:r,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:p,sourceType:m,cacheEncryptionKeys:g,bufferBasedABR:y,leastPixelDiffSelector:x,captionServices:I,experimentalUseMMS:M}=e;if(!n)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:H}=e;if(H===null||typeof H>"u")H=1/0;if(Dl=r,this.bufferBasedABR=Boolean(y),this.leastPixelDiffSelector=Boolean(x),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=H,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_)this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType="";if(this.requestOptions_={withCredentials:i,maxPlaylistRetries:H,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=DO(),M&&je.default.ManagedMediaSource)this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new je.default.ManagedMediaSource,this.usingManagedMediaSource_=!0,$e.log("Using ManagedMediaSource");else if(je.default.MediaSource)this.mediaSource=new je.default.MediaSource;this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Is(),this.hasPlayed_=!1,this.syncController_=new JS(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new SO,this.sourceUpdater_=new o3(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new ZS,this.keyStatusMap_=new Map;let X={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:I,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:g,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new N1(n,this.vhs_,Qn(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ch(n,this.vhs_,Qn(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new P1(Qn(X,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new P1(Qn(X,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new YS(Qn(X,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((te,ae)=>{function ne(){s.off("vttjserror",oe),te()}function oe(){s.off("vttjsloaded",ne),ae()}s.one("vttjsloaded",ne),s.one("vttjserror",oe),s.addWebVttScript_()})}),e);let W=()=>this.mainSegmentLoader_.bandwidth;if(this.contentSteeringController_=new n_(this.vhs_.xhr,W),this.setupSegmentLoaderListeners_(),this.bufferBasedABR)this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_());if(RO.forEach((te)=>{this[te+"_"]=OO.bind(this,te)}),this.logger_=Fr("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none")this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_);else this.mainPlaylistLoader_.load();this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;let Y=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(Y,()=>{let te=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-te,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();if(e===-1||n===-1)return-1;return e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let n=this.selectPlaylist();if(n&&this.shouldSwitchToMedia_(n))this.switchMedia_(n,e)}switchMedia_(e,n,i){let s=this.media(),a=s&&(s.id||s.uri),r=e&&(e.id||e.uri);if(a&&a!==r){this.logger_(`switch media ${a} -> ${r} from ${n}`);let l={renditionInfo:{id:r,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e)=>{let n=this.mediaTypes_[e],i=n?n.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){let r=(i.length?i[0].playlists:i.playlists).filter((l)=>l.attributes.serviceLocation===s);if(r.length)this.mediaTypes_[e].activePlaylistLoader.media(r[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=je.default.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){if(this.tech_.scrubbing&&this.tech_.scrubbing())return;je.default.clearInterval(this.abrTimer_),this.abrTimer_=null}getAudioTrackPlaylists_(){let e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;let i=e.mediaGroups.AUDIO,s=Object.keys(i),a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{let l=i.main||s.length&&i[s[0]];for(let c in l)if(l[c].default){a={label:c};break}}if(!a)return n;let r=[];for(let l in i)if(i[l][a.label]){let c=i[l][a.label];if(c.playlists&&c.playlists.length)r.push.apply(r,c.playlists);else if(c.uri)r.push(c);else if(e.playlists.length)for(let p=0;p<e.playlists.length;p++){let m=e.playlists[p];if(m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l)r.push(m)}}if(!r.length)return n;return r}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{let n=this.mainPlaylistLoader_.media(),i=n.targetDuration*1.5*1000;if(e5(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=i;if(n.endList&&this.tech_.preload()!=="none")this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load();if(qO({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media())this.trigger("selectedinitialmedia");else this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{if(this.loadOnPlay_)this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist)i=this.selectInitialPlaylist();if(!i)i=this.selectPlaylist();if(!i||!this.shouldSwitchToMedia_(i))return;if(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{let n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let n=this.mainPlaylistLoader_.media(),i=n.targetDuration*1.5*1000;if(e5(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media()))this.requestOptions_.timeout=0;else this.requestOptions_.timeout=i;if(this.sourceType_==="dash"){if(this.mainPlaylistLoader_.isPaused)this.mainPlaylistLoader_.load()}if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();else this.mainSegmentLoader_.load();this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;if(this.stuckAtPlaylistEnd_(n))this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck")}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach((n)=>{this.mainPlaylistLoader_.on(n,(i)=>{this.player_.trigger(Ri({},i))})})}handleUpdatedMediaPlaylist(e){if(this.useCueTags_)this.updateAdCues_(e);if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_)this.runFastQualitySwitch_();if(this.updateDuration(!e.endList),!this.tech_.paused()){if(this.mainSegmentLoader_.load(),this.audioSegmentLoader_)this.audioSegmentLoader_.load()}}triggerPresenceUsage_(e,n){let i=e.mediaGroups||{},s=!0,a=Object.keys(i.AUDIO);for(let r in i.AUDIO)for(let l in i.AUDIO[r])if(!i.AUDIO[r][l].uri)s=!1;if(s)this.tech_.trigger({type:"usage",name:"vhs-demuxed"});if(Object.keys(i.SUBTITLES).length)this.tech_.trigger({type:"usage",name:"vhs-webvtt"});if(Dl.Playlist.isAes(n))this.tech_.trigger({type:"usage",name:"vhs-aes"});if(a.length&&Object.keys(i.AUDIO[a[0]]).length>1)this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"});if(this.useCueTags_)this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){let n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),r=this.tech_.buffered();return FO({buffered:r,currentTime:i,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){if(this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{if(this.bufferBasedABR)this.mainSegmentLoader_.load()}),!this.bufferBasedABR)this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")});this.mainSegmentLoader_.on("error",()=>{let i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{let i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;let s=i.segment.syncInfo.end+0.01;this.tech_.setCurrentTime(s)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{if(this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}),this.mainSegmentLoader_.on("earlyabort",(i)=>{if(this.bufferBasedABR)return;this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:MO})});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let i=this.getCodecsOrExclude_();if(!i)return;this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{if(!this.triggeredFmp4Usage)this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0}),this.audioSegmentLoader_.on("fmp4",()=>{if(!this.triggeredFmp4Usage)this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach((i)=>{this.mainSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ri({},s))}),this.audioSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ri({},s))}),this.subtitleSegmentLoader_.on(i,(s)=>{this.player_.trigger(Ri({},s))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){if(this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.load();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.load()}pause(){if(this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){if(this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}play(){if(this.setupFirstPlay())return;if(this.tech_.ended())this.tech_.setCurrentTime(0);if(this.hasPlayed_)this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}}setupFirstPlay(){let e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){let n=this.seekable();if(!n.length)return!1;let i=n.end(0),s=i;if(e.start){let a=e.start.timeOffset;if(a<0){let r=this.mainPlaylistLoader_.main,l=Dl.Playlist.liveEdgeDelay(r,e),c=i+l;s=Math.max(Math.min(c+a,i),n.start(0))}else s=Math.min(i,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){let e=this.tech_.play();if(typeof e<"u"&&typeof e.then==="function")e.then(null,(n)=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let n=this.mainSegmentLoader_.getCurrentMediaInfo_();if(!n||n.hasVideo)e=e&&this.audioSegmentLoader_.ended_;else e=this.audioSegmentLoader_.ended_}if(!e)return;this.stopABRTimer_(),this.sourceUpdater_.endOfStream()}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;let s=Dl.Playlist.playlistEnd(e,i),a=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return s-a<=No;let l=r.end(r.length-1);return l-a<=No&&s-l<=No}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){if(this.error=n,this.mediaSource.readyState!=="open")this.trigger("error");else this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let s=this.mainPlaylistLoader_.main.playlists,a=s.filter(bb),r=a.length===1&&a[0]===e;if(s.length===1&&i!==1/0)return $e.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){let I=this.pathwayAttribute_(e),M=this.contentSteeringController_.steeringManifest.ttl*1000;this.contentSteeringController_.excludePathway(I),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(I)},M);return}let x=!1;if(s.forEach((I)=>{if(I===e)return;let M=I.excludeUntil;if(typeof M<"u"&&M!==1/0)x=!0,delete I.excludeUntil}),x)$e.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist")}let l;if(e.playlistErrors_>this.maxPlaylistRetries)l=1/0;else l=Date.now()+i*1000;if(e.excludeUntil=l,n.reason)e.lastExcludeReason_=n.reason;this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let p=n.internal?this.logger_:$e.log.warn,m=n.message?" "+n.message:"";if(p(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO)this.delegateLoaders_("audio",["abort","pause"]);if(c.attributes.SUBTITLES!==e.attributes.SUBTITLES)this.delegateLoaders_("subtitle",["abort","pause"]);this.delegateLoaders_("main",["abort","pause"]);let g=c.targetDuration/2*1000||5000,y=typeof c.lastRequest==="number"&&Date.now()-c.lastRequest<=g;return this.switchMedia_(c,"exclude",r||y)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){let i=[],s=e==="all";if(s||e==="main")i.push(this.mainPlaylistLoader_);let a=[];if(s||e==="audio")a.push("AUDIO");if(s||e==="subtitle")a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES");a.forEach((r)=>{let l=this.mediaTypes_[r]&&this.mediaTypes_[r].activePlaylistLoader;if(l)i.push(l)}),["main","audio","subtitle"].forEach((r)=>{let l=this[`${r}SegmentLoader_`];if(l&&(e===r||e==="all"))i.push(l)}),i.forEach((r)=>n.forEach((l)=>{if(typeof r[l]==="function")r[l]()}))}setCurrentTime(e){let n=Qf(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()))return 0;if(!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;if(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader)this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything();if(this.mediaTypes_.SUBTITLES.activePlaylistLoader)this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything();this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();if(!e)return 0;if(!e.endList)return 1/0;if(this.mediaSource)return this.mediaSource.duration;return Dl.Playlist.duration(e)}seekable(){return this.seekable_}getSeekableRange_(e,n){let i=e.media();if(!i)return null;let s=this.syncController_.getMediaSequenceSync(n);if(s&&s.isReliable){let{start:l,end:c}=s;if(!isFinite(l)||!isFinite(c))return null;let p=Dl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(l,c-p);return Is([[l,m]])}let a=this.syncController_.getExpiredTime(i,this.duration());if(a===null)return null;let r=Dl.Playlist.seekable(i,a,Dl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return r.length?r:null}computeFinalSeekable_(e,n){if(!n)return e;let i=e.start(0),s=e.end(0),a=n.start(0),r=n.end(0);if(a>s||i>r)return e;return Is([[Math.max(i,a),Math.min(s,r)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;let e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let n;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(n=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!n)return}let i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,n),!this.seekable_)return;if(i&&i.length&&this.seekable_.length){if(i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return}this.logger_(`seekable updated [${oS(this.seekable_)}]`);let s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_)this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null;if(this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){let s=this.seekable();if(!s.length)return;if(isNaN(this.mediaSource.duration)||this.mediaSource.duration<s.end(s.length-1))this.sourceUpdater_.setDuration(s.end(s.length-1));return}let n=this.tech_.buffered(),i=Dl.Playlist.duration(this.mainPlaylistLoader_.media());if(n.length>0)i=Math.max(i,n.end(n.length-1));if(this.mediaSource.duration!==i)this.sourceUpdater_.setDuration(i)}dispose(){if(this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_)this.tech_.off("play",this.loadOnPlay_);if(["AUDIO","SUBTITLES"].forEach((e)=>{let n=this.mediaTypes_[e].groups;for(let i in n)n[i].forEach((s)=>{if(s.playlistLoader)s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_)this.mediaSource.removeEventListener("sourceopen",this.updateDuration_);this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e?!0:!!this.audioSegmentLoader_.getCurrentMediaInfo_();if(!n||!i)return!1;return!0}getCodecsOrExclude_(){let e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;let i=Sp(this.main(),n),s={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo)s.video=i.video||e.main.videoCodec||C6;if(e.main.isMuxed)s.video+=`,${i.audio||e.main.audioCodec||Gw}`;if(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Gw,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4;if(!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let r=(p,m)=>p?Df(m,this.usingManagedMediaSource_):$g(m),l={},c;if(["video","audio"].forEach(function(p){if(s.hasOwnProperty(p)&&!r(e[p].isFmp4,s[p])){let m=e[p].isFmp4?"browser":"muxer";if(l[m]=l[m]||[],l[m].push(s[p]),p==="audio")c=m}}),a&&c&&n.attributes.AUDIO){let p=n.attributes.AUDIO;this.main().playlists.forEach((m)=>{if((m.attributes&&m.attributes.AUDIO)===p&&m!==n)m.excludeUntil=1/0}),this.logger_(`excluding audio group ${p} as ${c} does not support codec(s): "${s.audio}"`)}if(Object.keys(l).length){let p=Object.keys(l).reduce((m,g)=>{if(m)m+=", ";return m+=`${g} does not support codec(s): "${l[g].join(",")}"`,m},"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let p=[];if(["video","audio"].forEach((m)=>{let g=(eo(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,y=(eo(s[m]||"")[0]||{}).type;if(g&&y&&g.toLowerCase()!==y.toLowerCase())p.push(`"${this.sourceUpdater_.codecs[m]}" -> "${s[m]}"`)}),p.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){let e=this.main().playlists,n=[];Object.keys(e).forEach((i)=>{let s=e[i];if(n.indexOf(s.id)!==-1)return;n.push(s.id);let a=Sp(this.main,s),r=[];if(a.audio&&!$g(a.audio)&&!Df(a.audio,this.usingManagedMediaSource_))r.push(`audio codec ${a.audio}`);if(a.video&&!$g(a.video)&&!Df(a.video,this.usingManagedMediaSource_))r.push(`video codec ${a.video}`);if(a.text&&a.text==="stpp.ttml.im1t")r.push(`text codec ${a.text}`);if(r.length)s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${r.join(", ")}`)})}excludeIncompatibleVariants_(e){let n=[],i=this.main().playlists,s=Ap(eo(e)),a=I8(s),r=s.video&&eo(s.video)[0]||null,l=s.audio&&eo(s.audio)[0]||null;Object.keys(i).forEach((c)=>{let p=i[c];if(n.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;n.push(p.id);let m=[],g=Sp(this.mainPlaylistLoader_.main,p),y=I8(g);if(!g.audio&&!g.video)return;if(y!==a)m.push(`codec count "${y}" !== "${a}"`);if(!this.sourceUpdater_.canChangeType()){let x=g.video&&eo(g.video)[0]||null,I=g.audio&&eo(g.audio)[0]||null;if(x&&r&&x.type.toLowerCase()!==r.type.toLowerCase())m.push(`video codec "${x.type}" !== "${r.type}"`);if(I&&l&&I.type.toLowerCase()!==l.type.toLowerCase())m.push(`audio codec "${I.type}" !== "${l.type}"`)}if(m.length)p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${m.join(" && ")}`)})}updateAdCues_(e){let n=0,i=this.seekable();if(i.length)n=i.start(0);wO(e,this.cueTagsTrack_,n)}goalBufferLength(){let e=this.tech_.currentTime(),{GOAL_BUFFER_LENGTH:n,GOAL_BUFFER_LENGTH_RATE:i}=Ds,s=Math.max(n,Ds.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*i,s)}bufferLowWaterLine(){let e=this.tech_.currentTime(),{BUFFER_LOW_WATER_LINE:n,BUFFER_LOW_WATER_LINE_RATE:i}=Ds,s=Math.max(n,Ds.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,Ds.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*i,this.bufferBasedABR?a:s)}bufferHighWaterLine(){return Ds.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){L8(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ZR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,i){let s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();L8(this.inbandTextTracks_,e,this.tech_),YR({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(!e.contentSteering)return;for(let n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){if(this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach((n)=>{this.contentSteeringController_.on(n,(i)=>{this.trigger(Ri({},i))})}),this.sourceType_==="dash")this.mainPlaylistLoader_.on("loadedplaylist",()=>{let n=this.main();if(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{let a=this.contentSteeringController_.getAvailablePathways(),r=[];for(let l of n.playlists){let c=l.attributes.serviceLocation;if(c){if(r.push(c),!a.has(c))return!0}}if(!r.length&&a.size)return!0;return!1})())this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let i=this.main().playlists,s=new Set,a=!1;if(Object.keys(i).forEach((r)=>{let l=i[r],c=this.pathwayAttribute_(l),p=c&&e!==c;if(l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!p)delete l.excludeUntil,delete l.lastExcludeReason_,a=!0;let g=!l.excludeUntil&&l.excludeUntil!==1/0;if(!(!s.has(l.id)&&p&&g))return;s.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`)}),this.contentSteeringController_.manifestType_==="DASH")Object.keys(this.mediaTypes_).forEach((r)=>{let l=this.mediaTypes_[r];if(l.activePlaylistLoader){let c=l.activePlaylistLoader.media_;if(c&&c.attributes.serviceLocation!==e)a=!0}});if(a)this.changeSegmentPathway_()}handlePathwayClones_(){let n=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(!(i&&i.size||s&&s.size))return;for(let[r,l]of i.entries())if(!s.get(r))this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(r);for(let[r,l]of s.entries()){let c=i.get(r);if(!c){n.filter((m)=>m.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach((m)=>{this.mainPlaylistLoader_.addClonePathway(l,m)}),this.contentSteeringController_.addAvailablePathway(r);continue}if(this.equalPathwayClones_(c,l))continue;this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(r)}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,s=n["URI-REPLACEMENT"].PARAMS;for(let a in i)if(i[a]!==s[a])return!1;for(let a in s)if(i[a]!==s[a])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();if(this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH")this.switchMediaForDASHContentSteering_();this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,n="non-usable";if(this.mainPlaylistLoader_.main.playlists.forEach((i)=>{let s=this.mainPlaylistLoader_.getKeyIdSet(i);if(!s||!s.size)return;s.forEach((a)=>{let l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)==="usable",c=i.lastExcludeReason_===n&&i.excludeUntil===1/0;if(!l){if(i.excludeUntil!==1/0&&i.lastExcludeReason_!==n)i.excludeUntil=1/0,i.lastExcludeReason_=n,this.logger_(`excluding playlist ${i.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not usable`);e++}else if(l&&c)delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${a} is usable`)})}),e>=this.mainPlaylistLoader_.main.playlists.length)this.mainPlaylistLoader_.main.playlists.forEach((i)=>{let s=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,a=i.excludeUntil===1/0&&i.lastExcludeReason_===n;if(s&&a)delete i.excludeUntil,$e.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${n} key IDs`)})}addKeyStatus_(e,n){let a=(typeof e==="string"?e:gO(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){if(this.addKeyStatus_(e,n),!this.waitingForFastQualityPlaylistReceived_)this.excludeNonUsableThenChangePlaylist_();this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}var NO=(e,n,i)=>(s)=>{let a=e.main.playlists[n],r=i3(a),l=bb(a);if(typeof s>"u")return l;if(s)delete a.disabled;else a.disabled=!0;let c={renditionInfo:{id:n,bandwidth:a.attributes.BANDWIDTH,resolution:a.attributes.RESOLUTION,codecs:a.attributes.CODECS},cause:"fast-quality"};if(s!==l&&!r)if(s)i(a),e.trigger({type:"renditionenabled",metadata:c});else e.trigger({type:"renditiondisabled",metadata:c});return s};class s_{constructor(e,n,i){let{playlistController_:s}=e,a=s.fastQualityChange_.bind(s);if(n.attributes){let r=n.attributes.RESOLUTION;this.width=r&&r.width,this.height=r&&r.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=Sp(s.main(),n),this.playlist=n,this.id=i,this.enabled=NO(e.playlists,n.id,a)}}var PO=function(e){e.representations=()=>{let n=e.playlistController_.main(),i=qp(n)?e.playlistController_.getAudioTrackPlaylists_():n.playlists;if(!i)return[];return i.filter((s)=>!i3(s)).map((s,a)=>new s_(e,s,s.id))}},K8=["seeking","seeked","pause","playing","error"];class a_ extends $e.EventTarget{constructor(e){super();this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Fr("PlaybackWatcher"),this.logger_("initialize");let n=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),r=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach((m)=>{c[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},r[`${m}SegmentLoader_`].on("appendsdone",c[m].updateend),r[`${m}SegmentLoader_`].on("playlistupdate",c[m].reset),this.tech_.on(["seeked","seeking"],c[m].reset)});let p=(m)=>{["main","audio"].forEach((g)=>{r[`${g}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{if(this.fixesBadSeeks_())this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off")},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(K8,a),this.tech_.on("canplay",i),this.tech_.one("play",n),this.dispose=()=>{if(this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(K8,a),this.tech_.off("canplay",i),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach((m)=>{r[`${m}SegmentLoader_`].off("appendsdone",c[m].updateend),r[`${m}SegmentLoader_`].off("playlistupdate",c[m].reset),this.tech_.off(["seeked","seeking"],c[m].reset)}),this.checkCurrentTimeTimeout_)je.default.clearTimeout(this.checkCurrentTimeTimeout_);this.resetTimeUpdate_()}}monitorCurrentTime_(){if(this.checkCurrentTime_(),this.checkCurrentTimeTimeout_)je.default.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=je.default.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let n=this.playlistController_[`${e}SegmentLoader_`];if(this[`${e}StalledDownloads_`]>0)this.logger_(`resetting possible stalled download count for ${e} loader`);this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){let n=this.playlistController_,i=n[`${e}SegmentLoader_`],s=i.buffered_(),a=IM(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,a){let r={bufferedRanges:s};n.trigger({type:"bufferedrangeschanged",metadata:r}),this.resetSegmentDownloads_(e);return}if(this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:lh(s)}),this[`${e}StalledDownloads_`]<10)return;if(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e==="subtitle")return;n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+No>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Is([this.lastRecordedTime,e]));let i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;let n=this.seekable(),i=this.tech_.currentTime(),s=this.afterSeekableWindow_(n,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow),a;if(s)a=n.end(n.length-1);if(this.beforeSeekableWindow_(n,i)){let I=n.start(0);a=I+(I===n.end(0)?0:No)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${oS(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;let r=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=r.audioBuffer?r.audioBuffered():null,p=r.videoBuffer?r.videoBuffered():null,m=this.media(),g=m.partTargetDuration?m.partTargetDuration:(m.targetDuration-Fo)*2,y=[c,p];for(let I=0;I<y.length;I++){if(!y[I])continue;if(t3(y[I],i)<g)return!1}let x=p1(l,i);if(x.length===0)return!1;return a=x.start(0)+No,this.logger_(`Buffered region starts (${x.start(0)}) just beyond seek point (${i}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0}waiting_(){if(this.techWaiting_())return;let e=this.tech_.currentTime(),n=this.tech_.buffered(),i=Qf(n,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){let l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let r=p1(s,n);if(r.length>0)return this.logger_(`Stopped at ${n} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0;return!1}afterSeekableWindow_(e,n,i,s=!1){if(!e.length)return!1;let a=e.end(e.length-1)+No,r=!i.endList,l=typeof i.partTargetDuration==="number";if(r&&(l||s))a=e.end(e.length-1)+i.targetDuration*3;if(n>a)return!0;return!1}beforeSeekableWindow_(e,n){if(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)return!0;return!1}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:i}){if(!e)return;let s;if(e.length&&n.length){let a=Qf(e,i-3),r=Qf(e,i),l=Qf(n,i);if(l.length&&!r.length&&a.length)s={start:a.end(0),end:l.end(0)}}else if(!p1(e,i).length)s=this.gapFromVideoUnderflow_(e,i);if(s)return this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0;return!1}skipTheGap_(e){let n=this.tech_.buffered(),i=this.tech_.currentTime(),s=p1(n,i);if(this.resetTimeUpdate_(),s.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+Fo);let a={gapInfo:{from:i,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:a}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,n){let i=EM(e);for(let s=0;s<i.length;s++){let a=i.start(s),r=i.end(s);if(n-a<4&&n-a>2)return{start:a,end:r}}return null}}var BO={errorInterval:30,getSource(e){let i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return e(i)}},r_=function(e,n){let i=0,s=0,a=Qn(BO,n);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let r=function(){if(s)e.currentTime(s)},l=function(g){if(g===null||g===void 0)return;s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(g),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play()},c=function(){if(Date.now()-i<a.errorInterval*1000){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!a.getSource||typeof a.getSource!=="function"){$e.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),a.getSource.call(e,l)},p=function(){e.off("loadedmetadata",r),e.off("error",c),e.off("dispose",p)},m=function(g){p(),r_(e,g)};e.on("error",c),e.on("dispose",p),e.reloadSourceOnError=m},LO=function(e){r_(this,e)},o_="3.17.5",HO="7.1.0",UO="1.4.0",zO="7.2.0",GO="4.0.2",Oi={PlaylistLoader:ch,Playlist:Ba,utils:sR,STANDARD_PLAYLIST_SELECTOR:B8,INITIAL_PLAYLIST_SELECTOR:VR,lastBandwidthSelector:B8,movingAverageBandwidthSelector:zR,comparePlaylistBandwidth:r3,comparePlaylistResolution:UR,xhr:AS()};Object.keys(Ds).forEach((e)=>{Object.defineProperty(Oi,e,{get(){return $e.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Ds[e]},set(n){if($e.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),typeof n!=="number"||n<0){$e.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}Ds[e]=n}})});var l_="videojs-vhs",c_=function(e,n){let i=n.media(),s=-1;for(let a=0;a<e.length;a++)if(e[a].id===i.id){s=a;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})},VO=function(e,n){n.representations().forEach((i)=>{e.addQualityLevel(i)}),c_(e,n.playlists)};Oi.canPlaySource=function(){return $e.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};var XO=(e,n,i)=>{if(!e)return e;let s={};if(n&&n.attributes&&n.attributes.CODECS)s=Ap(eo(n.attributes.CODECS));if(i&&i.attributes&&i.attributes.CODECS)s.audio=i.attributes.CODECS;let a=nh(s.video),r=nh(s.audio),l={};for(let c in e){if(l[c]={},r)l[c].audioContentType=r;if(a)l[c].videoContentType=a;if(n.contentProtection&&n.contentProtection[c]&&n.contentProtection[c].pssh)l[c].pssh=n.contentProtection[c].pssh;if(typeof e[c]==="string")l[c].url=e[c]}return Qn(e,l)},WO=(e,n)=>e.reduce((i,s)=>{if(!s.contentProtection)return i;let a=n.reduce((r,l)=>{let c=s.contentProtection[l];if(c&&c.pssh)r[l]={pssh:c.pssh};return r},{});if(Object.keys(a).length)i.push(a);return i},[]),KO=({player:e,sourceKeySystems:n,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let a=i?s.concat([i]):s,r=WO(a,Object.keys(n)),l=[],c=[];return r.forEach((p)=>{c.push(new Promise((m,g)=>{e.tech_.one("keysessioncreated",m)})),l.push(new Promise((m,g)=>{e.eme.initializeMediaKeys({keySystems:p},(y)=>{if(y){g(y);return}m()})}))}),Promise.race([Promise.all(l),Promise.race(c)])},$O=({player:e,sourceKeySystems:n,media:i,audioMedia:s})=>{let a=XO(n,i,s);if(!a)return!1;if(e.currentSource().keySystems=a,a&&!e.eme)return $e.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1;return!0},h_=()=>{if(!je.default.localStorage)return null;let e=je.default.localStorage.getItem(l_);if(!e)return null;try{return JSON.parse(e)}catch(n){return null}},YO=(e)=>{if(!je.default.localStorage)return!1;let n=h_();n=n?Qn(n,e):e;try{je.default.localStorage.setItem(l_,JSON.stringify(n))}catch(i){return!1}return n},QO=(e)=>{if(e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0)return JSON.parse(e.substring(e.indexOf(",")+1));return e},f_=(e,n)=>{if(!e._requestCallbackSet)e._requestCallbackSet=new Set;e._requestCallbackSet.add(n)};var p_=(e,n)=>{if(!e._responseCallbackSet)e._responseCallbackSet=new Set;e._responseCallbackSet.add(n)},m_=(e,n)=>{if(!e._requestCallbackSet)return;if(e._requestCallbackSet.delete(n),!e._requestCallbackSet.size)delete e._requestCallbackSet},g_=(e,n)=>{if(!e._responseCallbackSet)return;if(e._responseCallbackSet.delete(n),!e._responseCallbackSet.size)delete e._responseCallbackSet};Oi.supportsNativeHls=function(){if(!Et.default||!Et.default.createElement)return!1;let e=Et.default.createElement("video");if(!$e.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(e.canPlayType(i))})}();Oi.supportsNativeDash=function(){if(!Et.default||!Et.default.createElement||!$e.getTech("Html5").isSupported())return!1;return/maybe|probably/i.test(Et.default.createElement("video").canPlayType("application/dash+xml"))}();Oi.supportsTypeNatively=(e)=>{if(e==="hls")return Oi.supportsNativeHls;if(e==="dash")return Oi.supportsNativeDash;return!1};Oi.isSupported=function(){return $e.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Oi.xhr.onRequest=function(e){f_(Oi.xhr,e)};Oi.xhr.onResponse=function(e){p_(Oi.xhr,e)};Oi.xhr.offRequest=function(e){m_(Oi.xhr,e)};Oi.xhr.offResponse=function(e){g_(Oi.xhr,e)};var JO=$e.getComponent("Component");class c3 extends JO{constructor(e,n,i){super(n,i.vhs);if(typeof i.initialBandwidth==="number")this.options_.bandwidth=i.initialBandwidth;if(this.logger_=Fr("VhsHandler"),n.options_&&n.options_.playerId){let s=$e.getPlayer(n.options_.playerId);this.player_=s}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(Et.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(s)=>{let a=Et.default.fullscreenElement||Et.default.webkitFullscreenElement||Et.default.mozFullScreenElement||Et.default.msFullscreenElement;if(a&&a.contains(this.tech_.el()))this.playlistController_.fastQualityChange_();else this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){if(this.tech_.error()&&this.playlistController_)this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Qn(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions===!1?!1:!0,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls===!1?!1:!0,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!=="number")this.options_.playlistExclusionDuration=60;if(typeof this.options_.bandwidth!=="number"){if(this.options_.useBandwidthFromLocalStorage){let i=h_();if(i&&i.bandwidth)this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"});if(i&&i.throughput)this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})}}if(typeof this.options_.bandwidth!=="number")this.options_.bandwidth=Ds.INITIAL_BANDWIDTH;this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ds.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((i)=>{if(typeof this.source_[i]<"u")this.options_[i]=this.source_[i]}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;let n=this.options_.customPixelRatio;if(typeof n==="number"&&n>=0)this.customPixelRatio=n}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=QO(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Oi,this.options_.sourceType=Vw(n),this.options_.seekTo=(a)=>{this.tech_.setCurrentTime(a)},this.options_.player_=this.player_,this.playlistController_=new i_(this.options_);let i=Qn({liveRangeSafeTimeDelta:No},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new a_(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{let a=$e.players[this.tech_.options_.playerId],r=this.playlistController_.error;if(typeof r==="object"&&!r.code)r.code=3;else if(typeof r==="string")r={message:r,code:3};a.error(r)});let s=this.options_.bufferBasedABR?Oi.movingAverageBandwidthSelector(0.55):Oi.STANDARD_PLAYLIST_SELECTOR;if(this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=Oi.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth,r=je.default.navigator.connection||je.default.navigator.mozConnection||je.default.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&r){let c=r.downlink*1000*1000;if(c>=l&&a>=l)a=Math.max(a,c);else a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){let a=1/(this.bandwidth||1),r;if(this.throughput>0)r=1/this.throughput;else r=0;return Math.floor(1/(a+r))},set(){$e.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth)this.bandwidth=this.options_.bandwidth;if(this.options_.throughput)this.throughput=this.options_.throughput;if(Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>lh(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>lh(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage)YO({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{PO(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),!this.tech_.el())return;if(this.mediaSourceUrl_=je.default.URL.createObjectURL(this.playlistController_.mediaSource),($e.browser.IS_ANY_SAFARI||$e.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement==="function")this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src);else this.tech_.src(this.mediaSourceUrl_)}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),KO({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch((n)=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=$O({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",(i)=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=$e.players[this.tech_.options_.playerId];if(!e||!e.qualityLevels||this.qualityLevels_)return;this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{VO(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{c_(this.qualityLevels_,this.playlists)})}static version(){return{"@videojs/http-streaming":o_,"mux.js":HO,"mpd-parser":UO,"m3u8-parser":zO,"aes-decrypter":GO}}version(){return this.constructor.version()}canChangeType(){return o3.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){if(this.playbackWatcher_)this.playbackWatcher_.dispose();if(this.playlistController_)this.playlistController_.dispose();if(this.qualityLevels_)this.qualityLevels_.dispose();if(this.tech_&&this.tech_.vhs)delete this.tech_.vhs;if(this.mediaSourceUrl_&&je.default.URL.revokeObjectURL)je.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null;if(this.tech_)this.tech_.off("waitingforkey",this.handleWaitingForKey_);super.dispose()}convertToProgramTime(e,n){return hR({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,i=!0,s=2){return DS({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=(e)=>{f_(this.xhr,e)},this.xhr.onResponse=(e)=>{p_(this.xhr,e)},this.xhr.offRequest=(e)=>{m_(this.xhr,e)},this.xhr.offResponse=(e)=>{g_(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){let e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];e.forEach((i)=>{this.playlistController_.on(i,(s)=>{this.player_.trigger(Ri({},s))})}),n.forEach((i)=>{this.playbackWatcher_.on(i,(s)=>{this.player_.trigger(Ri({},s))})})}}var L1={name:"videojs-http-streaming",VERSION:o_,canHandleSource(e,n={}){let i=Qn($e.options,n);if(!i.vhs.experimentalUseMMS&&!Df("avc1.4d400d,mp4a.40.2",!1))return!1;return L1.canPlayType(e.type,i)},handleSource(e,n,i={}){let s=Qn($e.options,i);return n.vhs=new c3(e,n,s),n.vhs.xhr=AS(),n.vhs.setupXhrHooks_(),n.vhs.src(e.src,e.type),n.vhs},canPlayType(e,n){let i=Vw(e);if(!i)return"";let s=L1.getOverrideNative(n);return!Oi.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){let{vhs:n={}}=e,i=!($e.browser.IS_ANY_SAFARI||$e.browser.IS_IOS),{overrideNative:s=i}=n;return s}},ZO=()=>Df("avc1.4d400d,mp4a.40.2",!0);if(ZO())$e.getTech("Html5").registerSourceHandler(L1,0);$e.VhsHandler=c3;$e.VhsSourceHandler=L1;$e.Vhs=Oi;if(!$e.use)$e.registerComponent("Vhs",Oi);$e.options.vhs=$e.options.vhs||{};if(!$e.getPlugin||!$e.getPlugin("reloadSourceOnError"))$e.registerPlugin("reloadSourceOnError",LO);C();var eF=1000;function yb(e,n,i,s){let[a,r]=u(0),l=v(!1),c=v(!1),p=v(null),m=v(a);m.current=a,h(()=>{r(0);let y=e.current;if(!y)return;let x=()=>{c.current=!0},I=()=>{c.current=!1};return y.addEventListener("play",x),y.addEventListener("pause",I),c.current=!y.paused,()=>{y.removeEventListener("play",x),y.removeEventListener("pause",I)}},[e.current]),h(()=>{let y=e.current;if(!y)return;let x=null,I=null,M=!0,H=Date.now(),X=!1,W=-1,Y=()=>{H=Date.now(),X=!1,W=-1},te=()=>{if(!M)return;if(y.paused||y.ended)return;let me=y,be=!!me.requestVideoFrameCallback,xe=qc(n),Oe=Date.now()-H,Fe=X&&Oe>xe,Ue=!X&&Oe>eF;if(s||!be||Fe||Ue){let Le=Math.floor(y.currentTime*n+0.45),qe=Math.max(0,Math.min(Le,i-1));r(qe)}if(I=requestAnimationFrame(te),me.requestVideoFrameCallback&&x===null)x=me.requestVideoFrameCallback((Le,qe)=>{x=null,H=Date.now(),X=!0,W=qe.mediaTime;let Me=Math.floor(qe.mediaTime*n+0.45),yt=Math.max(0,Math.min(Me,i-1));r(yt)})},ae=()=>{Y(),te()},ne=()=>{if(x!==null){let Ue=y;if(Ue.cancelVideoFrameCallback)try{Ue.cancelVideoFrameCallback(x)}catch{}x=null}if(I!==null)cancelAnimationFrame(I),I=null;let me=qc(n),xe=X&&W>=0&&Date.now()-H<=me?W:y.currentTime,Oe=Math.floor(xe*n+0.45),Fe=Math.max(0,Math.min(Oe,i-1));if(r(Fe),!y.ended){let Ue=jc(Fe,n);y.currentTime=Ue}},oe=()=>{r(i-1)};if(y.addEventListener("play",ae),y.addEventListener("pause",ne),y.addEventListener("ended",oe),!y.paused)Y(),te();return()=>{if(M=!1,y.removeEventListener("play",ae),y.removeEventListener("pause",ne),y.removeEventListener("ended",oe),x!==null){let me=y;if(me.cancelVideoFrameCallback)try{me.cancelVideoFrameCallback(x)}catch{}}if(I!==null)cancelAnimationFrame(I)}},[e.current,n,i]);let g=N(async(y)=>{let x=e.current;if(!x)return;let I=Math.round(y),M=Math.max(0,Math.min(I,i-1));if(l.current){p.current=M,r(M);return}l.current=!0,r(M);let H=async(X)=>{let W=jc(X,n),Y=!x.paused;if(x.currentTime=W,await new Promise((oe)=>{let me=null,be=()=>{if(me)clearTimeout(me);x.removeEventListener("seeked",be),oe()};x.addEventListener("seeked",be),me=setTimeout(()=>{x.removeEventListener("seeked",be),oe()},500)}),!Y&&!c.current)x.pause();let te=Math.floor(x.currentTime*n+0.45),ae=Math.max(0,Math.min(te,i-1));r(ae);let ne=x;if(ne.requestVideoFrameCallback)ne.requestVideoFrameCallback((oe,me)=>{let be=Math.floor(me.mediaTime*n+0.45),xe=Math.max(0,Math.min(be,i-1));r(xe)});if(p.current!==null){let oe=p.current;p.current=null,await H(oe)}else l.current=!1};await H(M)},[e,n,i]);return h(()=>{let y=(x)=>{let I=x.target;if(I instanceof HTMLInputElement||I instanceof HTMLTextAreaElement||I.isContentEditable)return;if(x.key==="ArrowRight"){x.preventDefault();let M=x.shiftKey?10:1;g(m.current+M)}else if(x.key==="ArrowLeft"){x.preventDefault();let M=x.shiftKey?10:1;g(m.current-M)}};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[g]),h(()=>{let y=e.current;if(!y)return;let x=()=>{if(!l.current){let I=Math.floor(y.currentTime*n+0.45),M=Math.max(0,Math.min(I,i-1));r(M);let H=jc(M,n),X=1/n;if(Math.abs(y.currentTime-H)>X/4)y.currentTime=H}};return y.addEventListener("seeked",x),()=>{y.removeEventListener("seeked",x)}},[e.current,n,i]),{currentFrame:a,setCurrentFrame:r,seekToFrame:g,isSeeking:l}}C();var tF=(e)=>{if(isNaN(e))return"00:00";let n=new Date(e*1000),i=n.getUTCHours(),s=n.getUTCMinutes(),a=n.getUTCSeconds().toString().padStart(2,"0");if(i)return`${i}:${s.toString().padStart(2,"0")}:${a}`;return`${s}:${a}`},nF=({totalFrames:e,currentFrame:n,fps:i,previewUrl:s,onSeek:a,buffered:r=0,metadata:l})=>{let c=v(null),p=v(null),[m,g]=u(null),[y,x]=u(!1),[I,M]=u(!1),H=v(a);h(()=>{H.current=a},[a]),h(()=>{if(p.current&&s)p.current.load()},[s]);let X=N((Oe)=>{if(!c.current)return 0;let Fe=c.current.getBoundingClientRect();return Math.max(0,Math.min(Oe-Fe.left,Fe.width))/Fe.width},[]),W=N((Oe)=>{if(I)return;if(!c.current)return;let Fe=c.current.getBoundingClientRect(),ze=Math.max(0,Math.min(Oe.clientX-Fe.left,Fe.width))/Fe.width;if(g(ze),x(!0),p.current&&e){let Le=ze*e,qe=1/i,Me=Le*qe+qe/2,yt=p.current;if(Number.isFinite(Me))yt.currentTime=Me}},[e,i,I]),Y=()=>{if(!I)x(!1),g(null)},te=(Oe)=>{if(Oe.button!==0)return;Oe.preventDefault(),M(!0);let Fe=X(Oe.clientX);g(Fe),x(!0),H.current(Fe*e)},ae=(Oe)=>{M(!0);let Fe=X(Oe.touches[0].clientX);g(Fe),x(!0),H.current(Fe*e)};h(()=>{if(!I)return;let Oe=(Le)=>{let qe=X(Le.clientX);if(g(qe),x(!0),p.current&&e){let Me=qe*e,yt=1/i,Ge=Me*yt+yt/2,Qe=p.current;if(Number.isFinite(Ge))Qe.currentTime=Ge}H.current(qe*e)},Fe=(Le)=>{M(!1);let qe=!1;if(c.current){let yt=c.current.getBoundingClientRect();qe=Le.clientX>=yt.left&&Le.clientX<=yt.right&&Le.clientY>=yt.top&&Le.clientY<=yt.bottom}if(!qe)x(!1),g(null);let Me=X(Le.clientX);H.current(Me*e)},Ue=(Le)=>{if(Le.touches.length===0)return;let qe=X(Le.touches[0].clientX);if(g(qe),x(!0),p.current&&e){let Me=qe*e,yt=1/i,Ge=Me*yt+yt/2,Qe=p.current;if(Number.isFinite(Ge))Qe.currentTime=Ge}H.current(qe*e)},ze=(Le)=>{M(!1);let qe=Le.changedTouches.length>0?Le.changedTouches[0].clientX:null,Me=Le.changedTouches.length>0?Le.changedTouches[0].clientY:null,yt=!1;if(qe!==null&&Me!==null&&c.current){let Ge=c.current.getBoundingClientRect();yt=qe>=Ge.left&&qe<=Ge.right&&Me>=Ge.top&&Me<=Ge.bottom}if(!yt)x(!1),g(null);if(qe!==null){let Ge=X(qe);H.current(Ge*e)}};return window.addEventListener("mousemove",Oe),window.addEventListener("mouseup",Fe),window.addEventListener("touchmove",Ue,{passive:!0}),window.addEventListener("touchend",ze),()=>{window.removeEventListener("mousemove",Oe),window.removeEventListener("mouseup",Fe),window.removeEventListener("touchmove",Ue),window.removeEventListener("touchend",ze)}},[I,e,i,X]);let ne=I&&m!==null?m*100:e>0?n/e*100:0,oe=m!==null?m*100:0,me=()=>{if(m===null)return{};return{left:`${oe}%`,transform:`translateX(-${oe}%)`}},be=180,xe={width:`${be}px`,height:"auto"};if(l&&l.originalWidth&&l.originalHeight){let{originalWidth:Oe,originalHeight:Fe}=l;if(Oe>=Fe){let Ue=be*Fe/Oe;xe={width:`${be}px`,height:`${Ue}px`}}else xe={width:`${be*Oe/Fe}px`,height:`${be}px`}}return o("div",{ref:c,className:"group relative h-1.5 w-full cursor-pointer touch-none rounded-full bg-muted transition-colors duration-200",onMouseMove:W,onMouseLeave:Y,onMouseDown:te,onTouchStart:ae,"data-testid":"seekbar",children:[t("video",{ref:p,src:s,className:"hidden",preload:"auto",muted:!0,playsInline:!0}),y&&e>0&&t("div",{className:"pointer-events-none absolute bottom-full z-50 mb-3 flex w-max flex-col",style:me(),children:o("div",{className:"relative overflow-hidden rounded-lg border-2 border-border bg-popover shadow-2xl",children:[t("video",{src:s,className:"bg-black object-cover",style:xe,muted:!0,ref:(Oe)=>{if(Oe&&p.current)Oe.currentTime=p.current.currentTime}}),t("div",{className:"absolute bottom-0 w-full bg-popover/80 py-0.5 text-center text-xs font-medium text-popover-foreground",children:tF(m*e/i)})]})}),t("div",{className:"absolute top-0 left-0 h-full rounded-full bg-muted-foreground/30 transition-all duration-200",style:{width:`${r}%`}}),y&&t("div",{className:"absolute top-0 left-0 h-full rounded-full bg-primary/30",style:{width:`${oe}%`}}),t("div",{className:"relative absolute top-0 left-0 h-full rounded-full bg-primary",style:{width:`${ne}%`},"data-testid":"seekbar-fill",children:t("div",{className:E("absolute top-1/2 right-0 h-3.5 w-3.5 -translate-y-1/2 translate-x-1/2 rounded-full border border-border bg-primary shadow-md transition-transform duration-100",y||I?"scale-100":"scale-0 group-hover:scale-100")})})]})},vb=nF;var Zc=({state:e,zoom:n,isControlsVisible:i,buffered:s,data:a,resolutions:r,togglePlay:l,toggleLoop:c,toggleMute:p,handleVolumeChange:m,changePlaybackRate:g,changeResolution:y,handleDownload:x,toggleFullScreen:I,onZoomChange:M,onZoomReset:H,frameRate:X,totalFrames:W,currentFrame:Y,seekToFrame:te,floatOverlayInFullScreen:ae=!0,onMouseEnter:ne,onMouseLeave:oe,allowDownload:me=!0})=>{let{videoTimeDisplayMode:be,setVideoTimeDisplayMode:xe}=Ht();if(!a.media?.metadata)return null;let Oe=e.isFullScreen&&ae,Fe=a.proxyType==="audio",Ue=a.media?.metadata?.startTimecode,ze=Math.max(0,W-1),Le=be==="frames"?`${Y} / ${ze} fr`:be==="standard"?`${xn(Y,X,"standard")} / ${ds(W/X)}`:`${xn(Y,X,be,Ue)} / ${xn(ze,X,be,Ue)}`;return o("div",{className:E("transition-all duration-300 ease-in-out z-20 text-foreground",Oe?"absolute bottom-0 left-0 right-0 px-4 py-4 bg-card/90 backdrop-blur-md border-t border-border":"relative w-full bg-card border-t border-border px-4 py-3 z-10 transition-colors duration-200",i?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"),onMouseEnter:ne,onMouseLeave:oe,children:[t("div",{className:"mb-4 px-1",children:t(vb,{totalFrames:W,currentFrame:Y,fps:X,buffered:s,previewUrl:a.media.videoPreview?.url,onSeek:te,metadata:{...a.media.metadata,frameRate:X}})}),o("div",{className:"flex items-center justify-between text-foreground",children:[o("div",{className:"flex items-center gap-4",children:[t("button",{onClick:l,className:"hover:text-primary transition-colors","data-testid":"play-toggle","data-playing":e.isPlaying,"aria-label":e.isPlaying?"Pause":"Play",children:e.isPlaying?t(Hg,{className:"w-6 h-6 fill-current"}):t(Dc,{className:"w-6 h-6 fill-current"})}),t("button",{onClick:c,className:E("transition-colors",e.isLooping?"text-primary":"text-muted-foreground"),title:"Loop",children:t(Ug,{className:"w-5 h-5"})}),o("div",{className:"flex items-center gap-3 group/vol",children:[t("button",{onClick:p,className:"hover:text-primary",children:e.isMuted||e.volume===0?t(Gg,{className:"w-6 h-6"}):t(zg,{className:"w-6 h-6"})}),t("div",{className:"w-0 overflow-hidden group-hover/vol:w-24 transition-all duration-300 ease-in-out",children:t("div",{className:"w-24 px-1",children:t(Ea,{value:e.isMuted?[0]:[e.volume],onValueChange:(qe)=>m(qe[0]),max:1,step:0.05})})})]}),o("div",{className:"flex items-center gap-1 text-sm font-medium tabular-nums select-none min-w-[100px]",children:[t("span",{className:"text-muted-foreground font-mono","data-testid":"time-readout",children:Le}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t("button",{className:"h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer focus:outline-none",children:t(_e,{className:"h-3.5 w-3.5"})})}),o(Ae,{align:"start",className:"w-40 z-30",children:[t(qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Format"}),o(V,{onClick:()=>xe("standard"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Standard Time"}),be==="standard"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]}),o(V,{onClick:()=>xe("frames"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Frames"}),be==="frames"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]}),o(V,{onClick:()=>xe("timecode"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:"Timecode"}),be==="timecode"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]})]})]})]})]}),o("div",{className:"relative flex items-center gap-3",children:[!Fe&&o("div",{className:"flex items-center gap-1",children:[o("div",{className:"flex items-center gap-1 rounded-md bg-muted p-0.5",children:[t("button",{onClick:()=>M(n*0.8),className:"p-1 hover:text-primary rounded",title:mp(),children:t(ls,{size:14})}),o("span",{className:"text-xs w-8 text-center tabular-nums",children:[Math.round(n*100),"%"]}),t("button",{onClick:()=>M(n*1.2),className:"p-1 hover:text-primary rounded",title:pp(),children:t(de,{size:14})})]}),t("button",{onClick:H,className:"text-xs font-medium px-2 py-1 rounded bg-muted hover:text-primary transition-colors",children:uf()})]}),o(he,{children:[t(ge,{asChild:!0,children:o("button",{className:"w-8 text-sm font-bold hover:text-primary",children:[e.playbackRate,"x"]})}),t(Ae,{children:[0.5,1,1.5,2].map((qe)=>o(V,{onClick:()=>g(qe),className:E("rounded py-1 px-2 text-left text-xs",e.playbackRate===qe?"bg-primary text-primary-foreground focus:bg-primary focus:text-primary-foreground":"text-foreground"),children:[qe,"x"]},qe))})]}),!Fe&&r.length>0&&o(he,{children:[t(ge,{asChild:!0,children:o("button",{className:"flex items-center gap-1 rounded border border-border px-2 py-0.5 text-sm font-semibold hover:bg-muted transition-colors",children:[t(Ca,{className:"h-3.5 w-3.5"}),t("span",{children:e.currentResolution==="Original"?ol():e.currentResolution})]})}),o(Ae,{children:[t(qr,{children:Bh()}),r.map((qe)=>o(V,{onClick:()=>y(qe),className:E("flex w-full items-center justify-between",e.currentResolution===qe.resolution?"text-primary font-medium":"text-foreground"),children:[t("span",{children:qe.resolution==="Original"?ol():qe.resolution}),o("span",{className:"pl-5 text-xs text-muted-foreground",children:[qe.width,"x",qe.height]})]},qe.resolution))]})]}),me&&(Fe?t("button",{onClick:()=>x(a.media?.original?.key||""),className:"transition-colors hover:text-primary",title:dr(),disabled:!a.media?.original?.key,children:t(vt,{className:"h-5 w-5"})}):o(he,{children:[t(ge,{asChild:!0,children:t("button",{className:"transition-colors hover:text-primary",title:dr(),children:t(vt,{className:"h-5 w-5"})})}),o(Ae,{children:[t(qr,{children:dr()}),r.map((qe)=>o(V,{onClick:()=>x(qe.key??""),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground",children:[t("span",{children:qe.resolution}),t("span",{className:"text-xs text-muted-foreground",children:"MP4"})]},qe.resolution)),a.media?.original?.key&&o(B,{children:[t(qt,{}),o(V,{onClick:()=>x(a.media?.original?.key??""),className:"flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground",children:[t("span",{children:ol()}),t("span",{className:"text-xs text-muted-foreground",children:a.name?.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})]})),t("button",{onClick:I,className:"transition-colors hover:text-primary",title:Hu(),children:e.isFullScreen?t(ss,{className:"h-6 w-6"}):t(as,{className:"h-6 w-6"})})]})]})]})};var b_=({state:e,isControlsVisible:n,buffered:i,data:s,resolutions:a,togglePlay:r,toggleLoop:l,toggleMute:c,changePlaybackRate:p,changeResolution:m,toggleFullScreen:g,frameRate:y,totalFrames:x,currentFrame:I,seekToFrame:M,floatOverlayInFullScreen:H=!0,onMouseEnter:X,onMouseLeave:W})=>{let{videoTimeDisplayMode:Y,setVideoTimeDisplayMode:te}=Ht();if(!s.media?.metadata)return null;let ae=e.isFullScreen&&H,ne=s.proxyType==="audio",oe=s.media?.metadata?.startTimecode,me=Math.max(0,x-1),be=Y==="frames"?`${I} / ${me} fr`:Y==="standard"?`${xn(I,y,"standard")} / ${ds(x/y)}`:`${xn(I,y,Y,oe)} / ${xn(me,y,Y,oe)}`;return o("div",{className:E("transition-all duration-300 ease-in-out z-20 text-foreground",ae?"absolute bottom-0 left-0 right-0 px-3 py-3 bg-card/90 backdrop-blur-md border-t border-border":"relative w-full bg-card border-t border-border px-3 py-2.5 z-10 transition-colors duration-200",n?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"),onMouseEnter:X,onMouseLeave:W,children:[t("div",{className:"mb-2 px-0.5",children:t(vb,{totalFrames:x,currentFrame:I,fps:y,buffered:i,previewUrl:s.media.videoPreview?.url,onSeek:M,metadata:{...s.media.metadata,frameRate:y}})}),o("div",{className:"flex items-center justify-between text-foreground gap-1 select-none",children:[o("div",{className:"flex items-center gap-2 min-w-0",children:[t("button",{onClick:r,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0","data-testid":"play-toggle","data-playing":e.isPlaying,"aria-label":e.isPlaying?"Pause":"Play",children:e.isPlaying?t(Hg,{className:"w-5 h-5 fill-current"}):t(Dc,{className:"w-5 h-5 fill-current"})}),t("button",{onClick:c,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0","aria-label":e.isMuted?"Unmute":"Mute",children:e.isMuted||e.volume===0?t(Gg,{className:"w-5 h-5"}):t(zg,{className:"w-5 h-5"})}),o("div",{className:"flex items-center gap-0.5 text-xs font-medium tabular-nums min-w-0",children:[t("span",{className:"text-muted-foreground font-mono truncate text-[11px] sm:text-xs","data-testid":"time-readout",children:be}),o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t("button",{className:"h-5 w-5 inline-flex items-center justify-center rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer focus:outline-none shrink-0","aria-label":Ly(),children:t(_e,{className:"h-3 w-3"})})}),o(Ae,{align:"start",className:"w-40 z-30",children:[t(qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:wb()}),o(V,{onClick:()=>te("standard"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:iE()}),Y==="standard"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]}),o(V,{onClick:()=>te("frames"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:xb()}),Y==="frames"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]}),o(V,{onClick:()=>te("timecode"),className:"flex items-center justify-between cursor-pointer text-xs",children:[t("span",{children:QE()}),Y==="timecode"&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]})]})]})]})]}),o("div",{className:"flex items-center gap-1 shrink-0",children:[o(he,{modal:!1,children:[t(ge,{asChild:!0,children:o("button",{className:"flex items-center gap-1 rounded border border-border px-1.5 py-1 text-xs font-semibold hover:bg-muted transition-colors cursor-pointer",title:Wf(),"aria-label":Wf(),children:[t(Ca,{className:"h-3.5 w-3.5"}),t("span",{className:"text-[11px]",children:!ne&&e.currentResolution?e.currentResolution:`${e.playbackRate}x`})]})}),o(Ae,{align:"end",className:"w-48 z-30",children:[!ne&&a.length>0&&o(B,{children:[t(qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:Bh()}),a.map((xe)=>o(V,{onClick:()=>m(xe),className:E("flex w-full items-center justify-between text-xs cursor-pointer",e.currentResolution===xe.resolution?"text-primary font-medium":"text-foreground"),children:[t("span",{children:xe.resolution==="Original"?ol():xe.resolution}),o("span",{className:"text-[10px] text-muted-foreground",children:[xe.width,"x",xe.height]})]},xe.resolution)),t(qt,{})]}),t(qr,{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:jx()}),[0.5,1,1.5,2].map((xe)=>o(V,{onClick:()=>p(xe),className:E("flex items-center justify-between text-xs cursor-pointer",e.playbackRate===xe?"text-primary font-medium":"text-foreground"),children:[o("span",{children:[xe,"x"]}),e.playbackRate===xe&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]},xe)),t(qt,{}),o(V,{onClick:l,className:"flex items-center justify-between text-xs cursor-pointer",children:[o("span",{className:"flex items-center gap-1.5",children:[t(Ug,{className:"h-3.5 w-3.5"}),t("span",{children:mv()})]}),e.isLooping&&t(Te,{className:"h-3.5 w-3.5 text-primary"})]})]})]}),t("button",{onClick:g,className:"p-1 hover:text-primary transition-colors cursor-pointer shrink-0",title:Hu(),"aria-label":Hu(),children:e.isFullScreen?t(ss,{className:"h-5 w-5"}):t(as,{className:"h-5 w-5"})})]})]})]})};var iF=Math.PI/180;function sF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var $c=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},Ct={_global:$c,version:"10.3.2",isBrowser:sF(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return Ct.angleDeg?e*iF:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return Ct.DD.isDragging},isTransforming(){var e,n;return(n=(e=Ct.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&n!==void 0?n:!1},isDragReady(){return!!Ct.DD.node},releaseCanvasOnDestroy:!0,document:$c.document,_injectGlobal(e){if(typeof $c.Konva<"u")console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.");$c.Konva=e}},wn=(e)=>{Ct[e.prototype.getClassName()]=e};Ct._injectGlobal(Ct);var aF=`Konva.js unsupported environment.
|
|
224
|
+
|
|
225
|
+
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
226
|
+
|
|
227
|
+
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
228
|
+
|
|
229
|
+
bash: npm install canvas
|
|
230
|
+
js: import "konva/canvas-backend";
|
|
231
|
+
|
|
232
|
+
or
|
|
233
|
+
|
|
234
|
+
bash: npm install skia-canvas
|
|
235
|
+
js: import "konva/skia-backend";
|
|
236
|
+
`,w_=()=>{if(typeof document>"u")throw Error(aF)};class Gs{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Gs(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){let n=Math.cos(e),i=Math.sin(e),s=this.m[0]*n+this.m[2]*i,a=this.m[1]*n+this.m[3]*i,r=this.m[0]*-i+this.m[2]*n,l=this.m[1]*-i+this.m[3]*n;return this.m[0]=s,this.m[1]=a,this.m[2]=r,this.m[3]=l,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){let i=this.m[0]+this.m[2]*n,s=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,r=this.m[3]+this.m[1]*e;return this.m[0]=i,this.m[1]=s,this.m[2]=a,this.m[3]=r,this}multiply(e){let n=this.m[0]*e.m[0]+this.m[2]*e.m[1],i=this.m[1]*e.m[0]+this.m[3]*e.m[1],s=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],r=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],l=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=i,this.m[2]=s,this.m[3]=a,this.m[4]=r,this.m[5]=l,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,i=-this.m[1]*e,s=-this.m[2]*e,a=this.m[0]*e,r=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),l=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=i,this.m[2]=s,this.m[3]=a,this.m[4]=r,this.m[5]=l,this}getMatrix(){return this.m}decompose(){let e=this.m[0],n=this.m[1],i=this.m[2],s=this.m[3],a=this.m[4],r=this.m[5],l=e*s-n*i,c={x:a,y:r,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){let p=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/p):-Math.acos(e/p),c.scaleX=p,c.scaleY=l/p,c.skewX=(e*i+n*s)/l,c.skewY=0}else if(i!=0||s!=0){let p=Math.sqrt(i*i+s*s);c.rotation=Math.PI/2-(s>0?Math.acos(-i/p):-Math.acos(i/p)),c.scaleX=l/p,c.scaleY=p,c.skewX=0,c.skewY=(e*i+n*s)/l}return c.rotation=Pe._getRotation(c.rotation),c}}var rF="[object Array]",oF="[object Number]",lF="[object String]",cF="[object Boolean]",uF=Math.PI/180,x_=180/Math.PI,Sb="#",hF="",fF="0",dF="Konva warning: ",y_="Konva error: ",pF={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Dp=null,mF=typeof window<"u"?window:{},u3=new WeakMap,gF=(e,n)=>{if(typeof e.requestAnimationFrame==="function")e.requestAnimationFrame(n);else if(typeof requestAnimationFrame<"u")requestAnimationFrame(n);else setTimeout(n,16)},v_=new Map,S_=(e)=>{let n=e.trim();return n.indexOf(",")===-1?n.split(/\s*\/\s*|\s+/):n.split(/\s*,\s*/)},k_="[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?",bF=new RegExp(`^(${k_})(%?)$`,"i"),bh=(e,n)=>{let i=bF.exec(e);if(!i)return NaN;return i[2]?Number(i[1])/100*n:Number(i[1])},_b=/^#[0-9a-f]+$/i,__=(e)=>Math.min(Math.max(e,0),1),wF=new RegExp(`^(${k_})(deg|grad|rad|turn)?$`,"i"),yF={deg:1,grad:0.9,rad:x_,turn:360},Pe={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===rF},_isNumber(e){return Object.prototype.toString.call(e)===oF&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===lF},_isBoolean(e){return Object.prototype.toString.call(e)===cF},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=="string")return!1;let n=e[0];return n==="#"||n==="."||n===n.toUpperCase()},_sign(e){if(e===0)return 1;if(e>0)return 1;else return-1},requestAnimFrame(e,n){let i=n&&!n.closed&&n||mF,s=u3.get(i);if(!s)s=[],u3.set(i,s),gF(i,function(){u3.delete(i),s.forEach(function(a){a()})});s.push(e)},createCanvasElement(){w_();let e=document.createElement("canvas");try{e.style=e.style||{}}catch(n){}return e},createImageElement(){return w_(),document.createElement("img")},_isInDocument(e){return!!e.isConnected},_urlToImage(e,n){let i=Pe.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex(e,n,i){return(16777216+(e<<16)+(n<<8)+i).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Sb,hF);let n=parseInt(e,16);return{r:n>>16&255,g:n>>8&255,b:n&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);while(e.length<6)e=fF+e;return Sb+e},isCanvasFarblingActive(){if(Dp!==null)return Dp;if(typeof document>"u")return Dp=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let n=e.getContext("2d",{willReadFrequently:!0});n.clearRect(0,0,10,10),n.fillStyle="#282828",n.fillRect(0,0,10,10);let i=n.getImageData(0,0,10,10).data,s=!1;for(let a=0;a<100;a++)if(i[a*4]!==40||i[a*4+1]!==40||i[a*4+2]!==40||i[a*4+3]!==255){s=!0;break}return Dp=s,this.releaseCanvas(e),Dp},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,n,i){if(this.isCanvasFarblingActive())e=Math.round(e/5)*5,n=Math.round(n/5)*5,i=Math.round(i/5)*5;return Sb+this._rgbToHex(e,n,i)},getSnappedHexColor(e){let n=this._hexToRgb(e);return Sb+this._rgbToHex(Math.round(n.r/5)*5,Math.round(n.g/5)*5,Math.round(n.b/5)*5)},getRGB(e){var n;let{r:i=0,g:s=0,b:a=0}=(n=Pe.colorToRGBA(e))!==null&&n!==void 0?n:{};return{r:i,g:s,b:a}},colorToRGBA(e){e=(e||"").trim()||"black";let n=Pe._namedColorToRBA(e)||Pe._hex3ColorToRGBA(e)||Pe._hex4ColorToRGBA(e)||Pe._hex6ColorToRGBA(e)||Pe._hex8ColorToRGBA(e)||Pe._rgbColorToRGBA(e)||Pe._hslColorToRGBA(e);if(n&&[n.r,n.g,n.b,n.a].every(Pe._isNumber))return n},_namedColorToRBA(e){let n=pF[e.toLowerCase()];if(!n)return null;return{r:n[0],g:n[1],b:n[2],a:n.length>3?n[3]:1}},_rgbColorToRGBA(e){let n=/^rgba?\(([^)]*)\)$/i.exec(e);if(!n)return;let i=S_(n[1]);if(i.length<3||i.length>4)return;return{r:bh(i[0],255),g:bh(i[1],255),b:bh(i[2],255),a:i.length>3?bh(i[3],1):1}},_hex8ColorToRGBA(e){if(e.length===9&&_b.test(e))return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e.length===7&&_b.test(e))return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e.length===5&&_b.test(e))return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e.length===4&&_b.test(e))return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){let n=/^hsla?\(([^)]*)\)$/i.exec(e);if(!n)return;let i=S_(n[1]);if(i.length<3||i.length>4)return;let s=wF.exec(i[0]);if(!s)return;let a=s[2],r=Number(s[1])*(a?yF[a.toLowerCase()]:1);if(!isFinite(r))return;let l=(r%360+360)%360/360,c=__(bh(i[1],100)/100),p=__(bh(i[2],100)/100),m=i.length>3?bh(i[3],1):1,g=p<0.5?p*(1+c):p+c-p*c,y=2*p-g,x=[0,0,0];for(let I=0;I<3;I++){let M=l+0.3333333333333333*-(I-1);if(M<0)M++;if(M>1)M--;let H;if(6*M<1)H=y+(g-y)*6*M;else if(2*M<1)H=g;else if(3*M<2)H=y+(g-y)*(0.6666666666666666-M)*6;else H=y;x[I]=H*255}return{r:Math.round(x[0]),g:Math.round(x[1]),b:Math.round(x[2]),a:m}},haveIntersection(e,n){return!(n.x>e.x+e.width||n.x+n.width<e.x||n.y>e.y+e.height||n.y+n.height<e.y)},cloneObject(e){let n={};for(let i in e)if(this._isPlainObject(e[i]))n[i]=this.cloneObject(e[i]);else if(this._isArray(e[i]))n[i]=this.cloneArray(e[i]);else n[i]=e[i];return n},cloneArray(e){return e.slice(0)},degToRad(e){return e*uF},radToDeg(e){return e*x_},_degToRad(e){return Pe.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Pe.degToRad(e)},_radToDeg(e){return Pe.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Pe.radToDeg(e)},_getRotation(e){return Ct.angleDeg?Pe.radToDeg(e):e},_capitalize(e){let n=v_.get(e);if(n!==void 0)return n;let i=e.charAt(0).toUpperCase()+e.slice(1);return v_.set(e,i),i},throw(e){throw Error(y_+e)},error(e){console.error(y_+e)},warn(e){if(!Ct.showWarnings)return;console.warn(dF+e)},each(e,n){for(let i in e)n(i,e[i])},_inRange(e,n,i){return n<=e&&e<i},_getProjectionToSegment(e,n,i,s,a,r){let l,c,p,m=(e-i)*(e-i)+(n-s)*(n-s);if(m==0)l=e,c=n,p=(a-i)*(a-i)+(r-s)*(r-s);else{let g=((a-e)*(i-e)+(r-n)*(s-n))/m;if(g<0)l=e,c=n,p=(e-a)*(e-a)+(n-r)*(n-r);else if(g>1)l=i,c=s,p=(i-a)*(i-a)+(s-r)*(s-r);else l=e+g*(i-e),c=n+g*(s-n),p=(l-a)*(l-a)+(c-r)*(c-r)}return[l,c,p]},_getProjectionToLine(e,n,i){let s=Pe.cloneObject(e),a=Number.MAX_VALUE;return n.forEach(function(r,l){if(!i&&l===n.length-1)return;let c=n[(l+1)%n.length],p=Pe._getProjectionToSegment(r.x,r.y,c.x,c.y,e.x,e.y),m=p[0],g=p[1],y=p[2];if(y<a)s.x=m,s.y=g,a=y}),s},_prepareArrayForTween(e,n,i){let s=[],a=[];if(e.length>n.length){let l=n;n=e,e=l}for(let l=0;l<e.length;l+=2)s.push({x:e[l],y:e[l+1]});for(let l=0;l<n.length;l+=2)a.push({x:n[l],y:n[l+1]});let r=[];return a.forEach(function(l){let c=Pe._getProjectionToLine(l,s,i);r.push(c.x),r.push(c.y)}),r},_prepareToStringify(e){let n;e.visitedByCircularReferenceRemoval=!0;for(let i in e){if(!(e.hasOwnProperty(i)&&e[i]&&typeof e[i]=="object"))continue;if(n=Object.getOwnPropertyDescriptor(e,i),e[i].visitedByCircularReferenceRemoval||Pe._isElement(e[i]))if(n.configurable)delete e[i];else return null;else if(Pe._prepareToStringify(e[i])===null)if(n.configurable)delete e[i];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,n){for(let i in n)e[i]=n[i];return e},_getFirstPointerId(e){if(!e.touches)return e.pointerId||999;else return e.changedTouches[0].identifier},releaseCanvas(...e){if(!Ct.releaseCanvasOnDestroy)return;e.forEach((n)=>{n.width=0,n.height=0})},drawRoundedRectPath(e,n,i,s){let a=n<0?n:0,r=i<0?i:0;n=Math.abs(n),i=Math.abs(i);let l=0,c=0,p=0,m=0;if(typeof s==="number")l=c=p=m=Math.min(s,n/2,i/2);else l=Math.min(s[0]||0,n/2,i/2),c=Math.min(s[1]||0,n/2,i/2),m=Math.min(s[2]||0,n/2,i/2),p=Math.min(s[3]||0,n/2,i/2);e.moveTo(a+l,r),e.lineTo(a+n-c,r),e.arc(a+n-c,r+c,c,Math.PI*3/2,0,!1),e.lineTo(a+n,r+i-m),e.arc(a+n-m,r+i-m,m,0,Math.PI/2,!1),e.lineTo(a+p,r+i),e.arc(a+p,r+i-p,p,Math.PI/2,Math.PI,!1),e.lineTo(a,r+l),e.arc(a+l,r+l,l,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,n,i,s,a){s=Math.abs(s);for(let r=0;r<i;r++){let l=n[(r-1+i)%i],c=n[r],p=n[(r+1)%i],m={x:c.x-l.x,y:c.y-l.y},g={x:p.x-c.x,y:p.y-c.y},y=Math.hypot(m.x,m.y),x=Math.hypot(g.x,g.y),I;if(typeof a==="number")I=a;else I=r<a.length?a[r]:0;I=s*Math.cos(Math.PI/i)*Math.min(1,I/s*2);let H={x:m.x/y,y:m.y/y},X={x:g.x/x,y:g.y/x},W={x:c.x-H.x*I,y:c.y-H.y*I},Y={x:c.x+X.x*I,y:c.y+X.y*I};if(r===0)e.moveTo(W.x,W.y);else e.lineTo(W.x,W.y);e.arcTo(c.x,c.y,Y.x,Y.y,I)}}};function vF(e){let n=[],i=e.length,s=Pe;for(let a=0;a<i;a++){let r=e[a];if(s._isNumber(r))r=Math.round(r*1000)/1000;else if(!s._isString(r))r=r+"";n.push(r)}return n}var T_=",",SF="(",_F=")",xF="([",kF="])",TF=";",AF="()",CF="=",C_=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],jF=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],EF=100,kb=null;function h3(){if(kb!==null)return kb;try{let n=Pe.createCanvasElement().getContext("2d");if(!n)return kb=!1,!1;return!!n&&"filter"in n}catch(e){return kb=!1,!1}}class wd{constructor(e){if(this.canvas=e,Ct.enableTrace)this.traceArr=[],this._enableTrace()}fillShape(e){if(e.fillEnabled())this._fill(e)}_fill(e){}strokeShape(e){if(e.hasStroke())this._stroke(e)}_stroke(e){}fillStrokeShape(e){if(e.attrs.fillAfterStrokeEnabled)this.strokeShape(e),this.fillShape(e);else this.fillShape(e),this.strokeShape(e)}getTrace(e,n){let i=this.traceArr,s=i.length,a="",r,l,c,p;for(r=0;r<s;r++){if(l=i[r],c=l.method,c)if(p=l.args,a+=c,e)a+=AF;else if(Pe._isArray(p[0]))a+=xF+p.join(T_)+kF;else{if(n)p=p.map((m)=>typeof m==="number"?Math.floor(m):m);a+=SF+p.join(T_)+_F}else if(a+=l.property,!e)a+=CF+l.val;a+=TF}return a}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,i;if(n.push(e),i=n.length,i>=EF)n.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let n=this.getCanvas();if(e)this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0);else this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){let n=e.attrs.lineCap;if(n)this.setAttr("lineCap",n)}_applyOpacity(e){let n=e.getAbsoluteOpacity();if(n!==1)this.setAttr("globalAlpha",n)}_applyLineJoin(e){let n=e.attrs.lineJoin;if(n)this.setAttr("lineJoin",n)}_applyMiterLimit(e){let n=e.attrs.miterLimit;if(n!=null)this.setAttr("miterLimit",n)}setAttr(e,n){this._context[e]=n}arc(e,n,i,s,a,r){this._context.arc(e,n,i,s,a,r)}arcTo(e,n,i,s,a){this._context.arcTo(e,n,i,s,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,i,s,a,r){this._context.bezierCurveTo(e,n,i,s,a,r)}clearRect(e,n,i,s){this._context.clearRect(e,n,i,s)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){let i=arguments;if(i.length===2)return this._context.createImageData(e,n);else if(i.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,i,s){return this._context.createLinearGradient(e,n,i,s)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,i,s,a,r){return this._context.createRadialGradient(e,n,i,s,a,r)}drawImage(e,n,i,s,a,r,l,c,p){let m=arguments,g=this._context;if(m.length===3)g.drawImage(e,n,i);else if(m.length===5)g.drawImage(e,n,i,s,a);else if(m.length===9)g.drawImage(e,n,i,s,a,r,l,c,p)}ellipse(e,n,i,s,a,r,l,c){this._context.ellipse(e,n,i,s,a,r,l,c)}isPointInPath(e,n,i,s){if(i)return this._context.isPointInPath(i,e,n,s);return this._context.isPointInPath(e,n,s)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,i,s){this._context.fillRect(e,n,i,s)}strokeRect(e,n,i,s){this._context.strokeRect(e,n,i,s)}fillText(e,n,i,s){if(s)this._context.fillText(e,n,i,s);else this._context.fillText(e,n,i)}measureText(e){return this._context.measureText(e)}getImageData(e,n,i,s){return this._context.getImageData(e,n,i,s)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,i,s){this._context.rect(e,n,i,s)}roundRect(e,n,i,s,a){this._context.roundRect(e,n,i,s,a)}putImageData(e,n,i){this._context.putImageData(e,n,i)}quadraticCurveTo(e,n,i,s){this._context.quadraticCurveTo(e,n,i,s)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){if(this._context.setLineDash)this._context.setLineDash(e);else if("mozDash"in this._context)this._context.mozDash=e;else if("webkitLineDash"in this._context)this._context.webkitLineDash=e}getLineDash(){return this._context.getLineDash()}setTransform(e,n,i,s,a,r){this._context.setTransform(e,n,i,s,a,r)}stroke(e){if(e)this._context.stroke(e);else this._context.stroke()}strokeText(e,n,i,s){this._context.strokeText(e,n,i,s)}transform(e,n,i,s,a,r){this._context.transform(e,n,i,s,a,r)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=C_.length,i=this.setAttr,s,a,r=function(l){let c=e[l],p;e[l]=function(){return a=vF(Array.prototype.slice.call(arguments,0)),p=c.apply(e,arguments),e._trace({method:l,args:a}),p}};for(s=0;s<n;s++)r(C_[s]);e.setAttr=function(){i.apply(e,arguments);let l=arguments[0],c=arguments[1];if(l==="shadowOffsetX"||l==="shadowOffsetY"||l==="shadowBlur")c=c/this.canvas.getPixelRatio();e._trace({property:l,val:c})}}_applyGlobalCompositeOperation(e){let n=e.attrs.globalCompositeOperation;if(!(!n||n==="source-over"))this.setAttr("globalCompositeOperation",n)}}jF.forEach(function(e){Object.defineProperty(wd.prototype,e,{get(){return this._context[e]},set(n){this._context[e]=n}})});class f3 extends wd{constructor(e,{willReadFrequently:n=!1}={}){super(e);this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){let n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){let n=this._context;if("patternQuality"in n)n.patternQuality=n.imageSmoothingEnabled?"good":"nearest";this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let n=e._getLinearGradient();if(n)this.setAttr("fillStyle",n),e._fillFunc(this)}_fillRadialGradient(e){let n=e._getRadialGradient();if(n)this.setAttr("fillStyle",n),e._fillFunc(this)}_fill(e){let n=e.fill(),i=e.getFillPriority();if(n&&i==="color"){this._fillColor(e);return}let s=e.getFillPatternImage();if(s&&i==="pattern"){this._fillPattern(e);return}let a=e.getFillLinearGradientColorStops();if(a&&i==="linear-gradient"){this._fillLinearGradient(e);return}let r=e.getFillRadialGradientColorStops();if(r&&i==="radial-gradient"){this._fillRadialGradient(e);return}if(n)this._fillColor(e);else if(s)this._fillPattern(e);else if(a)this._fillLinearGradient(e);else if(r)this._fillRadialGradient(e)}_strokeLinearGradient(e){let n=e.getStrokeLinearGradientStartPoint(),i=e.getStrokeLinearGradientEndPoint(),s=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(n.x,n.y,i.x,i.y);if(s){for(let r=0;r<s.length;r+=2)a.addColorStop(s[r],s[r+1]);this.setAttr("strokeStyle",a)}}_stroke(e){let n=e.dash(),i=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!i){this.save();let a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}if(this._applyLineCap(e),n&&e.dashEnabled())this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset());if(this.setAttr("lineWidth",e.strokeWidth()),!e.getShadowForStrokeEnabled())this.setAttr("shadowColor","rgba(0,0,0,0)");if(e.getStrokeLinearGradientColorStops())this._strokeLinearGradient(e);else this.setAttr("strokeStyle",e.stroke());if(e._strokeFunc(this),!i)this.restore()}}_applyShadow(e){var n,i,s;let a=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",r=(i=e.getShadowBlur())!==null&&i!==void 0?i:5,l=(s=e.getShadowOffset())!==null&&s!==void 0?s:{x:0,y:0},c=e.getAbsoluteScale(),p=this.canvas.getPixelRatio(),m=c.x*p,g=c.y*p;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",r*Math.min(Math.abs(m),Math.abs(g))),this.setAttr("shadowOffsetX",l.x*m),this.setAttr("shadowOffsetY",l.y*g)}}class d3 extends wd{constructor(e){super(e);this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){if(e.hasHitStroke())this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let n=e.getStrokeScaleEnabled();if(!n){this.save();let a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e);let i=e.hitStrokeWidth(),s=i==="auto"?e.strokeWidth():i;if(this.setAttr("lineWidth",s),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),!n)this.restore()}}}var Tb;function qF(){if(Tb)return Tb;let e=Pe.createCanvasElement(),n=e.getContext("2d");return Tb=function(){let i=Ct._global.devicePixelRatio||1,s=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return i/s}(),Pe.releaseCanvas(e),Tb}class Ip{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let i=(e||{}).pixelRatio||Ct.pixelRatio||qF();this.pixelRatio=i,this._canvas=Pe.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){let n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";let n=this.pixelRatio;this.getContext()._context.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";let n=this.pixelRatio;this.getContext()._context.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}setSizeIfChanged(e,n){if(this.width!==e*this.pixelRatio||this.height!==n*this.pixelRatio)this.setSize(e,n)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch(i){try{return this._canvas.toDataURL()}catch(s){return Pe.error("Unable to get data URL. "+s.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Nr extends Ip{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e);this.context=new f3(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class wh extends Ip{constructor(e={width:0,height:0}){super(e);this.hitCanvas=!0,this.context=new d3(this),this.setSize(e.width,e.height)}}var Hn={get isDragging(){let e=!1;return Hn._dragElements.forEach((n)=>{if(n.dragStatus==="dragging")e=!0}),e},justDragged:!1,get node(){let e;return Hn._dragElements.forEach((n)=>{e=n.node}),e},_dragElements:new Map,_listenToWindow(e){let n=(s)=>Hn._endDragBefore(s,e),i=(s)=>Hn._drag(s,e);e.addEventListener("mouseup",n,!0),e.addEventListener("touchend",n,!0),e.addEventListener("touchcancel",n,!0),e.addEventListener("mousemove",i),e.addEventListener("touchmove",i),e.addEventListener("mouseup",Hn._endDragAfter,!1),e.addEventListener("touchend",Hn._endDragAfter,!1),e.addEventListener("touchcancel",Hn._endDragAfter,!1)},_drag(e,n){let i=[];Hn._dragElements.forEach((s,a)=>{let{node:r}=s,l=r.getStage();if(n&&l._getOwnerWindow()!==n)return;if(l.setPointersPositions(e),s.pointerId===void 0)s.pointerId=Pe._getFirstPointerId(e);let c=l._changedPointerPositions.find((p)=>p.id===s.pointerId);if(!c)return;if(s.dragStatus!=="dragging"){let p=r.dragDistance();if(Math.max(Math.abs(c.x-s.startPointerPos.x),Math.abs(c.y-s.startPointerPos.y))<p)return;if(r.startDrag({evt:e}),!r.isDragging())return}r._setDragPosition(e,s),i.push(r)}),i.forEach((s)=>{if(!s.getStage())return;s.fire("dragmove",{type:"dragmove",target:s,evt:e},!0)})},_endDragBefore(e,n){let i=[];Hn._dragElements.forEach((s)=>{let{node:a}=s,r=a.getStage();if(e&&(!n||r._getOwnerWindow()===n))r.setPointersPositions(e);if(!r._changedPointerPositions.find((p)=>p.id===s.pointerId))return;if(s.dragStatus==="dragging"||s.dragStatus==="stopped")Hn.justDragged=!0,Ct._mouseListenClick=!1,Ct._touchListenClick=!1,Ct._pointerListenClick=!1,s.dragStatus="stopped";let c=s.node.getLayer()||s.node instanceof Ct.Stage&&s.node;if(c&&i.indexOf(c)===-1)i.push(c)}),i.forEach((s)=>{s.draw()})},_endDragAfter(e){Hn._dragElements.forEach((n,i)=>{if(n.dragStatus==="stopped")n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0);if(n.dragStatus!=="dragging")Hn._dragElements.delete(i)})}};function Yc(e){if(Pe._isString(e))return'"'+e+'"';if(Object.prototype.toString.call(e)==="[object Number]")return e;if(Pe._isBoolean(e))return e;return Object.prototype.toString.call(e)}function Ab(e){if(e>255)return 255;else if(e<0)return 0;return Math.round(e)}function mt(){if(Ct.isUnminified)return function(e,n){if(!Pe._isNumber(e))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a number.');return e}}function Qc(e){if(Ct.isUnminified)return function(n,i){let s=Pe._isNumber(n),a=Pe._isArray(n)&&n.length==e;if(!s&&!a)Pe.warn(Yc(n)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+e+")");return n}}function Mp(){if(Ct.isUnminified)return function(e,n){if(!(Pe._isNumber(e)||e==="auto"))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or "auto".');return e}}function Uo(){if(Ct.isUnminified)return function(e,n){if(!Pe._isString(e))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a string.');return e}}function p3(){if(Ct.isUnminified)return function(e,n){let i=Pe._isString(e),s=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;if(!(i||s))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a string or a native gradient.');return e}}function j_(){if(Ct.isUnminified)return function(e,n){let i=Int8Array?Object.getPrototypeOf(Int8Array):null;if(i&&e instanceof i)return e;if(!Pe._isArray(e))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a array of numbers.');else e.forEach(function(s){if(!Pe._isNumber(s))Pe.warn('"'+n+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")});return e}}function Vs(){if(Ct.isUnminified)return function(e,n){if(!(e===!0||e===!1))Pe.warn(Yc(e)+' is a not valid value for "'+n+'" attribute. The value should be a boolean.');return e}}function E_(e){if(Ct.isUnminified)return function(n,i){if(n===void 0||n===null)return n;if(!Pe.isObject(n))Pe.warn(Yc(n)+' is a not valid value for "'+i+'" attribute. The value should be an object with properties '+e);return n}}var Rp="get",Op="set",ye={addGetterSetter(e,n,i,s,a){ye.addGetter(e,n,i),ye.addSetter(e,n,s,a),ye.addOverloadedGetterSetter(e,n)},addGetter(e,n,i){let s=Rp+Pe._capitalize(n);e.prototype[s]=e.prototype[s]||function(){let a=this.attrs[n];return a===void 0?i:a}},addSetter(e,n,i,s){let a=Op+Pe._capitalize(n);if(!e.prototype[a])ye.overWriteSetter(e,n,i,s)},overWriteSetter(e,n,i,s){let a=Op+Pe._capitalize(n);e.prototype[a]=function(r){if(i&&r!==void 0&&r!==null)r=i.call(this,r,n);if(this._setAttr(n,r),s)s.call(this);return this}},addComponentsGetterSetter(e,n,i,s,a){let r=i.length,l=Pe._capitalize,c=Rp+l(n),p=Op+l(n);e.prototype[c]=function(){let g={};for(let y=0;y<r;y++){let x=i[y];g[x]=this.getAttr(n+l(x))}return g};let m=E_(i);e.prototype[p]=function(g){let y=this.attrs[n];if(s)g=s.call(this,g,n);if(m)m.call(this,g,n);for(let x in g){if(!g.hasOwnProperty(x))continue;this._setAttr(n+l(x),g[x])}if(!g)i.forEach((x)=>{this._setAttr(n+l(x),void 0)});if(this._fireChangeEvent(n,y,g),a)a.call(this);return this},ye.addOverloadedGetterSetter(e,n)},addOverloadedGetterSetter(e,n){let i=Pe._capitalize(n),s=Op+i,a=Rp+i;e.prototype[n]=function(){if(arguments.length)return this[s](arguments[0]),this;return this[a]()}},addDeprecatedGetterSetter(e,n,i,s){Pe.error("Adding deprecated "+n);let a=Rp+Pe._capitalize(n),r=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[a]=function(){Pe.error(r);let l=this.attrs[n];return l===void 0?i:l},ye.addSetter(e,n,s,function(){Pe.error(r)}),ye.addOverloadedGetterSetter(e,n)},backCompat(e,n){Pe.each(n,function(i,s){let a=e.prototype[s],r=Rp+Pe._capitalize(i),l=Op+Pe._capitalize(i);function c(){a.apply(this,arguments),Pe.error('"'+i+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}e.prototype[i]=c,e.prototype[r]=c,e.prototype[l]=c})},afterSetFilter(){this._filterUpToDate=!1}};function DF(e){let n=/(\w+)\(([^)]+)\)/g,i;while((i=n.exec(e))!==null){let[,s,a]=i;switch(s){case"blur":{let r=parseFloat(a.replace("px",""));return function(l){this.blurRadius(r*0.5);let c=Ct.Filters;if(c&&c.Blur)c.Blur.call(this,l)}}case"brightness":{let r=a.includes("%")?parseFloat(a)/100:parseFloat(a);return function(l){this.brightness(r);let c=Ct.Filters;if(c&&c.Brightness)c.Brightness.call(this,l)}}case"contrast":{let r=parseFloat(a);return function(l){let c=100*(Math.sqrt(r)-1);this.contrast(c);let p=Ct.Filters;if(p&&p.Contrast)p.Contrast.call(this,l)}}case"grayscale":return function(r){let l=Ct.Filters;if(l&&l.Grayscale)l.Grayscale.call(this,r)};case"sepia":return function(r){let l=Ct.Filters;if(l&&l.Sepia)l.Sepia.call(this,r)};case"invert":return function(r){let l=Ct.Filters;if(l&&l.Invert)l.Invert.call(this,r)};default:Pe.warn(`CSS filter "${s}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Cb="absoluteOpacity",q_="allEventListeners",Fl="absoluteTransform",D_="absoluteScale",yh="canvas",IF="Change",MF="children",RF="konva",m3="listening",OF="mouseenter",FF="mouseleave",NF="pointerenter",PF="pointerleave",BF="touchenter",LF="touchleave";var I_="set",R_="Shape",jb=" ",O_="stage",Jc="transform",HF="Stage",g3="visible",UF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(jb),zF=1;class St{constructor(e){this._id=zF++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){if((e===Jc||e===Fl)&&this._cache.get(e))this._cache.get(e).dirty=!0;else if(e)this._cache.delete(e);else this._cache.clear()}_getCache(e,n){let i=this._cache.get(e);if(i===void 0||(e===Jc||e===Fl)&&i.dirty===!0)i=n.call(this),this._cache.set(e,i);return i}_calculate(e,n,i){if(!this._attachedDepsListeners.get(e)){let s=n.map((a)=>a+"Change.konva").join(jb);this.on(s,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,i)}_getCanvasCache(){return this._cache.get(yh)}_clearSelfAndDescendantCache(e){if(this._clearCache(e),e===Fl)this.fire("absoluteTransformChange")}static _runAfterAbsTransformCascade(e){if(St._absTransformCascadeDepth>0)St._pendingAfterCascade.push(e);else e()}clearCache(){if(this._cache.has(yh)){let{scene:e,filter:n,hit:i}=this._cache.get(yh);Pe.releaseCanvas(e._canvas,n._canvas,...i?[i._canvas]:[]),this._cache.delete(yh)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let n=e||{},i={};if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0});let s=Math.ceil(n.width||i.width),a=Math.ceil(n.height||i.height),r=n.pixelRatio,l=n.x===void 0?Math.floor(i.x):n.x,c=n.y===void 0?Math.floor(i.y):n.y,p=n.offset||0,m=n.drawBorder||!1,g=n.hitCanvasPixelRatio||1;if(!s||!a){Pe.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}let y=Math.abs(Math.round(i.x)-l)>0.5?1:0,x=Math.abs(Math.round(i.y)-c)>0.5?1:0;s+=p*2+y,a+=p*2+x,l-=p,c-=p;let I=new Nr({pixelRatio:r,width:s,height:a}),M=new Nr({pixelRatio:r,width:0,height:0,willReadFrequently:!0}),H=I.getContext(),X=new Nr({width:I.width/I.pixelRatio+Math.abs(l),height:I.height/I.pixelRatio+Math.abs(c),pixelRatio:I.pixelRatio}),W=X.getContext();if(I.isCache=!0,this._cache.delete(yh),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1)I.getContext()._context.imageSmoothingEnabled=!1,M.getContext()._context.imageSmoothingEnabled=!1;if(H.save(),W.save(),H.translate(-l,-c),W.translate(-l,-c),X.x=l,X.y=c,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Cb),this._clearSelfAndDescendantCache(D_),this.drawScene(I,this,X),this._isUnderCache=!1,H.restore(),m)H.save(),H.beginPath(),H.rect(0,0,s,a),H.closePath(),H.setAttr("strokeStyle","red"),H.setAttr("lineWidth",5),H.stroke(),H.restore();return Pe.releaseCanvas(X._canvas),this._cache.set(yh,{scene:I,filter:M,hit:null,hitConfig:{pixelRatio:g,width:s,height:a},x:l,y:c}),this._requestDraw(),this}_getCachedHitCanvas(e){if(e===this)return null;let n=this._getCanvasCache();if(!n)return null;if(n.hit)return n.hit;let i=new wh(n.hitConfig);i.isCache=!0;let s=i.getContext();return s.save(),s.translate(-n.x,-n.y),this.drawHit(i,this),s.restore(),n.hit=i,i}isCached(){return this._cache.has(yh)}getClientRect(e){throw Error('abstract "getClientRect" method call')}_transformedRect(e,n){let i=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],s=1/0,a=1/0,r=-1/0,l=-1/0,c=this.getAbsoluteTransform(n);return i.forEach(function(p){let m=c.point(p);if(s===void 0)s=r=m.x,a=l=m.y;s=Math.min(s,m.x),a=Math.min(a,m.y),r=Math.max(r,m.x),l=Math.max(l,m.y)}),{x:s,y:a,width:r-s,height:l-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let n=this._getCanvasCache();e.translate(n.x,n.y);let i=this._getCachedSceneCanvas(),s=i.pixelRatio;e.drawImage(i._canvas,0,0,i.width/s,i.height/s),e.restore()}_drawCachedHitCanvas(e,n){let i=this._getCanvasCache();e.save(),e.translate(i.x,i.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),{scene:i,filter:s}=n,a=s.getContext(),r,l,c,p;if(!e||e.length===0)return i;if(this._filterUpToDate)return s;let m=!0;for(let y=0;y<e.length;y++){let x=typeof e[y]==="string"&&!h3();if(typeof e[y]!=="string"||!h3()){m=!1;break}}let g=i.pixelRatio;if(s.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio),m){let y=e.join(" ");return a.save(),a.setAttr("filter",y),a.drawImage(i._canvas,0,0,i.getWidth()/g,i.getHeight()/g),a.restore(),this._filterUpToDate=!0,s}try{r=e.length,a.clear(),a.drawImage(i._canvas,0,0,i.getWidth()/g,i.getHeight()/g),l=a.getImageData(0,0,s.getWidth(),s.getHeight());for(c=0;c<r;c++){if(p=e[c],typeof p==="string")p=DF(p);p.call(this,l),a.putImageData(l,0,0)}}catch(y){Pe.error("Unable to apply filter. "+y.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,s}on(...e){let n=e[0],i=e[1],s=e[2];if(this._cache)this._cache.delete(q_);if(e.length===3)return this._delegate.apply(this,e);let a=n.split(jb);for(let r=0;r<a.length;r++){let c=a[r].split("."),p=c[0],m=c[1]||"";if(!this.eventListeners[p])this.eventListeners[p]=[];this.eventListeners[p].push({name:m,handler:i})}return this}off(e,n){let i=(e||"").split(jb),s=i.length,a,r,l,c,p,m;if(this._cache&&this._cache.delete(q_),!e)for(r in this.eventListeners)this._off(r);for(a=0;a<s;a++)if(l=i[a],c=l.split("."),p=c[0],m=c[1],p){if(this.eventListeners[p])this._off(p,m,n)}else for(r in this.eventListeners)this._off(r,m,n);return this}dispatchEvent(e){let n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(i){n.call(this,i.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,i){let s=this;return this.on(e,function(a){let r=a.target.findAncestors(n,!0,s);for(let l=0;l<r.length;l++)a=Pe.cloneObject(a),a.currentTarget=r[l],i.call(r[l],a)}),this}remove(){if(this.isDragging())this.stopDrag();return Hn._dragElements.delete(this._id),Hn._dragElements.forEach((e,n)=>{if(this.isAncestorOf(e.node))Hn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Fl),this._clearSelfAndDescendantCache(Cb),this._clearSelfAndDescendantCache(D_),this._clearSelfAndDescendantCache(O_),this._clearSelfAndDescendantCache(g3),this._clearSelfAndDescendantCache(m3)}_remove(){this._clearCaches();let e=this.getParent();if(e&&e.children)e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let n="get"+Pe._capitalize(e);if(Pe._isFunction(this[n]))return this[n]();return this.attrs[e]}getAncestors(){let e=this.getParent(),n=[];while(e)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let n,i;if(!e)return this;for(n in e){if(n===MF)continue;if(i=I_+Pe._capitalize(n),Pe._isFunction(this[i]))this[i](e[n]);else this._setAttr(n,e[n])}}),this}isListening(){return this._getCache(m3,this._isListening)}_isListening(e){if(!this.listening())return!1;let i=this.getParent();if(i&&i!==e&&this!==e)return i._isListening(e);else return!0}isVisible(){return this._getCache(g3,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let i=this.getParent();if(i&&i!==e&&this!==e)return i._isVisible(e);else return!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);let i=this.getLayer(),s=!1;Hn._dragElements.forEach((r)=>{if(r.dragStatus!=="dragging")return;else if(r.node.nodeType==="Stage")s=!0;else if(r.node.getLayer()===i)s=!0});let a=!n&&!Ct.hitOnDragEnabled&&(s||Ct.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,i=0,s,a,r,l;function c(m){s=[],a=m.length;for(r=0;r<a;r++){if(l=m[r],i++,l.nodeType!==R_)s=s.concat(l.getChildren().slice());if(l._id===n._id)r=a}if(s.length>0&&s[0].getDepth()<=e)c(s)}let p=this.getStage();if(n.nodeType!==HF&&p)c(p.getChildren());return i}getDepth(){let e=0,n=this.parent;while(n)e++,n=n.parent;return e}_batchTransformChanges(e){if(this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache)this._clearCache(Jc),this._clearSelfAndDescendantCache(Fl);this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let e=this.getStage();if(!e)return null;let n=e.getPointerPosition();if(!n)return null;let i=this.getAbsoluteTransform().copy();return i.invert(),i.point(n)}getAbsolutePosition(e){let n=!1,i=this.parent;while(i){if(i.isCached()){n=!0;break}i=i.parent}if(n&&!e)e=!0;let s=this.getAbsoluteTransform(e).getMatrix(),a=new Gs,r=this.offset();return a.m=s.slice(),a.translate(r.x,r.y),a.getTranslation()}setAbsolutePosition(e){let{x:n,y:i,...s}=this._clearTransform();this.attrs.x=n,this.attrs.y=i,this._clearCache(Jc);let a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(s),this.setPosition({x:e.x,y:e.y}),this._clearCache(Jc),this._clearSelfAndDescendantCache(Fl),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){let e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let{x:n,y:i}=e,s=this.x(),a=this.y();if(n!==void 0)s+=n;if(i!==void 0)a+=i;return this.setPosition({x:s,y:a}),this}_eachAncestorReverse(e,n){let i=[],s=this.getParent(),a,r;if(n&&n._id===this._id)return;i.unshift(this);while(s&&(!n||s._id!==n._id))i.unshift(s),s=s.parent;a=i.length;for(r=0;r<a;r++)e(i[r])}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Pe.warn("Node has no parent. moveToTop function is ignored."),!1;let e=this.index,n=this.parent.getChildren().length;if(e<n-1)return this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0;return!1}moveUp(){if(!this.parent)return Pe.warn("Node has no parent. moveUp function is ignored."),!1;let e=this.index,n=this.parent.getChildren().length;if(e<n-1)return this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveDown(){if(!this.parent)return Pe.warn("Node has no parent. moveDown function is ignored."),!1;let e=this.index;if(e>0)return this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0;return!1}moveToBottom(){if(!this.parent)return Pe.warn("Node has no parent. moveToBottom function is ignored."),!1;let e=this.index;if(e>0)return this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0;return!1}setZIndex(e){if(!this.parent)return Pe.warn("Node has no parent. zIndex parameter is ignored."),this;if(e<0||e>=this.parent.children.length)Pe.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");let n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Cb,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),n=this.getParent();if(n&&!n._isUnderCache)e*=n.getAbsoluteOpacity();return e}moveTo(e){if(this.getParent()!==e)this._remove(),e.add(this);return this}toObject(){let e=this.getAttrs(),n,i,s,a,r,l={attrs:{},className:this.getClassName()};for(n in e){if(i=e[n],r=Pe.isObject(i)&&!Pe._isPlainObject(i)&&!Pe._isArray(i),r)continue;if(s=typeof this[n]==="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=i,a!==i)l.attrs[n]=i}return Pe._prepareToStringify(l)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,i){let s=[];if(n&&this._isMatch(e))s.push(this);let a=this.parent;while(a){if(a===i)return s;if(a._isMatch(e))s.push(a);a=a.parent}return s}isAncestorOf(e){return!1}findAncestor(e,n,i){return this.findAncestors(e,n,i)[0]}_isMatch(e){if(!e)return!1;if(typeof e==="function")return e(this);let n=e.replace(/ /g,"").split(","),i=n.length,s,a;for(s=0;s<i;s++){if(a=n[s],!Pe.isValidSelector(a))Pe.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Pe.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Pe.warn("Konva is awesome, right?");if(a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0}return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(O_,this._getStage)}_getStage(){let e=this.getParent();if(e)return e.getStage();else return null}fire(e,n={},i){if(n.target=n.target||this,i)this._fireAndBubble(e,n);else this._fire(e,n);return this}getAbsoluteTransform(e){if(e)return this._getAbsoluteTransform(e);else return this._getCache(Fl,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new Gs,this._eachAncestorReverse(function(i){let s=i.transformsEnabled();if(s==="all")n.multiply(i.getTransform());else if(s==="position")n.translate(i.x()-i.offsetX(),i.y()-i.offsetY())},e),n;else{if(n=this._cache.get(Fl)||new Gs,this.parent)this.parent.getAbsoluteTransform().copyInto(n);else n.reset();let i=this.transformsEnabled();if(i==="all")n.multiply(this.getTransform());else if(i==="position"){let s=this.attrs.x||0,a=this.attrs.y||0,r=this.attrs.offsetX||0,l=this.attrs.offsetY||0;n.translate(s-r,a-l)}return n.dirty=!1,n}}getAbsoluteScale(e){let n=this;while(n){if(n._isUnderCache)e=n;n=n.getParent()}let s=this.getAbsoluteTransform(e).decompose();return{x:s.scaleX,y:s.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Jc,this._getTransform)}_getTransform(){var e,n;let i=this._cache.get(Jc)||new Gs;i.reset();let s=this.x(),a=this.y(),r=Ct.getAngle(this.rotation()),l=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,c=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,p=this.attrs.skewX||0,m=this.attrs.skewY||0,g=this.attrs.offsetX||0,y=this.attrs.offsetY||0;if(s!==0||a!==0)i.translate(s,a);if(r!==0)i.rotate(r);if(p!==0||m!==0)i.skew(p,m);if(l!==1||c!==1)i.scale(l,c);if(g!==0||y!==0)i.translate(-1*g,-1*y);return i.dirty=!1,i}clone(e){let n=Pe.cloneObject(this.attrs),i,s,a,r,l;for(i in e)n[i]=e[i];let c=new this.constructor(n);for(i in this.eventListeners){s=this.eventListeners[i],a=s.length;for(r=0;r<a;r++)if(l=s[r],l.name.indexOf(RF)<0){if(!c.eventListeners[i])c.eventListeners[i]=[];c.eventListeners[i].push(l)}}return c}_toKonvaCanvas(e){e=e||{};let n=this.getClientRect(),i=this.getStage(),s=e.x!==void 0?e.x:Math.floor(n.x),a=e.y!==void 0?e.y:Math.floor(n.y),r=e.pixelRatio||1,l=new Nr({width:e.width||Math.ceil(n.width)||(i?i.width():0),height:e.height||Math.ceil(n.height)||(i?i.height():0),pixelRatio:r}),c=l.getContext(),p=new Nr({width:l.width/l.pixelRatio+Math.abs(s),height:l.height/l.pixelRatio+Math.abs(a),pixelRatio:l.pixelRatio});if(e.imageSmoothingEnabled===!1)c._context.imageSmoothingEnabled=!1;if(c.save(),s||a)c.translate(-1*s,-1*a);return this.drawScene(l,void 0,p),c.restore(),l}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};let n=e.mimeType||null,i=e.quality||null,s=this._toKonvaCanvas(e).toDataURL(n,i);if(e.callback)e.callback(s);return s}toImage(e){return new Promise((n,i)=>{try{let s=e===null||e===void 0?void 0:e.callback;if(s)delete e.callback;Pe._urlToImage(this.toDataURL(e),function(a){n(a),s===null||s===void 0||s(a)})}catch(s){i(s)}})}toBlob(e){return new Promise((n,i)=>{try{let s=e===null||e===void 0?void 0:e.callback;if(s)delete e.callback;this.toCanvas(e).toBlob((a)=>{n(a),s===null||s===void 0||s(a)},e===null||e===void 0?void 0:e.mimeType,e===null||e===void 0?void 0:e.quality)}catch(s){i(s)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){if(this.attrs.dragDistance!==void 0)return this.attrs.dragDistance;else if(this.parent)return this.parent.getDragDistance();else return Ct.dragDistance}_off(e,n,i){let s=this.eventListeners[e],a,r,l;for(a=0;a<s.length;a++)if(r=s[a].name,l=s[a].handler,(r!=="konva"||n==="konva")&&(!n||r===n)&&(!i||i===l)){if(s.splice(a,1),s.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,n,i){this._fire(e+IF,{oldVal:n,newVal:i})}addName(e){if(!this.hasName(e)){let n=this.name(),i=n?n+" "+e:e;this.name(i)}return this}hasName(e){if(!e)return!1;let n=this.name();if(!n)return!1;return(n||"").split(/\s/g).indexOf(e)!==-1}removeName(e){let n=(this.name()||"").split(/\s/g),i=n.indexOf(e);if(i!==-1)n.splice(i,1),this.name(n.join(" "));return this}setAttr(e,n){let i=this[I_+Pe._capitalize(e)];if(Pe._isFunction(i))i.call(this,n);else this._setAttr(e,n);return this}_requestDraw(){if(Ct.autoDrawEnabled){let e=this.getLayer()||this.getStage();e===null||e===void 0||e.batchDraw()}}_setAttr(e,n){let i=this.attrs[e];if(i===n&&!Pe.isObject(n))return;if(n===void 0||n===null)delete this.attrs[e];else this.attrs[e]=n;if(this._shouldFireChangeEvents)this._fireChangeEvent(e,i,n);this._requestDraw()}_setComponentAttr(e,n,i){let s;if(i!==void 0){if(s=this.attrs[e],!s)this.attrs[e]=this.getAttr(e);this.attrs[e][n]=i,this._fireChangeEvent(e,s,i)}}_fireAndBubble(e,n,i){if(n&&this.nodeType===R_)n.target=this;let s=[OF,FF,NF,PF,BF,LF];if(!(s.indexOf(e)!==-1&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||this.nodeType==="Stage"&&!i))){this._fire(e,n);let r=s.indexOf(e)!==-1&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);if((n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!r)if(i&&i.parent)this._fireAndBubble.call(this.parent,e,n,i);else this._fireAndBubble.call(this.parent,e,n)}}_getProtoListeners(e){var n,i;let{nodeType:s}=this,a=St.protoListenerMap.get(s)||{},r=a===null||a===void 0?void 0:a[e];if(r===void 0){r=[];let l=new Set,c=Object.getPrototypeOf(this);while(c){let p=(i=(n=c.eventListeners)===null||n===void 0?void 0:n[e])!==null&&i!==void 0?i:[];for(let m=0;m<p.length;m++){let g=p[m];if(!l.has(g))l.add(g),r.push(g)}c=Object.getPrototypeOf(c)}a[e]=r,St.protoListenerMap.set(s,a)}return r}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;let i=this._getProtoListeners(e);if(i)for(let a=0;a<i.length;a++)i[a].handler.call(this,n);let s=this.eventListeners[e];if(s){let a=s.slice(),r=a.length;for(let c=0;c<a.length;c++)a[c].handler.call(this,n);let l=this.eventListeners[e];if(l)for(let c=r;c<l.length;c++)l[c].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let n=e?e.pointerId:void 0,i=this.getStage(),s=this.getAbsolutePosition();if(!i)return;let a=i._getPointerById(n)||i._changedPointerPositions[0]||s;Hn._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-s.x,y:a.y-s.y},dragStatus:"ready",pointerId:n,startEvent:e})}startDrag(e,n=!0){if(!Hn._dragElements.has(this._id))this._createDragElement(e);let i=Hn._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:i.startEvent&&i.startEvent.evt||e&&e.evt},n)}_setDragPosition(e,n){let i=this.getStage()._getPointerById(n.pointerId);if(!i)return;let s={x:i.x-n.offset.x,y:i.y-n.offset.y},a=this.dragBoundFunc();if(a!==void 0){let r=a.call(this,s,e);if(!r)Pe.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");else s=r}if(!this._lastPos||this._lastPos.x!==s.x||this._lastPos.y!==s.y)this.setAbsolutePosition(s),this._requestDraw();this._lastPos=s}stopDrag(e){let n=Hn._dragElements.get(this._id);if(n)n.dragStatus="stopped";Hn._endDragBefore(e),Hn._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){let e=Hn._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(e.evt.button===void 0||Ct.dragButtons.indexOf(e.evt.button)>=0))return;if(this.isDragging())return;let s=!1;if(Hn._dragElements.forEach((a)=>{if(this.isAncestorOf(a.node))s=!0}),!s)this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let n=Hn._dragElements.get(this._id),i=n&&n.dragStatus==="dragging",s=n&&n.dragStatus==="ready";if(i)this.stopDrag();else if(s)Hn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){let n=this.getStage();if(!n)return!1;let i={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return Pe.haveIntersection(i,this.getClientRect())}static create(e,n){if(Pe._isString(e))e=JSON.parse(e);return this._createNode(e,n)}static _createNode(e,n){let i=St.prototype.getClassName.call(e),s=e.children,a,r,l;if(n)e.attrs.container=n;if(!Ct[i])Pe.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape";if(a=new Ct[i](e.attrs),s){r=s.length;for(l=0;l<r;l++)a.add(St._createNode(s[l]))}return a}}St._absTransformCascadeDepth=0;St._pendingAfterCascade=[];St.protoListenerMap=new Map;St.prototype.nodeType="Node";St.prototype._attrsAffectingSize=[];St.prototype.eventListeners={};St.prototype.on(UF,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Jc),this._clearSelfAndDescendantCache(Fl)});St.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(g3)});St.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(m3)});St.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Cb)});var pi=ye.addGetterSetter;pi(St,"zIndex");pi(St,"absolutePosition");pi(St,"position");pi(St,"x",0,mt());pi(St,"y",0,mt());pi(St,"globalCompositeOperation","source-over",Uo());pi(St,"opacity",1,mt());pi(St,"name","",Uo());pi(St,"id","",Uo());pi(St,"rotation",0,mt());ye.addComponentsGetterSetter(St,"scale",["x","y"]);pi(St,"scaleX",1,mt());pi(St,"scaleY",1,mt());ye.addComponentsGetterSetter(St,"skew",["x","y"]);pi(St,"skewX",0,mt());pi(St,"skewY",0,mt());ye.addComponentsGetterSetter(St,"offset",["x","y"]);pi(St,"offsetX",0,mt());pi(St,"offsetY",0,mt());pi(St,"dragDistance",void 0,mt());pi(St,"width",0,mt());pi(St,"height",0,mt());pi(St,"listening",!0,Vs());pi(St,"preventDefault",!0,Vs());pi(St,"filters",void 0,function(e){return this._filterUpToDate=!1,e});pi(St,"visible",!0,Vs());pi(St,"transformsEnabled","all",Uo());pi(St,"size");pi(St,"dragBoundFunc");pi(St,"draggable",!1,Vs());ye.backCompat(St,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Rs extends St{constructor(){super(...arguments);this.children=[]}getChildren(e){let n=this.children||[];if(e)return n.filter(e);return n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e)=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e)=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let i=0;i<e.length;i++)this.add(e[i]);return this}let n=e[0];if(n.getParent())return n.moveTo(this),this;return this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this}destroy(){if(this.hasChildren())this.destroyChildren();return super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){let i=[];return this._descendants((s)=>{let a=s._isMatch(e);if(a)i.push(s);if(a&&n)return!0;return!1}),i}_descendants(e){let n=!1,i=this.getChildren();for(let s of i){if(n=e(s),n)return!0;if(!s.hasChildren())continue;if(n=s._descendants(e),n)return!0}return!1}toObject(){let e=St.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((n)=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();while(n){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){let n=St.prototype.clone.call(this,e);return this.getChildren().forEach(function(i){n.add(i.clone())}),n}getAllIntersections(e){let n=[];return this.find("Shape").forEach((i)=>{if(i.isVisible()&&i.intersects(e))n.push(i)}),n}_clearSelfAndDescendantCache(e){var n;let i=e==="absoluteTransform";if(i)St._absTransformCascadeDepth++;try{if(super._clearSelfAndDescendantCache(e),this.isCached())return;(n=this.children)===null||n===void 0||n.forEach(function(s){s._clearSelfAndDescendantCache(e)})}finally{if(i&&--St._absTransformCascadeDepth===0){let s=St._pendingAfterCascade;if(s.length){St._pendingAfterCascade=[];for(let a=0;a<s.length;a++)s[a]()}}}}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,i){n.index=i}),this._requestDraw()}drawScene(e,n,i){let s=this.getLayer(),a=e||s&&s.getCanvas(),r=a&&a.getContext(),l=this._getCanvasCache(),c=l&&l.scene,p=a&&a.isCache;if(!this.isVisible()&&!p)return this;if(c){r.save();let m=this.getAbsoluteTransform(n).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),this._drawCachedSceneCanvas(r),r.restore()}else this._drawChildren("drawScene",a,n,i);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;let i=this.getLayer(),s=e||i&&i.hitCanvas,a=s&&s.getContext(),r=this._getCachedHitCanvas(n);if(r){a.save();let l=this.getAbsoluteTransform(n).getMatrix();a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(a,r),a.restore()}else this._drawChildren("drawHit",s,n);return this}_drawChildren(e,n,i,s){var a;let r=n&&n.getContext(),l=this.clipWidth(),c=this.clipHeight(),p=this.clipFunc(),m=typeof l==="number"&&typeof c==="number"||p,g=i===this;if(m){r.save();let x=this.getAbsoluteTransform(i),I=x.getMatrix();r.transform(I[0],I[1],I[2],I[3],I[4],I[5]),r.beginPath();let M;if(p)M=p.call(this,r,this);else{let H=this.clipX(),X=this.clipY();r.rect(H||0,X||0,l,c)}r.clip.apply(r,M),I=x.copy().invert().getMatrix(),r.transform(I[0],I[1],I[2],I[3],I[4],I[5])}let y=!g&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";if(y)r.save(),r._applyGlobalCompositeOperation(this);if((a=this.children)===null||a===void 0||a.forEach(function(x){x[e](n,i,s)}),y)r.restore();if(m)r.restore()}getClientRect(e={}){var n;let{skipTransform:i,relativeTo:s}=e,a,r,l,c,p={x:1/0,y:1/0,width:0,height:0},m=this;(n=this.children)===null||n===void 0||n.forEach(function(x){if(!x.visible())return;let I=x.getClientRect({relativeTo:m,skipShadow:e.skipShadow,skipStroke:e.skipStroke});if(I.width===0&&I.height===0)return;if(a===void 0)a=I.x,r=I.y,l=I.x+I.width,c=I.y+I.height;else a=Math.min(a,I.x),r=Math.min(r,I.y),l=Math.max(l,I.x+I.width),c=Math.max(c,I.y+I.height)});let g=this.find("Shape"),y=!1;for(let x=0;x<g.length;x++)if(g[x]._isVisible(this)){y=!0;break}if(y&&a!==void 0)p={x:a,y:r,width:l-a,height:c-r};else p={x:0,y:0,width:0,height:0};if(!i)return this._transformedRect(p,s);return p}}ye.addComponentsGetterSetter(Rs,"clip",["x","y","width","height"]);ye.addGetterSetter(Rs,"clipX",void 0,mt());ye.addGetterSetter(Rs,"clipY",void 0,mt());ye.addGetterSetter(Rs,"clipWidth",void 0,mt());ye.addGetterSetter(Rs,"clipHeight",void 0,mt());ye.addGetterSetter(Rs,"clipFunc");var Fp=new Map,F_=Ct._global.PointerEvent!==void 0;function Eb(e){return Fp.get(e)}function qb(e){return{evt:e,pointerId:e.pointerId}}function Db(e,n){return Fp.get(e)===n}function Ib(e,n){var i;vh(e);let s=n.getStage();if(!s)return;if(Fp.set(e,n),F_){try{(i=s.content)===null||i===void 0||i.setPointerCapture(e)}catch(a){}n._fire("gotpointercapture",qb(new PointerEvent("gotpointercapture")))}}function vh(e,n){var i;let s=Fp.get(e);if(!s)return;let a=s.getStage();if(Fp.delete(e),F_){try{(i=a===null||a===void 0?void 0:a.content)===null||i===void 0||i.releasePointerCapture(e)}catch(r){}s._fire("lostpointercapture",qb(new PointerEvent("lostpointercapture")))}}var GF="Stage",VF="string",P_="px",XF="mouseout",U_="mouseleave",z_="mouseover",G_="mouseenter",V_="mousemove",X_="mousedown",W_="mouseup",Np="pointermove",Pp="pointerdown",Sd="pointerup",Bp="pointercancel",WF="lostpointercapture",Mb="pointerout",Lp="pointerleave",Rb="pointerover",Ob="pointerenter",w3="contextmenu",K_="touchstart",$_="touchend",Y_="touchmove",Q_="touchcancel",y3="wheel",KF=5,$F=[[G_,"_pointerenter"],[X_,"_pointerdown"],[V_,"_pointermove"],[W_,"_pointerup"],[U_,"_pointerleave"],[K_,"_pointerdown"],[Y_,"_pointermove"],[$_,"_pointerup"],[Q_,"_pointercancel"],[z_,"_pointerover"],[y3,"_wheel"],[w3,"_contextmenu"],[Pp,"_pointerdown"],[Np,"_pointermove"],[Sd,"_pointerup"],[Bp,"_pointercancel"],[Lp,"_pointerleave"],[WF,"_lostpointercapture"]],b3={mouse:{[Mb]:XF,[Lp]:U_,[Rb]:z_,[Ob]:G_,[Np]:V_,[Pp]:X_,[Sd]:W_,[Bp]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Mb]:"touchout",[Lp]:"touchleave",[Rb]:"touchover",[Ob]:"touchenter",[Np]:Y_,[Pp]:K_,[Sd]:$_,[Bp]:Q_,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Mb]:Mb,[Lp]:Lp,[Rb]:Rb,[Ob]:Ob,[Np]:Np,[Pp]:Pp,[Sd]:Sd,[Bp]:Bp,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Hp=(e)=>{if(e.indexOf("pointer")>=0)return"pointer";if(e.indexOf("touch")>=0)return"touch";return"mouse"},yd=(e)=>{let n=Hp(e);if(n==="pointer")return Ct.pointerEventsEnabled&&b3.pointer;if(n==="touch")return b3.touch;if(n==="mouse")return b3.mouse};function B_(e={}){if(e.clipFunc||e.clipWidth||e.clipHeight)Pe.warn("Stage does not support clipping. Please use clip for Layers or Groups.");return e}var YF="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",_d=[],L_=new WeakSet,H_=(e)=>{if(!e||L_.has(e))return;L_.add(e),Hn._listenToWindow(e),e.document.addEventListener("visibilitychange",()=>{_d.forEach((n)=>{n.batchDraw()})})};class xd extends Rs{constructor(e){super(B_(e));this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),_d.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{B_(this.attrs)}),this._checkVisibility()}_validateAdd(e){let n=e.getType()==="Layer",i=e.getType()==="FastLayer";if(!(n||i))Pe.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;let e=this.visible()?"":"none";this.content.style.display=e}_getOwnerWindow(){var e;let n=this.content||this.container();return((e=n===null||n===void 0?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView)||(Ct.isBrowser?window:null)}setContainer(e){if(typeof e===VF){let n;if(e.charAt(0)==="."){let i=e.slice(1);e=document.getElementsByClassName(i)[0]}else{if(e.charAt(0)!=="#")n=e;else n=e.slice(1);e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}if(this._setAttr("container",e),this.content){if(this.content.parentElement)this.content.parentElement.removeChild(this.content);e.appendChild(this.content),H_(this._getOwnerWindow())}return this}shouldDrawHit(){return!0}clear(){let e=this.children,n=e.length;for(let i=0;i<n;i++)e[i].clear();return this}clone(e){if(!e)e={};return e.container=typeof document<"u"&&document.createElement("div"),Rs.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;if(e&&Pe._isInDocument(e))this.container().removeChild(e);let n=_d.indexOf(this);if(n>-1)_d.splice(n,1);return Pe.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];if(!e)return Pe.warn(YF),null;return{x:e.x,y:e.y}}_getPointerById(e){return this._pointerPositions.find((n)=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let n=new Nr({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),i=n.getContext()._context,s=this.children;if(e.x||e.y)i.translate(-1*e.x,-1*e.y);return s.forEach(function(a){if(!a.isVisible())return;let r=a._toKonvaCanvas(e);i.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),n}getIntersection(e){if(!e)return null;let n=this.children,i=n.length,s=i-1;for(let a=s;a>=0;a--){let r=n[a].getIntersection(e);if(r)return r}return null}_resizeDOM(){let e=this.width(),n=this.height();if(this.content)this.content.style.width=e+P_,this.content.style.height=n+P_;this.children.forEach((i)=>{i.setSize({width:e,height:n}),i.draw()})}_syncBufferSize(e){return e.setSizeIfChanged(this.width(),this.height()),e}add(e,...n){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.add(arguments[s]);return this}super.add(e);let i=this.children.length;if(i>KF)Pe.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.");if(e.setSize({width:this.width(),height:this.height()}),e.draw(),Ct.isBrowser)this.content.appendChild(e.canvas._canvas);return this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Db(e,this)}setPointerCapture(e){Ib(e,this)}releaseCapture(e){vh(e,this)}getLayers(){return this.children}_bindContentEvents(){if(!Ct.isBrowser)return;$F.forEach(([e,n])=>{this.content.addEventListener(e,(i)=>{this[n](i)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let n=yd(e.type);if(n)this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let n=yd(e.type);if(n)this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];if(n&&!n.getStage())n=null;return n}_pointerleave(e){let n=yd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=this._getTargetShape(i),a=!(Ct.isDragging()||Ct.isTransforming())||Ct.hitOnDragEnabled;if(s&&a)s._fireAndBubble(n.pointerout,{evt:e}),s._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[i+"targetShape"]=null;else if(a)this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this});this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let n=yd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=!1;if(this._changedPointerPositions.forEach((a)=>{let r=this.getIntersection(a);if(Hn.justDragged=!1,Ct["_"+i+"ListenClick"]=!0,!r||!r.isListening()){this[i+"ClickStartShape"]=void 0;return}if(Ct.capturePointerEventsEnabled)r.setPointerCapture(a.id);this[i+"ClickStartShape"]=r,r._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),s=!0;let l=e.type.indexOf("touch")>=0;if(r.preventDefault()&&e.cancelable&&l)e.preventDefault()}),!s)this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let n=yd(e.type),i=Hp(e.type);if(!n)return;let s=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Ct.isDragging()&&Hn.node.preventDefault()&&e.cancelable&&s)e.preventDefault();if(this.setPointersPositions(e),!(!(Ct.isDragging()||Ct.isTransforming())||Ct.hitOnDragEnabled))return;let r={},l=!1,c=this._getTargetShape(i);if(this._changedPointerPositions.forEach((p)=>{let m=Eb(p.id)||this.getIntersection(p),g=p.id,y={evt:e,pointerId:g},x=c!==m;if(x&&c)c._fireAndBubble(n.pointerout,{...y},m),c._fireAndBubble(n.pointerleave,{...y},m);if(m){if(r[m._id])return;r[m._id]=!0}if(m&&m.isListening()){if(l=!0,x)m._fireAndBubble(n.pointerover,{...y},c),m._fireAndBubble(n.pointerenter,{...y},c),this[i+"targetShape"]=m;m._fireAndBubble(n.pointermove,{...y})}else if(c)this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:g}),this[i+"targetShape"]=null}),!l)this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let n=yd(e.type),i=Hp(e.type);if(!n)return;this.setPointersPositions(e);let s=Hn.justDragged||i==="pointer"&&Ct.isDragging(),a=Ct["_"+i+"ListenClick"]&&!s,r=this[i+"ClickStartShape"],l=this[i+"ClickEndShape"],c={},p=!1;if(this._changedPointerPositions.forEach((m)=>{let g=Eb(m.id)||this.getIntersection(m);if(g){if(g.releaseCapture(m.id),c[g._id])return;c[g._id]=!0}let y=m.id,x={evt:e,pointerId:y},I=!1;if(Ct["_"+i+"InDblClickWindow"])I=!0,clearTimeout(this[i+"DblTimeout"]);else if(!s)Ct["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"]);if(this[i+"DblTimeout"]=setTimeout(function(){Ct["_"+i+"InDblClickWindow"]=!1},Ct.dblClickWindow),g&&g.isListening()){if(p=!0,this[i+"ClickEndShape"]=g,g._fireAndBubble(n.pointerup,{...x}),a&&r===g){if(g._fireAndBubble(n.pointerclick,{...x}),I&&l&&l===g)g._fireAndBubble(n.pointerdblclick,{...x})}}else{if(this[i+"ClickEndShape"]=null,!p)this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),p=!0;if(a)this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:y});if(I)this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:y})}}),!p)this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id});if(Ct["_"+i+"ListenClick"]=!1,e.cancelable&&i!=="touch"&&i!=="pointer")e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let n=this.getIntersection(this.getPointerPosition());if(n&&n.isListening())n._fireAndBubble(w3,{evt:e});else this._fire(w3,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let n=this.getIntersection(this.getPointerPosition());if(n&&n.isListening())n._fireAndBubble(y3,{evt:e});else this._fire(y3,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let n=Eb(e.pointerId)||this.getIntersection(this.getPointerPosition());if(n)n._fireAndBubble(Sd,qb(e));vh(e.pointerId)}_lostpointercapture(e){vh(e.pointerId)}setPointersPositions(e){let n=this._getContentPosition(),i=null,s=null;if(e=e?e:window.event,e.touches!==void 0)this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(a)=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,(a)=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})});else i=(e.clientX-n.left)/n.scaleX,s=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:i,y:s},this._pointerPositions=[{x:i,y:s,id:Pe._getFirstPointerId(e)}],this._changedPointerPositions=[{x:i,y:s,id:Pe._getFirstPointerId(e)}]}_setPointerPosition(e){Pe.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Nr({width:0,height:0}),this.bufferHitCanvas=new wh({pixelRatio:1,width:0,height:0}),!Ct.isBrowser)return;let e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=e.ownerDocument.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),H_(this._getOwnerWindow()),this._resizeDOM()}cache(){return Pe.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}xd.prototype.nodeType=GF;wn(xd);ye.addGetterSetter(xd,"container");var J_="hasShadow",Z_="shadowRGBA",ex="patternImage",tx="linearGradient",nx="radialGradient",Fb;function v3(){if(Fb)return Fb;return Fb=Pe.createCanvasElement().getContext("2d"),Fb}var Sh={};function QF(e){let n=this.attrs.fillRule;if(n)e.fill(n);else e.fill()}function JF(e){e.stroke()}function ZF(e){let n=this.attrs.fillRule;if(n)e.fill(n);else e.fill()}function eN(e){e.stroke()}function tN(){this._clearCache(J_)}function nN(){this._clearCache(Z_)}function iN(){this._clearCache(ex)}function sN(){this._clearCache(tx)}function aN(){this._clearCache(nx)}class _t extends St{constructor(e){super(e);let n,i=0;while(!0){if(n=Pe.getHitColor(),n&&!(n in Sh))break;if(i++,i>=1e4){Pe.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),n=Pe.getRandomColor();break}}this.colorKey=n,Sh[n]=this}getContext(){return Pe.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Pe.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(J_,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(ex,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let n=v3().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){let i=new Gs;i.translate(this.fillPatternX(),this.fillPatternY()),i.rotate(Ct.getAngle(this.fillPatternRotation())),i.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),i.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let s=i.getMatrix(),a=typeof DOMMatrix>"u"?{a:s[0],b:s[1],c:s[2],d:s[3],e:s[4],f:s[5]}:new DOMMatrix(s);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(tx,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let n=v3(),i=this.fillLinearGradientStartPoint(),s=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(i.x,i.y,s.x,s.y);for(let r=0;r<e.length;r+=2)a.addColorStop(e[r],e[r+1]);return a}}_getRadialGradient(){return this._getCache(nx,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let n=v3(),i=this.fillRadialGradientStartPoint(),s=this.fillRadialGradientEndPoint(),a=n.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),s.x,s.y,this.fillRadialGradientEndRadius());for(let r=0;r<e.length;r+=2)a.addColorStop(e[r],e[r+1]);return a}}getShadowRGBA(){return this._getCache(Z_,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=Pe.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let e=this.hitStrokeWidth();if(e==="auto")return this.hasStroke();return this.strokeEnabled()&&!!e}intersects(e){let n=this.getStage();if(!n)return!1;let i=n._syncBufferSize(n.bufferHitCanvas);return i.getContext().clear(),this.drawHit(i,void 0,!0),i.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return St.prototype.destroy.call(this),delete Sh[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;let s=e||this.hasFill(),a=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(s&&a&&r)return!0;let l=this.hasShadow(),c=this.shadowForStrokeEnabled();if(s&&a&&l&&c)return!0;return!1}setStrokeHitEnabled(e){if(Pe.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e)this.hitStrokeWidth("auto");else this.hitStrokeWidth(0)}getStrokeHitEnabled(){if(this.hitStrokeWidth()===0)return!1;else return!0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let n=!1,i=this.getParent();while(i){if(i.isCached()){n=!0;break}i=i.getParent()}let s=e.skipTransform,a=e.relativeTo||n&&this.getStage()||void 0,r=this.getSelfRect(),c=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,p=r.width+c,m=r.height+c,g=!e.skipShadow&&this.hasShadow(),y=g?this.shadowOffsetX():0,x=g?this.shadowOffsetY():0,I=p+Math.abs(y),M=m+Math.abs(x),H=g&&this.shadowBlur()||0,X=I+H*2,W=M+H*2,Y={width:X,height:W,x:-(c/2+H)+Math.min(y,0)+r.x,y:-(c/2+H)+Math.min(x,0)+r.y};if(!s)return this._transformedRect(Y,a);return Y}drawScene(e,n,i){let s=this.getLayer(),a=e||s.getCanvas(),r=a.getContext(),l=this._getCanvasCache(),c=this.getSceneFunc(),p=this.hasShadow(),m,g=!1,y=n===this;if(!this.isVisible()&&!y)return this;if(l){r.save();let x=this.getAbsoluteTransform(n).getMatrix();return r.transform(x[0],x[1],x[2],x[3],x[4],x[5]),this._drawCachedSceneCanvas(r),r.restore(),this}if(!c)return this;if(r.save(),this._useBufferCanvas()){m=this.getStage();let x=i||m._syncBufferSize(m.bufferCanvas),I=x.getContext();if(i)I.save(),I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,x.width,x.height),I.restore();else I.clear();I.save(),I.imageSmoothingEnabled=r.imageSmoothingEnabled,I._applyLineJoin(this),I._applyMiterLimit(this);let M=this.getAbsoluteTransform(n).getMatrix();I.transform(M[0],M[1],M[2],M[3],M[4],M[5]),c.call(this,I,this),I.restore();let H=x.pixelRatio;if(p)r._applyShadow(this);if(!y)r._applyOpacity(this),r._applyGlobalCompositeOperation(this);r.drawImage(x._canvas,x.x||0,x.y||0,x.width/H,x.height/H)}else{if(r._applyLineJoin(this),r._applyMiterLimit(this),!y){let x=this.getAbsoluteTransform(n).getMatrix();r.transform(x[0],x[1],x[2],x[3],x[4],x[5]),r._applyOpacity(this),r._applyGlobalCompositeOperation(this)}if(p)r._applyShadow(this);c.call(this,r,this)}return r.restore(),this}drawHit(e,n,i=!1){if(!this.shouldDrawHit(n,i))return this;let s=this.getLayer(),a=e||s.hitCanvas,r=a&&a.getContext(),l=this.hitFunc()||this.sceneFunc(),c=this._getCachedHitCanvas(n);if(!this.colorKey)Pe.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()");if(c){r.save();let m=this.getAbsoluteTransform(n).getMatrix();return r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),this._drawCachedHitCanvas(r,c),r.restore(),this}if(!l)return this;if(r.save(),r._applyLineJoin(this),r._applyMiterLimit(this),this!==n){let m=this.getAbsoluteTransform(n).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5])}return l.call(this,r,this),r.restore(),this}drawHitFromCache(e=0){let n=this._getCachedSceneCanvas(),i=this._getCachedHitCanvas(),s=i.getContext(),a=i.getWidth(),r=i.getHeight();s.clear(),s.drawImage(n._canvas,0,0,a,r);try{let l=s.getImageData(0,0,a,r),c=l.data,p=c.length,m=Pe._hexToRgb(this.colorKey);for(let g=0;g<p;g+=4)if(c[g+3]>e)c[g]=m.r,c[g+1]=m.g,c[g+2]=m.b,c[g+3]=255;else c[g+3]=0;s.putImageData(l,0,0)}catch(l){Pe.error("Unable to draw hit graph from cached scene canvas. "+l.message)}return this}hasPointerCapture(e){return Db(e,this)}setPointerCapture(e){Ib(e,this)}releaseCapture(e){vh(e,this)}}_t.prototype._fillFunc=QF;_t.prototype._strokeFunc=JF;_t.prototype._fillFuncHit=ZF;_t.prototype._strokeFuncHit=eN;_t.prototype._centroid=!1;_t.prototype.nodeType="Shape";wn(_t);_t.prototype.eventListeners={};_t.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",tN);_t.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",nN);_t.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",iN);_t.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",sN);_t.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",aN);ye.addGetterSetter(_t,"stroke",void 0,p3());ye.addGetterSetter(_t,"strokeWidth",2,mt());ye.addGetterSetter(_t,"fillAfterStrokeEnabled",!1);ye.addGetterSetter(_t,"hitStrokeWidth","auto",Mp());ye.addGetterSetter(_t,"strokeHitEnabled",!0,Vs());ye.addGetterSetter(_t,"perfectDrawEnabled",!0,Vs());ye.addGetterSetter(_t,"shadowForStrokeEnabled",!0,Vs());ye.addGetterSetter(_t,"lineJoin");ye.addGetterSetter(_t,"lineCap");ye.addGetterSetter(_t,"miterLimit");ye.addGetterSetter(_t,"sceneFunc");ye.addGetterSetter(_t,"hitFunc");ye.addGetterSetter(_t,"dash");ye.addGetterSetter(_t,"dashOffset",0,mt());ye.addGetterSetter(_t,"shadowColor",void 0,Uo());ye.addGetterSetter(_t,"shadowBlur",0,mt());ye.addGetterSetter(_t,"shadowOpacity",1,mt());ye.addComponentsGetterSetter(_t,"shadowOffset",["x","y"]);ye.addGetterSetter(_t,"shadowOffsetX",0,mt());ye.addGetterSetter(_t,"shadowOffsetY",0,mt());ye.addGetterSetter(_t,"fillPatternImage");ye.addGetterSetter(_t,"fill",void 0,p3());ye.addGetterSetter(_t,"fillPatternX",0,mt());ye.addGetterSetter(_t,"fillPatternY",0,mt());ye.addGetterSetter(_t,"fillLinearGradientColorStops");ye.addGetterSetter(_t,"strokeLinearGradientColorStops");ye.addGetterSetter(_t,"fillRadialGradientStartRadius",0);ye.addGetterSetter(_t,"fillRadialGradientEndRadius",0);ye.addGetterSetter(_t,"fillRadialGradientColorStops");ye.addGetterSetter(_t,"fillPatternRepeat","repeat");ye.addGetterSetter(_t,"fillEnabled",!0);ye.addGetterSetter(_t,"strokeEnabled",!0);ye.addGetterSetter(_t,"shadowEnabled",!0);ye.addGetterSetter(_t,"dashEnabled",!0);ye.addGetterSetter(_t,"strokeScaleEnabled",!0);ye.addGetterSetter(_t,"fillPriority","color");ye.addComponentsGetterSetter(_t,"fillPatternOffset",["x","y"]);ye.addGetterSetter(_t,"fillPatternOffsetX",0,mt());ye.addGetterSetter(_t,"fillPatternOffsetY",0,mt());ye.addComponentsGetterSetter(_t,"fillPatternScale",["x","y"]);ye.addGetterSetter(_t,"fillPatternScaleX",1,mt());ye.addGetterSetter(_t,"fillPatternScaleY",1,mt());ye.addComponentsGetterSetter(_t,"fillLinearGradientStartPoint",["x","y"]);ye.addComponentsGetterSetter(_t,"strokeLinearGradientStartPoint",["x","y"]);ye.addGetterSetter(_t,"fillLinearGradientStartPointX",0);ye.addGetterSetter(_t,"strokeLinearGradientStartPointX",0);ye.addGetterSetter(_t,"fillLinearGradientStartPointY",0);ye.addGetterSetter(_t,"strokeLinearGradientStartPointY",0);ye.addComponentsGetterSetter(_t,"fillLinearGradientEndPoint",["x","y"]);ye.addComponentsGetterSetter(_t,"strokeLinearGradientEndPoint",["x","y"]);ye.addGetterSetter(_t,"fillLinearGradientEndPointX",0);ye.addGetterSetter(_t,"strokeLinearGradientEndPointX",0);ye.addGetterSetter(_t,"fillLinearGradientEndPointY",0);ye.addGetterSetter(_t,"strokeLinearGradientEndPointY",0);ye.addComponentsGetterSetter(_t,"fillRadialGradientStartPoint",["x","y"]);ye.addGetterSetter(_t,"fillRadialGradientStartPointX",0);ye.addGetterSetter(_t,"fillRadialGradientStartPointY",0);ye.addComponentsGetterSetter(_t,"fillRadialGradientEndPoint",["x","y"]);ye.addGetterSetter(_t,"fillRadialGradientEndPointX",0);ye.addGetterSetter(_t,"fillRadialGradientEndPointY",0);ye.addGetterSetter(_t,"fillPatternRotation",0);ye.addGetterSetter(_t,"fillRule",void 0,Uo());ye.backCompat(_t,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var rN="beforeDraw",oN="draw",ix=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],lN=ix.length;class zo extends Rs{constructor(e){super(e);this.canvas=new Nr,this.hitCanvas=new wh({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);let n=this.getStage();if(n&&n.content)if(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1)n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas);else n.content.appendChild(this.getNativeCanvasElement());return this}moveToTop(){St.prototype.moveToTop.call(this);let e=this.getStage();if(e&&e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement());return!0}moveUp(){if(!St.prototype.moveUp.call(this))return!1;let n=this.getStage();if(!n||!n.content)return!1;if(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1)n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas);else n.content.appendChild(this.getNativeCanvasElement());return!0}moveDown(){if(St.prototype.moveDown.call(this)){let e=this.getStage();if(e){let n=e.children;if(e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas)}return!0}return!1}moveToBottom(){if(St.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let n=e.children;if(e.content)e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas)}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();if(St.prototype.remove.call(this),e&&e.parentNode&&Pe._isInDocument(e))e.parentNode.removeChild(e);return this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this._syncHitCanvasSize(),this._setSmoothEnabled(),this}_syncHitCanvasSize(){let e=this.isListening();this.hitCanvas.setSizeIfChanged((e?this.getWidth():0)||0,(e?this.getHeight():0)||0)}_validateAdd(e){let n=e.getType();if(n!=="Group"&&n!=="Shape")Pe.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),St.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){if(this.visible())this.canvas._canvas.style.display="block";else this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Pe.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Pe.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){var e;if(!this._waitingForDraw)this._waitingForDraw=!0,Pe.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1},(e=this.getStage())===null||e===void 0?void 0:e._getOwnerWindow());return this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,i=!1;while(!0){for(let s=0;s<lN;s++){let a=ix[s],r=this._getIntersection({x:e.x+a.x*n,y:e.y+a.y*n}),l=r.shape;if(l)return l;if(i=!!r.antialiased,!r.antialiased)break}if(i)n+=1;else return null}}_getIntersection(e){if(!this.hitCanvas.width||!this.hitCanvas.height)return{};let n=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,s=i[3];if(s===255){let a=Pe.getHitColorKey(i[0],i[1],i[2]),r=Sh[a];if(r)return{shape:r};return{antialiased:!0}}else if(s>0)return{antialiased:!0};return{}}drawScene(e,n,i){let s=this.getLayer(),a=e||s&&s.getCanvas();if(this._fire(rN,{node:this}),this.clearBeforeDraw())a.getContext().clear();return Rs.prototype.drawScene.call(this,a,n,i),this._fire(oN,{node:this}),this}drawHit(e,n){let i=this.getLayer(),s=e||i&&i.hitCanvas;if(!e&&i){if(i._syncHitCanvasSize(),i.clearBeforeDraw())i.getHitCanvas().getContext().clear()}return Rs.prototype.drawHit.call(this,s,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Pe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Pe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;if(!!this.hitCanvas._canvas.parentNode)e.content.removeChild(this.hitCanvas._canvas);else e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Pe.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}zo.prototype.nodeType="Layer";wn(zo);ye.addGetterSetter(zo,"imageSmoothingEnabled",!0);ye.addGetterSetter(zo,"clearBeforeDraw",!0);ye.addGetterSetter(zo,"hitGraphEnabled",!0,Vs());class Up extends zo{constructor(e){super(e);this.listening(!1),Pe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Up.prototype.nodeType="FastLayer";wn(Up);class Go extends Rs{_validateAdd(e){let n=e.getType();if(n!=="Group"&&n!=="Shape")Pe.throw("You may only add groups and shapes to groups.")}}Go.prototype.nodeType="Group";wn(Go);var S3=function(){if($c.performance&&$c.performance.now)return function(){return $c.performance.now()};return function(){return new Date().getTime()}}();class _a{constructor(e,n){this.id=_a.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:S3(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];if(e)n=Array.isArray(e)?e:[e];return this.layers=n,this}getLayers(){return this.layers}addLayer(e){let n=this.layers,i=n.length;for(let s=0;s<i;s++)if(n[s]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let n=_a.animations,i=n.length;for(let s=0;s<i;s++)if(n[s].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=S3(),_a._addAnimation(this),this}stop(){return _a._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1000/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let n=e.id,i=this.animations,s=i.length;for(let a=0;a<s;a++)if(i[a].id===n){this.animations.splice(a,1);break}}static _runFrames(){let e={},n=this.animations;for(let i=0;i<n.length;i++){let s=n[i],{layers:a,func:r}=s;s._updateFrameObject(S3());let l=a.length,c;if(r)c=r.call(s,s.frame)!==!1;else c=!0;if(!c)continue;for(let p=0;p<l;p++){let m=a[p];if(m._id!==void 0)e[m._id]=m}}for(let i in e){if(!e.hasOwnProperty(i))continue;e[i].batchDraw()}}static _animationLoop(){let e=_a;if(e.animations.length)e._runFrames(),Pe.requestAnimFrame(e._animationLoop);else e.animRunning=!1}static _handleAnimation(){if(!this.animRunning)this.animRunning=!0,Pe.requestAnimFrame(this._animationLoop)}}_a.animations=[];_a.animIdCounter=0;_a.animRunning=!1;var cN={node:1,duration:1,easing:1,onFinish:1,yoyo:1},uN=1,sx=2,ax=3,rx=["fill","stroke","shadowColor"],hN=0;function Nb(e){return Pe.colorToRGBA(e)||Pe.throw('can not tween the color "'+e+'", because it is not a valid color.')}class ox{constructor(e,n,i,s,a,r,l){this.prop=e,this.propFunc=n,this.begin=s,this._pos=s,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=l,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=a-this.begin,this.pause()}fire(e){let n=this[e];if(n)n()}setTime(e){if(e>this.duration)if(this.yoyo)this._time=this.duration,this.reverse();else this.finish();else if(e<0)if(this.yoyo)this._time=0,this.play();else this.reset();else this._time=e,this.update()}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){if(e===void 0)e=this._time;return this.func(e,this.begin,this._change,this.duration)}play(){this.state=sx,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=ax,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){let e=this.getTimer()-this._startTime;if(this.state===sx)this.setTime(e);else if(this.state===ax)this.setTime(this.duration-e)}pause(){this.state=uN,this.fire("onPause")}getTimer(){return new Date().getTime()}}class mi{constructor(e){let n=this,i=e.node,s=i._id,a=e.easing||kd.Linear,r=!!e.yoyo,l,c;if(typeof e.duration>"u")l=0.3;else if(e.duration===0)l=0.001;else l=e.duration;this.node=i,this._id=hN++;let p=i.getLayer()||(i instanceof Ct.Stage?i.getLayers():null);if(!p)Pe.error("Tween constructor have `node` that is not in a layer. Please add node into layer first.");if(this.anim=new _a(function(){n.tween.onEnterFrame()},p),this.tween=new ox(c,function(m){n._tweenFunc(m)},a,0,1,l*1000,r),this._addListeners(),!mi.attrs[s])mi.attrs[s]={};if(!mi.attrs[s][this._id])mi.attrs[s][this._id]={};if(!mi.tweens[s])mi.tweens[s]={};for(c in e)if(cN[c]===void 0)this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){let i=this.node,s=i._id,a,r,l,c,p,m=mi.tweens[s][e];if(m)delete mi.attrs[s][m][e];let g=i.getAttr(e);if(Pe._isArray(n)){if(a=[],r=Math.max(n.length,g.length),e==="points"&&n.length!==g.length)if(n.length>g.length)c=g,g=Pe._prepareArrayForTween(g,n,i.closed());else l=n,n=Pe._prepareArrayForTween(n,g,i.closed());if(e.indexOf("fill")===0)for(let y=0;y<r;y++)if(y%2===0)a.push(n[y]-g[y]);else{let x=Nb(g[y]);p=Nb(n[y]),g[y]=x,a.push({r:p.r-x.r,g:p.g-x.g,b:p.b-x.b,a:p.a-x.a})}else for(let y=0;y<r;y++)a.push(n[y]-g[y])}else if(rx.indexOf(e)!==-1)g=Nb(g),p=Nb(n),a={r:p.r-g.r,g:p.g-g.g,b:p.b-g.b,a:p.a-g.a};else a=n-g;mi.attrs[s][this._id][e]={start:g,diff:a,end:n,trueEnd:l,trueStart:c},mi.tweens[s][e]=this._id}_tweenFunc(e){let n=this.node,i=mi.attrs[n._id][this._id],s,a,r,l,c,p,m,g;for(s in i){if(a=i[s],r=a.start,l=a.diff,g=a.end,Pe._isArray(r))if(c=[],m=Math.max(r.length,g.length),s.indexOf("fill")===0)for(p=0;p<m;p++)if(p%2===0)c.push((r[p]||0)+l[p]*e);else c.push("rgba("+Math.round(r[p].r+l[p].r*e)+","+Math.round(r[p].g+l[p].g*e)+","+Math.round(r[p].b+l[p].b*e)+","+(r[p].a+l[p].a*e)+")");else for(p=0;p<m;p++)c.push((r[p]||0)+l[p]*e);else if(rx.indexOf(s)!==-1)c="rgba("+Math.round(r.r+l.r*e)+","+Math.round(r.g+l.g*e)+","+Math.round(r.b+l.b*e)+","+(r.a+l.a*e)+")";else c=r+l*e;n.setAttr(s,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let e=this.node,n=mi.attrs[e._id][this._id];if(n.points&&n.points.trueEnd)e.setAttr("points",n.points.trueEnd);if(this.onFinish)this.onFinish.call(this)},this.tween.onReset=()=>{let e=this.node,n=mi.attrs[e._id][this._id];if(n.points&&n.points.trueStart)e.points(n.points.trueStart);if(this.onReset)this.onReset()},this.tween.onUpdate=()=>{if(this.onUpdate)this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1000),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let e=this.node._id,n=this._id,i=mi.tweens[e];if(this.pause(),this.anim)this.anim.stop();for(let s in i)delete mi.tweens[e][s];if(delete mi.attrs[e][n],mi.tweens[e]){if(Object.keys(mi.tweens[e]).length===0)delete mi.tweens[e];if(Object.keys(mi.attrs[e]).length===0)delete mi.attrs[e]}}}mi.attrs={};mi.tweens={};St.prototype.to=function(e){let n=e.onFinish;e.node=this,e.onFinish=function(){if(this.destroy(),n)n()},new mi(e).play()};var kd={BackEaseIn(e,n,i,s){return i*(e/=s)*e*(2.70158*e-1.70158)+n},BackEaseOut(e,n,i,s){return i*((e=e/s-1)*e*(2.70158*e+1.70158)+1)+n},BackEaseInOut(e,n,i,s){let a=1.70158;if((e/=s/2)<1)return i/2*(e*e*(((a*=1.525)+1)*e-a))+n;return i/2*((e-=2)*e*(((a*=1.525)+1)*e+a)+2)+n},ElasticEaseIn(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s)===1)return n+i;if(!r)r=s*0.3;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);return-(a*Math.pow(2,10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r))+n},ElasticEaseOut(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s)===1)return n+i;if(!r)r=s*0.3;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);return a*Math.pow(2,-10*e)*Math.sin((e*s-l)*(2*Math.PI)/r)+i+n},ElasticEaseInOut(e,n,i,s,a,r){let l=0;if(e===0)return n;if((e/=s/2)===2)return n+i;if(!r)r=s*0.44999999999999996;if(!a||a<Math.abs(i))a=i,l=r/4;else l=r/(2*Math.PI)*Math.asin(i/a);if(e<1)return-0.5*(a*Math.pow(2,10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r))+n;return a*Math.pow(2,-10*(e-=1))*Math.sin((e*s-l)*(2*Math.PI)/r)*0.5+i+n},BounceEaseOut(e,n,i,s){if((e/=s)<0.36363636363636365)return i*(7.5625*e*e)+n;else if(e<0.7272727272727273)return i*(7.5625*(e-=0.5454545454545454)*e+0.75)+n;else if(e<0.9090909090909091)return i*(7.5625*(e-=0.8181818181818182)*e+0.9375)+n;else return i*(7.5625*(e-=0.9545454545454546)*e+0.984375)+n},BounceEaseIn(e,n,i,s){return i-kd.BounceEaseOut(s-e,0,i,s)+n},BounceEaseInOut(e,n,i,s){if(e<s/2)return kd.BounceEaseIn(e*2,0,i,s)*0.5+n;else return kd.BounceEaseOut(e*2-s,0,i,s)*0.5+i*0.5+n},EaseIn(e,n,i,s){return i*(e/=s)*e+n},EaseOut(e,n,i,s){return-i*(e/=s)*(e-2)+n},EaseInOut(e,n,i,s){if((e/=s/2)<1)return i/2*e*e+n;return-i/2*(--e*(e-2)-1)+n},StrongEaseIn(e,n,i,s){return i*(e/=s)*e*e*e*e+n},StrongEaseOut(e,n,i,s){return i*((e=e/s-1)*e*e*e*e+1)+n},StrongEaseInOut(e,n,i,s){if((e/=s/2)<1)return i/2*e*e*e*e*e+n;return i/2*((e-=2)*e*e*e*e+2)+n},Linear(e,n,i,s){return i*e/s+n}};var Td=Pe._assign(Ct,{Util:Pe,Transform:Gs,Node:St,Container:Rs,Stage:xd,stages:_d,Layer:zo,FastLayer:Up,Group:Go,DD:Hn,Shape:_t,shapes:Sh,Animation:_a,Tween:mi,Easings:kd,Context:wd,Canvas:Ip});class ao extends _t{_sceneFunc(e){let n=Ct.getAngle(this.angle()),i=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,i),e.arc(0,0,this.innerRadius(),n,0,!i),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){let e=this.innerRadius(),n=this.outerRadius(),i=this.clockwise(),s=Ct.getAngle(this.angle());if(s%(Math.PI*2)===0)return s!==0?{x:-n,y:-n,width:n*2,height:n*2}:{x:e,y:0,width:n-e,height:0};let a=Ct.getAngle(i?360-this.angle():this.angle()),r=Math.cos(Math.min(a,Math.PI)),l=1,c=Math.sin(Math.min(Math.max(Math.PI,a),3*Math.PI/2)),p=Math.sin(Math.min(a,Math.PI/2)),m=r*(r>0?e:n),g=l*(l>0?n:e),y=c*(c>0?e:n),x=p*(p>0?n:e);return{x:m,y:i?-1*x:y,width:g-m,height:x-y}}}ao.prototype._centroid=!0;ao.prototype.className="Arc";ao.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];wn(ao);ye.addGetterSetter(ao,"innerRadius",0,mt());ye.addGetterSetter(ao,"outerRadius",0,mt());ye.addGetterSetter(ao,"angle",0,mt());ye.addGetterSetter(ao,"clockwise",!1,Vs());var fN=[[],[],[-0.5773502691896257,0.5773502691896257],[0,-0.7745966692414834,0.7745966692414834],[-0.33998104358485626,0.33998104358485626,-0.8611363115940526,0.8611363115940526],[0,-0.5384693101056831,0.5384693101056831,-0.906179845938664,0.906179845938664],[0.6612093864662645,-0.6612093864662645,-0.2386191860831969,0.2386191860831969,-0.932469514203152,0.932469514203152],[0,0.4058451513773972,-0.4058451513773972,-0.7415311855993945,0.7415311855993945,-0.9491079123427585,0.9491079123427585],[-0.1834346424956498,0.1834346424956498,-0.525532409916329,0.525532409916329,-0.7966664774136267,0.7966664774136267,-0.9602898564975363,0.9602898564975363],[0,-0.8360311073266358,0.8360311073266358,-0.9681602395076261,0.9681602395076261,-0.3242534234038089,0.3242534234038089,-0.6133714327005904,0.6133714327005904],[-0.14887433898163122,0.14887433898163122,-0.4333953941292472,0.4333953941292472,-0.6794095682990244,0.6794095682990244,-0.8650633666889845,0.8650633666889845,-0.9739065285171717,0.9739065285171717],[0,-0.26954315595234496,0.26954315595234496,-0.5190961292068118,0.5190961292068118,-0.7301520055740494,0.7301520055740494,-0.8870625997680953,0.8870625997680953,-0.978228658146057,0.978228658146057],[-0.1252334085114689,0.1252334085114689,-0.3678314989981802,0.3678314989981802,-0.5873179542866175,0.5873179542866175,-0.7699026741943047,0.7699026741943047,-0.9041172563704749,0.9041172563704749,-0.9815606342467192,0.9815606342467192],[0,-0.2304583159551348,0.2304583159551348,-0.44849275103644687,0.44849275103644687,-0.6423493394403402,0.6423493394403402,-0.8015780907333099,0.8015780907333099,-0.9175983992229779,0.9175983992229779,-0.9841830547185881,0.9841830547185881],[-0.10805494870734367,0.10805494870734367,-0.31911236892788974,0.31911236892788974,-0.5152486363581541,0.5152486363581541,-0.6872929048116855,0.6872929048116855,-0.827201315069765,0.827201315069765,-0.9284348836635735,0.9284348836635735,-0.9862838086968123,0.9862838086968123],[0,-0.20119409399743451,0.20119409399743451,-0.3941513470775634,0.3941513470775634,-0.5709721726085388,0.5709721726085388,-0.7244177313601701,0.7244177313601701,-0.8482065834104272,0.8482065834104272,-0.937273392400706,0.937273392400706,-0.9879925180204854,0.9879925180204854],[-0.09501250983763744,0.09501250983763744,-0.2816035507792589,0.2816035507792589,-0.45801677765722737,0.45801677765722737,-0.6178762444026438,0.6178762444026438,-0.755404408355003,0.755404408355003,-0.8656312023878318,0.8656312023878318,-0.9445750230732326,0.9445750230732326,-0.9894009349916499,0.9894009349916499],[0,-0.17848418149584785,0.17848418149584785,-0.3512317634538763,0.3512317634538763,-0.5126905370864769,0.5126905370864769,-0.6576711592166907,0.6576711592166907,-0.7815140038968014,0.7815140038968014,-0.8802391537269859,0.8802391537269859,-0.9506755217687678,0.9506755217687678,-0.9905754753144174,0.9905754753144174],[-0.0847750130417353,0.0847750130417353,-0.2518862256915055,0.2518862256915055,-0.41175116146284263,0.41175116146284263,-0.5597708310739475,0.5597708310739475,-0.6916870430603532,0.6916870430603532,-0.8037049589725231,0.8037049589725231,-0.8926024664975557,0.8926024664975557,-0.9558239495713977,0.9558239495713977,-0.9915651684209309,0.9915651684209309],[0,-0.16035864564022537,0.16035864564022537,-0.31656409996362983,0.31656409996362983,-0.46457074137596094,0.46457074137596094,-0.600545304661681,0.600545304661681,-0.7209661773352294,0.7209661773352294,-0.8227146565371428,0.8227146565371428,-0.9031559036148179,0.9031559036148179,-0.96020815213483,0.96020815213483,-0.9924068438435844,0.9924068438435844],[-0.07652652113349734,0.07652652113349734,-0.22778585114164507,0.22778585114164507,-0.37370608871541955,0.37370608871541955,-0.5108670019508271,0.5108670019508271,-0.636053680726515,0.636053680726515,-0.7463319064601508,0.7463319064601508,-0.8391169718222188,0.8391169718222188,-0.912234428251326,0.912234428251326,-0.9639719272779138,0.9639719272779138,-0.9931285991850949,0.9931285991850949],[0,-0.1455618541608951,0.1455618541608951,-0.2880213168024011,0.2880213168024011,-0.4243421202074388,0.4243421202074388,-0.5516188358872198,0.5516188358872198,-0.6671388041974123,0.6671388041974123,-0.7684399634756779,0.7684399634756779,-0.8533633645833173,0.8533633645833173,-0.9200993341504008,0.9200993341504008,-0.9672268385663063,0.9672268385663063,-0.9937521706203895,0.9937521706203895],[-0.06973927331972223,0.06973927331972223,-0.20786042668822127,0.20786042668822127,-0.34193582089208424,0.34193582089208424,-0.469355837986757,0.469355837986757,-0.5876404035069116,0.5876404035069116,-0.6944872631866827,0.6944872631866827,-0.7878168059792081,0.7878168059792081,-0.8658125777203002,0.8658125777203002,-0.926956772187174,0.926956772187174,-0.9700604978354287,0.9700604978354287,-0.9942945854823992,0.9942945854823992],[0,-0.1332568242984661,0.1332568242984661,-0.26413568097034495,0.26413568097034495,-0.3903010380302908,0.3903010380302908,-0.5095014778460075,0.5095014778460075,-0.6196098757636461,0.6196098757636461,-0.7186613631319502,0.7186613631319502,-0.8048884016188399,0.8048884016188399,-0.8767523582704416,0.8767523582704416,-0.9329710868260161,0.9329710868260161,-0.9725424712181152,0.9725424712181152,-0.9947693349975522,0.9947693349975522],[-0.06405689286260563,0.06405689286260563,-0.1911188674736163,0.1911188674736163,-0.3150426796961634,0.3150426796961634,-0.4337935076260451,0.4337935076260451,-0.5454214713888396,0.5454214713888396,-0.6480936519369755,0.6480936519369755,-0.7401241915785544,0.7401241915785544,-0.820001985973903,0.820001985973903,-0.8864155270044011,0.8864155270044011,-0.9382745520027328,0.9382745520027328,-0.9747285559713095,0.9747285559713095,-0.9951872199970213,0.9951872199970213]],dN=[[],[],[1,1],[0.8888888888888888,0.5555555555555556,0.5555555555555556],[0.6521451548625461,0.6521451548625461,0.34785484513745385,0.34785484513745385],[0.5688888888888889,0.47862867049936647,0.47862867049936647,0.23692688505618908,0.23692688505618908],[0.3607615730481386,0.3607615730481386,0.46791393457269104,0.46791393457269104,0.17132449237917036,0.17132449237917036],[0.4179591836734694,0.3818300505051189,0.3818300505051189,0.27970539148927664,0.27970539148927664,0.1294849661688697,0.1294849661688697],[0.362683783378362,0.362683783378362,0.31370664587788727,0.31370664587788727,0.22238103445337448,0.22238103445337448,0.10122853629037626,0.10122853629037626],[0.3302393550012598,0.1806481606948574,0.1806481606948574,0.08127438836157441,0.08127438836157441,0.31234707704000286,0.31234707704000286,0.26061069640293544,0.26061069640293544],[0.29552422471475287,0.29552422471475287,0.26926671930999635,0.26926671930999635,0.21908636251598204,0.21908636251598204,0.1494513491505806,0.1494513491505806,0.06667134430868814,0.06667134430868814],[0.2729250867779006,0.26280454451024665,0.26280454451024665,0.23319376459199048,0.23319376459199048,0.18629021092773426,0.18629021092773426,0.1255803694649046,0.1255803694649046,0.05566856711617366,0.05566856711617366],[0.24914704581340277,0.24914704581340277,0.2334925365383548,0.2334925365383548,0.20316742672306592,0.20316742672306592,0.16007832854334622,0.16007832854334622,0.10693932599531843,0.10693932599531843,0.04717533638651183,0.04717533638651183],[0.2325515532308739,0.22628318026289723,0.22628318026289723,0.2078160475368885,0.2078160475368885,0.17814598076194574,0.17814598076194574,0.13887351021978725,0.13887351021978725,0.09212149983772845,0.09212149983772845,0.04048400476531588,0.04048400476531588],[0.2152638534631578,0.2152638534631578,0.2051984637212956,0.2051984637212956,0.18553839747793782,0.18553839747793782,0.15720316715819355,0.15720316715819355,0.12151857068790319,0.12151857068790319,0.08015808715976021,0.08015808715976021,0.03511946033175186,0.03511946033175186],[0.2025782419255613,0.19843148532711158,0.19843148532711158,0.1861610000155622,0.1861610000155622,0.16626920581699392,0.16626920581699392,0.13957067792615432,0.13957067792615432,0.10715922046717194,0.10715922046717194,0.07036604748810812,0.07036604748810812,0.03075324199611727,0.03075324199611727],[0.1894506104550685,0.1894506104550685,0.18260341504492358,0.18260341504492358,0.16915651939500254,0.16915651939500254,0.14959598881657674,0.14959598881657674,0.12462897125553388,0.12462897125553388,0.09515851168249279,0.09515851168249279,0.062253523938647894,0.062253523938647894,0.027152459411754096,0.027152459411754096],[0.17944647035620653,0.17656270536699264,0.17656270536699264,0.16800410215645004,0.16800410215645004,0.15404576107681028,0.15404576107681028,0.13513636846852548,0.13513636846852548,0.11188384719340397,0.11188384719340397,0.08503614831717918,0.08503614831717918,0.0554595293739872,0.0554595293739872,0.02414830286854793,0.02414830286854793],[0.1691423829631436,0.1691423829631436,0.16427648374583273,0.16427648374583273,0.15468467512626524,0.15468467512626524,0.14064291467065065,0.14064291467065065,0.12255520671147846,0.12255520671147846,0.10094204410628717,0.10094204410628717,0.07642573025488905,0.07642573025488905,0.0497145488949698,0.0497145488949698,0.02161601352648331,0.02161601352648331],[0.1610544498487837,0.15896884339395434,0.15896884339395434,0.15276604206585967,0.15276604206585967,0.1426067021736066,0.1426067021736066,0.12875396253933621,0.12875396253933621,0.11156664554733399,0.11156664554733399,0.09149002162245,0.09149002162245,0.06904454273764123,0.06904454273764123,0.0448142267656996,0.0448142267656996,0.019461788229726478,0.019461788229726478],[0.15275338713072584,0.15275338713072584,0.14917298647260374,0.14917298647260374,0.14209610931838204,0.14209610931838204,0.13168863844917664,0.13168863844917664,0.11819453196151841,0.11819453196151841,0.10193011981724044,0.10193011981724044,0.08327674157670475,0.08327674157670475,0.06267204833410907,0.06267204833410907,0.04060142980038694,0.04060142980038694,0.017614007139152118,0.017614007139152118],[0.14608113364969041,0.14452440398997005,0.14452440398997005,0.13988739479107315,0.13988739479107315,0.13226893863333747,0.13226893863333747,0.12183141605372853,0.12183141605372853,0.10879729916714838,0.10879729916714838,0.09344442345603386,0.09344442345603386,0.0761001136283793,0.0761001136283793,0.057134425426857205,0.057134425426857205,0.036953789770852494,0.036953789770852494,0.016017228257774335,0.016017228257774335],[0.13925187285563198,0.13925187285563198,0.13654149834601517,0.13654149834601517,0.13117350478706238,0.13117350478706238,0.12325237681051242,0.12325237681051242,0.11293229608053922,0.11293229608053922,0.10041414444288096,0.10041414444288096,0.08594160621706773,0.08594160621706773,0.06979646842452049,0.06979646842452049,0.052293335152683286,0.052293335152683286,0.03377490158481415,0.03377490158481415,0.0146279952982722,0.0146279952982722],[0.13365457218610619,0.1324620394046966,0.1324620394046966,0.12890572218808216,0.12890572218808216,0.12304908430672953,0.12304908430672953,0.11499664022241136,0.11499664022241136,0.10489209146454141,0.10489209146454141,0.09291576606003515,0.09291576606003515,0.07928141177671895,0.07928141177671895,0.06423242140852585,0.06423242140852585,0.04803767173108467,0.04803767173108467,0.030988005856979445,0.030988005856979445,0.013411859487141771,0.013411859487141771],[0.12793819534675216,0.12793819534675216,0.1258374563468283,0.1258374563468283,0.12167047292780339,0.12167047292780339,0.1155056680537256,0.1155056680537256,0.10744427011596563,0.10744427011596563,0.09761865210411388,0.09761865210411388,0.08619016153195327,0.08619016153195327,0.0733464814110803,0.0733464814110803,0.05929858491543678,0.05929858491543678,0.04427743881741981,0.04427743881741981,0.028531388628933663,0.028531388628933663,0.0123412297999872,0.0123412297999872]],pN=[[1],[1,1],[1,2,1],[1,3,3,1]],x3=(e,n,i)=>{let s,a,r=20,l=i/2;s=0;for(let c=0;c<20;c++)a=l*fN[20][c]+l,s+=dN[20][c]*mN(e,n,a);return l*s},k3=(e,n,i)=>{if(i===void 0)i=1;let s=e[0]-2*e[1]+e[2],a=n[0]-2*n[1]+n[2],r=2*e[1]-2*e[0],l=2*n[1]-2*n[0],c=4*(s*s+a*a),p=4*(s*r+a*l),m=r*r+l*l;if(c===0)return i*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(n[2]-n[0],2));let g=p/(2*c),y=m/c,x=i+g,I=y-g*g,M=x*x+I>0?Math.sqrt(x*x+I):0,H=g*g+I>0?Math.sqrt(g*g+I):0,X=g+Math.sqrt(g*g+I)!==0?I*Math.log(Math.abs((x+M)/(g+H))):0;return Math.sqrt(c)/2*(x*M-g*H+X)};function mN(e,n,i){let s=_3(1,i,e),a=_3(1,i,n),r=s*s+a*a;return Math.sqrt(r)}var _3=(e,n,i)=>{let s=i.length-1,a,r;if(s===0)return 0;if(e===0){r=0;for(let l=0;l<=s;l++)r+=pN[s][l]*Math.pow(1-n,s-l)*Math.pow(n,l)*i[l];return r}else{a=Array(s);for(let l=0;l<s;l++)a[l]=s*(i[l+1]-i[l]);return _3(e-1,n,a)}},T3=(e,n,i)=>{let s=1,a=e/n,r=(e-i(a))/n,l=0;while(s>0.001){let c=i(a+r),p=Math.abs(e-c)/n;if(p<s)s=p,a+=r;else{let m=i(a-r),g=Math.abs(e-m)/n;if(g<s)s=g,a-=r;else r/=2}if(l++,l>500)break}return a},lx=(e,n,i,s)=>{let a=1-s;return a*a*e+2*a*s*n+s*s*i},Pb=(e,n,i,s,a,r)=>{let l=[];for(let c of[[e,i,a],[n,s,r]]){let p=(c[0]-c[1])/(c[0]-2*c[1]+c[2]);if(p>0&&p<1)l.push(lx(e,i,a,p),lx(n,s,r,p))}return l},cx=(e,n,i,s,a)=>{let r=1-a;return r*r*r*e+3*r*r*a*n+3*r*a*a*i+a*a*a*s},zp=(e,n,i,s,a,r,l,c)=>{let p=[];for(let m of[[e,i,a,l],[n,s,r,c]]){let g=-3*m[0]+9*m[1]-9*m[2]+3*m[3],y=6*m[0]-12*m[1]+6*m[2],x=-3*m[0]+3*m[1],I=y*y-4*g*x;if(I<0)continue;let M=-(y+(y<0?-1:1)*Math.sqrt(I))/2;for(let H of[M/g,x/M])if(H>0&&H<1)p.push(cx(e,i,a,l,H),cx(n,s,r,c,H))}return p};function A3(e,n,i,s,a,r,l){let c=Math.sqrt(Math.pow(i-e,2)+Math.pow(s-n,2)),p=Math.sqrt(Math.pow(a-i,2)+Math.pow(r-s,2)),m=c+p;if(m===0)return[i,s,i,s];let g=l*c/m,y=l*p/m,x=i-g*(a-e),I=s-g*(r-n),M=i+y*(a-e),H=s+y*(r-n);return[x,I,M,H]}function ux(e,n){let i=e.length,s=[];for(let a=2;a<i-2;a+=2){let r=A3(e[a-2],e[a-1],e[a],e[a+1],e[a+2],e[a+3],n);if(isNaN(r[0]))continue;s.push(r[0]),s.push(r[1]),s.push(e[a]),s.push(e[a+1]),s.push(r[2]),s.push(r[3])}return s}function gN(e){let n=[];for(let i=0;i+7<e.length;i+=6)n.push(e[i+6],e[i+7],...zp(e[i],e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6],e[i+7]));return n}class Pr extends _t{constructor(e){super(e);this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_hasTension(){return this.tension()!==0&&this.points().length>4}_eachTensionSegment(e,n){let i=this.points(),s=i.length,a=this.closed(),r=this.getTensionPoints(),l=r.length,c=i[0],p=i[1],m=a?0:4;if(!a)e(c,p,r[0],r[1],r[2],r[3]),c=r[2],p=r[3];while(m<l-2){let g=r[m++],y=r[m++],x=r[m++],I=r[m++],M=r[m++],H=r[m++];n(c,p,g,y,x,I,M,H),c=M,p=H}if(!a)e(c,p,r[l-2],r[l-1],i[s-2],i[s-1])}_sceneFunc(e){let n=this.points(),i=n.length,s=this.closed(),a=this.bezier();if(!i)return;let r=0;if(e.beginPath(),e.moveTo(n[0],n[1]),this._hasTension())this._eachTensionSegment((l,c,p,m,g,y)=>e.quadraticCurveTo(p,m,g,y),(l,c,p,m,g,y,x,I)=>e.bezierCurveTo(p,m,g,y,x,I));else if(a){r=2;while(r<i)e.bezierCurveTo(n[r++],n[r++],n[r++],n[r++],n[r++],n[r++])}else for(r=2;r<i;r+=2)e.lineTo(n[r],n[r+1]);if(s)e.closePath(),e.fillStrokeShape(this);else e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){if(this.closed())return this._getTensionPointsClosed();else return ux(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),n=e.length,i=this.tension(),s=A3(e[n-2],e[n-1],e[0],e[1],e[2],e[3],i),a=A3(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],i),r=ux(e,i);return[s[2],s[3]].concat(r).concat([a[0],a[1],e[n-2],e[n-1],a[2],a[3],s[0],s[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};if(this._hasTension()){let c=[e[0],e[1]];this._eachTensionSegment((p,m,g,y,x,I)=>c.push(x,I,...Pb(p,m,g,y,x,I)),(p,m,g,y,x,I,M,H)=>c.push(M,H,...zp(p,m,g,y,x,I,M,H))),e=c}else if(this.bezier())e=[e[0],e[1],...gN(e)];let n=e[0],i=e[0],s=e[1],a=e[1],r,l;for(let c=0;c<e.length/2;c++)r=e[c*2],l=e[c*2+1],n=Math.min(n,r),i=Math.max(i,r),s=Math.min(s,l),a=Math.max(a,l);return{x:n,y:s,width:i-n,height:a-s}}}Pr.prototype.className="Line";Pr.prototype._attrsAffectingSize=["points","bezier","tension"];wn(Pr);ye.addGetterSetter(Pr,"closed",!1);ye.addGetterSetter(Pr,"bezier",!1);ye.addGetterSetter(Pr,"tension",0,mt());ye.addGetterSetter(Pr,"points",[],j_());class ci extends _t{constructor(e){super(e);this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ci.parsePathData(this.data()),this.pathLength=ci.getPathLength(this.dataArray)}_sceneFunc(e){let n=this.dataArray;e.beginPath();let i=!1;for(let s=0;s<n.length;s++){let a=n[s].command,r=n[s].points;switch(a){case"L":e.lineTo(r[0],r[1]);break;case"M":e.moveTo(r[0],r[1]);break;case"C":e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"Q":e.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case"A":let l=r[0],c=r[1],p=r[2],m=r[3],g=r[4],y=r[5],x=r[6],I=r[7],M=p>m?p:m,H=p>m?1:p/m,X=p>m?m/p:1;e.translate(l,c),e.rotate(x),e.scale(H,X),e.arc(0,0,M,g,g+y,1-I),e.scale(1/H,1/X),e.rotate(-x),e.translate(-l,-c);break;case"z":i=!0,e.closePath();break}}if(!i&&!this.hasFill())e.strokeShape(this);else e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(c){if(c.command==="A"){let p=c.points[4],m=c.points[5],g=c.points[4]+m,y=Math.PI/180;if(Math.abs(p-g)<y)y=Math.abs(p-g);if(m<0)for(let x=p-y;x>g;x-=y){let I=ci.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],x,0);e.push(I.x,I.y)}else for(let x=p+y;x<g;x+=y){let I=ci.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],x,0);e.push(I.x,I.y)}}else if(c.command==="C")e.push(c.start.x,c.start.y,c.points[4],c.points[5],...zp(c.start.x,c.start.y,c.points[0],c.points[1],c.points[2],c.points[3],c.points[4],c.points[5]));else if(c.command==="Q")e.push(c.start.x,c.start.y,c.points[2],c.points[3],...Pb(c.start.x,c.start.y,c.points[0],c.points[1],c.points[2],c.points[3]));else e=e.concat(c.points)});let n=e[0],i=e[0],s=e[1],a=e[1],r,l;for(let c=0;c<e.length/2;c++){if(r=e[c*2],l=e[c*2+1],!isNaN(r))n=Math.min(n,r),i=Math.max(i,r);if(!isNaN(l))s=Math.min(s,l),a=Math.max(a,l)}return{x:n,y:s,width:i-n,height:a-s}}getLength(){return this.pathLength}getPointAtLength(e){return ci.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,i,s){return Math.sqrt((i-e)*(i-e)+(s-n)*(s-n))}static getPathLength(e){let n=0;for(let i=0;i<e.length;++i)n+=e[i].pathLength;return n}static getPointAtLengthOfDataArray(e,n){let i,s=0,a=n.length;if(!a)return null;while(s<a&&e>n[s].pathLength)e-=n[s].pathLength,++s;if(s===a){let c=s-1;while(c>0&&n[c].points.length<2)c--;return i=n[c].points.slice(-2),{x:i[0],y:i[1]}}if(e<0.01)if(n[s].command==="M")return i=n[s].points.slice(0,2),{x:i[0],y:i[1]};else return{x:n[s].start.x,y:n[s].start.y};let r=n[s],l=r.points;switch(r.command){case"L":return ci.getPointOnLine(e,r.start.x,r.start.y,l[0],l[1]);case"C":return ci.getPointOnCubicBezier(T3(e,ci.getPathLength(n),(M)=>x3([r.start.x,l[0],l[2],l[4]],[r.start.y,l[1],l[3],l[5]],M)),r.start.x,r.start.y,l[0],l[1],l[2],l[3],l[4],l[5]);case"Q":return ci.getPointOnQuadraticBezier(T3(e,ci.getPathLength(n),(M)=>k3([r.start.x,l[0],l[2]],[r.start.y,l[1],l[3]],M)),r.start.x,r.start.y,l[0],l[1],l[2],l[3]);case"A":let c=l[0],p=l[1],m=l[2],g=l[3],y=l[5],x=l[6],I=l[4];return I+=y*e/r.pathLength,ci.getPointOnEllipticalArc(c,p,m,g,I,x)}return null}static getPointOnLine(e,n,i,s,a,r,l){r=r!==null&&r!==void 0?r:n,l=l!==null&&l!==void 0?l:i;let c=this.getLineLength(n,i,s,a);if(c<0.0000000001)return{x:n,y:i};if(s===n)return{x:r,y:l+(a>i?e:-e)};let p=(a-i)/(s-n),m=Math.sqrt(e*e/(1+p*p))*(s<n?-1:1),g=p*m;if(Math.abs(l-i-p*(r-n))<0.0000000001)return{x:r+m,y:l+g};let y=((r-n)*(s-n)+(l-i)*(a-i))/(c*c),x=n+y*(s-n),I=i+y*(a-i),M=this.getLineLength(r,l,x,I),H=Math.sqrt(e*e-M*M),X=Math.sqrt(H*H/(1+p*p))*(s<n?-1:1),W=p*X;return{x:x+X,y:I+W}}static getPointOnCubicBezier(e,n,i,s,a,r,l,c,p){function m(H){return H*H*H}function g(H){return 3*H*H*(1-H)}function y(H){return 3*H*(1-H)*(1-H)}function x(H){return(1-H)*(1-H)*(1-H)}let I=c*m(e)+r*g(e)+s*y(e)+n*x(e),M=p*m(e)+l*g(e)+a*y(e)+i*x(e);return{x:I,y:M}}static getPointOnQuadraticBezier(e,n,i,s,a,r,l){function c(x){return x*x}function p(x){return 2*x*(1-x)}function m(x){return(1-x)*(1-x)}let g=r*c(e)+s*p(e)+n*m(e),y=l*c(e)+a*p(e)+i*m(e);return{x:g,y}}static getPointOnEllipticalArc(e,n,i,s,a,r){let l=Math.cos(r),c=Math.sin(r),p={x:i*Math.cos(a),y:s*Math.sin(a)};return{x:e+(p.x*l-p.y*c),y:n+(p.x*c+p.y*l)}}static parsePathData(e){if(!e)return[];let n=e,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let g=0;g<i.length;g++)n=n.replace(new RegExp(i[g],"g"),"|"+i[g]);let s=n.split("|"),a=[],r=[],l=0,c=0,p=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,m;for(let g=1;g<s.length;g++){let y=s[g],x=y.charAt(0);y=y.slice(1),r.length=0;while(m=p.exec(y))r.push(m[0]);let I=[],M=x==="A"||x==="a"?0:-1;for(let H=0,X=r.length;H<X;H++){let W=r[H];if(W==="00"){if(I.push(0,0),M>=0){if(M+=2,M>=7)M-=7}continue}if(M>=0){if(M===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(W)){if(I.push(parseInt(W[0],10)),I.push(parseInt(W[1],10)),I.push(parseFloat(W.slice(2))),M+=3,M>=7)M-=7;continue}if(W==="11"||W==="10"||W==="01"){if(I.push(parseInt(W[0],10)),I.push(parseInt(W[1],10)),M+=2,M>=7)M-=7;continue}if(W==="0"||W==="1"){if(I.push(parseInt(W,10)),M+=1,M>=7)M-=7;continue}}else if(M===4){if(/^[01]\d+(?:\.\d+)?$/.test(W)){if(I.push(parseInt(W[0],10)),I.push(parseFloat(W.slice(1))),M+=2,M>=7)M-=7;continue}if(W==="0"||W==="1"){if(I.push(parseInt(W,10)),M+=1,M>=7)M-=7;continue}}let Y=parseFloat(W);if(!isNaN(Y))I.push(Y);else I.push(0);if(M+=1,M>=7)M-=7}else{let Y=parseFloat(W);if(!isNaN(Y))I.push(Y);else I.push(0)}}while(I.length>0){if(isNaN(I[0]))break;let H="",X=[],W=l,Y=c,te,ae,ne,oe,me,be,xe,Oe,Fe,Ue;switch(x){case"l":l+=I.shift(),c+=I.shift(),H="L",X.push(l,c);break;case"L":l=I.shift(),c=I.shift(),X.push(l,c);break;case"m":let ze=I.shift(),Le=I.shift();if(l+=ze,c+=Le,H="M",a.length>2&&a[a.length-1].command==="z"){for(let qe=a.length-2;qe>=0;qe--)if(a[qe].command==="M"){l=a[qe].points[0]+ze,c=a[qe].points[1]+Le;break}}X.push(l,c),x="l";break;case"M":l=I.shift(),c=I.shift(),H="M",X.push(l,c),x="L";break;case"h":l+=I.shift(),H="L",X.push(l,c);break;case"H":l=I.shift(),H="L",X.push(l,c);break;case"v":c+=I.shift(),H="L",X.push(l,c);break;case"V":c=I.shift(),H="L",X.push(l,c);break;case"C":X.push(I.shift(),I.shift(),I.shift(),I.shift()),l=I.shift(),c=I.shift(),X.push(l,c);break;case"c":X.push(l+I.shift(),c+I.shift(),l+I.shift(),c+I.shift()),l+=I.shift(),c+=I.shift(),H="C",X.push(l,c);break;case"S":if(ae=l,ne=c,te=a[a.length-1],te.command==="C")ae=l+(l-te.points[2]),ne=c+(c-te.points[3]);X.push(ae,ne,I.shift(),I.shift()),l=I.shift(),c=I.shift(),H="C",X.push(l,c);break;case"s":if(ae=l,ne=c,te=a[a.length-1],te.command==="C")ae=l+(l-te.points[2]),ne=c+(c-te.points[3]);X.push(ae,ne,l+I.shift(),c+I.shift()),l+=I.shift(),c+=I.shift(),H="C",X.push(l,c);break;case"Q":X.push(I.shift(),I.shift()),l=I.shift(),c=I.shift(),X.push(l,c);break;case"q":X.push(l+I.shift(),c+I.shift()),l+=I.shift(),c+=I.shift(),H="Q",X.push(l,c);break;case"T":if(ae=l,ne=c,te=a[a.length-1],te.command==="Q")ae=l+(l-te.points[0]),ne=c+(c-te.points[1]);l=I.shift(),c=I.shift(),H="Q",X.push(ae,ne,l,c);break;case"t":if(ae=l,ne=c,te=a[a.length-1],te.command==="Q")ae=l+(l-te.points[0]),ne=c+(c-te.points[1]);l+=I.shift(),c+=I.shift(),H="Q",X.push(ae,ne,l,c);break;case"A":oe=I.shift(),me=I.shift(),be=I.shift(),xe=I.shift(),Oe=I.shift(),Fe=l,Ue=c,l=I.shift(),c=I.shift(),H="A",X=this.convertEndpointToCenterParameterization(Fe,Ue,l,c,xe,Oe,oe,me,be);break;case"a":oe=I.shift(),me=I.shift(),be=I.shift(),xe=I.shift(),Oe=I.shift(),Fe=l,Ue=c,l+=I.shift(),c+=I.shift(),H="A",X=this.convertEndpointToCenterParameterization(Fe,Ue,l,c,xe,Oe,oe,me,be);break}a.push({command:H||x,points:X,start:{x:W,y:Y},pathLength:this.calcLength(W,Y,H||x,X)})}if(x==="z"||x==="Z")a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,n,i,s){let a,r,l,c,p=ci;switch(i){case"L":return p.getLineLength(e,n,s[0],s[1]);case"C":return x3([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return k3([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":a=0;let m=s[4],g=s[5],y=s[4]+g,x=Math.PI/180;if(Math.abs(m-y)<x)x=Math.abs(m-y);if(r=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],m,0),g<0)for(c=m-x;c>y;c-=x)l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],c,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),r=l;else for(c=m+x;c<y;c+=x)l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],c,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),r=l;return l=p.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],y,0),a+=p.getLineLength(r.x,r.y,l.x,l.y),a}return 0}static convertEndpointToCenterParameterization(e,n,i,s,a,r,l,c,p){let m=p*(Math.PI/180),g=Math.cos(m)*(e-i)/2+Math.sin(m)*(n-s)/2,y=-1*Math.sin(m)*(e-i)/2+Math.cos(m)*(n-s)/2,x=g*g/(l*l)+y*y/(c*c);if(x>1)l*=Math.sqrt(x),c*=Math.sqrt(x);let I=Math.sqrt((l*l*(c*c)-l*l*(y*y)-c*c*(g*g))/(l*l*(y*y)+c*c*(g*g)));if(a===r)I*=-1;if(isNaN(I))I=0;let M=I*l*y/c,H=I*-c*g/l,X=(e+i)/2+Math.cos(m)*M-Math.sin(m)*H,W=(n+s)/2+Math.sin(m)*M+Math.cos(m)*H,Y=function(xe){return Math.sqrt(xe[0]*xe[0]+xe[1]*xe[1])},te=function(xe,Oe){return(xe[0]*Oe[0]+xe[1]*Oe[1])/(Y(xe)*Y(Oe))},ae=function(xe,Oe){return(xe[0]*Oe[1]<xe[1]*Oe[0]?-1:1)*Math.acos(te(xe,Oe))},ne=ae([1,0],[(g-M)/l,(y-H)/c]),oe=[(g-M)/l,(y-H)/c],me=[(-1*g-M)/l,(-1*y-H)/c],be=ae(oe,me);if(te(oe,me)<=-1)be=Math.PI;if(te(oe,me)>=1)be=0;if(r===0&&be>0)be=be-2*Math.PI;if(r===1&&be<0)be=be+2*Math.PI;return[X,W,l,c,ne,be,m,r]}}ci.prototype.className="Path";ci.prototype._attrsAffectingSize=["data"];wn(ci);ye.addGetterSetter(ci,"data");class Nl extends Pr{_sceneFunc(e){super._sceneFunc(e);let n=Math.PI*2,i=this.points(),s=i,a=this.tension()!==0&&i.length>4;if(a)s=this.getTensionPoints();let r=this.pointerLength(),l=i.length,c,p;if(a){let y=[s[s.length-4],s[s.length-3],s[s.length-2],s[s.length-1],i[l-2],i[l-1]],x=ci.calcLength(s[s.length-4],s[s.length-3],"C",y),I=ci.getPointOnQuadraticBezier(Math.min(1,1-r/x),y[0],y[1],y[2],y[3],y[4],y[5]);c=i[l-2]-I.x,p=i[l-1]-I.y}else c=i[l-2]-i[l-4],p=i[l-1]-i[l-3];let m=(Math.atan2(p,c)+n)%n,g=this.pointerWidth();if(this.pointerAtEnding())e.save(),e.beginPath(),e.translate(i[l-2],i[l-1]),e.rotate(m),e.moveTo(0,0),e.lineTo(-r,g/2),e.lineTo(-r,-g/2),e.closePath(),e.restore(),this.__fillStroke(e);if(this.pointerAtBeginning()){if(e.save(),e.beginPath(),e.translate(i[0],i[1]),a)c=(s[0]+s[2])/2-i[0],p=(s[1]+s[3])/2-i[1];else c=i[2]-i[0],p=i[3]-i[1];e.rotate((Math.atan2(-p,-c)+n)%n),e.moveTo(0,0),e.lineTo(-r,g/2),e.lineTo(-r,-g/2),e.closePath(),e.restore(),this.__fillStroke(e)}}__fillStroke(e){let n=this.dashEnabled();if(n)this.attrs.dashEnabled=!1,e.setLineDash([]);if(e.fillStrokeShape(this),n)this.attrs.dashEnabled=!0}getSelfRect(){let e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}}Nl.prototype.className="Arrow";wn(Nl);ye.addGetterSetter(Nl,"pointerLength",10,mt());ye.addGetterSetter(Nl,"pointerWidth",10,mt());ye.addGetterSetter(Nl,"pointerAtBeginning",!1);ye.addGetterSetter(Nl,"pointerAtEnding",!0);class eu extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){if(this.radius()!==e/2)this.radius(e/2)}setHeight(e){if(this.radius()!==e/2)this.radius(e/2)}}eu.prototype._centroid=!0;eu.prototype.className="Circle";eu.prototype._attrsAffectingSize=["radius"];wn(eu);ye.addGetterSetter(eu,"radius",0,mt());class Vo extends _t{_sceneFunc(e){let n=this.radiusX(),i=this.radiusY();if(e.beginPath(),e.save(),n!==i)e.scale(1,i/n);e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Vo.prototype.className="Ellipse";Vo.prototype._centroid=!0;Vo.prototype._attrsAffectingSize=["radiusX","radiusY"];wn(Vo);ye.addComponentsGetterSetter(Vo,"radius",["x","y"]);ye.addGetterSetter(Vo,"radiusX",0,mt());ye.addGetterSetter(Vo,"radiusY",0,mt());class Ua extends _t{constructor(e){super(e);this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",(n)=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let e=this.image();if(e&&e.complete)return;if(e&&e.readyState===4)return;if(e&&e.addEventListener)e.addEventListener("load",this._loadListener)}_removeImageLoad(e){if(e&&e.removeEventListener)e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let e=!!this.cornerRadius(),n=this.hasShadow();if(e&&n)return!0;return super._useBufferCanvas(!0)}_sceneFunc(e){let n=this.getWidth(),i=this.getHeight(),s=this.cornerRadius(),a=this.attrs.image,r;if(a){let l=this.attrs.cropWidth,c=this.attrs.cropHeight;if(l&&c)r=[a,this.cropX(),this.cropY(),l,c,0,0,n,i];else r=[a,0,0,n,i]}if(this.hasFill()||this.hasStroke()||s)e.beginPath(),s?Pe.drawRoundedRectPath(e,n,i,s):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this);if(a){if(s)e.clip();e.drawImage.apply(e,r)}}_hitFunc(e){let n=this.width(),i=this.height(),s=this.cornerRadius();if(e.beginPath(),!s)e.rect(0,0,n,i);else Pe.drawRoundedRectPath(e,n,i,s);e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n,i;return(i=(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&i!==void 0?i:0}getHeight(){var e,n,i;return(i=(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&i!==void 0?i:0}static fromURL(e,n,i=null){let s=Pe.createImageElement();s.onload=function(){let a=new Ua({image:s});n(a)},s.onerror=i,s.crossOrigin="Anonymous",s.src=e}}Ua.prototype.className="Image";Ua.prototype._attrsAffectingSize=["image"];wn(Ua);ye.addGetterSetter(Ua,"cornerRadius",0,Qc(4));ye.addGetterSetter(Ua,"image");ye.addComponentsGetterSetter(Ua,"crop",["x","y","width","height"]);ye.addGetterSetter(Ua,"cropX",0,mt());ye.addGetterSetter(Ua,"cropY",0,mt());ye.addGetterSetter(Ua,"cropWidth",0,mt());ye.addGetterSetter(Ua,"cropHeight",0,mt());var hx=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],bN="Change.konva",wN="none",C3="up",j3="right",E3="down",q3="left",yN=hx.length;class Gp extends Go{constructor(e){super(e);this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,i,s=function(){n._sync()};for(i=0;i<yN;i++)e.on(hx[i]+bN,s)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),n=this.getTag(),i,s,a,r,l,c,p;if(e&&n){switch(i=e.width(),s=e.height(),a=n.pointerDirection(),r=n.pointerWidth(),p=n.pointerHeight(),l=0,c=0,a){case C3:l=i/2,c=-1*p;break;case j3:l=i+r,c=s/2;break;case E3:l=i/2,c=s+p;break;case q3:l=-1*r,c=s/2;break}n.setAttrs({x:-1*l,y:-1*c,width:i,height:s}),e.setAttrs({x:-1*l,y:-1*c})}}}Gp.prototype.className="Label";wn(Gp);class Pl extends _t{_sceneFunc(e){let n=this.width(),i=this.height(),s=this.pointerDirection(),a=this.pointerWidth(),r=this.pointerHeight(),l=this.cornerRadius(),c=0,p=0,m=0,g=0;if(typeof l==="number")c=p=m=g=Math.min(l,n/2,i/2);else c=Math.min(l[0]||0,n/2,i/2),p=Math.min(l[1]||0,n/2,i/2),g=Math.min(l[2]||0,n/2,i/2),m=Math.min(l[3]||0,n/2,i/2);if(e.beginPath(),e.moveTo(c,0),s===C3)e.lineTo((n-a)/2,0),e.lineTo(n/2,-1*r),e.lineTo((n+a)/2,0);if(e.lineTo(n-p,0),e.arc(n-p,p,p,Math.PI*3/2,0,!1),s===j3)e.lineTo(n,(i-r)/2),e.lineTo(n+a,i/2),e.lineTo(n,(i+r)/2);if(e.lineTo(n,i-g),e.arc(n-g,i-g,g,0,Math.PI/2,!1),s===E3)e.lineTo((n+a)/2,i),e.lineTo(n/2,i+r),e.lineTo((n-a)/2,i);if(e.lineTo(m,i),e.arc(m,i-m,m,Math.PI/2,Math.PI,!1),s===q3)e.lineTo(0,(i+r)/2),e.lineTo(-1*a,i/2),e.lineTo(0,(i-r)/2);e.lineTo(0,c),e.arc(c,c,c,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,n=0,i=this.pointerWidth(),s=this.pointerHeight(),a=this.pointerDirection(),r=this.width(),l=this.height();if(a===C3)n-=s,l+=s;else if(a===E3)l+=s;else if(a===q3)e-=i*1.5,r+=i;else if(a===j3)r+=i*1.5;return{x:e,y:n,width:r,height:l}}}Pl.prototype.className="Tag";wn(Pl);ye.addGetterSetter(Pl,"pointerDirection",wN);ye.addGetterSetter(Pl,"pointerWidth",0,mt());ye.addGetterSetter(Pl,"pointerHeight",0,mt());ye.addGetterSetter(Pl,"cornerRadius",0,Qc(4));class tu extends _t{_sceneFunc(e){let n=this.cornerRadius(),i=this.width(),s=this.height();if(e.beginPath(),!n)e.rect(0,0,i,s);else Pe.drawRoundedRectPath(e,i,s,n);e.closePath(),e.fillStrokeShape(this)}}tu.prototype.className="Rect";wn(tu);ye.addGetterSetter(tu,"cornerRadius",0,Qc(4));class Wo extends _t{_sceneFunc(e){let n=this._getPoints(),i=this.radius(),s=this.sides(),a=this.cornerRadius();if(e.beginPath(),!a){e.moveTo(n[0].x,n[0].y);for(let r=1;r<n.length;r++)e.lineTo(n[r].x,n[r].y)}else Pe.drawRoundedPolygonPath(e,n,s,i,a);e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,n=this.attrs.radius||0,i=[];for(let s=0;s<e;s++)i.push({x:n*Math.sin(s*2*Math.PI/e),y:-1*n*Math.cos(s*2*Math.PI/e)});return i}getSelfRect(){let e=this._getPoints(),n=e[0].x,i=e[0].x,s=e[0].y,a=e[0].y;return e.forEach((r)=>{n=Math.min(n,r.x),i=Math.max(i,r.x),s=Math.min(s,r.y),a=Math.max(a,r.y)}),{x:n,y:s,width:i-n,height:a-s}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Wo.prototype.className="RegularPolygon";Wo.prototype._centroid=!0;Wo.prototype._attrsAffectingSize=["radius"];wn(Wo);ye.addGetterSetter(Wo,"radius",0,mt());ye.addGetterSetter(Wo,"sides",0,mt());ye.addGetterSetter(Wo,"cornerRadius",0,Qc(4));var fx=Math.PI*2;class Bl extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,fx,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),fx,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Bl.prototype.className="Ring";Bl.prototype._centroid=!0;Bl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];wn(Bl);ye.addGetterSetter(Bl,"innerRadius",0,mt());ye.addGetterSetter(Bl,"outerRadius",0,mt());class Br extends _t{constructor(e){super(e);this._updated=!0,this.anim=new _a(()=>{let n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){if(!this.anim.isRunning())return;clearInterval(this.interval),this._setInterval()})}_sceneFunc(e){let n=this.animation(),i=this.frameIndex(),s=i*4,a=this.animations()[n],r=this.frameOffsets(),l=a[s+0],c=a[s+1],p=a[s+2],m=a[s+3],g=this.image();if(this.hasFill()||this.hasStroke())e.beginPath(),e.rect(0,0,p,m),e.closePath(),e.fillStrokeShape(this);if(g)if(r){let y=r[n],x=i*2;e.drawImage(g,l,c,p,m,y[x+0],y[x+1],p,m)}else e.drawImage(g,l,c,p,m,0,0,p,m)}_hitFunc(e){let n=this.animation(),i=this.frameIndex(),s=i*4,a=this.animations()[n],r=this.frameOffsets(),l=a[s+2],c=a[s+3];if(e.beginPath(),r){let p=r[n],m=i*2;e.rect(p[m+0],p[m+1],l,c)}else e.rect(0,0,l,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1000/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),n=this.animation(),i=this.animations(),s=i[n],a=s.length/4;if(e<a-1)this.frameIndex(e+1);else this.frameIndex(0)}}Br.prototype.className="Sprite";wn(Br);ye.addGetterSetter(Br,"animation");ye.addGetterSetter(Br,"animations");ye.addGetterSetter(Br,"frameOffsets");ye.addGetterSetter(Br,"image");ye.addGetterSetter(Br,"frameIndex",0,mt());ye.addGetterSetter(Br,"frameRate",17,mt());ye.backCompat(Br,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Ko extends _t{_sceneFunc(e){let n=this.innerRadius(),i=this.outerRadius(),s=this.numPoints();e.beginPath(),e.moveTo(0,0-i);for(let a=1;a<s*2;a++){let r=a%2===0?i:n,l=r*Math.sin(a*Math.PI/s),c=-1*r*Math.cos(a*Math.PI/s);e.lineTo(l,c)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ko.prototype.className="Star";Ko.prototype._centroid=!0;Ko.prototype._attrsAffectingSize=["innerRadius","outerRadius"];wn(Ko);ye.addGetterSetter(Ko,"numPoints",5,mt());ye.addGetterSetter(Ko,"innerRadius",0,mt());ye.addGetterSetter(Ko,"outerRadius",0,mt());function Cd(e){return[...e].reduce((n,i,s,a)=>{if(/\p{Emoji}/u.test(i)){let r=a[s+1];if(r&&/\p{Emoji_Modifier}|\u200D/u.test(r))n.push(i+r),a[s+1]="";else n.push(i)}else if(/\p{Regional_Indicator}{2}/u.test(i+(a[s+1]||"")))n.push(i+a[s+1]);else if(s>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(i))n[n.length-1]+=i;else if(i)n.push(i);return n},[])}var Ad="auto",vN="center",bx="inherit",Vp="justify",SN="Change.konva",wx="2d",dx="-",yx="left",_N="text",xN="Text",kN="top",TN="bottom",px="middle",vx="normal",AN="px ",Bb=" ",CN="right",mx="rtl",jN="word",EN="char",gx="none",D3="…",Sx=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],qN=Sx.length,Xp=null;function DN(){if(Xp!==null)return Xp;Xp=!1;try{let e=document.createElement("canvas");e.width=10,e.height=10;let n=e.getContext(wx);if(n){n.globalAlpha=0,n.shadowColor="black",n.shadowBlur=5,n.shadowOffsetX=5,n.shadowOffsetY=5,n.fillStyle="black",n.font="10px Arial",n.fillText("X",0,10);let i=n.getImageData(0,0,10,10).data;for(let s=3;s<i.length;s+=4)if(i[s]>0){Xp=!0;break}}}catch(e){}return Xp}function IN(e){return e.split(",").map((n)=>{n=n.trim();let i=n.indexOf(" ")>=0,s=n.indexOf('"')>=0||n.indexOf("'")>=0;if(i&&!s)n=`"${n}"`;return n}).join(", ")}var Lb;function I3(){if(Lb)return Lb;return Lb=Pe.createCanvasElement().getContext(wx),Lb}function MN(e){if(this._partialFillStyle)e.setAttr("fillStyle",this._partialFillStyle);e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function RN(e){if(e.setAttr("miterLimit",2),this._partialStrokeStyle)e.setAttr("strokeStyle",this._partialStrokeStyle);e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function ON(e){if(e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage)e.fill=e.fill||"black";return e}class ii extends _t{constructor(e){super(ON(e));this._partialTextX=0,this._partialTextY=0;for(let n=0;n<qN;n++)this.on(Sx[n]+SN,this._setTextData);this._setTextData()}_sceneFunc(e){var n,i;let s=this.textArr,a=s.length;if(!this.text())return;let r=this.padding(),l=this.fontSize(),c=this.lineHeight()*l,p=this.verticalAlign(),m=this.direction(),g=0,y=this.align(),x=this.getWidth(),I=this.letterSpacing(),M=this.charRenderFunc(),H=this.fill(),X=this.textDecoration(),W=this.underlineOffset(),Y=X.indexOf("underline")!==-1,te=X.indexOf("line-through")!==-1,ae;m=m===bx?e.direction:m;let ne=c/2,oe=px;if(!Ct.legacyTextRendering){let xe=this.measureSize("M");oe="alphabetic";let Oe=(n=xe.fontBoundingBoxAscent)!==null&&n!==void 0?n:xe.actualBoundingBoxAscent,Fe=(i=xe.fontBoundingBoxDescent)!==null&&i!==void 0?i:xe.actualBoundingBoxDescent;ne=(Oe-Fe)/2+c/2}if(m===mx)e.setAttr("direction",m);if(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",oe),e.setAttr("textAlign",yx),p===px)g=(this.getHeight()-a*c-r*2)/2;else if(p===TN)g=this.getHeight()-a*c-r*2;e.translate(r,g+r);let me=M?e.fillStyle:void 0,be=M?e.strokeStyle:void 0;for(ae=0;ae<a;ae++){let xe=0,Oe=0,Fe=s[ae],{text:Ue,width:ze,lastInParagraph:Le}=Fe;if(e.save(),y===CN)xe+=x-ze-r*2;else if(y===vN)xe+=(x-ze-r*2)/2;if(Y){e.save(),e.beginPath();let Me=W!==null&&W!==void 0?W:!Ct.legacyTextRendering?Math.round(l/4):Math.round(l/2),yt=xe,Ge=ne+Oe+Me;e.moveTo(yt,Ge);let Qe=y===Vp&&!Le?x-r*2:ze;e.lineTo(yt+Math.round(Qe),Ge),e.lineWidth=l/15;let jt=this._getLinearGradient();e.strokeStyle=jt||H,e.stroke(),e.restore()}let qe=xe;if(m!==mx&&(I!==0||y===Vp||M)){let Me=Ue.split(" ").length-1,yt=Cd(Ue);for(let Ge=0;Ge<yt.length;Ge++){let Qe=yt[Ge];if(Qe===" "&&!Le&&y===Vp)xe+=(x-r*2-ze)/Me;if(this._partialTextX=xe,this._partialTextY=ne+Oe,this._partialText=Qe,M){e.save();let ut=s.slice(0,ae).reduce((un,nn)=>un+Cd(nn.text).length,0),st=Ge+ut;M({char:Qe,index:st,x:xe,y:ne+Oe,lineIndex:ae,column:Ge,isLastInLine:Le,width:this.measureSize(Qe).width,context:e});let bt=e.fillStyle;if(bt!==me)this._partialFillStyle=bt;let Wt=e.strokeStyle;if(Wt!==be)this._partialStrokeStyle=Wt}if(e.fillStrokeShape(this),M)this._partialFillStyle=void 0,this._partialStrokeStyle=void 0,e.restore();xe+=this.measureSize(Qe).width+I}}else{if(I!==0)e.setAttr("letterSpacing",`${I}px`);this._partialTextX=xe,this._partialTextY=ne+Oe,this._partialText=Ue,e.fillStrokeShape(this)}if(te){e.save(),e.beginPath();let Me=!Ct.legacyTextRendering?-Math.round(l/4):0,yt=qe;e.moveTo(yt,ne+Oe+Me);let Ge=y===Vp&&!Le?x-r*2:ze;e.lineTo(yt+Math.round(Ge),ne+Oe+Me),e.lineWidth=l/15;let Qe=this._getLinearGradient();e.strokeStyle=Qe||H,e.stroke(),e.restore()}if(e.restore(),a>1)ne+=c}}_hitFunc(e){let n=this.getWidth(),i=this.getHeight();e.beginPath(),e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}setText(e){let n=Pe._isString(e)?e:e===null||e===void 0?"":e+"";return this._setAttr(_N,n),this}getWidth(){return this.attrs.width===Ad||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Ad||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Pe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,i,s,a,r,l,c,p,m,g,y;let x=I3(),I=this.fontSize(),M;x.save(),x.font=this._getContextFont(),M=x.measureText(e),x.restore();let H=I/100;return{actualBoundingBoxAscent:(n=M.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*H,actualBoundingBoxDescent:(i=M.actualBoundingBoxDescent)!==null&&i!==void 0?i:0,actualBoundingBoxLeft:(s=M.actualBoundingBoxLeft)!==null&&s!==void 0?s:-7.421875*H,actualBoundingBoxRight:(a=M.actualBoundingBoxRight)!==null&&a!==void 0?a:75.732421875*H,alphabeticBaseline:(r=M.alphabeticBaseline)!==null&&r!==void 0?r:0,emHeightAscent:(l=M.emHeightAscent)!==null&&l!==void 0?l:100*H,emHeightDescent:(c=M.emHeightDescent)!==null&&c!==void 0?c:-20*H,fontBoundingBoxAscent:(p=M.fontBoundingBoxAscent)!==null&&p!==void 0?p:91*H,fontBoundingBoxDescent:(m=M.fontBoundingBoxDescent)!==null&&m!==void 0?m:21*H,hangingBaseline:(g=M.hangingBaseline)!==null&&g!==void 0?g:72.80000305175781*H,ideographicBaseline:(y=M.ideographicBaseline)!==null&&y!==void 0?y:-21*H,width:M.width,height:I}}_getContextFont(){return this.fontStyle()+Bb+this.fontVariant()+Bb+(this.fontSize()+AN)+IN(this.fontFamily())}_addTextLine(e){if(this.align()===Vp)e=e.trim();let i=this._getTextWidth(e);return this.textArr.push({text:e,width:i,lastInParagraph:!1})}_getTextWidth(e){let n=this.letterSpacing(),i=e.length;return I3().measureText(e).width+n*i}_setTextData(){let e=this.text().split(`
|
|
237
|
+
`),n=+this.fontSize(),i=0,s=this.lineHeight()*n,a=this.attrs.width,r=this.attrs.height,l=a!==Ad&&a!==void 0,c=r!==Ad&&r!==void 0,p=this.padding(),m=a-p*2,g=r-p*2,y=0,x=this.wrap(),I=x!==gx,M=x!==EN&&I,H=this.ellipsis();this.textArr=[],I3().font=this._getContextFont();let X=H?this._getTextWidth(D3):0;for(let W=0,Y=e.length;W<Y;++W){let te=e[W],ae=this._getTextWidth(te);if(l&&ae>m)while(te.length>0){let ne=Cd(te),oe=0,me=ne.length,be="",xe=0;while(oe<me){let Oe=oe+me>>>1,Fe=ne.slice(0,Oe+1).join(""),Ue=this._getTextWidth(Fe);if((H&&c&&y+s>g?Ue+X:Ue)<=m)oe=Oe+1,be=Fe,xe=Ue;else me=Oe}if(be){if(M){let Fe=Cd(be),Ue=ne[Fe.length],ze=Ue===Bb||Ue===dx,Le;if(ze&&xe<=m)Le=Fe.length;else{let qe=Fe.lastIndexOf(Bb),Me=Fe.lastIndexOf(dx);Le=Math.max(qe,Me)+1}if(Le>0)oe=Le,be=ne.slice(0,oe).join(""),xe=this._getTextWidth(be)}if(be=be.trimRight(),this._addTextLine(be),i=Math.max(i,xe),y+=s,this._shouldHandleEllipsis(y)){this._tryToAddEllipsisToLastLine();break}if(te=ne.slice(oe).join("").trimLeft(),te.length>0){if(ae=this._getTextWidth(te),ae<=m){this._addTextLine(te),y+=s,i=Math.max(i,ae);break}}}else break}else if(this._addTextLine(te),y+=s,i=Math.max(i,ae),this._shouldHandleEllipsis(y)&&W<Y-1)this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1])this.textArr[this.textArr.length-1].lastInParagraph=!0;if(c&&y+s>g)break}this.textHeight=n,this.textWidth=i}_shouldHandleEllipsis(e){let n=+this.fontSize(),i=this.lineHeight()*n,s=this.attrs.height,a=s!==Ad&&s!==void 0,r=this.padding(),l=s-r*2;return this.wrap()===gx||a&&e+i>l}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,n=e!==Ad&&e!==void 0,i=this.padding(),s=e-i*2,a=this.ellipsis(),r=this.textArr[this.textArr.length-1];if(!r||!a)return;if(n){if(!(this._getTextWidth(r.text+D3)<s))r.text=r.text.slice(0,r.text.length-3)}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text+D3)}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();if(e&&n)return!0;if(n&&this.getAbsoluteOpacity()!==1&&DN())return!0;return super._useBufferCanvas()}}ii.prototype._fillFunc=MN;ii.prototype._strokeFunc=RN;ii.prototype.className=xN;ii.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];wn(ii);ye.overWriteSetter(ii,"width",Mp());ye.overWriteSetter(ii,"height",Mp());ye.addGetterSetter(ii,"direction",bx);ye.addGetterSetter(ii,"fontFamily","Arial");ye.addGetterSetter(ii,"fontSize",12,mt());ye.addGetterSetter(ii,"fontStyle",vx);ye.addGetterSetter(ii,"fontVariant",vx);ye.addGetterSetter(ii,"padding",0,mt());ye.addGetterSetter(ii,"align",yx);ye.addGetterSetter(ii,"verticalAlign",kN);ye.addGetterSetter(ii,"lineHeight",1,mt());ye.addGetterSetter(ii,"wrap",jN);ye.addGetterSetter(ii,"ellipsis",!1,Vs());ye.addGetterSetter(ii,"letterSpacing",0,mt());ye.addGetterSetter(ii,"text","",Uo());ye.addGetterSetter(ii,"textDecoration","");ye.addGetterSetter(ii,"underlineOffset",void 0,mt());ye.addGetterSetter(ii,"charRenderFunc",void 0);var FN="",_x="normal";function xx(e){e.fillText(this.partialText,0,0)}function Tx(e){e.strokeText(this.partialText,0,0)}class Wi extends _t{constructor(e){super(e);this.dummyCanvas=Pe.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return ci.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;let n=this.pathLength;if(e>n)return null;return ci.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=ci.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();let n=this.textDecoration(),i=this.fill(),s=this.fontSize(),a=this.glyphInfo,r=n.indexOf("underline")!==-1,l=n.indexOf("line-through")!==-1;if(r)e.beginPath();for(let c=0;c<a.length;c++){e.save();let p=a[c].p0;if(e.translate(p.x,p.y),e.rotate(a[c].rotation),this.partialText=a[c].text,e.fillStrokeShape(this),r){if(c===0)e.moveTo(0,s/2+1);e.lineTo(a[c].width,s/2+1)}e.restore()}if(r)e.strokeStyle=i,e.lineWidth=s/20,e.stroke();if(l){e.beginPath();for(let c=0;c<a.length;c++){e.save();let p=a[c].p0;if(e.translate(p.x,p.y),e.rotate(a[c].rotation),c===0)e.moveTo(0,0);e.lineTo(a[c].width,0),e.restore()}e.strokeStyle=i,e.lineWidth=s/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let n=this.glyphInfo;if(n.length>=1){let i=n[0].p0;e.moveTo(i.x,i.y)}for(let i=0;i<n.length;i++){let s=n[i].p1;e.lineTo(s.x,s.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Pe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return ii.prototype.setText.call(this,e)}_getContextFont(){return ii.prototype._getContextFont.call(this)}_getTextSize(e){let i=this.dummyCanvas.getContext("2d");i.save(),i.font=this._getContextFont();let s=i.measureText(e);return i.restore(),{width:s.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=Cd(this.text());if(this.direction()==="rtl")e.reverse();let n=[],i=0;for(let x=0;x<e.length;x++)n.push({char:e[x],width:this._getTextSize(e[x]).width}),i+=n[x].width;let{width:s,height:a}=this._getTextSize(this.attrs.text);if(this.textWidth=i,this.textHeight=a,this.glyphInfo=[],!this.attrs.data)return null;let r=this.letterSpacing(),l=this.align(),c=this.kerningFunc(),p=Math.max(0,i-s),m=Math.max(this.textWidth+((this.attrs.text||"").length-1)*r,0),g=0;if(l==="center")g=Math.max(0,this.pathLength/2-m/2);if(l==="right")g=Math.max(0,this.pathLength-m);let y=g;for(let x=0;x<n.length;x++){let I=this._getPointAtLength(y);if(!I)return;let M=n[x].char,H=n[x].width+r;if(M===" "&&l==="justify"){let oe=this.text().split(" ").length-1;H+=(this.pathLength-m)/oe}let X=y+H,W=this._getPointAtLength(X>this.pathLength&&X-this.pathLength<=p?this.pathLength:X);if(!W)return;let Y=ci.getLineLength(I.x,I.y,W.x,W.y),te=0;if(c)try{te=c(n[x-1].char,M)*this.fontSize()}catch(oe){te=0}I.x+=te,W.x+=te,this.textWidth+=te;let ae=ci.getPointOnLine(te+Y/2,I.x,I.y,W.x,W.y),ne=Math.atan2(W.y-I.y,W.x-I.x);this.glyphInfo.push({transposeX:ae.x,transposeY:ae.y,text:e[x],rotation:ne,p0:I,p1:W,width:Y}),y+=H}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(p){e.push(p.p0.x),e.push(p.p0.y),e.push(p.p1.x),e.push(p.p1.y)});let n=e[0]||0,i=e[0]||0,s=e[1]||0,a=e[1]||0,r,l;for(let p=0;p<e.length/2;p++)r=e[p*2],l=e[p*2+1],n=Math.min(n,r),i=Math.max(i,r),s=Math.min(s,l),a=Math.max(a,l);let c=this.fontSize();return{x:n-c/2,y:s-c/2,width:i-n+c,height:a-s+c}}destroy(){return Pe.releaseCanvas(this.dummyCanvas),super.destroy()}}Wi.prototype._fillFunc=xx;Wi.prototype._strokeFunc=Tx;Wi.prototype._fillFuncHit=xx;Wi.prototype._strokeFuncHit=Tx;Wi.prototype.className="TextPath";Wi.prototype._attrsAffectingSize=["text","fontSize","data"];wn(Wi);ye.addGetterSetter(Wi,"data");ye.addGetterSetter(Wi,"fontFamily","Arial");ye.addGetterSetter(Wi,"fontSize",12,mt());ye.addGetterSetter(Wi,"fontStyle",_x);ye.addGetterSetter(Wi,"align","left");ye.addGetterSetter(Wi,"letterSpacing",0,mt());ye.addGetterSetter(Wi,"textBaseline","middle");ye.addGetterSetter(Wi,"fontVariant",_x);ye.addGetterSetter(Wi,"text",FN);ye.addGetterSetter(Wi,"textDecoration","");ye.addGetterSetter(Wi,"kerningFunc",void 0);ye.addGetterSetter(Wi,"direction","inherit");var Ex="tr-konva",NN=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((e)=>e+`.${Ex}`).join(" "),Ax="nodesRect",PN=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],BN={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},LN="ontouchstart"in Ct._global;function HN(e,n,i){if(e==="rotater")return i;n+=Pe.degToRad(BN[e]||0);let s=(Pe.radToDeg(n)%360+360)%360;if(Pe._inRange(s,337.5,360)||Pe._inRange(s,0,22.5))return"ns-resize";else if(Pe._inRange(s,22.5,67.5))return"nesw-resize";else if(Pe._inRange(s,67.5,112.5))return"ew-resize";else if(Pe._inRange(s,112.5,157.5))return"nwse-resize";else if(Pe._inRange(s,157.5,202.5))return"ns-resize";else if(Pe._inRange(s,202.5,247.5))return"nesw-resize";else if(Pe._inRange(s,247.5,292.5))return"ew-resize";else if(Pe._inRange(s,292.5,337.5))return"nwse-resize";else return Pe.error("Transformer has unknown angle for cursor detection: "+s),"pointer"}var Hb=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Cx=1e8;function UN(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function qx(e,n,i){let s=i.x+(e.x-i.x)*Math.cos(n)-(e.y-i.y)*Math.sin(n),a=i.y+(e.x-i.x)*Math.sin(n)+(e.y-i.y)*Math.cos(n);return{...e,rotation:e.rotation+n,x:s,y:a}}function zN(e,n){let i=UN(e);return qx(e,n,i)}function GN(e,n,i){let s=n;for(let a=0;a<e.length;a++){let r=Ct.getAngle(e[a]),l=Math.abs(r-n)%(Math.PI*2);if(Math.min(l,Math.PI*2-l)<i)s=r}return s}var M3=0;class qn extends Go{constructor(e){super(e);if(this._movingAnchorName=null,this._transforming=!1,this._transformWindow=null,this._elementsCreated=!1,this._updateScheduled=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(NN,this.update),this.getNode())this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Pe.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Ex+this._id}setNodes(e=[]){if(this._nodes&&this._nodes.length)this.detach();let n=e.filter((s)=>{if(s.isAncestorOf(this))return Pe.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1;return!0});if(this._nodes=e=n,e.length===1&&this.useSingleNodeRotation())this.rotation(e[0].getAbsoluteRotation());else this.rotation(0);if(this._nodes.forEach((s)=>{let a=()=>{if(this._transforming)return;if(this.nodes().length===1&&this.useSingleNodeRotation())this.rotation(this.nodes()[0].getAbsoluteRotation());if(this._resetTransformCache(),!this.isDragging())this._scheduleUpdate()};if(s._attrsAffectingSize.length){let r=s._attrsAffectingSize.map((l)=>l+"Change."+this._getEventNamespace()).join(" ");s.on(r,a)}s.on(PN.map((r)=>r+`.${this._getEventNamespace()}`).join(" "),a),s.on(`absoluteTransformChange.${this._getEventNamespace()}`,a),this._proxyDrag(s)}),this._resetTransformCache(),!!this.findOne(".top-left"))this.update();return this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,(i)=>{if(n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back"))this.startDrag(i,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,(i)=>{if(!n)return;let s=e.getAbsolutePosition(),a=s.x-n.x,r=s.y-n.y;this.nodes().forEach((l)=>{if(l===e)return;if(l.isDragging())return;let c=l.getAbsolutePosition();l.setAbsolutePosition({x:c.x+a,y:c.y+r}),l.startDrag(i)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){if(this._nodes)this._nodes.forEach((e)=>{e.off("."+this._getEventNamespace())});this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Ax),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Ax,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),i){let s=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(i),r=e.getAbsolutePosition(i),l=s.x*a.x-e.offsetX()*a.x,c=s.y*a.y-e.offsetY()*a.y,p=(Ct.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),m={x:r.x+l*Math.cos(p)+c*Math.sin(-p),y:r.y+c*Math.cos(p)+l*Math.sin(p),width:s.width*a.x,height:s.height*a.y,rotation:p};return qx(m,-Ct.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-Cx,y:-Cx,width:0,height:0,rotation:0};let n=[];this.nodes().map((p)=>{let m=p.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),g=[{x:m.x,y:m.y},{x:m.x+m.width,y:m.y},{x:m.x+m.width,y:m.y+m.height},{x:m.x,y:m.y+m.height}],y=p.getAbsoluteTransform();g.forEach(function(x){let I=y.point(x);n.push(I)})});let i=new Gs;i.rotate(-Ct.getAngle(this.rotation()));let s=1/0,a=1/0,r=-1/0,l=-1/0;n.forEach(function(p){let m=i.point(p);if(s===void 0)s=r=m.x,a=l=m.y;s=Math.min(s,m.x),a=Math.min(a,m.y),r=Math.max(r,m.x),l=Math.max(l,m.y)}),i.invert();let c=i.point({x:s,y:a});return{x:c.x,y:c.y,width:r-s,height:l-a,rotation:Ct.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Hb.forEach((e)=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){let n=new tu({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:LN?10:"auto"}),i=this;n.on("mousedown touchstart",function(s){i._handleMouseDown(s)}),n.on("dragstart",(s)=>{n.stopDrag(),s.cancelBubble=!0}),n.on("dragend",(s)=>{s.cancelBubble=!0}),n.on("mouseenter",()=>{let s=Ct.getAngle(this.rotation()),a=this.rotateAnchorCursor(),r=HN(e,s,a);n.getStage().content&&(n.getStage().content.style.cursor=r),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){let e=new _t({name:"back",width:0,height:0,sceneFunc(n,i){let s=i.getParent(),a=s.padding(),r=i.width(),l=i.height();if(n.beginPath(),n.rect(-a,-a,r+a*2,l+a*2),s.rotateEnabled()&&s.rotateLineVisible()){let c=s.rotateAnchorAngle(),p=s.rotateAnchorOffset(),m=Pe.degToRad(c),g=Math.sin(m),y=-Math.cos(m),x=r/2,I=l/2,M=1/0;if(y<0)M=Math.min(M,-I/y);else if(y>0)M=Math.min(M,(l-I)/y);if(g<0)M=Math.min(M,-x/g);else if(g>0)M=Math.min(M,(r-x)/g);let H=x+g*M,X=I+y*M,W=Pe._sign(l),Y=H+g*p*W,te=X+y*p*W;n.moveTo(H,X),n.lineTo(Y,te)}n.fillStrokeShape(i)},hitFunc:(n,i)=>{if(!this.shouldOverdrawWholeArea())return;let s=this.padding();n.beginPath(),n.rect(-s,-s,i.width()+s*2,i.height()+s*2),n.fillStrokeShape(i)}});this.add(e),this._proxyDrag(e),e.on("dragstart",(n)=>{n.cancelBubble=!0}),e.on("dragmove",(n)=>{n.cancelBubble=!0}),e.on("dragend",(n)=>{n.cancelBubble=!0}),this.on("dragmove",(n)=>{this.update()})}_handleMouseDown(e){var n;if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];let i=this._getNodeRect(),{width:s,height:a}=i,r=Math.sqrt(Math.pow(s,2)+Math.pow(a,2));this.sin=Math.abs(a/r),this.cos=Math.abs(s/r);let l=(n=this.getStage())===null||n===void 0?void 0:n._getOwnerWindow();if(this._transformWindow=l||null,l)l.addEventListener("mousemove",this._handleMouseMove),l.addEventListener("touchmove",this._handleMouseMove),l.addEventListener("mouseup",this._handleMouseUp,!0),l.addEventListener("touchend",this._handleMouseUp,!0);this._transforming=!0;let c=e.target.getAbsolutePosition(),p=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:p.x-c.x,y:p.y-c.y},M3++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((m)=>{m._fire("transformstart",{evt:e.evt,target:m})})}_handleMouseMove(e){let n,i,s,a=this.findOne("."+this._movingAnchorName),r=a.getStage();r.setPointersPositions(e);let l=r.getPointerPosition(),c={x:l.x-this._anchorDragOffset.x,y:l.y-this._anchorDragOffset.y},p=a.getAbsolutePosition();if(this.anchorDragBoundFunc())c=this.anchorDragBoundFunc()(p,c,e);a.setAbsolutePosition(c);let m=a.getAbsolutePosition();if(p.x===m.x&&p.y===m.y)return;if(this._movingAnchorName==="rotater"){let Y=this._getNodeRect();n=a.x()-Y.width/2,i=-a.y()+Y.height/2;let te=Ct.getAngle(this.rotateAnchorAngle()),ae=Math.atan2(-i,n)+Math.PI/2-te;if(Y.height<0)ae-=Math.PI;let oe=Ct.getAngle(this.rotation())+ae,me=Ct.getAngle(this.rotationSnapTolerance()),xe=GN(this.rotationSnaps(),oe,me)-Y.rotation,Oe=zN(Y,xe);this._fitNodesInto(Oe,e);return}let g=this.shiftBehavior(),y;if(g==="inverted")y=this.keepRatio()&&!e.shiftKey;else if(g==="none")y=this.keepRatio();else y=this.keepRatio()||e.shiftKey;let x=this.centeredScaling()||e.altKey,I=!1;if(this._movingAnchorName==="top-left"){if(y){I=!0;let Y=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};s=Math.sqrt(Math.pow(Y.x-a.x(),2)+Math.pow(Y.y-a.y(),2));let te=this.findOne(".top-left").x()>Y.x?-1:1,ae=this.findOne(".top-left").y()>Y.y?-1:1;n=s*this.cos*te,i=s*this.sin*ae,this.findOne(".top-left").x(Y.x-n),this.findOne(".top-left").y(Y.y-i)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){I=!0;let Y=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};s=Math.sqrt(Math.pow(a.x()-Y.x,2)+Math.pow(Y.y-a.y(),2));let te=this.findOne(".top-right").x()<Y.x?-1:1,ae=this.findOne(".top-right").y()>Y.y?-1:1;n=s*this.cos*te,i=s*this.sin*ae,this.findOne(".top-right").x(Y.x+n),this.findOne(".top-right").y(Y.y-i)}var M=a.position();this.findOne(".top-left").y(M.y),this.findOne(".bottom-right").x(M.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){I=!0;let Y=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};s=Math.sqrt(Math.pow(Y.x-a.x(),2)+Math.pow(a.y()-Y.y,2));let te=Y.x<a.x()?-1:1,ae=a.y()<Y.y?-1:1;n=s*this.cos*te,i=s*this.sin*ae,a.x(Y.x-n),a.y(Y.y+i)}M=a.position(),this.findOne(".top-left").x(M.x),this.findOne(".bottom-right").y(M.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(a.y());else if(this._movingAnchorName==="bottom-right"){if(y){I=!0;let Y=x?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};s=Math.sqrt(Math.pow(a.x()-Y.x,2)+Math.pow(a.y()-Y.y,2));let te=this.findOne(".bottom-right").x()<Y.x?-1:1,ae=this.findOne(".bottom-right").y()<Y.y?-1:1;n=s*this.cos*te,i=s*this.sin*ae,this.findOne(".bottom-right").x(Y.x+n),this.findOne(".bottom-right").y(Y.y+i)}}else console.error(Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(x=this.centeredScaling()||e.altKey,x){let Y=this.findOne(".top-left"),te=this.findOne(".bottom-right"),ae=Y.x(),ne=Y.y(),oe=this.getWidth()-te.x(),me=this.getHeight()-te.y();te.move({x:-ae,y:-ne}),Y.move({x:oe,y:me})}let H=this.findOne(".top-left").getAbsolutePosition();n=H.x,i=H.y;let X=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),W=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:i,width:X,height:W,rotation:Ct.getAngle(this.rotation())},e,I)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var n;if(this._transforming){this._transforming=!1;let i=this._transformWindow;if(this._transformWindow=null,i)i.removeEventListener("mousemove",this._handleMouseMove),i.removeEventListener("touchmove",this._handleMouseMove),i.removeEventListener("mouseup",this._handleMouseUp,!0),i.removeEventListener("touchend",this._handleMouseUp,!0);let s=this.getNode();if(M3--,this._fire("transformend",{evt:e,target:s}),(n=this.getLayer())===null||n===void 0||n.batchDraw(),s)this._nodes.forEach((a)=>{var r;a._fire("transformend",{evt:e,target:a}),(r=a.getLayer())===null||r===void 0||r.batchDraw()});this._movingAnchorName=null}}_fitNodesInto(e,n,i=!1){let s=Ct.autoDrawEnabled;Ct.autoDrawEnabled=!1;try{return this._doFitNodesInto(e,n,i)}finally{Ct.autoDrawEnabled=s}}_doFitNodesInto(e,n,i=!1){let s=this._getNodeRect(),a=1;if(Pe._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(Pe._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new Gs;r.rotate(Ct.getAngle(this.rotation()));let l=i?0:this.padding()*2,c=null,p=null;if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){let X=r.point({x:-l,y:0});e.x+=X.x,e.y+=X.y,e.width+=l,c={axis:"width",from:"left",to:"right",offset:X}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){let X=r.point({x:l,y:0});e.width+=l,c={axis:"width",from:"right",to:"left",offset:X}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){let X=r.point({x:0,y:-l});e.x+=X.x,e.y+=X.y,e.height+=l,p={axis:"height",from:"top",to:"bottom",offset:X}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){let X=r.point({x:0,y:l});e.height+=l,p={axis:"height",from:"bottom",to:"top",offset:X}}if(this.boundBoxFunc()){let X=this.boundBoxFunc()(s,e);if(X)e=X;else Pe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}for(let X of[c,p])if(X&&e[X.axis]<0&&this._movingAnchorName)this._movingAnchorName=this._movingAnchorName.replace(X.from,X.to),this._anchorDragOffset.x-=X.offset.x,this._anchorDragOffset.y-=X.offset.y;let m=1e7,g=new Gs;g.translate(s.x,s.y),g.rotate(s.rotation),g.scale(s.width/m,s.height/m);let y=new Gs,x=e.width/m,I=e.height/m;if(this.flipEnabled()===!1)y.translate(e.x,e.y),y.rotate(e.rotation),y.translate(e.width<0?e.width:0,e.height<0?e.height:0),y.scale(Math.abs(x),Math.abs(I));else y.translate(e.x,e.y),y.rotate(e.rotation),y.scale(x,I);let M=y.multiply(g.invert()),H=new Set;this._nodes.forEach((X)=>{if(!X.getStage())return;let W=X.getParent().getAbsoluteTransform(),Y=X.getTransform().copy();Y.translate(X.offsetX(),X.offsetY());let te=new Gs;te.multiply(W.copy().invert()).multiply(M).multiply(W).multiply(Y);let ae=te.decompose();X.setAttrs(ae);let ne=X.getLayer();if(ne)H.add(ne)}),this.rotation(Pe._getRotation(e.rotation)),this._nodes.forEach((X)=>{this._fire("transform",{evt:n,target:X}),X._fire("transform",{evt:n,target:X})}),this._resetTransformCache(),this.update(),H.add(this.getLayer()),H.forEach((X)=>X&&X.batchDraw())}_scheduleUpdate(){if(this._updateScheduled)return;this._updateScheduled=!0,St._runAfterAbsTransformCascade(()=>{var e;if(this._updateScheduled=!1,!((e=this._nodes)===null||e===void 0?void 0:e.length)||this._transforming||this.isDragging())return;this.update()})}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;let n=this._getNodeRect();this.rotation(Pe._getRotation(n.rotation));let{width:i,height:s}=n,a=this.enabledAnchors(),r=this.resizeEnabled(),l=this.padding(),c=this.anchorSize(),p=this.find("._anchor");p.forEach((ne)=>{ne.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+l,offsetY:c/2+l,visible:r&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:c/2+l,visible:r&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:c/2-l,offsetY:c/2+l,visible:r&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:s/2,offsetX:c/2+l,visible:r&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:s/2,offsetX:c/2-l,visible:r&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:s,offsetX:c/2+l,offsetY:c/2-l,visible:r&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:s,offsetY:c/2-l,visible:r&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:s,offsetX:c/2-l,offsetY:c/2-l,visible:r&&a.indexOf("bottom-right")>=0});let m=this.rotateAnchorAngle(),g=this.rotateAnchorOffset(),y=Pe.degToRad(m),x=Math.sin(y),I=-Math.cos(y),M=i/2,H=s/2,X=1/0;if(I<0)X=Math.min(X,-H/I);else if(I>0)X=Math.min(X,(s-H)/I);if(x<0)X=Math.min(X,-M/x);else if(x>0)X=Math.min(X,(i-M)/x);let W=M+x*X,Y=H+I*X,te=Pe._sign(s);this._batchChangeChild(".rotater",{x:W+x*g*te,y:Y+I*g*te-l*I,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:s,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some((ne)=>ne.draggable()),x:0,y:0});let ae=this.anchorStyleFunc();if(ae)p.forEach((ne)=>{ae(ne)});(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne("."+this._movingAnchorName);if(e)e.stopDrag()}}destroy(){if(this.getStage()&&this._cursorChange)this.getStage().content&&(this.getStage().content.style.cursor="");return Go.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){if(this._elementsCreated)return Pe.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this;return super.add(...e)}toObject(){return St.prototype.toObject.call(this)}clone(e){return St.prototype.clone.call(this,e)}getClientRect(){if(this.nodes().length>0)return super.getClientRect();else return{x:0,y:0,width:0,height:0}}}qn.isTransforming=()=>M3>0;function VN(e){if(!(e instanceof Array))Pe.warn("enabledAnchors value should be an array");if(e instanceof Array)e.forEach(function(n){if(Hb.indexOf(n)===-1)Pe.warn("Unknown anchor name: "+n+". Available names are: "+Hb.join(", "))});return e||[]}qn.prototype.className="Transformer";wn(qn);ye.addGetterSetter(qn,"enabledAnchors",Hb,VN);ye.addGetterSetter(qn,"flipEnabled",!0,Vs());ye.addGetterSetter(qn,"resizeEnabled",!0);ye.addGetterSetter(qn,"anchorSize",10,mt());ye.addGetterSetter(qn,"rotateEnabled",!0);ye.addGetterSetter(qn,"rotateLineVisible",!0);ye.addGetterSetter(qn,"rotationSnaps",[]);ye.addGetterSetter(qn,"rotateAnchorOffset",50,mt());ye.addGetterSetter(qn,"rotateAnchorAngle",0,mt());ye.addGetterSetter(qn,"rotateAnchorCursor","crosshair");ye.addGetterSetter(qn,"rotationSnapTolerance",5,mt());ye.addGetterSetter(qn,"borderEnabled",!0);ye.addGetterSetter(qn,"anchorStroke","rgb(0, 161, 255)");ye.addGetterSetter(qn,"anchorStrokeWidth",1,mt());ye.addGetterSetter(qn,"anchorFill","white");ye.addGetterSetter(qn,"anchorCornerRadius",0,mt());ye.addGetterSetter(qn,"borderStroke","rgb(0, 161, 255)");ye.addGetterSetter(qn,"borderStrokeWidth",1,mt());ye.addGetterSetter(qn,"borderDash");ye.addGetterSetter(qn,"keepRatio",!0);ye.addGetterSetter(qn,"shiftBehavior","default");ye.addGetterSetter(qn,"centeredScaling",!1);ye.addGetterSetter(qn,"ignoreStroke",!1);ye.addGetterSetter(qn,"padding",0,mt());ye.addGetterSetter(qn,"nodes");ye.addGetterSetter(qn,"node");ye.addGetterSetter(qn,"boundBoxFunc");ye.addGetterSetter(qn,"anchorDragBoundFunc");ye.addGetterSetter(qn,"anchorStyleFunc");ye.addGetterSetter(qn,"shouldOverdrawWholeArea",!1);ye.addGetterSetter(qn,"useSingleNodeRotation",!0);ye.backCompat(qn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class ro extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Ct.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}ro.prototype.className="Wedge";ro.prototype._centroid=!0;ro.prototype._attrsAffectingSize=["radius"];wn(ro);ye.addGetterSetter(ro,"radius",0,mt());ye.addGetterSetter(ro,"angle",0,mt());ye.addGetterSetter(ro,"clockwise",!1);ye.backCompat(ro,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Dx(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var XN=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],WN=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function KN(e,n){let{data:i,width:s,height:a}=e,r,l,c,p,m,g,y,x,I,M,H,X,W,Y,te,ae,ne,oe,me,be,xe=n+n+1,Oe=s-1,Fe=a-1,Ue=n+1,ze=Ue*(Ue+1)/2,Le=new Dx,qe=XN[n],Me=WN[n],yt=null,Ge=Le,Qe=null,jt=null;for(let ut=1;ut<xe;ut++)if(Ge=Ge.next=new Dx,ut===Ue)yt=Ge;Ge.next=Le,c=l=0;for(let ut=0;ut<a;ut++){X=W=Y=te=p=m=g=y=0,x=Ue*(ae=i[l]),I=Ue*(ne=i[l+1]),M=Ue*(oe=i[l+2]),H=Ue*(me=i[l+3]),p+=ze*ae,m+=ze*ne,g+=ze*oe,y+=ze*me,Ge=Le;for(let st=0;st<Ue;st++)Ge.r=ae,Ge.g=ne,Ge.b=oe,Ge.a=me,Ge=Ge.next;for(let st=1;st<Ue;st++)r=l+((Oe<st?Oe:st)<<2),p+=(Ge.r=ae=i[r])*(be=Ue-st),m+=(Ge.g=ne=i[r+1])*be,g+=(Ge.b=oe=i[r+2])*be,y+=(Ge.a=me=i[r+3])*be,X+=ae,W+=ne,Y+=oe,te+=me,Ge=Ge.next;Qe=Le,jt=yt;for(let st=0;st<s;st++){if(i[l+3]=me=y*qe>>Me,me!==0)me=255/me,i[l]=(p*qe>>Me)*me,i[l+1]=(m*qe>>Me)*me,i[l+2]=(g*qe>>Me)*me;else i[l]=i[l+1]=i[l+2]=0;p-=x,m-=I,g-=M,y-=H,x-=Qe.r,I-=Qe.g,M-=Qe.b,H-=Qe.a,r=c+((r=st+n+1)<Oe?r:Oe)<<2,X+=Qe.r=i[r],W+=Qe.g=i[r+1],Y+=Qe.b=i[r+2],te+=Qe.a=i[r+3],p+=X,m+=W,g+=Y,y+=te,Qe=Qe.next,x+=ae=jt.r,I+=ne=jt.g,M+=oe=jt.b,H+=me=jt.a,X-=ae,W-=ne,Y-=oe,te-=me,jt=jt.next,l+=4}c+=s}for(let ut=0;ut<s;ut++){W=Y=te=X=m=g=y=p=0,l=ut<<2,x=Ue*(ae=i[l]),I=Ue*(ne=i[l+1]),M=Ue*(oe=i[l+2]),H=Ue*(me=i[l+3]),p+=ze*ae,m+=ze*ne,g+=ze*oe,y+=ze*me,Ge=Le;for(let bt=0;bt<Ue;bt++)Ge.r=ae,Ge.g=ne,Ge.b=oe,Ge.a=me,Ge=Ge.next;let st=s;for(let bt=1;bt<=n;bt++)if(l=st+ut<<2,p+=(Ge.r=ae=i[l])*(be=Ue-bt),m+=(Ge.g=ne=i[l+1])*be,g+=(Ge.b=oe=i[l+2])*be,y+=(Ge.a=me=i[l+3])*be,X+=ae,W+=ne,Y+=oe,te+=me,Ge=Ge.next,bt<Fe)st+=s;l=ut,Qe=Le,jt=yt;for(let bt=0;bt<a;bt++){if(r=l<<2,i[r+3]=me=y*qe>>Me,me>0)me=255/me,i[r]=(p*qe>>Me)*me,i[r+1]=(m*qe>>Me)*me,i[r+2]=(g*qe>>Me)*me;else i[r]=i[r+1]=i[r+2]=0;p-=x,m-=I,g-=M,y-=H,x-=Qe.r,I-=Qe.g,M-=Qe.b,H-=Qe.a,r=ut+((r=bt+Ue)<Fe?r:Fe)*s<<2,p+=X+=Qe.r=i[r],m+=W+=Qe.g=i[r+1],g+=Y+=Qe.b=i[r+2],y+=te+=Qe.a=i[r+3],Qe=Qe.next,x+=ae=jt.r,I+=ne=jt.g,M+=oe=jt.b,H+=me=jt.a,X-=ae,W-=ne,Y-=oe,te-=me,jt=jt.next,l+=s}}}var Ix=function(n){let i=Math.round(this.blurRadius());if(i>0)KN(n,i)};ye.addGetterSetter(St,"blurRadius",0,mt(),ye.afterSetFilter);var Mx=function(e){let n=this.brightness()*255,i=e.data,s=i.length;for(let a=0;a<s;a+=4)i[a]+=n,i[a+1]+=n,i[a+2]+=n};ye.addGetterSetter(St,"brightness",0,mt(),ye.afterSetFilter);var Rx=function(e){let n=this.brightness(),i=e.data,s=i.length;for(let a=0;a<s;a+=4)i[a]=Math.min(255,i[a]*n),i[a+1]=Math.min(255,i[a+1]*n),i[a+2]=Math.min(255,i[a+2]*n)};var Ox=function(e){let n=Math.pow((this.contrast()+100)/100,2),i=e.data,s=i.length,a=150,r=150,l=150;for(let c=0;c<s;c+=4)a=i[c],r=i[c+1],l=i[c+2],a/=255,a-=0.5,a*=n,a+=0.5,a*=255,r/=255,r-=0.5,r*=n,r+=0.5,r*=255,l/=255,l-=0.5,l*=n,l+=0.5,l*=255,a=a<0?0:a>255?255:a,r=r<0?0:r>255?255:r,l=l<0?0:l>255?255:l,i[c]=a,i[c+1]=r,i[c+2]=l};ye.addGetterSetter(St,"contrast",0,mt(),ye.afterSetFilter);var Fx=function(e){var n,i,s,a,r,l,c,p,m;let{data:g,width:y,height:x}=e,I=Math.min(1,Math.max(0,(i=(n=this.embossStrength)===null||n===void 0?void 0:n.call(this))!==null&&i!==void 0?i:0.5)),M=Math.min(1,Math.max(0,(a=(s=this.embossWhiteLevel)===null||s===void 0?void 0:s.call(this))!==null&&a!==void 0?a:0.5)),X=(c={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(l=(r=this.embossDirection)===null||r===void 0?void 0:r.call(this))!==null&&l!==void 0?l:"top-left"])!==null&&c!==void 0?c:315,W=!!((m=(p=this.embossBlend)===null||p===void 0?void 0:p.call(this))!==null&&m!==void 0?m:!1),Y=I*10,te=M*255,ae=X*Math.PI/180,ne=Math.cos(ae),oe=Math.sin(ae),me=0.12549019607843137*Y,be=new Uint8ClampedArray(g),xe=new Float32Array(y*x);for(let Le=0,qe=0;qe<g.length;qe+=4,Le++)xe[Le]=0.2126*be[qe]+0.7152*be[qe+1]+0.0722*be[qe+2];let Oe=[-1,0,1,-2,0,2,-1,0,1],Fe=[-1,-2,-1,0,0,0,1,2,1],Ue=[-y-1,-y,-y+1,-1,0,1,y-1,y,y+1],ze=(Le)=>Le<0?0:Le>255?255:Le;for(let Le=1;Le<x-1;Le++)for(let qe=1;qe<y-1;qe++){let Me=Le*y+qe,yt=0,Ge=0;yt+=xe[Me+Ue[0]]*Oe[0],Ge+=xe[Me+Ue[0]]*Fe[0],yt+=xe[Me+Ue[1]]*Oe[1],Ge+=xe[Me+Ue[1]]*Fe[1],yt+=xe[Me+Ue[2]]*Oe[2],Ge+=xe[Me+Ue[2]]*Fe[2],yt+=xe[Me+Ue[3]]*Oe[3],Ge+=xe[Me+Ue[3]]*Fe[3],yt+=xe[Me+Ue[5]]*Oe[5],Ge+=xe[Me+Ue[5]]*Fe[5],yt+=xe[Me+Ue[6]]*Oe[6],Ge+=xe[Me+Ue[6]]*Fe[6],yt+=xe[Me+Ue[7]]*Oe[7],Ge+=xe[Me+Ue[7]]*Fe[7],yt+=xe[Me+Ue[8]]*Oe[8],Ge+=xe[Me+Ue[8]]*Fe[8];let Qe=ne*yt+oe*Ge,jt=ze(te+Qe*me),ut=Me*4;if(W){let st=jt-te;g[ut]=ze(be[ut]+st),g[ut+1]=ze(be[ut+1]+st),g[ut+2]=ze(be[ut+2]+st),g[ut+3]=be[ut+3]}else g[ut]=g[ut+1]=g[ut+2]=jt,g[ut+3]=be[ut+3]}for(let Le=0;Le<y;Le++){let qe=Le*4,Me=((x-1)*y+Le)*4;g[qe]=be[qe],g[qe+1]=be[qe+1],g[qe+2]=be[qe+2],g[qe+3]=be[qe+3],g[Me]=be[Me],g[Me+1]=be[Me+1],g[Me+2]=be[Me+2],g[Me+3]=be[Me+3]}for(let Le=1;Le<x-1;Le++){let qe=Le*y*4,Me=(Le*y+(y-1))*4;g[qe]=be[qe],g[qe+1]=be[qe+1],g[qe+2]=be[qe+2],g[qe+3]=be[qe+3],g[Me]=be[Me],g[Me+1]=be[Me+1],g[Me+2]=be[Me+2],g[Me+3]=be[Me+3]}return e};ye.addGetterSetter(St,"embossStrength",0.5,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"embossWhiteLevel",0.5,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"embossDirection","top-left",void 0,ye.afterSetFilter);ye.addGetterSetter(St,"embossBlend",!1,void 0,ye.afterSetFilter);function R3(e,n,i,s,a){let r=i-n,l=a-s;if(r===0)return s+l/2;if(l===0)return s;let c=(e-n)/r;return c=l*c+s,c}var Nx=function(e){let n=e.data,i=n.length,s=n[0],a=s,r,l=n[1],c=l,p,m=n[2],g=m,y,x=this.enhance();if(x===0)return;for(let te=0;te<i;te+=4){if(r=n[te+0],r<s)s=r;else if(r>a)a=r;if(p=n[te+1],p<l)l=p;else if(p>c)c=p;if(y=n[te+2],y<m)m=y;else if(y>g)g=y}if(a===s)a=255,s=0;if(c===l)c=255,l=0;if(g===m)g=255,m=0;let I,M,H,X,W,Y;if(x>0)I=a+x*(255-a),M=s-x*(s-0),H=c+x*(255-c),X=l-x*(l-0),W=g+x*(255-g),Y=m-x*(m-0);else{let te=(a+s)*0.5;I=a+x*(a-te),M=s+x*(s-te);let ae=(c+l)*0.5;H=c+x*(c-ae),X=l+x*(l-ae);let ne=(g+m)*0.5;W=g+x*(g-ne),Y=m+x*(m-ne)}for(let te=0;te<i;te+=4)n[te+0]=R3(n[te+0],s,a,M,I),n[te+1]=R3(n[te+1],l,c,X,H),n[te+2]=R3(n[te+2],m,g,Y,W)};ye.addGetterSetter(St,"enhance",0,mt(),ye.afterSetFilter);var Px=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4){let a=0.34*n[s]+0.5*n[s+1]+0.16*n[s+2];n[s]=a,n[s+1]=a,n[s+2]=a}};ye.addGetterSetter(St,"hue",0,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"saturation",0,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"luminance",0,mt(),ye.afterSetFilter);var Bx=function(e){let n=e.data,i=n.length,a=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,l=this.luminance()*127,c=1*a*Math.cos(r*Math.PI/180),p=1*a*Math.sin(r*Math.PI/180),m=0.299+0.701*c+0.167*p,g=0.587-0.587*c+0.33*p,y=0.114-0.114*c-0.497*p,x=0.299-0.299*c-0.328*p,I=0.587+0.413*c+0.035*p,M=0.114-0.114*c+0.293*p,H=0.299-0.3*c+1.25*p,X=0.587-0.586*c-1.05*p,W=0.114+0.886*c-0.2*p,Y,te,ae,ne;for(let oe=0;oe<i;oe+=4)Y=n[oe+0],te=n[oe+1],ae=n[oe+2],ne=n[oe+3],n[oe+0]=m*Y+g*te+y*ae+l,n[oe+1]=x*Y+I*te+M*ae+l,n[oe+2]=H*Y+X*te+W*ae+l,n[oe+3]=ne};var Lx=function(e){let n=e.data,i=n.length,s=Math.pow(2,this.value()),a=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,l=s*a*Math.cos(r*Math.PI/180),c=s*a*Math.sin(r*Math.PI/180),p=0.299*s+0.701*l+0.167*c,m=0.587*s-0.587*l+0.33*c,g=0.114*s-0.114*l-0.497*c,y=0.299*s-0.299*l-0.328*c,x=0.587*s+0.413*l+0.035*c,I=0.114*s-0.114*l+0.293*c,M=0.299*s-0.3*l+1.25*c,H=0.587*s-0.586*l-1.05*c,X=0.114*s+0.886*l-0.2*c;for(let W=0;W<i;W+=4){let Y=n[W+0],te=n[W+1],ae=n[W+2],ne=n[W+3];n[W+0]=p*Y+m*te+g*ae,n[W+1]=y*Y+x*te+I*ae,n[W+2]=M*Y+H*te+X*ae,n[W+3]=ne}};ye.addGetterSetter(St,"hue",0,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"saturation",0,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"value",0,mt(),ye.afterSetFilter);var Hx=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4)n[s]=255-n[s],n[s+1]=255-n[s+1],n[s+2]=255-n[s+2]};var $N=function(e,n,i){let s=e.data,a=n.data,{width:r,height:l}=e,c=i.polarCenterX||r/2,p=i.polarCenterY||l/2,m=Math.sqrt(c*c+p*p),g=r-c,y=l-p,x=Math.sqrt(g*g+y*y);m=x>m?x:m;let I=l,M=r,H=360/M*Math.PI/180;for(let X=0;X<M;X+=1){let W=Math.sin(X*H),Y=Math.cos(X*H);for(let te=0;te<I;te+=1){g=Math.floor(c+m*te/I*Y),y=Math.floor(p+m*te/I*W);let ae=(y*r+g)*4,ne=s[ae+0],oe=s[ae+1],me=s[ae+2],be=s[ae+3];ae=(X+te*r)*4,a[ae+0]=ne,a[ae+1]=oe,a[ae+2]=me,a[ae+3]=be}}},YN=function(e,n,i){let s=e.data,a=n.data,{width:r,height:l}=e,c=i.polarCenterX||r/2,p=i.polarCenterY||l/2,m=Math.sqrt(c*c+p*p),g=r-c,y=l-p,x=Math.sqrt(g*g+y*y);m=x>m?x:m;let I=l,M=r,H=i.polarRotation||0,X,W;for(g=0;g<r;g+=1)for(y=0;y<l;y+=1){let Y=g-c,te=y-p,ae=Math.sqrt(Y*Y+te*te)*I/m,ne=(Math.atan2(te,Y)*180/Math.PI+360+H)%360;ne=ne*M/360,X=Math.floor(ne),W=Math.floor(ae);let oe=(W*r+X)*4,me=s[oe+0],be=s[oe+1],xe=s[oe+2],Oe=s[oe+3];oe=(y*r+g)*4,a[oe+0]=me,a[oe+1]=be,a[oe+2]=xe,a[oe+3]=Oe}},Ux=function(e){let{width:n,height:i}=e,s,a,r,l,c,p,m,g,y,x,I=Math.round(this.kaleidoscopePower()),M=Math.round(this.kaleidoscopeAngle()),H=Math.floor(n*(M%360)/360);if(I<1)return;let X=Pe.createCanvasElement();X.width=n,X.height=i;let W=X.getContext("2d").getImageData(0,0,n,i);Pe.releaseCanvas(X),$N(e,W,{polarCenterX:n/2,polarCenterY:i/2});let Y=n/Math.pow(2,I);while(Y<=8)Y=Y*2,I-=1;Y=Math.ceil(Y);let te=Y,ae=0,ne=te,oe=1;if(H+Y>n)ae=te,ne=0,oe=-1;for(a=0;a<i;a+=1)for(s=ae;s!==ne;s+=oe)r=Math.round(s+H)%n,y=(n*a+r)*4,c=W.data[y+0],p=W.data[y+1],m=W.data[y+2],g=W.data[y+3],x=(n*a+s)*4,W.data[x+0]=c,W.data[x+1]=p,W.data[x+2]=m,W.data[x+3]=g;for(a=0;a<i;a+=1){te=Math.floor(Y);for(l=0;l<I;l+=1){for(s=0;s<te+1;s+=1)y=(n*a+s)*4,c=W.data[y+0],p=W.data[y+1],m=W.data[y+2],g=W.data[y+3],x=(n*a+te*2-s-1)*4,W.data[x+0]=c,W.data[x+1]=p,W.data[x+2]=m,W.data[x+3]=g;te*=2}}YN(W,e,{polarRotation:0})};ye.addGetterSetter(St,"kaleidoscopePower",2,mt(),ye.afterSetFilter);ye.addGetterSetter(St,"kaleidoscopeAngle",0,mt(),ye.afterSetFilter);function Ub(e,n,i){let s=(i*e.width+n)*4,a=[];return a.push(e.data[s++],e.data[s++],e.data[s++],e.data[s++]),a}function Wp(e,n){return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2)+Math.pow(e[2]-n[2],2))}function QN(e){let n=[0,0,0];for(let i=0;i<e.length;i++)n[0]+=e[i][0],n[1]+=e[i][1],n[2]+=e[i][2];return n[0]/=e.length,n[1]/=e.length,n[2]/=e.length,n}function JN(e,n){let i=Ub(e,0,0),s=Ub(e,e.width-1,0),a=Ub(e,0,e.height-1),r=Ub(e,e.width-1,e.height-1),l=n||10;if(Wp(i,s)<l&&Wp(s,r)<l&&Wp(r,a)<l&&Wp(a,i)<l){let c=QN([s,i,r,a]),p=[];for(let m=0;m<e.width*e.height;m++){let g=Wp(c,[e.data[m*4],e.data[m*4+1],e.data[m*4+2]]);p[m]=g<l?0:255}return p}}function ZN(e,n){for(let i=0;i<e.width*e.height;i++)e.data[4*i+3]=n[i]}function eP(e,n,i){let s=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let I=c+y-r,M=p+x-r;if(I>=0&&I<i&&M>=0&&M<n){let H=I*n+M,X=s[y*a+x];g+=e[H]*X}}l[m]=g===2040?255:0}return l}function tP(e,n,i){let s=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let I=c+y-r,M=p+x-r;if(I>=0&&I<i&&M>=0&&M<n){let H=I*n+M,X=s[y*a+x];g+=e[H]*X}}l[m]=g>=1020?255:0}return l}function nP(e,n,i){let s=[0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111,0.1111111111111111],a=Math.round(Math.sqrt(s.length)),r=Math.floor(a/2),l=[];for(let c=0;c<i;c++)for(let p=0;p<n;p++){let m=c*n+p,g=0;for(let y=0;y<a;y++)for(let x=0;x<a;x++){let I=c+y-r,M=p+x-r;if(I>=0&&I<i&&M>=0&&M<n){let H=I*n+M,X=s[y*a+x];g+=e[H]*X}}l[m]=g}return l}var zx=function(e){let n=this.threshold(),i=JN(e,n);if(i)i=eP(i,e.width,e.height),i=tP(i,e.width,e.height),i=nP(i,e.width,e.height),ZN(e,i);return e};ye.addGetterSetter(St,"threshold",0,mt(),ye.afterSetFilter);var Gx=function(e){let n=this.noise()*255,i=e.data,s=i.length,a=n/2;for(let r=0;r<s;r+=4)i[r+0]+=a-2*a*Math.random(),i[r+1]+=a-2*a*Math.random(),i[r+2]+=a-2*a*Math.random()};ye.addGetterSetter(St,"noise",0.2,mt(),ye.afterSetFilter);var Vx=function(e){let n=Math.ceil(this.pixelSize()),{width:i,height:s}=e,a=Math.ceil(i/n),r=Math.ceil(s/n),l=e.data;if(n<=0){Pe.error("pixelSize value can not be <= 0");return}for(let c=0;c<a;c+=1)for(let p=0;p<r;p+=1){let m=0,g=0,y=0,x=0,I=c*n,M=I+n,H=p*n,X=H+n,W=0;for(let Y=I;Y<M;Y+=1){if(Y>=i)continue;for(let te=H;te<X;te+=1){if(te>=s)continue;let ae=(i*te+Y)*4;m+=l[ae+0],g+=l[ae+1],y+=l[ae+2],x+=l[ae+3],W+=1}}m=m/W,g=g/W,y=y/W,x=x/W;for(let Y=I;Y<M;Y+=1){if(Y>=i)continue;for(let te=H;te<X;te+=1){if(te>=s)continue;let ae=(i*te+Y)*4;l[ae+0]=m,l[ae+1]=g,l[ae+2]=y,l[ae+3]=x}}}};ye.addGetterSetter(St,"pixelSize",8,mt(),ye.afterSetFilter);var Xx=function(e){let n=Math.round(this.levels()*254)+1,i=e.data,s=i.length,a=255/n;for(let r=0;r<s;r+=1)i[r]=Math.floor(i[r]/a)*a};ye.addGetterSetter(St,"levels",0.5,mt(),ye.afterSetFilter);var Wx=function(e){let n=e.data,i=n.length,s=this.red(),a=this.green(),r=this.blue();for(let l=0;l<i;l+=4){let c=(0.34*n[l]+0.5*n[l+1]+0.16*n[l+2])/255;n[l]=c*s,n[l+1]=c*a,n[l+2]=c*r,n[l+3]=n[l+3]}};ye.addGetterSetter(St,"red",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});ye.addGetterSetter(St,"green",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});ye.addGetterSetter(St,"blue",0,Ab,ye.afterSetFilter);var Kx=function(e){let n=e.data,i=n.length,s=this.red(),a=this.green(),r=this.blue(),l=this.alpha();for(let c=0;c<i;c+=4){let p=1-l;n[c]=s*l+n[c]*p,n[c+1]=a*l+n[c+1]*p,n[c+2]=r*l+n[c+2]*p}};ye.addGetterSetter(St,"red",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});ye.addGetterSetter(St,"green",0,function(e){if(this._filterUpToDate=!1,e>255)return 255;else if(e<0)return 0;else return Math.round(e)});ye.addGetterSetter(St,"blue",0,Ab,ye.afterSetFilter);ye.addGetterSetter(St,"alpha",1,function(e){if(this._filterUpToDate=!1,e>1)return 1;else if(e<0)return 0;else return e});var $x=function(e){let n=e.data,i=n.length;for(let s=0;s<i;s+=4){let a=n[s+0],r=n[s+1],l=n[s+2];n[s+0]=Math.min(255,a*0.393+r*0.769+l*0.189),n[s+1]=Math.min(255,a*0.349+r*0.686+l*0.168),n[s+2]=Math.min(255,a*0.272+r*0.534+l*0.131)}};var Yx=function(e){let i=e.data;for(let s=0;s<i.length;s+=4){let a=i[s],r=i[s+1],l=i[s+2];if(0.2126*a+0.7152*r+0.0722*l>=128)i[s]=255-a,i[s+1]=255-r,i[s+2]=255-l}return e};var Qx=function(e){let n=this.threshold()*255,i=e.data,s=i.length;for(let a=0;a<s;a+=1)i[a]=i[a]<n?0:255};ye.addGetterSetter(St,"threshold",0.5,mt(),ye.afterSetFilter);var Jx=Td.Util._assign(Td,{Arc:ao,Arrow:Nl,Circle:eu,Ellipse:Vo,Image:Ua,Label:Gp,Tag:Pl,Line:Pr,Path:ci,Rect:tu,RegularPolygon:Wo,Ring:Bl,Sprite:Br,Star:Ko,Text:ii,TextPath:Wi,Transformer:qn,Wedge:ro,Filters:{Blur:Ix,Brightness:Rx,Brighten:Mx,Contrast:Ox,Emboss:Fx,Enhance:Nx,Grayscale:Px,HSL:Bx,HSV:Lx,Invert:Hx,Kaleidoscope:Ux,Mask:zx,Noise:Gx,Pixelate:Vx,Posterize:Xx,RGB:Wx,RGBA:Kx,Sepia:$x,Solarize:Yx,Threshold:Qx}});var Zx=Jx;C();C();var jd=Td;var fk=Ke(ek());var O3=1;var zb=32,F3=2;C();var P3={};Ne(P3,{HostTransitionContext:()=>gB,NotPendingTransition:()=>mB,afterActiveInstanceBlur:()=>JP,appendChild:()=>FP,appendChildToContainer:()=>NP,appendInitialChild:()=>fP,beforeActiveInstanceBlur:()=>QP,cancelTimeout:()=>AP,clearContainer:()=>KP,commitMount:()=>UP,commitTextUpdate:()=>HP,commitUpdate:()=>zP,createInstance:()=>dP,createTextInstance:()=>pP,detachDeletedInstance:()=>$P,finalizeInitialChildren:()=>mP,getChildHostContext:()=>kP,getCurrentEventPriority:()=>ZP,getCurrentUpdatePriority:()=>iB,getInstanceFromNode:()=>YP,getInstanceFromScope:()=>tB,getPublicInstance:()=>gP,getRootHostContext:()=>xP,hideInstance:()=>GP,hideTextInstance:()=>VP,idlePriority:()=>Ms,insertBefore:()=>lk,insertInContainerBefore:()=>PP,isPrimaryRenderer:()=>DP,maySuspendCommit:()=>uB,noTimeout:()=>EP,now:()=>jn,preloadInstance:()=>hB,prepareForCommit:()=>bP,preparePortalMount:()=>wP,prepareScopeUpdate:()=>eB,prepareUpdate:()=>yP,removeChild:()=>BP,removeChildFromContainer:()=>LP,requestPostPaintCallback:()=>cB,resetAfterCommit:()=>vP,resetFormInstance:()=>bB,resetTextContent:()=>SP,resolveEventTimeStamp:()=>lB,resolveEventType:()=>oB,resolveUpdatePriority:()=>sB,run:()=>bu,scheduleMicrotask:()=>jP,scheduleTimeout:()=>TP,setCurrentUpdatePriority:()=>nB,shouldAttemptEagerTransition:()=>aB,shouldDeprioritizeSubtree:()=>_P,shouldSetTextContent:()=>qP,startSuspendingCommit:()=>fB,supportsHydration:()=>OP,supportsMicrotasks:()=>CP,supportsMutation:()=>MP,supportsPersistence:()=>RP,suspendInstance:()=>dB,trackSchedulerEvent:()=>rB,unhideInstance:()=>XP,unhideTextInstance:()=>WP,waitForCommitToBeReady:()=>pB,warnsIfNotActing:()=>IP});var tk={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},nk=!1,ik=!1,Ed=".react-konva-event",rP=!1;var oP=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
|
|
238
|
+
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
|
|
239
|
+
Consider to add onDragMove or onDragEnd events.
|
|
240
|
+
For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
241
|
+
`,lP=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
242
|
+
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
243
|
+
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
244
|
+
`,cP={},sk=()=>{};function ak(e){sk=e}var N3=!1;function uP(e){return function(...n){let i=e.apply(this,n);if(!N3){N3=!0;try{sk()}finally{N3=!1}}return i}}function qd(e,n,i=cP){if(!nk&&"zIndex"in n)console.warn(lP),nk=!0;if(!ik&&n.draggable){var s=n.x!==void 0||n.y!==void 0,a=n.onDragEnd||n.onDragMove;if(s&&!a)console.warn(oP),ik=!0}for(var r in i){if(tk[r])continue;var l=r.slice(0,2)==="on",c=i[r]!==n[r];if(l&&c){var p=r.substr(2).toLowerCase();if(p.substr(0,7)==="content")p="content"+p.substr(7,1).toUpperCase()+p.substr(8);e.off(p+Ed)}var m=!n.hasOwnProperty(r);if(m)e.setAttr(r,void 0)}var g=rP||n._useStrictMode,y={},x=!1;let I={};for(var r in n){if(tk[r])continue;var l=r.slice(0,2)==="on",M=i[r]!==n[r];if(l&&M){var p=r.substr(2).toLowerCase();if(p.substr(0,7)==="content")p="content"+p.substr(7,1).toUpperCase()+p.substr(8);if(n[r])I[p]=n[r]}if(!l&&(n[r]!==i[r]||g&&n[r]!==e.getAttr(r)))x=!0,y[r]=n[r]}if(x)e.setAttrs(y),Ll(e);for(var p in I)e.off(p+Ed),e.on(p+Ed,uP(I[p]))}function Ll(e){if(!Ct.autoDrawEnabled){var n=e.getLayer()||e.getStage();n&&n.batchDraw()}}vu();var rk={},hP={};jd.Node.prototype._applyProps=qd;var ok=zb;function fP(e,n){if(typeof n==="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${n}`);return}e.add(n),Ll(e)}function dP(e,n,i){let s=jd[e];if(!s)console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=jd.Group;let a={},r={};for(var l in n){if(l==="ref")continue;var c=l.slice(0,2)==="on";if(c)r[l]=n[l];else a[l]=n[l]}let p=new s(a);return qd(p,r),p}function pP(e,n,i){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function mP(e,n,i){return!1}function gP(e){return e}function bP(){return null}function wP(){return null}function yP(e,n,i,s){return hP}function vP(){}function SP(e){}function _P(e,n){return!1}function xP(){return rk}function kP(){return rk}var TP=setTimeout,AP=clearTimeout,CP=!0,jP=typeof queueMicrotask==="function"?queueMicrotask:(e)=>Promise.resolve(null).then(e),EP=-1;function qP(e,n){return!1}var DP=!1,IP=!1,MP=!0,RP=!1,OP=!1;function FP(e,n){if(n.parent===e)n.moveToTop();else e.add(n);Ll(e)}function NP(e,n){if(n.parent===e)n.moveToTop();else e.add(n);Ll(e)}function lk(e,n,i){n._remove(),e.add(n),n.setZIndex(i.getZIndex()),Ll(e)}function PP(e,n,i){lk(e,n,i)}function BP(e,n){n.destroy(),n.off(Ed),Ll(e)}function LP(e,n){n.destroy(),n.off(Ed),Ll(e)}function HP(e,n,i){console.error(`Text components are not yet supported in ReactKonva. You text is: "${i}"`)}function UP(e,n,i){}function zP(e,n,i,s){qd(e,s,i)}function GP(e){e.hide(),Ll(e)}function VP(e){}function XP(e,n){if(n.visible==null||n.visible)e.show()}function WP(e,n){}function KP(e){}function $P(){}function YP(){return null}function QP(){}function JP(){}function ZP(){return zb}function eB(){}function tB(){return null}function nB(e){ok=e}function iB(){return ok}function sB(){return F3}function aB(){return!1}function rB(){}function oB(){return null}function lB(){return-1.1}function cB(){}function uB(){return!1}function hB(){return!0}function fB(){}function dB(){}function pB(){return null}var mB=null,gB=wt(null);function bB(){}C();function ck(e,n,i){if(!e)return;if(i(e)===!0)return e;let s=n?e.return:e.child;for(;s;){let a=ck(s,n,i);if(a)return a;s=n?null:s.sibling}}function uk(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch(n){return e}}var B3=uk(wt(null));class Gb extends da{render(){return j(B3.Provider,{value:this._reactInternals},this.props.children)}}function wB(){let e=xt(B3);if(e===null)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let n=fu();return O(()=>{for(let i of[e,e==null?void 0:e.alternate]){if(!i)continue;let s=ck(i,!1,(a)=>{let r=a.memoizedState;for(;r;){if(r.memoizedState===n)return!0;r=r.next}});if(s)return s}},[e,n])}var yB=Symbol.for("react.context"),vB=(e)=>e!==null&&typeof e=="object"&&("$$typeof"in e)&&e.$$typeof===yB;function SB(){let e=wB(),[n]=u(()=>new Map);n.clear();let i=e;for(;i;){let s=i.type;vB(s)&&s!==B3&&!n.has(s)&&n.set(s,rc(uk(s))),i=i.return}return n}function hk(){let e=SB();return O(()=>Array.from(e.keys()).reduce((n,i)=>(s)=>j(n,null,j(i.Provider,{...s,value:e.get(i)})),(n)=>j(Gb,{...n})),[e])}if(fa.indexOf("19")===-1)throw Error("react-konva version 19 is only compatible with React 19. Make sure to have the last version of react-konva and react or downgrade react-konva to version 18.");function _B(e){let n=v({});return He(()=>{n.current=e}),He(()=>()=>{n.current={}},[]),n.current}var xB=()=>{let e=v(0);return O(()=>{e.current++},[]),e.current>1},kB=(e)=>{let n=v(null),i=v(null),s=v(null),a=_B(e),r=hk(),l=v(null),c=(g)=>{let{forwardedRef:y}=e;if(!y)return;if(typeof y==="function")y(g);else y.current=g},p=xB(),m=()=>{c(null),_h.flushSyncFromReconciler(()=>{_h.updateContainer(null,s.current,null)}),i.current?.destroy(),i.current=null};return He(()=>{if(l.current)clearTimeout(l.current),l.current=null;if(i.current)c(i.current);else i.current=new jd.Stage({width:e.width,height:e.height,container:n.current}),c(i.current),s.current=_h.createContainer(i.current,O3,null,!1,null,"",console.error,console.error,console.error,null),_h.updateContainer(j(r,{},e.children),s.current,null,()=>{});return()=>{if(p)l.current=setTimeout(m,0);else m()}},[]),He(()=>{c(i.current),qd(i.current,e,a),_h.updateContainer(j(r,{},e.children),s.current,null),_h.flushSyncWork()}),j("div",{ref:n,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},dk="Layer";var pk="Group";var L3="Rect";var H3="Line";var mk="Image";var U3="Arrow";var _h=fk.default(P3);ak(()=>_h.flushSyncWork());var gk=D((e,n)=>j(Gb,{},j(kB,{...e,forwardedRef:n})));var yk=Ke(wk(),1);var TB=({width:e,height:n,mediaDimensions:i,imageUrl:s,canvasElement:a,videoElement:r,annotations:l,scale:c,offset:p,onPan:m,onClick:g,className:y,isDrawing:x=!1,currentTool:I="arrow",currentColor:M="#ef4444",onAddAnnotation:H})=>{let[X]=yk.default(s||"","anonymous"),W=v(null),Y=v(!1),te=v({x:0,y:0}),ae=v(null),ne=v(null),oe=v(null),me=v(null);h(()=>{if(a&&W.current)W.current.getLayer()?.batchDraw()},[a]),h(()=>{if(r&&W.current){let ze=W.current.getLayer();if(!ze)return;let Le=new Zx.Animation(()=>{},ze);return Le.start(),()=>{Le.stop()}}},[r]);let be=(ze,Le=!1,qe)=>{let Me=ze.getAbsoluteTransform().copy();Me.invert();let yt=qe||ze.getStage()?.getPointerPosition();if(yt){let Ge=Me.point(yt);if(Le)return{x:Math.max(0,Math.min(i.width,Ge.x)),y:Math.max(0,Math.min(i.height,Ge.y))};return Ge}return null},xe=v({isDrawing:x,currentTool:I,currentColor:M,onPan:m,offset:p,scale:c,mediaDimensions:i,onAddAnnotation:H});xe.current={isDrawing:x,currentTool:I,currentColor:M,onPan:m,offset:p,scale:c,mediaDimensions:i,onAddAnnotation:H};let Oe=()=>{if(!Y.current)return;Y.current=!1;let{isDrawing:ze,onAddAnnotation:Le,mediaDimensions:qe,currentTool:Me,currentColor:yt}=xe.current;if(ze&&Le){let{width:Ge,height:Qe}=qe,jt=(ut,st)=>ut/st;if(Me==="freehand"&&ne.current){ne.current.visible(!1);let ut=ne.current.points(),st=[];for(let bt=0;bt<ut.length;bt+=2)st.push([jt(ut[bt],Ge),jt(ut[bt+1],Qe)]);if(st.length>1)Le({type:"freehand",color:yt,points:st})}else if(Me==="line"&&ne.current){ne.current.visible(!1);let ut=ne.current.points(),st={type:"line",color:yt,points:[[jt(ut[0],Ge),jt(ut[1],Qe)],[jt(ut[2],Ge),jt(ut[3],Qe)]]};Le(st)}else if(Me==="box"&&oe.current){oe.current.visible(!1);let ut=oe.current.x(),st=oe.current.y(),bt=oe.current.width(),Wt=oe.current.height(),un=[jt(ut,Ge),jt(st,Qe)],nn=[jt(ut+bt,Ge),jt(st+Wt,Qe)];Le({type:"box",color:yt,points:[un,nn]})}else if(Me==="arrow"&&me.current){me.current.visible(!1);let ut=me.current.points(),st={type:"arrow",color:yt,points:[[jt(ut[0],Ge),jt(ut[1],Qe)],[jt(ut[2],Ge),jt(ut[3],Qe)]]};Le(st)}}};h(()=>{let ze=(qe)=>{if(!Y.current)return;let Me=W.current?.getStage();if(!Me)return;let Ge=Me.container().getBoundingClientRect(),Qe,jt;if("clientX"in qe)Qe=qe.clientX,jt=qe.clientY;else Qe=qe.touches[0].clientX,jt=qe.touches[0].clientY;let ut={x:Qe-Ge.left,y:jt-Ge.top};if("touches"in qe&&qe.touches.length>1){te.current=ut;return}let{isDrawing:st,currentTool:bt,onPan:Wt,offset:un}=xe.current;if(st){if(bt==="select")return;let nn=be(W.current,!0,ut);if(!nn||!ae.current)return;let Zt=ae.current,Rn=W.current?.getLayer();if(bt==="freehand"&&ne.current){let Jn=ne.current.points().concat([nn.x,nn.y]);ne.current.points(Jn)}else if(bt==="line"&&ne.current)ne.current.points([Zt.x,Zt.y,nn.x,nn.y]);else if(bt==="box"&&oe.current)oe.current.width(nn.x-Zt.x),oe.current.height(nn.y-Zt.y);else if(bt==="arrow"&&me.current)me.current.points([Zt.x,Zt.y,nn.x,nn.y]);Rn?.batchDraw()}else{if(!Wt)return;let nn=ut.x-te.current.x,Zt=ut.y-te.current.y;te.current=ut,Wt({x:un.x+nn,y:un.y+Zt})}},Le=(qe)=>{if("touches"in qe&&qe.touches.length>0)return;Oe()};return window.addEventListener("mousemove",ze),window.addEventListener("mouseup",Le),window.addEventListener("touchmove",ze),window.addEventListener("touchend",Le),()=>{window.removeEventListener("mousemove",ze),window.removeEventListener("mouseup",Le),window.removeEventListener("touchmove",ze),window.removeEventListener("touchend",Le)}},[]);let Fe=(ze)=>{if(x){if(I==="select")return;if(!ze.target.getStage())return;let qe=be(W.current);if(!qe)return;if(qe.x<0||qe.x>i.width||qe.y<0||qe.y>i.height)return;Y.current=!0,ae.current=qe;let Me=W.current?.getLayer();if(!Me)return;if(I==="freehand"&&ne.current)ne.current.points([qe.x,qe.y]),ne.current.stroke(M),ne.current.visible(!0);else if(I==="line"&&ne.current)ne.current.points([qe.x,qe.y,qe.x,qe.y]),ne.current.stroke(M),ne.current.visible(!0);else if(I==="box"&&oe.current)oe.current.position(qe),oe.current.width(0),oe.current.height(0),oe.current.stroke(M),oe.current.visible(!0);else if(I==="arrow"&&me.current)me.current.points([qe.x,qe.y,qe.x,qe.y]),me.current.stroke(M),me.current.fill(M),me.current.visible(!0);Me.batchDraw()}else{if(!m)return;Y.current=!0;let Le=ze.target.getStage();if(Le){let qe=Le.getPointerPosition();if(qe)te.current=qe}}},Ue=(ze,Le)=>{let{width:qe,height:Me}=i;switch(ze.type){case"box":{let[yt,Ge]=ze.points,Qe=Math.min(yt[0],Ge[0])*qe,jt=Math.min(yt[1],Ge[1])*Me,ut=Math.abs(Ge[0]-yt[0])*qe,st=Math.abs(Ge[1]-yt[1])*Me;return t(L3,{x:Qe,y:jt,width:ut,height:st,stroke:ze.color,strokeWidth:2.6/c,listening:!1},Le)}case"arrow":{let yt=ze.points.flat().map((Ge,Qe)=>Qe%2===0?Ge*qe:Ge*Me);return t(U3,{points:yt,stroke:ze.color,strokeWidth:2.6/c,fill:ze.color,pointerLength:10/c,pointerWidth:10/c,listening:!1},Le)}case"line":case"freehand":{let yt=ze.points.flat().map((Ge,Qe)=>Qe%2===0?Ge*qe:Ge*Me);return t(H3,{points:yt,stroke:ze.color,strokeWidth:2.6/c,tension:0.5,lineCap:"round",lineJoin:"round",listening:!1},Le)}default:return null}};return t("div",{className:y,style:{width:e,height:n,overflow:"hidden",pointerEvents:!x&&!m?"none":"auto",cursor:x&&I!=="select"?"crosshair":m?Y.current?"grabbing":"grab":"default"},children:t(gk,{width:e,height:n,scaleX:c,scaleY:c,x:p.x,y:p.y,onMouseDown:Fe,onClick:!x?g:void 0,onTap:!x?g:void 0,onTouchStart:Fe,children:o(dk,{children:[t(mk,{ref:W,image:r||a||X,width:i.width,height:i.height}),l.map(Ue),o(pk,{listening:!1,children:[t(H3,{ref:ne,strokeWidth:2.6/c,lineCap:"round",lineJoin:"round",visible:!1}),t(L3,{ref:oe,strokeWidth:2.6/c,visible:!1}),t(U3,{ref:me,points:[],strokeWidth:2.6/c,pointerLength:10/c,pointerWidth:10/c,visible:!1})]})]})})})},$o=TB;function nu(e,n,i,s){if(e<=0||n<=0||i<=0||s<=0)return 1;return Math.min(e/i,n/s)}function Hl(e,n,i,s,a){return{x:(e-i*a)/2,y:(n-s*a)/2}}function $p(e,n,i=0.02){return e>n*(1+i)}function AB(e,n=0.01,i=50){return Math.min(i,Math.max(n,e))}function Ul(e,n,i,s,a,r=0.01,l=50){let c=AB(e*i,r,l),p=c/e;return{zoom:c,pan:{x:s-(s-n.x)*p,y:a-(a-n.y)*p}}}function vk(e,n){let i=n===1?e*16:n===2?e*100:e,s=Math.exp(-i*0.01);return Math.min(2,Math.max(0.5,s))}C();function Dd({containerRef:e,zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r}){let l=v({zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r});l.current={zoom:n,pan:i,baseScale:s,onZoomChange:a,onPanChange:r},h(()=>{let c=e.current;if(!c)return;let p=new Map,m=null,g=(X)=>{let W=l.current;if(X.ctrlKey){X.preventDefault();let Y=c.getBoundingClientRect(),te=X.clientX-Y.left,ae=X.clientY-Y.top;W.onZoomChange(Ul(W.zoom,W.pan,vk(X.deltaY,X.deltaMode),te,ae));return}if($p(W.zoom,W.baseScale))X.preventDefault(),W.onPanChange({x:W.pan.x-X.deltaX,y:W.pan.y-X.deltaY})},y=(X,W)=>Math.hypot(W.x-X.x,W.y-X.y),x=(X,W,Y)=>({x:(X.x+W.x)/2-Y.left,y:(X.y+W.y)/2-Y.top}),I=(X)=>{for(let W of Array.from(X.touches))p.set(W.identifier,{x:W.clientX,y:W.clientY});if(p.size===2){X.preventDefault();let W=c.getBoundingClientRect(),[Y,te]=Array.from(p.values());m={lastDist:y(Y,te),lastMid:x(Y,te,W)}}},M=(X)=>{for(let Oe of Array.from(X.touches))p.set(Oe.identifier,{x:Oe.clientX,y:Oe.clientY});if(!m||p.size<2)return;X.preventDefault();let W=c.getBoundingClientRect(),[Y,te]=Array.from(p.values()),ae=x(Y,te,W),ne=y(Y,te),oe=l.current,me=m.lastDist>0?ne/m.lastDist:1,be=Ul(oe.zoom,oe.pan,me,ae.x,ae.y),xe=be.pan;if($p(be.zoom,oe.baseScale))xe={x:xe.x+(ae.x-m.lastMid.x),y:xe.y+(ae.y-m.lastMid.y)};oe.onZoomChange({zoom:be.zoom,pan:xe}),m.lastDist=ne,m.lastMid=ae},H=(X)=>{for(let W of Array.from(X.changedTouches))p.delete(W.identifier);if(p.size<2)m=null};return c.addEventListener("wheel",g,{passive:!1}),c.addEventListener("touchstart",I,{passive:!1}),c.addEventListener("touchmove",M,{passive:!1}),c.addEventListener("touchend",H,{passive:!1}),c.addEventListener("touchcancel",H,{passive:!1}),()=>{c.removeEventListener("wheel",g),c.removeEventListener("touchstart",I),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",H),c.removeEventListener("touchcancel",H)}},[e])}var CB=D(({file:e,onPlay:n,onPause:i,onTimeUpdate:s,annotations:a,startTime:r,shareId:l,children:c,allowDownload:p},m)=>{let g=v(null),y=g,x=(e.media?.videoTranscodes??[]).map((Dt)=>{let Pt=Math.max(Dt.width,Dt.height),Kt=`${Dt.height}p`;if(Pt>=3840)Kt="2160p";else if(Pt>=1920)Kt="1080p";else if(Pt>=1280)Kt="720p";else if(Pt>=960)Kt="540p";else if(Pt>=640)Kt="360p";else if(Pt>=320)Kt="180p";return{...Dt,resolution:Kt}}),I=x.length>0&&!!e.media?.metadata,M=v(null),H=()=>{if(x.length===0)return null;if(typeof window>"u")return x[0];let Dt=window.innerWidth*(window.devicePixelRatio||1),Pt=[...x].sort(($t,Ci)=>{let gi=$t.width??0,gr=Ci.width??0;return gi-gr});return Pt.find(($t)=>($t.width??0)>=Dt)||Pt[Pt.length-1]},X=H(),[W,Y]=u({isPlaying:!1,progress:0,currentTime:0,duration:e.media?.metadata?.duration||0,volume:1,isMuted:!1,isLooping:!1,playbackRate:1,isFullScreen:!1,showFrames:!1,currentResolution:X?.resolution??"",currentSrc:X?.url??""}),te=v(null),ae=v(null),ne=v(null);tn(m,()=>({play:()=>{if(g.current)g.current.play()},pause:()=>{if(g.current)g.current.pause()},seekTo:(Dt)=>{if(g.current)g.current.currentTime(Dt)},getCurrentTime:()=>(g.current?g.current.currentTime():0)??0,getDuration:()=>(g.current?g.current.duration():0)??0}));let oe=v(!1),[me,be]=u(void 0),xe=v(null),[Oe,Fe]=u(1),[Ue,ze]=u({x:0,y:0}),[Le,qe]=u(!1),[Me,yt]=u({width:0,height:0});h(()=>{let Dt=H();Y((Pt)=>({...Pt,isPlaying:!1,progress:0,currentTime:0,duration:e.media?.metadata?.duration||0,currentResolution:Dt?.resolution??"",currentSrc:Dt?.url??""})),qe(!1),Ki(!1),Bi(0),zt.current=null},[e.id]);let Ge=e.media?.metadata?.originalWidth||1920,Qe=e.media?.metadata?.originalHeight||1080,jt=nu(Me.width,Me.height,Ge,Qe),ut=(Dt)=>{qe(!0);let Pt=Ul(Oe,Ue,Dt/Oe,Me.width/2,Me.height/2);Fe(Pt.zoom),ze(Pt.pan)},st=()=>{if(qe(!1),Me.width>0&&Me.height>0){let Dt=nu(Me.width,Me.height,Ge,Qe);Fe(Dt),ze(Hl(Me.width,Me.height,Ge,Qe,Dt))}},{isDrawing:bt,currentTool:Wt,currentColor:un,addAnnotation:nn,annotations:Zt}=Wr(),Rn=[...a||[],...Zt];h(()=>{if(!te.current)return;let Dt=new ResizeObserver((Pt)=>{let Kt=Pt[0];if(Kt)yt({width:Kt.contentRect.width,height:Kt.contentRect.height})});return Dt.observe(te.current),()=>Dt.disconnect()},[]),h(()=>{if(Me.width<=0||Me.height<=0)return;if(Le)return;let Dt=nu(Me.width,Me.height,Ge,Qe);Fe(Dt),ze(Hl(Me.width,Me.height,Ge,Qe,Dt))},[Me.width,Me.height,Ge,Qe,Le]),Dd({containerRef:te,zoom:Oe,pan:Ue,baseScale:jt,onZoomChange:(Dt)=>{qe(!0),Fe(Dt.zoom),ze(Dt.pan)},onPanChange:ze}),h(()=>()=>{xe.current=null},[]);let[Jn,Bi]=u(0),[ai,Ai]=u(!0),[Ks,Ki]=u(!1),zt=v(null),Yt=e.media?.metadata,ln=Yt?.frameRate||30,bn=Yt?.totalFrames||0,ri=Yt?.duration||0,fn=e.proxyType==="audio",Si=Hc({dbTotalFrames:bn,containerDuration:ri,frameRate:ln}),{currentFrame:En,seekToFrame:sa}=yb(xe,ln,Si,fn),pr=En/ln,bs=Si/ln,ws=bs>0?pr/bs*100:0,aa={...W,currentTime:pr,duration:bs,progress:ws};h(()=>{if(s)s(En/ln)},[En,ln,s]),h(()=>{if(!M.current)return;let Pt=H()?.url??"";if(!Pt)return;if(y.current&&!y.current.isDisposed())y.current.dispose(),y.current=null,xe.current=null;let Kt=document.createElement("video-js");Kt.classList.add("vjs-big-play-centered","!h-full","!w-full"),Kt.style.opacity="0",Kt.style.pointerEvents="none",M.current.appendChild(Kt);let $t=y.current=$e(Kt,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:Pt,type:"video/mp4"}]}),Ci=Kt.querySelector("video");if(Ci)be(Ci),xe.current=Ci;else $t.ready(()=>{let gi=$t.tech({iWillNotUseThisInPlugins:!0})?.el();if(gi)be(gi),xe.current=gi});return $t.on("play",()=>{Y((gi)=>({...gi,isPlaying:!0})),n?.()}),$t.on("pause",()=>{Y((gi)=>({...gi,isPlaying:!1})),i?.()}),$t.on("ended",()=>Y((gi)=>({...gi,isPlaying:!1}))),$t.on("loadedmetadata",()=>{Ki(!0)}),$t.on("loadstart",()=>{Ki(!1)}),$t.on("timeupdate",()=>{let gi=$t.duration()||e.media?.metadata?.duration||0,gr=$t.bufferedEnd();if(gi>0)Bi(gr/gi*100)}),$t.on("volumechange",()=>{let gi=$t.volume(),gr=$t.muted();Y((tl)=>({...tl,volume:gi||0,isMuted:gr||!1}))}),$t.on("ratechange",()=>{Y((gi)=>({...gi,playbackRate:$t.playbackRate()||1}))}),$t.on("error",()=>{console.error("VideoJS Error:",$t.error())}),$t.volume(W.volume),()=>{if($t&&!$t.isDisposed())$t.dispose(),y.current=null,xe.current=null}},[e.id]),h(()=>{if(!Ks)return;if(r!==void 0&&r!==null&&r>0){if(r!==zt.current){zt.current=r;let Dt=Math.floor(r*ln+0.45);sa(Dt)}}},[r,ln,sa,Ks]);let Li=N(()=>{if(ne.current)clearTimeout(ne.current);if(W.isFullScreen&&!oe.current)ne.current=setTimeout(()=>{Ai(!1)},1200)},[W.isFullScreen]),ys=N(()=>{Ai(!0),Li()},[Li]),Vr=N(()=>{if(oe.current=!0,ne.current)clearTimeout(ne.current);Ai(!0)},[]),Xr=N(()=>{oe.current=!1,Li()},[Li]),zn=N(()=>{if(W.isFullScreen){if(ne.current)clearTimeout(ne.current);Ai(!1)}},[W.isFullScreen]);h(()=>()=>{if(ne.current)clearTimeout(ne.current)},[]),h(()=>{if(!W.isFullScreen){if(Ai(!0),ne.current)clearTimeout(ne.current)}else ys()},[W.isPlaying,W.isFullScreen,ys]);let ka=N(()=>{if(Wr.getState().isDrawing)return;let Dt=y.current;if(!Dt)return;if(Dt.paused()||Dt.ended()){let Pt=Dt.play();if(Pt!==void 0)Pt.catch((Kt)=>{if(Kt.name==="AbortError")return;console.error("Play failed:",Kt)})}else Dt.pause()},[]);h(()=>{let Dt=(Pt)=>{let Kt=document.activeElement;if(Kt&&(Kt.tagName==="INPUT"||Kt.tagName==="TEXTAREA"||Kt instanceof HTMLElement&&Kt.isContentEditable))return;let $t=Pt.key===" ",Ci=Kt&&(Kt.tagName==="BUTTON"||Kt.tagName==="A"||Kt.tagName==="SELECT"||Kt.tagName==="OPTION"||Kt.getAttribute("role")==="button"||Kt.getAttribute("role")==="link"||Kt.getAttribute("role")==="checkbox"||Kt.getAttribute("role")==="radio"||Kt.getAttribute("role")==="menuitem");if($t&&Ci)return;if(Pt.key===" "||Pt.key.toLowerCase()==="k")Pt.preventDefault(),ka()};return window.addEventListener("keydown",Dt),()=>{window.removeEventListener("keydown",Dt)}},[ka]);let mr=()=>{let Dt=y.current;if(!Dt)return;let Pt=!W.isLooping;Dt.loop(Pt),Y((Kt)=>({...Kt,isLooping:Pt}))},Wl=(Dt)=>{Y((Kt)=>({...Kt,volume:Dt,isMuted:Dt===0}));let Pt=y.current;if(!Pt)return;if(Pt.volume(Dt),Dt>0&&Pt.muted())Pt.muted(!1);else if(Dt===0&&!Pt.muted())Pt.muted(!0)},ho=()=>{let Dt=y.current;if(!Dt)return;if(Dt.muted()){if(Dt.muted(!1),Dt.volume()===0)Dt.volume(0.5)}else Dt.muted(!0)},Kl=(Dt)=>{let Pt=y.current;if(!Pt)return;Pt.playbackRate(Dt)},mo=(Dt)=>{let Pt=y.current;if(!Pt)return;let Kt=!Pt.paused(),$t=Pt.currentTime();Y((Ci)=>({...Ci,currentResolution:Dt.resolution,currentSrc:Dt.url})),Pt.src({type:"video/mp4",src:Dt.url}),Pt.one("loadedmetadata",()=>{if(Pt.currentTime($t),Kt){let Ci=Pt.play();if(Ci!==void 0)Ci.catch((gi)=>{if(gi.name==="AbortError")return;console.error("Play after seek failed:",gi)})}Pt.playbackRate(W.playbackRate)})},Gt=()=>{let Dt=ae.current,Pt=me||xe.current;if(Dt&&typeof Dt.requestFullscreen==="function"){if(!document.fullscreenElement)Dt.requestFullscreen().catch(()=>{}),Y(($t)=>({...$t,isFullScreen:!0}));else if(document.exitFullscreen)document.exitFullscreen().catch(()=>{}),Y(($t)=>({...$t,isFullScreen:!1}));return}let Kt=Pt;if(Kt&&typeof Kt.webkitEnterFullscreen==="function"){if(!Kt.webkitDisplayingFullscreen)try{Kt.webkitEnterFullscreen()}catch($t){console.error("Failed to enter iOS fullscreen:",$t)}else if(typeof Kt.webkitExitFullscreen==="function")try{Kt.webkitExitFullscreen()}catch($t){console.error("Failed to exit iOS fullscreen:",$t)}return}Y(($t)=>({...$t,isFullScreen:!$t.isFullScreen}))},Qt=async(Dt)=>{try{let Pt=l?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:l,fileId:e.id},json:{key:Dt}}):await A.api.files["download-url"].$post({json:{key:Dt,assetId:e.id}});if(!Pt.ok)return;let{url:Kt}=await Pt.json(),$t=document.createElement("a");$t.href=Kt,$t.download="",document.body.appendChild($t),$t.click(),document.body.removeChild($t)}catch{}};h(()=>{let Dt=()=>{Y((Ci)=>({...Ci,isFullScreen:!!document.fullscreenElement}))};document.addEventListener("fullscreenchange",Dt);let Pt=me||xe.current,Kt=()=>{Y((Ci)=>({...Ci,isFullScreen:!0}))},$t=()=>{Y((Ci)=>({...Ci,isFullScreen:!1}))};if(Pt)Pt.addEventListener("webkitbeginfullscreen",Kt),Pt.addEventListener("webkitendfullscreen",$t);return()=>{if(document.removeEventListener("fullscreenchange",Dt),Pt)Pt.removeEventListener("webkitbeginfullscreen",Kt),Pt.removeEventListener("webkitendfullscreen",$t)}},[me]);let Zn=Oe,es=Co();if(!I)return t("div",{className:"flex h-full w-full items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Media is not available."})});return o("div",{ref:ae,className:E("group shadow-2xl font-sans select-none flex flex-col mx-auto relative",W.isFullScreen?"h-full w-full rounded-none bg-black":"w-full h-full",!ai&&W.isFullScreen?"cursor-none":""),onMouseMove:ys,onMouseLeave:zn,children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[!W.isFullScreen&&c,o("div",{ref:te,className:E("flex-1 bg-black cursor-pointer relative flex items-center justify-center overflow-hidden min-h-0 touch-none"),onClick:ka,"data-vjs-player":!0,"data-testid":"video-area",children:[t("div",{ref:M,className:"absolute inset-0 z-[-1]"}),fn?t("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:t(To,{className:E("w-16 h-16 text-foreground/75 transition-transform duration-500",W.isPlaying?"animate-pulse scale-110 text-primary":"")})}):me&&Me.width>0&&t($o,{width:Me.width,height:Me.height,mediaDimensions:{width:Ge,height:Qe},videoElement:me,annotations:Rn,scale:Zn,offset:Ue,className:"absolute inset-0",isDrawing:bt,currentTool:Wt,currentColor:un,onAddAnnotation:nn}),!W.isPlaying&&!bt&&t("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 pointer-events-none z-10",children:t("div",{className:"w-20 h-20 bg-white/10 backdrop-blur-sm rounded-full flex items-center justify-center border-2 border-white/30 animate-pulse",children:t(Dc,{className:"w-10 h-10 text-white ml-1 fill-white"})})})]})]}),es?t(b_,{state:aa,zoom:Oe,isControlsVisible:ai,buffered:Jn,data:e,resolutions:x,togglePlay:ka,toggleLoop:mr,toggleMute:ho,handleVolumeChange:Wl,changePlaybackRate:Kl,changeResolution:mo,handleDownload:Qt,toggleFullScreen:Gt,onZoomChange:ut,onZoomReset:st,frameRate:ln,totalFrames:Si,currentFrame:En,seekToFrame:sa,onMouseEnter:Vr,onMouseLeave:Xr,allowDownload:p}):t(Zc,{state:aa,zoom:Oe,isControlsVisible:ai,buffered:Jn,data:e,resolutions:x,togglePlay:ka,toggleLoop:mr,toggleMute:ho,handleVolumeChange:Wl,changePlaybackRate:Kl,changeResolution:mo,handleDownload:Qt,toggleFullScreen:Gt,onZoomChange:ut,onZoomReset:st,frameRate:ln,totalFrames:Si,currentFrame:En,seekToFrame:sa,onMouseEnter:Vr,onMouseLeave:Xr,allowDownload:p})]})}),Sk=CB;C();function jB(e){return(e.media?.videoTranscodes??[]).map((n)=>{let i=Math.max(n.width,n.height),s=`${n.height}p`;if(i>=3840)s="2160p";else if(i>=1920)s="1080p";else if(i>=1280)s="720p";else if(i>=960)s="540p";else if(i>=640)s="360p";else if(i>=320)s="180p";return{...n,resolution:s}})}var _k=D(function({file:n,shareId:i,isActive:s,muted:a=!0,volume:r=1,annotations:l,onStateChange:c,onActivate:p,onRequestTogglePlay:m,onTimeUpdate:g,onPlay:y},x){let I=v(null),M=v(null),H=v(null),X=v(null),[W,Y]=u(void 0),{isDrawing:te,currentTool:ae,currentColor:ne,addAnnotation:oe,annotations:me}=Wr(),[be,xe]=u({width:0,height:0}),[Oe,Fe]=u(1),[Ue,ze]=u(!1),[Le,qe]=u(null),[Me,yt]=u(!1),[Ge,Qe]=u(!1),[jt,ut]=u(1),[st,bt]=u(0),[Wt,un]=u(r),[nn,Zt]=u(a),[Rn,Jn]=u(!1),Bi=n.media?.metadata,ai=Bi?.frameRate||30,Ai=Bi?.totalFrames||0,Ks=Bi?.duration||0,Ki=Hc({dbTotalFrames:Ai,containerDuration:Ks,frameRate:ai}),zt=jB(n),Yt=zt[0],[ln,bn]=u(Yt?.resolution??""),ri=v(Yt?.url),fn=n.proxyType==="audio",{currentFrame:Si,seekToFrame:En}=yb(X,ai,Ki,fn),sa=v(Oe);sa.current=Oe;let pr=v(Si);pr.current=Si,h(()=>{if(!H.current)return;let Gt=new ResizeObserver((Qt)=>{let Zn=Qt[0];if(Zn)xe({width:Zn.contentRect.width,height:Zn.contentRect.height})});return Gt.observe(H.current),()=>Gt.disconnect()},[]);let bs=Bi?.originalWidth||1920,ws=Bi?.originalHeight||1080;h(()=>{if(be.width>0&&be.height>0&&!Ue){let Gt=Math.min(be.width/bs,be.height/ws);Fe(Gt)}},[be.width,be.height,bs,ws,Ue]),h(()=>{bn(Yt?.resolution??""),ri.current=Yt?.url},[n.id]),h(()=>{if(!M.current)return;let Gt=document.createElement("video-js");Gt.classList.add("vjs-big-play-centered","!h-full","!w-full"),Gt.style.opacity="0",Gt.style.pointerEvents="none",M.current.appendChild(Gt);let Qt=I.current=$e(Gt,{controls:!1,autoplay:!1,preload:"auto",playsinline:!0,sources:[{src:ri.current??"",type:"video/mp4"}]}),Zn=Gt.querySelector("video");if(Zn)Y(Zn),X.current=Zn;else Qt.ready(()=>{let es=Qt.tech({iWillNotUseThisInPlugins:!0})?.el();if(es)Y(es),X.current=es});return Qt.on("play",()=>{yt(!0),y?.()}),Qt.on("pause",()=>yt(!1)),Qt.on("ended",()=>yt(!1)),Qt.on("loadedmetadata",()=>Jn(!0)),Qt.on("loadstart",()=>Jn(!1)),Qt.on("timeupdate",()=>{let es=Qt.duration()||Ks||0,Dt=Qt.bufferedEnd();if(es>0)bt(Dt/es*100)}),Qt.on("volumechange",()=>{un(Qt.volume()||0),Zt(Qt.muted()||!1)}),Qt.on("ratechange",()=>ut(Qt.playbackRate()||1)),()=>{if(Qt&&!Qt.isDisposed())Qt.dispose(),I.current=null,X.current=null}},[n.id]),h(()=>{let Gt=I.current;if(!Gt||!Rn)return;Gt.muted(a),Gt.volume(r)},[a,r,Rn]),h(()=>{c({kind:"video",zoom:Oe,video:{frameRate:ai,totalFrames:Ki,currentFrame:Si,isPlaying:Me,volume:Wt,isMuted:nn,playbackRate:jt,isLooping:Ge,currentResolution:ln,resolutions:zt,buffered:st}})},[Oe,ai,Ki,Si,Me,Wt,nn,jt,Ge,ln,st]),h(()=>{if(s)g?.(Si/ai)},[Si,ai,s,g]);let aa=N((Gt)=>{let Zn=sa.current*Gt;if(Zn<0.01||Zn>50)return;Fe(Zn),ze(!0)},[]),Li=N(()=>{ze(!1),qe(null)},[]),ys=N((Gt)=>y4(Gt,Ki),[Ki]),Vr=N(async(Gt)=>{let Qt=Gt??n.media?.original?.key;if(!Qt||!n.id)return;try{let Zn=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:n.id},json:{key:Qt}}):await A.api.files["download-url"].$post({json:{key:Qt,assetId:n.id}});if(!Zn.ok)return;let{url:es}=await Zn.json(),Dt=document.createElement("a");Dt.href=es,Dt.download="",document.body.appendChild(Dt),Dt.click(),document.body.removeChild(Dt)}catch{}},[n.id,n.media?.original?.key,i]),Xr=N((Gt)=>{let Qt=I.current;if(!Qt)return;let Zn=zt.find((Pt)=>Pt.resolution===Gt);if(!Zn)return;let es=!Qt.paused(),Dt=Qt.currentTime();bn(Gt),ri.current=Zn.url,Qt.src({type:"video/mp4",src:Zn.url}),Qt.one("loadedmetadata",()=>{if(Qt.currentTime(Dt),es){let Pt=Qt.play();if(Pt!==void 0)Pt.catch(()=>{})}})},[zt]);tn(x,()=>({getKind:()=>"video",play:()=>{let Gt=I.current?.play();if(Gt!==void 0)Gt.catch(()=>{})},pause:()=>I.current?.pause(),togglePlay:()=>{let Gt=I.current;if(!Gt)return;if(Gt.paused()||Gt.ended()){let Qt=Gt.play();if(Qt!==void 0)Qt.catch(()=>{})}else Gt.pause()},seekToFrame:(Gt)=>En(ys(Gt)),seekToSecond:(Gt)=>{let Qt=Math.floor(Gt*ai+0.45);En(ys(Qt))},stepFrame:(Gt)=>En(ys(pr.current+Gt)),setMuted:(Gt)=>I.current?.muted(Gt),setVolume:(Gt)=>{let Qt=I.current;if(!Qt)return;if(Qt.volume(Gt),Gt>0&&Qt.muted())Qt.muted(!1);else if(Gt===0&&!Qt.muted())Qt.muted(!0)},setPlaybackRate:(Gt)=>I.current?.playbackRate(Gt),toggleLoop:()=>{let Gt=I.current;if(!Gt)return;let Qt=!Gt.loop();Gt.loop(Qt),Qe(Qt)},changeResolution:Xr,zoomBy:aa,fit:Li,panBy:(Gt,Qt)=>qe((Zn)=>{let es=sa.current,Dt=Zn??{x:(be.width-bs*es)/2,y:(be.height-ws*es)/2};return{x:Dt.x+Gt,y:Dt.y+Qt}}),download:(Gt)=>Vr(Gt)}),[En,ys,ai,aa,Li,Xr,Vr,be.width,be.height,bs,ws]);let zn=[...l,...s?me:[]],ka=Oe,mr=(be.width-bs*ka)/2,Wl=(be.height-ws*ka)/2,ho=Le?.x??mr,Kl=Le?.y??Wl,mo=N(()=>{if(Wr.getState().isDrawing)return;if(!s){p?.();return}m?.()},[s,p,m]);if(!n.media?.metadata||zt.length===0)return t("div",{className:"flex h-full w-full items-center justify-center bg-black",children:t("p",{className:"text-muted-foreground",children:"Media is not available."})});return o("div",{ref:H,className:E("relative flex flex-1 cursor-pointer items-center justify-center overflow-hidden bg-black"),onClick:mo,"data-testid":"compare-video-area",children:[t("div",{ref:M,className:"absolute inset-0 z-[-1]"}),fn?t("div",{className:"flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none",children:t(To,{className:E("w-16 h-16 text-foreground/75 transition-transform duration-500",Me?"animate-pulse scale-110 text-primary":"")})}):W&&be.width>0&&t($o,{width:be.width,height:be.height,mediaDimensions:{width:bs,height:ws},videoElement:W,annotations:zn,scale:ka,offset:{x:ho,y:Kl},className:"absolute inset-0",onClick:mo,isDrawing:s&&te,currentTool:ae,currentColor:ne,onAddAnnotation:s?oe:void 0}),!Me&&!te&&t("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-black/20",children:t("div",{className:"flex h-16 w-16 items-center justify-center rounded-full border-2 border-white/30 bg-white/10 backdrop-blur-sm",children:t(Dc,{className:"ml-1 h-8 w-8 fill-white text-white"})})})]})});var xk={id:"video",name:"Video",match:(e)=>e.proxyType==="video"||e.proxyType==="audio",viewer:Sk,comparePane:_k,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0}};C();function Vb(){let[e,n]=u({width:window.innerWidth,height:window.innerHeight});return He(()=>{function i(){n({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),e}C();function Lc({zoom:e,onZoomIn:n,onZoomOut:i,onFit:s,onDownload:a,canDownload:r,onCopy:l,copied:c=!1,canCopy:p=!0,allowDownload:m=!0,fullscreen:g}){return o("div",{className:"relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200",children:[o("div",{className:"flex items-center gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5 mr-auto",children:[t("button",{onClick:i,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:mp(),children:t(ls,{size:16})}),o("span",{className:"w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(e*100),"%"]}),t("button",{onClick:n,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:pp(),children:t(de,{size:16})})]}),t("button",{onClick:s,className:"text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent animate-in fade-in zoom-in-95 duration-200",children:uf()}),l&&o("button",{onClick:l,disabled:!p,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:u0(),children:[c?t(Te,{size:14,className:"text-green-500"}):t(Er,{size:14}),c?a0():c0()]}),m&&o("button",{onClick:a,disabled:!r,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:d_(),children:[t(vt,{size:14}),dr()]}),g&&t("button",{onClick:g.onToggle,className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:Hu(),children:g.isFullScreen?t(ss,{size:16}):t(as,{size:16})})]})}var EB=D(({file:e,annotations:n,shareId:i,children:s,allowDownload:a},r)=>{tn(r,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}}));let{width:l}=Vb(),{isDrawing:c,currentTool:p,currentColor:m,addAnnotation:g,annotations:y}=Wr(),[x,I]=u({width:0,height:0}),[M,H]=u(1),[X,W]=u({x:0,y:0}),[Y,te]=u(!1),[ae,ne]=u(!1),oe=v(null);h(()=>{te(!1),ne(!1)},[e.id]),h(()=>{let Ge=oe.current;if(!Ge)return;let Qe=new ResizeObserver((jt)=>{let ut=jt[0];if(ut)I({width:ut.contentRect.width,height:ut.contentRect.height})});return Qe.observe(Ge),()=>Qe.disconnect()},[]);let me=e.media?.metadata?.originalWidth??1920,be=e.media?.metadata?.originalHeight??1080,{width:xe,height:Oe}=x,Fe=nu(xe,Oe,me,be);h(()=>{if(xe<=0||Oe<=0)return;if(Y)return;H(Fe),W(Hl(xe,Oe,me,be,Fe))},[xe,Oe,Fe,me,be,Y]);let Ue=(Ge)=>{te(!0);let Qe=Ul(M,X,Ge,xe/2,Oe/2);H(Qe.zoom),W(Qe.pan)},ze=()=>{te(!1),H(Fe),W(Hl(xe,Oe,me,be,Fe))};Dd({containerRef:oe,zoom:M,pan:X,baseScale:Fe,onZoomChange:(Ge)=>{te(!0),H(Ge.zoom),W(Ge.pan)},onPanChange:W});let Le=vd(e.media?.imageTranscodes,l)?.url??"",qe=async()=>{let Ge=e.media?.original?.key;if(!Ge||!e.id)return;try{let Qe=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:e.id},json:{key:Ge}}):await A.api.files["download-url"].$post({json:{key:Ge,assetId:e.id}});if(!Qe.ok)return;let{url:jt}=await Qe.json(),ut=document.createElement("a");ut.href=jt,ut.download="",document.body.appendChild(ut),ut.click(),document.body.removeChild(ut)}catch{}},Me=async()=>{let Ge=Le;if(!Ge)return;try{let Qe=(async()=>{let ut=await(await fetch(Ge)).blob(),st=new Image;st.crossOrigin="anonymous";let bt=URL.createObjectURL(ut);st.src=bt;try{await new Promise((Zt,Rn)=>{st.onload=Zt,st.onerror=(Jn)=>Rn(Error("Failed to load image: "+String(Jn)))});let Wt=document.createElement("canvas");Wt.width=st.width,Wt.height=st.height;let un=Wt.getContext("2d");if(!un)throw Error("Could not get canvas context");un.drawImage(st,0,0);let nn=await new Promise((Zt)=>{Wt.toBlob(Zt,"image/png")});if(!nn)throw Error("Failed to convert image to PNG");return nn}finally{URL.revokeObjectURL(bt)}})();await navigator.clipboard.write([new ClipboardItem({"image/png":Qe})]),ne(!0),setTimeout(()=>ne(!1),2000)}catch(Qe){console.error("Failed to copy image to clipboard:",Qe)}},yt=[...n||[],...y];return o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[s,t("div",{ref:oe,className:"flex-1 relative overflow-hidden touch-none",children:Le?t($o,{width:xe,height:Oe,mediaDimensions:{width:me,height:be},imageUrl:Le,annotations:yt,scale:M,offset:X,onPan:$p(M,Fe)?W:void 0,className:"absolute inset-0 z-0",isDrawing:c,currentTool:p,currentColor:m,onAddAnnotation:g}):t("div",{className:"flex h-full w-full items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})})})]}),t(Lc,{zoom:M,onZoomIn:()=>Ue(1.2),onZoomOut:()=>Ue(0.8),onFit:ze,onDownload:qe,canDownload:!!e.media?.original?.key,onCopy:Me,copied:ae,canCopy:!!Le,allowDownload:a})]})}),kk=EB;C();var qB=0.01,DB=50,Tk=D(function({file:n,shareId:i,isActive:s,annotations:a,onStateChange:r,onUserPan:l,onActivate:c},p){let{width:m}=Vb(),{isDrawing:g,currentTool:y,currentColor:x,addAnnotation:I,annotations:M}=Wr(),[H,X]=u({width:0,height:0}),[W,Y]=u(1),[te,ae]=u({x:0,y:0}),ne=v(null),oe=v(W);oe.current=W;let me=v(te);me.current=te;let be=N((jt)=>{if(ne.current)ne.current.disconnect(),ne.current=null;if(jt!==null){let ut=new ResizeObserver((st)=>{let bt=st[0];if(bt)X({width:bt.contentRect.width,height:bt.contentRect.height})});ut.observe(jt),ne.current=ut}},[]),xe=n.media?.metadata?.originalWidth??1920,Oe=n.media?.metadata?.originalHeight??1080,{width:Fe,height:Ue}=H,ze=1;if(Fe>0&&Ue>0)ze=Math.min(Fe/xe,Ue/Oe);h(()=>{if(Fe>0&&Ue>0)Y(ze),ae({x:(Fe-xe*ze)/2,y:(Ue-Oe*ze)/2})},[n.id,Fe,Ue,ze,xe,Oe]);let Le=N((jt)=>{let ut=Fe/2,st=Ue/2,bt=oe.current,Wt=bt*jt;if(Wt<qB||Wt>DB)return;let un=me.current;ae({x:ut-(ut-un.x)*(Wt/bt),y:st-(st-un.y)*(Wt/bt)}),Y(Wt)},[Fe,Ue]),qe=N(()=>{Y(ze),ae({x:(Fe-xe*ze)/2,y:(Ue-Oe*ze)/2})},[ze,Fe,Ue,xe,Oe]),Me=vd(n.media?.imageTranscodes,m)?.url??"",yt=N(async()=>{let jt=n.media?.original?.key;if(!jt||!n.id)return;try{let ut=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:n.id},json:{key:jt}}):await A.api.files["download-url"].$post({json:{key:jt,assetId:n.id}});if(!ut.ok)return;let{url:st}=await ut.json(),bt=document.createElement("a");bt.href=st,bt.download="",document.body.appendChild(bt),bt.click(),document.body.removeChild(bt)}catch{}},[n.id,n.media?.original?.key,i]);tn(p,()=>({getKind:()=>"image",play:()=>{},pause:()=>{},togglePlay:()=>{},seekToFrame:()=>{},seekToSecond:()=>{},stepFrame:()=>{},setMuted:()=>{},setVolume:()=>{},setPlaybackRate:()=>{},toggleLoop:()=>{},changeResolution:()=>{},zoomBy:(jt)=>Le(jt),fit:qe,panBy:(jt,ut)=>ae((st)=>({x:st.x+jt,y:st.y+ut})),download:yt}),[Le,qe,yt]),h(()=>{r({kind:"image",zoom:W})},[W,r]);let Ge=[...a,...s?M:[]],Qe=N((jt)=>{let ut=me.current,st=jt.x-ut.x,bt=jt.y-ut.y;if(ae(jt),st!==0||bt!==0)l?.(st,bt)},[l]);if(!Me)return t("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})});return t("div",{ref:be,className:"relative flex-1 overflow-hidden bg-black",onMouseDown:c,children:t($o,{width:Fe,height:Ue,mediaDimensions:{width:xe,height:Oe},imageUrl:Me,annotations:Ge,scale:W,offset:te,onPan:Qe,className:"absolute inset-0 z-0",isDrawing:s&&g,currentTool:y,currentColor:x,onAddAnnotation:s?I:void 0})})});var Ak={id:"image",name:"Image",match:(e)=>e.proxyType==="image",viewer:kk,comparePane:Tk,commentsConfig:{hasTimestamp:!1,hasAnnotations:!0}};var ur=typeof process==="object"&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Gl=[1/0,1/0,-1/0,-1/0],Ah=new Float32Array(Gl),K3=[0.001,0,0,0.001,0,0];var cr={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},su={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};var yn={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Pn={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},IB={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};var ms={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},e2={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ni={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27};var Md={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var p2={ERRORS:0,WARNINGS:1,INFOS:5},Zo={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Yp={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},MB={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},m2=p2.WARNINGS;function RB(e){if(Number.isInteger(e))m2=e}function OB(){return m2}function g2(e){if(m2>=p2.INFOS)console.info(`Info: ${e}`)}function vn(e){if(m2>=p2.WARNINGS)console.warn(`Warning: ${e}`)}function Un(e){throw Error(e)}function Pi(e,n){if(!e)Un(n)}function FB(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function eT(e,n=null,i=null){if(!e)return null;if(i&&typeof e==="string"){if(i.addDefaultProtocol&&e.startsWith("www.")){if(e.match(/\./g)?.length>=2)e=`http://${e}`}if(i.tryConvertEncoding)try{e=PB(e)}catch{}}let s=n?URL.parse(e,n):URL.parse(e);return FB(s)?s:null}function tT(e,n,i=!1){let s=URL.parse(e);if(s)return s.hash=n,s.href;if(i&&eT(e,"http://example.com"))return e.split("#",1)[0]+`${n?`#${n}`:""}`;return""}function $3(e){return e.substring(e.lastIndexOf("/")+1)}function en(e,n,i,s=!1){return Object.defineProperty(e,n,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}var Ih=function(){function n(i,s){this.message=i,this.name=s}return n.prototype=Error(),n.constructor=n,n}();class s2 extends Ih{constructor(e,n){super(e,"PasswordException");this.code=n}}class t2 extends Ih{constructor(e,n){super(e,"UnknownErrorException");this.details=n}}class a2 extends Ih{constructor(e){super(e,"InvalidPDFException")}}class im extends Ih{constructor(e,n,i){super(e,"ResponseException");this.status=n,this.missing=i}}class nT extends Ih{constructor(e){super(e,"FormatError")}}class Xl extends Ih{constructor(e){super(e,"AbortException")}}function NB(e){if(typeof e!=="object"||e?.length===void 0)Un("Invalid argument for bytesToString");let n=e.length,i=8192;if(n<i)return String.fromCharCode.apply(null,e);let s=[];for(let a=0;a<n;a+=i){let r=Math.min(a+i,n),l=e.subarray(a,r);s.push(String.fromCharCode.apply(null,l))}return s.join("")}function b2(e){if(typeof e!=="string")Un("Invalid argument for stringToBytes");let n=e.length,i=new Uint8Array(n);for(let s=0;s<n;++s)i[s]=e.charCodeAt(s)&255;return i}class si{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let n=new Uint32Array(e.buffer,0,1);return en(this,"isLittleEndian",n[0]===1)}static get isOffscreenCanvasSupported(){return en(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return en(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return en(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return en(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:e,userAgent:n}=navigator;return en(this,"platform",{isAndroid:n.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:n.includes("Firefox")})}static get isCanvasFilterSupported(){let e;if(this.isOffscreenCanvasSupported)e=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u")e=document.createElement("canvas").getContext("2d");return en(this,"isCanvasFilterSupported",e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return en(this,"isAlphaColorInputSupported",!1);let e=document.createElement("input");return e.type="color",e.setAttribute("alpha",""),e.value="#ff000080",en(this,"isAlphaColorInputSupported",e.value!=="#ff0000")}static get isBackdropFilterSupported(){return en(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}class Ot{static get hexNums(){return en(this,"hexNums",Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0")))}static makeHexColor(e,n,i){return`#${this.hexNums[e]}${this.hexNums[n]}${this.hexNums[i]}`}static transform(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}static multiplyByDOMMatrix(e,n){return[e[0]*n.a+e[2]*n.b,e[1]*n.a+e[3]*n.b,e[0]*n.c+e[2]*n.d,e[1]*n.c+e[3]*n.d,e[0]*n.e+e[2]*n.f+e[4],e[1]*n.e+e[3]*n.f+e[5]]}static applyTransform(e,n,i=0){let s=e[i],a=e[i+1];e[i]=s*n[0]+a*n[2]+n[4],e[i+1]=s*n[1]+a*n[3]+n[5]}static applyTransformToBezier(e,n,i=0){let s=n[0],a=n[1],r=n[2],l=n[3],c=n[4],p=n[5];for(let m=0;m<6;m+=2){let g=e[i+m],y=e[i+m+1];e[i+m]=g*s+y*r+c,e[i+m+1]=g*a+y*l+p}}static applyInverseTransform(e,n){let i=e[0],s=e[1],a=n[0]*n[3]-n[1]*n[2];e[0]=(i*n[3]-s*n[2]+n[2]*n[5]-n[4]*n[3])/a,e[1]=(-i*n[1]+s*n[0]+n[4]*n[1]-n[5]*n[0])/a}static axialAlignedBoundingBox(e,n,i){let s=n[0],a=n[1],r=n[2],l=n[3],c=n[4],p=n[5],m=e[0],g=e[1],y=e[2],x=e[3],I=s*m+c,M=I,H=s*y+c,X=H,W=l*g+p,Y=W,te=l*x+p,ae=te;if(a!==0||r!==0){let ne=a*m,oe=a*y,me=r*g,be=r*x;I+=me,X+=me,H+=be,M+=be,W+=ne,ae+=ne,te+=oe,Y+=oe}i[0]=Math.min(i[0],I,H,M,X),i[1]=Math.min(i[1],W,te,Y,ae),i[2]=Math.max(i[2],I,H,M,X),i[3]=Math.max(i[3],W,te,Y,ae)}static inverseTransform(e){let n=e[0]*e[3]-e[1]*e[2];return[e[3]/n,-e[1]/n,-e[2]/n,e[0]/n,(e[2]*e[5]-e[4]*e[3])/n,(e[4]*e[1]-e[5]*e[0])/n]}static singularValueDecompose2dScale(e,n){let i=e[0],s=e[1],a=e[2],r=e[3],l=i**2+s**2,c=i*a+s*r,p=a**2+r**2,m=(l+p)/2,g=Math.sqrt(m**2-(l*p-c**2));n[0]=Math.sqrt(m+g||1),n[1]=Math.sqrt(m-g||1)}static normalizeRect(e){let n=e.slice(0);if(e[0]>e[2])n[0]=e[2],n[2]=e[0];if(e[1]>e[3])n[1]=e[3],n[3]=e[1];return n}static intersect(e,n){let i=Math.max(Math.min(e[0],e[2]),Math.min(n[0],n[2])),s=Math.min(Math.max(e[0],e[2]),Math.max(n[0],n[2]));if(i>s)return null;let a=Math.max(Math.min(e[1],e[3]),Math.min(n[1],n[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(n[1],n[3]));if(a>r)return null;return[i,a,s,r]}static pointBoundingBox(e,n,i){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],n),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],n)}static rectBoundingBox(e,n,i,s,a){a[0]=Math.min(a[0],e,i),a[1]=Math.min(a[1],n,s),a[2]=Math.max(a[2],e,i),a[3]=Math.max(a[3],n,s)}static#e(e,n,i,s,a,r,l,c,p,m){if(p<=0||p>=1)return;let g=1-p,y=p*p,x=y*p,I=g*(g*(g*e+3*p*n)+3*y*i)+x*s,M=g*(g*(g*a+3*p*r)+3*y*l)+x*c;m[0]=Math.min(m[0],I),m[1]=Math.min(m[1],M),m[2]=Math.max(m[2],I),m[3]=Math.max(m[3],M)}static#t(e,n,i,s,a,r,l,c,p,m,g,y){if(Math.abs(p)<0.000000000001){if(Math.abs(m)>=0.000000000001)this.#e(e,n,i,s,a,r,l,c,-g/m,y);return}let x=m**2-4*g*p;if(x<0)return;let I=Math.sqrt(x),M=2*p;this.#e(e,n,i,s,a,r,l,c,(-m+I)/M,y),this.#e(e,n,i,s,a,r,l,c,(-m-I)/M,y)}static bezierBoundingBox(e,n,i,s,a,r,l,c,p){p[0]=Math.min(p[0],e,l),p[1]=Math.min(p[1],n,c),p[2]=Math.max(p[2],e,l),p[3]=Math.max(p[3],n,c),this.#t(e,i,a,l,n,s,r,c,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),p),this.#t(e,i,a,l,n,s,r,c,3*(-n+3*(s-r)+c),6*(n-2*s+r),3*(s-n),p)}}function PB(e){return decodeURIComponent(escape(e))}var z3=null,Ck=null;function BB(e){if(!z3)z3=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ck=new Map([["ſt","ſt"]]);return e.replaceAll(z3,(n,i,s)=>i?i.normalize("NFKC"):Ck.get(s))}function iT(){if(typeof crypto.randomUUID==="function")return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),NB(e)}function LB(e,n,i){if(!Array.isArray(i)||i.length<2)return!1;let[s,a,...r]=i;if(!e(s)&&!Number.isInteger(s))return!1;if(!n(a))return!1;let l=r.length,c=!0;switch(a.name){case"XYZ":if(l<2||l>3)return!1;break;case"Fit":case"FitB":return l===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(l>1)return!1;break;case"FitR":if(l!==4)return!1;c=!1;break;default:return!1}for(let p of r){if(typeof p==="number"||c&&p===null)continue;return!1}return!0}var Nd=()=>[],r9=()=>new Map,Y3=()=>Object.create(null),HB=()=>new Set;if(typeof Iterator.prototype.join!=="function")Iterator.prototype.join=function(e){return[...this].join(e)};function vi(e,n,i){return Math.min(Math.max(e,n),i)}class um{constructor({viewBox:e,userUnit:n,scale:i,rotation:s,offsetX:a=0,offsetY:r=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=n,this.scale=i,this.rotation=s,this.offsetX=a,this.offsetY=r,i*=n;let c=(e[2]+e[0])/2,p=(e[3]+e[1])/2,m,g,y,x;if(s%=360,s<0)s+=360;switch(s){case 180:m=-1,g=0,y=0,x=1;break;case 90:m=0,g=1,y=1,x=0;break;case 270:m=0,g=-1,y=-1,x=0;break;case 0:m=1,g=0,y=0,x=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(l)y=-y,x=-x;let I,M,H,X;if(m===0)I=Math.abs(p-e[1])*i+a,M=Math.abs(c-e[0])*i+r,H=(e[3]-e[1])*i,X=(e[2]-e[0])*i;else I=Math.abs(c-e[0])*i+a,M=Math.abs(p-e[1])*i+r,H=(e[2]-e[0])*i,X=(e[3]-e[1])*i;this.transform=[m*i,g*i,y*i,x*i,I-m*i*c-y*i*p,M-g*i*c-x*i*p],this.width=H,this.height=X}get rawDims(){let e=this.viewBox;return en(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:n=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}={}){return new um({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:n,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(e,n){let i=[e,n];return Ot.applyTransform(i,this.transform),i}convertToPdfPoint(e,n){let i=[e,n];return Ot.applyInverseTransform(i,this.transform),i}}class sm{static textContent(e){let n=[],i={items:n,styles:Object.create(null)};function s(a){if(!a)return;let r=null,l=a.name;if(l==="#text")r=a.value;else if(!sm.shouldBuildText(l))return;else if(a?.attributes?.textContent)r=a.attributes.textContent;else if(a.value)r=a.value;if(r!==null)n.push({str:r});if(!a.children)return;for(let c of a.children)s(c)}return s(e),i}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}var UB=/url\(|image-set\(/i,zB=/^on/i;class o9{static get _allowedHtmlElements(){return en(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return en(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return en(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return en(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return en(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(e,n,i,s,a){let r=s.getValue(n,{value:null});switch(i.name){case"textarea":if(r.value!==null)e.textContent=r.value;if(a==="print")break;e.addEventListener("input",(l)=>{s.setValue(n,{value:l.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(r.value===i.attributes.xfaOn)e.setAttribute("checked",!0);else if(r.value===i.attributes.xfaOff)e.removeAttribute("checked");if(a==="print")break;e.addEventListener("change",(l)=>{s.setValue(n,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(r.value!==null)e.setAttribute("value",r.value);if(a==="print")break;e.addEventListener("input",(l)=>{s.setValue(n,{value:l.target.value})})}break;case"select":if(r.value!==null){e.setAttribute("value",r.value);for(let l of i.children)if(l.attributes.value===r.value)l.attributes.selected=!0;else if(Object.hasOwn(l.attributes,"selected"))delete l.attributes.selected}e.addEventListener("input",(l)=>{let c=l.target.options,p=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(n,{value:p})});break}}static setAttributes({html:e,element:n,storage:i=null,intent:s,linkService:a}){let{attributes:r}=n,l=e instanceof HTMLAnchorElement;if(r.type==="radio")r.name=`${r.name}-${s}`;for(let[c,p]of Object.entries(r)){if(p===null||p===void 0)continue;if(zB.test(c))continue;if(s==="richText"&&!this._allowedRichTextAttributes.has(c))continue;switch(c){case"class":if(p.length)e.setAttribute(c,p.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",p);break;case"style":if(s==="richText"){let m=this._allowedRichTextStyles;for(let[g,y]of Object.entries(p))if(m.has(g)&&!UB.test(y))e.style[g]=y}else Object.assign(e.style,p);break;case"textContent":e.textContent=p;break;default:if(!l||c!=="href"&&c!=="newWindow")e.setAttribute(c,p)}}if(l)a?.addLinkAttributes(e,r.href,r.newWindow);if(i&&r.dataId)this.setupStorage(e,r.dataId,n,i)}static#e(e,n,i){if(i==="richText")return!n&&this._allowedRichTextElements.has(e)?document.createElement(e):null;if(n)return n==="http://www.w3.org/2000/svg"&&this._allowedSvgElements.has(e)?document.createElementNS("http://www.w3.org/2000/svg",e):null;return this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let{annotationStorage:n,linkService:i,xfaHtml:s}=e,a=e.intent||"display",r=this.#e(s.name,s.attributes?.xmlns,a)??document.createElement("div");if(s.attributes)this.setAttributes({html:r,element:s,intent:a,linkService:i});let l=a!=="richText",c=e.div;if(c.append(r),e.viewport){let g=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=g}if(l)c.setAttribute("class","xfaLayer xfaFont");let p=[];if(s.children.length===0){if(s.value){let g=document.createTextNode(s.value);if(r.append(g),l&&sm.shouldBuildText(s.name))p.push(g)}return{textDivs:p}}let m=[[s,-1,r]];while(m.length>0){let[g,y,x]=m.at(-1);if(y+1===g.children.length){m.pop();continue}let I=g.children[++m.at(-1)[1]];if(I===null)continue;let{name:M}=I;if(M==="#text"){let X=document.createTextNode(I.value);p.push(X),x.append(X);continue}let H=this.#e(M,I.attributes?.xmlns,a);if(!H)continue;if(x.append(H),I.attributes)this.setAttributes({html:H,element:I,storage:n,intent:a,linkService:i});if(I.children?.length>0)m.push([I,-1,H]);else if(I.value){let X=document.createTextNode(I.value);if(l&&sm.shouldBuildText(M))p.push(X);H.append(X)}}for(let g of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:p}}static update(e){let n=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=n,e.div.hidden=!1}static getPageViewport(e,{scale:n=1,rotation:i=0}){let{width:s,height:a}=e.attributes.style;return new um({viewBox:[0,0,parseInt(s,10),parseInt(a,10)],userUnit:1,scale:n,rotation:i})}}class Eh{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function l9(e,n="text"){if(em(e,document.baseURI)){let i=await fetch(e);if(!i.ok)throw Error(i.statusText);switch(n){case"blob":return i.blob();case"bytes":return i.bytes();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=n==="bytes"?"arraybuffer":n,a.onreadystatechange=()=>{if(a.readyState!==XMLHttpRequest.DONE)return;if(a.status===200||a.status===0){switch(n){case"bytes":i(new Uint8Array(a.response));return;case"blob":case"json":i(a.response);return}i(a.responseText);return}s(Error(a.statusText))},a.send(null)})}class w2 extends Ih{constructor(e,n=0){super(e,"RenderingCancelledException");this.extraDelay=n}}function y2(e){let n=e.length,i=0;while(i<n&&e[i].trim()==="")i++;return e.substring(i,i+5).toLowerCase()==="data:"}function c9(e){return typeof e==="string"&&/\.pdf$/i.test(e)}function GB(e){return[e]=e.split(/[#?]/,1),$3(e)}function VB(e,n="document.pdf"){if(typeof e!=="string")return n;if(y2(e))return vn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),n;let s=((c)=>{try{return new URL(c)}catch{}try{return new URL(decodeURIComponent(c))}catch{}try{return new URL(c,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(c),"https://foo.bar")}catch{}return null})(e);if(!s)return n;let a=(c)=>{try{let p=decodeURIComponent(c);if(p.includes("/")){if(p=$3(p),p.length===4&&r.test(p))return c}return p}catch{return c}},r=/\.pdf$/i,l=$3(s.pathname);if(r.test(l))return a(l);if(s.searchParams.size>0){let c=(m)=>[...m].findLast((g)=>r.test(g)),p=c(s.searchParams.values())??c(s.searchParams.keys());if(p)return a(p)}if(s.hash){let{hash:c}=s,p=-1;for(let{index:m}of c.matchAll(/\.pdf\b/gi))p=m;if(p>0){let m=p;while(m>0&&!"/?#=".includes(c[m-1]))m--;if(m<p)return a(c.slice(m,p+4))}}return n}class Q3{#e=new Map;times=[];time(e){if(this.#e.has(e))vn(`Timer is already running for ${e}`);this.#e.set(e,Date.now())}timeEnd(e){if(!this.#e.has(e))vn(`Timer has not been started for ${e}`);this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map((n)=>n.name.length));return this.times.map((n)=>`${n.name.padEnd(e)} ${n.end-n.start}ms
|
|
245
|
+
`).join("")}}function em(e,n){let i=n?URL.parse(e,n):URL.parse(e);return/https?:/.test(i?.protocol??"")}function lo(e){e.preventDefault()}function gs(e){e.preventDefault(),e.stopPropagation()}class r2{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?");let n=this.#e.exec(e);if(!n)return null;let i=parseInt(n[1],10),s=parseInt(n[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(n[3],10);a=a>=1&&a<=31?a:1;let r=parseInt(n[4],10);r=r>=0&&r<=23?r:0;let l=parseInt(n[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(n[6],10);c=c>=0&&c<=59?c:0;let p=n[7]||"Z",m=parseInt(n[8],10);m=m>=0&&m<=23?m:0;let g=parseInt(n[9],10)||0;if(g=g>=0&&g<=59?g:0,p==="-")r+=m,l+=g;else if(p==="+")r-=m,l-=g;return new Date(Date.UTC(i,s,a,r,l,c))}}function hm(e){if(e.startsWith("#")){let i=e.slice(1);return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),i.length>=8?parseInt(i.slice(6,8),16)/255:1]}if(e.startsWith("rgb(")){let[i,s,a]=e.slice(4,-1).split(",").map((r)=>parseInt(r,10));return[i,s,a,1]}if(e.startsWith("rgba(")){let i=e.slice(5,-1).split(",");return[parseInt(i[0],10),parseInt(i[1],10),parseInt(i[2],10),parseFloat(i[3])]}let n=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);if(n)return[Math.round(parseFloat(n[1])*255),Math.round(parseFloat(n[2])*255),Math.round(parseFloat(n[3])*255),n[4]!==void 0&&n[4]!=="none"?parseFloat(n[4]):1];return null}function fm(e){let n=hm(e);if(!n)return vn(`Not a valid color format: "${e}"`),[0,0,0];return n.slice(0,3)}function XB(e){let n=document.createElement("span");n.style.visibility="hidden",n.style.colorScheme="only light",document.body.append(n);for(let i of e.keys()){n.style.color=i;let s=window.getComputedStyle(n).color;e.set(i,fm(s))}n.remove()}function bi(e){let{a:n,b:i,c:s,d:a,e:r,f:l}=e.getTransform();return[n,i,s,a,r,l]}function Yo(e){let{a:n,b:i,c:s,d:a,e:r,f:l}=e.getTransform().invertSelf();return[n,i,s,a,r,l]}function qh(e,n,i=!1,s=!0){if(n instanceof um){let{pageWidth:a,pageHeight:r}=n.rawDims,{style:l}=e,c=`round(down, var(--total-scale-factor) * ${a}px, var(--scale-round-x))`,p=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-y))`;if(!i||n.rotation%180===0)l.width=c,l.height=p;else l.width=p,l.height=c}if(s)e.setAttribute("data-main-rotation",n.rotation)}class co{constructor(){let{pixelRatio:e}=co;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,n,i,s,a=-1){let r=1/0,l=1/0,c=1/0;if(i=co.capPixels(i,a),i>0)r=Math.sqrt(i/(e*n));if(s!==-1)l=s/e,c=s/n;let p=Math.min(r,l,c);if(this.sx>p||this.sy>p)return this.sx=p,this.sy=p,!0;return!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,n){if(n>=0){let i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+n/100));return e>0?Math.min(e,i):i}return e}}var J3=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class sT{static get isDarkMode(){return en(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class aT{static get commentForegroundColor(){let e=document.createElement("span");e.classList.add("comment","sidebar");let{style:n}=e;n.width=n.height="0",n.display="none",n.color="var(--comment-fg-color)",document.body.append(e);let{color:i}=window.getComputedStyle(e);return e.remove(),en(this,"commentForegroundColor",fm(i))}}function WB(e,n){n=vi(n??1,0,1);let i=255*(1-n);return e.map((s)=>Math.round(s*n+i))}function jk(e,n){let i=e[0]/255,s=e[1]/255,a=e[2]/255,r=Math.max(i,s,a),l=Math.min(i,s,a),c=(r+l)/2;if(r===l)n[0]=n[1]=0;else{let p=r-l;switch(n[1]=c<0.5?p/(r+l):p/(2-r-l),r){case i:n[0]=((s-a)/p+(s<a?6:0))*60;break;case s:n[0]=((a-i)/p+2)*60;break;case a:n[0]=((i-s)/p+4)*60;break}}n[2]=c}function Z3(e,n){let i=e[0],s=e[1],a=e[2],r=(1-Math.abs(2*a-1))*s,l=r*(1-Math.abs(i/60%2-1)),c=a-r/2;switch(Math.floor(i/60)){case 0:n[0]=r+c,n[1]=l+c,n[2]=c;break;case 1:n[0]=l+c,n[1]=r+c,n[2]=c;break;case 2:n[0]=c,n[1]=r+c,n[2]=l+c;break;case 3:n[0]=c,n[1]=l+c,n[2]=r+c;break;case 4:n[0]=l+c,n[1]=c,n[2]=r+c;break;case 5:case 6:n[0]=r+c,n[1]=c,n[2]=l+c;break}}function e9(e){return e<=0.03928?e/12.92:((e+0.055)/1.055)**2.4}function Ek(e,n,i){Z3(e,i),i.map(e9);let s=0.2126*i[0]+0.7152*i[1]+0.0722*i[2];Z3(n,i),i.map(e9);let a=0.2126*i[0]+0.7152*i[1]+0.0722*i[2];return s>a?(s+0.05)/(a+0.05):(a+0.05)/(s+0.05)}var qk=new Map;function KB(e,n){let i=e[0]+e[1]*256+e[2]*65536+n[0]*16777216+n[1]*4294967296+n[2]*1099511627776,s=qk.get(i);if(s)return s;let a=new Float32Array(9),r=a.subarray(0,3),l=a.subarray(3,6);jk(e,l);let c=a.subarray(6,9);jk(n,c);let p=c[2]<0.5,m=p?12:4.5;if(l[2]=p?Math.sqrt(l[2]):1-Math.sqrt(1-l[2]),Ek(l,c,r)<m){let g,y;if(p)g=l[2],y=1;else g=0,y=l[2];let x=0.005;while(y-g>x){let I=l[2]=(g+y)/2;if(p===Ek(l,c,r)<m)g=I;else y=I}l[2]=p?y:g}return Z3(l,r),s=Ot.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),qk.set(i,s),s}function rT({html:e,dir:n,className:i},s){let a=document.createDocumentFragment();if(typeof e==="string"){let r=document.createElement("p");r.dir=n||"auto";let l=e.split(/\r\n?|\n/);for(let c=0,p=l.length;c<p;++c){let m=l[c];if(r.append(document.createTextNode(m)),c<p-1)r.append(document.createElement("br"))}a.append(r)}else o9.render({xfaHtml:e,div:a,intent:"richText"});a.firstElementChild.classList.add("richText",i),s.append(a)}function oT(e){let n=new Path2D;if(!e)return n;for(let i=0,s=e.length;i<s;)switch(e[i++]){case Yp.moveTo:n.moveTo(e[i++],e[i++]);break;case Yp.lineTo:n.lineTo(e[i++],e[i++]);break;case Yp.curveTo:n.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);break;case Yp.quadraticCurveTo:n.quadraticCurveTo(e[i++],e[i++],e[i++],e[i++]);break;case Yp.closePath:n.closePath();break;default:vn(`Unrecognized drawing path operator: ${e[i-1]}`);break}return n}class tm{#e=null;#t=null;#n;#i=null;#s=null;#r=null;#a=null;#o=null;static#l=null;constructor(e){this.#n=e,tm.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){let e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");let n=this.#n._uiManager._signal;if(n instanceof AbortSignal&&!n.aborted)e.addEventListener("contextmenu",lo,{signal:n}),e.addEventListener("pointerdown",tm.#c,{signal:n});let i=this.#i=document.createElement("div");i.className="buttons",e.append(i);let s=this.#n.toolbarPosition;if(s){let{style:a}=e,r=this.#n._uiManager.direction==="ltr"?1-s[0]:s[0];a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#c(e){e.stopPropagation()}#f(e){this.#n._focusEventsAllowed=!1,gs(e)}#h(e){this.#n._focusEventsAllowed=!0,gs(e)}#d(e){let n=this.#n._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return!1;return e.addEventListener("focusin",this.#f.bind(this),{capture:!0,signal:n}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:n}),e.addEventListener("contextmenu",lo,{signal:n}),!0}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#s?.shown(),this.#r?.shown()}addDeleteButton(){let{editorType:e,_uiManager:n}=this.#n,i=document.createElement("button");if(i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",tm.#l[e]),this.#d(i))i.addEventListener("click",(s)=>{n.delete()},{signal:n._signal});this.#i.append(i)}get#m(){let e=document.createElement("div");return e.className="divider",e}async addAltText(e){let n=await e.render();this.#d(n),this.#i.append(n,this.#m),this.#s=e}addComment(e,n=null){if(this.#r)return;let i=e.renderForToolbar();if(!i)return;this.#d(i);let s=this.#a=this.#m;if(!n)this.#i.append(i,s);else this.#i.insertBefore(i,n),this.#i.insertBefore(s,n);this.#r=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let n=e.renderButton();this.#d(n),this.#i.append(n,this.#m)}async addEditSignatureButton(e){let n=this.#o=await e.renderEditButton(this.#n);this.#d(n),this.#i.append(n,this.#m)}removeButton(e){switch(e){case"comment":this.#r?.removeToolbarCommentButton(),this.#r=null,this.#a?.remove(),this.#a=null;break}}async addButton(e,n){switch(e){case"colorPicker":if(n)this.addColorPicker(n);break;case"altText":if(n)await this.addAltText(n);break;case"editSignature":if(n)await this.addEditSignatureButton(n);break;case"delete":this.addDeleteButton();break;case"comment":if(n)this.addComment(n);break}}async addButtonBefore(e,n,i){if(!n&&e==="comment")return;let s=this.#i.querySelector(i);if(!s)return;if(e==="comment")this.addComment(n,s)}updateEditSignatureButton(e){if(this.#o)this.#o.title=e}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class lT{#e=null;#t=null;#n;constructor(e){this.#n=e}#i(){let e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.dir=this.#n.direction;let n=this.#n._signal;if(n instanceof AbortSignal&&!n.aborted)e.addEventListener("contextmenu",lo,{signal:n});let i=this.#e=document.createElement("div");if(i.className="buttons",e.append(i),this.#n.hasCommentManager())this.#r("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#n.commentSelection("floating_button")});return this.#r("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#n.highlightSelection("floating_button")}),e}#s(e,n){let i=0,s=0;for(let a of e){let r=a.y+a.height;if(r<i)continue;let l=a.x+(n?a.width:0);if(r>i){s=l,i=r;continue}if(n){if(l>s)s=l}else if(l<s)s=l}return[n?1-s:s,i]}show(e,n,i){let[s,a]=this.#s(n,i),{style:r}=this.#t||=this.#i();e.append(this.#t),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(e,n,i,s){let a=document.createElement("button");a.classList.add("basic",e),a.tabIndex=0,a.setAttribute("data-l10n-id",n);let r=document.createElement("span");a.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",i);let l=this.#n._signal;if(l instanceof AbortSignal&&!l.aborted)a.addEventListener("contextmenu",lo,{signal:l}),a.addEventListener("click",s,{signal:l});this.#e.append(a)}}var $B="59968104-cc61-4cf9-b570-014b35b3709c",G3=Object.freeze({internal:$B});function cT(e,n,i){for(let s of i)n.addEventListener(s,e[s].bind(e))}class Wn{static#e=NaN;static#t=null;static#n=NaN;static#i=null;static initializeAndAddPointerId(e){(Wn.#t||=new Set).add(e)}static setPointer(e,n){Wn.#e||=n,Wn.#i??=e}static setTimeStamp(e){Wn.#n=e}static isSamePointerId(e){return Wn.#e===e}static isSamePointerIdOrRemove(e){if(Wn.#e===e)return!0;return Wn.#t?.delete(e),!1}static isSamePointerType(e){return Wn.#i===e}static isInitializedAndDifferentPointerType(e){return Wn.#i!==null&&!Wn.isSamePointerType(e)}static isSameTimeStamp(e){return Wn.#n===e}static isUsingMultiplePointers(){return Wn.#t?.size>=1}static clearPointerType(){Wn.#i=null}static clearPointerIds(){Wn.#e=NaN,Wn.#t=null}static clearTimeStamp(){Wn.#n=NaN}}class uT{#e=0;get id(){return`pdfjs_internal_editor_${this.#e++}`}}class u9{#e=iT();#t=0;#n=null;static get _isSVGFittingCanvas(){let i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';let a=s.decode().then(()=>(i.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return en(this,"_isSVGFittingCanvas",a)}async#i(e,n){this.#n||=new Map;let i=this.#n.get(e);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let s;if(typeof n==="string")i.url=n,s=await l9(n,"blob");else if(n instanceof File)s=i.file=n;else if(n instanceof Blob)s=n;if(s.type==="image/svg+xml"){let a=u9._isSVGFittingCanvas,r=new FileReader,l=new Image,c=new Promise((p,m)=>{l.onload=()=>{i.bitmap=l,i.isSvg=!0,p()},r.onload=async()=>{let g=i.svgUrl=r.result;l.src=await a?`${g}#svgView(preserveAspectRatio(none))`:g},l.onerror=r.onerror=m});r.readAsDataURL(s),await c}else i.bitmap=await createImageBitmap(s);i.refCounter=1}catch(s){vn(s),i=null}if(this.#n.set(e,i),i)this.#n.set(i.id,i);return i}async getFromFile(e){let{lastModified:n,name:i,size:s,type:a}=e;return this.#i(`${n}_${i}_${s}_${a}`,e)}async getFromUrl(e){return this.#i(e,e)}async getFromBlob(e,n){let i=await n;return this.#i(e,i)}async getFromId(e){this.#n||=new Map;let n=this.#n.get(e);if(!n)return null;if(n.bitmap)return n.refCounter+=1,n;if(n.file)return this.getFromFile(n.file);if(n.blobPromise){let{blobPromise:i}=n;return delete n.blobPromise,this.getFromBlob(n.id,i)}return this.getFromUrl(n.url)}getFromCanvas(e,n){this.#n||=new Map;let i=this.#n.get(e);if(i?.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(n.width,n.height);return s.getContext("2d").drawImage(n,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,i),this.#n.set(i.id,i),i}getSvgUrl(e){let n=this.#n.get(e);if(!n?.isSvg)return null;return n.svgUrl}deleteId(e){this.#n||=new Map;let n=this.#n.get(e);if(!n)return;if(n.refCounter-=1,n.refCounter!==0)return;let{bitmap:i}=n;if(!n.url&&!n.file){let s=new OffscreenCanvas(i.width,i.height);s.getContext("bitmaprenderer").transferFromImageBitmap(i),n.blobPromise=s.convertToBlob()}i.close?.(),n.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class hT{#e=[];#t=!1;#n;#i=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:n,post:i,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:l=!1}){if(s)e();if(this.#t)return;let c={cmd:e,undo:n,post:i,type:a};if(this.#i===-1){if(this.#e.length>0)this.#e.length=0;this.#i=0,this.#e.push(c);return}if(r&&this.#e[this.#i].type===a){if(l)c.undo=this.#e[this.#i].undo;this.#e[this.#i]=c;return}let p=this.#i+1;if(p===this.#n)this.#e.splice(0,1);else if(this.#i=p,p<this.#e.length)this.#e.splice(p);this.#e.push(c)}undo(){if(this.#i===-1)return;this.#t=!0;let{undo:e,post:n}=this.#e[this.#i];e(),n?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;let{cmd:e,post:n}=this.#e[this.#i];e(),n?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}cleanType(e){if(this.#i===-1)return;for(let n=this.#i;n>=0;n--)if(this.#e[n].type!==e){this.#e.splice(n+1,this.#i-n),this.#i=n;return}this.#e.length=0,this.#i=-1}destroy(){this.#e=null}}class hr{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(e){this.callbacks=new Map;let{isMac:n}=si.platform;for(let[i,s,a={}]of e){let r=i.some((l)=>l.startsWith("mac+"));for(let l of i){let c=l;if(r){let g=l.startsWith("mac+");if(n!==g)continue;if(g)c=l.slice(4)}let[p,m]=hr.#e(c);if(p===null)continue;this.callbacks.getOrInsertComputed(p,Nd).push({callback:s,options:a,modifiers:m})}}}static#e(e){let n=null,i=0;for(let s of e.split("+")){if(s=s.trim(),!s)continue;let a=s.toUpperCase(),r=hr[a];if(r){i|=r;continue}if(n!==null){vn(`KeyboardManager: multiple keys in shortcut "${e}"`);break}n=a==="SPACE"?" ":s}if(n===null)vn(`KeyboardManager: no key found in shortcut "${e}"`);return[n,i]}static#t(e){let n=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);if(!n)return null;return n[1]?.toLowerCase()??n[2]}exec(e,n){let i=this.callbacks.get(n.key);if(!i){if(/^[a-z]$/i.test(n.key))return;let m=hr.#t(n.code);if(m===null||m===n.key)return;if(i=this.callbacks.get(m),!i)return}let s=(n.altKey?hr.ALT:0)|(n.ctrlKey?hr.CTRL:0)|(n.metaKey?hr.META:0)|(n.shiftKey?hr.SHIFT:0),a=i.find((m)=>m.modifiers===s);if(!a)return;let{callback:r,options:{bubbles:l=!1,args:c=[],checker:p=null}}=a;if(p&&!p(e,n))return;if(r.bind(e,...c,n)(),!l)gs(n)}}class h9{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let e=new Map([["CanvasText",null],["Canvas",null]]);return XB(e),en(this,"_colors",e)}convert(e){let n=fm(e);if(!window.matchMedia("(forced-colors: active)").matches)return n;for(let[i,s]of this._colors)if(s.every((a,r)=>a===n[r]))return h9._colorsMapping.get(i);return n}getHexCode(e){let n=this._colors.get(e);if(!n)return e;return Ot.makeHexColor(...n)}}class au{#e=new AbortController;#t=null;#n=null;#i=new Map;#s=new Map;#r=null;#a=null;#o=null;#l=null;#c=null;#f=new hT;#h=null;#d=null;#m=null;#g=0;#u=new Set;#p=null;#b=null;#w=new Set;_editorUndoBar=null;#y=!1;#v=!1;#x=!1;#_=null;#k=null;#T=null;#q=null;#j=!1;#C=null;#I=new uT;#D=!1;#M=!1;#L=!1;#R=null;#F=null;#G=null;#N=null;#H=null;#A=yn.NONE;#S=new Set;#P=null;#U=null;#V=null;#Y=null;#K=null;#$={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#O=[0,0];#X=null;#W=null;#ee=null;#te=null;#B=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=au.prototype,n=(r)=>r.#W.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),i=(r,{target:l})=>{if(l instanceof HTMLInputElement){let{type:c}=l;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return en(this,"_keyboardManager",new hr([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],e.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:i}],[["Enter"],e.addNewEditorFromKeyboard,{checker:(r,{target:l})=>!(l instanceof HTMLButtonElement)&&r.#W.contains(l)&&!r.isEnterHandled}],[["Space"],e.addNewEditorFromKeyboard,{checker:(r,{target:l})=>!(l instanceof HTMLButtonElement)&&r.#W.contains(document.activeElement)}],[["Escape"],e.unselectAll],[["ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:n}],[["ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:n}],[["ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:n}],[["ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,n,i,s,a,r,l,c,p,m,g,y,x,I,M,H){let X=this._signal=this.#e.signal;this.#W=e,this.#ee=n,this.#te=i,this.#o=s,this.#h=a,this.#U=r,this.#K=c,this._eventBus=l;let W={signal:X,...G3};l.on("editingaction",this.onEditingAction.bind(this),W),l.on("pagechanging",this.onPageChanging.bind(this),W),l.on("scalechanging",this.onScaleChanging.bind(this),W),l.on("rotationchanging",this.onRotationChanging.bind(this),W),l.on("setpreference",this.onSetPreference.bind(this),W),l.on("switchannotationeditorparams",(Y)=>this.updateParams(Y.type,Y.value),W),window.addEventListener("pointerdown",()=>{this.#M=!0},{capture:!0,signal:X}),window.addEventListener("pointerup",()=>{this.#M=!1},{capture:!0,signal:X}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:X}),this.#le(),this.#pe(),this.#ie(),this.#l=c.annotationStorage,this.#_=c.filterFactory,this.#V=p,this.#q=m||null,this.#y=g,this.#v=y,this.#x=x,this.#H=I||null,this.viewParameters={realScale:Eh.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=M||null,this._supportsPinchToZoom=H!==!1,a?.setSidebarUiManager(this)}destroy(){this.#B?.resolve(),this.#B=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#s.values())e.destroy();if(this.#s.clear(),this.#i.clear(),this.#w.clear(),this.#N?.clear(),this.#t=null,this.#S.clear(),this.#f.destroy(),this.#o?.destroy(),this.#h?.destroy(),this.#U?.destroy(),this.#C?.hide(),this.#C=null,this.#G?.destroy(),this.#G=null,this.#n=null,this.#k)clearTimeout(this.#k),this.#k=null;if(this.#X)clearTimeout(this.#X),this.#X=null;this._editorUndoBar?.destroy(),this.#K=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#H}get useNewAltTextFlow(){return this.#v}get useNewAltTextWhenAddingImage(){return this.#x}get hcmFilter(){return en(this,"hcmFilter",this.#V?this.#_.addHCMFilter(this.#V.foreground,this.#V.background):"none")}get direction(){return en(this,"direction",getComputedStyle(this.#W).direction)}get _highlightColors(){return en(this,"_highlightColors",this.#q?new Map(this.#q.split(",").map((e)=>(e=e.split("=").map((n)=>n.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return en(this,"highlightColors",null);let n=new Map,i=!!this.#V;for(let[s,a]of e){let r=s.endsWith("_HCM");if(i&&r){n.set(s.replace("_HCM",""),a);continue}if(!i&&!r)n.set(s,a)}return en(this,"highlightColors",n)}get highlightColorNames(){return en(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e)=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let n=this.highlightColorNames.get(e);return this._highlightColors.get(n)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){if(e)this.unselectAll(),this.disableUserSelect(!0);else this.disableUserSelect(!1);this.#m=e}setMainHighlightColorPicker(e){this.#G=e}editAltText(e,n=!1){this.#o?.editAltText(this,e,n)}hasCommentManager(){return!!this.#h}editComment(e,n,i,s){this.#h?.showDialog(this,e,n,i,s)}selectComment(e,n){this.#s.get(e)?.getEditorByUID(n)?.toggleComment(!0,!0)}updateComment(e){this.#h?.updateComment(e.getData())}updatePopupColor(e){this.#h?.updatePopupColor(e)}removeComment(e){this.#h?.removeComments([e.uid])}deleteComment(e,n){let i=()=>{e.comment=n},s=()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),e.comment=null};this.addCommands({cmd:s,undo:i,mustExec:!0})}toggleComment(e,n,i=void 0){this.#h?.toggleCommentPopup(e,n,i)}makeCommentColor(e,n){return e&&this.#h?.makeCommentColor(e,n)||null}getCommentDialogElement(){return this.#h?.dialogElement||null}async waitForEditorsRendered(e){if(this.#s.has(e-1))return;let{resolve:n,promise:i}=Promise.withResolvers(),s=(a)=>{if(a.pageNumber===e)this._eventBus.off("editorsrendered",s),n()};this._eventBus.on("editorsrendered",s,G3),await i}getSignature(e){this.#U?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#U}switchToMode(e,n){this._eventBus.on("annotationeditormodechanged",n,{once:!0,signal:this._signal,...G3}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,n){this._eventBus.dispatch("setpreference",{source:this,name:e,value:n})}onSetPreference({name:e,value:n}){switch(e){case"enableNewAltTextWhenAddingImage":this.#x=n;break}}onPageChanging({pageNumber:e}){this.#g=e-1}deletePage(e){for(let n of this.getEditors(e))n.remove();if(this.#s.delete(e),this.#g===e)this.#g=0}focusMainContainer(){this.#W.focus()}findParent(e,n){for(let i of this.#s.values()){let{x:s,y:a,width:r,height:l}=i.div.getBoundingClientRect();if(e>=s&&e<=s+r&&n>=a&&n<=a+l)return i}return null}disableUserSelect(e=!1){this.#ee.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#w.add(e)}removeShouldRescale(e){this.#w.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Eh.PDF_TO_CSS_UNITS;for(let n of this.#w)n.onScaleChanging();this.#m?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#ne(e){let{currentLayer:n}=this;if(n.hasTextLayer(e))return n;for(let i of this.#s.values())if(i.hasTextLayer(e))return i;return null}highlightSelection(e="",n=!1){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:l}=i,c=i.toString(),m=this.#Z(i).closest(".textLayer"),g=this.getSelectionBoxes(m);if(!g)return;i.empty();let y=this.#ne(m),x=this.#A===yn.NONE,I=()=>{let M=y?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:g,anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:l,text:c});if(x)this.showAllEditors("highlight",!0,!0);if(n)M?.editComment()};if(x){this.switchToMode(yn.HIGHLIGHT,I);return}I()}commentSelection(e=""){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#re(){let e=document.getSelection();if(!e||e.isCollapsed)return;let i=this.#Z(e).closest(".textLayer"),s=this.getSelectionBoxes(i);if(!s)return;this.#C||=new lT(this),this.#C.show(i,s,this.direction==="ltr")}getAndRemoveDataFromAnnotationStorage(e){if(!this.#l)return null;let n=`pdfjs_internal_editor_${e}`,i=this.#l.getRawValue(n);if(i)this.#l.remove(n);return i}addToAnnotationStorage(e){if(!e.isEmpty()&&this.#l&&!this.#l.has(e.id))this.#l.setValue(e.id,e)}a11yAlert(e,n=null){let i=this.#te;if(!i)return;if(i.setAttribute("data-l10n-id",e),n)i.setAttribute("data-l10n-args",JSON.stringify(n));else i.removeAttribute("data-l10n-args")}#oe(){let e=document.getSelection();if(!e||e.isCollapsed){if(this.#P)this.#C?.hide(),this.#P=null,this.#E({hasSelectedText:!1});return}let{anchorNode:n}=e;if(n===this.#P)return;let s=this.#Z(e).closest(".textLayer");if(!s){if(this.#P)this.#C?.hide(),this.#P=null,this.#E({hasSelectedText:!1});return}if(this.#C?.hide(),this.#P=n,this.#E({hasSelectedText:!0}),this.#A!==yn.HIGHLIGHT&&this.#A!==yn.NONE)return;if(this.#A===yn.HIGHLIGHT)this.showAllEditors("highlight",!0,!0);if(this.#j=this.isShiftKeyDown,!this.isShiftKeyDown){let a=this.#A===yn.HIGHLIGHT?this.#ne(s):null;if(a?.toggleDrawing(),this.#M){let r=new AbortController,l=this.combinedSignal(r),c=(p)=>{if(p.type==="pointerup"&&p.button!==0)return;if(r.abort(),a?.toggleDrawing(!0),p.type==="pointerup")this.#Q("main_toolbar")};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else a?.toggleDrawing(!0),this.#Q("main_toolbar")}}#Q(e=""){if(this.#A===yn.HIGHLIGHT)this.highlightSelection(e);else if(this.#y)this.#re()}#le(){document.addEventListener("selectionchange",this.#oe.bind(this),{signal:this._signal})}#ce(){if(this.#T)return;this.#T=new AbortController;let e=this.combinedSignal(this.#T);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ue(){this.#T?.abort(),this.#T=null}blur(){if(this.isShiftKeyDown=!1,this.#j)this.#j=!1,this.#Q("main_toolbar");if(!this.hasSelection)return;let{activeElement:e}=document;for(let n of this.#S)if(n.div.contains(e)){this.#F=[n,e],n._focusEventsAllowed=!1;break}}focus(){if(!this.#F)return;let[e,n]=this.#F;this.#F=null,n.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),n.focus()}#ie(){if(this.#R)return;this.#R=new AbortController;let e=this.combinedSignal(this.#R);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#he(){this.#R?.abort(),this.#R=null}#fe(){if(this.#d)return;this.#d=new AbortController;let e=this.combinedSignal(this.#d);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#de(){this.#d?.abort(),this.#d=null}#pe(){let e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ie(),this.setEditingState(!0)}removeEditListeners(){this.#he(),this.setEditingState(!1)}dragOver(e){for(let{type:n}of e.dataTransfer.items)for(let i of this.#b)if(i.isHandlingMimeForPasting(n)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(let n of e.dataTransfer.items)for(let i of this.#b)if(i.isHandlingMimeForPasting(n.type)){i.paste(n,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let n=[];for(let i of this.#S){let s=i.serialize(!0);if(s)n.push(s)}if(n.length===0)return;e.clipboardData.setData("application/pdfjs",JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:n}=e;for(let a of n.items)for(let r of this.#b)if(r.isHandlingMimeForPasting(a.type)){r.paste(a,this.currentLayer);return}let i=n.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(a){vn(`paste: "${a.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let s=this.currentLayer;try{let a=[];for(let c of i){let p=await s.deserialize(c);if(!p)return;a.push(p)}let r=()=>{for(let c of a)this.#se(c);this.#ae(a)},l=()=>{for(let c of a)c.remove()};this.addCommands({cmd:r,undo:l,mustExec:!0})}catch(a){vn(`paste: "${a.message}".`)}}keydown(e){if(!this.isShiftKeyDown&&e.key==="Shift")this.isShiftKeyDown=!0;if(this.#A!==yn.NONE&&!this.isEditorHandlingKeyboard)au._keyboardManager.exec(this,e)}keyup(e){if(this.isShiftKeyDown&&e.key==="Shift"){if(this.isShiftKeyDown=!1,this.#j)this.#j=!1,this.#Q("main_toolbar")}}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(e,n){for(let s of this.#a.get(e)||[])s.pageIndex=n;let i=this.#r.get(e);if(i)if(i.pageIndex=n,this.#s.set(n,i),this.#D)i.enable();else i.disable()}startUpdatePages(){this.#r=new Map(this.#s),this.#s.clear();let e=this.#a=new Map,n=(i)=>{e.getOrInsertComputed(i.pageIndex,Nd).push(i)};for(let i of this.#i.values())n(i);for(let[i,s]of this.#l)if(i.startsWith("pdfjs_internal_editor_")&&!this.#i.has(i)&&Number.isInteger(s?.pageIndex))n(s)}endUpdatePages(){this.#r=null,this.#a=null}clonePage(e,n){for(let i of this.getEditors(e)){let s=i.serialize(i.mode!==yn.HIGHLIGHT);if(!s)continue;s.pageIndex=n,s.id=this.getId(),s.isClone=!0,delete s.popupRef,this.#l.setValue(s.id,s)}}findClonesForPage(e){let n=[],{pageIndex:i}=e;for(let[s,a]of this.#l)if(a.pageIndex===i&&a.isClone)this.#l.remove(s),n.push(e.deserialize(a).then((r)=>{if(r)r.isClone=!0,e.addOrRebuild(r)}));return Promise.all(n)}#E(e){if(Object.entries(e).some(([i,s])=>this.#$[i]!==s)){if(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#$,e)}),this.#A===yn.HIGHLIGHT&&e.hasSelectedEditor===!1)this.#z([[Pn.HIGHLIGHT_FREE,!0]])}}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){if(e)this.#ce(),this.#fe(),this.#E({isEditing:this.#A!==yn.NONE,isEmpty:this.#J(),hasSomethingToUndo:this.#f.hasSomethingToUndo(),hasSomethingToRedo:this.#f.hasSomethingToRedo(),hasSelectedEditor:!1});else this.#ue(),this.#de(),this.#E({isEditing:!1}),this.disableUserSelect(!1)}registerEditorTypes(e){if(this.#b)return;this.#b=e;for(let n of this.#b)this.#z(n.defaultPropertiesToUpdate)}getId(){return this.#I.id}get currentLayer(){return this.#s.get(this.#g)}getLayer(e){return this.#s.get(e)}get currentPageIndex(){return this.#g}addLayer(e){if(this.#s.set(e.pageIndex,e),this.#D)e.enable();else e.disable()}removeLayer(e){this.#s.delete(e.pageIndex)}async updateMode(e,n=null,i=!1,s=!1,a=!1,r=!1){if(this.#A===e)return;if(this.#B){if(await this.#B.promise,!this.#B)return}if(this.#B=Promise.withResolvers(),this.#m?.commitOrRemove(),this.#A===yn.POPUP)this.#h?.hideSidebar();if(this.#h?.destroyPopup(),this.#A=e,e===yn.NONE){this.setEditingState(!1),this.#ge();for(let l of this.#i.values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#B.resolve();return}for(let l of this.#i.values())l.addStandaloneCommentButton();if(e===yn.SIGNATURE)await this.#U?.loadSignatures();if(i)Wn.clearPointerType();this.setEditingState(!0),await this.#me(),this.unselectAll();for(let l of this.#s.values())l.updateMode(e);if(e===yn.POPUP){this.#n||=await this.#K.getAnnotationsByType(new Set(this.#b.map((p)=>p._editorType)));let l=new Set,c=[];for(let p of this.#i.values()){let{annotationElementId:m,hasComment:g,deleted:y}=p;if(m)l.add(m);if(g&&!y)c.push(p.getData())}for(let p of this.#n){let{id:m,popupRef:g,contentsObj:y}=p;if(g&&y?.str&&!l.has(m)&&!this.#u.has(m))c.push(p)}this.#h?.showSidebar(c)}if(!n){if(s)this.addNewEditorFromKeyboard();this.#B.resolve();return}for(let l of this.#i.values())if(l.uid===n)if(this.setSelected(l),r)l.editComment();else if(a)l.enterInEditMode();else l.focus();else l.unselect();this.#B.resolve()}addNewEditorFromKeyboard(){if(this.currentLayer.canCreateNewEmptyEditor())this.currentLayer.addNewEditor()}updateToolbar(e){if(e.mode===this.#A)return;this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,n){if(!this.#b)return;switch(e){case Pn.CREATE:this.currentLayer.addNewEditor(n);return;case Pn.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#Y||=new Map).set(e,n),this.showAllEditors("highlight",n);break}if(this.hasSelection)for(let i of this.#S)i.updateParams(e,n);else for(let i of this.#b)i.updateDefaultParams(e,n)}showAllEditors(e,n,i=!1){for(let a of this.#i.values())if(a.editorType===e)a.show(n);if((this.#Y?.get(Pn.HIGHLIGHT_SHOW_ALL)??!0)!==n)this.#z([[Pn.HIGHLIGHT_SHOW_ALL,n]])}enableWaiting(e=!1){if(this.#L===e)return;this.#L=e;for(let n of this.#s.values()){if(e)n.disableClick();else n.enableClick();n.div.classList.toggle("waiting",e)}}async#me(){if(!this.#D){this.#D=!0;let e=[];for(let n of this.#s.values())e.push(n.enable());await Promise.all(e);for(let n of this.#i.values())n.enable()}}#ge(){if(this.unselectAll(),this.#D){this.#D=!1;for(let e of this.#s.values())e.disable();for(let e of this.#i.values())e.disable()}}*getEditors(e){for(let n of this.#i.values())if(n.pageIndex===e)yield n}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)){if(this.#k)clearTimeout(this.#k);this.#k=setTimeout(()=>{this.focusMainContainer(),this.#k=null},0)}if(this.#i.delete(e.id),e.annotationElementId)this.#N?.delete(e.annotationElementId);if(this.unselect(e),!e.annotationElementId||!this.#u.has(e.annotationElementId))this.#l?.remove(e.id)}addDeletedAnnotationElement(e){this.#u.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#u.has(e)}removeDeletedAnnotationElement(e){this.#u.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#se(e){let n=this.#s.get(e.pageIndex);if(n)n.addOrRebuild(e);else this.addEditor(e),this.addToAnnotationStorage(e)}setActiveEditor(e){if(this.#t===e)return;if(this.#t=e,e)this.#z(e.propertiesToUpdate)}get#be(){let e=null;for(e of this.#S);return e}updateUI(e){if(this.#be===e)this.#z(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#z(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#S.has(e)){this.#S.delete(e),e.unselect(),this.#E({hasSelectedEditor:this.hasSelection});return}this.#S.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#E({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#m?.commitOrRemove();for(let n of this.#S)if(n!==e)n.unselect();this.#h?.destroyPopup(),this.#S.clear(),this.#S.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#E({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#S.values().next().value}unselect(e){e.unselect(),this.#S.delete(e),this.#E({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#S.size!==0}get isEnterHandled(){return this.#S.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#f.undo(),this.#E({hasSomethingToUndo:this.#f.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#J()}),this._editorUndoBar?.hide()}redo(){this.#f.redo(),this.#E({hasSomethingToUndo:!0,hasSomethingToRedo:this.#f.hasSomethingToRedo(),isEmpty:this.#J()})}addCommands(e){this.#f.add(e),this.#E({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#J()})}cleanUndoStack(e){this.#f.cleanType(e)}#J(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(let e of this.#i.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let n=e?[e]:[...this.#S],i=()=>{this._editorUndoBar?.show(s,n.length===1?n[0].editorType:n.length);for(let a of n)a.remove()},s=()=>{for(let a of n)this.#se(a)};this.addCommands({cmd:i,undo:s,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ae(e){for(let n of this.#S)n.unselect();this.#S.clear();for(let n of e){if(n.isEmpty())continue;this.#S.add(n),n.select()}this.#E({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#S)e.commit();this.#ae(this.#i.values())}unselectAll(){if(this.#t){if(this.#t.commitOrRemove(),this.#A!==yn.NONE)return}if(this.#m?.commitOrRemove())return;if(this.#h?.destroyPopup(),!this.hasSelection)return;for(let e of this.#S)e.unselect();this.#S.clear(),this.#E({hasSelectedEditor:!1})}translateSelectedEditors(e,n,i=!1){if(!i)this.commitOrRemove();if(!this.hasSelection)return;this.#O[0]+=e,this.#O[1]+=n;let[s,a]=this.#O,r=[...this.#S],l=1000;if(this.#X)clearTimeout(this.#X);this.#X=setTimeout(()=>{this.#X=null,this.#O[0]=this.#O[1]=0,this.addCommands({cmd:()=>{for(let c of r)if(this.#i.has(c.id))c.translateInPage(s,a),c.translationDone()},undo:()=>{for(let c of r)if(this.#i.has(c.id))c.translateInPage(-s,-a),c.translationDone()},mustExec:!1})},l);for(let c of r)c.translateInPage(e,n),c.translationDone()}setUpDragSession(){if(!this.hasSelection)return;this.disableUserSelect(!0),this.#p=new Map;for(let e of this.#S)this.#p.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#p)return!1;this.disableUserSelect(!1);let e=this.#p;this.#p=null;let n=!1;for(let[{x:s,y:a,pageIndex:r},l]of e)l.newX=s,l.newY=a,l.newPageIndex=r,n||=s!==l.savedX||a!==l.savedY||r!==l.savedPageIndex;if(!n)return!1;let i=(s,a,r,l)=>{if(this.#i.has(s.id)){let c=this.#s.get(l);if(c)s._setParentAndPosition(c,a,r);else s.pageIndex=l,s.x=a,s.y=r}};return this.addCommands({cmd:()=>{for(let[s,{newX:a,newY:r,newPageIndex:l}]of e)i(s,a,r,l)},undo:()=>{for(let[s,{savedX:a,savedY:r,savedPageIndex:l}]of e)i(s,a,r,l)},mustExec:!0}),!0}dragSelectedEditors(e,n){if(!this.#p)return;for(let i of this.#p.keys())i.drag(e,n)}rebuild(e){if(e.parent===null){let n=this.getLayer(e.pageIndex);if(n)n.changeParent(e),n.addOrRebuild(e);else this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild()}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#S.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#A}isEditingMode(){return this.#A!==yn.NONE}get imageManager(){return en(this,"imageManager",new u9)}getSelectionBoxes(e){if(!e)return null;let n=document.getSelection();for(let p=0,m=n.rangeCount;p<m;p++)if(!e.contains(n.getRangeAt(p).commonAncestorContainer))return null;let{x:i,y:s,width:a,height:r}=e.getBoundingClientRect(),l;switch(e.getAttribute("data-main-rotation")){case"90":l=(p,m,g,y)=>({x:(m-s)/r,y:1-(p+g-i)/a,width:y/r,height:g/a});break;case"180":l=(p,m,g,y)=>({x:1-(p+g-i)/a,y:1-(m+y-s)/r,width:g/a,height:y/r});break;case"270":l=(p,m,g,y)=>({x:1-(m+y-s)/r,y:(p-i)/a,width:y/r,height:g/a});break;default:l=(p,m,g,y)=>({x:(p-i)/a,y:(m-s)/r,width:g/a,height:y/r});break}let c=[];for(let p=0,m=n.rangeCount;p<m;p++){let g=n.getRangeAt(p);if(g.collapsed)continue;for(let{x:y,y:x,width:I,height:M}of g.getClientRects()){if(I===0||M===0)continue;c.push(l(y,x,I,M))}}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:n}){(this.#c||=new Map).set(e,n)}removeChangedExistingAnnotation({annotationElementId:e}){this.#c?.delete(e)}renderAnnotationElement(e){let n=this.#c?.get(e.data.id);if(!n)return;let i=this.#l.getRawValue(n);if(!i)return;if(this.#A===yn.NONE&&!i.hasBeenModified)return;i.renderAnnotationElement(e)}setMissingCanvas(e,n,i){let s=this.#N?.get(e);if(!s)return;s.setCanvas(n,i),this.#N.delete(e)}addMissingCanvas(e,n){(this.#N||=new Map).set(e,n)}}class el{#e=null;#t=!1;#n=null;#i=null;#s=null;#r=null;#a=!1;#o=null;#l=null;#c=null;#f=null;#h=!1;static#d=null;static _l10n=null;constructor(e){this.#l=e,this.#h=e._uiManager.useNewAltTextFlow,el.#d||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){el._l10n??=e}async render(){let e=this.#n=document.createElement("button");e.className="altText",e.tabIndex="0";let n=this.#i=document.createElement("span");if(e.append(n),this.#h)e.classList.add("new"),e.setAttribute("data-l10n-id",el.#d.missing),n.setAttribute("data-l10n-id",el.#d["missing-label"]);else e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label");let i=this.#l._uiManager._signal;e.addEventListener("contextmenu",lo,{signal:i}),e.addEventListener("pointerdown",(a)=>a.stopPropagation(),{signal:i});let s=(a)=>{if(a.preventDefault(),this.#l._uiManager.editAltText(this.#l),this.#h)this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return e.addEventListener("click",s,{capture:!0,signal:i}),e.addEventListener("keydown",(a)=>{if(a.target===e&&a.key==="Enter")this.#a=!0,s(a)},{signal:i}),await this.#g(),e}get#m(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){if(!this.#n)return;this.#n.focus({focusVisible:this.#a}),this.#a=!1}isEmpty(){return this.#h?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#h?this.#e!==null||!!this.#c:this.isEmpty()}get guessedText(){return this.#c}async setGuessedText(e){if(this.#e!==null)return;this.#c=e,this.#f=await el._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#g()}toggleAltTextBadge(e=!1){if(!this.#h||this.#e){this.#o?.remove(),this.#o=null;return}if(!this.#o){let n=this.#o=document.createElement("div");n.className="noAltTextBadge",this.#l.div.append(n)}this.#o.classList.toggle("hidden",!e)}serialize(e){let n=this.#e;if(!e&&this.#c===n)n=this.#f;return{altText:n,decorative:this.#t,guessedText:this.#c,textWithDisclaimer:this.#f}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:n,guessedText:i,textWithDisclaimer:s,cancel:a=!1}){if(i)this.#c=i,this.#f=s;if(this.#e===e&&this.#t===n)return;if(!a)this.#e=e,this.#t=n;this.#g()}toggle(e=!1){if(!this.#n)return;if(!e&&this.#r)clearTimeout(this.#r),this.#r=null;this.#n.disabled=!e}shown(){this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#n?.remove(),this.#n=null,this.#i=null,this.#s=null,this.#o?.remove(),this.#o=null}async#g(){let e=this.#n;if(!e)return;if(this.#h){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",el.#d[this.#m]),this.#i?.setAttribute("data-l10n-id",el.#d[`${this.#m}-label`]),!this.#e){this.#s?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#s?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=this.#s;if(!n){this.#s=n=document.createElement("span"),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${this.#l.id}`;let s=100,a=this.#l._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(this.#r),this.#r=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#r=setTimeout(()=>{this.#r=null,this.#s.classList.add("show"),this.#l._reportTelemetry({action:"alt_text_tooltip"})},s)},{signal:a}),e.addEventListener("mouseleave",()=>{if(this.#r)clearTimeout(this.#r),this.#r=null;this.#s?.classList.remove("show")},{signal:a})}if(this.#t)n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip");else n.removeAttribute("data-l10n-id"),n.textContent=this.#e;if(!n.parentNode)e.append(n);this.#l.getElementForAltText()?.setAttribute("aria-describedby",n.id)}}class Zp{#e=null;#t=null;#n=!1;#i=null;#s=null;#r=null;#a=null;#o=null;#l=!1;#c=null;constructor(e){this.#i=e}renderForToolbar(){let e=this.#t=document.createElement("button");return e.className="comment",this.#f(e,!1)}renderForStandalone(){let e=this.#e=document.createElement("button");e.className="annotationCommentButton";let n=this.#i.commentButtonPosition;if(n){let{style:i}=e;i.insetInlineEnd=`calc(${100*(this.#i._uiManager.direction==="ltr"?1-n[0]:n[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*n[1]}% - var(--comment-button-dim))`;let s=this.#i.commentButtonColor;if(s)i.backgroundColor=s}return this.#f(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#i.commentButtonColor;if(e)this.#e.style.backgroundColor=e;this.#i._uiManager.updatePopupColor(this.#i)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#i.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#c)return this.#c;if(!this.#e)return null;let{x:e,y:n,height:i}=this.#e.getBoundingClientRect(),{x:s,y:a,width:r,height:l}=this.#i.parent.boundingClientRect;return[(e-s)/r,(n+i-a)/l]}set commentPopupPositionInLayer(e){this.#c=e}hasDefaultPopupPosition(){return this.#c===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:n}){if(!this.#e)return;this.#e.classList.toggle("selected",e),this.#e.ariaExpanded=n}#f(e,n){if(!this.#i._uiManager.hasCommentManager())return null;if(e.tabIndex="0",e.ariaHasPopup="dialog",n)e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button");else e.ariaControlsElements=[this.#i._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button");let i=this.#i._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return e;if(e.addEventListener("contextmenu",lo,{signal:i}),n)e.addEventListener("focusin",(a)=>{this.#i._focusEventsAllowed=!1,gs(a)},{capture:!0,signal:i}),e.addEventListener("focusout",(a)=>{this.#i._focusEventsAllowed=!0,gs(a)},{capture:!0,signal:i});e.addEventListener("pointerdown",(a)=>a.stopPropagation(),{signal:i});let s=(a)=>{if(a.preventDefault(),e===this.#t)this.edit();else this.#i.toggleComment(!0)};return e.addEventListener("click",s,{capture:!0,signal:i}),e.addEventListener("keydown",(a)=>{if(a.target===e&&a.key==="Enter")this.#n=!0,s(a)},{signal:i}),e.addEventListener("pointerenter",()=>{this.#i.toggleComment(!1,!0)},{signal:i}),e.addEventListener("pointerleave",()=>{this.#i.toggleComment(!1,!1)},{signal:i}),e}edit(e){let n=this.commentPopupPositionInLayer,i,s;if(n)[i,s]=n;else{[i,s]=this.#i.commentButtonPosition;let{width:m,height:g,x:y,y:x}=this.#i;i=y+i*m,s=x+s*g}let a=this.#i.parent.boundingClientRect,{x:r,y:l,width:c,height:p}=a;this.#i._uiManager.editComment(this.#i,r+i*c,l+s*p,{...e,parentDimensions:a})}finish(){if(!this.#t)return;this.#t.focus({focusVisible:this.#n}),this.#n=!1}isDeleted(){return this.#l||this.#a===""}isEmpty(){return this.#a===null}hasBeenEdited(){return this.isDeleted()||this.#a!==this.#s}serialize(){return this.data}get data(){return{text:this.#a,richText:this.#r,date:this.#o,deleted:this.isDeleted()}}set data(e){if(e!==this.#a)this.#r=null;if(e===null){this.#a="",this.#l=!0;return}this.#a=e,this.#o=new Date,this.#l=!1}restoreData({text:e,richText:n,date:i}){this.#a=e,this.#r=n,this.#o=i,this.#l=!1}setInitialText(e,n=null){this.#s=e,this.data=e,this.#o=null,this.#r=n}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#a="",this.#r=null,this.#o=null,this.#i=null,this.#n=!1,this.#l=!1}}function Dk(e){e.preventDefault()}var Ik=0.0001;function V3(e){if(e.cancelable)return gs(e),!0;return e.stopPropagation(),!1}class f9{#e;#t=!1;#n=null;#i;#s;#r;#a;#o;#l=!1;#c=null;#f;#h=new Set;#d=null;#m;#g=null;#u=0;constructor({container:e,isPinchingDisabled:n=null,isPinchingStopped:i=null,onPinchStart:s=null,onPinching:a=null,onPinchEnd:r=null,onPanning:l=null,signal:c}){this.#e=e,this.#n=i,this.#i=n,this.#s=s,this.#r=a,this.#a=r,this.#o=l,this.#m=new AbortController,this.#f=AbortSignal.any([c,this.#m.signal]),e.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#f})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/co.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/co.pixelRatio}#p(e){if(this.#i?.())return;this.#w(e);let n=this.#h;for(let{identifier:i}of e.changedTouches)n.add(i);if(n.size===1){this.#b();return}if(!this.#g){this.#g=new AbortController;let i=AbortSignal.any([this.#f,this.#g.signal]),s=this.#e,a={signal:i,capture:!1,passive:!1};s.addEventListener("touchmove",this.#x.bind(this),a);let r=this.#_.bind(this);s.addEventListener("touchend",r,a),s.addEventListener("touchcancel",r,a),a.capture=!0,s.addEventListener("pointerdown",gs,a),s.addEventListener("pointermove",gs,a),s.addEventListener("pointercancel",Dk,a),s.addEventListener("pointerup",Dk,a),this.#s?.()}this.#l=V3(e),this.#v(e)}#b(){if(this.#c)return;let e=this.#c=new AbortController,n=AbortSignal.any([this.#f,e.signal]),i=this.#e,s={capture:!0,signal:n,passive:!1},a=(r)=>{if(r.pointerType==="touch")this.#c?.abort(),this.#c=null};i.addEventListener("pointerdown",(r)=>{if(r.pointerType==="touch")gs(r),a(r)},s),i.addEventListener("pointerup",a,s),i.addEventListener("pointercancel",a,s)}#w(e){let n=this.#h;if(n.size===0)return;let i=this.#h=new Set;for(let{identifier:s}of e.touches)if(n.has(s))i.add(s)}#y(e){let n=this.#h,i=[];for(let s of e.touches)if(n.has(s.identifier))i.push(s);return i}#v(e){let n=this.#y(e);if(n.length!==2||this.#n?.()){this.#d=null;return}let[i,s]=n;this.#d={touch0X:i.screenX,touch0Y:i.screenY,touch1X:s.screenX,touch1Y:s.screenY,panX:(i.clientX+s.clientX)/2,panY:(i.clientY+s.clientY)/2,screenPanX:(i.screenX+s.screenX)/2,screenPanY:(i.screenY+s.screenY)/2}}#x(e){if(!this.#d)return;let n=this.#y(e);if(n.length!==2)return;let i=this.#l;if(this.#l=V3(e),!this.#l)return;if(!i){this.#v(e);return}let[s,a]=n,{screenX:r,screenY:l}=s,{screenX:c,screenY:p}=a,m=this.#d,{touch0X:g,touch0Y:y,touch1X:x,touch1Y:I,panX:M,panY:H}=m,X=x-g,W=I-y,Y=c-r,te=p-l,ae=(s.clientX+a.clientX)/2,ne=(s.clientY+a.clientY)/2;m.panX=ae,m.panY=ne;let oe=ae-M,me=ne-H,be=(r+c)/2,xe=(l+p)/2,Oe=Math.hypot(be-m.screenPanX,xe-m.screenPanY);m.screenPanX=be,m.screenPanY=xe;let Fe=Math.hypot(Y,te),Ue=Math.hypot(X,W),ze=this.#t?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*Oe;if(Fe<Ik||Ue<Ik||Math.abs(Ue-Fe)<=ze){if(oe||me)this.#o?.(oe,me);return}m.touch0X=r,m.touch0Y=l,m.touch1X=c,m.touch1Y=p;let Le=Math.sign(Fe-Ue);if(!this.#t){if(this.#t=!0,this.#u=Le,oe||me)this.#o?.(oe,me);return}if(this.#u){let qe=this.#u;if(this.#u=0,Le!==qe&&Math.abs(Fe-Ue)<=2*Oe){if(this.#t=!1,oe||me)this.#o?.(oe,me);return}}this.#r?.([M,H],Ue,Fe,oe,me)}#_(e){if(this.#w(e),this.#h.size>=2){this.#v(e);return}let n=!!this.#d;if(this.#k(),this.#h.size===1)this.#b();if(n)V3(e)}#k(){if(this.#d=null,this.#t=!1,this.#u=0,this.#l=!1,this.#g)this.#g.abort(),this.#g=null,this.#a?.()}destroy(){this.#k(),this.#h.clear(),this.#m?.abort(),this.#m=null,this.#c?.abort(),this.#c=null}}class Jt{#e=null;#t=null;#n=null;#i=null;#s=null;#r=!1;#a=null;#o="";#l=null;#c=null;#f=null;#h=null;#d=null;#m="";#g=!1;#u=null;#p=!1;#b=!1;#w=!1;#y=null;#v=0;#x=0;#_=null;#k=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#T=!1;#q=Jt._zIndex++;static _borderLineWidth=-1;static _colorManager=new h9;static _zIndex=1;static _telemetryTimeout=1000;static get _resizerKeyboardManager(){let e=Jt.prototype._resizeWithKeyboard,{TRANSLATE_SMALL:n,TRANSLATE_BIG:i}=au;return en(this,"_resizerKeyboardManager",new hr([[["ArrowLeft"],e,{args:[-n,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-i,0]}],[["ArrowRight"],e,{args:[n,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[i,0]}],[["ArrowUp"],e,{args:[0,-n]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-i]}],[["ArrowDown"],e,{args:[0,n]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,i]}],[["Escape"],Jt.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:n,rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=n,this.pageRotation=(360+n-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[a,r];let[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return en(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){let n=new fT({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});n.annotationElementId=e.annotationElementId,n.deleted=!0,n._uiManager.addToAnnotationStorage(n)}static initialize(e,n){if(Jt._l10n??=e,Jt._l10nAlert??=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"}),Jt._l10nResizer??=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),Jt._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Jt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,n){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,n){Un("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#T}set _isDraggable(e){this.#T=e,this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,n]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*n/(e*2),this.y+=this.width*e/(n*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*n/(e*2),this.y-=this.width*e/(n*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#q}setParent(e){if(e!==null)this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions;else this.#O(),this.#h?.remove(),this.#h=null;this.parent=e}focusin(e){if(!this._focusEventsAllowed)return;if(!this.#g)this.parent.setSelected(this);else this.#g=!1}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;if(e.relatedTarget?.closest(`#${this.id}`))return;if(e.preventDefault(),!this.parent?.isMultipleSelection)this.commitOrRemove()}commitOrRemove(){if(this.isEmpty())this.remove();else this.commit()}commit(){if(!this.isInEditMode())return;this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,n,i,s){let[a,r]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(e+i)/a,this.y=(n+s)/r,this.fixAndSetPosition()}_moveAfterPaste(e,n){if(this.isClone){delete this.isClone;return}let[i,s]=this.parentDimensions;this.setAt(e*i,n*s,this.width*i,this.height*s),this._onTranslated()}#j([e,n],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/e,this.y+=s/n,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,n){this.#j(this.parentDimensions,e,n)}translateInPage(e,n){this.#u||=[this.x,this.y,this.width,this.height],this.#j(this.pageDimensions,e,n),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,n){this.#u||=[this.x,this.y,this.width,this.height];let{div:i,parentDimensions:[s,a]}=this;if(this.x+=e/s,this.y+=n/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:g,y}=this.div.getBoundingClientRect();if(this.parent.findNewParent(this,g,y))this.x-=Math.floor(this.x),this.y-=Math.floor(this.y)}let{x:r,y:l}=this,[c,p]=this.getBaseTranslation();r+=c,l+=p;let{style:m}=i;m.left=`${(100*r).toFixed(2)}%`,m.top=`${(100*l).toFixed(2)}%`,this._onTranslating(r,l)}_onTranslating(e,n){}_onTranslated(e,n){}get _hasBeenMoved(){return!!this.#u&&(this.#u[0]!==this.x||this.#u[1]!==this.y)}get _hasBeenResized(){return!!this.#u&&(this.#u[2]!==this.width||this.#u[3]!==this.height)}getBaseTranslation(){let[e,n]=this.parentDimensions,{_borderLineWidth:i}=Jt,s=i/e,a=i/n;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:n},pageDimensions:[i,s]}=this,{x:a,y:r,width:l,height:c}=this;if(l*=i,c*=s,a*=i,r*=s,this._mustFixPosition)switch(e){case 0:a=vi(a,0,i-l),r=vi(r,0,s-c);break;case 90:a=vi(a,0,i-c),r=vi(r,l,s);break;case 180:a=vi(a,l,i),r=vi(r,c,s);break;case 270:a=vi(a,c,i),r=vi(r,0,s-l);break}this.x=a/=i,this.y=r/=s;let[p,m]=this.getBaseTranslation();a+=p,r+=m,n.left=`${(100*a).toFixed(2)}%`,n.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#C(e,n,i){switch(i){case 90:return[n,-e];case 180:return[-e,-n];case 270:return[-n,e];default:return[e,n]}}screenToPageTranslation(e,n){return Jt.#C(e,n,this.parentRotation)}pageTranslationToScreen(e,n){return Jt.#C(e,n,360-this.parentRotation)}#I(e){switch(e){case 90:{let[n,i]=this.pageDimensions;return[0,-n/i,i/n,0]}case 180:return[-1,0,0,-1];case 270:{let[n,i]=this.pageDimensions;return[0,n/i,-i/n,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[n,i]}=this;return[n*e,i*e]}setDims(){let{div:{style:e},width:n,height:i}=this;e.width=`${(100*n).toFixed(2)}%`,e.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#D(){if(this.#l)return;this.#l=document.createElement("div"),this.#l.classList.add("resizers");let e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],n=this._uiManager._signal;for(let i of e){let s=document.createElement("div");this.#l.append(s),s.classList.add("resizer",i),s.setAttribute("data-resizer-name",i),s.addEventListener("pointerdown",this.#M.bind(this,i),{signal:n}),s.addEventListener("contextmenu",lo,{signal:n}),s.tabIndex=-1}this.div.prepend(this.#l)}#M(e,n){n.preventDefault();let{isMac:i}=si.platform;if(n.button!==0||n.ctrlKey&&i)return;this.#n?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,this.#c=[n.screenX,n.screenY];let a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#F.bind(this,e),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",gs,{passive:!1,signal:r}),window.addEventListener("contextmenu",lo,{signal:r}),this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(n.target).cursor;let p=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=l,this.div.style.cursor=c,this.#R()};window.addEventListener("pointerup",p,{signal:r}),window.addEventListener("blur",p,{signal:r})}#L(e,n,i,s){this.width=i,this.height=s,this.x=e,this.y=n,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#R(){if(!this.#f)return;let{savedX:e,savedY:n,savedWidth:i,savedHeight:s}=this.#f;this.#f=null;let a=this.x,r=this.y,l=this.width,c=this.height;if(a===e&&r===n&&l===i&&c===s)return;this.addCommands({cmd:this.#L.bind(this,a,r,l,c),undo:this.#L.bind(this,e,n,i,s),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#F(e,n){let[i,s]=this.parentDimensions,a=this.x,r=this.y,l=this.width,c=this.height,p=Jt.MIN_SIZE/i,m=Jt.MIN_SIZE/s,g=this.#I(this.rotation),y=(qe,Me)=>[g[0]*qe+g[2]*Me,g[1]*qe+g[3]*Me],x=this.#I(360-this.rotation),I=(qe,Me)=>[x[0]*qe+x[2]*Me,x[1]*qe+x[3]*Me],M,H,X=!1,W=!1;switch(e){case"topLeft":X=!0,M=(qe,Me)=>[0,0],H=(qe,Me)=>[qe,Me];break;case"topMiddle":M=(qe,Me)=>[qe/2,0],H=(qe,Me)=>[qe/2,Me];break;case"topRight":X=!0,M=(qe,Me)=>[qe,0],H=(qe,Me)=>[0,Me];break;case"middleRight":W=!0,M=(qe,Me)=>[qe,Me/2],H=(qe,Me)=>[0,Me/2];break;case"bottomRight":X=!0,M=(qe,Me)=>[qe,Me],H=(qe,Me)=>[0,0];break;case"bottomMiddle":M=(qe,Me)=>[qe/2,Me],H=(qe,Me)=>[qe/2,0];break;case"bottomLeft":X=!0,M=(qe,Me)=>[0,Me],H=(qe,Me)=>[qe,0];break;case"middleLeft":W=!0,M=(qe,Me)=>[0,Me/2],H=(qe,Me)=>[qe,Me/2];break}let Y=M(l,c),te=H(l,c),ae=y(...te),ne=Jt._round(a+ae[0]),oe=Jt._round(r+ae[1]),me=1,be=1,xe,Oe;if(!n.fromKeyboard){let{screenX:qe,screenY:Me}=n,[yt,Ge]=this.#c;[xe,Oe]=this.screenToPageTranslation(qe-yt,Me-Ge),this.#c[0]=qe,this.#c[1]=Me}else({deltaX:xe,deltaY:Oe}=n);if([xe,Oe]=I(xe/i,Oe/s),X){let qe=Math.hypot(l,c);me=be=Math.max(Math.min(Math.hypot(te[0]-Y[0]-xe,te[1]-Y[1]-Oe)/qe,1/l,1/c),p/l,m/c)}else if(W)me=vi(Math.abs(te[0]-Y[0]-xe),p,1)/l;else be=vi(Math.abs(te[1]-Y[1]-Oe),m,1)/c;let Fe=Jt._round(l*me),Ue=Jt._round(c*be);ae=y(...H(Fe,Ue));let ze=ne-ae[0],Le=oe-ae[1];this.#u||=[this.x,this.y,this.width,this.height],this.width=Fe,this.height=Ue,this.x=ze,this.y=Le,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#b)return this._editToolbar;this._editToolbar=new tm(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[n,i]of e)await this._editToolbar.addButton(n,i);if(!this.hasComment)this._editToolbar.addButton("comment",this.addCommentButton());return this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let n=this._editToolbar?.div;if(n)n.before(e);else this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){if(!this.#n){if(el.initialize(Jt._l10n),this.#n=new el(this),this.#e)this.#n.data=this.#e,this.#e=null}return this.#n}get altTextData(){return this.#n?.data}set altTextData(e){if(!this.#n)return;this.#n.data=e}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#i?.focusButton()}addCommentButton(){return this.canAddComment?this.#i||=new Zp(this):null}addStandaloneCommentButton(){if(!this._uiManager.hasCommentManager())return;if(this.#s){if(this._uiManager.isEditingMode())this.#s.classList.remove("hidden");return}if(!this.hasComment)return;this.#s=this.#i.renderForStandalone(),this.div.append(this.#s)}removeStandaloneCommentButton(){this.#i.removeStandaloneCommentButton(),this.#s=null}hideStandaloneCommentButton(){this.#s?.classList.add("hidden")}get comment(){if(!this.#i)return null;let{data:{richText:e,text:n,date:i,deleted:s}}=this.#i;return{text:n,richText:e,date:i,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){if(this.#i||=new Zp(this),typeof e==="object"&&e!==null)this.#i.restoreData(e);else this.#i.data=e;if(this.hasComment)this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this);else this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this)}setCommentData({comment:e,popupRef:n,richText:i}){if(!n)return;if(this.#i||=new Zp(this),this.#i.setInitialText(e,i),!this.annotationElementId)return;let s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);if(s)this.updateFromAnnotationLayer(s)}get hasEditedComment(){return this.#i?.hasBeenEdited()}get hasDeletedComment(){return this.#i?.isDeleted()}get hasComment(){return!!this.#i&&!this.#i.isEmpty()&&!this.#i.isDeleted()}async editComment(e){this.#i||=new Zp(this),this.#i.edit(e)}toggleComment(e,n=void 0){if(this.hasComment)this._uiManager.toggleComment(this,e,n)}setSelectedCommentButton(e){this.#i.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,s]=e.rect,[a]=this.pageDimensions,[r]=this.pageTranslation,l=r+a+1,c=s-100,p=l+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,p,s]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:n}}){this.#i.data=n?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement("div");if(e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#r?-1:0,e.setAttribute("role","application"),this.defaultL10nId)e.setAttribute("data-l10n-id",this.defaultL10nId);if(!this._isVisible)e.classList.add("hidden");this.setInForeground(),this.#P();let[n,i]=this.parentDimensions;if(this.parentRotation%180!==0)e.style.maxWidth=`${(100*i/n).toFixed(2)}%`,e.style.maxHeight=`${(100*n/i).toFixed(2)}%`;let[s,a]=this.getInitialTranslation();return this.translate(s,a),cT(this,e,["keydown","pointerdown","dblclick"]),this.#U(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#G(){this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#N(e,n,i){let a=0.7*(i/n)+1-0.7;if(a===1)return;let r=this.#I(this.rotation),l=(ne,oe)=>[r[0]*ne+r[2]*oe,r[1]*ne+r[3]*oe],[c,p]=this.parentDimensions,m=this.x,g=this.y,y=this.width,x=this.height,I=Jt.MIN_SIZE/c,M=Jt.MIN_SIZE/p;a=Math.max(Math.min(a,1/y,1/x),I/y,M/x);let H=Jt._round(y*a),X=Jt._round(x*a);if(H===y&&X===x)return;this.#u||=[m,g,y,x];let W=l(y/2,x/2),Y=Jt._round(m+W[0]),te=Jt._round(g+W[1]),ae=l(H/2,X/2);this.x=Y-ae[0],this.y=te-ae[1],this.width=H,this.height=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#H(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#R()}pointerdown(e){let{isMac:n}=si.platform;if(e.button!==0||e.ctrlKey&&n){e.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#S(e);return}this.#A(e)}#A(e){let{isMac:n}=si.platform;if(e.ctrlKey&&!n||e.shiftKey||e.metaKey&&n)this.parent.toggleSelected(this);else this.parent.setSelected(this)}#S(e){let{isSelected:n}=this;this._uiManager.setUpDragSession();let i=!1,s=new AbortController,a=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:a},l=(p)=>{if(s.abort(),this.#a=null,this.#g=!1,!this._uiManager.endDragSession())this.#A(p);if(i)this._onStopDragging()};if(n)this.#v=e.clientX,this.#x=e.clientY,this.#a=e.pointerId,this.#o=e.pointerType,window.addEventListener("pointermove",(p)=>{if(!i)i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging();let{clientX:m,clientY:g,pointerId:y}=p;if(y!==this.#a){gs(p);return}let[x,I]=this.screenToPageTranslation(m-this.#v,g-this.#x);this.#v=m,this.#x=g,this._uiManager.dragSelectedEditors(x,I),this.div.scrollIntoView({block:"nearest"})},r),window.addEventListener("touchmove",gs,r),window.addEventListener("pointerdown",(p)=>{if(p.pointerType===this.#o){if(this.#k||p.isPrimary)l(p)}gs(p)},r);let c=(p)=>{if(!this.#a||this.#a===p.pointerId){l(p);return}gs(p)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){if(this.#y)clearTimeout(this.#y);this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,n,i){e.changeParent(this),this.x=n,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(e,n,i=this.rotation){let s=this.parentScale,[a,r]=this.pageDimensions,[l,c]=this.pageTranslation,p=e/s,m=n/s,g=this.x*a,y=this.y*r,x=this.width*a,I=this.height*r;switch(i){case 0:return[g+p+l,r-y-m-I+c,g+p+x+l,r-y-m+c];case 90:return[g+m+l,r-y+p+c,g+m+I+l,r-y+p+x+c];case 180:return[g-p-x+l,r-y+m+c,g-p+l,r-y+m+I+c];case 270:return[g-m-I+l,r-y-p-x+c,g-m+l,r-y-p+c];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(e,n){let[i,s,a,r]=e,l=a-i,c=r-s;switch(this.rotation){case 0:return[i,n-r,l,c];case 90:return[i,n-s,c,l];case 180:return[a,n-s,l,c];case 270:return[a,n-r,c,l];default:throw Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Jt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#i?.onUpdatedColor()}getData(){let{comment:{text:e,color:n,date:i,opacity:s,deleted:a,richText:r},uid:l,pageIndex:c,creationDate:p,modificationDate:m}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:r,contentsObj:{str:e},creationDate:p,modificationDate:i||m,popupRef:!a,color:n,opacity:s}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){if(this.isInEditMode())return!1;return this.parent.setEditingState(!1),this.#b=!0,!0}disableEditMode(){if(!this.isInEditMode())return!1;return this.parent.setEditingState(!0),this.#b=!1,!0}isInEditMode(){return this.#b}shouldGetKeyboardEvents(){return this.#w}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:n,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:a,innerWidth:r}=window;return n<r&&s>0&&e<a&&i>0}#P(){if(this.#d||!this.div)return;this.#d=new AbortController;let e=this._uiManager.combinedSignal(this.#d);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}#U(){if(this.#k||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom)return;this.#k=new f9({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#G.bind(this),onPinching:this.#N.bind(this),onPinchEnd:this.#H.bind(this),signal:this._uiManager._signal})}rebuild(){this.#P(),this.#U()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,n=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,n,i){let s=new this.prototype.constructor({parent:n,id:i.getId(),uiManager:i,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});s.rotation=e.rotation,s.#e=e.accessibilityData,s._isCopy=e.isCopy||!1;let[a,r]=s.pageDimensions,[l,c,p,m]=s.getRectInCurrentCoords(e.rect,r);return s.x=l/a,s.y=c/r,s.width=p/a,s.height=m/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#d?.abort(),this.#d=null,!this.isEmpty())this.commit();if(this.#k?.destroy(),this.#k=null,this.parent)this.parent.remove(this);else this._uiManager.removeEditor(this);if(this.hideCommentPopup(),this.#y)clearTimeout(this.#y),this.#y=null;if(this.#O(),this.removeEditToolbar(),this.#_){for(let e of this.#_.values())clearTimeout(e);this.#_=null}this.parent=null,this.#h?.remove(),this.#h=null}get isResizable(){return!1}makeResizable(){if(this.isResizable)this.#D(),this.#l.classList.remove("hidden")}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[e,n]}=this,[i,s,a,r]=this.getPDFRect();return[Jt._round(i+(a-i)*e),Jt._round(s+(r-s)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#i.commentPopupPositionInLayer}set commentPopupPosition(e){this.#i.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#i.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#i.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#i?.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#f={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#l.children;if(!this.#t){this.#t=Array.from(n);let r=this.#V.bind(this),l=this.#Y.bind(this),c=this._uiManager._signal;for(let p of this.#t){let m=p.getAttribute("data-resizer-name");p.setAttribute("role","spinbutton"),p.addEventListener("keydown",r,{signal:c}),p.addEventListener("blur",l,{signal:c}),p.addEventListener("focus",this.#K.bind(this,m),{signal:c}),p.setAttribute("data-l10n-id",Jt._l10nResizer[m])}}let i=this.#t[0],s=0;for(let r of n){if(r===i)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==s){if(a<s)for(let l=0;l<s-a;l++)this.#l.append(this.#l.firstElementChild);else if(a>s)for(let l=0;l<a-s;l++)this.#l.firstElementChild.before(this.#l.lastElementChild);let r=0;for(let l of n){let p=this.#t[r++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Jt._l10nResizer[p])}}this.#$(0),this.#w=!0,this.#l.firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#V(e){Jt._resizerKeyboardManager.exec(this,e)}#Y(e){if(this.#w&&e.relatedTarget?.parentNode!==this.#l)this.#O()}#K(e){this.#m=this.#w?e:""}#$(e){if(!this.#t)return;for(let n of this.#t)n.tabIndex=e}_resizeWithKeyboard(e,n){if(!this.#w)return;this.#F(this.#m,{deltaX:e,deltaY:n,fromKeyboard:!0})}#O(){this.#w=!1,this.#$(-1),this.#R()}_stopResizingWithKeyboard(){this.#O(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{if(this.div?.classList.contains("selectedEditor"))this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){if(this.div&&!this.div.contains(document.activeElement))setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){if(!this.isSelected)return;if(this.isSelected=!1,this.#l?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement))this._uiManager.currentLayer.div.focus({preventScroll:!0});this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup()}hideCommentPopup(){if(this.hasComment)this._uiManager.toggleComment(null)}updateParams(e,n){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){if(!this.canChangeContent)return;this.enableEditMode(),this.div.focus()}dblclick(e){if(e.target.nodeName==="BUTTON")return;this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(e){if(this.#p=e,!this.parent)return;if(e)this.parent.setSelected(this),this.parent.setActiveEditor(this);else this.parent.setActiveEditor(null)}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){this.#_||=new Map;let{action:i}=e,s=this.#_.get(i);if(s)clearTimeout(s);s=setTimeout(()=>{if(this._reportTelemetry(e),this.#_.delete(i),this.#_.size===0)this.#_=null},Jt._telemetryTimeout),this.#_.set(i,s);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){if(this.div)this.div.tabIndex=0;this.#r=!1}disable(){if(this.div)this.div.tabIndex=-1;this.#r=!0}updateFakeAnnotationElement(e){if(!this.#h&&!this.deleted){this.#h=e.addFakeAnnotation(this);return}if(this.deleted){this.#h.remove(),this.#h=null;return}if(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)this.#h.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let n=e.container.querySelector(".annotationContent");if(!n)n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),e.container.prepend(n);else if(n.nodeName==="CANVAS"){let i=n;n=document.createElement("div"),n.classList.add("annotationContent",this.editorType),i.before(n)}return n}resetAnnotationElement(e){let{firstElementChild:n}=e.container;if(n?.nodeName==="DIV"&&n.classList.contains("annotationContent"))n.remove()}}class fT extends Jt{constructor(e){super(e);this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}var Mk=3285377520,Lr=4294901760,Qo=65535;class o2{constructor(e){this.h1=e?e&4294967295:Mk,this.h2=e?e&4294967295:Mk}update(e){let n,i;if(typeof e==="string"){n=new Uint8Array(e.length*2),i=0;for(let M=0,H=e.length;M<H;M++){let X=e.charCodeAt(M);if(X<=255)n[i++]=X;else n[i++]=X>>>8,n[i++]=X&255}}else if(ArrayBuffer.isView(e))n=e.slice(),i=n.byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-s*4,r=new Uint32Array(n.buffer,0,s),l=0,c=0,p=this.h1,m=this.h2,g=3432918353,y=461845907,x=g&Qo,I=y&Qo;for(let M=0;M<s;M++)if(M&1)l=r[M],l=l*g&Lr|l*x&Qo,l=l<<15|l>>>17,l=l*y&Lr|l*I&Qo,p^=l,p=p<<13|p>>>19,p=p*5+3864292196;else c=r[M],c=c*g&Lr|c*x&Qo,c=c<<15|c>>>17,c=c*y&Lr|c*I&Qo,m^=c,m=m<<13|m>>>19,m=m*5+3864292196;switch(l=0,a){case 3:l^=n[s*4+2]<<16;case 2:l^=n[s*4+1]<<8;case 1:if(l^=n[s*4],l=l*g&Lr|l*x&Qo,l=l<<15|l>>>17,l=l*y&Lr|l*I&Qo,s&1)p^=l;else m^=l}this.h1=p,this.h2=m}hexdigest(){let e=this.h1,n=this.h2;return e^=n>>>1,e=e*3981806797&Lr|e*36045&Qo,n=n*4283543511&Lr|((n<<16|e>>>16)*2950163797&Lr)>>>16,e^=n>>>1,e=e*444984403&Lr|e*60499&Qo,n=n*3301882366&Lr|((n<<16|e>>>16)*3120437893&Lr)>>>16,e^=n>>>1,(e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")}}var am=Object.freeze({map:null,hash:"",transfer:void 0});class v2{#e=!1;#t=null;#n=null;#i=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,n){let i=this.#i.get(e);if(i===void 0)return n;return Object.assign(n,i)}getRawValue(e){return this.#i.get(e)}remove(e){let n=this.#i.get(e);if(n===void 0)return;if(n instanceof Jt)this.#n.delete(n.annotationElementId);if(this.#i.delete(e),this.#i.size===0)this.resetModified();if(this.#i.values().some((i)=>i instanceof Jt))return;this.onAnnotationEditor?.(null)}setValue(e,n){let i=this.#i.get(e),s=!1;if(i!==void 0){for(let[a,r]of Object.entries(n))if(i[a]!==r)s=!0,i[a]=r}else s=!0,this.#i.set(e,n);if(s)this.#s();if(n instanceof Jt)(this.#n||=new Map).set(n.annotationElementId,n),this.onAnnotationEditor?.(n.constructor._type)}has(e){return this.#i.has(e)}get size(){return this.#i.size}#s(){if(!this.#e)this.#e=!0,this.onSetModified?.()}resetModified(){if(this.#e)this.#e=!1,this.onResetModified?.()}get print(){return new d9(this)}get serializable(){if(this.#i.size===0)return am;let e=new Map,n=new o2,i=[],s=Object.create(null),a=!1;for(let[r,l]of this.#i){let c=l instanceof Jt?l.serialize(!1,s):l;if(l.page)l.pageIndex=l.page._pageIndex,delete l.page;if(c)e.set(r,c),n.update(`${r}:${JSON.stringify(c)}`),a||=!!c.bitmap}if(a){for(let r of e.values())if(r.bitmap)i.push(r.bitmap)}return e.size>0?{map:e,hash:n.hexdigest(),transfer:i}:am}get editorStats(){let e=null,n=new Map,i=0,s=0;for(let a of this.#i.values()){if(!(a instanceof Jt)){if(a.popup)if(a.popup.deleted)s+=1;else i+=1;continue}if(a.isCommentDeleted)s+=1;else if(a.hasEditedComment)i+=1;let r=a.telemetryFinalData;if(!r)continue;let{type:l}=r;n.getOrInsertComputed(l,()=>Object.getPrototypeOf(a).constructor),e||=Object.create(null);let c=e[l]||=new Map;for(let[p,m]of Object.entries(r)){if(p==="type")continue;let g=c.getOrInsertComputed(p,r9);g.set(m,(g.get(m)??0)+1)}}if(s>0||i>0)e||=Object.create(null),e.comments={deleted:s,edited:i};if(!e)return null;for(let[a,r]of n)e[a]=r.computeTelemetryFinalData(e[a]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,n){let i=this.#n?.get(e);if(i)return i.updateFromAnnotationLayer(n),!0;return!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let i of this.#n.values()){if(!i.serialize())continue;e.push(i.annotationElementId)}let n="";if(e.length){let i=new o2;i.update(e.join(",")),n=i.hexdigest()}return this.#t={ids:new Set(e),hash:n}}[Symbol.iterator](){return this.#i.entries()}}class d9 extends v2{#e=am;constructor(e){super();let{serializable:n}=e;if(n===am)return;let{map:i,hash:s,transfer:a}=n,r=structuredClone(i,a?{transfer:a}:null);this.#e={map:r,hash:s,transfer:[]}}get print(){Un("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return en(this,"modifiedIds",{ids:new Set,hash:""})}}var Id="__forcedDependency",{floor:Rk,ceil:Ok}=Math;function Fk(e,n,i,s,a,r){e[n*4+0]=Math.min(e[n*4+0],i),e[n*4+1]=Math.min(e[n*4+1],s),e[n*4+2]=Math.max(e[n*4+2],a),e[n*4+3]=Math.max(e[n*4+3],r)}function YB(e,n,i,s,a){let r;if(e){if(e<0)r=a[0],a[0]=a[2],a[2]=r;if(a[0]*=e,a[2]*=e,n<0)r=a[1],a[1]=a[3],a[3]=r;a[1]*=n,a[3]*=n}else a.fill(0);a[0]+=i,a[1]+=s,a[2]+=i,a[3]+=s}var t9=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class dT{#e;#t;constructor(e,n){this.#e=e,this.#t=n}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===t9}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}}var Nk=(e,n)=>e?.getOrInsertComputed(n,()=>({dependencies:new Set,isRenderingOperation:!1}));class pT{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(Gl);_pendingBBoxIdx=-1;#i;#s;#r;#a;_savesStack=[];_markedContentStack=[];constructor(e,n){this.#i=e.width,this.#s=e.height,this.#o(n)}growOperationsCount(e){if(e>=this.#a.length)this.#o(e,this.#a)}#o(e,n){let i=new ArrayBuffer(e*4);if(this.#r=new Uint8ClampedArray(i),this.#a=new Uint32Array(i),n&&n.length>0)this.#a.set(n),this.#a.fill(t9,n.length);else this.#a.fill(t9)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,n){let i=Object.getPrototypeOf(this.#t);if(i===null)return this;this.#t=i;let s=this._savesStack.pop();if(s!==void 0)n?.(s,e),this.#a[e]=this.#a[s];return this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,n){let i=this._savesStack.pop();if(i!==void 0)n?.(i,e),this.#a[e]=this.#a[i];return this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,n){let i=this._markedContentStack.pop();if(i!==void 0)n?.(i,e),this.#a[e]=this.#a[i];return this}pushBaseTransform(e){return this.#e.push(Ot.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){if(this.#e.length>1)this.#e.pop();return this}resetBBox(e){if(this._pendingBBoxIdx!==e)this._pendingBBoxIdx=e,this.#n.set(Gl,0);return this}recordClipBox(e,n,i,s,a,r){let l=Ot.multiplyByDOMMatrix(this.#e.at(-1),n.getTransform()),c=Gl.slice();Ot.axialAlignedBoundingBox([i,a,s,r],l,c);let p=Ot.intersect(this.#t,c);if(p)this.#t[0]=p[0],this.#t[1]=p[1],this.#t[2]=p[2],this.#t[3]=p[3];else this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0;return this}recordBBox(e,n,i,s,a,r){let l=this.#t;if(l[0]===1/0)return this;let c=Ot.multiplyByDOMMatrix(this.#e.at(-1),n.getTransform());if(l[0]===-1/0)return Ot.axialAlignedBoundingBox([i,a,s,r],c,this.#n),this;let p=Gl.slice();return Ot.axialAlignedBoundingBox([i,a,s,r],c,p),this.#n[0]=vi(p[0],l[0],this.#n[0]),this.#n[1]=vi(p[1],l[1],this.#n[1]),this.#n[2]=vi(p[2],this.#n[2],l[2]),this.#n[3]=vi(p[3],this.#n[3],l[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#i,this.#t[2]),this.#n[3]=Math.min(this.#s,this.#t[3]),this}recordOperation(e,n=!1,i){if(this._pendingBBoxIdx!==e)return this;let s=Rk(this.#n[0]*256/this.#i),a=Rk(this.#n[1]*256/this.#s),r=Ok(this.#n[2]*256/this.#i),l=Ok(this.#n[3]*256/this.#s);if(Fk(this.#r,e,s,a,r,l),i){for(let c of i)for(let p of c)if(p!==e)Fk(this.#r,p,s,a,r,l)}if(!n)this._pendingBBoxIdx=-1;return this}bboxToClipBoxDropOperation(e){if(this._pendingBBoxIdx===e)this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3]);return this}take(){return new dT(this.#a,this.#r)}takeDebugMetadata(){throw Error("Unreachable")}recordSimpleData(e,n){return this}recordIncrementalData(e,n){return this}resetIncrementalData(e,n){return this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,i){return this}recordFutureForcedDependency(e,n){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,n,i,s=1,a=0,r=0,l){return this}getSimpleIndex(e){return}recordDependencies(e,n){return this}recordNamedDependency(e,n){return this}recordShowTextOperation(e,n=!1){return this}}class mT{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[Id]:[]};#n=new Map;#i=new Set;#s=new Map;#r;#a;#o;constructor(e,n=!1){if(this.#o=e,n)this.#r=new Map,this.#a=(i,s)=>{Nk(this.#r,s).dependencies.add(i)}}get clipBox(){return this.#o.clipBox}growOperationsCount(e){this.#o.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[Id]:{__proto__:this.#t[Id]}},this.#o.save(e),this}restore(e){this.#o.restore(e,this.#a);let n=Object.getPrototypeOf(this.#e);if(n===null)return this;return this.#e=n,this.#t=Object.getPrototypeOf(this.#t),this}recordOpenMarker(e){return this.#o.recordOpenMarker(e,this.#a),this}getOpenMarker(){return this.#o.getOpenMarker()}recordCloseMarker(e){return this.#o.recordCloseMarker(e,this.#a),this}beginMarkedContent(e){return this.#o.beginMarkedContent(e),this}endMarkedContent(e){return this.#o.endMarkedContent(e,this.#a),this}pushBaseTransform(e){return this.#o.pushBaseTransform(e),this}popBaseTransform(){return this.#o.popBaseTransform(),this}recordSimpleData(e,n){return this.#e[e]=n,this}recordIncrementalData(e,n){return this.#t[e].push(n),this}resetIncrementalData(e,n){return this.#t[e].length=0,this}recordNamedData(e,n){return this.#n.set(e,n),this}recordSimpleDataFromNamed(e,n,i){this.#e[e]=this.#n.get(n)??i}recordFutureForcedDependency(e,n){return this.recordIncrementalData(Id,n),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let n of e)if(n in this.#e)this.recordFutureForcedDependency(n,this.#e[n]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#i)this.recordFutureForcedDependency(Id,e);return this}resetBBox(e){return this.#o.resetBBox(e),this}recordClipBox(e,n,i,s,a,r){return this.#o.recordClipBox(e,n,i,s,a,r),this}recordBBox(e,n,i,s,a,r){return this.#o.recordBBox(e,n,i,s,a,r),this}recordCharacterBBox(e,n,i,s=1,a=0,r=0,l){let c=i.bbox,p,m;if(c){if(p=c[2]!==c[0]&&c[3]!==c[1]&&this.#s.get(i),p!==!1){if(m=[0,0,0,0],Ot.axialAlignedBoundingBox(c,i.fontMatrix,m),s!==1||a!==0||r!==0)YB(s,-s,a,r,m);if(p)return this.recordBBox(e,n,m[0],m[2],m[1],m[3])}}if(!l)return this.recordFullPageBBox(e);let g=l();if(c&&m&&p===void 0){if(p=m[0]<=a-g.actualBoundingBoxLeft&&m[2]>=a+g.actualBoundingBoxRight&&m[1]<=r-g.actualBoundingBoxAscent&&m[3]>=r+g.actualBoundingBoxDescent,this.#s.set(i,p),p)return this.recordBBox(e,n,m[0],m[2],m[1],m[3])}return this.recordBBox(e,n,a-g.actualBoundingBoxLeft,a+g.actualBoundingBoxRight,r-g.actualBoundingBoxAscent,r+g.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#o.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,n){let i=this.#i,s=this.#e,a=this.#t;for(let r of n)if(r in this.#e)i.add(s[r]);else if(r in a)a[r].forEach(i.add,i);return this}recordNamedDependency(e,n){if(this.#n.has(n))this.#i.add(this.#n.get(n));return this}recordOperation(e,n=!1){if(this.recordDependencies(e,[Id]),this.#r){let s=Nk(this.#r,e),{dependencies:a}=s;this.#i.forEach(a.add,a),this.#o._savesStack.forEach(a.add,a),this.#o._markedContentStack.forEach(a.add,a),a.delete(e),s.isRenderingOperation=!0}let i=!n&&e===this.#o._pendingBBoxIdx;if(this.#o.recordOperation(e,n,[this.#i,this.#o._savesStack,this.#o._markedContentStack]),i)this.#i.clear();return this}recordShowTextOperation(e,n=!1){let i=Array.from(this.#i);this.recordOperation(e,n),this.recordIncrementalData("sameLineText",e);for(let s of i)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(e,n=!1){let i=!n&&e===this.#o._pendingBBoxIdx;if(this.#o.bboxToClipBoxDropOperation(e),i)this.#i.clear();return this}take(){return this.#s.clear(),this.#o.take()}takeDebugMetadata(){return this.#r}}class rm{#e;#t;#n;#i=0;#s=0;constructor(e,n,i){if(e instanceof rm&&e.#n===!!i)return e;this.#e=e,this.#t=n,this.#n=!!i}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error("Unreachable")}save(e){return this.#s++,this.#e.save(this.#t),this}restore(e){if(this.#s>0)this.#e.restore(this.#t),this.#s--;return this}recordOpenMarker(e){return this.#i++,this}getOpenMarker(){return this.#i>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#i--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,n){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,n){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,n){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,n){return this}recordSimpleDataFromNamed(e,n,i){return this.#e.recordSimpleDataFromNamed(e,n,this.#t),this}recordFutureForcedDependency(e,n){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){if(!this.#n)this.#e.resetBBox(this.#t);return this}recordClipBox(e,n,i,s,a,r){if(!this.#n)this.#e.recordClipBox(this.#t,n,i,s,a,r);return this}recordBBox(e,n,i,s,a,r){if(!this.#n)this.#e.recordBBox(this.#t,n,i,s,a,r);return this}recordCharacterBBox(e,n,i,s,a,r,l){if(!this.#n)this.#e.recordCharacterBBox(this.#t,n,i,s,a,r,l);return this}recordFullPageBBox(e){if(!this.#n)this.#e.recordFullPageBBox(this.#t);return this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,n){return this.#e.recordDependencies(this.#t,n),this}recordNamedDependency(e,n){return this.#e.recordNamedDependency(this.#t,n),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){if(!this.#n)this.#e.bboxToClipBoxDropOperation(this.#t,!0);return this}take(){throw Error("Unreachable")}takeDebugMetadata(){throw Error("Unreachable")}}var Ur={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]};class l2{#e;#t;#n=4;#i=0;#s=new l2.#r(this.#n*6);static#r=si.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(e,n,i,s){if(this.#i===this.#n){this.#n*=2;let l=new l2.#r(this.#n*6);l.set(this.#s),this.#s=l}let a=bi(e),r;if(s[0]!==1/0){let l=Gl.slice();Ot.axialAlignedBoundingBox([0,-i,n,0],a,l);let c=Ot.intersect(s,l);if(!c)return;let[p,m,g,y]=c;if(p!==l[0]||m!==l[1]||g!==l[2]||y!==l[3]){let x=Math.atan2(a[1],a[0]),I=Math.abs(Math.sin(x)),M=Math.abs(Math.cos(x));if(I<0.000001||M<0.000001||Math.abs(I-M)<0.000001)r=[p,m,p,y,g,m];else{let H=g-p,X=y-m,W=I*I,Y=M*M,te=M*I,ae=Y-W,ne=(X*Y-H*te)/ae,oe=(X*te-H*W)/ae;r=[p+oe,m,p,m+ne,g,y-ne]}}}if(!r)r=[0,-i,0,0,n,-i],Ot.applyTransform(r,a,0),Ot.applyTransform(r,a,2),Ot.applyTransform(r,a,4);r[0]/=this.#e,r[1]/=this.#t,r[2]/=this.#e,r[3]/=this.#t,r[4]/=this.#e,r[5]/=this.#t,this.#s.set(r,this.#i*6),this.#i++}take(){return this.#s.subarray(0,this.#i*6)}}var Pk=/\p{Cc}/u;function QB(e){let n=e[0];if(e.length<2||n!=='"'&&n!=="'"||e.at(-1)!==n)return!1;let i=e.length-1;for(let s=1;s<i;s++){let a=e[s];if(a===n||Pk.test(a))return!1;if(a==="\\"){if(++s>=i||Pk.test(e[s]))return!1}}return!0}function Bk(e){if(QB(e))return e;return`"${e.replaceAll(/["\\\p{Cc}]/gu,(i)=>i==='"'||i==="\\"?`\\${i}`:`\\${i.codePointAt(0).toString(16)} `)}"`}class gT{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:n=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let n=this.#n();n.insertRule(e,n.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:n}=this._document;if(n){let i=new e;return n.push(i),this.#t=i}}if(!this.styleElement)this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);return this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;if(e?.includes(this.#t))this._document.adoptedStyleSheets=e.filter((n)=>n!==this.#t);this.#t=null}if(this.styleElement)this.styleElement.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:e,disableFontFace:n,_inspectFont:i}){if(!e||this.#e.has(e.loadedName))return;if(Pi(!n,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:s,src:a,style:r}=e,l=new FontFace(s,a,r);this.addNativeFontFace(l);try{await l.load(),this.#e.add(s),i?.(e)}catch{vn(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}Un("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let i=e.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(s){throw vn(`Failed to load font '${i.family}': '${s}'.`),e.disableFontFace=!0,s}}return}let n=e.createFontFaceRule();if(n){if(this.insertRule(n),this.isSyncFontLoadingSupported)return;await new Promise((i)=>{let s=this._queueLoadingCallback(i);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return en(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return en(this,"isSyncFontLoadingSupported",ur||si.platform.isFirefox)}_queueLoadingCallback(e){function n(){Pi(!s.done,"completeRequest() cannot be called twice."),s.done=!0;while(i.length>0&&i[0].done){let a=i.shift();setTimeout(a.callback,0)}}let{loadingRequests:i}=this,s={done:!1,complete:n,callback:e};return i.push(s),s}get _loadTestFont(){let e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return en(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,n){function i(ae,ne){return ae.charCodeAt(ne)<<24|ae.charCodeAt(ne+1)<<16|ae.charCodeAt(ne+2)<<8|ae.charCodeAt(ne+3)&255}function s(ae){return String.fromCharCode(ae>>24&255,ae>>16&255,ae>>8&255,ae&255)}function a(ae,ne,oe,me){let be=ae.substring(0,ne),xe=ae.substring(ne+oe);return be+me+xe}let r,l,c=this._document.createElement("canvas");c.width=1,c.height=1;let p=c.getContext("2d"),m=0;function g(ae,ne){if(++m>30){vn("Load test font never loaded."),ne();return}if(p.font="30px "+ae,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){ne();return}setTimeout(g.bind(null,ae,ne))}let y=`lt${Date.now()}${this.loadTestFontId++}`,x=this._loadTestFont;x=a(x,976,y.length,y);let M=16,H=1482184792,X=i(x,M);for(r=0,l=y.length-3;r<l;r+=4)X=X-H+i(y,r)|0;if(r<y.length)X=X-H+i(y+"XXX",r)|0;x=a(x,M,4,s(X));let W=`url(data:font/opentype;base64,${btoa(x)});`,Y=`@font-face {font-family:"${y}";src:${W}}`;this.insertRule(Y);let te=this._document.createElement("div");te.style.visibility="hidden",te.style.width=te.style.height="10px",te.style.position="absolute",te.style.top=te.style.left="0px";for(let ae of[e.loadedName,y]){let ne=this._document.createElement("span");ne.textContent="Hi",ne.style.fontFamily=ae,te.append(ne)}this._document.body.append(te),g(y,()=>{te.remove(),n.complete()})}}class bT{compiledGlyphs=Object.create(null);#e;constructor(e,n=null,i,s){if(this.#e=e,this._inspectFont=n,i)this.charProcOperatorList=i;if(s)Object.assign(this,s)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let n={weight:this.cssFontInfo.fontWeight};if(this.cssFontInfo.italicAngle)n.style=`oblique ${this.cssFontInfo.italicAngle}deg`;e=new FontFace(Bk(this.cssFontInfo.fontFamily),this.data,n)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;if(this.cssFontInfo.italicAngle)i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;n=`@font-face {font-family:${Bk(this.cssFontInfo.fontFamily)};${i}src:${e}}`}return this._inspectFont?.(this,e),n}getPathGenerator(e,n){if(this.compiledGlyphs[n]!==void 0)return this.compiledGlyphs[n];let i=this.loadedName+"_path_"+n,s;try{s=e.get(i)}catch(r){vn(`getPathGenerator - ignoring character: "${r}".`)}let a=oT(s?.path);if(!this.fontExtraProperties)e.delete(i);return this.compiledGlyphs[n]=a}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){en(this,"disableFontFace",!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}}class wT{static strings=["fontFamily","fontWeight","italicAngle"]}class yT{static strings=["css","loadedName","baseFontName","src"]}class zr{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6}class iu{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16}class om{static get decoder(){return en(this,"decoder",new TextDecoder)}static get encoder(){return en(this,"encoder",new TextEncoder)}}class vT{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){Pi(e<wT.strings.length,"Invalid string index");let{decoder:n}=om,i=0;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}}class ST{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}get guessFallback(){return this.#t.getUint8(0)!==0}#n(e){Pi(e<yT.strings.length,"Invalid string index");let{decoder:n}=om,i=5;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let{decoder:e}=om,n=1;n+=4+this.#t.getUint32(n);let i=this.#t.getUint32(n),s=e.decode(new Uint8Array(this.#e,n+4,i));n+=4+i;let a=this.#t.getUint32(n),r=e.decode(new Uint8Array(this.#e,n+4,a));return{style:s,weight:r}}}class _T{#e;#t;constructor({buffer:e,extra:n}){if(this.#e=e,this.#t=new DataView(e),n)Object.assign(this,n)}#n(e){Pi(e<zr.bools.length,"Invalid boolean index");let n=Math.floor(e/4),i=e*2%8,s=this.#t.getUint8(n)>>i&3;return s===0?void 0:s===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#i(e){return Pi(e<zr.numbers.length,"Invalid number index"),this.#t.getFloat64(zr.OFFSET_NUMBERS+e*8)}get ascent(){return this.#i(0)}get defaultWidth(){return this.#i(1)}get descent(){return this.#i(2)}#s(e,n,i,s){let a=this.#t.getUint8(e);if(a===0)return;Pi(a===n,"Invalid array length."),e+=1;let r=Array(a);for(let l=0;l<a;l++)r[l]=this.#t[i](e,!0),e+=s;return r}get bbox(){return this.#s(zr.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#s(zr.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#s(zr.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#r(e){Pi(e<zr.strings.length,"Invalid string index");let{decoder:n}=om,i=zr.OFFSET_STRINGS+4;for(let a=0;a<e;a++)i+=this.#t.getUint32(i)+4;let s=this.#t.getUint32(i);return n.decode(new Uint8Array(this.#e,i+4,s))}get fallbackName(){return this.#r(0)}get loadedName(){return this.#r(1)}get mimetype(){return this.#r(2)}get name(){return this.#r(3)}#a(){let e=zr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);e+=4+i;let s=this.#t.getUint32(e);e+=4+s;let a=this.#t.getUint32(e);return{offset:e,length:a}}get data(){let{offset:e,length:n}=this.#a();return n===0?void 0:new Uint8Array(this.#e,e+4,n)}clearData(){let{offset:e,length:n}=this.#a();if(n===0)return;this.#t.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#t=new DataView(this.#e)}get cssFontInfo(){let e=zr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);e+=4+i;let s=this.#t.getUint32(e);if(s===0)return null;let a=new Uint8Array(s);return a.set(new Uint8Array(this.#e,e+4,s)),new vT(a.buffer)}get systemFontInfo(){let e=zr.OFFSET_STRINGS,n=this.#t.getUint32(e);e+=4+n;let i=this.#t.getUint32(e);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(this.#e,e+4,i)),new ST(s.buffer)}}class xT{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,n=this.data[iu.KIND],i=!!this.data[iu.HAS_BBOX],s=!!this.data[iu.HAS_BACKGROUND],a=e.getUint32(iu.N_COORD,!0),r=e.getUint32(iu.N_COLOR,!0),l=e.getUint32(iu.N_STOP,!0),c=20,p=new Float32Array(this.buffer,c,a*2);c+=a*8;let m=new Uint8Array(this.buffer,c,r*4);c+=r*4;let g=[];for(let I=0;I<l;++I){let M=e.getFloat32(c,!0);c+=4;let H=e.getUint32(c,!0);c+=4,g.push([M,`#${H.toString(16).padStart(6,"0")}`])}let y=null;if(i){y=[];for(let I=0;I<4;++I)y.push(e.getFloat32(c,!0)),c+=4}let x=null;if(s)x=new Uint8Array(this.buffer,c,3),c+=3;if(n===1)return["RadialAxial","axial",y,g,Array.from(p.slice(0,2)),Array.from(p.slice(2,4)),null,null];if(n===2)return["RadialAxial","radial",y,g,[p[0],p[1]],[p[3],p[4]],p[2],p[5]];if(n===3){let I=this.data[iu.SHADING_TYPE],M=null;if(p.length>0){M=Gl.slice();for(let H=0,X=p.length;H<X;H+=2)Ot.pointBoundingBox(p[H],p[H+1],M)}return["Mesh",I,p,m,a,M,y,x]}throw Error(`Unsupported pattern kind: ${n}`)}}class kT{#e;constructor(e){this.#e=e}get path(){if(si.isFloat16ArraySupported)return new Float16Array(this.#e);return new Float32Array(this.#e)}}function JB(e){if(e instanceof URL)return e;if(typeof e==="string"){if(ur){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let i=process.getBuiltinModule("url");return new URL(i.pathToFileURL(e))}let n=URL.parse(e,window.location);if(n)return n}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function ZB(e){if(ur&&typeof Buffer<"u"&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==="string")return b2(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==="object"&&!isNaN(e?.length))return new Uint8Array(e);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Xb(e){if(typeof e!=="string")return null;if(e.endsWith("/"))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var n9=(e)=>typeof e==="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,eL=(e)=>typeof e==="object"&&typeof e?.name==="string",tL=LB.bind(null,n9,eL);class TT{#e=new Map;#t=Promise.resolve();postMessage(e,n){let i={data:structuredClone(e,n?{transfer:n}:null)};this.#t.then(()=>{for(let[s]of this.#e)s.call(this,i)})}addEventListener(e,n,i=null){let s=null;if(i?.signal instanceof AbortSignal){let{signal:a}=i;if(a.aborted){vn("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(e,n);s=()=>a.removeEventListener("abort",r),a.addEventListener("abort",r)}this.#e.set(n,s)}removeEventListener(e,n){this.#e.get(n)?.(),this.#e.delete(n)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}}var Wb={DATA:1,ERROR:2},hs={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Lk(){}function za(e){if(e instanceof Xl||e instanceof a2||e instanceof s2||e instanceof im||e instanceof t2)return e;if(!(e instanceof Error||typeof e==="object"&&e!==null))Un('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new Xl(e.message);case"InvalidPDFException":return new a2(e.message);case"PasswordException":return new s2(e.message,e.code);case"ResponseException":return new im(e.message,e.status,e.missing);case"UnknownErrorException":return new t2(e.message,e.details)}return new t2(e.message,e.toString())}class Od{#e=new AbortController;constructor(e,n,i){this.sourceName=e,this.targetName=n,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#i(e);return}if(e.callback){let i=e.callbackId,s=this.callbackCapabilities[i];if(!s)throw Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],e.callback===Wb.DATA)s.resolve(e.data);else if(e.callback===Wb.ERROR)s.reject(za(e.reason));else throw Error("Unexpected callback case");return}let n=this.actionHandler[e.action];if(!n)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let i=this.sourceName,s=e.sourceName,a=this.comObj;Promise.try(n,e.data).then(function(r){a.postMessage({sourceName:i,targetName:s,callback:Wb.DATA,callbackId:e.callbackId,data:r})},function(r){a.postMessage({sourceName:i,targetName:s,callback:Wb.ERROR,callbackId:e.callbackId,reason:za(r)})});return}if(e.streamId){this.#n(e);return}n(e.data)}on(e,n){let i=this.actionHandler;if(i[e])throw Error(`There is already an actionName called "${e}"`);i[e]=n}send(e,n,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:n},i)}sendWithPromise(e,n,i){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:n},i)}catch(r){a.reject(r)}return a.promise}sendWithStream(e,n,i,s){let a=this.streamId++,r=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:(p)=>{let m=Promise.withResolvers();return this.streamControllers[a]={controller:p,startCall:m,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:r,targetName:l,action:e,streamId:a,data:n,desiredSize:p.desiredSize},s),m.promise},pull:(p)=>{let m=Promise.withResolvers();return this.streamControllers[a].pullCall=m,c.postMessage({sourceName:r,targetName:l,stream:hs.PULL,streamId:a,desiredSize:p.desiredSize}),m.promise},cancel:(p)=>{Pi(p instanceof Error,"cancel must have a valid reason");let m=Promise.withResolvers();return this.streamControllers[a].cancelCall=m,this.streamControllers[a].isClosed=!0,c.postMessage({sourceName:r,targetName:l,stream:hs.CANCEL,streamId:a,reason:za(p)}),m.promise}},i)}#n(e){let n=e.streamId,i=this.sourceName,s=e.sourceName,a=this.comObj,r=this,l=this.actionHandler[e.action],c={enqueue(p,m=1,g){if(this.isCancelled)return;let y=this.desiredSize;if(this.desiredSize-=m,y>0&&this.desiredSize<=0)this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise;a.postMessage({sourceName:i,targetName:s,stream:hs.ENQUEUE,streamId:n,chunk:p},g)},close(){if(this.isCancelled)return;this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:hs.CLOSE,streamId:n}),delete r.streamSinks[n]},error(p){if(Pi(p instanceof Error,"error must have a valid reason"),this.isCancelled)return;this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:hs.ERROR,streamId:n,reason:za(p)})},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[n]=c,Promise.try(l,e.data,c).then(function(){a.postMessage({sourceName:i,targetName:s,stream:hs.START_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:hs.START_COMPLETE,streamId:n,reason:za(p)})})}#i(e){let n=e.streamId,i=this.sourceName,s=e.sourceName,a=this.comObj,r=this.streamControllers[n],l=this.streamSinks[n];switch(e.stream){case hs.START_COMPLETE:if(e.success)r.startCall.resolve();else r.startCall.reject(za(e.reason));break;case hs.PULL_COMPLETE:if(e.success)r.pullCall.resolve();else r.pullCall.reject(za(e.reason));break;case hs.PULL:if(!l){a.postMessage({sourceName:i,targetName:s,stream:hs.PULL_COMPLETE,streamId:n,success:!0});break}if(l.desiredSize<=0&&e.desiredSize>0)l.sinkCapability.resolve();l.desiredSize=e.desiredSize,Promise.try(l.onPull||Lk).then(function(){a.postMessage({sourceName:i,targetName:s,stream:hs.PULL_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:hs.PULL_COMPLETE,streamId:n,reason:za(p)})});break;case hs.ENQUEUE:if(Pi(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(e.chunk);break;case hs.CLOSE:if(Pi(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,n);break;case hs.ERROR:Pi(r,"error should have stream controller"),r.controller.error(za(e.reason)),this.#s(r,n);break;case hs.CANCEL_COMPLETE:if(e.success)r.cancelCall.resolve();else r.cancelCall.reject(za(e.reason));this.#s(r,n);break;case hs.CANCEL:if(!l)break;let c=za(e.reason);Promise.try(l.onCancel||Lk,c).then(function(){a.postMessage({sourceName:i,targetName:s,stream:hs.CANCEL_COMPLETE,streamId:n,success:!0})},function(p){a.postMessage({sourceName:i,targetName:s,stream:hs.CANCEL_COMPLETE,streamId:n,reason:za(p)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[n];break;default:throw Error("Unexpected stream case")}}async#s(e,n){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[n]}destroy(){this.#e?.abort(),this.#e=null}}class p9{#e=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:e=null,standardFontDataUrl:n=null,wasmUrl:i=null}){this.cMapUrl=e,this.standardFontDataUrl=n,this.wasmUrl=i}async fetch({kind:e,filename:n}){switch(e){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Un(`Not implemented: ${e}`)}let i=this[e];if(!i)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let s=`${i}${n}`;return this._fetch(s,e).catch((a)=>{throw Error(`Unable to load ${this.#e[e]} data at: ${s}`)})}async _fetch(e,n){Un("Abstract method `_fetch` called.")}}class i9 extends p9{async _fetch(e,n){let i=n==="cMapUrl"&&!e.endsWith(".bcmap")?"text":"bytes",s=await l9(e,i);return s instanceof Uint8Array?s:b2(s)}}class m9{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,n){if(e<=0||n<=0)throw Error("Invalid canvas size");let i=this._createCanvas(e,n);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#e})}}reset({canvas:e},n,i){if(!e)throw Error("Canvas is not specified");if(n<=0||i<=0)throw Error("Invalid canvas size");e.width=n,e.height=i}destroy(e){let{canvas:n}=e;if(!n)throw Error("Canvas is not specified");n.width=n.height=0,e.canvas=null,e.context=null}_createCanvas(e,n){Un("Abstract method `_createCanvas` called.")}}class AT extends m9{constructor({ownerDocument:e=globalThis.document,enableHWA:n=!1}){super({enableHWA:n});this._document=e}_createCanvas(e,n){let i=this._document.createElement("canvas");return i.width=e,i.height=n,i}}class g9{addFilter(e){return"none"}addHCMFilter(e,n){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addKnockoutFilter(e=0){return"none"}addHighlightHCMFilter(e,n,i,s,a){return"none"}addSelectionHCMFilter(e,n){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(e=null){return null}destroy(e=!1){}}class CT extends g9{#e;#t;#n;#i;#s;#r;#a=0;constructor({docId:e,ownerDocument:n=globalThis.document}){super();this.#i=e,this.#s=n}get#o(){return this.#t||=new Map}get#l(){return this.#r||=new Map}get#c(){if(!this.#n){let e=this.#s.createElement("div"),{style:n}=e;n.colorScheme="only light",n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;let i=this.#s.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#n=this.#s.createElementNS("http://www.w3.org/2000/svg","defs"),e.append(i),i.append(this.#n),this.#s.body.append(e)}return this.#n}#f(e){if(e.length===1){let c=e[0],p=Array(256);for(let g=0;g<256;g++)p[g]=c[g]/255;let m=p.join(",");return[m,m,m]}let[n,i,s]=e,a=Array(256),r=Array(256),l=Array(256);for(let c=0;c<256;c++)a[c]=n[c]/255,r[c]=i[c]/255,l[c]=s[c]/255;return[a.join(","),r.join(","),l.join(",")]}#h(e){if(this.#e===void 0){this.#e="";let n=this.#s.URL;if(n!==this.#s.baseURI)if(y2(n))vn('#createUrl: ignore "data:"-URL for performance reasons.');else this.#e=tT(n,"")}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let n=this.#o.get(e);if(n)return n;let[i,s,a]=this.#f(e),r=e.length===1?i:`${i}${s}${a}`;if(n=this.#o.get(r),n)return this.#o.set(e,n),n;let l=`g_${this.#i}_transfer_map_${this.#a++}`,c=this.#h(l);this.#o.set(e,c),this.#o.set(r,c);let p=this.#g(l);return this.#p(i,s,a,p),c}addHCMFilter(e,n){let i=`${e}-${n}`,s="base",a=this.#l.get("base");if(a?.key===i)return a.url;if(a)a.filter?.remove(),a.key=i,a.url="none",a.filter=null;else a={key:i,url:"none",filter:null},this.#l.set("base",a);if(!e||!n)return a.url;let r=this.#w(e);e=Ot.makeHexColor(...r);let l=this.#w(n);if(n=Ot.makeHexColor(...l),this.#v(),e==="#000000"&&n==="#ffffff"||e===n)return a.url;let p=Array.from({length:256},(x,I)=>e9(I/255)).join(","),m=`g_${this.#i}_hcm_filter`,g=a.filter=this.#g(m);this.#p(p,p,p,g),this.#m(g);let y=(x,I)=>{let M=r[x]/255,H=l[x]/255,X=Array(I+1);for(let W=0;W<=I;W++)X[W]=M+W/I*(H-M);return X.join(",")};return this.#p(y(0,5),y(1,5),y(2,5),g),a.url=this.#h(m),a.url}addSelectionHCMFilter(e,n){return this.addHighlightHCMFilter("selection",e,n,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(e=null){let n=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();if(n==="none"||!si.platform.isFirefox)return null;return{"backdrop-filter":n,"background-color":"transparent"}}addAlphaFilter(e){let n=this.#o.get(e);if(n)return n;let[i]=this.#f([e]),s=`alpha_${i}`;if(n=this.#o.get(s),n)return this.#o.set(e,n),n;let a=`g_${this.#i}_alpha_map_${this.#a++}`,r=this.#h(a);this.#o.set(e,r),this.#o.set(s,r);let l=this.#g(a);return this.#b(i,l),r}addLuminosityFilter(e){let n=this.#o.get(e||"luminosity");if(n)return n;let i,s;if(e)[i]=this.#f([e]),s=`luminosity_${i}`;else s="luminosity";if(n=this.#o.get(s),n)return this.#o.set(e,n),n;let a=`g_${this.#i}_luminosity_map_${this.#a++}`,r=this.#h(a);this.#o.set(e,r),this.#o.set(s,r);let l=this.#g(a);if(this.#d(l),e)this.#b(i,l);return r}addKnockoutFilter(e=0){let n=e>0?Math.min(1/e,1e6):1e6,i=`knockout_${n}`,s=this.#o.get(i);if(s)return s;let a=`g_${this.#i}_knockout_filter_${this.#a++}`,r=this.#h(a);this.#o.set(i,r);let l=this.#g(a),c=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");l.append(c);let p=this.#s.createElementNS("http://www.w3.org/2000/svg","feFuncA");return p.setAttribute("type","linear"),p.setAttribute("slope",`${n}`),p.setAttribute("intercept","0"),c.append(p),r}addHighlightHCMFilter(e,n,i,s,a){let r=`${n}-${i}-${s}-${a}`,l=this.#l.get(e);if(l?.key===r)return l.url;if(l)l.filter?.remove(),l.key=r,l.url="none",l.filter=null;else l={key:r,url:"none",filter:null},this.#l.set(e,l);if(!n||!i)return l.url;let[c,p]=[n,i].map(this.#w.bind(this)),m=Math.round(0.2126*c[0]+0.7152*c[1]+0.0722*c[2]),g=Math.round(0.2126*p[0]+0.7152*p[1]+0.0722*p[2]),[y,x]=[s,a].map(this.#x.bind(this));if(g<m)[m,g,y,x]=[g,m,x,y];this.#v();let I=(X,W,Y)=>{let te=Array(256),ae=(g-m)/Y,ne=X/255,oe=(W-X)/(255*Y),me=0;for(let be=0;be<=Y;be++){let xe=Math.round(m+be*ae),Oe=ne+be*oe;for(let Fe=me;Fe<=xe;Fe++)te[Fe]=Oe;me=xe+1}for(let be=me;be<256;be++)te[be]=te[me-1];return te.join(",")},M=`g_${this.#i}_hcm_${e}_filter`,H=l.filter=this.#g(M);return this.#m(H),this.#p(I(y[0],x[0],5),I(y[1],x[1],5),I(y[2],x[2],5),H),l.url=this.#h(M),l.url}destroy(e=!1){if(e&&this.#r?.size)return;this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#r?.clear(),this.#r=null,this.#a=0}#d(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(n)}#m(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(n)}#g(e){let n=this.#s.createElementNS("http://www.w3.org/2000/svg","filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),this.#c.append(n),n}#u(e,n,i){let s=this.#s.createElementNS("http://www.w3.org/2000/svg",n);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),e.append(s)}#p(e,n,i,s){let a=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");s.append(a),this.#u(a,"feFuncR",e),this.#u(a,"feFuncG",n),this.#u(a,"feFuncB",i)}#b(e,n){let i=this.#s.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer");n.append(i),this.#u(i,"feFuncA",e)}#w(e){return this.#c.style.color="CanvasText",this.#c.style.backgroundColor=e,fm(getComputedStyle(this.#c).getPropertyValue("background-color"))}#y(e){return this.#c.style.color="CanvasText",this.#c.style.backgroundColor=e,hm(getComputedStyle(this.#c).getPropertyValue("background-color"))}#v(){this.#c.style.color="",this.#c.style.backgroundColor=""}#x(e){let[n,i,s,a]=this.#y(e);if(a===1)return[n,i,s];let[r,l,c]=this.#w("Canvas");return[X3(n,r,a),X3(i,l,a),X3(s,c,a)]}}function X3(e,n,i){return Math.round(i*e+(1-i)*n)}if(ur)vn("Please use the `legacy` build in Node.js environments.");async function nL(e){let i=await process.getBuiltinModule("fs/promises").readFile(e);return new Uint8Array(i)}class jT extends g9{}class ET extends m9{_createCanvas(e,n){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,n)}}class qT extends p9{async _fetch(e,n){return nL(e)}}function DT({src:e,srcPos:n=0,dest:i,width:s,height:a,nonBlackColor:r=4294967295,inverseDecode:l=!1}){let c=si.isLittleEndian?4278190080:255,[p,m]=l?[r,c]:[c,r],g=s>>3,y=s&7,x=p^m,I=e.length;i=new Uint32Array(i.buffer);let M=0;for(let H=0;H<a;++H){for(let W=n+g;n<W;++n,M+=8){let Y=e[n];i[M]=p^-(Y>>7&1)&x,i[M+1]=p^-(Y>>6&1)&x,i[M+2]=p^-(Y>>5&1)&x,i[M+3]=p^-(Y>>4&1)&x,i[M+4]=p^-(Y>>3&1)&x,i[M+5]=p^-(Y>>2&1)&x,i[M+6]=p^-(Y>>1&1)&x,i[M+7]=p^-(Y&1)&x}if(y===0)continue;let X=n<I?e[n++]:255;for(let W=0;W<y;++W,++M)i[M]=p^-(X>>7-W&1)&x}return{srcPos:n,destPos:M}}function iL({src:e,srcPos:n=0,dest:i,destPos:s=0,width:a,height:r}){let l=0,c=a*r*3,p=c>>2,m=new Uint32Array(e.buffer,n,p),g=si.isLittleEndian?4278190080:255;if(si.isLittleEndian){for(;l<p-2;l+=3,s+=4){let y=m[l],x=m[l+1],I=m[l+2];i[s]=y|g,i[s+1]=y>>>24|x<<8|g,i[s+2]=x>>>16|I<<16|g,i[s+3]=I>>>8|g}for(let y=l*4,x=n+c;y<x;y+=3)i[s++]=e[y]|e[y+1]<<8|e[y+2]<<16|g}else{for(;l<p-2;l+=3,s+=4){let y=m[l],x=m[l+1],I=m[l+2];i[s]=y|g,i[s+1]=y<<24|x>>>8|g,i[s+2]=x<<16|I>>>16|g,i[s+3]=I<<8|g}for(let y=l*4,x=n+c;y<x;y+=3)i[s++]=e[y]<<24|e[y+1]<<16|e[y+2]<<8|g}return{srcPos:n+c,destPos:s}}var sL=`
|
|
246
|
+
struct Uniforms {
|
|
247
|
+
offsetX : f32,
|
|
248
|
+
offsetY : f32,
|
|
249
|
+
scaleX : f32,
|
|
250
|
+
scaleY : f32,
|
|
251
|
+
paddedWidth : f32,
|
|
252
|
+
paddedHeight : f32,
|
|
253
|
+
borderSize : f32,
|
|
254
|
+
_pad : f32,
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
@group(0) @binding(0) var<uniform> u : Uniforms;
|
|
258
|
+
|
|
259
|
+
struct VertexInput {
|
|
260
|
+
@location(0) position : vec2<f32>,
|
|
261
|
+
@location(1) color : vec4<f32>,
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
struct VertexOutput {
|
|
265
|
+
@builtin(position) position : vec4<f32>,
|
|
266
|
+
@location(0) color : vec3<f32>,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
@vertex
|
|
270
|
+
fn vs_main(in : VertexInput) -> VertexOutput {
|
|
271
|
+
var out : VertexOutput;
|
|
272
|
+
let cx = (in.position.x + u.offsetX) * u.scaleX;
|
|
273
|
+
let cy = (in.position.y + u.offsetY) * u.scaleY;
|
|
274
|
+
out.position = vec4<f32>(
|
|
275
|
+
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
|
|
276
|
+
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
|
|
277
|
+
0.0,
|
|
278
|
+
1.0
|
|
279
|
+
);
|
|
280
|
+
out.color = in.color.rgb;
|
|
281
|
+
return out;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@fragment
|
|
285
|
+
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
286
|
+
return vec4<f32>(in.color, 1.0);
|
|
287
|
+
}
|
|
288
|
+
`;class IT{#e=null;#t=null;#n=null;#i=null;async#s(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();if(!e)return!1;return this.#i=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0}catch{return!1}}init(){return this.#e||=this.#s()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:sL});this.#n=this.#t.createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:e,entryPoint:"fs_main",targets:[{format:this.#i}]},primitive:{topology:"triangle-list"}})}draw(e,n,i,s,a,r,l,c){this.loadMeshShader();let p=this.#t,{offsetX:m,offsetY:g,scaleX:y,scaleY:x}=s,I=p.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(e.byteLength>0)p.queue.writeBuffer(I,0,e);let M=p.createBuffer({size:Math.max(n.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});if(n.byteLength>0)p.queue.writeBuffer(M,0,n);let H=p.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});p.queue.writeBuffer(H,0,new Float32Array([m,g,y,x,r,l,c,0]));let X=p.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:H}}]}),W=new OffscreenCanvas(r,l),Y=W.getContext("webgpu");Y.configure({device:p,format:this.#i,alphaMode:a?"opaque":"premultiplied"});let te=a?{r:a[0]/255,g:a[1]/255,b:a[2]/255,a:1}:{r:0,g:0,b:0,a:0},ae=p.createCommandEncoder(),ne=ae.beginRenderPass({colorAttachments:[{view:Y.getCurrentTexture().createView(),clearValue:te,loadOp:"clear",storeOp:"store"}]});if(i>0)ne.setPipeline(this.#n),ne.setBindGroup(0,X),ne.setVertexBuffer(0,I),ne.setVertexBuffer(1,M),ne.draw(i);return ne.end(),p.queue.submit([ae.finish()]),I.destroy(),M.destroy(),H.destroy(),W.transferToImageBitmap()}}var S2=new IT;function aL(){return S2.init()}function rL(){return S2.isReady}function oL(){S2.loadMeshShader()}function lL(e,n,i,s,a,r,l,c){return S2.draw(e,n,i,s,a,r,l,c)}var Ws={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function n2(e,n){if(!n)return;let i=n[2]-n[0],s=n[3]-n[1],a=new Path2D;a.rect(n[0],n[1],i,s),e.clip(a)}class _2{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){Un("Abstract method `getPattern` called.")}}class MT extends _2{constructor(e){super();this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,n=null){let i,s=this._p0,a=this._p1;if(n)s=s.slice(),a=a.slice(),Ot.applyTransform(s,n),Ot.applyTransform(a,n);if(this._type==="axial")i=e.createLinearGradient(s[0],s[1],a[0],a[1]);else if(this._type==="radial"){let r=this._r0,l=this._r1;if(n){let c=new Float32Array(2);Ot.singularValueDecompose2dScale(n,c),r*=c[0],l*=c[0]}i=e.createRadialGradient(s[0],s[1],r,a[0],a[1],l)}for(let r of this._colorStops)i.addColorStop(r[0],r[1]);return i}_createReversedGradient(e,n=null){let i=this._p1,s=this._p0;if(n)i=i.slice(),s=s.slice(),Ot.applyTransform(i,n),Ot.applyTransform(s,n);let a=this._r1,r=this._r0;if(n){let p=new Float32Array(2);Ot.singularValueDecompose2dScale(n,p),a*=p[0],r*=p[0]}let l=e.createRadialGradient(i[0],i[1],a,s[0],s[1],r),c=this._colorStops.map(([p,m])=>[1-p,m]).reverse();for(let[p,m]of c)l.addColorStop(p,m);return l}getPattern(e,n,i,s){let a;if(s===Ws.STROKE||s===Ws.FILL){if(this.isOriginBased()){let y=Ot.transform(i,n.baseTransform);if(this.matrix)y=Ot.transform(y,this.matrix);let x=0.001,I=Math.hypot(y[0],y[1]),M=Math.hypot(y[2],y[3]),H=(y[0]*y[2]+y[1]*y[3])/(I*M);if(Math.abs(H)<x)if(this.isRadial()){if(Math.abs(I-M)<x)return this._createGradient(e,y)}else return this._createGradient(e,y)}let r=n.current.getClippedPathBoundingBox(s,bi(e))||[0,0,0,0],l=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,p=n.canvasFactory.create(l,c),m=p.context;if(m.clearRect(0,0,m.canvas.width,m.canvas.height),m.beginPath(),m.rect(0,0,m.canvas.width,m.canvas.height),m.translate(-r[0],-r[1]),i=Ot.transform(i,[1,0,0,1,r[0],r[1]]),m.transform(...n.baseTransform),this.matrix)m.transform(...this.matrix);if(n2(m,this._bbox),this.areConic())m.fillStyle=this._createReversedGradient(m),m.fill();m.fillStyle=this._createGradient(m),m.fill(),a=e.createPattern(p.canvas,"no-repeat"),n.canvasFactory.destroy(p);let g=new DOMMatrix(i);a.setTransform(g)}else{if(this.areConic())e.save(),n2(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-10000000000,-10000000000,20000000000,20000000000),e.restore();n2(e,this._bbox),a=this._createGradient(e)}return a}}function cL(e,n,i,s,a,r,l,c){let{coords:p,colors:m}=n,g=e.data,y=e.width*4,x;if(p[i*2+1]>p[s*2+1])x=i,i=s,s=x,x=r,r=l,l=x;if(p[s*2+1]>p[a*2+1])x=s,s=a,a=x,x=l,l=c,c=x;if(p[i*2+1]>p[s*2+1])x=i,i=s,s=x,x=r,r=l,l=x;let I=(p[i*2]+n.offsetX)*n.scaleX,M=(p[i*2+1]+n.offsetY)*n.scaleY,H=(p[s*2]+n.offsetX)*n.scaleX,X=(p[s*2+1]+n.offsetY)*n.scaleY,W=(p[a*2]+n.offsetX)*n.scaleX,Y=(p[a*2+1]+n.offsetY)*n.scaleY;if(M>=Y)return;let te=m[r*4],ae=m[r*4+1],ne=m[r*4+2],oe=m[l*4],me=m[l*4+1],be=m[l*4+2],xe=m[c*4],Oe=m[c*4+1],Fe=m[c*4+2],Ue=Math.round(M),ze=Math.round(Y),Le,qe,Me,yt,Ge,Qe,jt,ut;for(let st=Ue;st<=ze;st++){if(st<X){let Zt=st<M?0:(M-st)/(M-X);Le=I-(I-H)*Zt,qe=te-(te-oe)*Zt,Me=ae-(ae-me)*Zt,yt=ne-(ne-be)*Zt}else{let Zt;if(st>Y)Zt=1;else if(X===Y)Zt=0;else Zt=(X-st)/(X-Y);Le=H-(H-W)*Zt,qe=oe-(oe-xe)*Zt,Me=me-(me-Oe)*Zt,yt=be-(be-Fe)*Zt}let bt;if(st<M)bt=0;else if(st>Y)bt=1;else bt=(M-st)/(M-Y);Ge=I-(I-W)*bt,Qe=te-(te-xe)*bt,jt=ae-(ae-Oe)*bt,ut=ne-(ne-Fe)*bt;let Wt=Math.round(Math.min(Le,Ge)),un=Math.round(Math.max(Le,Ge)),nn=y*st+Wt*4;for(let Zt=Wt;Zt<=un;Zt++){if(bt=(Le-Zt)/(Le-Ge),bt<0)bt=0;else if(bt>1)bt=1;g[nn++]=qe-(qe-Qe)*bt|0,g[nn++]=Me-(Me-jt)*bt|0,g[nn++]=yt-(yt-ut)*bt|0,g[nn++]=255}}}class RT extends _2{constructor(e){super();this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],oL()}_createMeshCanvas(e,n,i){let l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),p=Math.ceil(this._bounds[2])-l,m=Math.ceil(this._bounds[3])-c,g=Math.min(Math.ceil(Math.abs(p*e[0]*1.1)),3000)||1,y=Math.min(Math.ceil(Math.abs(m*e[1]*1.1)),3000)||1,x=p?p/g:1,I=m?m/y:1,M={coords:this._posData,colors:this._colData,offsetX:-l,offsetY:-c,scaleX:1/x,scaleY:1/I},H=g+4,X=y+4,W=i.create(H,X);if(rL()&&this._vertexCount>48)W.context.drawImage(lL(this._posData,this._colData,this._vertexCount,M,n,H,X,2),0,0);else{let Y=W.context.createImageData(g,y);if(n){let te=Y.data;for(let ae=0,ne=te.length;ae<ne;ae+=4)te[ae]=n[0],te[ae+1]=n[1],te[ae+2]=n[2],te[ae+3]=255}for(let te=0,ae=this._vertexCount;te<ae;te+=3)cL(Y,M,te,te+1,te+2,te,te+1,te+2);W.context.putImageData(Y,2,2)}return{canvas:W.canvas,offsetX:l-2*x,offsetY:c-2*I,scaleX:x,scaleY:I}}isModifyingCurrentTransform(){return!0}getPattern(e,n,i,s){n2(e,this._bbox);let a=new Float32Array(2);if(s===Ws.SHADING)Ot.singularValueDecompose2dScale(bi(e),a);else if(this.matrix){Ot.singularValueDecompose2dScale(this.matrix,a);let[c,p]=a;Ot.singularValueDecompose2dScale(n.baseTransform,a),a[0]*=c,a[1]*=p}else Ot.singularValueDecompose2dScale(n.baseTransform,a);let r=this._createMeshCanvas(a,s===Ws.SHADING?null:this._background,n.canvasFactory);if(s!==Ws.SHADING){if(e.setTransform(...n.baseTransform),this.matrix)e.transform(...this.matrix)}e.translate(r.offsetX,r.offsetY),e.scale(r.scaleX,r.scaleY);let l=e.createPattern(r.canvas,"no-repeat");return n.canvasFactory.destroy(r),l}}class OT extends _2{getPattern(){return"hotpink"}}function uL(e){switch(e[0]){case"RadialAxial":return new MT(e);case"Mesh":return new RT(e);case"Dummy":return new OT}throw Error(`Unknown IR type: ${e[0]}`)}var Hk={COLORED:1,UNCOLORED:2};class nm{static MAX_PATTERN_SIZE=3000;constructor(e,n,i,s){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=n,this.canvasGraphicsFactory=i,this.baseTransform=s,this.patternBaseMatrix=this.matrix?Ot.transform(s,this.matrix):s}canSkipPatternCanvas([e,n,i,s]){let[a,r,l,c]=this.bbox,p=Math.abs(this.xstep),m=Math.abs(this.ystep);if(e>p+0.000001||n>m+0.000001)return null;let g=Math.floor((i-l)/p)+1,y=Math.ceil((i+e-a)/p)-1,x=Math.floor((s-c)/m)+1,I=Math.ceil((s+n-r)/m)-1;return y<=g&&I<=x?[g,x]:null}updatePatternDims(e,n){let i=Ot.inverseTransform(this.patternBaseMatrix),s=[e[0],e[1]],a=[e[2],e[3]];Ot.applyTransform(s,i),Ot.applyTransform(a,i),n[0]=Math.abs(a[0]-s[0]),n[1]=Math.abs(a[1]-s[1]),n[2]=Math.min(s[0],a[0]),n[3]=Math.min(s[1],a[1])}_renderTileCanvas(e,n,i,s){let[a,r,l,c]=this.bbox,p=e.canvasFactory.create(i.size,s.size),m=p.context,g=this.canvasGraphicsFactory.createCanvasGraphics(m,n);return g.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(g,this.paintType,this.color),m.translate(-i.scale*a,-s.scale*r),g.transform(0,i.scale,0,0,s.scale,0,0),m.save(),g.dependencyTracker?.save(),this.clipBbox(g,a,r,l,c),g.baseTransform=bi(g.ctx),g.executeOperatorList(this.operatorList),g.endDrawing(),g.dependencyTracker?.restore(),m.restore(),p}_getCombinedScales(){let e=new Float32Array(2);Ot.singularValueDecompose2dScale(this.matrix,e);let[n,i]=e;return Ot.singularValueDecompose2dScale(this.baseTransform,e),[n*e[0],i*e[1]]}drawPattern(e,n,i=!1,[s,a],r){let[l,c,p,m]=this.bbox,g=e.dependencyTracker;if(g)e.dependencyTracker=new rm(g,r);if(e.save(),i)e.ctx.clip(n,"evenodd");else e.ctx.clip(n);if(e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(s*this.xstep,a*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!=="source-over"||e.inSMaskMode){let y=p-l,x=m-c,[I,M]=this._getCombinedScales(),H=this.getSizeAndScale(y,this.ctx.canvas.width,I),X=this.getSizeAndScale(x,this.ctx.canvas.height,M),W=this._renderTileCanvas(e,r,H,X);e.ctx.drawImage(W.canvas,l,c,y,x),e.canvasFactory.destroy(W)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,l,c,p,m),e.baseTransformStack.push(e.baseTransform),e.baseTransform=bi(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();if(e.restore(),g)e.dependencyTracker=g}createPatternCanvas(e,n){let[i,s,a,r]=this.bbox,l=a-i,c=r-s,{xstep:p,ystep:m}=this;p=Math.abs(p),m=Math.abs(m),g2("TilingType: "+this.tilingType);let[g,y]=this._getCombinedScales(),x=l,I=c,M=!1,H=!1;if(Math.ceil(p*g)>=Math.ceil(l*g))x=p;else M=!0;if(Math.ceil(m*y)>=Math.ceil(c*y))I=m;else H=!0;let X=this.getSizeAndScale(x,this.ctx.canvas.width,g),W=this.getSizeAndScale(I,this.ctx.canvas.height,y),Y=this._renderTileCanvas(e,n,X,W);if(M||H){let te=Y.canvas;if(M)x=p;if(H)I=m;let ae=this.getSizeAndScale(x,this.ctx.canvas.width,g),ne=this.getSizeAndScale(I,this.ctx.canvas.height,y),oe=ae.size,me=ne.size,be=e.canvasFactory.create(oe,me),xe=be.context,Oe=M?Math.floor(l/p):0,Fe=H?Math.floor(c/m):0;for(let Ue=0;Ue<=Oe;Ue++)for(let ze=0;ze<=Fe;ze++)xe.drawImage(te,oe*Ue,me*ze,oe,me,0,0,oe,me);return e.canvasFactory.destroy(Y),{canvas:be.canvas,canvasEntry:be,scaleX:ae.scale,scaleY:ne.scale,offsetX:i,offsetY:s}}return{canvas:Y.canvas,canvasEntry:Y,scaleX:X.scale,scaleY:W.scale,offsetX:i,offsetY:s}}getSizeAndScale(e,n,i){let s=Math.max(nm.MAX_PATTERN_SIZE,n),a=Math.ceil(e*i);if(a>=s)a=s;else i=a/e;return{scale:i,size:a}}clipBbox(e,n,i,s,a){let r=s-n,l=a-i,c=new Path2D;c.rect(n,i,r,l),Ot.axialAlignedBoundingBox([n,i,s,a],bi(e.ctx),e.current.minMax),e.ctx.clip(c),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,n,i){let{ctx:s,current:a}=e;switch(a.patternFill=a.patternStroke=!1,n){case Hk.COLORED:let{fillStyle:r,strokeStyle:l}=this.ctx;s.fillStyle=a.fillColor=r,s.strokeStyle=a.strokeColor=l;break;case Hk.UNCOLORED:s.fillStyle=s.strokeStyle=i,a.fillColor=a.strokeColor=i;break;default:throw new nT(`Unsupported paint type: ${n}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,n,i,s,a){let r=s!==Ws.SHADING?Ot.transform(i,this.patternBaseMatrix):i,l=this.createPatternCanvas(n,a),c=new DOMMatrix(r);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);let p=e.createPattern(l.canvas,"repeat");return n.canvasFactory.destroy(l.canvasEntry),p.setTransform(c),p}}var hL=16,fL=100,dL=15,Uk=10,Ga=16,fr=new Float32Array(2);function zk(e,n){if(e._removeMirroring)throw Error("Context is already forwarding operations.");let i=new Map;for(let s of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){let a=e[s];if(typeof a!=="function"||typeof n[s]!=="function")continue;i.set(s,a),e[s]=function(...r){return n[s](...r),a.apply(this,r)}}e._removeMirroring=()=>{for(let[s,a]of i)e[s]=a;delete e._removeMirroring}}function Kb(e,n,i,s,a,r,l,c,p,m){let[g,y,x,I,M,H]=bi(e);if(y===0&&x===0){let Y=l*g+M,te=Math.round(Y),ae=c*I+H,ne=Math.round(ae),oe=(l+p)*g+M,me=Math.abs(Math.round(oe)-te)||1,be=(c+m)*I+H,xe=Math.abs(Math.round(be)-ne)||1;return e.setTransform(Math.sign(g),0,0,Math.sign(I),te,ne),e.drawImage(n,i,s,a,r,0,0,me,xe),e.setTransform(g,y,x,I,M,H),[me,xe]}if(g===0&&I===0){let Y=c*x+M,te=Math.round(Y),ae=l*y+H,ne=Math.round(ae),oe=(c+m)*x+M,me=Math.abs(Math.round(oe)-te)||1,be=(l+p)*y+H,xe=Math.abs(Math.round(be)-ne)||1;return e.setTransform(0,Math.sign(y),Math.sign(x),0,te,ne),e.drawImage(n,i,s,a,r,0,0,xe,me),e.setTransform(g,y,x,I,M,H),[xe,me]}e.drawImage(n,i,s,a,r,l,c,p,m);let X=Math.hypot(g,y),W=Math.hypot(x,I);return[X*p,W*m]}class s9{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=K3;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=ms.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=Ah.slice();constructor(e,n){this.clipBox=new Float32Array([0,0,e,n])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=Ws.FILL,n=null){let i=this.minMax.slice();if(e===Ws.STROKE){if(!n)Un("Stroke bounding box must include transform.");Ot.singularValueDecompose2dScale(n,fr);let s=fr[0]*this.lineWidth/2,a=fr[1]*this.lineWidth/2;i[0]-=s,i[1]-=a,i[2]+=s,i[3]+=a}return i}updateClipFromPath(){let e=Ot.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(Ah,0)}getClippedPathBoundingBox(e=Ws.FILL,n=null){return Ot.intersect(this.clipBox,this.getPathBoundingBox(e,n))}}function Gk(e,n){let{width:i,height:s,kind:a}=n,r=s%Ga,l=(s-r)/Ga,c=r===0?l:l+1,p=e.createImageData(i,Ga),m=0,g=n.data,y=p.data,x;if(a===e2.GRAYSCALE_1BPP)for(x=0;x<c;x++)({srcPos:m}=DT({src:g,srcPos:m,dest:y,width:i,height:x<l?Ga:r})),e.putImageData(p,0,x*Ga);else if(a===e2.RGBA_32BPP){let I=0,M=i*Ga*4;for(x=0;x<l;x++)y.set(g.subarray(m,m+M)),m+=M,e.putImageData(p,0,I),I+=Ga;if(x<c)M=i*r*4,y.set(g.subarray(m,m+M)),e.putImageData(p,0,I)}else if(a===e2.RGB_24BPP)for(x=0;x<c;x++)({srcPos:m}=iL({src:g,srcPos:m,dest:new Uint32Array(y.buffer),width:i,height:x<l?Ga:r})),e.putImageData(p,0,x*Ga);else throw Error(`bad image kind: ${a}`)}function Vk(e,n){if(n.bitmap){e.drawImage(n.bitmap,0,0);return}let{width:i,height:s}=n,a=s%Ga,r=(s-a)/Ga,l=a===0?r:r+1,c=e.createImageData(i,Ga),p=0,m=n.data,g=c.data;for(let y=0;y<l;y++)({srcPos:p}=DT({src:m,srcPos:p,dest:g,width:i,height:y<r?Ga:a,nonBlackColor:0})),e.putImageData(c,0,y*Ga)}function xh(e,n){let i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let s of i)if(e[s]!==void 0)n[s]=e[s];if(e.setLineDash!==void 0)n.setLineDash(e.getLineDash()),n.lineDashOffset=e.lineDashOffset}function $b(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0)e.setLineDash([]),e.lineDashOffset=0;let{filter:n}=e;if(n!=="none"&&n!=="")e.filter="none"}function Xk(e,n){if(n)return!0;Ot.singularValueDecompose2dScale(e,fr);let i=Math.fround(co.pixelRatio*Eh.PDF_TO_CSS_UNITS);return fr[0]<=i&&fr[1]<=i}var pL=["butt","round","square"],mL=["miter","round","bevel"],gL={},Wk={};class jh{static#e=null;#t=0;#n=0;#i=null;#s=null;#r=null;#a=null;#o=1;#l;#c=null;#f=[];constructor(e,n,i,s,a,{optionalContentConfig:r,markedContentStack:l=null},c,p,m,g){this.ctx=e,this.current=new s9(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=n,this.objs=i,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=r,this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=p,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=m??null,this.imagesTracker=g??null}getObject(e,n,i=null){if(typeof n==="string")return this.dependencyTracker?.recordNamedDependency(e,n),n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);return i}beginDrawing({transform:e,viewport:n,transparency:i=!1,background:s=null}){let a=this.ctx.canvas.width,r=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=l,i){let c=this.transparentCanvasEntry=this.canvasFactory.create(a,r);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=c,this.ctx.save(),this.ctx.transform(...bi(this.compositeCtx))}if(this.ctx.save(),$b(this.ctx),e)this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3];this.ctx.transform(...n.transform),this.viewportScale=n.scale,this.baseTransform=bi(this.ctx)}executeOperatorList(e,n,i,s,a){let{argsArray:r,fnArray:l}=e,c=n||0,p=r.length;if(p===c)return c;let m=p-c>Uk&&typeof i==="function",g=m?Date.now()+dL:0,y=0,x=this.commonObjs,I=this.objs,M,H;while(!0){if(s!==void 0){if(c===s.nextBreakPoint)return s.breakIt(c,i),c;if(s.shouldSkip(c)){if(++c===p)return c;continue}}if(!a||a(c))if(M=l[c],H=r[c]??null,M!==Zo.dependency)if(H===null)this[M](c);else this[M](c,...H);else for(let X of H){this.dependencyTracker?.recordNamedData(X,c);let W=X.startsWith("g_")?x:I;if(!W.has(X))return W.get(X,i),c}if(c++,c===p)return c;if(m&&++y>Uk){if(Date.now()>g)return i(),c;y=0}}}#h(){while(this.stateStack.length||this.inSMaskMode)this.restore();if(this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas)this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null}endDrawing(){this.#h();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#f)this.#v(e);this.#f.length=0,this.#i=null,this.#s=null,this.#r=null,this.#a=null,this.#o=1,this.#c=null,this.#n=0,this.#t=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let n of e.values())if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement)n.width=n.height=0;e.clear()}this._cachedBitmapsMap.clear(),this.#d()}#d(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){let n=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=n}}}_scaleImage(e,n){let i=e.width??e.displayWidth,s=e.height??e.displayHeight,a=Math.max(Math.hypot(n[0],n[1]),1),r=Math.max(Math.hypot(n[2],n[3]),1),l=[],c=a,p=r,m=i,g=s;while(c>2&&m>1||p>2&&g>1){let X=m,W=g;if(c>2&&m>1)X=Math.ceil(m/2),c/=m/X;if(p>2&&g>1)W=Math.ceil(g/2),p/=g/W;l.push({newWidth:X,newHeight:W}),m=X,g=W}if(l.length===0)return{img:e,paintWidth:i,paintHeight:s,tmpCanvas:null};if(l.length===1){let{newWidth:X,newHeight:W}=l[0],Y=this.canvasFactory.create(X,W);return Y.context.drawImage(e,0,0,i,s,0,0,X,W),{img:Y.canvas,paintWidth:X,paintHeight:W,tmpCanvas:Y}}let y=this.canvasFactory.create(1,1),x=this.canvasFactory.create(1,1),I=i,M=s,H=e;for(let{newWidth:X,newHeight:W}of l)this.canvasFactory.reset(x,X,W),x.context.drawImage(H,0,0,I,M,0,0,X,W),[y,x]=[x,y],H=y.canvas,I=X,M=W;return this.canvasFactory.destroy(x),{img:y.canvas,paintWidth:I,paintHeight:M,tmpCanvas:y}}_createMaskCanvas(e,n){let i=this.ctx,{width:s,height:a}=n,r=this.current.fillColor,l=this.current.patternFill,c=bi(i),p,m,g,y;if((n.bitmap||n.data)&&n.count>1){let Oe=n.bitmap||n.data.buffer;m=JSON.stringify(l?c:[c.slice(0,4),r]),p=this._cachedBitmapsMap.getOrInsertComputed(Oe,r9);let Fe=p.get(m);if(Fe&&!l){let Ue=Math.round(Math.min(c[0],c[2])+c[4]),ze=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(e,Ur.transformAndFill),{canvas:Fe,offsetX:Ue,offsetY:ze}}g=Fe}if(!g)y=this.canvasFactory.create(s,a),Vk(y.context,n);let x=Ot.transform(c,[1/s,0,0,-1/a,0,0]);x=Ot.transform(x,[1,0,0,1,0,-a]);let I=Ah.slice();Ot.axialAlignedBoundingBox([0,0,s,a],x,I);let[M,H,X,W]=I,Y=Math.round(X-M)||1,te=Math.round(W-H)||1,ae=this.canvasFactory.create(Y,te),ne=ae.context,oe=M,me=H;ne.translate(-oe,-me),ne.transform(...x);let be=null;if(!g){let Oe=this._scaleImage(y.canvas,Yo(ne));if(g=Oe.img,be=Oe.tmpCanvas,g!==y.canvas)this.canvasFactory.destroy(y),y=null;if(p&&l)p.set(m,g),be=null,y=null}if(ne.imageSmoothingEnabled=Xk(bi(ne),n.interpolate),Kb(ne,g,0,0,g.width,g.height,0,0,s,a),be)this.canvasFactory.destroy(be);if(y)this.canvasFactory.destroy(y);ne.globalCompositeOperation="source-in";let xe=Ot.transform(Yo(ne),[1,0,0,1,-oe,-me]);if(ne.fillStyle=l?r.getPattern(i,this,xe,Ws.FILL,e):r,ne.fillRect(0,0,s,a),p&&!l)p.set(m,ae.canvas);return this.dependencyTracker?.recordDependencies(e,Ur.transformAndFill),{canvas:ae.canvas,canvasEntry:p&&!l?null:ae,offsetX:Math.round(oe),offsetY:Math.round(me)}}setLineWidth(e,n){if(this.dependencyTracker?.recordSimpleData("lineWidth",e),n!==this.current.lineWidth)this._cachedScaleForStroking[0]=-1;this.current.lineWidth=n,this.ctx.lineWidth=n}setLineCap(e,n){this.dependencyTracker?.recordSimpleData("lineCap",e),this.ctx.lineCap=pL[n]}setLineJoin(e,n){this.dependencyTracker?.recordSimpleData("lineJoin",e),this.ctx.lineJoin=mL[n]}setMiterLimit(e,n){this.dependencyTracker?.recordSimpleData("miterLimit",e),this.ctx.miterLimit=n}setDash(e,n,i){this.dependencyTracker?.recordSimpleData("dash",e);let s=this.ctx;if(s.setLineDash!==void 0)s.setLineDash(n),s.lineDashOffset=i}setRenderingIntent(e,n){}setFlatness(e,n){}setGState(e,n){for(let[i,s]of n)switch(i){case"LW":this.setLineWidth(e,s);break;case"LC":this.setLineCap(e,s);break;case"LJ":this.setLineJoin(e,s);break;case"ML":this.setMiterLimit(e,s);break;case"D":this.setDash(e,s[0],s[1]);break;case"RI":this.setRenderingIntent(e,s);break;case"FL":this.setFlatness(e,s);break;case"Font":this.setFont(e,s[0],s[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=s;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=s;break;case"SMask":if(this.dependencyTracker?.recordSimpleData("SMask",e),this.current.activeSMask=s?this.tempSMask:null,this.current.activeSMask)this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation;this.tempSMask=null,this.checkSMaskState(e);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){if(this.smaskPreparedEntry)this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null;this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){if(e===this.smaskPreparedFor)return;this._clearPreparedSMask(),this._prepareSMaskCanvas(e)}checkSMaskState(e){let n=this.inSMaskMode;if(this.current.activeSMask&&!n)this.beginSMaskMode(e);else if(!this.current.activeSMask&&n)this.endSMaskMode();else if(this.current.activeSMask&&n)this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:n,subtype:i,backdrop:s,transferMap:a}=e,r=i==="Luminosity"||i==="Alpha"&&a;if(!r&&!(i==="Luminosity"&&s)){this.smaskPreparedFor=e;return}let l;if(i==="Luminosity"&&s){let[W,Y,te]=hm(s),ae=Math.round(0.3*W+0.59*Y+0.11*te);l=a?.[ae]??ae}else l=a?.[0]??0;let c=4,{width:p,height:m}=this.ctx.canvas,g=n.width*n.height,y=p*m<c*g,x=r?{url:i==="Alpha"?this.filterFactory.addAlphaFilter(a):this.filterFactory.addLuminosityFilter(a),subtype:i,transferMap:a}:null,I=i==="Luminosity"?s:null,M,H,X;if(y)M=this._bakeSMaskCanvas(n,e.offsetX,e.offsetY,p,m,I,x),H=0,X=0;else M=this._bakeSMaskCanvas(n,0,0,n.width,n.height,I,x),H=e.offsetX,X=e.offsetY;this.smaskPreparedEntry=M,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=H,this.smaskPreparedOffsetY=X,this.smaskPreparedOOBAlpha=!y&&l!==0?l:null}_bakeSMaskCanvas(e,n,i,s,a,r,l){if(!r&&!l)Un("_bakeSMaskCanvas with neither backdrop nor filter");let c=this.canvasFactory.create(s,a),p=c.context;if(p.drawImage(e,n,i),r)p.globalCompositeOperation="destination-atop",p.fillStyle=r,p.fillRect(0,0,s,a);if(!l)return c;let m=this.canvasFactory.create(s,a),g=m.context;g.filter=l.url;let y=si.isCanvasFilterSupported&&g.filter!=="none"&&g.filter!=="";if(g.drawImage(c.canvas,0,0),si.isCanvasFilterSupported)g.filter="none";if(!y){let x=g.getImageData(0,0,s,a),{data:I}=x,{transferMap:M}=l;if(l.subtype==="Luminosity")for(let H=0,X=I.length;H<X;H+=4){let W=0.3*I[H]+0.59*I[H+1]+0.11*I[H+2]+0.5|0;I[H]=I[H+1]=I[H+2]=0,I[H+3]=M?.[W]??W}else for(let H=3,X=I.length;H<X;H+=4)I[H]=M[I[H]];g.putImageData(x,0,0)}return this.canvasFactory.destroy(c),m}beginSMaskMode(e){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let{width:n,height:i}=this.ctx.canvas,s=this.canvasFactory.create(n,i);this.smaskScratchCanvas=s,this.suspendedCtx=this.ctx;let a=this.ctx=s.context;a.setTransform(this.suspendedCtx.getTransform()),xh(this.suspendedCtx,a),zk(a,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),xh(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#m(e,n=null,i=1){let{width:s,height:a}=e,r=n??this.canvasFactory.create(s,a),l=r.context;i=Math.round(i*255)/255;let c=i<1;if(c&&this.#l===void 0)this.#l=si.isCanvasFilterSupported?new Map:"none";let p="none";if(c&&this.#l instanceof Map)p=this.#l.getOrInsertComputed(i,()=>this.filterFactory.addKnockoutFilter(i));if(!c||p!=="none"){if(n)l.save(),l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,s,a),l.restore();return l.filter=p,l.drawImage(e,0,0),l.filter="none",r}let m=e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,s,a),g=l.createImageData(s,a),y=m.data,x=g.data,I=i>0?1/i:1e6;for(let M=3,H=y.length;M<H;M+=4)x[M]=Math.min(Math.round(y[M]*I),255);return l.putImageData(g,0,0),r}#g(e,n,i,s){let a=e?.[n]??null;if(a&&(a.canvas.width!==i||a.canvas.height!==s))this.canvasFactory.destroy(a),a=null;if(!a){if(a=this.canvasFactory.create(i,s),e)e[n]=a;return a}let r=a.context;return r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,i,s),r.restore(),a}#u(e,n,i={}){let{backdropCanvas:s=null,destTransform:a=[1,0,0,1,0,0],backdropOffset:r=[0,0],reuseMaskEntry:l=null,poolMeta:c=null,sourceAlpha:p=1,sourceFilter:m="none",knockoutAlpha:g=1}=i,{width:y,height:x}=n,I=this.#m(n,l,g),M=e.globalCompositeOperation;if(e.save(),e.setTransform(...a),e.globalAlpha=1,si.isCanvasFilterSupported)e.filter="none";if(e.globalCompositeOperation="destination-out",e.drawImage(I.canvas,0,0),s){let[H,X]=r,W=this.#g(c,"knockoutBackdropEntry",y,x),Y=W.context;if(Y.drawImage(s,H,X,y,x,0,0,y,x),Y.globalCompositeOperation="destination-in",Y.drawImage(I.canvas,0,0),Y.globalCompositeOperation="source-over",e.globalCompositeOperation="destination-over",e.drawImage(W.canvas,0,0),!c)this.canvasFactory.destroy(W)}if(e.globalCompositeOperation=M,e.globalAlpha=p,si.isCanvasFilterSupported)e.filter=m??"none";if(e.drawImage(n,0,0),e.restore(),!l)this.canvasFactory.destroy(I)}#p(e=1){if(this.#t===0||this.#n>0||!this.contentVisible)return!1;this.#n++,this.#o=e;let n=this.#f.at(-1),{canvas:i}=this.ctx,s=this.#g(n,"knockoutTempEntry",i.width,i.height);this.#i=s;let a=s.context;if(a.save(),a.setTransform(this.ctx.getTransform()),xh(this.ctx,a),this.#a=a.globalCompositeOperation,a.globalCompositeOperation="source-over",zk(a,this.ctx),this.#c=n,this.#s=this.ctx,this.#r=this.suspendedCtx,this.ctx=a,this.inSMaskMode)this.suspendedCtx=a;return!0}#b(e){if(!e)return;let n=this.#i,i=this.#s,s=this.#r,a=n.context;if(this.#i=null,this.#s=null,this.#r=null,this.inSMaskMode&&this.suspendedCtx===a&&this.ctx!==a)this.endSMaskMode();if(this.inSMaskMode)this.suspendedCtx=s;this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#a,this.#a=null,xh(this.ctx,i),this.ctx=i;let r=this.#c;this.#c=null;let l=this.#o;this.#o=1;try{this.#u(s??i,n.canvas,{backdropCanvas:r?.backdropCtx?.canvas??null,backdropOffset:r?.backdropCtx?[r.offsetX,r.offsetY]:[0,0],reuseMaskEntry:r?.knockoutMaskEntry??null,poolMeta:r,knockoutAlpha:l})}finally{if(a.restore(),this.#n--,!r)this.canvasFactory.destroy(n)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let n=this.current.activeSMask,i=this.suspendedCtx,s=this.#n>0&&i===this.ctx;if(this.composeSMask(s?null:i,n,this.ctx,e),s)return;this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,n,i,s){let a=s[0],r=s[1],l=s[2]-a,c=s[3]-r;if(l===0||c===0)return;let p=this.smaskPreparedEntry;if(p){let m=a,g=r,y=l,x=c,I=this.smaskPreparedOOBAlpha,M=I!==null;if(M){m=Math.max(a,n.offsetX),g=Math.max(r,n.offsetY);let H=Math.min(a+l,n.offsetX+n.canvas.width),X=Math.min(r+c,n.offsetY+n.canvas.height);y=H-m,x=X-g}if(y>0&&x>0){let H=m-this.smaskPreparedOffsetX,X=g-this.smaskPreparedOffsetY;i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0);let W=new Path2D;W.rect(m,g,y,x),i.clip(W),i.globalCompositeOperation="destination-in",i.drawImage(p.canvas,H,X,y,x,m,g,y,x),i.restore()}if(M&&I<255)this._applySMaskOOBAlpha(i,a,r,l,c,m,g,m+y,g+x,I)}else this.genericComposeSMask(n,i,l,c,a,r);if(!e)return;e.save(),e.globalAlpha=1,e.globalCompositeOperation=n.blendMode||"source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,a,r,l,c,a,r,l,c),e.restore()}_applySMaskOOBAlpha(e,n,i,s,a,r,l,c,p,m){let g=r<c&&l<p;if(g&&r===n&&l===i&&c===n+s&&p===i+a)return;let y=new Path2D;if(y.rect(n,i,s,a),g)y.rect(r,l,c-r,p-l);e.save(),e.globalAlpha=m/255,e.setTransform(1,0,0,1,0,0),e.clip(y,"evenodd"),e.globalCompositeOperation="destination-in",e.fillStyle="#000000",e.fillRect(n,i,s,a),e.restore()}genericComposeSMask(e,n,i,s,a,r){let{context:l,offsetX:c,offsetY:p}=e;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let m=new Path2D;m.rect(a,r,i,s),n.clip(m),n.globalCompositeOperation="destination-in",n.drawImage(l.canvas,a-c,r-p,i,s,a,r,i,s),n.restore()}save(e){if(this.inSMaskMode)xh(this.ctx,this.suspendedCtx);this.ctx.save();let n=this.current;this.stateStack.push(n),this.current=n.clone(),this.dependencyTracker?.save(e)}restore(e){if(this.dependencyTracker?.restore(e),this.stateStack.length===0){if(this.inSMaskMode)this.endSMaskMode();return}if(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode)xh(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform());this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,n,i,s,a,r,l){this.dependencyTracker?.recordIncrementalData("transform",e),this.ctx.transform(n,i,s,a,r,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,n,i,s){let[a]=i;if(!s){if(a||=i[0]=new Path2D,n!==Zo.stroke&&n!==Zo.closeStroke)this.current.tilingPatternDims=null;this[n](e,a);return}if(this.dependencyTracker!==null){let l=n===Zo.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,s[0]-l,s[2]+l,s[1]-l,s[3]+l).recordDependencies(e,["transform"])}if(!(a instanceof Path2D))a=i[0]=oT(a);Ot.axialAlignedBoundingBox(s,bi(this.ctx),this.current.minMax);let r=this.current.tilingPatternDims;if(r&&n!==Zo.stroke&&n!==Zo.closeStroke&&this.current.fillColor instanceof nm){let l=Ot.intersect(this.current.clipBox,this.current.minMax);if(!l)this.current.tilingPatternDims=null;else this.current.fillColor.updatePatternDims(l,r)}this[n](e,a),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,n,i=!0){let s=i&&this.#p(this.current.strokeAlpha),a=this.ctx,r=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r==="object"&&r?.getPattern){let l=r.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=r.getPattern(a,this,Yo(a),Ws.STROKE,e),l){let c=new Path2D;c.addPath(n,a.getTransform().invertSelf().multiplySelf(l)),n=c}this.rescaleAndStroke(n,!1),a.restore()}else this.rescaleAndStroke(n,!0);if(this.dependencyTracker?.recordDependencies(e,Ur.stroke),i)this.consumePath(e,n,this.current.getClippedPathBoundingBox(Ws.STROKE,bi(this.ctx)));a.globalAlpha=this.current.fillAlpha,this.#b(s)}closeStroke(e,n){this.stroke(e,n)}fill(e,n,i=!0){let s=i&&this.#p(this.current.fillAlpha),a=this.ctx,r=this.current.fillColor,l=this.current.patternFill,c=!1,p=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,Ur.fill),l){let m=this.current.tilingPatternDims,g=m&&r.canSkipPatternCanvas(m);if(g){if(r.drawPattern(this,n,this.pendingEOFill,g,e),this.pendingEOFill=!1,i)this.consumePath(e,n,p);this.current.tilingPatternDims=null,this.#b(s);return}let y=r.isModifyingCurrentTransform()?a.getTransform():null;if(this.dependencyTracker?.save(e),a.save(),a.fillStyle=r.getPattern(a,this,Yo(a),Ws.FILL,e),y){let x=new Path2D;x.addPath(n,a.getTransform().invertSelf().multiplySelf(y)),n=x}c=!0}if(this.contentVisible&&p!==null)if(this.pendingEOFill)a.fill(n,"evenodd"),this.pendingEOFill=!1;else a.fill(n);if(c)a.restore(),this.dependencyTracker?.restore(e);if(i)this.consumePath(e,n,p);this.#b(s)}eoFill(e,n){this.pendingEOFill=!0,this.fill(e,n)}fillStroke(e,n){let i=this.#p(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,n,!1),this.stroke(e,n,!1),this.consumePath(e,n),this.#b(i)}eoFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}closeFillStroke(e,n){this.fillStroke(e,n)}closeEOFillStroke(e,n){this.pendingEOFill=!0,this.fillStroke(e,n)}endPath(e,n){this.consumePath(e,n)}rawFillPath(e,n){let i=this.#p(this.current.fillAlpha);this.ctx.fill(n),this.dependencyTracker?.recordDependencies(e,Ur.rawFillPath).recordOperation(e),this.#b(i)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=gL}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e),this.pendingClip=Wk}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){let n=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){let{dependencyTracker:s}=this;if(n!==void 0)s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",e);s.recordCloseMarker(e)}if(n!==void 0){let s=new Path2D,a=i.getTransform().invertSelf();for(let{transform:r,x:l,y:c,fontSize:p,path:m}of n){if(!m)continue;s.addPath(m,new DOMMatrix(r).preMultiplySelf(a).translate(l,c).scale(p,-p))}i.clip(s)}delete this.pendingTextPaths}setCharSpacing(e,n){this.dependencyTracker?.recordSimpleData("charSpacing",e),this.current.charSpacing=n}setWordSpacing(e,n){this.dependencyTracker?.recordSimpleData("wordSpacing",e),this.current.wordSpacing=n}setHScale(e,n){this.dependencyTracker?.recordSimpleData("hScale",e),this.current.textHScale=n/100}setLeading(e,n){this.dependencyTracker?.recordSimpleData("leading",e),this.current.leading=-n}setFont(e,n,i){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",n,e);let s=this.commonObjs.get(n),a=this.current;if(!s)throw Error(`Can't find font for ${n}`);if(a.fontMatrix=s.fontMatrix||K3,a.fontMatrix[0]===0||a.fontMatrix[3]===0)vn("Invalid font matrix for font "+n);if(i<0)i=-i,a.fontDirection=-1;else a.fontDirection=1;if(this.current.font=s,this.current.fontSize=i,s.isType3Font)return;let r=s.loadedName||"sans-serif",l=s.systemFontInfo?.css||`"${r}", ${s.fallbackName}`,c="normal";if(s.black)c="900";else if(s.bold)c="bold";let p=s.italic?"italic":"normal",m=vi(i,hL,fL);this.current.fontSizeScale=i/m,this.ctx.font=`${p} ${c} ${m}px ${l}`}setTextRenderingMode(e,n){this.dependencyTracker?.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=n}setTextRise(e,n){this.dependencyTracker?.recordSimpleData("textRise",e),this.current.textRise=n}moveText(e,n,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=n,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,n,i){this.setLeading(e,-i),this.moveText(e,n,i)}setTextMatrix(e,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);let{current:i}=this;i.textMatrix=n,i.textMatrixScale=Math.hypot(n[0],n[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}#w(e,n,i){let s=new Path2D;return s.addPath(e,new DOMMatrix(i).invertSelf().multiplySelf(n)),s}paintChar(e,n,i,s,a,r){let l=this.ctx,c=this.current,{font:p,textRenderingMode:m}=c,g=c.fontSize/c.fontSizeScale,y=m&ms.FILL_STROKE_MASK,x=!!(m&ms.ADD_TO_PATH_FLAG),I=c.patternFill&&!p.missingFile,M=c.patternStroke&&!p.missingFile,H;if((p.disableFontFace||x||I||M)&&!p.missingFile)H=p.getPathGenerator(this.commonObjs,n);if(H&&(p.disableFontFace||I||M)){l.save(),l.translate(i,s),l.scale(g,-g),this.dependencyTracker?.recordCharacterBBox(e,l,p);let X;if(y===ms.FILL||y===ms.FILL_STROKE)if(a){X=l.getTransform(),l.setTransform(...a);let W=this.#w(H,X,a);l.fill(W)}else l.fill(H);if(y===ms.STROKE||y===ms.FILL_STROKE)if(r){X||=l.getTransform(),l.setTransform(...r);let{a:W,b:Y,c:te,d:ae}=X,ne=Ot.inverseTransform(r),oe=Ot.transform([W,Y,te,ae,0,0],ne);Ot.singularValueDecompose2dScale(oe,fr),l.lineWidth*=Math.max(fr[0],fr[1])/g,l.stroke(this.#w(H,X,r))}else l.lineWidth/=g,l.stroke(H);l.restore()}else{if(y===ms.FILL||y===ms.FILL_STROKE)l.fillText(n,i,s),this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s,()=>l.measureText(n));if(y===ms.STROKE||y===ms.FILL_STROKE){if(this.dependencyTracker)this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s,()=>l.measureText(n)).recordDependencies(e,Ur.stroke);l.strokeText(n,i,s)}}if(x)(this.pendingTextPaths||=[]).push({transform:bi(l),x:i,y:s,fontSize:g,path:H}),this.dependencyTracker?.recordCharacterBBox(e,l,p,g,i,s)}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),n=e.context;n.scale(1.5,1),n.fillText("I",0,10);let i=n.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let s=!1;for(let a=3;a<i.length;a+=4)if(i[a]>0&&i[a]<255){s=!0;break}return en(this,"isFontSubpixelAAEnabled",s)}showText(e,n){if(this.dependencyTracker){if(this.dependencyTracker.recordDependencies(e,Ur.showText).resetBBox(e),this.current.textRenderingMode&ms.ADD_TO_PATH_FLAG)this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies()}let i=this.current,s=i.font;if(s.isType3Font){let Fe=this.#p(i.fillAlpha);this.showType3Text(e,n),this.dependencyTracker?.recordShowTextOperation(e),this.#b(Fe);return}let a=i.fontSize;if(a===0){this.dependencyTracker?.recordOperation(e);return}let r=this.#p(i.fillAlpha),l=this.ctx,{fontSizeScale:c,charSpacing:p,wordSpacing:m,fontDirection:g}=i,y=i.textHScale*g,x=n.length,I=s.vertical,M=I?1:-1,H=s.defaultVMetrics,X=a*i.fontMatrix[0],W=i.textRenderingMode===ms.FILL&&!s.disableFontFace&&!i.patternFill;if(l.save(),i.textMatrix)l.transform(...i.textMatrix);if(l.translate(i.x,i.y+i.textRise),g>0)l.scale(y,-1);else l.scale(y,1);let Y,te,ae=i.textRenderingMode&ms.FILL_STROKE_MASK,ne=ae===ms.FILL||ae===ms.FILL_STROKE,oe=ae===ms.STROKE||ae===ms.FILL_STROKE,{lineWidth:me,textMatrixScale:be}=i;if(be===0||me===0){if(oe)me=this.getSinglePixelWidth()}else me/=be;if(c!==1)l.scale(c,c),me/=c;if(l.lineWidth=me,ne&&i.patternFill){l.save();let Fe=i.fillColor.getPattern(l,this,Yo(l),Ws.FILL,e);Y=bi(l),l.restore(),l.fillStyle=Fe}if(oe&&i.patternStroke){l.save();let Fe=i.strokeColor.getPattern(l,this,Yo(l),Ws.STROKE,e);te=bi(l),l.restore(),l.strokeStyle=Fe}if(s.isInvalidPDFjsFont){let Fe=[],Ue=0;for(let Le of n)Fe.push(Le.unicode),Ue+=Le.width;let ze=Fe.join("");if(l.fillText(ze,0,0),this.dependencyTracker!==null){let Le=l.measureText(ze);this.dependencyTracker.recordBBox(e,this.ctx,-Le.actualBoundingBoxLeft,Le.actualBoundingBoxRight,-Le.actualBoundingBoxAscent,Le.actualBoundingBoxDescent).recordShowTextOperation(e)}i.x+=Ue*X*y,l.restore(),this.compose(),this.#b(r);return}let xe=0,Oe;for(Oe=0;Oe<x;++Oe){let Fe=n[Oe];if(typeof Fe==="number"){xe+=M*Fe*a/1000;continue}let Ue=!1,ze=(Fe.isSpace?m:0)+p,{fontChar:Le,accent:qe}=Fe,Me,yt,Ge=Fe.width;if(I){let ut=Fe.vmetric||H,st=-(Fe.vmetric?ut[1]:Ge*0.5)*X,bt=ut[2]*X;Ge=ut?-ut[0]:Ge,Me=st/c,yt=(xe+bt)/c}else Me=xe/c,yt=0;let Qe;if(s.remeasure&&Ge>0){Qe=l.measureText(Le);let ut=Qe.width*1000/a*c;if(Ge<ut&&this.isFontSubpixelAAEnabled){let st=Ge/ut;Ue=!0,l.save(),l.scale(st,1),Me/=st}else if(Ge!==ut)Me+=(Ge-ut)/2000*a/c}if(this.contentVisible&&(Fe.isInFont||s.missingFile)){if(W&&!qe)l.fillText(Le,Me,yt),this.dependencyTracker?.recordCharacterBBox(e,l,Qe?{bbox:null}:s,a/c,Me,yt,()=>Qe??l.measureText(Le));else if(this.paintChar(e,Le,Me,yt,Y,te),qe){let ut=Me+a*qe.offset.x/c,st=yt-a*qe.offset.y/c;this.paintChar(e,qe.fontChar,ut,st,Y,te)}}let jt=I?Ge*X-ze*g:Ge*X+ze*g;if(xe+=jt,Ue)l.restore()}if(I)i.y-=xe;else i.x+=xe*y;l.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#b(r)}showType3Text(e,n){let i=this.ctx,s=this.current,{font:a,fontSize:r,fontDirection:l}=s,c=a.vertical?1:-1,{charSpacing:p,wordSpacing:m}=s,g=s.textHScale*l,y=s.fontMatrix||K3,x=n.length,I=s.textRenderingMode===ms.INVISIBLE,M,H,X,W;if(I||r===0)return;if(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),s.textMatrix)i.transform(...s.textMatrix);i.translate(s.x,s.y+s.textRise),i.scale(g,l);let Y=this.dependencyTracker;this.dependencyTracker=Y?new rm(Y,e):null;for(M=0;M<x;++M){if(H=n[M],typeof H==="number"){W=c*H*r/1000,this.ctx.translate(W,0),s.x+=W*g;continue}let te=(H.isSpace?m:0)+p,ae=a.charProcOperatorList.get(H.operatorListId);if(!ae)vn(`Type3 character "${H.operatorListId}" is not available.`);else if(this.contentVisible){if(this.save(),ae.fnArray[0]===Zo.setCharWidth)s.fillAlpha=s.strokeAlpha=1,i.globalAlpha=1;i.scale(r,r),i.transform(...y),this.executeOperatorList(ae),this.restore()}let ne=[H.width,0];Ot.applyTransform(ne,y),X=ne[0]*r+te,i.translate(X,0),s.x+=X*g}if(i.restore(),Y)this.dependencyTracker=Y}setCharWidth(e,n,i){}setCharWidthAndBounds(e,n,i,s,a,r,l){let c=new Path2D;c.rect(s,a,r-s,l-a),this.ctx.clip(c),this.dependencyTracker?.recordBBox(e,this.ctx,s,r,a,l).recordClipBox(e,this.ctx,s,r,a,l),this.endPath(e)}getColorN_Pattern(e,n){let i;if(n[0]==="TilingPattern"){let s=this.baseTransform||bi(this.ctx),a={createCanvasGraphics:(r,l)=>new jh(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new rm(this.dependencyTracker,l,!0):null)};i=new nm(n,this.ctx,a,s)}else i=this._getPattern(e,n[1],n[2]);return i}setStrokeColorN(e,...n){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,n),this.current.patternStroke=!0}setFillColorN(e,...n){this.dependencyTracker?.recordSimpleData("fillColor",e);let i=this.current.fillColor=this.getColorN_Pattern(e,n);this.current.patternFill=!0,this.current.tilingPatternDims=i instanceof nm?[0,0,0,0]:null}setStrokeRGBColor(e,n){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=n,this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,n){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=n,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,n,i=null){let s=this.cachedPatterns.getOrInsertComputed(n,()=>uL(this.getObject(e,n)));if(i)s.matrix=i;return s}shadingFill(e,n){if(!this.contentVisible)return;let i=this.#p(this.current.fillAlpha),s=this.ctx;this.save(e);let a=this._getPattern(e,n);s.fillStyle=a.getPattern(s,this,Yo(s),Ws.SHADING,e);let r=Yo(s);if(r){let{width:l,height:c}=s.canvas,p=Ah.slice();Ot.axialAlignedBoundingBox([0,0,l,c],r,p);let[m,g,y,x]=p;this.ctx.fillRect(m,g,y-m,x-g)}else this.ctx.fillRect(-10000000000,-10000000000,20000000000,20000000000);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Ur.transform).recordDependencies(e,Ur.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#b(i)}beginInlineImage(){Un("Should not call beginInlineImage")}beginImageData(){Un("Should not call beginImageData")}paintFormXObjectBegin(e,n,i){if(!this.contentVisible)return;if(this.save(e),this.baseTransformStack.push(this.baseTransform),n)this.transform(e,...n);if(this.baseTransform=bi(this.ctx),i){Ot.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);let[s,a,r,l]=i,c=new Path2D;c.rect(s,a,r-s,l-a),this.ctx.clip(c),this.dependencyTracker?.recordClipBox(e,this.ctx,s,r,a,l),this.endPath(e)}}paintFormXObjectEnd(e){if(!this.contentVisible)return;this.restore(e),this.baseTransform=this.baseTransformStack.pop()}beginGroup(e,n){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:i}=this;if(i)this.endSMaskMode(),this.current.activeSMask=null;let s=this.ctx;if((!n.needsIsolation||!n.isolated&&!n.hasSoftMask)&&!n.knockout&&!n.isGray&&this.#t===0&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&!i){if(n.bbox){let te=new Path2D,[ae,ne,oe,me]=n.bbox;if(te.rect(ae,ne,oe-ae,me-ne),n.matrix){let be=new Path2D;be.addPath(te,new DOMMatrix(n.matrix)),te=be}s.clip(te)}this.groupStack.push(null),this.#f.push(null),this.groupLevel++;return}if(!n.isolated&&!n.knockout&&this.#t===0)g2("TODO: Fully support non-isolated non-knockout groups.");let a=bi(s);if(n.matrix)s.transform(...n.matrix);let r=[0,0,s.canvas.width,s.canvas.height],l;if(n.bbox)l=Ah.slice(),Ot.axialAlignedBoundingBox(n.bbox,bi(s),l),l=Ot.intersect(l,r)||[0,0,0,0];else l=r;let c=Math.floor(l[0]),p=Math.floor(l[1]),m=Math.max(Math.ceil(l[2])-c,1),g=Math.max(Math.ceil(l[3])-p,1);this.current.startNewPathAndClipBox([0,0,m,g]);let y=this.canvasFactory.create(m,g);if(n.smask)this.smaskGroupCanvases.push(y);let x=y.context,I=n.knockout&&!n.isolated?s:null,M=!n.isolated&&!n.knockout&&!n.smask&&n.needsIsolation&&this.#t>0,H=n.knockout?this.canvasFactory.create(m,g):null,X=this.#t;if(n.knockout)this.#t++;else this.#t=0;x.translate(-c,-p),x.transform(...a);let W=!n.isolated&&!n.smask&&n.needsIsolation,Y=W&&!i&&X===0&&!n.knockout&&!n.isGray&&n.hasSoftMask&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(W&&(i||Y))x.save(),x.setTransform(1,0,0,1,0,0),x.drawImage(s.canvas,-c,-p),x.restore();if(n.bbox){let te=new Path2D,[ae,ne,oe,me]=n.bbox;if(te.rect(ae,ne,oe-ae,me-ne),n.matrix){let be=new Path2D;be.addPath(te,new DOMMatrix(n.matrix)),te=be}x.clip(te)}if(n.smask)this.smaskStack.push({canvas:y.canvas,context:x,offsetX:c,offsetY:p,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null});if(!n.smask||this.dependencyTracker)s.setTransform(1,0,0,1,0,0),s.translate(c,p),s.save();xh(s,x),this.ctx=x,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(s),this.#f.push({backdropCtx:I,savedKnockoutLevel:X,offsetX:c,offsetY:p,hasInnerBackdrop:M,replaceBackdrop:Y,knockoutMaskEntry:H,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,n){if(!this.contentVisible)return;this.groupLevel--;let i=this.ctx,s=this.groupStack.pop(),a=this.#f.pop();if(a)this.#t=a.savedKnockoutLevel;if(s===null){this.restore(e);return}if(n.isGray)this.#y(i);if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),n.smask){if(this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker){if(this.ctx.restore(),this.inSMaskMode)this.ctx.setTransform(this.suspendedCtx.getTransform())}this.#v(a)}else{this.ctx.restore();let r=bi(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...r);let l=Ah.slice();Ot.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],r,l);let c=this.#f.at(-1);if(this.#t>0)if(a.hasInnerBackdrop){let{width:p,height:m}=i.canvas,g=this.canvasFactory.create(p,m),y=g.context;y.drawImage(s.canvas,a.offsetX,a.offsetY,p,m,0,0,p,m),y.globalCompositeOperation="source-over",y.drawImage(i.canvas,0,0);let x=this.#m(i.canvas);y.globalCompositeOperation="destination-in",y.drawImage(x.canvas,0,0);let I=this.ctx.globalCompositeOperation,M=this.ctx.globalAlpha,H=this.ctx.filter;if(this.ctx.save(),this.ctx.setTransform(...r),this.ctx.globalAlpha=1,si.isCanvasFilterSupported)this.ctx.filter="none";if(this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(x.canvas,0,0),this.ctx.globalCompositeOperation=I,this.ctx.globalAlpha=M,si.isCanvasFilterSupported)this.ctx.filter=H??"none";this.ctx.drawImage(g.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(x),this.canvasFactory.destroy(g)}else{let p=c?.backdropCtx??null;this.#u(this.ctx,i.canvas,{backdropCanvas:p?.canvas??null,destTransform:r,backdropOffset:p?[c.offsetX+a.offsetX,c.offsetY+a.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(a.replaceBackdrop){let p=new Path2D;p.rect(0,0,i.canvas.width,i.canvas.height),this.ctx.clip(p),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(i.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:i.canvas,context:i}),this.#v(a),this.compose(l)}}#y(e){let{canvas:n}=e,{width:i,height:s}=n;if(si.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter="grayscale(1)",e.globalAlpha=1,e.globalCompositeOperation="copy",e.drawImage(n,0,0),e.restore();return}let a=e.getImageData(0,0,i,s),{data:r}=a;for(let l=0,c=r.length;l<c;l+=4){let p=r[l]*0.2126+r[l+1]*0.7152+r[l+2]*0.0722+0.5|0;r[l]=r[l+1]=r[l+2]=p}e.putImageData(a,0,0)}#v(e){if(!e)return;if(e.knockoutMaskEntry)this.canvasFactory.destroy(e.knockoutMaskEntry),e.knockoutMaskEntry=null;if(e.knockoutTempEntry)this.canvasFactory.destroy(e.knockoutTempEntry),e.knockoutTempEntry=null;if(e.knockoutBackdropEntry)this.canvasFactory.destroy(e.knockoutBackdropEntry),e.knockoutBackdropEntry=null}beginAnnotation(e,n,i,s,a,r,l){if(this.#h(),$b(this.ctx),this.ctx.save(),this.save(e),this.baseTransform)this.ctx.setTransform(...this.baseTransform);if(i){let c=i[2]-i[0],p=i[3]-i[1];if(r&&this.annotationCanvasMap){s=s.slice(),s[4]-=i[0],s[5]-=i[1],Ot.singularValueDecompose2dScale(bi(this.ctx),fr);let{viewportScale:m}=this,g=Math.ceil(c*this.outputScaleX*m),y=Math.ceil(p*this.outputScaleY*m);this.annotationCanvas=this.canvasFactory.create(g,y);let{canvas:x,context:I}=this.annotationCanvas;if(l){let M=this.annotationCanvasMap.getOrInsertComputed(n,Nd);x.setAttribute("data-canvas-name",l);let H=M.findIndex((X)=>X.getAttribute("data-canvas-name")===l);if(H===-1)M.push(x);else M[H]=x}else this.annotationCanvasMap.set(n,x);this.annotationCanvas.savedCtx=this.ctx,this.ctx=I,this.ctx.save(),this.ctx.setTransform(fr[0],0,0,-fr[1],0,p*fr[1]),$b(this.ctx)}else{$b(this.ctx),this.endPath(e);let m=new Path2D;m.rect(i[0],i[1],c,p),this.ctx.clip(m)}}this.current=new s9(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...s),this.transform(e,...a),this.baseTransform=bi(this.ctx)}endAnnotation(e){if(this.annotationCanvas)this.ctx.restore(),this.#d(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas;this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,n){if(!this.contentVisible)return;let i=n.count;n=this.getObject(e,n.data,n),n.count=i;let s=this.#p(this.current.fillAlpha),a=this.ctx,r=this._createMaskCanvas(e,n),l=r.canvas;if(a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(l,r.offsetX,r.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,r.offsetX,r.offsetX+l.width,r.offsetY,r.offsetY+l.height).recordOperation(e),a.restore(),r.canvasEntry)this.canvasFactory.destroy(r.canvasEntry);this.compose(),this.#b(s)}paintImageMaskXObjectRepeat(e,n,i,s=0,a=0,r,l){if(!this.contentVisible)return;n=this.getObject(e,n.data,n);let c=this.#p(this.current.fillAlpha),p=this.ctx;p.save();let m=bi(p);p.transform(i,s,a,r,0,0);let g=this._createMaskCanvas(e,n);p.setTransform(1,0,0,1,g.offsetX-m[4],g.offsetY-m[5]),this.dependencyTracker?.resetBBox(e);for(let y=0,x=l.length;y<x;y+=2){let I=Ot.transform(m,[i,s,a,r,l[y],l[y+1]]);p.drawImage(g.canvas,I[4],I[5]),this.dependencyTracker?.recordBBox(e,this.ctx,I[4],I[4]+g.canvas.width,I[5],I[5]+g.canvas.height)}if(p.restore(),g.canvasEntry)this.canvasFactory.destroy(g.canvasEntry);this.compose(),this.dependencyTracker?.recordOperation(e),this.#b(c)}paintImageMaskXObjectGroup(e,n){if(!this.contentVisible)return;let i=this.#p(this.current.fillAlpha),s=this.ctx,a=this.current.fillColor,r=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Ur.transformAndFill);for(let l of n){let{data:c,width:p,height:m,transform:g}=l,y=this.canvasFactory.create(p,m),x=y.context;x.save();let I=this.getObject(e,c,l);Vk(x,I),x.globalCompositeOperation="source-in",x.fillStyle=r?a.getPattern(x,this,Yo(s),Ws.FILL,e):a,x.fillRect(0,0,p,m),x.restore(),s.save(),s.transform(...g),s.scale(1,-1),Kb(s,y.canvas,0,0,p,m,0,-1,1,1),this.canvasFactory.destroy(y),this.dependencyTracker?.recordBBox(e,s,0,p,0,m),s.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#b(i)}paintImageXObject(e,n){if(!this.contentVisible)return;let i=this.getObject(e,n);if(!i){vn("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,i)}paintImageXObjectRepeat(e,n,i,s,a){if(!this.contentVisible)return;let r=this.getObject(e,n);if(!r){vn("Dependent image isn't ready yet");return}let{width:l,height:c}=r,p=[];for(let m=0,g=a.length;m<g;m+=2)p.push({transform:[i,0,0,s,a[m],a[m+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(e,r,p)}applyTransferMapsToCanvas(e){if(this.current.transferMaps!=="none")e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none";return e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return{img:e.bitmap,canvasEntry:null};let{bitmap:n,width:i,height:s}=e,a=this.canvasFactory.create(i,s),r=a.context;return r.filter=this.current.transferMaps,r.drawImage(n,0,0),r.filter="none",{img:a.canvas,canvasEntry:a}}paintInlineImageXObject(e,n){if(!this.contentVisible)return;let{width:i,height:s}=n,a=this.#p(this.current.fillAlpha),r=this.ctx;this.save(e);let{filter:l}=r;if(l!=="none"&&l!=="")r.filter="none";r.scale(1/i,-1/s);let c,p=null;if(n.bitmap){let g=this.applyTransferMapsToBitmap(n);c=g.img,p=g.canvasEntry}else{let g=this.canvasFactory.create(i,s);Gk(g.context,n),c=this.applyTransferMapsToCanvas(g.context),p=g}let m=this._scaleImage(c,Yo(r));if(r.imageSmoothingEnabled=Xk(bi(r),n.interpolate),this.dependencyTracker)this.dependencyTracker.resetBBox(e).recordBBox(e,r,0,i,-s,0).recordDependencies(e,Ur.imageXObject).recordOperation(e),this.imagesTracker?.record(r,i,s,this.dependencyTracker.clipBox);if(Kb(r,m.img,0,0,m.paintWidth,m.paintHeight,0,-s,i,s),m.tmpCanvas)this.canvasFactory.destroy(m.tmpCanvas);if(p)this.canvasFactory.destroy(p);this.compose(),this.restore(e),this.#b(a)}paintInlineImageXObjectGroup(e,n,i){if(!this.contentVisible)return;let s=this.#p(this.current.fillAlpha),a=this.ctx,r,l=null;if(n.bitmap)r=n.bitmap;else{let{width:c,height:p}=n,m=this.canvasFactory.create(c,p);Gk(m.context,n),r=this.applyTransferMapsToCanvas(m.context),l=m}this.dependencyTracker?.resetBBox(e);for(let c of i)a.save(),a.transform(...c.transform),a.scale(1,-1),Kb(a,r,c.x,c.y,c.w,c.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,a,0,1,-1,0),a.restore();if(l)this.canvasFactory.destroy(l);this.dependencyTracker?.recordOperation(e),this.compose(),this.#b(s)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let n=this.#p(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,Ur.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#b(n)}markPoint(e,n){}markPointProps(e,n,i){}beginMarkedContent(e,n){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,n,i){if(this.dependencyTracker?.beginMarkedContent(e),n==="OC")this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)});else this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,n,i){let s=this.current.isEmptyClip();if(this.pendingClip)this.current.updateClipFromPath();if(!this.pendingClip)this.compose(i);let a=this.ctx;if(this.pendingClip){if(!s)if(this.pendingClip===Wk)a.clip(n,"evenodd");else a.clip(n);this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)}else this.dependencyTracker?.recordOperation(e);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=bi(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let n=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),s=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/n}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:n,b:i,c:s,d:a}=this.ctx.getTransform(),r,l;if(i===0&&s===0){let c=Math.abs(n),p=Math.abs(a);if(c===p)if(e===0)r=l=1/c;else{let m=c*e;r=l=m<1?1/m:1}else if(e===0)r=1/c,l=1/p;else{let m=c*e,g=p*e;r=m<1?1/m:1,l=g<1?1/g:1}}else{let c=Math.abs(n*a-i*s),p=Math.hypot(n,i),m=Math.hypot(s,a);if(e===0)r=m/c,l=p/c;else{let g=e*c;r=m>g?m/g:1,l=p>g?p/g:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,n){let{ctx:i,current:{lineWidth:s}}=this,[a,r]=this.getScaleForStroking();if(a===r){i.lineWidth=(s||1)*a,i.stroke(e);return}let l=jh.#e??=new DOMMatrix,c=i.getLineDash();if(n)i.save();i.scale(a,r),l.a=1/a,l.d=1/r;let p=new Path2D;if(p.addPath(e,l),c.length>0){let m=Math.max(a,r);i.setLineDash(c.map((g)=>g/m)),i.lineDashOffset/=m}if(i.lineWidth=s||1,i.stroke(p),n)i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(let e in Zo)if(jh.prototype[e]!==void 0)jh.prototype[Zo[e]]=jh.prototype[e];class dm{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,n,i){this._source=e,this.#e=n,this.#t=i}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Pi(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#e(this)}getRangeReader(e,n){if(n<=this._progressiveDataLength)return null;let i=new this.#t(this,e,n);return this._rangeReaders.add(i),i}cancelAllRequests(e){this._fullReader?.cancel(e);for(let n of new Set(this._rangeReaders))n.cancel(e)}}class pm{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){Un("Abstract method `read` called")}cancel(e){Un("Abstract method `cancel` called")}}class mm{_stream=null;constructor(e,n,i){this._stream=e}async read(){Un("Abstract method `read` called")}cancel(e){Un("Abstract method `cancel` called")}}function bL(e){let n=!0,i=s("filename\\*","i").exec(e);if(i){i=i[1];let g=c(i);return g=unescape(g),g=p(g),g=m(g),r(g)}if(i=l(e),i){let g=m(i);return r(g)}if(i=s("filename","i").exec(e),i){i=i[1];let g=c(i);return g=m(g),r(g)}function s(g,y){return new RegExp("(?:^|;)\\s*"+g+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',y)}function a(g,y){if(g){if(!/^[\x00-\xFF]+$/.test(y))return y;try{let x=new TextDecoder(g,{fatal:!0}),I=b2(y);y=x.decode(I),n=!1}catch{}}return y}function r(g){if(n&&/[\x80-\xff]/.test(g)){if(g=a("utf-8",g),n)g=a("iso-8859-1",g)}return g}function l(g){let y=[],x,I=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");while((x=I.exec(g))!==null){let[,H,X,W]=x;if(H=parseInt(H,10),H in y){if(H===0)break;continue}y[H]=[X,W]}let M=[];for(let H=0;H<y.length;++H){if(!(H in y))break;let[X,W]=y[H];if(W=c(W),X){if(W=unescape(W),H===0)W=p(W)}M.push(W)}return M.join("")}function c(g){if(g.startsWith('"')){let y=g.slice(1).split("\\\"");for(let x=0;x<y.length;++x){let I=y[x].indexOf('"');if(I!==-1)y[x]=y[x].slice(0,I),y.length=x+1;y[x]=y[x].replaceAll(/\\(.)/g,"$1")}g=y.join('"')}return g}function p(g){let y=g.indexOf("'");if(y===-1)return g;let x=g.slice(0,y),M=g.slice(y+1).replace(/^[^']*'/,"");return a(x,M)}function m(g){if(!g.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(g))return g;return g.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(y,x,I,M){if(I==="q"||I==="Q")return M=M.replaceAll("_"," "),M=M.replaceAll(/=([0-9a-f]{2})/gi,function(H,X){return String.fromCharCode(parseInt(X,16))}),a(x,M);try{M=atob(M)}catch{}return a(x,M)})}return""}function FT(e,n){let i=new Headers;if(!e||!n||typeof n!=="object")return i;for(let s in n){let a=n[s];if(a!==void 0)i.append(s,a)}return i}function wL(e){let n=e.length;while(n>0&&e[n-1]!==" "&&/\s/.test(e[n-1]))n--;return e.slice(0,n)}function x2(e){return URL.parse(e)?.origin??null}function NT({responseHeaders:e,isHttp:n,rangeChunkSize:i,disableRange:s}){let a={contentLength:0,isRangeSupported:!1},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.contentLength=r,r<=2*i)return a;if(s||!n)return a;if(e.get("Accept-Ranges")!=="bytes")return a;if((e.get("Content-Encoding")||"identity")==="identity")a.isRangeSupported=!0;return a}function PT(e){let n=e.get("Content-Disposition");if(n){let i=bL(n);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(c9(i))return i}return null}function k2(e,n){return new im(`Unexpected server response (${e}) while retrieving PDF "${n.href}".`,e,e===404||e===0&&n.protocol==="file:")}function BT(e,n){if(e!==n)throw Error(`Expected range response-origin "${e}" to match "${n}".`)}function LT(e,n,i,s){return fetch(e,{method:"GET",headers:n,signal:s.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function HT(e,n){if(e!==200&&e!==206)throw k2(e,n)}function T2(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}class UT extends dm{_responseOrigin=null;constructor(e){super(e,zT,GT);let{httpHeaders:n,url:i}=e;Pi(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=FT(!0,n)}}class zT extends pm{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a,withCredentials:r}=e._source;this._isStreamingSupported=!i;let l=new Headers(e.headers);LT(a,l,r,this._abortController).then((c)=>{e._responseOrigin=x2(c.url),HT(c.status,a),this._reader=c.body.getReader();let p=c.headers,{contentLength:m,isRangeSupported:g}=NT({responseHeaders:p,isHttp:!0,rangeChunkSize:s,disableRange:n});if(this._contentLength=m,this._isRangeSupported=g,this._filename=PT(p),!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new Xl("Streaming is disabled."));this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return this._loaded+=e.byteLength,this._callOnProgress(),{value:T2(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class GT extends mm{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,n,i){super(e,n,i);let{url:s,withCredentials:a}=e._source,r=new Headers(e.headers);r.append("Range",`bytes=${n}-${i-1}`),LT(s,r,a,this._abortController).then((l)=>{let c=x2(l.url);BT(c,e._responseOrigin),HT(l.status,s),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return{value:T2(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}function Kk(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function A2(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}class VT extends dm{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,XT,WT);let{pdfDataRangeTransport:n}=e,{initialData:i,progressiveDone:s}=n;if(i?.length>0){let r=Kk(i);this._queuedChunks.push(r)}this._progressiveDone=s;let a=(r)=>{switch(r.type){case"range":case"progressiveRead":this.#e(r.begin,r.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}};n.transportReady(a)}#e(e,n){let i=Kk(n);if(e===void 0)if(this._fullReader)this._fullReader._enqueue(i);else this._queuedChunks.push(i);else{let s=this._rangeReaders.keys().find((a)=>a._begin===e);Pi(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(i)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,n){let i=super.getRangeReader(e,n);if(i)i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(e,n);return i}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}}class XT extends pm{#e=A2.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:n,disableRange:i,disableStream:s}=e._source,{length:a,contentDispositionFilename:r}=n;this._queuedChunks=e._queuedChunks||[];for(let c of this._queuedChunks)this._loaded+=c.byteLength;if(this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!i,c9(r))this._filename=r;this._headersCapability.resolve();let l=this._loaded;Promise.resolve().then(()=>{if(l>0&&this._loaded===l)this._callOnProgress()})}_enqueue(e){if(this._done)return;if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._queuedChunks.push(e);this._loaded+=e.byteLength,this._callOnProgress()}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){if(this._done||=!0,this._queuedChunks.length===0)this.#e()}}class WT extends mm{#e=A2.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,n,i){super(e,n,i);this._begin=n}_enqueue(e){if(this._done)return;if(this._requests.length===0)this._queuedChunk=e;else this._requests.shift().resolve({value:e,done:!1}),this.#e();this._done=!0,this.onDone?.()}async read(){if(this._queuedChunk){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}}var W3=200,$k=206;function yL(e){return typeof e!=="string"?e:b2(e).buffer}class KT extends dm{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,$T,YT);let{httpHeaders:n,url:i}=e;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=FT(this.isHttp,n)}_request(e){let n=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(n,i),n.open("GET",this.url),n.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)n.setRequestHeader(s,a);if(this.isHttp&&"begin"in e&&"end"in e)n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.validateStatus=(s)=>s===$k||s===W3;else i.validateStatus=(s)=>s===W3;return n.responseType="arraybuffer",Pi(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>e.onError(n.status),n.onreadystatechange=this.#n.bind(this,n),n.onprogress=this.#t.bind(this,n),n.send(null),n}#t(e,n){this.#e.get(e)?.onProgress?.(n)}#n(e,n){let i=this.#e.get(e);if(!i)return;if(e.readyState>=2&&i.onHeadersReceived)i.onHeadersReceived(),delete i.onHeadersReceived;if(e.readyState!==4)return;if(!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){i.onError(e.status);return}let s=e.status||W3;if(!i.validateStatus(s)){i.onError(e.status);return}let a=yL(e.response);if(s===$k){let r=e.getResponseHeader("Content-Range");if(/bytes \d+-\d+\/\d+/.test(r))i.onDone(a);else vn('Missing or invalid "Content-Range" header.'),i.onError(0)}else if(a)i.onDone(a);else i.onError(e.status)}_abortRequest(e){if(this.#e.has(e))this.#e.delete(e),e.abort()}getRangeReader(e,n){let i=super.getRangeReader(e,n);if(i)i.onClosed=()=>this._rangeReaders.delete(i);return i}}class $T extends pm{#e=A2.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e);this._fullRequestXhr=e._request({onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#i.bind(this),onProgress:this.#s.bind(this)})}#t(){let e=this._stream,{disableRange:n,rangeChunkSize:i}=e._source,s=this._fullRequestXhr;e._responseOrigin=x2(s.responseURL);let a=s.getAllResponseHeaders(),r=new Headers(a?wL(a.trimStart()).split(/[\r\n]+/).map((p)=>{let[m,...g]=p.split(": ");return[m,g.join(": ")]}):[]),{contentLength:l,isRangeSupported:c}=NT({responseHeaders:r,isHttp:e.isHttp,rangeChunkSize:i,disableRange:n});if(this._contentLength=l,this._isRangeSupported=c,this._filename=PT(r),this._isRangeSupported)e._abortRequest(s);this._headersCapability.resolve()}#n(e){if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._cachedChunks.push(e);if(this._done=!0,this._cachedChunks.length===0)this.#e()}#i(e){this._storedError=k2(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#s(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class YT extends mm{#e=A2.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,n,i){super(e,n,i);this._requestXhr=e._request({begin:n,end:i,onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#i.bind(this),onProgress:null})}#t(){let e=x2(this._requestXhr?.responseURL);try{BT(e,this._stream._responseOrigin)}catch(n){this._storedError=n,this.#i(0)}}#n(e){if(this._requests.length>0)this._requests.shift().resolve({value:e,done:!1});else this._queuedChunk=e;this._done=!0,this.#e(),this.onClosed?.()}#i(e){this._storedError??=k2(e,this._stream.url);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}function QT(e,n=null){let i=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),a=i.createReadStream(e,n);return s.toWeb(a)}class JT extends dm{constructor(e){super(e,ZT,eA);let{url:n}=e;Pi(n.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class ZT extends pm{_reader=null;constructor(e){super(e);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a}=e._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(a).then((l)=>{let c=QT(a);this._reader=c.getReader();let{size:p}=l;if(this._contentLength=p,this._isRangeSupported=!n&&p>2*s,!this._isStreamingSupported&&this._isRangeSupported)this.cancel(new Xl("Streaming is disabled."));this._headersCapability.resolve()}).catch((l)=>{if(l.code==="ENOENT")l=k2(0,a);this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return this._loaded+=e.byteLength,this._callOnProgress(),{value:T2(e),done:!1}}cancel(e){this._reader?.cancel(e)}}class eA extends mm{_readCapability=Promise.withResolvers();_reader=null;constructor(e,n,i){super(e,n,i);let{url:s}=e._source;try{let a=QT(s,{start:n,end:i-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};return{value:T2(e),done:!1}}cancel(e){this._reader?.cancel(e)}}function vL(e){return em(e)?UT:ur?JT:KT}class Vl{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=="string")throw Error("Invalid `workerSrc` type.");this.#t=e}}class tA{#e;#t;constructor({parsedData:e,rawData:n}){this.#e=e,this.#t=n}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}var kh=Symbol("INTERNAL");class nA{#e=!1;#t=!1;#n=!1;#i=!0;constructor(e,{name:n,intent:i,usage:s,rbGroups:a}){this.#e=!!(e&cr.DISPLAY),this.#t=!!(e&cr.PRINT),this.name=n,this.intent=i,this.usage=s,this.rbGroups=a}get visible(){if(this.#n)return this.#i;if(!this.#i)return!1;let{print:e,view:n}=this.usage;if(this.#e)return n?.viewState!=="OFF";else if(this.#t)return e?.printState!=="OFF";return!0}_setVisible(e,n,i=!1){if(e!==kh)Un("Internal method `_setVisible` called.");this.#n=i,this.#i=n}get serializable(){return{userSet:this.#n,visible:this.#i}}}class b9{#e=null;#t=new Map;#n=null;#i=null;#s;creator=null;name=null;constructor(e,n=cr.DISPLAY,i=null){if(this.#s=e,this.renderingIntent=n,e===null)return;this.name=e.name,this.creator=e.creator,this.#i=e.order;for(let s of e.groups)this.#t.set(s.id,new nA(n,s));if(i){if(i.size!==this.#t.size)Un("Incorrect serialized groupState.");for(let[s,a]of i)this.#t.get(s)._setVisible(kh,a.visible,a.userSet)}else{if(e.baseState==="OFF")for(let s of this.#t.values())s._setVisible(kh,!1);for(let s of e.on)this.#t.get(s)._setVisible(kh,!0);for(let s of e.off)this.#t.get(s)._setVisible(kh,!1)}this.#n=this.getHash()}#r(e){let n=e.length;if(n<2)return!0;let i=e[0];for(let s=1;s<n;s++){let a=e[s],r;if(Array.isArray(a))r=this.#r(a);else if(this.#t.has(a))r=this.#t.get(a).visible;else return vn(`Optional content group not found: ${a}`),!0;switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return i==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return g2("Optional content group not defined."),!0;if(e.type==="OCG"){if(!this.#t.has(e.id))return vn(`Optional content group not found: ${e.id}`),!0;return this.#t.get(e.id).visible}else if(e.type==="OCMD"){if(e.expression)return this.#r(e.expression);if(!e.policy||e.policy==="AnyOn"){for(let n of e.ids){if(!this.#t.has(n))return vn(`Optional content group not found: ${n}`),!0;if(this.#t.get(n).visible)return!0}return!1}else if(e.policy==="AllOn"){for(let n of e.ids){if(!this.#t.has(n))return vn(`Optional content group not found: ${n}`),!0;if(!this.#t.get(n).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(let n of e.ids){if(!this.#t.has(n))return vn(`Optional content group not found: ${n}`),!0;if(!this.#t.get(n).visible)return!0}return!1}else if(e.policy==="AllOff"){for(let n of e.ids){if(!this.#t.has(n))return vn(`Optional content group not found: ${n}`),!0;if(this.#t.get(n).visible)return!1}return!0}return vn(`Unknown optional content policy ${e.policy}.`),!0}return vn(`Unknown group type ${e.type}.`),!0}setVisibility(e,n=!0,i=!0){let s=this.#t.get(e);if(!s){vn(`Optional content group not found: ${e}`);return}if(i&&n&&s.rbGroups.length){for(let a of s.rbGroups)for(let r of a)if(r!==e)this.#t.get(r)?._setVisible(kh,!1,!0)}s._setVisible(kh,!!n,!0),this.#e=null}setOCGState({state:e,preserveRB:n}){let i;for(let s of e){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}let a=this.#t.get(s);if(!a)continue;switch(i){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!a.visible,n);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){if(!this.#t.size)return null;if(this.#i)return this.#i.slice();return[...this.#t.keys()]}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new o2;for(let[n,i]of this.#t)e.update(`${n}:${i.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[n,i]of this.#t)e.set(n,i.serializable);return{data:this.#s,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:e,renderingIntent:n,groupState:i}){return new b9(e,n,i)}}class iA{#e=null;#t=null;#n=0;#i=null;#s=null;get pagesNumber(){return this.#n}set pagesNumber(e){if(this.#n===e)return;this.#n=e,this.#e=null,this.#t=null}#r(){if(this.#e)return;let e=this.#n,n=this.#e=new Uint32Array(e);for(let i=0;i<e;i++)n[i]=i+1;this.#t=new Int32Array(n)}#a(){let e=new Map,n=this.#e;for(let i=0,s=this.#n;i<s;i++){let a=n[i],r=e.get(a);if(r)r.push(i+1);else e.set(a,[i+1])}return e}movePages(e,n,i){this.#r();let s=this.#e,a=n.length,r=new Uint32Array(a),l=0;for(let y=0;y<a;y++){let x=n[y]-1;if(r[y]=s[x],x<i)l++}let c=this.#n,p=c-a,m=new Int32Array(c),g=vi(i-l,0,p);for(let y=0,x=0;y<c;y++)if(!e.has(y+1))s[x]=s[y],m[x++]=y+1;if(s.copyWithin(g+a,g,p),s.set(r,g),m.copyWithin(g+a,g,p),m.set(n,g),this.#t=m,s.every((y,x)=>y===x+1))this.#e=null}deletePages(e){this.#r();let n=this.#e,i=this.#a();this.#s={pageNumberToId:n.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let s=this.#n-e.length;this.#n=s;let a=this.#e=new Uint32Array(s);this.#t=new Int32Array(s);let r=0,l=0;for(let c of e){let p=c-1;if(p!==r)a.set(n.subarray(r,p),l),l+=p-r;r=p+1}if(r<n.length)a.set(n.subarray(r),l);this.#o(i,new Set(e))}cancelDelete(){if(this.#s)this.#e=this.#s.pageNumberToId,this.#n=this.#s.pagesNumber,this.#t=this.#s.prevPageNumbers,this.#s=null}cleanSavedData(){this.#s=null}copyPages(e){this.#r(),this.#i={pageNumbers:e,pageIds:e.map((n)=>this.#e[n-1])}}cancelCopy(){this.#i=null}pastePages(e){this.#r();let n=this.#e,i=this.#a(),{pageNumbers:s,pageIds:a}=this.#i,r=this.#n+s.length;this.#n=r;let l=this.#e=new Uint32Array(r);this.#t=new Int32Array(r),l.set(n.subarray(0,e),0),l.set(a,e),l.set(n.subarray(e),e+s.length),this.#o(i,null,e,s),this.#i=null}#o(e,n=null,i=-1,s=null){let a=this.#t,r=this.#e,l=i+(s?.length??0),c=new Map;for(let p=0,m=this.#n;p<m;p++){if(p>=i&&p<l){a[p]=-s[p-i];continue}let g=r[p],y=e.get(g),x=c.get(g)||0;if(n&&y)while(x<y.length&&n.has(y[x]))x++;a[p]=y?.[x],c.set(g,x+1)}}hasBeenAltered(){return this.#e!==null}#l(e=null){if(!this.#e)return null;let n=new Int32Array(this.#n).fill(-1),i=new Map;if(e)for(let s of e){let a=this.getPageId(s),r=i.get(a)??0;i.set(a,r+1),n[s-1]=r}else for(let s=0,a=this.#n;s<a;s++){let r=this.#e[s],l=i.get(r)??0;i.set(r,l+1),n[s]=l}return n}getPageMappingForSaving(e=null,n=this.#l()){e??=this.#a();let i=0;for(let a of e.values())i=Math.max(i,a.length);let s=Array(i);for(let a=0;a<i;a++)s[a]={document:null,pageIndices:[],includePages:[]};for(let[a,r]of e)for(let l=0,c=r.length;l<c;l++)s[l].includePages.push([a-1,r[l]-1]);for(let{includePages:a,pageIndices:r}of s){a.sort((l,c)=>l[0]-c[0]);for(let l=0,c=a.length;l<c;l++)r.push(a[l][1]),a[l]=a[l][0]}return{pageInfos:s,copyLevels:n}}extractPages(e){e=Array.from(e).sort((i,s)=>i-s);let n=new Map;for(let i=0,s=e.length;i<s;i++){let a=this.getPageId(e[i]);n.getOrInsertComputed(a,Nd).push(i+1)}return this.getPageMappingForSaving(n,this.#l(e))}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let n=this.#e;for(let i=0,s=this.#n;i<s;i++)if(n[i]===e)return i+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}}var Rd=Symbol("INITIAL_DATA"),Yk=()=>({...Promise.withResolvers(),data:Rd});class w9{#e=new Map;get(e,n=null){if(n){let s=this.#e.getOrInsertComputed(e,Yk);return s.promise.then(()=>n(s.data)),null}let i=this.#e.get(e);if(!i||i.data===Rd)throw Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){let n=this.#e.get(e);return!!n&&n.data!==Rd}delete(e){let n=this.#e.get(e);if(!n||n.data===Rd)return!1;return this.#e.delete(e),!0}resolve(e,n=null){let i=this.#e.getOrInsertComputed(e,Yk);if(i.data!==Rd)throw Error(`Object already resolved ${e}.`);i.data=n,i.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:n}]of this.#e)if(n!==Rd)yield[e,n]}}var SL=1e5,Qk=30;class xa{#e=Promise.withResolvers();#t=null;#n=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#a=null;#o=0;#l=0;#c=null;#f=null;#h=0;#d=0;#m=Object.create(null);#g=[];#u=null;#p=[];#b=new WeakMap;#w=null;static#y=new Map;static#v=new Map;static#x=new WeakMap;static#_=null;static#k=new Set;constructor({textContentSource:e,images:n,container:i,viewport:s}){if(e instanceof ReadableStream)this.#u=e;else if(typeof e==="object")this.#u=new ReadableStream({start(p){p.enqueue(e),p.close()}});else throw Error('No "textContentSource" parameter specified.');this.#t=this.#f=i,this.#s=n,this.#d=s.scale*co.pixelRatio,this.#h=s.rotation,this.#a={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:r,pageX:l,pageY:c}=s.rawDims;this.#w=[1,0,0,-1,-l,c+r],this.#l=a,this.#o=r,xa.#D(),i.style.setProperty("--min-font-size",xa.#_),qh(i,s),this.#e.promise.finally(()=>{xa.#k.delete(this),this.#a=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:n}=si.platform;return en(this,"fontFamilyMap",new Map([["sans-serif",`${e&&n?"Calibri, ":""}sans-serif`],["monospace",`${e&&n?"Lucida Console, ":""}monospace`]]))}render(){if(this.#s)this.#t.append(this.#s.render());let e=()=>{this.#c.read().then(({value:n,done:i})=>{if(i){this.#e.resolve();return}this.#r??=n.lang,Object.assign(this.#m,n.styles),this.#T(n.items),e()},this.#e.reject)};return this.#c=this.#u.getReader(),xa.#k.add(this),e(),this.#e.promise}update({viewport:e,onBefore:n=null}){let i=e.scale*co.pixelRatio,s=e.rotation;if(s!==this.#h)n?.(),this.#h=s,qh(this.#f,{rotation:s});if(i!==this.#d){n?.(),this.#d=i;let a={div:null,properties:null,ctx:xa.#C(this.#r)};for(let r of this.#p)a.properties=this.#b.get(r),a.div=r,this.#j(a)}}cancel(){let e=new Xl("TextLayer task cancelled.");this.#c?.cancel(e).catch(()=>{}),this.#c=null,this.#e.reject(e)}get textDivs(){return this.#p}get textContentItemsStr(){return this.#g}#T(e){if(this.#n)return;this.#a.ctx??=xa.#C(this.#r);let n=this.#p,i=this.#g;for(let s of e){if(n.length>SL){vn("Ignoring additional textDivs for performance reasons."),this.#n=!0;return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){let a=this.#t;if(this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),s.id)this.#t.setAttribute("id",s.id);if(s.tag==="Artifact")this.#t.ariaHidden=!0;a.append(this.#t)}else if(s.type==="endMarkedContent")this.#t=this.#t.parentNode;continue}i.push(s.str),this.#q(s)}}#q(e){let n=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#p.push(n);let s=Ot.transform(this.#w,e.transform),a=Math.atan2(s[1],s[0]),r=this.#m[e.fontName];if(r.vertical)a+=Math.PI/2;let l=this.#i&&r.fontSubstitution||r.fontFamily;l=xa.fontFamilyMap.get(l)||l;let c=Math.hypot(s[2],s[3]),p=c*xa.#M(l,r,this.#r),m,g;if(a===0)m=s[4],g=s[5]-p;else m=s[4]+p*Math.sin(a),g=s[5]-p*Math.cos(a);let y=n.style;if(y.left=`${(100*m/this.#l).toFixed(2)}%`,y.top=`${(100*g/this.#o).toFixed(2)}%`,y.setProperty("--font-height",`${c.toFixed(2)}px`),y.fontFamily=l,i.fontSize=c,n.setAttribute("role","presentation"),n.textContent=e.str,n.dir=e.dir,this.#i)n.dataset.fontName=r.fontSubstitutionLoadedName||e.fontName;if(a!==0)i.angle=a*(180/Math.PI);let x=!1;if(e.str.length>1)x=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){let I=Math.abs(e.transform[0]),M=Math.abs(e.transform[3]);if(I!==M&&Math.max(I,M)/Math.min(I,M)>1.5)x=!0}if(x)i.canvasWidth=r.vertical?e.height:e.width;if(this.#b.set(n,i),this.#a.div=n,this.#a.properties=i,this.#j(this.#a),i.hasText)this.#t.append(n);if(i.hasEOL){let I=document.createElement("br");I.setAttribute("role","presentation"),this.#t.append(I)}}#j(e){let{div:n,properties:i,ctx:s}=e,{style:a}=n;if(i.canvasWidth!==0&&i.hasText){let{fontFamily:r}=a,{canvasWidth:l,fontSize:c}=i;xa.#I(s,c*this.#d,r);let{width:p}=s.measureText(n.textContent);if(p>0)a.setProperty("--scale-x",l*this.#d/p)}if(i.angle!==0)a.setProperty("--rotate",`${i.angle}deg`)}static cleanup(){if(this.#k.size>0)return;this.#y.clear();for(let{canvas:e}of this.#v.values())e.remove();this.#v.clear()}static#C(e=null){let n=this.#v.get(e||="");if(!n){let i=document.createElement("canvas");i.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",i.lang=e,document.body.append(i),n=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(e,n),this.#x.set(n,{size:0,family:""})}return n}static#I(e,n,i){let s=this.#x.get(e);if(n===s.size&&i===s.family)return;e.font=`${n}px ${i}`,s.size=n,s.family=i}static#D(){if(this.#_!==null)return;let e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#_=e.getBoundingClientRect().height,e.remove()}static#M(e,n,i){let s=this.#y.get(e);if(s)return s;let a=this.#C(i);a.canvas.width=a.canvas.height=Qk,this.#I(a,Qk,e);let r=a.measureText(""),l=r.fontBoundingBoxAscent,c=Math.abs(r.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let p=0.8;if(l)p=l/(l+c);else{if(si.platform.isFirefox)vn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");if(n.ascent)p=n.ascent;else if(n.descent)p=1+n.descent}return this.#y.set(e,p),p}}var _L=100;function y9(e={}){let n=new v9,{docId:i}=n,s=e.url?JB(e.url):null,a=e.data?ZB(e.data):null,r=e.httpHeaders||null,l=e.withCredentials===!0,c=e.password??null,p=e.range instanceof S9?e.range:null,m=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536,g=e.worker instanceof Xs?e.worker:null,y=e.verbosity,x=typeof e.docBaseUrl==="string"&&!y2(e.docBaseUrl)?e.docBaseUrl:null,I=Xb(e.cMapUrl),M=e.cMapPacked!==!1,H=Xb(e.iccUrl),X=Xb(e.standardFontDataUrl),W=Xb(e.wasmUrl),Y=e.stopAtErrors!==!0,te=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,ae=typeof e.isOffscreenCanvasSupported==="boolean"?e.isOffscreenCanvasSupported:!ur,ne=typeof e.isImageDecoderSupported==="boolean"?e.isImageDecoderSupported:!ur,oe=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,me=typeof e.disableFontFace==="boolean"?e.disableFontFace:ur,be=e.fontExtraProperties===!0,xe=e.enableXfa===!0,Oe=e.ownerDocument||globalThis.document,Fe=e.disableRange===!0,Ue=e.disableStream===!0,ze=e.disableAutoFetch===!0,Le=e.pdfBug===!0,qe=e.CanvasFactory||(ur?ET:AT),Me=e.FilterFactory||(ur?jT:CT),yt=e.BinaryDataFactory||(ur?qT:i9),Ge=e.enableHWA===!0,jt=e.enableWebGPU===!0?aL():Promise.resolve(!1),ut=e.useWasm!==!1,st=e.pagesMapper||new iA,bt=typeof e.useSystemFonts==="boolean"?e.useSystemFonts:!ur&&!me,Wt=typeof e.useWorkerFetch==="boolean"?e.useWorkerFetch:!!(yt===i9&&I&&M&&X&&W&&em(I,document.baseURI)&&em(X,document.baseURI)&&em(W,document.baseURI)),un=null;RB(y);let nn={canvasFactory:new qe({ownerDocument:Oe,enableHWA:Ge}),filterFactory:new Me({docId:i,ownerDocument:Oe}),binaryDataFactory:Wt?null:new yt({cMapUrl:I,standardFontDataUrl:X,wasmUrl:W})};if(!g)g=Xs.create({verbosity:y,port:Vl.workerPort}),n._worker=g;let Zt={docId:i,apiVersion:"6.3.289",data:a,password:c,disableAutoFetch:ze,rangeChunkSize:m,docBaseUrl:x,enableXfa:xe,evaluatorOptions:{maxImageSize:te,disableFontFace:me,ignoreErrors:Y,isOffscreenCanvasSupported:ae,isImageDecoderSupported:ne,canvasMaxAreaInBytes:oe,fontExtraProperties:be,useSystemFonts:bt,useWasm:ut,useWorkerFetch:Wt,cMapUrl:I,cMapPacked:M,iccUrl:H,standardFontDataUrl:X,wasmUrl:W,hasGPU:!1}},Rn={ownerDocument:Oe,pdfBug:Le,styleElement:un,enableHWA:Ge,loadingParams:{disableAutoFetch:ze,enableXfa:xe}};return Promise.all([g.promise,jt]).then(function([,Jn]){if(g.destroyed)throw Error("Worker was destroyed");Zt.evaluatorOptions.hasGPU=Jn;let Bi=g.messageHandler.sendWithPromise("GetDocRequest",Zt,a?[a.buffer]:null),ai;if(a);else if(p)ai=new VT({pdfDataRangeTransport:p,disableRange:Fe,disableStream:Ue});else if(s)ai=new(vL(s))({url:s,httpHeaders:r,withCredentials:l,rangeChunkSize:m,disableRange:Fe,disableStream:Ue});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Bi.then((Ai)=>{if(g.destroyed)throw Error("Worker was destroyed");let Ks=new Od(i,Ai,g.port),Ki=new aA(Ks,n,ai,Rn,nn,st);if(n._transport=Ki,n.destroyed)throw Error("Loading aborted");Ks.send("Ready",null)})}).catch(n._capability.reject).finally(n._setupCapability.resolve),n}class v9{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${v9.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{if(this._worker?.port)this._worker._pendingDestroy=!0;await this._setupCapability.promise,await this._transport?.destroy()}catch(e){if(this._worker?.port)delete this._worker._pendingDestroy;throw e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class S9{#e=Promise.withResolvers();#t=null;constructor(e,n,i=!1,s=null){this.length=e,this.initialData=n,this.progressiveDone=i,this.contentDispositionFilename=s}onDataRange(e,n){this.#t({type:"range",begin:e,chunk:n})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:"progressiveRead",chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:"progressiveDone"})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,n){Un("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class sA{constructor(e,n){this._pdfInfo=e,this._transport=n}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return en(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,n){return this._transport.getAnnotationsByType(e,n)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){let{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(n)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e,n=null){return this._transport.extractPages(e,n)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class _9{#e=!1;#t=null;constructor(e,n,i,s,a=!1){this._pageIndex=e,this._pageInfo=n,this._transport=i,this._stats=a?new Q3:null,this._pdfBug=a,this.commonObjs=i.commonObjs,this.objs=new w9,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=s,this.imageCoordinates=null}clone(e){let n=new _9(e,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:n=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}={}){return new um({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:n,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations({intent:e="display"}={}){let{renderingIntent:n}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,n)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return en(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:n=e.canvas,viewport:i,intent:s="display",annotationMode:a=su.ENABLE,transform:r=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:p=null,pageColors:m=null,printAnnotationStorage:g=null,isEditing:y=!1,recordImages:x=!1,recordOperations:I=!1,operationsFilter:M=null}){this._stats?.time("Overall");let H=this._transport.getRenderingIntent(s,a,g,y),{renderingIntent:X,cacheKey:W}=H;this.#e=!1,c||=this._transport.getOptionalContentConfig(X);let Y=this._intentStates.getOrInsertComputed(W,Y3);if(Y.streamReaderCancelTimeout)clearTimeout(Y.streamReaderCancelTimeout),Y.streamReaderCancelTimeout=null;let te=!!(X&cr.PRINT);if(!Y.displayReadyCapability)Y.displayReadyCapability=Promise.withResolvers(),Y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(H);let ae=!!(this._pdfBug&&globalThis.StepperManager?.enabled),ne=!!n&&!this.recordedBBoxes&&(I||ae),oe=!!n&&!this.imageCoordinates&&x,me=(Ue)=>{if(Y.renderTasks.delete(Oe),ne){let ze=Oe.gfx?.dependencyTracker.take();if(ze){if(Oe.stepper?.setOperatorBBoxes(ze,Oe.gfx.dependencyTracker.takeDebugMetadata()),I)this.recordedBBoxes=ze}}if(oe&&!Ue)this.imageCoordinates=Oe.gfx?.imagesTracker.take();if(te)this.#e=!0;if(this.#n(),Ue)Oe.capability.reject(Ue),this._abortOperatorList({intentState:Y,reason:Ue instanceof Error?Ue:Error(Ue)});else Oe.capability.resolve();if(this._stats){if(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled)globalThis.Stats.add(this.pageNumber,this._stats)}},be=null,xe=null;if(ne||oe)xe=new pT(n,Y.operatorList.length);if(ne)be=new mT(xe,ae);let Oe=new Fd({callback:me,params:{canvas:n,canvasContext:e,dependencyTracker:be??xe,imagesTracker:oe?new l2(n):null,viewport:i,transform:r,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:Y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!te,pdfBug:this._pdfBug,pageColors:m,enableHWA:this._transport.enableHWA,operationsFilter:M});(Y.renderTasks||=new Set).add(Oe);let Fe=Oe.task;return Promise.all([Y.displayReadyCapability.promise,c]).then(([Ue,ze])=>{if(this.destroyed){me();return}if(this._stats?.time("Rendering"),!(ze.renderingIntent&X))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");Oe.initializeGraphics({transparency:Ue,optionalContentConfig:ze}),Oe.operatorListChanged()}).catch(me),Fe}getOperatorList({intent:e="display",annotationMode:n=su.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){function a(){if(l.operatorList.lastChunk)l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c)}let r=this._transport.getRenderingIntent(e,n,i,s,!0),l=this._intentStates.getOrInsertComputed(r.cacheKey,Y3),c;if(!l.opListReadCapability)c=Object.create(null),c.operatorListChanged=a,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||=new Set).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r);return l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:n=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:n===!0},{highWaterMark:100,size(s){return s.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((s)=>sm.textContent(s));let n=this.streamTextContent(e),i={items:[],styles:Object.create(null),lang:null};for await(let s of n)i.lang??=s.lang,Object.assign(i.styles,s.styles),i.items.push(...s.items);return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let n of this._intentStates.values()){if(this._abortOperatorList({intentState:n,reason:Error("Page was destroyed."),force:!0}),n.opListReadCapability)continue;for(let i of n.renderTasks)e.push(i.completed),i.cancel()}return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let n=this.#n();if(e&&n)this._stats&&=new Q3;return n}#n(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:n}of this._intentStates.values())if(e.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,n){let i=this._intentStates.get(n);if(!i)return;this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e)}_renderPageChunk(e,n){for(let i=0,s=e.length;i<s;i++)n.operatorList.fnArray.push(e.fnArray[i]),n.operatorList.argsArray.push(e.argsArray[i]);n.operatorList.lastChunk=e.lastChunk,n.operatorList.separateAnnots=e.separateAnnots;for(let i of n.renderTasks)i.operatorListChanged();if(e.lastChunk)this.#n()}_pumpOperatorList({renderingIntent:e,cacheKey:n,annotationStorageSerializable:i,modifiedIds:s}){let{map:a,transfer:r}=i,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:n,annotationStorage:a,modifiedIds:s},void 0,r).getReader(),p=this._intentStates.get(n);p.streamReader=c;let m=()=>{c.read().then(({value:g,done:y})=>{if(y){p.streamReader=null;return}if(this._transport.destroyed)return;this._renderPageChunk(g,p),m()},(g)=>{if(p.streamReader=null,this._transport.destroyed)return;if(p.operatorList){p.operatorList.lastChunk=!0;for(let y of p.renderTasks)y.operatorListChanged();this.#n()}if(p.displayReadyCapability)p.displayReadyCapability.reject(g);else if(p.opListReadCapability)p.opListReadCapability.reject(g);else throw g})};m()}_abortOperatorList({intentState:e,reason:n,force:i=!1}){if(!e.streamReader)return;if(e.streamReaderCancelTimeout)clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null;if(!i){if(e.renderTasks.size>0)return;if(n instanceof w2){let s=_L;if(n.extraDelay>0&&n.extraDelay<1000)s+=n.extraDelay;e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:n,force:!0})},s);return}}if(e.streamReader.cancel(new Xl(n.message)).catch(()=>{}),e.streamReader=null,this._transport.destroyed)return;for(let[s,a]of this._intentStates)if(a===e){this._intentStates.delete(s);break}this.cleanup()}get stats(){return this._stats}}class Xs{#e=Promise.withResolvers();#t=null;#n=null;#i=null;static#s=0;static#r=!1;static#a=new WeakMap;static{if(ur)this.#r=!0,Vl.workerSrc||="./pdf.worker.mjs";this._isSameOrigin=(e,n)=>{let i=URL.parse(e);if(!i?.origin||i.origin==="null")return!1;let s=new URL(n,i);return i.origin===s.origin},this._createCDNWrapper=(e)=>{let n=`await import("${e}");`;return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))}}constructor({name:e=null,port:n=null,verbosity:i=OB()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=i,n){if(Xs.#a.has(n))throw Error("Cannot use more than one PDFWorker per port.");Xs.#a.set(n,this),this.#l(n)}else this.#c()}get promise(){return this.#e.promise}#o(){this.#e.resolve(),this.#t.send("configure",{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#l(e){this.#n=e,this.#t=new Od("main","worker",e),this.#t.on("ready",()=>{}),this.#o()}#c(){if(Xs.#r||Xs.#h){this.#f();return}let{workerSrc:e}=Xs;try{if(!Xs._isSameOrigin(window.location,e))e=Xs._createCDNWrapper(new URL(e,window.location).href);let n=new Worker(e,{type:"module"}),i=new Od("main","worker",n),s=()=>{if(a.abort(),i.destroy(),n.terminate(),this.destroyed)this.#e.reject(Error("Worker was destroyed"));else this.#f()},a=new AbortController;n.addEventListener("error",()=>{if(!this.#i)s()},{signal:a.signal}),i.on("test",(l)=>{if(a.abort(),this.destroyed||!l){s();return}this.#t=i,this.#n=n,this.#i=n,this.#o()}),i.on("ready",(l)=>{if(a.abort(),this.destroyed){s();return}try{r()}catch{this.#f()}});let r=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};r();return}catch{g2("The worker has been disabled.")}this.#f()}#f(){if(!Xs.#r)vn("Setting up fake worker."),Xs.#r=!0;Xs._setupFakeWorkerGlobal.then((e)=>{if(this.destroyed){this.#e.reject(Error("Worker was destroyed"));return}let n=new TT;this.#n=n;let i=`fake${Xs.#s++}`,s=new Od(i+"_worker",i,n);e.setup(s,n),this.#t=new Od(i,i+"_worker",n),this.#o()}).catch((e)=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#i?.terminate(),this.#i=null,Xs.#a.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(e){let n=this.#a.get(e?.port);if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new Xs(e)}static get workerSrc(){if(Vl.workerSrc)return Vl.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#h(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return en(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#h)return this.#h;return(await import(this.workerSrc)).WorkerMessageHandler})())}}class aA{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#i=new Map;#s=new Map;#r=new Map;#a=null;constructor(e,n,i,s,a,r){this.messageHandler=e,this.loadingTask=n,this.#n=i,this.commonObjs=new w9,this.fontLoader=new gT({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.enableHWA=s.enableHWA,this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.binaryDataFactory=a.binaryDataFactory,this.pagesMapper=r,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){let{_pageIndex:n}=e;this.#i.set(n,e),this.#s.set(n,Promise.resolve(e))}#o(e,n=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,n))}#l({loaded:e,total:n}){this.loadingTask.onProgress?.({loaded:e,total:n,percent:n?vi(Math.round(e/n*100),0,100):NaN})}get annotationStorage(){return en(this,"annotationStorage",new v2)}getRenderingIntent(e,n=su.ENABLE,i=null,s=!1,a=!1){let r=cr.DISPLAY,l=am;switch(e){case"any":r=cr.ANY;break;case"display":break;case"print":r=cr.PRINT;break;default:vn(`getRenderingIntent - invalid intent: ${e}`)}let c=r&cr.PRINT&&i instanceof d9?i:this.annotationStorage;switch(n){case su.DISABLE:r+=cr.ANNOTATIONS_DISABLE;break;case su.ENABLE:break;case su.ENABLE_FORMS:r+=cr.ANNOTATIONS_FORMS;break;case su.ENABLE_STORAGE:r+=cr.ANNOTATIONS_STORAGE,l=c.serializable;break;default:vn(`getRenderingIntent - invalid annotationMode: ${n}`)}if(s)r+=cr.IS_EDITING;if(a)r+=cr.OPLIST;let{ids:p,hash:m}=c.modifiedIds,g=[r,l.hash,m];return{renderingIntent:r,cacheKey:g.join("_"),annotationStorageSerializable:l,modifiedIds:p}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#a?.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let i of this.#i.values())e.push(i._destroy());if(this.#i.clear(),this.#s.clear(),this.#r.clear(),Object.hasOwn(this,"annotationStorage"))this.annotationStorage.resetModified();let n=this.messageHandler.sendWithPromise("Terminate",null);return e.push(n),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),xa.cleanup(),this.#n?.cancelAllRequests(new Xl("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:n}=this;e.on("GetReader",(i,s)=>{Pi(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=(a)=>this.#l(a),s.onPull=()=>{this.#e.read().then(function({value:a,done:r}){if(r){s.close();return}Pi(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch((a)=>{s.error(a)})},s.onCancel=(a)=>{this.#e.cancel(a),s.ready.catch((r)=>{if(this.destroyed)return;throw r})}}),e.on("ReaderHeadersReady",async(i)=>{await this.#e.headersReady;let{isStreamingSupported:s,isRangeSupported:a,contentLength:r}=this.#e;if(s&&a)this.#e.onProgress=null;return{isStreamingSupported:s,isRangeSupported:a,contentLength:r}}),e.on("GetRangeReader",(i,s)=>{Pi(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let a=this.#n.getRangeReader(i.begin,i.end);if(!a){s.close();return}s.onPull=()=>{a.read().then(function({value:r,done:l}){if(l){s.close();return}Pi(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch((r)=>{s.error(r)})},s.onCancel=(r)=>{a.cancel(r),s.ready.catch((l)=>{if(this.destroyed)return;throw l})}}),e.on("GetDoc",({pdfInfo:i})=>{this.pagesMapper.pagesNumber=i.numPages,this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,n._capability.resolve(new sA(i,this))}),e.on("DocException",(i)=>{n._capability.reject(za(i))}),e.on("PasswordRequest",(i)=>{this.#a=Promise.withResolvers();try{if(!n.onPassword)throw za(i);let s=(a)=>{if(a instanceof Error)this.#a.reject(a);else this.#a.resolve({password:a})};n.onPassword(s,i.code)}catch(s){this.#a.reject(s)}return this.#a.promise}),e.on("DataLoaded",(i)=>{this.#l({loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),e.on("StartRenderPage",(i)=>{if(this.destroyed)return;this.#i.get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),e.on("commonobj",([i,s,a])=>{if(this.destroyed)return null;if(this.commonObjs.has(i))return null;switch(s){case"Font":if("error"in a){let g=a.error;vn(`Error during font loading: ${g}`),this.commonObjs.resolve(i,g);break}let r=new _T(a),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(g,y)=>globalThis.FontInspector.fontAdded(g,y):null,c=new bT(r,l,a.charProcOperatorList,a.extra);this.fontLoader.bind(c).catch(()=>e.sendWithPromise("FontFallback",{id:i})).finally(()=>{if(!c.fontExtraProperties)c.clearData();this.commonObjs.resolve(i,c)});break;case"CopyLocalImage":let{imageRef:p}=a;Pi(p,"The imageRef must be defined.");for(let g of this.#i.values())for(let[,y]of g.objs){if(y?.ref!==p)continue;if(!y.dataLen)return null;let x=structuredClone(y);return this.commonObjs.resolve(i,x),y.dataLen}break;case"FontPath":this.commonObjs.resolve(i,new kT(a));break;case"Image":this.commonObjs.resolve(i,a);break;case"Pattern":let m=new xT(a);this.commonObjs.resolve(i,m.getIR());break;default:throw Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([i,s,a,r])=>{if(this.destroyed)return;let l=this.#i.get(s);if(l.objs.has(i))return;if(l._intentStates.size===0){r?.bitmap?.close();return}switch(a){case"Image":case"Pattern":l.objs.resolve(i,r);break;default:throw Error(`Got unknown object type ${a}`)}}),e.on("DocProgress",(i)=>{if(this.destroyed)return;this.#l(i)}),e.on("FetchBinaryData",async(i)=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(i)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){if(this.annotationStorage.size<=0)vn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this.#e?.filename??null},n).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,n=null){let i={pageInfos:e},s,a=globalThis.ImageBitmap;if(typeof a==="function"){let r=Array.isArray(e)?e:[e];for(let l of r)if(l?.image instanceof a)(s||=[]).push(l.image)}if(this.annotationStorage.size>0){let r=this.annotationStorage.serializable,{map:l}=r;if(r.transfer?.length)if(s)s.push(...r.transfer);else s=r.transfer;let c=this.pagesMapper.getMapping();if(c){let p=new Map;for(let[m,g]of l){if(g?.pageIndex!==void 0&&g.pageIndex>=0&&g.pageIndex<c.length){let y=n?.[g.pageIndex]??0,x=c[g.pageIndex]-1;if(x!==g.pageIndex||y!==0){p.set(m,{...g,pageIndex:x,copyLevel:y});continue}}p.set(m,g)}l=p}i.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",i,s).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error("Invalid page request."));let n=e-1,i=this.pagesMapper.getPageId(e)-1,s=this.#s.get(n);if(s)return s;let a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then((r)=>{if(this.destroyed)throw Error("Transport destroyed");if(r.refStr)this.#r.set(r.refStr,i);let l=new _9(n,r,this,this.pagesMapper,this._params.pdfBug);return this.#i.set(n,l),l});return this.#s.set(n,a),a}async getPageIndex(e){if(!n9(e))throw Error("Invalid pageIndex request.");let n=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),i=this.pagesMapper.getPageNumber(n+1);if(i===0)throw Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(e,n){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:n})}getFieldObjects(){return this.#o("GetFieldObjects")}getSignatures(){return this.#o("GetSignatures")}getSignatureData(e){return this.messageHandler.sendWithPromise("GetSignatureData",e)}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){if(typeof e!=="string")return Promise.reject(Error("Invalid destination request."));return this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise("GetAttachmentContent",e)}getAnnotationsByType(e,n){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:n})}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#o("GetOptionalContentConfig").then((n)=>new b9(n,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.#t.getOrInsertComputed("GetMetadata",()=>this.messageHandler.sendWithPromise("GetMetadata",null).then((n)=>({info:n[0],metadata:n[1]?new tA(n[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:n[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(this.destroyed)return;await this.messageHandler.sendWithPromise("Cleanup",null);for(let n of this.#i.values())if(!n.cleanup())throw Error(`startCleanup: Page ${n.pageNumber} is currently rendering.`);if(this.commonObjs.clear(),!e)this.fontLoader.clear();this.#t.clear(),this.filterFactory.destroy(!0),xa.cleanup()}cachedPageNumber(e){if(!n9(e))return null;let n=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,i=this.#r.get(n);if(i>=0){let s=this.pagesMapper.getPageNumber(i+1);if(s!==0)return s}return null}}class rA{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:n}=this._internalRenderTask;return e.form||e.canvas&&n?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}class Fd{#e=null;static#t=new WeakSet;constructor({callback:e,params:n,objs:i,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:l,canvasFactory:c,filterFactory:p,useRequestAnimationFrame:m=!1,pdfBug:g=!1,pageColors:y=null,enableHWA:x=!1,operationsFilter:I=null}){this.callback=e,this.params=n,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=p,this._pdfBug=g,this.pageColors=y,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=m===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new rA(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=n.canvas,this._canvasContext=n.canvas?null:n.canvasContext,this._enableHWA=x,this._dependencyTracker=n.dependencyTracker,this._imagesTracker=n.imagesTracker,this._operationsFilter=I}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(Fd.#t.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Fd.#t.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled)this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint();let{viewport:i,transform:s,background:a,dependencyTracker:r,imagesTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new jh(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,r,l),this.gfx.beginDrawing({transform:s,viewport:i,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,n=0){if(this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e)window.cancelAnimationFrame(this.#e),this.#e=null;Fd.#t.delete(this._canvas),e||=new w2(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}if(this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),this.running)return;this._continue()}_continue(){if(this.running=!0,this.cancelled)return;if(this.task.onContinue)this.task.onContinue(this._scheduleNextBound);else this._scheduleNext()}_scheduleNext(){if(this._useRequestAnimationFrame)this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)});else Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(this.cancelled)return;if(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length){if(this.running=!1,this.operatorList.lastChunk)this.gfx.endDrawing(),Fd.#t.delete(this._canvas),this.callback()}}}var xL="6.3.289",kL="1c8020a7d";class Gr{#e=null;#t=null;#n;#i=null;#s=!1;#r=!1;#a=null;#o;#l=null;#c=null;static#f=null;static get _keyboardManager(){return en(this,"_keyboardManager",new hr([[["Escape"],Gr.prototype._hideDropdownFromKeyboard],[["Space"],Gr.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],Gr.prototype._moveToNext],[["ArrowUp","ArrowLeft"],Gr.prototype._moveToPrevious],[["Home"],Gr.prototype._moveToBeginning],[["End"],Gr.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:n=null}){if(e)this.#r=!1,this.#a=e;else this.#r=!0;this.#c=e?._uiManager||n,this.#o=this.#c._eventBus,this.#n=e?.color?.toUpperCase()||this.#c?.highlightColors.values().next().value||"#FFFF98",Gr.#f||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let e=this.#e=document.createElement("button");if(e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#a)e.ariaControls=`${this.#a.id}_colorpicker_dropdown`;let n=this.#c._signal;e.addEventListener("click",this.#g.bind(this),{signal:n}),e.addEventListener("keydown",this.#m.bind(this),{signal:n});let i=this.#t=document.createElement("span");return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=this.#n,e.append(i),e}renderMainDropdown(){let e=this.#i=this.#h();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#h(){let e=document.createElement("div"),n=this.#c._signal;if(e.addEventListener("contextmenu",lo,{signal:n}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#a)e.id=`${this.#a.id}_colorpicker_dropdown`;for(let[i,s]of this.#c.highlightColors){let a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=i,a.setAttribute("data-l10n-id",Gr.#f[i]);let r=document.createElement("span");a.append(r),r.className="swatch",r.style.backgroundColor=s,a.ariaSelected=s===this.#n,a.addEventListener("click",this.#d.bind(this,s),{signal:n}),e.append(a)}return e.addEventListener("keydown",this.#m.bind(this),{signal:n}),e}#d(e,n){n.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:Pn.HIGHLIGHT_COLOR,value:e}),this.update(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#g(e);return}let n=e.target.getAttribute("data-color");if(!n)return;this.#d(n,e)}_moveToNext(e){if(!this.#p){this.#g(e);return}if(e.target===this.#e){this.#i.firstElementChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#i?.firstElementChild||e.target===this.#e){if(this.#p)this._hideDropdownFromKeyboard();return}if(!this.#p)this.#g(e);e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#p){this.#g(e);return}this.#i.firstElementChild?.focus()}_moveToEnd(e){if(!this.#p){this.#g(e);return}this.#i.lastElementChild?.focus()}#m(e){Gr._keyboardManager.exec(this,e)}#g(e){if(this.#p){this.hideDropdown();return}if(this.#s=e.detail===0,!this.#l)this.#l=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#c.combinedSignal(this.#l)});if(this.#e.ariaExpanded="true",this.#i){this.#i.classList.remove("hidden");return}let n=this.#i=this.#h();this.#e.append(n)}#u(e){if(this.#i?.contains(e.target))return;this.hideDropdown()}hideDropdown(){this.#i?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#l?.abort(),this.#l=null}get#p(){return this.#i&&!this.#i.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(this.#r)return;if(!this.#p){this.#a?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#s})}update(e){if(this.#t)this.#t.style.backgroundColor=e;if(!this.#i)return;let n=this.#c.highlightColors.values();for(let i of this.#i.children)i.ariaSelected=n.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#i?.remove(),this.#i=null}}class lm{#e=null;#t=!1;#n=null;#i=null;static#s=null;constructor(e){this.#n=e,this.#i=e._uiManager,lm.#s||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;let{editorType:e,colorType:n,colorAndOpacityType:i,opacityType:s,color:a,opacity:r}=this.#n,l=this.#t=si.isAlphaColorInputSupported&&s!==void 0,c=this.#e=document.createElement("input");if(c.type="color",l){c.setAttribute("alpha","");let p=Ot.hexNums[Math.round((r??1)*255)];c.value=(a||"#000000")+p}else c.value=a||"#000000";return c.className="basicColorPicker",c.tabIndex=0,c.setAttribute("data-l10n-id",lm.#s[e]),c.addEventListener("input",()=>{if(l){let p=hm(c.value);if(!p)return;let[m,g,y,x]=p,I=Ot.makeHexColor(m,g,y);if(i!==void 0)this.#i.updateParams(i,{color:I,opacity:x});else this.#i.updateParams(n,I),this.#i.updateParams(s,x)}else this.#i.updateParams(n,c.value)},{signal:this.#i._signal}),c}update(e){if(!this.#e)return;if(this.#t){let n=Ot.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+n}else this.#e.value=e}updateOpacity(e){if(!this.#e||!this.#t)return;let n=Ot.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+n}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}}function Jk(e){return Math.floor(vi(e,0,1)*255).toString(16).padStart(2,"0")}function Qp(e){return vi(e,0,1)*255}class a9{static CMYK_G([e,n,i,s]){return["G",1-Math.min(1,0.3*e+0.59*i+0.11*n+s)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Qp(e),[e,e,e]}static G_HTML([e]){let n=Jk(e);return`#${n}${n}${n}`}static RGB_G([e,n,i]){return["G",0.3*e+0.59*n+0.11*i]}static RGB_rgb(e){return e.map(Qp)}static RGB_HTML(e){return`#${e.map(Jk).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,n,i,s]){return["RGB",1-Math.min(1,e+s),1-Math.min(1,i+s),1-Math.min(1,n+s)]}static CMYK_rgb([e,n,i,s]){return[Qp(1-Math.min(1,e+s)),Qp(1-Math.min(1,i+s)),Qp(1-Math.min(1,n+s))]}static CMYK_HTML(e){let n=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(n)}static RGB_CMYK([e,n,i]){let s=1-e,a=1-n,r=1-i,l=Math.min(s,a,r);return["CMYK",s,a,r,l]}}class oA{create(e,n,i=!1){if(e<=0||n<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");if(s.setAttribute("version","1.1"),!i)s.setAttribute("width",`${e}px`),s.setAttribute("height",`${n}px`);return s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${e} ${n}`),s}createElement(e){if(typeof e!=="string")throw Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Un("Abstract method `_createSVG` called.")}}class cm extends oA{_createSVG(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}var TL=9,Dh=new WeakSet,AL=new Date().getTimezoneOffset()*60*1000;class i2{static create(e){switch(e.data.annotationType){case Ni.LINK:return new C2(e);case Ni.TEXT:return new cA(e);case Ni.WIDGET:switch(e.data.fieldType){case"Tx":return new uA(e);case"Btn":if(e.data.radioButton)return new dA(e);else if(e.data.checkBox)return new fA(e);return new pA(e);case"Ch":return new mA(e);case"Sig":return new hA(e)}return new ru(e);case Ni.POPUP:return new c2(e);case Ni.FREETEXT:return new x9(e);case Ni.LINE:return new bA(e);case Ni.SQUARE:return new wA(e);case Ni.CIRCLE:return new yA(e);case Ni.POLYLINE:return new k9(e);case Ni.CARET:return new SA(e);case Ni.INK:return new j2(e);case Ni.POLYGON:return new vA(e);case Ni.HIGHLIGHT:return new T9(e);case Ni.UNDERLINE:return new _A(e);case Ni.SQUIGGLY:return new xA(e);case Ni.STRIKEOUT:return new kA(e);case Ni.STAMP:return new A9(e);case Ni.FILEATTACHMENT:return new TA(e);case Ni.RICHMEDIA:case Ni.SCREEN:case Ni.SOUND:return new C9(e);default:return new Ti(e)}}}class Ti{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:n=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){if(this.isRenderable=n,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,n)this.contentElement=this.container=this._createContainer(i);if(s)this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:n}){return!!(e?.str||n?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Ti._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,n=this.annotationStorage?.getEditor(e.id);if(n)return n.getData();return e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:n,inkLists:i,rect:s}=this.data,a=-1/0,r=-1/0;if(n?.length>=8){for(let l=0;l<n.length;l+=8)if(n[l+1]>r)r=n[l+1],a=n[l+2];else if(n[l+1]===r)a=Math.max(a,n[l+2]);return[a,r]}if(i?.length>=1){for(let l of i)for(let c=0,p=l.length;c<p;c+=2)if(l[c+1]>r)r=l[c+1],a=l[c];else if(l[c+1]===r)a=Math.max(a,l[c]);if(a!==1/0)return[a,r]}if(s)return[s[2],s[3]];return null}_normalizePoint(e){let{page:{view:n},viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:r}}}=this.parent;return e[1]=n[3]-e[1]+n[1],e[0]=100*(e[0]-a)/i,e[1]=100*(e[1]-r)/s,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`pdfjs_internal_editor_${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){let{data:n}=this,i={deleted:!e,contents:e||""};if(!this.annotationStorage.updateEditor(n.id,{popup:i}))this.annotationStorage.setValue(`pdfjs_internal_editor_${n.id}`,{id:n.id,annotationType:n.annotationType,page:this.parent.page,popup:i,popupRef:n.popupRef,modificationDate:new Date});if(!e)this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;if(e.rect)this.#e||={rect:this.data.rect.slice(0)};let{rect:n,popup:i}=e;if(n)this.#i(n);let s=this.#n?.popup||this.popup;if(!s&&i?.text)this._createPopup(i),s=this.#n.popup;if(!s)return;if(s.updateEdited(e),i?.deleted)s.remove(),this.#n=null,this.popup=null}resetEdited(){if(!this.#e)return;this.#i(this.#e.rect),this.#n?.popup.resetEdited(),this.#e=null}#i(e){let{container:{style:n},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:l,pageY:c}}}}=this;if(i?.splice(0,4,...e),n.left=`${100*(e[0]-l)/a}%`,n.top=`${100*(r-e[3]+c)/r}%`,s===0)n.width=`${100*(e[2]-e[0])/a}%`,n.height=`${100*(e[3]-e[1])/r}%`;else this.setRotation(s)}_createContainer(e){let{data:n,parent:{page:i,viewport:s}}=this,a=document.createElement("section");if(a.setAttribute("data-annotation-id",n.id),!(this instanceof ru)&&!(this instanceof C2)&&!(this instanceof C9))a.tabIndex=0;let{style:r}=a;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,n.alternativeText)a.title=n.alternativeText;if(n.noRotate)a.classList.add("norotate");if(!n.rect||this instanceof c2){let{rotation:M}=n;if(!n.hasOwnCanvas&&M!==0)this.setRotation(M,a);return a}let{width:l,height:c}=this;if(!e&&n.borderStyle.width>0){r.borderWidth=`${n.borderStyle.width}px`;let M=n.borderStyle.horizontalCornerRadius,H=n.borderStyle.verticalCornerRadius;if(M>0||H>0){let W=`calc(${M}px * var(--total-scale-factor)) / calc(${H}px * var(--total-scale-factor))`;r.borderRadius=W}switch(n.borderStyle.style){case Md.SOLID:r.borderStyle="solid";break;case Md.DASHED:r.borderStyle="dashed";break;case Md.BEVELED:vn("Unimplemented border style: beveled");break;case Md.INSET:vn("Unimplemented border style: inset");break;case Md.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let X=n.borderColor||null;if(X)this.#t=!0,r.borderColor=Ot.makeHexColor(...X);else r.borderWidth=0}let p=Ot.normalizeRect([n.rect[0],i.view[3]-n.rect[1]+i.view[1],n.rect[2],i.view[3]-n.rect[3]+i.view[1]]),{pageWidth:m,pageHeight:g,pageX:y,pageY:x}=s.rawDims;r.left=`${100*(p[0]-y)/m}%`,r.top=`${100*(p[1]-x)/g}%`;let{rotation:I}=n;if(n.hasOwnCanvas||I===0)r.width=`${100*l/m}%`,r.height=`${100*c/g}%`;else this.setRotation(I,a);return a}setRotation(e,n=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:a,height:r}=this;if(e%180!==0)[a,r]=[r,a];n.style.width=`${100*a/i}%`,n.style.height=`${100*r/s}%`,n.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){let e=(n,i,s)=>{let a=s.detail[n],r=a[0],l=a.slice(1);s.target.style[i]=a9[`${r}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:a9[`${r}_rgb`](l)})};return en(this,"_commonActions",{display:(n)=>{let{display:i}=n.detail,s=i%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:i===1||i===2})},print:(n)=>{this.annotationStorage.setValue(this.data.id,{noPrint:!n.detail.print})},hidden:(n)=>{let{hidden:i}=n.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:(n)=>{setTimeout(()=>n.target.focus({preventScroll:!1}),0)},userName:(n)=>{n.target.title=n.detail.userName},readonly:(n)=>{n.target.disabled=n.detail.readonly},required:(n)=>{this._setRequired(n.target,n.detail.required)},bgColor:(n)=>{e("bgColor","backgroundColor",n)},fillColor:(n)=>{e("fillColor","backgroundColor",n)},fgColor:(n)=>{e("fgColor","color",n)},textColor:(n)=>{e("textColor","color",n)},borderColor:(n)=>{e("borderColor","borderColor",n)},strokeColor:(n)=>{e("strokeColor","borderColor",n)},rotation:(n)=>{let i=n.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(e,n){let i=this._commonActions;for(let s of Object.keys(n.detail))(e[s]||i[s])?.(n)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let n=this.annotationStorage.getRawValue(this.data.id);if(!n)return;let i=this._commonActions;for(let[s,a]of Object.entries(n)){let r=i[s];if(r){let l={detail:{[s]:a},target:e};r(l),delete n[s]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[n,i,s,a]=this.data.rect.map(Math.fround);if(e.length===8){let[M,H,X,W]=e.subarray(2,6);if(s===M&&a===H&&n===X&&i===W)return}let{style:r}=this.container,l;if(this.#t){let{borderColor:M,borderWidth:H}=r;r.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${M}" stroke-width="${H}">`],this.container.classList.add("hasBorder")}let c=s-n,p=a-i,{svgFactory:m}=this,g=m.createElement("svg");g.classList.add("quadrilateralsContainer"),g.setAttribute("width",0),g.setAttribute("height",0),g.role="none";let y=m.createElement("defs");g.append(y);let x=m.createElement("clipPath"),I=`clippath_${this.data.id}`;x.setAttribute("id",I),x.setAttribute("clipPathUnits","objectBoundingBox"),y.append(x);for(let M=2,H=e.length;M<H;M+=8){let X=e[M],W=e[M+1],Y=e[M+2],te=e[M+3],ae=m.createElement("rect"),ne=(Y-n)/c,oe=(a-W)/p,me=(X-Y)/c,be=(W-te)/p;ae.setAttribute("x",ne),ae.setAttribute("y",oe),ae.setAttribute("width",me),ae.setAttribute("height",be),x.append(ae),l?.push(`<rect vector-effect="non-scaling-stroke" x="${ne}" y="${oe}" width="${me}" height="${be}"/>`)}if(this.#t)l.push("</g></svg>')"),r.backgroundImage=l.join("");this.container.append(g),this.container.style.clipPath=`url(#${I})`}_createPopup(e=null){let{data:n}=this,i,s;if(e)i={str:e.text},s=e.date;else i=n.contentsObj,s=n.modificationDate;this.#n=new c2({data:{color:n.color,titleObj:n.titleObj,modificationDate:s,contentsObj:i,richText:n.richText,parentRect:n.rect,borderStyle:0,id:`popup_${n.id}`,rotation:n.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){Un("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,n=null){let i=[];if(this._fieldObjects){let s=this._fieldObjects.get(e)||[];for(let{page:a,id:r,exportValues:l}of s){if(a===-1)continue;if(r===n)continue;let c=typeof l==="string"?l:null,p=document.querySelector(`[data-element-id="${r}"]`);if(p&&!Dh.has(p)){vn(`_getElementsByName - element not allowed: ${r}`);continue}i.push({id:r,exportValue:c,domElement:p})}return i}for(let s of document.getElementsByName(e)){let{exportValue:a}=s,r=s.getAttribute("data-element-id");if(r===n)continue;if(!Dh.has(s))continue;i.push({id:r,exportValue:a,domElement:s})}return i}show(){if(this.container)this.container.hidden=!1;this.popup?.maybeShow()}hide(){if(this.container)this.container.hidden=!0;this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let n of e)n.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:n}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:n,mustEnterInEditMode:!0})})}updateOC(e){if(!this.data.oc||!e)return;if(e.isVisible(this.data.oc))this.show();else this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){let n=this.data.backgroundColor||null;e.style.backgroundColor=n===null?"transparent":Ot.makeHexColor(...n)}}class lA extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:e}=this;if(!e.hasComment)return;this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){if(this.editor.comment=e,!e)this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class C2 extends Ti{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!n?.ignoreBorder,createQuadrilaterals:!0});this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let s=!1;if(e.url)n.addLinkAttributes(i,e.url,e.newWindow),s=!0;else if(e.action)this._bindNamedAction(i,e.action,e.overlaidText),s=!0;else if(e.attachment)this.#t(i,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),s=!0;else if(e.setOCGState)this.#n(i,e.setOCGState,e.overlaidText),s=!0;else if(e.dest)this._bindLink(i,e.dest,e.overlaidText),s=!0;else{if(e.actions&&(e.actions.has("Action")||e.actions.has("Mouse Up")||e.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions)this._bindJSAction(i,e),s=!0;if(e.resetForm)this._bindResetFormAction(i,e.resetForm),s=!0;else if(this.isTooltipOnly&&!s)this._bindLink(i,""),s=!0}if(this.container.classList.add("linkAnnotation"),s)this.contentElement=i,this.container.append(i);return this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,n,i=""){if(e.href=this.linkService.getDestinationHash(n),e.onclick=()=>{if(n)this.linkService.goToDestination(n);return!1},n||n==="")this.#e();if(i)e.title=i}_bindNamedAction(e,n,i=""){if(e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),i)e.title=i;this.#e()}#t(e,n,i,s="",a=null){if(e.href=this.linkService.getAnchorUrl(""),i.description)e.title=i.description;else if(s)e.title=s;let r=async()=>{let l=await this.linkService.getAttachmentContent(n);if(l)this.downloadManager?.openOrDownloadData(l,i.filename,a)};e.onclick=()=>(r(),!1),this.#e()}#n(e,n,i=""){if(e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),i)e.title=i;this.#e()}_bindJSAction(e,{actions:n,id:i,overlaidText:s}){e.href=this.linkService.getAnchorUrl("");let a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of n.keys()){let l=a.get(r);if(!l)continue;e[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:r}}),!1)}if(s)e.title=s;e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,n){let i=e.onclick;if(!i)e.href=this.linkService.getAnchorUrl("");if(this.#e(),!this._fieldObjects){if(vn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),!i)e.onclick=()=>!1;return}e.onclick=()=>{i?.();let{fields:s,refs:a,include:r}=n,l=[];if(s.length!==0||a.length!==0){let m=new Set(a);for(let g of s){let y=this._fieldObjects.get(g)||[];for(let{id:x}of y)m.add(x)}for(let g of this._fieldObjects.values())for(let y of g)if(m.has(y.id)===r)l.push(y)}else for(let m of this._fieldObjects.values())l.push(...m);let c=this.annotationStorage,p=[];for(let m of l){let{id:g}=m;switch(p.push(g),m.type){case"text":{let x=m.defaultValue||"";c.setValue(g,{value:x});break}case"checkbox":case"radiobutton":{let x=m.defaultValue===m.exportValues;c.setValue(g,{value:x});break}case"combobox":case"listbox":{let x=m.defaultValue||"";c.setValue(g,{value:x});break}default:continue}let y=document.querySelector(`[data-element-id="${g}"]`);if(!y)continue;else if(!Dh.has(y)){vn(`_bindResetFormAction - element not allowed: ${g}`);continue}y.dispatchEvent(new Event("resetform"))}if(this.enableScripting)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:p,name:"ResetForm"}});return!1}}}class cA extends Ti{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let e=document.createElement("img");if(e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(e),this.container}}class ru extends Ti{render(){return this.container}_getKeyModifier(e){return si.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,n,i,s,a){if(i.includes("mouse"))e.addEventListener(i,(r)=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})});else e.addEventListener(i,(r)=>{if(i==="blur"){if(!n.focused||!r.relatedTarget)return;n.focused=!1}else if(i==="focus"){if(n.focused)return;n.focused=!0}if(!a)return;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r)}})})}_setEventListeners(e,n,i,s){let{actions:a}=this.data;for(let[r,l]of i)if(l==="Action"||a?.has(l)){if(l==="Focus"||l==="Blur")n||={focused:!1};if(this._setEventListener(e,n,r,l,s),l==="Focus"&&!a?.has("Blur"))this._setEventListener(e,n,"blur","Blur",null);else if(l==="Blur"&&!a?.has("Focus"))this._setEventListener(e,n,"focus","Focus",null)}}_setTextStyle(e){let n=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||TL,a=e.style,r,l=2,c=(p)=>Math.round(10*p)/10;if(this.data.multiLine){let p=Math.abs(this.data.rect[3]-this.data.rect[1]-2),m=Math.round(p/(1.35*s))||1,g=p/m;r=Math.min(s,c(g/1.35))}else{let p=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(s,c(p/1.35))}if(a.fontSize=`calc(${r}px * var(--total-scale-factor))`,a.color=Ot.makeHexColor(...i),this.data.textAlignment!==null&&!this.data.comb)a.textAlign=n[this.data.textAlignment]}_setRequired(e,n){if(n)e.setAttribute("required",!0);else e.removeAttribute("required");e.setAttribute("aria-required",n)}}class uA extends ru{constructor(e){let n=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:n})}setPropertyOnSiblings(e,n,i,s){let a=this.annotationStorage;for(let r of this._getElementsByName(e.name,e.id)){if(r.domElement)r.domElement[n]=i;a.setValue(r.id,{[s]:i})}}render(){let e=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let s=e.getValue(n,{value:this.data.fieldValue}),a=s.value||"",r=e.getValue(n,{charLimit:this.data.maxLen}).charLimit;if(r&&a.length>r)a=a.slice(0,r);let l=s.formattedValue||this.data.textContent?.join(`
|
|
289
|
+
`)||null;if(l&&this.data.comb)l=l.replaceAll(/\s+/g,"");let c={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};if(this.data.multiLine){if(i=document.createElement("textarea"),i.textContent=l??a,this.data.doNotScroll)i.style.overflowY="hidden"}else if(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",l??a),this.data.doNotScroll)i.style.overflowX="hidden";if(this.data.hasOwnCanvas){if(this.container.classList.add("hasOwnCanvas"),e.has(n))this.container.classList.add("sandboxModified")}Dh.add(i),this.contentElement=i,i.setAttribute("data-element-id",n),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;let{datetimeFormat:p,datetimeType:m,timeStep:g}=this.data,y=!!m&&this.enableScripting;if(p)i.title=p;if(this._setRequired(i,this.data.required),r)i.maxLength=r;i.addEventListener("input",(I)=>{e.setValue(n,{value:I.target.value}),this.setPropertyOnSiblings(i,"value",I.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",(I)=>{let M=this.data.defaultFieldValue??"";i.value=c.userValue=M,c.formattedValue=null});let x=(I)=>{let{formattedValue:M}=c;if(M!==null&&M!==void 0)I.target.value=M;I.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(M)=>{if(c.focused)return;let{target:H}=M;if(y){if(H.type=m,g)H.step=g}if(c.userValue){let X=c.userValue;if(y)if(m==="time"){let W=new Date(X),Y=[W.getHours(),W.getMinutes(),W.getSeconds()];H.value=Y.map((te)=>te.toString().padStart(2,"0")).join(":")}else H.value=new Date(X-AL).toISOString().split(m==="date"?"T":".",1)[0];else H.value=X}if(c.lastCommittedValue=H.value,c.commitKey=1,!this.data.actions?.has("Focus"))c.focused=!0}),i.addEventListener("updatefromsandbox",(M)=>{this.container.classList.add("sandboxModified");let H={value(X){if(c.userValue=X.detail.value??"",!y)e.setValue(n,{value:c.userValue.toString()});X.target.value=c.userValue},formattedValue(X){let{formattedValue:W}=X.detail;if(c.formattedValue=W,W!==null&&W!==void 0&&X.target!==document.activeElement)X.target.value=W;let Y={formattedValue:W};if(y)Y.value=W;e.setValue(n,Y)},selRange(X){X.target.setSelectionRange(...X.detail.selRange)},charLimit:(X)=>{let{charLimit:W}=X.detail,{target:Y}=X;if(W===0){Y.removeAttribute("maxLength");return}Y.setAttribute("maxLength",W);let te=c.userValue;if(!te||te.length<=W)return;te=te.slice(0,W),Y.value=c.userValue=te,e.setValue(n,{value:te}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:te,willCommit:!0,commitKey:1,selStart:Y.selectionStart,selEnd:Y.selectionEnd}})}};this._dispatchEventFromSandbox(H,M)}),i.addEventListener("keydown",(M)=>{c.commitKey=1;let H=-1;if(M.key==="Escape")H=0;else if(M.key==="Enter"&&!this.data.multiLine)H=2;else if(M.key==="Tab")c.commitKey=3;if(H===-1)return;let{value:X}=M.target;if(c.lastCommittedValue===X)return;c.lastCommittedValue=X,c.userValue=X,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:X,willCommit:!0,commitKey:H,selStart:M.target.selectionStart,selEnd:M.target.selectionEnd}})});let I=x;if(x=null,i.addEventListener("blur",(M)=>{if(!c.focused||!M.relatedTarget)return;if(!this.data.actions?.has("Blur"))c.focused=!1;let{target:H}=M,{value:X}=H;if(y){if(X&&m==="time"){let W=X.split(":").map((Y)=>parseInt(Y,10));X=new Date(2000,0,1,W[0],W[1],W[2]||0).valueOf(),H.step=""}else{if(!X.includes("T"))X=`${X}T00:00`;X=new Date(X).valueOf()}H.type="text"}if(c.userValue=X,c.lastCommittedValue!==X)this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:X,willCommit:!0,commitKey:c.commitKey,selStart:M.target.selectionStart,selEnd:M.target.selectionEnd}});I(M)}),this.data.actions?.has("Keystroke"))i.addEventListener("beforeinput",(M)=>{c.lastCommittedValue=null;let{data:H,target:X}=M,{value:W,selectionStart:Y,selectionEnd:te}=X,ae=Y,ne=te;switch(M.inputType){case"deleteWordBackward":{let oe=/\w/;while(ae>0&&!oe.test(W[ae-1]))ae--;while(ae>0&&oe.test(W[ae-1]))ae--;break}case"deleteWordForward":{let oe=W.substring(Y).match(/^\W*\w*/);if(oe)ne+=oe[0].length;break}case"deleteContentBackward":if(Y===te)ae-=1;break;case"deleteContentForward":if(Y===te)ne+=1;break}M.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:W,change:H||"",willCommit:!1,selStart:ae,selEnd:ne}})});this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(M)=>M.target.value)}if(x)i.addEventListener("blur",x);if(this.data.comb){let M=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.setProperty("--comb-width",`calc(${M}px * var(--total-scale-factor))`);let H=this.data.textAlignment;if(H===1||H===2){let X=()=>{let W=r-i.value.length;i.style.setProperty("--comb-offset",`${H===1?W>>1:W}`)};X();for(let W of["input","blur","resetform","updatefromsandbox"])i.addEventListener(W,X)}}}else if(i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas)i.hidden=!0;return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class hA extends ru{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class fA extends ru{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,n=this.data,i=n.id,s=e.getValue(i,{value:n.exportValue===n.fieldValue}).value;if(typeof s==="string")s=s!=="Off",e.setValue(i,{value:s});this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");if(Dh.add(a),a.setAttribute("data-element-id",i),a.disabled=n.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=n.fieldName,s)a.setAttribute("checked",!0);if(a.setAttribute("exportValue",n.exportValue),a.tabIndex=0,a.addEventListener("change",(r)=>{let{name:l,checked:c}=r.target;for(let p of this._getElementsByName(l,i)){let m=c&&p.exportValue===n.exportValue;if(p.domElement)p.domElement.checked=m;e.setValue(p.id,{value:m})}e.setValue(i,{value:c})}),a.addEventListener("resetform",(r)=>{let l=n.defaultFieldValue||"Off";r.target.checked=l===n.exportValue}),this.enableScripting&&this.hasJSActions)a.addEventListener("updatefromsandbox",(r)=>{let l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(i,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,r)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(r)=>r.target.checked);return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class dA extends ru{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let e=this.annotationStorage,n=this.data,i=n.id,s=e.getValue(i,{value:n.buttonValue!==null&&n.fieldValue===n.buttonValue}).value;if(typeof s==="string")s=s!==n.buttonValue,e.setValue(i,{value:s});if(s)for(let r of this._getElementsByName(n.fieldName,i))e.setValue(r.id,{value:!1});let a=document.createElement("input");if(Dh.add(a),a.setAttribute("data-element-id",i),a.disabled=n.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=n.fieldName,s)a.setAttribute("checked",!0);if(a.tabIndex=0,a.addEventListener("change",(r)=>{let{name:l,checked:c}=r.target;for(let p of this._getElementsByName(l,i))e.setValue(p.id,{value:!1});e.setValue(i,{value:c})}),a.addEventListener("resetform",(r)=>{let l=n.defaultFieldValue;r.target.checked=l!==null&&l!==void 0&&l===n.buttonValue}),this.enableScripting&&this.hasJSActions){let r=n.buttonValue;a.addEventListener("updatefromsandbox",(l)=>{let c={value:(p)=>{let m=r===p.detail.value;for(let g of this._getElementsByName(p.target.name)){let y=m&&g.id===i;if(g.domElement)g.domElement.checked=y;e.setValue(g.id,{value:y})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(l)=>l.target.checked)}return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class pA extends C2{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");let n=e.lastChild;if(this.enableScripting&&this.hasJSActions&&n)this._setDefaultPropertiesFromJS(n),n.addEventListener("updatefromsandbox",(i)=>{this._dispatchEventFromSandbox({},i)});return e}}class mA extends ru{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let e=this.annotationStorage,n=this.data.id,i=e.getValue(n,{value:this.data.fieldValue}),s=document.createElement("select");Dh.add(s),s.setAttribute("data-element-id",n),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let a=this.data.combo&&this.data.options.length>0;if(!this.data.combo){if(s.size=this.data.options.length,this.data.multiSelect)s.multiple=!0}s.addEventListener("resetform",(g)=>{let y=this.data.defaultFieldValue;for(let x of s.options)x.selected=x.value===y});let r=(g,y)=>{let x=y.replaceAll(" "," ");if(g.textContent=x,x!==y)g.setAttribute("display-value",y)};for(let g of this.data.options){let y=document.createElement("option");if(r(y,g.displayValue),y.value=g.exportValue,i.value.includes(g.exportValue))y.setAttribute("selected",!0),a=!1;s.append(y)}let l=null;if(a){let g=document.createElement("option");g.value=" ",g.setAttribute("hidden",!0),g.setAttribute("selected",!0),s.prepend(g),l=()=>{g.remove(),s.removeEventListener("input",l),l=null},s.addEventListener("input",l)}let c=(g)=>{let y=g?"value":"textContent",{options:x,multiple:I}=s;if(!I)return x.selectedIndex===-1?null:x[x.selectedIndex][y];return Array.prototype.filter.call(x,(M)=>M.selected).map((M)=>M[y])},p=c(!1),m=(g)=>{let y=g.target.options;return Array.prototype.map.call(y,(x)=>({displayValue:x.getAttribute("display-value")||x.textContent,exportValue:x.value}))};if(this.enableScripting&&this.hasJSActions)s.addEventListener("updatefromsandbox",(g)=>{let y={value(x){l?.();let I=x.detail.value,M=new Set(Array.isArray(I)?I:[I]);for(let H of s.options)H.selected=M.has(H.value);e.setValue(n,{value:c(!0)}),p=c(!1)},multipleSelection(x){s.multiple=!0},remove(x){let I=s.options,M=x.detail.remove;if(I[M].selected=!1,s.remove(M),I.length>0){if(Array.prototype.findIndex.call(I,(X)=>X.selected)===-1)I[0].selected=!0}e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},clear(x){while(s.length!==0)s.remove(0);e.setValue(n,{value:null,items:[]}),p=c(!1)},insert(x){let{index:I,displayValue:M,exportValue:H}=x.detail.insert,X=s.children[I],W=document.createElement("option");if(r(W,M),W.value=H,X)X.before(W);else s.append(W);e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},items(x){let{items:I}=x.detail;while(s.length!==0)s.remove(0);for(let M of I){let{displayValue:H,exportValue:X}=M,W=document.createElement("option");r(W,H),W.value=X,s.append(W)}if(s.options.length>0)s.options[0].selected=!0;e.setValue(n,{value:c(!0),items:m(x)}),p=c(!1)},indices(x){let I=new Set(x.detail.indices);for(let M of x.target.options)M.selected=I.has(M.index);e.setValue(n,{value:c(!0)}),p=c(!1)},editable(x){x.target.disabled=!x.detail.editable}};this._dispatchEventFromSandbox(y,g)}),s.addEventListener("input",(g)=>{let y=c(!0),x=c(!1);e.setValue(n,{value:y}),g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:p,change:x,changeEx:y,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(g)=>g.target.value);else s.addEventListener("input",function(g){e.setValue(n,{value:c(!0)})});if(this.data.combo)this._setTextStyle(s);return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class c2 extends Ti{constructor(e){let{data:n,elements:i,parent:s}=e,a=!!s._commentManager;super(e,{isRenderable:!a&&Ti._hasPopupData(n)});if(this.elements=i,a&&Ti._hasPopupData(n)){let r=this.popup=this.#e();for(let l of i)l.popup=r}else this.popup=null}#e(){return new gA({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let n=this.popup=this.#e(),i=[];for(let s of this.elements)s.popup=n,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map((s)=>`pdfjs_internal_id_${s}`).join(",")),this.container}}class gA{#e=null;#t=this.#G.bind(this);#n=this.#S.bind(this);#i=this.#A.bind(this);#s=this.#H.bind(this);#r=null;#a=null;#o=null;#l=null;#c=null;#f=null;#h=null;#d=!1;#m=null;#g=null;#u=null;#p=null;#b=null;#w=null;#y=null;#v=null;#x=null;#_=null;#k=!1;#T=null;#q=null;constructor({container:e,color:n,elements:i,titleObj:s,modificationDate:a,contentsObj:r,richText:l,parent:c,rect:p,parentRect:m,open:g,commentManager:y=null}){if(this.#a=e,this.#x=s,this.#o=r,this.#v=l,this.#f=c,this.#r=n,this.#y=p,this.#h=m,this.#c=i,this.#e=y,this.#T=i[0],this.#l=r2.toDateObject(a),this.trigger=i.flatMap((x)=>x.getElementsToTriggerPopup()),!y){if(this.#j(),this.#a.hidden=!0,g)this.#H()}}#j(){if(this.#g)return;this.#g=new AbortController;let{signal:e}=this.#g;for(let n of this.trigger)n.addEventListener("click",this.#s,{signal:e}),n.addEventListener("pointerenter",this.#i,{signal:e}),n.addEventListener("pointerleave",this.#n,{signal:e}),n.classList.add("popupTriggerArea");for(let n of this.#c)n.container?.addEventListener("keydown",this.#t,{signal:e})}#C(){let e=this.#c.find((n)=>n.hasCommentButton);if(!e)return;this.#b=e._normalizePoint(e.commentButtonPosition)}renderCommentButton(){if(this.#p){if(!this.#p.parentNode)this.#T.container.after(this.#p);return}if(!this.#b)this.#C();if(!this.#b)return;let{signal:e}=this.#g=new AbortController,n=this.#T.hasOwnCommentButton,i=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!n)},s=()=>{this.#e.toggleCommentPopup(this,!1,!0,!n)},a=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(!n){let r=this.#p=document.createElement("button");r.className="annotationCommentButton";let l=this.#T.container;r.style.zIndex=parseInt(l.style.zIndex,10)+1,r.tabIndex=0,r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#D(),this.#I(),r.addEventListener("keydown",this.#t,{signal:e}),r.addEventListener("click",i,{signal:e}),r.addEventListener("pointerenter",s,{signal:e}),r.addEventListener("pointerleave",a,{signal:e}),l.after(r)}else{this.#p=this.#T.container;for(let r of this.trigger)r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.addEventListener("keydown",this.#t,{signal:e}),r.addEventListener("click",i,{signal:e}),r.addEventListener("pointerenter",s,{signal:e}),r.addEventListener("pointerleave",a,{signal:e}),r.classList.add("popupTriggerArea")}}#I(){if(this.#T.extraPopupElement&&!this.#T.editor)return;if(!this.#p)this.renderCommentButton();let[e,n]=this.#b,{style:i}=this.#p;i.left=`calc(${e}%)`,i.top=`calc(${n}% - var(--comment-button-dim))`}#D(){if(this.#T.extraPopupElement)return;if(!this.#p)this.renderCommentButton();this.#p.style.backgroundColor=this.commentButtonColor||""}get commentButtonColor(){let{color:e,opacity:n}=this.#T.commentData;if(!e)return null;return this.#f._commentManager.makeCommentColor(e,n)}focusCommentButton(){setTimeout(()=>{this.#p?.focus()},0)}getData(){let{richText:e,color:n,opacity:i,creationDate:s,modificationDate:a}=this.#T.commentData;return{contentsObj:{str:this.comment},richText:e,color:n,opacity:i,creationDate:s,modificationDate:a}}get elementBeforePopup(){return this.#p}get comment(){return this.#q||=this.#T.commentText,this.#q}set comment(e){if(e===this.comment)return;this.#T.commentText=this.#q=e}focus(){this.#T.container?.focus()}get parentBoundingClientRect(){return this.#T.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:n}){if(!this.#p)return;this.#p.classList.toggle("selected",e),this.#p.ariaExpanded=n}setSelectedCommentButton(e){this.#p.classList.toggle("selected",e)}get commentPopupPosition(){if(this.#w)return this.#w;let{x:e,y:n,height:i}=this.#p.getBoundingClientRect(),{x:s,y:a,width:r,height:l}=this.#T.layer.getBoundingClientRect();return[(e-s)/r,(n+i-a)/l]}set commentPopupPosition(e){this.#w=e}hasDefaultPopupPosition(){return this.#w===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#p.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[n,i]=this.#w||this.commentButtonPosition.map((p)=>p/100),s=this.parentBoundingClientRect,{x:a,y:r,width:l,height:c}=s;this.#e.showDialog(null,this,a+n*l,r+i*c,{...e,parentDimensions:s})}render(){if(this.#m)return;let e=this.#m=document.createElement("div");if(e.className="popup",this.#r){let i=e.style.outlineColor=Ot.makeHexColor(...this.#r);e.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let n=document.createElement("span");if(n.className="header",this.#x?.str){let i=document.createElement("span");i.className="title",n.append(i),{dir:i.dir,str:i.textContent}=this.#x}if(e.append(n),this.#l){let i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#l.valueOf()})),i.dateTime=this.#l.toISOString(),n.append(i)}rT({html:this.#M||this.#o.str,dir:this.#o?.dir,className:"popupContent"},e),this.#a.append(e)}get#M(){let e=this.#v,n=this.#o;if(e?.str&&(!n?.str||n.str===e.str))return this.#v.html||null;return null}get#L(){return this.#M?.attributes?.style?.fontSize||0}get#R(){return this.#M?.attributes?.style?.color||null}#F(e){let n=[],i={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:n}]}},s={style:{color:this.#R,fontSize:this.#L?`calc(${this.#L}px * var(--total-scale-factor))`:""}};for(let a of e.split(`
|
|
290
|
+
`))n.push({name:"span",value:a,attributes:s});return i}#G(e){if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;if(e.key==="Enter"||e.key==="Escape"&&this.#d)this.#H()}updateEdited({rect:e,popup:n,deleted:i}){if(this.#e){if(i)this.remove(),this.#q=null;else if(n)if(n.deleted)this.remove();else this.#D(),this.#q=n.text;if(e)this.#b=null,this.#C(),this.#I();return}if(i||n?.deleted){this.remove();return}if(this.#j(),this.#_||={contentsObj:this.#o,richText:this.#v},e)this.#u=null;if(n&&n.text)this.#v=this.#F(n.text),this.#l=r2.toDateObject(n.date),this.#o=null;this.#m?.remove(),this.#m=null}resetEdited(){if(!this.#_)return;({contentsObj:this.#o,richText:this.#v}=this.#_),this.#_=null,this.#m?.remove(),this.#m=null,this.#u=null}remove(){if(this.#g?.abort(),this.#g=null,this.#m?.remove(),this.#m=null,this.#k=!1,this.#d=!1,this.#p?.remove(),this.#p=null,this.trigger)for(let e of this.trigger)e.classList.remove("popupTriggerArea")}#N(){if(this.#u!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}}=this.#f,r=!!this.#h,l=r?this.#h:this.#y;for(let I of this.#c)if(!l||Ot.intersect(I.data.rect,l)!==null){l=I.data.rect,r=!0;break}let c=Ot.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),p=5,m=r?l[2]-l[0]+p:0,g=c[0]+m,y=c[1];this.#u=[100*(g-s)/n,100*(y-a)/i];let{style:x}=this.#a;x.left=`${this.#u[0]}%`,x.top=`${this.#u[1]}%`}#H(){if(this.#e){this.#e.toggleCommentPopup(this,!1);return}if(this.#d=!this.#d,this.#d)this.#A(),this.#a.addEventListener("click",this.#s),this.#a.addEventListener("keydown",this.#t);else this.#S(),this.#a.removeEventListener("click",this.#s),this.#a.removeEventListener("keydown",this.#t)}#A(){if(!this.#m)this.render();if(!this.isVisible)this.#N(),this.#a.hidden=!1,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)+1000;else if(this.#d)this.#a.classList.add("focused")}#S(){if(this.#a.classList.remove("focused"),this.#d||!this.isVisible)return;this.#a.hidden=!0,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)-1000}forceHide(){if(this.#k=this.isVisible,!this.#k)return;this.#a.hidden=!0}maybeShow(){if(this.#e)return;if(this.#j(),!this.#k)return;if(!this.#m)this.#A();this.#k=!1,this.#a.hidden=!1}get isVisible(){return!this.#e&&this.#a.hidden===!1}}class x9 extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=yn.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(let n of this.textContent){let i=document.createElement("span");i.textContent=n,e.append(i)}this.container.append(e)}if(!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this._editOnDoubleClick(),this.container}}class bA extends Ti{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=this.#e=this.svgFactory.createElement("svg:line");if(a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class wA extends Ti{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,r=this.#e=this.svgFactory.createElement("svg:rect");if(r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",n-a),r.setAttribute("height",i-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class yA extends Ti{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,r=this.#e=this.svgFactory.createElement("svg:ellipse");if(r.setAttribute("cx",n/2),r.setAttribute("cy",i/2),r.setAttribute("rx",n/2-a/2),r.setAttribute("ry",i/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!e.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class k9 extends Ti{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:n,borderStyle:i,popupRef:s},width:a,height:r}=this;if(!n)return this.container;let l=this.svgFactory.create(a,r,!0),c=[];for(let m=0,g=n.length;m<g;m+=2){let y=n[m]-e[0],x=e[3]-n[m+1];c.push(`${y},${x}`)}c=c.join(" ");let p=this.#e=this.svgFactory.createElement(this.svgElementName);if(p.setAttribute("points",c),p.setAttribute("stroke-width",i.width||1),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),l.append(p),this.container.append(l),!s&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class vA extends k9{constructor(e){super(e);this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class SA extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){if(this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container}}class j2 extends Ti{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?yn.HIGHLIGHT:yn.INK}#n(e,n){switch(e){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:n,inkLists:i,borderStyle:s,popupRef:a}}=this,{transform:r,width:l,height:c}=this.#n(n,e),p=this.svgFactory.create(l,c,!0),m=this.#e=this.svgFactory.createElement("svg:g");p.append(m),m.setAttribute("stroke-width",s.width||1),m.setAttribute("stroke-linecap","round"),m.setAttribute("stroke-linejoin","round"),m.setAttribute("stroke-miterlimit",10),m.setAttribute("stroke","transparent"),m.setAttribute("fill","transparent"),m.setAttribute("transform",r);for(let g of i){let y=this.svgFactory.createElement(this.svgElementName);this.#t.push(y),y.setAttribute("points",g.join(",")),m.append(y)}if(!a&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this.container.append(p),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:n,points:i,rect:s}=e,a=this.#e;if(n>=0)a.setAttribute("stroke-width",n||1);if(i)for(let r=0,l=this.#t.length;r<l;r++)this.#t[r].setAttribute("points",i[r].join(","));if(s){let{transform:r,width:l,height:c}=this.#n(this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${c}`),a.setAttribute("transform",r)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class T9 extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0});this.annotationEditorType=yn.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){let i=document.createElement("mark");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class _A extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("underlineAnnotation"),e){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class xA extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("squigglyAnnotation"),e){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class kA extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:n}}=this;if(!n&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();if(this.container.classList.add("strikeoutAnnotation"),e){let i=document.createElement("s");i.classList.add("overlaidText"),i.textContent=e,this.container.append(i)}return this.container}}class A9 extends Ti{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.annotationEditorType=yn.STAMP}render(){if(this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();return this._editOnDoubleClick(),this.container}}class TA extends Ti{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:n,file:i}=this.data;this.filename=i.filename,this.content=i.content,this.fileId=n,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:n}=this,i;if(n.hasAppearance||n.fillAlpha===0)i=document.createElement("div");else if(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1)i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`;i.addEventListener("dblclick",this.#t.bind(this)),this.#e=i;let{isMac:s}=si.platform;if(e.addEventListener("keydown",(a)=>{if(a.key==="Enter"&&(s?a.metaKey:a.ctrlKey))this.#t()}),!n.popupRef&&this.hasPopupData)this.hasOwnCommentButton=!0,this._createPopup();else i.classList.add("popupTriggerArea");return e.append(i),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}async#t(){let{fileId:e,filename:n,content:i}=this,s=await this.linkService.getAttachmentContent(e)||i;if(s)this.downloadManager?.openOrDownloadData(s,n)}}class C9 extends Ti{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add("mediaAnnotation");let{filename:e}=this.data.richMedia,n=document.createElement("button");return n.className="mediaPlayButton",n.type="button",n.title=n.ariaLabel=e,n.addEventListener("click",()=>this.#i(n),{signal:this.#e.signal}),this.container.append(n),this.container}async#i(e){let{fileId:n,filename:i,contentType:s}=this.data.richMedia;e.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(n)}catch{return}finally{e.disabled=!1}if(!a||!e.isConnected)return;let{signal:r}=this.#e,l=URL.createObjectURL(new Blob([a],{type:s}));this.#t=l;let c=s.startsWith("audio/"),p=document.createElement(c?"audio":"video");if(this.#n=p,p.className="mediaContent",this._setBackgroundColor(p),p.src=l,p.title=i,p.controls=!0,p.autoplay=!0,p.tabIndex=0,c){let m=!1,g=!1,y=()=>{p.controls=m||g};this.container.addEventListener("pointerenter",()=>{m=!0,y()},{signal:r}),this.container.addEventListener("pointerleave",()=>{m=!1,y()},{signal:r}),this.container.addEventListener("focusin",()=>{g=!0,y()},{signal:r}),this.container.addEventListener("focusout",()=>{g=!1,y()},{signal:r})}p.addEventListener("emptied",()=>this.#s(l),{once:!0,signal:r}),e.replaceWith(p),p.play().catch(()=>{})}#s(e=this.#t){if(e&&e===this.#t)URL.revokeObjectURL(e),this.#t=null}destroy(){if(this.#e.abort(),this.#n)this.#n.pause(),this.#n.removeAttribute("src"),this.#n.load(),this.#n=null;this.#s()}}class j9{#e=null;#t=null;#n=null;#i=new Map;#s=null;#r=null;#a=[];#o=!1;zIndex=0;constructor({div:e,accessibilityManager:n,annotationCanvasMap:i,annotationEditorUIManager:s,page:a,viewport:r,structTreeLayer:l,commentManager:c,linkService:p,annotationStorage:m}){this.div=e,this.#e=n,this.#t=i,this.#s=l||null,this.#r=p||null,this.#n=m||new v2,this.page=a,this.viewport=r,this._annotationEditorUIManager=s,this._commentManager=c||null}hasEditableAnnotations(){return this.#i.size>0}async render(e){let{annotations:n,optionalContentConfig:i}=e,s=this.div;qh(s,this.viewport);let a=new Map,r=[],l={data:null,layer:s,linkService:this.#r,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new cm,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let c of n){if(c.noHTML)continue;let p=c.annotationType===Ni.POPUP;if(!p){if(c.rect[2]===c.rect[0]||c.rect[3]===c.rect[1])continue}else{let y=a.get(c.id);if(!y)continue;if(!this._commentManager){r.push(c);continue}l.elements=y}l.data=c;let m=i2.create(l);if(!m.isRenderable)continue;if(!p){if(this.#a.push(m),c.popupRef)a.getOrInsertComputed(c.popupRef,Nd).push(m)}let g=m.render();if(c.hidden)g.style.visibility="hidden";if(m.updateOC(i),m._isEditable)this.#i.set(m.data.id,m),this._annotationEditorUIManager?.renderAnnotationElement(m)}await this.#l();for(let c of r){let p=l.elements=a.get(c.id);l.data=c;let m=i2.create(l);if(!m.isRenderable)continue;let g=m.render();if(m.contentElement.id=`pdfjs_internal_id_${c.id}`,c.hidden)g.style.visibility="hidden";p.at(-1).container.after(g)}this.#c()}async#l(){if(this.#a.length===0)return;this.div.replaceChildren();let e=[];if(!this.#o){this.#o=!0;for(let{contentElement:i,data:{hidden:s,id:a,oc:r}}of this.#a){let l=i.id=`pdfjs_internal_id_${a}`,c=i.localName==="a"&&!s&&!r;e.push(this.#s?.getAriaAttributes(l,{enableLinkOwnership:c}).then((p)=>{if(p)for(let[m,g]of p)i.setAttribute(m,g)}))}}this.#a.sort(({data:{rect:[i,s,a,r]}},{data:{rect:[l,c,p,m]}})=>{if(i===a&&s===r)return 1;if(l===p&&c===m)return-1;let g=r,y=s,x=(s+r)/2,I=m,M=c,H=(c+m)/2;if(x>=I&&H<=y)return-1;if(H>=g&&x<=M)return 1;let X=(i+a)/2,W=(l+p)/2;return X-W});let n=document.createDocumentFragment();for(let i of this.#a)if(n.append(i.container),this._commentManager)(i.extraPopupElement?.popup||i.popup)?.renderCommentButton();else if(i.extraPopupElement)n.append(i.extraPopupElement.render());if(this.div.append(n),await Promise.all(e),this.#e){let i=await this.#s?.getAnnotationIds();for(let{contentElement:s}of this.#a){if(i?.has(s.id))continue;this.#e.addPointerInTextLayer(s,!1)}}}async addLinkAnnotations(e){let n={data:null,layer:this.div,linkService:this.#r,svgFactory:new cm,parent:this};for(let i of e){i.borderStyle||=j9._defaultBorderStyle,n.data=i;let s=i2.create(n);if(!s.isRenderable)continue;s.render(),s.contentElement.id=`pdfjs_internal_id_${i.id}`,this.#a.push(s)}await this.#l()}update({viewport:e,optionalContentConfig:n}){let i=this.div;this.viewport=e,qh(i,{rotation:e.rotation});for(let s of this.#a)s.updateOC(n);this.#c(),i.hidden=!1}destroy(){for(let e of this.#a)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#a.length=0,this.#i.clear(),this.div.replaceChildren()}#c(){if(!this.#t)return;let e=this.div;for(let[n,i]of this.#t){let s=e.querySelector(`[data-annotation-id="${n}"]`);if(!s)continue;if(Array.isArray(i))for(let p of i)p.className="annotationContent",p.ariaHidden=!0;else i.className="annotationContent",i.ariaHidden=!0;let a=[];for(let p of s.children)if(p.nodeName==="CANVAS")a.push(p);for(let p of a)p.remove();let r=Array.isArray(i)?i[0]:i,{firstChild:l}=s;if(!l)s.append(r);else if(!l.classList.contains("annotationContent"))l.before(r);else l.after(r);if(Array.isArray(i)){let p=r;for(let m=1,g=i.length;m<g;m++)p.after(i[m]),p=i[m]}this.#t.delete(n);let c=this.#i.get(n);if(!c)continue;if(c._hasNoCanvas)this._annotationEditorUIManager?.setMissingCanvas(n,s.id,i),c._hasNoCanvas=!1;else c.canvas=i}}refreshCanvases(){this.#c()}getEditableAnnotations(){return this.#i.values()}getEditableAnnotation(e){return this.#i.get(e)}addFakeAnnotation(e){let{div:n}=this,{id:i,rotation:s}=e,a=new lA({data:{id:i,rect:e.getPDFRect(),rotation:s},editor:e,layer:n,parent:this,enableComment:!!this._commentManager,linkService:this.#r,annotationStorage:this.#n});return a.render(),a.contentElement.id=`pdfjs_internal_id_${i}`,a.createOrUpdatePopup(),this.#a.push(a),a}removeAnnotation(e){let n=this.#a.findIndex((s)=>s.data.id===e);if(n<0)return;let[i]=this.#a.splice(n,1);this.#e?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(e){if(e.length===0)return;for(let n of e)n.updateFakeAnnotationElement(this);this.#l()}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return en(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Md.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}var Yb=/\r\n?|\n/g;class Os extends Jt{#e="";#t=`${this.id}-editor`;#n=null;#i;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let e=Os.prototype,n=(a)=>a.isEmpty(),{TRANSLATE_SMALL:i,TRANSLATE_BIG:s}=au;return en(this,"_keyboardManager",new hr([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],e.commitOrRemove],[["Escape"],e.commitOrRemove],[["ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:n}],[["ArrowRight"],e._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[s,0],checker:n}],[["ArrowUp"],e._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:n}],[["ArrowDown"],e._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,s],checker:n}]]))}static _type="freetext";static _editorType=yn.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"});if(this.color=e.color||Os._defaultColor||Jt._defaultLineColor,this.#i=e.fontSize||Os._defaultFontSize,!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert.freetext);this.canAddComment=!1}static initialize(e,n){Jt.initialize(e,n);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case Pn.FREETEXT_SIZE:Os._defaultFontSize=n;break;case Pn.FREETEXT_COLOR:Os._defaultColor=n;break}}updateParams(e,n){switch(e){case Pn.FREETEXT_SIZE:this.#s(n);break;case Pn.FREETEXT_COLOR:this.#r(n);break}}static get defaultPropertiesToUpdate(){return[[Pn.FREETEXT_SIZE,Os._defaultFontSize],[Pn.FREETEXT_COLOR,Os._defaultColor||Jt._defaultLineColor]]}get propertiesToUpdate(){return[[Pn.FREETEXT_SIZE,this.#i],[Pn.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new lm(this),[["colorPicker",this._colorPicker]]}get colorType(){return Pn.FREETEXT_COLOR}#s(e){let n=(s)=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-this.#i)*this.parentScale),this.#i=s,this.#o()},i=this.#i;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Pn.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#r(e){let n=(s)=>{this.color=s,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Pn.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){let e=this.parentScale;return[-Os._internalPadding*e,-(Os._internalPadding+this.#i)*e]}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(!this.isAttachedToDOM)this.parent.add(this)}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){if(!super.disableEditMode())return!1;return this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0}focusin(e){if(!this._focusEventsAllowed)return;if(super.focusin(e),e.target!==this.editorDiv)this.editorDiv.focus()}onceAdded(e){if(this.width)return;if(this.enableEditMode(),e)this.editorDiv.focus();if(this._initialOptions?.isCentered)this.center();this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){if(this.isEditing=!1,this.parent)this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing");super.remove()}#a(){let e=[];this.editorDiv.normalize();let n=null;for(let i of this.editorDiv.childNodes){if(n?.nodeType===Node.TEXT_NODE&&i.nodeName==="BR")continue;e.push(Os.#l(i)),n=i}return e.join(`
|
|
291
|
+
`)}#o(){let[e,n]=this.parentDimensions,i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{let{currentLayer:s,div:a}=this,r=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=r,a.classList.toggle("hidden",l)}if(this.rotation%180===this.parentRotation%180)this.width=i.width/e,this.height=i.height/n;else this.width=i.height/e,this.height=i.width/n;this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,n=this.#e=this.#a().trimEnd();if(e===n)return;let i=(s)=>{if(this.#e=s,!s){this.remove();return}this.#c(),this._uiManager.rebuild(this),this.#o()};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(e)},mustExec:!1}),this.#o()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){if(e.target===this.div&&e.key==="Enter")this.enterInEditMode(),e.preventDefault()}editorDivKeydown(e){Os._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,n;if(this._isCopy||this.annotationElementId)e=this.x,n=this.y;super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#t),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,a]=this.parentDimensions;if(this.annotationElementId){let{position:r}=this._initialData,[l,c]=this.getInitialTranslation();[l,c]=this.pageTranslationToScreen(l,c);let[p,m]=this.pageDimensions,[g,y]=this.pageTranslation,x,I;switch(this.rotation){case 0:x=e+(r[0]-g)/p,I=n+this.height-(r[1]-y)/m;break;case 90:x=e+(r[0]-g)/p,I=n-(r[1]-y)/m,[l,c]=[c,-l];break;case 180:x=e-this.width+(r[0]-g)/p,I=n-(r[1]-y)/m,[l,c]=[-l,-c];break;case 270:x=e+(r[0]-g-this.height*m)/p,I=n+(r[1]-y-this.width*p)/m,[l,c]=[-c,l];break}this.setAt(x*s,I*a,l,c)}else this._moveAfterPaste(e,n);this.#c(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#l(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Yb,"")}editorDivPaste(e){let n=e.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();let s=Os.#h(n.getData("text")||"").replaceAll(Yb,`
|
|
292
|
+
`);if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let r=a.getRangeAt(0);if(!s.includes(`
|
|
293
|
+
`)){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:l,startOffset:c}=r,p=[],m=[];if(l.nodeType===Node.TEXT_NODE){let x=l.parentElement;if(m.push(l.nodeValue.slice(c).replaceAll(Yb,"")),x!==this.editorDiv){let I=p;for(let M of this.editorDiv.childNodes){if(M===x){I=m;continue}I.push(Os.#l(M))}}p.push(l.nodeValue.slice(0,c).replaceAll(Yb,""))}else if(l===this.editorDiv){let x=p,I=0;for(let M of this.editorDiv.childNodes){if(I++===c)x=m;x.push(Os.#l(M))}}this.#e=`${p.join(`
|
|
294
|
+
`)}${s}${m.join(`
|
|
295
|
+
`)}`,this.#c();let g=new Range,y=Math.sumPrecise(p.map((x)=>x.length));for(let{firstChild:x}of this.editorDiv.childNodes)if(x.nodeType===Node.TEXT_NODE){let I=x.nodeValue.length;if(y<=I){g.setStart(x,y),g.setEnd(x,y);break}y-=I}a.removeAllRanges(),a.addRange(g)}#c(){if(this.editorDiv.replaceChildren(),!this.#e)return;for(let e of this.#e.split(`
|
|
296
|
+
`)){let n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}}#f(){return this.#e.replaceAll(" "," ")}static#h(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let e=Os._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,n,i){let s=null;if(e instanceof x9){let{data:{defaultAppearanceData:{fontSize:r,fontColor:l},rect:c,rotation:p,id:m,popupRef:g,richText:y,contentsObj:x,creationDate:I,modificationDate:M},textContent:H,textPosition:X,parent:{page:{pageNumber:W}}}=e;if(!H?.length)return null;s=e={annotationType:yn.FREETEXT,color:Array.from(l),fontSize:r,value:H.join(`
|
|
297
|
+
`),position:X,pageIndex:W-1,rect:c.slice(0),rotation:p,annotationElementId:m,id:m,deleted:!1,popupRef:g,comment:x?.str||null,richText:y,creationDate:I,modificationDate:M}}let a=await super.deserialize(e,n,i);if(a.#i=e.fontSize,a.color=Ot.makeHexColor(...e.color),a.#e=Os.#h(e.value),a._initialData=s,e.comment)a.setCommentData(e);return a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Jt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:n,fontSize:this.#i,value:this.#f()});if(this.addComment(i),e)return i.isCopy=!0,i;if(this.annotationElementId&&!this.#d(i))return null;return i.id=this.annotationElementId,i}#d(e){let{value:n,fontSize:i,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==n||e.fontSize!==i||e.color.some((r,l)=>r!==s[l])||e.pageIndex!==a}renderAnnotationElement(e){let n=super.renderAnnotationElement(e);if(!n)return null;let{style:i}=n;i.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,i.color=this.color,n.replaceChildren();for(let s of this.#e.split(`
|
|
298
|
+
`)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),n.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class E2{#e=Object.create(null);updateProperty(e,n){this[e]=n,this.updateSVGProperty(e,n)}updateProperties(e){if(!e)return;for(let[n,i]of Object.entries(e))if(!n.startsWith("_"))this.updateProperty(n,i)}updateSVGProperty(e,n){this.#e[e]=n}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Un("Not implemented")}}class Mn extends Jt{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#i=null;static#s=null;static#r=null;static _INNER_MARGIN=3;constructor(e){super(e);this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){if(e.drawOutlines)this.#a(e),this.#g()}#a({drawOutlines:e,drawId:n,drawingOptions:i,clipPathId:s}){if(this._drawOutlines=e,this._drawingOptions||=i,!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert[this.editorType]);if(n>=0)this._drawId=n,this._clipPathId=s??null,this.parent.drawLayer.finalizeDraw(n,e.defaultProperties),this.#l(this.parent);else this._drawId=this.#o(e,this.parent);this.#b(e.box)}#o(e,n){let{id:i,clipPathId:s}=n.drawLayer.draw(Mn._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,this.constructor._hasClipPath);if(this.constructor._hasClipPath)this._clipPathId=s;return this.#l(n),i}#l(e){let n=this._drawOutlines.getFocusSVGProperties(this.#d);if(n)this._focusDrawId=e.drawLayer.drawOutline(n,this._drawOutlines.focusMustRemoveSelfIntersections)}#c(e=this.#d){if(this._focusDrawId===null)return;this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#f(e){if(this._focusDrawId!==null)this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#h(){let{parent:e,_drawId:n,_focusDrawId:i,_isVisible:s}=this;if(!e||n===null)return;let a={hidden:!s};if(e.drawLayer.updateProperties(n,{rootClass:a}),i!==null)e.drawLayer.updateProperties(i,{rootClass:a})}static _mergeSVGProperties(e,n){let i=new Set(Object.keys(e));for(let[s,a]of Object.entries(n))if(i.has(s))Object.assign(e[s],a);else e[s]=a;return e}static getDefaultDrawingOptions(e){Un("Not implemented")}static get typesMap(){Un("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#d(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(e,n){let i=this.typesMap.get(e);if(i)this._defaultDrawingOptions.updateProperty(i,n);if(this._currentParent)Mn.#n.updateProperty(i,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}updateParams(e,n){let i=this.constructor.typesMap.get(e);if(i)this._updateProperty(e,i,n)}static get defaultPropertiesToUpdate(){let e=[],n=this._defaultDrawingOptions;for(let[i,s]of this.typesMap)e.push([i,n[s]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:n}=this;for(let[i,s]of this.constructor.typesMap)e.push([i,n[s]]);return e}_updateProperty(e,n,i){let s=this._drawingOptions,a=s[n],r=(l)=>{s.updateProperty(n,l);let c=this._drawOutlines.updateProperty(n,l);if(c)this.#b(c);if(this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),e===this.colorType)this.onUpdatedColor();else if(e===this.opacityType)this.onUpdatedOpacity()};this.addCommands({cmd:r.bind(this,i),undo:r.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,n,i=this.colorAndOpacityType){let s=this.constructor.typesMap.get(this.colorType),a=this._opacityName,r=this._drawingOptions,l=r[s],c=r[a],p=(m,g)=>{r.updateProperty(s,m),r.updateProperty(a,g),this._drawOutlines.updateProperty(s,m),this._drawOutlines.updateProperty(a,g),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:p.bind(this,e,n),undo:p.bind(this,l,c),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:i,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#p()),{bbox:this.#w()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#p()),{bbox:this.#w()})),this.#c()}_onTranslating(e,n){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#w()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#p(),this.parentDimensions),{bbox:this.#w()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){if(super.commit(),this._mustBeDisabledOnCommit)this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(this._isDraggable=!0,this.#t){if(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen)this.div.focus()}}remove(){this._uiManager.removeShouldRescale(this),this.#m(),super.remove()}rebuild(){if(!this.parent)return;if(super.rebuild(),this.div===null)return;if(this.#g(),this.#b(this._drawOutlines.box),!this.isAttachedToDOM)this.parent.add(this)}setParent(e){let n=!1;if(this.parent&&!e)this._uiManager.removeShouldRescale(this),this.#m();else if(e)this._uiManager.addShouldRescale(this),this.#g(e),n=!this.parent&&this.div?.classList.contains("selectedEditor");if(super.setParent(e),this.#h(),n)this.select()}#m(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;if(e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null)e.remove(this._focusDrawId),this._focusDrawId=null;this._drawingOptions.reset()}#g(e=this.parent){if(this._drawId!==null&&this.parent===e)return;if(this._drawId!==null){let{drawLayer:n}=this.parent;if(n.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null)n.updateParent(this._focusDrawId,e.drawLayer);return}if(this._drawingOptions.updateAll(),this._drawId=this.#o(this._drawOutlines,e),this._clipPathId&&this.#e)this.#e.style.clipPath=this._clipPathId}#u([e,n,i,s]){let{parentDimensions:[a,r],_drawRotation:l}=this;switch(l){case 90:return[n,1-e,i*(r/a),s*(a/r)];case 180:return[1-e,1-n,i,s];case 270:return[1-n,e,i*(r/a),s*(a/r)];default:return[e,n,i,s]}}#p(){let{x:e,y:n,width:i,height:s,parentDimensions:[a,r],_drawRotation:l}=this;switch(l){case 90:return[1-n,e,i*(a/r),s*(r/a)];case 180:return[1-e,1-n,i,s];case 270:return[n,1-e,i*(a/r),s*(r/a)];default:return[e,n,i,s]}}#b(e){if([this.x,this.y,this.width,this.height]=this.#u(e),this.div)this.fixAndSetPosition(),this.setDims();this._onResized()}#w(e=this.parentRotation){let{x:n,y:i,width:s,height:a,_drawRotation:r,parentDimensions:[l,c]}=this;switch((r*4+e)/90){case 1:return[1-i-a,n,a,s];case 2:return[1-n-s,1-i-a,s,a];case 3:return[i,1-n-s,a,s];case 4:return[n,i-s*(l/c),a*(c/l),s*(l/c)];case 5:return[1-i,n,s*(l/c),a*(c/l)];case 6:return[1-n-a*(c/l),1-i,a*(c/l),s*(l/c)];case 7:return[i-s*(l/c),1-n-a*(c/l),s*(l/c),a*(c/l)];case 8:return[n-s,i-a,s,a];case 9:return[1-i,n-s,a,s];case 10:return[1-n,1-i,s,a];case 11:return[i-a,1-n,a,s];case 12:return[n-a*(c/l),i,a*(c/l),s*(l/c)];case 13:return[1-i-s*(l/c),n-a*(c/l),s*(l/c),a*(c/l)];case 14:return[1-n,1-i-s*(l/c),a*(c/l),s*(l/c)];case 15:return[i,1-n,s*(l/c),a*(c/l)];default:return[n,i,s,a]}}rotate(e=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(e-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,Mn._mergeSVGProperties({bbox:this.#w(e)},this._drawOutlines.updateRotation(n))),this.#c(n)}show(e=this._isVisible){super.show(e),this.#h()}select(){super.select(),this.#f({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#f({selected:!1})}pointerover(){if(!this.isSelected)this.#f({hovered:!0})}pointerleave(){if(!this.isSelected)this.#f({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);if(e)this.#b(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,n;if(this._isCopy)e=this.x,n=this.y;let i=super.render();if(this.constructor._hasDrawClass)i.classList.add("draw");let s=this.#e=document.createElement("div");if(i.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this._clipPathId)s.style.clipPath=this._clipPathId;if(cT(this,s,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy)this._moveAfterPaste(e,n);return i}static createDrawerInstance(e){Un("Not implemented")}static _getDrawingTarget(e,{target:n}){return n}static _getPointerCoords({offsetX:e,offsetY:n,clientX:i,clientY:s},a=null){if(!a)return[e,n];let r=i-a.clientX,l=s-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[r,l]=[l,-r];break;case 180:[r,l]=[-r,-l];break;case 270:[r,l]=[-l,r];break}return[a.offsetX+r,a.offsetY+l]}static _addDrawingListeners(e,n){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(e,n,i,s){let{pointerId:a,pointerType:r}=s;if(Wn.isInitializedAndDifferentPointerType(r))return;let l=this._getDrawingTarget(e,s),[c,p]=this._getPointerCoords(s),{viewport:{rotation:m}}=e,{x:g,y,width:x,height:I}=l.getBoundingClientRect(),M=Mn.#i=new AbortController,H=e.combinedSignal(M);if(Wn.setPointer(r,a),window.addEventListener("pointerup",(Y)=>{if(Wn.isSamePointerIdOrRemove(Y.pointerId))this._endDraw(Y)},{signal:H}),window.addEventListener("pointercancel",(Y)=>{if(Wn.isSamePointerIdOrRemove(Y.pointerId))this._endDrawingSession()},{signal:H}),window.addEventListener("pointerdown",(Y)=>{if(!Wn.isSamePointerType(Y.pointerType))return;if(Wn.initializeAndAddPointerId(Y.pointerId),Mn.#n.isCancellable())if(Mn.#n.removeLastElement(),Mn.#n.isEmpty())this._endDrawingSession(!0);else this._endDraw(null)},{capture:!0,passive:!1,signal:H}),window.addEventListener("contextmenu",lo,{signal:H}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:H}),l.addEventListener("touchmove",(Y)=>{if(Wn.isSameTimeStamp(Y.timeStamp))gs(Y)},{signal:H}),this._addDrawingListeners(l,H),e.toggleDrawing(),n._editorUndoBar?.hide(),Mn.#n){e.drawLayer.updateProperties(this._currentDrawId,Mn.#n.startNew(c,p,x,I,m));return}n.updateUIForDefaultProperties(this),Mn.#n=this.createDrawerInstance({x:c,y:p,box:[g,y,x,I],rotation:m,parent:e,isLTR:i}),Mn.#s=this.getDefaultDrawingOptions(),this._currentParent=e;let{id:X,clipPathId:W}=e.drawLayer.draw(this._mergeSVGProperties(Mn.#s.toSVGProperties(),Mn.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=X,Mn.#r=this._hasClipPath?W:null}static _drawMove(e){if(Wn.isSameTimeStamp(e.timeStamp),!Mn.#n)return;if(!Wn.isSamePointerId(e.pointerId))return;if(Wn.isUsingMultiplePointers()){this._endDraw(e);return}let n,i=e.getCoalescedEvents?.();if(i?.length){let s=[];for(let a of i)s.push(...this._getPointerCoords(a,e));n=Mn.#n.addPoints(s)}else n=Mn.#n.add(...this._getPointerCoords(e));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),Wn.setTimeStamp(e.timeStamp),gs(e)}static _cleanup(e){if(e)this._currentDrawId=-1,this._currentParent=null,Mn.#n=null,Mn.#s=null,Mn.#r=null,Wn.clearTimeStamp();if(Mn.#i)Mn.#i.abort(),Mn.#i=null,Wn.clearPointerIds()}static _endDraw(e){let n=this._currentParent;if(!n)return;if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,e?.target===n.div?Mn.#n.end(...this._getPointerCoords(e)):Mn.#n.end()),this.supportMultipleDrawings){let i=Mn.#n,s=this._currentDrawId,a=i.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(s,i.setLastElement(a))},undo:()=>{n.drawLayer.updateProperties(s,i.removeLastElement())},mustExec:!1,type:Pn.DRAW_STEP});return}this.endDrawing(!1)}static endDrawing(e){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Pn.DRAW_STEP),!Mn.#n.isEmpty()){let{pageDimensions:[i,s],scale:a}=n,r=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:Mn.#r,drawOutlines:Mn.#n.getOutlines(i*a,s*a,a,this._INNER_MARGIN),drawingOptions:Mn.#s,mustBeCommitted:!e});return this._cleanup(!0),r}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,n,i,s,a,r,l){Un("Not implemented")}static async deserialize(e,n,i){let{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:l}}=n.viewport,c=this.deserializeDraw(r,l,s,a,this._INNER_MARGIN,e,i),p=await super.deserialize(e,n,i);return p.createDrawingOptions(e),p.#a({drawOutlines:c}),p.#g(),p.onScaleChanging(),p.rotate(),p}serializeDraw(e){let[n,i]=this.pageTranslation,[s,a]=this.pageDimensions;return this._drawOutlines.serialize([n,i,s,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class Bt{static PRECISION=0.0001;focusOutline=null;toSVGPath(){Un("Abstract method `toSVGPath` must be implemented.")}get box(){Un("Abstract getter `box` must be implemented.")}serialize(e,n){Un("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){Un("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,n){return null}updateParentDimensions(e,n){return null}serializeQuadPoints(e,n){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,n){return{}}static _rotateBox([e,n,i,s],a){switch(a){case 90:return[1-n-s,e,s,i];case 180:return[1-e-i,1-n-s,i,s];case 270:return[n,1-e-i,s,i]}return[e,n,i,s]}static _rescale(e,n,i,s,a,r){r||=new Float32Array(e.length);for(let l=0,c=e.length;l<c;l+=2)r[l]=n+e[l]*s,r[l+1]=i+e[l+1]*a;return r}static _rescaleAndSwap(e,n,i,s,a,r){r||=new Float32Array(e.length);for(let l=0,c=e.length;l<c;l+=2)r[l]=n+e[l+1]*s,r[l+1]=i+e[l]*a;return r}static _translate(e,n,i,s){s||=new Float32Array(e.length);for(let a=0,r=e.length;a<r;a+=2)s[a]=n+e[a],s[a+1]=i+e[a+1];return s}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,n,i,s,a){switch(a){case 90:return[1-n/i,e/s];case 180:return[1-e/i,1-n/s];case 270:return[n/i,1-e/s];default:return[e/i,n/s]}}static createBezierPoints(e,n,i,s,a,r){return[(e+5*i)/6,(n+5*s)/6,(5*i+a)/6,(5*s+r)/6,(i+a)/2,(s+r)/2]}}class Ch{#e;#t=[];#n;#i;#s=[];#r=new Float32Array(18);#a;#o;#l;#c;#f;#h;#d=[];static#m=8;static#g=2;static#u=Ch.#m+Ch.#g;constructor(e,n,i,s,a,r,l=0){this.#e=i,this.#h=a*s,this.#i=r,this.#r.set([NaN,NaN,NaN,NaN,e,n],6),this.#n=l,this.#c=Ch.#m*s,this.#l=Ch.#u*s,this.#f=s,this.#d.push(e,n)}isEmpty(){return isNaN(this.#r[8])}isCancellable(){return this.#d.length<=10}removeLastElement(){return this.#r.fill(NaN),this.#s.length=this.#t.length=this.#d.length=0,{path:{d:""}}}#p(){let e=this.#r.subarray(4,6),n=this.#r.subarray(16,18),[i,s,a,r]=this.#e;return[(this.#a+(e[0]-n[0])/2-i)/a,(this.#o+(e[1]-n[1])/2-s)/r,(this.#a+(n[0]-e[0])/2-i)/a,(this.#o+(n[1]-e[1])/2-s)/r]}add(e,n){this.#a=e,this.#o=n;let[i,s,a,r]=this.#e,[l,c,p,m]=this.#r.subarray(8,12),g=e-p,y=n-m,x=Math.hypot(g,y);if(x<this.#l)return!1;let I=x-this.#c,M=I/x,H=M*g,X=M*y,W=l,Y=c;l=p,c=m,p+=H,m+=X,this.#d?.push(e,n);let te=-X/I,ae=H/I,ne=te*this.#h,oe=ae*this.#h;if(this.#r.set(this.#r.subarray(2,8),0),this.#r.set([p+ne,m+oe],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([p-ne,m-oe],16),isNaN(this.#r[6])){if(this.#s.length===0)this.#r.set([l+ne,c+oe],2),this.#s.push(NaN,NaN,NaN,NaN,(l+ne-i)/a,(c+oe-s)/r),this.#r.set([l-ne,c-oe],14),this.#t.push(NaN,NaN,NaN,NaN,(l-ne-i)/a,(c-oe-s)/r);return this.#r.set([W,Y,l,c,p,m],6),!this.isEmpty()}if(this.#r.set([W,Y,l,c,p,m],6),Math.abs(Math.atan2(Y-c,W-l)-Math.atan2(X,H))<Math.PI/2)return[l,c,p,m]=this.#r.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((l+p)/2-i)/a,((c+m)/2-s)/r),[l,c,W,Y]=this.#r.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((W+l)/2-i)/a,((Y+c)/2-s)/r),!0;return[W,Y,l,c,p,m]=this.#r.subarray(0,6),this.#s.push(((W+5*l)/6-i)/a,((Y+5*c)/6-s)/r,((5*l+p)/6-i)/a,((5*c+m)/6-s)/r,((l+p)/2-i)/a,((c+m)/2-s)/r),[p,m,l,c,W,Y]=this.#r.subarray(12,18),this.#t.push(((W+5*l)/6-i)/a,((Y+5*c)/6-s)/r,((5*l+p)/6-i)/a,((5*c+m)/6-s)/r,((l+p)/2-i)/a,((c+m)/2-s)/r),!0}toSVGPath(){if(this.isEmpty())return"";let e=this.#s,n=this.#t;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#b();let i=[];i.push(`M${e[4]} ${e[5]}`);for(let s=6;s<e.length;s+=6)if(isNaN(e[s]))i.push(`L${e[s+4]} ${e[s+5]}`);else i.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);this.#y(i);for(let s=n.length-6;s>=6;s-=6)if(isNaN(n[s]))i.push(`L${n[s+4]} ${n[s+5]}`);else i.push(`C${n[s]} ${n[s+1]} ${n[s+2]} ${n[s+3]} ${n[s+4]} ${n[s+5]}`);return this.#w(i),i.join(" ")}#b(){let[e,n,i,s]=this.#e,[a,r,l,c]=this.#p();return`M${(this.#r[2]-e)/i} ${(this.#r[3]-n)/s} L${(this.#r[4]-e)/i} ${(this.#r[5]-n)/s} L${a} ${r} L${l} ${c} L${(this.#r[16]-e)/i} ${(this.#r[17]-n)/s} L${(this.#r[14]-e)/i} ${(this.#r[15]-n)/s} Z`}#w(e){let n=this.#t;e.push(`L${n[4]} ${n[5]} Z`)}#y(e){let[n,i,s,a]=this.#e,r=this.#r.subarray(4,6),l=this.#r.subarray(16,18),[c,p,m,g]=this.#p();e.push(`L${(r[0]-n)/s} ${(r[1]-i)/a} L${c} ${p} L${m} ${g} L${(l[0]-n)/s} ${(l[1]-i)/a}`)}newFreeDrawOutline(e,n,i,s,a,r){return new E9(e,n,i,s,a,r)}getOutlines(){let e=this.#s,n=this.#t,i=this.#r,[s,a,r,l]=this.#e,c=new Float32Array((this.#d?.length??0)+2);for(let g=0,y=c.length-2;g<y;g+=2)c[g]=(this.#d[g]-s)/r,c[g+1]=(this.#d[g+1]-a)/l;if(c[c.length-2]=(this.#a-s)/r,c[c.length-1]=(this.#o-a)/l,isNaN(i[6])&&!this.isEmpty())return this.#v(c);let p=new Float32Array(this.#s.length+24+this.#t.length),m=e.length;for(let g=0;g<m;g+=2){if(isNaN(e[g])){p[g]=p[g+1]=NaN;continue}p[g]=e[g],p[g+1]=e[g+1]}m=this.#_(p,m);for(let g=n.length-6;g>=6;g-=6)for(let y=0;y<6;y+=2){if(isNaN(n[g+y])){p[m]=p[m+1]=NaN,m+=2;continue}p[m]=n[g+y],p[m+1]=n[g+y+1],m+=2}return this.#x(p,m),this.newFreeDrawOutline(p,c,this.#e,this.#f,this.#n,this.#i)}#v(e){let n=this.#r,[i,s,a,r]=this.#e,[l,c,p,m]=this.#p(),g=new Float32Array(36);return g.set([NaN,NaN,NaN,NaN,(n[2]-i)/a,(n[3]-s)/r,NaN,NaN,NaN,NaN,(n[4]-i)/a,(n[5]-s)/r,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(n[16]-i)/a,(n[17]-s)/r,NaN,NaN,NaN,NaN,(n[14]-i)/a,(n[15]-s)/r],0),this.newFreeDrawOutline(g,e,this.#e,this.#f,this.#n,this.#i)}#x(e,n){let i=this.#t;return e.set([NaN,NaN,NaN,NaN,i[4],i[5]],n),n+=6}#_(e,n){let i=this.#r.subarray(4,6),s=this.#r.subarray(16,18),[a,r,l,c]=this.#e,[p,m,g,y]=this.#p();return e.set([NaN,NaN,NaN,NaN,(i[0]-a)/l,(i[1]-r)/c,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,g,y,NaN,NaN,NaN,NaN,(s[0]-a)/l,(s[1]-r)/c],n),n+=24}}class E9 extends Bt{#e;#t=new Float32Array(4);#n;#i;#s;#r;#a;constructor(e,n,i,s,a,r){super();this.#a=e,this.#s=n,this.#e=i,this.#r=s,this.#n=a,this.#i=r,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#o(r);let[l,c,p,m]=this.#t;for(let g=0,y=e.length;g<y;g+=2)e[g]=(e[g]-l)/p,e[g+1]=(e[g+1]-c)/m;for(let g=0,y=n.length;g<y;g+=2)n[g]=(n[g]-l)/p,n[g+1]=(n[g+1]-c)/m}toSVGPath(){let e=[`M${this.#a[4]} ${this.#a[5]}`];for(let n=6,i=this.#a.length;n<i;n+=6){if(isNaN(this.#a[n])){e.push(`L${this.#a[n+4]} ${this.#a[n+5]}`);continue}e.push(`C${this.#a[n]} ${this.#a[n+1]} ${this.#a[n+2]} ${this.#a[n+3]} ${this.#a[n+4]} ${this.#a[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,i,s],a){let r=i-e,l=s-n,c,p;switch(a){case 0:c=Bt._rescale(this.#a,e,s,r,-l),p=Bt._rescale(this.#s,e,s,r,-l);break;case 90:c=Bt._rescaleAndSwap(this.#a,e,n,r,l),p=Bt._rescaleAndSwap(this.#s,e,n,r,l);break;case 180:c=Bt._rescale(this.#a,i,n,-r,l),p=Bt._rescale(this.#s,i,n,-r,l);break;case 270:c=Bt._rescaleAndSwap(this.#a,i,s,-r,-l),p=Bt._rescaleAndSwap(this.#s,i,s,-r,-l);break}return{outline:Array.from(c),points:[Array.from(p)]}}#o(e){let n=this.#a,i=n[4],s=n[5],a=[i,s,i,s],r=i,l=s,c=i,p=s,m=e?Math.max:Math.min,g=new Float32Array(4);for(let x=6,I=n.length;x<I;x+=6){let M=n[x+4],H=n[x+5];if(isNaN(n[x])){if(Ot.pointBoundingBox(M,H,a),l>H)r=M,l=H;else if(l===H)r=m(r,M);if(p<H)c=M,p=H;else if(p===H)c=m(c,M)}else{if(g.set(Gl,0),Ot.bezierBoundingBox(i,s,...n.slice(x,x+6),g),Ot.rectBoundingBox(...g,a),l>g[1])r=g[0],l=g[1];else if(l===g[1])r=m(r,g[0]);if(p<g[3])c=g[2],p=g[3];else if(p===g[3])c=m(c,g[2])}i=M,s=H}let y=this.#t;y[0]=a[0]-this.#n,y[1]=a[1]-this.#n,y[2]=a[2]-a[0]+2*this.#n,y[3]=a[3]-a[1]+2*this.#n,this.firstPoint=[r,l],this.lastPoint=[c,p]}get box(){return this.#t}newOutliner(e,n,i,s,a,r,l=0){return new Ch(e,n,i,s,a,r,l)}updateThickness(e){let n=this.getNewOutline(e);return this.#a=n.#a,this.#s=n.#s,this.#t.set(n.#t),this.firstPoint=n.firstPoint,this.lastPoint=n.lastPoint,this.#t}getNewOutline(e,n){let[i,s,a,r]=this.#t,[l,c,p,m]=this.#e,g=a*p,y=r*m,x=i*p+l,I=s*m+c,M=this.#s,H=this.newOutliner(M[0]*g+x,M[1]*y+I,this.#e,this.#r,e,this.#i,n??this.#n);for(let X=2,W=M.length;X<W;X+=2)H.add(M[X]*g+x,M[X+1]*y+I);return H.getOutlines()}}function AA(e){return{bbox:e.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function CA(e,n){let{focusOutline:i}=e;return{bbox:Bt._rotateBox(i.box,n),root:{"data-main-rotation":n},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:i.toSVGPath()}}}class u2{#e;#t;#n;#i=[];#s=[];constructor(e,n=0,i=0,s=!0){let a=Gl.slice(),r=4,l=0.0001;for(let{x:H,y:X,width:W,height:Y}of e){let te=Math.floor((H-n)/0.0001)*0.0001,ae=Math.ceil((H+W+n)/0.0001)*0.0001,ne=Math.floor((X-n)/0.0001)*0.0001,oe=Math.ceil((X+Y+n)/0.0001)*0.0001,me=[te,ne,oe,!0],be=[ae,ne,oe,!1];this.#i.push(me,be),Ot.rectBoundingBox(te,ne,ae,oe,a)}let c=a[2]-a[0]+2*i,p=a[3]-a[1]+2*i,m=a[0]-i,g=a[1]-i,y=s?-1/0:1/0,x=1/0,I=this.#i.at(s?-1:-2),M=[I[0],I[2]];for(let H of this.#i){let[X,W,Y,te]=H;if(!te&&s){if(W<x)x=W,y=X;else if(W===x)y=Math.max(y,X)}else if(te&&!s){if(W<x)x=W,y=X;else if(W===x)y=Math.min(y,X)}H[0]=(X-m)/c,H[1]=(W-g)/p,H[2]=(Y-g)/p}this.#e=new Float32Array([m,g,c,p]),this.#t=[y,x],this.#n=M}getOutlines(){this.#i.sort((n,i)=>n[0]-i[0]||n[1]-i[1]||n[2]-i[2]);let e=[];for(let n of this.#i)if(n[3])e.push(...this.#c(n)),this.#o(n);else this.#l(n),e.push(...this.#c(n));return this.#r(e)}#r(e){let n=[],i=new Set;for(let r of e){let[l,c,p]=r;n.push([l,c,r],[l,p,r])}n.sort((r,l)=>r[1]-l[1]||r[0]-l[0]);for(let r=0,l=n.length;r<l;r+=2){let c=n[r][2],p=n[r+1][2];c.push(p),p.push(c),i.add(c),i.add(p)}let s=[],a;while(i.size>0){let r=i.values().next().value,[l,c,p,m,g]=r;i.delete(r);let y=l,x=c;a=[l,p],s.push(a);while(!0){let I;if(i.has(m))I=m;else if(i.has(g))I=g;else break;if(i.delete(I),[l,c,p,m,g]=I,y!==l)a.push(y,x,l,x===c?c:p),y=l;x=x===c?p:c}a.push(y,x)}return new h2(s,this.#e,this.#t,this.#n)}#a(e){let n=this.#s,i=0,s=n.length-1;while(i<=s){let a=i+s>>1,r=n[a][0];if(r===e)return a;if(r<e)i=a+1;else s=a-1}return s+1}#o([,e,n]){let i=this.#a(e);this.#s.splice(i,0,[e,n])}#l([,e,n]){let i=this.#a(e);for(let s=i;s<this.#s.length;s++){let[a,r]=this.#s[s];if(a!==e)break;if(a===e&&r===n){this.#s.splice(s,1);return}}for(let s=i-1;s>=0;s--){let[a,r]=this.#s[s];if(a!==e)break;if(a===e&&r===n){this.#s.splice(s,1);return}}}#c(e){let[n,i,s]=e,a=[[n,i,s]],r=this.#a(s);for(let l=0;l<r;l++){let[c,p]=this.#s[l];for(let m=0,g=a.length;m<g;m++){let[,y,x]=a[m];if(p<=y||x<=c)continue;if(y>=c){if(x>p)a[m][1]=p;else{if(g===1)return[];a.splice(m,1),m--,g--}continue}if(a[m][2]=c,x>p)a.push([n,p,x])}}return a}}class h2 extends Bt{#e;#t=null;#n;constructor(e,n,i,s){super();this.#n=e,this.#e=n,this.firstPoint=i,this.lastPoint=s}static build(e,n){let i=new u2(e,0.001).getOutlines();return i.#t=e,i.focusOutline=new u2(e,0.0025,0.001,n).getOutlines(),i}get isFree(){return!1}get defaultSVGProperties(){return AA(this)}getFocusSVGProperties(e){return CA(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,n],[i,s]){let a=this.#t,r=new Float32Array(a.length*8),l=0;for(let{x:c,y:p,width:m,height:g}of a){let y=c*i+e,x=(1-p)*s+n;r[l]=r[l+4]=y,r[l+1]=r[l+3]=x,r[l+2]=r[l+6]=y+m*i,r[l+5]=r[l+7]=x-g*s,l+=8}return r}toSVGPath(){let e=[];for(let n of this.#n){let[i,s]=n;e.push(`M${i} ${s}`);for(let a=2;a<n.length;a+=2){let r=n[a],l=n[a+1];if(r===i)e.push(`V${l}`),s=l;else if(l===s)e.push(`H${r}`),i=r}e.push("Z")}return e.join(" ")}serialize([e,n,i,s],a){let r=[],l=i-e,c=s-n;for(let p of this.#n){let m=Array(p.length);for(let g=0;g<p.length;g+=2)m[g]=e+p[g]*l,m[g+1]=s-p[g+1]*c;r.push(m)}return r}get box(){return this.#e}}class q2 extends Ch{newFreeDrawOutline(e,n,i,s,a,r){return new q9(e,n,i,s,a,r)}}class jA{#e;#t;constructor(e,n,i,s,a,r,l){this.#e=new q2(e,n,i,s,a,r,l),this.#t=a}add(e,n){return this.#e.add(e,n)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let n=!1;for(let i=0,s=e.length;i<s;i+=2)n=this.#e.add(e[i],e[i+1])||n;return n?{path:{d:this.#e.toSVGPath()}}:null}end(e,n){return e===void 0?null:this.add(e,n)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,n){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}}class q9 extends E9{static#e=1.5;newOutliner(e,n,i,s,a,r,l=0){return new q2(e,n,i,s,a,r,l)}get isFree(){return!0}buildFocusOutline(e){this.focusOutline=this.getNewOutline(e/2+q9.#e,0.0025)}get defaultSVGProperties(){return AA(this)}getFocusSVGProperties(e){return CA(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,n){if(e!=="thickness")return null;let i=this.updateThickness(n/2);return this.buildFocusOutline(n),i}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}}class D9 extends E2{constructor(e=null){super();super.updateProperties(e)}updateSVGProperty(e,n){if(e!=="thickness")super.updateSVGProperty(e,n)}clone(){let e=new D9;return e.updateAll(this),e}}class oo extends Mn{#e=null;#t=0;#n=null;#i=0;#s="";#r="";static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type="highlight";static _editorType=yn.HIGHLIGHT;static get _keyboardManager(){let e=oo.prototype;return en(this,"_keyboardManager",new hr([[["ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"});this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#i=e.focusOffset||0,this.#s=e.methodOfCreation||(this._drawOutlines?.isFree?"main_toolbar":""),this.#r=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions||=new D9({fill:n.highlightColors?.values().next().value||"#fff066","fill-opacity":oo._DEFAULT_OPACITY,thickness:oo._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get typesMap(){return en(this,"typesMap",new Map([[Pn.HIGHLIGHT_COLOR,"fill"],[Pn.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(e){let{boxes:n,drawOutlines:i}=e;if(!n&&!i)return;if(this._drawingOptions||=e.drawingOptions||oo.getDefaultDrawingOptions(),n)e={...e,drawOutlines:h2.build(n,this._uiManager.direction==="ltr")};super._addOutlines(e)}get colorType(){return Pn.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#s}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}translateInPage(e,n){}get toolbarPosition(){return this.#a(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#a(this._drawOutlines.firstPoint)}#a([e,n]){let[i,s,a,r]=this._drawOutlines.box;return[(e-i)/a,(n-s)/r]}updateParams(e,n){switch(e){case Pn.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,oo._DEFAULT_OPACITY,e),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(n)},!0);break;case Pn.HIGHLIGHT_THICKNESS:super.updateParams(e,n),this._reportTelemetry({action:"thickness_changed",thickness:n},!0);break}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([Pn.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){if(this._uiManager.highlightColors)return this._colorPicker=new Gr({editor:this}),[["colorPicker",this._colorPicker]];return super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,n){return super.getRect(e,n,this._drawRotation)}onceAdded(e){if(!this.annotationElementId)this.parent.addUndoableEditor(this);if(e)this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;let e=super.render();if(this.#r)e.setAttribute("aria-label",this.#r),e.setAttribute("role","mark");if(this._drawOutlines.isFree)e.classList.add("free");else e.addEventListener("keydown",this.#o.bind(this),{signal:this._uiManager._signal});return this.enableEditing(),e}#o(e){oo._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#l(!0);break;case 1:case 3:this.#l(!1);break}}#l(e){if(!this.#e)return;let n=window.getSelection();if(e)n.setPosition(this.#e,this.#t);else n.setPosition(this.#n,this.#i)}unselect(){if(super.unselect(),!this._drawOutlines.isFree)this.#l(!1)}static createDrawerInstance({x:e,y:n,box:i,parent:s,isLTR:a}){return new jA(e,n,i,s.scale,this._defaultDrawingOptions.thickness/2,a,0.001)}static _getDrawingTarget(e,{target:n}){return n.closest(".textLayer")}static _getPointerCoords({x:e,y:n}){return[e,n]}static _addDrawingListeners(e,n){e.classList.add("free"),n.addEventListener("abort",()=>e.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:n}),window.addEventListener("pointerdown",gs,{capture:!0,passive:!1,signal:n})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:e,opacity:n,thickness:i}){let{_defaultDrawingOptions:s,_DEFAULT_OPACITY:a}=oo;this._drawingOptions=oo.getDefaultDrawingOptions({fill:Ot.makeHexColor(...e),"fill-opacity":n||a,thickness:i||s.thickness})}static deserializeDraw(e,n,i,s,a,r,l){let{quadPoints:c}=r;if(c){let x=[];for(let I=0,M=c.length;I<M;I+=8)x.push({x:(c[I]-e)/i,y:1-(c[I+1]-n)/s,width:(c[I+2]-c[I])/i,height:(c[I+1]-c[I+5])/s});return h2.build(x,l.direction==="ltr")}let p=r.thickness||this._defaultDrawingOptions.thickness,m=(r.inkLists||r.outlines.points)[0],g=new q2(m[0]-e,s-(m[1]-n),[0,0,i,s],1,p/2,!0,0.001);for(let x=0,I=m.length;x<I;x+=2)g.add(m[x]-e,s-(m[x+1]-n));let y=g.getOutlines();return y.buildFocusOutline(p),y}static async deserialize(e,n,i){let s=null;if(e instanceof T9){let{data:{quadPoints:r,rect:l,rotation:c,id:p,color:m,opacity:g,popupRef:y,richText:x,contentsObj:I,creationDate:M,modificationDate:H},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:yn.HIGHLIGHT,color:Array.from(m),opacity:g,quadPoints:r,pageIndex:X-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:y,richText:x,comment:I?.str||null,creationDate:M,modificationDate:H}}else if(e instanceof j2){let{data:{inkLists:r,rect:l,rotation:c,id:p,color:m,borderStyle:{rawWidth:g},popupRef:y,richText:x,contentsObj:I,creationDate:M,modificationDate:H},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:yn.HIGHLIGHT,color:Array.from(m),thickness:g,inkLists:r,pageIndex:X-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:y,richText:x,comment:I?.str||null,creationDate:M,modificationDate:H}}let a=await super.deserialize(e,n,i);if(a._initialData=s,e.comment)a.setCommentData(e);return a}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let n=super.serialize(e);if(Object.assign(n,{color:Jt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(n.rect,this._drawRotation)}),this.addComment(n),this.annotationElementId&&!this.#c(n))return null;return n.id=this.annotationElementId,n}#c(e){let{color:n}=this._initialData;return this.hasEditedComment||e.color.some((i,s)=>i!==n[s])}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class EA{#e=new Float64Array(6);#t=new Float64Array(2);#n;#i;#s;#r;#a;#o="";#l=0;#c=new Pd;#f;#h;constructor(e,n,i,s,a,r){this.#f=i,this.#h=s,this.#s=a,this.#r=r,[e,n]=this.#d(e,n);let l=this.#n=[NaN,NaN,NaN,NaN,e,n];this.#a=[e,n],this.#i=[{line:l,points:this.#a}],this.#e.set(l,0),this.#t.set([e,n],0)}updateProperty(e,n){if(e==="stroke-width")this.#r=n}#d(e,n){return Bt._normalizePoint(e,n,this.#f,this.#h,this.#s)}isEmpty(){return!this.#i?.length}isCancellable(){return this.#a.length<=10}add(e,n){if(this.#m(e,n))this.toSVGPath();return{path:{d:this.#g()}}}addPoints(e){let n=!1;for(let i=0,s=e.length;i<s;i+=2){if(!this.#m(e[i],e[i+1]))continue;if(n=!0,this.#a.length<=6)this.toSVGPath(),n=!1}if(n)this.toSVGPath();return{path:{d:this.#g()}}}#m(e,n){[e,n]=this.#d(e,n),this.#t.set([e,n],0);let[i,s,a,r]=this.#e.subarray(2,6),l=e-a,c=n-r;if(Math.hypot(this.#f*l,this.#h*c)<=2)return!1;if(this.#a.push(e,n),isNaN(i))return this.#e.set([a,r,e,n],2),this.#n.push(NaN,NaN,NaN,NaN,e,n),!0;if(isNaN(this.#e[0]))this.#n.splice(6,6);return this.#e.set([i,s,a,r,e,n],0),this.#n.push(...Bt.createBezierPoints(i,s,a,r,e,n)),!0}end(e,n){if(e!==void 0&&this.#m(e,n))return{path:{d:this.toSVGPath()}};if(this.#a.length===2)return{path:{d:this.toSVGPath()}};return{path:{d:this.#o}}}startNew(e,n,i,s,a){this.#f=i,this.#h=s,this.#s=a,[e,n]=this.#d(e,n);let r=this.#n=[NaN,NaN,NaN,NaN,e,n];this.#a=[e,n],this.#t.set([e,n],0);let l=this.#i.at(-1);if(l)l.line=new Float32Array(l.line),l.points=new Float32Array(l.points);return this.#i.push({line:r,points:this.#a}),this.#e.set(r,0),this.#l=0,this.toSVGPath(),null}getLastElement(){return this.#i.at(-1)}setLastElement(e){if(!this.#i)return this.#c.setLastElement(e);return this.#i.push(e),this.#n=e.line,this.#a=e.points,this.#l=0,{path:{d:this.toSVGPath()}}}removeLastElement(){if(!this.#i)return this.#c.removeLastElement();this.#i.pop(),this.#o="";for(let e=0,n=this.#i.length;e<n;e++){let{line:i,points:s}=this.#i[e];this.#n=i,this.#a=s,this.#l=0,this.toSVGPath()}return{path:{d:this.#o}}}#g(){let e=Bt.svgRound(this.#t[0]),n=Bt.svgRound(this.#t[1]);if(this.#a.length===2){let i=Bt.svgRound(this.#n[4]),s=Bt.svgRound(this.#n[5]);return`${this.#o} M ${i} ${s} L ${e} ${n}`}return`${this.#o} L ${e} ${n}`}toSVGPath(){let e=Bt.svgRound(this.#n[4]),n=Bt.svgRound(this.#n[5]);if(this.#a.length===2)return this.#o=`${this.#o} M ${e} ${n} Z`,this.#o;if(this.#a.length<=6){let s=this.#o.lastIndexOf("M");this.#o=`${this.#o.slice(0,s)} M ${e} ${n}`,this.#l=6}if(this.#a.length===4){let s=Bt.svgRound(this.#n[10]),a=Bt.svgRound(this.#n[11]);return this.#o=`${this.#o} L ${s} ${a}`,this.#l=12,this.#o}let i=[];if(this.#l===0)i.push(`M ${e} ${n}`),this.#l=6;for(let s=this.#l,a=this.#n.length;s<a;s+=6){let[r,l,c,p,m,g]=this.#n.slice(s,s+6).map(Bt.svgRound);i.push(`C${r} ${l} ${c} ${p} ${m} ${g}`)}return this.#o+=i.join(" "),this.#l=this.#n.length,this.#o}getOutlines(e,n,i,s){let a=this.#i.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#c.build(this.#i,e,n,i,this.#s,this.#r,s),this.#e=null,this.#n=null,this.#i=null,this.#o=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Pd extends Bt{#e;#t=0;#n;#i;#s;#r;#a;#o;#l;build(e,n,i,s,a,r,l){this.#s=n,this.#r=i,this.#a=s,this.#o=a,this.#l=r,this.#n=l??0,this.#i=e,this.#h()}get thickness(){return this.#l}setLastElement(e){return this.#i.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#i.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:n}of this.#i){if(e.push(`M${Bt.svgRound(n[4])} ${Bt.svgRound(n[5])}`),n.length===6){e.push("Z");continue}if(n.length===12&&isNaN(n[6])){e.push(`L${Bt.svgRound(n[10])} ${Bt.svgRound(n[11])}`);continue}for(let i=6,s=n.length;i<s;i+=6){let[a,r,l,c,p,m]=n.subarray(i,i+6).map(Bt.svgRound);e.push(`C${a} ${r} ${l} ${c} ${p} ${m}`)}}return e.join("")}serialize([e,n,i,s],a){let r=[],l=[],[c,p,m,g]=this.#f(),y,x,I,M,H,X,W,Y,te;switch(this.#o){case 0:te=Bt._rescale,y=e,x=n+s,I=i,M=-s,H=e+c*i,X=n+(1-p-g)*s,W=e+(c+m)*i,Y=n+(1-p)*s;break;case 90:te=Bt._rescaleAndSwap,y=e,x=n,I=i,M=s,H=e+p*i,X=n+c*s,W=e+(p+g)*i,Y=n+(c+m)*s;break;case 180:te=Bt._rescale,y=e+i,x=n,I=-i,M=s,H=e+(1-c-m)*i,X=n+p*s,W=e+(1-c)*i,Y=n+(p+g)*s;break;case 270:te=Bt._rescaleAndSwap,y=e+i,x=n+s,I=-i,M=-s,H=e+(1-p-g)*i,X=n+(1-c-m)*s,W=e+(1-p)*i,Y=n+(1-c)*s;break}for(let{line:ae,points:ne}of this.#i)r.push(te(ae,y,x,I,M,a?Array(ae.length):null)),l.push(te(ne,y,x,I,M,a?Array(ne.length):null));return{lines:r,points:l,rect:[H,X,W,Y]}}static deserialize(e,n,i,s,a,{paths:{lines:r,points:l},rotation:c,thickness:p}){let m=[],g,y,x,I,M;switch(c){case 0:M=Bt._rescale,g=-e/i,y=n/s+1,x=1/i,I=-1/s;break;case 90:M=Bt._rescaleAndSwap,g=-n/s,y=-e/i,x=1/s,I=1/i;break;case 180:M=Bt._rescale,g=e/i+1,y=-n/s,x=-1/i,I=1/s;break;case 270:M=Bt._rescaleAndSwap,g=n/s+1,y=e/i+1,x=-1/s,I=-1/i;break}if(!r){r=[];for(let X of l){let W=X.length;if(W===2){r.push(new Float32Array([NaN,NaN,NaN,NaN,X[0],X[1]]));continue}if(W===4){r.push(new Float32Array([NaN,NaN,NaN,NaN,X[0],X[1],NaN,NaN,NaN,NaN,X[2],X[3]]));continue}let Y=new Float32Array(3*(W-2));r.push(Y);let[te,ae,ne,oe]=X.subarray(0,4);Y.set([NaN,NaN,NaN,NaN,te,ae],0);for(let me=4;me<W;me+=2){let be=X[me],xe=X[me+1];Y.set(Bt.createBezierPoints(te,ae,ne,oe,be,xe),(me-2)*3),[te,ae,ne,oe]=[ne,oe,be,xe]}}}for(let X=0,W=r.length;X<W;X++)m.push({line:M(r[X].map((Y)=>Y??NaN),g,y,x,I),points:M(l[X].map((Y)=>Y??NaN),g,y,x,I)});let H=new this.prototype.constructor;return H.build(m,i,s,1,c,p,a),H}#c(e=this.#l){let n=this.#n+e/2*this.#a;return this.#o%180===0?[n/this.#s,n/this.#r]:[n/this.#r,n/this.#s]}#f(){let[e,n,i,s]=this.#e,[a,r]=this.#c(0);return[e+a,n+r,i-2*a,s-2*r]}#h(){let e=this.#e=Ah.slice();for(let{line:s}of this.#i){if(s.length<=12){for(let l=4,c=s.length;l<c;l+=6)Ot.pointBoundingBox(s[l],s[l+1],e);continue}let a=s[4],r=s[5];for(let l=6,c=s.length;l<c;l+=6){let[p,m,g,y,x,I]=s.subarray(l,l+6);Ot.bezierBoundingBox(a,r,p,m,g,y,x,I,e),a=x,r=I}}let[n,i]=this.#c();e[0]=vi(e[0]-n,0,1),e[1]=vi(e[1]-i,0,1),e[2]=vi(e[2]+n,0,1),e[3]=vi(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,n){return e==="stroke-width"?this.#d(n):null}#d(e){let[n,i]=this.#c();this.#l=e;let[s,a]=this.#c(),[r,l]=[s-n,a-i],c=this.#e;return c[0]-=r,c[1]-=l,c[2]+=2*r,c[3]+=2*l,c}updateParentDimensions([e,n],i){let[s,a]=this.#c();this.#s=e,this.#r=n,this.#a=i;let[r,l]=this.#c(),c=r-s,p=l-a,m=this.#e;return m[0]-=c,m[1]-=p,m[2]+=2*c,m[3]+=2*p,m}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(Bt.svgRound).join(" ")}get defaultProperties(){let[e,n]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Bt.svgRound(e)} ${Bt.svgRound(n)}`}}}get rotationTransform(){let[,,e,n]=this.#e,i=0,s=0,a=0,r=0,l=0,c=0;switch(this.#t){case 90:s=n/e,a=-e/n,l=e;break;case 180:i=-1,r=-1,l=e,c=n;break;case 270:s=-n/e,a=e/n,c=n;break;default:return""}return`matrix(${i} ${s} ${a} ${r} ${Bt.svgRound(l)} ${Bt.svgRound(c)})`}getPathResizingSVGProperties([e,n,i,s]){let[a,r]=this.#c(),[l,c,p,m]=this.#e;if(Math.abs(p-a)<=Bt.PRECISION||Math.abs(m-r)<=Bt.PRECISION){let M=e+i/2-(l+p/2),H=n+s/2-(c+m/2);return{path:{"transform-origin":`${Bt.svgRound(e)} ${Bt.svgRound(n)}`,transform:`${this.rotationTransform} translate(${M} ${H})`}}}let g=(i-2*a)/(p-2*a),y=(s-2*r)/(m-2*r),x=p/i,I=m/s;return{path:{"transform-origin":`${Bt.svgRound(l)} ${Bt.svgRound(c)}`,transform:`${this.rotationTransform} scale(${x} ${I}) translate(${Bt.svgRound(a)} ${Bt.svgRound(r)}) scale(${g} ${y}) translate(${Bt.svgRound(-a)} ${Bt.svgRound(-r)})`}}}getPathResizedSVGProperties([e,n,i,s]){let[a,r]=this.#c(),l=this.#e,[c,p,m,g]=l;if(l[0]=e,l[1]=n,l[2]=i,l[3]=s,Math.abs(m-a)<=Bt.PRECISION||Math.abs(g-r)<=Bt.PRECISION){let H=e+i/2-(c+m/2),X=n+s/2-(p+g/2);for(let{line:W,points:Y}of this.#i)Bt._translate(W,H,X,W),Bt._translate(Y,H,X,Y);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Bt.svgRound(e)} ${Bt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let y=(i-2*a)/(m-2*a),x=(s-2*r)/(g-2*r),I=-y*(c+a)+e+a,M=-x*(p+r)+n+r;if(y!==1||x!==1||I!==0||M!==0)for(let{line:H,points:X}of this.#i)Bt._rescale(H,I,M,y,x,H),Bt._rescale(X,I,M,y,x,X);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Bt.svgRound(e)} ${Bt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,n],i){let[s,a]=i,r=this.#e,l=e-r[0],c=n-r[1];if(this.#s===s&&this.#r===a)for(let{line:p,points:m}of this.#i)Bt._translate(p,l,c,p),Bt._translate(m,l,c,m);else{let p=this.#s/s,m=this.#r/a;this.#s=s,this.#r=a;for(let{line:g,points:y}of this.#i)Bt._rescale(g,l,c,p,m,g),Bt._rescale(y,l,c,p,m,y);r[2]*=p,r[3]*=m}return r[0]=e,r[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Bt.svgRound(e)} ${Bt.svgRound(n)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Bt.svgRound(e[0])} ${Bt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class D2 extends E2{constructor(e){super();this._viewParameters=e,super.updateProperties({fill:"none",stroke:Jt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,n){if(e==="stroke-width")n??=this["stroke-width"],n*=this._viewParameters.realScale;super.updateSVGProperty(e,n)}clone(){let e=new D2(this._viewParameters);return e.updateAll(this),e}}class I9 extends Mn{static _type="ink";static _editorType=yn.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"});this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions=new D2(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return en(this,"typesMap",new Map([[Pn.INK_THICKNESS,"stroke-width"],[Pn.INK_COLOR,"stroke"],[Pn.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:e,y:n,box:[,,i,s],rotation:a}){return new EA(e,n,i,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,n,i,s,a,r){return Pd.deserialize(e,n,i,s,a,r)}static async deserialize(e,n,i){let s=null;if(e instanceof j2){let{data:{inkLists:r,rect:l,rotation:c,id:p,color:m,opacity:g,borderStyle:{rawWidth:y},popupRef:x,richText:I,contentsObj:M,creationDate:H,modificationDate:X},parent:{page:{pageNumber:W}}}=e;s=e={annotationType:yn.INK,color:Array.from(m),thickness:y,opacity:g,paths:{points:r},boxes:null,pageIndex:W-1,rect:l.slice(0),rotation:c,annotationElementId:p,id:p,deleted:!1,popupRef:x,richText:I,comment:M?.str||null,creationDate:H,modificationDate:X}}let a=await super.deserialize(e,n,i);if(a._initialData=s,e.comment)a.setCommentData(e);return a}get toolbarButtons(){return this._colorPicker||=new lm(this),[["colorPicker",this._colorPicker]]}get colorType(){return Pn.INK_COLOR}get colorAndOpacityType(){return Pn.INK_COLOR_AND_OPACITY}get opacityType(){return Pn.INK_OPACITY}updateParams(e,n){if(e===Pn.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(n.color,n.opacity);return}super.updateParams(e,n)}static updateDefaultParams(e,n){if(e===Pn.INK_COLOR_AND_OPACITY){super.updateDefaultParams(Pn.INK_COLOR,n.color),super.updateDefaultParams(Pn.INK_OPACITY,n.opacity);return}super.updateDefaultParams(e,n)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:n,parent:i}=this;n.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,n.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;if(!e)return;super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}createDrawingOptions({color:e,thickness:n,opacity:i}){this._drawingOptions=I9.getDefaultDrawingOptions({stroke:Ot.makeHexColor(...e),"stroke-width":n,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":r}}=this,l=Object.assign(super.serialize(e),{color:Jt._colorManager.convert(s),opacity:a,thickness:r,paths:{lines:n,points:i}});if(this.addComment(l),e)return l.isCopy=!0,l;if(this.annotationElementId&&!this.#e(l))return null;return l.id=this.annotationElementId,l}#e(e){let{color:n,thickness:i,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((r,l)=>r!==n[l])||e.thickness!==i||e.opacity!==s||e.pageIndex!==a}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:n,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:n,popup:this.comment}),null}}class f2 extends Pd{toSVGPath(){let e=super.toSVGPath();if(!e.endsWith("Z"))e+="Z";return e}}var Qb=8,Jp=3;class Th{static#e={maxDim:512,sigmaSFactor:0.02,sigmaR:25,kernelSize:16};static#t(e,n,i,s){if(i-=e,s-=n,i===0)return s>0?0:4;if(i===1)return s+6;return 2-s}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#i(e,n,i,s,a,r,l){let c=this.#t(i,s,a,r);for(let p=0;p<8;p++){let m=(-p+c-l+16)%8,g=this.#n[2*m],y=this.#n[2*m+1];if(e[(i+g)*n+(s+y)]!==0)return m}return-1}static#s(e,n,i,s,a,r,l){let c=this.#t(i,s,a,r);for(let p=0;p<8;p++){let m=(p+c+l+16)%8,g=this.#n[2*m],y=this.#n[2*m+1];if(e[(i+g)*n+(s+y)]!==0)return m}return-1}static#r(e,n,i,s){let a=e.length,r=new Int32Array(a);for(let m=0;m<a;m++)r[m]=e[m]<=s?1:0;for(let m=1;m<i-1;m++)r[m*n]=r[m*n+n-1]=0;for(let m=0;m<n;m++)r[m]=r[n*i-1-m]=0;let l=1,c,p=[];for(let m=1;m<i-1;m++){c=1;for(let g=1;g<n-1;g++){let y=m*n+g,x=r[y];if(x===0)continue;let I=m,M=g;if(x===1&&r[y-1]===0)l+=1,M-=1;else if(x>=1&&r[y+1]===0){if(l+=1,M+=1,x>1)c=x}else{if(x!==1)c=Math.abs(x);continue}let H=[g,m],X=M===g+1,W={isHole:X,points:H,id:l,parent:0};p.push(W);let Y;for(let Oe of p)if(Oe.id===c){Y=Oe;break}if(!Y)W.parent=X?c:0;else if(Y.isHole)W.parent=X?Y.parent:c;else W.parent=X?c:Y.parent;let te=this.#i(r,n,m,g,I,M,0);if(te===-1){if(r[y]=-l,r[y]!==1)c=Math.abs(r[y]);continue}let ae=this.#n[2*te],ne=this.#n[2*te+1],oe=m+ae,me=g+ne;I=oe,M=me;let be=m,xe=g;while(!0){let Oe=this.#s(r,n,be,xe,I,M,1);ae=this.#n[2*Oe],ne=this.#n[2*Oe+1];let Fe=be+ae,Ue=xe+ne;H.push(Ue,Fe);let ze=be*n+xe;if(r[ze+1]===0)r[ze]=-l;else if(r[ze]===1)r[ze]=l;if(Fe===m&&Ue===g&&be===oe&&xe===me){if(r[y]!==1)c=Math.abs(r[y]);break}else I=be,M=xe,be=Fe,xe=Ue}}}return p}static#a(e,n,i,s){if(i-n<=4){for(let oe=n;oe<i-2;oe+=2)s.push(e[oe],e[oe+1]);return}let a=e[n],r=e[n+1],l=e[i-4]-a,c=e[i-3]-r,p=Math.hypot(l,c),m=l/p,g=c/p,y=m*r-g*a,x=c/l,I=1/p,M=Math.atan(x),H=Math.cos(M),X=Math.sin(M),W=I*(Math.abs(H)+Math.abs(X)),Y=I*(1-W+W**2),te=Math.max(Math.atan(Math.abs(X+H)*Y),Math.atan(Math.abs(X-H)*Y)),ae=0,ne=n;for(let oe=n+2;oe<i-2;oe+=2){let me=Math.abs(y-m*e[oe+1]+g*e[oe]);if(me>ae)ne=oe,ae=me}if(ae>(p*te)**2)this.#a(e,n,ne+2,s),this.#a(e,ne,i,s);else s.push(a,r)}static#o(e){let n=[],i=e.length;return this.#a(e,0,i,n),n.push(e[i-2],e[i-1]),n.length<=4?null:n}static#l(e,n,i,s,a,r){let l=new Float32Array(r**2),c=-2*s**2,p=r>>1;for(let M=0;M<r;M++){let H=(M-p)**2;for(let X=0;X<r;X++)l[M*r+X]=Math.exp((H+(X-p)**2)/c)}let m=new Float32Array(256),g=-2*a**2;for(let M=0;M<256;M++)m[M]=Math.exp(M**2/g);let y=e.length,x=new Uint8Array(y),I=new Uint32Array(256);for(let M=0;M<i;M++)for(let H=0;H<n;H++){let X=M*n+H,W=e[X],Y=0,te=0;for(let ne=0;ne<r;ne++){let oe=M+ne-p;if(oe<0||oe>=i)continue;for(let me=0;me<r;me++){let be=H+me-p;if(be<0||be>=n)continue;let xe=e[oe*n+be],Oe=l[ne*r+me]*m[Math.abs(xe-W)];Y+=xe*Oe,te+=Oe}}let ae=x[X]=Math.round(Y/te);I[ae]++}return[x,I]}static#c(e){let n=new Uint32Array(256);for(let i of e)n[i]++;return n}static#f(e){let n=e.length,i=new Uint8ClampedArray(n>>2),s=-1/0,a=1/0;for(let l=0,c=i.length;l<c;l++){let p=i[l]=e[l<<2];s=Math.max(s,p),a=Math.min(a,p)}let r=255/(s-a);for(let l=0,c=i.length;l<c;l++)i[l]=(i[l]-a)*r;return i}static#h(e){let n,i=-1/0,s=-1/0,a=e.findIndex((c)=>c!==0),r=a,l=a;for(n=a;n<256;n++){let c=e[n];if(c>i){if(n-r>s)s=n-r,l=n-1;i=c,r=n}}for(n=l-1;n>=0;n--)if(e[n]>e[n+1])break;return n}static#d(e){let n=e,{width:i,height:s}=e,{maxDim:a}=this.#e,r=i,l=s;if(i>a||s>a){let y=i,x=s,I=Math.log2(Math.max(i,s)/a),M=Math.floor(I);I=I===M?M-1:M;for(let X=0;X<I;X++){r=Math.ceil(y/2),l=Math.ceil(x/2);let W=new OffscreenCanvas(r,l);if(W.getContext("2d").drawImage(e,0,0,y,x,0,0,r,l),y=r,x=l,e!==n)e.close();e=W.transferToImageBitmap()}let H=Math.min(a/r,a/l);r=Math.round(r*H),l=Math.round(l*H)}let p=new OffscreenCanvas(r,l).getContext("2d",{willReadFrequently:!0});p.fillStyle="white",p.fillRect(0,0,r,l),p.filter="grayscale(1)",p.drawImage(e,0,0,e.width,e.height,0,0,r,l);let m=p.getImageData(0,0,r,l).data;return[this.#f(m),r,l]}static extractContoursFromText(e,{fontFamily:n,fontStyle:i,fontWeight:s},a,r,l,c){let p=new OffscreenCanvas(1,1),m=p.getContext("2d",{alpha:!1}),g=200,y=m.font=`${i} ${s} ${g}px ${n}`,{actualBoundingBoxLeft:x,actualBoundingBoxRight:I,actualBoundingBoxAscent:M,actualBoundingBoxDescent:H,fontBoundingBoxAscent:X,fontBoundingBoxDescent:W,width:Y}=m.measureText(e),te=1.5,ae=Math.ceil(Math.max(Math.abs(x)+Math.abs(I)||0,Y)*te),ne=Math.ceil(Math.max(Math.abs(M)+Math.abs(H)||g,Math.abs(X)+Math.abs(W)||g)*te);p=new OffscreenCanvas(ae,ne),m=p.getContext("2d",{alpha:!0,willReadFrequently:!0}),m.font=y,m.filter="grayscale(1)",m.fillStyle="white",m.fillRect(0,0,ae,ne),m.fillStyle="black",m.fillText(e,ae*(te-1)/2,ne*(3-te)/2);let oe=this.#f(m.getImageData(0,0,ae,ne).data),me=this.#c(oe),be=this.#h(me),xe=this.#r(oe,ae,ne,be);return this.processDrawnLines({lines:{curves:xe,width:ae,height:ne},pageWidth:a,pageHeight:r,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,n,i,s,a){let[r,l,c]=this.#d(e),[p,m]=this.#l(r,l,c,Math.hypot(l,c)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),g=this.#h(m),y=this.#r(p,l,c,g);return this.processDrawnLines({lines:{curves:y,width:l,height:c},pageWidth:n,pageHeight:i,rotation:s,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:a,mustSmooth:r,areContours:l}){if(s%180!==0)[n,i]=[i,n];let{curves:c,width:p,height:m}=e,g=e.thickness??0,y=[],x=Math.min(n/p,i/m),I=x/n,M=x/i,H=[];for(let{points:W}of c){let Y=r?this.#o(W):W;if(!Y)continue;H.push(Y);let te=Y.length,ae=new Float32Array(te),ne=new Float32Array(3*(te===2?2:te-2));if(y.push({line:ne,points:ae}),te===2){ae[0]=Y[0]*I,ae[1]=Y[1]*M,ne.set([NaN,NaN,NaN,NaN,ae[0],ae[1]],0);continue}let[oe,me,be,xe]=Y;oe*=I,me*=M,be*=I,xe*=M,ae.set([oe,me,be,xe],0),ne.set([NaN,NaN,NaN,NaN,oe,me],0);for(let Oe=4;Oe<te;Oe+=2){let Fe=ae[Oe]=Y[Oe]*I,Ue=ae[Oe+1]=Y[Oe+1]*M;ne.set(Bt.createBezierPoints(oe,me,be,xe,Fe,Ue),(Oe-2)*3),[oe,me,be,xe]=[be,xe,Fe,Ue]}}if(y.length===0)return null;let X=l?new f2:new Pd;return X.build(y,n,i,1,s,l?0:g,a),{outline:X,newCurves:H,areContours:l,thickness:g,width:p,height:m}}static async compressSignature({outlines:e,areContours:n,thickness:i,width:s,height:a}){let r=1/0,l=-1/0,c=0;for(let W of e){c+=W.length;for(let Y=2,te=W.length;Y<te;Y++){let ae=W[Y]-W[Y-2];r=Math.min(r,ae),l=Math.max(l,ae)}}let p;if(r>=-128&&l<=127)p=Int8Array;else if(r>=-32768&&l<=32767)p=Int16Array;else p=Int32Array;let m=e.length,g=Qb+Jp*m,y=new Uint32Array(g),x=0;y[x++]=g*Uint32Array.BYTES_PER_ELEMENT+(c-2*m)*p.BYTES_PER_ELEMENT,y[x++]=0,y[x++]=s,y[x++]=a,y[x++]=n?0:1,y[x++]=Math.max(0,Math.floor(i??0)),y[x++]=m,y[x++]=p.BYTES_PER_ELEMENT;for(let W of e)y[x++]=W.length-2,y[x++]=W[0],y[x++]=W[1];let I=new CompressionStream("deflate-raw"),M=I.writable.getWriter();await M.ready,M.write(y);let H=p.prototype.constructor;for(let W of e){let Y=new H(W.length-2);for(let te=2,ae=W.length;te<ae;te++)Y[te-2]=W[te]-W[te-2];M.write(Y)}return M.close(),(await new Response(I.readable).bytes()).toBase64()}static async decompressSignature(e){try{let n=Uint8Array.fromBase64(e),{readable:i,writable:s}=new DecompressionStream("deflate-raw"),a=s.getWriter();await a.ready,a.write(n).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,l=0;for await(let Y of i)r||=new Uint8Array(new Uint32Array(Y.buffer,0,4)[0]),r.set(Y,l),l+=Y.length;let c=new Uint32Array(r.buffer,0,r.length>>2),p=c[1];if(p!==0)throw Error(`Invalid version: ${p}`);let m=c[2],g=c[3],y=c[4]===0,x=c[5],I=c[6],M=c[7],H=[],X=(Qb+Jp*I)*Uint32Array.BYTES_PER_ELEMENT,W;switch(M){case Int8Array.BYTES_PER_ELEMENT:W=new Int8Array(r.buffer,X);break;case Int16Array.BYTES_PER_ELEMENT:W=new Int16Array(r.buffer,X);break;case Int32Array.BYTES_PER_ELEMENT:W=new Int32Array(r.buffer,X);break}l=0;for(let Y=0;Y<I;Y++){let te=c[Jp*Y+Qb],ae=new Float32Array(te+2);H.push(ae);for(let ne=0;ne<Jp-1;ne++)ae[ne]=c[Jp*Y+Qb+ne+1];for(let ne=0;ne<te;ne++)ae[ne+2]=ae[ne]+W[l++]}return{areContours:y,thickness:x,outlines:H,width:m,height:g}}catch(n){return vn(`decompressSignature: ${n}`),null}}}class M9 extends E2{constructor(){super();super.updateProperties({fill:Jt._defaultLineColor,"stroke-width":0})}clone(){let e=new M9;return e.updateAll(this),e}}class R9 extends D2{constructor(e){super(e);super.updateProperties({stroke:Jt._defaultLineColor,"stroke-width":1})}clone(){let e=new R9(this._viewParameters);return e.updateAll(this),e}}class Jo extends Mn{#e=!1;#t=null;#n=null;#i=null;static _type="signature";static _editorType=yn.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,n){Jt.initialize(e,n),this._defaultDrawingOptions=new M9,this._defaultDrawnSignatureOptions=new R9(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return en(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let n=e.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){if(this._drawId===null)return;super.onScaleChanging()}render(){if(this.div)return this.div;let e,n,{_isCopy:i}=this;if(i)this._isCopy=!1,e=this.x,n=this.y;if(super.render(),this._drawId===null)if(this.#n){let{lines:s,mustSmooth:a,areContours:r,description:l,uuid:c,heightInPage:p}=this.#n,{rawDims:{pageWidth:m,pageHeight:g},rotation:y}=this.parent.viewport,x=Th.processDrawnLines({lines:s,pageWidth:m,pageHeight:g,rotation:y,innerMargin:Jo._INNER_MARGIN,mustSmooth:a,areContours:r});this.addSignature(x,p,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#t||""}));if(i)this._isCopy=!0,this._moveAfterPaste(e,n);return this.div}setUuid(e){this.#i=e,this.addEditToolbar()}getUuid(){return this.#i}get description(){return this.#t}set description(e){if(this.#t=e,!this.div)return;this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then((n)=>{n?.updateEditSignatureButton(e)})}getSignaturePreview(){let{newCurves:e,areContours:n,thickness:i,width:s,height:a}=this.#n,r=Math.max(s,a),l=Th.processDrawnLines({lines:{curves:e.map((c)=>({points:c})),thickness:i,width:s,height:a},pageWidth:r,pageHeight:r,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,n,i,s){let{x:a,y:r}=this,{outline:l}=this.#n=e;this.#e=l instanceof f2,this.description=i;let c;if(this.#e)c=Jo.getDefaultDrawingOptions();else c=Jo._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness});this._addOutlines({drawOutlines:l,drawingOptions:c});let[,p]=this.pageDimensions,m=n/p;if(m=m>=1?0.5:m,this.width*=m/this.height,this.width>=1)m*=0.9/this.width,this.width=0.9;this.height=m,this.setDims(),this.x=a,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Th.process(e,n,i,s,Jo._INNER_MARGIN)}getFromText(e,n){let{rawDims:{pageWidth:i,pageHeight:s},rotation:a}=this.parent.viewport;return Th.extractContoursFromText(e,n,i,s,a,Jo._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Th.processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:Jo._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:n}){if(e)this._drawingOptions=Jo.getDefaultDrawingOptions();else this._drawingOptions=Jo._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n})}serialize(e=!1){if(this.isEmpty())return null;let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:s});if(this.addComment(a),e)a.paths={lines:n,points:i},a.uuid=this.#i,a.isCopy=!0;else a.lines=n;if(this.#t)a.accessibilityData={type:"Figure",alt:this.#t};return a}static deserializeDraw(e,n,i,s,a,r){if(r.areContours)return f2.deserialize(e,n,i,s,a,r);return Pd.deserialize(e,n,i,s,a,r)}static async deserialize(e,n,i){let s=await super.deserialize(e,n,i);return s.#e=e.areContours,s.description=e.accessibilityData?.alt||"",s.#i=e.uuid,s}}class qA extends Jt{#e=null;#t=null;#n=null;#i=null;#s=null;#r="";#a=null;#o=!1;#l=null;#c=!1;#f=!1;static _type="stamp";static _editorType=yn.STAMP;constructor(e){super({...e,name:"stampEditor"});this.#i=e.bitmapUrl,this.#s=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,n){Jt.initialize(e,n)}static isHandlingMimeForPasting(e){return J3.includes(e)}static paste(e,n){n.pasteEditor({mode:yn.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){if(this._uiManager.useNewAltTextFlow)this.div.hidden=!1;super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let n=e.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}#h(e,n=!1){if(!e){this.remove();return}if(this.#e=e.bitmap,!n)this.#t=e.id,this.#c=e.isSvg;if(e.file)this.#r=e.file.name;this.#g()}#d(){if(this.#n=null,this._uiManager.enableWaiting(!1),!this.#a)return;if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}async mlGuessAltText(e=null,n=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:s,width:a,height:r}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:s,width:a,height:r,channels:s.length/(a*r)}});if(!l)throw Error("No response from the AI service.");if(l.error)throw Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw Error("No valid response from the AI service.");let c=l.output;if(await this.setGuessedAltText(c),n&&!this.hasAltTextData())this.altTextData={alt:c,decorative:!1};return c}#m(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then((i)=>this.#h(i,!0)).finally(()=>this.#d());return}if(this.#i){let i=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(i).then((s)=>this.#h(s)).finally(()=>this.#d());return}if(this.#s){let i=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(i).then((s)=>this.#h(s)).finally(()=>this.#d());return}let e=document.createElement("input");e.type="file",e.accept=J3.join(",");let n=this._uiManager._signal;this.#n=new Promise((i)=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(s)}i()},{signal:n}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:n})}).finally(()=>this.#d()),e.click()}remove(){if(this.#t){if(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#a?.remove(),this.#a=null,this.#l)clearTimeout(this.#l),this.#l=null}super.remove()}rebuild(){if(!this.parent){if(this.#t)this.#m();return}if(super.rebuild(),this.div===null)return;if(this.#t&&this.#a===null)this.#m();if(!this.isAttachedToDOM)this.parent.add(this)}onceAdded(e){if(this._isDraggable=!0,e)this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#i||this.#s||this.#t||this.#o)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;if(this._isCopy)e=this.x,n=this.y;if(super.render(),this.div.hidden=!0,this.createAltText(),!this.#o)if(this.#e)this.#g();else this.#m();if(this._isCopy)this._moveAfterPaste(e,n);return this._uiManager.addShouldRescale(this),this.div}setCanvas(e,n){let{id:i,bitmap:s}=this._uiManager.imageManager.getFromCanvas(e,n);if(n.remove(),i&&this._uiManager.imageManager.isValidId(i)){if(this.#t=i,s)this.#e=s;this.#o=!1,this.#g()}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;if(this.#l!==null)clearTimeout(this.#l);let e=200;this.#l=setTimeout(()=>{this.#l=null,this.#p()},e)}#g(){let{div:e}=this,{width:n,height:i}=this.#e,[s,a]=this.pageDimensions,r=0.75;if(this.width)n=this.width*s,i=this.height*a;else if(n>0.75*s||i>0.75*a){let c=Math.min(0.75*s/n,0.75*a/i);n*=c,i*=c}this._uiManager.enableWaiting(!1);let l=this.#a=document.createElement("canvas");if(l.setAttribute("role","img"),this.addContainer(l),this.width=n/s,this.height=i/a,this.setDims(),this._initialOptions?.isCentered)this.center();else this.fixAndSetPosition();if(this._initialOptions=null,!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)e.hidden=!1;if(this.#p(),!this.#f)this.parent.addUndoableEditor(this),this.#f=!0;if(this._reportTelemetry({action:"inserted_image"}),this.#r)this.div.setAttribute("aria-description",this.#r);if(!this.annotationElementId)this._uiManager.a11yAlert(Jt._l10nAlert.stamp)}copyCanvas(e,n,i=!1){e||=224;let{width:s,height:a}=this.#e,r=new co,l=this.#e,c=s,p=a,m=null;if(n){if(s>n||a>n){let ne=Math.min(n/s,n/a);c=Math.floor(s*ne),p=Math.floor(a*ne)}m=document.createElement("canvas");let y=m.width=Math.ceil(c*r.sx),x=m.height=Math.ceil(p*r.sy);if(!this.#c)l=this.#u(y,x);let I=m.getContext("2d");I.filter=this._uiManager.hcmFilter;let M="white",H="#cfcfd8";if(this._uiManager.hcmFilter!=="none")H="black";else if(sT.isDarkMode)M="#8f8f9d",H="#42414d";let X=15,W=X*r.sx,Y=X*r.sy,te=new OffscreenCanvas(W*2,Y*2),ae=te.getContext("2d");ae.fillStyle=M,ae.fillRect(0,0,W*2,Y*2),ae.fillStyle=H,ae.fillRect(0,0,W,Y),ae.fillRect(W,Y,W,Y),I.fillStyle=I.createPattern(te,"repeat"),I.fillRect(0,0,y,x),I.drawImage(l,0,0,l.width,l.height,0,0,y,x)}let g=null;if(i){let y,x;if(r.symmetric&&l.width<e&&l.height<e)y=l.width,x=l.height;else if(l=this.#e,s>e||a>e){let H=Math.min(e/s,e/a);if(y=Math.floor(s*H),x=Math.floor(a*H),!this.#c)l=this.#u(y,x)}let M=new OffscreenCanvas(y,x).getContext("2d",{willReadFrequently:!0});M.drawImage(l,0,0,l.width,l.height,0,0,y,x),g={width:y,height:x,data:M.getImageData(0,0,y,x).data}}return{canvas:m,width:c,height:p,imageData:g}}#u(e,n){let{width:i,height:s}=this.#e,a=i,r=s,l=this.#e;while(a>2*e||r>2*n){let c=a,p=r;if(a>2*e)a=Math.ceil(a/2);if(r>2*n)r=Math.ceil(r/2);let m=new OffscreenCanvas(a,r);m.getContext("2d").drawImage(l,0,0,c,p,0,0,a,r),l=m.transferToImageBitmap()}return l}#p(){let[e,n]=this.parentDimensions,{width:i,height:s}=this,a=new co,r=Math.ceil(i*e*a.sx),l=Math.ceil(s*n*a.sy),c=this.#a;if(!c||c.width===r&&c.height===l)return;c.width=r,c.height=l;let p=this.#c?this.#e:this.#u(r,l),m=c.getContext("2d");m.filter=this._uiManager.hcmFilter,m.drawImage(p,0,0,p.width,p.height,0,0,r,l)}#b(e){if(e){if(this.#c){let s=this._uiManager.imageManager.getSvgUrl(this.#t);if(s)return s}let n=document.createElement("canvas");return{width:n.width,height:n.height}=this.#e,n.getContext("2d").drawImage(this.#e,0,0),n.toDataURL()}if(this.#c){let[n,i]=this.pageDimensions,s=Math.round(this.width*n*Eh.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*Eh.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,a);return r.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,s,a),r.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,n,i){let s=null,a=!1;if(e instanceof A9){let{data:{rect:M,rotation:H,id:X,structParent:W,popupRef:Y,richText:te,contentsObj:ae,creationDate:ne,modificationDate:oe},container:me,parent:{page:{pageNumber:be}},canvas:xe}=e,Oe,Fe;if(xe)delete e.canvas,{id:Oe,bitmap:Fe}=i.imageManager.getFromCanvas(me.id,xe),xe.remove();else a=!0,e._hasNoCanvas=!0;let Ue=(await n._structTree.getAriaAttributes(`pdfjs_internal_id_${X}`))?.get("aria-label")||"";s=e={annotationType:yn.STAMP,bitmapId:Oe,bitmap:Fe,pageIndex:be-1,rect:M.slice(0),rotation:H,annotationElementId:X,id:X,deleted:!1,accessibilityData:{decorative:!1,altText:Ue},isSvg:!1,structParent:W,popupRef:Y,richText:te,comment:ae?.str||null,creationDate:ne,modificationDate:oe}}let r=await super.deserialize(e,n,i),{rect:l,bitmap:c,bitmapUrl:p,bitmapId:m,isSvg:g,accessibilityData:y}=e;if(a)i.addMissingCanvas(e.id,r),r.#o=!0;else if(m&&i.imageManager.isValidId(m)){if(r.#t=m,c)r.#e=c}else r.#i=p;r.#c=g;let[x,I]=r.pageDimensions;if(r.width=(l[2]-l[0])/x,r.height=(l[3]-l[1])/I,y)r.altTextData=y;if(r._initialData=s,e.comment)r.setCommentData(e);return r.#f=!!s,r}serialize(e=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#c});if(this.addComment(i),e)return i.bitmapUrl=this.#b(!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a)i.accessibilityData={type:"Figure",alt:a};if(this.annotationElementId){let l=this.#w(i);if(l.isSame)return null;if(l.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=this._initialData.structParent??-1;return i.id=this.annotationElementId,delete i.bitmapId,i}if(n===null)return i;n.stamps||=new Map;let r=this.#c?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(this.#t))n.stamps.set(this.#t,{area:r,serialized:i}),i.bitmap=this.#b(!1);else if(this.#c){let l=n.stamps.get(this.#t);if(r>l.area)l.area=r,l.serialized.bitmap.close(),l.serialized.bitmap=this.#b(!1)}return i}#w(e){let{pageIndex:n,accessibilityData:{altText:i}}=this._initialData,s=e.pageIndex===n,a=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;return e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class zl{#e;#t=!1;#n=null;#i=null;#s=null;#r=new Map;#a=!1;#o=!1;#l=!1;#c=null;#f=null;#h=null;#d=null;#m=null;#g=-1;#u;static _initialized=!1;static#p=new Map([Os,I9,qA,oo,Jo].map((e)=>[e._editorType,e]));constructor({uiManager:e,pageIndex:n,div:i,structTreeLayer:s,accessibilityManager:a,annotationLayer:r,drawLayer:l,textLayer:c,viewport:p,l10n:m}){let g=[...zl.#p.values()];if(!zl._initialized){zl._initialized=!0;for(let y of g)y.initialize(m,e)}e.registerEditorTypes(g),this.#u=e,this.pageIndex=n,this.div=i,this.#e=a,this.#n=r,this.viewport=p,this.#h=c,this.drawLayer=l,this._structTree=s,this.#u.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===yn.NONE}updateToolbar(e){this.#u.updateToolbar(e)}updateMode(e=this.#u.getMode()){switch(this.#_(),e){case yn.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case yn.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case yn.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle("nonEditing",!1),e===yn.POPUP)n.toggle("commentEditing",!0);else{n.toggle("commentEditing",!1);for(let i of zl.#p.values())n.toggle(`${i._type}Editing`,e===i._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#h?.div}setEditingState(e){this.#u.setEditingState(e)}addCommands(e){this.#u.addCommands(e)}cleanUndoStack(e){this.#u.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#b(){return this.#r.size!==0?this.#r.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#l=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#m?.abort(),this.#m=null;let e=new Set;for(let i of this.#b)if(i.enableEditing(),i.show(!0),i.annotationElementId)this.#u.removeChangedExistingAnnotation(i),e.add(i.annotationElementId);let n=this.#n;if(n)for(let i of n.getEditableAnnotations()){if(i.hide(),this.#u.isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;let s=await this.deserialize(i);if(!s)continue;this.addOrRebuild(s),s.enableEditing()}this.#l=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#m){this.#m=new AbortController;let s=this.#u.combinedSignal(this.#m);this.#h.div.addEventListener("pointerdown",(a)=>{let{clientX:l,clientY:c,timeStamp:p}=a,m=this.#g;if(p-m>500){this.#g=p;return}this.#g=-1;let{classList:g}=this.div;g.toggle("getElements",!0);let y=document.elementsFromPoint(l,c);if(g.toggle("getElements",!1),!this.div.contains(y[0]))return;let x,I=new RegExp("^pdfjs_internal_editor_[0-9]+$");for(let H of y)if(I.test(H.id)){x=H.id;break}if(!x)return;let M=this.#r.get(x);if(M?.annotationElementId===null)gs(a),M.dblclick(a)},{signal:s,capture:!0})}let e=this.#n,n=[];if(e){let s=new Map,a=new Map;for(let r of this.#b){if(r.disableEditing(),!r.annotationElementId){n.push(r);continue}if(r.serialize()!==null){s.set(r.annotationElementId,r);continue}else a.set(r.annotationElementId,r);this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()}for(let r of e.getEditableAnnotations()){let{id:l}=r.data;if(this.#u.isDeletedAnnotationElement(l)){r.updateEdited({deleted:!0});continue}let c=a.get(l);if(c){c.resetAnnotationElement(r),c.show(!1),r.show();continue}if(c=s.get(l),c){if(this.#u.addChangedExistingAnnotation(c),c.renderAnnotationElement(r))c.show(!1)}r.show()}}if(this.#_(),this.isEmpty)this.div.hidden=!0;let{classList:i}=this.div;for(let s of zl.#p.values())i.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e?.updateFakeAnnotations(n),this.#o=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){if(this.#u.getActive()===e)return;this.#u.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#d){this.#d=new AbortController;let e=this.#u.combinedSignal(this.#d);this.#h.div.addEventListener("pointerdown",this.#w.bind(this),{signal:e}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){if(this.div.tabIndex=0,this.#h?.div&&this.#d)this.#d.abort(),this.#d=null,this.#h.div.classList.remove("highlighting")}#w(e){this.#u.unselectAll();let{target:n}=e;if(n===this.#h.div||(n.getAttribute("role")==="img"||n.classList.contains("endOfContent")||n.classList.contains("textLayerImages")||n.classList.contains("textLayerImagePlaceholder"))&&this.#h.div.contains(n)){let{isMac:i}=si.platform;if(e.button!==0||e.ctrlKey&&i)return;this.#u.showAllEditors("highlight",!0,!0),oo.startDrawing(this,this.#u,this.#u.direction==="ltr",e),e.preventDefault()}}enableClick(){if(this.#i)return;this.#i=new AbortController;let e=this.#u.combinedSignal(this.#i);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});let n=this.pointerup.bind(this);this.div.addEventListener("pointerup",n,{signal:e}),this.div.addEventListener("pointercancel",n,{signal:e})}disableClick(){this.#i?.abort(),this.#i=null}attach(e){this.#r.set(e.id,e);let{annotationElementId:n}=e;if(n&&this.#u.isDeletedAnnotationElement(n))this.#u.removeDeletedAnnotationElement(e)}detach(e){if(this.#r.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#o&&e.annotationElementId)this.#u.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#u.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){if(e.parent===this)return;if(e.parent&&e.annotationElementId)this.#u.addDeletedAnnotationElement(e),Jt.deleteAnnotationElement(e),e.annotationElementId=null;if(this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM)e.div.remove(),this.div.append(e.div)}add(e){if(e.parent===this&&e.isAttachedToDOM)return;if(this.changeParent(e),this.#u.addEditor(e),this.attach(e),!e.isAttachedToDOM){let n=e.render();this.div.append(n),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#l),this.#u.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:n}=document;if(e.div.contains(n)&&!this.#s)e._focusEventsAllowed=!1,this.#s=setTimeout(()=>{if(this.#s=null,!e.div.contains(document.activeElement))e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#u._signal}),n.focus();else e._focusEventsAllowed=!0},0);e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){if(e.needsToBeRebuilt())e.parent||=this,e.rebuild(),e.show();else this.add(e)}addUndoableEditor(e){let n=()=>e._uiManager.rebuild(e),i=()=>{e.remove()};this.addCommands({cmd:n,undo:i,mustExec:!1})}getEditorByUID(e){for(let n of this.#r.values())if(n.uid===e)return n;return null}get#y(){return zl.#p.get(this.#u.getMode())}combinedSignal(e){return this.#u.combinedSignal(e)}#v(e){let n=this.#y;return n?new n.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,n){this.updateToolbar(e),await this.#u.updateMode(e.mode);let{offsetX:i,offsetY:s}=this.#x(),a=this.#u.getId(),r=this.#v({parent:this,id:a,x:i,y:s,uiManager:this.#u,isCentered:!0,...n});if(r)this.add(r)}async deserialize(e){return await zl.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#u)||null}createAndAddNewEditor(e,n,i={}){let s=this.#u.getId(),a=this.#v({parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:this.#u,isCentered:n,...i});if(a)this.add(a);return a}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:n,width:i,height:s}=this.boundingClientRect,a=Math.max(0,e),r=Math.max(0,n),l=Math.min(window.innerWidth,e+i),c=Math.min(window.innerHeight,n+s),p=(a+l)/2-e,m=(r+c)/2-n,[g,y]=this.viewport.rotation%180===0?[p,m]:[m,p];return{offsetX:g,offsetY:y}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#u.setSelected(e)}toggleSelected(e){this.#u.toggleSelected(e)}unselect(e){this.#u.unselect(e)}pointerup(e){let{isMac:n}=si.platform;if(e.button!==0||e.ctrlKey&&n)return;if(e.target!==this.div)return;if(!this.#a)return;if(this.#a=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings)return;if(!this.#t){this.#t=!0;return}let i=this.#u.getMode();if(i===yn.STAMP||i===yn.POPUP||i===yn.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#u.getMode()===yn.HIGHLIGHT)this.enableTextSelection();if(this.#a){this.#a=!1;return}let{isMac:n}=si.platform;if(e.button!==0||e.ctrlKey&&n)return;if(e.target!==this.div)return;if(this.#a=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let i=this.#u.getActive();this.#t=!i||i.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#c){this.#y.startDrawing(this,this.#u,!1,e);return}this.#u.setCurrentDrawingSession(this),this.#c=new AbortController;let n=this.#u.combinedSignal(this.#c);this.div.addEventListener("blur",({relatedTarget:i})=>{if(i&&!this.div.contains(i))this.#f=null,this.commitOrRemove()},{signal:n}),this.#y.startDrawing(this,this.#u,!1,e)}pause(e){if(e){let{activeElement:n}=document;if(this.div.contains(n))this.#f=n;return}if(this.#f)setTimeout(()=>{this.#f?.focus(),this.#f=null},0)}endDrawingSession(e=!1){if(!this.#c)return null;return this.#u.setCurrentDrawingSession(null),this.#c.abort(),this.#c=null,this.#f=null,this.#y.endDrawing(e)}findNewParent(e,n,i){let s=this.#u.findParent(n,i);if(s===null||s===this)return!1;return s.changeParent(e),!0}commitOrRemove(){if(this.#c)return this.endDrawingSession(),!0;return!1}onScaleChanging(){if(!this.#c)return;this.#y.onScaleChangingWhenDrawing(this)}destroy(){if(this.commitOrRemove(),this.#u.getActive()?.parent===this)this.#u.commitOrRemove(),this.#u.setActiveEditor(null);if(this.#s)clearTimeout(this.#s),this.#s=null;for(let e of this.#r.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#r.clear(),this.#u.removeLayer(this)}#_(){for(let e of this.#r.values())if(e.isEmpty())e.remove()}async render({viewport:e}){this.viewport=e,qh(this.div,e);for(let n of this.#u.getEditors(this.pageIndex))this.add(n),n.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#u.commitOrRemove(),this.#_();let n=this.viewport.rotation,i=e.rotation;if(this.viewport=e,qh(this.div,{rotation:i}),n!==i)for(let s of this.#r.values())s.rotate(i)}get pageDimensions(){let{pageWidth:e,pageHeight:n}=this.viewport.rawDims;return[e,n]}get scale(){return this.#u.viewParameters.realScale}}function CL(e,n){if(e===n)return 0;return e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Jb(e){if(!e)return null;if(e.nodeType===Node.ELEMENT_NODE)return e.closest(".textLayer");return e.parentElement?.closest(".textLayer")||null}function jL(e,n,i,s){if(e===i)return n<=s;let a=e.compareDocumentPosition(i);if(a&Node.DOCUMENT_POSITION_FOLLOWING)return!0;if(a&Node.DOCUMENT_POSITION_PRECEDING)return!1;return null}function Zk(e,n,i){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains("textLayer")||n!==e.childNodes.length)return{container:e,offset:n};let s=e.lastChild;if(s?.nodeType===Node.ELEMENT_NODE&&s.classList.contains("endOfContent"))s=s.previousSibling;if(!s||!i.contains(s))return null;if(s.nodeType===Node.TEXT_NODE)return{container:s,offset:s.textContent.length};return{container:s,offset:s.childNodes.length}}class dn{#e=null;#t=new Map;#n=null;#i=null;#s=null;#r=null;#a=new Map;static#o=0;static#l=0;static#c=null;static#f=new Set;static#h=!1;static#d=new Set;static#m=new WeakMap;constructor({filterFactory:e=null,pageColors:n=null,pageIndex:i,textLayer:s=null}){if(this.pageIndex=i,this.#i=e,this.#s=n,s){let a=dn.#m.get(s);if(a?.selectionDiv)a.selectionDiv.remove(),dn.#f.delete(a.selectionDiv);if(dn.#m.set(s,{drawLayer:this}),dn.#d.add(s),this.#n=s,this.#r=new MutationObserver((r)=>{if(!this.#e||!this.#n?.isConnected||!dn.#u())return;for(let{addedNodes:l}of r)for(let c of l)if(c.nodeType===Node.ELEMENT_NODE&&c.classList.contains("endOfContent")){dn.#b();return}}),this.#r.observe(s,{childList:!0}),dn.#c===null){dn.#c=new AbortController;let{signal:r}=dn.#c;document.addEventListener("selectionchange",dn.#b.bind(dn),{signal:r}),document.addEventListener("pointerdown",()=>{dn.#h=!0},{signal:r}),document.addEventListener("pointerup",()=>{dn.#h=!1},{signal:r}),window.addEventListener("blur",()=>{dn.#h=!1},{signal:r})}}}setParent(e){if(!this.#e){if(this.#e=e,this.#n?.isConnected&&dn.#u())dn.#b();return}if(this.#e!==e){if(this.#t.size>0)for(let n of this.#t.values())n.remove(),e.append(n);this.#e=e}}static#g(e){let n=this.#m.get(e);if(!n?.selectionDiv)return;n.selectionDiv.remove(),this.#f.delete(n.selectionDiv),n.selectionDiv=null,n.path=null}static#u(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#p(){return this.#d.keys().filter((e)=>e.isConnected).toArray().sort(CL)}static#b(){let e=document.getSelection();if(!e||e.isCollapsed){for(let r of this.#f)r.remove();this.#f.clear();return}let n=new WeakMap,i=this.#p(),s=[];for(let r=0,l=e.rangeCount;r<l;r++){let c=e.getRangeAt(r);if(c.collapsed)continue;let{startContainer:p,startOffset:m,endContainer:g,endOffset:y}=c,x=Jb(p),I=Jb(g),M=x===null,H=I===null;if(this.#h&&M!==H)return;if(e.rangeCount===1){let{anchorNode:Y,anchorOffset:te,focusNode:ae,focusOffset:ne}=e,oe=Jb(Y),me=Jb(ae),be=jL(Y,te,ae,ne);if(oe&&me&&be!==null)if(be)p=Y,m=te,x=oe,g=ae,y=ne,I=me;else p=ae,m=ne,x=me,g=Y,y=te,I=oe}let X=i.filter((Y)=>c.intersectsNode(Y));if(X.length===0)continue;let W=!1;if(!x)x=X[0],p=x,m=0,W=!0;if(!I)I=X.at(-1),g=I,y=I.childNodes.length,W=!0;if(g.nodeType===Node.ELEMENT_NODE){if(g.classList.contains("endOfContent")){let Y=g.previousSibling;if(!Y)continue;g=Y,y=Y.nodeType===Node.TEXT_NODE?Y.textContent.length:Y.childNodes.length}else if(g.classList.contains("textLayer")&&g.childNodes.length===y){let Y=Zk(g,y,I);if(!Y)continue;g=Y.container,y=Y.offset}}if(p.nodeType===Node.ELEMENT_NODE){let Y=Zk(p,m,x);if(!Y)continue;p=Y.container,m=Y.offset}if(x===I&&!W&&X.includes(x)){s.push([c,x]);continue}for(let Y of X){let te=Y.firstChild;if(!te)continue;let ae=document.createRange();if(Y===x)ae.setStart(p,m);else ae.setStartBefore(te);if(Y===I)ae.setEnd(g,y);else{let ne=Y.lastChild;if(!ne)continue;if(ne.nodeType===Node.ELEMENT_NODE&&ne.classList.contains("endOfContent")){let oe=ne.previousSibling;if(!oe)continue;ae.setEndAfter(oe)}else ae.setEndAfter(ne)}if(!ae.collapsed)s.push([ae,Y])}}let a=new Set(s.map((r)=>r[1]));for(let r of this.#d)if(!a.has(r))this.#g(r);for(let[r,l]of s){let c=dn.#m.get(l);if(!c)continue;let p=n.get(l);if(!p){let I=l.getBoundingClientRect();p=(M,H,X,W)=>({x:(M-I.x)/I.width,y:(H-I.y)/I.height,width:X/I.width,height:W/I.height}),n.set(l,p)}let m=[];for(let{x:I,y:M,width:H,height:X}of r.getClientRects()){if(H===0||X===0)continue;if({x:I,y:M,width:H,height:X}=p(I,M,H,X),H===1&&X===1)continue;m.push(`M${I} ${M} h${H} v${X} h-${H} Z`)}if(m.length===0)continue;let{drawLayer:g,selectionDiv:y,path:x}=c;if(!y){let I=`clip_selection_${dn.#l++}`;y=document.createElement("div"),y.className="selection",y.style.clipPath=`url(#${I})`;let M=g.#i?.createSelectionStyle(g.#s);if(M)for(let[W,Y]of Object.entries(M))y.style.setProperty(W,Y);let H=dn._svgFactory.create(1,1,!0);H.setAttribute("aria-hidden","true"),H.setAttribute("width","100%"),H.setAttribute("height","100%");let X=dn._svgFactory.createElement("clipPath");X.setAttribute("id",I),X.setAttribute("clipPathUnits","objectBoundingBox"),x=dn._svgFactory.createElement("path"),X.append(x),H.append(X),y.append(H),c.path=x,c.selectionDiv=y}if(g.#e&&y.parentNode!==g.#e)g.#e.append(y),this.#f.add(y);x.setAttribute("d",m.join(" "))}}static get _svgFactory(){return en(this,"_svgFactory",new cm)}static#w(e,[n,i,s,a]){let{style:r}=e;r.top=`${100*i}%`,r.left=`${100*n}%`,r.width=`${100*s}%`,r.height=`${100*a}%`}#y(){let e=dn._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden","true"),e}#v(e,n){let i=dn._svgFactory.createElement("clipPath");e.append(i);let s=`clip_${n}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=dn._svgFactory.createElement("use");return i.append(a),a.setAttribute("href",`#${n}`),a.classList.add("clip"),s}#x(e,n){for(let[i,s]of Object.entries(n))if(s===null)e.removeAttribute(i);else e.setAttribute(i,s)}draw(e,n=!1,i=!1){let s=dn.#o++,a=this.#y(),r=dn._svgFactory.createElement("defs");a.append(r);let l=dn._svgFactory.createElement("path");r.append(l);let c=`path_${s}`;if(l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),n)this.#a.set(s,l);let p=i?this.#v(r,c):null,m=dn._svgFactory.createElement("use");return a.append(m),m.setAttribute("href",`#${c}`),this.updateProperties(a,e),this.#t.set(s,a),{id:s,clipPathId:`url(#${p})`}}drawOutline(e,n){let i=dn.#o++,s=this.#y(),a=dn._svgFactory.createElement("defs");s.append(a);let r=dn._svgFactory.createElement("path");a.append(r);let l=`path_${i}`;r.setAttribute("id",l),r.setAttribute("vector-effect","non-scaling-stroke");let c;if(n){let g=dn._svgFactory.createElement("mask");a.append(g),c=`mask_${i}`,g.setAttribute("id",c),g.setAttribute("maskUnits","objectBoundingBox");let y=dn._svgFactory.createElement("rect");g.append(y),y.setAttribute("width","1"),y.setAttribute("height","1"),y.setAttribute("fill","white");let x=dn._svgFactory.createElement("use");g.append(x),x.setAttribute("href",`#${l}`),x.setAttribute("stroke","none"),x.setAttribute("fill","black"),x.setAttribute("fill-rule","nonzero"),x.classList.add("mask")}let p=dn._svgFactory.createElement("use");if(s.append(p),p.setAttribute("href",`#${l}`),c)p.setAttribute("mask",`url(#${c})`);let m=p.cloneNode();return s.append(m),p.classList.add("mainOutline"),m.classList.add("secondaryOutline"),this.updateProperties(s,e),this.#t.set(i,s),i}finalizeDraw(e,n){this.#a.delete(e),this.updateProperties(e,n)}updateProperties(e,n){if(!n)return;let{root:i,bbox:s,rootClass:a,path:r}=n,l=typeof e==="number"?this.#t.get(e):e;if(!l)return;if(i)this.#x(l,i);if(s)dn.#w(l,s);if(a){let{classList:c}=l;for(let[p,m]of Object.entries(a))c.toggle(p,m)}if(r){let p=l.firstElementChild.firstElementChild;this.#x(p,r)}}updateParent(e,n){if(n===this)return;let i=this.#t.get(e);if(!i)return;n.#e.append(i),this.#t.delete(e),n.#t.set(e,i)}remove(e){if(this.#a.delete(e),this.#e===null)return;this.#t.get(e).remove(),this.#t.delete(e)}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();if(this.#t.clear(),this.#a.clear(),this.#r?.disconnect(),this.#r=null,this.#n){if(dn.#m.get(this.#n)?.drawLayer===this){if(dn.#g(this.#n),dn.#m.delete(this.#n),dn.#d.delete(this.#n),dn.#d.size===0)dn.#c?.abort(),dn.#c=null,dn.#h=!1}this.#n=null}}}function Zb(e){return`${(e*100).toFixed(2)}%`}class d2{#e=[];#t=new Map;#n=null;#i=0;#s=0;#r=0;static#a=null;constructor(e,n,i,s){this.#i=e,this.#e=n,this.#s=i.rawDims.pageWidth,this.#r=i.rawDims.pageHeight,this.#n=s}render(){let e=document.createElement("div");e.className="textLayerImages";for(let n=0;n<this.#e.length;n+=6){let i=this.#o(this.#e.subarray(n,n+6));if(i)e.append(i)}return e.addEventListener("contextmenu",(n)=>{if(!(n.target instanceof HTMLCanvasElement))return;let i=n.target,s=this.#t.get(i);if(!s)return;let a=d2.#a?.deref();if(a===i)return;if(a)a.width=0,a.height=0;d2.#a=new WeakRef(i);let{inverseTransform:r,x1:l,y1:c,width:p,height:m}=s,g=this.#n(),y=Math.ceil(l*g.width),x=Math.ceil(c*g.height),I=Math.floor((l+p/this.#s)*g.width),M=Math.floor((c+m/this.#r)*g.height);i.width=I-y,i.height=M-x;let H=i.getContext("2d");H.setTransform(...r),H.translate(-y,-x),H.drawImage(g,0,0)}),e}#o([e,n,i,s,a,r]){let l=Math.hypot((a-e)*this.#s,(r-n)*this.#r),c=Math.hypot((i-e)*this.#s,(s-n)*this.#r);if(l<this.#i||c<this.#i)return null;let p=[(a-e)*this.#s/l,(r-n)*this.#r/l,(i-e)*this.#s/c,(s-n)*this.#r/c,0,0],m=Ot.inverseTransform(p),g=document.createElement("canvas");return g.className="textLayerImagePlaceholder",g.width=0,g.height=0,Object.assign(g.style,{opacity:0,position:"absolute",left:Zb(e),top:Zb(n),width:Zb(l/this.#s),height:Zb(c/this.#r),transformOrigin:"0% 0%",transform:`matrix(${p.join(",")})`}),this.#t.set(g,{inverseTransform:m,width:l,height:c,x1:e,y1:n}),g}}globalThis._pdfjsTestingUtils={HighlightOutliner:u2};globalThis.pdfjsLib={AbortException:Xl,AnnotationEditorLayer:zl,AnnotationEditorParamsType:Pn,AnnotationEditorType:yn,AnnotationEditorUIManager:au,AnnotationLayer:j9,AnnotationMode:su,AnnotationType:Ni,applyOpacity:WB,build:kL,ColorPicker:Gr,createValidAbsoluteUrl:eT,CSSConstants:aT,DOMSVGFactory:cm,DrawLayer:dn,FeatureTest:si,fetchData:l9,findContrastColor:KB,getDocument:y9,getFilenameFromUrl:GB,getPdfFilenameFromUrl:VB,getRGB:fm,getRGBA:hm,getUuid:iT,GlobalWorkerOptions:Vl,ImageKind:e2,InvalidPDFException:a2,isDataScheme:y2,isPdfFile:c9,isValidExplicitDest:tL,makeArr:Nd,makeMap:r9,makeObj:Y3,makeSet:HB,MathClamp:vi,noContextMenu:lo,normalizeUnicode:BB,OPS:Zo,OutputScale:co,PasswordException:s2,PasswordResponses:MB,PDFDataRangeTransport:S9,PDFDateString:r2,PDFWorker:Xs,PermissionFlag:IB,PixelsPerInch:Eh,RenderingCancelledException:w2,renderRichText:rT,ResponseException:im,setLayerDimensions:qh,shadow:en,SignatureExtractor:Th,stopEvent:gs,SupportedImageMimeTypes:J3,TextLayer:xa,TextLayerImages:d2,TouchManager:f9,updateUrlHash:tT,Util:Ot,VerbosityLevel:p2,version:xL,XfaLayer:o9};C();function DA({currentPage:e,totalPages:n,onPageChange:i,zoom:s,onZoomIn:a,onZoomOut:r,onFit:l,onDownload:c,canDownload:p,allowDownload:m=!0}){return o("div",{className:"relative px-2 py-2 sm:px-4 sm:py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-between gap-1.5 sm:gap-2 transition-colors duration-200 shrink-0",children:[o("div",{className:"flex items-center gap-1 sm:gap-1.5 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5 shrink-0",children:[t("button",{onClick:()=>i(Math.max(1,e-1)),disabled:e<=1,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors disabled:opacity-40",title:Nf(),children:t(jr,{size:16})}),o("span",{className:"px-1 sm:px-2 text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none whitespace-nowrap",children:[t("span",{className:"hidden sm:inline",children:kx({current:e,total:n||1})}),o("span",{className:"inline sm:hidden",children:[e,"/",n||1]})]}),t("button",{onClick:()=>i(Math.min(n,e+1)),disabled:e>=n,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors disabled:opacity-40",title:Rw(),children:t(ft,{size:16})})]}),o("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[o("div",{className:"flex items-center gap-0.5 sm:gap-1 bg-gray-200/50 dark:bg-white/10 rounded-md p-0.5",children:[t("button",{onClick:r,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:mp(),children:t(ls,{size:16})}),o("span",{className:"w-10 sm:w-12 text-center text-xs font-mono font-medium text-gray-900 dark:text-gray-100 select-none",children:[Math.round(s*100),"%"]}),t("button",{onClick:a,className:"p-1 sm:p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors",title:pp(),children:t(de,{size:16})})]}),t("button",{onClick:l,className:"text-xs font-medium px-2 py-1 sm:px-3 sm:py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent",children:uf()}),m&&o("button",{onClick:c,disabled:!p,className:"flex items-center gap-1 text-xs font-medium px-2 py-1 sm:px-3 sm:py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50",title:u_(),children:[t(vt,{size:14}),t("span",{className:"hidden sm:inline",children:dr()})]})]})]})}var Bd="./pdf.worker.min-vf48er29.mjs";var DL=32000000,IA=16;if(typeof window<"u"&&Vl)try{let e=typeof Bd==="string"?Bd.startsWith("/")?Bd:"/"+Bd.replace(/^\.\//,""):Bd;if(typeof e==="string")Vl.workerSrc=e}catch{}var IL=D(({file:e,annotations:n,shareId:i,children:s,onPlay:a,onPause:r,onTimeUpdate:l,startTime:c,allowDownload:p},m)=>{let{isDrawing:g,currentTool:y,currentColor:x,addAnnotation:I,annotations:M}=Wr(),[H,X]=u(null),[W,Y]=u(()=>c&&!isNaN(c)?Math.max(1,Math.round(c)):1),[te,ae]=u(1),[ne,oe]=u(null),[me,be]=u({width:800,height:1000}),[xe,Oe]=u(2),Fe=v(null),[Ue,ze]=u(!0),[Le,qe]=u(null);tn(m,()=>({play:()=>{a?.()},pause:()=>{r?.()},seekTo:(zt)=>{if(zt&&!isNaN(zt)){let Yt=Math.max(1,Math.min(te,Math.round(zt)));Y(Yt)}}}),[te,a,r]),h(()=>{l?.(W)},[W,l]),h(()=>{let zt=(Yt)=>{let ln=document.activeElement;if(ln&&(ln.tagName==="INPUT"||ln.tagName==="TEXTAREA"||ln instanceof HTMLElement&&ln.isContentEditable))return;if(Yt.key==="ArrowRight"||Yt.key==="ArrowDown"||Yt.key==="PageDown")Yt.preventDefault(),Y((bn)=>{let ri=Math.min(te,bn+1);if(ri!==bn)a?.();return ri});else if(Yt.key==="ArrowLeft"||Yt.key==="ArrowUp"||Yt.key==="PageUp")Yt.preventDefault(),Y((bn)=>{let ri=Math.max(1,bn-1);if(ri!==bn)a?.();return ri});else if(Yt.key==="Home")Yt.preventDefault(),Y(1),a?.();else if(Yt.key==="End")Yt.preventDefault(),Y(te),a?.()};return window.addEventListener("keydown",zt),()=>{window.removeEventListener("keydown",zt)}},[te,a]);let[Me,yt]=u({width:0,height:0}),[Ge,Qe]=u(1),[jt,ut]=u({x:0,y:0}),[st,bt]=u(!1);h(()=>{bt(!1)},[e.id]);let Wt=v(null);h(()=>{let zt=Wt.current;if(!zt)return;let Yt=new ResizeObserver((ln)=>{let bn=ln[0];if(bn)yt({width:bn.contentRect.width,height:bn.contentRect.height})});return Yt.observe(zt),()=>Yt.disconnect()},[]);let un=e.media?.pdfTranscode?.url;h(()=>{if(!un){qe("No PDF URL available"),ze(!1);return}let zt=!0;ze(!0),qe(null);let Yt=y9({url:un});return Yt.promise.then((ln)=>{if(!zt)return;X(ln),ae(ln.numPages),Y((bn)=>c&&!isNaN(c)?Math.max(1,Math.min(ln.numPages,Math.round(c))):bn),ze(!1)}).catch((ln)=>{if(!zt)return;console.error("Failed to load PDF:",ln),qe("Failed to load PDF document"),ze(!1)}),()=>{zt=!1,Yt.destroy().catch(()=>{})}},[un,c]),h(()=>{if(!H)return;let zt=!0,Yt=null;return H.getPage(W).then((ln)=>{if(!zt)return;let bn=ln.getViewport({scale:1}),ri=ln.getViewport({scale:xe}),fn=document.createElement("canvas");fn.width=ri.width,fn.height=ri.height;let Si=fn.getContext("2d");if(!Si)return;if(Yt=ln.render({canvasContext:Si,viewport:ri,canvas:fn}),!zt){Yt.cancel();return}Yt.promise.then(()=>{if(!zt)return;oe(fn),be({width:bn.width,height:bn.height})}).catch((En)=>{if(!zt||En&&typeof En==="object"&&"name"in En&&En.name==="RenderingCancelledException")return;console.error("Failed to render page:",En)})}).catch((ln)=>{if(!zt)return;console.error("Failed to get page:",ln)}),()=>{if(zt=!1,Yt)Yt.cancel()}},[H,W,xe]),h(()=>{let zt=window.setTimeout(()=>{let Yt=typeof window<"u"?window.devicePixelRatio||1:1,ln=me.width*me.height,bn=ln>0?Math.sqrt(DL/ln):IA,ri=Math.min(Math.max(0.5,Ge*Yt),bn,IA);Oe(ri)},150);return()=>window.clearTimeout(zt)},[Ge,me]),h(()=>{let zt=Fe.current;if(!H||!zt)return;let Yt=!0,ln=null;return zt.innerHTML="",H.getPage(W).then((bn)=>{if(!Yt)return;ln=new xa({textContentSource:bn.streamTextContent(),container:zt,viewport:bn.getViewport({scale:1})}),ln.render().catch(()=>{})}).catch((bn)=>{if(!Yt)return;console.error("Failed to build text layer:",bn)}),()=>{Yt=!1,ln?.cancel()}},[H,W]),h(()=>{let zt=Fe.current;if(!zt)return;zt.style.transform=`translate(${jt.x}px, ${jt.y}px) scale(${Ge})`},[jt,Ge]);let{width:nn,height:Zt}=Me,{width:Rn,height:Jn}=me,Bi=nu(nn,Zt,Rn,Jn);h(()=>{if(nn<=0||Zt<=0||Rn<=0||Jn<=0)return;if(st)return;Qe(Bi),ut(Hl(nn,Zt,Rn,Jn,Bi))},[nn,Zt,Bi,Rn,Jn,st]);let ai=(zt)=>{bt(!0);let Yt=Ul(Ge,jt,zt,nn/2,Zt/2);Qe(Yt.zoom),ut(Yt.pan)},Ai=()=>{bt(!1),Qe(Bi),ut(Hl(nn,Zt,Rn,Jn,Bi))};Dd({containerRef:Wt,zoom:Ge,pan:jt,baseScale:Bi,onZoomChange:(zt)=>{bt(!0),Qe(zt.zoom),ut(zt.pan)},onPanChange:ut});let Ks=async()=>{let zt=e.media?.original?.key;if(!zt||!e.id)return;try{let Yt=i?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:i,fileId:e.id},json:{key:zt}}):await A.api.files["download-url"].$post({json:{key:zt,assetId:e.id}});if(!Yt.ok)return;let{url:ln}=await Yt.json(),bn=document.createElement("a");bn.href=ln,bn.download=e.name||"document.pdf",document.body.appendChild(bn),bn.click(),document.body.removeChild(bn)}catch{}},Ki=[...n||[],...M];return o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[s,o("div",{ref:Wt,className:"flex-1 relative overflow-hidden touch-none",children:[Ue?t("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 z-20",children:t("div",{className:"w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):Le?t("div",{className:"absolute inset-0 flex items-center justify-center text-gray-500 text-sm",children:Le}):t($o,{width:nn,height:Zt,mediaDimensions:me,canvasElement:ne,annotations:Ki,scale:Ge,offset:jt,className:"absolute inset-0 z-0",isDrawing:g,currentTool:y,currentColor:x,onAddAnnotation:I}),t("div",{ref:Fe,className:"pdf-text-layer",onMouseDown:(zt)=>{if(zt.target instanceof HTMLElement&&zt.target.tagName!=="SPAN")window.getSelection()?.removeAllRanges()},style:{transform:`translate(${jt.x}px, ${jt.y}px) scale(${Ge})`,transformOrigin:"0 0",pointerEvents:g?"none":"auto"}})]})]}),t(DA,{currentPage:W,totalPages:te,onPageChange:(zt)=>{Y(zt),a?.()},zoom:Ge,onZoomIn:()=>ai(1.2),onZoomOut:()=>ai(0.8),onFit:Ai,onDownload:Ks,canDownload:!!e.media?.original?.key,allowDownload:p})]})}),MA=IL;var RA={id:"pdf",name:"PDF",match:(e)=>e.proxyType==="pdf",viewer:MA,commentsConfig:{hasTimestamp:!0,hasAnnotations:!0,formatTimestamp:(e)=>`P${Math.round(e)}`}};C();var ML=D(({file:e,shareId:n,children:i,allowDownload:s=!0},a)=>(tn(a,()=>({play:()=>{},pause:()=>{},seekTo:()=>{}})),o("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative",children:[o("div",{className:"flex-1 flex flex-col-reverse md:flex-row min-h-0 relative",children:[i,t("div",{className:"flex-1 flex items-center justify-center",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})})]}),t("div",{className:"relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200",children:s&&o("button",{onClick:async()=>{let l=e.media?.original?.key;if(!l||!e.id)return;try{let c=n?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:n,fileId:e.id},json:{key:l}}):await A.api.files["download-url"].$post({json:{key:l,assetId:e.id}});if(!c.ok)return;let{url:p}=await c.json(),m=document.createElement("a");m.href=p,m.download="",document.body.appendChild(m),m.click(),document.body.removeChild(m)}catch{}},disabled:!e.media?.original?.key,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200",title:"Download original file",children:[t(vt,{size:14}),"Download"]})})]}))),OA=ML;var O9={id:"default",name:"Default",match:()=>!0,viewer:OA,commentsConfig:{hasTimestamp:!1,hasAnnotations:!1}};var RL=[RA,xk,Ak];function Xo(e){if(!e)return O9;return RL.find((i)=>i.match(e))||O9}function is({teamId:e,projectId:n,file:i,onSaveField:s,members:a,onCommentSelect:r,hideAnnotationControl:l=!1,readOnly:c=!1,publicFields:p,isPublic:m=!1,shareId:g,currentTime:y,onTyping:x,selectedCommentId:I}){let{canEdit:M}=Rt(n),{fields:H,setFields:X}=Rr(),W=Q(),{ref:Y,inView:te}=Tt(),[ae,ne]=u(null),[oe,me]=u(!1),[be,xe]=u(null),{data:Oe}=L({queryKey:["fields",n],queryFn:async()=>{let st=await A.api.projects[":projectId"].fields.$get({param:{projectId:n}});if(!st.ok)throw Error("Failed to fetch fields");return await st.json()},enabled:!!n&&!p}),Fe=Xo(i);h(()=>{if(p)X(p,n);else if(Oe)X(Oe,n)},[Oe,p,n,X]);let{data:Ue,fetchNextPage:ze,hasNextPage:Le}=ct({queryKey:m?["shares",g,"files",i?.id,"comments"]:["files",i?.id,"comments"],queryFn:async({pageParam:st})=>{if(m){let bt=localStorage.getItem(`share_pwd_${g}`)||"",Wt=await A.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:g,fileId:i.id},query:{after:st}},{headers:{"x-share-password":bt}});if(!Wt.ok)throw Error("Failed to fetch comments");return await Wt.json()}else{let bt=await A.api.files[":fileId"].comments.$get({param:{fileId:i.id},query:{after:st}});if(!bt.ok)throw Error("Failed to fetch comments");return await bt.json()}},enabled:!!i?.id&&(!m||!!g),initialPageParam:"",refetchInterval:2000,getNextPageParam:(st)=>st.pageInfo?.cursor||void 0}),{mutate:qe}=U({mutationFn:async({text:st,attachmentIds:bt,annotations:Wt,replyToId:un,guestUserId:nn,second:Zt})=>{if(m){let Rn=localStorage.getItem(`share_pwd_${g}`)||"",Jn=await A.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:g,fileId:i.id},json:{message:st,attachmentIds:bt,replyToId:un??void 0,annotations:Wt,second:Zt??void 0}},{headers:{"x-share-password":Rn,...nn?{"x-guest-user-id":nn}:{}}});if(!Jn.ok)throw Error("Failed to create comment");return await Jn.json()}else{let Rn=await A.api.files[":fileId"].comments.$post({param:{fileId:i.id},json:{message:st,attachmentIds:bt,replyToId:un??void 0,annotations:Wt,second:Zt??void 0}});if(!Rn.ok)throw Error("Failed to create comment");return await Rn.json()}},onSuccess:()=>{W.invalidateQueries({queryKey:m?["shares",g,"files",i?.id,"comments"]:["files",i?.id,"comments"]})}});h(()=>{if(te&&Le)ze()},[te,ze,Le]);let Me=O(()=>(i?.fieldValues||[]).reduce((st,bt)=>(st[bt.fieldId]=bt,st),{}),[i?.fieldValues]),yt=O(()=>[...H].sort((st,bt)=>{let Wt=st.config?.name?.toLowerCase()||"",un=bt.config?.name?.toLowerCase()||"";if(Wt<un)return-1;if(Wt>un)return 1;return 0}),[H]),Ge=Ue?.pages.flatMap((st)=>st.data??[])??[],Qe=async(st,bt,Wt,un,nn)=>{if(!i?.id)return;if(m){console.log("[handleSendMessage] checking auth status");let Zt=await A.api.me.$get(),{id:Rn}=await Zt.json();if(console.log("[handleSendMessage] loggedInUserId:",Rn),!Rn){let Jn=localStorage.getItem("guest_user_id");if(console.log("[handleSendMessage] guestUserId from storage:",Jn),!Jn){console.log("[handleSendMessage] no guest ID, opening popup"),xe({text:st,attachmentIds:bt,annotations:Wt,replyToId:un,second:nn}),me(!0);return}qe({text:st,attachmentIds:bt,annotations:Wt,replyToId:un,guestUserId:Jn,second:nn})}else qe({text:st,attachmentIds:bt,annotations:Wt,replyToId:un,second:nn})}else qe({text:st,attachmentIds:bt,annotations:Wt,replyToId:un,second:nn});ne(null)},jt=(st)=>{if(console.log("[handleGuestSuccess] guestUserId:",st),be)qe({...be,guestUserId:st}),xe(null),ne(null)},ut=(st)=>{let bt=a.find((Wt)=>Wt.id===st);if(bt)return bt;return{id:"unknown",name:"Unknown",role:"unknown"}};if(!i)return t("div",{className:"flex h-full items-center justify-center p-8 text-center bg-background",children:o("div",{className:"space-y-2",children:[t("p",{className:"text-sm font-medium text-foreground",children:Fw()}),t("p",{className:"text-xs text-muted-foreground",children:IC()})]})});return t("div",{className:"bg-background h-full flex flex-col overflow-hidden",children:o(uo,{defaultValue:"comments",className:"p-1 flex-1 flex flex-col px-2 min-h-0",children:[o(fo,{className:"w-full shrink-0",children:[t(Hr,{value:"comments",className:"flex-1",children:Lu()}),t(Hr,{value:"fields",className:"flex-1",children:fi()})]}),o(_n,{value:"comments",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-0",children:[t(se,{className:"flex-1 min-h-0 [&>div>div]:block!",children:o("div",{className:"space-y-4",children:[Ge.map((st)=>o("div",{children:[t(xi,{teamId:e,message:st,getUser:ut,onReply:ne,hasReplies:!!st.replies?.length,formatTimestamp:Fe?.commentsConfig?.formatTimestamp,frameRate:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,isSelected:I===st.id,onSelect:()=>{r?.(st)}}),st.replies?.map((bt,Wt)=>t("div",{children:t(xi,{teamId:e,isReply:!0,message:bt,getUser:ut,onReply:ne,hasReplies:!1,isLastReply:Wt===(st.replies?.length??0)-1,formatTimestamp:Fe?.commentsConfig?.formatTimestamp,frameRate:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,isSelected:I===bt.id,onSelect:()=>{r?.(bt)}})},bt.id))]},st.id)),t("div",{ref:Y})]})}),(!c||m)&&t("div",{className:"mt-4 shrink-0",children:t(Bc,{isOpen:oe,onClose:()=>me(!1),onSuccess:jt,children:t(Sa,{projectId:n,onSendMessage:Qe,replyingTo:ae,onCancelReply:()=>ne(null),hideAnnotationControl:l,disableMentions:m,currentTime:Fe?.commentsConfig?.hasTimestamp?y:void 0,formatTimestamp:Fe?.commentsConfig?.formatTimestamp,frameRate:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.frameRate||30:void 0,startTimecode:Fe?.commentsConfig?.hasTimestamp?i?.media?.metadata?.startTimecode:void 0,onTyping:x})})})]}),t(_n,{value:"fields",className:"flex-1 flex flex-col overflow-hidden min-h-0 mt-4",children:t(se,{className:"flex-1 px-4 min-h-0 [&>div>div]:block!",children:yt&&yt.length>0&&t("div",{className:"space-y-4 pb-4",children:yt.map((st)=>o("div",{className:"space-y-1",children:[t("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:st.config?.name}),t("div",{className:"min-h-[28px]",children:t(ra,{fieldId:st.id,config:st.config,value:Me[st.id]?.value,onSave:M?(bt)=>s(st.id,bt):void 0,readOnly:c||st.readOnly||!M})})]},st.id))})})})]})})}
|
|
299
|
+
export{as,ss,Zc,Cl,Lc,Xo,xi,Bc,is};
|